method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public Pin get_pin(int p_no) {
if (p_no < 0 || p_no >= pin_arr.length) {
Logger.getLogger(Package.class.getName()).log(Level.INFO, "Package.get_pin: p_no out of range");
return null;
}
return pin_arr[p_no];
}
|
Pin function(int p_no) { if (p_no < 0 p_no >= pin_arr.length) { Logger.getLogger(Package.class.getName()).log(Level.INFO, STR); return null; } return pin_arr[p_no]; }
|
/**
* Returns the pin with the input number from this package.
*/
|
Returns the pin with the input number from this package
|
get_pin
|
{
"repo_name": "rbuj/FreeRouting",
"path": "src/main/java/net/freerouting/freeroute/library/Package.java",
"license": "gpl-3.0",
"size": 6719
}
|
[
"java.util.logging.Level",
"java.util.logging.Logger"
] |
import java.util.logging.Level; import java.util.logging.Logger;
|
import java.util.logging.*;
|
[
"java.util"
] |
java.util;
| 2,487,387
|
public Structure getStructure(File filename) throws IOException {
InputStreamProvider isp = new InputStreamProvider();
InputStream inStream = isp.getInputStream(filename);
return getStructure(inStream);
}
|
Structure function(File filename) throws IOException { InputStreamProvider isp = new InputStreamProvider(); InputStream inStream = isp.getInputStream(filename); return getStructure(inStream); }
|
/** opens filename, parses it and returns a Structure object
*
* @param filename a File object
* @return the Structure object
* @throws IOException ...
*/
|
opens filename, parses it and returns a Structure object
|
getStructure
|
{
"repo_name": "JolantaWojcik/biojavaOwn",
"path": "biojava3-structure/src/main/java/org/biojava/bio/structure/io/PDBFileReader.java",
"license": "lgpl-2.1",
"size": 27187
}
|
[
"java.io.File",
"java.io.IOException",
"java.io.InputStream",
"org.biojava.bio.structure.Structure",
"org.biojava3.core.util.InputStreamProvider"
] |
import java.io.File; import java.io.IOException; import java.io.InputStream; import org.biojava.bio.structure.Structure; import org.biojava3.core.util.InputStreamProvider;
|
import java.io.*; import org.biojava.bio.structure.*; import org.biojava3.core.util.*;
|
[
"java.io",
"org.biojava.bio",
"org.biojava3.core"
] |
java.io; org.biojava.bio; org.biojava3.core;
| 2,292,210
|
private void makeLargeFile(String fname) throws IOException {
File largeFile = new File(fname);
if (!largeFile.exists()) {
byte[] text = "abcdefghijklmnopqrstuvwxyz\n".getBytes();
FileOutputStream os = new FileOutputStream(largeFile);
for (int i = 0; i < 100000; i++) {
os.write(text);
}
os.close();
}
}
|
void function(String fname) throws IOException { File largeFile = new File(fname); if (!largeFile.exists()) { byte[] text = STR.getBytes(); FileOutputStream os = new FileOutputStream(largeFile); for (int i = 0; i < 100000; i++) { os.write(text); } os.close(); } }
|
/**
* Initialize a large file used for tests. This is to avoid
* having giant files checked into the source code repository.
*
* @param fname the name of the large file to create (if it
* doesn't already exist).
* @throws IOException if creating the large file fails.
*/
|
Initialize a large file used for tests. This is to avoid having giant files checked into the source code repository
|
makeLargeFile
|
{
"repo_name": "googlegsa/manager.v3",
"path": "projects/connector-manager/source/javatests/com/google/enterprise/connector/traversal/QueryTraverserTest.java",
"license": "apache-2.0",
"size": 26940
}
|
[
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException"
] |
import java.io.File; import java.io.FileOutputStream; import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,328,175
|
String jaxbPackage = GetCustomersByName.class.getPackage().getName();
SoapJaxbDataFormat dataFormat = new SoapJaxbDataFormat();
dataFormat.setContextPath(jaxbPackage);
dataFormat.setElementNameStrategy(null);
return dataFormat;
}
|
String jaxbPackage = GetCustomersByName.class.getPackage().getName(); SoapJaxbDataFormat dataFormat = new SoapJaxbDataFormat(); dataFormat.setContextPath(jaxbPackage); dataFormat.setElementNameStrategy(null); return dataFormat; }
|
/**
* Create Dataformat by using the setters
*/
|
Create Dataformat by using the setters
|
createDataFormat
|
{
"repo_name": "DariusX/camel",
"path": "components/camel-soap/src/test/java/org/apache/camel/dataformat/soap/SoapMarshalSetterTest.java",
"license": "apache-2.0",
"size": 1499
}
|
[
"com.example.customerservice.GetCustomersByName"
] |
import com.example.customerservice.GetCustomersByName;
|
import com.example.customerservice.*;
|
[
"com.example.customerservice"
] |
com.example.customerservice;
| 1,914,164
|
Process process = new ProcessBuilder(command).start();
InputStream stdout = process.getInputStream();
InputStreamReader reader = new InputStreamReader(stdout);
BufferedReader bufferedReader = new BufferedReader(reader);
int exitValue = process.waitFor();
String line;
List<String> result = new ArrayList<>();
while ((line = bufferedReader.readLine()) != null) {
result.add(line);
}
return result;
}
|
Process process = new ProcessBuilder(command).start(); InputStream stdout = process.getInputStream(); InputStreamReader reader = new InputStreamReader(stdout); BufferedReader bufferedReader = new BufferedReader(reader); int exitValue = process.waitFor(); String line; List<String> result = new ArrayList<>(); while ((line = bufferedReader.readLine()) != null) { result.add(line); } return result; }
|
/**
* Runs the given command and returns the output lines.
*
* @param command a {@link java.lang.String} object.
* @return a {@link java.util.List} object.
* @throws java.io.IOException if any.
* @throws java.lang.InterruptedException if any.
*/
|
Runs the given command and returns the output lines
|
run
|
{
"repo_name": "ngeor/zfs-snapshot-trimmer",
"path": "src/main/java/zfs/snapshot/trimmer/ProcessRunner.java",
"license": "mit",
"size": 1190
}
|
[
"java.io.BufferedReader",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.util.ArrayList",
"java.util.List"
] |
import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.List;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 726,461
|
@Override
public void info(final String message) {
logWrapper.logIfEnabled(loggerName, Level.INFO, null, message, (Throwable) null);
}
|
void function(final String message) { logWrapper.logIfEnabled(loggerName, Level.INFO, null, message, (Throwable) null); }
|
/**
* Logs a message object with the {@code Level.INFO} level.
*
* @param message the message object to log.
*/
|
Logs a message object with the Level.INFO level
|
info
|
{
"repo_name": "PurelyApplied/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/logging/log4j/LogWriterLogger.java",
"license": "apache-2.0",
"size": 56907
}
|
[
"org.apache.logging.log4j.Level"
] |
import org.apache.logging.log4j.Level;
|
import org.apache.logging.log4j.*;
|
[
"org.apache.logging"
] |
org.apache.logging;
| 2,215,546
|
public static void check() {
StringBuilder message = new StringBuilder();
final ServiceLoader<SAXParserFactory> allSax = ServiceLoader.load(SAXParserFactory.class);
for(final SAXParserFactory sax : allSax){
message.append(getClassName(sax.toString()));
message.append(" ");
}
logger.debug("Detected SAXParserFactory classes: " + message.toString());
message = new StringBuilder();
boolean invalidVersionFound = false;
if( hasValidClassVersion( "Parser", validParsers, message ) ) {
logger.info( message.toString() );
} else {
logger.warn(message.toString());
invalidVersionFound = true;
}
message = new StringBuilder();
final ServiceLoader<TransformerFactory> allXsl = ServiceLoader.load(TransformerFactory.class);
for(final TransformerFactory xsl : allXsl){
message.append(getClassName(xsl.toString()));
message.append(" ");
}
logger.debug("Detected TransformerFactory classes: " + message.toString());
message = new StringBuilder();
if( hasValidClassVersion( "Transformer", validTransformers, message ) ) {
logger.info( message.toString() );
} else {
logger.warn( message.toString() );
System.err.println( message.toString() );
invalidVersionFound = true;
}
message = new StringBuilder();
if( hasValidClassVersion( "Resolver", validResolvers, message ) ) {
logger.info(message.toString());
} else {
logger.warn(message.toString());
invalidVersionFound = true;
}
logger.info( "Using parser " + determineActualParserClass() );
logger.info( "Using transformer " + determineActualTransformerClass() );
if(invalidVersionFound) {
logger.warn("Using parser " + determineActualParserClass());
logger.warn( "Using transformer " + determineActualTransformerClass() );
}
}
|
static void function() { StringBuilder message = new StringBuilder(); final ServiceLoader<SAXParserFactory> allSax = ServiceLoader.load(SAXParserFactory.class); for(final SAXParserFactory sax : allSax){ message.append(getClassName(sax.toString())); message.append(" "); } logger.debug(STR + message.toString()); message = new StringBuilder(); boolean invalidVersionFound = false; if( hasValidClassVersion( STR, validParsers, message ) ) { logger.info( message.toString() ); } else { logger.warn(message.toString()); invalidVersionFound = true; } message = new StringBuilder(); final ServiceLoader<TransformerFactory> allXsl = ServiceLoader.load(TransformerFactory.class); for(final TransformerFactory xsl : allXsl){ message.append(getClassName(xsl.toString())); message.append(" "); } logger.debug(STR + message.toString()); message = new StringBuilder(); if( hasValidClassVersion( STR, validTransformers, message ) ) { logger.info( message.toString() ); } else { logger.warn( message.toString() ); System.err.println( message.toString() ); invalidVersionFound = true; } message = new StringBuilder(); if( hasValidClassVersion( STR, validResolvers, message ) ) { logger.info(message.toString()); } else { logger.warn(message.toString()); invalidVersionFound = true; } logger.info( STR + determineActualParserClass() ); logger.info( STR + determineActualTransformerClass() ); if(invalidVersionFound) { logger.warn(STR + determineActualParserClass()); logger.warn( STR + determineActualTransformerClass() ); } }
|
/**
* Perform checks on parsers, transformers and resolvers.
*/
|
Perform checks on parsers, transformers and resolvers
|
check
|
{
"repo_name": "ambs/exist",
"path": "exist-core/src/main/java/org/exist/validation/XmlLibraryChecker.java",
"license": "lgpl-2.1",
"size": 12850
}
|
[
"java.util.ServiceLoader",
"javax.xml.parsers.SAXParserFactory",
"javax.xml.transform.TransformerFactory"
] |
import java.util.ServiceLoader; import javax.xml.parsers.SAXParserFactory; import javax.xml.transform.TransformerFactory;
|
import java.util.*; import javax.xml.parsers.*; import javax.xml.transform.*;
|
[
"java.util",
"javax.xml"
] |
java.util; javax.xml;
| 1,485,746
|
@Test
public void getRootPackageWithSpecialCharactersTest() throws ParseException {
conflictResolver.setPrefixForIdentifier(VALID_PREFIX);
Date date = simpleDateFormat.parse(DATE1);
String rootPackage = getRootPackage((byte) 1, INVALID_NAME_SPACE1, date, conflictResolver);
assertThat(rootPackage.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
+ PERIOD + VALID_NAME_SPACE1 + PERIOD + DATE_WITH_REV1), is(true));
conflictResolver.setPrefixForIdentifier(null);
String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver);
assertThat(rootPackage1.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
+ PERIOD + VALID_NAME_SPACE2 + PERIOD + DATE_WITH_REV1), is(true));
String rootPackage2 = getRootPackage((byte) 1, INVALID_NAME_SPACE3, date, conflictResolver);
assertThat(rootPackage2.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
+ PERIOD + VALID_NAME_SPACE4 + PERIOD + DATE_WITH_REV1), is(true));
conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1);
String rootPackage3 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver);
assertThat(rootPackage3.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER
+ PERIOD + VALID_NAME_SPACE3 + PERIOD + DATE_WITH_REV1), is(true));
}
|
void function() throws ParseException { conflictResolver.setPrefixForIdentifier(VALID_PREFIX); Date date = simpleDateFormat.parse(DATE1); String rootPackage = getRootPackage((byte) 1, INVALID_NAME_SPACE1, date, conflictResolver); assertThat(rootPackage.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER + PERIOD + VALID_NAME_SPACE1 + PERIOD + DATE_WITH_REV1), is(true)); conflictResolver.setPrefixForIdentifier(null); String rootPackage1 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver); assertThat(rootPackage1.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER + PERIOD + VALID_NAME_SPACE2 + PERIOD + DATE_WITH_REV1), is(true)); String rootPackage2 = getRootPackage((byte) 1, INVALID_NAME_SPACE3, date, conflictResolver); assertThat(rootPackage2.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER + PERIOD + VALID_NAME_SPACE4 + PERIOD + DATE_WITH_REV1), is(true)); conflictResolver.setPrefixForIdentifier(INVALID_PREFIX1); String rootPackage3 = getRootPackage((byte) 1, INVALID_NAME_SPACE2, date, conflictResolver); assertThat(rootPackage3.equals(DEFAULT_BASE_PKG + PERIOD + VERSION_NUMBER + PERIOD + VALID_NAME_SPACE3 + PERIOD + DATE_WITH_REV1), is(true)); }
|
/**
* Unit test for root package generation with special characters presence.
*/
|
Unit test for root package generation with special characters presence
|
getRootPackageWithSpecialCharactersTest
|
{
"repo_name": "VinodKumarS-Huawei/ietf96yang",
"path": "utils/yangutils/plugin/src/test/java/org/onosproject/yangutils/translator/tojava/utils/JavaIdentifierSyntaxTest.java",
"license": "apache-2.0",
"size": 16297
}
|
[
"java.text.ParseException",
"java.util.Date",
"org.hamcrest.core.Is",
"org.junit.Assert",
"org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax"
] |
import java.text.ParseException; import java.util.Date; import org.hamcrest.core.Is; import org.junit.Assert; import org.onosproject.yangutils.translator.tojava.utils.JavaIdentifierSyntax;
|
import java.text.*; import java.util.*; import org.hamcrest.core.*; import org.junit.*; import org.onosproject.yangutils.translator.tojava.utils.*;
|
[
"java.text",
"java.util",
"org.hamcrest.core",
"org.junit",
"org.onosproject.yangutils"
] |
java.text; java.util; org.hamcrest.core; org.junit; org.onosproject.yangutils;
| 29,008
|
public static GetRecordByIdResultDocument export( GetRecordByIdResult response )
throws XMLException {
GetRecordByIdResultDocument doc = new GetRecordByIdResultDocument();
try {
doc.createEmptyDocument( response.getRequest().getVersion() );
Document owner = doc.getRootElement().getOwnerDocument();
if ( response != null && response.getRecords() != null ) {
for ( Node record : response.getRecords() ) {
Node copy = owner.importNode( record, true );
doc.getRootElement().appendChild( copy );
}
} else if ( "2.0.2".equals( response.getRequest().getVersion() )
&& ( response == null || response.getRecord() == null ) ) {
throw new OGCWebServiceException( "A record with the given ID does nor exist in the CSW",
CSWExceptionCode.INVALIDPARAMETERVALUE );
}
} catch ( Exception e ) {
LOG.logError( e.getMessage(), e );
throw new XMLException( e.getMessage() );
}
return doc;
}
|
static GetRecordByIdResultDocument function( GetRecordByIdResult response ) throws XMLException { GetRecordByIdResultDocument doc = new GetRecordByIdResultDocument(); try { doc.createEmptyDocument( response.getRequest().getVersion() ); Document owner = doc.getRootElement().getOwnerDocument(); if ( response != null && response.getRecords() != null ) { for ( Node record : response.getRecords() ) { Node copy = owner.importNode( record, true ); doc.getRootElement().appendChild( copy ); } } else if ( "2.0.2".equals( response.getRequest().getVersion() ) && ( response == null response.getRecord() == null ) ) { throw new OGCWebServiceException( STR, CSWExceptionCode.INVALIDPARAMETERVALUE ); } } catch ( Exception e ) { LOG.logError( e.getMessage(), e ); throw new XMLException( e.getMessage() ); } return doc; }
|
/**
* Exports a instance of {@link GetRecordByIdResult} to a {@link GetRecordByIdResultDocument}.
*
* @param response
* @return a new document
* @throws XMLException
*/
|
Exports a instance of <code>GetRecordByIdResult</code> to a <code>GetRecordByIdResultDocument</code>
|
export
|
{
"repo_name": "lat-lon/deegree2-base",
"path": "deegree2-core/src/main/java/org/deegree/ogcwebservices/csw/discovery/XMLFactory.java",
"license": "lgpl-2.1",
"size": 34135
}
|
[
"org.deegree.framework.xml.XMLException",
"org.deegree.ogcwebservices.OGCWebServiceException",
"org.deegree.ogcwebservices.csw.CSWExceptionCode",
"org.w3c.dom.Document",
"org.w3c.dom.Node"
] |
import org.deegree.framework.xml.XMLException; import org.deegree.ogcwebservices.OGCWebServiceException; import org.deegree.ogcwebservices.csw.CSWExceptionCode; import org.w3c.dom.Document; import org.w3c.dom.Node;
|
import org.deegree.framework.xml.*; import org.deegree.ogcwebservices.*; import org.deegree.ogcwebservices.csw.*; import org.w3c.dom.*;
|
[
"org.deegree.framework",
"org.deegree.ogcwebservices",
"org.w3c.dom"
] |
org.deegree.framework; org.deegree.ogcwebservices; org.w3c.dom;
| 2,182,887
|
return new MatrixCursor(CONTACT_PROJECTION);
}
/**
* Create a {@link MatrixCursor} with the proper projection for a subclass of {@link AbstractContactsCursorLoader}
*
* @param initialCapacity The initial capacity to hand to the {@link MatrixCursor}
|
return new MatrixCursor(CONTACT_PROJECTION); } /** * Create a {@link MatrixCursor} with the proper projection for a subclass of {@link AbstractContactsCursorLoader} * * @param initialCapacity The initial capacity to hand to the {@link MatrixCursor}
|
/**
* Create a {@link MatrixCursor} with the proper projection for a subclass of {@link AbstractContactsCursorLoader}
*/
|
Create a <code>MatrixCursor</code> with the proper projection for a subclass of <code>AbstractContactsCursorLoader</code>
|
createMatrixCursor
|
{
"repo_name": "WhisperSystems/Signal-Android",
"path": "app/src/main/java/org/thoughtcrime/securesms/contacts/ContactsCursorRows.java",
"license": "gpl-3.0",
"size": 7083
}
|
[
"android.database.MatrixCursor"
] |
import android.database.MatrixCursor;
|
import android.database.*;
|
[
"android.database"
] |
android.database;
| 1,224,839
|
public Set<Integer> matchPattern(String pattern, String status,
boolean hasTag) {
PropertyConfigurator.configure("conf/log4j.properties");
Logger myLogger = Logger.getLogger("learn.discover.matchPattern");
myLogger.trace("Enter matchPattern");
myLogger.trace("Pattern: " + pattern);
myLogger.trace("Status: " + status);
myLogger.trace("HasTag: " + hasTag);
Set<Integer> matchedIDs = new HashSet<Integer>();
for (int i = 0; i < this.myDataHolder.getSentenceHolder().size(); i++) {
SentenceStructure sent = this.myDataHolder.getSentenceHolder().get(
i);
String thisSentence = sent.getSentence();
String thisStatus = sent.getStatus();
String thisTag = sent.getTag();
boolean a = hasTag;
boolean b = (thisTag == null);
if ((a ^ b) && (StringUtils.equals(status, thisStatus))) {
Pattern p = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE);
Matcher m = p.matcher(thisSentence);
if (m.lookingAt()) {
myLogger.debug("Push Sentence #" + i);
myLogger.debug("Sentence: " + thisSentence);
myLogger.debug("Status: " + thisStatus);
myLogger.debug("Tag: " + thisTag);
myLogger.debug("\n");
matchedIDs.add(i);
}
}
}
myLogger.trace("Return IDs: " + matchedIDs);
myLogger.trace("Quite matchPattern");
myLogger.trace("\n");
return matchedIDs;
}
|
Set<Integer> function(String pattern, String status, boolean hasTag) { PropertyConfigurator.configure(STR); Logger myLogger = Logger.getLogger(STR); myLogger.trace(STR); myLogger.trace(STR + pattern); myLogger.trace(STR + status); myLogger.trace(STR + hasTag); Set<Integer> matchedIDs = new HashSet<Integer>(); for (int i = 0; i < this.myDataHolder.getSentenceHolder().size(); i++) { SentenceStructure sent = this.myDataHolder.getSentenceHolder().get( i); String thisSentence = sent.getSentence(); String thisStatus = sent.getStatus(); String thisTag = sent.getTag(); boolean a = hasTag; boolean b = (thisTag == null); if ((a ^ b) && (StringUtils.equals(status, thisStatus))) { Pattern p = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE); Matcher m = p.matcher(thisSentence); if (m.lookingAt()) { myLogger.debug(STR + i); myLogger.debug(STR + thisSentence); myLogger.debug(STR + thisStatus); myLogger.debug(STR + thisTag); myLogger.debug("\n"); matchedIDs.add(i); } } } myLogger.trace(STR + matchedIDs); myLogger.trace(STR); myLogger.trace("\n"); return matchedIDs; }
|
/**
* Find the IDs of the sentences that matches the pattern
*
* @param pattern
* @param status
* @param hasTag
* @return a set of sentence IDs of the sentences that matches the pattern
*/
|
Find the IDs of the sentences that matches the pattern
|
matchPattern
|
{
"repo_name": "phenoscape/charaparser-unsupervised",
"path": "src/main/java/semanticMarkup/ling/learn/Learner.java",
"license": "mit",
"size": 129278
}
|
[
"java.util.HashSet",
"java.util.Set",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.apache.commons.lang3.StringUtils",
"org.apache.log4j.Logger",
"org.apache.log4j.PropertyConfigurator"
] |
import java.util.HashSet; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.commons.lang3.StringUtils; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator;
|
import java.util.*; import java.util.regex.*; import org.apache.commons.lang3.*; import org.apache.log4j.*;
|
[
"java.util",
"org.apache.commons",
"org.apache.log4j"
] |
java.util; org.apache.commons; org.apache.log4j;
| 2,372,986
|
public Card deal();
|
Card function();
|
/**
* Deal a card from the deck. Return null when there is no more card in
* the deck to deal.
* @return a card from the deck or null
*/
|
Deal a card from the deck. Return null when there is no more card in the deck to deal
|
deal
|
{
"repo_name": "htquach/GameOfWar",
"path": "src/com/gameofwar/Deck.java",
"license": "mit",
"size": 856
}
|
[
"com.gameofwar.model.Card"
] |
import com.gameofwar.model.Card;
|
import com.gameofwar.model.*;
|
[
"com.gameofwar.model"
] |
com.gameofwar.model;
| 149,953
|
public void pause() throws IllegalStateException {
stayAwake(false);
_pause();
}
/**
* Set the low-level power management behavior for this MediaPlayer. This
* can be used when the MediaPlayer is not playing through a SurfaceHolder
* set with {@link #setDisplay(SurfaceHolder)} and thus can use the
* high-level {@link #setScreenOnWhilePlaying(boolean)} feature.
* <p>
* <p>This function has the MediaPlayer access the low-level power manager
* service to control the device's power usage while playing is occurring.
* The parameter is a combination of {@link PowerManager} wake flags.
* Use of this method requires {@link android.Manifest.permission#WAKE_LOCK}
|
void function() throws IllegalStateException { stayAwake(false); _pause(); } /** * Set the low-level power management behavior for this MediaPlayer. This * can be used when the MediaPlayer is not playing through a SurfaceHolder * set with {@link #setDisplay(SurfaceHolder)} and thus can use the * high-level {@link #setScreenOnWhilePlaying(boolean)} feature. * <p> * <p>This function has the MediaPlayer access the low-level power manager * service to control the device's power usage while playing is occurring. * The parameter is a combination of {@link PowerManager} wake flags. * Use of this method requires {@link android.Manifest.permission#WAKE_LOCK}
|
/**
* Pauses playback. Call start() to resume.
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
|
Pauses playback. Call start() to resume
|
pause
|
{
"repo_name": "openstreetview/android",
"path": "ffmpeg/src/main/java/com/telenav/ffmpeg/FFMPEGTrackPlayer.java",
"license": "lgpl-3.0",
"size": 27447
}
|
[
"android.os.PowerManager",
"android.view.SurfaceHolder"
] |
import android.os.PowerManager; import android.view.SurfaceHolder;
|
import android.os.*; import android.view.*;
|
[
"android.os",
"android.view"
] |
android.os; android.view;
| 644,865
|
public ApiManagementServiceResourceInner restore(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) {
return restoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body();
}
|
ApiManagementServiceResourceInner function(String resourceGroupName, String serviceName, ApiManagementServiceBackupRestoreParameters parameters) { return restoreWithServiceResponseAsync(resourceGroupName, serviceName, parameters).toBlocking().last().body(); }
|
/**
* Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param parameters Parameters supplied to the Restore API Management service from backup operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ApiManagementServiceResourceInner object if successful.
*/
|
Restores a backup of an API Management service created using the ApiManagementService_Backup operation on the current service. This is a long running operation and could take several minutes to complete
|
restore
|
{
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/apimanagement/mgmt-v2019_01_01/src/main/java/com/microsoft/azure/management/apimanagement/v2019_01_01/implementation/ApiManagementServicesInner.java",
"license": "mit",
"size": 134209
}
|
[
"com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceBackupRestoreParameters"
] |
import com.microsoft.azure.management.apimanagement.v2019_01_01.ApiManagementServiceBackupRestoreParameters;
|
import com.microsoft.azure.management.apimanagement.v2019_01_01.*;
|
[
"com.microsoft.azure"
] |
com.microsoft.azure;
| 399,109
|
@Test
public void testPersistEntityWithoutDateInsideAList() {
List<AnEntity> setOne = new ArrayList<AnEntity>();
EntityManager em = entityManagerFactory.createEntityManager();
AnEntity entity = RandomUtils.createRandomAnEntity();
setOne.add(entity);
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
em.clear();
AnEntity returned = em.find(AnEntity.class, entity.getId());
List<AnEntity> setTwo = new ArrayList<AnEntity>();
setTwo.add(returned);
Assert.assertEquals(entity, returned);
Assert.assertEquals(setOne, setTwo);
}
|
void function() { List<AnEntity> setOne = new ArrayList<AnEntity>(); EntityManager em = entityManagerFactory.createEntityManager(); AnEntity entity = RandomUtils.createRandomAnEntity(); setOne.add(entity); em.getTransaction().begin(); em.persist(entity); em.getTransaction().commit(); em.clear(); AnEntity returned = em.find(AnEntity.class, entity.getId()); List<AnEntity> setTwo = new ArrayList<AnEntity>(); setTwo.add(returned); Assert.assertEquals(entity, returned); Assert.assertEquals(setOne, setTwo); }
|
/**
* Tests the persistence of the Entity, fetches it and asserts that
* it is the same when inside a List, this is to sanity-check the apparent
* bug when comparing sets with dates inside.
*/
|
Tests the persistence of the Entity, fetches it and asserts that it is the same when inside a List, this is to sanity-check the apparent bug when comparing sets with dates inside
|
testPersistEntityWithoutDateInsideAList
|
{
"repo_name": "GMelo/BatooJPAInvestigation",
"path": "src/test/java/org/gmelo/batooInvestigation/model/persistence/AnEntityTest.java",
"license": "gpl-2.0",
"size": 2987
}
|
[
"java.util.ArrayList",
"java.util.List",
"javax.persistence.EntityManager",
"junit.framework.Assert",
"org.gmelo.batooInvestigation.model.AnEntity",
"org.gmelo.batooInvestigation.util.RandomUtils"
] |
import java.util.ArrayList; import java.util.List; import javax.persistence.EntityManager; import junit.framework.Assert; import org.gmelo.batooInvestigation.model.AnEntity; import org.gmelo.batooInvestigation.util.RandomUtils;
|
import java.util.*; import javax.persistence.*; import junit.framework.*; import org.gmelo.*;
|
[
"java.util",
"javax.persistence",
"junit.framework",
"org.gmelo"
] |
java.util; javax.persistence; junit.framework; org.gmelo;
| 1,446,994
|
public Iterator keys() {
return this.map.keySet().iterator();
}
|
Iterator function() { return this.map.keySet().iterator(); }
|
/**
* Get an enumeration of the keys of the JSONObject.
*
* @return An iterator of the keys.
*/
|
Get an enumeration of the keys of the JSONObject
|
keys
|
{
"repo_name": "neo4j-attic/shell",
"path": "src/main/java/org/neo4j/shell/util/json/JSONObject.java",
"license": "agpl-3.0",
"size": 54079
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,544,995
|
@Override
public double evaluate(final double[] values, final int begin, final int length)
throws MathIllegalArgumentException {
double sum = Double.NaN;
if (test(values, begin, length, true)) {
sum = 0.0;
for (int i = begin; i < begin + length; i++) {
sum += values[i];
}
}
return sum;
}
|
double function(final double[] values, final int begin, final int length) throws MathIllegalArgumentException { double sum = Double.NaN; if (test(values, begin, length, true)) { sum = 0.0; for (int i = begin; i < begin + length; i++) { sum += values[i]; } } return sum; }
|
/**
* The sum of the entries in the specified portion of
* the input array, or 0 if the designated subarray
* is empty.
* <p>
* Throws <code>MathIllegalArgumentException</code> if the array is null.</p>
*
* @param values the input array
* @param begin index of the first array element to include
* @param length the number of elements to include
* @return the sum of the values or 0 if length = 0
* @throws MathIllegalArgumentException if the array is null or the array index
* parameters are not valid
*/
|
The sum of the entries in the specified portion of the input array, or 0 if the designated subarray is empty. Throws <code>MathIllegalArgumentException</code> if the array is null
|
evaluate
|
{
"repo_name": "tbepler/seq-svm",
"path": "src/org/apache/commons/math3/stat/descriptive/summary/Sum.java",
"license": "mit",
"size": 7421
}
|
[
"org.apache.commons.math3.exception.MathIllegalArgumentException"
] |
import org.apache.commons.math3.exception.MathIllegalArgumentException;
|
import org.apache.commons.math3.exception.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,775,786
|
public final MetaProperty<LocalDate> premiumDate() {
return _premiumDate;
}
|
final MetaProperty<LocalDate> function() { return _premiumDate; }
|
/**
* The meta-property for the {@code premiumDate} property.
* @return the meta-property, not null
*/
|
The meta-property for the premiumDate property
|
premiumDate
|
{
"repo_name": "McLeodMoores/starling",
"path": "projects/core/src/main/java/com/opengamma/core/position/impl/SimpleTrade.java",
"license": "apache-2.0",
"size": 28757
}
|
[
"org.joda.beans.MetaProperty",
"org.threeten.bp.LocalDate"
] |
import org.joda.beans.MetaProperty; import org.threeten.bp.LocalDate;
|
import org.joda.beans.*; import org.threeten.bp.*;
|
[
"org.joda.beans",
"org.threeten.bp"
] |
org.joda.beans; org.threeten.bp;
| 1,257,397
|
private Context getApplicationContext() {
return this.cordova.getActivity().getApplicationContext();
}
|
Context function() { return this.cordova.getActivity().getApplicationContext(); }
|
/**
* Gets the application context from cordova's main activity.
*
* @return the application context
*/
|
Gets the application context from cordova's main activity
|
getApplicationContext
|
{
"repo_name": "sxagan/cordova-plugin-hlpush",
"path": "src/android/gcm/PushPlugin.java",
"license": "apache-2.0",
"size": 4868
}
|
[
"android.content.Context"
] |
import android.content.Context;
|
import android.content.*;
|
[
"android.content"
] |
android.content;
| 656,827
|
private AutoPopulatingList<ErrorMessage> putMessageInMap(Map<String, AutoPopulatingList<ErrorMessage>> messagesMap, String propertyName, String messageKey, boolean withFullErrorPath, boolean escapeHtmlMessageParameters, String... messageParameters) {
if (StringUtils.isBlank(propertyName)) {
throw new IllegalArgumentException("invalid (blank) propertyName");
}
if (StringUtils.isBlank(messageKey)) {
throw new IllegalArgumentException("invalid (blank) errorKey");
}
// check if we have previous errors for this property
AutoPopulatingList<ErrorMessage> errorList = null;
String propertyKey = getKeyPath(propertyName, withFullErrorPath);
if (messagesMap.containsKey(propertyKey)) {
errorList = messagesMap.get(propertyKey);
}
else {
errorList = new AutoPopulatingList<ErrorMessage>(ErrorMessage.class);
}
if (escapeHtmlMessageParameters && messageParameters != null) {
String[] filteredMessageParameters = new String[messageParameters.length];
for (int i = 0; i < messageParameters.length; i++) {
filteredMessageParameters[i] = StringEscapeUtils.escapeHtml(messageParameters[i]);
}
messageParameters = filteredMessageParameters;
}
// add error to list
ErrorMessage errorMessage = new ErrorMessage(messageKey, messageParameters);
// check if this error has already been added to the list
if ( !errorList.contains( errorMessage ) ) {
errorList.add(errorMessage);
}
return messagesMap.put(propertyKey, errorList);
}
|
AutoPopulatingList<ErrorMessage> function(Map<String, AutoPopulatingList<ErrorMessage>> messagesMap, String propertyName, String messageKey, boolean withFullErrorPath, boolean escapeHtmlMessageParameters, String... messageParameters) { if (StringUtils.isBlank(propertyName)) { throw new IllegalArgumentException(STR); } if (StringUtils.isBlank(messageKey)) { throw new IllegalArgumentException(STR); } AutoPopulatingList<ErrorMessage> errorList = null; String propertyKey = getKeyPath(propertyName, withFullErrorPath); if (messagesMap.containsKey(propertyKey)) { errorList = messagesMap.get(propertyKey); } else { errorList = new AutoPopulatingList<ErrorMessage>(ErrorMessage.class); } if (escapeHtmlMessageParameters && messageParameters != null) { String[] filteredMessageParameters = new String[messageParameters.length]; for (int i = 0; i < messageParameters.length; i++) { filteredMessageParameters[i] = StringEscapeUtils.escapeHtml(messageParameters[i]); } messageParameters = filteredMessageParameters; } ErrorMessage errorMessage = new ErrorMessage(messageKey, messageParameters); if ( !errorList.contains( errorMessage ) ) { errorList.add(errorMessage); } return messagesMap.put(propertyKey, errorList); }
|
/**
* adds an error to the map under the given propertyName and adds an array of message parameters.
*
* @param propertyName name of the property to add error under
* @param messageKey resource key used to retrieve the error text from the error message resource bundle
* @param withFullErrorPath true if you want the whole parent error path appended, false otherwise
* @param escapeHtmlMessageParameters whether to escape HTML characters in the message parameters, provides protection against XSS attacks
* @param messageParameters zero or more string parameters for the displayed error message
* @return TypeArrayList
*/
|
adds an error to the map under the given propertyName and adds an array of message parameters
|
putMessageInMap
|
{
"repo_name": "sbower/kuali-rice-1",
"path": "krad/krad-app-framework/src/main/java/org/kuali/rice/krad/util/MessageMap.java",
"license": "apache-2.0",
"size": 27367
}
|
[
"java.util.Map",
"org.apache.commons.lang.StringEscapeUtils",
"org.apache.commons.lang.StringUtils",
"org.springframework.util.AutoPopulatingList"
] |
import java.util.Map; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import org.springframework.util.AutoPopulatingList;
|
import java.util.*; import org.apache.commons.lang.*; import org.springframework.util.*;
|
[
"java.util",
"org.apache.commons",
"org.springframework.util"
] |
java.util; org.apache.commons; org.springframework.util;
| 2,573,696
|
private boolean isOcrSupported() {
// If Tesseract has been installed and is set to be used through
// configuration, then ocr is enabled. OCR can only currently be run on 64
// bit Windows OS.
return TESSERACT_PATH != null
&& tesseractOCREnabled
&& PlatformUtil.isWindowsOS()
&& PlatformUtil.is64BitOS()
&& isSupported();
}
|
boolean function() { return TESSERACT_PATH != null && tesseractOCREnabled && PlatformUtil.isWindowsOS() && PlatformUtil.is64BitOS() && isSupported(); }
|
/**
* Whether or not OCR is supported in environment.
*
* @return True if OCR is supported.
*/
|
Whether or not OCR is supported in environment
|
isOcrSupported
|
{
"repo_name": "sleuthkit/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/textextractors/TikaTextExtractor.java",
"license": "apache-2.0",
"size": 25298
}
|
[
"org.sleuthkit.autopsy.coreutils.PlatformUtil"
] |
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
|
import org.sleuthkit.autopsy.coreutils.*;
|
[
"org.sleuthkit.autopsy"
] |
org.sleuthkit.autopsy;
| 995,159
|
public Adapter createPackageElementAdapter()
{
return null;
}
|
Adapter function() { return null; }
|
/**
* Creates a new adapter for an object of class '{@link org.xtext.burst.burst.PackageElement <em>Package Element</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.xtext.burst.burst.PackageElement
* @generated
*/
|
Creates a new adapter for an object of class '<code>org.xtext.burst.burst.PackageElement Package Element</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.
|
createPackageElementAdapter
|
{
"repo_name": "Parashift/Burst",
"path": "org.xtext.burst/src-gen/org/xtext/burst/burst/util/BurstAdapterFactory.java",
"license": "agpl-3.0",
"size": 25573
}
|
[
"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;
| 972,132
|
@Override
public ServiceObjectiveListResponse list(String resourceGroupName, String serverName) throws IOException, ServiceException {
// Validate
if (resourceGroupName == null) {
throw new NullPointerException("resourceGroupName");
}
if (serverName == null) {
throw new NullPointerException("serverName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
tracingParameters.put("resourceGroupName", resourceGroupName);
tracingParameters.put("serverName", serverName);
CloudTracing.enter(invocationId, this, "listAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/subscriptions/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/resourceGroups/";
url = url + URLEncoder.encode(resourceGroupName, "UTF-8");
url = url + "/providers/";
url = url + "Microsoft.Sql";
url = url + "/servers/";
url = url + URLEncoder.encode(serverName, "UTF-8");
url = url + "/serviceObjectives";
ArrayList<String> queryParameters = new ArrayList<String>();
queryParameters.add("api-version=" + "2014-04-01");
if (queryParameters.size() > 0) {
url = url + "?" + CollectionStringBuilder.join(queryParameters, "&");
}
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpGet httpRequest = new HttpGet(url);
// Set Headers
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
ServiceException ex = ServiceException.createFromJson(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
ServiceObjectiveListResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new ServiceObjectiveListResponse();
ObjectMapper objectMapper = new ObjectMapper();
JsonNode responseDoc = null;
String responseDocContent = IOUtils.toString(responseContent);
if (responseDocContent == null == false && responseDocContent.length() > 0) {
responseDoc = objectMapper.readTree(responseDocContent);
}
if (responseDoc != null && responseDoc instanceof NullNode == false) {
JsonNode valueArray = responseDoc.get("value");
if (valueArray != null && valueArray instanceof NullNode == false) {
for (JsonNode valueValue : ((ArrayNode) valueArray)) {
ServiceObjective serviceObjectiveInstance = new ServiceObjective();
result.getServiceObjectives().add(serviceObjectiveInstance);
JsonNode propertiesValue = valueValue.get("properties");
if (propertiesValue != null && propertiesValue instanceof NullNode == false) {
ServiceObjectiveProperties propertiesInstance = new ServiceObjectiveProperties();
serviceObjectiveInstance.setProperties(propertiesInstance);
JsonNode serviceObjectiveNameValue = propertiesValue.get("serviceObjectiveName");
if (serviceObjectiveNameValue != null && serviceObjectiveNameValue instanceof NullNode == false) {
String serviceObjectiveNameInstance;
serviceObjectiveNameInstance = serviceObjectiveNameValue.getTextValue();
propertiesInstance.setServiceObjectiveName(serviceObjectiveNameInstance);
}
JsonNode isDefaultValue = propertiesValue.get("isDefault");
if (isDefaultValue != null && isDefaultValue instanceof NullNode == false) {
boolean isDefaultInstance;
isDefaultInstance = isDefaultValue.getBooleanValue();
propertiesInstance.setIsDefault(isDefaultInstance);
}
JsonNode isSystemValue = propertiesValue.get("isSystem");
if (isSystemValue != null && isSystemValue instanceof NullNode == false) {
boolean isSystemInstance;
isSystemInstance = isSystemValue.getBooleanValue();
propertiesInstance.setIsSystem(isSystemInstance);
}
JsonNode descriptionValue = propertiesValue.get("description");
if (descriptionValue != null && descriptionValue instanceof NullNode == false) {
String descriptionInstance;
descriptionInstance = descriptionValue.getTextValue();
propertiesInstance.setDescription(descriptionInstance);
}
JsonNode enabledValue = propertiesValue.get("enabled");
if (enabledValue != null && enabledValue instanceof NullNode == false) {
boolean enabledInstance;
enabledInstance = enabledValue.getBooleanValue();
propertiesInstance.setEnabled(enabledInstance);
}
}
JsonNode idValue = valueValue.get("id");
if (idValue != null && idValue instanceof NullNode == false) {
String idInstance;
idInstance = idValue.getTextValue();
serviceObjectiveInstance.setId(idInstance);
}
JsonNode nameValue = valueValue.get("name");
if (nameValue != null && nameValue instanceof NullNode == false) {
String nameInstance;
nameInstance = nameValue.getTextValue();
serviceObjectiveInstance.setName(nameInstance);
}
JsonNode typeValue = valueValue.get("type");
if (typeValue != null && typeValue instanceof NullNode == false) {
String typeInstance;
typeInstance = typeValue.getTextValue();
serviceObjectiveInstance.setType(typeInstance);
}
JsonNode locationValue = valueValue.get("location");
if (locationValue != null && locationValue instanceof NullNode == false) {
String locationInstance;
locationInstance = locationValue.getTextValue();
serviceObjectiveInstance.setLocation(locationInstance);
}
JsonNode tagsSequenceElement = ((JsonNode) valueValue.get("tags"));
if (tagsSequenceElement != null && tagsSequenceElement instanceof NullNode == false) {
Iterator<Map.Entry<String, JsonNode>> itr = tagsSequenceElement.getFields();
while (itr.hasNext()) {
Map.Entry<String, JsonNode> property = itr.next();
String tagsKey = property.getKey();
String tagsValue = property.getValue().getTextValue();
serviceObjectiveInstance.getTags().put(tagsKey, tagsValue);
}
}
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
}
|
ServiceObjectiveListResponse function(String resourceGroupName, String serverName) throws IOException, ServiceException { if (resourceGroupName == null) { throw new NullPointerException(STR); } if (serverName == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, resourceGroupName); tracingParameters.put(STR, serverName); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = STR/subscriptions/STRUTF-8STR/resourceGroups/STRUTF-8STR/providers/STRMicrosoft.SqlSTR/servers/STRUTF-8STR/serviceObjectivesSTRapi-version=STR2014-04-01STR?STR&STR/STR STR%20STRvalueSTRpropertiesSTRserviceObjectiveNameSTRisDefaultSTRisSystemSTRdescriptionSTRenabledSTRidSTRnameSTRtypeSTRlocationSTRtagsSTRx-ms-request-idSTRx-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } }
|
/**
* Returns information about an Azure SQL Database Server Service Objectives.
*
* @param resourceGroupName Required. The name of the Resource Group to
* which the server belongs.
* @param serverName Required. The name of the Server.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @return Represents the response to a Get Azure Sql Database Service
* Objectives request.
*/
|
Returns information about an Azure SQL Database Server Service Objectives
|
list
|
{
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "resource-management/azure-mgmt-sql/src/main/java/com/microsoft/azure/management/sql/ServiceObjectiveOperationsImpl.java",
"license": "apache-2.0",
"size": 26695
}
|
[
"com.microsoft.azure.management.sql.models.ServiceObjectiveListResponse",
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.tracing.CloudTracing",
"java.io.IOException",
"java.util.HashMap"
] |
import com.microsoft.azure.management.sql.models.ServiceObjectiveListResponse; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.util.HashMap;
|
import com.microsoft.azure.management.sql.models.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.util.*;
|
[
"com.microsoft.azure",
"com.microsoft.windowsazure",
"java.io",
"java.util"
] |
com.microsoft.azure; com.microsoft.windowsazure; java.io; java.util;
| 779,454
|
private void performDoubleQRStep(final int il, final int im, final int iu,
final ShiftInfo shift, final double[] hVec) {
final int n = matrixT.length;
double p = hVec[0];
double q = hVec[1];
double r = hVec[2];
for (int k = im; k <= iu - 1; k++) {
boolean notlast = k != (iu - 1);
if (k != im) {
p = matrixT[k][k - 1];
q = matrixT[k + 1][k - 1];
r = notlast ? matrixT[k + 2][k - 1] : 0.0;
shift.x = FastMath.abs(p) + FastMath.abs(q) + FastMath.abs(r);
if (Precision.equals(shift.x, 0.0, epsilon)) {
continue;
}
p /= shift.x;
q /= shift.x;
r /= shift.x;
}
double s = FastMath.sqrt(p * p + q * q + r * r);
if (p < 0.0) {
s = -s;
}
if (s != 0.0) {
if (k != im) {
matrixT[k][k - 1] = -s * shift.x;
} else if (il != im) {
matrixT[k][k - 1] = -matrixT[k][k - 1];
}
p += s;
shift.x = p / s;
shift.y = q / s;
double z = r / s;
q /= p;
r /= p;
// Row modification
for (int j = k; j < n; j++) {
p = matrixT[k][j] + q * matrixT[k + 1][j];
if (notlast) {
p += r * matrixT[k + 2][j];
matrixT[k + 2][j] -= p * z;
}
matrixT[k][j] -= p * shift.x;
matrixT[k + 1][j] -= p * shift.y;
}
// Column modification
for (int i = 0; i <= FastMath.min(iu, k + 3); i++) {
p = shift.x * matrixT[i][k] + shift.y * matrixT[i][k + 1];
if (notlast) {
p += z * matrixT[i][k + 2];
matrixT[i][k + 2] -= p * r;
}
matrixT[i][k] -= p;
matrixT[i][k + 1] -= p * q;
}
// Accumulate transformations
final int high = matrixT.length - 1;
for (int i = 0; i <= high; i++) {
p = shift.x * matrixP[i][k] + shift.y * matrixP[i][k + 1];
if (notlast) {
p += z * matrixP[i][k + 2];
matrixP[i][k + 2] -= p * r;
}
matrixP[i][k] -= p;
matrixP[i][k + 1] -= p * q;
}
} // (s != 0)
} // k loop
// clean up pollution due to round-off errors
for (int i = im + 2; i <= iu; i++) {
matrixT[i][i-2] = 0.0;
if (i > im + 2) {
matrixT[i][i-3] = 0.0;
}
}
}
private static class ShiftInfo {
// CHECKSTYLE: stop all
double x;
double y;
double w;
double exShift;
// CHECKSTYLE: resume all
}
|
void function(final int il, final int im, final int iu, final ShiftInfo shift, final double[] hVec) { final int n = matrixT.length; double p = hVec[0]; double q = hVec[1]; double r = hVec[2]; for (int k = im; k <= iu - 1; k++) { boolean notlast = k != (iu - 1); if (k != im) { p = matrixT[k][k - 1]; q = matrixT[k + 1][k - 1]; r = notlast ? matrixT[k + 2][k - 1] : 0.0; shift.x = FastMath.abs(p) + FastMath.abs(q) + FastMath.abs(r); if (Precision.equals(shift.x, 0.0, epsilon)) { continue; } p /= shift.x; q /= shift.x; r /= shift.x; } double s = FastMath.sqrt(p * p + q * q + r * r); if (p < 0.0) { s = -s; } if (s != 0.0) { if (k != im) { matrixT[k][k - 1] = -s * shift.x; } else if (il != im) { matrixT[k][k - 1] = -matrixT[k][k - 1]; } p += s; shift.x = p / s; shift.y = q / s; double z = r / s; q /= p; r /= p; for (int j = k; j < n; j++) { p = matrixT[k][j] + q * matrixT[k + 1][j]; if (notlast) { p += r * matrixT[k + 2][j]; matrixT[k + 2][j] -= p * z; } matrixT[k][j] -= p * shift.x; matrixT[k + 1][j] -= p * shift.y; } for (int i = 0; i <= FastMath.min(iu, k + 3); i++) { p = shift.x * matrixT[i][k] + shift.y * matrixT[i][k + 1]; if (notlast) { p += z * matrixT[i][k + 2]; matrixT[i][k + 2] -= p * r; } matrixT[i][k] -= p; matrixT[i][k + 1] -= p * q; } final int high = matrixT.length - 1; for (int i = 0; i <= high; i++) { p = shift.x * matrixP[i][k] + shift.y * matrixP[i][k + 1]; if (notlast) { p += z * matrixP[i][k + 2]; matrixP[i][k + 2] -= p * r; } matrixP[i][k] -= p; matrixP[i][k + 1] -= p * q; } } } for (int i = im + 2; i <= iu; i++) { matrixT[i][i-2] = 0.0; if (i > im + 2) { matrixT[i][i-3] = 0.0; } } } private static class ShiftInfo { double x; double y; double w; double exShift; }
|
/**
* Perform a double QR step involving rows l:idx and columns m:n
*
* @param il the index of the small sub-diagonal element
* @param im the start index for the QR step
* @param iu the current eigenvalue index
* @param shift shift information holder
* @param hVec the initial houseHolder vector
*/
|
Perform a double QR step involving rows l:idx and columns m:n
|
performDoubleQRStep
|
{
"repo_name": "tbepler/seq-svm",
"path": "src/org/apache/commons/math3/linear/SchurTransformer.java",
"license": "mit",
"size": 16356
}
|
[
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.util.Precision"
] |
import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision;
|
import org.apache.commons.math3.util.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 762,623
|
public PagedList<KeyItem> listKeyVersions(final String vaultBaseUrl, final String keyName, final Integer maxresults)
throws KeyVaultErrorException, IOException, IllegalArgumentException {
return innerKeyVaultClient.getKeyVersions(vaultBaseUrl, keyName, maxresults);
}
|
PagedList<KeyItem> function(final String vaultBaseUrl, final String keyName, final Integer maxresults) throws KeyVaultErrorException, IOException, IllegalArgumentException { return innerKeyVaultClient.getKeyVersions(vaultBaseUrl, keyName, maxresults); }
|
/**
* List the versions of the specified key.
*
* @param vaultBaseUrl The vault name, e.g. https://myvault.vault.azure.net
* @param keyName The name of the key
* @param maxresults Maximum number of results to return in a page. If not specified the service will return up to 25 results.
* @throws KeyVaultErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws IllegalArgumentException exception thrown from invalid parameters
* @return the PagedList<KeyItem> if successful.
*/
|
List the versions of the specified key
|
listKeyVersions
|
{
"repo_name": "herveyw/azure-sdk-for-java",
"path": "azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClient.java",
"license": "mit",
"size": 97117
}
|
[
"com.microsoft.azure.PagedList",
"com.microsoft.azure.keyvault.models.KeyItem",
"com.microsoft.azure.keyvault.models.KeyVaultErrorException",
"java.io.IOException"
] |
import com.microsoft.azure.PagedList; import com.microsoft.azure.keyvault.models.KeyItem; import com.microsoft.azure.keyvault.models.KeyVaultErrorException; import java.io.IOException;
|
import com.microsoft.azure.*; import com.microsoft.azure.keyvault.models.*; import java.io.*;
|
[
"com.microsoft.azure",
"java.io"
] |
com.microsoft.azure; java.io;
| 2,439,920
|
public int compareNextTo(Composite composite) throws IOException;
|
int function(Composite composite) throws IOException;
|
/**
* Comparare the next name to read to the provided Composite.
* This does not consume the next name.
*/
|
Comparare the next name to read to the provided Composite. This does not consume the next name
|
compareNextTo
|
{
"repo_name": "qinjin/mdtc-cassandra",
"path": "src/java/org/apache/cassandra/db/composites/CellNameType.java",
"license": "apache-2.0",
"size": 8290
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,739,158
|
public void setMixins(NodeId nodeId, Name[] mixinNodeTypeNames) throws RepositoryException;
|
void function(NodeId nodeId, Name[] mixinNodeTypeNames) throws RepositoryException;
|
/**
* Modify the set of mixin node types present on the node identified by the
* given id.
*
* @param nodeId NodeId identifying the node to be modified.
* @param mixinNodeTypeNames The new set of mixin types. Compared to the
* previous values this may result in both adding and/or removing mixin types.
* @throws javax.jcr.nodetype.NoSuchNodeTypeException
* @throws javax.jcr.version.VersionException
* @throws javax.jcr.nodetype.ConstraintViolationException
* @throws javax.jcr.lock.LockException
* @throws javax.jcr.AccessDeniedException
* @throws javax.jcr.UnsupportedRepositoryOperationException
* @throws javax.jcr.RepositoryException
* @see javax.jcr.Node#addMixin(String)
* @see javax.jcr.Node#removeMixin(String)
*/
|
Modify the set of mixin node types present on the node identified by the given id
|
setMixins
|
{
"repo_name": "apache/jackrabbit",
"path": "jackrabbit-spi/src/main/java/org/apache/jackrabbit/spi/Batch.java",
"license": "apache-2.0",
"size": 14018
}
|
[
"javax.jcr.RepositoryException"
] |
import javax.jcr.RepositoryException;
|
import javax.jcr.*;
|
[
"javax.jcr"
] |
javax.jcr;
| 865,373
|
public PathMatcher getPathMatcher() {
return this.pathMatcher;
}
|
PathMatcher function() { return this.pathMatcher; }
|
/**
* The configured PathMatcher, or {@code null}.
*/
|
The configured PathMatcher, or null
|
getPathMatcher
|
{
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.webmvc/org/springframework/web/servlet/handler/MappedInterceptor.java",
"license": "mit",
"size": 6115
}
|
[
"org.springframework.util.PathMatcher"
] |
import org.springframework.util.PathMatcher;
|
import org.springframework.util.*;
|
[
"org.springframework.util"
] |
org.springframework.util;
| 53,025
|
private static String calculateClassId(String s) {
//return a plain uuid:
return UUIDGenerator.getInstance().generateUUID();
}
|
static String function(String s) { return UUIDGenerator.getInstance().generateUUID(); }
|
/**
* Returns a unique stirng for a class name:
*/
|
Returns a unique stirng for a class name:
|
calculateClassId
|
{
"repo_name": "grimurjonsson/com.idega.core",
"path": "src/java/com/idega/idegaweb/IWMainApplication.java",
"license": "gpl-3.0",
"size": 86797
}
|
[
"com.idega.core.idgenerator.business.UUIDGenerator"
] |
import com.idega.core.idgenerator.business.UUIDGenerator;
|
import com.idega.core.idgenerator.business.*;
|
[
"com.idega.core"
] |
com.idega.core;
| 2,733,665
|
public static byte[] getBinaryContent(final Object iValue) {
if (iValue == null) return null;
else if (iValue instanceof OBinary) return ((OBinary) iValue).toByteArray();
else if (iValue instanceof byte[]) return (byte[]) iValue;
else if (iValue instanceof String) {
String s = (String) iValue;
if (s.length() > 1
&& (s.charAt(0) == BINARY_BEGINEND && s.charAt(s.length() - 1) == BINARY_BEGINEND)
|| (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\''))
// @COMPATIBILITY 1.0rc7-SNAPSHOT ' TO SUPPORT OLD DATABASES
s = s.substring(1, s.length() - 1);
// IN CASE OF JSON BINARY IMPORT THIS EXEPTION IS WRONG
// else
// throw new IllegalArgumentException("Not binary type: " + iValue);
return Base64.getDecoder().decode(s);
} else
throw new IllegalArgumentException(
"Cannot parse binary as the same type as the value (class="
+ iValue.getClass().getName()
+ "): "
+ iValue);
}
|
static byte[] function(final Object iValue) { if (iValue == null) return null; else if (iValue instanceof OBinary) return ((OBinary) iValue).toByteArray(); else if (iValue instanceof byte[]) return (byte[]) iValue; else if (iValue instanceof String) { String s = (String) iValue; if (s.length() > 1 && (s.charAt(0) == BINARY_BEGINEND && s.charAt(s.length() - 1) == BINARY_BEGINEND) (s.charAt(0) == '\'' && s.charAt(s.length() - 1) == '\'')) s = s.substring(1, s.length() - 1); return Base64.getDecoder().decode(s); } else throw new IllegalArgumentException( STR + iValue.getClass().getName() + STR + iValue); }
|
/**
* Returns the binary representation of a content. If it's a String a Base64 decoding is applied.
*/
|
Returns the binary representation of a content. If it's a String a Base64 decoding is applied
|
getBinaryContent
|
{
"repo_name": "orientechnologies/orientdb",
"path": "core/src/main/java/com/orientechnologies/orient/core/serialization/serializer/OStringSerializerHelper.java",
"license": "apache-2.0",
"size": 46285
}
|
[
"com.orientechnologies.common.types.OBinary",
"java.util.Base64"
] |
import com.orientechnologies.common.types.OBinary; import java.util.Base64;
|
import com.orientechnologies.common.types.*; import java.util.*;
|
[
"com.orientechnologies.common",
"java.util"
] |
com.orientechnologies.common; java.util;
| 2,332,597
|
public Digest getDigest()
{
return digest;
}
|
Digest function() { return digest; }
|
/**
* return the underlying digest.
*/
|
return the underlying digest
|
getDigest
|
{
"repo_name": "Skywalker-11/spongycastle",
"path": "core/src/main/java/org/spongycastle/crypto/agreement/kdf/ConcatenationKDFGenerator.java",
"license": "mit",
"size": 3133
}
|
[
"org.spongycastle.crypto.Digest"
] |
import org.spongycastle.crypto.Digest;
|
import org.spongycastle.crypto.*;
|
[
"org.spongycastle.crypto"
] |
org.spongycastle.crypto;
| 879,799
|
public Node getXblParentNode(Node n) {
Node contentElement = getXblContentElement(n);
Node parent = contentElement == null
? n.getParentNode()
: contentElement.getParentNode();
if (parent instanceof XBLOMContentElement) {
parent = parent.getParentNode();
}
if (parent instanceof XBLOMShadowTreeElement) {
parent = getXblBoundElement(parent);
}
return parent;
}
|
Node function(Node n) { Node contentElement = getXblContentElement(n); Node parent = contentElement == null ? n.getParentNode() : contentElement.getParentNode(); if (parent instanceof XBLOMContentElement) { parent = parent.getParentNode(); } if (parent instanceof XBLOMShadowTreeElement) { parent = getXblBoundElement(parent); } return parent; }
|
/**
* Get the parent of a node in the fully flattened tree.
*/
|
Get the parent of a node in the fully flattened tree
|
getXblParentNode
|
{
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/svg12/DefaultXBLManager.java",
"license": "apache-2.0",
"size": 70751
}
|
[
"org.apache.flex.forks.batik.dom.svg12.XBLOMContentElement",
"org.apache.flex.forks.batik.dom.svg12.XBLOMShadowTreeElement",
"org.w3c.dom.Node"
] |
import org.apache.flex.forks.batik.dom.svg12.XBLOMContentElement; import org.apache.flex.forks.batik.dom.svg12.XBLOMShadowTreeElement; import org.w3c.dom.Node;
|
import org.apache.flex.forks.batik.dom.svg12.*; import org.w3c.dom.*;
|
[
"org.apache.flex",
"org.w3c.dom"
] |
org.apache.flex; org.w3c.dom;
| 1,321,932
|
public void setFilters(List<Filter> filters) {
this.filters = filters;
}
|
void function(List<Filter> filters) { this.filters = filters; }
|
/**
* Sets the filters/buckets for this facet
*
* @param filters List of filters/buckets for this facet
*/
|
Sets the filters/buckets for this facet
|
setFilters
|
{
"repo_name": "madickson/opencommercesearch",
"path": "opencommercesearch-sdk-java/src/main/java/org/opencommercesearch/client/impl/Facet.java",
"license": "apache-2.0",
"size": 8103
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,718,212
|
public String getDataDirectory() {
checkEventThread();
return System.getProperty("user.home") + File.separator + "." + name + File.separator;
}
|
String function() { checkEventThread(); return System.getProperty(STR) + File.separator + "." + name + File.separator; }
|
/**
* Gets a platform specific path that can be used to store
* application data. The application name typically appears
* as part of the path.
*
* On some platforms, the path may not yet exist and the caller
* will need to create it.
*
* @return the platform specific path for the application data
*/
|
Gets a platform specific path that can be used to store application data. The application name typically appears as part of the path. On some platforms, the path may not yet exist and the caller will need to create it
|
getDataDirectory
|
{
"repo_name": "maiklos-mirrors/jfx78",
"path": "modules/graphics/src/main/java/com/sun/glass/ui/Application.java",
"license": "gpl-2.0",
"size": 24783
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 266,141
|
@Test
public void testFailedTargetWithSaveTemps() throws Exception {
write("bad_clib/BUILD",
"cc_library(name='bad_clib', srcs=['badlib.cc'])\n");
// trigger a warning to make the build fail:
// "control reaches end of non-void function [-Werror,-Wreturn-type]"
write("bad_clib/badlib.cc",
"int f() { }");
// We need to set --keep_going so that the temps get built even though the compilation fails.
addOptions("--save_temps", "--keep_going");
build(true, "compilation of rule '//bad_clib:bad_clib' failed", "//bad_clib");
String stderr = recOutErr.errAsLatin1();
assertThat(stderr).contains("Target //bad_clib:bad_clib failed to build");
assertThat(stderr).contains("See temp at blaze-bin/bad_clib/_objs/bad_clib/badlib.pic.ii\n");
}
|
void function() throws Exception { write(STR, STR); write(STR, STR); addOptions(STR, STR); build(true, STRTarget assertThat(stderr).contains(STR); }
|
/**
* This is a regression test for bug #1013874, in which the temp artifacts (.ii and .s)
* were not being reported as having been created within a failing target.
* It's possible that one or more temps were successfully created, even if the
* compilation failed.
*/
|
This is a regression test for bug #1013874, in which the temp artifacts (.ii and .s) were not being reported as having been created within a failing target. It's possible that one or more temps were successfully created, even if the compilation failed
|
testFailedTargetWithSaveTemps
|
{
"repo_name": "davidzchen/bazel",
"path": "src/test/java/com/google/devtools/build/lib/buildtool/BuildResultTestCase.java",
"license": "apache-2.0",
"size": 15596
}
|
[
"com.google.common.truth.Truth"
] |
import com.google.common.truth.Truth;
|
import com.google.common.truth.*;
|
[
"com.google.common"
] |
com.google.common;
| 809,039
|
public static boolean onlyOnCompanion(Declaration model) {
return Decl.withinInterface(model)
&& (model instanceof ClassOrInterface
|| !Decl.isShared(model));
}
|
static boolean function(Declaration model) { return Decl.withinInterface(model) && (model instanceof ClassOrInterface !Decl.isShared(model)); }
|
/**
* Non-{@code shared} concrete interface members are
* only defined/declared on the companion class, not on the transformed
* interface itself.
*/
|
Non-shared concrete interface members are only defined/declared on the companion class, not on the transformed interface itself
|
onlyOnCompanion
|
{
"repo_name": "lucaswerkmeister/ceylon-compiler",
"path": "src/com/redhat/ceylon/compiler/java/codegen/Strategy.java",
"license": "gpl-2.0",
"size": 13792
}
|
[
"com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface",
"com.redhat.ceylon.compiler.typechecker.model.Declaration"
] |
import com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface; import com.redhat.ceylon.compiler.typechecker.model.Declaration;
|
import com.redhat.ceylon.compiler.typechecker.model.*;
|
[
"com.redhat.ceylon"
] |
com.redhat.ceylon;
| 1,599,488
|
@CheckForNull
MetricsAccessKey getAccessKey(String accessKey);
}
@Extension
public static class DescriptorImpl extends Descriptor<MetricsAccessKey> {
private static final SecureRandom entropy = new SecureRandom();
private static final char[] keyChars =
"ABCEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".toCharArray();
@GuardedBy("this")
private List<MetricsAccessKey> accessKeys;
private transient volatile Set<String> accessKeySet;
public DescriptorImpl() {
super();
load();
}
|
MetricsAccessKey getAccessKey(String accessKey); } public static class DescriptorImpl extends Descriptor<MetricsAccessKey> { private static final SecureRandom entropy = new SecureRandom(); private static final char[] keyChars = STR.toCharArray(); @GuardedBy("this") private List<MetricsAccessKey> accessKeys; private transient volatile Set<String> accessKeySet; public DescriptorImpl() { super(); load(); }
|
/**
* Returns the definition of the specific access key. Note that all entries in {@link #getAccessKeys()} must
* be returned by this method, but it may also return additional entries.
*
* @param accessKey the access key to retrieve.
* @return the access key.
*/
|
Returns the definition of the specific access key. Note that all entries in <code>#getAccessKeys()</code> must be returned by this method, but it may also return additional entries
|
getAccessKey
|
{
"repo_name": "oleg-nenashev/metrics-plugin",
"path": "src/main/java/jenkins/metrics/api/MetricsAccessKey.java",
"license": "mit",
"size": 22007
}
|
[
"hudson.model.Descriptor",
"java.security.SecureRandom",
"java.util.List",
"java.util.Set",
"javax.annotation.concurrent.GuardedBy"
] |
import hudson.model.Descriptor; import java.security.SecureRandom; import java.util.List; import java.util.Set; import javax.annotation.concurrent.GuardedBy;
|
import hudson.model.*; import java.security.*; import java.util.*; import javax.annotation.concurrent.*;
|
[
"hudson.model",
"java.security",
"java.util",
"javax.annotation"
] |
hudson.model; java.security; java.util; javax.annotation;
| 549,094
|
public Connection getConnection() throws DAOException {
try {
if (THREAD_CONNECTION.get() == null) {
THREAD_CONNECTION.set(this.dataSource.getConnection());
}
return THREAD_CONNECTION.get();
} catch (SQLException e) {
throw new DAOException("Unable to connect to database : " + e.getMessage());
}
}
|
Connection function() throws DAOException { try { if (THREAD_CONNECTION.get() == null) { THREAD_CONNECTION.set(this.dataSource.getConnection()); } return THREAD_CONNECTION.get(); } catch (SQLException e) { throw new DAOException(STR + e.getMessage()); } }
|
/**
* Gets a connection from the pool or creates a new one.
* @return a connection taken from the pool
* @throws DAOException thrown if Hikari is unable to connect to the database
*/
|
Gets a connection from the pool or creates a new one
|
getConnection
|
{
"repo_name": "serrearthur/training-java",
"path": "ComputerDataBase/src/main/java/cdb/dao/ConnectionManager.java",
"license": "apache-2.0",
"size": 5354
}
|
[
"java.sql.Connection",
"java.sql.SQLException"
] |
import java.sql.Connection; import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,867,805
|
public void remove(ArrayList<Song> songs){
for(Song s : songs){
songList.remove(s);
playTime -= s.getLength();
}
int newIndex = songList.indexOf(currentSong);
if(newIndex == -1){
stop();
currentSongIndex = currentSongIndex % songList.size();
currentSong = songList.get(currentSongIndex);
}
else{
currentSongIndex = newIndex;
}
}
|
void function(ArrayList<Song> songs){ for(Song s : songs){ songList.remove(s); playTime -= s.getLength(); } int newIndex = songList.indexOf(currentSong); if(newIndex == -1){ stop(); currentSongIndex = currentSongIndex % songList.size(); currentSong = songList.get(currentSongIndex); } else{ currentSongIndex = newIndex; } }
|
/**
* Removes from the list the given song list.
* @param songs List of songs to remove.
*/
|
Removes from the list the given song list
|
remove
|
{
"repo_name": "jlsuarezdiaz/MusicPlayer",
"path": "src/Model/MusicPlayer.java",
"license": "gpl-2.0",
"size": 18064
}
|
[
"java.util.ArrayList"
] |
import java.util.ArrayList;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,684,137
|
public ServiceCall head300Async(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException {
if (serviceCallback == null) {
throw new IllegalArgumentException("ServiceCallback is required for async calls.");
}
|
ServiceCall function(final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); }
|
/**
* Return 300 status code and redirect to /http/success/200.
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if callback is null
* @return the {@link Call} object
*/
|
Return 300 status code and redirect to /http/success/200
|
head300Async
|
{
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/http/HttpRedirectsOperationsImpl.java",
"license": "mit",
"size": 53468
}
|
[
"com.microsoft.rest.ServiceCall",
"com.microsoft.rest.ServiceCallback"
] |
import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 413,554
|
@ServiceMethod(returns = ReturnType.SINGLE)
public WorkspaceInner update(String resourceGroupName, String workspaceName, WorkspaceUpdateParameters parameters) {
return updateAsync(resourceGroupName, workspaceName, parameters).block();
}
|
@ServiceMethod(returns = ReturnType.SINGLE) WorkspaceInner function(String resourceGroupName, String workspaceName, WorkspaceUpdateParameters parameters) { return updateAsync(resourceGroupName, workspaceName, parameters).block(); }
|
/**
* Updates properties of a Workspace.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric
* characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
* @param parameters Additional parameters for workspace update.
* @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 batch AI Workspace information.
*/
|
Updates properties of a Workspace
|
update
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/batchai/azure-resourcemanager-batchai/src/main/java/com/azure/resourcemanager/batchai/implementation/WorkspacesClientImpl.java",
"license": "mit",
"size": 77030
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.batchai.fluent.models.WorkspaceInner",
"com.azure.resourcemanager.batchai.models.WorkspaceUpdateParameters"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.batchai.fluent.models.WorkspaceInner; import com.azure.resourcemanager.batchai.models.WorkspaceUpdateParameters;
|
import com.azure.core.annotation.*; import com.azure.resourcemanager.batchai.fluent.models.*; import com.azure.resourcemanager.batchai.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 1,404,199
|
private void dateFilter(String period) {
if (arrayListDates != null) {
Date startDate = new Date();
Date endDate = new Date();
calendar = Calendar.getInstance();
calendar.setTime(startDate);
if (period.equals("thisPeriod")) {
calendar.add(Calendar.DATE, -getUser().getThisPeriod());
startDate = calendar.getTime();
} else if (period.equals("lastPeriod")) {
calendar.add(Calendar.DATE, -getUser().getThisPeriod() - getUser().getLastPeriod());
startDate = calendar.getTime();
calendar.setTime(endDate);
calendar.add(Calendar.DATE, -getUser().getThisPeriod());
endDate = calendar.getTime();
} else if (period.equals("earlier")) {
calendar.add(Calendar.DATE, -getUser().getThisPeriod() - getUser().getLastPeriod());
endDate = calendar.getTime();
startDate = null;
} else if (period.equals("null")) {
startDate = null;
endDate = null;
}
ArrayList<Integer> indexes = new ArrayList<>();
Date compareDate = null;
for (int i = 0; i < arrayListDates.size(); i++) {
try {
compareDate = new SimpleDateFormat("yyyy'-'MM'-'dd'T'HH':'mm':'ss").parse(arrayListDates.get(i));
} catch (ParseException e) {
e.printStackTrace();
}
if (startDate == null && endDate == null) {
continue;
} else if (startDate == null && !compareDate.before(endDate)) {
indexes.add(i);
} else if (!compareDate.after(startDate) || !compareDate.before(endDate)) {
indexes.add(i);
}
}
ArrayList<String> copyArrayListDates = new ArrayList<>(arrayListDates);
ArrayList<String> copyArrayListTaskNames = new ArrayList<>(arrayListTaskNames);
ArrayList<String> copyArrayListTaskScores = new ArrayList<>(arrayListTaskScores);
ArrayList<String> copyArrayListUsernames = new ArrayList<>(arrayListUsernames);
int counter = 0;
for (int index : indexes) {
copyArrayListDates.remove(index - counter);
copyArrayListTaskNames.remove(index - counter);
copyArrayListTaskScores.remove(index - counter);
copyArrayListUsernames.remove(index - counter);
counter++;
}
historyTabUsernames = copyArrayListUsernames.toArray(new String[0]);
historyTabDates = copyArrayListDates.toArray(new String[0]);
historyTabTaskNames = copyArrayListTaskNames.toArray(new String[0]);
historyTabTaskScores = copyArrayListTaskScores.toArray(new String[0]);
// Log.e("MainMenu", "taskNames: " + copyArrayListTaskNames);
customHistoryListAdapter = new CustomHistoryListAdapter(this, historyTabUsernames, historyTabDates, historyTabTaskNames, historyTabTaskScores);
// historyTabList = (ListView) findViewById(R.id.historyList);
historyTabList.setAdapter(customHistoryListAdapter);
}
}
|
void function(String period) { if (arrayListDates != null) { Date startDate = new Date(); Date endDate = new Date(); calendar = Calendar.getInstance(); calendar.setTime(startDate); if (period.equals(STR)) { calendar.add(Calendar.DATE, -getUser().getThisPeriod()); startDate = calendar.getTime(); } else if (period.equals(STR)) { calendar.add(Calendar.DATE, -getUser().getThisPeriod() - getUser().getLastPeriod()); startDate = calendar.getTime(); calendar.setTime(endDate); calendar.add(Calendar.DATE, -getUser().getThisPeriod()); endDate = calendar.getTime(); } else if (period.equals(STR)) { calendar.add(Calendar.DATE, -getUser().getThisPeriod() - getUser().getLastPeriod()); endDate = calendar.getTime(); startDate = null; } else if (period.equals("null")) { startDate = null; endDate = null; } ArrayList<Integer> indexes = new ArrayList<>(); Date compareDate = null; for (int i = 0; i < arrayListDates.size(); i++) { try { compareDate = new SimpleDateFormat(STR).parse(arrayListDates.get(i)); } catch (ParseException e) { e.printStackTrace(); } if (startDate == null && endDate == null) { continue; } else if (startDate == null && !compareDate.before(endDate)) { indexes.add(i); } else if (!compareDate.after(startDate) !compareDate.before(endDate)) { indexes.add(i); } } ArrayList<String> copyArrayListDates = new ArrayList<>(arrayListDates); ArrayList<String> copyArrayListTaskNames = new ArrayList<>(arrayListTaskNames); ArrayList<String> copyArrayListTaskScores = new ArrayList<>(arrayListTaskScores); ArrayList<String> copyArrayListUsernames = new ArrayList<>(arrayListUsernames); int counter = 0; for (int index : indexes) { copyArrayListDates.remove(index - counter); copyArrayListTaskNames.remove(index - counter); copyArrayListTaskScores.remove(index - counter); copyArrayListUsernames.remove(index - counter); counter++; } historyTabUsernames = copyArrayListUsernames.toArray(new String[0]); historyTabDates = copyArrayListDates.toArray(new String[0]); historyTabTaskNames = copyArrayListTaskNames.toArray(new String[0]); historyTabTaskScores = copyArrayListTaskScores.toArray(new String[0]); customHistoryListAdapter = new CustomHistoryListAdapter(this, historyTabUsernames, historyTabDates, historyTabTaskNames, historyTabTaskScores); historyTabList.setAdapter(customHistoryListAdapter); } }
|
/**
* Filters the tab based on the period selected
* @param period
*/
|
Filters the tab based on the period selected
|
dateFilter
|
{
"repo_name": "robinsjovoll/Collective",
"path": "app/src/main/java/com/mobile/collective/implementation/controller/MainMenuController.java",
"license": "mit",
"size": 58605
}
|
[
"com.mobile.collective.framework.CustomHistoryListAdapter",
"java.text.ParseException",
"java.text.SimpleDateFormat",
"java.util.ArrayList",
"java.util.Calendar",
"java.util.Date"
] |
import com.mobile.collective.framework.CustomHistoryListAdapter; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date;
|
import com.mobile.collective.framework.*; import java.text.*; import java.util.*;
|
[
"com.mobile.collective",
"java.text",
"java.util"
] |
com.mobile.collective; java.text; java.util;
| 2,436,506
|
public static List<MemoryManagerMXBean> getMemoryManagerMXBeans() {
return sun.management.ManagementFactory.getMemoryManagerMXBeans();
}
|
static List<MemoryManagerMXBean> function() { return sun.management.ManagementFactory.getMemoryManagerMXBeans(); }
|
/**
* Returns a list of {@link MemoryManagerMXBean} objects
* in the Java virtual machine.
* The Java virtual machine can have one or more memory managers.
* It may add or remove memory managers during execution.
*
* @return a list of <tt>MemoryManagerMXBean</tt> objects.
*
*/
|
Returns a list of <code>MemoryManagerMXBean</code> objects in the Java virtual machine. The Java virtual machine can have one or more memory managers. It may add or remove memory managers during execution
|
getMemoryManagerMXBeans
|
{
"repo_name": "jgaltidor/VarJ",
"path": "analyzed_libs/jdk1.6.0_06_src/java/lang/management/ManagementFactory.java",
"license": "mit",
"size": 24568
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 607,948
|
private boolean deleteSelectedEntry()
{
String sAlias = m_jtKeyStore.getSelectedAlias();
if (sAlias == null)
{
return false;
}
int iSelected = JOptionPane.showConfirmDialog(this,
MessageFormat.format(RB.getString("FPortecle.DeleteEntry.message"), sAlias),
RB.getString("FPortecle.DeleteEntry.Title"), JOptionPane.YES_NO_OPTION);
if (iSelected != JOptionPane.YES_OPTION)
{
return false;
}
assert m_keyStoreWrap != null;
assert m_keyStoreWrap.getKeyStore() != null;
KeyStore keyStore = m_keyStoreWrap.getKeyStore();
try
{
// Delete the entry
keyStore.deleteEntry(sAlias);
// Update the keystore wrapper
m_keyStoreWrap.removeEntryPassword(sAlias);
m_keyStoreWrap.setChanged(true);
}
catch (KeyStoreException ex)
{
DThrowable.showAndWait(this, null, ex);
return false;
}
// Update the frame's components and title
selectedAlias = null;
updateControls();
updateTitle();
return true;
}
|
boolean function() { String sAlias = m_jtKeyStore.getSelectedAlias(); if (sAlias == null) { return false; } int iSelected = JOptionPane.showConfirmDialog(this, MessageFormat.format(RB.getString(STR), sAlias), RB.getString(STR), JOptionPane.YES_NO_OPTION); if (iSelected != JOptionPane.YES_OPTION) { return false; } assert m_keyStoreWrap != null; assert m_keyStoreWrap.getKeyStore() != null; KeyStore keyStore = m_keyStoreWrap.getKeyStore(); try { keyStore.deleteEntry(sAlias); m_keyStoreWrap.removeEntryPassword(sAlias); m_keyStoreWrap.setChanged(true); } catch (KeyStoreException ex) { DThrowable.showAndWait(this, null, ex); return false; } selectedAlias = null; updateControls(); updateTitle(); return true; }
|
/**
* Let the user delete the selected keystore entry.
*
* @return True if the deletion is successful, false otherwise
*/
|
Let the user delete the selected keystore entry
|
deleteSelectedEntry
|
{
"repo_name": "gavioto/portecle",
"path": "src/main/net/sf/portecle/FPortecle.java",
"license": "gpl-2.0",
"size": 188859
}
|
[
"java.security.KeyStore",
"java.security.KeyStoreException",
"java.text.MessageFormat",
"javax.swing.JOptionPane",
"net.sf.portecle.gui.error.DThrowable"
] |
import java.security.KeyStore; import java.security.KeyStoreException; import java.text.MessageFormat; import javax.swing.JOptionPane; import net.sf.portecle.gui.error.DThrowable;
|
import java.security.*; import java.text.*; import javax.swing.*; import net.sf.portecle.gui.error.*;
|
[
"java.security",
"java.text",
"javax.swing",
"net.sf.portecle"
] |
java.security; java.text; javax.swing; net.sf.portecle;
| 1,182,493
|
checkStack(stack);// check the stack
Object dateObject = stack.pop();
// check for unknown values
if (dateObject == UnknownValue.UNKNOWN_NOMINAL || (dateObject instanceof Double && ((Double) dateObject).isNaN())) {
stack.push(UnknownValue.UNKNOWN_DATE);
return;
}
if (dateObject instanceof Double) {
dateObject = ((Double)dateObject).longValue();
}
if (!(dateObject instanceof String) && !(dateObject instanceof Long)) {
throw new ParseException("Invalid argument type for 'date_parse', argument must be (string), (double) or (long)");
}
Date date;
if (dateObject instanceof String) {
String dateString = (String)dateObject;
try {
date = DateFormat.getDateInstance(DateFormat.SHORT).parse(dateString);
Calendar cal = GregorianCalendar.getInstance();
cal.setTime(date);
stack.push(cal);
} catch (java.text.ParseException e) {
throw new ParseException("Bad string argument for 'date_parse' (" + e.getMessage() + ")");
}
} else if (dateObject instanceof Long) {
long dateLong = (Long)dateObject;
date = new Date(dateLong);
Calendar cal = GregorianCalendar.getInstance();
cal.setTime(date);
stack.push(cal);
}
}
|
checkStack(stack); Object dateObject = stack.pop(); if (dateObject == UnknownValue.UNKNOWN_NOMINAL (dateObject instanceof Double && ((Double) dateObject).isNaN())) { stack.push(UnknownValue.UNKNOWN_DATE); return; } if (dateObject instanceof Double) { dateObject = ((Double)dateObject).longValue(); } if (!(dateObject instanceof String) && !(dateObject instanceof Long)) { throw new ParseException(STR); } Date date; if (dateObject instanceof String) { String dateString = (String)dateObject; try { date = DateFormat.getDateInstance(DateFormat.SHORT).parse(dateString); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(date); stack.push(cal); } catch (java.text.ParseException e) { throw new ParseException(STR + e.getMessage() + ")"); } } else if (dateObject instanceof Long) { long dateLong = (Long)dateObject; date = new Date(dateLong); Calendar cal = GregorianCalendar.getInstance(); cal.setTime(date); stack.push(cal); } }
|
/**
* Create the resulting Calendar object.
*/
|
Create the resulting Calendar object
|
run
|
{
"repo_name": "aborg0/RapidMiner-Unuk",
"path": "src_agpl/com/rapidminer/tools/jep/function/expressions/date/DateParse.java",
"license": "agpl-3.0",
"size": 2788
}
|
[
"com.rapidminer.tools.expression.parser.UnknownValue",
"java.text.DateFormat",
"java.util.Calendar",
"java.util.Date",
"java.util.GregorianCalendar",
"org.nfunk.jep.ParseException"
] |
import com.rapidminer.tools.expression.parser.UnknownValue; import java.text.DateFormat; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import org.nfunk.jep.ParseException;
|
import com.rapidminer.tools.expression.parser.*; import java.text.*; import java.util.*; import org.nfunk.jep.*;
|
[
"com.rapidminer.tools",
"java.text",
"java.util",
"org.nfunk.jep"
] |
com.rapidminer.tools; java.text; java.util; org.nfunk.jep;
| 2,222,254
|
public static String readStream(InputStream stream) throws IOException {
try (InputStreamReader reader = new InputStreamReader(stream, Constants.UTF8)) {
return readToString(reader);
}
}
|
static String function(InputStream stream) throws IOException { try (InputStreamReader reader = new InputStreamReader(stream, Constants.UTF8)) { return readToString(reader); } }
|
/**
* Reads a UTF-8-encoded string into a string.
*/
|
Reads a UTF-8-encoded string into a string
|
readStream
|
{
"repo_name": "Squarespace/less-compiler",
"path": "src/main/java/com/squarespace/less/core/LessUtils.java",
"license": "apache-2.0",
"size": 8178
}
|
[
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader"
] |
import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 166,735
|
public int lastIndexOf(CharSequence subString, int start) {
final int thisLen = length();
final int subCount = subString.length();
if (subCount > thisLen || start < 0) {
return -1;
}
if (subCount <= 0) {
return start < thisLen ? start : thisLen;
}
start = Math.min(start, thisLen - subCount);
// count and subCount are both >= 1
final char firstChar = subString.charAt(0);
if (firstChar > MAX_CHAR_VALUE) {
return -1;
}
ByteProcessor IndexOfVisitor = new IndexOfProcessor((byte) firstChar);
try {
for (;;) {
int i = forEachByteDesc(start, thisLen - start, IndexOfVisitor);
if (i == -1) {
return -1;
}
int o1 = i, o2 = 0;
while (++o2 < subCount && (char) (value[++o1 + arrayOffset()] & 0xFF) == subString.charAt(o2)) {
// Intentionally empty
}
if (o2 == subCount) {
return i;
}
start = i - 1;
}
} catch (Exception e) {
PlatformDependent.throwException(e);
return -1;
}
}
|
int function(CharSequence subString, int start) { final int thisLen = length(); final int subCount = subString.length(); if (subCount > thisLen start < 0) { return -1; } if (subCount <= 0) { return start < thisLen ? start : thisLen; } start = Math.min(start, thisLen - subCount); final char firstChar = subString.charAt(0); if (firstChar > MAX_CHAR_VALUE) { return -1; } ByteProcessor IndexOfVisitor = new IndexOfProcessor((byte) firstChar); try { for (;;) { int i = forEachByteDesc(start, thisLen - start, IndexOfVisitor); if (i == -1) { return -1; } int o1 = i, o2 = 0; while (++o2 < subCount && (char) (value[++o1 + arrayOffset()] & 0xFF) == subString.charAt(o2)) { } if (o2 == subCount) { return i; } start = i - 1; } } catch (Exception e) { PlatformDependent.throwException(e); return -1; } }
|
/**
* Searches in this string for the index of the specified string. The search for the string starts at the specified
* offset and moves towards the beginning of this string.
*
* @param subString the string to find.
* @param start the starting offset.
* @return the index of the first character of the specified string in this string , -1 if the specified string is
* not a substring.
* @throws NullPointerException if {@code subString} is {@code null}.
*/
|
Searches in this string for the index of the specified string. The search for the string starts at the specified offset and moves towards the beginning of this string
|
lastIndexOf
|
{
"repo_name": "danbev/netty",
"path": "common/src/main/java/io/netty/util/AsciiString.java",
"license": "apache-2.0",
"size": 37250
}
|
[
"io.netty.util.ByteProcessor",
"io.netty.util.internal.PlatformDependent"
] |
import io.netty.util.ByteProcessor; import io.netty.util.internal.PlatformDependent;
|
import io.netty.util.*; import io.netty.util.internal.*;
|
[
"io.netty.util"
] |
io.netty.util;
| 1,951,168
|
public void testMarkForRollbackOnError()
{
try
{
EntityManager em = getEM();
EntityTransaction tx = em.getTransaction();
try
{
tx.begin();
try
{
em.find(Account.class, Long.valueOf(123));
}
catch (EntityNotFoundException enfe)
{
if (!tx.getRollbackOnly())
{
fail("Transaction wasn't marked for rollback after exception on object find()");
}
}
tx.rollback();
}
catch (Exception e)
{
e.printStackTrace();
}
finally
{
em.close();
}
}
finally
{
clean(Account.class);
}
}
|
void function() { try { EntityManager em = getEM(); EntityTransaction tx = em.getTransaction(); try { tx.begin(); try { em.find(Account.class, Long.valueOf(123)); } catch (EntityNotFoundException enfe) { if (!tx.getRollbackOnly()) { fail(STR); } } tx.rollback(); } catch (Exception e) { e.printStackTrace(); } finally { em.close(); } } finally { clean(Account.class); } }
|
/**
* Test of marking of current txn for rollback on exception.
*/
|
Test of marking of current txn for rollback on exception
|
testMarkForRollbackOnError
|
{
"repo_name": "datanucleus/tests",
"path": "jpa/general/src/test/org/datanucleus/tests/EntityManagerTest.java",
"license": "apache-2.0",
"size": 30260
}
|
[
"javax.persistence.EntityManager",
"javax.persistence.EntityNotFoundException",
"javax.persistence.EntityTransaction",
"org.datanucleus.samples.annotations.models.company.Account"
] |
import javax.persistence.EntityManager; import javax.persistence.EntityNotFoundException; import javax.persistence.EntityTransaction; import org.datanucleus.samples.annotations.models.company.Account;
|
import javax.persistence.*; import org.datanucleus.samples.annotations.models.company.*;
|
[
"javax.persistence",
"org.datanucleus.samples"
] |
javax.persistence; org.datanucleus.samples;
| 46,804
|
public void setOnItemSelectedListener(@Nullable OnItemSelectedListener selectedListener) {
mItemSelectedListener = selectedListener;
}
|
void function(@Nullable OnItemSelectedListener selectedListener) { mItemSelectedListener = selectedListener; }
|
/**
* Sets a listener to receive events when a list item is selected.
*
* @param selectedListener Listener to register.
*
* @see ListView#setOnItemSelectedListener(OnItemSelectedListener)
*/
|
Sets a listener to receive events when a list item is selected
|
setOnItemSelectedListener
|
{
"repo_name": "xorware/android_frameworks_base",
"path": "core/java/android/widget/ListPopupWindow.java",
"license": "apache-2.0",
"size": 48624
}
|
[
"android.annotation.Nullable",
"android.widget.AdapterView"
] |
import android.annotation.Nullable; import android.widget.AdapterView;
|
import android.annotation.*; import android.widget.*;
|
[
"android.annotation",
"android.widget"
] |
android.annotation; android.widget;
| 2,119,373
|
public Timestamp getCreated();
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
Timestamp function(); public static final String COLUMNNAME_CreatedBy = STR;
|
/** Get Created.
* Date this record was created
*/
|
Get Created. Date this record was created
|
getCreated
|
{
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/model/I_I_ElementValue.java",
"license": "gpl-2.0",
"size": 11391
}
|
[
"java.sql.Timestamp"
] |
import java.sql.Timestamp;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,572,393
|
// -------------------------------------------------------------------------
// ---- Methods for EnvironmentTypes ---------------------------------------
// -------------------------------------------------------------------------
public EnvironmentTypes getKnownEnvironmentTypes() {
if (knownEnvironmentTypes==null) {
knownEnvironmentTypes = new EnvironmentTypes();
// --- Define 'No environment' ------------------------------------
String envKey = "none";
String envDisplayName = "Kein vordefiniertes Umgebungsmodell verwenden";
String envDisplayNameLanguage = Language.DE;
Class<? extends EnvironmentController> envControllerClass = null;
Class<? extends Agent> displayAgentClass = null;
knownEnvironmentTypes.add(new EnvironmentType(envKey, envDisplayName, envDisplayNameLanguage, envControllerClass, displayAgentClass));
}
// --- Check for environments in the dynamic OSGI environment ---------
List<EnvironmentType> envTypeList = EnvironmentTypeServiceFinder.findEnvironmentTypeServices();
for (int i = 0; i < envTypeList.size(); i++) {
if (knownEnvironmentTypes.contains(envTypeList.get(i))==false) {
knownEnvironmentTypes.add(envTypeList.get(i));
}
}
return knownEnvironmentTypes;
}
|
EnvironmentTypes function() { if (knownEnvironmentTypes==null) { knownEnvironmentTypes = new EnvironmentTypes(); String envKey = "none"; String envDisplayName = STR; String envDisplayNameLanguage = Language.DE; Class<? extends EnvironmentController> envControllerClass = null; Class<? extends Agent> displayAgentClass = null; knownEnvironmentTypes.add(new EnvironmentType(envKey, envDisplayName, envDisplayNameLanguage, envControllerClass, displayAgentClass)); } List<EnvironmentType> envTypeList = EnvironmentTypeServiceFinder.findEnvironmentTypeServices(); for (int i = 0; i < envTypeList.size(); i++) { if (knownEnvironmentTypes.contains(envTypeList.get(i))==false) { knownEnvironmentTypes.add(envTypeList.get(i)); } } return knownEnvironmentTypes; }
|
/**
* This method returns all EnvironmentTypes known by Agent.GUI
* @return the knowEnvironmentTypes
* @see EnvironmentType
* @see EnvironmentTypes
*/
|
This method returns all EnvironmentTypes known by Agent.GUI
|
getKnownEnvironmentTypes
|
{
"repo_name": "EnFlexIT/AgentWorkbench",
"path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/core/config/GlobalInfo.java",
"license": "lgpl-2.1",
"size": 78561
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 53,478
|
public void parse(String systemId)
throws IOException, SAXException {
allowXMLCatalogPI = true;
setupBaseURI(systemId);
try {
super.parse(systemId);
} catch (InternalError ie) {
explain(systemId);
throw ie;
}
}
|
void function(String systemId) throws IOException, SAXException { allowXMLCatalogPI = true; setupBaseURI(systemId); try { super.parse(systemId); } catch (InternalError ie) { explain(systemId); throw ie; } }
|
/** SAX XMLReader API.
*
* @see #parse(InputSource)
*/
|
SAX XMLReader API
|
parse
|
{
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jaxp/src/com/sun/org/apache/xml/internal/resolver/tools/ResolvingXMLFilter.java",
"license": "mit",
"size": 10923
}
|
[
"java.io.IOException",
"org.xml.sax.SAXException"
] |
import java.io.IOException; import org.xml.sax.SAXException;
|
import java.io.*; import org.xml.sax.*;
|
[
"java.io",
"org.xml.sax"
] |
java.io; org.xml.sax;
| 1,644,640
|
protected boolean checkPreparedPages(PageViewport newPageViewport,
boolean renderUnresolved) {
for (Iterator iter = prepared.iterator(); iter.hasNext();) {
PageViewport pageViewport = (PageViewport)iter.next();
if (pageViewport.isResolved() || renderUnresolved) {
if (!renderer.supportsOutOfOrder()
&& pageViewport.getPageSequence().isFirstPage(pageViewport)) {
renderer.startPageSequence(pageViewport.getPageSequence());
}
renderPage(pageViewport);
pageViewport.clear();
iter.remove();
} else {
// if keeping order then stop at first page not resolved
if (!renderer.supportsOutOfOrder()) {
break;
}
}
}
return renderer.supportsOutOfOrder() || prepared.isEmpty();
}
|
boolean function(PageViewport newPageViewport, boolean renderUnresolved) { for (Iterator iter = prepared.iterator(); iter.hasNext();) { PageViewport pageViewport = (PageViewport)iter.next(); if (pageViewport.isResolved() renderUnresolved) { if (!renderer.supportsOutOfOrder() && pageViewport.getPageSequence().isFirstPage(pageViewport)) { renderer.startPageSequence(pageViewport.getPageSequence()); } renderPage(pageViewport); pageViewport.clear(); iter.remove(); } else { if (!renderer.supportsOutOfOrder()) { break; } } } return renderer.supportsOutOfOrder() prepared.isEmpty(); }
|
/**
* Check prepared pages
*
* @param newPageViewport the new page being added
* @param renderUnresolved render pages with unresolved idref's
* (done at end-of-document processing)
* @return true if the current page should be rendered
* false if the renderer doesn't support out of order
* rendering and there are pending pages
*/
|
Check prepared pages
|
checkPreparedPages
|
{
"repo_name": "StrategyObject/fop",
"path": "src/java/org/apache/fop/area/RenderPagesModel.java",
"license": "apache-2.0",
"size": 9830
}
|
[
"java.util.Iterator"
] |
import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,526,107
|
public void discardMostRecentElements(int i) throws MathIllegalArgumentException {
discardExtremeElements(i,false);
}
|
void function(int i) throws MathIllegalArgumentException { discardExtremeElements(i,false); }
|
/**
* Discards the {@code i} last elements of the array.
* <p>
* For example, if the array contains the elements 1,2,3,4, invoking
* {@code discardMostRecentElements(2)} will cause the last two elements
* to be discarded, leaving 1,2 in the array.
*
* @param i the number of elements to discard from the end of the array
* @throws MathIllegalArgumentException if i is greater than numElements.
* @since 2.0
*/
|
Discards the i last elements of the array. For example, if the array contains the elements 1,2,3,4, invoking discardMostRecentElements(2) will cause the last two elements to be discarded, leaving 1,2 in the array
|
discardMostRecentElements
|
{
"repo_name": "virtualdataset/metagen-java",
"path": "virtdata-lib-curves4/src/main/java/org/apache/commons/math4/util/ResizableDoubleArray.java",
"license": "apache-2.0",
"size": 32895
}
|
[
"org.apache.commons.math4.exception.MathIllegalArgumentException"
] |
import org.apache.commons.math4.exception.MathIllegalArgumentException;
|
import org.apache.commons.math4.exception.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 2,052,748
|
public static ZergHosts from(Collection<ZergHost> hosts) {
return new ZergHosts(ImmutableSet.copyOf(hosts));
}
private static final Pattern ZONE_PATTERN = Pattern.compile("^(\\w+-\\w+)-(\\w+)$");
|
static ZergHosts function(Collection<ZergHost> hosts) { return new ZergHosts(ImmutableSet.copyOf(hosts)); } private static final Pattern ZONE_PATTERN = Pattern.compile(STR);
|
/**
* Creates a ZergHosts set from a collection of {@link ZergHost}s.
*
* @param hosts the hosts to be in this set
* @return the ZergHosts
*/
|
Creates a ZergHosts set from a collection of <code>ZergHost</code>s
|
from
|
{
"repo_name": "signal/agathon",
"path": "agathon-manager/src/main/java/com/brighttag/agathon/dao/zerg/ZergHosts.java",
"license": "apache-2.0",
"size": 6765
}
|
[
"com.google.common.collect.ImmutableSet",
"java.util.Collection",
"java.util.regex.Pattern"
] |
import com.google.common.collect.ImmutableSet; import java.util.Collection; import java.util.regex.Pattern;
|
import com.google.common.collect.*; import java.util.*; import java.util.regex.*;
|
[
"com.google.common",
"java.util"
] |
com.google.common; java.util;
| 490,697
|
@Message(id = 79, value = "Failed initializing module %s")
RuntimeException failedInitializingModule(@Cause Throwable cause, String name);
|
@Message(id = 79, value = STR) RuntimeException failedInitializingModule(@Cause Throwable cause, String name);
|
/**
* Creates an exception indicating a failure to initialize the module.
*
* @param cause the cause of the error.
* @param name the name of the module.
*
* @return a {@link RuntimeException} for the error.
*/
|
Creates an exception indicating a failure to initialize the module
|
failedInitializingModule
|
{
"repo_name": "aloubyansky/wildfly-core",
"path": "controller/src/main/java/org/jboss/as/controller/logging/ControllerLogger.java",
"license": "lgpl-2.1",
"size": 164970
}
|
[
"org.jboss.logging.annotations.Cause",
"org.jboss.logging.annotations.Message"
] |
import org.jboss.logging.annotations.Cause; import org.jboss.logging.annotations.Message;
|
import org.jboss.logging.annotations.*;
|
[
"org.jboss.logging"
] |
org.jboss.logging;
| 79,079
|
EReference getAssociationEnd__IsSorted_1();
|
EReference getAssociationEnd__IsSorted_1();
|
/**
* Returns the meta object for the containment reference list '{@link cruise.umple.umple.AssociationEnd_#getIsSorted_1 <em>Is Sorted 1</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Is Sorted 1</em>'.
* @see cruise.umple.umple.AssociationEnd_#getIsSorted_1()
* @see #getAssociationEnd_()
* @generated
*/
|
Returns the meta object for the containment reference list '<code>cruise.umple.umple.AssociationEnd_#getIsSorted_1 Is Sorted 1</code>'.
|
getAssociationEnd__IsSorted_1
|
{
"repo_name": "ahmedvc/umple",
"path": "cruise.umple.xtext/src-gen/cruise/umple/umple/UmplePackage.java",
"license": "mit",
"size": 485842
}
|
[
"org.eclipse.emf.ecore.EReference"
] |
import org.eclipse.emf.ecore.EReference;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 392,127
|
ISteamflakeTmTextDirective addTextDirective( Optional<IFileOrigin> origin, String text );
|
ISteamflakeTmTextDirective addTextDirective( Optional<IFileOrigin> origin, String text );
|
/**
* Creates a new text directive within this rule.
*
* @param origin the source file location of the new directive.
* @param text the text of the directive.
*
* @return the newly created directive.
*/
|
Creates a new text directive within this rule
|
addTextDirective
|
{
"repo_name": "martin-nordberg/steamflake",
"path": "steamflake-templates/domain/steamflake-template-model/src/main/java/org/steamflake/templates/domain/model/api/elements/ISteamflakeTmDirectiveSequence.java",
"license": "apache-2.0",
"size": 3457
}
|
[
"java.util.Optional",
"org.steamflake.core.domain.base.model.api.utilities.IFileOrigin",
"org.steamflake.templates.domain.model.api.directives.text.ISteamflakeTmTextDirective"
] |
import java.util.Optional; import org.steamflake.core.domain.base.model.api.utilities.IFileOrigin; import org.steamflake.templates.domain.model.api.directives.text.ISteamflakeTmTextDirective;
|
import java.util.*; import org.steamflake.core.domain.base.model.api.utilities.*; import org.steamflake.templates.domain.model.api.directives.text.*;
|
[
"java.util",
"org.steamflake.core",
"org.steamflake.templates"
] |
java.util; org.steamflake.core; org.steamflake.templates;
| 2,881,660
|
protected void connect(Object edge, Object terminal, boolean isSource,
boolean isClone)
{
mxGraph graph = graphComponent.getGraph();
mxIGraphModel model = graph.getModel();
model.beginUpdate();
try
{
if (isClone)
{
Object clone = graph.cloneCells(new Object[] { edge })[0];
Object parent = model.getParent(edge);
graph.addCells(new Object[] { clone }, parent);
Object other = model.getTerminal(edge, !isSource);
graph.connectCell(clone, other, !isSource);
graph.setSelectionCell(clone);
edge = clone;
}
// Passes an empty constraint to reset constraint information
graph.connectCell(edge, terminal, isSource,
new mxConnectionConstraint());
}
finally
{
model.endUpdate();
}
}
|
void function(Object edge, Object terminal, boolean isSource, boolean isClone) { mxGraph graph = graphComponent.getGraph(); mxIGraphModel model = graph.getModel(); model.beginUpdate(); try { if (isClone) { Object clone = graph.cloneCells(new Object[] { edge })[0]; Object parent = model.getParent(edge); graph.addCells(new Object[] { clone }, parent); Object other = model.getTerminal(edge, !isSource); graph.connectCell(clone, other, !isSource); graph.setSelectionCell(clone); edge = clone; } graph.connectCell(edge, terminal, isSource, new mxConnectionConstraint()); } finally { model.endUpdate(); } }
|
/**
* Connects the given edge to the given source or target terminal.
*
* @param edge
* @param terminal
* @param isSource
*/
|
Connects the given edge to the given source or target terminal
|
connect
|
{
"repo_name": "3w3rt0n/AmeacasInternas",
"path": "src/com/mxgraph/swing/handler/mxEdgeHandler.java",
"license": "apache-2.0",
"size": 18945
}
|
[
"com.mxgraph.view.mxConnectionConstraint"
] |
import com.mxgraph.view.mxConnectionConstraint;
|
import com.mxgraph.view.*;
|
[
"com.mxgraph.view"
] |
com.mxgraph.view;
| 2,274,929
|
private void checkResourceRequirementsWithDelay() {
if (lastResourceRequirementsCheck == null || lastResourceRequirementsCheck.isDone()) {
lastResourceRequirementsCheck =
scheduledExecutor.schedule(
() -> mainThreadExecutor.execute(this::checkResourceRequirements),
requirementsCheckDelay.toMilliseconds(),
TimeUnit.MILLISECONDS);
}
}
|
void function() { if (lastResourceRequirementsCheck == null lastResourceRequirementsCheck.isDone()) { lastResourceRequirementsCheck = scheduledExecutor.schedule( () -> mainThreadExecutor.execute(this::checkResourceRequirements), requirementsCheckDelay.toMilliseconds(), TimeUnit.MILLISECONDS); } }
|
/**
* Depending on the implementation of {@link ResourceAllocationStrategy}, checking resource
* requirements and potentially making a re-allocation can be heavy. In order to cover more
* changes with each check, thus reduce the frequency of unnecessary re-allocations, the checks
* are performed with a slight delay.
*/
|
Depending on the implementation of <code>ResourceAllocationStrategy</code>, checking resource requirements and potentially making a re-allocation can be heavy. In order to cover more changes with each check, thus reduce the frequency of unnecessary re-allocations, the checks are performed with a slight delay
|
checkResourceRequirementsWithDelay
|
{
"repo_name": "tillrohrmann/flink",
"path": "flink-runtime/src/main/java/org/apache/flink/runtime/resourcemanager/slotmanager/FineGrainedSlotManager.java",
"license": "apache-2.0",
"size": 32650
}
|
[
"java.util.concurrent.TimeUnit"
] |
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 2,506,981
|
public static <T> DslTemplate<T> dslTemplate(Class<? extends T> cl, String template, List<?> args) {
return dslTemplate(cl, createTemplate(template), args);
}
|
static <T> DslTemplate<T> function(Class<? extends T> cl, String template, List<?> args) { return dslTemplate(cl, createTemplate(template), args); }
|
/**
* Create a new Template expression
*
* @param cl type of expression
* @param template template
* @param args template parameters
* @return template expression
*/
|
Create a new Template expression
|
dslTemplate
|
{
"repo_name": "johnktims/querydsl",
"path": "querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java",
"license": "apache-2.0",
"size": 74346
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 164,310
|
private int getImageResourceForFile(File file) {
int res = R.drawable.file_document;
if (pointsToParentFolder(file)) {
res = R.drawable.arrow_up;
} else if (file.isDirectory()) {
res = R.drawable.folder;
} else if (GUESS_MUSIC.matcher(file.getName()).matches()) {
res = R.drawable.file_music;
} else if (GUESS_IMAGE.matcher(file.getName()).matches()) {
res = R.drawable.file_image;
}
return res;
}
|
int function(File file) { int res = R.drawable.file_document; if (pointsToParentFolder(file)) { res = R.drawable.arrow_up; } else if (file.isDirectory()) { res = R.drawable.folder; } else if (GUESS_MUSIC.matcher(file.getName()).matches()) { res = R.drawable.file_music; } else if (GUESS_IMAGE.matcher(file.getName()).matches()) { res = R.drawable.file_image; } return res; }
|
/**
* Returns a drawable resource id for given file.
* This function is rather fast as the file type is guessed
* based on the extension.
*
* @return resource id to use.
*/
|
Returns a drawable resource id for given file. This function is rather fast as the file type is guessed based on the extension
|
getImageResourceForFile
|
{
"repo_name": "xbao/vanilla",
"path": "src/ch/blinkenlights/android/vanilla/FileSystemAdapter.java",
"license": "gpl-3.0",
"size": 12663
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 197,326
|
CompletableFuture<Void> removeListener(MapEventListener<K, V> listener);
|
CompletableFuture<Void> removeListener(MapEventListener<K, V> listener);
|
/**
* Unregisters the specified listener such that it will no longer
* receive map change notifications.
*
* @param listener listener to unregister
* @return future that will be completed when the operation finishes
*/
|
Unregisters the specified listener such that it will no longer receive map change notifications
|
removeListener
|
{
"repo_name": "osinstom/onos",
"path": "core/api/src/main/java/org/onosproject/store/service/AsyncConsistentMap.java",
"license": "apache-2.0",
"size": 15961
}
|
[
"java.util.concurrent.CompletableFuture"
] |
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 2,854,914
|
public IQueue getQueueAppEvents();
|
IQueue function();
|
/**
* Gets {@link IQueue} to buffer application's events.
*
* @return
*/
|
Gets <code>IQueue</code> to buffer application's events
|
getQueueAppEvents
|
{
"repo_name": "btnguyen2k/upas",
"path": "app/modules/registry/IRegistry.java",
"license": "mit",
"size": 2227
}
|
[
"com.github.ddth.queue.IQueue"
] |
import com.github.ddth.queue.IQueue;
|
import com.github.ddth.queue.*;
|
[
"com.github.ddth"
] |
com.github.ddth;
| 312,980
|
protected Integer getNextAccountingLineNumber(CapitalAccountingLines capitalAccountingLine, CapitalAssetInformation capitalAsset) {
Integer nextAccountingLineNumber = 0;
List<CapitalAssetAccountsGroupDetails> capitalAssetAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails();
for (CapitalAssetAccountsGroupDetails capitalAssetAccountLine : capitalAssetAccountLines) {
nextAccountingLineNumber = capitalAssetAccountLine.getCapitalAssetAccountLineNumber();
}
return ++nextAccountingLineNumber;
}
|
Integer function(CapitalAccountingLines capitalAccountingLine, CapitalAssetInformation capitalAsset) { Integer nextAccountingLineNumber = 0; List<CapitalAssetAccountsGroupDetails> capitalAssetAccountLines = capitalAsset.getCapitalAssetAccountsGroupDetails(); for (CapitalAssetAccountsGroupDetails capitalAssetAccountLine : capitalAssetAccountLines) { nextAccountingLineNumber = capitalAssetAccountLine.getCapitalAssetAccountLineNumber(); } return ++nextAccountingLineNumber; }
|
/**
* calculates the next accounting line number for accounts details for each capital asset.
* Goes through the current records and gets the last accounting line number.
*
* @param capitalAsset
* @return nextAccountingLineNumber
*/
|
calculates the next accounting line number for accounts details for each capital asset. Goes through the current records and gets the last accounting line number
|
getNextAccountingLineNumber
|
{
"repo_name": "bhutchinson/kfs",
"path": "kfs-cam/src/main/java/org/kuali/kfs/module/cab/document/service/impl/GlLineServiceImpl.java",
"license": "agpl-3.0",
"size": 46133
}
|
[
"java.util.List",
"org.kuali.kfs.fp.businessobject.CapitalAccountingLines",
"org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails",
"org.kuali.kfs.fp.businessobject.CapitalAssetInformation"
] |
import java.util.List; import org.kuali.kfs.fp.businessobject.CapitalAccountingLines; import org.kuali.kfs.fp.businessobject.CapitalAssetAccountsGroupDetails; import org.kuali.kfs.fp.businessobject.CapitalAssetInformation;
|
import java.util.*; import org.kuali.kfs.fp.businessobject.*;
|
[
"java.util",
"org.kuali.kfs"
] |
java.util; org.kuali.kfs;
| 2,882,561
|
public Document doFinal(Document context, Element element, boolean content)
throws Exception {
logger.log(java.util.logging.Level.FINE, "Processing source element...");
if(null == context)
logger.log(java.util.logging.Level.SEVERE, "Context document unexpectedly null...");
if(null == element)
logger.log(java.util.logging.Level.SEVERE, "Source element unexpectedly null...");
_contextDocument = context;
Document result = null;
switch (_cipherMode) {
case DECRYPT_MODE:
if (content) {
result = decryptElementContent(element);
} else {
result = decryptElement(element);
}
break;
case ENCRYPT_MODE:
if (content) {
result = encryptElementContent(element);
} else {
result = encryptElement(element);
}
break;
case UNWRAP_MODE:
break;
case WRAP_MODE:
break;
default:
throw new XMLEncryptionException(
"empty", new IllegalStateException());
}
return (result);
}
|
Document function(Document context, Element element, boolean content) throws Exception { logger.log(java.util.logging.Level.FINE, STR); if(null == context) logger.log(java.util.logging.Level.SEVERE, STR); if(null == element) logger.log(java.util.logging.Level.SEVERE, STR); _contextDocument = context; Document result = null; switch (_cipherMode) { case DECRYPT_MODE: if (content) { result = decryptElementContent(element); } else { result = decryptElement(element); } break; case ENCRYPT_MODE: if (content) { result = encryptElementContent(element); } else { result = encryptElement(element); } break; case UNWRAP_MODE: break; case WRAP_MODE: break; default: throw new XMLEncryptionException( "empty", new IllegalStateException()); } return (result); }
|
/**
* Process the contents of a DOM <code>Element</code> node. The processing
* depends on the initialization parameters of
* {@link #init(int, Key) init()}.
*
* @param context the context <code>Document</code>.
* @param element the <code>Element</code> which contents is to be
* encrypted.
* @param content
* @return the processed <code>Document</code>.
* @throws Exception to indicate any exceptional conditions.
*/
|
Process the contents of a DOM <code>Element</code> node. The processing depends on the initialization parameters of <code>#init(int, Key) init()</code>
|
doFinal
|
{
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xml/internal/security/encryption/XMLCipher.java",
"license": "apache-2.0",
"size": 155696
}
|
[
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] |
import org.w3c.dom.Document; import org.w3c.dom.Element;
|
import org.w3c.dom.*;
|
[
"org.w3c.dom"
] |
org.w3c.dom;
| 2,653,527
|
public PipeAdvertisement getAdvertisement();
|
PipeAdvertisement function();
|
/**
* Gets the pipe advertisement
*
* @return The advertisement
*/
|
Gets the pipe advertisement
|
getAdvertisement
|
{
"repo_name": "johnjianfang/jxse",
"path": "src/main/java/net/jxta/pipe/OutputPipe.java",
"license": "apache-2.0",
"size": 5050
}
|
[
"net.jxta.protocol.PipeAdvertisement"
] |
import net.jxta.protocol.PipeAdvertisement;
|
import net.jxta.protocol.*;
|
[
"net.jxta.protocol"
] |
net.jxta.protocol;
| 2,589,554
|
public static String getValidInputOverBlackListPatterns(String input, String... blackListPatterns)
throws IdentityValidationException {
if (StringUtils.isEmpty(input) || isValidOverBlackListPatterns(input, blackListPatterns)) {
return input;
}
throw new IdentityValidationException(
msgSection1 + String.format(msgSection3, getPatternString(blackListPatterns)));
}
|
static String function(String input, String... blackListPatterns) throws IdentityValidationException { if (StringUtils.isEmpty(input) isValidOverBlackListPatterns(input, blackListPatterns)) { return input; } throw new IdentityValidationException( msgSection1 + String.format(msgSection3, getPatternString(blackListPatterns))); }
|
/**
* Returns the input if valid over the given black list patterns else throws an IdentityValidationException
*
* @param input input
* @param blackListPatterns a String array of black list pattern keys
* @return input if valid over the given black list patterns else throws an IdentityValidationException
*/
|
Returns the input if valid over the given black list patterns else throws an IdentityValidationException
|
getValidInputOverBlackListPatterns
|
{
"repo_name": "PasinduTennage/carbon-identity-framework",
"path": "components/identity-core/org.wso2.carbon.identity.base/src/main/java/org/wso2/carbon/identity/base/IdentityValidationUtil.java",
"license": "apache-2.0",
"size": 10711
}
|
[
"org.apache.commons.lang.StringUtils"
] |
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,316,843
|
@Nullable
public static Boolean getBooleanValue(@NotNull String value) {
value = StringUtil.toLowerCase(value);
if (ContainerUtil.newHashSet("true", "yes", "on", "1").contains(value)) return true;
if (ContainerUtil.newHashSet("false", "no", "off", "0", "").contains(value)) return false;
return null;
}
|
static Boolean function(@NotNull String value) { value = StringUtil.toLowerCase(value); if (ContainerUtil.newHashSet("true", "yes", "on", "1").contains(value)) return true; if (ContainerUtil.newHashSet("false", "no", "off", "0", "").contains(value)) return false; return null; }
|
/**
* Converts the git config boolean value (which can be specified in various ways) to Java Boolean.
* @return true if the value represents "true", false if the value represents "false", null if the value doesn't look like a boolean value.
*/
|
Converts the git config boolean value (which can be specified in various ways) to Java Boolean
|
getBooleanValue
|
{
"repo_name": "leafclick/intellij-community",
"path": "plugins/git4idea/src/git4idea/config/GitConfigUtil.java",
"license": "apache-2.0",
"size": 5926
}
|
[
"com.intellij.openapi.util.text.StringUtil",
"com.intellij.util.containers.ContainerUtil",
"org.jetbrains.annotations.NotNull"
] |
import com.intellij.openapi.util.text.StringUtil; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull;
|
import com.intellij.openapi.util.text.*; import com.intellij.util.containers.*; import org.jetbrains.annotations.*;
|
[
"com.intellij.openapi",
"com.intellij.util",
"org.jetbrains.annotations"
] |
com.intellij.openapi; com.intellij.util; org.jetbrains.annotations;
| 510,058
|
public void setScope(String value)
{
this.attributeMap.put(TagConstants.ATTRIBUTE_SCOPE, value);
}
|
void function(String value) { this.attributeMap.put(TagConstants.ATTRIBUTE_SCOPE, value); }
|
/**
* setter for the "scope" tag attribute.
* @param value attribute value
*/
|
setter for the "scope" tag attribute
|
setScope
|
{
"repo_name": "martin-kuba/metacentrum-accounting",
"path": "metaacct/src/main/java/org/displaytag/tags/ColumnTag.java",
"license": "apache-2.0",
"size": 30040
}
|
[
"org.displaytag.util.TagConstants"
] |
import org.displaytag.util.TagConstants;
|
import org.displaytag.util.*;
|
[
"org.displaytag.util"
] |
org.displaytag.util;
| 606,559
|
private boolean isTdbAuToBeConfigured(TdbAu tdbAu, Connection conn,
boolean isFirstRun, Configuration config) throws DbException {
final String DEBUG_HEADER = "processNewTdbAu(): ";
if (log.isDebug2()) {
log.debug2(DEBUG_HEADER + "tdbAu = " + tdbAu);
log.debug2(DEBUG_HEADER + "isFirstRun = " + isFirstRun);
}
// Skip those archival units that are down.
if (tdbAu.isDown()) {
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Not configured: TdbAu '"
+ tdbAu + "' is marked down.");
return false;
}
// Get the archival unit identifier.
String auId;
try {
auId = tdbAu.getAuId(pluginManager);
if (log.isDebug3()) log.debug3(DEBUG_HEADER + "auId = " + auId);
} catch (IllegalStateException ise) {
if (log.isDebug2()) log.debug2("Not configured: Ignored '" + tdbAu
+ "' because of problems getting its identifier: "
+ ise.getMessage());
return false;
} catch (RuntimeException re) {
if (log.isDebug2()) log.debug2("Not configured: Ignored '" + tdbAu
+ "' because of problems getting its identifier: " + re.getMessage());
return false;
}
// Get the archival unit.
ArchivalUnit au = pluginManager.getAuFromId(auId);
if (log.isDebug3()) log.debug3(DEBUG_HEADER + "au = " + au);
// Check whether the archival unit is already configured.
if (au != null && pluginManager.isActiveAu(au)) {
// Yes: Nothing more to do.
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Not configured: TdbAu '"
+ tdbAu + "' is already configured.");
return false;
}
// Check whether the archival unit must be configured.
if (isTotalSubscriptionOn || mustConfigure) {
// Yes: Add the archival unit configuration to those to be configured.
config = subscriptionManager.addAuConfiguration(tdbAu, auId, config);
if (log.isDebug2()) log.debug2(DEBUG_HEADER
+ "Configured: isTotalSubscriptionOn = " + isTotalSubscriptionOn
+ ", mustConfigure = " + mustConfigure);
return true;
}
// No: Check whether this is the first run of the subscription manager.
if (isFirstRun) {
// Yes: Add the archival unit to the table of unconfigured archival units.
mdManager.persistUnconfiguredAu(conn, auId);
// The archival unit is not going to be configured.
if (log.isDebug2()) log.debug2(DEBUG_HEADER
+ "Not configured: isFirstRun " + isFirstRun);
return false;
}
// No.
if (log.isDebug3()) {
log.debug3(DEBUG_HEADER + "currentTdbPublisher = " + currentTdbPublisher);
log.debug3(DEBUG_HEADER + "tdbAu.getTdbPublisher() = "
+ tdbAu.getTdbPublisher());
}
// Check whether this archival unit belongs to a different publisher than
// the previous archival unit processed.
if (!tdbAu.getTdbPublisher().equals(currentTdbPublisher)) {
// Yes: Update the publisher for this archival unit.
currentTdbPublisher = tdbAu.getTdbPublisher();
// Get the publisher subscription setting for this publisher.
currentCoveredByPublisherSubscription = subscriptionManager
.findPublisherSubscription(conn, currentTdbPublisher.getName());
if (log.isDebug3()) log.debug3(DEBUG_HEADER
+ "currentCoveredByPublisherSubscription = "
+ currentCoveredByPublisherSubscription);
} else {
// No: Reuse the publisher from the previous archival unit.
if (log.isDebug3()) log.debug3(DEBUG_HEADER
+ "Reusing publisher = " + currentTdbPublisher);
}
// Check whether there is a publisher subscription.
if (currentCoveredByPublisherSubscription != null) {
// Yes: Check whether all publisher archival units are subscribed.
if (currentCoveredByPublisherSubscription.booleanValue()) {
// Yes: Add the archival unit configuration to those to be configured.
config = subscriptionManager.addAuConfiguration(tdbAu, auId, config);
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Configured: TdbAu '"
+ tdbAu + "' is covered by publisher subscription = "
+ currentCoveredByPublisherSubscription);
return true;
} else {
// No: Nothing else to do.
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Not configured: TdbAu '"
+ tdbAu + "' is covered by publisher subscription = "
+ currentCoveredByPublisherSubscription);
return false;
}
}
// No.
if (log.isDebug3()) {
log.debug3(DEBUG_HEADER + "currentTdbTitle = " + currentTdbTitle);
log.debug3(DEBUG_HEADER + "tdbAu.getTdbTitle() = " + tdbAu.getTdbTitle());
}
// Check whether the archival unit is in the table of unconfigured archival
// units already.
if (mdManager.isAuInUnconfiguredAuTable(conn, auId)) {
// Yes: The archival unit is not going to be configured.
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Not configured: TdbAu '"
+ tdbAu
+ "' is in the table of unconfigured archival units already.");
return false;
}
// No: Check whether this archival unit belongs to a different title than
// the previous archival unit processed.
if (!tdbAu.getTdbTitle().equals(currentTdbTitle)) {
// Yes: Update the title data for this archival unit.
currentTdbTitle = tdbAu.getTdbTitle();
// Get the subscription ranges for the archival unit title.
currentSubscribedRanges = new ArrayList<BibliographicPeriod>();
currentUnsubscribedRanges = new ArrayList<BibliographicPeriod>();
subscriptionManager.populateTitleSubscriptionRanges(conn, currentTdbTitle,
currentSubscribedRanges, currentUnsubscribedRanges);
// Get the archival units covered by the subscription.
currentCoveredTdbAus = subscriptionManager.getCoveredTdbAus(
currentTdbTitle, currentSubscribedRanges, currentUnsubscribedRanges);
} else {
// No: Reuse the title data from the previous archival unit.
if (log.isDebug3()) log.debug3(DEBUG_HEADER
+ "Reusing data from title = " + currentTdbTitle);
}
// Check whether the archival unit needs to be configured.
if (currentCoveredTdbAus.contains(tdbAu)) {
// Yes: Add the archival unit configuration to those to be configured.
config = subscriptionManager.addAuConfiguration(tdbAu, auId, config);
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Configured: TdbAu '"
+ tdbAu + "' is covered by subscription.");
return true;
}
// No: Add it to the table of unconfigured archival units if not already
// there.
if (!mdManager.isAuInUnconfiguredAuTable(conn, auId)) {
mdManager.persistUnconfiguredAu(conn, auId);
}
if (log.isDebug2()) log.debug2(DEBUG_HEADER + "Not configured: TdbAu '"
+ tdbAu + "' is not covered by subscription.");
return false;
}
|
boolean function(TdbAu tdbAu, Connection conn, boolean isFirstRun, Configuration config) throws DbException { final String DEBUG_HEADER = STR; if (log.isDebug2()) { log.debug2(DEBUG_HEADER + STR + tdbAu); log.debug2(DEBUG_HEADER + STR + isFirstRun); } if (tdbAu.isDown()) { if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR); return false; } String auId; try { auId = tdbAu.getAuId(pluginManager); if (log.isDebug3()) log.debug3(DEBUG_HEADER + STR + auId); } catch (IllegalStateException ise) { if (log.isDebug2()) log.debug2(STR + tdbAu + STR + ise.getMessage()); return false; } catch (RuntimeException re) { if (log.isDebug2()) log.debug2(STR + tdbAu + STR + re.getMessage()); return false; } ArchivalUnit au = pluginManager.getAuFromId(auId); if (log.isDebug3()) log.debug3(DEBUG_HEADER + STR + au); if (au != null && pluginManager.isActiveAu(au)) { if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR); return false; } if (isTotalSubscriptionOn mustConfigure) { config = subscriptionManager.addAuConfiguration(tdbAu, auId, config); if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + isTotalSubscriptionOn + STR + mustConfigure); return true; } if (isFirstRun) { mdManager.persistUnconfiguredAu(conn, auId); if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + isFirstRun); return false; } if (log.isDebug3()) { log.debug3(DEBUG_HEADER + STR + currentTdbPublisher); log.debug3(DEBUG_HEADER + STR + tdbAu.getTdbPublisher()); } if (!tdbAu.getTdbPublisher().equals(currentTdbPublisher)) { currentTdbPublisher = tdbAu.getTdbPublisher(); currentCoveredByPublisherSubscription = subscriptionManager .findPublisherSubscription(conn, currentTdbPublisher.getName()); if (log.isDebug3()) log.debug3(DEBUG_HEADER + STR + currentCoveredByPublisherSubscription); } else { if (log.isDebug3()) log.debug3(DEBUG_HEADER + STR + currentTdbPublisher); } if (currentCoveredByPublisherSubscription != null) { if (currentCoveredByPublisherSubscription.booleanValue()) { config = subscriptionManager.addAuConfiguration(tdbAu, auId, config); if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR + currentCoveredByPublisherSubscription); return true; } else { if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR + currentCoveredByPublisherSubscription); return false; } } if (log.isDebug3()) { log.debug3(DEBUG_HEADER + STR + currentTdbTitle); log.debug3(DEBUG_HEADER + STR + tdbAu.getTdbTitle()); } if (mdManager.isAuInUnconfiguredAuTable(conn, auId)) { if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR); return false; } if (!tdbAu.getTdbTitle().equals(currentTdbTitle)) { currentTdbTitle = tdbAu.getTdbTitle(); currentSubscribedRanges = new ArrayList<BibliographicPeriod>(); currentUnsubscribedRanges = new ArrayList<BibliographicPeriod>(); subscriptionManager.populateTitleSubscriptionRanges(conn, currentTdbTitle, currentSubscribedRanges, currentUnsubscribedRanges); currentCoveredTdbAus = subscriptionManager.getCoveredTdbAus( currentTdbTitle, currentSubscribedRanges, currentUnsubscribedRanges); } else { if (log.isDebug3()) log.debug3(DEBUG_HEADER + STR + currentTdbTitle); } if (currentCoveredTdbAus.contains(tdbAu)) { config = subscriptionManager.addAuConfiguration(tdbAu, auId, config); if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR); return true; } if (!mdManager.isAuInUnconfiguredAuTable(conn, auId)) { mdManager.persistUnconfiguredAu(conn, auId); } if (log.isDebug2()) log.debug2(DEBUG_HEADER + STR + tdbAu + STR); return false; }
|
/**
* Provides an indication of whether an archival unit needs to be configured.
*
* @param tdbAu
* A TdbAu for the archival unit to be processed.
* @param conn
* A Connection with the database connection to be used.
* @param isFirstRun
* A boolean with <code>true</code> if this is the first run of the
* subscription manager, <code>false</code> otherwise.
* @param config
* A Configuration to which to add the archival unit configuration.
* @return a boolean with <code>true</code> if the archival unit has been
* added to the batch to be configured, <code>false</code> otherwise.
* @throws DbException
* if any problem occurred accessing the database.
*/
|
Provides an indication of whether an archival unit needs to be configured
|
isTdbAuToBeConfigured
|
{
"repo_name": "edina/lockss-daemon",
"path": "src/org/lockss/subscription/SubscriptionStarter.java",
"license": "bsd-3-clause",
"size": 26304
}
|
[
"java.sql.Connection",
"java.util.ArrayList",
"org.lockss.config.Configuration",
"org.lockss.config.TdbAu",
"org.lockss.db.DbException",
"org.lockss.plugin.ArchivalUnit"
] |
import java.sql.Connection; import java.util.ArrayList; import org.lockss.config.Configuration; import org.lockss.config.TdbAu; import org.lockss.db.DbException; import org.lockss.plugin.ArchivalUnit;
|
import java.sql.*; import java.util.*; import org.lockss.config.*; import org.lockss.db.*; import org.lockss.plugin.*;
|
[
"java.sql",
"java.util",
"org.lockss.config",
"org.lockss.db",
"org.lockss.plugin"
] |
java.sql; java.util; org.lockss.config; org.lockss.db; org.lockss.plugin;
| 664,927
|
private void buildNewKey( Map<String,JSONObject> uniqueKey,
Map<String,JSONObject> lastUniqueKey,
List<Map<String,Object>> keyQuestions,
Map<Object,List<Object>> keyQuestionCombinations,
Object uniqueGroupId )
{
for ( int i = 0; i < keyQuestions.size(); ++i )
{
// Get the unique key question
Map<String,Object> uniquePerEntityOrModuleQuestion = keyQuestions.get( i );
// Get the question UUID
String questionUUID = ( String )uniquePerEntityOrModuleQuestion.get( UUID_VALUE );
// Generate a random answer value for this question
JSONObject randomAnswerValue =
generateRandomAnswerValueForUniqueKey( uniquePerEntityOrModuleQuestion, uniqueKey, lastUniqueKey, keyQuestionCombinations, uniqueGroupId );
uniqueKey.put( questionUUID, randomAnswerValue );
// Track the newly generated key in the questionCombinations collection
if ( i == keyQuestions.size() - 1 )
{
for ( Map.Entry<String, JSONObject> entry : uniqueKey.entrySet() )
{
String key = GeneratedModuleDataDetail.getTwoPartMapKey(
entry.getKey(),
entry.getValue().get(ANSWERVALUE_VALUE).toString() );
List<Object> list = keyQuestionCombinations.get( key );
if ( list == null ) {
list = Collections.synchronizedList( new ArrayList<Object>() );
}
if ( ! list.contains( uniqueGroupId ) ) list.add( uniqueGroupId );
keyQuestionCombinations.put( key, list );
}
}
}
}
|
void function( Map<String,JSONObject> uniqueKey, Map<String,JSONObject> lastUniqueKey, List<Map<String,Object>> keyQuestions, Map<Object,List<Object>> keyQuestionCombinations, Object uniqueGroupId ) { for ( int i = 0; i < keyQuestions.size(); ++i ) { Map<String,Object> uniquePerEntityOrModuleQuestion = keyQuestions.get( i ); String questionUUID = ( String )uniquePerEntityOrModuleQuestion.get( UUID_VALUE ); JSONObject randomAnswerValue = generateRandomAnswerValueForUniqueKey( uniquePerEntityOrModuleQuestion, uniqueKey, lastUniqueKey, keyQuestionCombinations, uniqueGroupId ); uniqueKey.put( questionUUID, randomAnswerValue ); if ( i == keyQuestions.size() - 1 ) { for ( Map.Entry<String, JSONObject> entry : uniqueKey.entrySet() ) { String key = GeneratedModuleDataDetail.getTwoPartMapKey( entry.getKey(), entry.getValue().get(ANSWERVALUE_VALUE).toString() ); List<Object> list = keyQuestionCombinations.get( key ); if ( list == null ) { list = Collections.synchronizedList( new ArrayList<Object>() ); } if ( ! list.contains( uniqueGroupId ) ) list.add( uniqueGroupId ); keyQuestionCombinations.put( key, list ); } } } }
|
/**
* Generates a random unique key for a given module.
* Returns whether or not this key is actually a duplicate
* within the appropriate scope (per-module, per-entity or per-entitymodule).
*/
|
Generates a random unique key for a given module. Returns whether or not this key is actually a duplicate within the appropriate scope (per-module, per-entity or per-entitymodule)
|
buildNewKey
|
{
"repo_name": "NCIP/edct-formbuilder",
"path": "src/main/java/com/healthcit/cacure/businessdelegates/GeneratedModuleDataManager.java",
"license": "bsd-3-clause",
"size": 41898
}
|
[
"com.healthcit.cacure.model.admin.GeneratedModuleDataDetail",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Map",
"net.sf.json.JSONObject"
] |
import com.healthcit.cacure.model.admin.GeneratedModuleDataDetail; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import net.sf.json.JSONObject;
|
import com.healthcit.cacure.model.admin.*; import java.util.*; import net.sf.json.*;
|
[
"com.healthcit.cacure",
"java.util",
"net.sf.json"
] |
com.healthcit.cacure; java.util; net.sf.json;
| 2,816,379
|
public List<Axis> getUserAxes() {
List<Axis> r = new ArrayList<Axis>();
for (Axis a : axes)
if(!a.isSystem())
r.add(a);
return r;
}
|
List<Axis> function() { List<Axis> r = new ArrayList<Axis>(); for (Axis a : axes) if(!a.isSystem()) r.add(a); return r; }
|
/**
* Gets the subset of {@link AxisList} that are not system axes.
*
* @deprecated as of 1.373
* System vs user difference are generalized into extension point.
*/
|
Gets the subset of <code>AxisList</code> that are not system axes
|
getUserAxes
|
{
"repo_name": "abayer/jenkins",
"path": "core/src/main/java/hudson/matrix/MatrixProject.java",
"license": "mit",
"size": 33330
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,223,132
|
public WorkItemClassificationNode updateClassificationNode(
final WorkItemClassificationNode postedNode,
final UUID project,
final TreeStructureGroup structureGroup,
final String path) {
final UUID locationId = UUID.fromString("5a172953-1b41-49d3-840a-33f79c3ce89f"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.2"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("project", project); //$NON-NLS-1$
routeValues.put("structureGroup", structureGroup); //$NON-NLS-1$
routeValues.put("path", path); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH,
locationId,
routeValues,
apiVersion,
postedNode,
VssMediaTypes.APPLICATION_JSON_TYPE,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, WorkItemClassificationNode.class);
}
|
WorkItemClassificationNode function( final WorkItemClassificationNode postedNode, final UUID project, final TreeStructureGroup structureGroup, final String path) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); routeValues.put(STR, structureGroup); routeValues.put("path", path); final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH, locationId, routeValues, apiVersion, postedNode, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, WorkItemClassificationNode.class); }
|
/**
* [Preview API 3.1-preview.2]
*
* @param postedNode
*
* @param project
* Project ID
* @param structureGroup
*
* @param path
*
* @return WorkItemClassificationNode
*/
|
[Preview API 3.1-preview.2]
|
updateClassificationNode
|
{
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/workitemtracking/webapi/WorkItemTrackingHttpClientBase.java",
"license": "mit",
"size": 169431
}
|
[
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.TreeStructureGroup",
"com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.WorkItemClassificationNode",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"java.util.HashMap",
"java.util.Map",
"java.util.UUID"
] |
import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.TreeStructureGroup; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.WorkItemClassificationNode; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID;
|
import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.workitemtracking.webapi.models.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*;
|
[
"com.microsoft.alm",
"java.util"
] |
com.microsoft.alm; java.util;
| 2,347,184
|
protected BoxFolder getCurrentFolder() {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.box_browsesdk_fragment_container);
BoxFolder curFolder = fragment instanceof BoxBrowseFolderFragment ?
((BoxBrowseFolderFragment) fragment).getFolder() :
null;
return curFolder;
}
|
BoxFolder function() { Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.box_browsesdk_fragment_container); BoxFolder curFolder = fragment instanceof BoxBrowseFolderFragment ? ((BoxBrowseFolderFragment) fragment).getFolder() : null; return curFolder; }
|
/**
* Gets current folder.
*
* @return the current folder
*/
|
Gets current folder
|
getCurrentFolder
|
{
"repo_name": "seema-at-box/box-android-browse-sdk",
"path": "box-browse-sdk/src/main/java/com/box/androidsdk/browse/activities/BoxBrowseActivity.java",
"license": "apache-2.0",
"size": 19444
}
|
[
"android.support.v4.app.Fragment",
"com.box.androidsdk.browse.fragments.BoxBrowseFolderFragment",
"com.box.androidsdk.content.models.BoxFolder"
] |
import android.support.v4.app.Fragment; import com.box.androidsdk.browse.fragments.BoxBrowseFolderFragment; import com.box.androidsdk.content.models.BoxFolder;
|
import android.support.v4.app.*; import com.box.androidsdk.browse.fragments.*; import com.box.androidsdk.content.models.*;
|
[
"android.support",
"com.box.androidsdk"
] |
android.support; com.box.androidsdk;
| 829,697
|
public Collection<DatanodeDescriptor> getCorruptReplicas(Block block) {
return corruptReplicas.getNodes(block);
}
|
Collection<DatanodeDescriptor> function(Block block) { return corruptReplicas.getNodes(block); }
|
/**
* Get the replicas which are corrupt for a given block.
*/
|
Get the replicas which are corrupt for a given block
|
getCorruptReplicas
|
{
"repo_name": "songweijia/fffs",
"path": "sources/hadoop-2.4.1-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java",
"license": "apache-2.0",
"size": 138554
}
|
[
"java.util.Collection",
"org.apache.hadoop.hdfs.protocol.Block"
] |
import java.util.Collection; import org.apache.hadoop.hdfs.protocol.Block;
|
import java.util.*; import org.apache.hadoop.hdfs.protocol.*;
|
[
"java.util",
"org.apache.hadoop"
] |
java.util; org.apache.hadoop;
| 1,886,482
|
@Generated
@Selector("setLuminanceWeight:")
public native void setLuminanceWeight(float value);
|
@Selector(STR) native void function(float value);
|
/**
* Controls how samples' luminance values are compared during bilateral filtering. The final
* weight is given by exp(-abs(L1 - L2) / (luminanceWeight * luminanceVariance + EPSILON)). Must be
* greater than or equal to zero. Defaults to 4.
*/
|
Controls how samples' luminance values are compared during bilateral filtering. The final weight is given by exp(-abs(L1 - L2) / (luminanceWeight * luminanceVariance + EPSILON)). Must be greater than or equal to zero. Defaults to 4
|
setLuminanceWeight
|
{
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/metalperformanceshaders/MPSSVGF.java",
"license": "apache-2.0",
"size": 51099
}
|
[
"org.moe.natj.objc.ann.Selector"
] |
import org.moe.natj.objc.ann.Selector;
|
import org.moe.natj.objc.ann.*;
|
[
"org.moe.natj"
] |
org.moe.natj;
| 2,364,517
|
public Response updateUser(final UserResponse user);
|
Response function(final UserResponse user);
|
/**
* Service for updating a user.
*
* @param user json with user info.
* @return user info or message error.
*/
|
Service for updating a user
|
updateUser
|
{
"repo_name": "tuliobraga/tech-gallery",
"path": "src/main/java/com/ciandt/techgallery/service/UserServiceTG.java",
"license": "apache-2.0",
"size": 1417
}
|
[
"com.ciandt.techgallery.service.model.Response",
"com.ciandt.techgallery.service.model.UserResponse"
] |
import com.ciandt.techgallery.service.model.Response; import com.ciandt.techgallery.service.model.UserResponse;
|
import com.ciandt.techgallery.service.model.*;
|
[
"com.ciandt.techgallery"
] |
com.ciandt.techgallery;
| 1,454,430
|
Path createQuarantinePath(Path hFile) throws IOException {
// extract the normal dirs structure
Path cfDir = hFile.getParent();
Path regionDir = cfDir.getParent();
Path tableDir = regionDir.getParent();
// build up the corrupted dirs structure
Path corruptBaseDir = new Path(FSUtils.getRootDir(conf), HConstants.CORRUPT_DIR_NAME);
if (conf.get("hbase.hfile.quarantine.dir") != null) {
LOG.warn("hbase.hfile.quarantine.dir is deprecated. Default to " + corruptBaseDir);
}
Path corruptTableDir = new Path(corruptBaseDir, tableDir.getName());
Path corruptRegionDir = new Path(corruptTableDir, regionDir.getName());
Path corruptFamilyDir = new Path(corruptRegionDir, cfDir.getName());
Path corruptHfile = new Path(corruptFamilyDir, hFile.getName());
return corruptHfile;
}
|
Path createQuarantinePath(Path hFile) throws IOException { Path cfDir = hFile.getParent(); Path regionDir = cfDir.getParent(); Path tableDir = regionDir.getParent(); Path corruptBaseDir = new Path(FSUtils.getRootDir(conf), HConstants.CORRUPT_DIR_NAME); if (conf.get(STR) != null) { LOG.warn(STR + corruptBaseDir); } Path corruptTableDir = new Path(corruptBaseDir, tableDir.getName()); Path corruptRegionDir = new Path(corruptTableDir, regionDir.getName()); Path corruptFamilyDir = new Path(corruptRegionDir, cfDir.getName()); Path corruptHfile = new Path(corruptFamilyDir, hFile.getName()); return corruptHfile; }
|
/**
* Given a path, generates a new path to where we move a corrupted hfile (bad
* trailer, no trailer).
*
* @param hFile
* Path to a corrupt hfile (assumes that it is HBASE_DIR/ table
* /region/cf/file)
* @return path to where corrupted files are stored. This should be
* HBASE_DIR/.corrupt/table/region/cf/file.
*/
|
Given a path, generates a new path to where we move a corrupted hfile (bad trailer, no trailer)
|
createQuarantinePath
|
{
"repo_name": "gustavoanatoly/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/util/hbck/HFileCorruptionChecker.java",
"license": "apache-2.0",
"size": 19181
}
|
[
"java.io.IOException",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.util.FSUtils"
] |
import java.io.IOException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.util.FSUtils;
|
import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 1,328,611
|
private static SOAPMessage sendRequest(String url, SOAPMessage message)
throws SOAPException {
SOAPConnection connection = null;
SOAPMessage response = null;
try {
connection = createConnection();
response = connection.call(message, url);
} finally {
if (connection != null) {
closeConnection(connection);
}
}
return response;
}
|
static SOAPMessage function(String url, SOAPMessage message) throws SOAPException { SOAPConnection connection = null; SOAPMessage response = null; try { connection = createConnection(); response = connection.call(message, url); } finally { if (connection != null) { closeConnection(connection); } } return response; }
|
/**
* Sends the SOAP message request to the SOAP server
*
* @param url
* the endpoint of the web service
* @param message
* the SOAP message to be send
* @return the response, SOAP message
* @throws SOAPException
* if unable to send request
*/
|
Sends the SOAP message request to the SOAP server
|
sendRequest
|
{
"repo_name": "bolobr/IEBT-Libreplan",
"path": "libreplan-webapp/src/main/java/org/libreplan/importers/TimSoapClient.java",
"license": "agpl-3.0",
"size": 11460
}
|
[
"javax.xml.soap.SOAPConnection",
"javax.xml.soap.SOAPException",
"javax.xml.soap.SOAPMessage"
] |
import javax.xml.soap.SOAPConnection; import javax.xml.soap.SOAPException; import javax.xml.soap.SOAPMessage;
|
import javax.xml.soap.*;
|
[
"javax.xml"
] |
javax.xml;
| 2,528,804
|
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
log.info("From " + request.getRemoteHost() + " - " + request.getRemoteAddr());
doPost (request, response);
} // doGet
|
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { log.info(STR + request.getRemoteHost() + STR + request.getRemoteAddr()); doPost (request, response); }
|
/**
* Process the initial HTTP Get request.
* Reads the Parameter Amt and optional C_Invoice_ID
*
* @param request request
* @param response response
* @throws ServletException
* @throws IOException
*/
|
Process the initial HTTP Get request. Reads the Parameter Amt and optional C_Invoice_ID
|
doGet
|
{
"repo_name": "erpcya/adempierePOS",
"path": "serverApps/src/main/servlet/org/compiere/wstore/ProductServlet.java",
"license": "gpl-2.0",
"size": 4770
}
|
[
"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,551,882
|
void doFindMarkers(ArrayList<IMarker> result, String type, boolean includeSubtypes) {
// MarkerManager markerMan = ((Workspace) ResourcesPlugin.getWorkspace()).getMarkerManager();
// for (int i = 0; i < resources.length; i++)
// markerMan.doFindMarkers(resources[i], result, type, includeSubtypes, depth);
throw new UnsupportedOperationException("doFindMarkers");
}
|
void doFindMarkers(ArrayList<IMarker> result, String type, boolean includeSubtypes) { throw new UnsupportedOperationException(STR); }
|
/**
* Efficient implementation of {@link #findMarkers(String, boolean)}, not
* available to clients because underlying non-API methods are used that
* may change.
*/
|
Efficient implementation of <code>#findMarkers(String, boolean)</code>, not available to clients because underlying non-API methods are used that may change
|
doFindMarkers
|
{
"repo_name": "dhuebner/che",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-core-resources/src/main/java/org/eclipse/core/resources/mapping/ResourceTraversal.java",
"license": "epl-1.0",
"size": 6703
}
|
[
"java.util.ArrayList",
"org.eclipse.core.resources.IMarker"
] |
import java.util.ArrayList; import org.eclipse.core.resources.IMarker;
|
import java.util.*; import org.eclipse.core.resources.*;
|
[
"java.util",
"org.eclipse.core"
] |
java.util; org.eclipse.core;
| 1,703,324
|
private static void addAbstractedAttribute(String tag, double value, String unit, MetadataElement dest, String desc) {
final MetadataAttribute attribute = new MetadataAttribute(tag, ProductData.TYPE_FLOAT64, 1);
attribute.getData().setElems(new double[]{value});
attribute.setUnit(unit);
attribute.setDescription(desc);
dest.addAttribute(attribute);
}
|
static void function(String tag, double value, String unit, MetadataElement dest, String desc) { final MetadataAttribute attribute = new MetadataAttribute(tag, ProductData.TYPE_FLOAT64, 1); attribute.getData().setElems(new double[]{value}); attribute.setUnit(unit); attribute.setDescription(desc); dest.addAttribute(attribute); }
|
/**
* Adds an attribute from src to dest
*
* @param tag the name of the attribute
* @param value the double value
* @param unit the unit string
* @param dest the destination element
* @param desc the description
*/
|
Adds an attribute from src to dest
|
addAbstractedAttribute
|
{
"repo_name": "arraydev/snap-engine",
"path": "snap-envisat-reader/src/main/java/org/esa/snap/dataio/envisat/AsarAbstractMetadata.java",
"license": "gpl-3.0",
"size": 31804
}
|
[
"org.esa.snap.framework.datamodel.MetadataAttribute",
"org.esa.snap.framework.datamodel.MetadataElement",
"org.esa.snap.framework.datamodel.ProductData"
] |
import org.esa.snap.framework.datamodel.MetadataAttribute; import org.esa.snap.framework.datamodel.MetadataElement; import org.esa.snap.framework.datamodel.ProductData;
|
import org.esa.snap.framework.datamodel.*;
|
[
"org.esa.snap"
] |
org.esa.snap;
| 2,396,405
|
@SuppressWarnings("unchecked")
public HB options(Map<String, Object> options) {
this.options = options;
return (HB) this;
}
/**
* @return the value set by {@link #options(Map)}
|
@SuppressWarnings(STR) HB function(Map<String, Object> options) { this.options = options; return (HB) this; } /** * @return the value set by {@link #options(Map)}
|
/**
* Allows to set custom options for custom highlighters.
*/
|
Allows to set custom options for custom highlighters
|
options
|
{
"repo_name": "henakamaMSFT/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/fetch/subphase/highlight/AbstractHighlighterBuilder.java",
"license": "apache-2.0",
"size": 22299
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,877,573
|
public void refreshReferencingContentlets(File file, boolean live);
|
void function(File file, boolean live);
|
/**
* Refreshes (regenerates) all content files referenced by a given file asset
* @param file asset
* @param live contentlets or not
*/
|
Refreshes (regenerates) all content files referenced by a given file asset
|
refreshReferencingContentlets
|
{
"repo_name": "guhb/core",
"path": "src/com/dotmarketing/portlets/contentlet/business/ContentletAPIPostHook.java",
"license": "gpl-3.0",
"size": 52012
}
|
[
"com.dotmarketing.portlets.files.model.File"
] |
import com.dotmarketing.portlets.files.model.File;
|
import com.dotmarketing.portlets.files.model.*;
|
[
"com.dotmarketing.portlets"
] |
com.dotmarketing.portlets;
| 644,631
|
public void testMultipleInsertRetrieve0()
throws DatabaseException {
initEnv(false);
Locker txn = new BasicLocker(DbInternal.envGetEnvironmentImpl(env));
NullCursor cursor = new NullCursor(tree.getDatabase(), txn);
for (int i = 0; i < 21; i++) {
byte[] key = new byte[N_KEY_BYTES];
TestUtils.generateRandomAlphaBytes(key);
insertAndRetrieve(cursor, key, new LN((byte[]) null));
}
txn.operationEnd();
}
|
void function() throws DatabaseException { initEnv(false); Locker txn = new BasicLocker(DbInternal.envGetEnvironmentImpl(env)); NullCursor cursor = new NullCursor(tree.getDatabase(), txn); for (int i = 0; i < 21; i++) { byte[] key = new byte[N_KEY_BYTES]; TestUtils.generateRandomAlphaBytes(key); insertAndRetrieve(cursor, key, new LN((byte[]) null)); } txn.operationEnd(); }
|
/**
* Slightly less rudimentary test inserting a handfull of keys and LN's.
*/
|
Slightly less rudimentary test inserting a handfull of keys and LN's
|
testMultipleInsertRetrieve0
|
{
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/je-3.2.74/test/com/sleepycat/je/tree/TreeTest.java",
"license": "gpl-2.0",
"size": 11828
}
|
[
"com.sleepycat.je.DatabaseException",
"com.sleepycat.je.DbInternal",
"com.sleepycat.je.dbi.NullCursor",
"com.sleepycat.je.txn.BasicLocker",
"com.sleepycat.je.txn.Locker",
"com.sleepycat.je.util.TestUtils"
] |
import com.sleepycat.je.DatabaseException; import com.sleepycat.je.DbInternal; import com.sleepycat.je.dbi.NullCursor; import com.sleepycat.je.txn.BasicLocker; import com.sleepycat.je.txn.Locker; import com.sleepycat.je.util.TestUtils;
|
import com.sleepycat.je.*; import com.sleepycat.je.dbi.*; import com.sleepycat.je.txn.*; import com.sleepycat.je.util.*;
|
[
"com.sleepycat.je"
] |
com.sleepycat.je;
| 571,327
|
public void init(Properties configuration, SQLHandler sqlHandler, String dialect, List<String> schemaNames) {
this.configuration = configuration;
this.sqlHandler = sqlHandler;
this.dbSupports = getDbSupports(configuration, sqlHandler, dialect, schemaNames);
this.defaultDbSupport = getDefaultDbSupport(configuration, sqlHandler, dialect, (CollectionUtils.isEmpty(schemaNames) ? "" : schemaNames.get(0)));
this.dialect = dialect;
doInit(configuration);
}
|
void function(Properties configuration, SQLHandler sqlHandler, String dialect, List<String> schemaNames) { this.configuration = configuration; this.sqlHandler = sqlHandler; this.dbSupports = getDbSupports(configuration, sqlHandler, dialect, schemaNames); this.defaultDbSupport = getDefaultDbSupport(configuration, sqlHandler, dialect, (CollectionUtils.isEmpty(schemaNames) ? "" : schemaNames.get(0))); this.dialect = dialect; doInit(configuration); }
|
/**
* Initializes the database operation class with the given {@link Properties}, {@link DataSource}.
*
* @param configuration The configuration, not null
* @param sqlHandler The sql handler, not null
*/
|
Initializes the database operation class with the given <code>Properties</code>, <code>DataSource</code>
|
init
|
{
"repo_name": "arteam/unitils",
"path": "unitils-dbmaintainer/src/main/java/org/unitils/dbmaintainer/util/BaseDatabaseAccessor.java",
"license": "apache-2.0",
"size": 2983
}
|
[
"java.util.List",
"java.util.Properties",
"org.apache.commons.collections.CollectionUtils",
"org.unitils.core.dbsupport.DbSupportFactory",
"org.unitils.core.dbsupport.SQLHandler"
] |
import java.util.List; import java.util.Properties; import org.apache.commons.collections.CollectionUtils; import org.unitils.core.dbsupport.DbSupportFactory; import org.unitils.core.dbsupport.SQLHandler;
|
import java.util.*; import org.apache.commons.collections.*; import org.unitils.core.dbsupport.*;
|
[
"java.util",
"org.apache.commons",
"org.unitils.core"
] |
java.util; org.apache.commons; org.unitils.core;
| 2,748,831
|
public void start(Context context, android.support.v4.app.Fragment fragment) {
start(context, fragment, REQUEST_CROP);
}
|
void function(Context context, android.support.v4.app.Fragment fragment) { start(context, fragment, REQUEST_CROP); }
|
/**
* Send the crop Intent from a support library Fragment
*
* @param context Context
* @param fragment Fragment to receive result
*/
|
Send the crop Intent from a support library Fragment
|
start
|
{
"repo_name": "liuyanggithub/SuperSelector",
"path": "app/src/main/java/com/ly/selector/util/Crop.java",
"license": "mit",
"size": 7975
}
|
[
"android.app.Fragment",
"android.content.Context"
] |
import android.app.Fragment; import android.content.Context;
|
import android.app.*; import android.content.*;
|
[
"android.app",
"android.content"
] |
android.app; android.content;
| 1,451,342
|
public Properties getSubstitutableProperties() {
return substitutableProperties;
}
|
Properties function() { return substitutableProperties; }
|
/**
* Returns all substitutable properties defined on this CoreDescriptor
* @return all substitutable properties defined on this CoreDescriptor
*/
|
Returns all substitutable properties defined on this CoreDescriptor
|
getSubstitutableProperties
|
{
"repo_name": "visouza/solr-5.0.0",
"path": "solr/core/src/java/org/apache/solr/core/CoreDescriptor.java",
"license": "apache-2.0",
"size": 14566
}
|
[
"java.util.Properties"
] |
import java.util.Properties;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,305,203
|
private void applyState(CustomHashtable checked, CustomHashtable grayed,
Widget widget) {
Item[] items = getChildren(widget);
for (int i = 0; i < items.length; i++) {
Item item = items[i];
if (item instanceof TreeItem) {
Object data = item.getData();
if (data != null) {
TreeItem ti = (TreeItem) item;
ti.setChecked(checked.containsKey(data));
ti.setGrayed(grayed.containsKey(data));
}
}
applyState(checked, grayed, item);
}
}
|
void function(CustomHashtable checked, CustomHashtable grayed, Widget widget) { Item[] items = getChildren(widget); for (int i = 0; i < items.length; i++) { Item item = items[i]; if (item instanceof TreeItem) { Object data = item.getData(); if (data != null) { TreeItem ti = (TreeItem) item; ti.setChecked(checked.containsKey(data)); ti.setGrayed(grayed.containsKey(data)); } } applyState(checked, grayed, item); } }
|
/**
* Applies the checked and grayed states of the given widget and its
* descendents.
*
* @param checked a set of elements (element type: <code>Object</code>)
* @param grayed a set of elements (element type: <code>Object</code>)
* @param widget the widget
*/
|
Applies the checked and grayed states of the given widget and its descendents
|
applyState
|
{
"repo_name": "ghillairet/gef-gwt",
"path": "src/main/java/org/eclipse/jface/viewers/CheckboxTreeViewer.java",
"license": "epl-1.0",
"size": 22544
}
|
[
"org.eclipse.swt.widgets.Item",
"org.eclipse.swt.widgets.TreeItem",
"org.eclipse.swt.widgets.Widget"
] |
import org.eclipse.swt.widgets.Item; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.swt.widgets.Widget;
|
import org.eclipse.swt.widgets.*;
|
[
"org.eclipse.swt"
] |
org.eclipse.swt;
| 648,118
|
public void request(String contact, boolean batch)
throws GramException, GSSException {
Gram.request(contact, this, batch);
}
|
void function(String contact, boolean batch) throws GramException, GSSException { Gram.request(contact, this, batch); }
|
/**
* Submits a job to the specified gatekeeper either as
* an interactive or batch job. Performs limited delegation.
*
* @param contact
* the resource manager contact.
* @param batch
* specifies if the job should be submitted as
* a batch job.
* @throws GramException
* if error occurs during job submission.
* @throws GSSException
* if user credentials are invalid.
* @see #request(String) for detailed resource manager
* contact specification.
*/
|
Submits a job to the specified gatekeeper either as an interactive or batch job. Performs limited delegation
|
request
|
{
"repo_name": "dCache/jglobus-1.8",
"path": "src/org/globus/gram/GramJob.java",
"license": "apache-2.0",
"size": 10987
}
|
[
"org.ietf.jgss.GSSException"
] |
import org.ietf.jgss.GSSException;
|
import org.ietf.jgss.*;
|
[
"org.ietf.jgss"
] |
org.ietf.jgss;
| 2,013,034
|
private void setQueryFilterSingleValue(SolrQuery query, String fieldKey, String fieldValue, String fieldNegate) {
String fieldQuery;
if (StringUtils.isNotEmpty(fieldNegate) && fieldNegate.equalsIgnoreCase(
SolrConstants.NEGATE_VALUE_DEFAULT)) {
fieldQuery = fieldKey + SolrConstants.SOLR_NEGATE_VALUE + fieldKey + fieldValue;
} else {
fieldQuery = fieldKey + fieldValue;
}
query.addFilterQuery(fieldQuery);
}
|
void function(SolrQuery query, String fieldKey, String fieldValue, String fieldNegate) { String fieldQuery; if (StringUtils.isNotEmpty(fieldNegate) && fieldNegate.equalsIgnoreCase( SolrConstants.NEGATE_VALUE_DEFAULT)) { fieldQuery = fieldKey + SolrConstants.SOLR_NEGATE_VALUE + fieldKey + fieldValue; } else { fieldQuery = fieldKey + fieldValue; } query.addFilterQuery(fieldQuery); }
|
/**
* Method to add the query filter for single fields (resource author, resource last updater, resource media type)
* @param fieldValue resource value
* @param query solr query
* @param fieldNegate resource negation
*/
|
Method to add the query filter for single fields (resource author, resource last updater, resource media type)
|
setQueryFilterSingleValue
|
{
"repo_name": "arunasujith/carbon-registry",
"path": "components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java",
"license": "apache-2.0",
"size": 53679
}
|
[
"org.apache.commons.lang.StringUtils",
"org.apache.solr.client.solrj.SolrQuery",
"org.wso2.carbon.registry.indexing.SolrConstants"
] |
import org.apache.commons.lang.StringUtils; import org.apache.solr.client.solrj.SolrQuery; import org.wso2.carbon.registry.indexing.SolrConstants;
|
import org.apache.commons.lang.*; import org.apache.solr.client.solrj.*; import org.wso2.carbon.registry.indexing.*;
|
[
"org.apache.commons",
"org.apache.solr",
"org.wso2.carbon"
] |
org.apache.commons; org.apache.solr; org.wso2.carbon;
| 1,722,438
|
void onDrawerOpened(View drawerView);
|
void onDrawerOpened(View drawerView);
|
/**
* Called when a drawer has settled in a completely open state.
* The drawer is interactive at this point.
*
* @param drawerView Drawer view that is now open
*/
|
Called when a drawer has settled in a completely open state. The drawer is interactive at this point
|
onDrawerOpened
|
{
"repo_name": "JakeWharton/u2020",
"path": "app/src/internalDebug/java/com/jakewharton/u2020/ui/debug/DebugDrawerLayout.java",
"license": "apache-2.0",
"size": 65682
}
|
[
"android.view.View"
] |
import android.view.View;
|
import android.view.*;
|
[
"android.view"
] |
android.view;
| 1,652,715
|
@Test
public void whenFoundByPhoneThenFound() {
var dictionary = new PhoneDictionary();
dictionary.add(new Person("Alexey", "Tolstonogov", "Krasnoyarsk", "424242"));
dictionary.add(new Person("Nikolay", "Funtikov", "Moscow", "878787"));
dictionary.add(new Person("Evgeniy", "Esin", "Abakan", "616161"));
assertThat(dictionary.find("87").iterator().next().getSurname(), is("Funtikov"));
}
|
void function() { var dictionary = new PhoneDictionary(); dictionary.add(new Person(STR, STR, STR, STR)); dictionary.add(new Person(STR, STR, STR, STR)); dictionary.add(new Person(STR, "Esin", STR, STR)); assertThat(dictionary.find("87").iterator().next().getSurname(), is(STR)); }
|
/**
* key == "87" -> phone == "878787" -> surname == "Funtikov".
*/
|
key == "87" -> phone == "878787" -> surname == "Funtikov"
|
whenFoundByPhoneThenFound
|
{
"repo_name": "tolstinator/atolstonogov",
"path": "chapter_003/src/test/java/ru/job4j/search/PhoneDictionaryTest.java",
"license": "apache-2.0",
"size": 2901
}
|
[
"org.hamcrest.core.Is",
"org.junit.Assert"
] |
import org.hamcrest.core.Is; import org.junit.Assert;
|
import org.hamcrest.core.*; import org.junit.*;
|
[
"org.hamcrest.core",
"org.junit"
] |
org.hamcrest.core; org.junit;
| 1,810,428
|
String addCompositeApiFromDefinition(InputStream apiDefinition) throws APIManagementException;
|
String addCompositeApiFromDefinition(InputStream apiDefinition) throws APIManagementException;
|
/**
* Create Composite API from Swagger Definition
*
* @param apiDefinition Swagger content of the Composite API.
* @return Details of the added Composite API.
* @throws APIManagementException If failed to add Composite API.
*/
|
Create Composite API from Swagger Definition
|
addCompositeApiFromDefinition
|
{
"repo_name": "Minoli/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/api/APIStore.java",
"license": "apache-2.0",
"size": 24087
}
|
[
"java.io.InputStream",
"org.wso2.carbon.apimgt.core.exception.APIManagementException"
] |
import java.io.InputStream; import org.wso2.carbon.apimgt.core.exception.APIManagementException;
|
import java.io.*; import org.wso2.carbon.apimgt.core.exception.*;
|
[
"java.io",
"org.wso2.carbon"
] |
java.io; org.wso2.carbon;
| 2,660,803
|
public static Document createDom(final InputStream inputStream) {
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
org.w3c.dom.Document w3cDocument = null;
try {
final DocumentBuilder builder = factory.newDocumentBuilder();
w3cDocument = builder.parse(inputStream);
} catch (ParserConfigurationException e) {
Debug.trace(e);
} catch (SAXException e) {
Debug.trace(e);
} catch (IOException e) {
Debug.trace(e);
}
return new DOMBuilder().build(w3cDocument);
}
|
static Document function(final InputStream inputStream) { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); org.w3c.dom.Document w3cDocument = null; try { final DocumentBuilder builder = factory.newDocumentBuilder(); w3cDocument = builder.parse(inputStream); } catch (ParserConfigurationException e) { Debug.trace(e); } catch (SAXException e) { Debug.trace(e); } catch (IOException e) { Debug.trace(e); } return new DOMBuilder().build(w3cDocument); }
|
/**
* Creates a parsed {@link Document} from the given {@link InputStream inputStream}.
*
* @param inputStream the stream to be parsed
* @return a parsed inputStream
*/
|
Creates a parsed <code>Document</code> from the given <code>InputStream inputStream</code>
|
createDom
|
{
"repo_name": "lveci/nest",
"path": "beam/beam-core/src/main/java/org/esa/beam/dataio/dimap/DimapProductHelpers.java",
"license": "gpl-3.0",
"size": 94410
}
|
[
"java.io.IOException",
"java.io.InputStream",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.esa.beam.util.Debug",
"org.jdom.Document",
"org.jdom.input.DOMBuilder",
"org.xml.sax.SAXException"
] |
import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.esa.beam.util.Debug; import org.jdom.Document; import org.jdom.input.DOMBuilder; import org.xml.sax.SAXException;
|
import java.io.*; import javax.xml.parsers.*; import org.esa.beam.util.*; import org.jdom.*; import org.jdom.input.*; import org.xml.sax.*;
|
[
"java.io",
"javax.xml",
"org.esa.beam",
"org.jdom",
"org.jdom.input",
"org.xml.sax"
] |
java.io; javax.xml; org.esa.beam; org.jdom; org.jdom.input; org.xml.sax;
| 1,738,544
|
public Set<AddOn> getUninstalls() {
return uninstalls;
}
|
Set<AddOn> function() { return uninstalls; }
|
/**
* Gets the add-ons that need to be uninstalled as result of the changes.
*
* @return the the add-ons that need to be uninstalled
*/
|
Gets the add-ons that need to be uninstalled as result of the changes
|
getUninstalls
|
{
"repo_name": "JordanGS/zaproxy",
"path": "src/org/zaproxy/zap/extension/autoupdate/AddOnDependencyChecker.java",
"license": "apache-2.0",
"size": 40883
}
|
[
"java.util.Set",
"org.zaproxy.zap.control.AddOn"
] |
import java.util.Set; import org.zaproxy.zap.control.AddOn;
|
import java.util.*; import org.zaproxy.zap.control.*;
|
[
"java.util",
"org.zaproxy.zap"
] |
java.util; org.zaproxy.zap;
| 1,321,880
|
@Override
public IntHashMap clone() {
try {
IntHashMap t = (IntHashMap) super.clone();
t.table = new Entry[table.length];
for (int i = table.length; i-- > 0; ) {
t.table[i] = (table[i] != null)
? (Entry) table[i].clone() : null;
}
t.keySet = null;
t.entrySet = null;
t.values = null;
t.modCount = 0;
return t;
} catch (CloneNotSupportedException e) {
// this shouldn't happen, since we are Cloneable
throw new InternalError();
}
}
// views
private transient Set keySet;
private transient Set entrySet;
private transient Collection values;
|
IntHashMap function() { try { IntHashMap t = (IntHashMap) super.clone(); t.table = new Entry[table.length]; for (int i = table.length; i-- > 0; ) { t.table[i] = (table[i] != null) ? (Entry) table[i].clone() : null; } t.keySet = null; t.entrySet = null; t.values = null; t.modCount = 0; return t; } catch (CloneNotSupportedException e) { throw new InternalError(); } } private transient Set keySet; private transient Set entrySet; private transient Collection values;
|
/**
* Returns a shallow copy of this <code>IntHashMap</code> instance: the keys and
* values themselves are not cloned.
*
* @return a shallow copy of this map.
*/
|
Returns a shallow copy of this <code>IntHashMap</code> instance: the keys and values themselves are not cloned
|
clone
|
{
"repo_name": "wjw465150/jodd",
"path": "jodd-core/src/main/java/jodd/util/collection/IntHashMap.java",
"license": "bsd-2-clause",
"size": 20924
}
|
[
"java.util.Collection",
"java.util.Set"
] |
import java.util.Collection; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 300,754
|
private void addMetadataItems( final Map<String, MetadataItem> metadataItemMap, final EventQueryParams params,
final List<Option> itemOptions )
{
boolean includeDetails = params.isIncludeMetadataDetails();
if ( !params.isSkipData() )
{
// filtering if the rows in grid are there (skipData = false)
itemOptions.forEach( option -> metadataItemMap.put( option.getUid(),
new MetadataItem( option.getDisplayName(), includeDetails ? option.getUid() : null,
option.getCode() ) ) );
}
else
{
// filtering if the rows in grid are not there (skipData = true
// only)
// dimension=Zj7UnCAulEk.K6uUAvq500H:IN:A00;A60;A01 -> IN indicates
// there is a filter
// the stream contains all options if no filter or only options fit
// to the filter
// options can be divided by separator <<;>>
params.getItemOptions().stream()
.filter( option -> option != null &&
(params.getItems().stream().noneMatch( QueryItem::hasFilter ) ||
params.getItems().stream().filter( QueryItem::hasFilter )
.anyMatch( qi -> qi.getFilters().stream()
.anyMatch( f -> Arrays.stream( f.getFilter().split( ";" ) )
.anyMatch( ft -> ft.equalsIgnoreCase( option.getCode() ) ) ) )) )
.forEach( option -> metadataItemMap.put( option.getUid(),
new MetadataItem( option.getDisplayName(), includeDetails ? option.getUid() : null,
option.getCode() ) ) );
}
}
|
void function( final Map<String, MetadataItem> metadataItemMap, final EventQueryParams params, final List<Option> itemOptions ) { boolean includeDetails = params.isIncludeMetadataDetails(); if ( !params.isSkipData() ) { itemOptions.forEach( option -> metadataItemMap.put( option.getUid(), new MetadataItem( option.getDisplayName(), includeDetails ? option.getUid() : null, option.getCode() ) ) ); } else { params.getItemOptions().stream() .filter( option -> option != null && (params.getItems().stream().noneMatch( QueryItem::hasFilter ) params.getItems().stream().filter( QueryItem::hasFilter ) .anyMatch( qi -> qi.getFilters().stream() .anyMatch( f -> Arrays.stream( f.getFilter().split( ";" ) ) .anyMatch( ft -> ft.equalsIgnoreCase( option.getCode() ) ) ) )) ) .forEach( option -> metadataItemMap.put( option.getUid(), new MetadataItem( option.getDisplayName(), includeDetails ? option.getUid() : null, option.getCode() ) ) ); } }
|
/**
* Add into the MetadataItemMap itemOptions
*
* @param metadataItemMap MetadataItemMap.
* @param params EventQueryParams.
* @param itemOptions itemOtion list.
*/
|
Add into the MetadataItemMap itemOptions
|
addMetadataItems
|
{
"repo_name": "dhis2/dhis2-core",
"path": "dhis-2/dhis-services/dhis-service-analytics/src/main/java/org/hisp/dhis/analytics/event/data/AbstractAnalyticsService.java",
"license": "bsd-3-clause",
"size": 21883
}
|
[
"java.util.Arrays",
"java.util.List",
"java.util.Map",
"org.hisp.dhis.analytics.event.EventQueryParams",
"org.hisp.dhis.common.MetadataItem",
"org.hisp.dhis.common.QueryItem",
"org.hisp.dhis.option.Option"
] |
import java.util.Arrays; import java.util.List; import java.util.Map; import org.hisp.dhis.analytics.event.EventQueryParams; import org.hisp.dhis.common.MetadataItem; import org.hisp.dhis.common.QueryItem; import org.hisp.dhis.option.Option;
|
import java.util.*; import org.hisp.dhis.analytics.event.*; import org.hisp.dhis.common.*; import org.hisp.dhis.option.*;
|
[
"java.util",
"org.hisp.dhis"
] |
java.util; org.hisp.dhis;
| 1,265,253
|
public Deferred<Object> addPoint(final String metric,
final long timestamp,
final long value,
final Map<String, String> tags) {
final byte[] v;
if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) {
v = new byte[] { (byte) value };
} else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) {
v = Bytes.fromShort((short) value);
} else if (Integer.MIN_VALUE <= value && value <= Integer.MAX_VALUE) {
v = Bytes.fromInt((int) value);
} else {
v = Bytes.fromLong(value);
}
final short flags = (short) (v.length - 1); // Just the length.
return addPointInternal(metric, timestamp, v, tags, flags);
}
|
Deferred<Object> function(final String metric, final long timestamp, final long value, final Map<String, String> tags) { final byte[] v; if (Byte.MIN_VALUE <= value && value <= Byte.MAX_VALUE) { v = new byte[] { (byte) value }; } else if (Short.MIN_VALUE <= value && value <= Short.MAX_VALUE) { v = Bytes.fromShort((short) value); } else if (Integer.MIN_VALUE <= value && value <= Integer.MAX_VALUE) { v = Bytes.fromInt((int) value); } else { v = Bytes.fromLong(value); } final short flags = (short) (v.length - 1); return addPointInternal(metric, timestamp, v, tags, flags); }
|
/**
* Adds a single integer value data point in the TSDB.
* @param metric A non-empty string.
* @param timestamp The timestamp associated with the value.
* @param value The value of the data point.
* @param tags The tags on this series. This map must be non-empty.
* @return A deferred object that indicates the completion of the request.
* The {@link Object} has not special meaning and can be {@code null} (think
* of it as {@code Deferred<Void>}). But you probably want to attach at
* least an errback to this {@code Deferred} to handle failures.
* @throws IllegalArgumentException if the timestamp is less than or equal
* to the previous timestamp added or 0 for the first timestamp, or if the
* difference with the previous timestamp is too large.
* @throws IllegalArgumentException if the metric name is empty or contains
* illegal characters.
* @throws IllegalArgumentException if the tags list is empty or one of the
* elements contains illegal characters.
* @throws HBaseException (deferred) if there was a problem while persisting
* data.
*/
|
Adds a single integer value data point in the TSDB
|
addPoint
|
{
"repo_name": "pepperdata/opentsdb",
"path": "opentsdb-core/src/main/java/net/opentsdb/core/TSDB.java",
"license": "lgpl-2.1",
"size": 55721
}
|
[
"com.stumbleupon.async.Deferred",
"java.util.Map",
"org.hbase.async.Bytes"
] |
import com.stumbleupon.async.Deferred; import java.util.Map; import org.hbase.async.Bytes;
|
import com.stumbleupon.async.*; import java.util.*; import org.hbase.async.*;
|
[
"com.stumbleupon.async",
"java.util",
"org.hbase.async"
] |
com.stumbleupon.async; java.util; org.hbase.async;
| 1,417,245
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.