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 static List<Model> listDir2(File f, Activity caller) {
File[] files = f.listFiles();
if(files == null){
files = new File[]{};
}
List<Model> fileList = new ArrayList<Model>();
for (File file : files) {
if (!file.getName().matches(Constants.FILE_NAME_PATTERN)) {
Log.d(Constants.TAG, String.format(
"'%s' didn't match the file name pattern",
file.getName()));
continue;
}
Model mModel = new Model(file.getName());
String phoneNum = mModel.getCallName().substring(16,
mModel.getCallName().length() - 4);
mModel.setUserNameFromContact(getContactName(phoneNum, caller));
fileList.add(mModel);
}
Collections.sort(fileList);
Collections.sort(fileList, Collections.reverseOrder());
return fileList;
}
|
static List<Model> function(File f, Activity caller) { File[] files = f.listFiles(); if(files == null){ files = new File[]{}; } List<Model> fileList = new ArrayList<Model>(); for (File file : files) { if (!file.getName().matches(Constants.FILE_NAME_PATTERN)) { Log.d(Constants.TAG, String.format( STR, file.getName())); continue; } Model mModel = new Model(file.getName()); String phoneNum = mModel.getCallName().substring(16, mModel.getCallName().length() - 4); mModel.setUserNameFromContact(getContactName(phoneNum, caller)); fileList.add(mModel); } Collections.sort(fileList); Collections.sort(fileList, Collections.reverseOrder()); return fileList; }
|
/**
* Fetches list of previous recordings
*
* @param f
* @return
*/
|
Fetches list of previous recordings
|
listDir2
|
{
"repo_name": "changhongzi/AndroidCallerRecord",
"path": "app/src/main/java/org/changhongzi/androidcallerrecord/FileHelper.java",
"license": "apache-2.0",
"size": 5855
}
|
[
"android.app.Activity",
"android.util.Log",
"java.io.File",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] |
import android.app.Activity; import android.util.Log; import java.io.File; import java.util.ArrayList; import java.util.Collections; import java.util.List;
|
import android.app.*; import android.util.*; import java.io.*; import java.util.*;
|
[
"android.app",
"android.util",
"java.io",
"java.util"
] |
android.app; android.util; java.io; java.util;
| 56,700
|
public List<Typeface> getTypefaces() {
if (mTypefaces == null) {
synchronized (this) {
if (mTypefaces == null) {
loadTypefaces();
}
}
}
return mTypefaces;
}
|
List<Typeface> function() { if (mTypefaces == null) { synchronized (this) { if (mTypefaces == null) { loadTypefaces(); } } } return mTypefaces; }
|
/**
* Returns named typefaces of this font file.
*
* @return Named typefaces of this font file.
*/
|
Returns named typefaces of this font file
|
getTypefaces
|
{
"repo_name": "mta452/Tehreer-Android",
"path": "tehreer-android/src/main/java/com/mta/tehreer/font/FontFile.java",
"license": "apache-2.0",
"size": 6219
}
|
[
"com.mta.tehreer.graphics.Typeface",
"java.util.List"
] |
import com.mta.tehreer.graphics.Typeface; import java.util.List;
|
import com.mta.tehreer.graphics.*; import java.util.*;
|
[
"com.mta.tehreer",
"java.util"
] |
com.mta.tehreer; java.util;
| 164,275
|
@Test
public void testToString3() {
Assert.assertEquals("?, ?, ?, ?", new Params(3, ParameterCount.ROUNDED_BY_PWR_OF_TWO).toString());
Assert.assertEquals("?, ?, ?", new Params(3, ParameterCount.EXACT).toString());
}
|
void function() { Assert.assertEquals(STR, new Params(3, ParameterCount.ROUNDED_BY_PWR_OF_TWO).toString()); Assert.assertEquals(STR, new Params(3, ParameterCount.EXACT).toString()); }
|
/**
* Test method for {@link com.persinity.common.db.metainfo.Params#toString()} with three parameters.
*/
|
Test method for <code>com.persinity.common.db.metainfo.Params#toString()</code> with three parameters
|
testToString3
|
{
"repo_name": "Persinity/ndt-migrate",
"path": "ndt-migrate-1.0-beta/common/src/test/java/com/persinity/common/db/metainfo/ParamsTest.java",
"license": "mit",
"size": 3184
}
|
[
"com.persinity.common.db.metainfo.Params",
"org.junit.Assert"
] |
import com.persinity.common.db.metainfo.Params; import org.junit.Assert;
|
import com.persinity.common.db.metainfo.*; import org.junit.*;
|
[
"com.persinity.common",
"org.junit"
] |
com.persinity.common; org.junit;
| 1,798,529
|
public void updateIndex(RhizomeDocument doc) throws RhizomeInitializationException;
|
void function(RhizomeDocument doc) throws RhizomeInitializationException;
|
/**
* Given a document, updates the search index with this document's
* information.
*
* If the document already exists in the index, this should remove
* defunct info.
* @param doc
*/
|
Given a document, updates the search index with this document's information. If the document already exists in the index, this should remove defunct info
|
updateIndex
|
{
"repo_name": "technosophos/sinciput",
"path": "rhizome/src/com/technosophos/rhizome/repository/DocumentIndexer.java",
"license": "mit",
"size": 3385
}
|
[
"com.technosophos.rhizome.document.RhizomeDocument",
"com.technosophos.rhizome.repository.RhizomeInitializationException"
] |
import com.technosophos.rhizome.document.RhizomeDocument; import com.technosophos.rhizome.repository.RhizomeInitializationException;
|
import com.technosophos.rhizome.document.*; import com.technosophos.rhizome.repository.*;
|
[
"com.technosophos.rhizome"
] |
com.technosophos.rhizome;
| 1,338,740
|
if(documentType.equals(IDocument.WRITER)) {
return "StarWriter 4.0 Vorlage/Template";
}
else if(documentType.equals(IDocument.WEB)) {
return "StarWriter/Web 4.0 Vorlage/Template";
}
else if(documentType.equals(IDocument.CALC)) {
return "StarCalc 4.0 Vorlage/Template";
}
else if(documentType.equals(IDocument.IMPRESS)) {
return "StarImpress 4.0 Vorlage";
}
return null;
}
|
if(documentType.equals(IDocument.WRITER)) { return STR; } else if(documentType.equals(IDocument.WEB)) { return STR; } else if(documentType.equals(IDocument.CALC)) { return STR; } else if(documentType.equals(IDocument.IMPRESS)) { return STR; } return null; }
|
/**
* Returns definition of the filter. Returns null if the filter
* is not available for the submitted document type.
*
* @param documentType document type to be used
*
* @return definition of the filter or null if the filter
* is not available for the submitted document type
*
* @author Markus Krüger
* @date 13.03.2008
*/
|
Returns definition of the filter. Returns null if the filter is not available for the submitted document type
|
getFilterDefinition
|
{
"repo_name": "LibreOffice/noa-libre",
"path": "src/ag/ion/noa/filter/StarOffice40TemplateFilter.java",
"license": "lgpl-2.1",
"size": 5846
}
|
[
"ag.ion.bion.officelayer.document.IDocument"
] |
import ag.ion.bion.officelayer.document.IDocument;
|
import ag.ion.bion.officelayer.document.*;
|
[
"ag.ion.bion"
] |
ag.ion.bion;
| 99,263
|
public boolean isCellEditable(DefaultMutableTreeTableNode node, int column)
{
return node.isEditable(column);
}
|
boolean function(DefaultMutableTreeTableNode node, int column) { return node.isEditable(column); }
|
/**
* Returns <code>true</code> if the cell can be edited for this node and
* column, <code>false</code> otherwise.
*
* @param node The node of the tree.
* @param column The field to edit.
* @return See above.
*/
|
Returns <code>true</code> if the cell can be edited for this node and column, <code>false</code> otherwise
|
isCellEditable
|
{
"repo_name": "dominikl/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/treetable/model/OMETreeTableModel.java",
"license": "gpl-2.0",
"size": 3808
}
|
[
"org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode"
] |
import org.jdesktop.swingx.treetable.DefaultMutableTreeTableNode;
|
import org.jdesktop.swingx.treetable.*;
|
[
"org.jdesktop.swingx"
] |
org.jdesktop.swingx;
| 1,197,484
|
public String getCreateDocType()
{
return InstanceUtils.isValid(getCreateDocInst()) ? getCreateDocInst().getType().getLabel() : null;
}
|
String function() { return InstanceUtils.isValid(getCreateDocInst()) ? getCreateDocInst().getType().getLabel() : null; }
|
/**
* Gets the creates the doc type.
*
* @return the creates the doc type
*/
|
Gets the creates the doc type
|
getCreateDocType
|
{
"repo_name": "eFaps/eFapsApp-Sales",
"path": "src/main/efaps/ESJP/org/efaps/esjp/sales/report/PaymentReport_Base.java",
"license": "apache-2.0",
"size": 37836
}
|
[
"org.efaps.esjp.db.InstanceUtils"
] |
import org.efaps.esjp.db.InstanceUtils;
|
import org.efaps.esjp.db.*;
|
[
"org.efaps.esjp"
] |
org.efaps.esjp;
| 698,588
|
public static void writeShort(OutputStream outputStream, short value)
throws IOException {
byte[] byteArray = convertToBytes(value);
outputStream.write(byteArray);
return;
}
|
static void function(OutputStream outputStream, short value) throws IOException { byte[] byteArray = convertToBytes(value); outputStream.write(byteArray); return; }
|
/**
* Writes a short out to an OutputStream.
*
* @param outputStream
* The OutputStream the short will be written to
* @param value
* The short to write
* @throws IOException
* Thrown if there is a problem writing to the OutputStream
*/
|
Writes a short out to an OutputStream
|
writeShort
|
{
"repo_name": "PlanetWaves/clockworkengine",
"path": "branches/3.0/engine/src/core-plugins/com/clockwork/export/binary/ByteUtils.java",
"license": "apache-2.0",
"size": 13820
}
|
[
"java.io.IOException",
"java.io.OutputStream"
] |
import java.io.IOException; import java.io.OutputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,354,821
|
public void sortInputsByDeps(Compiler compiler) {
// Set the compiler, so that we can parse requires/provides and report
// errors properly.
for (CompilerInput input : inputs) {
input.setCompiler(compiler);
}
// Sort the JSModule in this order.
try {
List<CompilerInput> sortedList =
(new SortedDependencies<>(
Collections.unmodifiableList(inputs)))
.getSortedList();
inputs.clear();
inputs.addAll(sortedList);
} catch (CircularDependencyException e) {
compiler.report(
JSError.make(CIRCULAR_DEPENDENCY_ERROR, e.getMessage()));
}
}
|
void function(Compiler compiler) { for (CompilerInput input : inputs) { input.setCompiler(compiler); } try { List<CompilerInput> sortedList = (new SortedDependencies<>( Collections.unmodifiableList(inputs))) .getSortedList(); inputs.clear(); inputs.addAll(sortedList); } catch (CircularDependencyException e) { compiler.report( JSError.make(CIRCULAR_DEPENDENCY_ERROR, e.getMessage())); } }
|
/**
* Puts the JS files into a topologically sorted order by their dependencies.
*/
|
Puts the JS files into a topologically sorted order by their dependencies
|
sortInputsByDeps
|
{
"repo_name": "nicks/closure-compiler-old",
"path": "src/com/google/javascript/jscomp/JSModule.java",
"license": "apache-2.0",
"size": 8434
}
|
[
"com.google.javascript.jscomp.deps.SortedDependencies",
"java.util.Collections",
"java.util.List"
] |
import com.google.javascript.jscomp.deps.SortedDependencies; import java.util.Collections; import java.util.List;
|
import com.google.javascript.jscomp.deps.*; import java.util.*;
|
[
"com.google.javascript",
"java.util"
] |
com.google.javascript; java.util;
| 403,640
|
public static LocalDateTime localDateTimeOf(final Date time) {
return localDateTimeOf(time.getTime());
}
|
static LocalDateTime function(final Date time) { return localDateTimeOf(time.getTime()); }
|
/**
* Local date time of local date time.
*
* @param time the time
* @return the local date time
*/
|
Local date time of local date time
|
localDateTimeOf
|
{
"repo_name": "philliprower/cas",
"path": "core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java",
"license": "apache-2.0",
"size": 9966
}
|
[
"java.time.LocalDateTime",
"java.util.Date"
] |
import java.time.LocalDateTime; import java.util.Date;
|
import java.time.*; import java.util.*;
|
[
"java.time",
"java.util"
] |
java.time; java.util;
| 2,152,911
|
public static String localeToString(Locale locale) {
if (locale == null) {
throw new NullPointerException("Locale cannot be null.");
}
String language = locale.getLanguage();
String country = locale.getCountry();
if (StringUtils.isEmpty(language)) {
throw new IllegalArgumentException("Given locale '" + locale.getDisplayName() + "' does not have language specified. Unexpected error.");
}
return language
+ (!StringUtils.isEmpty(country) ? ("." + country) : "");
}
/**
* Replacement for {@link Calendar#getInstance(java.util.TimeZone, Locale)},
* uses the locale and time zone defined in
* {@link Defaults} or {@link GraphRuntimeContext}
|
static String function(Locale locale) { if (locale == null) { throw new NullPointerException(STR); } String language = locale.getLanguage(); String country = locale.getCountry(); if (StringUtils.isEmpty(language)) { throw new IllegalArgumentException(STR + locale.getDisplayName() + STR); } return language + (!StringUtils.isEmpty(country) ? ("." + country) : ""); } /** * Replacement for {@link Calendar#getInstance(java.util.TimeZone, Locale)}, * uses the locale and time zone defined in * {@link Defaults} or {@link GraphRuntimeContext}
|
/**
* Converts given locale to clover standard format. This is symmetric method to {@link #createLocale(String)}.
* @param locale
* @return
*/
|
Converts given locale to clover standard format. This is symmetric method to <code>#createLocale(String)</code>
|
localeToString
|
{
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.engine/src/org/jetel/util/MiscUtils.java",
"license": "lgpl-2.1",
"size": 10585
}
|
[
"java.util.Calendar",
"java.util.Locale",
"org.jetel.data.Defaults",
"org.jetel.graph.runtime.GraphRuntimeContext",
"org.jetel.util.string.StringUtils"
] |
import java.util.Calendar; import java.util.Locale; import org.jetel.data.Defaults; import org.jetel.graph.runtime.GraphRuntimeContext; import org.jetel.util.string.StringUtils;
|
import java.util.*; import org.jetel.data.*; import org.jetel.graph.runtime.*; import org.jetel.util.string.*;
|
[
"java.util",
"org.jetel.data",
"org.jetel.graph",
"org.jetel.util"
] |
java.util; org.jetel.data; org.jetel.graph; org.jetel.util;
| 2,568,515
|
public void testGetFirstLegalEntityNoDocuments() {
final LegalEntitySearchResult result = new LegalEntitySearchResult();
assertNull(result.getFirstLegalEntity());
}
|
void function() { final LegalEntitySearchResult result = new LegalEntitySearchResult(); assertNull(result.getFirstLegalEntity()); }
|
/**
* Tests getting the first entity.
*/
|
Tests getting the first entity
|
testGetFirstLegalEntityNoDocuments
|
{
"repo_name": "McLeodMoores/starling",
"path": "projects/master/src/test/java/com/opengamma/master/legalentity/LegalEntitySearchResultTest.java",
"license": "apache-2.0",
"size": 7388
}
|
[
"org.testng.Assert"
] |
import org.testng.Assert;
|
import org.testng.*;
|
[
"org.testng"
] |
org.testng;
| 1,669,167
|
private void validateNoCollapse(Node n, JSDocInfo info) {
if (n.isFromExterns()) {
if (info != null && info.isNoCollapse()) {
// @nocollapse has no effect in externs
reportMisplaced(n, "nocollapse", "This JSDoc has no effect in externs.");
}
return;
}
if (!NodeUtil.isPrototypePropertyDeclaration(n.getParent())) {
return;
}
JSDocInfo jsdoc = n.getJSDocInfo();
if (jsdoc != null && jsdoc.isNoCollapse()) {
reportMisplaced(n, "nocollapse", "This JSDoc has no effect on prototype properties.");
}
}
|
void function(Node n, JSDocInfo info) { if (n.isFromExterns()) { if (info != null && info.isNoCollapse()) { reportMisplaced(n, STR, STR); } return; } if (!NodeUtil.isPrototypePropertyDeclaration(n.getParent())) { return; } JSDocInfo jsdoc = n.getJSDocInfo(); if (jsdoc != null && jsdoc.isNoCollapse()) { reportMisplaced(n, STR, STR); } }
|
/**
* Warns when nocollapse annotations are present on nodes
* which are not eligible for property collapsing.
*/
|
Warns when nocollapse annotations are present on nodes which are not eligible for property collapsing
|
validateNoCollapse
|
{
"repo_name": "Medium/closure-compiler",
"path": "src/com/google/javascript/jscomp/CheckJSDoc.java",
"license": "apache-2.0",
"size": 14380
}
|
[
"com.google.javascript.rhino.JSDocInfo",
"com.google.javascript.rhino.Node"
] |
import com.google.javascript.rhino.JSDocInfo; import com.google.javascript.rhino.Node;
|
import com.google.javascript.rhino.*;
|
[
"com.google.javascript"
] |
com.google.javascript;
| 2,269,381
|
public void endStep(Phase phase, Step step) {
if (!isComplete(phase)) {
lazyInitStep(phase, step).endTime = monotonicNow();
}
}
|
void function(Phase phase, Step step) { if (!isComplete(phase)) { lazyInitStep(phase, step).endTime = monotonicNow(); } }
|
/**
* Ends execution of the specified step within the specified phase. This is
* a no-op if the phase is already completed.
*
* @param phase Phase within which the step should be ended
* @param step Step to end
*/
|
Ends execution of the specified step within the specified phase. This is a no-op if the phase is already completed
|
endStep
|
{
"repo_name": "apurtell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/startupprogress/StartupProgress.java",
"license": "apache-2.0",
"size": 9122
}
|
[
"org.apache.hadoop.util.Time"
] |
import org.apache.hadoop.util.Time;
|
import org.apache.hadoop.util.*;
|
[
"org.apache.hadoop"
] |
org.apache.hadoop;
| 644,009
|
public static boolean validate256( String submittedOTP, byte[] secret, int numDigits ) throws GeneralSecurityException
{
TimeZone utc = TimeZone.getTimeZone( "UTC" );
Calendar currentDateTime = Calendar.getInstance( utc );
String generatedTOTP = TimeBasedOTP.generateTOTP256( new String( secret ) , numDigits );
boolean result = generatedTOTP.equals( submittedOTP );
if( !result )
{
//Step back time interval
long timeInMilis = currentDateTime.getTimeInMillis();
timeInMilis -= TIME_INTERVAL;
generatedTOTP = TimeBasedOTP.generateTOTP256( new String( secret ) , "" + timeInMilis, numDigits );
result = generatedTOTP.equals( submittedOTP );
}
if( !result )
{
//Step ahead time interval
long timeInMilis = currentDateTime.getTimeInMillis();
timeInMilis += TIME_INTERVAL;
generatedTOTP = TimeBasedOTP.generateTOTP256( new String( secret ) , "" + timeInMilis, numDigits );
result = generatedTOTP.equals( submittedOTP );
}
return result;
}
|
static boolean function( String submittedOTP, byte[] secret, int numDigits ) throws GeneralSecurityException { TimeZone utc = TimeZone.getTimeZone( "UTC" ); Calendar currentDateTime = Calendar.getInstance( utc ); String generatedTOTP = TimeBasedOTP.generateTOTP256( new String( secret ) , numDigits ); boolean result = generatedTOTP.equals( submittedOTP ); if( !result ) { long timeInMilis = currentDateTime.getTimeInMillis(); timeInMilis -= TIME_INTERVAL; generatedTOTP = TimeBasedOTP.generateTOTP256( new String( secret ) , STR" + timeInMilis, numDigits ); result = generatedTOTP.equals( submittedOTP ); } return result; }
|
/**
* Validate a submitted OTP string using HMAC_256
* @param submittedOTP OTP string to validate
* @param secret Shared secret
* @return
* @throws GeneralSecurityException
*/
|
Validate a submitted OTP string using HMAC_256
|
validate256
|
{
"repo_name": "picketbox/picketbox",
"path": "security-spi/spi/src/main/java/org/jboss/security/otp/TimeBasedOTPUtil.java",
"license": "lgpl-2.1",
"size": 5197
}
|
[
"java.security.GeneralSecurityException",
"java.util.Calendar",
"java.util.TimeZone"
] |
import java.security.GeneralSecurityException; import java.util.Calendar; import java.util.TimeZone;
|
import java.security.*; import java.util.*;
|
[
"java.security",
"java.util"
] |
java.security; java.util;
| 1,821,110
|
public final T read(Path file) throws IOException {
try (Directory dir = newDirectory(file.getParent())) {
try (final IndexInput indexInput = dir.openInput(file.getFileName().toString(), IOContext.DEFAULT)) {
// We checksum the entire file before we even go and parse it. If it's corrupted we barf right here.
CodecUtil.checksumEntireFile(indexInput);
CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, STATE_FILE_VERSION, STATE_FILE_VERSION);
final XContentType xContentType = XContentType.values()[indexInput.readInt()];
indexInput.readLong(); // version currently unused
long filePointer = indexInput.getFilePointer();
long contentSize = indexInput.length() - CodecUtil.footerLength() - filePointer;
try (IndexInput slice = indexInput.slice("state_xcontent", filePointer, contentSize)) {
try (XContentParser parser = XContentFactory.xContent(xContentType).createParser(new InputStreamIndexInput(slice, contentSize))) {
return fromXContent(parser);
}
}
} catch(CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException ex) {
// we trick this into a dedicated exception with the original stacktrace
throw new CorruptStateException(ex);
}
}
}
|
final T function(Path file) throws IOException { try (Directory dir = newDirectory(file.getParent())) { try (final IndexInput indexInput = dir.openInput(file.getFileName().toString(), IOContext.DEFAULT)) { CodecUtil.checksumEntireFile(indexInput); CodecUtil.checkHeader(indexInput, STATE_FILE_CODEC, STATE_FILE_VERSION, STATE_FILE_VERSION); final XContentType xContentType = XContentType.values()[indexInput.readInt()]; indexInput.readLong(); long filePointer = indexInput.getFilePointer(); long contentSize = indexInput.length() - CodecUtil.footerLength() - filePointer; try (IndexInput slice = indexInput.slice(STR, filePointer, contentSize)) { try (XContentParser parser = XContentFactory.xContent(xContentType).createParser(new InputStreamIndexInput(slice, contentSize))) { return fromXContent(parser); } } } catch(CorruptIndexException IndexFormatTooOldException IndexFormatTooNewException ex) { throw new CorruptStateException(ex); } } }
|
/**
* Reads the state from a given file and compares the expected version against the actual version of
* the state.
*/
|
Reads the state from a given file and compares the expected version against the actual version of the state
|
read
|
{
"repo_name": "ESamir/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/gateway/MetaDataStateFormat.java",
"license": "apache-2.0",
"size": 18309
}
|
[
"java.io.IOException",
"java.nio.file.Path",
"org.apache.lucene.codecs.CodecUtil",
"org.apache.lucene.index.CorruptIndexException",
"org.apache.lucene.index.IndexFormatTooNewException",
"org.apache.lucene.index.IndexFormatTooOldException",
"org.apache.lucene.store.Directory",
"org.apache.lucene.store.IOContext",
"org.apache.lucene.store.IndexInput",
"org.elasticsearch.common.lucene.store.InputStreamIndexInput",
"org.elasticsearch.common.xcontent.XContentFactory",
"org.elasticsearch.common.xcontent.XContentParser",
"org.elasticsearch.common.xcontent.XContentType"
] |
import java.io.IOException; import java.nio.file.Path; import org.apache.lucene.codecs.CodecUtil; import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.IndexFormatTooNewException; import org.apache.lucene.index.IndexFormatTooOldException; import org.apache.lucene.store.Directory; import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IndexInput; import org.elasticsearch.common.lucene.store.InputStreamIndexInput; import org.elasticsearch.common.xcontent.XContentFactory; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType;
|
import java.io.*; import java.nio.file.*; import org.apache.lucene.codecs.*; import org.apache.lucene.index.*; import org.apache.lucene.store.*; import org.elasticsearch.common.lucene.store.*; import org.elasticsearch.common.xcontent.*;
|
[
"java.io",
"java.nio",
"org.apache.lucene",
"org.elasticsearch.common"
] |
java.io; java.nio; org.apache.lucene; org.elasticsearch.common;
| 292,001
|
public static Map<String, Object> parseMapping(NamedXContentRegistry xContentRegistry, String mappingSource) throws Exception {
try (XContentParser parser = XContentType.JSON.xContent()
.createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, mappingSource)) {
return parser.map();
}
}
|
static Map<String, Object> function(NamedXContentRegistry xContentRegistry, String mappingSource) throws Exception { try (XContentParser parser = XContentType.JSON.xContent() .createParser(xContentRegistry, LoggingDeprecationHandler.INSTANCE, mappingSource)) { return parser.map(); } }
|
/**
* Parses the mappings (formatted as JSON) into a map
*/
|
Parses the mappings (formatted as JSON) into a map
|
parseMapping
|
{
"repo_name": "s1monw/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/mapper/MapperService.java",
"license": "apache-2.0",
"size": 41028
}
|
[
"java.util.Map",
"org.elasticsearch.common.xcontent.LoggingDeprecationHandler",
"org.elasticsearch.common.xcontent.NamedXContentRegistry",
"org.elasticsearch.common.xcontent.XContentParser",
"org.elasticsearch.common.xcontent.XContentType"
] |
import java.util.Map; import org.elasticsearch.common.xcontent.LoggingDeprecationHandler; import org.elasticsearch.common.xcontent.NamedXContentRegistry; import org.elasticsearch.common.xcontent.XContentParser; import org.elasticsearch.common.xcontent.XContentType;
|
import java.util.*; import org.elasticsearch.common.xcontent.*;
|
[
"java.util",
"org.elasticsearch.common"
] |
java.util; org.elasticsearch.common;
| 191,486
|
public ServiceFuture<ExpressRouteCircuitInner> updateTagsAsync(String resourceGroupName, String circuitName, final ServiceCallback<ExpressRouteCircuitInner> serviceCallback) {
return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, circuitName), serviceCallback);
}
|
ServiceFuture<ExpressRouteCircuitInner> function(String resourceGroupName, String circuitName, final ServiceCallback<ExpressRouteCircuitInner> serviceCallback) { return ServiceFuture.fromResponse(updateTagsWithServiceResponseAsync(resourceGroupName, circuitName), serviceCallback); }
|
/**
* Updates an express route circuit tags.
*
* @param resourceGroupName The name of the resource group.
* @param circuitName The name of the circuit.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/
|
Updates an express route circuit tags
|
updateTagsAsync
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/ExpressRouteCircuitsInner.java",
"license": "mit",
"size": 117005
}
|
[
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] |
import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture;
|
import com.microsoft.rest.*;
|
[
"com.microsoft.rest"
] |
com.microsoft.rest;
| 1,431,395
|
public void showErrors(final Set<String> messages) {
final InputElement inputElement = this.getInputElement();
if (messages.isEmpty()) {
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(StringUtils.EMPTY);
}
if (this.validationMessageElement == null) {
inputElement.setTitle(StringUtils.EMPTY);
} else {
this.validationMessageElement.getElement().removeAllChildren();
}
} else {
final String messagesAsString = ErrorMessageFormater.messagesToString(messages);
if (FeatureCheck.supportCustomValidity(inputElement)) {
inputElement.setCustomValidity(messagesAsString);
}
if (this.validationMessageElement == null) {
inputElement.setTitle(messagesAsString);
} else {
this.validationMessageElement.getElement()
.setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages));
}
}
}
|
void function(final Set<String> messages) { final InputElement inputElement = this.getInputElement(); if (messages.isEmpty()) { if (FeatureCheck.supportCustomValidity(inputElement)) { inputElement.setCustomValidity(StringUtils.EMPTY); } if (this.validationMessageElement == null) { inputElement.setTitle(StringUtils.EMPTY); } else { this.validationMessageElement.getElement().removeAllChildren(); } } else { final String messagesAsString = ErrorMessageFormater.messagesToString(messages); if (FeatureCheck.supportCustomValidity(inputElement)) { inputElement.setCustomValidity(messagesAsString); } if (this.validationMessageElement == null) { inputElement.setTitle(messagesAsString); } else { this.validationMessageElement.getElement() .setInnerSafeHtml(ErrorMessageFormater.messagesToList(messages)); } } }
|
/**
* show error messages.
*
* @param messages set of messages
*/
|
show error messages
|
showErrors
|
{
"repo_name": "ManfredTremmel/gwt-bean-validators",
"path": "gwt-mt-widgets/src/main/java/de/knightsoftnet/mtwidgets/client/ui/widget/ValueBoxBaseWithEditorErrors.java",
"license": "apache-2.0",
"size": 6364
}
|
[
"de.knightsoftnet.mtwidgets.client.ui.widget.helper.ErrorMessageFormater",
"de.knightsoftnet.mtwidgets.client.ui.widget.helper.FeatureCheck",
"java.util.Set",
"org.apache.commons.lang3.StringUtils"
] |
import de.knightsoftnet.mtwidgets.client.ui.widget.helper.ErrorMessageFormater; import de.knightsoftnet.mtwidgets.client.ui.widget.helper.FeatureCheck; import java.util.Set; import org.apache.commons.lang3.StringUtils;
|
import de.knightsoftnet.mtwidgets.client.ui.widget.helper.*; import java.util.*; import org.apache.commons.lang3.*;
|
[
"de.knightsoftnet.mtwidgets",
"java.util",
"org.apache.commons"
] |
de.knightsoftnet.mtwidgets; java.util; org.apache.commons;
| 1,505,608
|
public DocumentFeatureGenerator createFeatureGenerators() {
if (this.featureGeneratorBytes == null && this.artifactProvider != null) {
this.featureGeneratorBytes = (byte[]) this.artifactProvider
.getArtifact(DocumentClassifierModel.GENERATOR_DESCRIPTOR_ENTRY_NAME);
}
if (this.featureGeneratorBytes == null) {
System.err.println(
"WARNING: loading the default feature generator descriptor!!");
this.featureGeneratorBytes = loadDefaultFeatureGeneratorBytes();
}
final InputStream descriptorIn = new ByteArrayInputStream(
this.featureGeneratorBytes);
DocumentFeatureGenerator generator = null;
try {
generator = DocumentGeneratorFactory.create(descriptorIn,
new FeatureGeneratorResourceProvider() {
|
DocumentFeatureGenerator function() { if (this.featureGeneratorBytes == null && this.artifactProvider != null) { this.featureGeneratorBytes = (byte[]) this.artifactProvider .getArtifact(DocumentClassifierModel.GENERATOR_DESCRIPTOR_ENTRY_NAME); } if (this.featureGeneratorBytes == null) { System.err.println( STR); this.featureGeneratorBytes = loadDefaultFeatureGeneratorBytes(); } final InputStream descriptorIn = new ByteArrayInputStream( this.featureGeneratorBytes); DocumentFeatureGenerator generator = null; try { generator = DocumentGeneratorFactory.create(descriptorIn, new FeatureGeneratorResourceProvider() {
|
/**
* Creates the {@link DocumentFeatureGenerator}. Usually this is a set of
* generators contained in the {@link DocumentFeatureAggregator}.
*
* Note: The generators are created on every call to this method.
*
* @return the feature generator or null if there is no descriptor in the
* model
*/
|
Creates the <code>DocumentFeatureGenerator</code>. Usually this is a set of generators contained in the <code>DocumentFeatureAggregator</code>. Note: The generators are created on every call to this method
|
createFeatureGenerators
|
{
"repo_name": "ixa-ehu/ixa-pipe-ml",
"path": "src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierFactory.java",
"license": "apache-2.0",
"size": 6008
}
|
[
"eus.ixa.ixa.pipe.ml.document.features.DocumentFeatureGenerator",
"eus.ixa.ixa.pipe.ml.document.features.DocumentGeneratorFactory",
"java.io.ByteArrayInputStream",
"java.io.InputStream"
] |
import eus.ixa.ixa.pipe.ml.document.features.DocumentFeatureGenerator; import eus.ixa.ixa.pipe.ml.document.features.DocumentGeneratorFactory; import java.io.ByteArrayInputStream; import java.io.InputStream;
|
import eus.ixa.ixa.pipe.ml.document.features.*; import java.io.*;
|
[
"eus.ixa.ixa",
"java.io"
] |
eus.ixa.ixa; java.io;
| 230,281
|
public void testInvalidKeySpecException01() {
InvalidKeySpecException tE = new InvalidKeySpecException();
assertNull("getMessage() must return null.", tE.getMessage());
assertNull("getCause() must return null", tE.getCause());
}
|
void function() { InvalidKeySpecException tE = new InvalidKeySpecException(); assertNull(STR, tE.getMessage()); assertNull(STR, tE.getCause()); }
|
/**
* Test for <code>InvalidKeySpecException()</code> constructor Assertion:
* constructs InvalidKeySpecException with no detail message
*/
|
Test for <code>InvalidKeySpecException()</code> constructor Assertion: constructs InvalidKeySpecException with no detail message
|
testInvalidKeySpecException01
|
{
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/java6/modules/security/src/test/api/java/org/apache/harmony/security/tests/java/security/spec/InvalidKeySpecExceptionTest.java",
"license": "apache-2.0",
"size": 7435
}
|
[
"java.security.spec.InvalidKeySpecException"
] |
import java.security.spec.InvalidKeySpecException;
|
import java.security.spec.*;
|
[
"java.security"
] |
java.security;
| 2,165,764
|
public ServiceResponse<Map<String, Integer>> getIntInvalidString() throws ErrorException, IOException {
Call<ResponseBody> call = service.getIntInvalidString();
return getIntInvalidStringDelegate(call.execute());
}
|
ServiceResponse<Map<String, Integer>> function() throws ErrorException, IOException { Call<ResponseBody> call = service.getIntInvalidString(); return getIntInvalidStringDelegate(call.execute()); }
|
/**
* Get integer dictionary value {"0": 1, "1": "integer", "2": 0}.
*
* @throws ErrorException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the Map<String, Integer> object wrapped in {@link ServiceResponse} if successful.
*/
|
Get integer dictionary value {"0": 1, "1": "integer", "2": 0}
|
getIntInvalidString
|
{
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Java.Tests/src/main/java/fixtures/bodydictionary/DictionaryOperationsImpl.java",
"license": "mit",
"size": 167988
}
|
[
"com.microsoft.rest.ServiceResponse",
"java.io.IOException",
"java.util.Map"
] |
import com.microsoft.rest.ServiceResponse; import java.io.IOException; import java.util.Map;
|
import com.microsoft.rest.*; import java.io.*; import java.util.*;
|
[
"com.microsoft.rest",
"java.io",
"java.util"
] |
com.microsoft.rest; java.io; java.util;
| 2,032,312
|
@SuppressWarnings("unchecked")
private static Object prepend(final Object list, final Object value) {
if (list == null) {
return newArrayList(value);
}
checkArgument(list instanceof List<?>, "Cannot prepend to non-list attribute");
((List<Object>) list).add(0, value);
return list;
}
|
@SuppressWarnings(STR) static Object function(final Object list, final Object value) { if (list == null) { return newArrayList(value); } checkArgument(list instanceof List<?>, STR); ((List<Object>) list).add(0, value); return list; }
|
/**
* Attempts to prepend a value to an attribute list.
*
* @throws IllegalArgumentException if the attribute is not a list
*/
|
Attempts to prepend a value to an attribute list
|
prepend
|
{
"repo_name": "sonatype/nexus-public",
"path": "components/nexus-repository-content/src/main/java/org/sonatype/nexus/repository/content/AttributesHelper.java",
"license": "epl-1.0",
"size": 5263
}
|
[
"com.google.common.base.Preconditions",
"com.google.common.collect.Lists",
"java.util.List"
] |
import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import java.util.List;
|
import com.google.common.base.*; import com.google.common.collect.*; import java.util.*;
|
[
"com.google.common",
"java.util"
] |
com.google.common; java.util;
| 2,421,055
|
private Integer listCorruptFileBlocks(String dir, int limit, String baseUrl)
throws IOException {
int errCode = -1;
int numCorrupt = 0;
int cookie = 0;
String lastBlock = null;
final String noCorruptLine = "has no CORRUPT files";
final String noMoreCorruptLine = "has no more CORRUPT files";
final String cookiePrefix = "Cookie:";
boolean allDone = false;
while (!allDone) {
final StringBuffer url = new StringBuffer(baseUrl);
if (cookie > 0) {
url.append("&startblockafterIndex=").append(String.valueOf(cookie));
} else if (lastBlock != null) { // for backwards compatibility purpose
url.append("&startblockafter=").append(lastBlock);
}
URL path = new URL(url.toString());
// SecurityUtil.fetchServiceTicket(path);
URLConnection connection = path.openConnection();
InputStream stream = connection.getInputStream();
BufferedReader input = new BufferedReader(new InputStreamReader(stream,
"UTF-8"));
try {
String line = null;
while ((line = input.readLine()) != null) {
if (line.startsWith(cookiePrefix)){
try{
cookie = Integer.parseInt(line.split("\t")[1]);
} catch (Exception e){
allDone = true;
break;
}
continue;
}
if ((line.endsWith(noCorruptLine)) ||
(line.endsWith(noMoreCorruptLine)) ||
(line.endsWith(NamenodeFsck.NONEXISTENT_STATUS)) ||
numCorrupt >= limit) {
allDone = true;
break;
}
if ((line.isEmpty())
|| (line.startsWith("FSCK started by"))
|| (line.startsWith("The filesystem under path")))
continue;
numCorrupt++;
if (numCorrupt == 1) {
out.println("The list of corrupt files under path '"
+ dir + "' are:");
}
out.println(line);
try {
// Get the block # that we need to send in next call
lastBlock = line.split("\t")[0];
} catch (Exception e) {
allDone = true;
break;
}
}
} finally {
input.close();
}
}
out.println("The filesystem under path '" + dir + "' has "
+ numCorrupt + " CORRUPT files");
if (numCorrupt == 0)
errCode = 0;
return errCode;
}
|
Integer function(String dir, int limit, String baseUrl) throws IOException { int errCode = -1; int numCorrupt = 0; int cookie = 0; String lastBlock = null; final String noCorruptLine = STR; final String noMoreCorruptLine = STR; final String cookiePrefix = STR; boolean allDone = false; while (!allDone) { final StringBuffer url = new StringBuffer(baseUrl); if (cookie > 0) { url.append(STR).append(String.valueOf(cookie)); } else if (lastBlock != null) { url.append(STR).append(lastBlock); } URL path = new URL(url.toString()); URLConnection connection = path.openConnection(); InputStream stream = connection.getInputStream(); BufferedReader input = new BufferedReader(new InputStreamReader(stream, "UTF-8")); try { String line = null; while ((line = input.readLine()) != null) { if (line.startsWith(cookiePrefix)){ try{ cookie = Integer.parseInt(line.split("\t")[1]); } catch (Exception e){ allDone = true; break; } continue; } if ((line.endsWith(noCorruptLine)) (line.endsWith(noMoreCorruptLine)) (line.endsWith(NamenodeFsck.NONEXISTENT_STATUS)) numCorrupt >= limit) { allDone = true; break; } if ((line.isEmpty()) (line.startsWith(STR)) (line.startsWith(STR))) continue; numCorrupt++; if (numCorrupt == 1) { out.println(STR + dir + STR); } out.println(line); try { lastBlock = line.split("\t")[0]; } catch (Exception e) { allDone = true; break; } } } finally { input.close(); } } out.println(STR + dir + STR + numCorrupt + STR); if (numCorrupt == 0) errCode = 0; return errCode; }
|
/**
* To get the list, we need to call iteratively until the server says
* there is no more left.
*/
|
To get the list, we need to call iteratively until the server says there is no more left
|
listCorruptFileBlocks
|
{
"repo_name": "rvadali/fb-raid-refactoring",
"path": "src/hdfs/org/apache/hadoop/hdfs/tools/DFSck.java",
"license": "apache-2.0",
"size": 10617
}
|
[
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.net.URLConnection",
"org.apache.hadoop.hdfs.server.namenode.NamenodeFsck"
] |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.URLConnection; import org.apache.hadoop.hdfs.server.namenode.NamenodeFsck;
|
import java.io.*; import java.net.*; import org.apache.hadoop.hdfs.server.namenode.*;
|
[
"java.io",
"java.net",
"org.apache.hadoop"
] |
java.io; java.net; org.apache.hadoop;
| 1,680,186
|
private void initMisc() {
// labeled border of the section
miscGroup = new Group(this, SWT.SHADOW_IN);
miscGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, ARC4Con.H_SPAN_RIGHT, 1));
miscGroup.setText(Messages.CompositeSettingsText);
miscGroup.setToolTipText(Messages.CompositeSettingsTool);
miscGroup.setLayout(new GridLayout(2, true));
|
void function() { miscGroup = new Group(this, SWT.SHADOW_IN); miscGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, ARC4Con.H_SPAN_RIGHT, 1)); miscGroup.setText(Messages.CompositeSettingsText); miscGroup.setToolTipText(Messages.CompositeSettingsTool); miscGroup.setLayout(new GridLayout(2, true));
|
/**
* Initialize the section that allows you to make misc settings to the plug-in
*/
|
Initialize the section that allows you to make misc settings to the plug-in
|
initMisc
|
{
"repo_name": "kevinott/crypto",
"path": "org.jcryptool.visual.arc4/src/org/jcryptool/visual/arc4/ui/ARC4Composite.java",
"license": "epl-1.0",
"size": 16562
}
|
[
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Group",
"org.jcryptool.visual.arc4.ARC4Con",
"org.jcryptool.visual.arc4.Messages"
] |
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Group; import org.jcryptool.visual.arc4.ARC4Con; import org.jcryptool.visual.arc4.Messages;
|
import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.jcryptool.visual.arc4.*;
|
[
"org.eclipse.swt",
"org.jcryptool.visual"
] |
org.eclipse.swt; org.jcryptool.visual;
| 231,038
|
Double getServiceMessageFrequency() throws IOException;
|
Double getServiceMessageFrequency() throws IOException;
|
/**
* Returns the number of service message invocations per minute.
*
* @return The number of service message invocations per minute.
* @throws IOException Throws IOException.
*/
|
Returns the number of service message invocations per minute
|
getServiceMessageFrequency
|
{
"repo_name": "apache/flex-blazeds",
"path": "core/src/main/java/flex/management/runtime/messaging/endpoints/EndpointControlMBean.java",
"license": "apache-2.0",
"size": 3779
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,013,599
|
public static final MemberAccessModifier convertToMemberAccessModifier(Collection<? extends N4Modifier> modifiers,
List<Annotation> annotations) {
if (modifiers.contains(N4Modifier.PRIVATE)) {
return MemberAccessModifier.PRIVATE;
} else if (modifiers.contains(N4Modifier.PROJECT)) {
return MemberAccessModifier.PROJECT;
} else if (modifiers.contains(N4Modifier.PROTECTED)) {
return annotations.stream().anyMatch(a -> ANN_INTERNAL.equals(a.getName()))
? MemberAccessModifier.PROTECTED_INTERNAL
: MemberAccessModifier.PROTECTED;
} else if (modifiers.contains(N4Modifier.PUBLIC)) {
return annotations.stream().anyMatch(a -> ANN_INTERNAL.equals(a.getName()))
? MemberAccessModifier.PUBLIC_INTERNAL
: MemberAccessModifier.PUBLIC;
} else {
return MemberAccessModifier.UNDEFINED;
}
}
|
static final MemberAccessModifier function(Collection<? extends N4Modifier> modifiers, List<Annotation> annotations) { if (modifiers.contains(N4Modifier.PRIVATE)) { return MemberAccessModifier.PRIVATE; } else if (modifiers.contains(N4Modifier.PROJECT)) { return MemberAccessModifier.PROJECT; } else if (modifiers.contains(N4Modifier.PROTECTED)) { return annotations.stream().anyMatch(a -> ANN_INTERNAL.equals(a.getName())) ? MemberAccessModifier.PROTECTED_INTERNAL : MemberAccessModifier.PROTECTED; } else if (modifiers.contains(N4Modifier.PUBLIC)) { return annotations.stream().anyMatch(a -> ANN_INTERNAL.equals(a.getName())) ? MemberAccessModifier.PUBLIC_INTERNAL : MemberAccessModifier.PUBLIC; } else { return MemberAccessModifier.UNDEFINED; } }
|
/**
* Converts a {@link N4Modifier} from the AST to a {@link MemberAccessModifier} in the types model.
*/
|
Converts a <code>N4Modifier</code> from the AST to a <code>MemberAccessModifier</code> in the types model
|
convertToMemberAccessModifier
|
{
"repo_name": "lbeurerkellner/n4js",
"path": "plugins/org.eclipse.n4js.model/src/org/eclipse/n4js/n4JS/ModifierUtils.java",
"license": "epl-1.0",
"size": 6558
}
|
[
"java.util.Collection",
"java.util.List",
"org.eclipse.n4js.ts.types.MemberAccessModifier"
] |
import java.util.Collection; import java.util.List; import org.eclipse.n4js.ts.types.MemberAccessModifier;
|
import java.util.*; import org.eclipse.n4js.ts.types.*;
|
[
"java.util",
"org.eclipse.n4js"
] |
java.util; org.eclipse.n4js;
| 1,332,049
|
public Color getViewColor() {
if (_viewColor == null) {
_viewColor = UI.getTagColor(_ID);
}
return _viewColor;
}
private COntology() {
_ID = Tools.randomID();
_name = "Untitled";
_description = null;
_indexMap = new COntologyToCMatrixMap(this);
}
public COntology(String name, String description) {
this(name, description, null);
}
public COntology(String name, String description, String ID) {
if (ID == null || ID.length() == 0) {
_ID = Tools.randomID();
} else {
_ID = ID;
}
_name = name;
_description = description;
_indexMap = new COntologyToCMatrixMap(this);
}
|
Color function() { if (_viewColor == null) { _viewColor = UI.getTagColor(_ID); } return _viewColor; } private COntology() { _ID = Tools.randomID(); _name = STR; _description = null; _indexMap = new COntologyToCMatrixMap(this); } public COntology(String name, String description) { this(name, description, null); } public COntology(String name, String description, String ID) { if (ID == null ID.length() == 0) { _ID = Tools.randomID(); } else { _ID = ID; } _name = name; _description = description; _indexMap = new COntologyToCMatrixMap(this); }
|
/**
* assign a new random color if it was not assigned.
*
* @return
*/
|
assign a new random color if it was not assigned
|
getViewColor
|
{
"repo_name": "sugang/coolmap",
"path": "src/coolmap/data/contology/model/COntology.java",
"license": "gpl-2.0",
"size": 28672
}
|
[
"java.awt.Color"
] |
import java.awt.Color;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 489,418
|
private interface SkyFunctionFactory {
SkyFunction create(final Semaphore threadStarted, final String[] errorMessage);
}
|
interface SkyFunctionFactory { SkyFunction function(final Semaphore threadStarted, final String[] errorMessage); }
|
/**
* Creates a SkyFunction suitable for a specific test scenario.
*
* @param threadStarted a latch which the returned SkyFunction must
* {@link Semaphore#release() release} once it started (otherwise the test won't work)
* @param errorMessage a single-element array; the SkyFunction can put a error message in it
* to indicate that an assertion failed (calling {@code fail} from async thread doesn't
* work)
*/
|
Creates a SkyFunction suitable for a specific test scenario
|
create
|
{
"repo_name": "damienmg/bazel",
"path": "src/test/java/com/google/devtools/build/skyframe/ParallelEvaluatorTest.java",
"license": "apache-2.0",
"size": 98885
}
|
[
"java.util.concurrent.Semaphore"
] |
import java.util.concurrent.Semaphore;
|
import java.util.concurrent.*;
|
[
"java.util"
] |
java.util;
| 2,021,026
|
public static void sendFromSupportEmail(String subject, String to, String body, boolean isHtmlFormat)
throws AddressException, MessagingException, UnsupportedEncodingException {
Emailer.sendFromSupportEmail(subject, to, body, isHtmlFormat, null);
}
|
static void function(String subject, String to, String body, boolean isHtmlFormat) throws AddressException, MessagingException, UnsupportedEncodingException { Emailer.sendFromSupportEmail(subject, to, body, isHtmlFormat, null); }
|
/**
* Sends an email sourced from support email
*
* @param subject
* the subject of the email
* @param to
* the email of the recipient
* @param body
* the body of the email
* @param isHtmlFormat
* whether the message is of HTML content-type or plain text
*/
|
Sends an email sourced from support email
|
sendFromSupportEmail
|
{
"repo_name": "lamsfoundation/lams",
"path": "lams_common/src/java/org/lamsfoundation/lams/util/Emailer.java",
"license": "gpl-2.0",
"size": 6063
}
|
[
"java.io.UnsupportedEncodingException",
"javax.mail.MessagingException",
"javax.mail.internet.AddressException"
] |
import java.io.UnsupportedEncodingException; import javax.mail.MessagingException; import javax.mail.internet.AddressException;
|
import java.io.*; import javax.mail.*; import javax.mail.internet.*;
|
[
"java.io",
"javax.mail"
] |
java.io; javax.mail;
| 2,167,291
|
@Override
public Response deleteScope(String name) {
try {
ScopeUtils.getOAuth2ScopeService().deleteScope(name);
} catch (IdentityOAuth2ScopeClientException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Client Error while deleting scope " + name, e);
}
if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_NOT_FOUND_SCOPE.getCode()
.equals(e.getErrorCode())) {
ScopeUtils.handleErrorResponse(Response.Status.NOT_FOUND,
Response.Status.NOT_FOUND.getReasonPhrase(), e, false, LOG);
} else {
ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST,
Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG);
}
} catch (IdentityOAuth2ScopeException e) {
ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG);
} catch (Throwable throwable) {
ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR,
Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG);
}
return Response.status(Response.Status.OK).build();
}
|
Response function(String name) { try { ScopeUtils.getOAuth2ScopeService().deleteScope(name); } catch (IdentityOAuth2ScopeClientException e) { if (LOG.isDebugEnabled()) { LOG.debug(STR + name, e); } if (Oauth2ScopeConstants.ErrorMessages.ERROR_CODE_NOT_FOUND_SCOPE.getCode() .equals(e.getErrorCode())) { ScopeUtils.handleErrorResponse(Response.Status.NOT_FOUND, Response.Status.NOT_FOUND.getReasonPhrase(), e, false, LOG); } else { ScopeUtils.handleErrorResponse(Response.Status.BAD_REQUEST, Response.Status.BAD_REQUEST.getReasonPhrase(), e, false, LOG); } } catch (IdentityOAuth2ScopeException e) { ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), e, true, LOG); } catch (Throwable throwable) { ScopeUtils.handleErrorResponse(Response.Status.INTERNAL_SERVER_ERROR, Response.Status.INTERNAL_SERVER_ERROR.getReasonPhrase(), throwable, true, LOG); } return Response.status(Response.Status.OK).build(); }
|
/**
* Delete the scope for the given scope name
*
* @param name Name of the scope which need to get deleted
* @return Response with the status of scope deletion
*/
|
Delete the scope for the given scope name
|
deleteScope
|
{
"repo_name": "IsuraD/identity-inbound-auth-oauth",
"path": "components/org.wso2.carbon.identity.oauth.scope.endpoint/src/main/java/org/wso2/carbon/identity/oauth/scope/endpoint/impl/ScopesApiServiceImpl.java",
"license": "apache-2.0",
"size": 14000
}
|
[
"javax.ws.rs.core.Response",
"org.wso2.carbon.identity.oauth.scope.endpoint.util.ScopeUtils",
"org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeClientException",
"org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeException",
"org.wso2.carbon.identity.oauth2.Oauth2ScopeConstants"
] |
import javax.ws.rs.core.Response; import org.wso2.carbon.identity.oauth.scope.endpoint.util.ScopeUtils; import org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeClientException; import org.wso2.carbon.identity.oauth2.IdentityOAuth2ScopeException; import org.wso2.carbon.identity.oauth2.Oauth2ScopeConstants;
|
import javax.ws.rs.core.*; import org.wso2.carbon.identity.oauth.scope.endpoint.util.*; import org.wso2.carbon.identity.oauth2.*;
|
[
"javax.ws",
"org.wso2.carbon"
] |
javax.ws; org.wso2.carbon;
| 1,297,646
|
protected Response replicate(final String method, final Object entity, final Map<String, String> headersToOverride) {
try {
return replicateNodeResponse(method, entity, headersToOverride).getResponse();
} catch (final InterruptedException ie) {
return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity("Request to " + method + " " + getAbsolutePath() + " was interrupted").type("text/plain").build();
}
}
|
Response function(final String method, final Object entity, final Map<String, String> headersToOverride) { try { return replicateNodeResponse(method, entity, headersToOverride).getResponse(); } catch (final InterruptedException ie) { return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(STR + method + " " + getAbsolutePath() + STR).type(STR).build(); } }
|
/**
* Replicates the request to all nodes in the cluster using the provided method and entity. The headers
* used will be those provided by the {@link #getHeaders()} method. The URI that will be used will be
* that provided by the {@link #getAbsolutePath()} method
*
* @param method the HTTP method to use
* @param entity the entity to replicate
* @param headersToOverride the headers to override
* @return the response from the request
* @see #replicateNodeResponse(String, Object, Map)
*/
|
Replicates the request to all nodes in the cluster using the provided method and entity. The headers used will be those provided by the <code>#getHeaders()</code> method. The URI that will be used will be that provided by the <code>#getAbsolutePath()</code> method
|
replicate
|
{
"repo_name": "MikeThomsen/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/api/ApplicationResource.java",
"license": "apache-2.0",
"size": 60484
}
|
[
"java.util.Map",
"javax.ws.rs.core.Response"
] |
import java.util.Map; import javax.ws.rs.core.Response;
|
import java.util.*; import javax.ws.rs.core.*;
|
[
"java.util",
"javax.ws"
] |
java.util; javax.ws;
| 1,813,802
|
public List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>> getRelationshipFormulated(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>>> retType = new TypeReference<List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>>>() {};
List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_Formulated", args, retType, true, false);
return res.get(0);
}
|
List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>>> retType = new TypeReference<List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>>>() {}; List<List<Tuple3<FieldsSource, FieldsFormulated, FieldsCoregulatedSet>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); }
|
/**
* <p>Original spec-file function name: get_relationship_Formulated</p>
* <pre>
* This relationship connects a coregulated set to the
* source organization that originally computed it.
* It has the following fields:
* =over 4
* =back
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsSource FieldsSource} (original type "fields_Source"), type {@link us.kbase.cdmientityapi.FieldsFormulated FieldsFormulated} (original type "fields_Formulated"), type {@link us.kbase.cdmientityapi.FieldsCoregulatedSet FieldsCoregulatedSet} (original type "fields_CoregulatedSet")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/
|
Original spec-file function name: get_relationship_Formulated <code> This relationship connects a coregulated set to the source organization that originally computed it. It has the following fields: =over 4 =back </code>
|
getRelationshipFormulated
|
{
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
}
|
[
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] |
import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3;
|
import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*;
|
[
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] |
com.fasterxml.jackson; java.io; java.util; us.kbase.common;
| 1,967,570
|
void put(@NonNull final String key, @Nullable final String migrationKey,
@Nullable final Object data);
/**
* stores the data using the key to access the data later with {@link #get(String)}
|
void put(@NonNull final String key, @Nullable final String migrationKey, @Nullable final Object data); /** * stores the data using the key to access the data later with {@link #get(String)}
|
/**
* same as {@link #put(String, Object)} but with an additional migration key to save where the
* data came from.
*
* @param key where to save
* @param migrationKey where the data came from
* @param data what to save
*/
|
same as <code>#put(String, Object)</code> but with an additional migration key to save where the data came from
|
put
|
{
"repo_name": "omegasoft7/tray",
"path": "library/src/main/java/net/grandcentrix/tray/storage/PreferenceStorage.java",
"license": "apache-2.0",
"size": 2229
}
|
[
"android.support.annotation.NonNull",
"android.support.annotation.Nullable"
] |
import android.support.annotation.NonNull; import android.support.annotation.Nullable;
|
import android.support.annotation.*;
|
[
"android.support"
] |
android.support;
| 1,187,438
|
public void refreshData(final CidsBean cidsBean) {
data.clear();
data.addAll(getChemMst(cidsBean));
isInitialised = true;
fireTableDataChanged();
}
|
void function(final CidsBean cidsBean) { data.clear(); data.addAll(getChemMst(cidsBean)); isInitialised = true; fireTableDataChanged(); }
|
/**
* DOCUMENT ME!
*
* @param cidsBean DOCUMENT ME!
*/
|
DOCUMENT ME
|
refreshData
|
{
"repo_name": "cismet/cids-custom-wrrl-db-mv",
"path": "src/main/java/de/cismet/cids/custom/objecteditors/wrrl_db_mv/WkFgPanSix.java",
"license": "lgpl-3.0",
"size": 66369
}
|
[
"de.cismet.cids.dynamics.CidsBean"
] |
import de.cismet.cids.dynamics.CidsBean;
|
import de.cismet.cids.dynamics.*;
|
[
"de.cismet.cids"
] |
de.cismet.cids;
| 419,104
|
public VisitorActivityQueryRequest withActivityType(final VisitorActivityType activityType) {
return withCollectionParam("type", activityType.getValue());
}
|
VisitorActivityQueryRequest function(final VisitorActivityType activityType) { return withCollectionParam("type", activityType.getValue()); }
|
/**
* Filter by activity type.
* @param activityType Activity type to filter by.
* @return RequestBuilder
*/
|
Filter by activity type
|
withActivityType
|
{
"repo_name": "Crim/pardot-java-client",
"path": "src/main/java/com/darksci/pardot/api/request/visitoractivity/VisitorActivityQueryRequest.java",
"license": "mit",
"size": 12026
}
|
[
"com.darksci.pardot.api.response.visitoractivity.VisitorActivityType"
] |
import com.darksci.pardot.api.response.visitoractivity.VisitorActivityType;
|
import com.darksci.pardot.api.response.visitoractivity.*;
|
[
"com.darksci.pardot"
] |
com.darksci.pardot;
| 2,232,730
|
public static int getListViewSelectedItem(ListView listView)
{
final SparseBooleanArray checkedItems = listView.getCheckedItemPositions();
for (int i = 0; i < checkedItems.size(); i++)
{
// And this tells us the item status at the above position
final boolean isChecked = checkedItems.valueAt(i);
if (isChecked)
{
// This tells us the item position we are looking at
return checkedItems.keyAt(i);
}
}
return -1;
}
|
static int function(ListView listView) { final SparseBooleanArray checkedItems = listView.getCheckedItemPositions(); for (int i = 0; i < checkedItems.size(); i++) { final boolean isChecked = checkedItems.valueAt(i); if (isChecked) { return checkedItems.keyAt(i); } } return -1; }
|
/**
* Returns the FIRST position of a selected item from a ListView. If none found, returns -1
*
* @param listView
* @return
*/
|
Returns the FIRST position of a selected item from a ListView. If none found, returns -1
|
getListViewSelectedItem
|
{
"repo_name": "johnwstafford/AndroidProject",
"path": "TOMClient/validation/Validation.java",
"license": "gpl-3.0",
"size": 3231
}
|
[
"android.util.SparseBooleanArray",
"android.widget.ListView"
] |
import android.util.SparseBooleanArray; import android.widget.ListView;
|
import android.util.*; import android.widget.*;
|
[
"android.util",
"android.widget"
] |
android.util; android.widget;
| 2,358,852
|
public List<WordWithCoreferenceTag> getListOfWordsWithTags() throws ArkrefClientException
{
if (null==listOfWordsWithTags) throw new ArkrefClientException("You should call parse() before calling this method.");
return listOfWordsWithTags;
}
//////////////////////////////// PRIVATE ///////////////////////////////////
|
List<WordWithCoreferenceTag> function() throws ArkrefClientException { if (null==listOfWordsWithTags) throw new ArkrefClientException(STR); return listOfWordsWithTags; }
|
/**
* Returns the output of the parse of the given output-text.
* The output is given as a list of {@link WordWithCoreferenceTag}.
* <P>
* You should call {@link #parse()} before calling this method.
* @return
* @throws ArkrefClientException
*/
|
Returns the output of the parse of the given output-text. The output is given as a list of <code>WordWithCoreferenceTag</code>. You should call <code>#parse()</code> before calling this method
|
getListOfWordsWithTags
|
{
"repo_name": "madhumita-git/Excitement-Open-Platform",
"path": "lap/src/main/java/eu/excitementproject/eop/lap/biu/en/coreference/arkref/ArkrefOutputParser.java",
"license": "gpl-3.0",
"size": 7694
}
|
[
"eu.excitementproject.eop.lap.biu.coreference.merge.WordWithCoreferenceTag",
"eu.excitementproject.eop.lap.biu.en.coreference.arkref.ArkrefClient",
"java.util.List"
] |
import eu.excitementproject.eop.lap.biu.coreference.merge.WordWithCoreferenceTag; import eu.excitementproject.eop.lap.biu.en.coreference.arkref.ArkrefClient; import java.util.List;
|
import eu.excitementproject.eop.lap.biu.coreference.merge.*; import eu.excitementproject.eop.lap.biu.en.coreference.arkref.*; import java.util.*;
|
[
"eu.excitementproject.eop",
"java.util"
] |
eu.excitementproject.eop; java.util;
| 318,881
|
public LifecycleEnvironment lifecycle() {
return lifecycleEnvironment;
}
|
LifecycleEnvironment function() { return lifecycleEnvironment; }
|
/**
* Returns the application's {@link LifecycleEnvironment}.
*/
|
Returns the application's <code>LifecycleEnvironment</code>
|
lifecycle
|
{
"repo_name": "ryankennedy/dropwizard",
"path": "dropwizard-core/src/main/java/io/dropwizard/setup/Environment.java",
"license": "apache-2.0",
"size": 6204
}
|
[
"io.dropwizard.lifecycle.setup.LifecycleEnvironment"
] |
import io.dropwizard.lifecycle.setup.LifecycleEnvironment;
|
import io.dropwizard.lifecycle.setup.*;
|
[
"io.dropwizard.lifecycle"
] |
io.dropwizard.lifecycle;
| 1,509,928
|
private boolean pruneSegment(FilterQueryTree filterQueryTree,
Map<String, ColumnPartitionMetadata> columnMetadataMap) {
if (filterQueryTree == null) {
return false;
}
List<FilterQueryTree> children = filterQueryTree.getChildren();
// Non-leaf node
if (children != null && !children.isEmpty()) {
return pruneNonLeaf(filterQueryTree, columnMetadataMap);
}
// TODO: Enhance partition based pruning for RANGE operator.
if (filterQueryTree.getOperator() != FilterOperator.EQUALITY) {
return false;
}
// Leaf node
String column = filterQueryTree.getColumn();
ColumnPartitionMetadata metadata = columnMetadataMap.get(column);
if (metadata == null) {
return false;
}
List<IntRange> partitionRanges = metadata.getPartitionRanges();
if (partitionRanges == null || partitionRanges.isEmpty()) {
return false;
}
String value = filterQueryTree.getValue().get(0);
PartitionFunction partitionFunction =
PartitionFunctionFactory.getPartitionFunction(metadata.getFunctionName(), metadata.getNumPartitions());
int partition = partitionFunction.getPartition(value);
for (IntRange partitionRange : partitionRanges) {
if (partitionRange.containsInteger(partition)) {
return false;
}
}
return true;
}
|
boolean function(FilterQueryTree filterQueryTree, Map<String, ColumnPartitionMetadata> columnMetadataMap) { if (filterQueryTree == null) { return false; } List<FilterQueryTree> children = filterQueryTree.getChildren(); if (children != null && !children.isEmpty()) { return pruneNonLeaf(filterQueryTree, columnMetadataMap); } if (filterQueryTree.getOperator() != FilterOperator.EQUALITY) { return false; } String column = filterQueryTree.getColumn(); ColumnPartitionMetadata metadata = columnMetadataMap.get(column); if (metadata == null) { return false; } List<IntRange> partitionRanges = metadata.getPartitionRanges(); if (partitionRanges == null partitionRanges.isEmpty()) { return false; } String value = filterQueryTree.getValue().get(0); PartitionFunction partitionFunction = PartitionFunctionFactory.getPartitionFunction(metadata.getFunctionName(), metadata.getNumPartitions()); int partition = partitionFunction.getPartition(value); for (IntRange partitionRange : partitionRanges) { if (partitionRange.containsInteger(partition)) { return false; } } return true; }
|
/**
* Helper method to prune a segment based on the filter query tree and partition metadata.
*
* @param filterQueryTree Filter tree for the predicates in the query
* @param columnMetadataMap Map of column name to partition metadata for the column.
*
* @return True if the segment can be pruned, false otherwise.
*/
|
Helper method to prune a segment based on the filter query tree and partition metadata
|
pruneSegment
|
{
"repo_name": "sajavadi/pinot",
"path": "pinot-broker/src/main/java/com/linkedin/pinot/broker/pruner/PartitionZKMetadataPruner.java",
"license": "apache-2.0",
"size": 5262
}
|
[
"com.linkedin.pinot.common.metadata.segment.ColumnPartitionMetadata",
"com.linkedin.pinot.common.request.FilterOperator",
"com.linkedin.pinot.common.utils.request.FilterQueryTree",
"com.linkedin.pinot.core.data.partition.PartitionFunction",
"com.linkedin.pinot.core.data.partition.PartitionFunctionFactory",
"java.util.List",
"java.util.Map",
"org.apache.commons.lang.math.IntRange"
] |
import com.linkedin.pinot.common.metadata.segment.ColumnPartitionMetadata; import com.linkedin.pinot.common.request.FilterOperator; import com.linkedin.pinot.common.utils.request.FilterQueryTree; import com.linkedin.pinot.core.data.partition.PartitionFunction; import com.linkedin.pinot.core.data.partition.PartitionFunctionFactory; import java.util.List; import java.util.Map; import org.apache.commons.lang.math.IntRange;
|
import com.linkedin.pinot.common.metadata.segment.*; import com.linkedin.pinot.common.request.*; import com.linkedin.pinot.common.utils.request.*; import com.linkedin.pinot.core.data.partition.*; import java.util.*; import org.apache.commons.lang.math.*;
|
[
"com.linkedin.pinot",
"java.util",
"org.apache.commons"
] |
com.linkedin.pinot; java.util; org.apache.commons;
| 90,873
|
public final void testGetGroupsForNonExistentUser() {
try {
final ExternalAPIRemote service = getService();
final List<Group> groups = service.getGroups(Long.valueOf(-1));
Assert.assertNotNull(groups);
Assert.assertTrue(groups.isEmpty());
} catch (final Exception e) {
e.printStackTrace();
Assert.fail();
}
}
|
final void function() { try { final ExternalAPIRemote service = getService(); final List<Group> groups = service.getGroups(Long.valueOf(-1)); Assert.assertNotNull(groups); Assert.assertTrue(groups.isEmpty()); } catch (final Exception e) { e.printStackTrace(); Assert.fail(); } }
|
/**
* Tests {@link org.gss_project.gss.server.ejb.ExternalAPIBean#getGroups(Long)} for a
* non-existent user
*/
|
Tests <code>org.gss_project.gss.server.ejb.ExternalAPIBean#getGroups(Long)</code> for a non-existent user
|
testGetGroupsForNonExistentUser
|
{
"repo_name": "andrewbissada/gss",
"path": "test/org/gss_project/gss/server/ejb/ExternalAPITest.java",
"license": "gpl-3.0",
"size": 23691
}
|
[
"java.util.List",
"junit.framework.Assert",
"org.gss_project.gss.server.domain.Group"
] |
import java.util.List; import junit.framework.Assert; import org.gss_project.gss.server.domain.Group;
|
import java.util.*; import junit.framework.*; import org.gss_project.gss.server.domain.*;
|
[
"java.util",
"junit.framework",
"org.gss_project.gss"
] |
java.util; junit.framework; org.gss_project.gss;
| 931,470
|
public void setShortMonthNames(final FileSystemOptions opts, final String[] shortMonthNames) {
String[] clone = null;
if (shortMonthNames != null) {
clone = new String[shortMonthNames.length];
System.arraycopy(shortMonthNames, 0, clone, 0, shortMonthNames.length);
}
setParam(opts, SHORT_MONTH_NAMES, clone);
}
|
void function(final FileSystemOptions opts, final String[] shortMonthNames) { String[] clone = null; if (shortMonthNames != null) { clone = new String[shortMonthNames.length]; System.arraycopy(shortMonthNames, 0, clone, 0, shortMonthNames.length); } setParam(opts, SHORT_MONTH_NAMES, clone); }
|
/**
* See {@link org.apache.commons.net.ftp.FTPClientConfig} for details and examples.
*
* @param opts The FileSystemOptions.
* @param shortMonthNames an array of short month name Strings.
*/
|
See <code>org.apache.commons.net.ftp.FTPClientConfig</code> for details and examples
|
setShortMonthNames
|
{
"repo_name": "seeburger-ag/commons-vfs",
"path": "commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java",
"license": "apache-2.0",
"size": 17410
}
|
[
"org.apache.commons.vfs2.FileSystemOptions"
] |
import org.apache.commons.vfs2.FileSystemOptions;
|
import org.apache.commons.vfs2.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 664,153
|
public PagedResult<Subscriber> active(Date subscribedFrom,
Integer page, Integer pageSize, String orderField, String orderDirection) throws CreateSendException {
return active(JsonProvider.ApiDateFormat.format(subscribedFrom),
page, pageSize, orderField, orderDirection);
}
|
PagedResult<Subscriber> function(Date subscribedFrom, Integer page, Integer pageSize, String orderField, String orderDirection) throws CreateSendException { return active(JsonProvider.ApiDateFormat.format(subscribedFrom), page, pageSize, orderField, orderDirection); }
|
/**
* Gets a paged collection of active subscribers who have subscribed to the list
* since the provided date.
* @param subscribedFrom The API will only return subscribers who became active on or after this date.
* This field is required
* @param page The page number or results to get. Use <code>null</code> for the default (page=1)
* @param pageSize The number of records to get on the current page. Use <code>null</code> for the default.
* @param orderField The field used to order the results by. Use <code>null</code> for the default.
* @param orderDirection The direction to order the results by. Use <code>null</code> for the default.
* @return The paged subscribers returned by the api call.
* @throws CreateSendException Thrown when the API responds with a HTTP Status >= 400
* @see <a href="http://www.campaignmonitor.com/api/lists/#active_subscribers" target="_blank">
* Getting active subscribers</a>
*/
|
Gets a paged collection of active subscribers who have subscribed to the list since the provided date
|
active
|
{
"repo_name": "richardbremner/createsend-java",
"path": "src/com/createsend/Lists.java",
"license": "mit",
"size": 30528
}
|
[
"com.createsend.models.PagedResult",
"com.createsend.models.subscribers.Subscriber",
"com.createsend.util.exceptions.CreateSendException",
"com.createsend.util.jersey.JsonProvider",
"java.util.Date"
] |
import com.createsend.models.PagedResult; import com.createsend.models.subscribers.Subscriber; import com.createsend.util.exceptions.CreateSendException; import com.createsend.util.jersey.JsonProvider; import java.util.Date;
|
import com.createsend.models.*; import com.createsend.models.subscribers.*; import com.createsend.util.exceptions.*; import com.createsend.util.jersey.*; import java.util.*;
|
[
"com.createsend.models",
"com.createsend.util",
"java.util"
] |
com.createsend.models; com.createsend.util; java.util;
| 504,332
|
public PagingLoader<PagingLoadResult<ModelData>> getLoader() {
return loader;
}
|
PagingLoader<PagingLoadResult<ModelData>> function() { return loader; }
|
/**
* Gets the loader.
*
* @return the loader
*/
|
Gets the loader
|
getLoader
|
{
"repo_name": "andrefilo/geofence",
"path": "src/gui/core/plugin/userui/src/main/java/org/geoserver/geofence/gui/client/widget/ProfileGridWidget.java",
"license": "gpl-2.0",
"size": 17683
}
|
[
"com.extjs.gxt.ui.client.data.ModelData",
"com.extjs.gxt.ui.client.data.PagingLoadResult",
"com.extjs.gxt.ui.client.data.PagingLoader"
] |
import com.extjs.gxt.ui.client.data.ModelData; import com.extjs.gxt.ui.client.data.PagingLoadResult; import com.extjs.gxt.ui.client.data.PagingLoader;
|
import com.extjs.gxt.ui.client.data.*;
|
[
"com.extjs.gxt"
] |
com.extjs.gxt;
| 2,859,581
|
void drawDivider(Canvas canvas, Rect bounds, int childIndex) {
// This widget draws the same divider for all children
final Drawable divider = mDivider;
divider.setBounds(bounds);
divider.draw(canvas);
}
|
void drawDivider(Canvas canvas, Rect bounds, int childIndex) { final Drawable divider = mDivider; divider.setBounds(bounds); divider.draw(canvas); }
|
/**
* Draws a divider for the given child in the given bounds.
*
* @param canvas The canvas to draw to.
* @param bounds The bounds of the divider.
* @param childIndex The index of child (of the View) above the divider.
* This will be -1 if there is no child above the divider to be
* drawn.
*/
|
Draws a divider for the given child in the given bounds
|
drawDivider
|
{
"repo_name": "daiqiquan/framework-base",
"path": "core/java/android/widget/ListView.java",
"license": "apache-2.0",
"size": 158603
}
|
[
"android.graphics.Canvas",
"android.graphics.Rect",
"android.graphics.drawable.Drawable"
] |
import android.graphics.Canvas; import android.graphics.Rect; import android.graphics.drawable.Drawable;
|
import android.graphics.*; import android.graphics.drawable.*;
|
[
"android.graphics"
] |
android.graphics;
| 49,016
|
public boolean smoke( ) {
//final int[] r_value = new int[2];
//final int[] w_value;
//if ( nodeName.equals( "LineSet" ) && fieldName.equals( "vertexCount" ) ) {
// w_value = new int[]{ 2, 2 };
//}
//else if ( nodeName.equals( "TriangleFanSet" ) && fieldName.equals( "fanCount" ) ) {
// w_value = new int[]{ 3, 3 };
//}
//else if ( nodeName.equals( "TriangleStripSet" ) && fieldName.equals( "stripCount" ) ) {
// w_value = new int[]{ 3, 3 };
//}
//else { w_value = new int[]{ 1, 2 }; }
int[] r_value;
final int[] w_value = smoke_value;
final int w_size = w_value.length;
switch ( access ) {
case X3DFieldTypes.INPUT_ONLY:
case X3DFieldTypes.INITIALIZE_ONLY:
field.setValue( w_size, w_value );
break;
case X3DFieldTypes.OUTPUT_ONLY:
r_value = new int[field.size( )];
field.getValue( r_value );
break;
case X3DFieldTypes.INPUT_OUTPUT:
//
control.bufferUpdate( );
field.setValue( w_size, w_value );
control.flushUpdate( );
//
final int r_size = field.size( );
if ( r_size != w_size ) {
control.logMessage( tMessageType.ERROR, new String[]{
nodeName +":"+ fieldName,
"\twrite size = " + w_size,
"\tread size = " + r_size } );
return( FAIL );
}
r_value = new int[r_size];
field.getValue( r_value );
for ( int i = 0; i < r_value.length; i++ ) {
if ( w_value[i] != r_value[i] ) {
control.logMessage( tMessageType.ERROR, new String[]{
nodeName +":"+ fieldName,
"\tdata mismatch at array index: " + i,
"\twrote [ " + w_value[i] +" ]",
"\tread [ " + r_value[i] +" ]" } );
return( FAIL );
}
}
break;
default:
control.logMessage( tMessageType.ERROR, nodeName +":"+ fieldName + " invalid access type: " + access );
return( FAIL );
}
control.logMessage( tMessageType.SUCCESS, nodeName +":"+ fieldName );
return( SUCCESS );
}
|
boolean function( ) { int[] r_value; final int[] w_value = smoke_value; final int w_size = w_value.length; switch ( access ) { case X3DFieldTypes.INPUT_ONLY: case X3DFieldTypes.INITIALIZE_ONLY: field.setValue( w_size, w_value ); break; case X3DFieldTypes.OUTPUT_ONLY: r_value = new int[field.size( )]; field.getValue( r_value ); break; case X3DFieldTypes.INPUT_OUTPUT: field.setValue( w_size, w_value ); control.flushUpdate( ); if ( r_size != w_size ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, STR + w_size, STR + r_size } ); return( FAIL ); } r_value = new int[r_size]; field.getValue( r_value ); for ( int i = 0; i < r_value.length; i++ ) { if ( w_value[i] != r_value[i] ) { control.logMessage( tMessageType.ERROR, new String[]{ nodeName +":"+ fieldName, STR + i, STR + w_value[i] +STR, STR + r_value[i] +STR } ); return( FAIL ); } } break; default: control.logMessage( tMessageType.ERROR, nodeName +":"+ fieldName + STR + access ); return( FAIL ); } control.logMessage( tMessageType.SUCCESS, nodeName +":"+ fieldName ); return( SUCCESS ); }
|
/**
* Execute a 'smoke' test.
* @return results, <code>true</code> for pass, <code>false</code> for fail
*/
|
Execute a 'smoke' test
|
smoke
|
{
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/parsetest/sai/external/nodetest/tMFInt32.java",
"license": "gpl-2.0",
"size": 4624
}
|
[
"org.web3d.x3d.sai.X3DFieldTypes"
] |
import org.web3d.x3d.sai.X3DFieldTypes;
|
import org.web3d.x3d.sai.*;
|
[
"org.web3d.x3d"
] |
org.web3d.x3d;
| 2,390,449
|
static PreferenceScreen getPreferenceScreen(PreferenceManager manager) {
try {
Method m = PreferenceManager.class.getDeclaredMethod("getPreferenceScreen");
m.setAccessible(true);
return (PreferenceScreen) m.invoke(manager);
} catch (Exception e) {
Log.w(TAG, "Couldn't call PreferenceManager.getPreferenceScreen by reflection", e);
}
return null;
}
|
static PreferenceScreen getPreferenceScreen(PreferenceManager manager) { try { Method m = PreferenceManager.class.getDeclaredMethod(STR); m.setAccessible(true); return (PreferenceScreen) m.invoke(manager); } catch (Exception e) { Log.w(TAG, STR, e); } return null; }
|
/**
* Returns the root of the preference hierarchy managed by this class.
*
* @return The {@link android.preference.PreferenceScreen} object that is at the root of the hierarchy.
*/
|
Returns the root of the preference hierarchy managed by this class
|
getPreferenceScreen
|
{
"repo_name": "jfsso/dagger-android-helper-library",
"path": "DaggerAndroidHelperLibrary/src/main/java/com/anprosit/android/dagger/ui/v4/PreferenceManagerCompat.java",
"license": "apache-2.0",
"size": 8738
}
|
[
"android.preference.PreferenceManager",
"android.preference.PreferenceScreen",
"android.util.Log",
"java.lang.reflect.Method"
] |
import android.preference.PreferenceManager; import android.preference.PreferenceScreen; import android.util.Log; import java.lang.reflect.Method;
|
import android.preference.*; import android.util.*; import java.lang.reflect.*;
|
[
"android.preference",
"android.util",
"java.lang"
] |
android.preference; android.util; java.lang;
| 497,383
|
@SmallTest
@Feature({"Multiwindow"})
@UiThreadTest
public void testIndexFallback2() {
assertTrue("Not enough selectors", TabWindowManager.MAX_SIMULTANEOUS_SELECTORS >= 3);
final TabWindowManager manager = TabWindowManager.getInstance();
ChromeActivity activity0 = buildActivity();
ChromeActivity activity1 = buildActivity();
TabModelSelector selector0 = requestSelector(activity0, 2);
// Request 2 again, but should get 0 instead.
TabModelSelector selector1 = requestSelector(activity1, 2);
assertNotNull("Was not able to build the TabModelSelector", selector0);
assertNotNull("Was not able to build the TabModelSelector", selector1);
assertEquals("Unexpected model index", 2, manager.getIndexForWindow(activity0));
assertEquals("Unexpected model index", 0, manager.getIndexForWindow(activity1));
}
|
@Feature({STR}) void function() { assertTrue(STR, TabWindowManager.MAX_SIMULTANEOUS_SELECTORS >= 3); final TabWindowManager manager = TabWindowManager.getInstance(); ChromeActivity activity0 = buildActivity(); ChromeActivity activity1 = buildActivity(); TabModelSelector selector0 = requestSelector(activity0, 2); TabModelSelector selector1 = requestSelector(activity1, 2); assertNotNull(STR, selector0); assertNotNull(STR, selector1); assertEquals(STR, 2, manager.getIndexForWindow(activity0)); assertEquals(STR, 0, manager.getIndexForWindow(activity1)); }
|
/**
* Test that requesting the same {@link TabModelSelector} index will fall back and return a
* model for a different available index instead. In this case, a lower index (2 -> 0).
*/
|
Test that requesting the same <code>TabModelSelector</code> index will fall back and return a model for a different available index instead. In this case, a lower index (2 -> 0)
|
testIndexFallback2
|
{
"repo_name": "danakj/chromium",
"path": "chrome/android/javatests/src/org/chromium/chrome/browser/tabmodel/TabWindowManagerTest.java",
"license": "bsd-3-clause",
"size": 11623
}
|
[
"org.chromium.base.test.util.Feature",
"org.chromium.chrome.browser.ChromeActivity"
] |
import org.chromium.base.test.util.Feature; import org.chromium.chrome.browser.ChromeActivity;
|
import org.chromium.base.test.util.*; import org.chromium.chrome.browser.*;
|
[
"org.chromium.base",
"org.chromium.chrome"
] |
org.chromium.base; org.chromium.chrome;
| 207,305
|
List<Synchronization> handoverCompletions();
|
List<Synchronization> handoverCompletions();
|
/**
* Handover all the on completions from this exchange
*
* @return the on completions
*/
|
Handover all the on completions from this exchange
|
handoverCompletions
|
{
"repo_name": "curso007/camel",
"path": "camel-core/src/main/java/org/apache/camel/Exchange.java",
"license": "apache-2.0",
"size": 26601
}
|
[
"java.util.List",
"org.apache.camel.spi.Synchronization"
] |
import java.util.List; import org.apache.camel.spi.Synchronization;
|
import java.util.*; import org.apache.camel.spi.*;
|
[
"java.util",
"org.apache.camel"
] |
java.util; org.apache.camel;
| 1,863,837
|
private String getReadQuery(CmsFormDatabaseFilter filter, List<Object> params, boolean count) {
StringBuffer sql = new StringBuffer(128);
params.clear(); // be sure the parameters list is clear
if (count) {
sql.append(getQuery("COUNT_FORM_ENTRIES"));
} else {
if (filter.isHeadersOnly()) {
sql.append(getQuery("READ_FORM_ENTRY"));
} else {
sql.append(getQuery("READ_FORM_DATA"));
}
}
StringBuffer where = new StringBuffer(128);
if (!filter.getFields().isEmpty()) {
int fields = filter.getFields().size();
for (int i = 0; i < fields; i++) {
sql.append(",").append(getQuery("COND_FIELD_FROM", "" + i));
}
}
if (!filter.isHeadersOnly()) {
where.append(getQuery("COND_JOIN"));
}
if (filter.getEntryId() > 0) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
where.append(getQuery("FILTER_ENTRY_ID"));
params.add(new Integer(filter.getEntryId()));
}
if (filter.getFormId() != null) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
where.append(getQuery("FILTER_FORM_ID"));
params.add(filter.getFormId());
}
if (filter.getDateEnd() != CmsFormDatabaseFilter.DATE_IGNORE_TO) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
where.append(getQuery("FILTER_DATE_END"));
params.add(new Long(filter.getDateEnd()));
}
if (filter.getStartDate() != CmsFormDatabaseFilter.DATE_IGNORE_FROM) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
where.append(getQuery("FILTER_DATE_START"));
params.add(new Long(filter.getStartDate()));
}
if (filter.getResourceId() != null) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
where.append(getQuery("FILTER_RESOURCE_ID"));
params.add(filter.getResourceId().toString());
}
// states filter
Set<Integer> states = filter.getStates();
if (!states.isEmpty()) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
String ph = "";
for (int i = 0; i < states.size(); i++) {
ph += "?";
if (i < (states.size() - 1)) {
ph += ", ";
}
}
where.append(getQuery("FILTER_STATES", ph));
Iterator<Integer> it = states.iterator();
while (it.hasNext()) {
Integer state = it.next();
params.add(state);
}
}
// fields filter
Map<String, String> fields = filter.getFields();
if (!fields.isEmpty()) {
if (where.length() > 0) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
int i = 0;
Iterator<Entry<String, String>> it = fields.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> field = it.next();
where.append(getQuery("FILTER_FIELD", "" + i));
params.add(field.getKey());
params.add(field.getValue());
if (it.hasNext()) {
where.append(" ").append(getQuery("COND_AND")).append(" ");
}
i++;
}
}
if (where.length() > 0) {
sql.append(" ").append(getQuery("COND_WHERE")).append(" ").append(where);
}
if (!count) {
if (filter.isOrderAsc()) {
sql.append(" ").append(getQuery("COND_ORDER_ASC"));
} else {
sql.append(" ").append(getQuery("COND_ORDER_DESC"));
}
}
if ((filter.getIndexFrom() != CmsFormDatabaseFilter.INDEX_IGNORE_FROM)
|| (filter.getIndexTo() != CmsFormDatabaseFilter.INDEX_IGNORE_TO)) {
int rows = filter.getIndexTo() - filter.getIndexFrom();
if (m_db.equals(DB_ORACLE)) {
rows = filter.getIndexTo();
}
sql.insert(0, " ").insert(0, getQuery("FILTER_LIMIT_PREFIX"));
sql.append(" ").append(getQuery("FILTER_LIMIT_POSTFIX")).append(" ");
sql.append(" ").append(getQuery("FILTER_LIMIT", "" + rows));
if (filter.getIndexFrom() != 0) {
sql.append(" ").append(getQuery("FILTER_OFFSET", "" + filter.getIndexFrom()));
}
}
return sql.toString();
}
|
String function(CmsFormDatabaseFilter filter, List<Object> params, boolean count) { StringBuffer sql = new StringBuffer(128); params.clear(); if (count) { sql.append(getQuery(STR)); } else { if (filter.isHeadersOnly()) { sql.append(getQuery(STR)); } else { sql.append(getQuery(STR)); } } StringBuffer where = new StringBuffer(128); if (!filter.getFields().isEmpty()) { int fields = filter.getFields().size(); for (int i = 0; i < fields; i++) { sql.append(",").append(getQuery(STR, STRCOND_JOINSTR STRCOND_ANDSTR STRFILTER_ENTRY_IDSTR STRCOND_ANDSTR STRFILTER_FORM_IDSTR STRCOND_ANDSTR STRFILTER_DATE_ENDSTR STRCOND_ANDSTR STRFILTER_DATE_STARTSTR STRCOND_ANDSTR STRFILTER_RESOURCE_IDSTR STRCOND_ANDSTR STRSTR?STR, STRFILTER_STATESSTR STRCOND_ANDSTR STRFILTER_FIELDSTRSTR STRCOND_ANDSTR STR STRCOND_WHERESTR STR STRCOND_ORDER_ASCSTR STRCOND_ORDER_DESCSTR STRFILTER_LIMIT_PREFIXSTR STRFILTER_LIMIT_POSTFIXSTR STR STRFILTER_LIMITSTRSTR STRFILTER_OFFSETSTR" + filter.getIndexFrom())); } } return sql.toString(); }
|
/**
* Build the whole sql statement for the given form filter.<p>
*
* @param filter the filter
* @param params the parameter values (return parameter)
* @param count if true it selects no row, just the number of rows
*
* @return the sql statement string
*/
|
Build the whole sql statement for the given form filter
|
getReadQuery
|
{
"repo_name": "gallardo/alkacon-oamp",
"path": "com.alkacon.opencms.formgenerator/src/com/alkacon/opencms/formgenerator/database/CmsFormDataAccess.java",
"license": "gpl-3.0",
"size": 48249
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 681,029
|
public static java.util.Set extractUserAccessSet(ims.domain.ILightweightDomainFactory domainFactory, ims.correspondence.vo.UserAccessFullVoCollection voCollection)
{
return extractUserAccessSet(domainFactory, voCollection, null, new HashMap());
}
|
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.correspondence.vo.UserAccessFullVoCollection voCollection) { return extractUserAccessSet(domainFactory, voCollection, null, new HashMap()); }
|
/**
* Create the ims.correspondence.configuration.domain.objects.UserAccess set from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/
|
Create the ims.correspondence.configuration.domain.objects.UserAccess set from the value object collection
|
extractUserAccessSet
|
{
"repo_name": "IMS-MAXIMS/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/correspondence/vo/domain/UserAccessFullVoAssembler.java",
"license": "agpl-3.0",
"size": 19491
}
|
[
"java.util.HashMap"
] |
import java.util.HashMap;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,051,282
|
private static ScopeQualifier getScopeQualifier(RequestAttributes requestAttributes)
throws ScopeResolverException {
Iterator<Attribute> iterAttributesScope = requestAttributes.getAttributes(XACML3.ID_RESOURCE_SCOPE);
if (iterAttributesScope == null || !iterAttributesScope.hasNext()) {
return null;
}
Attribute attributeScope = iterAttributesScope.next();
if (iterAttributesScope.hasNext()) {
throw new ScopeResolverException("More than one " + XACML3.ID_RESOURCE_SCOPE.stringValue()
+ " attribute");
}
Iterator<AttributeValue<?>> iterAttributeValuesScope = attributeScope.getValues().iterator();
if (!iterAttributeValuesScope.hasNext()) {
throw new ScopeResolverException("No values for " + XACML3.ID_RESOURCE_SCOPE.stringValue()
+ " atribute");
}
ScopeQualifier scopeQualifier = null;
while (scopeQualifier == null && iterAttributeValuesScope.hasNext()) {
AttributeValue<?> attributeValueScope = iterAttributeValuesScope.next();
AttributeValue<String> attributeValueScopeString = null;
try {
attributeValueScopeString = DataTypes.DT_STRING.convertAttributeValue(attributeValueScope);
if (attributeValueScopeString != null) {
scopeQualifier = ScopeQualifier.getScopeQualifier(attributeValueScopeString.getValue());
}
} catch (Exception ex) { //NOPMD
}
}
if (scopeQualifier == null) {
throw new ScopeResolverException("No valid values for " + XACML3.ID_RESOURCE_SCOPE.stringValue()
+ " attribute");
}
return scopeQualifier;
}
|
static ScopeQualifier function(RequestAttributes requestAttributes) throws ScopeResolverException { Iterator<Attribute> iterAttributesScope = requestAttributes.getAttributes(XACML3.ID_RESOURCE_SCOPE); if (iterAttributesScope == null !iterAttributesScope.hasNext()) { return null; } Attribute attributeScope = iterAttributesScope.next(); if (iterAttributesScope.hasNext()) { throw new ScopeResolverException(STR + XACML3.ID_RESOURCE_SCOPE.stringValue() + STR); } Iterator<AttributeValue<?>> iterAttributeValuesScope = attributeScope.getValues().iterator(); if (!iterAttributeValuesScope.hasNext()) { throw new ScopeResolverException(STR + XACML3.ID_RESOURCE_SCOPE.stringValue() + STR); } ScopeQualifier scopeQualifier = null; while (scopeQualifier == null && iterAttributeValuesScope.hasNext()) { AttributeValue<?> attributeValueScope = iterAttributeValuesScope.next(); AttributeValue<String> attributeValueScopeString = null; try { attributeValueScopeString = DataTypes.DT_STRING.convertAttributeValue(attributeValueScope); if (attributeValueScopeString != null) { scopeQualifier = ScopeQualifier.getScopeQualifier(attributeValueScopeString.getValue()); } } catch (Exception ex) { } } if (scopeQualifier == null) { throw new ScopeResolverException(STR + XACML3.ID_RESOURCE_SCOPE.stringValue() + STR); } return scopeQualifier; }
|
/**
* Gets the <code>ScopeQualifier</code> specified in the given <code>RequestAttributes</code>.
*
* @param requestAttributes
* @return
* @throws org.apache.openaz.xacml.api.pdp.ScopeResolverException
*/
|
Gets the <code>ScopeQualifier</code> specified in the given <code>RequestAttributes</code>
|
getScopeQualifier
|
{
"repo_name": "phrinx/incubator-openaz",
"path": "openaz-xacml/src/main/java/org/apache/openaz/xacml/std/StdIndividualDecisionRequestGenerator.java",
"license": "apache-2.0",
"size": 35575
}
|
[
"java.util.Iterator",
"org.apache.openaz.xacml.api.Attribute",
"org.apache.openaz.xacml.api.AttributeValue",
"org.apache.openaz.xacml.api.RequestAttributes",
"org.apache.openaz.xacml.api.pdp.ScopeQualifier",
"org.apache.openaz.xacml.api.pdp.ScopeResolverException",
"org.apache.openaz.xacml.std.datatypes.DataTypes"
] |
import java.util.Iterator; import org.apache.openaz.xacml.api.Attribute; import org.apache.openaz.xacml.api.AttributeValue; import org.apache.openaz.xacml.api.RequestAttributes; import org.apache.openaz.xacml.api.pdp.ScopeQualifier; import org.apache.openaz.xacml.api.pdp.ScopeResolverException; import org.apache.openaz.xacml.std.datatypes.DataTypes;
|
import java.util.*; import org.apache.openaz.xacml.api.*; import org.apache.openaz.xacml.api.pdp.*; import org.apache.openaz.xacml.std.datatypes.*;
|
[
"java.util",
"org.apache.openaz"
] |
java.util; org.apache.openaz;
| 314,886
|
public void setClass (String clazz, boolean reviews)
{
if (clazz.equals ("correct")) {
enableIgnoreButton (false);
disable (correctFG, correctBG);
} else if (clazz.equals ("incorrect")) {
if (PrefManager.getAutoPopup())
errorPopup ();
if (PrefManager.getMistakeDelay())
wv.js (MistakeDelay.JS_MISTAKE);
enableIgnoreButton (reviews && PrefManager.getIgnoreButton());
disable (incorrectFG, incorrectBG);
} else if (clazz.equals ("WKO_ignored")) {
enableIgnoreButton (false);
disable (ignoredFG, ignoredBG);
}
}
|
void function (String clazz, boolean reviews) { if (clazz.equals (STR)) { enableIgnoreButton (false); disable (correctFG, correctBG); } else if (clazz.equals (STR)) { if (PrefManager.getAutoPopup()) errorPopup (); if (PrefManager.getMistakeDelay()) wv.js (MistakeDelay.JS_MISTAKE); enableIgnoreButton (reviews && PrefManager.getIgnoreButton()); disable (incorrectFG, incorrectBG); } else if (clazz.equals (STR)) { enableIgnoreButton (false); disable (ignoredFG, ignoredBG); } }
|
/**
* Called when the HTML textbox changes class. It changes the edit text accordingly.
* @param clazz the CSS class
* @param reviews if we are reviewing
*/
|
Called when the HTML textbox changes class. It changes the edit text accordingly
|
setClass
|
{
"repo_name": "xiprox/WaniKani-for-Android",
"path": "WaniKani/src/tr/xip/wanikani/LocalIMEKeyboard.java",
"license": "gpl-3.0",
"size": 51741
}
|
[
"tr.xip.wanikani.managers.PrefManager",
"tr.xip.wanikani.userscripts.MistakeDelay"
] |
import tr.xip.wanikani.managers.PrefManager; import tr.xip.wanikani.userscripts.MistakeDelay;
|
import tr.xip.wanikani.managers.*; import tr.xip.wanikani.userscripts.*;
|
[
"tr.xip.wanikani"
] |
tr.xip.wanikani;
| 2,332,025
|
@NotNull
Collection<Instruction> allPred();
|
Collection<Instruction> allPred();
|
/**
* Incoming edges
*/
|
Incoming edges
|
allPred
|
{
"repo_name": "leafclick/intellij-community",
"path": "platform/core-api/src/com/intellij/codeInsight/controlflow/Instruction.java",
"license": "apache-2.0",
"size": 1631
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,835,416
|
public void testReleaseConnectionFailed ()
throws Exception
{
// connect
mHttpConnection.establishConnection(
DEFAULT_URL,
CONNECT_TIMEOUT, READ_TIMEOUT);
// set message 1
HttpRequestResponseHeader header = new HttpRequestResponseHeader();
header.addRequestHeader(
CONTENT_TYPE_PARAMETER, CONTENT_TYPE_PARAMETER_VALUE);
header.addRequestHeader(
"Message1", "Nachricht 1");
mHttpConnection.setRequestResponseHeader(header);
mHttpConnection.setRequestBody(
new ByteArrayInputStream("This is message one".getBytes()));
// send message 1
mHttpConnection.execute();
// set message 2
header = new HttpRequestResponseHeader();
header.addRequestHeader(
CONTENT_TYPE_PARAMETER, CONTENT_TYPE_PARAMETER_VALUE);
header.addRequestHeader(
"Message2", "Nachricht 2");
mHttpConnection.setRequestResponseHeader(header);
// send message 2
try
{
mHttpConnection.execute();
fail(ILLEGALSTATEEXCEPTION_EXPECTED);
}
catch (IllegalStateException ise)
{
assertEquals(ILLEGAL_STATE_MESSAGE_NOT_LIKE_EXPECTED,
CONNECTION_MUST_BE_ESTABLISHED_OR_RELEASED,
ise.getMessage());
}
// close
mHttpConnection.closeConnection();
}
|
void function () throws Exception { mHttpConnection.establishConnection( DEFAULT_URL, CONNECT_TIMEOUT, READ_TIMEOUT); HttpRequestResponseHeader header = new HttpRequestResponseHeader(); header.addRequestHeader( CONTENT_TYPE_PARAMETER, CONTENT_TYPE_PARAMETER_VALUE); header.addRequestHeader( STR, STR); mHttpConnection.setRequestResponseHeader(header); mHttpConnection.setRequestBody( new ByteArrayInputStream(STR.getBytes())); mHttpConnection.execute(); header = new HttpRequestResponseHeader(); header.addRequestHeader( CONTENT_TYPE_PARAMETER, CONTENT_TYPE_PARAMETER_VALUE); header.addRequestHeader( STR, STR); mHttpConnection.setRequestResponseHeader(header); try { mHttpConnection.execute(); fail(ILLEGALSTATEEXCEPTION_EXPECTED); } catch (IllegalStateException ise) { assertEquals(ILLEGAL_STATE_MESSAGE_NOT_LIKE_EXPECTED, CONNECTION_MUST_BE_ESTABLISHED_OR_RELEASED, ise.getMessage()); } mHttpConnection.closeConnection(); }
|
/**
* Tests error case with a missing "releaseConnection" call before reusing
* an already opened connection.
* @throws Exception if the test case fails with an exception.
*/
|
Tests error case with a missing "releaseConnection" call before reusing an already opened connection
|
testReleaseConnectionFailed
|
{
"repo_name": "jCoderZ/fawkez-old",
"path": "test/java/org/jcoderz/commons/connector/http/transport/HttpClientConnectionTest.java",
"license": "bsd-3-clause",
"size": 29513
}
|
[
"java.io.ByteArrayInputStream"
] |
import java.io.ByteArrayInputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 784,876
|
protected boolean isBearerTokenRequest(HttpServletRequest request) {
String authValue = request.getHeader(AUTHORIZATION_HEADER);
return authValue != null && authValue.startsWith("Bearer");
}
|
boolean function(HttpServletRequest request) { String authValue = request.getHeader(AUTHORIZATION_HEADER); return authValue != null && authValue.startsWith(STR); }
|
/**
* Returns true if the request was made with a bearer token authorization header.
*
* @param request the current <code>HttpServletRequest</code>
*
* @return <code>true</code> if the <code>request</code> was made with a bearer token authorization header;
* <code>false</code> otherwise.
*/
|
Returns true if the request was made with a bearer token authorization header
|
isBearerTokenRequest
|
{
"repo_name": "lkubik/keycloak",
"path": "adapters/oidc/spring-security/src/main/java/org/keycloak/adapters/springsecurity/filter/KeycloakAuthenticationProcessingFilter.java",
"license": "apache-2.0",
"size": 12245
}
|
[
"javax.servlet.http.HttpServletRequest"
] |
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.*;
|
[
"javax.servlet"
] |
javax.servlet;
| 2,579,261
|
if((strArray != null) && (value != null))
return Arrays.asList(strArray).contains(value);
return false;
}
|
if((strArray != null) && (value != null)) return Arrays.asList(strArray).contains(value); return false; }
|
/**
* Arr contains.
*
* @param strArray the str array
* @param value the value
* @return true, if successful
*/
|
Arr contains
|
arrContains
|
{
"repo_name": "rivetlogic/liferay-announcer",
"path": "portlets/announcer-portlet/docroot/WEB-INF/src/com/rivetlogic/jstl/Functions.java",
"license": "gpl-3.0",
"size": 1162
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,722,220
|
@Test
@Tag("slow")
public void testSTOCFOR2() {
CuteNetlibCase.doTest("STOCFOR2.SIF", "-39024.4085378819", null, NumberContext.of(7, 4));
}
|
@Tag("slow") void function() { CuteNetlibCase.doTest(STR, STR, null, NumberContext.of(7, 4)); }
|
/**
* <pre>
* 2019-02-13: Tagged as slow since too large for promotional/community version of CPLEX
* 2019-02-14: Objective defined by ojAlgo's current result
* </pre>
*/
|
<code> 2019-02-13: Tagged as slow since too large for promotional/community version of CPLEX 2019-02-14: Objective defined by ojAlgo's current result </code>
|
testSTOCFOR2
|
{
"repo_name": "optimatika/ojAlgo",
"path": "src/test/java/org/ojalgo/optimisation/linear/CuteNetlibCase.java",
"license": "mit",
"size": 42381
}
|
[
"org.junit.jupiter.api.Tag",
"org.ojalgo.type.context.NumberContext"
] |
import org.junit.jupiter.api.Tag; import org.ojalgo.type.context.NumberContext;
|
import org.junit.jupiter.api.*; import org.ojalgo.type.context.*;
|
[
"org.junit.jupiter",
"org.ojalgo.type"
] |
org.junit.jupiter; org.ojalgo.type;
| 1,383,555
|
public static void addNodePointerFactory(NodePointerFactory factory) {
synchronized (nodeFactories) {
nodeFactories.add(factory);
nodeFactoryArray = null;
}
}
|
static void function(NodePointerFactory factory) { synchronized (nodeFactories) { nodeFactories.add(factory); nodeFactoryArray = null; } }
|
/**
* Call this with a custom NodePointerFactory to add support for
* additional types of objects. Make sure the factory returns
* a name that puts it in the right position on the list of factories.
* @param factory NodePointerFactory to add
*/
|
Call this with a custom NodePointerFactory to add support for additional types of objects. Make sure the factory returns a name that puts it in the right position on the list of factories
|
addNodePointerFactory
|
{
"repo_name": "mohanaraosv/commons-jxpath",
"path": "src/java/org/apache/commons/jxpath/ri/JXPathContextReferenceImpl.java",
"license": "apache-2.0",
"size": 27778
}
|
[
"org.apache.commons.jxpath.ri.model.NodePointerFactory"
] |
import org.apache.commons.jxpath.ri.model.NodePointerFactory;
|
import org.apache.commons.jxpath.ri.model.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 1,101,107
|
void scan(final String[] packages,
final ClassVisitor classVisitor)
throws IllegalArgumentException;
|
void scan(final String[] packages, final ClassVisitor classVisitor) throws IllegalArgumentException;
|
/**
* Scan specified packages and use the {@link ClassVisitor} provided to
* gather necessary information.
* @param packages The packages to scan classes for.
* @param classVisitor The visitor which will visit the classes in the
* packages for extracting the information it needs.
* @throws java.lang.IllegalArgumentException If either of them is null or
* packages is empty.
*/
|
Scan specified packages and use the <code>ClassVisitor</code> provided to gather necessary information
|
scan
|
{
"repo_name": "SmartITEngineering/smart-util",
"path": "simple-util/src/main/java/com/smartitengineering/util/simple/reflection/ClassScanner.java",
"license": "lgpl-3.0",
"size": 2312
}
|
[
"org.objectweb.asm.ClassVisitor"
] |
import org.objectweb.asm.ClassVisitor;
|
import org.objectweb.asm.*;
|
[
"org.objectweb.asm"
] |
org.objectweb.asm;
| 197,500
|
@Test
public void testRefreshToken() {
ApplicationContext context =
TEST_DATA_RESOURCE
.getSecondaryApplication()
.getBuilder()
.client(ClientType.AuthorizationGrant, true)
.bearerToken()
.refreshToken()
.build();
OAuthToken t = context.getToken();
String header = authHeaderBearer(t.getId());
Response r = target("/token/private")
.request()
.header(AUTHORIZATION, header)
.get();
assertEquals(Status.UNAUTHORIZED.getStatusCode(), r.getStatus());
}
|
void function() { ApplicationContext context = TEST_DATA_RESOURCE .getSecondaryApplication() .getBuilder() .client(ClientType.AuthorizationGrant, true) .bearerToken() .refreshToken() .build(); OAuthToken t = context.getToken(); String header = authHeaderBearer(t.getId()); Response r = target(STR) .request() .header(AUTHORIZATION, header) .get(); assertEquals(Status.UNAUTHORIZED.getStatusCode(), r.getStatus()); }
|
/**
* Assert that refresh tokens are not permitted.
*/
|
Assert that refresh tokens are not permitted
|
testRefreshToken
|
{
"repo_name": "kangaroo-server/kangaroo",
"path": "kangaroo-server-authz/src/test/java/net/krotscheck/kangaroo/authz/oauth2/authn/authn/O2BearerTokenFilterTest.java",
"license": "apache-2.0",
"size": 11926
}
|
[
"javax.ws.rs.core.Response",
"net.krotscheck.kangaroo.authz.common.database.entity.ClientType",
"net.krotscheck.kangaroo.authz.common.database.entity.OAuthToken",
"net.krotscheck.kangaroo.authz.test.ApplicationBuilder",
"net.krotscheck.kangaroo.util.HttpUtil",
"org.junit.Assert"
] |
import javax.ws.rs.core.Response; import net.krotscheck.kangaroo.authz.common.database.entity.ClientType; import net.krotscheck.kangaroo.authz.common.database.entity.OAuthToken; import net.krotscheck.kangaroo.authz.test.ApplicationBuilder; import net.krotscheck.kangaroo.util.HttpUtil; import org.junit.Assert;
|
import javax.ws.rs.core.*; import net.krotscheck.kangaroo.authz.common.database.entity.*; import net.krotscheck.kangaroo.authz.test.*; import net.krotscheck.kangaroo.util.*; import org.junit.*;
|
[
"javax.ws",
"net.krotscheck.kangaroo",
"org.junit"
] |
javax.ws; net.krotscheck.kangaroo; org.junit;
| 2,704,205
|
private static MethodDescriptionComposite getBaseMethod(MethodDescriptionComposite mdc,
int index, ArrayList<MethodDescriptionComposite> methodList,
Map<String, Integer> hierarchyMap) {
int baseLevel = hierarchyMap.get(mdc.getDeclaringClass());
if (log.isDebugEnabled()) {
log.debug("Base method: " + mdc.getMethodName() + " initial level: " + baseLevel);
}
for (; index < methodList.size(); index++) {
MethodDescriptionComposite compareMDC = methodList.get(index);
// If the two methods are the same method that means we have found an inherited
// overridden case
if (mdc.equals(compareMDC)) {
if (log.isDebugEnabled()) {
log.debug("Found equivalent methods: " + mdc.getMethodName());
}
// get the declaration level of the method we are comparing to
int compareLevel = hierarchyMap.get(compareMDC.getDeclaringClass());
// if the method was declared by a class in a lower level of the hierarchy it
// becomes the method that we will compare other methods to
if (compareLevel < baseLevel) {
if (log.isDebugEnabled()) {
log.debug("Found method lower in hierarchy chain: "
+ compareMDC.getMethodName() + " of class: "
+ compareMDC.getMethodName());
}
mdc = compareMDC;
baseLevel = compareLevel;
}
}
}
return mdc;
}
|
static MethodDescriptionComposite function(MethodDescriptionComposite mdc, int index, ArrayList<MethodDescriptionComposite> methodList, Map<String, Integer> hierarchyMap) { int baseLevel = hierarchyMap.get(mdc.getDeclaringClass()); if (log.isDebugEnabled()) { log.debug(STR + mdc.getMethodName() + STR + baseLevel); } for (; index < methodList.size(); index++) { MethodDescriptionComposite compareMDC = methodList.get(index); if (mdc.equals(compareMDC)) { if (log.isDebugEnabled()) { log.debug(STR + mdc.getMethodName()); } int compareLevel = hierarchyMap.get(compareMDC.getDeclaringClass()); if (compareLevel < baseLevel) { if (log.isDebugEnabled()) { log.debug(STR + compareMDC.getMethodName() + STR + compareMDC.getMethodName()); } mdc = compareMDC; baseLevel = compareLevel; } } } return mdc; }
|
/**
* This method is responsible for determining the most basic level of a method declaration in
* the <code>DescriptionBuilderComposite</code> hierarchy.
*
* @param mdc - <code>MethodDescriptionComposite</code> current method
* @param index - <code>int</code> current location in method list
* @param methodList - <code>List</code> list of methods available on this composite
* @param hierarchyMap - <code>HashMap</code> map that represents the hierarchy of the current
* <code>DescriptionBuilderComposite</code>
* @return - <code>MethodDescriptionComposite</code> most basic method declaration
*/
|
This method is responsible for determining the most basic level of a method declaration in the <code>DescriptionBuilderComposite</code> hierarchy
|
getBaseMethod
|
{
"repo_name": "jsdjayanga/wso2-axis2",
"path": "modules/metadata/src/org/apache/axis2/jaxws/description/MethodRetriever.java",
"license": "apache-2.0",
"size": 12706
}
|
[
"java.util.ArrayList",
"java.util.Map",
"org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite"
] |
import java.util.ArrayList; import java.util.Map; import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
|
import java.util.*; import org.apache.axis2.jaxws.description.builder.*;
|
[
"java.util",
"org.apache.axis2"
] |
java.util; org.apache.axis2;
| 292,525
|
@Override
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
super.collectNewChildDescriptors(newChildDescriptors, object);
}
|
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
|
/**
* This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
* that can be created under this object.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
|
collectNewChildDescriptors
|
{
"repo_name": "KAMP-Research/KAMP4APS",
"path": "edu.kit.ipd.sdq.kamp4aps.aps.edit/src/edu/kit/ipd/sdq/kamp4aps/model/aPS/StructureRepository/provider/PowerNetworkItemProvider.java",
"license": "apache-2.0",
"size": 2796
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,715,431
|
public void clearStore() {
if (store == null)
return;
try {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
AccessController.doPrivileged(new PrivilegedStoreClear());
}catch(PrivilegedActionException ex){
Exception exception = ex.getException();
log.error("Exception clearing the Store: " + exception,
exception);
}
} else {
store.clear();
}
} catch (IOException e) {
log.error("Exception clearing the Store: " + e, e);
}
}
|
void function() { if (store == null) return; try { if (SecurityUtil.isPackageProtectionEnabled()){ try{ AccessController.doPrivileged(new PrivilegedStoreClear()); }catch(PrivilegedActionException ex){ Exception exception = ex.getException(); log.error(STR + exception, exception); } } else { store.clear(); } } catch (IOException e) { log.error(STR + e, e); } }
|
/**
* Clear all sessions from the Store.
*/
|
Clear all sessions from the Store
|
clearStore
|
{
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.0/PersistentManagerBase.java",
"license": "mit",
"size": 32842
}
|
[
"java.io.IOException",
"java.security.AccessController",
"java.security.PrivilegedActionException",
"org.apache.catalina.security.SecurityUtil"
] |
import java.io.IOException; import java.security.AccessController; import java.security.PrivilegedActionException; import org.apache.catalina.security.SecurityUtil;
|
import java.io.*; import java.security.*; import org.apache.catalina.security.*;
|
[
"java.io",
"java.security",
"org.apache.catalina"
] |
java.io; java.security; org.apache.catalina;
| 2,752,210
|
public Logger getLog() {
return log;
}
|
Logger function() { return log; }
|
/**
* Get the logger for the web server.
*
* @return the logger
*/
|
Get the logger for the web server
|
getLog
|
{
"repo_name": "kmhughes/robotbrains-examples",
"path": "data/cloud/scala/org.robotbrains.data.cloud.timeseries.server/src/main/scala/org/robotbrains/support/web/server/netty/NettyWebServer.java",
"license": "apache-2.0",
"size": 14026
}
|
[
"org.apache.logging.log4j.Logger"
] |
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.*;
|
[
"org.apache.logging"
] |
org.apache.logging;
| 2,317,338
|
public static String resolveIdWithEmbedPlayer(String url) throws IOException, ReCaptchaException, ParsingException {
String response = NewPipe.getDownloader().download("https://w.soundcloud.com/player/?url="
+ URLEncoder.encode(url, "UTF-8"));
return Parser.matchGroup1(",\"id\":(.*?),", response);
}
|
static String function(String url) throws IOException, ReCaptchaException, ParsingException { String response = NewPipe.getDownloader().download(STRUTF-8STR,\"id\":(.*?),", response); }
|
/**
* Fetch the embed player with the url and return the id (like the id from the json api).
*
* @return the id resolved
*/
|
Fetch the embed player with the url and return the id (like the id from the json api)
|
resolveIdWithEmbedPlayer
|
{
"repo_name": "ram-on/extractor",
"path": "src/main/java/org/schabi/newpipe/extractor/services/soundcloud/SoundcloudParsingHelper.java",
"license": "gpl-3.0",
"size": 6793
}
|
[
"java.io.IOException",
"org.schabi.newpipe.extractor.NewPipe",
"org.schabi.newpipe.extractor.exceptions.ParsingException",
"org.schabi.newpipe.extractor.exceptions.ReCaptchaException"
] |
import java.io.IOException; import org.schabi.newpipe.extractor.NewPipe; import org.schabi.newpipe.extractor.exceptions.ParsingException; import org.schabi.newpipe.extractor.exceptions.ReCaptchaException;
|
import java.io.*; import org.schabi.newpipe.extractor.*; import org.schabi.newpipe.extractor.exceptions.*;
|
[
"java.io",
"org.schabi.newpipe"
] |
java.io; org.schabi.newpipe;
| 400,785
|
return dateRange;
}
/**
* Sets the value of the dateRange property.
*
* @param value
* allowed object is
* {@link DateRange }
|
return dateRange; } /** * Sets the value of the dateRange property. * * @param value * allowed object is * {@link DateRange }
|
/**
* Gets the value of the dateRange property.
*
* @return
* possible object is
* {@link DateRange }
*
*/
|
Gets the value of the dateRange property
|
getDateRange
|
{
"repo_name": "nafae/developer",
"path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201402/video/StatsSelector.java",
"license": "apache-2.0",
"size": 6641
}
|
[
"com.google.api.ads.adwords.jaxws.v201402.cm.DateRange"
] |
import com.google.api.ads.adwords.jaxws.v201402.cm.DateRange;
|
import com.google.api.ads.adwords.jaxws.v201402.cm.*;
|
[
"com.google.api"
] |
com.google.api;
| 1,876,589
|
public void fireSelectionEvent(Collection<Object> oldSelection,
Collection<Object> newSelection) {
fireEvent(new SelectionEvent(this, oldSelection, newSelection));
}
|
void function(Collection<Object> oldSelection, Collection<Object> newSelection) { fireEvent(new SelectionEvent(this, oldSelection, newSelection)); }
|
/**
* Fires a selection change event.
* <p>
* <strong>Note:</strong> This is not a method that should be called by
* application logic. This method is publicly accessible only so that
* {@link SelectionModel SelectionModels} would be able to inform Grid of
* these events.
*
* @param newSelection
* the selection that was added by this event
* @param oldSelection
* the selection that was removed by this event
*/
|
Fires a selection change event. Note: This is not a method that should be called by application logic. This method is publicly accessible only so that <code>SelectionModel SelectionModels</code> would be able to inform Grid of these events
|
fireSelectionEvent
|
{
"repo_name": "mittop/vaadin",
"path": "server/src/com/vaadin/ui/Grid.java",
"license": "apache-2.0",
"size": 222421
}
|
[
"com.vaadin.event.SelectionEvent",
"java.util.Collection"
] |
import com.vaadin.event.SelectionEvent; import java.util.Collection;
|
import com.vaadin.event.*; import java.util.*;
|
[
"com.vaadin.event",
"java.util"
] |
com.vaadin.event; java.util;
| 2,486,679
|
public final static CMObjectType getType(final Object O)
{
if(O instanceof Race) return CMObjectType.RACE;
if(O instanceof CharClass) return CMObjectType.CHARCLASS;
if(O instanceof Ability) return CMObjectType.ABILITY;
if(O instanceof Room) return CMObjectType.LOCALE;
if(O instanceof MOB) return CMObjectType.MOB;
if(O instanceof Exit) return CMObjectType.EXIT;
if(O instanceof Behavior) return CMObjectType.BEHAVIOR;
if(O instanceof WebMacro) return CMObjectType.WEBMACRO;
if(O instanceof Area) return CMObjectType.AREA;
if(O instanceof CMLibrary) return CMObjectType.LIBRARY;
if(O instanceof CMCommon) return CMObjectType.COMMON;
if(O instanceof Command) return CMObjectType.COMMAND;
if(O instanceof Clan) return CMObjectType.CLAN;
if(O instanceof ClanItem) return CMObjectType.CLANITEM;
if(O instanceof MiscMagic) return CMObjectType.MISCMAGIC;
if(O instanceof Armor) return CMObjectType.ARMOR;
if(O instanceof Weapon) return CMObjectType.WEAPON;
if(O instanceof Item) return CMObjectType.ITEM;
if(O instanceof Software) return CMObjectType.SOFTWARE;
if(O instanceof ShipComponent) return CMObjectType.SHIPTECH;
if(O instanceof Electronics) return CMObjectType.TECH;
return null;
}
|
final static CMObjectType function(final Object O) { if(O instanceof Race) return CMObjectType.RACE; if(O instanceof CharClass) return CMObjectType.CHARCLASS; if(O instanceof Ability) return CMObjectType.ABILITY; if(O instanceof Room) return CMObjectType.LOCALE; if(O instanceof MOB) return CMObjectType.MOB; if(O instanceof Exit) return CMObjectType.EXIT; if(O instanceof Behavior) return CMObjectType.BEHAVIOR; if(O instanceof WebMacro) return CMObjectType.WEBMACRO; if(O instanceof Area) return CMObjectType.AREA; if(O instanceof CMLibrary) return CMObjectType.LIBRARY; if(O instanceof CMCommon) return CMObjectType.COMMON; if(O instanceof Command) return CMObjectType.COMMAND; if(O instanceof Clan) return CMObjectType.CLAN; if(O instanceof ClanItem) return CMObjectType.CLANITEM; if(O instanceof MiscMagic) return CMObjectType.MISCMAGIC; if(O instanceof Armor) return CMObjectType.ARMOR; if(O instanceof Weapon) return CMObjectType.WEAPON; if(O instanceof Item) return CMObjectType.ITEM; if(O instanceof Software) return CMObjectType.SOFTWARE; if(O instanceof ShipComponent) return CMObjectType.SHIPTECH; if(O instanceof Electronics) return CMObjectType.TECH; return null; }
|
/**
* Returns the object type of the given object
* @see com.suscipio_solutions.consecro_mud.core.CMClass.CMObjectType
* @param O the object to inspect
* @return the cmobjectype type
*/
|
Returns the object type of the given object
|
getType
|
{
"repo_name": "ConsecroMUD/ConsecroMUD",
"path": "com/suscipio_solutions/consecro_mud/core/CMClass.java",
"license": "apache-2.0",
"size": 105821
}
|
[
"com.suscipio_solutions.consecro_mud.Abilities",
"com.suscipio_solutions.consecro_mud.Areas",
"com.suscipio_solutions.consecro_mud.Behaviors",
"com.suscipio_solutions.consecro_mud.CharClasses",
"com.suscipio_solutions.consecro_mud.Commands",
"com.suscipio_solutions.consecro_mud.Common",
"com.suscipio_solutions.consecro_mud.Exits",
"com.suscipio_solutions.consecro_mud.Items",
"com.suscipio_solutions.consecro_mud.Libraries",
"com.suscipio_solutions.consecro_mud.Locales",
"com.suscipio_solutions.consecro_mud.Races",
"com.suscipio_solutions.consecro_mud.WebMacros"
] |
import com.suscipio_solutions.consecro_mud.Abilities; import com.suscipio_solutions.consecro_mud.Areas; import com.suscipio_solutions.consecro_mud.Behaviors; import com.suscipio_solutions.consecro_mud.CharClasses; import com.suscipio_solutions.consecro_mud.Commands; import com.suscipio_solutions.consecro_mud.Common; import com.suscipio_solutions.consecro_mud.Exits; import com.suscipio_solutions.consecro_mud.Items; import com.suscipio_solutions.consecro_mud.Libraries; import com.suscipio_solutions.consecro_mud.Locales; import com.suscipio_solutions.consecro_mud.Races; import com.suscipio_solutions.consecro_mud.WebMacros;
|
import com.suscipio_solutions.consecro_mud.*;
|
[
"com.suscipio_solutions.consecro_mud"
] |
com.suscipio_solutions.consecro_mud;
| 250,881
|
JComboBox cb = (JComboBox)e.getSource();
Locale selectedLocale = (Locale)cb.getSelectedItem();
// update the tool tip
final String newToolTipMessage = formatLocale( selectedLocale );
cb.setToolTipText( newToolTipMessage );
}
|
JComboBox cb = (JComboBox)e.getSource(); Locale selectedLocale = (Locale)cb.getSelectedItem(); final String newToolTipMessage = formatLocale( selectedLocale ); cb.setToolTipText( newToolTipMessage ); }
|
/**
* update the tool tip text, as the selection has changed
*/
|
update the tool tip text, as the selection has changed
|
actionPerformed
|
{
"repo_name": "bernhardhuber/netbeansplugins",
"path": "nb-locale/src/org/huberb/localenb/LocaleToolTipActionListener.java",
"license": "apache-2.0",
"size": 2652
}
|
[
"java.util.Locale",
"javax.swing.JComboBox"
] |
import java.util.Locale; import javax.swing.JComboBox;
|
import java.util.*; import javax.swing.*;
|
[
"java.util",
"javax.swing"
] |
java.util; javax.swing;
| 2,127,921
|
@SuppressWarnings("deprecation")
private void useRoundRobinLists(
List<DropEntry> newDropList, List<BackendAddressGroup> newBackendAddrList,
@Nullable GrpclbClientLoadRecorder loadRecorder) {
logger.log(
ChannelLogLevel.INFO, "Using RR list={0}, drop={1}", newBackendAddrList, newDropList);
HashMap<List<EquivalentAddressGroup>, Subchannel> newSubchannelMap =
new HashMap<>();
List<BackendEntry> newBackendList = new ArrayList<>();
switch (mode) {
case ROUND_ROBIN:
for (BackendAddressGroup backendAddr : newBackendAddrList) {
EquivalentAddressGroup eag = backendAddr.getAddresses();
List<EquivalentAddressGroup> eagAsList = Collections.singletonList(eag);
Subchannel subchannel = newSubchannelMap.get(eagAsList);
if (subchannel == null) {
subchannel = subchannels.get(eagAsList);
if (subchannel == null) {
subchannel = subchannelPool.takeOrCreateSubchannel(eag, createSubchannelAttrs());
subchannel.requestConnection();
}
newSubchannelMap.put(eagAsList, subchannel);
}
BackendEntry entry;
// Only picks with tokens are reported to LoadRecorder
if (backendAddr.getToken() == null) {
entry = new BackendEntry(subchannel);
} else {
entry = new BackendEntry(subchannel, loadRecorder, backendAddr.getToken());
}
newBackendList.add(entry);
}
// Close Subchannels whose addresses have been delisted
for (Entry<List<EquivalentAddressGroup>, Subchannel> entry : subchannels.entrySet()) {
List<EquivalentAddressGroup> eagList = entry.getKey();
if (!newSubchannelMap.containsKey(eagList)) {
returnSubchannelToPool(entry.getValue());
}
}
subchannels = Collections.unmodifiableMap(newSubchannelMap);
break;
case PICK_FIRST:
int numOfEags = newBackendAddrList.size();
List<EquivalentAddressGroup> eagList = Arrays.asList(new EquivalentAddressGroup[numOfEags]);
// Because for PICK_FIRST, we create a single Subchannel for all addresses, we have to
// attach the tokens to the EAG attributes and use TokenAttachingLoadRecorder to put them on
// headers.
//
// The PICK_FIRST code path doesn't cache Subchannels.
int offset = pickFirstIndex;
for (BackendAddressGroup bag : newBackendAddrList) {
EquivalentAddressGroup origEag = bag.getAddresses();
Attributes eagAttrs = origEag.getAttributes();
if (bag.getToken() != null) {
eagAttrs = eagAttrs.toBuilder()
.set(GrpclbConstants.TOKEN_ATTRIBUTE_KEY, bag.getToken()).build();
}
eagList.set(
offset++ % numOfEags,
new EquivalentAddressGroup(origEag.getAddresses(), eagAttrs));
}
Subchannel subchannel;
if (subchannels.isEmpty()) {
// TODO(zhangkun83): remove the deprecation suppression on this method once migrated to
// the new createSubchannel().
subchannel = helper.createSubchannel(eagList, createSubchannelAttrs());
} else {
checkState(subchannels.size() == 1, "Unexpected Subchannel count: %s", subchannels);
subchannel = subchannels.values().iterator().next();
subchannel.updateAddresses(eagList);
}
subchannels = Collections.singletonMap(eagList, subchannel);
newBackendList.add(
new BackendEntry(subchannel, new TokenAttachingTracerFactory(loadRecorder)));
break;
default:
throw new AssertionError("Missing case for " + mode);
}
dropList = Collections.unmodifiableList(newDropList);
backendList = Collections.unmodifiableList(newBackendList);
}
|
@SuppressWarnings(STR) void function( List<DropEntry> newDropList, List<BackendAddressGroup> newBackendAddrList, @Nullable GrpclbClientLoadRecorder loadRecorder) { logger.log( ChannelLogLevel.INFO, STR, newBackendAddrList, newDropList); HashMap<List<EquivalentAddressGroup>, Subchannel> newSubchannelMap = new HashMap<>(); List<BackendEntry> newBackendList = new ArrayList<>(); switch (mode) { case ROUND_ROBIN: for (BackendAddressGroup backendAddr : newBackendAddrList) { EquivalentAddressGroup eag = backendAddr.getAddresses(); List<EquivalentAddressGroup> eagAsList = Collections.singletonList(eag); Subchannel subchannel = newSubchannelMap.get(eagAsList); if (subchannel == null) { subchannel = subchannels.get(eagAsList); if (subchannel == null) { subchannel = subchannelPool.takeOrCreateSubchannel(eag, createSubchannelAttrs()); subchannel.requestConnection(); } newSubchannelMap.put(eagAsList, subchannel); } BackendEntry entry; if (backendAddr.getToken() == null) { entry = new BackendEntry(subchannel); } else { entry = new BackendEntry(subchannel, loadRecorder, backendAddr.getToken()); } newBackendList.add(entry); } for (Entry<List<EquivalentAddressGroup>, Subchannel> entry : subchannels.entrySet()) { List<EquivalentAddressGroup> eagList = entry.getKey(); if (!newSubchannelMap.containsKey(eagList)) { returnSubchannelToPool(entry.getValue()); } } subchannels = Collections.unmodifiableMap(newSubchannelMap); break; case PICK_FIRST: int numOfEags = newBackendAddrList.size(); List<EquivalentAddressGroup> eagList = Arrays.asList(new EquivalentAddressGroup[numOfEags]); int offset = pickFirstIndex; for (BackendAddressGroup bag : newBackendAddrList) { EquivalentAddressGroup origEag = bag.getAddresses(); Attributes eagAttrs = origEag.getAttributes(); if (bag.getToken() != null) { eagAttrs = eagAttrs.toBuilder() .set(GrpclbConstants.TOKEN_ATTRIBUTE_KEY, bag.getToken()).build(); } eagList.set( offset++ % numOfEags, new EquivalentAddressGroup(origEag.getAddresses(), eagAttrs)); } Subchannel subchannel; if (subchannels.isEmpty()) { subchannel = helper.createSubchannel(eagList, createSubchannelAttrs()); } else { checkState(subchannels.size() == 1, STR, subchannels); subchannel = subchannels.values().iterator().next(); subchannel.updateAddresses(eagList); } subchannels = Collections.singletonMap(eagList, subchannel); newBackendList.add( new BackendEntry(subchannel, new TokenAttachingTracerFactory(loadRecorder))); break; default: throw new AssertionError(STR + mode); } dropList = Collections.unmodifiableList(newDropList); backendList = Collections.unmodifiableList(newBackendList); }
|
/**
* Populate the round-robin lists with the given values.
*/
|
Populate the round-robin lists with the given values
|
useRoundRobinLists
|
{
"repo_name": "carl-mastrangelo/grpc-java",
"path": "grpclb/src/main/java/io/grpc/grpclb/GrpclbState.java",
"license": "apache-2.0",
"size": 37274
}
|
[
"com.google.common.base.Preconditions",
"io.grpc.Attributes",
"io.grpc.ChannelLogger",
"io.grpc.EquivalentAddressGroup",
"io.grpc.LoadBalancer",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collections",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"javax.annotation.Nullable"
] |
import com.google.common.base.Preconditions; import io.grpc.Attributes; import io.grpc.ChannelLogger; import io.grpc.EquivalentAddressGroup; import io.grpc.LoadBalancer; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Nullable;
|
import com.google.common.base.*; import io.grpc.*; import java.util.*; import javax.annotation.*;
|
[
"com.google.common",
"io.grpc",
"java.util",
"javax.annotation"
] |
com.google.common; io.grpc; java.util; javax.annotation;
| 1,457,164
|
private void recomputeBounds() {
// fast path for case of no children
if (children.isEmpty()) {
cachedBounds.makeEmpty();
return;
}
// fast path for case of 1 child
if (children.size() == 1) {
Node node = children.get(0);
node.boundsChanged = false;
if (node.isVisible()) {
cachedBounds = getChildTransformedBounds(node, BaseTransform.IDENTITY_TRANSFORM, cachedBounds);
top = left = bottom = right = near = far = node;
} else {
cachedBounds.makeEmpty();
// no need to null edge nodes here, it was done in childExcluded
// top = left = bottom = right = near = far = null;
}
return;
}
if ((dirtyChildrenCount == 0) ||
!updateCachedBounds(dirtyChildren != null
? dirtyChildren : children,
dirtyChildrenCount)) {
// failed to update cached bounds, recreate them
createCachedBounds(children);
}
}
private final int LEFT_INVALID = 1;
private final int TOP_INVALID = 1 << 1;
private final int NEAR_INVALID = 1 << 2;
private final int RIGHT_INVALID = 1 << 3;
private final int BOTTOM_INVALID = 1 << 4;
private final int FAR_INVALID = 1 << 5;
|
void function() { if (children.isEmpty()) { cachedBounds.makeEmpty(); return; } if (children.size() == 1) { Node node = children.get(0); node.boundsChanged = false; if (node.isVisible()) { cachedBounds = getChildTransformedBounds(node, BaseTransform.IDENTITY_TRANSFORM, cachedBounds); top = left = bottom = right = near = far = node; } else { cachedBounds.makeEmpty(); } return; } if ((dirtyChildrenCount == 0) !updateCachedBounds(dirtyChildren != null ? dirtyChildren : children, dirtyChildrenCount)) { createCachedBounds(children); } } private final int LEFT_INVALID = 1; private final int TOP_INVALID = 1 << 1; private final int NEAR_INVALID = 1 << 2; private final int RIGHT_INVALID = 1 << 3; private final int BOTTOM_INVALID = 1 << 4; private final int FAR_INVALID = 1 << 5;
|
/**
* Recomputes the bounds from scratch and saves the cached bounds.
*/
|
Recomputes the bounds from scratch and saves the cached bounds
|
recomputeBounds
|
{
"repo_name": "teamfx/openjfx-10-dev-rt",
"path": "modules/javafx.graphics/src/main/java/javafx/scene/Parent.java",
"license": "gpl-2.0",
"size": 76020
}
|
[
"com.sun.javafx.geom.transform.BaseTransform"
] |
import com.sun.javafx.geom.transform.BaseTransform;
|
import com.sun.javafx.geom.transform.*;
|
[
"com.sun.javafx"
] |
com.sun.javafx;
| 2,637,995
|
void handleNotificationError(IBinder key, StatusBarNotification n, String message) {
removeNotification(key);
try {
mBarService.onNotificationError(n.pkg, n.tag, n.id, n.uid, n.initialPid, message);
} catch (RemoteException ex) {
// The end is nigh.
}
}
|
void handleNotificationError(IBinder key, StatusBarNotification n, String message) { removeNotification(key); try { mBarService.onNotificationError(n.pkg, n.tag, n.id, n.uid, n.initialPid, message); } catch (RemoteException ex) { } }
|
/**
* Cancel this notification and tell the status bar service about the failure. Hold no locks.
*/
|
Cancel this notification and tell the status bar service about the failure. Hold no locks
|
handleNotificationError
|
{
"repo_name": "flymoondust/project",
"path": "android/SystemUI2/src/com/android/systemui/statusbar/tablet/TabletStatusBar.java",
"license": "gpl-2.0",
"size": 82710
}
|
[
"android.os.IBinder",
"android.os.RemoteException",
"com.android.internal.statusbar.StatusBarNotification"
] |
import android.os.IBinder; import android.os.RemoteException; import com.android.internal.statusbar.StatusBarNotification;
|
import android.os.*; import com.android.internal.statusbar.*;
|
[
"android.os",
"com.android.internal"
] |
android.os; com.android.internal;
| 2,028,262
|
private void deletePubsubTopic(String topic) throws IOException {
if (pubsubClient == null) {
pubsubClient = Transport.newPubsubClient(options).build();
}
if (executeNullIfNotFound(pubsubClient.projects().topics().get(topic)) != null) {
pubsubClient.projects().topics().delete(topic).execute();
}
}
|
void function(String topic) throws IOException { if (pubsubClient == null) { pubsubClient = Transport.newPubsubClient(options).build(); } if (executeNullIfNotFound(pubsubClient.projects().topics().get(topic)) != null) { pubsubClient.projects().topics().delete(topic).execute(); } }
|
/**
* Deletes the Google Cloud Pub/Sub topic.
*
* @throws IOException if there is a problem deleting the Pub/Sub topic
*/
|
Deletes the Google Cloud Pub/Sub topic
|
deletePubsubTopic
|
{
"repo_name": "Test-Betta-Inc/musical-umbrella",
"path": "examples/src/main/java/com/google/cloud/dataflow/examples/common/DataflowExampleUtils.java",
"license": "apache-2.0",
"size": 19842
}
|
[
"com.google.cloud.dataflow.sdk.util.Transport",
"java.io.IOException"
] |
import com.google.cloud.dataflow.sdk.util.Transport; import java.io.IOException;
|
import com.google.cloud.dataflow.sdk.util.*; import java.io.*;
|
[
"com.google.cloud",
"java.io"
] |
com.google.cloud; java.io;
| 589,064
|
protected void parseConfiguration(ServerConfiguration conf) {
TableOperations t = getTableOperations();
if (null == t) {
throw new RuntimeException("Table Operations cannot be null");
}
tableIdToTableName = new HashMap<>();
poolNameToRegexPattern = new HashMap<>();
for (Entry<String,String> table : t.tableIdMap().entrySet()) {
tableIdToTableName.put(table.getValue(), table.getKey());
conf.getTableConfiguration(table.getValue()).addObserver(this);
Map<String,String> customProps = conf.getTableConfiguration(table.getValue()).getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX);
if (null != customProps && customProps.size() > 0) {
for (Entry<String,String> customProp : customProps.entrySet()) {
if (customProp.getKey().startsWith(HOST_BALANCER_PREFIX)) {
if (customProp.getKey().equals(HOST_BALANCER_OOB_CHECK_KEY) || customProp.getKey().equals(HOST_BALANCER_POOL_RECHECK_KEY)
|| customProp.getKey().equals(HOST_BALANCER_REGEX_USING_IPS_KEY) || customProp.getKey().equals(HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY)) {
continue;
}
String tableName = customProp.getKey().substring(HOST_BALANCER_PREFIX.length());
String regex = customProp.getValue();
poolNameToRegexPattern.put(tableName, Pattern.compile(regex));
}
}
}
}
String oobProperty = conf.getConfiguration().get(HOST_BALANCER_OOB_CHECK_KEY);
if (null != oobProperty) {
oobCheckMillis = AccumuloConfiguration.getTimeInMillis(oobProperty);
}
String poolRecheckProperty = conf.getConfiguration().get(HOST_BALANCER_POOL_RECHECK_KEY);
if (null != poolRecheckProperty) {
poolRecheckMillis = AccumuloConfiguration.getTimeInMillis(poolRecheckProperty);
}
String ipBased = conf.getConfiguration().get(HOST_BALANCER_REGEX_USING_IPS_KEY);
if (null != ipBased) {
isIpBasedRegex = Boolean.parseBoolean(ipBased);
}
String migrations = conf.getConfiguration().get(HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY);
if (null != migrations) {
maxTServerMigrations = Integer.parseInt(migrations);
}
LOG.info("{}", this);
}
|
void function(ServerConfiguration conf) { TableOperations t = getTableOperations(); if (null == t) { throw new RuntimeException(STR); } tableIdToTableName = new HashMap<>(); poolNameToRegexPattern = new HashMap<>(); for (Entry<String,String> table : t.tableIdMap().entrySet()) { tableIdToTableName.put(table.getValue(), table.getKey()); conf.getTableConfiguration(table.getValue()).addObserver(this); Map<String,String> customProps = conf.getTableConfiguration(table.getValue()).getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); if (null != customProps && customProps.size() > 0) { for (Entry<String,String> customProp : customProps.entrySet()) { if (customProp.getKey().startsWith(HOST_BALANCER_PREFIX)) { if (customProp.getKey().equals(HOST_BALANCER_OOB_CHECK_KEY) customProp.getKey().equals(HOST_BALANCER_POOL_RECHECK_KEY) customProp.getKey().equals(HOST_BALANCER_REGEX_USING_IPS_KEY) customProp.getKey().equals(HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY)) { continue; } String tableName = customProp.getKey().substring(HOST_BALANCER_PREFIX.length()); String regex = customProp.getValue(); poolNameToRegexPattern.put(tableName, Pattern.compile(regex)); } } } } String oobProperty = conf.getConfiguration().get(HOST_BALANCER_OOB_CHECK_KEY); if (null != oobProperty) { oobCheckMillis = AccumuloConfiguration.getTimeInMillis(oobProperty); } String poolRecheckProperty = conf.getConfiguration().get(HOST_BALANCER_POOL_RECHECK_KEY); if (null != poolRecheckProperty) { poolRecheckMillis = AccumuloConfiguration.getTimeInMillis(poolRecheckProperty); } String ipBased = conf.getConfiguration().get(HOST_BALANCER_REGEX_USING_IPS_KEY); if (null != ipBased) { isIpBasedRegex = Boolean.parseBoolean(ipBased); } String migrations = conf.getConfiguration().get(HOST_BALANCER_REGEX_MAX_MIGRATIONS_KEY); if (null != migrations) { maxTServerMigrations = Integer.parseInt(migrations); } LOG.info("{}", this); }
|
/**
* Parse configuration and extract properties
*
* @param conf
* server configuration
*/
|
Parse configuration and extract properties
|
parseConfiguration
|
{
"repo_name": "dhutchis/accumulo",
"path": "server/base/src/main/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancer.java",
"license": "apache-2.0",
"size": 19078
}
|
[
"java.util.HashMap",
"java.util.Map",
"java.util.regex.Pattern",
"org.apache.accumulo.core.client.admin.TableOperations",
"org.apache.accumulo.core.conf.AccumuloConfiguration",
"org.apache.accumulo.core.conf.Property",
"org.apache.accumulo.server.conf.ServerConfiguration"
] |
import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.server.conf.ServerConfiguration;
|
import java.util.*; import java.util.regex.*; import org.apache.accumulo.core.client.admin.*; import org.apache.accumulo.core.conf.*; import org.apache.accumulo.server.conf.*;
|
[
"java.util",
"org.apache.accumulo"
] |
java.util; org.apache.accumulo;
| 2,183,151
|
public static Put getPutOnlyTableHeaderRow(List<Mutation> tableMetaData) {
for (Mutation m : tableMetaData) {
if (m instanceof Put) { return (Put) m; }
}
throw new IllegalStateException("No table header row found in table metadata");
}
|
static Put function(List<Mutation> tableMetaData) { for (Mutation m : tableMetaData) { if (m instanceof Put) { return (Put) m; } } throw new IllegalStateException(STR); }
|
/**
* Returns the first Put element in <code>tableMetaData</code>. There could be leading Delete elements before the
* table header row
*/
|
Returns the first Put element in <code>tableMetaData</code>. There could be leading Delete elements before the table header row
|
getPutOnlyTableHeaderRow
|
{
"repo_name": "AyolaJayamaha/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/MetaDataUtil.java",
"license": "apache-2.0",
"size": 29455
}
|
[
"java.util.List",
"org.apache.hadoop.hbase.client.Mutation",
"org.apache.hadoop.hbase.client.Put"
] |
import java.util.List; import org.apache.hadoop.hbase.client.Mutation; import org.apache.hadoop.hbase.client.Put;
|
import java.util.*; import org.apache.hadoop.hbase.client.*;
|
[
"java.util",
"org.apache.hadoop"
] |
java.util; org.apache.hadoop;
| 293,664
|
public List<TimelineObjectHolder<VersionType, ObjectType>> lookup(Interval interval)
{
try {
lock.readLock().lock();
return lookup(interval, false);
}
finally {
lock.readLock().unlock();
}
}
|
List<TimelineObjectHolder<VersionType, ObjectType>> function(Interval interval) { try { lock.readLock().lock(); return lookup(interval, false); } finally { lock.readLock().unlock(); } }
|
/**
* Does a lookup for the objects representing the given time interval. Will *only* return
* PartitionHolders that are complete.
*
* @param interval interval to find objects for
*
* @return Holders representing the interval that the objects exist for, PartitionHolders
* are guaranteed to be complete
*/
|
Does a lookup for the objects representing the given time interval. Will *only* return PartitionHolders that are complete
|
lookup
|
{
"repo_name": "Saligia-eva/mobvista_druid",
"path": "common/src/main/java/io/druid/timeline/VersionedIntervalTimeline.java",
"license": "apache-2.0",
"size": 17837
}
|
[
"java.util.List",
"org.joda.time.Interval"
] |
import java.util.List; import org.joda.time.Interval;
|
import java.util.*; import org.joda.time.*;
|
[
"java.util",
"org.joda.time"
] |
java.util; org.joda.time;
| 2,603,778
|
public void setAttribute(String name, Object value)
throws IOException
{
name = name.toLowerCase(Locale.ENGLISH);
if (name.equals("date") ||
name.equals("received") || name.equals("return-path") ||
name.equals("message-id"))
throw new IOException("cannot set property `" + name + "'");
if (name.equals("to")) {
addTo((String) value);
return;
}
if (name.equals("cc")) {
addCc((String) value);
return;
}
if (name.equals("bcc")) {
addBcc((String) value);
return;
}
if (name.equals("from")) {
_from = (String) value;
return;
}
if (name.equals("sender")) {
_sender = (String) value;
return;
}
if (_attributes == null)
_attributes = new HashMap<String,Object>();
_attributes.put(name, value);
}
|
void function(String name, Object value) throws IOException { name = name.toLowerCase(Locale.ENGLISH); if (name.equals("date") name.equals(STR) name.equals(STR) name.equals(STR)) throw new IOException(STR + name + "'"); if (name.equals("to")) { addTo((String) value); return; } if (name.equals("cc")) { addCc((String) value); return; } if (name.equals("bcc")) { addBcc((String) value); return; } if (name.equals("from")) { _from = (String) value; return; } if (name.equals(STR)) { _sender = (String) value; return; } if (_attributes == null) _attributes = new HashMap<String,Object>(); _attributes.put(name, value); }
|
/**
* Sets an attribute. Some attributes, like "date" and "sender" cannot
* be set. Any unknown attribute will be treated as a user RFC822
* header.
*/
|
Sets an attribute. Some attributes, like "date" and "sender" cannot be set. Any unknown attribute will be treated as a user RFC822 header
|
setAttribute
|
{
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/vfs/SmtpStream.java",
"license": "gpl-2.0",
"size": 13228
}
|
[
"java.io.IOException",
"java.util.HashMap",
"java.util.Locale"
] |
import java.io.IOException; import java.util.HashMap; import java.util.Locale;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 844,551
|
public BandwidthCapacity capacity(Bandwidth bandwidth) {
checkNotNull(bandwidth);
// TODO current Bandwidth API end up value converted to double
setOrClear(CAPACITY, bandwidth.bps());
return this;
}
/**
* Available Bandwidth resource (Capacity).
*
* @return {@link Bandwidth}
|
BandwidthCapacity function(Bandwidth bandwidth) { checkNotNull(bandwidth); setOrClear(CAPACITY, bandwidth.bps()); return this; } /** * Available Bandwidth resource (Capacity). * * @return {@link Bandwidth}
|
/**
* Sets the Available Bandwidth resource (Capacity).
*
* @param bandwidth value to set.
* @return self
*/
|
Sets the Available Bandwidth resource (Capacity)
|
capacity
|
{
"repo_name": "LorenzReinhart/ONOSnew",
"path": "core/api/src/main/java/org/onosproject/net/config/basics/BandwidthCapacity.java",
"license": "apache-2.0",
"size": 2838
}
|
[
"com.google.common.base.Preconditions",
"org.onlab.util.Bandwidth"
] |
import com.google.common.base.Preconditions; import org.onlab.util.Bandwidth;
|
import com.google.common.base.*; import org.onlab.util.*;
|
[
"com.google.common",
"org.onlab.util"
] |
com.google.common; org.onlab.util;
| 1,410,008
|
@Override
public boolean equals(Object obj) {
if (!super.equals(obj)) {
return false;
}
final MCRMetaDateLangText other = (MCRMetaDateLangText) obj;
return Objects.equals(this.text, other.text) && Objects.equals(this.form, other.form)
&& Objects.equals(this.isoDate, other.isoDate);
}
|
boolean function(Object obj) { if (!super.equals(obj)) { return false; } final MCRMetaDateLangText other = (MCRMetaDateLangText) obj; return Objects.equals(this.text, other.text) && Objects.equals(this.form, other.form) && Objects.equals(this.isoDate, other.isoDate); }
|
/**
* Check the equivalence between this instance and the given object.
*
* @param obj the MCRMetaDateLangText object
* @return true if its equal
*/
|
Check the equivalence between this instance and the given object
|
equals
|
{
"repo_name": "MyCoRe-Org/mycore",
"path": "mycore-base/src/main/java/org/mycore/datamodel/metadata/MCRMetaDateLangText.java",
"license": "gpl-3.0",
"size": 6424
}
|
[
"java.util.Objects"
] |
import java.util.Objects;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,060,659
|
try {
final InetAddress addr = InetAddress.getLocalHost();
return addr.getHostName();
} catch (final UnknownHostException uhe) {
try {
final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces();
while (interfaces.hasMoreElements()) {
final NetworkInterface nic = interfaces.nextElement();
final Enumeration<InetAddress> addresses = nic.getInetAddresses();
while (addresses.hasMoreElements()) {
final InetAddress address = addresses.nextElement();
if (!address.isLoopbackAddress()) {
final String hostname = address.getHostName();
if (hostname != null) {
return hostname;
}
}
}
}
} catch (final SocketException se) {
LOGGER.error("Could not determine local host name", uhe);
return "UNKNOWN_LOCALHOST";
}
LOGGER.error("Could not determine local host name", uhe);
return "UNKNOWN_LOCALHOST";
}
}
|
try { final InetAddress addr = InetAddress.getLocalHost(); return addr.getHostName(); } catch (final UnknownHostException uhe) { try { final Enumeration<NetworkInterface> interfaces = NetworkInterface.getNetworkInterfaces(); while (interfaces.hasMoreElements()) { final NetworkInterface nic = interfaces.nextElement(); final Enumeration<InetAddress> addresses = nic.getInetAddresses(); while (addresses.hasMoreElements()) { final InetAddress address = addresses.nextElement(); if (!address.isLoopbackAddress()) { final String hostname = address.getHostName(); if (hostname != null) { return hostname; } } } } } catch (final SocketException se) { LOGGER.error(STR, uhe); return STR; } LOGGER.error(STR, uhe); return STR; } }
|
/**
* This method gets the network name of the machine we are running on.
* Returns "UNKNOWN_LOCALHOST" in the unlikely case where the host name
* cannot be found.
*
* @return String the name of the local host
*/
|
This method gets the network name of the machine we are running on. Returns "UNKNOWN_LOCALHOST" in the unlikely case where the host name cannot be found
|
getLocalHostname
|
{
"repo_name": "ClarenceAu/log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/helpers/NetUtils.java",
"license": "apache-2.0",
"size": 2829
}
|
[
"java.net.InetAddress",
"java.net.NetworkInterface",
"java.net.SocketException",
"java.net.UnknownHostException",
"java.util.Enumeration"
] |
import java.net.InetAddress; import java.net.NetworkInterface; import java.net.SocketException; import java.net.UnknownHostException; import java.util.Enumeration;
|
import java.net.*; import java.util.*;
|
[
"java.net",
"java.util"
] |
java.net; java.util;
| 818,800
|
private UIContext getContextForSession(final WServlet servlet, final HttpSession session) {
return (UIContext) session.getAttribute(servlet.getClass().getName() + ".servlet.model");
}
|
UIContext function(final WServlet servlet, final HttpSession session) { return (UIContext) session.getAttribute(servlet.getClass().getName() + STR); }
|
/**
* getUIContext is protected in WServlet.WServletHelper, so this is a duplicate.
*
* @param servlet the servlet instance
* @param session the current session.
* @return the user context for the session
*/
|
getUIContext is protected in WServlet.WServletHelper, so this is a duplicate
|
getContextForSession
|
{
"repo_name": "marksreeves/wcomponents",
"path": "wcomponents-core/src/test/java/com/github/bordertech/wcomponents/servlet/WServlet_Test.java",
"license": "gpl-3.0",
"size": 15071
}
|
[
"com.github.bordertech.wcomponents.UIContext",
"javax.servlet.http.HttpSession"
] |
import com.github.bordertech.wcomponents.UIContext; import javax.servlet.http.HttpSession;
|
import com.github.bordertech.wcomponents.*; import javax.servlet.http.*;
|
[
"com.github.bordertech",
"javax.servlet"
] |
com.github.bordertech; javax.servlet;
| 799,141
|
public void setCurrency(CurrencyBean currency) {
this._currency = currency;
}
|
void function(CurrencyBean currency) { this._currency = currency; }
|
/**
* Sets the currency.
* @param currency the new value of the property
*/
|
Sets the currency
|
setCurrency
|
{
"repo_name": "McLeodMoores/starling",
"path": "projects/master-db/src/main/java/com/opengamma/masterdb/security/hibernate/equity/EquityVarianceSwapSecurityBean.java",
"license": "apache-2.0",
"size": 23690
}
|
[
"com.opengamma.masterdb.security.hibernate.CurrencyBean"
] |
import com.opengamma.masterdb.security.hibernate.CurrencyBean;
|
import com.opengamma.masterdb.security.hibernate.*;
|
[
"com.opengamma.masterdb"
] |
com.opengamma.masterdb;
| 747,268
|
for (String aggCounterName : RESET_COUNTERS) {
AggregateCounter aggCounter = (AggregateCounter) counterMap.get(aggCounterName);
aggCounter.reset();
}
for (String slave : slaveMachines) {
for (String aggCounterName : RESET_COUNTERS) {
AggregateCounter aggCounter = (AggregateCounter) counterMap.get(slave + "$" + aggCounterName);
aggCounter.reset();
}
}
}
|
for (String aggCounterName : RESET_COUNTERS) { AggregateCounter aggCounter = (AggregateCounter) counterMap.get(aggCounterName); aggCounter.reset(); } for (String slave : slaveMachines) { for (String aggCounterName : RESET_COUNTERS) { AggregateCounter aggCounter = (AggregateCounter) counterMap.get(slave + "$" + aggCounterName); aggCounter.reset(); } } }
|
/**
* Reset the counters
*/
|
Reset the counters
|
reset
|
{
"repo_name": "tectronics/hyracks",
"path": "hyracks/hyracks-client/src/main/java/org/apache/hyracks/client/stats/impl/ClientCounterContext.java",
"license": "apache-2.0",
"size": 9777
}
|
[
"org.apache.hyracks.client.stats.AggregateCounter"
] |
import org.apache.hyracks.client.stats.AggregateCounter;
|
import org.apache.hyracks.client.stats.*;
|
[
"org.apache.hyracks"
] |
org.apache.hyracks;
| 360,364
|
public void subscribeCommand(String commandId, QosPolicy qos, IMqttActionListener completionListener) {
String topic = MqttConst.TOPIC_PREFIX + "/cmd/" + commandId + "/fmt/" + mMessageFormat.getValue();
super.subscribe(topic, qos, completionListener);
}
|
void function(String commandId, QosPolicy qos, IMqttActionListener completionListener) { String topic = MqttConst.TOPIC_PREFIX + "/cmd/" + commandId + "/fmt/" + mMessageFormat.getValue(); super.subscribe(topic, qos, completionListener); }
|
/**
* Subscribe to Command
*
* @param commandId command identifier
* @param qos define quality of service (check QosPolicy enum)
* @param completionListener completion listener (null allowed)
*/
|
Subscribe to Command
|
subscribeCommand
|
{
"repo_name": "akinaru/iotf-android",
"path": "iotf-library/src/main/java/fr/bmartel/android/iotf/handler/DeviceHandler.java",
"license": "mit",
"size": 6706
}
|
[
"fr.bmartel.android.iotf.constant.MqttConst",
"fr.bmartel.android.iotf.constant.QosPolicy",
"org.eclipse.paho.client.mqttv3.IMqttActionListener"
] |
import fr.bmartel.android.iotf.constant.MqttConst; import fr.bmartel.android.iotf.constant.QosPolicy; import org.eclipse.paho.client.mqttv3.IMqttActionListener;
|
import fr.bmartel.android.iotf.constant.*; import org.eclipse.paho.client.mqttv3.*;
|
[
"fr.bmartel.android",
"org.eclipse.paho"
] |
fr.bmartel.android; org.eclipse.paho;
| 2,633,201
|
public Object registerMBean(Object bean,
Class beanInterface,
String keyProperties)
throws StandardException;
|
Object function(Object bean, Class beanInterface, String keyProperties) throws StandardException;
|
/**
* Registers an MBean with the MBean server.
* The mbean will be unregistered automatically when Derby shuts down.
*
* @param bean The MBean to wrap with a StandardMBean and register
* @param beanInterface The management interface for the MBean.
* @param keyProperties The String representation of the MBean's key properties,
* they will be added into the ObjectName with Derby's domain. Key
* type should be first with a short name for the bean, typically the
* class name without the package.
*
* @return An idenitifier that can later be used to unregister the mbean.
*/
|
Registers an MBean with the MBean server. The mbean will be unregistered automatically when Derby shuts down
|
registerMBean
|
{
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/iapi/services/jmx/ManagementService.java",
"license": "apache-2.0",
"size": 2722
}
|
[
"org.apache.derby.iapi.error.StandardException"
] |
import org.apache.derby.iapi.error.StandardException;
|
import org.apache.derby.iapi.error.*;
|
[
"org.apache.derby"
] |
org.apache.derby;
| 1,589,281
|
public ComboOption addComboOptions(List<ComboOption> ComboOptions);
|
ComboOption function(List<ComboOption> ComboOptions);
|
/**
* Add a list of ComboOptions
*/
|
Add a list of ComboOptions
|
addComboOptions
|
{
"repo_name": "fei-chen/AmberAlert",
"path": "backend/src/main/java/com/highform/datastore/db/ComboOption.java",
"license": "apache-2.0",
"size": 682
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,311,854
|
interface WithAgentPoolProfiles {
WithCreate withAgentPoolProfiles(List<ManagedClusterAgentPoolProfile> agentPoolProfiles);
}
|
interface WithAgentPoolProfiles { WithCreate withAgentPoolProfiles(List<ManagedClusterAgentPoolProfile> agentPoolProfiles); }
|
/**
* Specifies agentPoolProfiles.
* @param agentPoolProfiles Properties of the agent pool
* @return the next definition stage
*/
|
Specifies agentPoolProfiles
|
withAgentPoolProfiles
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/containerservice/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/containerservice/v2019_08_01/ManagedCluster.java",
"license": "mit",
"size": 18323
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,497,803
|
@PostMapping("/brute-stack")
@ApiOperation(value = "Brute Force using Stack Approach", notes = "Stack all items in a pocket sequentially, and pop them to respective positions on second visit")
public JsonArray bruteStack(@RequestBody JsonArray array, @RequestParam(defaultValue = "1") Integer n) {
SNode root = sLever.getSinglyLinkedList(array);
SNode currentRoot = root;
SNode node = root;
Integer nodeCount = 0;
Stack<Integer> stack = new Stack<>();
while (null != node) {
if (nodeCount % n == 0) {
relocate(stack, currentRoot);
currentRoot = node;
}
stack.push(node.getData());
node = node.getNext();
nodeCount = nodeCount + 1;
}
relocate(stack, currentRoot);
return sLever.getJsonArray(root);
}
|
@PostMapping(STR) @ApiOperation(value = STR, notes = STR) JsonArray function(@RequestBody JsonArray array, @RequestParam(defaultValue = "1") Integer n) { SNode root = sLever.getSinglyLinkedList(array); SNode currentRoot = root; SNode node = root; Integer nodeCount = 0; Stack<Integer> stack = new Stack<>(); while (null != node) { if (nodeCount % n == 0) { relocate(stack, currentRoot); currentRoot = node; } stack.push(node.getData()); node = node.getNext(); nodeCount = nodeCount + 1; } relocate(stack, currentRoot); return sLever.getJsonArray(root); }
|
/**
* Brute stack.
*
* @param array the array
* @param n the n
* @return the json array
*/
|
Brute stack
|
bruteStack
|
{
"repo_name": "balajeetm/t-nut",
"path": "src/main/java/com/balajeetm/tnut/controller/ReverseSinglyLinkedList.java",
"license": "apache-2.0",
"size": 5740
}
|
[
"com.balajeetm.tnut.model.SNode",
"com.google.gson.JsonArray",
"io.swagger.annotations.ApiOperation",
"java.util.Stack",
"org.springframework.web.bind.annotation.PostMapping",
"org.springframework.web.bind.annotation.RequestBody",
"org.springframework.web.bind.annotation.RequestParam"
] |
import com.balajeetm.tnut.model.SNode; import com.google.gson.JsonArray; import io.swagger.annotations.ApiOperation; import java.util.Stack; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam;
|
import com.balajeetm.tnut.model.*; import com.google.gson.*; import io.swagger.annotations.*; import java.util.*; import org.springframework.web.bind.annotation.*;
|
[
"com.balajeetm.tnut",
"com.google.gson",
"io.swagger.annotations",
"java.util",
"org.springframework.web"
] |
com.balajeetm.tnut; com.google.gson; io.swagger.annotations; java.util; org.springframework.web;
| 1,767,405
|
private void drawGridLine(double x, GraphicsWrap g, RectangleWrap field) {
g.drawLine(plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0, field),
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(yLength, field));
g.drawLine(plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0, field),
plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(-yLength, field));
}
|
void function(double x, GraphicsWrap g, RectangleWrap field) { g.drawLine(plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0, field), plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(yLength, field)); g.drawLine(plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(0, field), plotSheet.xToGraphic(x, field), plotSheet.yToGraphic(-yLength, field)); }
|
/**
* Draw a grid line in specified graphics object
*
* @param x x-position the vertical line shall be drawn
* @param g graphic the line shall be drawn onto
* @param field definition of the graphic boundaries
*/
|
Draw a grid line in specified graphics object
|
drawGridLine
|
{
"repo_name": "StKotok/Anki-Android",
"path": "AnkiDroid/src/main/java/com/wildplot/android/rendering/YGrid.java",
"license": "gpl-3.0",
"size": 5102
}
|
[
"com.wildplot.android.rendering.graphics.wrapper.GraphicsWrap",
"com.wildplot.android.rendering.graphics.wrapper.RectangleWrap"
] |
import com.wildplot.android.rendering.graphics.wrapper.GraphicsWrap; import com.wildplot.android.rendering.graphics.wrapper.RectangleWrap;
|
import com.wildplot.android.rendering.graphics.wrapper.*;
|
[
"com.wildplot.android"
] |
com.wildplot.android;
| 1,376,801
|
private void setUpSchema(final Collection<SourceIdentifier> requiredSources) {
logger.trace("{}: Trying to build schema context from {}", id, requiredSources);
// If no more sources, fail
if(requiredSources.isEmpty()) {
handleSalInitializationFailure(new IllegalStateException(id + ": No more sources for schema context"), listener);
return;
}
final CheckedFuture<SchemaContext, SchemaResolutionException> schemaBuilderFuture = schemaContextFactory.createSchemaContext(requiredSources);
final FutureCallback<SchemaContext> RecursiveSchemaBuilderCallback = new FutureCallback<SchemaContext>() {
|
void function(final Collection<SourceIdentifier> requiredSources) { logger.trace(STR, id, requiredSources); if(requiredSources.isEmpty()) { handleSalInitializationFailure(new IllegalStateException(id + STR), listener); return; } final CheckedFuture<SchemaContext, SchemaResolutionException> schemaBuilderFuture = schemaContextFactory.createSchemaContext(requiredSources); final FutureCallback<SchemaContext> RecursiveSchemaBuilderCallback = new FutureCallback<SchemaContext>() {
|
/**
* Recursively build schema context, in case of success or final failure notify device
*/
|
Recursively build schema context, in case of success or final failure notify device
|
setUpSchema
|
{
"repo_name": "aryantaheri/controller",
"path": "opendaylight/md-sal/sal-netconf-connector/src/main/java/org/opendaylight/controller/sal/connect/netconf/NetconfDevice.java",
"license": "epl-1.0",
"size": 18182
}
|
[
"com.google.common.util.concurrent.CheckedFuture",
"com.google.common.util.concurrent.FutureCallback",
"java.util.Collection",
"org.opendaylight.yangtools.yang.model.api.SchemaContext",
"org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException",
"org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier"
] |
import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.FutureCallback; import java.util.Collection; import org.opendaylight.yangtools.yang.model.api.SchemaContext; import org.opendaylight.yangtools.yang.model.repo.api.SchemaResolutionException; import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
|
import com.google.common.util.concurrent.*; import java.util.*; import org.opendaylight.yangtools.yang.model.api.*; import org.opendaylight.yangtools.yang.model.repo.api.*;
|
[
"com.google.common",
"java.util",
"org.opendaylight.yangtools"
] |
com.google.common; java.util; org.opendaylight.yangtools;
| 1,320,036
|
protected ReadWriteLock getLock() {
return lock;
}
|
ReadWriteLock function() { return lock; }
|
/**
* Gets the ReadWriteLock value of lock for this instance of ObjectPool.
*
* @return the lock
*/
|
Gets the ReadWriteLock value of lock for this instance of ObjectPool
|
getLock
|
{
"repo_name": "shuliangtao/apache-camel-2.13.0-src",
"path": "components/camel-sjms/src/main/java/org/apache/camel/component/sjms/jms/ObjectPool.java",
"license": "apache-2.0",
"size": 4053
}
|
[
"java.util.concurrent.locks.ReadWriteLock"
] |
import java.util.concurrent.locks.ReadWriteLock;
|
import java.util.concurrent.locks.*;
|
[
"java.util"
] |
java.util;
| 782,907
|
public boolean unload() {
// terminate task service
//aiTaskService.shutdown();
if (EventFactory.getInstance().callEvent(new WorldUnloadEvent(this)).isCancelled()) {
return false;
}
try {
storage.getChunkIoService().unload();
storage.getScoreboardIoService().unload();
} catch (IOException e) {
return false;
}
return true;
}
|
boolean function() { if (EventFactory.getInstance().callEvent(new WorldUnloadEvent(this)).isCancelled()) { return false; } try { storage.getChunkIoService().unload(); storage.getScoreboardIoService().unload(); } catch (IOException e) { return false; } return true; }
|
/**
* Unloads the world.
*
* @return true if successful
*/
|
Unloads the world
|
unload
|
{
"repo_name": "GlowstoneMC/GlowstonePlusPlus",
"path": "src/main/java/net/glowstone/GlowWorld.java",
"license": "mit",
"size": 77767
}
|
[
"java.io.IOException",
"org.bukkit.event.world.WorldUnloadEvent"
] |
import java.io.IOException; import org.bukkit.event.world.WorldUnloadEvent;
|
import java.io.*; import org.bukkit.event.world.*;
|
[
"java.io",
"org.bukkit.event"
] |
java.io; org.bukkit.event;
| 1,793,985
|
protected List<CmsSelectWidgetOption> getComboCronExpressions() {
List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>();
// 0 0 3 * * ? (daily at 3 am)
result.add(new CmsSelectWidgetOption("0 0 3 * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE1_0)));
// 0 0/30 * * * ? (daily every thirty minutes)
result.add(
new CmsSelectWidgetOption("0 0/30 * * * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE2_0)));
// 0 30 8 ? * 4 (every Wednesday at 8:30 am)
result.add(new CmsSelectWidgetOption("0 30 8 ? * 4", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE3_0)));
// 0 15 18 15 * ? (on the 20th day of the month at 6:15 pm)
result.add(
new CmsSelectWidgetOption("0 15 18 20 * ?", false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE4_0)));
// 0 45 15 ? * 1 2007-2009 (every Sunday from the year 2007 to 2009 at 3:45 pm)
result.add(new CmsSelectWidgetOption(
"0 45 15 ? * 1 2007-2009",
false,
null,
key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE5_0)));
return result;
}
|
List<CmsSelectWidgetOption> function() { List<CmsSelectWidgetOption> result = new ArrayList<CmsSelectWidgetOption>(); result.add(new CmsSelectWidgetOption(STR, false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE1_0))); result.add( new CmsSelectWidgetOption(STR, false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE2_0))); result.add(new CmsSelectWidgetOption(STR, false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE3_0))); result.add( new CmsSelectWidgetOption(STR, false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE4_0))); result.add(new CmsSelectWidgetOption( STR, false, null, key(Messages.GUI_EDITOR_CRONJOB_EXAMPLE5_0))); return result; }
|
/**
* Returns the example cron expressions to show in the combo box.<p>
*
* The result list elements are of type <code>{@link org.opencms.widgets.CmsSelectWidgetOption}</code>.<p>
*
* @return the example cron expressions to show in the combo box
*/
|
Returns the example cron expressions to show in the combo box. The result list elements are of type <code><code>org.opencms.widgets.CmsSelectWidgetOption</code></code>
|
getComboCronExpressions
|
{
"repo_name": "ggiudetti/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/scheduler/CmsEditScheduledJobInfoDialog.java",
"license": "lgpl-2.1",
"size": 19189
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.opencms.widgets.CmsSelectWidgetOption"
] |
import java.util.ArrayList; import java.util.List; import org.opencms.widgets.CmsSelectWidgetOption;
|
import java.util.*; import org.opencms.widgets.*;
|
[
"java.util",
"org.opencms.widgets"
] |
java.util; org.opencms.widgets;
| 2,774,797
|
public void actionPerformed(ActionEvent event) {
String command = event.getActionCommand();
if (CommonSettingsDialog.UPDATE.equalsIgnoreCase(command)) {
update();
} else if (CommonSettingsDialog.CANCEL.equalsIgnoreCase(command)) {
cancel();
}
}
|
void function(ActionEvent event) { String command = event.getActionCommand(); if (CommonSettingsDialog.UPDATE.equalsIgnoreCase(command)) { update(); } else if (CommonSettingsDialog.CANCEL.equalsIgnoreCase(command)) { cancel(); } }
|
/**
* Handle the player pressing the action buttons. <p/> Implements the
* <code>ActionListener</code> interface.
*
* @param event - the <code>ActionEvent</code> that initiated this call.
*/
|
Handle the player pressing the action buttons. Implements the <code>ActionListener</code> interface
|
actionPerformed
|
{
"repo_name": "chvink/kilomek",
"path": "megamek/src/megamek/client/ui/swing/CommonSettingsDialog.java",
"license": "gpl-3.0",
"size": 66371
}
|
[
"java.awt.event.ActionEvent"
] |
import java.awt.event.ActionEvent;
|
import java.awt.event.*;
|
[
"java.awt"
] |
java.awt;
| 868,151
|
private Relationship createEdgeToParent(Node createdVertex, Node parentVertex) {
Relationship rel = parentVertex.createRelationshipTo(createdVertex, RelTypes.IS_PARENT);
return rel;
}
|
Relationship function(Node createdVertex, Node parentVertex) { Relationship rel = parentVertex.createRelationshipTo(createdVertex, RelTypes.IS_PARENT); return rel; }
|
/**
* Creates an Edge to the parent vertex
*
* @param createdVertex
* @param parentVertex
* @return
*/
|
Creates an Edge to the parent vertex
|
createEdgeToParent
|
{
"repo_name": "tchico/dgMaster-trunk",
"path": "src/generator/misc/EntityEventNodeNeo4j.java",
"license": "apache-2.0",
"size": 14076
}
|
[
"org.neo4j.graphdb.Node",
"org.neo4j.graphdb.Relationship"
] |
import org.neo4j.graphdb.Node; import org.neo4j.graphdb.Relationship;
|
import org.neo4j.graphdb.*;
|
[
"org.neo4j.graphdb"
] |
org.neo4j.graphdb;
| 1,320,545
|
BufferedImage getSplitComponentImage()
{
Renderer rnd = metadataViewer.getRenderer();
if (rnd == null) return null;
PlaneDef pDef = new PlaneDef();
pDef.t = getDefaultT();
pDef.z = getDefaultZ();
pDef.slice = omero.romio.XY.value;
return rnd.renderPlane(pDef);
}
|
BufferedImage getSplitComponentImage() { Renderer rnd = metadataViewer.getRenderer(); if (rnd == null) return null; PlaneDef pDef = new PlaneDef(); pDef.t = getDefaultT(); pDef.z = getDefaultZ(); pDef.slice = omero.romio.XY.value; return rnd.renderPlane(pDef); }
|
/**
* This method should only be invoked when we save the displayed image
* and split its components.
*
* @return See above.
*/
|
This method should only be invoked when we save the displayed image and split its components
|
getSplitComponentImage
|
{
"repo_name": "joshmoore/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java",
"license": "gpl-2.0",
"size": 72048
}
|
[
"java.awt.image.BufferedImage",
"org.openmicroscopy.shoola.agents.metadata.rnd.Renderer"
] |
import java.awt.image.BufferedImage; import org.openmicroscopy.shoola.agents.metadata.rnd.Renderer;
|
import java.awt.image.*; import org.openmicroscopy.shoola.agents.metadata.rnd.*;
|
[
"java.awt",
"org.openmicroscopy.shoola"
] |
java.awt; org.openmicroscopy.shoola;
| 876,514
|
// FIXME @Test
public void testGetAllDynCols() throws Exception {
String query = "SELECT * FROM WEB_STATS WHERE entry='entry1'";
String url = getUrl() + ";";
Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES);
Connection conn = DriverManager.getConnection(url, props);
try {
PreparedStatement statement = conn.prepareStatement(query);
ResultSet rs = statement.executeQuery();
assertTrue(rs.next());
Pair<String,Integer> maxClickCountUserIdAndValue = getMaxClickCountValue(rs);
// This fails because the dynamic columns are not available through ResultSetMetaData
assertEquals(USER_ID2_BYTES,maxClickCountUserIdAndValue.getFirst());
assertEquals(ENTRY1_CLICK_COUNT,maxClickCountUserIdAndValue.getSecond());
assertFalse(rs.next());
} finally {
conn.close();
}
}
|
String query = STR; String url = getUrl() + ";"; Properties props = PropertiesUtil.deepCopy(TEST_PROPERTIES); Connection conn = DriverManager.getConnection(url, props); try { PreparedStatement statement = conn.prepareStatement(query); ResultSet rs = statement.executeQuery(); assertTrue(rs.next()); Pair<String,Integer> maxClickCountUserIdAndValue = getMaxClickCountValue(rs); assertEquals(USER_ID2_BYTES,maxClickCountUserIdAndValue.getFirst()); assertEquals(ENTRY1_CLICK_COUNT,maxClickCountUserIdAndValue.getSecond()); assertFalse(rs.next()); } finally { conn.close(); } }
|
/**
* Should project all of column family A columns qualifiers. Should also automatically be case insensitive,
* since it is a wildcard.
* @throws Exception
*/
|
Should project all of column family A columns qualifiers. Should also automatically be case insensitive, since it is a wildcard
|
testGetAllDynCols
|
{
"repo_name": "ndimiduk/phoenix",
"path": "phoenix-core/src/it/java/org/apache/phoenix/end2end/DynamicFamilyIT.java",
"license": "apache-2.0",
"size": 17322
}
|
[
"java.sql.Connection",
"java.sql.DriverManager",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.util.Properties",
"org.apache.hadoop.hbase.util.Pair",
"org.apache.phoenix.util.PropertiesUtil",
"org.junit.Assert"
] |
import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.Properties; import org.apache.hadoop.hbase.util.Pair; import org.apache.phoenix.util.PropertiesUtil; import org.junit.Assert;
|
import java.sql.*; import java.util.*; import org.apache.hadoop.hbase.util.*; import org.apache.phoenix.util.*; import org.junit.*;
|
[
"java.sql",
"java.util",
"org.apache.hadoop",
"org.apache.phoenix",
"org.junit"
] |
java.sql; java.util; org.apache.hadoop; org.apache.phoenix; org.junit;
| 2,537,180
|
public StoredValueSet getSupplierSet() {
return (StoredValueSet) supplierMap.values();
}
|
StoredValueSet function() { return (StoredValueSet) supplierMap.values(); }
|
/**
* Return an entity set view of the supplier storage container.
*/
|
Return an entity set view of the supplier storage container
|
getSupplierSet
|
{
"repo_name": "bjorndm/prebake",
"path": "code/third_party/bdb/examples/collections/ship/entity/SampleViews.java",
"license": "apache-2.0",
"size": 9836
}
|
[
"com.sleepycat.collections.StoredValueSet"
] |
import com.sleepycat.collections.StoredValueSet;
|
import com.sleepycat.collections.*;
|
[
"com.sleepycat.collections"
] |
com.sleepycat.collections;
| 1,641,274
|
public void apply(Swarm swarm) throws IOException, ModuleLoadException {
applyProperties(swarm);
applyConfigurations(swarm);
if (get(HELP)) {
displayVersion(System.err);
System.err.println();
displayHelp(System.err);
System.exit(0);
}
if (get(CONFIG_HELP) != null) {
displayConfigHelp(System.err, get(CONFIG_HELP));
System.exit(0);
}
if (get(YAML_HELP) != null) {
dumpYaml(System.err, get(YAML_HELP));
System.exit(0);
}
if (get(VERSION)) {
displayVersion(System.err);
}
}
|
void function(Swarm swarm) throws IOException, ModuleLoadException { applyProperties(swarm); applyConfigurations(swarm); if (get(HELP)) { displayVersion(System.err); System.err.println(); displayHelp(System.err); System.exit(0); } if (get(CONFIG_HELP) != null) { displayConfigHelp(System.err, get(CONFIG_HELP)); System.exit(0); } if (get(YAML_HELP) != null) { dumpYaml(System.err, get(YAML_HELP)); System.exit(0); } if (get(VERSION)) { displayVersion(System.err); } }
|
/**
* Apply properties and configuration from the parsed commandline to a container.
*
* @param swarm The Swarm instance to apply configuration to.
* @throws IOException If an error occurs resolving any URL.
*/
|
Apply properties and configuration from the parsed commandline to a container
|
apply
|
{
"repo_name": "wildfly-swarm/wildfly-swarm",
"path": "core/container/src/main/java/org/wildfly/swarm/cli/CommandLine.java",
"license": "apache-2.0",
"size": 16169
}
|
[
"java.io.IOException",
"org.jboss.modules.ModuleLoadException",
"org.wildfly.swarm.Swarm"
] |
import java.io.IOException; import org.jboss.modules.ModuleLoadException; import org.wildfly.swarm.Swarm;
|
import java.io.*; import org.jboss.modules.*; import org.wildfly.swarm.*;
|
[
"java.io",
"org.jboss.modules",
"org.wildfly.swarm"
] |
java.io; org.jboss.modules; org.wildfly.swarm;
| 253,768
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.