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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd); | ServiceOffering createServiceOffering(CreateServiceOfferingCmd cmd); | /**
* Create a service offering through the API
*
* @param cmd
* the command object that specifies the name, number of cpu cores, amount of RAM, etc. for the service
* offering
* @return the newly created service offering if successful, null otherwise
*/ | Create a service offering through the API | createServiceOffering | {
"repo_name": "ikoula/cloudstack",
"path": "api/src/com/cloud/configuration/ConfigurationService.java",
"license": "gpl-2.0",
"size": 9600
} | [
"com.cloud.offering.ServiceOffering",
"org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd"
] | import com.cloud.offering.ServiceOffering; import org.apache.cloudstack.api.command.admin.offering.CreateServiceOfferingCmd; | import com.cloud.offering.*; import org.apache.cloudstack.api.command.admin.offering.*; | [
"com.cloud.offering",
"org.apache.cloudstack"
] | com.cloud.offering; org.apache.cloudstack; | 36,493 |
@Test
public final void test_sequenceSet_testing_shouldBeReturned1d()
{
final LearnerGraph machine = buildLearnerGraph("A-a->A-b->B-b->B\nA-d->C-d->C\nB-c->D-c->D-a->D-b->D", "test_sequenceSet_testing_shouldBeReturned1d",mainConfiguration,converter);
en = new PTA_FSMStructure(machine,null) {
{
init(machine.new FSMImplementation(){
@Override
public boolean shouldBeReturned(Object elem) {
// elem is null for REJECT states
return elem != null && elem.toString().equals("B");
}
});
}
};
SequenceSet seq = en.new SequenceSet();seq.setIdentity();
Map<String,String> actual = getDebugDataMap(en,seq.cross(TestFSMAlgo.buildList(new String[][] {
new String[] {"a","a","b"},
new String[] {"a","a","c","c"},
new String[] {"d","d"},
new String[] {"c"}
},mainConfiguration,converter)).crossWithSet(labelList(new String[] {"b","a"})));
vertifyPTA(en, 1, new String[][] {
new String[] {"a","a","b","b"}
});
Map<String,String> expected=TestFSMAlgo.buildStringMap(new Object[][] {
new Object[]{new String[] {"a","a","b","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)}
});
Assert.assertTrue("expected: "+expected+", actual: "+actual, expected.equals(actual));
} | final void function() { final LearnerGraph machine = buildLearnerGraph(STR, STR,mainConfiguration,converter); en = new PTA_FSMStructure(machine,null) { { init(machine.new FSMImplementation(){ public boolean shouldBeReturned(Object elem) { return elem != null && elem.toString().equals("B"); } }); } }; SequenceSet seq = en.new SequenceSet();seq.setIdentity(); Map<String,String> actual = getDebugDataMap(en,seq.cross(TestFSMAlgo.buildList(new String[][] { new String[] {"a","a","b"}, new String[] {"a","a","c","c"}, new String[] {"d","d"}, new String[] {"c"} },mainConfiguration,converter)).crossWithSet(labelList(new String[] {"b","a"}))); vertifyPTA(en, 1, new String[][] { new String[] {"a","a","b","b"} }); Map<String,String> expected=TestFSMAlgo.buildStringMap(new Object[][] { new Object[]{new String[] {"a","a","b","b"}, PTASequenceEngine.DebugDataValues.booleanToString(true, true)} }); Assert.assertTrue(STR+expected+STR+actual, expected.equals(actual)); } | /** Test that it is possible to selectively filter out paths which terminate at specific states.
* In this PTA, there are two different paths with accept on tail nodes.
*/ | Test that it is possible to selectively filter out paths which terminate at specific states. In this PTA, there are two different paths with accept on tail nodes | test_sequenceSet_testing_shouldBeReturned1d | {
"repo_name": "kirilluk/statechum",
"path": "tests/statechum/model/testset/TestPTASequenceEngine.java",
"license": "gpl-3.0",
"size": 66274
} | [
"java.util.Map",
"org.junit.Assert"
] | import java.util.Map; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 138,085 |
public void start() throws IOException {
// do nothing
} | void function() throws IOException { } | /**
* Lifecycle method to allow the LoadManager to start any work in separate
* threads.
*/ | Lifecycle method to allow the LoadManager to start any work in separate threads | start | {
"repo_name": "CodingCat/LongTermFairScheduler",
"path": "src/contrib/creditscheduler/src/java/org/apache/hadoop/mapred/LoadManager.java",
"license": "apache-2.0",
"size": 3829
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,006,400 |
protected boolean isAttributeMappingJoined(DatabaseMapping attributeMapping) {
return isAttributeNameInJoinedExpressionList(attributeMapping.getAttributeName(), getJoinedMappingExpressions());
} | boolean function(DatabaseMapping attributeMapping) { return isAttributeNameInJoinedExpressionList(attributeMapping.getAttributeName(), getJoinedMappingExpressions()); } | /**
* Return whether the given attribute is joined as a result of a join on a mapping
*/ | Return whether the given attribute is joined as a result of a join on a mapping | isAttributeMappingJoined | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/queries/JoinedAttributeManager.java",
"license": "epl-1.0",
"size": 54086
} | [
"org.eclipse.persistence.mappings.DatabaseMapping"
] | import org.eclipse.persistence.mappings.DatabaseMapping; | import org.eclipse.persistence.mappings.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 2,613,998 |
@GameProperty(xmlProperty = true, gameProperty = true, adds = true)
public void setConvoyAttached(final String value) throws GameParseException {
if (value.length() <= 0) {
return;
}
for (final String subString : value.split(":")) {
final Territory territory = getData().getMap().getTerritory(subString);
if (territory == null) {
throw new GameParseException("No territory called:" + subString + thisErrorMsg());
}
m_convoyAttached.add(territory);
}
} | @GameProperty(xmlProperty = true, gameProperty = true, adds = true) void function(final String value) throws GameParseException { if (value.length() <= 0) { return; } for (final String subString : value.split(":")) { final Territory territory = getData().getMap().getTerritory(subString); if (territory == null) { throw new GameParseException(STR + subString + thisErrorMsg()); } m_convoyAttached.add(territory); } } | /**
* Adds to, not sets. Anything that adds to instead of setting needs a clear function as well.
*
* @param value
* @throws GameParseException
*/ | Adds to, not sets. Anything that adds to instead of setting needs a clear function as well | setConvoyAttached | {
"repo_name": "simon33-2/triplea",
"path": "src/games/strategy/triplea/attachments/TerritoryAttachment.java",
"license": "gpl-2.0",
"size": 24580
} | [
"games.strategy.engine.data.GameParseException",
"games.strategy.engine.data.Territory",
"games.strategy.engine.data.annotations.GameProperty"
] | import games.strategy.engine.data.GameParseException; import games.strategy.engine.data.Territory; import games.strategy.engine.data.annotations.GameProperty; | import games.strategy.engine.data.*; import games.strategy.engine.data.annotations.*; | [
"games.strategy.engine"
] | games.strategy.engine; | 2,249,435 |
public void setPdpActivationsPerMobileValue(short pdpActivationsPerMobileValue)
throws JNCException {
setPdpActivationsPerMobileValue(new YangUInt8(pdpActivationsPerMobileValue));
} | void function(short pdpActivationsPerMobileValue) throws JNCException { setPdpActivationsPerMobileValue(new YangUInt8(pdpActivationsPerMobileValue)); } | /**
* Sets the value for child leaf "pdp-activations-per-mobile",
* using Java primitive values.
* @param pdpActivationsPerMobileValue used during instantiation.
*/ | Sets the value for child leaf "pdp-activations-per-mobile", using Java primitive values | setPdpActivationsPerMobileValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/interface_/nas/MmeNasSgsnSm.java",
"license": "apache-2.0",
"size": 38827
} | [
"com.tailf.jnc.YangUInt8"
] | import com.tailf.jnc.YangUInt8; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 562,149 |
private Object[] getValuesToInsert(String number, long date, int duration, int type) {
Object[] values = CallLogQueryTestUtils.createTestExtendedValues();
values[CallLogQuery.ID] = mIndex;
values[CallLogQuery.NUMBER] = number;
values[CallLogQuery.DATE] = date == NOW ? new Date().getTime() : date;
values[CallLogQuery.DURATION] = duration < 0 ? mRnd.nextInt(10 * 60) : duration;
if (mVoicemail != null && mVoicemail.equals(number)) {
assertEquals(Calls.OUTGOING_TYPE, type);
}
values[CallLogQuery.CALL_TYPE] = type;
values[CallLogQuery.COUNTRY_ISO] = TEST_COUNTRY_ISO;
values[CallLogQuery.SECTION] = CallLogQuery.SECTION_OLD_ITEM;
return values;
}
| Object[] function(String number, long date, int duration, int type) { Object[] values = CallLogQueryTestUtils.createTestExtendedValues(); values[CallLogQuery.ID] = mIndex; values[CallLogQuery.NUMBER] = number; values[CallLogQuery.DATE] = date == NOW ? new Date().getTime() : date; values[CallLogQuery.DURATION] = duration < 0 ? mRnd.nextInt(10 * 60) : duration; if (mVoicemail != null && mVoicemail.equals(number)) { assertEquals(Calls.OUTGOING_TYPE, type); } values[CallLogQuery.CALL_TYPE] = type; values[CallLogQuery.COUNTRY_ISO] = TEST_COUNTRY_ISO; values[CallLogQuery.SECTION] = CallLogQuery.SECTION_OLD_ITEM; return values; } | /**
* Returns the values for a new call entry.
*
* @param number The phone number. For unknown and private numbers,
* use CallerInfo.UNKNOWN_NUMBER or CallerInfo.PRIVATE_NUMBER.
* @param date In millisec since epoch. Use NOW to use the current time.
* @param duration In seconds of the call. Use RAND_DURATION to pick a random one.
* @param type Either Call.OUTGOING_TYPE or Call.INCOMING_TYPE or Call.MISSED_TYPE.
*/ | Returns the values for a new call entry | getValuesToInsert | {
"repo_name": "risingsunm/Contacts_4.0",
"path": "tests/src/com/android/contacts/calllog/CallLogFragmentTest.java",
"license": "gpl-2.0",
"size": 26982
} | [
"android.provider.CallLog",
"java.util.Date"
] | import android.provider.CallLog; import java.util.Date; | import android.provider.*; import java.util.*; | [
"android.provider",
"java.util"
] | android.provider; java.util; | 1,474,786 |
public void unwind(GridCacheContext ctx) {
List<CA> q;
synchronized (undeploys) {
q = undeploys.remove(ctx.name());
}
if (q == null)
return;
int cnt = 0;
for (CA c : q) {
c.apply();
cnt++;
}
if (log.isDebugEnabled())
log.debug("Unwound undeploys count: " + cnt);
} | void function(GridCacheContext ctx) { List<CA> q; synchronized (undeploys) { q = undeploys.remove(ctx.name()); } if (q == null) return; int cnt = 0; for (CA c : q) { c.apply(); cnt++; } if (log.isDebugEnabled()) log.debug(STR + cnt); } | /**
* Undeploy all queued up closures.
*
* @param ctx Cache context.
*/ | Undeploy all queued up closures | unwind | {
"repo_name": "daradurvs/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentManager.java",
"license": "apache-2.0",
"size": 33055
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,146,107 |
Single<Integer> removeRangeTail(String fromElement, boolean fromInclusive); | Single<Integer> removeRangeTail(String fromElement, boolean fromInclusive); | /**
* Removes tail values range starting with <code>fromElement</code>.
*
* @param fromElement - start element
* @param fromInclusive - start element inclusive
* @return number of elements removed
*/ | Removes tail values range starting with <code>fromElement</code> | removeRangeTail | {
"repo_name": "redisson/redisson",
"path": "redisson/src/main/java/org/redisson/api/RLexSortedSetRx.java",
"license": "apache-2.0",
"size": 5899
} | [
"io.reactivex.rxjava3.core.Single"
] | import io.reactivex.rxjava3.core.Single; | import io.reactivex.rxjava3.core.*; | [
"io.reactivex.rxjava3"
] | io.reactivex.rxjava3; | 1,434,494 |
public RowReader<VALUE> getReader(InputSplit split,
Options options) throws IOException; | RowReader<VALUE> function(InputSplit split, Options options) throws IOException; | /**
* Get a record reader that provides the user-facing view of the data after
* it has been merged together. The key provides information about the
* record's identifier (write id, bucket, record id).
* @param split the split to read
* @param options the options to read with
* @return a record reader
* @throws IOException
*/ | Get a record reader that provides the user-facing view of the data after it has been merged together. The key provides information about the record's identifier (write id, bucket, record id) | getReader | {
"repo_name": "anishek/hive",
"path": "ql/src/java/org/apache/hadoop/hive/ql/io/AcidInputFormat.java",
"license": "apache-2.0",
"size": 10098
} | [
"java.io.IOException",
"org.apache.hadoop.mapred.InputSplit"
] | import java.io.IOException; import org.apache.hadoop.mapred.InputSplit; | import java.io.*; import org.apache.hadoop.mapred.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,094,753 |
protected synchronized final void ensureOpen(boolean includePendingClose) throws AlreadyClosedException {
if (!isOpen(includePendingClose)) {
throw new AlreadyClosedException("this IndexWriter is closed");
}
} | synchronized final void function(boolean includePendingClose) throws AlreadyClosedException { if (!isOpen(includePendingClose)) { throw new AlreadyClosedException(STR); } } | /**
* Used internally to throw an {@link
* AlreadyClosedException} if this IndexWriter has been
* closed.
* @throws AlreadyClosedException if this IndexWriter is
*/ | Used internally to throw an <code>AlreadyClosedException</code> if this IndexWriter has been closed | ensureOpen | {
"repo_name": "Photobucket/Solbase-Lucene",
"path": "src/java/org/apache/lucene/index/IndexWriter.java",
"license": "apache-2.0",
"size": 205989
} | [
"org.apache.lucene.store.AlreadyClosedException"
] | import org.apache.lucene.store.AlreadyClosedException; | import org.apache.lucene.store.*; | [
"org.apache.lucene"
] | org.apache.lucene; | 1,832,485 |
public static Source loadFromJSON(Path file) throws IOException {
JSONObject json = (JSONObject) JSONSystem.loadJSON(file);
return new Source(-1, (String) json.get("name").value(), (Double) json.get("reliability").value());
}
/**
* Loads a {@link Source} from SQL data.
*
* @param rs
* the {@link ResultSet} thats currently select row should be used to generate the {@link Source} | static Source function(Path file) throws IOException { JSONObject json = (JSONObject) JSONSystem.loadJSON(file); return new Source(-1, (String) json.get("name").value(), (Double) json.get(STR).value()); } /** * Loads a {@link Source} from SQL data. * * @param rs * the {@link ResultSet} thats currently select row should be used to generate the {@link Source} | /**
* Loads a {@link Source} from a JSON file
*
* @param file
* a {@link Path} to the JSON file
* @return the {@link Scraper} described in the JSON file
* @throws IOException
* an I/O error occurs
*/ | Loads a <code>Source</code> from a JSON file | loadFromJSON | {
"repo_name": "beallej/event-detection",
"path": "src/eventdetection/common/Source.java",
"license": "mit",
"size": 2612
} | [
"java.io.IOException",
"java.nio.file.Path",
"java.sql.ResultSet"
] | import java.io.IOException; import java.nio.file.Path; import java.sql.ResultSet; | import java.io.*; import java.nio.file.*; import java.sql.*; | [
"java.io",
"java.nio",
"java.sql"
] | java.io; java.nio; java.sql; | 2,761,501 |
public static int getExifOrientation(String filepath) {
ExifInterface exif;
try {
// ExifInterface does not check whether file path is null or not,
// so passing null file path argument to its constructor causing SIGSEGV.
// We should avoid such a situation by checking file path string.
exif = newInstance(filepath);
} catch (IOException ex) {
Log.e(TAG, "cannot read exif", ex);
return EXIF_DEGREE_FALLBACK_VALUE;
}
int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, EXIF_DEGREE_FALLBACK_VALUE);
if (orientation == EXIF_DEGREE_FALLBACK_VALUE) {
return 0;
}
// We only recognize a subset of orientation tag values.
switch (orientation) {
case ExifInterface.ORIENTATION_ROTATE_90:
return 90;
case ExifInterface.ORIENTATION_ROTATE_180:
return 180;
case ExifInterface.ORIENTATION_ROTATE_270:
return 270;
default:
return 0;
}
} | static int function(String filepath) { ExifInterface exif; try { exif = newInstance(filepath); } catch (IOException ex) { Log.e(TAG, STR, ex); return EXIF_DEGREE_FALLBACK_VALUE; } int orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, EXIF_DEGREE_FALLBACK_VALUE); if (orientation == EXIF_DEGREE_FALLBACK_VALUE) { return 0; } switch (orientation) { case ExifInterface.ORIENTATION_ROTATE_90: return 90; case ExifInterface.ORIENTATION_ROTATE_180: return 180; case ExifInterface.ORIENTATION_ROTATE_270: return 270; default: return 0; } } | /**
* Read exif info and get orientation value of the photo.
*
* @param filepath to get exif.
* @return exif orientation value
*/ | Read exif info and get orientation value of the photo | getExifOrientation | {
"repo_name": "tonystarsoon/SmartPhotoSelectorDemo",
"path": "photoselect/src/main/java/cn/soon/internal/utils/ExifInterfaceCompat.java",
"license": "apache-2.0",
"size": 4594
} | [
"android.media.ExifInterface",
"android.util.Log",
"java.io.IOException"
] | import android.media.ExifInterface; import android.util.Log; import java.io.IOException; | import android.media.*; import android.util.*; import java.io.*; | [
"android.media",
"android.util",
"java.io"
] | android.media; android.util; java.io; | 2,805,864 |
S3ClientSettings refine(Settings repositorySettings) {
// Normalize settings to placeholder client settings prefix so that we can use the affix settings directly
final Settings normalizedSettings =
Settings.builder().put(repositorySettings).normalizePrefix(PREFIX + PLACEHOLDER_CLIENT + '.').build();
final String newEndpoint = getRepoSettingOrDefault(ENDPOINT_SETTING, normalizedSettings, endpoint);
final Protocol newProtocol = getRepoSettingOrDefault(PROTOCOL_SETTING, normalizedSettings, protocol);
final String newProxyHost = getRepoSettingOrDefault(PROXY_HOST_SETTING, normalizedSettings, proxyHost);
final int newProxyPort = getRepoSettingOrDefault(PROXY_PORT_SETTING, normalizedSettings, proxyPort);
final int newReadTimeoutMillis = Math.toIntExact(
getRepoSettingOrDefault(READ_TIMEOUT_SETTING, normalizedSettings, TimeValue.timeValueMillis(readTimeoutMillis)).millis());
final int newMaxRetries = getRepoSettingOrDefault(MAX_RETRIES_SETTING, normalizedSettings, maxRetries);
final boolean newThrottleRetries = getRepoSettingOrDefault(USE_THROTTLE_RETRIES_SETTING, normalizedSettings, throttleRetries);
final boolean newPathStyleAccess = getRepoSettingOrDefault(USE_PATH_STYLE_ACCESS, normalizedSettings, pathStyleAccess);
final boolean newDisableChunkedEncoding = getRepoSettingOrDefault(
DISABLE_CHUNKED_ENCODING, normalizedSettings, disableChunkedEncoding);
final String newRegion = getRepoSettingOrDefault(REGION, normalizedSettings, region);
final String newSignerOverride = getRepoSettingOrDefault(SIGNER_OVERRIDE, normalizedSettings, signerOverride);
if (Objects.equals(endpoint, newEndpoint) && protocol == newProtocol && Objects.equals(proxyHost, newProxyHost)
&& proxyPort == newProxyPort && newReadTimeoutMillis == readTimeoutMillis && maxRetries == newMaxRetries
&& newThrottleRetries == throttleRetries
&& newPathStyleAccess == pathStyleAccess
&& newDisableChunkedEncoding == disableChunkedEncoding
&& Objects.equals(region, newRegion) && Objects.equals(signerOverride, newSignerOverride)) {
return this;
}
return new S3ClientSettings(
credentials,
newEndpoint,
newProtocol,
newProxyHost,
newProxyPort,
proxyUsername,
proxyPassword,
newReadTimeoutMillis,
newMaxRetries,
newThrottleRetries,
newPathStyleAccess,
newDisableChunkedEncoding,
newRegion,
newSignerOverride
);
} | S3ClientSettings refine(Settings repositorySettings) { final Settings normalizedSettings = Settings.builder().put(repositorySettings).normalizePrefix(PREFIX + PLACEHOLDER_CLIENT + '.').build(); final String newEndpoint = getRepoSettingOrDefault(ENDPOINT_SETTING, normalizedSettings, endpoint); final Protocol newProtocol = getRepoSettingOrDefault(PROTOCOL_SETTING, normalizedSettings, protocol); final String newProxyHost = getRepoSettingOrDefault(PROXY_HOST_SETTING, normalizedSettings, proxyHost); final int newProxyPort = getRepoSettingOrDefault(PROXY_PORT_SETTING, normalizedSettings, proxyPort); final int newReadTimeoutMillis = Math.toIntExact( getRepoSettingOrDefault(READ_TIMEOUT_SETTING, normalizedSettings, TimeValue.timeValueMillis(readTimeoutMillis)).millis()); final int newMaxRetries = getRepoSettingOrDefault(MAX_RETRIES_SETTING, normalizedSettings, maxRetries); final boolean newThrottleRetries = getRepoSettingOrDefault(USE_THROTTLE_RETRIES_SETTING, normalizedSettings, throttleRetries); final boolean newPathStyleAccess = getRepoSettingOrDefault(USE_PATH_STYLE_ACCESS, normalizedSettings, pathStyleAccess); final boolean newDisableChunkedEncoding = getRepoSettingOrDefault( DISABLE_CHUNKED_ENCODING, normalizedSettings, disableChunkedEncoding); final String newRegion = getRepoSettingOrDefault(REGION, normalizedSettings, region); final String newSignerOverride = getRepoSettingOrDefault(SIGNER_OVERRIDE, normalizedSettings, signerOverride); if (Objects.equals(endpoint, newEndpoint) && protocol == newProtocol && Objects.equals(proxyHost, newProxyHost) && proxyPort == newProxyPort && newReadTimeoutMillis == readTimeoutMillis && maxRetries == newMaxRetries && newThrottleRetries == throttleRetries && newPathStyleAccess == pathStyleAccess && newDisableChunkedEncoding == disableChunkedEncoding && Objects.equals(region, newRegion) && Objects.equals(signerOverride, newSignerOverride)) { return this; } return new S3ClientSettings( credentials, newEndpoint, newProtocol, newProxyHost, newProxyPort, proxyUsername, proxyPassword, newReadTimeoutMillis, newMaxRetries, newThrottleRetries, newPathStyleAccess, newDisableChunkedEncoding, newRegion, newSignerOverride ); } | /**
* Overrides the settings in this instance with settings found in repository metadata.
*
* @param repositorySettings found in repository metadata
* @return S3ClientSettings
*/ | Overrides the settings in this instance with settings found in repository metadata | refine | {
"repo_name": "nknize/elasticsearch",
"path": "plugins/repository-s3/src/main/java/org/elasticsearch/repositories/s3/S3ClientSettings.java",
"license": "apache-2.0",
"size": 17561
} | [
"com.amazonaws.Protocol",
"java.util.Objects",
"org.elasticsearch.common.settings.Settings",
"org.elasticsearch.common.unit.TimeValue"
] | import com.amazonaws.Protocol; import java.util.Objects; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.common.unit.TimeValue; | import com.amazonaws.*; import java.util.*; import org.elasticsearch.common.settings.*; import org.elasticsearch.common.unit.*; | [
"com.amazonaws",
"java.util",
"org.elasticsearch.common"
] | com.amazonaws; java.util; org.elasticsearch.common; | 857,866 |
public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws PropertyNotFoundException {
if ( isAbstractClass( clazz ) ) {
return null;
}
try {
Constructor<T> constructor = clazz.getDeclaredConstructor( NO_PARAM_SIGNATURE );
ensureAccessibility( constructor );
return constructor;
}
catch ( NoSuchMethodException nme ) {
throw new PropertyNotFoundException(
"Object class [" + clazz.getName() + "] must declare a default (no-argument) constructor"
);
}
} | static <T> Constructor<T> function(Class<T> clazz) throws PropertyNotFoundException { if ( isAbstractClass( clazz ) ) { return null; } try { Constructor<T> constructor = clazz.getDeclaredConstructor( NO_PARAM_SIGNATURE ); ensureAccessibility( constructor ); return constructor; } catch ( NoSuchMethodException nme ) { throw new PropertyNotFoundException( STR + clazz.getName() + STR ); } } | /**
* Retrieve the default (no arg) constructor from the given class.
*
* @param clazz The class for which to retrieve the default ctor.
* @return The default constructor.
* @throws PropertyNotFoundException Indicates there was not publicly accessible, no-arg constructor (todo : why PropertyNotFoundException???)
*/ | Retrieve the default (no arg) constructor from the given class | getDefaultConstructor | {
"repo_name": "lamsfoundation/lams",
"path": "3rdParty_sources/hibernate-core/org/hibernate/internal/util/ReflectHelper.java",
"license": "gpl-2.0",
"size": 22486
} | [
"java.lang.reflect.Constructor",
"org.hibernate.PropertyNotFoundException"
] | import java.lang.reflect.Constructor; import org.hibernate.PropertyNotFoundException; | import java.lang.reflect.*; import org.hibernate.*; | [
"java.lang",
"org.hibernate"
] | java.lang; org.hibernate; | 2,068,861 |
public void scanFiles( File base ) throws JasperException {
Stack dirs = new Stack();
dirs.push(base);
if (extensions == null) {
extensions = new Vector();
extensions.addElement("jsp");
extensions.addElement("jspx");
}
while (!dirs.isEmpty()) {
String s = dirs.pop().toString();
//System.out.println("--" + s);
File f = new File(s);
if (f.exists() && f.isDirectory()) {
String[] files = f.list();
String ext;
for (int i = 0; i < files.length; i++) {
File f2 = new File(s, files[i]);
//System.out.println(":" + f2.getPath());
if (f2.isDirectory()) {
dirs.push(f2.getPath());
//System.out.println("++" + f2.getPath());
} else {
String path = f2.getPath();
String uri = path.substring(uriRoot.length());
ext = files[i].substring(files[i].lastIndexOf('.')
+ 1);
if (extensions.contains(ext) ||
jspConfig.isJspPage(uri)) {
//System.out.println(s + "?" + files[i]);
pages.addElement(path);
} else {
//System.out.println("not done:" + ext);
}
}
}
}
}
} | void function( File base ) throws JasperException { Stack dirs = new Stack(); dirs.push(base); if (extensions == null) { extensions = new Vector(); extensions.addElement("jsp"); extensions.addElement("jspx"); } while (!dirs.isEmpty()) { String s = dirs.pop().toString(); File f = new File(s); if (f.exists() && f.isDirectory()) { String[] files = f.list(); String ext; for (int i = 0; i < files.length; i++) { File f2 = new File(s, files[i]); if (f2.isDirectory()) { dirs.push(f2.getPath()); } else { String path = f2.getPath(); String uri = path.substring(uriRoot.length()); ext = files[i].substring(files[i].lastIndexOf('.') + 1); if (extensions.contains(ext) jspConfig.isJspPage(uri)) { pages.addElement(path); } else { } } } } } } | /**
* Locate all jsp files in the webapp. Used if no explicit
* jsps are specified.
*/ | Locate all jsp files in the webapp. Used if no explicit jsps are specified | scanFiles | {
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-5.0.18-src/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java",
"license": "apache-2.0",
"size": 36318
} | [
"java.io.File",
"java.util.Stack",
"java.util.Vector"
] | import java.io.File; import java.util.Stack; import java.util.Vector; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,647,150 |
@Override
public void onLoadComplete(LoaderIds loaderId, @Nullable Cursor cursor) {
if (loaderId == LoaderIds.CURRENT_WEATHER_LOADER) {
Log.d(TAG, String.format("onLoadComplete: LoaderId:%s. Cursor swapped", loaderId));
CurrentWeatherStatePagerAdapter currentWeatherStatePagerAdapter = (CurrentWeatherStatePagerAdapter) viewPager.getAdapter();
currentWeatherStatePagerAdapter.swapCursor(cursor);
// if (justReturnedFromSearch) {
// Log.d(TAG, "onLoadComplete: Just returned from search is true");
// int pos = 0;
// if(cursor.moveToFirst()) {
// do {
// String cityName = cursor.getString(CurrentWeatherStatePagerAdapter.CurrentWeatherCursorPosition.CITY_NAME_POS.getValue());
// Log.d(TAG, "onLoadComplete: JustSelected:" + justSelectedCityName + ", CityName:" + cityName);
//
// if (justSelectedCityName.equalsIgnoreCase(cityName)) {
// viewPagerPosition = pos;
// Log.d(TAG, "onLoadComplete: Found the new pager position:" + pos);
//
// //reseting the member variables since they are no longer needed for this search
// justSelectedCityName = null;
// justReturnedFromSearch = false;
// break;
// }
// ++pos;
// } while (cursor.moveToNext());
// }
// }
//viewPager.setCurrentItem(viewPagerPosition, false);
onPageSelected(viewPagerPosition);
}
else {
Log.d(TAG, String.format("onLoadComplete: LoaderId:%s. Unknown loader id:", loaderId));
}
} | void function(LoaderIds loaderId, @Nullable Cursor cursor) { if (loaderId == LoaderIds.CURRENT_WEATHER_LOADER) { Log.d(TAG, String.format(STR, loaderId)); CurrentWeatherStatePagerAdapter currentWeatherStatePagerAdapter = (CurrentWeatherStatePagerAdapter) viewPager.getAdapter(); currentWeatherStatePagerAdapter.swapCursor(cursor); onPageSelected(viewPagerPosition); } else { Log.d(TAG, String.format(STR, loaderId)); } } | /**
* Method implementation for CurrentWeatherLoaderListener interface
* @param loaderId
* @param cursor
*/ | Method implementation for CurrentWeatherLoaderListener interface | onLoadComplete | {
"repo_name": "yeelin/weatherberry",
"path": "app/src/main/java/com/example/yeelin/homework/weatherberry/activity/CurrentWeatherAndDailyForecastPagerActivity.java",
"license": "mit",
"size": 19719
} | [
"android.database.Cursor",
"android.support.annotation.Nullable",
"android.util.Log",
"com.example.yeelin.homework.weatherberry.adapter.CurrentWeatherStatePagerAdapter",
"com.example.yeelin.homework.weatherberry.loader.LoaderIds"
] | import android.database.Cursor; import android.support.annotation.Nullable; import android.util.Log; import com.example.yeelin.homework.weatherberry.adapter.CurrentWeatherStatePagerAdapter; import com.example.yeelin.homework.weatherberry.loader.LoaderIds; | import android.database.*; import android.support.annotation.*; import android.util.*; import com.example.yeelin.homework.weatherberry.adapter.*; import com.example.yeelin.homework.weatherberry.loader.*; | [
"android.database",
"android.support",
"android.util",
"com.example.yeelin"
] | android.database; android.support; android.util; com.example.yeelin; | 2,392,040 |
@Test
public void testT1RV4D1_T1LV9D2() {
test_id = getTestId("T1RV4D1", "T1LV9D2", "60");
String src = selectTRVD("T1RV4D1");
String dest = selectTLVD("T1LV9D2");
String result = ".";
try {
result = TRVD_TLVD_Action(src, dest);
} catch (RecognitionException e) {
e.printStackTrace();
} catch (TokenStreamException e) {
e.printStackTrace();
}
assertTrue(ReturnFailure4,
checkResult_ReturnFailure4(src, dest, result));
GraphicalEditor editor = getActiveEditor();
if (editor != null) {
validateOrGenerateResults(editor, generateResults);
}
}
| void function() { test_id = getTestId(STR, STR, "60"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(ReturnFailure4, checkResult_ReturnFailure4(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } } | /**
* Perform the test for the given matrix column (T1RV4D1) and row (T1LV9D2).
*
*/ | Perform the test for the given matrix column (T1RV4D1) and row (T1LV9D2) | testT1RV4D1_T1LV9D2 | {
"repo_name": "rmulvey/bptest",
"path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_8_Generics.java",
"license": "apache-2.0",
"size": 153074
} | [
"org.xtuml.bp.ui.graphics.editor.GraphicalEditor"
] | import org.xtuml.bp.ui.graphics.editor.GraphicalEditor; | import org.xtuml.bp.ui.graphics.editor.*; | [
"org.xtuml.bp"
] | org.xtuml.bp; | 2,761,044 |
public native void setInputBufferSize(int portHandle, int size) throws IOException; | native void function(int portHandle, int size) throws IOException; | /**
* Sets the input buffer size.
* <p>
* Java code must synchronize on the <code>CommPort</code> instance
* when calling this method.
* </p>
* @param portHandle The port handle or token.
* @param size
* @throws IllegalArgumentException If <code>portHandle</code>
* is not a valid handle or token.
* @throws IllegalStateException If the port is closed.
* @throws IOException If communication with the port device has been lost.
*
* </dl><dl><dt><b>Unit tests:</b></dt>
* <dd><code>SERIAL_PASS, PARALLEL_PASS</code> - Set input buffer size
* to <CODE>size</CODE>.</dd>
* <dd><code>SERIAL_FAIL, PARALLEL_FAIL</code> - Throw
* <code>IOException</code>.</dd></dl>
*/ | Sets the input buffer size. Java code must synchronize on the <code>CommPort</code> instance when calling this method. | setInputBufferSize | {
"repo_name": "makerbot/RXTX-devel",
"path": "Rewrite2010/src/java/main/gnu/io/Dispatcher.java",
"license": "lgpl-2.1",
"size": 44635
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 936,497 |
public static void negateBoolean(MethodVisitor mv) {
// code to negate the primitive boolean
Label endLabel = new Label();
Label falseLabel = new Label();
mv.visitJumpInsn(IFNE, falseLabel);
mv.visitInsn(ICONST_1);
mv.visitJumpInsn(GOTO, endLabel);
mv.visitLabel(falseLabel);
mv.visitInsn(ICONST_0);
mv.visitLabel(endLabel);
} | static void function(MethodVisitor mv) { Label endLabel = new Label(); Label falseLabel = new Label(); mv.visitJumpInsn(IFNE, falseLabel); mv.visitInsn(ICONST_1); mv.visitJumpInsn(GOTO, endLabel); mv.visitLabel(falseLabel); mv.visitInsn(ICONST_0); mv.visitLabel(endLabel); } | /**
* Negate a boolean on stack.
*/ | Negate a boolean on stack | negateBoolean | {
"repo_name": "paulk-asert/groovy",
"path": "src/main/java/org/codehaus/groovy/classgen/asm/BytecodeHelper.java",
"license": "apache-2.0",
"size": 29151
} | [
"org.objectweb.asm.Label",
"org.objectweb.asm.MethodVisitor"
] | import org.objectweb.asm.Label; import org.objectweb.asm.MethodVisitor; | import org.objectweb.asm.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 1,164,125 |
boolean isRunfileLinksEnabled(PathFragment runfilesDir); | boolean isRunfileLinksEnabled(PathFragment runfilesDir); | /**
* Returns whether it's allowed to create runfile symlinks in the {@code runfilesDir}. Also
* returns {@code false} if the runfiles supplier doesn't know about the directory.
*
* @param runfilesDir runfiles directory relative to the exec root
*/ | Returns whether it's allowed to create runfile symlinks in the runfilesDir. Also returns false if the runfiles supplier doesn't know about the directory | isRunfileLinksEnabled | {
"repo_name": "ulfjack/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/RunfilesSupplier.java",
"license": "apache-2.0",
"size": 2650
} | [
"com.google.devtools.build.lib.vfs.PathFragment"
] | import com.google.devtools.build.lib.vfs.PathFragment; | import com.google.devtools.build.lib.vfs.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,365,225 |
public synchronized InetSocketAddress initPassiveDataConnection()
throws DataConnectionException {
LOG.debug("Initiating passive data connection");
// close old sockets if any
closeDataConnection();
// get the passive port
int passivePort = session.getListener()
.getDataConnectionConfiguration().requestPassivePort();
if (passivePort == -1) {
servSoc = null;
throw new DataConnectionException(
"Cannot find an available passive port.");
}
// open passive server socket and get parameters
try {
DataConnectionConfiguration dataCfg = session.getListener()
.getDataConnectionConfiguration();
String passiveAddress = dataCfg.getPassiveAddress();
if (passiveAddress == null) {
address = serverControlAddress;
} else {
address = resolveAddress(dataCfg.getPassiveAddress());
}
if (secure) {
LOG
.debug(
"Opening SSL passive data connection on address \"{}\" and port {}",
address, passivePort);
SslConfiguration ssl = getSslConfiguration();
if (ssl == null) {
throw new DataConnectionException(
"Data connection SSL required but not configured.");
}
// this method does not actually create the SSL socket, due to a JVM bug
// (https://issues.apache.org/jira/browse/FTPSERVER-241).
// Instead, it creates a regular
// ServerSocket that will be wrapped as a SSL socket in createDataSocket()
servSoc = new ServerSocket(passivePort, 0, address);
LOG
.debug(
"SSL Passive data connection created on address \"{}\" and port {}",
address, passivePort);
} else {
LOG
.debug(
"Opening passive data connection on address \"{}\" and port {}",
address, passivePort);
servSoc = new ServerSocket(passivePort, 0, address);
LOG
.debug(
"Passive data connection created on address \"{}\" and port {}",
address, passivePort);
}
port = servSoc.getLocalPort();
servSoc.setSoTimeout(dataCfg.getIdleTime() * 1000);
// set different state variables
passive = true;
requestTime = System.currentTimeMillis();
return new InetSocketAddress(address, port);
} catch (Exception ex) {
servSoc = null;
closeDataConnection();
throw new DataConnectionException(
"Failed to initate passive data connection: "
+ ex.getMessage(), ex);
}
} | synchronized InetSocketAddress function() throws DataConnectionException { LOG.debug(STR); closeDataConnection(); int passivePort = session.getListener() .getDataConnectionConfiguration().requestPassivePort(); if (passivePort == -1) { servSoc = null; throw new DataConnectionException( STR); } try { DataConnectionConfiguration dataCfg = session.getListener() .getDataConnectionConfiguration(); String passiveAddress = dataCfg.getPassiveAddress(); if (passiveAddress == null) { address = serverControlAddress; } else { address = resolveAddress(dataCfg.getPassiveAddress()); } if (secure) { LOG .debug( STR{}\STR, address, passivePort); SslConfiguration ssl = getSslConfiguration(); if (ssl == null) { throw new DataConnectionException( STR); } servSoc = new ServerSocket(passivePort, 0, address); LOG .debug( STR{}\STR, address, passivePort); } else { LOG .debug( STR{}\STR, address, passivePort); servSoc = new ServerSocket(passivePort, 0, address); LOG .debug( STR{}\STR, address, passivePort); } port = servSoc.getLocalPort(); servSoc.setSoTimeout(dataCfg.getIdleTime() * 1000); passive = true; requestTime = System.currentTimeMillis(); return new InetSocketAddress(address, port); } catch (Exception ex) { servSoc = null; closeDataConnection(); throw new DataConnectionException( STR + ex.getMessage(), ex); } } | /**
* Initiate a data connection in passive mode (server listening).
*/ | Initiate a data connection in passive mode (server listening) | initPassiveDataConnection | {
"repo_name": "ariso/JavaFtpD",
"path": "java/apacheftpd/src/org/apache/ftpserver/impl/IODataConnectionFactory.java",
"license": "apache-2.0",
"size": 15650
} | [
"java.net.InetSocketAddress",
"java.net.ServerSocket",
"org.apache.ftpserver.DataConnectionConfiguration",
"org.apache.ftpserver.DataConnectionException",
"org.apache.ftpserver.ssl.SslConfiguration"
] | import java.net.InetSocketAddress; import java.net.ServerSocket; import org.apache.ftpserver.DataConnectionConfiguration; import org.apache.ftpserver.DataConnectionException; import org.apache.ftpserver.ssl.SslConfiguration; | import java.net.*; import org.apache.ftpserver.*; import org.apache.ftpserver.ssl.*; | [
"java.net",
"org.apache.ftpserver"
] | java.net; org.apache.ftpserver; | 558,192 |
private String getValue(MultivaluedMap<String, String> headers, String header) {
List<String> values = headers.get(header);
if (values == null || values.isEmpty()) {
return null;
}
return values.get(0).toString();
} | String function(MultivaluedMap<String, String> headers, String header) { List<String> values = headers.get(header); if (values == null values.isEmpty()) { return null; } return values.get(0).toString(); } | /**
* Get the first value of a header which may contains several values.
*
* @param headers
* @param header
* @return The first value from the given header or null if the header is
* not found.
*
*/ | Get the first value of a header which may contains several values | getValue | {
"repo_name": "philomatic/smarthome",
"path": "bundles/io/org.eclipse.smarthome.io.rest/src/main/java/org/eclipse/smarthome/io/rest/internal/filter/CorsFilter.java",
"license": "epl-1.0",
"size": 7072
} | [
"java.util.List",
"javax.ws.rs.core.MultivaluedMap"
] | import java.util.List; import javax.ws.rs.core.MultivaluedMap; | import java.util.*; import javax.ws.rs.core.*; | [
"java.util",
"javax.ws"
] | java.util; javax.ws; | 2,635,122 |
public OneResponse addHost(int hid)
{
return addHost(client, id, hid);
} | OneResponse function(int hid) { return addHost(client, id, hid); } | /**
* Adds a Host to this Cluster
*
* @param hid Host ID.
* @return A encapsulated response.
*/ | Adds a Host to this Cluster | addHost | {
"repo_name": "baby-gnu/one",
"path": "src/oca/java/src/org/opennebula/client/cluster/Cluster.java",
"license": "apache-2.0",
"size": 11168
} | [
"org.opennebula.client.OneResponse"
] | import org.opennebula.client.OneResponse; | import org.opennebula.client.*; | [
"org.opennebula.client"
] | org.opennebula.client; | 2,412,557 |
Response export(UriInfo uriInfo, RealmModel realm, String format); | Response export(UriInfo uriInfo, RealmModel realm, String format); | /**
* Export a representation of the IdentityProvider in a specific format. For example, a SAML EntityDescriptor
*
* @return
*/ | Export a representation of the IdentityProvider in a specific format. For example, a SAML EntityDescriptor | export | {
"repo_name": "gregjones60/keycloak",
"path": "broker/core/src/main/java/org/keycloak/broker/provider/IdentityProvider.java",
"license": "apache-2.0",
"size": 4143
} | [
"javax.ws.rs.core.Response",
"javax.ws.rs.core.UriInfo",
"org.keycloak.models.RealmModel"
] | import javax.ws.rs.core.Response; import javax.ws.rs.core.UriInfo; import org.keycloak.models.RealmModel; | import javax.ws.rs.core.*; import org.keycloak.models.*; | [
"javax.ws",
"org.keycloak.models"
] | javax.ws; org.keycloak.models; | 1,503,450 |
public List rows() throws SQLException {
return rows(getSql(), getParameters());
} | List function() throws SQLException { return rows(getSql(), getParameters()); } | /**
* Returns a List of all of the rows from the table a DataSet
* represents.
*
* @return Returns a list of GroovyRowResult objects from the dataset
* @throws SQLException if a database error occurs
*/ | Returns a List of all of the rows from the table a DataSet represents | rows | {
"repo_name": "avafanasiev/groovy",
"path": "subprojects/groovy-sql/src/main/java/groovy/sql/DataSet.java",
"license": "apache-2.0",
"size": 17977
} | [
"java.sql.SQLException",
"java.util.List"
] | import java.sql.SQLException; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,057,706 |
protected void addListSelectionListener (final JTable table, final ListSelectionModel lsm) {
if (lsm != null && !isModelUsedByOtherTables (table, lsm)) {
lsm.addListSelectionListener (this);
}
}
| void function (final JTable table, final ListSelectionModel lsm) { if (lsm != null && !isModelUsedByOtherTables (table, lsm)) { lsm.addListSelectionListener (this); } } | /**
* Add the LinkedTableRowSelectionModel to the jtables' ListSelectionModel listeners
* @param table
* @param lsm
*/ | Add the LinkedTableRowSelectionModel to the jtables' ListSelectionModel listeners | addListSelectionListener | {
"repo_name": "martingraham/JSwingPlus",
"path": "src/model/shared/selection/LinkedTableRowSelectionModel.java",
"license": "apache-2.0",
"size": 8330
} | [
"javax.swing.JTable",
"javax.swing.ListSelectionModel"
] | import javax.swing.JTable; import javax.swing.ListSelectionModel; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 208,851 |
@ServiceMethod(returns = ReturnType.SINGLE)
void delete(String resourceGroupName, String serverName, String databaseName, Context context); | @ServiceMethod(returns = ReturnType.SINGLE) void delete(String resourceGroupName, String serverName, String databaseName, Context context); | /**
* Deletes a database.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param serverName The name of the server.
* @param databaseName The name of the database.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
*/ | Deletes a database | delete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/DatabasesClient.java",
"license": "mit",
"size": 10654
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; | import com.azure.core.annotation.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 795,554 |
public List<UniqueConstraint<SecondaryTable<T>>> getAllUniqueConstraint()
{
List<UniqueConstraint<SecondaryTable<T>>> list = new ArrayList<UniqueConstraint<SecondaryTable<T>>>();
List<Node> nodeList = childNode.get("unique-constraint");
for(Node node: nodeList)
{
UniqueConstraint<SecondaryTable<T>> type = new UniqueConstraintImpl<SecondaryTable<T>>(this, "unique-constraint", childNode, node);
list.add(type);
}
return list;
} | List<UniqueConstraint<SecondaryTable<T>>> function() { List<UniqueConstraint<SecondaryTable<T>>> list = new ArrayList<UniqueConstraint<SecondaryTable<T>>>(); List<Node> nodeList = childNode.get(STR); for(Node node: nodeList) { UniqueConstraint<SecondaryTable<T>> type = new UniqueConstraintImpl<SecondaryTable<T>>(this, STR, childNode, node); list.add(type); } return list; } | /**
* Returns all <code>unique-constraint</code> elements
* @return list of <code>unique-constraint</code>
*/ | Returns all <code>unique-constraint</code> elements | getAllUniqueConstraint | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/SecondaryTableImpl.java",
"license": "epl-1.0",
"size": 9922
} | [
"java.util.ArrayList",
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.orm20.SecondaryTable",
"org.jboss.shrinkwrap.descriptor.api.orm20.UniqueConstraint",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.ArrayList; import java.util.List; import org.jboss.shrinkwrap.descriptor.api.orm20.SecondaryTable; import org.jboss.shrinkwrap.descriptor.api.orm20.UniqueConstraint; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.orm20.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 1,319,999 |
public synchronized List getStatistics() throws StandardException
{
// if table already has the statistics descriptors initialized
// no need to do anything
if (statisticsDescriptorList != null)
return statisticsDescriptorList;
DataDictionary dd = getDataDictionary();
return statisticsDescriptorList = dd.getStatisticsDescriptors(this);
} | synchronized List function() throws StandardException { if (statisticsDescriptorList != null) return statisticsDescriptorList; DataDictionary dd = getDataDictionary(); return statisticsDescriptorList = dd.getStatisticsDescriptors(this); } | /** Returns a list of statistics for this table.
*/ | Returns a list of statistics for this table | getStatistics | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/engine/org/apache/derby/iapi/sql/dictionary/TableDescriptor.java",
"license": "apache-2.0",
"size": 46099
} | [
"java.util.List",
"org.apache.derby.iapi.error.StandardException"
] | import java.util.List; import org.apache.derby.iapi.error.StandardException; | import java.util.*; import org.apache.derby.iapi.error.*; | [
"java.util",
"org.apache.derby"
] | java.util; org.apache.derby; | 673,983 |
public static AnnotationSet getAnnotationsAtOffset(
AnnotationSet annotationSet, Long atOffset) {
// this returns all annotations that start at this atOffset OR AFTER!
AnnotationSet tmp = annotationSet.get(atOffset);
// so lets filter ...
List<Annotation> ret = new ArrayList<Annotation>();
Iterator<Annotation> it = tmp.iterator();
while(it.hasNext()) {
Annotation ann = it.next();
if(ann.getStartNode().getOffset().equals(atOffset)) {
ret.add(ann);
}
}
return Factory.createImmutableAnnotationSet(annotationSet.getDocument(), ret);
} | static AnnotationSet function( AnnotationSet annotationSet, Long atOffset) { AnnotationSet tmp = annotationSet.get(atOffset); List<Annotation> ret = new ArrayList<Annotation>(); Iterator<Annotation> it = tmp.iterator(); while(it.hasNext()) { Annotation ann = it.next(); if(ann.getStartNode().getOffset().equals(atOffset)) { ret.add(ann); } } return Factory.createImmutableAnnotationSet(annotationSet.getDocument(), ret); } | /**
* Return a the subset of annotations from the given annotation set
* that start exactly at the given offset.
*
* @param annotationSet the set of annotations from which to select
* @param atOffset the offset where the annoation to be returned should start
* @return an annotation set containing all the annotations from the original
* set that start at the given offset
*/ | Return a the subset of annotations from the given annotation set that start exactly at the given offset | getAnnotationsAtOffset | {
"repo_name": "GateNLP/gate-core",
"path": "src/main/java/gate/Utils.java",
"license": "lgpl-3.0",
"size": 59694
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,686,030 |
private Device getAllDeviceInfo(Device device) throws DeviceManagementException {
device.setDeviceInfo(this.getDeviceInfo(device));
device.setApplications(this.getInstalledApplications(device));
DeviceManager deviceManager = this.getDeviceManager(device.getType());
if (deviceManager == null) {
if (log.isDebugEnabled()) {
log.debug("Device Manager associated with the device type '" + device.getType() + "' is null. " +
"Therefore, not attempting method 'isEnrolled'");
}
return device;
}
Device dmsDevice =
deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType()));
if (dmsDevice != null) {
device.setFeatures(dmsDevice.getFeatures());
device.setProperties(dmsDevice.getProperties());
}
return device;
} | Device function(Device device) throws DeviceManagementException { device.setDeviceInfo(this.getDeviceInfo(device)); device.setApplications(this.getInstalledApplications(device)); DeviceManager deviceManager = this.getDeviceManager(device.getType()); if (deviceManager == null) { if (log.isDebugEnabled()) { log.debug(STR + device.getType() + STR + STR); } return device; } Device dmsDevice = deviceManager.getDevice(new DeviceIdentifier(device.getDeviceIdentifier(), device.getType())); if (dmsDevice != null) { device.setFeatures(dmsDevice.getFeatures()); device.setProperties(dmsDevice.getProperties()); } return device; } | /**
* Returns all the available information (device-info, location, applications and plugin-db data)
* of a given device.
*/ | Returns all the available information (device-info, location, applications and plugin-db data) of a given device | getAllDeviceInfo | {
"repo_name": "Supun94/carbon-device-mgt",
"path": "components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java",
"license": "apache-2.0",
"size": 81189
} | [
"org.wso2.carbon.device.mgt.common.Device",
"org.wso2.carbon.device.mgt.common.DeviceIdentifier",
"org.wso2.carbon.device.mgt.common.DeviceManagementException",
"org.wso2.carbon.device.mgt.common.DeviceManager"
] | import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManager; | import org.wso2.carbon.device.mgt.common.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 1,203,059 |
private ErasureCodingPolicyInfo[] checkErasureCodingPolicies()
throws IOException {
ErasureCodingPolicyInfo[] policiesRouter =
routerProtocol.getErasureCodingPolicies();
assertNotNull(policiesRouter);
ErasureCodingPolicyInfo[] policiesNamenode =
nnProtocol.getErasureCodingPolicies();
Arrays.sort(policiesRouter, EC_POLICY_CMP);
Arrays.sort(policiesNamenode, EC_POLICY_CMP);
assertArrayEquals(policiesRouter, policiesNamenode);
return policiesRouter;
} | ErasureCodingPolicyInfo[] function() throws IOException { ErasureCodingPolicyInfo[] policiesRouter = routerProtocol.getErasureCodingPolicies(); assertNotNull(policiesRouter); ErasureCodingPolicyInfo[] policiesNamenode = nnProtocol.getErasureCodingPolicies(); Arrays.sort(policiesRouter, EC_POLICY_CMP); Arrays.sort(policiesNamenode, EC_POLICY_CMP); assertArrayEquals(policiesRouter, policiesNamenode); return policiesRouter; } | /**
* Check the erasure coding policies in the Router and the Namenode.
* @return The erasure coding policies.
*/ | Check the erasure coding policies in the Router and the Namenode | checkErasureCodingPolicies | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterRpc.java",
"license": "apache-2.0",
"size": 44294
} | [
"java.io.IOException",
"java.util.Arrays",
"org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyInfo",
"org.junit.Assert"
] | import java.io.IOException; import java.util.Arrays; import org.apache.hadoop.hdfs.protocol.ErasureCodingPolicyInfo; import org.junit.Assert; | import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.protocol.*; import org.junit.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.io; java.util; org.apache.hadoop; org.junit; | 1,490,772 |
CompletableFuture<Long> sendPing(); | CompletableFuture<Long> sendPing(); | /**
* Send a PING on this exchanges connection, and completes the returned CF
* with the number of milliseconds it took to get a valid response.
* It may also complete exceptionally
*/ | Send a PING on this exchanges connection, and completes the returned CF with the number of milliseconds it took to get a valid response. It may also complete exceptionally | sendPing | {
"repo_name": "md-5/jdk10",
"path": "test/jdk/java/net/httpclient/http2/server/Http2TestExchange.java",
"license": "gpl-2.0",
"size": 2254
} | [
"java.util.concurrent.CompletableFuture"
] | import java.util.concurrent.CompletableFuture; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 340,061 |
public void waitForCompletion() throws IOException;
/**
* Returns the current state of the Job.
* {@link JobStatus} | void function() throws IOException; /** * Returns the current state of the Job. * {@link JobStatus} | /**
* Blocks until the job is complete.
*
* @throws IOException
*/ | Blocks until the job is complete | waitForCompletion | {
"repo_name": "steveloughran/hadoop-mapreduce",
"path": "src/java/org/apache/hadoop/mapred/RunningJob.java",
"license": "apache-2.0",
"size": 6801
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,283,377 |
public static boolean checkProvider(XMultiServiceFactory xProvider)
{
// check the provider we have
if (xProvider == null)
{
System.out.println("No provider available. Cannot access configuration data.");
return false;
}
try
{
// check the provider implementation
XServiceInfo xProviderServices =
UnoRuntime.queryInterface( XServiceInfo.class, xProvider );
if (xProviderServices == null ||
!xProviderServices.supportsService("com.sun.star.configuration.ConfigurationProvider"))
{
System.out.println("WARNING: The provider is not a com.sun.star.configuration.ConfigurationProvider");
}
if (xProviderServices != null)
{
System.out.println("Using provider implementation: " + xProviderServices.getImplementationName());
}
return true;
}
catch (com.sun.star.uno.RuntimeException e)
{
System.err.println("ERROR: Failure while checking the provider services.");
e.printStackTrace();
return false;
}
} | static boolean function(XMultiServiceFactory xProvider) { if (xProvider == null) { System.out.println(STR); return false; } try { XServiceInfo xProviderServices = UnoRuntime.queryInterface( XServiceInfo.class, xProvider ); if (xProviderServices == null !xProviderServices.supportsService(STR)) { System.out.println(STR); } if (xProviderServices != null) { System.out.println(STR + xProviderServices.getImplementationName()); } return true; } catch (com.sun.star.uno.RuntimeException e) { System.err.println(STR); e.printStackTrace(); return false; } } | /** Do some simple checks, if there is a valid ConfigurationProvider
*/ | Do some simple checks, if there is a valid ConfigurationProvider | checkProvider | {
"repo_name": "Limezero/libreoffice",
"path": "odk/examples/DevelopersGuide/Config/ConfigExamples.java",
"license": "gpl-3.0",
"size": 40351
} | [
"com.sun.star.lang.XMultiServiceFactory",
"com.sun.star.lang.XServiceInfo",
"com.sun.star.uno.UnoRuntime"
] | import com.sun.star.lang.XMultiServiceFactory; import com.sun.star.lang.XServiceInfo; import com.sun.star.uno.UnoRuntime; | import com.sun.star.lang.*; import com.sun.star.uno.*; | [
"com.sun.star"
] | com.sun.star; | 2,077,179 |
public void testFullCss() {
AbsoluteLayout layout = new AbsoluteLayout();
Button b = new Button();
layout.addComponent(b, CSS);
assertEquals(CSS_VALUE, layout.getPosition(b).getTopValue());
assertEquals(CSS_VALUE, layout.getPosition(b).getBottomValue());
assertEquals(CSS_VALUE, layout.getPosition(b).getLeftValue());
assertEquals(CSS_VALUE, layout.getPosition(b).getRightValue());
assertEquals(Sizeable.Unit.PIXELS, layout.getPosition(b).getTopUnits());
assertEquals(Sizeable.Unit.PICAS, layout.getPosition(b)
.getBottomUnits());
assertEquals(Sizeable.Unit.EM, layout.getPosition(b).getLeftUnits());
assertEquals(Sizeable.Unit.PERCENTAGE, layout.getPosition(b)
.getRightUnits());
assertEquals(7, layout.getPosition(b).getZIndex());
assertEquals(CSS, layout.getPosition(b).getCSSString());
} | void function() { AbsoluteLayout layout = new AbsoluteLayout(); Button b = new Button(); layout.addComponent(b, CSS); assertEquals(CSS_VALUE, layout.getPosition(b).getTopValue()); assertEquals(CSS_VALUE, layout.getPosition(b).getBottomValue()); assertEquals(CSS_VALUE, layout.getPosition(b).getLeftValue()); assertEquals(CSS_VALUE, layout.getPosition(b).getRightValue()); assertEquals(Sizeable.Unit.PIXELS, layout.getPosition(b).getTopUnits()); assertEquals(Sizeable.Unit.PICAS, layout.getPosition(b) .getBottomUnits()); assertEquals(Sizeable.Unit.EM, layout.getPosition(b).getLeftUnits()); assertEquals(Sizeable.Unit.PERCENTAGE, layout.getPosition(b) .getRightUnits()); assertEquals(7, layout.getPosition(b).getZIndex()); assertEquals(CSS, layout.getPosition(b).getCSSString()); } | /**
* Add component, setting all attributes using CSS, assert getter agree
*/ | Add component, setting all attributes using CSS, assert getter agree | testFullCss | {
"repo_name": "Flamenco/vaadin",
"path": "server/tests/src/com/vaadin/tests/server/component/absolutelayout/ComponentPositionTest.java",
"license": "apache-2.0",
"size": 8042
} | [
"com.vaadin.server.Sizeable",
"com.vaadin.ui.AbsoluteLayout",
"com.vaadin.ui.Button"
] | import com.vaadin.server.Sizeable; import com.vaadin.ui.AbsoluteLayout; import com.vaadin.ui.Button; | import com.vaadin.server.*; import com.vaadin.ui.*; | [
"com.vaadin.server",
"com.vaadin.ui"
] | com.vaadin.server; com.vaadin.ui; | 482,358 |
public TDepartment getTDepartment(Connection connection)
throws TorqueException
{
if (aTDepartment == null && (!ObjectUtils.equals(this.departmentID, null)))
{
aTDepartment = TDepartmentPeer.retrieveByPK(SimpleKey.keyFor(this.departmentID), connection);
}
return aTDepartment;
} | TDepartment function(Connection connection) throws TorqueException { if (aTDepartment == null && (!ObjectUtils.equals(this.departmentID, null))) { aTDepartment = TDepartmentPeer.retrieveByPK(SimpleKey.keyFor(this.departmentID), connection); } return aTDepartment; } | /**
* Return the associated TDepartment object
* If it was not retrieved before, the object is retrieved from
* the database using the passed connection
*
* @param connection the connection used to retrieve the associated object
* from the database, if it was not retrieved before
* @return the associated TDepartment object
* @throws TorqueException
*/ | Return the associated TDepartment object If it was not retrieved before, the object is retrieved from the database using the passed connection | getTDepartment | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTPerson.java",
"license": "gpl-3.0",
"size": 1013508
} | [
"com.aurel.track.persist.TDepartment",
"com.aurel.track.persist.TDepartmentPeer",
"java.sql.Connection",
"org.apache.commons.lang.ObjectUtils",
"org.apache.torque.TorqueException",
"org.apache.torque.om.SimpleKey"
] | import com.aurel.track.persist.TDepartment; import com.aurel.track.persist.TDepartmentPeer; import java.sql.Connection; import org.apache.commons.lang.ObjectUtils; import org.apache.torque.TorqueException; import org.apache.torque.om.SimpleKey; | import com.aurel.track.persist.*; import java.sql.*; import org.apache.commons.lang.*; import org.apache.torque.*; import org.apache.torque.om.*; | [
"com.aurel.track",
"java.sql",
"org.apache.commons",
"org.apache.torque"
] | com.aurel.track; java.sql; org.apache.commons; org.apache.torque; | 1,206,762 |
public static double inverse(@NotNull Number number) {
return 1 / (number.doubleValue());
} | static double function(@NotNull Number number) { return 1 / (number.doubleValue()); } | /**
* Inverse a number.
* @param number {@link Number} instance.
* @return {@link Double} value.
*/ | Inverse a number | inverse | {
"repo_name": "protoman92/JavaUtilities",
"path": "src/main/java/org/swiften/javautilities/number/HNumbers.java",
"license": "apache-2.0",
"size": 3448
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,245,851 |
protected Ellipse2D getWaferEdge(Rectangle2D plotArea) {
Ellipse2D edge = new Ellipse2D.Double();
double diameter = plotArea.getWidth();
double upperLeftX = plotArea.getX();
double upperLeftY = plotArea.getY();
//get major dimension
if (plotArea.getWidth() != plotArea.getHeight()) {
double major = 0d;
double minor = 0d;
if (plotArea.getWidth() > plotArea.getHeight()) {
major = plotArea.getWidth();
minor = plotArea.getHeight();
}
else {
major = plotArea.getHeight();
minor = plotArea.getWidth();
}
//ellipse diameter is the minor dimension
diameter = minor;
//set upperLeft point
if (plotArea.getWidth() == minor) { // x is minor
upperLeftY = plotArea.getY() + (major - minor) / 2;
}
else { // y is minor
upperLeftX = plotArea.getX() + (major - minor) / 2;
}
}
edge.setFrame(upperLeftX, upperLeftY, diameter, diameter);
return edge;
}
| Ellipse2D function(Rectangle2D plotArea) { Ellipse2D edge = new Ellipse2D.Double(); double diameter = plotArea.getWidth(); double upperLeftX = plotArea.getX(); double upperLeftY = plotArea.getY(); if (plotArea.getWidth() != plotArea.getHeight()) { double major = 0d; double minor = 0d; if (plotArea.getWidth() > plotArea.getHeight()) { major = plotArea.getWidth(); minor = plotArea.getHeight(); } else { major = plotArea.getHeight(); minor = plotArea.getWidth(); } diameter = minor; if (plotArea.getWidth() == minor) { upperLeftY = plotArea.getY() + (major - minor) / 2; } else { upperLeftX = plotArea.getX() + (major - minor) / 2; } } edge.setFrame(upperLeftX, upperLeftY, diameter, diameter); return edge; } | /**
* Calculates the location of the waferedge.
*
* @param plotArea the plot area.
*
* @return The wafer edge.
*/ | Calculates the location of the waferedge | getWaferEdge | {
"repo_name": "Mr-Steve/LTSpice_Library_Manager",
"path": "libs/jfreechart-1.0.16/source/org/jfree/chart/plot/WaferMapPlot.java",
"license": "gpl-2.0",
"size": 14695
} | [
"java.awt.geom.Ellipse2D",
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Ellipse2D; import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,026,941 |
public void treeExpanded(TreeExpansionEvent event) {
DefaultMutableTreeNode node = getTreeNode(event.getPath());
Name fnode = getNameNode(node);
if (fnode != null) {
getNodes(fnode);
m_model.reload(node);
}
} | void function(TreeExpansionEvent event) { DefaultMutableTreeNode node = getTreeNode(event.getPath()); Name fnode = getNameNode(node); if (fnode != null) { getNodes(fnode); m_model.reload(node); } } | /**
* Method called when a tree node is expanded, currently not used.
*
* @param event Swing TreeExpansionEvent object
* @return void
*/ | Method called when a tree node is expanded, currently not used | treeExpanded | {
"repo_name": "yyhpys/ccnx-trace-interest",
"path": "javasrc/src/org/ccnx/ccn/utils/explorer/ContentExplorer.java",
"license": "lgpl-2.1",
"size": 40065
} | [
"javax.swing.event.TreeExpansionEvent",
"javax.swing.tree.DefaultMutableTreeNode"
] | import javax.swing.event.TreeExpansionEvent; import javax.swing.tree.DefaultMutableTreeNode; | import javax.swing.event.*; import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 2,900,499 |
void serialize(ObjectOutputStream oos) throws IOException {
oos.writeUTF( uuid );
oos.writeBoolean( name != null );
if ( name != null ) {
oos.writeUTF( name );
}
} | void serialize(ObjectOutputStream oos) throws IOException { oos.writeUTF( uuid ); oos.writeBoolean( name != null ); if ( name != null ) { oos.writeUTF( name ); } } | /**
* Custom serialization hook used during Session serialization.
*
* @param oos The stream to which to write the factory
* @throws IOException Indicates problems writing out the serial data stream
*/ | Custom serialization hook used during Session serialization | serialize | {
"repo_name": "HerrB92/obp",
"path": "OpenBeaconPackage/libraries/hibernate-release-4.2.7.SP1/project/hibernate-core/src/main/java/org/hibernate/internal/SessionFactoryImpl.java",
"license": "mit",
"size": 67544
} | [
"java.io.IOException",
"java.io.ObjectOutputStream"
] | import java.io.IOException; import java.io.ObjectOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 658,463 |
public static MozuClient<com.mozu.api.contracts.productadmin.Product> updateProductClient(com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, String responseFields) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.ProductUrl.updateProductUrl(productCode, responseFields);
String verb = "PUT";
Class<?> clz = com.mozu.api.contracts.productadmin.Product.class;
MozuClient<com.mozu.api.contracts.productadmin.Product> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.Product>) MozuClientFactory.getInstance(clz);
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
mozuClient.setBody(product);
mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString());
return mozuClient;
} | static MozuClient<com.mozu.api.contracts.productadmin.Product> function(com.mozu.api.DataViewMode dataViewMode, com.mozu.api.contracts.productadmin.Product product, String productCode, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.ProductUrl.updateProductUrl(productCode, responseFields); String verb = "PUT"; Class<?> clz = com.mozu.api.contracts.productadmin.Product.class; MozuClient<com.mozu.api.contracts.productadmin.Product> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.Product>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); mozuClient.setBody(product); mozuClient.addHeader(Headers.X_VOL_DATAVIEW_MODE ,dataViewMode.toString()); return mozuClient; } | /**
* Updates one or more properties of a product definition in a master catalog.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.Product> mozuClient=UpdateProductClient(dataViewMode, product, productCode, responseFields);
* client.setBaseAddress(url);
* client.executeRequest();
* Product product = client.Result();
* </code></pre></p>
* @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
* @param responseFields Use this field to include those fields which are not included by default.
* @param product The properties of a product, referenced and used by carts, orders, wish lists, and returns.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.Product>
* @see com.mozu.api.contracts.productadmin.Product
* @see com.mozu.api.contracts.productadmin.Product
*/ | Updates one or more properties of a product definition in a master catalog. <code><code> MozuClient mozuClient=UpdateProductClient(dataViewMode, product, productCode, responseFields); client.setBaseAddress(url); client.executeRequest(); Product product = client.Result(); </code></code> | updateProductClient | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/ProductClient.java",
"license": "mit",
"size": 27851
} | [
"com.mozu.api.DataViewMode",
"com.mozu.api.Headers",
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] | import com.mozu.api.DataViewMode; import com.mozu.api.Headers; import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 2,650,171 |
return x;
}
/**
* Sets the value of the x property.
*
* @param value
* allowed object is
* {@link BigDecimal } | return x; } /** * Sets the value of the x property. * * @param value * allowed object is * {@link BigDecimal } | /**
* Gets the value of the x property.
*
* @return
* possible object is
* {@link BigDecimal }
*
*/ | Gets the value of the x property | getX | {
"repo_name": "HaydenElza/OGP2",
"path": "geoportal_1/src/main/java/org/opengeoportal/ogc/wmc/jaxb/CoordType.java",
"license": "gpl-3.0",
"size": 3095
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 2,908,842 |
@Internal
SemanticProperties getSemanticProperties();
// --------------------------------------------------------------------------------------------
// Fluent API methods
// --------------------------------------------------------------------------------------------
| SemanticProperties getSemanticProperties(); | /**
* Gets the semantic properties that have been set for the user-defined functions (UDF).
*
* @return The semantic properties of the UDF.
*/ | Gets the semantic properties that have been set for the user-defined functions (UDF) | getSemanticProperties | {
"repo_name": "WangTaoTheTonic/flink",
"path": "flink-java/src/main/java/org/apache/flink/api/java/operators/UdfOperator.java",
"license": "apache-2.0",
"size": 4147
} | [
"org.apache.flink.api.common.operators.SemanticProperties"
] | import org.apache.flink.api.common.operators.SemanticProperties; | import org.apache.flink.api.common.operators.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,805,130 |
public Builder withCamelContext(CamelContext camelContext) {
this.camelContext = camelContext;
return this;
} | Builder function(CamelContext camelContext) { this.camelContext = camelContext; return this; } | /**
* CamelContext to be used
*/ | CamelContext to be used | withCamelContext | {
"repo_name": "christophd/camel",
"path": "core/camel-support/src/main/java/org/apache/camel/support/PropertyBindingSupport.java",
"license": "apache-2.0",
"size": 87517
} | [
"org.apache.camel.CamelContext"
] | import org.apache.camel.CamelContext; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,772,744 |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Retain this fragment across configuration changes.
setRetainInstance(true);
} | void function(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setRetainInstance(true); } | /**
* This method will only be called once when the retained
* Fragment is first created.
*/ | This method will only be called once when the retained Fragment is first created | onCreate | {
"repo_name": "juanignaciomolina/txtr",
"path": "src/main/java/eu/siacs/conversations/api/ApiAsyncTask.java",
"license": "gpl-3.0",
"size": 4531
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 334,175 |
public static IncomingToken getToken(final String token)
throws NoTokenProvidedException {
try {
return new IncomingToken(token);
} catch (MissingParameterException e) {
throw new NoTokenProvidedException("No user token provided");
}
} | static IncomingToken function(final String token) throws NoTokenProvidedException { try { return new IncomingToken(token); } catch (MissingParameterException e) { throw new NoTokenProvidedException(STR); } } | /** Create an incoming token from a string, throwing an appropriate exception if the token is
* null or empty.
* @param token the token.
* @return an incoming token object.
* @throws NoTokenProvidedException if the token is null or empty.
*/ | Create an incoming token from a string, throwing an appropriate exception if the token is null or empty | getToken | {
"repo_name": "MrCreosote/auth2",
"path": "src/us/kbase/auth2/service/common/ServiceCommon.java",
"license": "mit",
"size": 9698
} | [
"us.kbase.auth2.lib.exceptions.MissingParameterException",
"us.kbase.auth2.lib.exceptions.NoTokenProvidedException",
"us.kbase.auth2.lib.token.IncomingToken"
] | import us.kbase.auth2.lib.exceptions.MissingParameterException; import us.kbase.auth2.lib.exceptions.NoTokenProvidedException; import us.kbase.auth2.lib.token.IncomingToken; | import us.kbase.auth2.lib.exceptions.*; import us.kbase.auth2.lib.token.*; | [
"us.kbase.auth2"
] | us.kbase.auth2; | 86,290 |
public Map<String, Integer> statisticsEnd() {
HashMap<String, Integer> map = New.hashMap();
FileStore fs = store.getFileStore();
int reads = fs == null ? 0 : (int) (fs.getReadCount() - statisticsStart);
map.put("reads", reads);
return map;
}
}
private static class MVInDoubtTransaction implements InDoubtTransaction {
private final MVStore store;
private final Transaction transaction;
private int state = InDoubtTransaction.IN_DOUBT;
MVInDoubtTransaction(MVStore store, Transaction transaction) {
this.store = store;
this.transaction = transaction;
} | Map<String, Integer> function() { HashMap<String, Integer> map = New.hashMap(); FileStore fs = store.getFileStore(); int reads = fs == null ? 0 : (int) (fs.getReadCount() - statisticsStart); map.put("reads", reads); return map; } } private static class MVInDoubtTransaction implements InDoubtTransaction { private final MVStore store; private final Transaction transaction; private int state = InDoubtTransaction.IN_DOUBT; MVInDoubtTransaction(MVStore store, Transaction transaction) { this.store = store; this.transaction = transaction; } | /**
* Stop collecting statistics.
*
* @return the statistics
*/ | Stop collecting statistics | statisticsEnd | {
"repo_name": "votaguz/frostwire-desktop",
"path": "lib/jars-src/h2-1.4.186/src/main/org/h2/mvstore/db/MVTableEngine.java",
"license": "gpl-3.0",
"size": 14670
} | [
"java.util.HashMap",
"java.util.Map",
"org.h2.mvstore.FileStore",
"org.h2.mvstore.MVStore",
"org.h2.mvstore.db.TransactionStore",
"org.h2.store.InDoubtTransaction",
"org.h2.util.New"
] | import java.util.HashMap; import java.util.Map; import org.h2.mvstore.FileStore; import org.h2.mvstore.MVStore; import org.h2.mvstore.db.TransactionStore; import org.h2.store.InDoubtTransaction; import org.h2.util.New; | import java.util.*; import org.h2.mvstore.*; import org.h2.mvstore.db.*; import org.h2.store.*; import org.h2.util.*; | [
"java.util",
"org.h2.mvstore",
"org.h2.store",
"org.h2.util"
] | java.util; org.h2.mvstore; org.h2.store; org.h2.util; | 20,603 |
public VbridgeBuildHelper getBridge(String name) {
return getBridge(new VnodeName(name));
} | VbridgeBuildHelper function(String name) { return getBridge(new VnodeName(name)); } | /**
* Return the {@link VbridgeBuildHelper} instance associated with the
* specified vBridge.
*
* @param name The name of the vBridge.
* @return A {@link VbridgeBuildHelper} instance if found.
* {@code null} if not found.
*/ | Return the <code>VbridgeBuildHelper</code> instance associated with the specified vBridge | getBridge | {
"repo_name": "opendaylight/vtn",
"path": "manager/implementation/src/test/java/org/opendaylight/vtn/manager/internal/vnode/VtnBuildHelper.java",
"license": "epl-1.0",
"size": 23060
} | [
"org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName"
] | import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.VnodeName; | import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.types.rev150209.*; | [
"org.opendaylight.yang"
] | org.opendaylight.yang; | 513,943 |
void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc);
| void afterConstructor(ICoreService coreService, long methodId, long sensorTypeId, Object object, Object[] parameters, RegisteredSensorConfig rsc); | /**
* The bytecode is inserted after the constructor calls.
*
* @param coreService
* The core service.
* @param methodId
* The unique method id.
* @param sensorTypeId
* The unique sensor type id.
* @param object
* The class itself which contains the hook.
* @param parameters
* The array of parameters.
* @param rsc
* The {@link RegisteredSensorConfig} object which holds all the information of the
* executed method.
*/ | The bytecode is inserted after the constructor calls | afterConstructor | {
"repo_name": "kugelr/inspectIT",
"path": "Agent/src/info/novatec/inspectit/agent/hooking/IConstructorHook.java",
"license": "agpl-3.0",
"size": 1942
} | [
"info.novatec.inspectit.agent.config.impl.RegisteredSensorConfig",
"info.novatec.inspectit.agent.core.ICoreService"
] | import info.novatec.inspectit.agent.config.impl.RegisteredSensorConfig; import info.novatec.inspectit.agent.core.ICoreService; | import info.novatec.inspectit.agent.config.impl.*; import info.novatec.inspectit.agent.core.*; | [
"info.novatec.inspectit"
] | info.novatec.inspectit; | 997,638 |
private void loadPlaintextIds() throws JSONIOException, JSONException {
if (this.plaintextIds != null) {
JSONObject currentPlaintextId = null;
logger.debug("Loading in the plaintext ids file");
// reads the plaintext candidate ids
JSONArray plaintextCandidateIds = IOUtils.readJSONArrayFromFile(IOUtils.findFile(this.getSpec().getPlaintextCandidateIds(), this.getBasePath()));
logger.debug("Plaintext ids: {}", plaintextCandidateIds.toString());
// add the plaintext candidate ids in EC Point form into storage
for (int i = 0; i < plaintextCandidateIds.length(); i++) {
currentPlaintextId = plaintextCandidateIds.getJSONObject(i);
this.plaintextIds.add(ECUtils.constructECPointFromJSON(currentPlaintextId));
}
logger.debug("Successfully loaded the plaintext ids file");
}
} | void function() throws JSONIOException, JSONException { if (this.plaintextIds != null) { JSONObject currentPlaintextId = null; logger.debug(STR); JSONArray plaintextCandidateIds = IOUtils.readJSONArrayFromFile(IOUtils.findFile(this.getSpec().getPlaintextCandidateIds(), this.getBasePath())); logger.debug(STR, plaintextCandidateIds.toString()); for (int i = 0; i < plaintextCandidateIds.length(); i++) { currentPlaintextId = plaintextCandidateIds.getJSONObject(i); this.plaintextIds.add(ECUtils.constructECPointFromJSON(currentPlaintextId)); } logger.debug(STR); } } | /**
* Loads in the plaintext ids for the election. The plaintext ids file
* contains the unencrypted plaintext candidate ids which have been selected
* from the underlying EC curve used.
*
* @throws JSONIOException
* @throws JSONException
*/ | Loads in the plaintext ids for the election. The plaintext ids file contains the unencrypted plaintext candidate ids which have been selected from the underlying EC curve used | loadPlaintextIds | {
"repo_name": "jerumble/vVoteVerifier",
"path": "src/com/vvote/verifier/component/ComponentDataStore.java",
"license": "gpl-3.0",
"size": 12611
} | [
"com.vvote.thirdparty.json.orgjson.JSONArray",
"com.vvote.thirdparty.json.orgjson.JSONException",
"com.vvote.thirdparty.json.orgjson.JSONObject",
"com.vvote.verifierlibrary.exceptions.JSONIOException",
"com.vvote.verifierlibrary.utils.crypto.ECUtils",
"com.vvote.verifierlibrary.utils.io.IOUtils"
] | import com.vvote.thirdparty.json.orgjson.JSONArray; import com.vvote.thirdparty.json.orgjson.JSONException; import com.vvote.thirdparty.json.orgjson.JSONObject; import com.vvote.verifierlibrary.exceptions.JSONIOException; import com.vvote.verifierlibrary.utils.crypto.ECUtils; import com.vvote.verifierlibrary.utils.io.IOUtils; | import com.vvote.thirdparty.json.orgjson.*; import com.vvote.verifierlibrary.exceptions.*; import com.vvote.verifierlibrary.utils.crypto.*; import com.vvote.verifierlibrary.utils.io.*; | [
"com.vvote.thirdparty",
"com.vvote.verifierlibrary"
] | com.vvote.thirdparty; com.vvote.verifierlibrary; | 1,656,592 |
@Override
long executeOp(int daemonId, int inputIdx, String ignore)
throws IOException {
long start = Time.now();
clientProto.getBlockLocations(fileNames[daemonId][inputIdx], 0L, BLOCK_SIZE);
long end = Time.now();
return end-start;
}
}
class DeleteFileStats extends OpenFileStats {
// Operation types
static final String OP_DELETE_NAME = "delete";
static final String OP_DELETE_USAGE =
"-op " + OP_DELETE_NAME + OP_USAGE_ARGS;
DeleteFileStats(List<String> args) {
super(args);
} | long executeOp(int daemonId, int inputIdx, String ignore) throws IOException { long start = Time.now(); clientProto.getBlockLocations(fileNames[daemonId][inputIdx], 0L, BLOCK_SIZE); long end = Time.now(); return end-start; } } class DeleteFileStats extends OpenFileStats { static final String OP_DELETE_NAME = STR; static final String OP_DELETE_USAGE = STR + OP_DELETE_NAME + OP_USAGE_ARGS; DeleteFileStats(List<String> args) { super(args); } | /**
* Do file open.
*/ | Do file open | executeOp | {
"repo_name": "vlajos/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NNThroughputBenchmark.java",
"license": "apache-2.0",
"size": 54138
} | [
"java.io.IOException",
"java.util.List",
"org.apache.hadoop.util.Time"
] | import java.io.IOException; import java.util.List; import org.apache.hadoop.util.Time; | import java.io.*; import java.util.*; import org.apache.hadoop.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 1,389,629 |
@Override
public void paintSelectionBorder(Graphics g) {
Graphics2D g2 = (Graphics2D) g;
Stroke previousStroke = g2.getStroke();
boolean paintBorders = false;
// Border for a normal vertex which is selected
if (selected) {
g2.setStroke(GraphVertex.SELECTION_STROKE);
g.setColor(GraphVertex.SELECTED_BORDER_COLOR);
paintBorders = true;
}
// Paints the border if needed
if (paintBorders) {
Dimension d = getSize();
if(isPhenodata){
// Draw oval borders
g.drawOval(0, 0, d.width - 1, d.height - 1);
} else {
g.drawRect(0, 0, d.width - 1, d.height - 1);
}
}
// Sets the stroke as if was before this method
g2.setStroke(previousStroke);
} | void function(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke previousStroke = g2.getStroke(); boolean paintBorders = false; if (selected) { g2.setStroke(GraphVertex.SELECTION_STROKE); g.setColor(GraphVertex.SELECTED_BORDER_COLOR); paintBorders = true; } if (paintBorders) { Dimension d = getSize(); if(isPhenodata){ g.drawOval(0, 0, d.width - 1, d.height - 1); } else { g.drawRect(0, 0, d.width - 1, d.height - 1); } } g2.setStroke(previousStroke); } | /**
* Paint special borders for selected cells.
* This method is called by the paint method.
*/ | Paint special borders for selected cells. This method is called by the paint method | paintSelectionBorder | {
"repo_name": "ilarischeinin/chipster",
"path": "src/main/java/fi/csc/microarray/client/dataviews/vertexes/GraphRenderer.java",
"license": "gpl-3.0",
"size": 5534
} | [
"java.awt.Dimension",
"java.awt.Graphics",
"java.awt.Graphics2D",
"java.awt.Stroke"
] | import java.awt.Dimension; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Stroke; | import java.awt.*; | [
"java.awt"
] | java.awt; | 262,824 |
return new CosineSimilarityScoreScript(params);
}
}
private CosineSimilarityScoreScript(Map<String, Object> params) {
params.entrySet();
// get the terms
terms = (ArrayList<String>) params.get("terms");
weights = (ArrayList<Double>) params.get("weights");
// get the field
field = (String) params.get("field");
if (field == null || terms == null || weights == null) {
throw new ElasticSearchException("cannot initialize " + SCRIPT_NAME + ": field, terms or weights parameter missing!");
}
if (weights.size() != terms.size()) {
throw new ElasticSearchException("cannot initialize " + SCRIPT_NAME + ": terms and weights array must have same length!");
}
} | return new CosineSimilarityScoreScript(params); } } private CosineSimilarityScoreScript(Map<String, Object> params) { params.entrySet(); terms = (ArrayList<String>) params.get("terms"); weights = (ArrayList<Double>) params.get(STR); field = (String) params.get("field"); if (field == null terms == null weights == null) { throw new ElasticSearchException(STR + SCRIPT_NAME + STR); } if (weights.size() != terms.size()) { throw new ElasticSearchException(STR + SCRIPT_NAME + STR); } } | /**
* This method is called for every search on every shard.
*
* @param params
* list of script parameters passed with the query
* @return new native script
*/ | This method is called for every search on every shard | newScript | {
"repo_name": "AndreiArion/elasticsearch-loghash-plugin",
"path": "src/main/java/org/elasticsearch/examples/nativescript/script/CosineSimilarityScoreScript.java",
"license": "apache-2.0",
"size": 4088
} | [
"java.util.ArrayList",
"java.util.Map",
"org.elasticsearch.ElasticSearchException"
] | import java.util.ArrayList; import java.util.Map; import org.elasticsearch.ElasticSearchException; | import java.util.*; import org.elasticsearch.*; | [
"java.util",
"org.elasticsearch"
] | java.util; org.elasticsearch; | 805,399 |
@Override
protected CompletionStage<?> pollAsync(Queue<AsyncRunnable> queue) {
AsyncRunnable task = queue.poll();
return task != null ? task.runAsync() : null;
}
@FunctionalInterface
public interface RejectsListener { | CompletionStage<?> function(Queue<AsyncRunnable> queue) { AsyncRunnable task = queue.poll(); return task != null ? task.runAsync() : null; } public interface RejectsListener { | /**
* internal method, todo: exclude from docs.
*/ | internal method, todo: exclude from docs | pollAsync | {
"repo_name": "dlepex/jcext",
"path": "src/main/java/io/github/actorish4j/TaskEnqueuer.java",
"license": "apache-2.0",
"size": 4419
} | [
"java.util.Queue",
"java.util.concurrent.CompletionStage"
] | import java.util.Queue; import java.util.concurrent.CompletionStage; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,011,584 |
OperationCompletionRS uploadPhoto(MultipartFile file, Principal principal); | OperationCompletionRS uploadPhoto(MultipartFile file, Principal principal); | /**
* Upload user's photo
*
* @param file
* @param principal
* @return
*/ | Upload user's photo | uploadPhoto | {
"repo_name": "talisman1234/service-api",
"path": "src/main/java/com/epam/ta/reportportal/ws/controller/IFileStorageController.java",
"license": "gpl-3.0",
"size": 2118
} | [
"com.epam.ta.reportportal.ws.model.OperationCompletionRS",
"java.security.Principal",
"org.springframework.web.multipart.MultipartFile"
] | import com.epam.ta.reportportal.ws.model.OperationCompletionRS; import java.security.Principal; import org.springframework.web.multipart.MultipartFile; | import com.epam.ta.reportportal.ws.model.*; import java.security.*; import org.springframework.web.multipart.*; | [
"com.epam.ta",
"java.security",
"org.springframework.web"
] | com.epam.ta; java.security; org.springframework.web; | 587,857 |
public static BufferedImage toCompatibleImage(BufferedImage image) {
if (image.getColorModel().equals(
getGraphicsConfiguration().getColorModel())) {
return image;
}
BufferedImage compatibleImage =
getGraphicsConfiguration().createCompatibleImage(
image.getWidth(), image.getHeight(),
image.getTransparency());
Graphics g = compatibleImage.getGraphics();
g.drawImage(image, 0, 0, null);
g.dispose();
return compatibleImage;
}
| static BufferedImage function(BufferedImage image) { if (image.getColorModel().equals( getGraphicsConfiguration().getColorModel())) { return image; } BufferedImage compatibleImage = getGraphicsConfiguration().createCompatibleImage( image.getWidth(), image.getHeight(), image.getTransparency()); Graphics g = compatibleImage.getGraphics(); g.drawImage(image, 0, 0, null); g.dispose(); return compatibleImage; } | /**
* <p>Return a new compatible image that contains a copy of the specified
* image. This method ensures an image is compatible with the hardware,
* and therefore optimized for fast blitting operations.</p>
*
* @see #createCompatibleImage(java.awt.image.BufferedImage)
* @see #createCompatibleImage(java.awt.image.BufferedImage, int, int)
* @see #createCompatibleImage(int, int)
* @see #createCompatibleTranslucentImage(int, int)
* @see #loadCompatibleImage(java.net.URL)
* @param image the image to copy into a new compatible image
* @return a new compatible copy, with the
* same width and height and transparency and content, of <code>image</code>
*/ | Return a new compatible image that contains a copy of the specified image. This method ensures an image is compatible with the hardware, and therefore optimized for fast blitting operations | toCompatibleImage | {
"repo_name": "mars-sim/mars-sim",
"path": "mars-sim-ui/src/main/java/org/mars_sim/msp/ui/swing/tool/GraphicsUtilities.java",
"license": "gpl-3.0",
"size": 25837
} | [
"java.awt.Graphics",
"java.awt.image.BufferedImage"
] | import java.awt.Graphics; import java.awt.image.BufferedImage; | import java.awt.*; import java.awt.image.*; | [
"java.awt"
] | java.awt; | 1,640,535 |
void removeLedger(LedgerManager lm, Long ledgerId) throws Exception {
lm.removeLedgerMetadata(ledgerId, Version.ANY).get();
} | void removeLedger(LedgerManager lm, Long ledgerId) throws Exception { lm.removeLedgerMetadata(ledgerId, Version.ANY).get(); } | /**
* Remove ledger using lm synchronously.
*
* @param lm
* @param ledgerId
* @throws InterruptedException
*/ | Remove ledger using lm synchronously | removeLedger | {
"repo_name": "massakam/pulsar",
"path": "pulsar-metadata/src/test/java/org/apache/pulsar/metadata/bookkeeper/LedgerManagerIteratorTest.java",
"license": "apache-2.0",
"size": 18742
} | [
"org.apache.bookkeeper.meta.LedgerManager",
"org.apache.bookkeeper.versioning.Version"
] | import org.apache.bookkeeper.meta.LedgerManager; import org.apache.bookkeeper.versioning.Version; | import org.apache.bookkeeper.meta.*; import org.apache.bookkeeper.versioning.*; | [
"org.apache.bookkeeper"
] | org.apache.bookkeeper; | 280,887 |
public static SecretKey toAes128Key(String s) {
try {
// turn secretKey into 256 bit hash
MessageDigest digest = MessageDigest.getInstance("SHA-256");
digest.reset();
digest.update(s.getBytes("UTF-8"));
// Due to the stupid US export restriction JDK only ships 128bit version.
return new SecretKeySpec(digest.digest(),0,128/8, "AES");
} catch (NoSuchAlgorithmException e) {
throw new Error(e);
} catch (UnsupportedEncodingException e) {
throw new Error(e);
}
} | static SecretKey function(String s) { try { MessageDigest digest = MessageDigest.getInstance(STR); digest.reset(); digest.update(s.getBytes("UTF-8")); return new SecretKeySpec(digest.digest(),0,128/8, "AES"); } catch (NoSuchAlgorithmException e) { throw new Error(e); } catch (UnsupportedEncodingException e) { throw new Error(e); } } | /**
* Converts a string into 128-bit AES key.
* @since 1.308
*/ | Converts a string into 128-bit AES key | toAes128Key | {
"repo_name": "vivek/hudson",
"path": "core/src/main/java/hudson/Util.java",
"license": "mit",
"size": 40917
} | [
"java.io.UnsupportedEncodingException",
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException",
"javax.crypto.SecretKey",
"javax.crypto.spec.SecretKeySpec"
] | import java.io.UnsupportedEncodingException; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; | import java.io.*; import java.security.*; import javax.crypto.*; import javax.crypto.spec.*; | [
"java.io",
"java.security",
"javax.crypto"
] | java.io; java.security; javax.crypto; | 2,373,031 |
public static User getJobOwner(Connection conn, long jobId)
throws MissingParamException, DatabaseException, NoSuchJobException {
MissingParam.checkMissing(conn, "conn");
MissingParam.checkPositive(jobId, "jobId");
User owner = null;
PreparedStatement stmt = null;
ResultSet record = null;
try {
stmt = conn.prepareStatement(GET_JOB_OWNER_QUERY);
stmt.setLong(1, jobId);
record = stmt.executeQuery();
if (!record.next()) {
throw new NoSuchJobException(jobId);
} else {
long ownerId = record.getLong(1);
if (ownerId != NO_OWNER) {
owner = UserDB.getUser(conn, ownerId);
}
}
} catch (SQLException | DatabaseException e) {
throw new DatabaseException(
"An error occured while finding the job owner", e);
} finally {
DatabaseUtils.closeResultSets(record);
DatabaseUtils.closeStatements(stmt);
}
return owner;
} | static User function(Connection conn, long jobId) throws MissingParamException, DatabaseException, NoSuchJobException { MissingParam.checkMissing(conn, "conn"); MissingParam.checkPositive(jobId, "jobId"); User owner = null; PreparedStatement stmt = null; ResultSet record = null; try { stmt = conn.prepareStatement(GET_JOB_OWNER_QUERY); stmt.setLong(1, jobId); record = stmt.executeQuery(); if (!record.next()) { throw new NoSuchJobException(jobId); } else { long ownerId = record.getLong(1); if (ownerId != NO_OWNER) { owner = UserDB.getUser(conn, ownerId); } } } catch (SQLException DatabaseException e) { throw new DatabaseException( STR, e); } finally { DatabaseUtils.closeResultSets(record); DatabaseUtils.closeStatements(stmt); } return owner; } | /**
* Get the owner of a job
*
* @param conn
* A database exception
* @param jobId
* The job's database ID
* @return The owner of the job
* @throws MissingParamException
* If any parameters are missing
* @throws DatabaseException
* If a database error occurs
* @throws NoSuchJobException
* If the job does not exist
*/ | Get the owner of a job | getJobOwner | {
"repo_name": "squaregoldfish/QuinCe",
"path": "WebApp/src/uk/ac/exeter/QuinCe/jobs/JobManager.java",
"license": "gpl-3.0",
"size": 56040
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"uk.ac.exeter.QuinCe"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import uk.ac.exeter.QuinCe; | import java.sql.*; import uk.ac.exeter.*; | [
"java.sql",
"uk.ac.exeter"
] | java.sql; uk.ac.exeter; | 2,041,123 |
public List<GenPolynomial<C>> generators() {
List<? extends C> cogens = coFac.generators();
List<? extends GenPolynomial<C>> univs = univariateList();
List<GenPolynomial<C>> gens = new ArrayList<GenPolynomial<C>>(univs.size() + cogens.size());
for (C c : cogens) {
gens.add(getONE().multiply(c));
}
gens.addAll(univs);
return gens;
} | List<GenPolynomial<C>> function() { List<? extends C> cogens = coFac.generators(); List<? extends GenPolynomial<C>> univs = univariateList(); List<GenPolynomial<C>> gens = new ArrayList<GenPolynomial<C>>(univs.size() + cogens.size()); for (C c : cogens) { gens.add(getONE().multiply(c)); } gens.addAll(univs); return gens; } | /**
* Get a list of the generating elements.
* @return list of generators for the algebraic structure.
* @see edu.jas.structure.ElemFactory#generators()
*/ | Get a list of the generating elements | generators | {
"repo_name": "breandan/java-algebra-system",
"path": "src/edu/jas/poly/GenPolynomialRing.java",
"license": "gpl-2.0",
"size": 39543
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,533,898 |
@NotNull
public PsiElement createElement(ASTNode node) {
return null;
//return ANTLRv4ASTFactory.createInternalParseTreeNode(node);
} | PsiElement function(ASTNode node) { return null; } | /** Convert from internal parse node (AST they call it) to final PSI node. This
* converts only internal rule nodes apparently, not leaf nodes. Leaves
* are just tokens I guess.
*/ | Convert from internal parse node (AST they call it) to final PSI node. This converts only internal rule nodes apparently, not leaf nodes. Leaves are just tokens I guess | createElement | {
"repo_name": "luluorta/intellij-plugin-sysml",
"path": "src/java/org/apache/sysml/intellij/plugin/DMLParserDefinition.java",
"license": "apache-2.0",
"size": 2221
} | [
"com.intellij.lang.ASTNode",
"com.intellij.psi.PsiElement"
] | import com.intellij.lang.ASTNode; import com.intellij.psi.PsiElement; | import com.intellij.lang.*; import com.intellij.psi.*; | [
"com.intellij.lang",
"com.intellij.psi"
] | com.intellij.lang; com.intellij.psi; | 2,901,146 |
Observable<ServiceResponse<Void>> setOwnerAsync(String accountName, String setOwnerFilePath, String owner, String group); | Observable<ServiceResponse<Void>> setOwnerAsync(String accountName, String setOwnerFilePath, String owner, String group); | /**
* Sets the owner of a file or directory.
*
* @param accountName The Azure Data Lake Store account to execute filesystem operations on.
* @param setOwnerFilePath The Data Lake Store path (starting with '/') of the file or directory for which to set the owner.
* @param owner The AAD Object ID of the user owner of the file or directory. If empty, the property will remain unchanged.
* @param group The AAD Object ID of the group owner of the file or directory. If empty, the property will remain unchanged.
* @return the {@link ServiceResponse} object if successful.
*/ | Sets the owner of a file or directory | setOwnerAsync | {
"repo_name": "herveyw/azure-sdk-for-java",
"path": "azure-mgmt-datalake-store/src/main/java/com/microsoft/azure/management/datalake/store/FileSystems.java",
"license": "mit",
"size": 64716
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,667,089 |
private void setRegInfo(EventRegistration er, MarshalledObject hb) {
registation = er;
handback = hb;
} | void function(EventRegistration er, MarshalledObject hb) { registation = er; handback = hb; } | /**
* Set the registion and handback so we can do basic error checking
*/ | Set the registion and handback so we can do basic error checking | setRegInfo | {
"repo_name": "cdegroot/river",
"path": "qa/src/com/sun/jini/test/impl/norm/ExpiredLeaseTest.java",
"license": "apache-2.0",
"size": 8753
} | [
"java.rmi.MarshalledObject",
"net.jini.core.event.EventRegistration"
] | import java.rmi.MarshalledObject; import net.jini.core.event.EventRegistration; | import java.rmi.*; import net.jini.core.event.*; | [
"java.rmi",
"net.jini.core"
] | java.rmi; net.jini.core; | 1,368,737 |
public SliceBuilder slice() {
return sliceBuilder;
} | SliceBuilder function() { return sliceBuilder; } | /**
* Gets the slice used to filter the search hits, the top hits and the aggregations.
*/ | Gets the slice used to filter the search hits, the top hits and the aggregations | slice | {
"repo_name": "jimczi/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/builder/SearchSourceBuilder.java",
"license": "apache-2.0",
"size": 58393
} | [
"org.elasticsearch.search.slice.SliceBuilder"
] | import org.elasticsearch.search.slice.SliceBuilder; | import org.elasticsearch.search.slice.*; | [
"org.elasticsearch.search"
] | org.elasticsearch.search; | 2,654,857 |
private void notifyTaskFinish() {
if (mFinishState == null) {
mFinishState = new FinishState(Status.DOWNLOAD_STATUS_PAUSED);// default paused
}
int status = mFinishState.status;
int increaseSize = mFinishState.increaseSize;
FileDownloadStatusFailReason failReason = mFinishState.failReason;
switch (status) {
// pause,complete,error,means finish the task
case Status.DOWNLOAD_STATUS_PAUSED:
case Status.DOWNLOAD_STATUS_COMPLETED:
case Status.DOWNLOAD_STATUS_ERROR:
case Status.DOWNLOAD_STATUS_FILE_NOT_EXIST:
if (mIsNotifyTaskFinish.get()) {
return;
}
try {
mDownloadRecorder.recordStatus(getUrl(), status, increaseSize);
switch (status) {
case Status.DOWNLOAD_STATUS_PAUSED:
if (mOnFileDownloadStatusListener != null) {
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
mOnFileDownloadStatusListener.onFileDownloadStatusPaused(getDownloadFile());
Log.i(TAG, "file-downloader-status 记录【暂停状态】成功,url:" + getUrl());
}
}
break;
case Status.DOWNLOAD_STATUS_COMPLETED:
if (mOnFileDownloadStatusListener != null) {
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
mOnFileDownloadStatusListener.onFileDownloadStatusCompleted(getDownloadFile());
Log.i(TAG, "file-downloader-status 记录【完成状态】成功,url:" + getUrl());
}
}
break;
case Status.DOWNLOAD_STATUS_ERROR:
if (mOnFileDownloadStatusListener != null) {
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(),
getDownloadFile(), failReason);
Log.i(TAG, "file-downloader-status 记录【错误状态】成功,url:" + getUrl());
}
}
break;
case Status.DOWNLOAD_STATUS_FILE_NOT_EXIST:
if (mOnFileDownloadStatusListener != null) {
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(),
getDownloadFile(), failReason);
Log.i(TAG, "file-downloader-status 记录【文件不存在状态】成功,url:" + getUrl());
}
}
break;
}
} catch (Exception e) {
e.printStackTrace();
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
// error
try {
mDownloadRecorder.recordStatus(getUrl(), Status.DOWNLOAD_STATUS_ERROR, 0);
} catch (Exception e1) {
e1.printStackTrace();
}
if (mOnFileDownloadStatusListener != null) {
mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(), getDownloadFile(), new
OnFileDownloadStatusFailReason(getUrl(), e));
Log.e(TAG, "file-downloader-status 记录【暂停/完成/出错状态】失败,url:" + getUrl());
}
}
} finally {
// if not notify finish, notify paused by default
if (mIsNotifyTaskFinish.compareAndSet(false, true)) {
// if not notify, however paused status will be recorded
try {
mDownloadRecorder.recordStatus(getUrl(), Status.DOWNLOAD_STATUS_PAUSED, 0);
} catch (Exception e) {
e.printStackTrace();
}
if (mOnFileDownloadStatusListener != null) {
mOnFileDownloadStatusListener.onFileDownloadStatusPaused(getDownloadFile());
}
Log.i(TAG, "file-downloader-status 记录【暂停状态】成功,url:" + getUrl());
}
}
break;
}
} | void function() { if (mFinishState == null) { mFinishState = new FinishState(Status.DOWNLOAD_STATUS_PAUSED); } int status = mFinishState.status; int increaseSize = mFinishState.increaseSize; FileDownloadStatusFailReason failReason = mFinishState.failReason; switch (status) { case Status.DOWNLOAD_STATUS_PAUSED: case Status.DOWNLOAD_STATUS_COMPLETED: case Status.DOWNLOAD_STATUS_ERROR: case Status.DOWNLOAD_STATUS_FILE_NOT_EXIST: if (mIsNotifyTaskFinish.get()) { return; } try { mDownloadRecorder.recordStatus(getUrl(), status, increaseSize); switch (status) { case Status.DOWNLOAD_STATUS_PAUSED: if (mOnFileDownloadStatusListener != null) { if (mIsNotifyTaskFinish.compareAndSet(false, true)) { mOnFileDownloadStatusListener.onFileDownloadStatusPaused(getDownloadFile()); Log.i(TAG, STR + getUrl()); } } break; case Status.DOWNLOAD_STATUS_COMPLETED: if (mOnFileDownloadStatusListener != null) { if (mIsNotifyTaskFinish.compareAndSet(false, true)) { mOnFileDownloadStatusListener.onFileDownloadStatusCompleted(getDownloadFile()); Log.i(TAG, STR + getUrl()); } } break; case Status.DOWNLOAD_STATUS_ERROR: if (mOnFileDownloadStatusListener != null) { if (mIsNotifyTaskFinish.compareAndSet(false, true)) { mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(), getDownloadFile(), failReason); Log.i(TAG, STR + getUrl()); } } break; case Status.DOWNLOAD_STATUS_FILE_NOT_EXIST: if (mOnFileDownloadStatusListener != null) { if (mIsNotifyTaskFinish.compareAndSet(false, true)) { mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(), getDownloadFile(), failReason); Log.i(TAG, STR + getUrl()); } } break; } } catch (Exception e) { e.printStackTrace(); if (mIsNotifyTaskFinish.compareAndSet(false, true)) { try { mDownloadRecorder.recordStatus(getUrl(), Status.DOWNLOAD_STATUS_ERROR, 0); } catch (Exception e1) { e1.printStackTrace(); } if (mOnFileDownloadStatusListener != null) { mOnFileDownloadStatusListener.onFileDownloadStatusFailed(getUrl(), getDownloadFile(), new OnFileDownloadStatusFailReason(getUrl(), e)); Log.e(TAG, STR + getUrl()); } } } finally { if (mIsNotifyTaskFinish.compareAndSet(false, true)) { try { mDownloadRecorder.recordStatus(getUrl(), Status.DOWNLOAD_STATUS_PAUSED, 0); } catch (Exception e) { e.printStackTrace(); } if (mOnFileDownloadStatusListener != null) { mOnFileDownloadStatusListener.onFileDownloadStatusPaused(getDownloadFile()); } Log.i(TAG, STR + getUrl()); } } break; } } | /**
* notify the task finish
*/ | notify the task finish | notifyTaskFinish | {
"repo_name": "wlfcolin/file-downloader",
"path": "FileDownloader/src/main/java/org/wlf/filedownloader/file_download/DownloadTaskImpl.java",
"license": "apache-2.0",
"size": 37381
} | [
"org.wlf.filedownloader.base.Log",
"org.wlf.filedownloader.base.Status",
"org.wlf.filedownloader.listener.OnFileDownloadStatusListener"
] | import org.wlf.filedownloader.base.Log; import org.wlf.filedownloader.base.Status; import org.wlf.filedownloader.listener.OnFileDownloadStatusListener; | import org.wlf.filedownloader.base.*; import org.wlf.filedownloader.listener.*; | [
"org.wlf.filedownloader"
] | org.wlf.filedownloader; | 2,598,645 |
@Override
public void setCrossOrigin(CrossOrigin crossorigin)
{
throw new UnsupportedOperationException(
"It is not allowed to set the crossorigin attribute for source tag");
} | void function(CrossOrigin crossorigin) { throw new UnsupportedOperationException( STR); } | /**
* Unsupported for source tag
*/ | Unsupported for source tag | setCrossOrigin | {
"repo_name": "mosoft521/wicket",
"path": "wicket-core/src/main/java/org/apache/wicket/markup/html/image/ExternalSource.java",
"license": "apache-2.0",
"size": 3146
} | [
"org.apache.wicket.markup.html.CrossOrigin"
] | import org.apache.wicket.markup.html.CrossOrigin; | import org.apache.wicket.markup.html.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 2,100,260 |
public void fitFunction() throws FunctionEvaluationException, OptimizationException {
NelderMead nmx = new NelderMead();
SimpleScalarValueChecker convergedChecker_ = new SimpleScalarValueChecker(1e-6,-1);
double[][] wxData = getDataAsArray(0);
MultiVariateZCalibrationFunction mvcx = new MultiVariateZCalibrationFunction(wxData);
double[] params0_ = new double[5]; // initial estimates:
params0_[0] = 37; // TODO: better estimate for c
params0_[1] = 200; // Estimate for w0
params0_[2] = 10; // TODO: better estimate for d
params0_[3] = 1; // TODO: better estimate for A
params0_[4] = 1; // TODO: better estimate for B
nmx.setStartConfiguration(params0_);
nmx.setConvergenceChecker(convergedChecker_);
nmx.setMaxIterations(maxIterations_);
double[] paramsOut;
RealPointValuePair result = nmx.optimize(mvcx, GoalType.MINIMIZE, params0_);
paramsOut = result.getPoint();
// write fit result to Results Table:
ResultsTable res = new ResultsTable();
res.incrementCounter();
res.addValue("c", paramsOut[0]);
res.addValue("w0", paramsOut[1]);
res.addValue("d", paramsOut[2]);
res.addValue("A", paramsOut[3]);
res.addValue("B", paramsOut[4]);
fitFunctionWx_ = paramsOut;
double[][] yxData = getDataAsArray(1);
MultiVariateZCalibrationFunction yvcx = new MultiVariateZCalibrationFunction(yxData);
nmx.setStartConfiguration(params0_);
result = nmx.optimize(yvcx, GoalType.MINIMIZE, params0_);
paramsOut = result.getPoint();
res.incrementCounter();
res.addValue("c", paramsOut[0]);
res.addValue("w0", paramsOut[1]);
res.addValue("d", paramsOut[2]);
res.addValue("A", paramsOut[3]);
res.addValue("B", paramsOut[4]);
res.show("Fit Parameters");
fitFunctionWy_ = paramsOut;
plotFitFunctions();
}
| void function() throws FunctionEvaluationException, OptimizationException { NelderMead nmx = new NelderMead(); SimpleScalarValueChecker convergedChecker_ = new SimpleScalarValueChecker(1e-6,-1); double[][] wxData = getDataAsArray(0); MultiVariateZCalibrationFunction mvcx = new MultiVariateZCalibrationFunction(wxData); double[] params0_ = new double[5]; params0_[0] = 37; params0_[1] = 200; params0_[2] = 10; params0_[3] = 1; params0_[4] = 1; nmx.setStartConfiguration(params0_); nmx.setConvergenceChecker(convergedChecker_); nmx.setMaxIterations(maxIterations_); double[] paramsOut; RealPointValuePair result = nmx.optimize(mvcx, GoalType.MINIMIZE, params0_); paramsOut = result.getPoint(); ResultsTable res = new ResultsTable(); res.incrementCounter(); res.addValue("c", paramsOut[0]); res.addValue("w0", paramsOut[1]); res.addValue("d", paramsOut[2]); res.addValue("A", paramsOut[3]); res.addValue("B", paramsOut[4]); fitFunctionWx_ = paramsOut; double[][] yxData = getDataAsArray(1); MultiVariateZCalibrationFunction yvcx = new MultiVariateZCalibrationFunction(yxData); nmx.setStartConfiguration(params0_); result = nmx.optimize(yvcx, GoalType.MINIMIZE, params0_); paramsOut = result.getPoint(); res.incrementCounter(); res.addValue("c", paramsOut[0]); res.addValue("w0", paramsOut[1]); res.addValue("d", paramsOut[2]); res.addValue("A", paramsOut[3]); res.addValue("B", paramsOut[4]); res.show(STR); fitFunctionWy_ = paramsOut; plotFitFunctions(); } | /**
* Creates fitFunctionWx_ and fitFunctionWy_ based on data in data_
*
*
* @throws org.apache.commons.math.FunctionEvaluationException
* @throws org.apache.commons.math.optimization.OptimizationException
*/ | Creates fitFunctionWx_ and fitFunctionWy_ based on data in data_ | fitFunction | {
"repo_name": "kmdouglass/Micro-Manager",
"path": "plugins/Gaussian/source/edu/valelab/gaussianfit/fitting/ZCalibrator.java",
"license": "mit",
"size": 7715
} | [
"org.apache.commons.math.FunctionEvaluationException",
"org.apache.commons.math.optimization.GoalType",
"org.apache.commons.math.optimization.OptimizationException",
"org.apache.commons.math.optimization.RealPointValuePair",
"org.apache.commons.math.optimization.SimpleScalarValueChecker",
"org.apache.comm... | import org.apache.commons.math.FunctionEvaluationException; import org.apache.commons.math.optimization.GoalType; import org.apache.commons.math.optimization.OptimizationException; import org.apache.commons.math.optimization.RealPointValuePair; import org.apache.commons.math.optimization.SimpleScalarValueChecker; import org.apache.commons.math.optimization.direct.NelderMead; | import org.apache.commons.math.*; import org.apache.commons.math.optimization.*; import org.apache.commons.math.optimization.direct.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,784,993 |
EClass getModelElementWithStatistics(); | EClass getModelElementWithStatistics(); | /**
* Returns the meta object for class '{@link de.hub.clickwatch.model.ModelElementWithStatistics <em>Model Element With Statistics</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Model Element With Statistics</em>'.
* @see de.hub.clickwatch.model.ModelElementWithStatistics
* @generated
*/ | Returns the meta object for class '<code>de.hub.clickwatch.model.ModelElementWithStatistics Model Element With Statistics</code>'. | getModelElementWithStatistics | {
"repo_name": "markus1978/clickwatch",
"path": "core/de.hub.clickwatch.core/src/de/hub/clickwatch/model/ClickWatchModelPackage.java",
"license": "apache-2.0",
"size": 56229
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,033,537 |
public final List<String> getArgv() {
return getArgv(getInternalOutputFile());
} | final List<String> function() { return getArgv(getInternalOutputFile()); } | /**
* Returns a new, mutable list of command and arguments (argv) to be passed
* to the gcc subprocess.
*/ | Returns a new, mutable list of command and arguments (argv) to be passed to the gcc subprocess | getArgv | {
"repo_name": "kamalmarhubi/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppCompileAction.java",
"license": "apache-2.0",
"size": 58095
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,359,271 |
public HTable getHTable() {
return hTable;
}
public HBaseWriter(AtomicInteger serialNo, final WriterPoolSettings settings, HBaseParameters parameters) throws IOException {
// Instantiates a new HBaseWriter for the WriterPool to use in heritrix.
super(serialNo, settings, null);
Preconditions.checkArgument(parameters != null);
this.hbaseParameters = parameters;
Configuration hbaseConfiguration = HBaseConfiguration.create();
// set the zk quorum list
log.info("setting zookeeper quorum to : " + hbaseParameters.getZkQuorum());
hbaseConfiguration.setStrings(HConstants.ZOOKEEPER_QUORUM, hbaseParameters.getZkQuorum().split(","));
// set the client port
log.info("setting zookeeper client Port to : " + hbaseParameters.getZkPort());
hbaseConfiguration.setInt(getHbaseParameters().getZookeeperClientPortKey(), hbaseParameters.getZkPort());
// create a crawl table
initializeCrawlTable(hbaseConfiguration, hbaseParameters.getHbaseTableName());
this.hTable = new HTable(hbaseConfiguration, hbaseParameters.getHbaseTableName());
} | HTable function() { return hTable; } public HBaseWriter(AtomicInteger serialNo, final WriterPoolSettings settings, HBaseParameters parameters) throws IOException { super(serialNo, settings, null); Preconditions.checkArgument(parameters != null); this.hbaseParameters = parameters; Configuration hbaseConfiguration = HBaseConfiguration.create(); log.info(STR + hbaseParameters.getZkQuorum()); hbaseConfiguration.setStrings(HConstants.ZOOKEEPER_QUORUM, hbaseParameters.getZkQuorum().split(",")); log.info(STR + hbaseParameters.getZkPort()); hbaseConfiguration.setInt(getHbaseParameters().getZookeeperClientPortKey(), hbaseParameters.getZkPort()); initializeCrawlTable(hbaseConfiguration, hbaseParameters.getHbaseTableName()); this.hTable = new HTable(hbaseConfiguration, hbaseParameters.getHbaseTableName()); } | /**
* Gets the HTable client.
*
* @return the client
*/ | Gets the HTable client | getHTable | {
"repo_name": "OpenSourceMasters/hbase-writer",
"path": "src/main/java/org/archive/io/hbase/HBaseWriter.java",
"license": "lgpl-2.1",
"size": 39709
} | [
"com.google.common.base.Preconditions",
"java.io.IOException",
"java.util.concurrent.atomic.AtomicInteger",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.HBaseConfiguration",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.client.HTable",
"org.archive.io.WriterPoolSet... | import com.google.common.base.Preconditions; import java.io.IOException; import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.client.HTable; import org.archive.io.WriterPoolSettings; | import com.google.common.base.*; import java.io.*; import java.util.concurrent.atomic.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.archive.io.*; | [
"com.google.common",
"java.io",
"java.util",
"org.apache.hadoop",
"org.archive.io"
] | com.google.common; java.io; java.util; org.apache.hadoop; org.archive.io; | 2,653,192 |
synchronized boolean tryStartDownload(final DownloadRequest req) {
final EmailServiceProxy service = EmailServiceUtils.getServiceForAccount(
AttachmentService.this, req.mAccountId);
// Do not download the same attachment multiple times
boolean alreadyInProgress = mDownloadsInProgress.get(req.mAttachmentId) != null;
if (alreadyInProgress) {
debugTrace("This attachment #%d is already in progress", req.mAttachmentId);
return false;
}
try {
startDownload(service, req);
} catch (RemoteException e) {
// TODO: Consider whether we need to do more in this case...
// For now, fix up our data to reflect the failure
cancelDownload(req);
}
return true;
} | synchronized boolean tryStartDownload(final DownloadRequest req) { final EmailServiceProxy service = EmailServiceUtils.getServiceForAccount( AttachmentService.this, req.mAccountId); boolean alreadyInProgress = mDownloadsInProgress.get(req.mAttachmentId) != null; if (alreadyInProgress) { debugTrace(STR, req.mAttachmentId); return false; } try { startDownload(service, req); } catch (RemoteException e) { cancelDownload(req); } return true; } | /**
* Attempt to execute the DownloadRequest, enforcing the maximum downloads per account
* parameter
* @param req the DownloadRequest
* @return whether or not the download was started
*/ | Attempt to execute the DownloadRequest, enforcing the maximum downloads per account parameter | tryStartDownload | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/Email/provider_src/com/android/email/service/AttachmentService.java",
"license": "gpl-3.0",
"size": 66935
} | [
"android.os.RemoteException",
"com.android.emailcommon.service.EmailServiceProxy"
] | import android.os.RemoteException; import com.android.emailcommon.service.EmailServiceProxy; | import android.os.*; import com.android.emailcommon.service.*; | [
"android.os",
"com.android.emailcommon"
] | android.os; com.android.emailcommon; | 1,077,112 |
public void halfOp(UserHostmask user) {
if (user == null)
throw new IllegalArgumentException("Can't set halfop on null user");
setMode("+h " + user.getNick());
} | void function(UserHostmask user) { if (user == null) throw new IllegalArgumentException(STR); setMode(STR + user.getNick()); } | /**
* Grants owner privileges to a user on a channel. Successful use of this
* method may require the bot to have operator or halfOp status itself.
* <p>
* <b>Warning:</b> Not all IRC servers support this. Some servers may even
* use it to mean something else!
*
* @param user
*/ | Grants owner privileges to a user on a channel. Successful use of this method may require the bot to have operator or halfOp status itself. Warning: Not all IRC servers support this. Some servers may even use it to mean something else | halfOp | {
"repo_name": "xmaxing/RxTwitch_MVP_Dagger",
"path": "pircbotx-2.1/src/main/java/org/pircbotx/output/OutputChannel.java",
"license": "mit",
"size": 16697
} | [
"org.pircbotx.UserHostmask"
] | import org.pircbotx.UserHostmask; | import org.pircbotx.*; | [
"org.pircbotx"
] | org.pircbotx; | 520,260 |
public static final RecaptchaEnterpriseServiceClient create(
RecaptchaEnterpriseServiceSettings settings) throws IOException {
return new RecaptchaEnterpriseServiceClient(settings);
} | static final RecaptchaEnterpriseServiceClient function( RecaptchaEnterpriseServiceSettings settings) throws IOException { return new RecaptchaEnterpriseServiceClient(settings); } | /**
* Constructs an instance of RecaptchaEnterpriseServiceClient, using the given settings. The
* channels are created based on the settings passed in, or defaults for any settings that are not
* set.
*/ | Constructs an instance of RecaptchaEnterpriseServiceClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set | create | {
"repo_name": "googleapis/java-recaptchaenterprise",
"path": "google-cloud-recaptchaenterprise/src/main/java/com/google/cloud/recaptchaenterprise/v1/RecaptchaEnterpriseServiceClient.java",
"license": "apache-2.0",
"size": 68119
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,699,723 |
public static void stopNestedScroll(View view) {
IMPL.stopNestedScroll(view);
} | static void function(View view) { IMPL.stopNestedScroll(view); } | /**
* Stop a nested scroll in progress.
*
* <p>Calling this method when a nested scroll is not currently in progress is harmless.</p>
*
* @see #startNestedScroll(View, int)
*/ | Stop a nested scroll in progress. Calling this method when a nested scroll is not currently in progress is harmless | stopNestedScroll | {
"repo_name": "rytina/dukecon_appsgenerator",
"path": "org.applause.lang.generator.android/sdk/extras/android/support/v4/src/java/android/support/v4/view/ViewCompat.java",
"license": "epl-1.0",
"size": 120271
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,471,474 |
public static void ensureLocalpartDoesNotIncludeFurtherExcludedCharacters(String localpart)
throws XmppStringprepException {
ensurePartDoesNotContain(XmppAddressParttype.localpart, localpart, LOCALPART_FURTHER_EXCLUDED_CHARACTERS);
} | static void function(String localpart) throws XmppStringprepException { ensurePartDoesNotContain(XmppAddressParttype.localpart, localpart, LOCALPART_FURTHER_EXCLUDED_CHARACTERS); } | /**
* Ensure that the input string does not contain any of the further excluded characters of XMPP localparts.
*
* @param localpart the input string.
* @throws XmppStringprepException if one of the further excluded characters is found.
* @see <a href="https://tools.ietf.org/html/rfc7622#section-3.3.1">RFC 7622 § 3.3.1</a>
*/ | Ensure that the input string does not contain any of the further excluded characters of XMPP localparts | ensureLocalpartDoesNotIncludeFurtherExcludedCharacters | {
"repo_name": "Flowdalic/jxmpp",
"path": "jxmpp-core/src/main/java/org/jxmpp/stringprep/simple/SimpleXmppStringprep.java",
"license": "apache-2.0",
"size": 5069
} | [
"org.jxmpp.XmppAddressParttype",
"org.jxmpp.stringprep.XmppStringprepException"
] | import org.jxmpp.XmppAddressParttype; import org.jxmpp.stringprep.XmppStringprepException; | import org.jxmpp.*; import org.jxmpp.stringprep.*; | [
"org.jxmpp",
"org.jxmpp.stringprep"
] | org.jxmpp; org.jxmpp.stringprep; | 577,337 |
protected void addCurrent_12_reacPropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_Triplex_node_current_12_reac_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_Triplex_node_current_12_reac_feature", "_UI_Triplex_node_type"),
VisGridPackage.eINSTANCE.getTriplex_node_Current_12_reac(),
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
} | void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), VisGridPackage.eINSTANCE.getTriplex_node_Current_12_reac(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); } | /**
* This adds a property descriptor for the Current 12 reac feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds a property descriptor for the Current 12 reac feature. | addCurrent_12_reacPropertyDescriptor | {
"repo_name": "mikesligo/visGrid",
"path": "ie.tcd.gmf.visGrid.edit/src/visGrid/provider/Triplex_nodeItemProvider.java",
"license": "gpl-3.0",
"size": 50747
} | [
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] | import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; | import org.eclipse.emf.edit.provider.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,261,505 |
protected List<ValidationError> checkStreamFilterUsage(PDDocument doc)
{
List<ValidationError> ve = new ArrayList<>();
List<?> filters = doc.getDocumentCatalog().getMetadata().getFilters();
if (!filters.isEmpty())
{
ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MAIN,
"Using stream filter on metadata dictionary is forbidden"));
}
return ve;
} | List<ValidationError> function(PDDocument doc) { List<ValidationError> ve = new ArrayList<>(); List<?> filters = doc.getDocumentCatalog().getMetadata().getFilters(); if (!filters.isEmpty()) { ve.add(new ValidationError(PreflightConstants.ERROR_METADATA_MAIN, STR)); } return ve; } | /**
* Check if metadata dictionary has no stream filter
*
* @param doc the document to check.
* @return the list of validation errors.
*/ | Check if metadata dictionary has no stream filter | checkStreamFilterUsage | {
"repo_name": "kalaspuffar/pdfbox",
"path": "preflight/src/main/java/org/apache/pdfbox/preflight/process/MetadataValidationProcess.java",
"license": "apache-2.0",
"size": 12373
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.pdfbox.pdmodel.PDDocument",
"org.apache.pdfbox.preflight.PreflightConstants",
"org.apache.pdfbox.preflight.ValidationResult"
] | import java.util.ArrayList; import java.util.List; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.preflight.PreflightConstants; import org.apache.pdfbox.preflight.ValidationResult; | import java.util.*; import org.apache.pdfbox.pdmodel.*; import org.apache.pdfbox.preflight.*; | [
"java.util",
"org.apache.pdfbox"
] | java.util; org.apache.pdfbox; | 2,682,989 |
public Observable<ServiceResponse<OriginInner>> updateWithServiceResponseAsync(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (profileName == null) {
throw new IllegalArgumentException("Parameter profileName is required and cannot be null.");
}
if (endpointName == null) {
throw new IllegalArgumentException("Parameter endpointName is required and cannot be null.");
}
if (originName == null) {
throw new IllegalArgumentException("Parameter originName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (originUpdateProperties == null) {
throw new IllegalArgumentException("Parameter originUpdateProperties is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
}
Validator.validate(originUpdateProperties);
Observable<Response<ResponseBody>> observable = service.update(resourceGroupName, profileName, endpointName, originName, this.client.subscriptionId(), originUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<OriginInner>() { }.getType());
} | Observable<ServiceResponse<OriginInner>> function(String resourceGroupName, String profileName, String endpointName, String originName, OriginUpdateParametersInner originUpdateProperties) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (profileName == null) { throw new IllegalArgumentException(STR); } if (endpointName == null) { throw new IllegalArgumentException(STR); } if (originName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (originUpdateProperties == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } Validator.validate(originUpdateProperties); Observable<Response<ResponseBody>> observable = service.update(resourceGroupName, profileName, endpointName, originName, this.client.subscriptionId(), originUpdateProperties, this.client.apiVersion(), this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPutOrPatchResultAsync(observable, new TypeToken<OriginInner>() { }.getType()); } | /**
* Updates an existing origin within an endpoint.
*
* @param resourceGroupName Name of the Resource group within the Azure subscription.
* @param profileName Name of the CDN profile which is unique within the resource group.
* @param endpointName Name of the endpoint under the profile which is unique globally.
* @param originName Name of the origin which is unique within the endpoint.
* @param originUpdateProperties Origin properties
* @return the observable for the request
*/ | Updates an existing origin within an endpoint | updateWithServiceResponseAsync | {
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/OriginsInner.java",
"license": "mit",
"size": 35589
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.rest.ServiceResponse",
"com.microsoft.rest.Validator"
] | import com.google.common.reflect.TypeToken; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; | import com.google.common.reflect.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.rest"
] | com.google.common; com.microsoft.rest; | 527,190 |
public DataPipe.ProducerHandle readProducerHandle(int offset, boolean nullable) {
return readUntypedHandle(offset, nullable).toDataPipeProducerHandle();
} | DataPipe.ProducerHandle function(int offset, boolean nullable) { return readUntypedHandle(offset, nullable).toDataPipeProducerHandle(); } | /**
* Deserializes a |ProducerHandle| at the given offset.
*/ | Deserializes a |ProducerHandle| at the given offset | readProducerHandle | {
"repo_name": "Teamxrtc/webrtc-streaming-node",
"path": "third_party/webrtc/src/chromium/src/third_party/mojo/src/mojo/public/java/bindings/src/org/chromium/mojo/bindings/Decoder.java",
"license": "mit",
"size": 27116
} | [
"org.chromium.mojo.system.DataPipe"
] | import org.chromium.mojo.system.DataPipe; | import org.chromium.mojo.system.*; | [
"org.chromium.mojo"
] | org.chromium.mojo; | 2,716,891 |
public static String getPackage(String moduleId, TaskReference.Phase phase) {
String name = getLocation(moduleId, phase).toPath('.');
return name;
} | static String function(String moduleId, TaskReference.Phase phase) { String name = getLocation(moduleId, phase).toPath('.'); return name; } | /**
* Returns the package name.
* @param moduleId the target module ID
* @param phase the target phase
* @return the corresponded package name
*/ | Returns the package name | getPackage | {
"repo_name": "ashigeru/asakusafw-compiler",
"path": "compiler-project/extension-externalio/src/main/java/com/asakusafw/lang/compiler/extension/externalio/Naming.java",
"license": "apache-2.0",
"size": 3147
} | [
"com.asakusafw.lang.compiler.api.reference.TaskReference"
] | import com.asakusafw.lang.compiler.api.reference.TaskReference; | import com.asakusafw.lang.compiler.api.reference.*; | [
"com.asakusafw.lang"
] | com.asakusafw.lang; | 2,584,656 |
private void readSettings() {
try (BufferedReader br = new BufferedReader(new FileReader("weather.config"))) {
apikey = br.readLine();
} catch (FileNotFoundException ex) {
configurationFileMissing();
} catch (IOException ex) {
exit(4);
}
} | void function() { try (BufferedReader br = new BufferedReader(new FileReader(STR))) { apikey = br.readLine(); } catch (FileNotFoundException ex) { configurationFileMissing(); } catch (IOException ex) { exit(4); } } | /**
* Read api key from configuration file
*/ | Read api key from configuration file | readSettings | {
"repo_name": "5AI-2015-TPI-pollini/progetto-java-xml-marcodelu",
"path": "src/Weather/Reader.java",
"license": "gpl-2.0",
"size": 5591
} | [
"java.io.BufferedReader",
"java.io.FileNotFoundException",
"java.io.FileReader",
"java.io.IOException",
"java.lang.System"
] | import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.lang.System; | import java.io.*; import java.lang.*; | [
"java.io",
"java.lang"
] | java.io; java.lang; | 2,419,012 |
public static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values)
{
cursorDoubleToContentValues(cursor, field, values, field);
} | static void function(Cursor cursor, String field, ContentValues values) { cursorDoubleToContentValues(cursor, field, values, field); } | /**
* Reads a Double out of a field in a Cursor and writes it to a Map.
*
* @param cursor The cursor to read from
* @param field The REAL field to read
* @param values The {@link ContentValues} to put the value into
*/ | Reads a Double out of a field in a Cursor and writes it to a Map | cursorDoubleToCursorValues | {
"repo_name": "JuudeDemos/android-sdk-20",
"path": "src/android/database/DatabaseUtils.java",
"license": "apache-2.0",
"size": 54432
} | [
"android.content.ContentValues"
] | import android.content.ContentValues; | import android.content.*; | [
"android.content"
] | android.content; | 889,972 |
private void breakSqlIndex(Ignite ig, String cacheName) throws Exception {
GridQueryProcessor qry = ((IgniteEx)ig).context().query();
GridCacheContext<Object, Object> ctx = ((IgniteEx)ig).cachex(cacheName).context();
GridDhtLocalPartition locPart = ctx.topology().localPartitions().get(0);
GridIterator<CacheDataRow> it = ctx.group().offheap().partitionIterator(locPart.id());
for (int i = 0; i < 500; i++) {
if (!it.hasNextX()) {
System.out.println("Early exit for index corruption, keys processed: " + i);
break;
}
CacheDataRow row = it.nextX();
ctx.shared().database().checkpointReadLock();
try {
qry.remove(ctx, row);
}
finally {
ctx.shared().database().checkpointReadUnlock();
}
}
} | void function(Ignite ig, String cacheName) throws Exception { GridQueryProcessor qry = ((IgniteEx)ig).context().query(); GridCacheContext<Object, Object> ctx = ((IgniteEx)ig).cachex(cacheName).context(); GridDhtLocalPartition locPart = ctx.topology().localPartitions().get(0); GridIterator<CacheDataRow> it = ctx.group().offheap().partitionIterator(locPart.id()); for (int i = 0; i < 500; i++) { if (!it.hasNextX()) { System.out.println(STR + i); break; } CacheDataRow row = it.nextX(); ctx.shared().database().checkpointReadLock(); try { qry.remove(ctx, row); } finally { ctx.shared().database().checkpointReadUnlock(); } } } | /**
* Removes some entries from H2 trees skipping partition updates. This effectively breaks the index.
*/ | Removes some entries from H2 trees skipping partition updates. This effectively breaks the index | breakSqlIndex | {
"repo_name": "ptupitsyn/ignite",
"path": "modules/indexing/src/test/java/org/apache/ignite/util/GridCommandHandlerIndexingTest.java",
"license": "apache-2.0",
"size": 12131
} | [
"org.apache.ignite.Ignite",
"org.apache.ignite.internal.IgniteEx",
"org.apache.ignite.internal.processors.cache.GridCacheContext",
"org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition",
"org.apache.ignite.internal.processors.cache.persistence.CacheDataRow",
"org.apac... | import org.apache.ignite.Ignite; import org.apache.ignite.internal.IgniteEx; import org.apache.ignite.internal.processors.cache.GridCacheContext; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.GridDhtLocalPartition; import org.apache.ignite.internal.processors.cache.persistence.CacheDataRow; import org.apache.ignite.internal.processors.query.GridQueryProcessor; import org.apache.ignite.internal.util.lang.GridIterator; | import org.apache.ignite.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.processors.cache.*; import org.apache.ignite.internal.processors.cache.distributed.dht.topology.*; import org.apache.ignite.internal.processors.cache.persistence.*; import org.apache.ignite.internal.processors.query.*; import org.apache.ignite.internal.util.lang.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 15,151 |
public Set<SupplyPoint> getSupplyPoints() {
return Collections.unmodifiableSet(supplyPoints);
}
| Set<SupplyPoint> function() { return Collections.unmodifiableSet(supplyPoints); } | /**
* Gets the set of supply points.
*
* @return the set of supply points
*/ | Gets the set of supply points | getSupplyPoints | {
"repo_name": "ptgrogan/spacenet",
"path": "src/main/java/edu/mit/spacenet/simulator/DemandSimulator.java",
"license": "apache-2.0",
"size": 8595
} | [
"edu.mit.spacenet.scenario.SupplyEdge",
"java.util.Collections",
"java.util.Set"
] | import edu.mit.spacenet.scenario.SupplyEdge; import java.util.Collections; import java.util.Set; | import edu.mit.spacenet.scenario.*; import java.util.*; | [
"edu.mit.spacenet",
"java.util"
] | edu.mit.spacenet; java.util; | 2,015,483 |
public String remove() {
FacesContext context = FacesContext.getCurrentInstance();
Map map = context.getExternalContext().getRequestParameterMap();
String title = (String) map.get("title");
CD cd = (CD) itemMap.get(title);
itemMap.remove(cd.getTitle());
itemMap.remove(title);
items.remove(cd);
return "remove";
}
| String function() { FacesContext context = FacesContext.getCurrentInstance(); Map map = context.getExternalContext().getRequestParameterMap(); String title = (String) map.get("title"); CD cd = (CD) itemMap.get(title); itemMap.remove(cd.getTitle()); itemMap.remove(title); items.remove(cd); return STR; } | /**
* TODO DOCUMENT ME!
*
* @return TODO DOCUMENT ME!
*/ | TODO DOCUMENT ME | remove | {
"repo_name": "asanzdiego/curso-jsf-hibernate-spring-2012",
"path": "src/jsf-04-facelets/src/com/arcmind/jsfquickstart/controller/ShoppingCartController.java",
"license": "gpl-3.0",
"size": 2538
} | [
"java.util.Map",
"javax.faces.context.FacesContext"
] | import java.util.Map; import javax.faces.context.FacesContext; | import java.util.*; import javax.faces.context.*; | [
"java.util",
"javax.faces"
] | java.util; javax.faces; | 1,481,653 |
public SecurityDomain.Builder getSecurityDomainBuilder() {
return securityDomainBuilder;
} | SecurityDomain.Builder function() { return securityDomainBuilder; } | /**
* Definition of Builder, which will be used for creation of security domain.
*/ | Definition of Builder, which will be used for creation of security domain | getSecurityDomainBuilder | {
"repo_name": "CodeSmell/camel",
"path": "components/camel-elytron/src/main/java/org/apache/camel/component/elytron/ElytronComponent.java",
"license": "apache-2.0",
"size": 7341
} | [
"org.wildfly.security.auth.server.SecurityDomain"
] | import org.wildfly.security.auth.server.SecurityDomain; | import org.wildfly.security.auth.server.*; | [
"org.wildfly.security"
] | org.wildfly.security; | 1,293,315 |
@Override
public byte[] toBinary() {
final ByteBuffer buffer = ByteBuffer.allocate(VarintUtils.unsignedLongByteLength(count));
VarintUtils.writeUnsignedLong(count, buffer);
return buffer.array();
} | byte[] function() { final ByteBuffer buffer = ByteBuffer.allocate(VarintUtils.unsignedLongByteLength(count)); VarintUtils.writeUnsignedLong(count, buffer); return buffer.array(); } | /**
* Serialize the statistic value to binary.
*/ | Serialize the statistic value to binary | toBinary | {
"repo_name": "locationtech/geowave",
"path": "examples/java-api/src/main/java/org/locationtech/geowave/examples/stats/WordCountStatistic.java",
"license": "apache-2.0",
"size": 7266
} | [
"java.nio.ByteBuffer",
"org.locationtech.geowave.core.index.VarintUtils"
] | import java.nio.ByteBuffer; import org.locationtech.geowave.core.index.VarintUtils; | import java.nio.*; import org.locationtech.geowave.core.index.*; | [
"java.nio",
"org.locationtech.geowave"
] | java.nio; org.locationtech.geowave; | 832,345 |
public Vector3D intersection(final Line line) {
final Vector3D direction = line.getDirection();
final double dot = w.dotProduct(direction);
if (FastMath.abs(dot) < 1.0e-10) {
return null;
}
final Vector3D point = line.toSpace((Point<Euclidean1D>) Vector1D.ZERO);
final double k = -(originOffset + w.dotProduct(point)) / dot;
return new Vector3D(1.0, point, k, direction);
} | Vector3D function(final Line line) { final Vector3D direction = line.getDirection(); final double dot = w.dotProduct(direction); if (FastMath.abs(dot) < 1.0e-10) { return null; } final Vector3D point = line.toSpace((Point<Euclidean1D>) Vector1D.ZERO); final double k = -(originOffset + w.dotProduct(point)) / dot; return new Vector3D(1.0, point, k, direction); } | /** Get the intersection of a line with the instance.
* @param line line intersecting the instance
* @return intersection point between between the line and the
* instance (null if the line is parallel to the instance)
*/ | Get the intersection of a line with the instance | intersection | {
"repo_name": "sdinot/hipparchus",
"path": "hipparchus-geometry/src/main/java/org/hipparchus/geometry/euclidean/threed/Plane.java",
"license": "apache-2.0",
"size": 18856
} | [
"org.hipparchus.geometry.Point",
"org.hipparchus.geometry.euclidean.oned.Euclidean1D",
"org.hipparchus.geometry.euclidean.oned.Vector1D",
"org.hipparchus.util.FastMath"
] | import org.hipparchus.geometry.Point; import org.hipparchus.geometry.euclidean.oned.Euclidean1D; import org.hipparchus.geometry.euclidean.oned.Vector1D; import org.hipparchus.util.FastMath; | import org.hipparchus.geometry.*; import org.hipparchus.geometry.euclidean.oned.*; import org.hipparchus.util.*; | [
"org.hipparchus.geometry",
"org.hipparchus.util"
] | org.hipparchus.geometry; org.hipparchus.util; | 1,074,905 |
public ActivityStack getStack( )
{
return stack;
} | ActivityStack function( ) { return stack; } | /**
* Returns the stack that changes.
*
* @return the stack that changes
*/ | Returns the stack that changes | getStack | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/activity/ActivityStackEvent.java",
"license": "epl-1.0",
"size": 2281
} | [
"org.eclipse.birt.report.model.activity.ActivityStack"
] | import org.eclipse.birt.report.model.activity.ActivityStack; | import org.eclipse.birt.report.model.activity.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 825,985 |
private static DetailAST getNextSiblingSkipComments(DetailAST node) {
DetailAST result = node.getNextSibling();
while (result.getType() == TokenTypes.SINGLE_LINE_COMMENT
|| result.getType() == TokenTypes.BLOCK_COMMENT_BEGIN) {
result = result.getNextSibling();
}
return result;
} | static DetailAST function(DetailAST node) { DetailAST result = node.getNextSibling(); while (result.getType() == TokenTypes.SINGLE_LINE_COMMENT result.getType() == TokenTypes.BLOCK_COMMENT_BEGIN) { result = result.getNextSibling(); } return result; } | /**
* Get next sibling node skipping any comment nodes.
* @param node current node
* @return next sibling
*/ | Get next sibling node skipping any comment nodes | getNextSiblingSkipComments | {
"repo_name": "baratali/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/utils/BlockCommentPosition.java",
"license": "lgpl-2.1",
"size": 9463
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.TokenTypes"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; | import com.puppycrawl.tools.checkstyle.api.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 1,052,788 |
public void sendConsultants(ObjectOutputStream out) {
} | void function(ObjectOutputStream out) { } | /**
* Send some new consultants to the server.
* @param out - the output stream connecting this client to the server.
*/ | Send some new consultants to the server | sendConsultants | {
"repo_name": "bkstamm67/java",
"path": "old/session2/assignment8/net/client/InvoiceClient.java",
"license": "mit",
"size": 6027
} | [
"java.io.ObjectOutputStream"
] | import java.io.ObjectOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,147,347 |
byte[] getBlock(long key) {
byte[] data = map.get(key);
if (data == null) {
throw DataUtils.newIllegalStateException(
DataUtils.ERROR_BLOCK_NOT_FOUND,
"Block {0} not found", key);
}
return data;
}
static class Stream extends InputStream {
private final StreamStore store;
private byte[] oneByteBuffer;
private ByteBuffer idBuffer;
private ByteArrayInputStream buffer;
private long skip;
private final long length;
private long pos;
Stream(StreamStore store, byte[] id) {
this.store = store;
this.length = store.length(id);
this.idBuffer = ByteBuffer.wrap(id);
} | byte[] getBlock(long key) { byte[] data = map.get(key); if (data == null) { throw DataUtils.newIllegalStateException( DataUtils.ERROR_BLOCK_NOT_FOUND, STR, key); } return data; } static class Stream extends InputStream { private final StreamStore store; private byte[] oneByteBuffer; private ByteBuffer idBuffer; private ByteArrayInputStream buffer; private long skip; private final long length; private long pos; Stream(StreamStore store, byte[] id) { this.store = store; this.length = store.length(id); this.idBuffer = ByteBuffer.wrap(id); } | /**
* Get the block.
*
* @param key the key
* @return the block
*/ | Get the block | getBlock | {
"repo_name": "vdr007/ThriftyPaxos",
"path": "src/applications/h2/src/main/org/h2/mvstore/StreamStore.java",
"license": "apache-2.0",
"size": 17081
} | [
"java.io.ByteArrayInputStream",
"java.io.InputStream",
"java.nio.ByteBuffer"
] | import java.io.ByteArrayInputStream; import java.io.InputStream; import java.nio.ByteBuffer; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 374,203 |
JsoHelper.setAttribute(jsObj, "adjustMaximumByMajorUnit", value);
}
| JsoHelper.setAttribute(jsObj, STR, value); } | /**
* Indicates whether to extend maximum beyond data's maximum to the nearest
* majorUnit.
*
* @param value
*/ | Indicates whether to extend maximum beyond data's maximum to the nearest majorUnit | setAdjustMaximumByMajorUnit | {
"repo_name": "ahome-it/ahome-touch",
"path": "ahome-touch/src/main/java/com/ait/toolkit/sencha/touch/charts/client/axis/NumericAxis.java",
"license": "apache-2.0",
"size": 2653
} | [
"com.ait.toolkit.core.client.JsoHelper"
] | import com.ait.toolkit.core.client.JsoHelper; | import com.ait.toolkit.core.client.*; | [
"com.ait.toolkit"
] | com.ait.toolkit; | 2,751,043 |
if (mergedKeyValueMetadata == null) {
Map<String, String> mergedKeyValues = new HashMap<String, String>();
for (Entry<String, Set<String>> entry : keyValueMetadata.entrySet()) {
if (entry.getValue().size() > 1) {
throw new RuntimeException("could not merge metadata: key " + entry.getKey() + " has conflicting values: " + entry.getValue());
}
mergedKeyValues.put(entry.getKey(), entry.getValue().iterator().next());
}
mergedKeyValueMetadata = mergedKeyValues;
}
return mergedKeyValueMetadata;
} | if (mergedKeyValueMetadata == null) { Map<String, String> mergedKeyValues = new HashMap<String, String>(); for (Entry<String, Set<String>> entry : keyValueMetadata.entrySet()) { if (entry.getValue().size() > 1) { throw new RuntimeException(STR + entry.getKey() + STR + entry.getValue()); } mergedKeyValues.put(entry.getKey(), entry.getValue().iterator().next()); } mergedKeyValueMetadata = mergedKeyValues; } return mergedKeyValueMetadata; } | /**
* If there is a conflicting value when reading from multiple files,
* an exception will be thrown
* @return the merged key values metadata form the file footers
*/ | If there is a conflicting value when reading from multiple files, an exception will be thrown | getMergedKeyValueMetaData | {
"repo_name": "tsdeng/incubator-parquet-mr",
"path": "parquet-hadoop/src/main/java/parquet/hadoop/api/InitContext.java",
"license": "apache-2.0",
"size": 3202
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.Set"
] | import java.util.HashMap; import java.util.Map; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,604,133 |
default DebeziumMongodbEndpointBuilder additionalProperties(
Map<String, Object> additionalProperties) {
doSetProperty("additionalProperties", additionalProperties);
return this;
} | default DebeziumMongodbEndpointBuilder additionalProperties( Map<String, Object> additionalProperties) { doSetProperty(STR, additionalProperties); return this; } | /**
* Additional properties for debezium components in case they can't be
* set directly on the camel configurations (e.g: setting Kafka Connect
* properties needed by Debezium engine, for example setting
* KafkaOffsetBackingStore), the properties have to be prefixed with
* additionalProperties.. E.g:
* additionalProperties.transactional.id=12345&additionalProperties.schema.registry.url=http://localhost:8811/avro.
*
* The option is a: <code>java.util.Map<java.lang.String,
* java.lang.Object></code> type.
*
* Group: common
*/ | Additional properties for debezium components in case they can't be set directly on the camel configurations (e.g: setting Kafka Connect properties needed by Debezium engine, for example setting KafkaOffsetBackingStore), the properties have to be prefixed with additionalProperties.. E.g: additionalProperties.transactional.id=12345&additionalProperties.schema.registry.url=HREF The option is a: <code>java.util.Map<java.lang.String, java.lang.Object></code> type. Group: common | additionalProperties | {
"repo_name": "zregvart/camel",
"path": "core/camel-endpointdsl/src/generated/java/org/apache/camel/builder/endpoint/dsl/DebeziumMongodbEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 42979
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,835,151 |
protected void pushTilesContext()
{
if (this.contextStack == null)
{
this.contextStack = new Stack();
}
contextStack.push(getCurrentContext());
} | void function() { if (this.contextStack == null) { this.contextStack = new Stack(); } contextStack.push(getCurrentContext()); } | /**
* <p>pushes the current tiles context onto the context-stack.
* preserving the context is necessary so that a sub-context can be
* put into request scope and lower level tiles can be rendered</p>
*/ | pushes the current tiles context onto the context-stack. preserving the context is necessary so that a sub-context can be put into request scope and lower level tiles can be rendered | pushTilesContext | {
"repo_name": "ggonzales/ksl",
"path": "src/org/apache/velocity/tools/struts/TilesTool.java",
"license": "gpl-3.0",
"size": 16622
} | [
"java.util.Stack"
] | import java.util.Stack; | import java.util.*; | [
"java.util"
] | java.util; | 405,381 |
public long waitForZkTxId(long zkTxId, Object timeout)
throws TimeoutException, InterruptedException
{
long endTime = ClockUtils.toEndTime(clock, timeout);
synchronized(_lock)
{
while(_lastZkTxId < zkTxId)
{
ConcurrentUtils.awaitUntil(clock, _lock, endTime);
}
return _lastZkTxId;
}
} | long function(long zkTxId, Object timeout) throws TimeoutException, InterruptedException { long endTime = ClockUtils.toEndTime(clock, timeout); synchronized(_lock) { while(_lastZkTxId < zkTxId) { ConcurrentUtils.awaitUntil(clock, _lock, endTime); } return _lastZkTxId; } } | /**
* Waits no longer than the timeout provided (or forever if <code>null</code>) for this tracker
* to have seen at least the provided zookeeper transaction id
* @return the last known zkTxId (guaranteed to be >= to zkTxId)
*/ | Waits no longer than the timeout provided (or forever if <code>null</code>) for this tracker to have seen at least the provided zookeeper transaction id | waitForZkTxId | {
"repo_name": "pongasoft/utils-zookeeper",
"path": "org.linkedin.zookeeper-impl/src/main/java/org/linkedin/zookeeper/tracker/ZooKeeperTreeTracker.java",
"license": "apache-2.0",
"size": 13125
} | [
"java.util.concurrent.TimeoutException",
"org.linkedin.util.clock.ClockUtils",
"org.linkedin.util.concurrent.ConcurrentUtils"
] | import java.util.concurrent.TimeoutException; import org.linkedin.util.clock.ClockUtils; import org.linkedin.util.concurrent.ConcurrentUtils; | import java.util.concurrent.*; import org.linkedin.util.clock.*; import org.linkedin.util.concurrent.*; | [
"java.util",
"org.linkedin.util"
] | java.util; org.linkedin.util; | 1,459,263 |
public Timestamp getDateModified() {
return (Timestamp) get(3);
} | Timestamp function() { return (Timestamp) get(3); } | /**
* Getter for <code>sugarcrm_4_12.sc_price_list_services.date_modified</code>.
*/ | Getter for <code>sugarcrm_4_12.sc_price_list_services.date_modified</code> | getDateModified | {
"repo_name": "SmartMedicalServices/SpringJOOQ",
"path": "src/main/java/com/sms/sis/db/tables/records/ScPriceListServicesRecord.java",
"license": "gpl-3.0",
"size": 17658
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 932,545 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.