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
@SuppressWarnings("unchecked") public <T extends Component> T getComponent(final Class<T> componentInterface) { final Component component = this.componentMap.get(componentInterface); boolean _equals = Objects.equal(component, null); if (_equals) { String _simpleName = componentInterface.getSimpleName(); String _plus = ("Unknown component:" + _simpleName); throw new IllegalArgumentException(_plus); } return ((T) component); }
@SuppressWarnings(STR) <T extends Component> T function(final Class<T> componentInterface) { final Component component = this.componentMap.get(componentInterface); boolean _equals = Objects.equal(component, null); if (_equals) { String _simpleName = componentInterface.getSimpleName(); String _plus = (STR + _simpleName); throw new IllegalArgumentException(_plus); } return ((T) component); }
/** * Gets the implementation for a given interface. * * @param <T> the generic type * @param componentInterface the component interface * @return the component */
Gets the implementation for a given interface
getComponent
{ "repo_name": "CymricNPG/abattle", "path": "ABattle.Common/xtend-gen/net/npg/abattle/common/component/ComponentLookup.java", "license": "apache-2.0", "size": 8541 }
[ "com.google.common.base.Objects", "net.npg.abattle.common.component.Component" ]
import com.google.common.base.Objects; import net.npg.abattle.common.component.Component;
import com.google.common.base.*; import net.npg.abattle.common.component.*;
[ "com.google.common", "net.npg.abattle" ]
com.google.common; net.npg.abattle;
2,563,969
// return UserRegistForm.class.equals(clazz); return UserRegistForm.class.isAssignableFrom(clazz); }
return UserRegistForm.class.isAssignableFrom(clazz); }
/** * Validate supported classes. */
Validate supported classes
supports
{ "repo_name": "d-saitou/Spring4MvcExample", "path": "src/main/java/com/example/springmvc/application/di/validator/UserRegistFormValidator.java", "license": "mit", "size": 1042 }
[ "com.example.springmvc.application.form.UserRegistForm" ]
import com.example.springmvc.application.form.UserRegistForm;
import com.example.springmvc.application.form.*;
[ "com.example.springmvc" ]
com.example.springmvc;
413,673
public List<Integer> getNewsFeed(int userId) { if (!tweetsMap.containsKey(userId)) { return new ArrayList<Integer>(); } List<Tweet> tweets = new ArrayList<Tweet>(); HashSet<Integer> followers = followersMap.get(userId); Iterator<Integer> iter = followers.iterator(); while (iter.hasNext()) { tweets.addAll(tweetsMap.get(iter.next())); } Collections.sort(tweets, new Comparator<Tweet>() {
List<Integer> function(int userId) { if (!tweetsMap.containsKey(userId)) { return new ArrayList<Integer>(); } List<Tweet> tweets = new ArrayList<Tweet>(); HashSet<Integer> followers = followersMap.get(userId); Iterator<Integer> iter = followers.iterator(); while (iter.hasNext()) { tweets.addAll(tweetsMap.get(iter.next())); } Collections.sort(tweets, new Comparator<Tweet>() {
/** * Retrieve the 10 most recent tweet ids in the user's news feed. Each item in * the news feed must be posted by users who the user followed or by the user * herself. Tweets must be ordered from most recent to least recent. */
Retrieve the 10 most recent tweet ids in the user's news feed. Each item in the news feed must be posted by users who the user followed or by the user herself. Tweets must be ordered from most recent to least recent
getNewsFeed
{ "repo_name": "darshanhs90/Java-InterviewPrep", "path": "src/DoordashPrep/_0355DesignTwitter.java", "license": "mit", "size": 3967 }
[ "java.util.ArrayList", "java.util.Collections", "java.util.Comparator", "java.util.HashSet", "java.util.Iterator", "java.util.List" ]
import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.Iterator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,823,164
default void setBorderShadowColor(NativeCallback borderShadowColorCallback) { // checks if handler is consistent if (getShadowOptionsHandler() != null) { getShadowOptionsHandler().setBorderShadowColor(borderShadowColorCallback); } }
default void setBorderShadowColor(NativeCallback borderShadowColorCallback) { if (getShadowOptionsHandler() != null) { getShadowOptionsHandler().setBorderShadowColor(borderShadowColorCallback); } }
/** * Sets the callback to set the color of the border shadow of annotation. * * @param borderShadowColorCallback to set the color of the border shadow of annotation */
Sets the callback to set the color of the border shadow of annotation
setBorderShadowColor
{ "repo_name": "pepstock-org/Charba", "path": "src/org/pepstock/charba/client/annotation/HasShadowOptions.java", "license": "apache-2.0", "size": 10392 }
[ "org.pepstock.charba.client.callbacks.NativeCallback" ]
import org.pepstock.charba.client.callbacks.NativeCallback;
import org.pepstock.charba.client.callbacks.*;
[ "org.pepstock.charba" ]
org.pepstock.charba;
2,205,995
protected void parseMatrix() throws ParseException, IOException { current = reader.read(); // Parse 'atrix wsp? ( wsp?' if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
void function() throws ParseException, IOException { current = reader.read(); if (current != 'a') { reportCharacterExpectedError( 'a', current ); skipTransform(); return; } current = reader.read(); if (current != 't') { reportCharacterExpectedError( 't', current ); skipTransform(); return; } current = reader.read(); if (current != 'r') { reportCharacterExpectedError( 'r', current ); skipTransform(); return; } current = reader.read(); if (current != 'i') { reportCharacterExpectedError( 'i', current ); skipTransform(); return; } current = reader.read(); if (current != 'x') { reportCharacterExpectedError( 'x', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); if (current != '(') { reportCharacterExpectedError( '(', current ); skipTransform(); return; } current = reader.read(); skipSpaces(); float a = parseFloat(); skipCommaSpaces(); float b = parseFloat(); skipCommaSpaces(); float c = parseFloat(); skipCommaSpaces(); float d = parseFloat(); skipCommaSpaces(); float e = parseFloat(); skipCommaSpaces(); float f = parseFloat(); skipSpaces(); if (current != ')') { reportCharacterExpectedError( ')', current ); skipTransform(); return; } fragmentIdentifierHandler.matrix(a, b, c, d, e, f); }
/** * Parses a matrix transform. 'm' is assumed to be the current character. */
Parses a matrix transform. 'm' is assumed to be the current character
parseMatrix
{ "repo_name": "Squeegee/batik", "path": "sources/org/apache/batik/parser/FragmentIdentifierParser.java", "license": "apache-2.0", "size": 47964 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,630,408
final LabelComboBox dbPositionChoice = new LabelComboBox(); dbPositionChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(BorderPos.INTO.toString()); label.setIcon(LResources.INNER_ICON); dbPositionChoice.addItem(label); label = new JLabel(BorderPos.OUT.toString()); label.setIcon(LResources.OUTER_ICON); dbPositionChoice.addItem(label); label = new JLabel(BorderPos.MID.toString()); label.setIcon(LResources.MIDDLE_ICON); dbPositionChoice.addItem(label); return dbPositionChoice; }
final LabelComboBox dbPositionChoice = new LabelComboBox(); dbPositionChoice.setRenderer(new LabelListCellRenderer()); JLabel label = new JLabel(BorderPos.INTO.toString()); label.setIcon(LResources.INNER_ICON); dbPositionChoice.addItem(label); label = new JLabel(BorderPos.OUT.toString()); label.setIcon(LResources.OUTER_ICON); dbPositionChoice.addItem(label); label = new JLabel(BorderPos.MID.toString()); label.setIcon(LResources.MIDDLE_ICON); dbPositionChoice.addItem(label); return dbPositionChoice; }
/** * Creates a list of the different positions of the borders. * @return The created list. */
Creates a list of the different positions of the borders
createBordersPositionChoice
{ "repo_name": "arnobl/latexdraw-mutants", "path": "GUImutants/original/net.sf.latexdraw/src/main/net/sf/latexdraw/instruments/ShapeBorderCustomiser.java", "license": "gpl-2.0", "size": 17084 }
[ "javax.swing.JLabel", "net.sf.latexdraw.glib.models.interfaces.IShape", "net.sf.latexdraw.ui.LabelComboBox", "net.sf.latexdraw.ui.LabelListCellRenderer", "net.sf.latexdraw.util.LResources" ]
import javax.swing.JLabel; import net.sf.latexdraw.glib.models.interfaces.IShape; import net.sf.latexdraw.ui.LabelComboBox; import net.sf.latexdraw.ui.LabelListCellRenderer; import net.sf.latexdraw.util.LResources;
import javax.swing.*; import net.sf.latexdraw.glib.models.interfaces.*; import net.sf.latexdraw.ui.*; import net.sf.latexdraw.util.*;
[ "javax.swing", "net.sf.latexdraw" ]
javax.swing; net.sf.latexdraw;
778,220
public Date getDate() { return date; }
Date function() { return date; }
/** * Returns the date. * * @return the date */
Returns the date
getDate
{ "repo_name": "jenkinsci/analysis-runner", "path": "src/main/java/edu/hm/hafner/MissingDeprecated.java", "license": "mit", "size": 1477 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
2,223,108
Destination destination = createDestination("foo.bar"); Connection connection = createConnection(); connection.start(); Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer1 = consumerSession.createConsumer(destination); consumer1.setMessageListener(this); MessageConsumer consumer2 = consumerSession.createConsumer(destination); try { consumer2.receive(10); fail("Did not receive expected exception."); } catch (JMSException e) { assertTrue(e instanceof IllegalStateException); } }
Destination destination = createDestination(STR); Connection connection = createConnection(); connection.start(); Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer1 = consumerSession.createConsumer(destination); consumer1.setMessageListener(this); MessageConsumer consumer2 = consumerSession.createConsumer(destination); try { consumer2.receive(10); fail(STR); } catch (JMSException e) { assertTrue(e instanceof IllegalStateException); } }
/** * test following condition- which are defined by JMS Spec 1.1: * MessageConsumers cannot use a MessageListener and receive() from the same * session * * @throws Exception */
test following condition- which are defined by JMS Spec 1.1: MessageConsumers cannot use a MessageListener and receive() from the same session
testDoChangeSessionDeliveryMode
{ "repo_name": "ryanemerson/activemq-artemis", "path": "tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ChangeSessionDeliveryModeTest.java", "license": "apache-2.0", "size": 2251 }
[ "javax.jms.Connection", "javax.jms.Destination", "javax.jms.IllegalStateException", "javax.jms.JMSException", "javax.jms.MessageConsumer", "javax.jms.Session" ]
import javax.jms.Connection; import javax.jms.Destination; import javax.jms.IllegalStateException; import javax.jms.JMSException; import javax.jms.MessageConsumer; import javax.jms.Session;
import javax.jms.*;
[ "javax.jms" ]
javax.jms;
448,249
@Test public void perJobYarnClusterWithParallelism() throws IOException { LOG.info("Starting perJobYarnClusterWithParallelism()"); // write log messages to stdout as well, so that the runWithArgs() method // is catching the log output addTestAppender(CliFrontend.class, Level.INFO); File exampleJarLocation = getTestJarPath("BatchWordCount.jar"); runWithArgs(new String[]{"run", "-p", "2", //test that the job is executed with a DOP of 2 "-m", "yarn-cluster", "-yj", flinkUberjar.getAbsolutePath(), "-yt", flinkLibFolder.getAbsolutePath(), "-yt", flinkShadedHadoopDir.getAbsolutePath(), "-yn", "1", "-ys", "2", "-yjm", "768m", "-ytm", "1024m", exampleJarLocation.getAbsolutePath()}, "Program execution finished", new String[]{"DataSink \\(.*\\) \\(1/1\\) switched to FINISHED"}, RunTypes.CLI_FRONTEND, 0, true); LOG.info("Finished perJobYarnClusterWithParallelism()"); }
void function() throws IOException { LOG.info(STR); addTestAppender(CliFrontend.class, Level.INFO); File exampleJarLocation = getTestJarPath(STR); runWithArgs(new String[]{"run", "-p", "2", "-m", STR, "-yj", flinkUberjar.getAbsolutePath(), "-yt", flinkLibFolder.getAbsolutePath(), "-yt", flinkShadedHadoopDir.getAbsolutePath(), "-yn", "1", "-ys", "2", "-yjm", "768m", "-ytm", "1024m", exampleJarLocation.getAbsolutePath()}, STR, new String[]{STR}, RunTypes.CLI_FRONTEND, 0, true); LOG.info(STR); }
/** * Test per-job yarn cluster with the parallelism set at the CliFrontend instead of the YARN client. */
Test per-job yarn cluster with the parallelism set at the CliFrontend instead of the YARN client
perJobYarnClusterWithParallelism
{ "repo_name": "ueshin/apache-flink", "path": "flink-yarn-tests/src/test/java/org/apache/flink/yarn/YARNSessionCapacitySchedulerITCase.java", "license": "apache-2.0", "size": 26765 }
[ "java.io.File", "java.io.IOException", "org.apache.flink.client.cli.CliFrontend", "org.apache.flink.yarn.UtilsTest", "org.apache.flink.yarn.util.YarnTestUtils", "org.apache.log4j.Level" ]
import java.io.File; import java.io.IOException; import org.apache.flink.client.cli.CliFrontend; import org.apache.flink.yarn.UtilsTest; import org.apache.flink.yarn.util.YarnTestUtils; import org.apache.log4j.Level;
import java.io.*; import org.apache.flink.client.cli.*; import org.apache.flink.yarn.*; import org.apache.flink.yarn.util.*; import org.apache.log4j.*;
[ "java.io", "org.apache.flink", "org.apache.log4j" ]
java.io; org.apache.flink; org.apache.log4j;
2,594,425
public synchronized void jump(int address) throws IOException { requireValidAddress(address); R.requireThat(isOpen(), "isOpen()").isTrue(); Packet packet = createPacket(6, hi(address), lo(address)); sendPacketGetReply(packet); }
synchronized void function(int address) throws IOException { requireValidAddress(address); R.requireThat(isOpen(), STR).isTrue(); Packet packet = createPacket(6, hi(address), lo(address)); sendPacketGetReply(packet); }
/** * Set PC. * * @param address address */
Set PC
jump
{ "repo_name": "markusheiden/c64dt", "path": "net/src/main/java/de/heiden/c64dt/net/code/C64Connection.java", "license": "gpl-3.0", "size": 5859 }
[ "de.heiden.c64dt.bytes.AddressUtil", "de.heiden.c64dt.bytes.ByteUtil", "de.heiden.c64dt.common.Requirements", "de.heiden.c64dt.net.Packet", "java.io.IOException" ]
import de.heiden.c64dt.bytes.AddressUtil; import de.heiden.c64dt.bytes.ByteUtil; import de.heiden.c64dt.common.Requirements; import de.heiden.c64dt.net.Packet; import java.io.IOException;
import de.heiden.c64dt.bytes.*; import de.heiden.c64dt.common.*; import de.heiden.c64dt.net.*; import java.io.*;
[ "de.heiden.c64dt", "java.io" ]
de.heiden.c64dt; java.io;
468,849
public Uri getTitleUrl() { return getUriAttribute(ATTR_TITLE_URL); }
Uri function() { return getUriAttribute(ATTR_TITLE_URL); }
/** * ModulePrefs@title_url * * User Pref + Message Bundle + Bidi */
ModulePrefs@title_url User Pref + Message Bundle + Bidi
getTitleUrl
{ "repo_name": "hgschmie/shindig", "path": "java/gadgets/src/main/java/org/apache/shindig/gadgets/spec/ModulePrefs.java", "license": "apache-2.0", "size": 16618 }
[ "org.apache.shindig.common.uri.Uri" ]
import org.apache.shindig.common.uri.Uri;
import org.apache.shindig.common.uri.*;
[ "org.apache.shindig" ]
org.apache.shindig;
478,499
private void showProgressBar() { View formView = findViewById(com.capgemini.SalesOrder.R.id.form); formView.setVisibility(View.GONE); View loadingView = findViewById(com.capgemini.SalesOrder.R.id.loading_view); loadingView.setVisibility(View.VISIBLE); }
void function() { View formView = findViewById(com.capgemini.SalesOrder.R.id.form); formView.setVisibility(View.GONE); View loadingView = findViewById(com.capgemini.SalesOrder.R.id.loading_view); loadingView.setVisibility(View.VISIBLE); }
/** * Hides the form view and displays the progress bar */
Hides the form view and displays the progress bar
showProgressBar
{ "repo_name": "liangyaohua/SalesOrder", "path": "src/com/capgemini/SalesOrder/LoginActivity.java", "license": "gpl-2.0", "size": 6486 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,800,071
@NonNull public ByteBuffer getBuffer() { return container.getTensorBuffer().getBuffer(); }
ByteBuffer function() { return container.getTensorBuffer().getBuffer(); }
/** * Returns a ByteBuffer representation of this TensorImage. * * <p>Important: It's only a reference. DO NOT MODIFY. We don't create a copy here for performance * concern, but if modification is necessary, please make a copy. * * <p>It's essentially a short cut for {@code getTensorBuffer().getBuffer()}. * * @return a reference to a ByteBuffer which holds the image data. * @throws IllegalStateException if the TensorImage never loads data. */
Returns a ByteBuffer representation of this TensorImage. Important: It's only a reference. DO NOT MODIFY. We don't create a copy here for performance concern, but if modification is necessary, please make a copy. It's essentially a short cut for getTensorBuffer().getBuffer()
getBuffer
{ "repo_name": "xzturn/tensorflow", "path": "tensorflow/lite/experimental/support/java/src/java/org/tensorflow/lite/support/image/TensorImage.java", "license": "apache-2.0", "size": 12138 }
[ "java.nio.ByteBuffer" ]
import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
494,934
default boolean ifString(Consumer<String> consumer) { if (isString()) { consumer.accept(asString()); return true; } return false; }
default boolean ifString(Consumer<String> consumer) { if (isString()) { consumer.accept(asString()); return true; } return false; }
/** * If a value is a string, invoke the specified consumer with the value, otherwise do nothing. * * @param consumer block to be executed if the value is a string * @return true if the block was called, or false otherwise */
If a value is a string, invoke the specified consumer with the value, otherwise do nothing
ifString
{ "repo_name": "rhauch/debezium-proto", "path": "debezium/src/main/java/org/debezium/message/Value.java", "license": "apache-2.0", "size": 11796 }
[ "java.util.function.Consumer" ]
import java.util.function.Consumer;
import java.util.function.*;
[ "java.util" ]
java.util;
114,986
private void setupLoggerFromProperties(final Properties props) { final String driverLogLevel = PGProperty.LOGGER_LEVEL.get(props); if (driverLogLevel == null) { return; // Don't mess with Logger if not set } if ("OFF".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.OFF); return; // Don't mess with Logger if set to OFF } else if ("DEBUG".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINE); } else if ("TRACE".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINEST); } ExpressionProperties exprProps = new ExpressionProperties(props, System.getProperties()); final String driverLogFile = PGProperty.LOGGER_FILE.get(exprProps); if (driverLogFile != null && driverLogFile.equals(loggerHandlerFile)) { return; // Same file output, do nothing. } for (java.util.logging.Handler handlers : PARENT_LOGGER.getHandlers()) { // Remove previously set Handlers handlers.close(); PARENT_LOGGER.removeHandler(handlers); loggerHandlerFile = null; } java.util.logging.Handler handler = null; if (driverLogFile != null) { try { handler = new java.util.logging.FileHandler(driverLogFile); loggerHandlerFile = driverLogFile; } catch (Exception ex) { System.err.println("Cannot enable FileHandler, fallback to ConsoleHandler."); } } Formatter formatter = new SimpleFormatter(); if ( handler == null ) { if (DriverManager.getLogWriter() != null) { handler = new LogWriterHandler(DriverManager.getLogWriter()); } else if ( DriverManager.getLogStream() != null) { handler = new StreamHandler(DriverManager.getLogStream(), formatter); } else { handler = new ConsoleHandler(); } } else { handler.setFormatter(formatter); } Level loggerLevel = PARENT_LOGGER.getLevel(); if (loggerLevel != null) { handler.setLevel(loggerLevel); } PARENT_LOGGER.setUseParentHandlers(false); PARENT_LOGGER.addHandler(handler); } private static class ConnectThread implements Runnable { ConnectThread(String url, Properties props) { this.url = url; this.props = props; }
void function(final Properties props) { final String driverLogLevel = PGProperty.LOGGER_LEVEL.get(props); if (driverLogLevel == null) { return; } if ("OFF".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.OFF); return; } else if ("DEBUG".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINE); } else if ("TRACE".equalsIgnoreCase(driverLogLevel)) { PARENT_LOGGER.setLevel(Level.FINEST); } ExpressionProperties exprProps = new ExpressionProperties(props, System.getProperties()); final String driverLogFile = PGProperty.LOGGER_FILE.get(exprProps); if (driverLogFile != null && driverLogFile.equals(loggerHandlerFile)) { return; } for (java.util.logging.Handler handlers : PARENT_LOGGER.getHandlers()) { handlers.close(); PARENT_LOGGER.removeHandler(handlers); loggerHandlerFile = null; } java.util.logging.Handler handler = null; if (driverLogFile != null) { try { handler = new java.util.logging.FileHandler(driverLogFile); loggerHandlerFile = driverLogFile; } catch (Exception ex) { System.err.println(STR); } } Formatter formatter = new SimpleFormatter(); if ( handler == null ) { if (DriverManager.getLogWriter() != null) { handler = new LogWriterHandler(DriverManager.getLogWriter()); } else if ( DriverManager.getLogStream() != null) { handler = new StreamHandler(DriverManager.getLogStream(), formatter); } else { handler = new ConsoleHandler(); } } else { handler.setFormatter(formatter); } Level loggerLevel = PARENT_LOGGER.getLevel(); if (loggerLevel != null) { handler.setLevel(loggerLevel); } PARENT_LOGGER.setUseParentHandlers(false); PARENT_LOGGER.addHandler(handler); } private static class ConnectThread implements Runnable { ConnectThread(String url, Properties props) { this.url = url; this.props = props; }
/** * <p>Setup java.util.logging.Logger using connection properties.</p> * * <p>See {@link PGProperty#LOGGER_FILE} and {@link PGProperty#LOGGER_FILE}</p> * * @param props Connection Properties */
Setup java.util.logging.Logger using connection properties. See <code>PGProperty#LOGGER_FILE</code> and <code>PGProperty#LOGGER_FILE</code>
setupLoggerFromProperties
{ "repo_name": "marschall/pgjdbc", "path": "pgjdbc/src/main/java/org/postgresql/Driver.java", "license": "bsd-2-clause", "size": 31089 }
[ "java.sql.DriverManager", "java.util.Properties", "java.util.logging.ConsoleHandler", "java.util.logging.Formatter", "java.util.logging.Level", "java.util.logging.SimpleFormatter", "java.util.logging.StreamHandler", "org.postgresql.util.ExpressionProperties", "org.postgresql.util.LogWriterHandler" ]
import java.sql.DriverManager; import java.util.Properties; import java.util.logging.ConsoleHandler; import java.util.logging.Formatter; import java.util.logging.Level; import java.util.logging.SimpleFormatter; import java.util.logging.StreamHandler; import org.postgresql.util.ExpressionProperties; import org.postgresql.util.LogWriterHandler;
import java.sql.*; import java.util.*; import java.util.logging.*; import org.postgresql.util.*;
[ "java.sql", "java.util", "org.postgresql.util" ]
java.sql; java.util; org.postgresql.util;
1,650,583
private void generateIntermediateApk() throws MojoExecutionException { CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor(); executor.setLogger( this.getLog() ); File[] overlayDirectories = getResourceOverlayDirectories(); File androidJar = getAndroidSdk().getAndroidJar(); File outputFile = new File( targetDirectory, finalName + ".ap_" ); List<File> dependencyArtifactResDirectoryList = new ArrayList<File>(); for ( Artifact libraryArtifact : getTransitiveDependencyArtifacts( APKLIB, AAR ) ) { final File libraryResDir = getUnpackedLibResourceFolder( libraryArtifact ); if ( libraryResDir.exists() ) { dependencyArtifactResDirectoryList.add( libraryResDir ); } } AaptCommandBuilder commandBuilder = AaptCommandBuilder .packageResources( getLog() ) .forceOverwriteExistingFiles() .setPathToAndroidManifest( destinationManifestFile ) .addResourceDirectoriesIfExists( overlayDirectories ) .addResourceDirectoryIfExists( resourceDirectory ) .addResourceDirectoriesIfExists( dependencyArtifactResDirectoryList ) .autoAddOverlay() // NB aapt only accepts a single assets parameter - combinedAssets is a merge of all assets .addRawAssetsDirectoryIfExists( combinedAssets ) .renameManifestPackage( renameManifestPackage ) .renameInstrumentationTargetPackage( renameInstrumentationTargetPackage ) .addExistingPackageToBaseIncludeSet( androidJar ) .setOutputApkFile( outputFile ) .addConfigurations( configurations ) .setVerbose( aaptVerbose ) .setDebugMode( !release ) .addExtraArguments( aaptExtraArgs ); getLog().debug( getAndroidSdk().getAaptPath() + " " + commandBuilder.toString() ); try { executor.setCaptureStdOut( true ); List<String> commands = commandBuilder.build(); executor.executeCommand( getAndroidSdk().getAaptPath(), commands, project.getBasedir(), false ); } catch ( ExecutionException e ) { throw new MojoExecutionException( "", e ); } }
void function() throws MojoExecutionException { CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor(); executor.setLogger( this.getLog() ); File[] overlayDirectories = getResourceOverlayDirectories(); File androidJar = getAndroidSdk().getAndroidJar(); File outputFile = new File( targetDirectory, finalName + ".ap_" ); List<File> dependencyArtifactResDirectoryList = new ArrayList<File>(); for ( Artifact libraryArtifact : getTransitiveDependencyArtifacts( APKLIB, AAR ) ) { final File libraryResDir = getUnpackedLibResourceFolder( libraryArtifact ); if ( libraryResDir.exists() ) { dependencyArtifactResDirectoryList.add( libraryResDir ); } } AaptCommandBuilder commandBuilder = AaptCommandBuilder .packageResources( getLog() ) .forceOverwriteExistingFiles() .setPathToAndroidManifest( destinationManifestFile ) .addResourceDirectoriesIfExists( overlayDirectories ) .addResourceDirectoryIfExists( resourceDirectory ) .addResourceDirectoriesIfExists( dependencyArtifactResDirectoryList ) .autoAddOverlay() .addRawAssetsDirectoryIfExists( combinedAssets ) .renameManifestPackage( renameManifestPackage ) .renameInstrumentationTargetPackage( renameInstrumentationTargetPackage ) .addExistingPackageToBaseIncludeSet( androidJar ) .setOutputApkFile( outputFile ) .addConfigurations( configurations ) .setVerbose( aaptVerbose ) .setDebugMode( !release ) .addExtraArguments( aaptExtraArgs ); getLog().debug( getAndroidSdk().getAaptPath() + " " + commandBuilder.toString() ); try { executor.setCaptureStdOut( true ); List<String> commands = commandBuilder.build(); executor.executeCommand( getAndroidSdk().getAaptPath(), commands, project.getBasedir(), false ); } catch ( ExecutionException e ) { throw new MojoExecutionException( "", e ); } }
/** * Generates an intermediate apk file (actually .ap_) containing the resources and assets. * * @throws MojoExecutionException */
Generates an intermediate apk file (actually .ap_) containing the resources and assets
generateIntermediateApk
{ "repo_name": "kedzie/maven-android-plugin", "path": "src/main/java/com/simpligility/maven/plugins/android/phase09package/ApkMojo.java", "license": "apache-2.0", "size": 41919 }
[ "com.simpligility.maven.plugins.android.CommandExecutor", "com.simpligility.maven.plugins.android.ExecutionException", "com.simpligility.maven.plugins.android.common.AaptCommandBuilder", "java.io.File", "java.util.ArrayList", "java.util.List", "org.apache.maven.artifact.Artifact", "org.apache.maven.pl...
import com.simpligility.maven.plugins.android.CommandExecutor; import com.simpligility.maven.plugins.android.ExecutionException; import com.simpligility.maven.plugins.android.common.AaptCommandBuilder; import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.maven.artifact.Artifact; import org.apache.maven.plugin.MojoExecutionException;
import com.simpligility.maven.plugins.android.*; import com.simpligility.maven.plugins.android.common.*; import java.io.*; import java.util.*; import org.apache.maven.artifact.*; import org.apache.maven.plugin.*;
[ "com.simpligility.maven", "java.io", "java.util", "org.apache.maven" ]
com.simpligility.maven; java.io; java.util; org.apache.maven;
2,133,280
public final Session getRequestSession() throws TechnicalException { LOG.debug("Looking for Hibernate Session in request"); Session result = SessionInView.getSession(Util.getServletRequest()); LOG.debug("Found Hibernate Session in request: " + result); return result; }
final Session function() throws TechnicalException { LOG.debug(STR); Session result = SessionInView.getSession(Util.getServletRequest()); LOG.debug(STR + result); return result; }
/** * Get the Hibernate {@link Session} from {@link SessionInView}. * * @result result != null; * @throws TechnicalException * ; cannot provide Session */
Get the Hibernate <code>Session</code> from <code>SessionInView</code>
getRequestSession
{ "repo_name": "jandppw/ppwcode-recovered-from-google-code", "path": "_purgatory/java/jsf/tags/I-1.0.1-1.0/src/java/be/peopleware/jsf_I/persistence/hibernate/SessionProvider.java", "license": "apache-2.0", "size": 2200 }
[ "be.peopleware.exception_I.TechnicalException", "be.peopleware.jsf_I.Util", "be.peopleware.servlet_I.hibernate.SessionInView", "net.sf.hibernate.Session" ]
import be.peopleware.exception_I.TechnicalException; import be.peopleware.jsf_I.Util; import be.peopleware.servlet_I.hibernate.SessionInView; import net.sf.hibernate.Session;
import be.peopleware.*; import net.sf.hibernate.*;
[ "be.peopleware", "net.sf.hibernate" ]
be.peopleware; net.sf.hibernate;
2,166,471
public void addColumn(final String content) { if (!firstColumn) { out.print(columnSeparator); } out.print(StringUtil.escapeString(content)); firstColumn = false; }
void function(final String content) { if (!firstColumn) { out.print(columnSeparator); } out.print(StringUtil.escapeString(content)); firstColumn = false; }
/** * Adds a text string as a new column in the current line of output, * taking care of escaping as necessary. * * @param content the string to add. */
Adds a text string as a new column in the current line of output, taking care of escaping as necessary
addColumn
{ "repo_name": "gracefullife/gerrit", "path": "gerrit-server/src/main/java/com/google/gerrit/server/ioutil/ColumnFormatter.java", "license": "apache-2.0", "size": 2652 }
[ "com.google.gerrit.server.StringUtil" ]
import com.google.gerrit.server.StringUtil;
import com.google.gerrit.server.*;
[ "com.google.gerrit" ]
com.google.gerrit;
2,647,583
public Observable<ServiceResponse<LoadBalancerInner>> updateTagsWithServiceResponseAsync(String resourceGroupName, String loadBalancerName, Map<String, String> tags) { if (resourceGroupName == null) { throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."); } if (loadBalancerName == null) { throw new IllegalArgumentException("Parameter loadBalancerName is required and cannot be null."); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null."); }
Observable<ServiceResponse<LoadBalancerInner>> function(String resourceGroupName, String loadBalancerName, Map<String, String> tags) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (loadBalancerName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); }
/** * Updates a load balancer tags. * * @param resourceGroupName The name of the resource group. * @param loadBalancerName The name of the load balancer. * @param tags Resource tags. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the observable to the LoadBalancerInner object */
Updates a load balancer tags
updateTagsWithServiceResponseAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/LoadBalancersInner.java", "license": "mit", "size": 68183 }
[ "com.microsoft.rest.ServiceResponse", "java.util.Map" ]
import com.microsoft.rest.ServiceResponse; import java.util.Map;
import com.microsoft.rest.*; import java.util.*;
[ "com.microsoft.rest", "java.util" ]
com.microsoft.rest; java.util;
296,024
@Test public void testT1RV5D3_T1LV1D3() { test_id = getTestId("T1RV5D3", "T1LV1D3", "122"); String src = selectTRVD("T1RV5D3"); String dest = selectTLVD("T1LV1D3"); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(Success, checkResult_Success(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
void function() { test_id = getTestId(STR, STR, "122"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(Success, checkResult_Success(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } }
/** * Perform the test for the given matrix column (T1RV5D3) and row (T1LV1D3). * */
Perform the test for the given matrix column (T1RV5D3) and row (T1LV1D3)
testT1RV5D3_T1LV1D3
{ "repo_name": "jason-rhodes/bridgepoint", "path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_10_Generics.java", "license": "apache-2.0", "size": 160978 }
[ "org.xtuml.bp.ui.graphics.editor.GraphicalEditor" ]
import org.xtuml.bp.ui.graphics.editor.GraphicalEditor;
import org.xtuml.bp.ui.graphics.editor.*;
[ "org.xtuml.bp" ]
org.xtuml.bp;
1,761,750
void synchToPlayer(EntityPlayer player);
void synchToPlayer(EntityPlayer player);
/** * Synchronizes the tracker to the client side. Should be called before opening any gui needing that information. * * @param player */
Synchronizes the tracker to the client side. Should be called before opening any gui needing that information
synchToPlayer
{ "repo_name": "allstar69/Natural-Biomes-2", "path": "common/forestry/api/genetics/IBreedingTracker.java", "license": "gpl-3.0", "size": 2059 }
[ "net.minecraft.entity.player.EntityPlayer" ]
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.*;
[ "net.minecraft.entity" ]
net.minecraft.entity;
2,129,762
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "Joxit/InstitutGalilee", "path": "M2/LEE/devoir_magloire/devoir_magloire-war/src/java/Administration/Deconnexion.java", "license": "gpl-3.0", "size": 2468 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
2,891,382
static public double String2Double(String text) throws ParseException { double zahl = 0.0; DecimalFormat df = new DecimalFormat(); text = text.toUpperCase(); zahl = df.parse(text).doubleValue(); return zahl; }
static double function(String text) throws ParseException { double zahl = 0.0; DecimalFormat df = new DecimalFormat(); text = text.toUpperCase(); zahl = df.parse(text).doubleValue(); return zahl; }
/** * Umwandeln eines Text in einen double Wert (localisiert) * @param text - der Eingabetext * @exception ParseException * @return der double Wert * */
Umwandeln eines Text in einen double Wert (localisiert)
String2Double
{ "repo_name": "a3rosol/LISA", "path": "Planspiel Systemanalyse/src/Client/Console.java", "license": "mit", "size": 9569 }
[ "java.text.DecimalFormat", "java.text.ParseException" ]
import java.text.DecimalFormat; import java.text.ParseException;
import java.text.*;
[ "java.text" ]
java.text;
2,733,370
protected void signRequest(HttpPost postMethod, ByteArrayOutputStream baos) throws Exception { Signature signature = getDigitalSignatureService().getSignatureForSigning(); HttpClientHeaderDigitalSigner signer = new HttpClientHeaderDigitalSigner(signature, postMethod, getJavaSecurityManagementService().getModuleKeyStoreAlias()); signer.getSignature().update(baos.toByteArray()); signer.sign(); }
void function(HttpPost postMethod, ByteArrayOutputStream baos) throws Exception { Signature signature = getDigitalSignatureService().getSignatureForSigning(); HttpClientHeaderDigitalSigner signer = new HttpClientHeaderDigitalSigner(signature, postMethod, getJavaSecurityManagementService().getModuleKeyStoreAlias()); signer.getSignature().update(baos.toByteArray()); signer.sign(); }
/** * Signs the request by adding headers to the PostMethod. */
Signs the request by adding headers to the PostMethod
signRequest
{ "repo_name": "geothomasp/kualico-rice-kc", "path": "rice-middleware/ksb/client-impl/src/main/java/org/kuali/rice/ksb/messaging/KSBHttpInvokerRequestExecutor.java", "license": "apache-2.0", "size": 8201 }
[ "java.io.ByteArrayOutputStream", "java.security.Signature", "org.apache.http.client.methods.HttpPost", "org.kuali.rice.ksb.security.HttpClientHeaderDigitalSigner" ]
import java.io.ByteArrayOutputStream; import java.security.Signature; import org.apache.http.client.methods.HttpPost; import org.kuali.rice.ksb.security.HttpClientHeaderDigitalSigner;
import java.io.*; import java.security.*; import org.apache.http.client.methods.*; import org.kuali.rice.ksb.security.*;
[ "java.io", "java.security", "org.apache.http", "org.kuali.rice" ]
java.io; java.security; org.apache.http; org.kuali.rice;
2,579,284
public void apply() { checkState(delegate != null, "Cannot apply detached config"); delegate.onApply(this); } // Miscellaneous helpers for interacting with JSON
void function() { checkState(delegate != null, STR); delegate.onApply(this); }
/** * Applies any configuration changes made via this configuration. * * Not effective for detached configs. */
Applies any configuration changes made via this configuration. Not effective for detached configs
apply
{ "repo_name": "sonu283304/onos", "path": "core/api/src/main/java/org/onosproject/net/config/Config.java", "license": "apache-2.0", "size": 25806 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
2,199,149
@ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable<AvailableServiceAliasInner> listByResourceGroup(String resourceGroupName, String location) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, location)); }
@ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<AvailableServiceAliasInner> function(String resourceGroupName, String location) { return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, location)); }
/** * Gets all available service aliases for this resource group in this region. * * @param resourceGroupName The name of the resource group. * @param location The location. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return all available service aliases for this resource group in this region. */
Gets all available service aliases for this resource group in this region
listByResourceGroup
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/AvailableServiceAliasesClientImpl.java", "license": "mit", "size": 26127 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.PagedIterable", "com.azure.resourcemanager.network.fluent.models.AvailableServiceAliasInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.network.fluent.models.AvailableServiceAliasInner;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
1,850,803
public Engine.IndexCommitRef acquireLastIndexCommit(boolean flushFirst) throws EngineException { final IndexShardState state = this.state; // one time volatile read // we allow snapshot on closed index shard, since we want to do one after we close the shard and before we close the engine if (state == IndexShardState.STARTED || state == IndexShardState.CLOSED) { return getEngine().acquireLastIndexCommit(flushFirst); } else { throw new IllegalIndexShardStateException(shardId, state, "snapshot is not allowed"); } }
Engine.IndexCommitRef function(boolean flushFirst) throws EngineException { final IndexShardState state = this.state; if (state == IndexShardState.STARTED state == IndexShardState.CLOSED) { return getEngine().acquireLastIndexCommit(flushFirst); } else { throw new IllegalIndexShardStateException(shardId, state, STR); } }
/** * Creates a new {@link IndexCommit} snapshot from the currently running engine. All resources referenced by this * commit won't be freed until the commit / snapshot is closed. * * @param flushFirst <code>true</code> if the index should first be flushed to disk / a low level lucene commit should be executed */
Creates a new <code>IndexCommit</code> snapshot from the currently running engine. All resources referenced by this commit won't be freed until the commit / snapshot is closed
acquireLastIndexCommit
{ "repo_name": "gfyoung/elasticsearch", "path": "server/src/main/java/org/elasticsearch/index/shard/IndexShard.java", "license": "apache-2.0", "size": 137199 }
[ "org.elasticsearch.index.engine.Engine", "org.elasticsearch.index.engine.EngineException" ]
import org.elasticsearch.index.engine.Engine; import org.elasticsearch.index.engine.EngineException;
import org.elasticsearch.index.engine.*;
[ "org.elasticsearch.index" ]
org.elasticsearch.index;
1,212,872
public FieldMatrix<T> outerProduct(SparseFieldVector<T> v) { final int n = v.getDimension(); SparseFieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, n); OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator(); while (iter.hasNext()) { iter.advance(); OpenIntToFieldHashMap<T>.Iterator iter2 = v.entries.iterator(); while (iter2.hasNext()) { iter2.advance(); res.setEntry(iter.key(), iter2.key(), iter.value().multiply(iter2.value())); } } return res; }
FieldMatrix<T> function(SparseFieldVector<T> v) { final int n = v.getDimension(); SparseFieldMatrix<T> res = new SparseFieldMatrix<T>(field, virtualSize, n); OpenIntToFieldHashMap<T>.Iterator iter = entries.iterator(); while (iter.hasNext()) { iter.advance(); OpenIntToFieldHashMap<T>.Iterator iter2 = v.entries.iterator(); while (iter2.hasNext()) { iter2.advance(); res.setEntry(iter.key(), iter2.key(), iter.value().multiply(iter2.value())); } } return res; }
/** * Optimized method to compute outer product when both vectors are sparse. * @param v vector with which outer product should be computed * @return the square matrix outer product between instance and v * @throws DimensionMismatchException * if the dimensions do not match. */
Optimized method to compute outer product when both vectors are sparse
outerProduct
{ "repo_name": "SpoonLabs/astor", "path": "examples/math_50v2/src/main/java/org/apache/commons/math/linear/SparseFieldVector.java", "license": "gpl-2.0", "size": 20416 }
[ "org.apache.commons.math.util.OpenIntToFieldHashMap" ]
import org.apache.commons.math.util.OpenIntToFieldHashMap;
import org.apache.commons.math.util.*;
[ "org.apache.commons" ]
org.apache.commons;
1,403,913
public BtrpOperand go(BtrPlaceTree parent) { append(token, "Unhandled token " + token.getText() + " (type=" + token.getType() + ")"); return IgnorableOperand.getInstance(); }
BtrpOperand function(BtrPlaceTree parent) { append(token, STR + token.getText() + STR + token.getType() + ")"); return IgnorableOperand.getInstance(); }
/** * Parse the root of the tree. * * @param parent the parent of the root * @return a content */
Parse the root of the tree
go
{ "repo_name": "btrplace/scheduler-UCC-15", "path": "btrpsl/src/main/java/org/btrplace/btrpsl/tree/BtrPlaceTree.java", "license": "lgpl-3.0", "size": 3246 }
[ "org.btrplace.btrpsl.element.BtrpOperand", "org.btrplace.btrpsl.element.IgnorableOperand" ]
import org.btrplace.btrpsl.element.BtrpOperand; import org.btrplace.btrpsl.element.IgnorableOperand;
import org.btrplace.btrpsl.element.*;
[ "org.btrplace.btrpsl" ]
org.btrplace.btrpsl;
53,541
@RequestMapping(method = RequestMethod.POST, params = "methodToCall=addAuditErrors") public ModelAndView addAuditErrors(@ModelAttribute("KualiForm") UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) { List<AuditError> auditErrors = new ArrayList<AuditError>(); List<AuditError> auditWarnings = new ArrayList<AuditError>(); Set<String> inputFieldIds = form.getViewPostMetadata().getInputFieldIds(); for (String id : inputFieldIds) { if (form.getViewPostMetadata().getComponentPostData(id, UifConstants.PostMetadata.PATH) != null) { String key = (String) form.getViewPostMetadata().getComponentPostData(id, UifConstants.PostMetadata.PATH); auditErrors.add(new AuditError(key, "error1Test", "link")); auditWarnings.add(new AuditError(key, "warning1Test", "link")); } } auditErrors.add(new AuditError("Demo-ValidationLayout-Section1", "errorSectionTest", "link")); GlobalVariables.getAuditErrorMap().put("A", new AuditCluster("A", auditErrors, KRADConstants.Audit.AUDIT_ERRORS)); GlobalVariables.getAuditErrorMap().put("B", new AuditCluster("B", auditWarnings, KRADConstants.Audit.AUDIT_WARNINGS)); return getModelAndView(form); }
@RequestMapping(method = RequestMethod.POST, params = STR) ModelAndView function(@ModelAttribute(STR) UifFormBase form, BindingResult result, HttpServletRequest request, HttpServletResponse response) { List<AuditError> auditErrors = new ArrayList<AuditError>(); List<AuditError> auditWarnings = new ArrayList<AuditError>(); Set<String> inputFieldIds = form.getViewPostMetadata().getInputFieldIds(); for (String id : inputFieldIds) { if (form.getViewPostMetadata().getComponentPostData(id, UifConstants.PostMetadata.PATH) != null) { String key = (String) form.getViewPostMetadata().getComponentPostData(id, UifConstants.PostMetadata.PATH); auditErrors.add(new AuditError(key, STR, "link")); auditWarnings.add(new AuditError(key, STR, "link")); } } auditErrors.add(new AuditError(STR, STR, "link")); GlobalVariables.getAuditErrorMap().put("A", new AuditCluster("A", auditErrors, KRADConstants.Audit.AUDIT_ERRORS)); GlobalVariables.getAuditErrorMap().put("B", new AuditCluster("B", auditWarnings, KRADConstants.Audit.AUDIT_WARNINGS)); return getModelAndView(form); }
/** * Adds warning and info messages to fields defined in the validationMessageFields array */
Adds warning and info messages to fields defined in the validationMessageFields array
addAuditErrors
{ "repo_name": "ricepanda/rice-git2", "path": "rice-middleware/sampleapp/src/main/java/edu/sampleu/demo/kitchensink/UifComponentsTestController.java", "license": "apache-2.0", "size": 22247 }
[ "java.util.ArrayList", "java.util.List", "java.util.Set", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse", "org.kuali.rice.krad.uif.UifConstants", "org.kuali.rice.krad.util.AuditCluster", "org.kuali.rice.krad.util.AuditError", "org.kuali.rice.krad.util.GlobalVariabl...
import java.util.ArrayList; import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.kuali.rice.krad.uif.UifConstants; import org.kuali.rice.krad.util.AuditCluster; import org.kuali.rice.krad.util.AuditError; import org.kuali.rice.krad.util.GlobalVariables; import org.kuali.rice.krad.util.KRADConstants; import org.kuali.rice.krad.web.form.UifFormBase; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView;
import java.util.*; import javax.servlet.http.*; import org.kuali.rice.krad.uif.*; import org.kuali.rice.krad.util.*; import org.kuali.rice.krad.web.form.*; import org.springframework.validation.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "java.util", "javax.servlet", "org.kuali.rice", "org.springframework.validation", "org.springframework.web" ]
java.util; javax.servlet; org.kuali.rice; org.springframework.validation; org.springframework.web;
1,348,065
public @Nullable SystemDataStreamDescriptor findMatchingDataStreamDescriptor(String name) { final List<SystemDataStreamDescriptor> matchingDescriptors = featureDescriptors.values() .stream() .flatMap(feature -> feature.getDataStreamDescriptors().stream()) .filter(descriptor -> descriptor.getDataStreamName().equals(name)) .collect(toUnmodifiableList()); if (matchingDescriptors.isEmpty()) { return null; } else if (matchingDescriptors.size() == 1) { return matchingDescriptors.get(0); } else { // This should be prevented by failing on overlapping patterns at startup time, but is here just in case. StringBuilder errorMessage = new StringBuilder().append("DataStream name [") .append(name) .append("] is claimed as a system data stream by multiple descriptors: [") .append( matchingDescriptors.stream() .map( descriptor -> "name: [" + descriptor.getDataStreamName() + "], description: [" + descriptor.getDescription() + "]" ) .collect(Collectors.joining("; ")) ); // Throw AssertionError if assertions are enabled, or a regular exception otherwise: assert false : errorMessage.toString(); throw new IllegalStateException(errorMessage.toString()); } }
@Nullable SystemDataStreamDescriptor function(String name) { final List<SystemDataStreamDescriptor> matchingDescriptors = featureDescriptors.values() .stream() .flatMap(feature -> feature.getDataStreamDescriptors().stream()) .filter(descriptor -> descriptor.getDataStreamName().equals(name)) .collect(toUnmodifiableList()); if (matchingDescriptors.isEmpty()) { return null; } else if (matchingDescriptors.size() == 1) { return matchingDescriptors.get(0); } else { StringBuilder errorMessage = new StringBuilder().append(STR) .append(name) .append(STR) .append( matchingDescriptors.stream() .map( descriptor -> STR + descriptor.getDataStreamName() + STR + descriptor.getDescription() + "]" ) .collect(Collectors.joining(STR)) ); assert false : errorMessage.toString(); throw new IllegalStateException(errorMessage.toString()); } }
/** * Finds a single matching {@link SystemDataStreamDescriptor}, if any, for the given DataStream name. * @param name the name of the DataStream * @return The matching {@link SystemDataStreamDescriptor} or {@code null} if no descriptor is found * @throws IllegalStateException if multiple descriptors match the name */
Finds a single matching <code>SystemDataStreamDescriptor</code>, if any, for the given DataStream name
findMatchingDataStreamDescriptor
{ "repo_name": "GlenRSmith/elasticsearch", "path": "server/src/main/java/org/elasticsearch/indices/SystemIndices.java", "license": "apache-2.0", "size": 44485 }
[ "java.util.List", "java.util.stream.Collectors", "org.elasticsearch.core.Nullable" ]
import java.util.List; import java.util.stream.Collectors; import org.elasticsearch.core.Nullable;
import java.util.*; import java.util.stream.*; import org.elasticsearch.core.*;
[ "java.util", "org.elasticsearch.core" ]
java.util; org.elasticsearch.core;
808,073
private void addImportedBundle(Map<Bundle, List<String>> map, ExportedPackage expPackage) { Bundle bnd = expPackage.getExportingBundle(); List<String> packages = map.get(bnd); if (packages == null) { packages = new ArrayList<String>(4); map.put(bnd, packages); } packages.add(new String(expPackage.getName())); }
void function(Map<Bundle, List<String>> map, ExportedPackage expPackage) { Bundle bnd = expPackage.getExportingBundle(); List<String> packages = map.get(bnd); if (packages == null) { packages = new ArrayList<String>(4); map.put(bnd, packages); } packages.add(new String(expPackage.getName())); }
/** * Adds the imported bundle to the map of packages. * * @param map * @param bundle * @param packageName */
Adds the imported bundle to the map of packages
addImportedBundle
{ "repo_name": "kurtharriger/spring-osgi", "path": "io/src/main/java/org/springframework/osgi/io/internal/resolver/PackageAdminResolver.java", "license": "apache-2.0", "size": 6523 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "org.osgi.framework.Bundle", "org.osgi.service.packageadmin.ExportedPackage" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import org.osgi.framework.Bundle; import org.osgi.service.packageadmin.ExportedPackage;
import java.util.*; import org.osgi.framework.*; import org.osgi.service.packageadmin.*;
[ "java.util", "org.osgi.framework", "org.osgi.service" ]
java.util; org.osgi.framework; org.osgi.service;
344,411
public ArrayList<String> getProductFeatures() { if (productFeatures==null) { productFeatures = new ArrayList<>(); productFeatures.add(this.getProductFeatureID()); productFeatures.addAll(this.getImportedFeaturesForFeatureMap().get(this.getProductFeatureID())); productFeatures.addAll(this.getIncludedFeaturesForFeatureMap().get(this.getProductFeatureID())); } return productFeatures; }
ArrayList<String> function() { if (productFeatures==null) { productFeatures = new ArrayList<>(); productFeatures.add(this.getProductFeatureID()); productFeatures.addAll(this.getImportedFeaturesForFeatureMap().get(this.getProductFeatureID())); productFeatures.addAll(this.getIncludedFeaturesForFeatureMap().get(this.getProductFeatureID())); } return productFeatures; }
/** * Returns the list of features that are provided by the product. * @return the product features */
Returns the list of features that are provided by the product
getProductFeatures
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/de.enflexit.common/src/de/enflexit/common/featureEvaluation/FeatureEvaluator.java", "license": "lgpl-2.1", "size": 22592 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
876,834
public String sendBitcoins (String walletPublicKey, UUID FermatTrId, CryptoAddress addressTo, long satoshis) throws InsufficientMoneyException, InvalidSendToAddressException, CouldNotSendMoneyException, CryptoTransactionAlreadySentException;
String function (String walletPublicKey, UUID FermatTrId, CryptoAddress addressTo, long satoshis) throws InsufficientMoneyException, InvalidSendToAddressException, CouldNotSendMoneyException, CryptoTransactionAlreadySentException;
/** * Send bitcoins to the specified address. The Address must be a valid address in the network beeing used * and we must have enought funds to send this money * @param walletPublicKey * @param FermatTrId internal transaction Id - used to validate that it was not send previously. * @param addressTo the valid address we are sending to * @param satoshis the amount in long of satoshis * @return the transaction Hash of the new created transaction in the vault. * @throws InsufficientMoneyException * @throws InvalidSendToAddressException * @throws CouldNotSendMoneyException */
Send bitcoins to the specified address. The Address must be a valid address in the network beeing used and we must have enought funds to send this money
sendBitcoins
{ "repo_name": "fvasquezjatar/fermat-unused", "path": "fermat-cry-api/src/main/java/com/bitdubai/fermat_cry_api/layer/crypto_vault/CryptoVaultManager.java", "license": "mit", "size": 3789 }
[ "com.bitdubai.fermat_api.layer.all_definition.money.CryptoAddress", "com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.CouldNotSendMoneyException", "com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.CryptoTransactionAlreadySentException", "com.bitdubai.fermat_cry_api.layer.crypto_vault.excepti...
import com.bitdubai.fermat_api.layer.all_definition.money.CryptoAddress; import com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.CouldNotSendMoneyException; import com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.CryptoTransactionAlreadySentException; import com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.InsufficientMoneyException; import com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.InvalidSendToAddressException;
import com.bitdubai.fermat_api.layer.all_definition.money.*; import com.bitdubai.fermat_cry_api.layer.crypto_vault.exceptions.*;
[ "com.bitdubai.fermat_api", "com.bitdubai.fermat_cry_api" ]
com.bitdubai.fermat_api; com.bitdubai.fermat_cry_api;
2,916,141
synchronized void disableBlockPoolId(String bpid) { Preconditions.checkNotNull(bpid); for (VolumeScanner scanner : scanners.values()) { scanner.disableBlockPoolId(bpid); } }
synchronized void disableBlockPoolId(String bpid) { Preconditions.checkNotNull(bpid); for (VolumeScanner scanner : scanners.values()) { scanner.disableBlockPoolId(bpid); } }
/** * Disable scanning a given block pool id. * * @param bpid The block pool id to disable scanning for. */
Disable scanning a given block pool id
disableBlockPoolId
{ "repo_name": "ZhangXFeng/hadoop", "path": "src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockScanner.java", "license": "apache-2.0", "size": 12056 }
[ "com.google.common.base.Preconditions" ]
import com.google.common.base.Preconditions;
import com.google.common.base.*;
[ "com.google.common" ]
com.google.common;
1,435,792
NetworkAcl createNetworkAcl(CreateNetworkAclRequest request, ResultCapture<CreateNetworkAclResult> extractor);
NetworkAcl createNetworkAcl(CreateNetworkAclRequest request, ResultCapture<CreateNetworkAclResult> extractor);
/** * Performs the <code>CreateNetworkAcl</code> action and use a ResultCapture * to retrieve the low-level client response. * * <p> * The following request parameters will be populated from the data of this * <code>Vpc</code> resource, and any conflicting parameter value set in the * request will be overridden: * <ul> * <li> * <b><code>VpcId</code></b> * - mapped from the <code>Id</code> identifier. * </li> * </ul> * * <p> * * @return The <code>NetworkAcl</code> resource object associated with the * result of this action. * @see CreateNetworkAclRequest */
Performs the <code>CreateNetworkAcl</code> action and use a ResultCapture to retrieve the low-level client response. The following request parameters will be populated from the data of this <code>Vpc</code> resource, and any conflicting parameter value set in the request will be overridden: <code>VpcId</code> - mapped from the <code>Id</code> identifier.
createNetworkAcl
{ "repo_name": "smartpcr/aws-sdk-java-resources", "path": "aws-resources-ec2/src/main/java/com/amazonaws/resources/ec2/Vpc.java", "license": "apache-2.0", "size": 28564 }
[ "com.amazonaws.resources.ResultCapture", "com.amazonaws.services.ec2.model.CreateNetworkAclRequest", "com.amazonaws.services.ec2.model.CreateNetworkAclResult" ]
import com.amazonaws.resources.ResultCapture; import com.amazonaws.services.ec2.model.CreateNetworkAclRequest; import com.amazonaws.services.ec2.model.CreateNetworkAclResult;
import com.amazonaws.resources.*; import com.amazonaws.services.ec2.model.*;
[ "com.amazonaws.resources", "com.amazonaws.services" ]
com.amazonaws.resources; com.amazonaws.services;
1,921,007
private static String byteToHex(final byte[] hash) { Formatter formatter = new Formatter(); for (byte b : hash) { formatter.format("%02x", b); } String result = formatter.toString(); formatter.close(); return result; }
static String function(final byte[] hash) { Formatter formatter = new Formatter(); for (byte b : hash) { formatter.format("%02x", b); } String result = formatter.toString(); formatter.close(); return result; }
/** * Fonction de conversion byte[] vers String * @param hash * @return */
Fonction de conversion byte[] vers String
byteToHex
{ "repo_name": "jmarginier/smarthouse", "path": "SmartHouseWeb/SmartHouseWeb-ejb/src/main/java/smarthouse/ejb/util/CryptUtil.java", "license": "apache-2.0", "size": 1163 }
[ "java.util.Formatter" ]
import java.util.Formatter;
import java.util.*;
[ "java.util" ]
java.util;
2,106,631
public ArrayList<ModGroup> getModGroups() { ArrayList<ModGroup> groups = new ArrayList<>(); String modGroupFolder = ModManager.getModGroupsFolder(); String[] extensions = new String[] { "txt" }; List<File> files = (List<File>) FileUtils.listFiles(new File(modGroupFolder), extensions, false); for (File file : files) { ModGroup mg = new ModGroup(file.getAbsolutePath()); if (mg.getDescPaths().size() > 0) { groups.add(mg); } else { ModManager.debugLogger.writeMessage("Modgroup has no valid desc paths in it: " + mg.getModGroupName()); } } return groups; }
ArrayList<ModGroup> function() { ArrayList<ModGroup> groups = new ArrayList<>(); String modGroupFolder = ModManager.getModGroupsFolder(); String[] extensions = new String[] { "txt" }; List<File> files = (List<File>) FileUtils.listFiles(new File(modGroupFolder), extensions, false); for (File file : files) { ModGroup mg = new ModGroup(file.getAbsolutePath()); if (mg.getDescPaths().size() > 0) { groups.add(mg); } else { ModManager.debugLogger.writeMessage(STR + mg.getModGroupName()); } } return groups; }
/** * Reads the mod groups list from disk * * @return list of valid modgroups */
Reads the mod groups list from disk
getModGroups
{ "repo_name": "Mgamerz/me3modmanager", "path": "src/com/me3tweaks/modmanager/ModGroupWindow.java", "license": "gpl-3.0", "size": 10272 }
[ "com.me3tweaks.modmanager.objects.ModGroup", "java.io.File", "java.util.ArrayList", "java.util.List", "org.apache.commons.io.FileUtils" ]
import com.me3tweaks.modmanager.objects.ModGroup; import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.FileUtils;
import com.me3tweaks.modmanager.objects.*; import java.io.*; import java.util.*; import org.apache.commons.io.*;
[ "com.me3tweaks.modmanager", "java.io", "java.util", "org.apache.commons" ]
com.me3tweaks.modmanager; java.io; java.util; org.apache.commons;
1,390,016
@Override public void onRename(String oldCatName, String oldDbName, String oldTabName, String oldPartName, String newCatName, String newDbName, String newTabName, String newPartName) throws MetaException { String callSig = "onRename(" + oldCatName + "," + oldDbName + "," + oldTabName + "," + oldPartName + "," + newCatName + "," + newDbName + "," + newTabName + "," + newPartName + ")"; if(newPartName != null) { assert oldPartName != null && oldTabName != null && oldDbName != null && oldCatName != null : callSig; } if(newTabName != null) { assert oldTabName != null && oldDbName != null && oldCatName != null : callSig; } if(newDbName != null) { assert oldDbName != null && oldCatName != null : callSig; } try { Connection dbConn = null; Statement stmt = null; try { dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); stmt = dbConn.createStatement(); List<String> queries = new ArrayList<>(); String update = "UPDATE \"TXN_COMPONENTS\" SET "; String where = " WHERE "; if(oldPartName != null) { update += "\"TC_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"TC_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"TC_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"TC_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"TC_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"TC_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"COMPLETED_TXN_COMPONENTS\" SET "; where = " WHERE "; if(oldPartName != null) { update += "\"CTC_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"CTC_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"CTC_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"CTC_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"CTC_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"CTC_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"HIVE_LOCKS\" SET "; where = " WHERE "; if(oldPartName != null) { update += "\"HL_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"HL_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"HL_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"HL_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"HL_DB\" = " + quoteString(normalizeCase(newDbName)); where += "\"HL_DB\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"COMPACTION_QUEUE\" SET "; where = " WHERE "; if(oldPartName != null) { update += "\"CQ_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"CQ_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"CQ_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"CQ_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"CQ_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"CQ_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"COMPLETED_COMPACTIONS\" SET "; where = " WHERE "; if(oldPartName != null) { update += "\"CC_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"CC_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"CC_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"CC_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"CC_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"CC_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"WRITE_SET\" SET "; where = " WHERE "; if(oldPartName != null) { update += "\"WS_PARTITION\" = " + quoteString(newPartName) + ", "; where += "\"WS_PARTITION\" = " + quoteString(oldPartName) + " AND "; } if(oldTabName != null) { update += "\"WS_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"WS_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"WS_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"WS_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"TXN_TO_WRITE_ID\" SET "; where = " WHERE "; if(oldTabName != null) { update += "\"T2W_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"T2W_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"T2W_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"T2W_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = "UPDATE \"NEXT_WRITE_ID\" SET "; where = " WHERE "; if(oldTabName != null) { update += "\"NWI_TABLE\" = " + quoteString(normalizeCase(newTabName)) + ", "; where += "\"NWI_TABLE\" = " + quoteString(normalizeCase(oldTabName)) + " AND "; } if(oldDbName != null) { update += "\"NWI_DATABASE\" = " + quoteString(normalizeCase(newDbName)); where += "\"NWI_DATABASE\" = " + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); for (String query : queries) { LOG.debug("Going to execute update <" + query + ">"); stmt.executeUpdate(query); } LOG.debug("Going to commit: " + callSig); dbConn.commit(); } catch (SQLException e) { LOG.debug("Going to rollback: " + callSig); rollbackDBConn(dbConn); checkRetryable(dbConn, e, callSig); if (e.getMessage().contains("does not exist")) { LOG.warn("Cannot perform " + callSig + " since metastore table does not exist"); } else { throw new MetaException("Unable to " + callSig + ":" + StringUtils.stringifyException(e)); } } finally { closeStmt(stmt); closeDbConn(dbConn); } } catch (RetryException e) { onRename(oldCatName, oldDbName, oldTabName, oldPartName, newCatName, newDbName, newTabName, newPartName); } }
void function(String oldCatName, String oldDbName, String oldTabName, String oldPartName, String newCatName, String newDbName, String newTabName, String newPartName) throws MetaException { String callSig = STR + oldCatName + "," + oldDbName + "," + oldTabName + "," + oldPartName + "," + newCatName + "," + newDbName + "," + newTabName + "," + newPartName + ")"; if(newPartName != null) { assert oldPartName != null && oldTabName != null && oldDbName != null && oldCatName != null : callSig; } if(newTabName != null) { assert oldTabName != null && oldDbName != null && oldCatName != null : callSig; } if(newDbName != null) { assert oldDbName != null && oldCatName != null : callSig; } try { Connection dbConn = null; Statement stmt = null; try { dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); stmt = dbConn.createStatement(); List<String> queries = new ArrayList<>(); String update = STRTXN_COMPONENTS\STR; String where = STR; if(oldPartName != null) { update += "\"TC_PARTITION\STR + quoteString(newPartName) + STR; where += "\"TC_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"TC_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"TC_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"TC_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"TC_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRCOMPLETED_TXN_COMPONENTS\STR; where = STR; if(oldPartName != null) { update += "\"CTC_PARTITION\STR + quoteString(newPartName) + STR; where += "\"CTC_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"CTC_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"CTC_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"CTC_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"CTC_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRHIVE_LOCKS\STR; where = STR; if(oldPartName != null) { update += "\"HL_PARTITION\STR + quoteString(newPartName) + STR; where += "\"HL_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"HL_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"HL_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"HL_DB\STR + quoteString(normalizeCase(newDbName)); where += "\"HL_DB\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRCOMPACTION_QUEUE\STR; where = STR; if(oldPartName != null) { update += "\"CQ_PARTITION\STR + quoteString(newPartName) + STR; where += "\"CQ_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"CQ_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"CQ_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"CQ_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"CQ_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRCOMPLETED_COMPACTIONS\STR; where = STR; if(oldPartName != null) { update += "\"CC_PARTITION\STR + quoteString(newPartName) + STR; where += "\"CC_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"CC_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"CC_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"CC_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"CC_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRWRITE_SET\STR; where = STR; if(oldPartName != null) { update += "\"WS_PARTITION\STR + quoteString(newPartName) + STR; where += "\"WS_PARTITION\STR + quoteString(oldPartName) + STR; } if(oldTabName != null) { update += "\"WS_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"WS_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"WS_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"WS_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRTXN_TO_WRITE_ID\STR; where = STR; if(oldTabName != null) { update += "\"T2W_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"T2W_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"T2W_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"T2W_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); update = STRNEXT_WRITE_ID\STR; where = STR; if(oldTabName != null) { update += "\"NWI_TABLE\STR + quoteString(normalizeCase(newTabName)) + STR; where += "\"NWI_TABLE\STR + quoteString(normalizeCase(oldTabName)) + STR; } if(oldDbName != null) { update += "\"NWI_DATABASE\STR + quoteString(normalizeCase(newDbName)); where += "\"NWI_DATABASE\STR + quoteString(normalizeCase(oldDbName)); } queries.add(update + where); for (String query : queries) { LOG.debug(STR + query + ">"); stmt.executeUpdate(query); } LOG.debug(STR + callSig); dbConn.commit(); } catch (SQLException e) { LOG.debug(STR + callSig); rollbackDBConn(dbConn); checkRetryable(dbConn, e, callSig); if (e.getMessage().contains(STR)) { LOG.warn(STR + callSig + STR); } else { throw new MetaException(STR + callSig + ":" + StringUtils.stringifyException(e)); } } finally { closeStmt(stmt); closeDbConn(dbConn); } } catch (RetryException e) { onRename(oldCatName, oldDbName, oldTabName, oldPartName, newCatName, newDbName, newTabName, newPartName); } }
/** * Catalog hasn't been added to transactional tables yet, so it's passed in but not used. */
Catalog hasn't been added to transactional tables yet, so it's passed in but not used
onRename
{ "repo_name": "jcamachor/hive", "path": "standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java", "license": "apache-2.0", "size": 263787 }
[ "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.util.StringUtils" ]
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.util.StringUtils;
import java.sql.*; import java.util.*; import org.apache.hadoop.hive.metastore.api.*; import org.apache.hadoop.util.*;
[ "java.sql", "java.util", "org.apache.hadoop" ]
java.sql; java.util; org.apache.hadoop;
962,722
if (size < 1024) { return String.format("%d bytes", size); } else if (size < 1024 * 1024) { return String.format(Locale.ENGLISH, "%.02f KB", 1.0 * size / 1024); } else { return String.format(Locale.ENGLISH, "%.02f MB", 1.0 * size / 1024 / 1024); } }
if (size < 1024) { return String.format(STR, size); } else if (size < 1024 * 1024) { return String.format(Locale.ENGLISH, STR, 1.0 * size / 1024); } else { return String.format(Locale.ENGLISH, STR, 1.0 * size / 1024 / 1024); } }
/** * Creates the section size formatter string depending on the size of the section. * * @param size The size of the section. * * @return The formatter string. */
Creates the section size formatter string depending on the size of the section
toString
{ "repo_name": "tempbottle/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/Gui/Debug/MemorySectionPanel/CMemorySectionWrapper.java", "license": "apache-2.0", "size": 1925 }
[ "java.util.Locale" ]
import java.util.Locale;
import java.util.*;
[ "java.util" ]
java.util;
644,077
public static Map<String, Object> getMapFromMessageBody(ActiveMQMapMessage message) throws JMSException { final HashMap<String, Object> map = new LinkedHashMap<String, Object>(); final Map<String, Object> contentMap = message.getContentMap(); if (contentMap != null) { for (Entry<String, Object> entry : contentMap.entrySet()) { Object value = entry.getValue(); if (value instanceof byte[]) { value = new Binary((byte[]) value); } map.put(entry.getKey(), value); } } return map; }
static Map<String, Object> function(ActiveMQMapMessage message) throws JMSException { final HashMap<String, Object> map = new LinkedHashMap<String, Object>(); final Map<String, Object> contentMap = message.getContentMap(); if (contentMap != null) { for (Entry<String, Object> entry : contentMap.entrySet()) { Object value = entry.getValue(); if (value instanceof byte[]) { value = new Binary((byte[]) value); } map.put(entry.getKey(), value); } } return map; }
/** * Return the underlying Map from the JMS MapMessage instance. * * @param message * the MapMessage whose underlying Map is requested. * * @return the underlying Map used to store the value in the given MapMessage. * * @throws JMSException if an error occurs in constructing or fetching the Map. */
Return the underlying Map from the JMS MapMessage instance
getMapFromMessageBody
{ "repo_name": "chirino/activemq", "path": "activemq-amqp/src/main/java/org/apache/activemq/transport/amqp/message/AmqpMessageSupport.java", "license": "apache-2.0", "size": 13266 }
[ "java.util.HashMap", "java.util.LinkedHashMap", "java.util.Map", "javax.jms.JMSException", "org.apache.activemq.command.ActiveMQMapMessage", "org.apache.qpid.proton.amqp.Binary" ]
import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import javax.jms.JMSException; import org.apache.activemq.command.ActiveMQMapMessage; import org.apache.qpid.proton.amqp.Binary;
import java.util.*; import javax.jms.*; import org.apache.activemq.command.*; import org.apache.qpid.proton.amqp.*;
[ "java.util", "javax.jms", "org.apache.activemq", "org.apache.qpid" ]
java.util; javax.jms; org.apache.activemq; org.apache.qpid;
1,600,543
private static RPropParameterUpdate sum(List<RPropParameterUpdate> updates) { Vector totalUpdate = updates.stream().filter(Objects::nonNull) .map(pu -> VectorUtils.elementWiseTimes(pu.updatesMask().copy(), pu.prevIterationUpdates())) .reduce(Vector::plus).orElse(null); Vector totalDelta = updates.stream().filter(Objects::nonNull) .map(RPropParameterUpdate::deltas).reduce(Vector::plus).orElse(null); Vector totalGradient = updates.stream().filter(Objects::nonNull) .map(RPropParameterUpdate::prevIterationGradient).reduce(Vector::plus).orElse(null); if (totalUpdate != null) return new RPropParameterUpdate(totalUpdate, totalGradient, totalDelta, new DenseVector(Objects.requireNonNull(totalDelta).size()).assign(1.0)); return null; }
static RPropParameterUpdate function(List<RPropParameterUpdate> updates) { Vector totalUpdate = updates.stream().filter(Objects::nonNull) .map(pu -> VectorUtils.elementWiseTimes(pu.updatesMask().copy(), pu.prevIterationUpdates())) .reduce(Vector::plus).orElse(null); Vector totalDelta = updates.stream().filter(Objects::nonNull) .map(RPropParameterUpdate::deltas).reduce(Vector::plus).orElse(null); Vector totalGradient = updates.stream().filter(Objects::nonNull) .map(RPropParameterUpdate::prevIterationGradient).reduce(Vector::plus).orElse(null); if (totalUpdate != null) return new RPropParameterUpdate(totalUpdate, totalGradient, totalDelta, new DenseVector(Objects.requireNonNull(totalDelta).size()).assign(1.0)); return null; }
/** * Sums updates returned by different trainings. * * @param updates Updates. * @return Sum of updates during returned by different trainings. */
Sums updates returned by different trainings
sum
{ "repo_name": "shroman/ignite", "path": "modules/ml/src/main/java/org/apache/ignite/ml/optimization/updatecalculators/RPropParameterUpdate.java", "license": "apache-2.0", "size": 8597 }
[ "java.util.List", "java.util.Objects", "org.apache.ignite.ml.math.primitives.vector.Vector", "org.apache.ignite.ml.math.primitives.vector.VectorUtils", "org.apache.ignite.ml.math.primitives.vector.impl.DenseVector" ]
import java.util.List; import java.util.Objects; import org.apache.ignite.ml.math.primitives.vector.Vector; import org.apache.ignite.ml.math.primitives.vector.VectorUtils; import org.apache.ignite.ml.math.primitives.vector.impl.DenseVector;
import java.util.*; import org.apache.ignite.ml.math.primitives.vector.*; import org.apache.ignite.ml.math.primitives.vector.impl.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,821,402
public Collection operations() { return fOperations.values(); }
Collection function() { return fOperations.values(); }
/** * Returns all operations defined for this class. Inherited * operations are not included. */
Returns all operations defined for this class. Inherited operations are not included
operations
{ "repo_name": "stormymauldin/stuff", "path": "src/main/org/tzi/use/uml/mm/MClass.java", "license": "gpl-2.0", "size": 11956 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,162,738
private void write(S3CheckpointData data) throws IgniteCheckedException, AmazonClientException { assert data != null; if (log.isDebugEnabled()) log.debug("Writing data to S3 [bucket=" + bucketName + ", key=" + data.getKey() + ']'); byte[] buf = data.toBytes(); ObjectMetadata meta = new ObjectMetadata(); meta.setContentLength(buf.length); s3.putObject(bucketName, data.getKey(), new ByteArrayInputStream(buf), meta); }
void function(S3CheckpointData data) throws IgniteCheckedException, AmazonClientException { assert data != null; if (log.isDebugEnabled()) log.debug(STR + bucketName + STR + data.getKey() + ']'); byte[] buf = data.toBytes(); ObjectMetadata meta = new ObjectMetadata(); meta.setContentLength(buf.length); s3.putObject(bucketName, data.getKey(), new ByteArrayInputStream(buf), meta); }
/** * Writes given checkpoint data to a given S3 bucket. Data is serialized to * the binary stream and saved to the S3. * * @param data Checkpoint data. * @throws IgniteCheckedException Thrown if an error occurs while marshalling. * @throws AmazonClientException If an error occurs while querying Amazon S3. */
Writes given checkpoint data to a given S3 bucket. Data is serialized to the binary stream and saved to the S3
write
{ "repo_name": "tkpanther/ignite", "path": "modules/aws/src/main/java/org/apache/ignite/spi/checkpoint/s3/S3CheckpointSpi.java", "license": "apache-2.0", "size": 22662 }
[ "com.amazonaws.AmazonClientException", "com.amazonaws.services.s3.model.ObjectMetadata", "java.io.ByteArrayInputStream", "org.apache.ignite.IgniteCheckedException" ]
import com.amazonaws.AmazonClientException; import com.amazonaws.services.s3.model.ObjectMetadata; import java.io.ByteArrayInputStream; import org.apache.ignite.IgniteCheckedException;
import com.amazonaws.*; import com.amazonaws.services.s3.model.*; import java.io.*; import org.apache.ignite.*;
[ "com.amazonaws", "com.amazonaws.services", "java.io", "org.apache.ignite" ]
com.amazonaws; com.amazonaws.services; java.io; org.apache.ignite;
665,360
void setButtonsTypeface(@Nullable Typeface typeface);
void setButtonsTypeface(@Nullable Typeface typeface);
/** * Sets the typeface for all buttons presented within this view. * * @param typeface The desired typeface to set. */
Sets the typeface for all buttons presented within this view
setButtonsTypeface
{ "repo_name": "albedinsky/android_dialogs", "path": "library/src/core/java/com/albedinsky/android/dialog/view/DialogButtonsView.java", "license": "apache-2.0", "size": 13312 }
[ "android.graphics.Typeface", "android.support.annotation.Nullable" ]
import android.graphics.Typeface; import android.support.annotation.Nullable;
import android.graphics.*; import android.support.annotation.*;
[ "android.graphics", "android.support" ]
android.graphics; android.support;
24,805
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int de =Integer.parseInt(request.getParameter("id")); DeliverDAO dao = new DeliverDAO(); Deliver deliver = (Deliver)dao.query(de); dao.delete(deliver); DeliverDAO dao1 =new DeliverDAO(); List<Object> list=dao1.queryAll(); request.setAttribute("list", list); request.getRequestDispatcher("/web/deliver/company.jsp").forward(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { int de =Integer.parseInt(request.getParameter("id")); DeliverDAO dao = new DeliverDAO(); Deliver deliver = (Deliver)dao.query(de); dao.delete(deliver); DeliverDAO dao1 =new DeliverDAO(); List<Object> list=dao1.queryAll(); request.setAttribute("list", list); request.getRequestDispatcher(STR).forward(request, response); }
/** * The doGet method of the servlet. <br> * * This method is called when a form has its tag value method equals to get. * * @param request the request send by the client to the server * @param response the response send by the server to the client * @throws ServletException if an error occurred * @throws IOException if an error occurred */
The doGet method of the servlet. This method is called when a form has its tag value method equals to get
doGet
{ "repo_name": "zhuxiaocqu/WebStore", "path": "src/com/webstore/servlet/back/delivermanager/deleteDeliver.java", "license": "gpl-2.0", "size": 2239 }
[ "com.webstore.bean.subobject.Deliver", "com.webstore.dao.DeliverDAO", "java.io.IOException", "java.util.List", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import com.webstore.bean.subobject.Deliver; import com.webstore.dao.DeliverDAO; import java.io.IOException; import java.util.List; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import com.webstore.bean.subobject.*; import com.webstore.dao.*; import java.io.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*;
[ "com.webstore.bean", "com.webstore.dao", "java.io", "java.util", "javax.servlet" ]
com.webstore.bean; com.webstore.dao; java.io; java.util; javax.servlet;
2,183,589
Observable<ServiceResponse<Void>> putBigDecimalWithServiceResponseAsync(BigDecimal numberBody);
Observable<ServiceResponse<Void>> putBigDecimalWithServiceResponseAsync(BigDecimal numberBody);
/** * Put big decimal value 2.5976931e+101. * * @param numberBody the BigDecimal value * @throws IllegalArgumentException thrown if parameters fail the validation * @return the {@link ServiceResponse} object if successful. */
Put big decimal value 2.5976931e+101
putBigDecimalWithServiceResponseAsync
{ "repo_name": "sergey-shandar/autorest", "path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/bodynumber/Numbers.java", "license": "mit", "size": 34974 }
[ "com.microsoft.rest.ServiceResponse", "java.math.BigDecimal" ]
import com.microsoft.rest.ServiceResponse; import java.math.BigDecimal;
import com.microsoft.rest.*; import java.math.*;
[ "com.microsoft.rest", "java.math" ]
com.microsoft.rest; java.math;
1,632,902
public QueryRewriteContext getRewriteContext(LongSupplier nowInMillis) { return new QueryRewriteContext(xContentRegistry, client, nowInMillis); }
QueryRewriteContext function(LongSupplier nowInMillis) { return new QueryRewriteContext(xContentRegistry, client, nowInMillis); }
/** * Returns a new {@link QueryRewriteContext} with the given <tt>now</tt> provider */
Returns a new <code>QueryRewriteContext</code> with the given now provider
getRewriteContext
{ "repo_name": "jimczi/elasticsearch", "path": "core/src/main/java/org/elasticsearch/indices/IndicesService.java", "license": "apache-2.0", "size": 62466 }
[ "java.util.function.LongSupplier", "org.elasticsearch.index.query.QueryRewriteContext" ]
import java.util.function.LongSupplier; import org.elasticsearch.index.query.QueryRewriteContext;
import java.util.function.*; import org.elasticsearch.index.query.*;
[ "java.util", "org.elasticsearch.index" ]
java.util; org.elasticsearch.index;
936,183
ChangePlanItemStateBuilder caseVariables(Map<String, Object> caseVariables);
ChangePlanItemStateBuilder caseVariables(Map<String, Object> caseVariables);
/** * Set the case variable that should be set as part of the change plan item state action. */
Set the case variable that should be set as part of the change plan item state action
caseVariables
{ "repo_name": "dbmalkovsky/flowable-engine", "path": "modules/flowable-cmmn-api/src/main/java/org/flowable/cmmn/api/runtime/ChangePlanItemStateBuilder.java", "license": "apache-2.0", "size": 3968 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
1,382,720
public View getMenu() { return mViewBehind.getContent(); }
View function() { return mViewBehind.getContent(); }
/** * Retrieves the main menu. * @return the main menu */
Retrieves the main menu
getMenu
{ "repo_name": "MatejVancik/amaroKontrol", "path": "amaroKontrol_wear/mobile/libs/slidingmenu/src/com/jeremyfeinstein/slidingmenu/lib/SlidingMenu.java", "license": "apache-2.0", "size": 28621 }
[ "android.view.View" ]
import android.view.View;
import android.view.*;
[ "android.view" ]
android.view;
2,067,634
public void writeInts (int[] array, int offset, int count, boolean optimizePositive) throws KryoException { if (varEncoding) { for (int n = offset + count; offset < n; offset++) writeVarInt(array[offset], optimizePositive); } else writeInts(array, offset, count); }
void function (int[] array, int offset, int count, boolean optimizePositive) throws KryoException { if (varEncoding) { for (int n = offset + count; offset < n; offset++) writeVarInt(array[offset], optimizePositive); } else writeInts(array, offset, count); }
/** Writes an int array in bulk using fixed or variable length encoding, depending on * {@link #setVariableLengthEncoding(boolean)}. This may be more efficient than writing them individually. */
Writes an int array in bulk using fixed or variable length encoding, depending on
writeInts
{ "repo_name": "EsotericSoftware/kryo", "path": "src/com/esotericsoftware/kryo/io/Output.java", "license": "bsd-3-clause", "size": 34695 }
[ "com.esotericsoftware.kryo.KryoException" ]
import com.esotericsoftware.kryo.KryoException;
import com.esotericsoftware.kryo.*;
[ "com.esotericsoftware.kryo" ]
com.esotericsoftware.kryo;
952,058
public static ASTNode getNormalizedNode(ASTNode node) { ASTNode current = node; // normalize name if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } // normalize type if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent()) || SimpleType.NAME_PROPERTY.equals(current.getLocationInParent()) || NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } // normalize parameterized types if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } return current; }
static ASTNode function(ASTNode node) { ASTNode current = node; if (QualifiedName.NAME_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } if (QualifiedType.NAME_PROPERTY.equals(current.getLocationInParent()) SimpleType.NAME_PROPERTY.equals(current.getLocationInParent()) NameQualifiedType.NAME_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } if (ParameterizedType.TYPE_PROPERTY.equals(current.getLocationInParent())) { current = current.getParent(); } return current; }
/** * For {@link Name} or {@link org.eclipse.jdt.core.dom.Type} nodes, returns the topmost {@link * org.eclipse.jdt.core.dom.Type} node that shares the same type binding as the given node. * * @param node an ASTNode * @return the normalized {@link org.eclipse.jdt.core.dom.Type} node or the original node */
For <code>Name</code> or <code>org.eclipse.jdt.core.dom.Type</code> nodes, returns the topmost <code>org.eclipse.jdt.core.dom.Type</code> node that shares the same type binding as the given node
getNormalizedNode
{ "repo_name": "sleshchenko/che", "path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/che/jdt/dom/ASTNodes.java", "license": "epl-1.0", "size": 4786 }
[ "org.eclipse.jdt.core.dom.ASTNode", "org.eclipse.jdt.core.dom.NameQualifiedType", "org.eclipse.jdt.core.dom.ParameterizedType", "org.eclipse.jdt.core.dom.QualifiedName", "org.eclipse.jdt.core.dom.QualifiedType", "org.eclipse.jdt.core.dom.SimpleType" ]
import org.eclipse.jdt.core.dom.ASTNode; import org.eclipse.jdt.core.dom.NameQualifiedType; import org.eclipse.jdt.core.dom.ParameterizedType; import org.eclipse.jdt.core.dom.QualifiedName; import org.eclipse.jdt.core.dom.QualifiedType; import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.*;
[ "org.eclipse.jdt" ]
org.eclipse.jdt;
2,389,760
public static char[] markWalkableTriangles(Context ctx, float walkableSlopeAngle, Vector3f[] vertices, int[] triangles) { SWIGTYPE_p_float verts = Converter.convertToSWIGTYPE_p_float(vertices); int nv = vertices.length; SWIGTYPE_p_int tris = Converter.convertToSWIGTYPE_p_int(triangles); int nt = triangles.length / 3; SWIGTYPE_p_unsigned_char area = new UCharArray(nt).cast(); RecastJNI.rcMarkWalkableTriangles(Context.getCPtr(ctx), ctx, walkableSlopeAngle, SWIGTYPE_p_float.getCPtr(verts), nv, SWIGTYPE_p_int.getCPtr(tris), nt, SWIGTYPE_p_unsigned_char.getCPtr(area)); return Converter.convertToChars(area, nt); }
static char[] function(Context ctx, float walkableSlopeAngle, Vector3f[] vertices, int[] triangles) { SWIGTYPE_p_float verts = Converter.convertToSWIGTYPE_p_float(vertices); int nv = vertices.length; SWIGTYPE_p_int tris = Converter.convertToSWIGTYPE_p_int(triangles); int nt = triangles.length / 3; SWIGTYPE_p_unsigned_char area = new UCharArray(nt).cast(); RecastJNI.rcMarkWalkableTriangles(Context.getCPtr(ctx), ctx, walkableSlopeAngle, SWIGTYPE_p_float.getCPtr(verts), nv, SWIGTYPE_p_int.getCPtr(tris), nt, SWIGTYPE_p_unsigned_char.getCPtr(area)); return Converter.convertToChars(area, nt); }
/** * - not tested (not sure about area.length) * * Sets the area id of all triangles with a slope below the specified value * to WALKABLE_AREA. * * @see RecastBuilder#WALKABLE_AREA() * @param ctx The build context to use during the operation. * @param walkableSlopeAngle The maximum slope that is considered walkable. * [Limits: 90> value >= 0] [Units: Degrees] * @param vertices The vertices. * @param triangles The triangle vertex indices. [(vert A, vertB, vertC)] * @return The triangle area ids. [Length: >= number of triangles] */
- not tested (not sure about area.length) Sets the area id of all triangles with a slope below the specified value to WALKABLE_AREA
markWalkableTriangles
{ "repo_name": "QuietOne/jNavigation", "path": "src/com/jme3/ai/navigation/recast/RecastBuilder.java", "license": "bsd-3-clause", "size": 51030 }
[ "com.jme3.ai.navigation.utils.Converter", "com.jme3.ai.navigation.utils.RecastJNI", "com.jme3.ai.navigation.utils.UCharArray", "com.jme3.math.Vector3f" ]
import com.jme3.ai.navigation.utils.Converter; import com.jme3.ai.navigation.utils.RecastJNI; import com.jme3.ai.navigation.utils.UCharArray; import com.jme3.math.Vector3f;
import com.jme3.ai.navigation.utils.*; import com.jme3.math.*;
[ "com.jme3.ai", "com.jme3.math" ]
com.jme3.ai; com.jme3.math;
1,038,116
@GET @Path("/{id}") @Produces(MediaType.APPLICATION_OCTET_STREAM) public Response getFullRDFDocument(@PathParam("id") String projectId) { try { ProjectManager pm = getProjectManager(projectId); return Response.ok(pm.getFullRdfDocument()) .header(HttpHeaders.CONTENT_DISPOSITION, String.format("attachment; filename='%s.owl'", pm.getProjectShortForm())) .build(); } catch (Exception e) { logger.warn(e.getMessage()); throw new WebApplicationException(e.getMessage()); } }
@Path("/{id}") @Produces(MediaType.APPLICATION_OCTET_STREAM) Response function(@PathParam("id") String projectId) { try { ProjectManager pm = getProjectManager(projectId); return Response.ok(pm.getFullRdfDocument()) .header(HttpHeaders.CONTENT_DISPOSITION, String.format(STR, pm.getProjectShortForm())) .build(); } catch (Exception e) { logger.warn(e.getMessage()); throw new WebApplicationException(e.getMessage()); } }
/** * Returns full OWL document as RDF/XML. * @param projectId ID of the WebProtégé project * @return JSON response */
Returns full OWL document as RDF/XML
getFullRDFDocument
{ "repo_name": "ChristophB/webprotege-rest-api", "path": "src/main/java/de/onto_med/ontology_service/resources/ProjectResource.java", "license": "gpl-3.0", "size": 10310 }
[ "de.onto_med.ontology_service.manager.ProjectManager", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.Produces", "javax.ws.rs.WebApplicationException", "javax.ws.rs.core.HttpHeaders", "javax.ws.rs.core.MediaType", "javax.ws.rs.core.Response" ]
import de.onto_med.ontology_service.manager.ProjectManager; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response;
import de.onto_med.ontology_service.manager.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "de.onto_med.ontology_service", "javax.ws" ]
de.onto_med.ontology_service; javax.ws;
1,386,782
public void openOutput(File f, LoggerSeverity s) throws FileNotFoundException { PrintStream out = new PrintStream(f); this.loggers.add(new LoggerOutput(out, s)); }
void function(File f, LoggerSeverity s) throws FileNotFoundException { PrintStream out = new PrintStream(f); this.loggers.add(new LoggerOutput(out, s)); }
/** * Adds a file output to logger. * @param f File to be used * @param s Minimal severity required to log the message * @throws FileNotFoundException if the stream couldn't be created */
Adds a file output to logger
openOutput
{ "repo_name": "Salmelu/Contests", "path": "src/cz/salmelu/contests/util/Logger.java", "license": "mit", "size": 5152 }
[ "java.io.File", "java.io.FileNotFoundException", "java.io.PrintStream" ]
import java.io.File; import java.io.FileNotFoundException; import java.io.PrintStream;
import java.io.*;
[ "java.io" ]
java.io;
402,639
public Object getValue(int encounterIndex, int conceptId){ return getValue(getObs(encounterIndex, conceptId)); } /** * Gets the value of a given {@link Obs}
Object function(int encounterIndex, int conceptId){ return getValue(getObs(encounterIndex, conceptId)); } /** * Gets the value of a given {@link Obs}
/** * Gets the value of an observation at a given index for a given concept. * * @param encounterIndex is the index of the observation starting with 1 for the most recent, * 2 for the second most recent, 3 for the third most recent, and more. * * @param conceptId is the concept id. * @return the value. */
Gets the value of an observation at a given index for a given concept
getValue
{ "repo_name": "viniciusboson/buendia", "path": "third_party/openmrs-module-xforms/api/src/main/java/org/openmrs/module/xforms/ObsHistory.java", "license": "apache-2.0", "size": 4794 }
[ "org.openmrs.Obs" ]
import org.openmrs.Obs;
import org.openmrs.*;
[ "org.openmrs" ]
org.openmrs;
2,177,331
public void removeAllDynamicShortcuts() { try { mService.removeAllDynamicShortcuts(mContext.getPackageName(), injectMyUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
void function() { try { mService.removeAllDynamicShortcuts(mContext.getPackageName(), injectMyUserId()); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } }
/** * Delete all dynamic shortcuts from the caller application. */
Delete all dynamic shortcuts from the caller application
removeAllDynamicShortcuts
{ "repo_name": "xorware/android_frameworks_base", "path": "core/java/android/content/pm/ShortcutManager.java", "license": "apache-2.0", "size": 10223 }
[ "android.os.RemoteException" ]
import android.os.RemoteException;
import android.os.*;
[ "android.os" ]
android.os;
2,079,663
private void checkUpdateEvent(EventType<ConfigurationEvent> eventType) { assertSame("Wrong super type for " + eventType, ConfigurationEvent.ANY, eventType.getSuperType()); }
void function(EventType<ConfigurationEvent> eventType) { assertSame(STR + eventType, ConfigurationEvent.ANY, eventType.getSuperType()); }
/** * Helper method for checking the relevant properties of a given event type * representing a configuration update event. * * @param eventType the event type to check */
Helper method for checking the relevant properties of a given event type representing a configuration update event
checkUpdateEvent
{ "repo_name": "mohanaraosv/commons-configuration", "path": "src/test/java/org/apache/commons/configuration2/event/TestConfigurationEventTypes.java", "license": "apache-2.0", "size": 7980 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
155,810
ImmutableValue<Date> lastJoined();
ImmutableValue<Date> lastJoined();
/** * Gets the {@link ImmutableValue} of the {@link Date} that a * {@link Player} joined the {@link Server} the last time. * * @return The immutable value for the last time a player joined */
Gets the <code>ImmutableValue</code> of the <code>Date</code> that a <code>Player</code> joined the <code>Server</code> the last time
lastJoined
{ "repo_name": "Kiskae/SpongeAPI", "path": "src/main/java/org/spongepowered/api/data/manipulator/immutable/entity/ImmutableJoinData.java", "license": "mit", "size": 2421 }
[ "java.util.Date", "org.spongepowered.api.data.value.immutable.ImmutableValue" ]
import java.util.Date; import org.spongepowered.api.data.value.immutable.ImmutableValue;
import java.util.*; import org.spongepowered.api.data.value.immutable.*;
[ "java.util", "org.spongepowered.api" ]
java.util; org.spongepowered.api;
1,359,612
public static ims.ocrr.configuration.domain.objects.OrderSetComponent extractOrderSetComponent(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.ComponentSelectOrderVo valueObject) { return extractOrderSetComponent(domainFactory, valueObject, new HashMap()); }
static ims.ocrr.configuration.domain.objects.OrderSetComponent function(ims.domain.ILightweightDomainFactory domainFactory, ims.ocrr.vo.ComponentSelectOrderVo valueObject) { return extractOrderSetComponent(domainFactory, valueObject, new HashMap()); }
/** * Create the domain object from the value object. * @param domainFactory - used to create existing (persistent) domain objects. * @param valueObject - extract the domain object fields from this. */
Create the domain object from the value object
extractOrderSetComponent
{ "repo_name": "open-health-hub/openMAXIMS", "path": "openmaxims_workspace/ValueObjects/src/ims/ocrr/vo/domain/ComponentSelectOrderVoAssembler.java", "license": "agpl-3.0", "size": 16058 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
2,218,079
public void unregisterReceiver(Context context) { context.unregisterReceiver(getBroadcastReceiver()); }
void function(Context context) { context.unregisterReceiver(getBroadcastReceiver()); }
/** * Unregister the GPU BroadcastReceiver in the given context. * @param context */
Unregister the GPU BroadcastReceiver in the given context
unregisterReceiver
{ "repo_name": "csabakeszegh/android-chromium-view", "path": "content/src/org/chromium/content/browser/TracingControllerAndroid.java", "license": "mit", "size": 10537 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
2,498,604
public Adapter createArrayAccessAdapter() { return null; }
Adapter function() { return null; }
/** * Creates a new adapter for an object of class '{@link org.tetrabox.minijava.model.miniJava.ArrayAccess <em>Array Access</em>}'. * <!-- begin-user-doc --> * This default implementation returns null so that we can easily ignore cases; * it's useful to ignore a case when inheritance will catch all the cases anyway. * <!-- end-user-doc --> * @return the new adapter. * @see org.tetrabox.minijava.model.miniJava.ArrayAccess * @generated */
Creates a new adapter for an object of class '<code>org.tetrabox.minijava.model.miniJava.ArrayAccess Array Access</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway.
createArrayAccessAdapter
{ "repo_name": "tetrabox/minijava", "path": "plugins/org.tetrabox.minijava.model/src/org/tetrabox/minijava/model/miniJava/util/MiniJavaAdapterFactory.java", "license": "epl-1.0", "size": 42082 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
885,415
private boolean isItemInAllTransactionsExceptFirst(List<Transaction> transactions, Integer item) { for(int i=1; i < transactions.size(); i++) { if(transactions.get(i).containsByBinarySearchOriginalTransaction(item) == false) { return false; } } return true; }
boolean function(List<Transaction> transactions, Integer item) { for(int i=1; i < transactions.size(); i++) { if(transactions.get(i).containsByBinarySearchOriginalTransaction(item) == false) { return false; } } return true; }
/** * Check if an item appears in all transactions after the first one in a list of transactions * @param transactions a list of transactions * @param item an item * @return true if the item appears in all transactions after the first one */
Check if an item appears in all transactions after the first one in a list of transactions
isItemInAllTransactionsExceptFirst
{ "repo_name": "aocalderon/PhD", "path": "Y2Q2/Research/Code/SPMF/src/ca/pfv/spmf/algorithms/frequentpatterns/lcm/AlgoLCM.java", "license": "lgpl-3.0", "size": 17933 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
942,585
public void setRequired(boolean required) { dictionary.setFlag(COSName.FF, FLAG_REQUIRED, required); }
void function(boolean required) { dictionary.setFlag(COSName.FF, FLAG_REQUIRED, required); }
/** * sets the flag whether the field is to be required to have a value at the time it is exported * by a submit-form action. * * @param required The new flag for required. */
sets the flag whether the field is to be required to have a value at the time it is exported by a submit-form action
setRequired
{ "repo_name": "kalaspuffar/pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/form/PDField.java", "license": "apache-2.0", "size": 14926 }
[ "org.apache.pdfbox.cos.COSName" ]
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.cos.*;
[ "org.apache.pdfbox" ]
org.apache.pdfbox;
2,157,969
public static String readStringFromTextFile(File textFile) { StringBuilder text = new StringBuilder(); try { BufferedReader bufferedReader = new BufferedReader(new FileReader(textFile)); String line; while ((line = bufferedReader.readLine()) != null) { text.append(line); text.append('\n'); } bufferedReader.close(); } catch (IOException e) { //Log.e(LOG_TAG, "Reading String from file failed: " + e.getMessage()); e.printStackTrace(); } return text.toString(); }
static String function(File textFile) { StringBuilder text = new StringBuilder(); try { BufferedReader bufferedReader = new BufferedReader(new FileReader(textFile)); String line; while ((line = bufferedReader.readLine()) != null) { text.append(line); text.append('\n'); } bufferedReader.close(); } catch (IOException e) { e.printStackTrace(); } return text.toString(); }
/** * Attempts to read a text file into a String. * * @param textFile The text file to read * @return A String containing the contents of the read text file */
Attempts to read a text file into a String
readStringFromTextFile
{ "repo_name": "jetkov/neatpad", "path": "app/src/main/java/ml/jetkov/neatpad/utils/FileManager.java", "license": "gpl-3.0", "size": 8912 }
[ "java.io.BufferedReader", "java.io.File", "java.io.FileReader", "java.io.IOException" ]
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
349,185
private List<AdGroupCriterionOperation> buildAdGroupCriterionOperations( List<AdGroupOperation> adGroupOperations) { List<AdGroupCriterionOperation> operations = new ArrayList<>(); for (AdGroupOperation adGroupOperation : adGroupOperations) { for (int i = 0; i < NUMBER_OF_KEYWORDS_TO_ADD; i++) { // Creates a keyword text by making 50% of keywords invalid to demonstrate error handling. String keywordText = "mars" + i; if (i % 2 == 0) { keywordText += "!!!"; } // Creates an ad group criterion using the created keyword text. AdGroupCriterion adGroupCriterion = AdGroupCriterion.newBuilder() .setKeyword( KeywordInfo.newBuilder() .setText(keywordText) .setMatchType(KeywordMatchType.BROAD) .build()) .setAdGroup(adGroupOperation.getCreate().getResourceName()) .setStatus(AdGroupCriterionStatus.ENABLED) .build(); // Creates an ad group criterion operation and adds it to the operations list. AdGroupCriterionOperation op = AdGroupCriterionOperation.newBuilder().setCreate(adGroupCriterion).build(); operations.add(op); } } return operations; }
List<AdGroupCriterionOperation> function( List<AdGroupOperation> adGroupOperations) { List<AdGroupCriterionOperation> operations = new ArrayList<>(); for (AdGroupOperation adGroupOperation : adGroupOperations) { for (int i = 0; i < NUMBER_OF_KEYWORDS_TO_ADD; i++) { String keywordText = "mars" + i; if (i % 2 == 0) { keywordText += "!!!"; } AdGroupCriterion adGroupCriterion = AdGroupCriterion.newBuilder() .setKeyword( KeywordInfo.newBuilder() .setText(keywordText) .setMatchType(KeywordMatchType.BROAD) .build()) .setAdGroup(adGroupOperation.getCreate().getResourceName()) .setStatus(AdGroupCriterionStatus.ENABLED) .build(); AdGroupCriterionOperation op = AdGroupCriterionOperation.newBuilder().setCreate(adGroupCriterion).build(); operations.add(op); } } return operations; }
/** * Builds new ad group criterion operations for creating keywords. 50% of keywords are created * with some invalid characters to demonstrate how BatchJobService returns information about such * errors. * * @param adGroupOperations the ad group operations to be used to create ad group criteria. * @return the ad group criterion operations. */
Builds new ad group criterion operations for creating keywords. 50% of keywords are created with some invalid characters to demonstrate how BatchJobService returns information about such errors
buildAdGroupCriterionOperations
{ "repo_name": "googleads/google-ads-java", "path": "google-ads-examples/src/main/java/com/google/ads/googleads/examples/campaignmanagement/AddCompleteCampaignsUsingBatchJob.java", "license": "apache-2.0", "size": 24357 }
[ "com.google.ads.googleads.v10.common.KeywordInfo", "com.google.ads.googleads.v10.enums.AdGroupCriterionStatusEnum", "com.google.ads.googleads.v10.enums.KeywordMatchTypeEnum", "com.google.ads.googleads.v10.resources.AdGroupCriterion", "com.google.ads.googleads.v10.services.AdGroupCriterionOperation", "com....
import com.google.ads.googleads.v10.common.KeywordInfo; import com.google.ads.googleads.v10.enums.AdGroupCriterionStatusEnum; import com.google.ads.googleads.v10.enums.KeywordMatchTypeEnum; import com.google.ads.googleads.v10.resources.AdGroupCriterion; import com.google.ads.googleads.v10.services.AdGroupCriterionOperation; import com.google.ads.googleads.v10.services.AdGroupOperation; import java.util.ArrayList; import java.util.List;
import com.google.ads.googleads.v10.common.*; import com.google.ads.googleads.v10.enums.*; import com.google.ads.googleads.v10.resources.*; import com.google.ads.googleads.v10.services.*; import java.util.*;
[ "com.google.ads", "java.util" ]
com.google.ads; java.util;
2,412,244
@BeanProperty(bound = false) public Cursor getLastCursor() { return lastCursor; } /** * {@inheritDoc}
@BeanProperty(bound = false) Cursor function() { return lastCursor; } /** * {@inheritDoc}
/** * Returns the last <code>Cursor</code> that was set by the * <code>setCursor</code> method that is not a resizable * <code>Cursor</code>. * * @return the last non-resizable <code>Cursor</code> * @since 1.6 */
Returns the last <code>Cursor</code> that was set by the <code>setCursor</code> method that is not a resizable <code>Cursor</code>
getLastCursor
{ "repo_name": "mirkosertic/Bytecoder", "path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/swing/JInternalFrame.java", "license": "apache-2.0", "size": 87325 }
[ "java.awt.Cursor", "java.beans.BeanProperty" ]
import java.awt.Cursor; import java.beans.BeanProperty;
import java.awt.*; import java.beans.*;
[ "java.awt", "java.beans" ]
java.awt; java.beans;
526,311
@Test public void testDefaultValuesInPdxFieldTypes() throws Exception { final Host host = Host.getHost(0); final VM vm0 = host.getVM(0); final VM vm1 = host.getVM(1); final int numberOfEntries = 10; final String name = "/" + regionName; final String query = "select stringField, booleanField, charField, shortField, intField, longField, floatField, doubleField from " + name;
void function() throws Exception { final Host host = Host.getHost(0); final VM vm0 = host.getVM(0); final VM vm1 = host.getVM(1); final int numberOfEntries = 10; final String name = "/" + regionName; final String query = STR + name;
/** * Test query execution when default values of {@link FieldType} are used. This happens when one * version of Pdx object does not have a field but other version has. * */
Test query execution when default values of <code>FieldType</code> are used. This happens when one version of Pdx object does not have a field but other version has
testDefaultValuesInPdxFieldTypes
{ "repo_name": "deepakddixit/incubator-geode", "path": "geode-core/src/distributedTest/java/org/apache/geode/cache/query/dunit/PdxQueryDUnitTest.java", "license": "apache-2.0", "size": 137231 }
[ "org.apache.geode.test.dunit.Host" ]
import org.apache.geode.test.dunit.Host;
import org.apache.geode.test.dunit.*;
[ "org.apache.geode" ]
org.apache.geode;
2,525,770
public void removeBaseCastConsumer(IBaseCastConsumer listener) { if (null != listener) { synchronized (mBaseCastConsumers) { if (mBaseCastConsumers.remove(listener)) { LOGD(TAG, "Successfully removed the existing BaseCastConsumer listener " + listener); } } } }
void function(IBaseCastConsumer listener) { if (null != listener) { synchronized (mBaseCastConsumers) { if (mBaseCastConsumers.remove(listener)) { LOGD(TAG, STR + listener); } } } }
/** * Unregisters an {@link IBaseCastConsumer}. * * @param listener */
Unregisters an <code>IBaseCastConsumer</code>
removeBaseCastConsumer
{ "repo_name": "hanspeide/CastSupportLib", "path": "src/com/google/sample/castcompanionlibrary/cast/BaseCastManager.java", "license": "apache-2.0", "size": 43986 }
[ "com.google.sample.castcompanionlibrary.cast.callbacks.IBaseCastConsumer" ]
import com.google.sample.castcompanionlibrary.cast.callbacks.IBaseCastConsumer;
import com.google.sample.castcompanionlibrary.cast.callbacks.*;
[ "com.google.sample" ]
com.google.sample;
2,557,969
public static boolean mayReturnNullOnNonNullInput(Expression expression) { requireNonNull(expression, "expression is null"); AtomicBoolean result = new AtomicBoolean(false); new Visitor().process(expression, result); return result.get(); }
static boolean function(Expression expression) { requireNonNull(expression, STR); AtomicBoolean result = new AtomicBoolean(false); new Visitor().process(expression, result); return result.get(); }
/** * TODO: this currently produces a very conservative estimate. * We need to narrow down the conditions under which certain constructs * can return null (e.g., if(a, b, c) might return null for non-null a * only if b or c can be null. */
We need to narrow down the conditions under which certain constructs can return null (e.g., if(a, b, c) might return null for non-null a only if b or c can be null
mayReturnNullOnNonNullInput
{ "repo_name": "hgschmie/presto", "path": "presto-main/src/main/java/io/prestosql/sql/planner/NullabilityAnalyzer.java", "license": "apache-2.0", "size": 4708 }
[ "io.prestosql.sql.tree.Expression", "java.util.Objects", "java.util.concurrent.atomic.AtomicBoolean" ]
import io.prestosql.sql.tree.Expression; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean;
import io.prestosql.sql.tree.*; import java.util.*; import java.util.concurrent.atomic.*;
[ "io.prestosql.sql", "java.util" ]
io.prestosql.sql; java.util;
643,901
private String getApplicationScopes(String appName) throws APIManagementException { String scopes = ""; String applicationRestAPI = null; if (AuthenticatorConstants.STORE_APPLICATION.equals(appName)) { applicationRestAPI = RestApiUtil.getStoreRestAPIResource(); } else if (AuthenticatorConstants.PUBLISHER_APPLICATION.equals(appName)) { applicationRestAPI = RestApiUtil.getPublisherRestAPIResource(); } else if (AuthenticatorConstants.ADMIN_APPLICATION.equals(appName)) { applicationRestAPI = RestApiUtil.getAdminRestAPIResource(); } try { if (applicationRestAPI != null) { APIDefinition apiDefinitionFromSwagger20 = new APIDefinitionFromSwagger20(); Map<String, Scope> applicationScopesMap; //Todo: when all swaggers modified with no vendor extension, following swagger parser should be modified. //todo: for now only publisher swagger have been modified for no vendor extensions if (AuthenticatorConstants.PUBLISHER_APPLICATION.equals(appName)) { applicationScopesMap = apiDefinitionFromSwagger20 .getScopesFromSecurityDefinition(applicationRestAPI); } else { applicationScopesMap = apiDefinitionFromSwagger20.getScopes(applicationRestAPI); } scopes = String.join(" ", applicationScopesMap.keySet()); // Set openid scope if (StringUtils.isEmpty(scopes)) { scopes = KeyManagerConstants.OPEN_ID_CONNECT_SCOPE; } else { scopes = scopes + " " + KeyManagerConstants.OPEN_ID_CONNECT_SCOPE; } } else { String errorMsg = "Error while getting application rest API resource."; log.error(errorMsg, ExceptionCodes.INTERNAL_ERROR); throw new APIManagementException(errorMsg, ExceptionCodes.INTERNAL_ERROR); } } catch (APIManagementException e) { String errorMsg = "Error while reading scopes from swagger definition."; log.error(errorMsg, e, ExceptionCodes.INTERNAL_ERROR); throw new APIManagementException(errorMsg, e, ExceptionCodes.INTERNAL_ERROR); } return scopes; }
String function(String appName) throws APIManagementException { String scopes = STR STR STRError while getting application rest API resource.STRError while reading scopes from swagger definition."; log.error(errorMsg, e, ExceptionCodes.INTERNAL_ERROR); throw new APIManagementException(errorMsg, e, ExceptionCodes.INTERNAL_ERROR); } return scopes; }
/** * This method returns the scopes for a given application. * * @param appName Name the application * @return scopes - A space separated list of scope keys * @throws APIManagementException When retrieving scopes from swagger definition fails */
This method returns the scopes for a given application
getApplicationScopes
{ "repo_name": "dewmini/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.authenticator/src/main/java/org/wso2/carbon/apimgt/rest/api/authenticator/AuthenticatorService.java", "license": "apache-2.0", "size": 18387 }
[ "org.wso2.carbon.apimgt.core.exception.APIManagementException", "org.wso2.carbon.apimgt.core.exception.ExceptionCodes" ]
import org.wso2.carbon.apimgt.core.exception.APIManagementException; import org.wso2.carbon.apimgt.core.exception.ExceptionCodes;
import org.wso2.carbon.apimgt.core.exception.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,412,976
public static float convertPixelsToDp(float px, Context context) { Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float dp = px / (metrics.densityDpi / 160f); return dp; }
static float function(float px, Context context) { Resources resources = context.getResources(); DisplayMetrics metrics = resources.getDisplayMetrics(); float dp = px / (metrics.densityDpi / 160f); return dp; }
/** * This method converts device specific pixels to density independent pixels. * * @param px A value in px (pixels) unit. Which we need to convert into db * @param context Context to get resources and device specific display metrics * @return A float value to represent dp equivalent to px value */
This method converts device specific pixels to density independent pixels
convertPixelsToDp
{ "repo_name": "simtse/CatholicJourney", "path": "app/src/main/java/org/sfx/catholicjourney/core/utils/UIUtils.java", "license": "apache-2.0", "size": 8254 }
[ "android.content.Context", "android.content.res.Resources", "android.util.DisplayMetrics" ]
import android.content.Context; import android.content.res.Resources; import android.util.DisplayMetrics;
import android.content.*; import android.content.res.*; import android.util.*;
[ "android.content", "android.util" ]
android.content; android.util;
622,041
public synchronized void disconnect() throws IOException { IOException ex = null; if (mConnection != null && mConnection.isConnected()) { try { mConnection.disconnect(); } catch (final IOException e) { ex = (ex != null) ? ex : e;// Always keep first non null // exception } } if (mIdleConnection != null && mIdleConnection.isConnected()) { try { mIdleConnection.disconnect(); } catch (final IOException e) { ex = (ex != null) ? ex : e;// Always keep non null first // exception } } }
synchronized void function() throws IOException { IOException ex = null; if (mConnection != null && mConnection.isConnected()) { try { mConnection.disconnect(); } catch (final IOException e) { ex = (ex != null) ? ex : e; } } if (mIdleConnection != null && mIdleConnection.isConnected()) { try { mIdleConnection.disconnect(); } catch (final IOException e) { ex = (ex != null) ? ex : e; } } }
/** * Disconnects from server. * * @throws IOException if an error occur while closing connection */
Disconnects from server
disconnect
{ "repo_name": "abarisain/dmix", "path": "JMPDComm/src/main/java/org/a0z/mpd/MPD.java", "license": "apache-2.0", "size": 70703 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,281,895
public Map<String, String> entries() { return entries; }
Map<String, String> function() { return entries; }
/** * Returns the view of environment variables. * @return the environment variables */
Returns the view of environment variables
entries
{ "repo_name": "asakusafw/asakusafw-spark", "path": "bootstrap/src/main/java/com/asakusafw/spark/bootstrap/Environment.java", "license": "apache-2.0", "size": 2989 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,134,137
public static void copy(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
static void function(File from, OutputSupplier<? extends OutputStream> to) throws IOException { asByteSource(from).copyTo(ByteStreams.asByteSink(to)); }
/** * Copies all bytes from a file to an {@link OutputStream} supplied by * a factory. * * @param from the source file * @param to the output factory * @throws IOException if an I/O error occurs */
Copies all bytes from a file to an <code>OutputStream</code> supplied by a factory
copy
{ "repo_name": "mike10004/appengine-imaging", "path": "gaecompat-awt-imaging/src/common/com/gaecompat/repackaged/com/google/common/io/Files.java", "license": "apache-2.0", "size": 35475 }
[ "java.io.File", "java.io.IOException", "java.io.OutputStream" ]
import java.io.File; import java.io.IOException; import java.io.OutputStream;
import java.io.*;
[ "java.io" ]
java.io;
691,936
protected Dimension getScaledPreferredSizeForGraph() { mxRectangle bounds = graph.getGraphBounds(); int border = graph.getBorder(); return new Dimension((int) Math.round(bounds.getX() + bounds.getWidth()) + border + 1, (int) Math.round(bounds.getY() + bounds.getHeight()) + border + 1); }
Dimension function() { mxRectangle bounds = graph.getGraphBounds(); int border = graph.getBorder(); return new Dimension((int) Math.round(bounds.getX() + bounds.getWidth()) + border + 1, (int) Math.round(bounds.getY() + bounds.getHeight()) + border + 1); }
/** * Returns the scaled preferred size for the current graph. */
Returns the scaled preferred size for the current graph
getScaledPreferredSizeForGraph
{ "repo_name": "ModelWriter/WP3", "path": "Source/eu.modelwriter.visualization.jgrapx/src/com/mxgraph/swing/mxGraphComponent.java", "license": "epl-1.0", "size": 106155 }
[ "java.awt.Dimension" ]
import java.awt.Dimension;
import java.awt.*;
[ "java.awt" ]
java.awt;
2,708,862
public String checkKeyAndGetDatabaseName(String db) { if (key == null) { return db; } if (key.equals(db)) { return keyDatabase; } throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD); }
String function(String db) { if (key == null) { return db; } if (key.equals(db)) { return keyDatabase; } throw DbException.get(ErrorCode.WRONG_USER_OR_PASSWORD); }
/** * If no key is set, return the original database name. If a key is set, * check if the key matches. If yes, return the correct database name. If * not, throw an exception. * * @param db the key to test (or database name if no key is used) * @return the database name * @throws DbException if a key is set but doesn't match */
If no key is set, return the original database name. If a key is set, check if the key matches. If yes, return the correct database name. If not, throw an exception
checkKeyAndGetDatabaseName
{ "repo_name": "ferquies/2dam", "path": "AD/Tema 2/h2/src/main/org/h2/server/TcpServer.java", "license": "gpl-3.0", "size": 16072 }
[ "org.h2.constant.ErrorCode", "org.h2.message.DbException" ]
import org.h2.constant.ErrorCode; import org.h2.message.DbException;
import org.h2.constant.*; import org.h2.message.*;
[ "org.h2.constant", "org.h2.message" ]
org.h2.constant; org.h2.message;
283,999
private void assertSuccessfulApplyWaveletOperations(WaveletContainerImpl with) throws Exception { with.applyWaveletOperations(addParticipantOps); assertEquals(with.getParticipants(), participants); with.applyWaveletOperations(removeParticipantOps); assertEquals(with.getParticipants(), Collections.emptyList()); }
void function(WaveletContainerImpl with) throws Exception { with.applyWaveletOperations(addParticipantOps); assertEquals(with.getParticipants(), participants); with.applyWaveletOperations(removeParticipantOps); assertEquals(with.getParticipants(), Collections.emptyList()); }
/** * Check that a container succeeds when adding non-existent participants and removing existing * participants. */
Check that a container succeeds when adding non-existent participants and removing existing participants
assertSuccessfulApplyWaveletOperations
{ "repo_name": "scrosby/fedone", "path": "test/org/waveprotocol/wave/examples/fedone/waveserver/WaveletContainerTest.java", "license": "apache-2.0", "size": 11904 }
[ "java.util.Collections" ]
import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
1,320,966
private void cleanUp() { //remove the route listener routeService.removeListener(routeListener); //clean up the routes. prefixToNextHop.entrySet().stream() .map(e -> new Route(Route.Source.UNDEFINED, e.getKey(), e.getValue())) .forEach(this::deleteRoute); if (interfaceManager != null) { interfaceManager.cleanup(); } }
void function() { routeService.removeListener(routeListener); prefixToNextHop.entrySet().stream() .map(e -> new Route(Route.Source.UNDEFINED, e.getKey(), e.getValue())) .forEach(this::deleteRoute); if (interfaceManager != null) { interfaceManager.cleanup(); } }
/** * Removes filtering objectives and routes before deactivate. */
Removes filtering objectives and routes before deactivate
cleanUp
{ "repo_name": "opennetworkinglab/onos", "path": "apps/routing/fibinstaller/src/main/java/org/onosproject/routing/fibinstaller/FibInstaller.java", "license": "apache-2.0", "size": 21915 }
[ "org.onosproject.routeservice.Route" ]
import org.onosproject.routeservice.Route;
import org.onosproject.routeservice.*;
[ "org.onosproject.routeservice" ]
org.onosproject.routeservice;
1,664,858
rport = SecureRandom.getInstance("SHA1PRNG").nextInt(2000) + 22000; System.out.println("Random HTTP port is: " + rport); ncprocess = new PortListener(rport); try { //Build the catalog VoltProjectBuilder builder = new VoltProjectBuilder(); builder.addLiteralSchema(""); String catalogJar = "dummy.jar"; builder.setHTTPDPort(rport); LocalCluster config = new LocalCluster(catalogJar, 2, 1, 0, BackendTarget.NATIVE_EE_JNI); config.portGenerator.enablePortProvider(); config.portGenerator.pprovider.setHttp(rport); config.setHasLocalServer(false); //We expect it to crash config.setExpectedToCrash(true); boolean success = config.compile(builder); assertTrue(success); config.startUp(); pf = config.m_pipes.get(0); Thread.currentThread().sleep(10000); } catch (IOException ex) { fail(ex.getMessage()); } finally { } }
rport = SecureRandom.getInstance(STR).nextInt(2000) + 22000; System.out.println(STR + rport); ncprocess = new PortListener(rport); try { VoltProjectBuilder builder = new VoltProjectBuilder(); builder.addLiteralSchema(STRdummy.jar"; builder.setHTTPDPort(rport); LocalCluster config = new LocalCluster(catalogJar, 2, 1, 0, BackendTarget.NATIVE_EE_JNI); config.portGenerator.enablePortProvider(); config.portGenerator.pprovider.setHttp(rport); config.setHasLocalServer(false); config.setExpectedToCrash(true); boolean success = config.compile(builder); assertTrue(success); config.startUp(); pf = config.m_pipes.get(0); Thread.currentThread().sleep(10000); } catch (IOException ex) { fail(ex.getMessage()); } finally { } }
/** * JUnit special method called to setup the test. This instance will start * the VoltDB server using the VoltServerConfig instance provided. */
JUnit special method called to setup the test. This instance will start the VoltDB server using the VoltServerConfig instance provided
setUp
{ "repo_name": "zheguang/voltdb", "path": "tests/frontend/org/voltdb/regressionsuites/TestHttpPort.java", "license": "agpl-3.0", "size": 3793 }
[ "java.io.IOException", "java.security.SecureRandom", "junit.framework.Assert", "org.voltdb.BackendTarget", "org.voltdb.compiler.VoltProjectBuilder" ]
import java.io.IOException; import java.security.SecureRandom; import junit.framework.Assert; import org.voltdb.BackendTarget; import org.voltdb.compiler.VoltProjectBuilder;
import java.io.*; import java.security.*; import junit.framework.*; import org.voltdb.*; import org.voltdb.compiler.*;
[ "java.io", "java.security", "junit.framework", "org.voltdb", "org.voltdb.compiler" ]
java.io; java.security; junit.framework; org.voltdb; org.voltdb.compiler;
372,502
public void read_reply (RequestOutputStream out) { // When reading a reply, the calling thread must hold a lock on both // the input and the output stream, otherwise we might end up doing // nasty stuff. assert Thread.holdsLock (this); assert Thread.holdsLock (out); // Flush the current request. // DON'T use plain send() because this could trigger a round-trip check // which would mess up with the reply. out.send_impl(); out.flush(); int exp_seq_no = out.seq_number; // Fetch all events and errors that may come before the reply. int code = -1; do { try { mark (1); code = read_int8 (); reset (); } catch (IOException ex) { handle_exception (ex); } if (code == 0) // Error. read_error (); else if (code > 1) { // Event. Event ev = read_event_from_stream (); if (ev != null) events.addLast (ev); }// else // Reply or Exception. } while (code != 1); // Check reply header, especially make sure that the sequence codes match. try { mark (4); int reply = read_int8 (); assert reply == 1 : "Reply code must be 1 but is: " + reply; skip (1); int seq_no = read_int16 (); assert (exp_seq_no == seq_no) : "expected sequence number: " + exp_seq_no + " got sequence number: " + seq_no; reset (); } catch (IOException ex) { handle_exception (ex); } // Now the calling thread can safely read the reply. }
void function (RequestOutputStream out) { assert Thread.holdsLock (this); assert Thread.holdsLock (out); out.send_impl(); out.flush(); int exp_seq_no = out.seq_number; int code = -1; do { try { mark (1); code = read_int8 (); reset (); } catch (IOException ex) { handle_exception (ex); } if (code == 0) read_error (); else if (code > 1) { Event ev = read_event_from_stream (); if (ev != null) events.addLast (ev); } } while (code != 1); try { mark (4); int reply = read_int8 (); assert reply == 1 : STR + reply; skip (1); int seq_no = read_int16 (); assert (exp_seq_no == seq_no) : STR + exp_seq_no + STR + seq_no; reset (); } catch (IOException ex) { handle_exception (ex); } }
/** * Flushes the currently pending request and starts reading the reply. The specified sequence * number is used to check the reply sequence number. * * @param seq_no the sequence number of the request * * @return the input stream for reading the reply */
Flushes the currently pending request and starts reading the reply. The specified sequence number is used to check the reply sequence number
read_reply
{ "repo_name": "chriskmanx/qmole", "path": "QMOLEDEV/escher-0.3/src/gnu/x11/ResponseInputStream.java", "license": "gpl-3.0", "size": 13615 }
[ "gnu.x11.event.Event", "java.io.IOException" ]
import gnu.x11.event.Event; import java.io.IOException;
import gnu.x11.event.*; import java.io.*;
[ "gnu.x11.event", "java.io" ]
gnu.x11.event; java.io;
2,088,139
public Arg getArgument(int index);
Arg function(int index);
/** * Gets Policy Argument definition for the specified argument index * * @param index argument index * @return ARG.KEY or ARG.START_VALUE or ARG.END_VALUE */
Gets Policy Argument definition for the specified argument index
getArgument
{ "repo_name": "daniel-he/community-edition", "path": "projects/repository/source/java/org/alfresco/repo/policy/PolicyDefinition.java", "license": "lgpl-3.0", "size": 1865 }
[ "org.alfresco.repo.policy.Policy" ]
import org.alfresco.repo.policy.Policy;
import org.alfresco.repo.policy.*;
[ "org.alfresco.repo" ]
org.alfresco.repo;
707,643
public Pointer<?> av_malloc(long size) { return Lib.av_malloc(size); }
Pointer<?> function(long size) { return Lib.av_malloc(size); }
/** * Allocate a block of size bytes with alignment suitable for all memory * accesses (including vectors if available on the CPU). * * @param size size in bytes for the memory block to be allocated * @return pointer to the allocated block, NULL if the block cannot be * allocated */
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if available on the CPU)
av_malloc
{ "repo_name": "operutka/jlibav", "path": "jlibav/src/main/java/org/libav/avutil/bridge/AVUtilLibrary.java", "license": "lgpl-3.0", "size": 31604 }
[ "org.bridj.Pointer" ]
import org.bridj.Pointer;
import org.bridj.*;
[ "org.bridj" ]
org.bridj;
2,390,630
public List<Map<String, Object>> listErrata(User loggedInUser, String channelLabel) throws NoSuchChannelException { List<Map<String, Object>> list = listErrata(loggedInUser, channelLabel, "", ""); return list; }
List<Map<String, Object>> function(User loggedInUser, String channelLabel) throws NoSuchChannelException { List<Map<String, Object>> list = listErrata(loggedInUser, channelLabel, STR"); return list; }
/** * List the errata applicable to a channel * @param loggedInUser The current user * @param channelLabel The label for the channel * @return the errata applicable to a channel * @throws NoSuchChannelException thrown if there is no channel matching * channelLabel. * * When removing deprecation, swtich this method over to using * listErrata(sessionKey, null, null) after deleting * listErrata(String, String, String, String), then update docs * to use $ErrataOverviewSerializer * * * @xmlrpc.doc List the errata applicable to a channel * @xmlrpc.param #session_key() * @xmlrpc.param #param_desc("string", "channelLabel", "channel to query") * @xmlrpc.returntype * #array() * #struct("errata") * #prop_desc("int", "id", "Errata Id") * #prop_desc("string", "advisory_synopsis", "Summary of the erratum.") * #prop_desc("string", "advisory_type", "Type label such as Security, Bug Fix") * #prop_desc("string", "advisory_name", "Name such as RHSA, etc") * #prop_desc("string","advisory", "name of the advisory (Deprecated)") * #prop_desc("string","issue_date", * "date format follows YYYY-MM-DD HH24:MI:SS (Deprecated)") * #prop_desc("string","update_date", * "date format follows YYYY-MM-DD HH24:MI:SS (Deprecated)") * #prop("string","synopsis (Deprecated)") * #prop_desc("string","last_modified_date", * "date format follows YYYY-MM-DD HH24:MI:SS (Deprecated)") * #struct_end() * #array_end() */
List the errata applicable to a channel
listErrata
{ "repo_name": "davidhrbac/spacewalk", "path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java", "license": "gpl-2.0", "size": 127652 }
[ "com.redhat.rhn.domain.user.User", "com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException", "java.util.List", "java.util.Map" ]
import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException; import java.util.List; import java.util.Map;
import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.xmlrpc.*; import java.util.*;
[ "com.redhat.rhn", "java.util" ]
com.redhat.rhn; java.util;
1,918,373
@Test public void getAssembly() throws LocalOperationException, RequestException, IOException { mockServerClient.when(HttpRequest.request() .withPath("/assemblies/76fe5df1c93a0a530f3e583805cf98b4").withMethod("GET")) .respond(HttpResponse.response().withBody(getJson("assembly.json"))); AssemblyResponse assembly = transloadit.getAssembly("76fe5df1c93a0a530f3e583805cf98b4"); assertEquals(assembly.getId(), "76fe5df1c93a0a530f3e583805cf98b4"); assertEquals(assembly.getUrl(), "http://localhost:9040/assemblies/76fe5df1c93a0a530f3e583805cf98b4"); }
void function() throws LocalOperationException, RequestException, IOException { mockServerClient.when(HttpRequest.request() .withPath(STR).withMethod("GET")) .respond(HttpResponse.response().withBody(getJson(STR))); AssemblyResponse assembly = transloadit.getAssembly(STR); assertEquals(assembly.getId(), STR); assertEquals(assembly.getUrl(), "http: }
/** * Tests if {@link Transloadit#getAssembly(String)} returns the specified Assembly's response * by verifying the assembly_id and host URL. * * @throws LocalOperationException if building the request goes wrong. * @throws RequestException if communication with the server goes wrong. * @throws IOException if Test resource "assembly.json" is missing. */
Tests if <code>Transloadit#getAssembly(String)</code> returns the specified Assembly's response by verifying the assembly_id and host URL
getAssembly
{ "repo_name": "transloadit/java-sdk", "path": "src/test/java/com/transloadit/sdk/TransloaditTest.java", "license": "mit", "size": 12543 }
[ "com.transloadit.sdk.exceptions.LocalOperationException", "com.transloadit.sdk.exceptions.RequestException", "com.transloadit.sdk.response.AssemblyResponse", "java.io.IOException", "org.junit.Assert", "org.mockserver.model.HttpRequest", "org.mockserver.model.HttpResponse" ]
import com.transloadit.sdk.exceptions.LocalOperationException; import com.transloadit.sdk.exceptions.RequestException; import com.transloadit.sdk.response.AssemblyResponse; import java.io.IOException; import org.junit.Assert; import org.mockserver.model.HttpRequest; import org.mockserver.model.HttpResponse;
import com.transloadit.sdk.exceptions.*; import com.transloadit.sdk.response.*; import java.io.*; import org.junit.*; import org.mockserver.model.*;
[ "com.transloadit.sdk", "java.io", "org.junit", "org.mockserver.model" ]
com.transloadit.sdk; java.io; org.junit; org.mockserver.model;
987,431
@Override public void onDeath(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); if (!worldObj.isRemote) { EntityIsaacBlood isaac = new EntityIsaacBlood(worldObj); isaac.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); worldObj.spawnEntityInWorld(isaac); } }
void function(DamageSource par1DamageSource) { super.onDeath(par1DamageSource); if (!worldObj.isRemote) { EntityIsaacBlood isaac = new EntityIsaacBlood(worldObj); isaac.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); worldObj.spawnEntityInWorld(isaac); } }
/** * Called when the mob's health reaches 0. */
Called when the mob's health reaches 0
onDeath
{ "repo_name": "sirolf2009/Necromancy", "path": "common/com/sirolf2009/necromancy/entity/EntityIsaacNormal.java", "license": "lgpl-3.0", "size": 3669 }
[ "net.minecraft.util.DamageSource" ]
import net.minecraft.util.DamageSource;
import net.minecraft.util.*;
[ "net.minecraft.util" ]
net.minecraft.util;
819,954
public UriComponents toUri(String methodName, Object[] parameters, Map<String, Object> pathVariables) { Assert.notEmpty(pathVariables, "PetsItemVisitsThymeleafController links need at least " + "the Pet id Path Variable with the 'pet' key"); Assert.notNull(pathVariables.get("pet"), "PetsItemVisitsThymeleafController links need at least " + "the Pet id Path Variable with the 'pet' key"); if (methodName.equals(CREATE_FORM)) { return MvcUriComponentsBuilder .fromMethodCall(MvcUriComponentsBuilder.on(getControllerClass()).createForm(null, null)) .buildAndExpand(pathVariables); } if (methodName.equals(CREATE)) { return MvcUriComponentsBuilder .fromMethodCall(MvcUriComponentsBuilder.on(getControllerClass()).create(null, null, null)) .buildAndExpand(pathVariables); } if (methodName.equals(DATATABLES)) { return MvcUriComponentsBuilder .fromMethodCall( MvcUriComponentsBuilder.on(getControllerClass()).datatables(null, null, null, null, null)) .buildAndExpand(pathVariables); } throw new IllegalArgumentException("Invalid method name: " + methodName); }
UriComponents function(String methodName, Object[] parameters, Map<String, Object> pathVariables) { Assert.notEmpty(pathVariables, STR + STR); Assert.notNull(pathVariables.get("pet"), STR + STR); if (methodName.equals(CREATE_FORM)) { return MvcUriComponentsBuilder .fromMethodCall(MvcUriComponentsBuilder.on(getControllerClass()).createForm(null, null)) .buildAndExpand(pathVariables); } if (methodName.equals(CREATE)) { return MvcUriComponentsBuilder .fromMethodCall(MvcUriComponentsBuilder.on(getControllerClass()).create(null, null, null)) .buildAndExpand(pathVariables); } if (methodName.equals(DATATABLES)) { return MvcUriComponentsBuilder .fromMethodCall( MvcUriComponentsBuilder.on(getControllerClass()).datatables(null, null, null, null, null)) .buildAndExpand(pathVariables); } throw new IllegalArgumentException(STR + methodName); }
/** * TODO Auto-generated method documentation * * @param methodName * @param parameters * @param pathVariables * @return UriComponents */
TODO Auto-generated method documentation
toUri
{ "repo_name": "DISID/disid-proofs", "path": "spring-roo-entity-format/src/main/java/org/springframework/roo/entityformat/web/PetsItemVisitsThymeleafLinkFactory.java", "license": "gpl-3.0", "size": 2314 }
[ "java.util.Map", "org.springframework.util.Assert", "org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder", "org.springframework.web.util.UriComponents" ]
import java.util.Map; import org.springframework.util.Assert; import org.springframework.web.servlet.mvc.method.annotation.MvcUriComponentsBuilder; import org.springframework.web.util.UriComponents;
import java.util.*; import org.springframework.util.*; import org.springframework.web.servlet.mvc.method.annotation.*; import org.springframework.web.util.*;
[ "java.util", "org.springframework.util", "org.springframework.web" ]
java.util; org.springframework.util; org.springframework.web;
192,724
public int saveDeliverable(int projectID, Deliverable deliverable, User user, String justification);
int function(int projectID, Deliverable deliverable, User user, String justification);
/** * This method saves the information of the given deliverable that belong to a specific project into the database. * * @param projectID is the project id where the deliverable belongs to. * @param deliverable - is the deliverable object with the new information to be added/updated. * @param user - is the user that is making the change. * @param justification - is the justification statement. * @return a number greater than 0 representing the new ID assigned by the database, 0 if the deliverable was updated * or -1 is some error occurred. */
This method saves the information of the given deliverable that belong to a specific project into the database
saveDeliverable
{ "repo_name": "CCAFS/ccafs-ap", "path": "impactPathways/src/main/java/org/cgiar/ccafs/ap/data/manager/DeliverableManager.java", "license": "gpl-3.0", "size": 7190 }
[ "org.cgiar.ccafs.ap.data.model.Deliverable", "org.cgiar.ccafs.ap.data.model.User" ]
import org.cgiar.ccafs.ap.data.model.Deliverable; import org.cgiar.ccafs.ap.data.model.User;
import org.cgiar.ccafs.ap.data.model.*;
[ "org.cgiar.ccafs" ]
org.cgiar.ccafs;
1,297,310
private StringPart createStringPart(final String name, final String value) { final StringPart stringPart = new StringPart(name, value); stringPart.setTransferEncoding(null); stringPart.setContentType(null); return stringPart; }
StringPart function(final String name, final String value) { final StringPart stringPart = new StringPart(name, value); stringPart.setTransferEncoding(null); stringPart.setContentType(null); return stringPart; }
/** * Utility method for creating string parts, since we need to remove transferEncoding and content type to behave like a browser * * @param name * the form field name * @param value * the for field value * @return return the created StringPart */
Utility method for creating string parts, since we need to remove transferEncoding and content type to behave like a browser
createStringPart
{ "repo_name": "tea-dragon/triplea", "path": "src/main/java/games/strategy/engine/pbem/TripleAWarClubForumPoster.java", "license": "gpl-2.0", "size": 9259 }
[ "org.apache.commons.httpclient.methods.multipart.StringPart" ]
import org.apache.commons.httpclient.methods.multipart.StringPart;
import org.apache.commons.httpclient.methods.multipart.*;
[ "org.apache.commons" ]
org.apache.commons;
247,773
public boolean cadastrarNotaJulgamento (Julgamento_model julgamentoModel){ //declarocoes de variaveis Connection conn = null; Statement stmt = null; try{ conn = BDConexao_dao.conectar(); conn.setAutoCommit(false); // monto os valores para a minha query String sql = "INSERT INTO `bodyboardsys`.`julgamento` " + "(`idjulgamento`, " + "`idjuizbateria`, " + "`idonda`, " + "`nota`, " + "`dataCadastro`) " + "values " + "(NULL, " + "'"+julgamentoModel.getJuizBateriaModel().getIdjuizbateria()+"', " + "'"+julgamentoModel.getOndaModel().getIdonda()+"', " + "'"+julgamentoModel.getNota()+"', " + "NULL);"; stmt = conn.createStatement(); stmt.execute(sql); } catch(SQLException e){ try { // dou um rollback no BD caso ocorra alguma excessao ao inserir o Campeonato conn.rollback(); conn.close(); System.out.println("Erro ao conectar com o banco: " + e.getMessage()); System.err.println("SQLException: " + e.getMessage()); System.err.println("SQLState: " + e.getSQLState()); System.err.println("VendorError: " + e.getErrorCode()); return false; } catch (SQLException e2) { System.out.println("Erro ao conectar com o banco: " + e.getMessage()); System.err.println("SQLException: " + e.getMessage()); System.err.println("SQLState: " + e.getSQLState()); System.err.println("VendorError: " + e.getErrorCode()); return false; } } try{ //dou commit no BD das alteracoes conn.commit(); //fecho a conexao do BD conn.close(); return true; } catch (Exception e) { return false; } }
boolean function (Julgamento_model julgamentoModel){ Connection conn = null; Statement stmt = null; try{ conn = BDConexao_dao.conectar(); conn.setAutoCommit(false); String sql = STR + STR + STR + STR + STR + STR + STR + STR + "'"+julgamentoModel.getJuizBateriaModel().getIdjuizbateria()+STR + "'"+julgamentoModel.getOndaModel().getIdonda()+STR + "'"+julgamentoModel.getNota()+STR + STR; stmt = conn.createStatement(); stmt.execute(sql); } catch(SQLException e){ try { conn.rollback(); conn.close(); System.out.println(STR + e.getMessage()); System.err.println(STR + e.getMessage()); System.err.println(STR + e.getSQLState()); System.err.println(STR + e.getErrorCode()); return false; } catch (SQLException e2) { System.out.println(STR + e.getMessage()); System.err.println(STR + e.getMessage()); System.err.println(STR + e.getSQLState()); System.err.println(STR + e.getErrorCode()); return false; } } try{ conn.commit(); conn.close(); return true; } catch (Exception e) { return false; } }
/** * Funcao para cadastro de notas de um julgamento que um atleta surfou * @param Julgamento_model julgamentoModel * @return boolean * */
Funcao para cadastro de notas de um julgamento que um atleta surfou
cadastrarNotaJulgamento
{ "repo_name": "rtancman/bbsys", "path": "src/br/com/bbsys/dao/campeonato/Julgamento/Julgamento_dao.java", "license": "apache-2.0", "size": 13345 }
[ "java.sql.Connection", "java.sql.SQLException", "java.sql.Statement" ]
import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement;
import java.sql.*;
[ "java.sql" ]
java.sql;
932,860
@SuppressWarnings("deprecation") public void setStatusBarTintDrawable(Drawable drawable) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundDrawable(drawable); } }
@SuppressWarnings(STR) void function(Drawable drawable) { if (mStatusBarAvailable) { mStatusBarTintView.setBackgroundDrawable(drawable); } }
/** * Apply the specified drawable to the system status bar. * * @param drawable The drawable to use as the background, or null to remove it. */
Apply the specified drawable to the system status bar
setStatusBarTintDrawable
{ "repo_name": "EricSun2012/EricWidget", "path": "app/src/main/java/com/EricSun/EricWidget/Utils/SystemBarTintManager.java", "license": "mit", "size": 20510 }
[ "android.graphics.drawable.Drawable" ]
import android.graphics.drawable.Drawable;
import android.graphics.drawable.*;
[ "android.graphics" ]
android.graphics;
2,572,408
default Stream<? extends Scannable> inners() { return Stream.empty(); }
default Stream<? extends Scannable> inners() { return Stream.empty(); }
/** * Return a {@link Stream} of referenced inners (flatmap, multicast etc) * * @return a {@link Stream} of referenced inners (flatmap, multicast etc) */
Return a <code>Stream</code> of referenced inners (flatmap, multicast etc)
inners
{ "repo_name": "sdeleuze/reactor-core", "path": "reactor-core/src/main/java/reactor/core/Scannable.java", "license": "apache-2.0", "size": 16169 }
[ "java.util.stream.Stream" ]
import java.util.stream.Stream;
import java.util.stream.*;
[ "java.util" ]
java.util;
218,840
public String[] getCalendarDaysOfWeekNames(boolean longNames) { int firstDayOfWeek = getFirstDayOfWeek(); Locale currentLocale = rb.getLocale(); SimpleDateFormat longDay = new SimpleDateFormat("EEEE", currentLocale); SimpleDateFormat shortDay = new SimpleDateFormat("EEE", currentLocale); String[] weekDays; String[] longWeekDays = new String[] { longDay.format(dateSunday), longDay.format(dateMonday), longDay.format(dateTuesday), longDay.format(dateWednesday), longDay.format(dateThursday), longDay.format(dateFriday), longDay.format(dateSaturday) }; String[] shortWeekDays = new String[] { shortDay.format(dateSunday), shortDay.format(dateMonday), shortDay.format(dateTuesday), shortDay.format(dateWednesday), shortDay.format(dateThursday), shortDay.format(dateFriday), shortDay.format(dateSaturday) }; if ( longNames ) weekDays = longWeekDays; else weekDays = shortWeekDays; String[] localeDays = new String[7]; for(int col = firstDayOfWeek; col<=7; col++) localeDays[col-firstDayOfWeek] = weekDays[col-1]; for (int col = 0; col<firstDayOfWeek-1;col++) localeDays[6-col] = weekDays[col]; return localeDays; }
String[] function(boolean longNames) { int firstDayOfWeek = getFirstDayOfWeek(); Locale currentLocale = rb.getLocale(); SimpleDateFormat longDay = new SimpleDateFormat("EEEE", currentLocale); SimpleDateFormat shortDay = new SimpleDateFormat("EEE", currentLocale); String[] weekDays; String[] longWeekDays = new String[] { longDay.format(dateSunday), longDay.format(dateMonday), longDay.format(dateTuesday), longDay.format(dateWednesday), longDay.format(dateThursday), longDay.format(dateFriday), longDay.format(dateSaturday) }; String[] shortWeekDays = new String[] { shortDay.format(dateSunday), shortDay.format(dateMonday), shortDay.format(dateTuesday), shortDay.format(dateWednesday), shortDay.format(dateThursday), shortDay.format(dateFriday), shortDay.format(dateSaturday) }; if ( longNames ) weekDays = longWeekDays; else weekDays = shortWeekDays; String[] localeDays = new String[7]; for(int col = firstDayOfWeek; col<=7; col++) localeDays[col-firstDayOfWeek] = weekDays[col-1]; for (int col = 0; col<firstDayOfWeek-1;col++) localeDays[6-col] = weekDays[col]; return localeDays; }
/** Returns array of weekday names, using the locale-specific first day-of-week ** ** @param longNames indicates whether to use short or long version of weekday names **/
Returns array of weekday names, using the locale-specific first day-of-week @param longNames indicates whether to use short or long version of weekday names
getCalendarDaysOfWeekNames
{ "repo_name": "OpenCollabZA/sakai", "path": "calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java", "license": "apache-2.0", "size": 17701 }
[ "java.text.SimpleDateFormat", "java.util.Locale" ]
import java.text.SimpleDateFormat; import java.util.Locale;
import java.text.*; import java.util.*;
[ "java.text", "java.util" ]
java.text; java.util;
2,312,846
private List<Event> createInterfaceOnNode(Connection dbConn, String nodeLabel, String ipaddr) throws SQLException, FailedOperationException { PreparedStatement stmt = null; ResultSet rs = null; final DBUtils d = new DBUtils(getClass()); try { // There is no ipinterface associated with the specified nodeLabel // exist in the database. Verify if a node with the nodeLabel already // exist in the database. If not, create a node with the nodeLabel and add it // to the database, and also add the ipaddress associated with this node to // the database. If the node with the nodeLabel exists in the node // table, just add the ip address to the database. stmt = dbConn.prepareStatement(SQL_QUERY_NODE_EXIST); d.watch(stmt); stmt.setString(1, nodeLabel); rs = stmt.executeQuery(); d.watch(rs); List<Event> eventsToSend = new LinkedList<Event>(); while (rs.next()) { if (log().isDebugEnabled()) log().debug("addInterfaceHandler: add interface: " + ipaddr + " to the database."); // Node already exists. Add the ipaddess to the ipinterface // table InetAddress ifaddr; try { ifaddr = InetAddressUtils.addr(ipaddr); } catch (final IllegalArgumentException e) { throw new FailedOperationException("unable to resolve host " + ipaddr + ": " + e.getMessage(), e); } int nodeId = rs.getInt(1); String dpName = rs.getString(2); DbIpInterfaceEntry ipInterface = DbIpInterfaceEntry.create(nodeId, ifaddr); ipInterface.setHostname(ifaddr.getHostName()); ipInterface.setManagedState(DbIpInterfaceEntry.STATE_MANAGED); ipInterface.setPrimaryState(DbIpInterfaceEntry.SNMP_NOT_ELIGIBLE); ipInterface.store(dbConn); // create a nodeEntry DbNodeEntry nodeEntry = DbNodeEntry.get(nodeId, dpName); Event newEvent = EventUtils.createNodeGainedInterfaceEvent(nodeEntry, ifaddr); eventsToSend.add(newEvent); } return eventsToSend; } finally { d.cleanUp(); } }
List<Event> function(Connection dbConn, String nodeLabel, String ipaddr) throws SQLException, FailedOperationException { PreparedStatement stmt = null; ResultSet rs = null; final DBUtils d = new DBUtils(getClass()); try { stmt = dbConn.prepareStatement(SQL_QUERY_NODE_EXIST); d.watch(stmt); stmt.setString(1, nodeLabel); rs = stmt.executeQuery(); d.watch(rs); List<Event> eventsToSend = new LinkedList<Event>(); while (rs.next()) { if (log().isDebugEnabled()) log().debug(STR + ipaddr + STR); InetAddress ifaddr; try { ifaddr = InetAddressUtils.addr(ipaddr); } catch (final IllegalArgumentException e) { throw new FailedOperationException(STR + ipaddr + STR + e.getMessage(), e); } int nodeId = rs.getInt(1); String dpName = rs.getString(2); DbIpInterfaceEntry ipInterface = DbIpInterfaceEntry.create(nodeId, ifaddr); ipInterface.setHostname(ifaddr.getHostName()); ipInterface.setManagedState(DbIpInterfaceEntry.STATE_MANAGED); ipInterface.setPrimaryState(DbIpInterfaceEntry.SNMP_NOT_ELIGIBLE); ipInterface.store(dbConn); DbNodeEntry nodeEntry = DbNodeEntry.get(nodeId, dpName); Event newEvent = EventUtils.createNodeGainedInterfaceEvent(nodeEntry, ifaddr); eventsToSend.add(newEvent); } return eventsToSend; } finally { d.cleanUp(); } }
/** * Helper method used to create add an interface to a node. * * @param dbConn * @param nodeLabel * @param ipaddr * @return a LinkedList of events to be sent * @throws SQLException * @throws FailedOperationException */
Helper method used to create add an interface to a node
createInterfaceOnNode
{ "repo_name": "bugcy013/opennms-tmp-tools", "path": "opennms-services/src/main/java/org/opennms/netmgt/capsd/BroadcastEventProcessor.java", "license": "gpl-2.0", "size": 95288 }
[ "java.net.InetAddress", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.SQLException", "java.util.LinkedList", "java.util.List", "org.opennms.core.utils.DBUtils", "org.opennms.core.utils.InetAddressUtils", "org.opennms.netmgt.model.capsd.DbIpInterfaceEntry", ...
import java.net.InetAddress; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedList; import java.util.List; import org.opennms.core.utils.DBUtils; import org.opennms.core.utils.InetAddressUtils; import org.opennms.netmgt.model.capsd.DbIpInterfaceEntry; import org.opennms.netmgt.model.capsd.DbNodeEntry; import org.opennms.netmgt.xml.event.Event;
import java.net.*; import java.sql.*; import java.util.*; import org.opennms.core.utils.*; import org.opennms.netmgt.model.capsd.*; import org.opennms.netmgt.xml.event.*;
[ "java.net", "java.sql", "java.util", "org.opennms.core", "org.opennms.netmgt" ]
java.net; java.sql; java.util; org.opennms.core; org.opennms.netmgt;
1,218,423
@Test(expected = UnsupportedOperationException.class) public void testRetainAll() { roster.retainAll(testUsers); }
@Test(expected = UnsupportedOperationException.class) void function() { roster.retainAll(testUsers); }
/** * Test method for {@link org.openymsg.legacy.roster.Roster#retainAll(java.util.Collection)}. */
Test method for <code>org.openymsg.legacy.roster.Roster#retainAll(java.util.Collection)</code>
testRetainAll
{ "repo_name": "OpenYMSG/openymsg", "path": "src/test/java/org/openymsg/legacy/roster/RosterBulkOperationsForbidden.java", "license": "gpl-2.0", "size": 2316 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
13,950
private int createPortMap(JsonObject requestBody, RestResource restResource) { final JsonObject vlanmapRequestBody = MapResourceGenerator .getCreatePortMapRequestBody(requestBody); StringBuilder sb = new StringBuilder(); sb.append(VtnServiceOpenStackConsts.VTN_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(getTenantId()); sb.append(VtnServiceOpenStackConsts.VBRIDGE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(getNetId()); sb.append(VtnServiceOpenStackConsts.INTERFACE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(requestBody.get(VtnServiceOpenStackConsts.ID).getAsString()); sb.append(VtnServiceOpenStackConsts.PORTMAP_PATH); restResource.setPath(sb.toString()); restResource.setSessionID(getSessionID()); restResource.setConfigID(getConfigID()); return restResource.put(vlanmapRequestBody); }
int function(JsonObject requestBody, RestResource restResource) { final JsonObject vlanmapRequestBody = MapResourceGenerator .getCreatePortMapRequestBody(requestBody); StringBuilder sb = new StringBuilder(); sb.append(VtnServiceOpenStackConsts.VTN_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(getTenantId()); sb.append(VtnServiceOpenStackConsts.VBRIDGE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(getNetId()); sb.append(VtnServiceOpenStackConsts.INTERFACE_PATH); sb.append(VtnServiceOpenStackConsts.URI_CONCATENATOR); sb.append(requestBody.get(VtnServiceOpenStackConsts.ID).getAsString()); sb.append(VtnServiceOpenStackConsts.PORTMAP_PATH); restResource.setPath(sb.toString()); restResource.setSessionID(getSessionID()); restResource.setConfigID(getConfigID()); return restResource.put(vlanmapRequestBody); }
/** * Create Port-Map at UNC * * @param requestBody * - OpenStack request body * @param restResource * - RestResource instance * @return - erorrCode, 200 for Success */
Create Port-Map at UNC
createPortMap
{ "repo_name": "opendaylight/vtn", "path": "coordinator/java/vtn-javaapi/src/org/opendaylight/vtn/javaapi/resources/openstack/PortsResource.java", "license": "epl-1.0", "size": 31980 }
[ "com.google.gson.JsonObject", "org.opendaylight.vtn.javaapi.RestResource", "org.opendaylight.vtn.javaapi.openstack.constants.VtnServiceOpenStackConsts", "org.opendaylight.vtn.javaapi.openstack.convertor.MapResourceGenerator" ]
import com.google.gson.JsonObject; import org.opendaylight.vtn.javaapi.RestResource; import org.opendaylight.vtn.javaapi.openstack.constants.VtnServiceOpenStackConsts; import org.opendaylight.vtn.javaapi.openstack.convertor.MapResourceGenerator;
import com.google.gson.*; import org.opendaylight.vtn.javaapi.*; import org.opendaylight.vtn.javaapi.openstack.constants.*; import org.opendaylight.vtn.javaapi.openstack.convertor.*;
[ "com.google.gson", "org.opendaylight.vtn" ]
com.google.gson; org.opendaylight.vtn;
121,071
public void setup() { // get GEOROCKET_CLI_HOME String geoRocketCliHomeStr = System.getenv("GEOROCKET_CLI_HOME"); if (geoRocketCliHomeStr == null) { System.err.println("Environment variable GEOROCKET_CLI_HOME not set. " + "Using current working directory."); geoRocketCliHomeStr = new File(".").getAbsolutePath(); } try { geoRocketCliHome = new File(geoRocketCliHomeStr).getCanonicalFile(); } catch (IOException e) { System.err.println("Invalid GeoRocket home: " + geoRocketCliHomeStr); System.exit(1); } }
void function() { String geoRocketCliHomeStr = System.getenv(STR); if (geoRocketCliHomeStr == null) { System.err.println(STR + STR); geoRocketCliHomeStr = new File(".").getAbsolutePath(); } try { geoRocketCliHome = new File(geoRocketCliHomeStr).getCanonicalFile(); } catch (IOException e) { System.err.println(STR + geoRocketCliHomeStr); System.exit(1); } }
/** * Setup GeoRocket CLI */
Setup GeoRocket CLI
setup
{ "repo_name": "andrej-sajenko/georocket", "path": "georocket-cli/src/main/java/io/georocket/GeoRocketCli.java", "license": "apache-2.0", "size": 9114 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,613,060
@SideOnly(Side.CLIENT) public void displayAllRelevantItems(NonNullList<ItemStack> p_78018_1_) { for (Item item : Item.REGISTRY) { item.getSubItems(this, p_78018_1_); } }
@SideOnly(Side.CLIENT) void function(NonNullList<ItemStack> p_78018_1_) { for (Item item : Item.REGISTRY) { item.getSubItems(this, p_78018_1_); } }
/** * only shows items which have tabToDisplayOn == this */
only shows items which have tabToDisplayOn == this
displayAllRelevantItems
{ "repo_name": "Severed-Infinity/technium", "path": "build/tmp/recompileMc/sources/net/minecraft/creativetab/CreativeTabs.java", "license": "gpl-3.0", "size": 9746 }
[ "net.minecraft.item.Item", "net.minecraft.item.ItemStack", "net.minecraft.util.NonNullList", "net.minecraftforge.fml.relauncher.Side", "net.minecraftforge.fml.relauncher.SideOnly" ]
import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraft.item.*; import net.minecraft.util.*; import net.minecraftforge.fml.relauncher.*;
[ "net.minecraft.item", "net.minecraft.util", "net.minecraftforge.fml" ]
net.minecraft.item; net.minecraft.util; net.minecraftforge.fml;
2,557,195
@Deployment(resources = { "org/activiti/engine/test/api/event/SignalThrowingEventListenerTest.globalSignal.bpmn20.xml", "org/activiti/engine/test/api/event/SignalThrowingEventListenerTest.globalSignalExternalProcess.bpmn20.xml" }) public void testGlobalSignal() throws Exception { SignalThrowingEventListener listener = null; try { listener = new SignalThrowingEventListener(); listener.setSignalName("Signal"); listener.setProcessInstanceScope(false); processEngineConfiguration.getEventDispatcher().addEventListener(listener, ActivitiEventType.TASK_ASSIGNED); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("globalSignalProcess"); assertThat(processInstance).isNotNull(); ProcessInstance externalProcess = runtimeService.startProcessInstanceByKey("globalSignalProcessExternal"); assertThat(processInstance).isNotNull(); // Make sure process is not ended yet by querying it again externalProcess = runtimeService.createProcessInstanceQuery().processInstanceId(externalProcess.getId()).singleResult(); assertThat(externalProcess).isNotNull(); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertThat(task).isNotNull(); // Assign task to trigger signal taskService.setAssignee(task.getId(), "kermit"); // Second process should have been signaled externalProcess = runtimeService.createProcessInstanceQuery().processInstanceId(externalProcess.getId()).singleResult(); assertThat(externalProcess).isNull(); // Task assignee should still be set task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertThat(task).isNotNull(); assertThat(task.getAssignee()).isEqualTo("kermit"); } finally { processEngineConfiguration.getEventDispatcher().removeEventListener(listener); } }
@Deployment(resources = { STR, STR }) void function() throws Exception { SignalThrowingEventListener listener = null; try { listener = new SignalThrowingEventListener(); listener.setSignalName(STR); listener.setProcessInstanceScope(false); processEngineConfiguration.getEventDispatcher().addEventListener(listener, ActivitiEventType.TASK_ASSIGNED); ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(STR); assertThat(processInstance).isNotNull(); ProcessInstance externalProcess = runtimeService.startProcessInstanceByKey(STR); assertThat(processInstance).isNotNull(); externalProcess = runtimeService.createProcessInstanceQuery().processInstanceId(externalProcess.getId()).singleResult(); assertThat(externalProcess).isNotNull(); Task task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertThat(task).isNotNull(); taskService.setAssignee(task.getId(), STR); externalProcess = runtimeService.createProcessInstanceQuery().processInstanceId(externalProcess.getId()).singleResult(); assertThat(externalProcess).isNull(); task = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); assertThat(task).isNotNull(); assertThat(task.getAssignee()).isEqualTo(STR); } finally { processEngineConfiguration.getEventDispatcher().removeEventListener(listener); } }
/** * Test if an engine-wide signal is thrown as response to a dispatched event. */
Test if an engine-wide signal is thrown as response to a dispatched event
testGlobalSignal
{ "repo_name": "Activiti/Activiti", "path": "activiti-core/activiti-engine/src/test/java/org/activiti/engine/test/api/event/SignalThrowingEventListenerTest.java", "license": "apache-2.0", "size": 13136 }
[ "org.activiti.engine.delegate.event.ActivitiEventType", "org.activiti.engine.impl.bpmn.helper.SignalThrowingEventListener", "org.activiti.engine.runtime.ProcessInstance", "org.activiti.engine.task.Task", "org.activiti.engine.test.Deployment", "org.assertj.core.api.Assertions" ]
import org.activiti.engine.delegate.event.ActivitiEventType; import org.activiti.engine.impl.bpmn.helper.SignalThrowingEventListener; import org.activiti.engine.runtime.ProcessInstance; import org.activiti.engine.task.Task; import org.activiti.engine.test.Deployment; import org.assertj.core.api.Assertions;
import org.activiti.engine.delegate.event.*; import org.activiti.engine.impl.bpmn.helper.*; import org.activiti.engine.runtime.*; import org.activiti.engine.task.*; import org.activiti.engine.test.*; import org.assertj.core.api.*;
[ "org.activiti.engine", "org.assertj.core" ]
org.activiti.engine; org.assertj.core;
552,132
CompletableFuture<Map<String, Object>> getAccumulators(JobID jobID, ClassLoader loader);
CompletableFuture<Map<String, Object>> getAccumulators(JobID jobID, ClassLoader loader);
/** * Requests and returns the accumulators for the given job identifier. Accumulators can be * requested while a is running or after it has finished. * * @param jobID The job identifier of a job. * @param loader The class loader for deserializing the accumulator results. * @return A Map containing the accumulator's name and its value. */
Requests and returns the accumulators for the given job identifier. Accumulators can be requested while a is running or after it has finished
getAccumulators
{ "repo_name": "lincoln-lil/flink", "path": "flink-clients/src/main/java/org/apache/flink/client/program/ClusterClient.java", "license": "apache-2.0", "size": 7113 }
[ "java.util.Map", "java.util.concurrent.CompletableFuture", "org.apache.flink.api.common.JobID" ]
import java.util.Map; import java.util.concurrent.CompletableFuture; import org.apache.flink.api.common.JobID;
import java.util.*; import java.util.concurrent.*; import org.apache.flink.api.common.*;
[ "java.util", "org.apache.flink" ]
java.util; org.apache.flink;
2,705,281