method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Observable<ServiceResponse<Void>> enumNullAsync(UriColor enumPath) {
if (enumPath == null) {
throw new IllegalArgumentException("Parameter enumPath is required and cannot be null.");
} | Observable<ServiceResponse<Void>> function(UriColor enumPath) { if (enumPath == null) { throw new IllegalArgumentException(STR); } | /**
* Get null (should throw on the client before the request is sent on wire).
*
* @param enumPath send null should throw. Possible values include: 'red color', 'green color', 'blue color'
* @return the {@link ServiceResponse} object if successful.
*/ | Get null (should throw on the client before the request is sent on wire) | enumNullAsync | {
"repo_name": "haocs/autorest",
"path": "src/generator/AutoRest.Java.Tests/src/main/java/fixtures/url/implementation/PathsImpl.java",
"license": "mit",
"size": 67937
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 418,481 |
@Test
public void testGetChangelists() throws Exception {
Map<String, Object>[] result = server.execMapCmd(
CmdSpec.INFO.toString(),
new String[]{},
null);
assertThat(result, notNullValue());
assertTrue(result.length > 0);
// Expire the ticket by logging out
server.logout();
// Login using the normal method
server.login(getSuperUserName(), new LoginOptions());
result = server.execMapCmd(
CmdSpec.CHANGES.toString(),
new String[]{"-m2"},
null);
assertThat(result, notNullValue());
assertTrue(result.length > 0);
} | void function() throws Exception { Map<String, Object>[] result = server.execMapCmd( CmdSpec.INFO.toString(), new String[]{}, null); assertThat(result, notNullValue()); assertTrue(result.length > 0); server.logout(); server.login(getSuperUserName(), new LoginOptions()); result = server.execMapCmd( CmdSpec.CHANGES.toString(), new String[]{"-m2"}, null); assertThat(result, notNullValue()); assertTrue(result.length > 0); } | /**
* Test get changelists (read) while connected to a Perforce replica.
*/ | Test get changelists (read) while connected to a Perforce replica | testGetChangelists | {
"repo_name": "groboclown/p4ic4idea",
"path": "p4java/src/test/java/com/perforce/p4java/tests/dev/unit/bug/r123/ReplicaAuthTicketsTest.java",
"license": "apache-2.0",
"size": 5772
} | [
"com.perforce.p4java.option.server.LoginOptions",
"com.perforce.p4java.server.CmdSpec",
"java.util.Map",
"org.hamcrest.MatcherAssert",
"org.hamcrest.core.IsNull",
"org.junit.jupiter.api.Assertions"
] | import com.perforce.p4java.option.server.LoginOptions; import com.perforce.p4java.server.CmdSpec; import java.util.Map; import org.hamcrest.MatcherAssert; import org.hamcrest.core.IsNull; import org.junit.jupiter.api.Assertions; | import com.perforce.p4java.option.server.*; import com.perforce.p4java.server.*; import java.util.*; import org.hamcrest.*; import org.hamcrest.core.*; import org.junit.jupiter.api.*; | [
"com.perforce.p4java",
"java.util",
"org.hamcrest",
"org.hamcrest.core",
"org.junit.jupiter"
] | com.perforce.p4java; java.util; org.hamcrest; org.hamcrest.core; org.junit.jupiter; | 891,390 |
private static final boolean isRightBracket(Token t) {
return t.type==TokenTypes.SEPARATOR && t.isSingleChar(']');
}
| static final boolean function(Token t) { return t.type==TokenTypes.SEPARATOR && t.isSingleChar(']'); } | /**
* Returns whether a token is the right bracket token.
*
* @param t The token.
* @return Whether the token is the right bracket token.
* @see #isLeftBracket(Token)
*/ | Returns whether a token is the right bracket token | isRightBracket | {
"repo_name": "Nanonid/RSyntaxTextArea",
"path": "src/org/fife/ui/rsyntaxtextarea/folding/JsonFoldParser.java",
"license": "bsd-3-clause",
"size": 4327
} | [
"org.fife.ui.rsyntaxtextarea.Token",
"org.fife.ui.rsyntaxtextarea.TokenTypes"
] | import org.fife.ui.rsyntaxtextarea.Token; import org.fife.ui.rsyntaxtextarea.TokenTypes; | import org.fife.ui.rsyntaxtextarea.*; | [
"org.fife.ui"
] | org.fife.ui; | 794,553 |
@Test
public void matchIPDscpTest() {
Criterion criterion = Criteria.matchIPDscp((byte) 63);
ObjectNode result = criterionCodec.encode(criterion, context);
assertThat(result, matchesCriterion(criterion));
} | void function() { Criterion criterion = Criteria.matchIPDscp((byte) 63); ObjectNode result = criterionCodec.encode(criterion, context); assertThat(result, matchesCriterion(criterion)); } | /**
* Tests IP DSCP criterion.
*/ | Tests IP DSCP criterion | matchIPDscpTest | {
"repo_name": "sonu283304/onos",
"path": "core/common/src/test/java/org/onosproject/codec/impl/CriterionCodecTest.java",
"license": "apache-2.0",
"size": 14736
} | [
"com.fasterxml.jackson.databind.node.ObjectNode",
"org.hamcrest.MatcherAssert",
"org.onosproject.codec.impl.CriterionJsonMatcher",
"org.onosproject.net.flow.criteria.Criteria",
"org.onosproject.net.flow.criteria.Criterion"
] | import com.fasterxml.jackson.databind.node.ObjectNode; import org.hamcrest.MatcherAssert; import org.onosproject.codec.impl.CriterionJsonMatcher; import org.onosproject.net.flow.criteria.Criteria; import org.onosproject.net.flow.criteria.Criterion; | import com.fasterxml.jackson.databind.node.*; import org.hamcrest.*; import org.onosproject.codec.impl.*; import org.onosproject.net.flow.criteria.*; | [
"com.fasterxml.jackson",
"org.hamcrest",
"org.onosproject.codec",
"org.onosproject.net"
] | com.fasterxml.jackson; org.hamcrest; org.onosproject.codec; org.onosproject.net; | 844,319 |
public static void printMyLog(Object object) {
if (Log.DEBUG > DEBUG_LEVEL) {
String tag = "MYLOG";
String method = callMethodAndLine();
String content = "";
if (object != null) {
content = object.toString() + " ---- "
+ method;
} else {
content = " ## " + " ---- " + method;
}
Log.d(tag, content);
if (DEBUG_SYSOUT) {
System.out.println(tag + " " + content + " " + method);
}
}
} | static void function(Object object) { if (Log.DEBUG > DEBUG_LEVEL) { String tag = "MYLOG"; String method = callMethodAndLine(); String content = STR ---- STR ## STR ---- STR STR " + method); } } } | /**
* Print debug log in blue.
*
* @param object The object to print.
*/ | Print debug log in blue | printMyLog | {
"repo_name": "FreedomZZQ/YouJoin-Android",
"path": "app/src/main/java/me/zq/youjoin/utils/LogUtils.java",
"license": "mit",
"size": 10134
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 206,141 |
public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) {
this.defaultPollInterval = defaultPollInterval;
return this;
}
private HttpPipeline pipeline; | PostgreSqlManagementClientBuilder function(Duration defaultPollInterval) { this.defaultPollInterval = defaultPollInterval; return this; } private HttpPipeline pipeline; | /**
* Sets The default poll interval for long-running operation.
*
* @param defaultPollInterval the defaultPollInterval value.
* @return the PostgreSqlManagementClientBuilder.
*/ | Sets The default poll interval for long-running operation | defaultPollInterval | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientBuilder.java",
"license": "mit",
"size": 4739
} | [
"com.azure.core.http.HttpPipeline",
"java.time.Duration"
] | import com.azure.core.http.HttpPipeline; import java.time.Duration; | import com.azure.core.http.*; import java.time.*; | [
"com.azure.core",
"java.time"
] | com.azure.core; java.time; | 2,489,058 |
@POST
@Path( "/checkParams" )
@Consumes( { APPLICATION_JSON } )
@Produces( { APPLICATION_JSON } )
@Facet( name = "Unsupported" )
public StringArrayWrapper checkParameters( DatabaseConnection connection ) {
StringArrayWrapper array = null;
String[] rawValues = DatabaseUtil.convertToDatabaseMeta( connection ).checkParameters();
if ( rawValues.length > 0 ) {
array = new StringArrayWrapper();
array.setArray( rawValues );
}
return array;
} | @Path( STR ) @Consumes( { APPLICATION_JSON } ) @Produces( { APPLICATION_JSON } ) @Facet( name = STR ) StringArrayWrapper function( DatabaseConnection connection ) { StringArrayWrapper array = null; String[] rawValues = DatabaseUtil.convertToDatabaseMeta( connection ).checkParameters(); if ( rawValues.length > 0 ) { array = new StringArrayWrapper(); array.setArray( rawValues ); } return array; } | /**
* Returns the database meta for the given connection.
*
* @param connection
* DatabaseConnection to retrieve meta from
*
* @return array containing the database connection metadata
*/ | Returns the database meta for the given connection | checkParameters | {
"repo_name": "kurtwalker/data-access",
"path": "core/src/main/java/org/pentaho/platform/dataaccess/datasource/wizard/service/impl/ConnectionService.java",
"license": "apache-2.0",
"size": 19066
} | [
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"org.codehaus.enunciate.Facet",
"org.pentaho.database.model.DatabaseConnection",
"org.pentaho.database.util.DatabaseUtil"
] | import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.Produces; import org.codehaus.enunciate.Facet; import org.pentaho.database.model.DatabaseConnection; import org.pentaho.database.util.DatabaseUtil; | import javax.ws.rs.*; import org.codehaus.enunciate.*; import org.pentaho.database.model.*; import org.pentaho.database.util.*; | [
"javax.ws",
"org.codehaus.enunciate",
"org.pentaho.database"
] | javax.ws; org.codehaus.enunciate; org.pentaho.database; | 690,321 |
public static void setInfoStream(PrintStream infoStream) {
SegmentInfos.infoStream = infoStream;
}
private static int defaultGenFileRetryCount = 10;
private static int defaultGenFileRetryPauseMsec = 50;
private static int defaultGenLookaheadCount = 10; | static void function(PrintStream infoStream) { SegmentInfos.infoStream = infoStream; } private static int defaultGenFileRetryCount = 10; private static int defaultGenFileRetryPauseMsec = 50; private static int defaultGenLookaheadCount = 10; | /** If non-null, information about retries when loading
* the segments file will be printed to this.
*/ | If non-null, information about retries when loading the segments file will be printed to this | setInfoStream | {
"repo_name": "sluk3r/lucene-3.0.2-src-study",
"path": "src/java/org/apache/lucene/index/SegmentInfos.java",
"license": "apache-2.0",
"size": 30724
} | [
"java.io.PrintStream"
] | import java.io.PrintStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,899,924 |
public static Object invokeStaticMethod(final Class<?> cls, final String methodName, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
if (parameterTypes == null) {
parameterTypes = ArrayUtils.EMPTY_CLASS_ARRAY;
}
if (args == null) {
args = ArrayUtils.EMPTY_OBJECT_ARRAY;
}
Method method = MethodUtils.getMatchingAccessibleMethod(cls, methodName, parameterTypes);
if (method == null) {
throw new NoSuchMethodException("No such accessible method: " + methodName + "() on class: " + cls.getName());
}
return method.invoke(null, args);
} | static Object function(final Class<?> cls, final String methodName, Object[] args, Class<?>[] parameterTypes) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { if (parameterTypes == null) { parameterTypes = ArrayUtils.EMPTY_CLASS_ARRAY; } if (args == null) { args = ArrayUtils.EMPTY_OBJECT_ARRAY; } Method method = MethodUtils.getMatchingAccessibleMethod(cls, methodName, parameterTypes); if (method == null) { throw new NoSuchMethodException(STR + methodName + STR + cls.getName()); } return method.invoke(null, args); } | /**
* <p>Invoke a named static method whose parameter type matches the object type.</p>
*
* <p>This method delegates the method search to {@link #getMatchingAccessibleMethod(Class, String, Class[])}.</p>
*
* <p>This method supports calls to methods taking primitive parameters
* via passing in wrapping classes. So, for example, a <code>Boolean</code> class
* would match a <code>boolean</code> primitive.</p>
*
*
* @param cls invoke static method on this class
* @param methodName get method with this name
* @param args use these arguments - treat null as empty array
* @param parameterTypes match these parameters - treat null as empty array
* @return The value returned by the invoked method
*
* @throws NoSuchMethodException if there is no such accessible method
* @throws InvocationTargetException wraps an exception thrown by the
* method invoked
* @throws IllegalAccessException if the requested method is not accessible
* via reflection
*/ | Invoke a named static method whose parameter type matches the object type. This method delegates the method search to <code>#getMatchingAccessibleMethod(Class, String, Class[])</code>. This method supports calls to methods taking primitive parameters via passing in wrapping classes. So, for example, a <code>Boolean</code> class would match a <code>boolean</code> primitive | invokeStaticMethod | {
"repo_name": "zycgit/configuration",
"path": "utils/util/reflect/MethodUtils.java",
"license": "apache-2.0",
"size": 28535
} | [
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method",
"org.more.util.ArrayUtils"
] | import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import org.more.util.ArrayUtils; | import java.lang.reflect.*; import org.more.util.*; | [
"java.lang",
"org.more.util"
] | java.lang; org.more.util; | 408,449 |
public final Certificate getCertificate(String alias)
throws KeyStoreException {
if (!isInit) {
// BEGIN android-changed
throwNotInitialized();
// END android-changed
}
return implSpi.engineGetCertificate(alias);
} | final Certificate function(String alias) throws KeyStoreException { if (!isInit) { throwNotInitialized(); } return implSpi.engineGetCertificate(alias); } | /**
* Returns the trusted certificate for the entry with the given alias.
*
* @param alias
* the alias for the entry.
* @return the trusted certificate for the entry with the given alias, or
* {@code null} if the specified alias is not bound to an entry.
* @throws KeyStoreException
* if this {@code KeyStore} is not initialized.
*/ | Returns the trusted certificate for the entry with the given alias | getCertificate | {
"repo_name": "webos21/xi",
"path": "java/jcl/src/java/java/security/KeyStore.java",
"license": "apache-2.0",
"size": 46268
} | [
"java.security.cert.Certificate"
] | import java.security.cert.Certificate; | import java.security.cert.*; | [
"java.security"
] | java.security; | 1,189,273 |
private boolean isOverAMShareLimit() {
// Check the AM resource usage for the leaf queue
if (!isAmRunning() && !getUnmanagedAM()) {
List<ResourceRequest> ask = appSchedulingInfo.getAllResourceRequests();
if (ask.isEmpty() || !getQueue().canRunAppAM(
ask.get(0).getCapability())) {
return true;
}
}
return false;
} | boolean function() { if (!isAmRunning() && !getUnmanagedAM()) { List<ResourceRequest> ask = appSchedulingInfo.getAllResourceRequests(); if (ask.isEmpty() !getQueue().canRunAppAM( ask.get(0).getCapability())) { return true; } } return false; } | /**
* Whether the AM container for this app is over maxAMShare limit.
*/ | Whether the AM container for this app is over maxAMShare limit | isOverAMShareLimit | {
"repo_name": "aliyun-beta/aliyun-oss-hadoop-fs",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSAppAttempt.java",
"license": "apache-2.0",
"size": 34957
} | [
"java.util.List",
"org.apache.hadoop.yarn.api.records.ResourceRequest"
] | import java.util.List; import org.apache.hadoop.yarn.api.records.ResourceRequest; | import java.util.*; import org.apache.hadoop.yarn.api.records.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,205,333 |
public SerialMessage getMessage(SensorType sensorType) {
if (isGetSupported == false) {
logger.debug("NODE {}: Node doesn't support get requests for MULTI_LEVEL_SENSOR",
this.getNode().getNodeId());
return null;
}
logger.debug("NODE {}: Creating new message for command SENSOR_MULTI_LEVEL_GET", this.getNode().getNodeId());
SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData,
SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get);
byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(),
(byte) SENSOR_MULTI_LEVEL_GET, (byte) sensorType.getKey() };
result.setMessagePayload(newPayload);
return result;
} | SerialMessage function(SensorType sensorType) { if (isGetSupported == false) { logger.debug(STR, this.getNode().getNodeId()); return null; } logger.debug(STR, this.getNode().getNodeId()); SerialMessage result = new SerialMessage(this.getNode().getNodeId(), SerialMessageClass.SendData, SerialMessageType.Request, SerialMessageClass.ApplicationCommandHandler, SerialMessagePriority.Get); byte[] newPayload = { (byte) this.getNode().getNodeId(), 3, (byte) getCommandClass().getKey(), (byte) SENSOR_MULTI_LEVEL_GET, (byte) sensorType.getKey() }; result.setMessagePayload(newPayload); return result; } | /**
* Gets a SerialMessage with the SENSOR_MULTI_LEVEL_GET command
*
* @param sensorType the {@link SensorType} to get the value for.
* @return the serial message
*/ | Gets a SerialMessage with the SENSOR_MULTI_LEVEL_GET command | getMessage | {
"repo_name": "vgoldman/openhab",
"path": "bundles/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/commandclass/ZWaveMultiLevelSensorCommandClass.java",
"license": "epl-1.0",
"size": 17689
} | [
"org.openhab.binding.zwave.internal.protocol.SerialMessage"
] | import org.openhab.binding.zwave.internal.protocol.SerialMessage; | import org.openhab.binding.zwave.internal.protocol.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,235,412 |
public static boolean requestAudioFocus() {
if(false == mIsFocusGranted) {
int focusResult;
AudioManager audioMgr;
if ((null != (audioMgr = getAudioManager()))) {
// Request permanent audio focus for voice call
focusResult = audioMgr.requestAudioFocus(mFocusListener, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN);
if (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == focusResult) {
mIsFocusGranted = true;
Log.d(LOG_TAG, "## getAudioFocus(): granted");
} else {
mIsFocusGranted = false;
Log.w(LOG_TAG, "## getAudioFocus(): refused - focusResult=" + focusResult);
}
}
} else {
Log.d(LOG_TAG, "## getAudioFocus(): already granted");
}
return mIsFocusGranted;
} | static boolean function() { if(false == mIsFocusGranted) { int focusResult; AudioManager audioMgr; if ((null != (audioMgr = getAudioManager()))) { focusResult = audioMgr.requestAudioFocus(mFocusListener, AudioManager.STREAM_VOICE_CALL, AudioManager.AUDIOFOCUS_GAIN); if (AudioManager.AUDIOFOCUS_REQUEST_GRANTED == focusResult) { mIsFocusGranted = true; Log.d(LOG_TAG, STR); } else { mIsFocusGranted = false; Log.w(LOG_TAG, STR + focusResult); } } } else { Log.d(LOG_TAG, STR); } return mIsFocusGranted; } | /**
* Request a permanent audio focus if the focus was not yet granted.
* @return true if audio focus was granted, false otherwise
*/ | Request a permanent audio focus if the focus was not yet granted | requestAudioFocus | {
"repo_name": "vt0r/vector-android",
"path": "vector/src/main/java/im/vector/util/VectorCallSoundManager.java",
"license": "apache-2.0",
"size": 23125
} | [
"android.media.AudioManager",
"android.util.Log"
] | import android.media.AudioManager; import android.util.Log; | import android.media.*; import android.util.*; | [
"android.media",
"android.util"
] | android.media; android.util; | 994,688 |
public void createTestInstancesThreaded() throws Exception {
// create the empty Test instances object
testInstances = new Instances("TestInstances", attributes, ps
.getAllTestDocs().size());
//if there are no test instances, set the instance object to null and move on with our lives
if (ps.getAllTestDocs().size()==0){
testInstances=null;
} else { //otherwise go through the whole process
//create/fetch data
List<Instance> generatedInstances = new ArrayList<Instance>();
int threadsToUse = numThreads;
int numInstances = ps.getAllTestDocs().size();
//make sure number of threads isn't silly
if (numThreads > numInstances) {
threadsToUse = numInstances;
}
//ensure the docs are divided correctly
int div = numInstances / threadsToUse;
if (div % threadsToUse != 0)
div++;
//Perform some parallelization magic
testThreads = new CreateTestInstancesThread[threadsToUse];
for (int thread = 0; thread < threadsToUse; thread++)
testThreads[thread] = new CreateTestInstancesThread(testInstances,div,thread,numInstances, new CumulativeFeatureDriver(cfd));
for (int thread = 0; thread < threadsToUse; thread++)
testThreads[thread].start();
for (int thread = 0; thread < threadsToUse; thread++)
testThreads[thread].join();
for (int thread = 0; thread < threadsToUse; thread++)
generatedInstances.addAll(testThreads[thread].list);
for (int thread = 0; thread < threadsToUse; thread++)
testThreads[thread] = null;
testThreads = null;
//add all of the instance objects to the Instances object
for (Instance inst: generatedInstances){
testInstances.add(inst);
}
}
}
//////////////////////////////////////////// InfoGain related things
| void function() throws Exception { testInstances = new Instances(STR, attributes, ps .getAllTestDocs().size()); if (ps.getAllTestDocs().size()==0){ testInstances=null; } else { List<Instance> generatedInstances = new ArrayList<Instance>(); int threadsToUse = numThreads; int numInstances = ps.getAllTestDocs().size(); if (numThreads > numInstances) { threadsToUse = numInstances; } int div = numInstances / threadsToUse; if (div % threadsToUse != 0) div++; testThreads = new CreateTestInstancesThread[threadsToUse]; for (int thread = 0; thread < threadsToUse; thread++) testThreads[thread] = new CreateTestInstancesThread(testInstances,div,thread,numInstances, new CumulativeFeatureDriver(cfd)); for (int thread = 0; thread < threadsToUse; thread++) testThreads[thread].start(); for (int thread = 0; thread < threadsToUse; thread++) testThreads[thread].join(); for (int thread = 0; thread < threadsToUse; thread++) generatedInstances.addAll(testThreads[thread].list); for (int thread = 0; thread < threadsToUse; thread++) testThreads[thread] = null; testThreads = null; for (Instance inst: generatedInstances){ testInstances.add(inst); } } } | /**
* Creates Test instances from all of the information gathered (if there are any)
* @throws Exception
*/ | Creates Test instances from all of the information gathered (if there are any) | createTestInstancesThreaded | {
"repo_name": "jbdatko/pes",
"path": "anonymouth/src/edu/drexel/psal/jstylo/generics/InstancesBuilder.java",
"license": "gpl-3.0",
"size": 25475
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 33,034 |
public EmbeddedActiveMQ getServer() {
return server;
} | EmbeddedActiveMQ function() { return server; } | /**
* Get the EmbeddedActiveMQ server.
*
* This may be required for advanced configuration of the EmbeddedActiveMQ server.
*
* @return the embedded ActiveMQ broker
*/ | Get the EmbeddedActiveMQ server. This may be required for advanced configuration of the EmbeddedActiveMQ server | getServer | {
"repo_name": "cshannon/activemq-artemis",
"path": "artemis-junit/src/main/java/org/apache/activemq/artemis/junit/EmbeddedActiveMQResource.java",
"license": "apache-2.0",
"size": 31805
} | [
"org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ"
] | import org.apache.activemq.artemis.core.server.embedded.EmbeddedActiveMQ; | import org.apache.activemq.artemis.core.server.embedded.*; | [
"org.apache.activemq"
] | org.apache.activemq; | 2,709,715 |
public Adapter createMultiTerminalsAdapter()
{
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link org.eclipse.xtext.serializer.sequencertest.MultiTerminals <em>Multi Terminals</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see org.eclipse.xtext.serializer.sequencertest.MultiTerminals
* @generated
*/ | Creates a new adapter for an object of class '<code>org.eclipse.xtext.serializer.sequencertest.MultiTerminals Multi Terminals</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createMultiTerminalsAdapter | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/serializer/sequencertest/util/SequencertestAdapterFactory.java",
"license": "epl-1.0",
"size": 39311
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 256,699 |
public void setupSubmit()
{
// File Selection
FileSelectorPopupScreen fileSelector = new FileSelectorPopupScreen();
fileSelector.pickFile();
String fileName = fileSelector.getFile();
// If a file has been selected
if (fileName != null)
{
// Add a slash to the front
fileName = "/" + fileName;
// Display a dialog for selecting a subreddit to submit to.
// This returns the index into the array of imgsubreds
// If the user cancels, the value is -1.
int index = Dialog.ask("To which subreddit?", imgsubreds, 0);
if (index >= 0)
{
//get the subreddit we'll be submitting to from the array
this.subreddit = imgsubreds[index];
// Create Imgur object and submit photo.
Imgur imgur = new Imgur(fileName);
// Add listener for file loaded to imgur
Event.observe(imgur, "LOADED", imgurListener);
imgur.submitPhoto();
// temporary override of the loading to imgur, so that we
// don't exceed our # of daily submissions
//imgurListener.callback(null);
}
}
}
| void function() { FileSelectorPopupScreen fileSelector = new FileSelectorPopupScreen(); fileSelector.pickFile(); String fileName = fileSelector.getFile(); if (fileName != null) { fileName = "/" + fileName; int index = Dialog.ask(STR, imgsubreds, 0); if (index >= 0) { this.subreddit = imgsubreds[index]; Imgur imgur = new Imgur(fileName); Event.observe(imgur, STR, imgurListener); imgur.submitPhoto(); } } } | /**
* Pop up file selector dialog
*/ | Pop up file selector dialog | setupSubmit | {
"repo_name": "HumbleSoftware/HelloReddit",
"path": "src/com/humblesoftware/reddit/screens/SubmitScreen.java",
"license": "mit",
"size": 11319
} | [
"com.humblesoftware.imgur.Imgur",
"com.humblesoftware.reddit.Event",
"net.rim.device.api.ui.component.Dialog"
] | import com.humblesoftware.imgur.Imgur; import com.humblesoftware.reddit.Event; import net.rim.device.api.ui.component.Dialog; | import com.humblesoftware.imgur.*; import com.humblesoftware.reddit.*; import net.rim.device.api.ui.component.*; | [
"com.humblesoftware.imgur",
"com.humblesoftware.reddit",
"net.rim.device"
] | com.humblesoftware.imgur; com.humblesoftware.reddit; net.rim.device; | 1,204,388 |
public String print(ReadablePartial partial) {
StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength());
printTo(buf, partial);
return buf.toString();
} | String function(ReadablePartial partial) { StringBuffer buf = new StringBuffer(requirePrinter().estimatePrintedLength()); printTo(buf, partial); return buf.toString(); } | /**
* Prints a ReadablePartial to a new String.
* <p>
* Neither the override chronology nor the override zone are used
* by this method.
*
* @param partial partial to format
* @return the printed result
*/ | Prints a ReadablePartial to a new String. Neither the override chronology nor the override zone are used by this method | print | {
"repo_name": "syntelos/gap-data",
"path": "types/lib/joda-time/src/org/joda/time/format/DateTimeFormatter.java",
"license": "lgpl-3.0",
"size": 29342
} | [
"org.joda.time.ReadablePartial"
] | import org.joda.time.ReadablePartial; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,997,903 |
public java.util.List<ArcHLAPI> getInArcsHLAPI();
| java.util.List<ArcHLAPI> function(); | /**
* This accessor automaticaly encapsulate all elements of the selected sublist.
* WARNING : this can creates a lot of new object in memory.
*/ | This accessor automaticaly encapsulate all elements of the selected sublist. WARNING : this can creates a lot of new object in memory | getInArcsHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/hlcorestructure/hlapi/PlaceNodeHLAPI.java",
"license": "epl-1.0",
"size": 4633
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,081,762 |
@Deprecated
public UrlResolver getCallbackUrlResolver() {
return getUrlResolver();
} | UrlResolver function() { return getUrlResolver(); } | /**
* Use {@link #getUrlResolver()} instead.
*
* @return the URL resolver for the callback URL
*/ | Use <code>#getUrlResolver()</code> instead | getCallbackUrlResolver | {
"repo_name": "JacobASeverson/pac4j",
"path": "pac4j-core/src/main/java/org/pac4j/core/client/IndirectClient.java",
"license": "apache-2.0",
"size": 9328
} | [
"org.pac4j.core.http.UrlResolver"
] | import org.pac4j.core.http.UrlResolver; | import org.pac4j.core.http.*; | [
"org.pac4j.core"
] | org.pac4j.core; | 2,589,473 |
@Test
public void testLoadConfigWithInvalidPath() {
PolyfillServiceConfigLocation serviceConfigLocation = new PolyfillServiceConfigFileLocation(
new File("wrong/path"));
ServiceConfig actualConfig = service.loadConfig(serviceConfigLocation);
ServiceConfig expectedConfig = new ServiceConfig.Builder().build();
assertEquals(expectedConfig.toString(), actualConfig.toString());
} | void function() { PolyfillServiceConfigLocation serviceConfigLocation = new PolyfillServiceConfigFileLocation( new File(STR)); ServiceConfig actualConfig = service.loadConfig(serviceConfigLocation); ServiceConfig expectedConfig = new ServiceConfig.Builder().build(); assertEquals(expectedConfig.toString(), actualConfig.toString()); } | /**
* Should return service config with default settings when unable to load service config
*/ | Should return service config with default settings when unable to load service config | testLoadConfigWithInvalidPath | {
"repo_name": "reiniergs/polyfill-service",
"path": "polyfill-service-api/src/test/java/org/polyfillservice/api/services/XmlServiceConfigLoaderServiceTest.java",
"license": "mit",
"size": 2269
} | [
"java.io.File",
"org.junit.Assert",
"org.polyfillservice.api.components.PolyfillServiceConfigFileLocation",
"org.polyfillservice.api.components.ServiceConfig",
"org.polyfillservice.api.interfaces.PolyfillServiceConfigLocation"
] | import java.io.File; import org.junit.Assert; import org.polyfillservice.api.components.PolyfillServiceConfigFileLocation; import org.polyfillservice.api.components.ServiceConfig; import org.polyfillservice.api.interfaces.PolyfillServiceConfigLocation; | import java.io.*; import org.junit.*; import org.polyfillservice.api.components.*; import org.polyfillservice.api.interfaces.*; | [
"java.io",
"org.junit",
"org.polyfillservice.api"
] | java.io; org.junit; org.polyfillservice.api; | 1,807,843 |
public double getTheoreticMz(Integer charge) {
double protonMass = ElementaryIon.proton.getTheoreticMass();
double mz = getTheoreticMass() + protonMass;
if (charge > 1) {
mz = (mz + (charge - 1) * protonMass) / charge;
}
return mz;
} | double function(Integer charge) { double protonMass = ElementaryIon.proton.getTheoreticMass(); double mz = getTheoreticMass() + protonMass; if (charge > 1) { mz = (mz + (charge - 1) * protonMass) / charge; } return mz; } | /**
* Returns the m/z expected for this ion at the given charge.
*
* @param charge the charge of interest
*
* @return the m/z expected for this ion
*/ | Returns the m/z expected for this ion at the given charge | getTheoreticMz | {
"repo_name": "compomics/compomics-utilities",
"path": "src/main/java/com/compomics/util/experiment/biology/ions/Ion.java",
"license": "apache-2.0",
"size": 13731
} | [
"com.compomics.util.experiment.biology.ions.impl.ElementaryIon"
] | import com.compomics.util.experiment.biology.ions.impl.ElementaryIon; | import com.compomics.util.experiment.biology.ions.impl.*; | [
"com.compomics.util"
] | com.compomics.util; | 1,128,852 |
protected SortKey getSortKey(JTable table, int column) {
RowSorter rowSorter = table.getRowSorter();
if (rowSorter == null) {
return null;
}
List sortedColumns = rowSorter.getSortKeys();
if (sortedColumns.size() > 0) {
return (SortKey) sortedColumns.get(0);
}
return null;
} | SortKey function(JTable table, int column) { RowSorter rowSorter = table.getRowSorter(); if (rowSorter == null) { return null; } List sortedColumns = rowSorter.getSortKeys(); if (sortedColumns.size() > 0) { return (SortKey) sortedColumns.get(0); } return null; } | /**
* Returns the current sort key, or null if the column is unsorted.
*
* @param table the table
* @param column the column index
* @return the SortKey, or null if the column is unsorted
*/ | Returns the current sort key, or null if the column is unsorted | getSortKey | {
"repo_name": "vasyllyashkevych/OntoDataPanel",
"path": "src/main/java/org/cssig/kb/util/DefaultTableHeaderCellRenderer.java",
"license": "gpl-3.0",
"size": 4010
} | [
"java.util.List",
"javax.swing.JTable",
"javax.swing.RowSorter"
] | import java.util.List; import javax.swing.JTable; import javax.swing.RowSorter; | import java.util.*; import javax.swing.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 1,665,538 |
public String getHumanReadableDuration(long duration) {
return String.format(Locale.getDefault(), "%02d:%02d:%02d", TimeUnit.MILLISECONDS.toHours(duration),
TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)),
TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration)));
} | String function(long duration) { return String.format(Locale.getDefault(), STR, TimeUnit.MILLISECONDS.toHours(duration), TimeUnit.MILLISECONDS.toMinutes(duration) - TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS.toHours(duration)), TimeUnit.MILLISECONDS.toSeconds(duration) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(duration))); } | /**
* Get Duration (for audio and video) in a pretty format
*
* @param duration
* @return
*/ | Get Duration (for audio and video) in a pretty format | getHumanReadableDuration | {
"repo_name": "ogero/android-multipicker-library",
"path": "multipicker/src/main/java/com/kbeanie/multipicker/api/entity/ChosenFile.java",
"license": "apache-2.0",
"size": 7707
} | [
"java.util.Locale",
"java.util.concurrent.TimeUnit"
] | import java.util.Locale; import java.util.concurrent.TimeUnit; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 507,058 |
double charge(TileEntity tile, double amt, boolean ignoreBandwidth); | double charge(TileEntity tile, double amt, boolean ignoreBandwidth); | /**
* Charge a specified amount of energy into the tile.
*
* @return How much energy not charged into the tile(left)
*/ | Charge a specified amount of energy into the tile | charge | {
"repo_name": "InfinityStudio/ExoticPower",
"path": "src/main/java/cn/academy/support/EnergyBlockHelper.java",
"license": "gpl-2.0",
"size": 2330
} | [
"net.minecraft.tileentity.TileEntity"
] | import net.minecraft.tileentity.TileEntity; | import net.minecraft.tileentity.*; | [
"net.minecraft.tileentity"
] | net.minecraft.tileentity; | 2,909,559 |
private void write(byte priKey, byte[] priData, boolean expectException)
throws DatabaseException {
DatabaseEntry keyEntry = new DatabaseEntry(new byte[] { priKey });
DatabaseEntry dataEntry = new DatabaseEntry(priData);
Transaction txn = txnBegin();
try {
OperationStatus status;
if (priData != null) {
status = priDb.put(txn, keyEntry, dataEntry);
} else {
status = priDb.delete(txn, keyEntry);
}
assertSame(OperationStatus.SUCCESS, status);
txnCommit(txn);
assertTrue(!expectException);
} catch (Exception e) {
txnAbort(txn);
assertTrue(e.toString(), expectException);
}
} | void function(byte priKey, byte[] priData, boolean expectException) throws DatabaseException { DatabaseEntry keyEntry = new DatabaseEntry(new byte[] { priKey }); DatabaseEntry dataEntry = new DatabaseEntry(priData); Transaction txn = txnBegin(); try { OperationStatus status; if (priData != null) { status = priDb.put(txn, keyEntry, dataEntry); } else { status = priDb.delete(txn, keyEntry); } assertSame(OperationStatus.SUCCESS, status); txnCommit(txn); assertTrue(!expectException); } catch (Exception e) { txnAbort(txn); assertTrue(e.toString(), expectException); } } | /**
* Puts or deletes a single primary record.
*/ | Puts or deletes a single primary record | write | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/je-3.2.44/test/com/sleepycat/je/test/ToManyTest.java",
"license": "gpl-2.0",
"size": 11706
} | [
"com.sleepycat.je.DatabaseEntry",
"com.sleepycat.je.DatabaseException",
"com.sleepycat.je.OperationStatus",
"com.sleepycat.je.Transaction"
] | import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; import com.sleepycat.je.OperationStatus; import com.sleepycat.je.Transaction; | import com.sleepycat.je.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 468,745 |
public void purchaseReserved(PurchaseReservedPeerConnRequest request) {
checkNotNull(request, "request should not be null.");
if (Strings.isNullOrEmpty(request.getClientToken())) {
request.setClientToken(this.generateClientToken());
}
InternalRequest internalRequest = this.createRequest(
request, HttpMethodName.PUT, PREFIX, request.getPeerConnId());
internalRequest.addParameter("purchaseReserved", null);
internalRequest.addParameter("clientToken", request.getClientToken());
fillPayload(internalRequest, request);
this.invokeHttpClient(internalRequest, AbstractBceResponse.class);
} | void function(PurchaseReservedPeerConnRequest request) { checkNotNull(request, STR); if (Strings.isNullOrEmpty(request.getClientToken())) { request.setClientToken(this.generateClientToken()); } InternalRequest internalRequest = this.createRequest( request, HttpMethodName.PUT, PREFIX, request.getPeerConnId()); internalRequest.addParameter(STR, null); internalRequest.addParameter(STR, request.getClientToken()); fillPayload(internalRequest, request); this.invokeHttpClient(internalRequest, AbstractBceResponse.class); } | /**
* PrchaseReserved for the specified peer conn.
*
* @param request The request containing all options for releasing the peer conn;
*/ | PrchaseReserved for the specified peer conn | purchaseReserved | {
"repo_name": "baidubce/bce-sdk-java",
"path": "src/main/java/com/baidubce/services/peerconn/PeerConnClient.java",
"license": "apache-2.0",
"size": 15323
} | [
"com.baidubce.http.HttpMethodName",
"com.baidubce.internal.InternalRequest",
"com.baidubce.model.AbstractBceResponse",
"com.baidubce.services.peerconn.model.PurchaseReservedPeerConnRequest",
"com.google.common.base.Preconditions",
"com.google.common.base.Strings"
] | import com.baidubce.http.HttpMethodName; import com.baidubce.internal.InternalRequest; import com.baidubce.model.AbstractBceResponse; import com.baidubce.services.peerconn.model.PurchaseReservedPeerConnRequest; import com.google.common.base.Preconditions; import com.google.common.base.Strings; | import com.baidubce.http.*; import com.baidubce.internal.*; import com.baidubce.model.*; import com.baidubce.services.peerconn.model.*; import com.google.common.base.*; | [
"com.baidubce.http",
"com.baidubce.internal",
"com.baidubce.model",
"com.baidubce.services",
"com.google.common"
] | com.baidubce.http; com.baidubce.internal; com.baidubce.model; com.baidubce.services; com.google.common; | 1,011,988 |
private static EvenementCouleur cursorToEvenementCouleur(Cursor cursor) {
EvenementCouleur evenementCategorie = new EvenementCouleur();
evenementCategorie.setId(cursor.getInt(0));
evenementCategorie.setCodeHex(cursor.getString(1));
evenementCouleurList.add(evenementCategorie);
return evenementCategorie;
} | static EvenementCouleur function(Cursor cursor) { EvenementCouleur evenementCategorie = new EvenementCouleur(); evenementCategorie.setId(cursor.getInt(0)); evenementCategorie.setCodeHex(cursor.getString(1)); evenementCouleurList.add(evenementCategorie); return evenementCategorie; } | /**
* Convertit un Cursor en Evenement
*
* @param cursor
* @return
*/ | Convertit un Cursor en Evenement | cursorToEvenementCouleur | {
"repo_name": "M0dz145/Kiwapp",
"path": "app/src/main/java/chevalierx/kiwapp/models/DAO/EvenementCouleurDAO.java",
"license": "mit",
"size": 4914
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 1,476,836 |
public static Point2D.Float getCenter(Graphnode_c node)
{
Rectangle2D.Float bounds = getBounds(node);
return new Point2D.Float(
bounds.x + bounds.width / 2,
bounds.y + bounds.height / 2);
}
| static Point2D.Float function(Graphnode_c node) { Rectangle2D.Float bounds = getBounds(node); return new Point2D.Float( bounds.x + bounds.width / 2, bounds.y + bounds.height / 2); } | /**
* Returns the center position of the given graph-node.
*/ | Returns the center position of the given graph-node | getCenter | {
"repo_name": "HebaKhaled/bposs",
"path": "src/com.mentor.nucleus.bp.ui.canvas/src/com/mentor/nucleus/bp/ui/canvas/util/GraphNodeUtil.java",
"license": "apache-2.0",
"size": 3137
} | [
"java.awt.geom.Point2D",
"java.awt.geom.Rectangle2D"
] | import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; | import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,510,171 |
@Override
public String getText(Object object) {
String label = ((SystemConfiguration) object).getName();
// begin-extension-code
return label == null || label.length() == 0 ? "[" + getString("_UI_SystemConfiguration_type") + "]" : label; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// end-extension-code
}
| String function(Object object) { String label = ((SystemConfiguration) object).getName(); return label == null label.length() == 0 ? "[" + getString(STR) + "]" : label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "smadelenat/CapellaModeAutomata",
"path": "Language/Configuration/com.thalesgroup.trt.mde.vp.configuration.model.edit/src/com/thalesgroup/trt/mde/vp/configuration/configuration/provider/SystemConfigurationItemProvider.java",
"license": "epl-1.0",
"size": 11232
} | [
"com.thalesgroup.trt.mde.vp.configuration.configuration.SystemConfiguration"
] | import com.thalesgroup.trt.mde.vp.configuration.configuration.SystemConfiguration; | import com.thalesgroup.trt.mde.vp.configuration.configuration.*; | [
"com.thalesgroup.trt"
] | com.thalesgroup.trt; | 1,020,556 |
protected void addToAvailableSessions(BrowserSessionInfo sessionInfo) {
availableSessions.add(sessionInfo);
}
public static class BrowserSessionInfo {
public BrowserSessionInfo(String sessionId, String browserString,
String baseUrl, BrowserLauncher launcher,
FrameGroupCommandQueueSet session) {
this.sessionId = sessionId;
this.browserString = browserString;
this.baseUrl = baseUrl;
this.launcher = launcher;
this.session = session; // optional field; may be null.
lastClosedAt = 0;
}
public final String sessionId;
public final String browserString;
public final String baseUrl;
public final BrowserLauncher launcher;
public final FrameGroupCommandQueueSet session;
public long lastClosedAt; | void function(BrowserSessionInfo sessionInfo) { availableSessions.add(sessionInfo); } public static class BrowserSessionInfo { public BrowserSessionInfo(String sessionId, String browserString, String baseUrl, BrowserLauncher launcher, FrameGroupCommandQueueSet session) { this.sessionId = sessionId; this.browserString = browserString; this.baseUrl = baseUrl; this.launcher = launcher; this.session = session; lastClosedAt = 0; } public final String sessionId; public final String browserString; public final String baseUrl; public final BrowserLauncher launcher; public final FrameGroupCommandQueueSet session; public long lastClosedAt; | /**
* for testing only
* @param sessionInfo browser session info
*/ | for testing only | addToAvailableSessions | {
"repo_name": "p0deje/selenium",
"path": "java/server/src/org/openqa/selenium/server/BrowserSessionFactory.java",
"license": "apache-2.0",
"size": 22187
} | [
"org.openqa.selenium.server.browserlaunchers.BrowserLauncher"
] | import org.openqa.selenium.server.browserlaunchers.BrowserLauncher; | import org.openqa.selenium.server.browserlaunchers.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 2,683,230 |
public DoubleValue getPageRankScore() {
return pageRankScore;
} | DoubleValue function() { return pageRankScore; } | /**
* Get the PageRank score.
*
* @return the PageRank score
*/ | Get the PageRank score | getPageRankScore | {
"repo_name": "zimmermatt/flink",
"path": "flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/linkanalysis/PageRank.java",
"license": "apache-2.0",
"size": 18934
} | [
"org.apache.flink.types.DoubleValue"
] | import org.apache.flink.types.DoubleValue; | import org.apache.flink.types.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,484,315 |
@Test
public void testWriteV2ReadV1() throws Exception {
final File outputFile = this.testFolder.newFile();
RainbowFishSerializer.writeV2(V2, outputFile.getPath());
final RainbowFish fish = RainbowFishSerializer.readV1(outputFile.getPath());
assertNotSame(V2, fish);
assertEquals(V2.getName(), fish.getName());
assertEquals(V2.getAge(), fish.getAge());
assertEquals(V2.getLengthMeters(), fish.getLengthMeters());
assertEquals(V2.getWeightTons(), fish.getWeightTons());
} | void function() throws Exception { final File outputFile = this.testFolder.newFile(); RainbowFishSerializer.writeV2(V2, outputFile.getPath()); final RainbowFish fish = RainbowFishSerializer.readV1(outputFile.getPath()); assertNotSame(V2, fish); assertEquals(V2.getName(), fish.getName()); assertEquals(V2.getAge(), fish.getAge()); assertEquals(V2.getLengthMeters(), fish.getLengthMeters()); assertEquals(V2.getWeightTons(), fish.getWeightTons()); } | /**
* Verify if a fish, written as version 2 can be read back as version 1
*/ | Verify if a fish, written as version 2 can be read back as version 1 | testWriteV2ReadV1 | {
"repo_name": "italoag/java-design-patterns",
"path": "tolerant-reader/src/test/java/com/iluwatar/tolerantreader/RainbowFishSerializerTest.java",
"license": "mit",
"size": 3309
} | [
"java.io.File",
"org.junit.jupiter.api.Assertions"
] | import java.io.File; import org.junit.jupiter.api.Assertions; | import java.io.*; import org.junit.jupiter.api.*; | [
"java.io",
"org.junit.jupiter"
] | java.io; org.junit.jupiter; | 2,828,170 |
public static HashCode hash(File file, HashFunction hashFunction)
throws IOException {
return asByteSource(file).hash(hashFunction);
}
/**
* Fully maps a file read-only in to memory as per
* {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)}.
*
* <p>Files are mapped from offset 0 to its length.
*
* <p>This only works for files <= {@link Integer#MAX_VALUE} bytes.
*
* @param file the file to map
* @return a read-only buffer reflecting {@code file} | static HashCode function(File file, HashFunction hashFunction) throws IOException { return asByteSource(file).hash(hashFunction); } /** * Fully maps a file read-only in to memory as per * {@link FileChannel#map(java.nio.channels.FileChannel.MapMode, long, long)}. * * <p>Files are mapped from offset 0 to its length. * * <p>This only works for files <= {@link Integer#MAX_VALUE} bytes. * * @param file the file to map * @return a read-only buffer reflecting {@code file} | /**
* Computes the hash code of the {@code file} using {@code hashFunction}.
*
* @param file the file to read
* @param hashFunction the hash function to use to hash the data
* @return the {@link HashCode} of all of the bytes in the file
* @throws IOException if an I/O error occurs
* @since 12.0
*/ | Computes the hash code of the file using hashFunction | hash | {
"repo_name": "paulmartel/voltdb",
"path": "third_party/java/src/com/google_voltpatches/common/io/Files.java",
"license": "agpl-3.0",
"size": 28996
} | [
"com.google_voltpatches.common.hash.HashCode",
"com.google_voltpatches.common.hash.HashFunction",
"java.io.File",
"java.io.IOException",
"java.nio.channels.FileChannel"
] | import com.google_voltpatches.common.hash.HashCode; import com.google_voltpatches.common.hash.HashFunction; import java.io.File; import java.io.IOException; import java.nio.channels.FileChannel; | import com.google_voltpatches.common.hash.*; import java.io.*; import java.nio.channels.*; | [
"com.google_voltpatches.common",
"java.io",
"java.nio"
] | com.google_voltpatches.common; java.io; java.nio; | 2,218,819 |
private void testAllDaysWithDefaultObserver(final Weekday specialDay, final Event event) {
final var defaultObserver = mock(EventObserver.class);
final var observer1 = mock(EventObserver.class);
final var observer2 = mock(EventObserver.class);
final var emitter = this.factoryWithDefaultObserver.apply(defaultObserver);
emitter.registerObserver(observer1);
emitter.registerObserver(observer2);
testAllDays(specialDay, event, emitter, defaultObserver, observer1, observer2);
} | void function(final Weekday specialDay, final Event event) { final var defaultObserver = mock(EventObserver.class); final var observer1 = mock(EventObserver.class); final var observer2 = mock(EventObserver.class); final var emitter = this.factoryWithDefaultObserver.apply(defaultObserver); emitter.registerObserver(observer1); emitter.registerObserver(observer2); testAllDays(specialDay, event, emitter, defaultObserver, observer1, observer2); } | /**
* Go over every day of the month, and check if the event is emitted on the given day.
*
* @param specialDay The special day on which an event is emitted
* @param event The expected event emitted by the test object
*/ | Go over every day of the month, and check if the event is emitted on the given day | testAllDaysWithDefaultObserver | {
"repo_name": "mookkiah/java-design-patterns",
"path": "event-aggregator/src/test/java/com/iluwatar/event/aggregator/EventEmitterTest.java",
"license": "mit",
"size": 5927
} | [
"org.mockito.Mockito"
] | import org.mockito.Mockito; | import org.mockito.*; | [
"org.mockito"
] | org.mockito; | 2,047,060 |
private void initialize(List<String> accessibleWorkspaces) throws RepositoryException {
for (Iterator<String> i = accessibleWorkspaces.iterator(); i.hasNext();) {
String workspace = i.next();
if (isBrixWorkspace(workspace)) {
Session session = getSession(workspace);
if (session.itemExists(NODE_PATH)) {
Node node = (Node) session.getItem(NODE_PATH);
// fix the node if it is not lockable
if (!node.isNodeType("mix:lockable")) {
node.addMixin("mix:lockable");
node.getSession().save();
}
// ignore workspaces in which the node is either locked or
// can not be locked
if (node.isLocked()) {
continue;
}
try {
node.getSession().getWorkspace().getLockManager().lock(node.getPath(), false, true, lockTimeoutHint, ownerInfo);
} catch (LockException e) {
continue;
}
try {
// determine whether the workspace is deleted or
// available
if (node.hasProperty(DELETED_PROPERTY)
&& node.getProperty(DELETED_PROPERTY).getBoolean() == true) {
deletedWorkspaceNames.add(workspace);
} else {
// for available workspaces read the properties
availableWorkspaceNames.add(workspace);
if (node.hasNode(PROPERTIES_NODE)) {
Node properties = node.getNode(PROPERTIES_NODE);
PropertyIterator iterator = properties.getProperties();
while (iterator.hasNext()) {
Property property = iterator.nextProperty();
setCachedAttribute(workspace, property.getName(), property.getValue().getString());
}
}
}
} finally {
node.getSession().getWorkspace().getLockManager().unlock(node.getPath());
}
}
}
i.remove();
}
} | void function(List<String> accessibleWorkspaces) throws RepositoryException { for (Iterator<String> i = accessibleWorkspaces.iterator(); i.hasNext();) { String workspace = i.next(); if (isBrixWorkspace(workspace)) { Session session = getSession(workspace); if (session.itemExists(NODE_PATH)) { Node node = (Node) session.getItem(NODE_PATH); if (!node.isNodeType(STR)) { node.addMixin(STR); node.getSession().save(); } if (node.isLocked()) { continue; } try { node.getSession().getWorkspace().getLockManager().lock(node.getPath(), false, true, lockTimeoutHint, ownerInfo); } catch (LockException e) { continue; } try { if (node.hasProperty(DELETED_PROPERTY) && node.getProperty(DELETED_PROPERTY).getBoolean() == true) { deletedWorkspaceNames.add(workspace); } else { availableWorkspaceNames.add(workspace); if (node.hasNode(PROPERTIES_NODE)) { Node properties = node.getNode(PROPERTIES_NODE); PropertyIterator iterator = properties.getProperties(); while (iterator.hasNext()) { Property property = iterator.nextProperty(); setCachedAttribute(workspace, property.getName(), property.getValue().getString()); } } } } finally { node.getSession().getWorkspace().getLockManager().unlock(node.getPath()); } } } i.remove(); } } | /**
* Iterates over the list of workspaces gathering information about each workspace. Every processed workspace is
* removed from the list. Workspaces left in list could not have been locked properly.
*
* @param accessibleWorkspaces
* @throws RepositoryException
*/ | Iterates over the list of workspaces gathering information about each workspace. Every processed workspace is removed from the list. Workspaces left in list could not have been locked properly | initialize | {
"repo_name": "dsimko/brix-cms",
"path": "brix-workspace/src/main/java/org/brixcms/workspace/AbstractClusteredWorkspaceManager.java",
"license": "apache-2.0",
"size": 17663
} | [
"java.util.Iterator",
"java.util.List",
"javax.jcr.Node",
"javax.jcr.Property",
"javax.jcr.PropertyIterator",
"javax.jcr.RepositoryException",
"javax.jcr.Session",
"javax.jcr.lock.LockException"
] | import java.util.Iterator; import java.util.List; import javax.jcr.Node; import javax.jcr.Property; import javax.jcr.PropertyIterator; import javax.jcr.RepositoryException; import javax.jcr.Session; import javax.jcr.lock.LockException; | import java.util.*; import javax.jcr.*; import javax.jcr.lock.*; | [
"java.util",
"javax.jcr"
] | java.util; javax.jcr; | 2,505,275 |
@Test
public void testGetSkew() {
// Get the controller's initial skew
double[] skew = controller.getSkew();
// Check that the skew is initially 0
assertEquals(0, Double.compare(skew[0], 0));
assertEquals(0, Double.compare(skew[1], 0));
assertEquals(0, Double.compare(skew[2], 0));
// Set the skew to a new value
controller.setSkew(1, 2, 3);
skew = controller.getSkew();
// Wait for the notification thread
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
// Check that the controller was notified
assertTrue(controller.isUpdated());
// Check that the skew is set correctly
assertEquals(0, Double.compare(skew[0], 1));
assertEquals(0, Double.compare(skew[1], 2));
assertEquals(0, Double.compare(skew[2], 3));
}
| void function() { double[] skew = controller.getSkew(); assertEquals(0, Double.compare(skew[0], 0)); assertEquals(0, Double.compare(skew[1], 0)); assertEquals(0, Double.compare(skew[2], 0)); controller.setSkew(1, 2, 3); skew = controller.getSkew(); try { Thread.sleep(50); } catch (InterruptedException e) { e.printStackTrace(); } assertTrue(controller.isUpdated()); assertEquals(0, Double.compare(skew[0], 1)); assertEquals(0, Double.compare(skew[1], 2)); assertEquals(0, Double.compare(skew[2], 3)); } | /**
* Tests the controller's operations on the transformation's skew
*/ | Tests the controller's operations on the transformation's skew | testGetSkew | {
"repo_name": "eclipse/eavp",
"path": "org.eclipse.eavp.tests.viz.modeling/src/org/eclipse/eavp/tests/viz/modeling/BasicControllerTester.java",
"license": "epl-1.0",
"size": 14929
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,191,364 |
public static void assertIsSatisfied(CamelContext context) throws InterruptedException {
ObjectHelper.notNull(context, "camelContext");
Collection<Endpoint> endpoints = context.getEndpoints();
for (Endpoint endpoint : endpoints) {
// if the endpoint was intercepted we should get the delegate
if (endpoint instanceof InterceptSendToEndpoint) {
endpoint = ((InterceptSendToEndpoint) endpoint).getDelegate();
}
if (endpoint instanceof MockEndpoint) {
MockEndpoint mockEndpoint = (MockEndpoint) endpoint;
mockEndpoint.assertIsSatisfied();
}
}
} | static void function(CamelContext context) throws InterruptedException { ObjectHelper.notNull(context, STR); Collection<Endpoint> endpoints = context.getEndpoints(); for (Endpoint endpoint : endpoints) { if (endpoint instanceof InterceptSendToEndpoint) { endpoint = ((InterceptSendToEndpoint) endpoint).getDelegate(); } if (endpoint instanceof MockEndpoint) { MockEndpoint mockEndpoint = (MockEndpoint) endpoint; mockEndpoint.assertIsSatisfied(); } } } | /**
* Asserts that all the expectations on any {@link MockEndpoint} instances registered
* in the given context are valid
*
* @param context the camel context used to find all the available endpoints to be asserted
*/ | Asserts that all the expectations on any <code>MockEndpoint</code> instances registered in the given context are valid | assertIsSatisfied | {
"repo_name": "engagepoint/camel",
"path": "camel-core/src/main/java/org/apache/camel/component/mock/MockEndpoint.java",
"license": "apache-2.0",
"size": 52988
} | [
"java.util.Collection",
"org.apache.camel.CamelContext",
"org.apache.camel.Endpoint",
"org.apache.camel.impl.InterceptSendToEndpoint",
"org.apache.camel.util.ObjectHelper"
] | import java.util.Collection; import org.apache.camel.CamelContext; import org.apache.camel.Endpoint; import org.apache.camel.impl.InterceptSendToEndpoint; import org.apache.camel.util.ObjectHelper; | import java.util.*; import org.apache.camel.*; import org.apache.camel.impl.*; import org.apache.camel.util.*; | [
"java.util",
"org.apache.camel"
] | java.util; org.apache.camel; | 1,963,510 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
private PollerFlux<PollResult<DscpConfigurationInner>, DscpConfigurationInner> beginCreateOrUpdateAsync(
String resourceGroupName, String dscpConfigurationName, DscpConfigurationInner parameters, Context context) {
context = this.client.mergeContext(context);
Mono<Response<Flux<ByteBuffer>>> mono =
createOrUpdateWithResponseAsync(resourceGroupName, dscpConfigurationName, parameters, context);
return this
.client
.<DscpConfigurationInner, DscpConfigurationInner>getLroResult(
mono,
this.client.getHttpPipeline(),
DscpConfigurationInner.class,
DscpConfigurationInner.class,
context);
} | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) PollerFlux<PollResult<DscpConfigurationInner>, DscpConfigurationInner> function( String resourceGroupName, String dscpConfigurationName, DscpConfigurationInner parameters, Context context) { context = this.client.mergeContext(context); Mono<Response<Flux<ByteBuffer>>> mono = createOrUpdateWithResponseAsync(resourceGroupName, dscpConfigurationName, parameters, context); return this .client .<DscpConfigurationInner, DscpConfigurationInner>getLroResult( mono, this.client.getHttpPipeline(), DscpConfigurationInner.class, DscpConfigurationInner.class, context); } | /**
* Creates or updates a DSCP Configuration.
*
* @param resourceGroupName The name of the resource group.
* @param dscpConfigurationName The name of the resource.
* @param parameters Parameters supplied to the create or update dscp configuration operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of differentiated Services Code Point configuration for any given
* network interface.
*/ | Creates or updates a DSCP Configuration | beginCreateOrUpdateAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/DscpConfigurationsClientImpl.java",
"license": "mit",
"size": 63306
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.Context",
"com.azure.core.util.polling.PollerFlux",
"com.azure.resourcemanager.network.fluent.models.DscpConfigurationInner",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.PollerFlux; import com.azure.resourcemanager.network.fluent.models.DscpConfigurationInner; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; import com.azure.resourcemanager.network.fluent.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 451,266 |
public boolean isBeforeNow() {
return isBefore(DateTimeUtils.currentTimeMillis());
} | boolean function() { return isBefore(DateTimeUtils.currentTimeMillis()); } | /**
* Is this time interval before the current instant.
* <p>
* Intervals are inclusive of the start instant and exclusive of the end.
*
* @return true if this time interval is before the current instant
*/ | Is this time interval before the current instant. Intervals are inclusive of the start instant and exclusive of the end | isBeforeNow | {
"repo_name": "aparo/scalajs-joda",
"path": "src/main/scala/org/joda/time/base/AbstractInterval.java",
"license": "apache-2.0",
"size": 18990
} | [
"org.joda.time.DateTimeUtils"
] | import org.joda.time.DateTimeUtils; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 2,265,530 |
public Observable<ServiceResponse<ResourceNameAvailabilityInner>> checkNameAvailabilityWithServiceResponseAsync(String name, CheckNameResourceTypes type, Boolean isFqdn) {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
}
if (this.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.apiVersion() is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (type == null) {
throw new IllegalArgumentException("Parameter type is required and cannot be null.");
} | Observable<ServiceResponse<ResourceNameAvailabilityInner>> function(String name, CheckNameResourceTypes type, Boolean isFqdn) { if (this.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.apiVersion() == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (type == null) { throw new IllegalArgumentException(STR); } | /**
* Check if a resource name is available.
* Description for Check if a resource name is available.
*
* @param name Resource name to verify.
* @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers'
* @param isFqdn Is fully qualified domain name.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceNameAvailabilityInner object
*/ | Check if a resource name is available. Description for Check if a resource name is available | checkNameAvailabilityWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/appservice/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/appservice/v2019_08_01/implementation/WebSiteManagementClientImpl.java",
"license": "mit",
"size": 168051
} | [
"com.microsoft.azure.management.appservice.v2019_08_01.CheckNameResourceTypes",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.management.appservice.v2019_08_01.CheckNameResourceTypes; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.management.appservice.v2019_08_01.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,408,836 |
public void unsetSessionContext() {
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
}
}
if (con != null) {
try {
con.close();
} catch (SQLException e) {
}
}
} | void function() { if (stmt != null) { try { stmt.close(); } catch (SQLException e) { } } if (con != null) { try { con.close(); } catch (SQLException e) { } } } | /**
* Description of the Method
*/ | Description of the Method | unsetSessionContext | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4jboss-arr/tags/dcm4jboss_0_7_1/src/java/org/dcm4chex/arr/ejb/session/QueryAuditRecordBean.java",
"license": "apache-2.0",
"size": 16166
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,395,987 |
public void setStructuralNodeModifiers(List<StructuralNodeModifier> snms) {
this.snms = new ArrayList<>(snms);
this.fireTableDataChanged();
} | void function(List<StructuralNodeModifier> snms) { this.snms = new ArrayList<>(snms); this.fireTableDataChanged(); } | /**
* Sets a new list of structural node modifiers for this model. An internal copy of the provided
* list is stored.
*
* @param snms the new structural node modifiers
*/ | Sets a new list of structural node modifiers for this model. An internal copy of the provided list is stored | setStructuralNodeModifiers | {
"repo_name": "psiinon/zaproxy",
"path": "zap/src/main/java/org/zaproxy/zap/view/StructuralNodeModifiersTableModel.java",
"license": "apache-2.0",
"size": 4960
} | [
"java.util.ArrayList",
"java.util.List",
"org.zaproxy.zap.model.StructuralNodeModifier"
] | import java.util.ArrayList; import java.util.List; import org.zaproxy.zap.model.StructuralNodeModifier; | import java.util.*; import org.zaproxy.zap.model.*; | [
"java.util",
"org.zaproxy.zap"
] | java.util; org.zaproxy.zap; | 371,521 |
Artifact packSourceFiles(
StarlarkActionFactory actions,
Artifact outputJar,
Artifact outputSourceJar,
List<Artifact> sourceFiles,
List<Artifact> sourceJars,
JavaToolchainProvider javaToolchain)
throws EvalException {
if (outputJar == null && outputSourceJar == null) {
throw Starlark.errorf(
"pack_sources requires at least one of the parameters output_jar or output_source_jar");
}
// If we only have one source jar, return it directly to avoid action creation
if (sourceFiles.isEmpty() && sourceJars.size() == 1 && outputSourceJar == null) {
return sourceJars.get(0);
}
ActionRegistry actionRegistry = actions.asActionRegistry(actions);
if (outputSourceJar == null) {
outputSourceJar = getDerivedSourceJar(actions.getActionConstructionContext(), outputJar);
}
SingleJarActionBuilder.createSourceJarAction(
actionRegistry,
actions.getActionConstructionContext(),
javaToolchain.getJavaSemantics(),
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceFiles),
NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceJars),
outputSourceJar,
javaToolchain);
return outputSourceJar;
} | Artifact packSourceFiles( StarlarkActionFactory actions, Artifact outputJar, Artifact outputSourceJar, List<Artifact> sourceFiles, List<Artifact> sourceJars, JavaToolchainProvider javaToolchain) throws EvalException { if (outputJar == null && outputSourceJar == null) { throw Starlark.errorf( STR); } if (sourceFiles.isEmpty() && sourceJars.size() == 1 && outputSourceJar == null) { return sourceJars.get(0); } ActionRegistry actionRegistry = actions.asActionRegistry(actions); if (outputSourceJar == null) { outputSourceJar = getDerivedSourceJar(actions.getActionConstructionContext(), outputJar); } SingleJarActionBuilder.createSourceJarAction( actionRegistry, actions.getActionConstructionContext(), javaToolchain.getJavaSemantics(), NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceFiles), NestedSetBuilder.<Artifact>wrap(Order.STABLE_ORDER, sourceJars), outputSourceJar, javaToolchain); return outputSourceJar; } | /**
* Creates action which creates archive with all source files inside. Takes all filer from
* sourceFiles collection and all files from every sourceJars. Name of Artifact generated based on
* outputJar.
*
* @param outputJar name of output Jar artifact.
* @param outputSourceJar name of output source Jar artifact, or {@code null}. If unset, defaults
* to base name of the output jar with the suffix {@code -src.jar}.
* @return generated artifact (can also be empty)
*/ | Creates action which creates archive with all source files inside. Takes all filer from sourceFiles collection and all files from every sourceJars. Name of Artifact generated based on outputJar | packSourceFiles | {
"repo_name": "perezd/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/java/JavaInfoBuildHelper.java",
"license": "apache-2.0",
"size": 20481
} | [
"com.google.devtools.build.lib.actions.ActionRegistry",
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.analysis.starlark.StarlarkActionFactory",
"com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder",
"com.google.devtools.build.lib.collect.nestedset.Order",
"java.util.List",
"net.starlark.java.eval.EvalException",
"net.starlark.java.eval.Starlark"
] | import com.google.devtools.build.lib.actions.ActionRegistry; import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.analysis.starlark.StarlarkActionFactory; import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder; import com.google.devtools.build.lib.collect.nestedset.Order; import java.util.List; import net.starlark.java.eval.EvalException; import net.starlark.java.eval.Starlark; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.analysis.starlark.*; import com.google.devtools.build.lib.collect.nestedset.*; import java.util.*; import net.starlark.java.eval.*; | [
"com.google.devtools",
"java.util",
"net.starlark.java"
] | com.google.devtools; java.util; net.starlark.java; | 317,701 |
@Override
public int compare( CellHandle cell1, CellHandle cell2 )
{
int cellType1 = cell1.getCellType();
int cellType2 = cell1.getCellType();
// numerics - possibly break out more to see if values are floating point or not.
// would help for equality, which is likely never reached here.
if( cell1.isNumber() && cell2.isNumber() )
{
if( cell1.getDoubleVal() > cell2.getDoubleVal() )
{
return 1;
}
if( cell1.getDoubleVal() < cell2.getDoubleVal() )
{
return -1;
}
return 0;
}
if( cell1.isNumber() )
{// get formula value if exists and is a numeric value
if( cellType2 == CellHandle.TYPE_FORMULA )
{
FormulaHandle f = null;
try
{
f = cell2.getFormulaHandle();
}
catch( FormulaNotFoundException e )
{
}
Double d = f.getDoubleVal();
if( !(d == Double.NaN) )
{
if( cell1.getDoubleVal() > d )
{
return 1;
}
if( cell1.getDoubleVal() < d )
{
return -1;
}
return 0;
}
}
else
{
return 1;
}
}
else if( cell2.isNumber() )
{
if( cellType1 == CellHandle.TYPE_FORMULA )
{
FormulaHandle f = null;
try
{
f = cell1.getFormulaHandle();
}
catch( FormulaNotFoundException e )
{
}
Double d = f.getDoubleVal();
if( !(d == Double.NaN) )
{
if( cell2.getDoubleVal() < d )
{
return 1;
}
if( cell2.getDoubleVal() > d )
{
return -1;
}
return 0;
}
}
else
{
return -1;
}
}
//Two formulas;
if( (cellType1 == CellHandle.TYPE_FORMULA) && (cellType2 == CellHandle.TYPE_FORMULA) )
{
try
{
FormulaHandle f1 = cell1.getFormulaHandle();
FormulaHandle f2 = cell2.getFormulaHandle();
double d1 = f1.getDoubleVal();
double d2 = f2.getDoubleVal();
if( !(d1 == Double.NaN) && !(d2 == Double.NaN) )
{
if( d1 > d2 )
{
return 1;
}
if( d1 < d2 )
{
return -1;
}
return 0;
}
if( !(d1 == Double.NaN) )
{
return 1;
}
if( !(d2 == Double.NaN) )
{
return -1;
}
}
catch( FormulaNotFoundException e )
{
}
}
// Strings, the last choice
String val1 = cell1.getStringVal();
String val2 = cell2.getStringVal();
return val1.compareTo( val2 );
} | int function( CellHandle cell1, CellHandle cell2 ) { int cellType1 = cell1.getCellType(); int cellType2 = cell1.getCellType(); if( cell1.isNumber() && cell2.isNumber() ) { if( cell1.getDoubleVal() > cell2.getDoubleVal() ) { return 1; } if( cell1.getDoubleVal() < cell2.getDoubleVal() ) { return -1; } return 0; } if( cell1.isNumber() ) { if( cellType2 == CellHandle.TYPE_FORMULA ) { FormulaHandle f = null; try { f = cell2.getFormulaHandle(); } catch( FormulaNotFoundException e ) { } Double d = f.getDoubleVal(); if( !(d == Double.NaN) ) { if( cell1.getDoubleVal() > d ) { return 1; } if( cell1.getDoubleVal() < d ) { return -1; } return 0; } } else { return 1; } } else if( cell2.isNumber() ) { if( cellType1 == CellHandle.TYPE_FORMULA ) { FormulaHandle f = null; try { f = cell1.getFormulaHandle(); } catch( FormulaNotFoundException e ) { } Double d = f.getDoubleVal(); if( !(d == Double.NaN) ) { if( cell2.getDoubleVal() < d ) { return 1; } if( cell2.getDoubleVal() > d ) { return -1; } return 0; } } else { return -1; } } if( (cellType1 == CellHandle.TYPE_FORMULA) && (cellType2 == CellHandle.TYPE_FORMULA) ) { try { FormulaHandle f1 = cell1.getFormulaHandle(); FormulaHandle f2 = cell2.getFormulaHandle(); double d1 = f1.getDoubleVal(); double d2 = f2.getDoubleVal(); if( !(d1 == Double.NaN) && !(d2 == Double.NaN) ) { if( d1 > d2 ) { return 1; } if( d1 < d2 ) { return -1; } return 0; } if( !(d1 == Double.NaN) ) { return 1; } if( !(d2 == Double.NaN) ) { return -1; } } catch( FormulaNotFoundException e ) { } } String val1 = cell1.getStringVal(); String val2 = cell2.getStringVal(); return val1.compareTo( val2 ); } | /**
* Compare 2 cellHandle classes
* <p/>
* This method handles comparisons of cells, note that formula results are used rather
* than formula strings, Numbers are sorted ahead of string values. Dates are stored
* as numbers internally in excel so are sorted against numbers
*/ | Compare 2 cellHandle classes This method handles comparisons of cells, note that formula results are used rather than formula strings, Numbers are sorted ahead of string values. Dates are stored as numbers internally in excel so are sorted against numbers | compare | {
"repo_name": "Maxels88/openxls",
"path": "src/main/java/org/openxls/ExtenXLS/CellComparator.java",
"license": "gpl-3.0",
"size": 4083
} | [
"org.openxls.formats.XLS"
] | import org.openxls.formats.XLS; | import org.openxls.formats.*; | [
"org.openxls.formats"
] | org.openxls.formats; | 2,842,827 |
private List<Map<String, Object>> getHistoricalEvents(MotionEvent motionEvent) {
List<Map<String, Object>> list = new ArrayList<>(motionEvent.getHistorySize());
if (motionEvent.getActionMasked() == MotionEvent.ACTION_MOVE) {
Map<String, Object> param;
for (int i = 0; i < motionEvent.getHistorySize(); i++) {
param = createFireEventParam(motionEvent, i,null);
list.add(param);
}
}
return list;
} | List<Map<String, Object>> function(MotionEvent motionEvent) { List<Map<String, Object>> list = new ArrayList<>(motionEvent.getHistorySize()); if (motionEvent.getActionMasked() == MotionEvent.ACTION_MOVE) { Map<String, Object> param; for (int i = 0; i < motionEvent.getHistorySize(); i++) { param = createFireEventParam(motionEvent, i,null); list.add(param); } } return list; } | /**
* Get historical event. This is only applied to {@link MotionEvent#ACTION_MOVE}.
* For other types of motionEvent, historical event is meaningless.
* @param motionEvent motionEvent, which contains all pointers event in a period of time
* @return If motionEvent.getActionMasked()!=MotionEvent.ACTION_MOVE,
* this method will return an empty list.
* Otherwise this method will return the historical motionEvent, which may also be empty.
*/ | Get historical event. This is only applied to <code>MotionEvent#ACTION_MOVE</code>. For other types of motionEvent, historical event is meaningless | getHistoricalEvents | {
"repo_name": "weexext/ucar-weex-core",
"path": "platforms/android/weex-sdk16/src/main/java/com/taobao/weex/ui/view/gesture/WXGesture.java",
"license": "apache-2.0",
"size": 21333
} | [
"android.view.MotionEvent",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import android.view.MotionEvent; import java.util.ArrayList; import java.util.List; import java.util.Map; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
] | android.view; java.util; | 1,424,290 |
return new CommonsLog(LogFactory.getLog(name));
} | return new CommonsLog(LogFactory.getLog(name)); } | /**
* Constructs the logger by name
*
* @param name Name
* @return Instance of commons log
*/ | Constructs the logger by name | doGetLog | {
"repo_name": "girinoboy/lojacasamento",
"path": "pagseguro-api/src/main/java/br/com/uol/pagseguro/api/utils/logging/CommonsLoggerFactory.java",
"license": "mit",
"size": 1518
} | [
"org.apache.commons.logging.LogFactory"
] | import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,373,084 |
public static Instant getInstantHoursOffsetFromNow(long offsetInHours) {
return Instant.now().plus(Duration.ofHours(offsetInHours));
} | static Instant function(long offsetInHours) { return Instant.now().plus(Duration.ofHours(offsetInHours)); } | /**
* Returns an java.time.Instant object that is offset by a number of hours from now.
* @param offsetInHours number of hours offset by (integer).
* @return java.time.Instant offset by offsetInHours hours from now.
*/ | Returns an java.time.Instant object that is offset by a number of hours from now | getInstantHoursOffsetFromNow | {
"repo_name": "amarlearning/teammates",
"path": "src/test/java/teammates/common/util/TimeHelperExtension.java",
"license": "gpl-2.0",
"size": 1469
} | [
"java.time.Duration",
"java.time.Instant"
] | import java.time.Duration; import java.time.Instant; | import java.time.*; | [
"java.time"
] | java.time; | 1,320,198 |
private static byte[] convertAudioBytes( byte[] audio_bytes,
boolean two_bytes_data )
{
ByteBuffer dest = ByteBuffer.allocateDirect( audio_bytes.length );
dest.order( ByteOrder.nativeOrder() );
ByteBuffer src = ByteBuffer.wrap( audio_bytes );
src.order( ByteOrder.LITTLE_ENDIAN );
if( two_bytes_data )
{
ShortBuffer dest_short = dest.asShortBuffer();
ShortBuffer src_short = src.asShortBuffer();
while( src_short.hasRemaining() )
{
dest_short.put(src_short.get());
}
}
else
{
while( src.hasRemaining() )
{
dest.put( src.get() );
}
}
dest.rewind();
if( !dest.hasArray() )
{
byte[] arrayBackedBuffer = new byte[dest.capacity()];
dest.get( arrayBackedBuffer );
dest.clear();
return arrayBackedBuffer;
}
return dest.array();
} | static byte[] function( byte[] audio_bytes, boolean two_bytes_data ) { ByteBuffer dest = ByteBuffer.allocateDirect( audio_bytes.length ); dest.order( ByteOrder.nativeOrder() ); ByteBuffer src = ByteBuffer.wrap( audio_bytes ); src.order( ByteOrder.LITTLE_ENDIAN ); if( two_bytes_data ) { ShortBuffer dest_short = dest.asShortBuffer(); ShortBuffer src_short = src.asShortBuffer(); while( src_short.hasRemaining() ) { dest_short.put(src_short.get()); } } else { while( src.hasRemaining() ) { dest.put( src.get() ); } } dest.rewind(); if( !dest.hasArray() ) { byte[] arrayBackedBuffer = new byte[dest.capacity()]; dest.get( arrayBackedBuffer ); dest.clear(); return arrayBackedBuffer; } return dest.array(); } | /**
* Converts sound bytes to little-endian format.
* @param audio_bytes The original wave data
* @param two_bytes_data For stereo sounds.
* @return byte array containing the converted data.
*/ | Converts sound bytes to little-endian format | convertAudioBytes | {
"repo_name": "yuripourre/etyllica",
"path": "src/main/java/sound/paulscode/codecs/CodecWav.java",
"license": "lgpl-3.0",
"size": 17420
} | [
"java.nio.ByteBuffer",
"java.nio.ByteOrder",
"java.nio.ShortBuffer"
] | import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.nio.ShortBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,532,760 |
public static String getFragment(String uriString) {
try {
return (new URI(uriString)).getFragment();
}
catch (URISyntaxException e) {
try {
return (new NetworkInterfaceURI(uriString)).getFragment();
}
catch (IllegalArgumentException ne) {
throw new IllegalArgumentException(ne.getMessage(), ne);
}
}
} | static String function(String uriString) { try { return (new URI(uriString)).getFragment(); } catch (URISyntaxException e) { try { return (new NetworkInterfaceURI(uriString)).getFragment(); } catch (IllegalArgumentException ne) { throw new IllegalArgumentException(ne.getMessage(), ne); } } } | /**
* Helper method for retrieving fragment
* @param uriString
* @return
*/ | Helper method for retrieving fragment | getFragment | {
"repo_name": "jfallows/gateway",
"path": "resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java",
"license": "apache-2.0",
"size": 20303
} | [
"java.net.URISyntaxException"
] | import java.net.URISyntaxException; | import java.net.*; | [
"java.net"
] | java.net; | 911,794 |
interface WithReadReplication {
WithCreate withReadReplication(Region region);
} | interface WithReadReplication { WithCreate withReadReplication(Region region); } | /**
* A georeplication location for the CosmosDB account.
*
* @param region the region for the location
* @return the next stage
*/ | A georeplication location for the CosmosDB account | withReadReplication | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/models/CosmosDBAccount.java",
"license": "mit",
"size": 25538
} | [
"com.azure.core.management.Region"
] | import com.azure.core.management.Region; | import com.azure.core.management.*; | [
"com.azure.core"
] | com.azure.core; | 1,663,027 |
DatabaseGetResponse get(String serverName, String databaseName) throws IOException, ServiceException, ParserConfigurationException, SAXException; | DatabaseGetResponse get(String serverName, String databaseName) throws IOException, ServiceException, ParserConfigurationException, SAXException; | /**
* Returns information about an Azure SQL Database.
*
* @param serverName Required. The name of the Azure SQL Database Server on
* which the database is hosted.
* @param databaseName Required. The name of the Azure SQL Database to be
* retrieved.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @return Contains the response to a Get Database request.
*/ | Returns information about an Azure SQL Database | get | {
"repo_name": "manikandan-palaniappan/azure-sdk-for-java",
"path": "management-sql/src/main/java/com/microsoft/windowsazure/management/sql/DatabaseOperations.java",
"license": "apache-2.0",
"size": 11203
} | [
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.management.sql.models.DatabaseGetResponse",
"java.io.IOException",
"javax.xml.parsers.ParserConfigurationException",
"org.xml.sax.SAXException"
] | import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.management.sql.models.DatabaseGetResponse; import java.io.IOException; import javax.xml.parsers.ParserConfigurationException; import org.xml.sax.SAXException; | import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.management.sql.models.*; import java.io.*; import javax.xml.parsers.*; import org.xml.sax.*; | [
"com.microsoft.windowsazure",
"java.io",
"javax.xml",
"org.xml.sax"
] | com.microsoft.windowsazure; java.io; javax.xml; org.xml.sax; | 519,576 |
public void setCursor(Image img, Cursor default_cursor) {
Point offset = new Point(0, 0);
Cursor customCursor = Toolkit.getDefaultToolkit()
.createCustomCursor(img, offset, "");
cursors.put(default_cursor, customCursor);
} | void function(Image img, Cursor default_cursor) { Point offset = new Point(0, 0); Cursor customCursor = Toolkit.getDefaultToolkit() .createCustomCursor(img, offset, ""); cursors.put(default_cursor, customCursor); } | /**
* Sets a custom Cursor object associated with the default_cursor.
*/ | Sets a custom Cursor object associated with the default_cursor | setCursor | {
"repo_name": "d2fn/passage",
"path": "src/main/java/com/bbn/openmap/tools/dnd/DnDListener.java",
"license": "mit",
"size": 12312
} | [
"java.awt.Cursor",
"java.awt.Image",
"java.awt.Point",
"java.awt.Toolkit"
] | import java.awt.Cursor; import java.awt.Image; import java.awt.Point; import java.awt.Toolkit; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,693,366 |
public List<GenericValue> getRelatedMulti(String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException {
return this.getDelegator().getMultiRelation(this, relationNameOne, relationNameTwo, orderBy);
} | List<GenericValue> function(String relationNameOne, String relationNameTwo, List<String> orderBy) throws GenericEntityException { return this.getDelegator().getMultiRelation(this, relationNameOne, relationNameTwo, orderBy); } | /**
* Get the named Related Entity for the GenericValue from the persistent store across another Relation.
* Helps to get related Values in a multi-to-multi relationship.
* @param relationNameOne String containing the relation name which is the
* combination of relation.title and relation.rel-entity-name as
* specified in the entity XML definition file, for first relation
* @param relationNameTwo String containing the relation name for second relation
* @param orderBy The fields of the named entity to order the query by; may be null;
* optionally add a " ASC" for ascending or " DESC" for descending
* @return List of GenericValue instances as specified in the relation definition
*/ | Get the named Related Entity for the GenericValue from the persistent store across another Relation. Helps to get related Values in a multi-to-multi relationship | getRelatedMulti | {
"repo_name": "ilscipio/scipio-erp",
"path": "framework/entity/src/org/ofbiz/entity/GenericValue.java",
"license": "apache-2.0",
"size": 28803
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,302,334 |
EReference getPTUV_TmVSt(); | EReference getPTUV_TmVSt(); | /**
* Returns the meta object for the reference '{@link gluemodel.substationStandard.LNNodes.LNGroupP.PTUV#getTmVSt <em>Tm VSt</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Tm VSt</em>'.
* @see gluemodel.substationStandard.LNNodes.LNGroupP.PTUV#getTmVSt()
* @see #getPTUV()
* @generated
*/ | Returns the meta object for the reference '<code>gluemodel.substationStandard.LNNodes.LNGroupP.PTUV#getTmVSt Tm VSt</code>'. | getPTUV_TmVSt | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/substationStandard/LNNodes/LNGroupP/LNGroupPPackage.java",
"license": "mit",
"size": 291175
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 555,257 |
Product add(Product product, String token, String tenant) throws InsertResourceException; | Product add(Product product, String token, String tenant) throws InsertResourceException; | /**
* Add to the catalog the product.
*
* @param product
* the release dto
* @throws InsertResourceException
* @return the created product.
*/ | Add to the catalog the product | add | {
"repo_name": "Fiware/cloud.SDC",
"path": "client/src/main/java/com/telefonica/euro_iaas/sdc/client/services/ProductService.java",
"license": "apache-2.0",
"size": 3478
} | [
"com.telefonica.euro_iaas.sdc.client.exception.InsertResourceException",
"com.telefonica.euro_iaas.sdc.model.Product"
] | import com.telefonica.euro_iaas.sdc.client.exception.InsertResourceException; import com.telefonica.euro_iaas.sdc.model.Product; | import com.telefonica.euro_iaas.sdc.client.exception.*; import com.telefonica.euro_iaas.sdc.model.*; | [
"com.telefonica.euro_iaas"
] | com.telefonica.euro_iaas; | 560,278 |
private int[] toLineNumbers(int y_coordinate) {
StyledText textWidget= fTextViewer.getTextWidget();
int maxLines= textWidget.getContent().getLineCount();
int rulerLength= fCanvas.getSize().y;
int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines);
if (rulerLength > writable)
rulerLength= Math.max(writable - fHeader.getSize().y, 0);
if (y_coordinate >= writable || y_coordinate >= rulerLength)
return new int[] {-1, -1};
int[] lines= new int[2];
int pixel0= Math.max(y_coordinate - 1, 0);
int pixel1= Math.min(rulerLength, y_coordinate + 1);
rulerLength= Math.max(rulerLength, 1);
lines[0]= (pixel0 * maxLines) / rulerLength;
lines[1]= (pixel1 * maxLines) / rulerLength;
if (fTextViewer instanceof ITextViewerExtension5) {
ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer;
lines[0]= extension.widgetLine2ModelLine(lines[0]);
lines[1]= extension.widgetLine2ModelLine(lines[1]);
} else {
try {
IRegion visible= fTextViewer.getVisibleRegion();
int lineNumber= fTextViewer.getDocument().getLineOfOffset(visible.getOffset());
lines[0] += lineNumber;
lines[1] += lineNumber;
} catch (BadLocationException x) {
}
}
return lines;
} | int[] function(int y_coordinate) { StyledText textWidget= fTextViewer.getTextWidget(); int maxLines= textWidget.getContent().getLineCount(); int rulerLength= fCanvas.getSize().y; int writable= JFaceTextUtil.computeLineHeight(textWidget, 0, maxLines, maxLines); if (rulerLength > writable) rulerLength= Math.max(writable - fHeader.getSize().y, 0); if (y_coordinate >= writable y_coordinate >= rulerLength) return new int[] {-1, -1}; int[] lines= new int[2]; int pixel0= Math.max(y_coordinate - 1, 0); int pixel1= Math.min(rulerLength, y_coordinate + 1); rulerLength= Math.max(rulerLength, 1); lines[0]= (pixel0 * maxLines) / rulerLength; lines[1]= (pixel1 * maxLines) / rulerLength; if (fTextViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 extension= (ITextViewerExtension5) fTextViewer; lines[0]= extension.widgetLine2ModelLine(lines[0]); lines[1]= extension.widgetLine2ModelLine(lines[1]); } else { try { IRegion visible= fTextViewer.getVisibleRegion(); int lineNumber= fTextViewer.getDocument().getLineOfOffset(visible.getOffset()); lines[0] += lineNumber; lines[1] += lineNumber; } catch (BadLocationException x) { } } return lines; } | /**
* Translates a given y-coordinate of this ruler into the corresponding
* document lines. The number of lines depends on the concrete scaling
* given as the ration between the height of this ruler and the length
* of the document.
*
* @param y_coordinate the y-coordinate
* @return the corresponding document lines
*/ | Translates a given y-coordinate of this ruler into the corresponding document lines. The number of lines depends on the concrete scaling given as the ration between the height of this ruler and the length of the document | toLineNumbers | {
"repo_name": "neelance/jface4ruby",
"path": "jface4ruby/src/org/eclipse/jface/text/source/OverviewRuler.java",
"license": "epl-1.0",
"size": 39538
} | [
"org.eclipse.jface.text.BadLocationException",
"org.eclipse.jface.text.IRegion",
"org.eclipse.jface.text.ITextViewerExtension5",
"org.eclipse.jface.text.JFaceTextUtil",
"org.eclipse.swt.custom.StyledText"
] | import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IRegion; import org.eclipse.jface.text.ITextViewerExtension5; import org.eclipse.jface.text.JFaceTextUtil; import org.eclipse.swt.custom.StyledText; | import org.eclipse.jface.text.*; import org.eclipse.swt.custom.*; | [
"org.eclipse.jface",
"org.eclipse.swt"
] | org.eclipse.jface; org.eclipse.swt; | 1,284,251 |
public List getConfigurations() {
return m_configurations;
}
| List function() { return m_configurations; } | /**
* Returns the list of all initialized configurations.<p>
*
* @return the list of all initialized configurations
*/ | Returns the list of all initialized configurations | getConfigurations | {
"repo_name": "comundus/opencms-comundus",
"path": "src/main/java/org/opencms/configuration/CmsConfigurationManager.java",
"license": "lgpl-2.1",
"size": 19624
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,806,278 |
@Function
public static String randomizeLetterCase(String text) {
StringBuilder result = new StringBuilder();
for (int i = 0; i < text.length(); i++) {
char c = text.charAt(i);
if (RANDOM.nextBoolean()) {
c = toUpperCase(c);
} else {
c = toLowerCase(c);
}
result.append(c);
}
return result.toString();
} | static String function(String text) { StringBuilder result = new StringBuilder(); for (int i = 0; i < text.length(); i++) { char c = text.charAt(i); if (RANDOM.nextBoolean()) { c = toUpperCase(c); } else { c = toLowerCase(c); } result.append(c); } return result.toString(); } | /**
* Takes a string and randomizes which letters in the text are upper or
* lower case
* @param text
* @return
*/ | Takes a string and randomizes which letters in the text are upper or lower case | randomizeLetterCase | {
"repo_name": "jfallows/k3po",
"path": "specification/ws/src/main/java/org/kaazing/specification/ws/internal/Functions.java",
"license": "apache-2.0",
"size": 7682
} | [
"java.lang.Character"
] | import java.lang.Character; | import java.lang.*; | [
"java.lang"
] | java.lang; | 1,673,993 |
@Override
public boolean equals(Object other)
{
Statement st = (Statement)other;
if (st == null) return false;
return
ObjectUtils.safeEquals(sUri, st.sUri) &&
ObjectUtils.safeEquals(oUri, st.oUri) &&
ObjectUtils.safeEquals(pUri, st.pUri) &&
ObjectUtils.safeEquals(lit, st.lit) &&
StringUtils.safeEqualsIgnoreCase(litLang, st.litLang) &&
ObjectUtils.safeEquals(litType, st.litType) &&
(sIsAnon == st.sIsAnon) &&
(oIsAnon == st.oIsAnon) &&
(fLiteral == st.fLiteral);
}
| boolean function(Object other) { Statement st = (Statement)other; if (st == null) return false; return ObjectUtils.safeEquals(sUri, st.sUri) && ObjectUtils.safeEquals(oUri, st.oUri) && ObjectUtils.safeEquals(pUri, st.pUri) && ObjectUtils.safeEquals(lit, st.lit) && StringUtils.safeEqualsIgnoreCase(litLang, st.litLang) && ObjectUtils.safeEquals(litType, st.litType) && (sIsAnon == st.sIsAnon) && (oIsAnon == st.oIsAnon) && (fLiteral == st.fLiteral); } | /**
* Not sure if I want to keep this. At the moment, only used for unit test.
*/ | Not sure if I want to keep this. At the moment, only used for unit test | equals | {
"repo_name": "christopher-johnson/cyto-rdf",
"path": "com.generalbioinformatics.rdf/com.generalbioinformatics.rdf/src/com/generalbioinformatics/rdf/stream/Statement.java",
"license": "gpl-2.0",
"size": 6468
} | [
"nl.helixsoft.util.ObjectUtils",
"nl.helixsoft.util.StringUtils"
] | import nl.helixsoft.util.ObjectUtils; import nl.helixsoft.util.StringUtils; | import nl.helixsoft.util.*; | [
"nl.helixsoft.util"
] | nl.helixsoft.util; | 1,738,471 |
@Override
public org.eclipse.persistence.sessions.Project getProject() {
return project;
} | org.eclipse.persistence.sessions.Project function() { return project; } | /**
* PUBLIC:
* Return the project, the project holds configuartion information including the descriptors.
*/ | Return the project, the project holds configuartion information including the descriptors | getProject | {
"repo_name": "gameduell/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/internal/sessions/AbstractSession.java",
"license": "epl-1.0",
"size": 198170
} | [
"org.eclipse.persistence.sessions.Project"
] | import org.eclipse.persistence.sessions.Project; | import org.eclipse.persistence.sessions.*; | [
"org.eclipse.persistence"
] | org.eclipse.persistence; | 1,015,714 |
private void printMonth(int mm, int yy) {
// //JKLog.d(tag, "==> printMonth: mm: " + mm + " " + "yy: " + yy);
// The number of days to leave blank at
// the start of this month.
int trailingSpaces = 0;
int leadSpaces = 0;
int daysInPrevMonth = 0;
int prevMonth = 0;
int prevYear = 0;
int nextMonth = 0;
int nextYear = 0;
int currentMonth = mm - 1;
String currentMonthName = getMonthAsString(currentMonth);
daysInMonth = getNumberOfDaysOfMonth(_calendar);
// //JKLog.d(tag, "Current Month: " + " " + currentMonthName + " having " + daysInMonth + " days.");
// Gregorian Calendar : MINUS 1, set to FIRST OF MONTH
GregorianCalendar cal = new GregorianCalendar(yy, currentMonth, 1);
//JKLog.d(tag, "Gregorian Calendar:= " + cal.getTime().toString());
Calendar prevC = Calendar.getInstance();
if (currentMonth == 11) {
prevMonth = currentMonth - 1;
prevC.set(Calendar.MONTH,prevMonth);
daysInPrevMonth = getNumberOfDaysOfMonth(prevC);
nextMonth = 0;
prevYear = yy;
nextYear = yy + 1;
//JKLog.d(tag, "*->PrevYear: " + prevYear + " PrevMonth:" + prevMonth + " NextMonth: " + nextMonth + " NextYear: " + nextYear);
} else if (currentMonth == 0) {
prevMonth = 11;
prevYear = yy - 1;
nextYear = yy;
prevC.set(Calendar.MONTH,prevMonth);
daysInPrevMonth = getNumberOfDaysOfMonth(prevC);
nextMonth = 1;
//JKLog.d(tag, "**--> PrevYear: " + prevYear + " PrevMonth:" + prevMonth + " NextMonth: " + nextMonth + " NextYear: " + nextYear);
} else {
prevMonth = currentMonth - 1;
nextMonth = currentMonth + 1;
nextYear = yy;
prevYear = yy;
prevC.set(Calendar.MONTH,prevMonth);
daysInPrevMonth = getNumberOfDaysOfMonth(prevC);
//JKLog.d(tag, "***---> PrevYear: " + prevYear + " PrevMonth:" + prevMonth + " NextMonth: " + nextMonth + " NextYear: " + nextYear);
}
// Compute how much to leave before before the first day of the
// month.
// getDay() returns 0 for Sunday.
int currentWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1;
trailingSpaces = currentWeekDay;
//JKLog.d(tag, "Week Day:" + currentWeekDay + " is " + getWeekDayAsString(currentWeekDay));
//JKLog.d(tag, "No. Trailing space to Add: " + trailingSpaces);
//JKLog.d(tag, "No. of Days in Previous Month: " + daysInPrevMonth);
if (cal.isLeapYear(cal.get(Calendar.YEAR)) && mm == 1) {
++daysInMonth;
}
// Trailing Month days
for (int i = 0; i < trailingSpaces; i++) {
// //JKLog.d(tag, "PREV MONTH:= " + prevMonth + " => " + getMonthAsString(prevMonth) + " " + String.valueOf((daysInPrevMonth - trailingSpaces + DAY_OFFSET) + i));
list.add("GREY-"+ String.valueOf((daysInPrevMonth - trailingSpaces + DAY_OFFSET) + i) + "-" + getMonthAsString(prevMonth) + "-" + prevYear);
}
//紀錄Month是第幾格開始
thisMonthStartIndex = list.size();
// Current Month Days
for (int i = 1; i <= daysInMonth; i++) {
//JKLog.d(currentMonthName, String.valueOf(i) + " " + getMonthAsString(currentMonth) + " " + yy);
if (i == getCurrentDayOfMonth()) {
list.add("BLACK-" + String.valueOf(i) + "-" + getMonthAsString(currentMonth) + "-" + yy);
} else {
list.add("WHITE-" + String.valueOf(i) + "-" + getMonthAsString(currentMonth) + "-" + yy);
}
}
//紀錄Month是第幾格結束
thisMonthEndIndex = list.size();
// Leading Month days
for (int i = 0; i < list.size() % 7; i++) {
//JKLog.d(tag, "NEXT MONTH:= " + getMonthAsString(nextMonth));
list.add( "GREY-" + String.valueOf(i + 1) +"-" + getMonthAsString(nextMonth) + "-" + nextYear);
}
} | void function(int mm, int yy) { int trailingSpaces = 0; int leadSpaces = 0; int daysInPrevMonth = 0; int prevMonth = 0; int prevYear = 0; int nextMonth = 0; int nextYear = 0; int currentMonth = mm - 1; String currentMonthName = getMonthAsString(currentMonth); daysInMonth = getNumberOfDaysOfMonth(_calendar); GregorianCalendar cal = new GregorianCalendar(yy, currentMonth, 1); Calendar prevC = Calendar.getInstance(); if (currentMonth == 11) { prevMonth = currentMonth - 1; prevC.set(Calendar.MONTH,prevMonth); daysInPrevMonth = getNumberOfDaysOfMonth(prevC); nextMonth = 0; prevYear = yy; nextYear = yy + 1; } else if (currentMonth == 0) { prevMonth = 11; prevYear = yy - 1; nextYear = yy; prevC.set(Calendar.MONTH,prevMonth); daysInPrevMonth = getNumberOfDaysOfMonth(prevC); nextMonth = 1; } else { prevMonth = currentMonth - 1; nextMonth = currentMonth + 1; nextYear = yy; prevYear = yy; prevC.set(Calendar.MONTH,prevMonth); daysInPrevMonth = getNumberOfDaysOfMonth(prevC); } int currentWeekDay = cal.get(Calendar.DAY_OF_WEEK) - 1; trailingSpaces = currentWeekDay; if (cal.isLeapYear(cal.get(Calendar.YEAR)) && mm == 1) { ++daysInMonth; } for (int i = 0; i < trailingSpaces; i++) { list.add("GREY-"+ String.valueOf((daysInPrevMonth - trailingSpaces + DAY_OFFSET) + i) + "-" + getMonthAsString(prevMonth) + "-" + prevYear); } thisMonthStartIndex = list.size(); for (int i = 1; i <= daysInMonth; i++) { if (i == getCurrentDayOfMonth()) { list.add(STR + String.valueOf(i) + "-" + getMonthAsString(currentMonth) + "-" + yy); } else { list.add(STR + String.valueOf(i) + "-" + getMonthAsString(currentMonth) + "-" + yy); } } thisMonthEndIndex = list.size(); for (int i = 0; i < list.size() % 7; i++) { list.add( "GREY-" + String.valueOf(i + 1) +"-" + getMonthAsString(nextMonth) + "-" + nextYear); } } | /**
* Prints Month
*
* @param mm
* @param yy
*/ | Prints Month | printMonth | {
"repo_name": "Jakevin/JKCalendar",
"path": "jkcalendar_lib/src/main/java/jakevin/com/jkcalendar_lib/ui/adapter/GridCellAdapter.java",
"license": "apache-2.0",
"size": 13104
} | [
"java.util.Calendar",
"java.util.GregorianCalendar"
] | import java.util.Calendar; import java.util.GregorianCalendar; | import java.util.*; | [
"java.util"
] | java.util; | 313,467 |
@Test
public void testPropertyToMessageAttributeWithEmpty() throws JMSException {
SQSMessage sqsText = new SQSTextMessage();
Map<String, MessageAttributeValue> messageAttributeText = producer.propertyToMessageAttribute(sqsText);
assertEquals(0, messageAttributeText.size());
SQSMessage sqsObject = new SQSObjectMessage();
Map<String, MessageAttributeValue> messageAttributeObject = producer.propertyToMessageAttribute(sqsObject);
assertEquals(0, messageAttributeObject.size());
MessageAttributeValue messageAttributeValueByte = new MessageAttributeValue();
messageAttributeValueByte.setDataType("String");
messageAttributeValueByte.setStringValue("byte");
SQSMessage sqsByte = new SQSBytesMessage();
Map<String, MessageAttributeValue> messageAttributeByte = producer.propertyToMessageAttribute(sqsByte);
assertEquals(0, messageAttributeObject.size());
} | void function() throws JMSException { SQSMessage sqsText = new SQSTextMessage(); Map<String, MessageAttributeValue> messageAttributeText = producer.propertyToMessageAttribute(sqsText); assertEquals(0, messageAttributeText.size()); SQSMessage sqsObject = new SQSObjectMessage(); Map<String, MessageAttributeValue> messageAttributeObject = producer.propertyToMessageAttribute(sqsObject); assertEquals(0, messageAttributeObject.size()); MessageAttributeValue messageAttributeValueByte = new MessageAttributeValue(); messageAttributeValueByte.setDataType(STR); messageAttributeValueByte.setStringValue("byte"); SQSMessage sqsByte = new SQSBytesMessage(); Map<String, MessageAttributeValue> messageAttributeByte = producer.propertyToMessageAttribute(sqsByte); assertEquals(0, messageAttributeObject.size()); } | /**
* Test propertyToMessageAttribute with empty messages of different type
*/ | Test propertyToMessageAttribute with empty messages of different type | testPropertyToMessageAttributeWithEmpty | {
"repo_name": "awslabs/amazon-sqs-java-messaging-lib",
"path": "src/test/java/com/amazon/sqs/javamessaging/SQSMessageProducerTest.java",
"license": "apache-2.0",
"size": 28836
} | [
"com.amazon.sqs.javamessaging.message.SQSBytesMessage",
"com.amazon.sqs.javamessaging.message.SQSMessage",
"com.amazon.sqs.javamessaging.message.SQSObjectMessage",
"com.amazon.sqs.javamessaging.message.SQSTextMessage",
"com.amazonaws.services.sqs.model.MessageAttributeValue",
"java.util.Map",
"javax.jms.JMSException",
"org.junit.Assert"
] | import com.amazon.sqs.javamessaging.message.SQSBytesMessage; import com.amazon.sqs.javamessaging.message.SQSMessage; import com.amazon.sqs.javamessaging.message.SQSObjectMessage; import com.amazon.sqs.javamessaging.message.SQSTextMessage; import com.amazonaws.services.sqs.model.MessageAttributeValue; import java.util.Map; import javax.jms.JMSException; import org.junit.Assert; | import com.amazon.sqs.javamessaging.message.*; import com.amazonaws.services.sqs.model.*; import java.util.*; import javax.jms.*; import org.junit.*; | [
"com.amazon.sqs",
"com.amazonaws.services",
"java.util",
"javax.jms",
"org.junit"
] | com.amazon.sqs; com.amazonaws.services; java.util; javax.jms; org.junit; | 14,738 |
public HttpBodyContent getObject(Path path, long byteRangeStart, long length)
throws IOException {
return swiftRestClient.getData(
toObjectPath(path), byteRangeStart, length);
} | HttpBodyContent function(Path path, long byteRangeStart, long length) throws IOException { return swiftRestClient.getData( toObjectPath(path), byteRangeStart, length); } | /**
* Get the input stream starting from a specific point.
*
* @param path path to object
* @param byteRangeStart starting point
* @param length no. of bytes
* @return an input stream that must be closed
* @throws IOException IO problems
*/ | Get the input stream starting from a specific point | getObject | {
"repo_name": "legend-hua/hadoop",
"path": "hadoop-tools/hadoop-openstack/src/main/java/org/apache/hadoop/fs/swift/snative/SwiftNativeFileSystemStore.java",
"license": "apache-2.0",
"size": 35041
} | [
"java.io.IOException",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.swift.http.HttpBodyContent"
] | import java.io.IOException; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.swift.http.HttpBodyContent; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.swift.http.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,341,472 |
public Exchange delete(Exchange exchange) throws BusinessException {
logger.debug("delete - START");
logger.debug("Deleting exchange with id: ".concat(String.valueOf(exchange.getExchangeId())));
try{
exchange = exchangeDao.delete(exchange);
} catch (Exception e) {
throw new BusinessException(ICodeException.EXCHANGE_DELETE, e);
}
logger.debug("Exchange " + exchange + " has been deleted");
logger.debug("delete - END");
return exchange;
}
| Exchange function(Exchange exchange) throws BusinessException { logger.debug(STR); logger.debug(STR.concat(String.valueOf(exchange.getExchangeId()))); try{ exchange = exchangeDao.delete(exchange); } catch (Exception e) { throw new BusinessException(ICodeException.EXCHANGE_DELETE, e); } logger.debug(STR + exchange + STR); logger.debug(STR); return exchange; } | /**
* Deletes an exchange
*
* @author Adelina
*
* @param exchange
* @return
* @throws BusinessException
*/ | Deletes an exchange | delete | {
"repo_name": "CodeSphere/termitaria",
"path": "TermitariaTS/src/ro/cs/ts/business/BLExchange.java",
"license": "agpl-3.0",
"size": 10803
} | [
"ro.cs.ts.entity.Exchange",
"ro.cs.ts.exception.BusinessException",
"ro.cs.ts.exception.ICodeException"
] | import ro.cs.ts.entity.Exchange; import ro.cs.ts.exception.BusinessException; import ro.cs.ts.exception.ICodeException; | import ro.cs.ts.entity.*; import ro.cs.ts.exception.*; | [
"ro.cs.ts"
] | ro.cs.ts; | 668,462 |
public Set getNamespaces() {
return NAMESPACES;
}
| Set function() { return NAMESPACES; } | /**
* Returns a set with all the URIs (JDOM Namespace elements) this module generator uses.
* <p/>
* It is used by the the feed generators to add their namespace definition in
* the root element of the generated document (forward-missing of Java 5.0 Generics).
* <p/>
*
* @return a set with all the URIs (JDOM Namespace elements) this module generator uses.
*/ | Returns a set with all the URIs (JDOM Namespace elements) this module generator uses. It is used by the the feed generators to add their namespace definition in the root element of the generated document (forward-missing of Java 5.0 Generics). | getNamespaces | {
"repo_name": "OpenNTF/collaborationtoday",
"path": "DOTSFeedMonster/org.openntf.rome/org.openntf.rome/src/com/sun/syndication/io/impl/SyModuleGenerator.java",
"license": "apache-2.0",
"size": 2925
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,269,945 |
private String[] harvestTool = new String[16];;
private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
public void setHarvestLevel(String toolClass, int level)
{
java.util.Iterator<IBlockState> itr = getBlockState().getValidStates().iterator();
while (itr.hasNext())
{
setHarvestLevel(toolClass, level, itr.next());
}
} | String[] harvestTool = new String[16];; private int[] harvestLevel = new int[]{-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1}; public void function(String toolClass, int level) { java.util.Iterator<IBlockState> itr = getBlockState().getValidStates().iterator(); while (itr.hasNext()) { setHarvestLevel(toolClass, level, itr.next()); } } | /**
* Sets or removes the tool and level required to harvest this block.
*
* @param toolClass Class
* @param level Harvest level:
* Wood: 0
* Stone: 1
* Iron: 2
* Diamond: 3
* Gold: 0
*/ | Sets or removes the tool and level required to harvest this block | setHarvestLevel | {
"repo_name": "aebert1/BigTransport",
"path": "build/tmp/recompileMc/sources/net/minecraft/block/Block.java",
"license": "gpl-3.0",
"size": 115325
} | [
"net.minecraft.block.state.IBlockState"
] | import net.minecraft.block.state.IBlockState; | import net.minecraft.block.state.*; | [
"net.minecraft.block"
] | net.minecraft.block; | 1,530,878 |
@Test
public void testMixedLocalGlobalTransactionNested3() throws Exception {
IPhynixxXAConnection<ITestConnection> xaCon = factory1.getXAConnection();
// con 1in lo´cal transaction. Transactional context has transactional
// data
ITestConnection con1 = xaCon.getConnection();
Object conId1 = con1.getConnectionId();
con1.act(1);
con1.act(2);
con1.commit();
// con1 on global transaction
this.getTransactionManager().begin();
// con2 shared con1 on global transaction
ITestConnection con2 = xaCon.getConnection();
Object conId2 = con2.getConnectionId();
con2.act(2);
this.getTransactionManager().rollback();
log.info(TestConnectionStatusManager.toDebugString());
TestStatusStack statusStack1 = TestConnectionStatusManager.getStatusStack(conId1);
TestCase.assertTrue(statusStack1 != null);
TestCase.assertTrue(statusStack1.isRolledback());
TestCase.assertTrue(statusStack1.isReleased());
TestStatusStack statusStack2 = TestConnectionStatusManager.getStatusStack(conId2);
TestCase.assertTrue(statusStack2 != null);
TestCase.assertTrue(statusStack2.isCommitted());
// one-phase commit -> no prepare
TestCase.assertTrue(!statusStack2.isPrepared());
TestCase.assertTrue(statusStack2.isReleased());
} | void function() throws Exception { IPhynixxXAConnection<ITestConnection> xaCon = factory1.getXAConnection(); ITestConnection con1 = xaCon.getConnection(); Object conId1 = con1.getConnectionId(); con1.act(1); con1.act(2); con1.commit(); this.getTransactionManager().begin(); ITestConnection con2 = xaCon.getConnection(); Object conId2 = con2.getConnectionId(); con2.act(2); this.getTransactionManager().rollback(); log.info(TestConnectionStatusManager.toDebugString()); TestStatusStack statusStack1 = TestConnectionStatusManager.getStatusStack(conId1); TestCase.assertTrue(statusStack1 != null); TestCase.assertTrue(statusStack1.isRolledback()); TestCase.assertTrue(statusStack1.isReleased()); TestStatusStack statusStack2 = TestConnectionStatusManager.getStatusStack(conId2); TestCase.assertTrue(statusStack2 != null); TestCase.assertTrue(statusStack2.isCommitted()); TestCase.assertTrue(!statusStack2.isPrepared()); TestCase.assertTrue(statusStack2.isReleased()); } | /**
*
* A local transaction is opened, transactional context is modified but
* rolled back at least. Therefore the transactional context is closed and a
* new global transaction can be start on this XAConncgtion
*
* @throws Exception
*/ | A local transaction is opened, transactional context is modified but rolled back at least. Therefore the transactional context is closed and a new global transaction can be start on this XAConncgtion | testMixedLocalGlobalTransactionNested3 | {
"repo_name": "csc19601128/Phynixx",
"path": "phynixx/phynixx-xa/src/test/java/org/csc/phynixx/xa/JotmIntegrationTest.java",
"license": "apache-2.0",
"size": 45549
} | [
"junit.framework.TestCase",
"org.csc.phynixx.phynixx.testconnection.ITestConnection",
"org.csc.phynixx.phynixx.testconnection.TestConnectionStatusManager",
"org.csc.phynixx.phynixx.testconnection.TestStatusStack"
] | import junit.framework.TestCase; import org.csc.phynixx.phynixx.testconnection.ITestConnection; import org.csc.phynixx.phynixx.testconnection.TestConnectionStatusManager; import org.csc.phynixx.phynixx.testconnection.TestStatusStack; | import junit.framework.*; import org.csc.phynixx.phynixx.testconnection.*; | [
"junit.framework",
"org.csc.phynixx"
] | junit.framework; org.csc.phynixx; | 1,677,696 |
public void loadConfigFile(String from) throws IOException; | void function(String from) throws IOException; | /**
* Load configurations from file 'from'. This does not clear pre-existing
* configurations but may overwrite configurations for existing nodes.
*/ | Load configurations from file 'from'. This does not clear pre-existing configurations but may overwrite configurations for existing nodes | loadConfigFile | {
"repo_name": "yongkun/flume-0.9.3-cdh3u0-rakuten",
"path": "src/java/com/cloudera/flume/master/ConfigurationManager.java",
"license": "apache-2.0",
"size": 5187
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 187,686 |
public int getTokenActivationID(String token) throws SQLException, NoSuchTokenException;
| int function(String token) throws SQLException, NoSuchTokenException; | /**
* Fetches the activation UID associated with the provided token
*
* @param token The activation token (not cleartext)
*
* @return The activation UID
*
* @throws SQLException
* @throws NoSuchTokenException
*/ | Fetches the activation UID associated with the provided token | getTokenActivationID | {
"repo_name": "rodrigojmlourenco/CycleOurCity",
"path": "driver/src/main/java/org/cycleourcity/driver/database/UsersDriver.java",
"license": "gpl-2.0",
"size": 6748
} | [
"java.sql.SQLException",
"org.cycleourcity.driver.exceptions.NoSuchTokenException"
] | import java.sql.SQLException; import org.cycleourcity.driver.exceptions.NoSuchTokenException; | import java.sql.*; import org.cycleourcity.driver.exceptions.*; | [
"java.sql",
"org.cycleourcity.driver"
] | java.sql; org.cycleourcity.driver; | 1,658,891 |
private void addClassesForSchema(
OpenInfraSchemas schema,
List<Class<? extends OpenInfraPojo> > classes) {
for(Class<? extends OpenInfraPojo> currentClass : classes) {
if(Modifier.isAbstract(currentClass.getModifiers()) == false &&
currentClass.isInterface() == false) {
pojoClasses.get(schema).put(
currentClass.getSimpleName().replaceAll(
"Pojo", "").toLowerCase(),
currentClass);
}
}
}
| void function( OpenInfraSchemas schema, List<Class<? extends OpenInfraPojo> > classes) { for(Class<? extends OpenInfraPojo> currentClass : classes) { if(Modifier.isAbstract(currentClass.getModifiers()) == false && currentClass.isInterface() == false) { pojoClasses.get(schema).put( currentClass.getSimpleName().replaceAll( "Pojo", "").toLowerCase(), currentClass); } } } | /**
* This method adds all given classes to the hash map (except interfaces
* and abstract classes) for the given schema.
* @param schema the schema
* @param classes the classes
*/ | This method adds all given classes to the hash map (except interfaces and abstract classes) for the given schema | addClassesForSchema | {
"repo_name": "OpenInfRA/core",
"path": "openinfra_core/src/main/java/de/btu/openinfra/backend/db/PojoPrimer.java",
"license": "gpl-3.0",
"size": 17544
} | [
"de.btu.openinfra.backend.db.pojos.OpenInfraPojo",
"java.lang.reflect.Modifier",
"java.util.List"
] | import de.btu.openinfra.backend.db.pojos.OpenInfraPojo; import java.lang.reflect.Modifier; import java.util.List; | import de.btu.openinfra.backend.db.pojos.*; import java.lang.reflect.*; import java.util.*; | [
"de.btu.openinfra",
"java.lang",
"java.util"
] | de.btu.openinfra; java.lang; java.util; | 2,213,974 |
public List getCsList()
{
List<CpAndParticipentsBean> csList = new ArrayList<CpAndParticipentsBean>();
//Getting the instance of participantRegistrationCacheManager
ParticipantRegistrationCacheManager partiRegCacheMgr = new ParticipantRegistrationCacheManager();
//Getting the CP List
List<NameValueBean> csColl = partiRegCacheMgr.getCSDetailCollection();
Collections.sort(csColl);
session = flex.messaging.FlexContext.getHttpRequest().getSession();
SessionDataBean sessionDataBean = (SessionDataBean) session
.getAttribute(Constants.SESSION_DATA);
//String userName = sessionDataBean.getUserName();
try
{
Role role = SecurityManagerFactory.getSecurityManager().getUserRole(
Long.parseLong(sessionDataBean.getCsmUserId()));
for (NameValueBean bean : csColl)
{
CpAndParticipentsBean csBean = new CpAndParticipentsBean();
if (role.getName().equals(edu.wustl.security.global.Constants.ADMINISTRATOR)
|| ((edu.wustl.clinportal.security.SecurityManager) SecurityManagerFactory
.getSecurityManager()).isAuthorized(sessionDataBean.getUserName(),
ClinicalStudy.class.getName() + "_" + bean.getValue(),
Permissions.PHI))
{
csBean.setName(bean.getName());
csBean.setValue(bean.getValue());
csList.add(csBean);
}
}
}
catch (SMException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
return csList;
}
| List function() { List<CpAndParticipentsBean> csList = new ArrayList<CpAndParticipentsBean>(); ParticipantRegistrationCacheManager partiRegCacheMgr = new ParticipantRegistrationCacheManager(); List<NameValueBean> csColl = partiRegCacheMgr.getCSDetailCollection(); Collections.sort(csColl); session = flex.messaging.FlexContext.getHttpRequest().getSession(); SessionDataBean sessionDataBean = (SessionDataBean) session .getAttribute(Constants.SESSION_DATA); try { Role role = SecurityManagerFactory.getSecurityManager().getUserRole( Long.parseLong(sessionDataBean.getCsmUserId())); for (NameValueBean bean : csColl) { CpAndParticipentsBean csBean = new CpAndParticipentsBean(); if (role.getName().equals(edu.wustl.security.global.Constants.ADMINISTRATOR) ((edu.wustl.clinportal.security.SecurityManager) SecurityManagerFactory .getSecurityManager()).isAuthorized(sessionDataBean.getUserName(), ClinicalStudy.class.getName() + "_" + bean.getValue(), Permissions.PHI)) { csBean.setName(bean.getName()); csBean.setValue(bean.getValue()); csList.add(csBean); } } } catch (SMException e) { e.printStackTrace(); } return csList; } | /**
* This method retrieves the List if all Collection Protocols
* @return The cp List.
*/ | This method retrieves the List if all Collection Protocols | getCsList | {
"repo_name": "NCIP/catissue-tools",
"path": "WEB-INF/src/edu/wustl/clinportal/flex/FlexInterface.java",
"license": "bsd-3-clause",
"size": 17599
} | [
"edu.wustl.clinportal.bean.CpAndParticipentsBean",
"edu.wustl.clinportal.domain.ClinicalStudy",
"edu.wustl.clinportal.util.ParticipantRegistrationCacheManager",
"edu.wustl.common.beans.NameValueBean",
"edu.wustl.common.beans.SessionDataBean",
"edu.wustl.common.util.global.Constants",
"edu.wustl.security.exception.SMException",
"edu.wustl.security.global.Permissions",
"edu.wustl.security.manager.SecurityManagerFactory",
"gov.nih.nci.security.authorization.domainobjects.Role",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import edu.wustl.clinportal.bean.CpAndParticipentsBean; import edu.wustl.clinportal.domain.ClinicalStudy; import edu.wustl.clinportal.util.ParticipantRegistrationCacheManager; import edu.wustl.common.beans.NameValueBean; import edu.wustl.common.beans.SessionDataBean; import edu.wustl.common.util.global.Constants; import edu.wustl.security.exception.SMException; import edu.wustl.security.global.Permissions; import edu.wustl.security.manager.SecurityManagerFactory; import gov.nih.nci.security.authorization.domainobjects.Role; import java.util.ArrayList; import java.util.Collections; import java.util.List; | import edu.wustl.clinportal.bean.*; import edu.wustl.clinportal.domain.*; import edu.wustl.clinportal.util.*; import edu.wustl.common.beans.*; import edu.wustl.common.util.global.*; import edu.wustl.security.exception.*; import edu.wustl.security.global.*; import edu.wustl.security.manager.*; import gov.nih.nci.security.authorization.domainobjects.*; import java.util.*; | [
"edu.wustl.clinportal",
"edu.wustl.common",
"edu.wustl.security",
"gov.nih.nci",
"java.util"
] | edu.wustl.clinportal; edu.wustl.common; edu.wustl.security; gov.nih.nci; java.util; | 1,278,713 |
private int createServer() throws IOException {
CacheServer server = null;
Properties p = new Properties();
// make it a loner
p.put(MCAST_PORT, "0");
p.put(LOCATORS, "");
this.system = DistributedSystem.connect(p);
this.cache = CacheFactory.create(system);
server = this.cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setMaxConnections(MAX_CNXS);
server.setMaxThreads(getMaxThreads());
server.setPort(port);
server.start();
return server.getPort();
} | int function() throws IOException { CacheServer server = null; Properties p = new Properties(); p.put(MCAST_PORT, "0"); p.put(LOCATORS, ""); this.system = DistributedSystem.connect(p); this.cache = CacheFactory.create(system); server = this.cache.addCacheServer(); int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET); server.setMaxConnections(MAX_CNXS); server.setMaxThreads(getMaxThreads()); server.setPort(port); server.start(); return server.getPort(); } | /**
* Creates and starts the server instance
*/ | Creates and starts the server instance | createServer | {
"repo_name": "pdxrunner/geode",
"path": "geode-core/src/integrationTest/java/org/apache/geode/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java",
"license": "apache-2.0",
"size": 7602
} | [
"java.io.IOException",
"java.util.Properties",
"org.apache.geode.cache.CacheFactory",
"org.apache.geode.cache.server.CacheServer",
"org.apache.geode.distributed.DistributedSystem",
"org.apache.geode.internal.AvailablePort"
] | import java.io.IOException; import java.util.Properties; import org.apache.geode.cache.CacheFactory; import org.apache.geode.cache.server.CacheServer; import org.apache.geode.distributed.DistributedSystem; import org.apache.geode.internal.AvailablePort; | import java.io.*; import java.util.*; import org.apache.geode.cache.*; import org.apache.geode.cache.server.*; import org.apache.geode.distributed.*; import org.apache.geode.internal.*; | [
"java.io",
"java.util",
"org.apache.geode"
] | java.io; java.util; org.apache.geode; | 2,231,177 |
public void startDTD(XMLLocator locator, Augmentations augs) throws XNIException {
} // startDTD(XMLLocator)
// startExternalSubset(Augmentations)
// endExternalSubset(Augmentations) | void function(XMLLocator locator, Augmentations augs) throws XNIException { } | /**
* The start of the DTD.
*
* @param locator The document locator, or null if the document
* location cannot be reported during the parsing of
* the document DTD. However, it is <em>strongly</em>
* recommended that a locator be supplied that can
* at least report the base system identifier of the
* DTD.
*
* @param augs Additional information that may include infoset
* augmentations.
* @throws XNIException Thrown by handler to signal an error.
*/ | The start of the DTD | startDTD | {
"repo_name": "JetBrains/jdk8u_jaxp",
"path": "src/com/sun/xml/internal/stream/dtd/nonvalidating/DTDGrammar.java",
"license": "gpl-2.0",
"size": 32798
} | [
"com.sun.org.apache.xerces.internal.xni.Augmentations",
"com.sun.org.apache.xerces.internal.xni.XMLLocator",
"com.sun.org.apache.xerces.internal.xni.XNIException"
] | import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XMLLocator; import com.sun.org.apache.xerces.internal.xni.XNIException; | import com.sun.org.apache.xerces.internal.xni.*; | [
"com.sun.org"
] | com.sun.org; | 1,909,828 |
public int addEarcon(String earcon, String packagename, @RawRes int resourceId) {
synchronized(mStartLock) {
mEarcons.put(earcon, makeResourceUri(packagename, resourceId));
return SUCCESS;
}
} | int function(String earcon, String packagename, @RawRes int resourceId) { synchronized(mStartLock) { mEarcons.put(earcon, makeResourceUri(packagename, resourceId)); return SUCCESS; } } | /**
* Adds a mapping between a string of text and a sound resource in a
* package. Use this to add custom earcons.
*
* @see #playEarcon(String, int, HashMap)
*
* @param earcon The name of the earcon.
* Example: <code>"[tick]"</code><br/>
*
* @param packagename
* the package name of the application that contains the
* resource. This can for instance be the package name of your own application.
* Example: <b>"com.google.marvin.compass"</b><br/>
* The package name can be found in the AndroidManifest.xml of
* the application containing the resource.
* <p>
* <code><manifest xmlns:android="..."
* package="<b>com.google.marvin.compass</b>"></code>
* </p>
*
* @param resourceId
* Example: <code>R.raw.tick_snd</code>
*
* @return Code indicating success or failure. See {@link #ERROR} and {@link #SUCCESS}.
*/ | Adds a mapping between a string of text and a sound resource in a package. Use this to add custom earcons | addEarcon | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/speech/tts/TextToSpeech.java",
"license": "gpl-3.0",
"size": 98214
} | [
"android.annotation.RawRes"
] | import android.annotation.RawRes; | import android.annotation.*; | [
"android.annotation"
] | android.annotation; | 177,139 |
public void setBuilderCustomizers(
Collection<? extends UndertowBuilderCustomizer> customizers) {
Assert.notNull(customizers, "Customizers must not be null");
this.builderCustomizers = new ArrayList<UndertowBuilderCustomizer>(customizers);
} | void function( Collection<? extends UndertowBuilderCustomizer> customizers) { Assert.notNull(customizers, STR); this.builderCustomizers = new ArrayList<UndertowBuilderCustomizer>(customizers); } | /**
* Set {@link UndertowBuilderCustomizer}s that should be applied to the Undertow
* {@link Builder}. Calling this method will replace any existing customizers.
* @param customizers the customizers to set
*/ | Set <code>UndertowBuilderCustomizer</code>s that should be applied to the Undertow <code>Builder</code>. Calling this method will replace any existing customizers | setBuilderCustomizers | {
"repo_name": "jorgepgjr/spring-boot",
"path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java",
"license": "apache-2.0",
"size": 17678
} | [
"java.util.ArrayList",
"java.util.Collection",
"org.springframework.util.Assert"
] | import java.util.ArrayList; import java.util.Collection; import org.springframework.util.Assert; | import java.util.*; import org.springframework.util.*; | [
"java.util",
"org.springframework.util"
] | java.util; org.springframework.util; | 1,612,429 |
public static Type getGenericSupertype(Type type, Class<?> rawType, Class<?> toResolve) {
if (toResolve == rawType) {
return type;
}
// we skip searching through interfaces if unknown is an interface
if (toResolve.isInterface()) {
Class[] interfaces = rawType.getInterfaces();
for (int i = 0, length = interfaces.length; i < length; i++) {
if (interfaces[i] == toResolve) {
return rawType.getGenericInterfaces()[i];
} else if (toResolve.isAssignableFrom(interfaces[i])) {
return getGenericSupertype(rawType.getGenericInterfaces()[i], interfaces[i], toResolve);
}
}
}
// check our supertypes
if (!rawType.isInterface()) {
while (rawType != Object.class) {
Class<?> rawSupertype = rawType.getSuperclass();
if (rawSupertype == toResolve) {
return rawType.getGenericSuperclass();
} else if (toResolve.isAssignableFrom(rawSupertype)) {
return getGenericSupertype(rawType.getGenericSuperclass(), rawSupertype, toResolve);
}
rawType = rawSupertype;
}
}
// we can't resolve this further
return toResolve;
} | static Type function(Type type, Class<?> rawType, Class<?> toResolve) { if (toResolve == rawType) { return type; } if (toResolve.isInterface()) { Class[] interfaces = rawType.getInterfaces(); for (int i = 0, length = interfaces.length; i < length; i++) { if (interfaces[i] == toResolve) { return rawType.getGenericInterfaces()[i]; } else if (toResolve.isAssignableFrom(interfaces[i])) { return getGenericSupertype(rawType.getGenericInterfaces()[i], interfaces[i], toResolve); } } } if (!rawType.isInterface()) { while (rawType != Object.class) { Class<?> rawSupertype = rawType.getSuperclass(); if (rawSupertype == toResolve) { return rawType.getGenericSuperclass(); } else if (toResolve.isAssignableFrom(rawSupertype)) { return getGenericSupertype(rawType.getGenericSuperclass(), rawSupertype, toResolve); } rawType = rawSupertype; } } return toResolve; } | /**
* Returns the generic supertype for {@code supertype}. For example, given a class {@code
* IntegerSet}, the result for when supertype is {@code Set.class} is {@code Set<Integer>} and the
* result when the supertype is {@code Collection.class} is {@code Collection<Integer>}.
*/ | Returns the generic supertype for supertype. For example, given a class IntegerSet, the result for when supertype is Set.class is Set and the result when the supertype is Collection.class is Collection | getGenericSupertype | {
"repo_name": "cgruber/guice-old",
"path": "core/src/com/google/inject/internal/MoreTypes.java",
"license": "apache-2.0",
"size": 17938
} | [
"java.lang.reflect.Type"
] | import java.lang.reflect.Type; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,639,963 |
static MCRAudioVideoExtender buildExtender(MCRFile file) {
if (file == null || !providesAudioVideoExtender(file.getStoreID())) {
return null;
}
Class<? extends MCRAudioVideoExtender> cl = getExtenderClass(file.getStoreID());
try {
MCRAudioVideoExtender ext = cl.getDeclaredConstructor().newInstance();
ext.init(file);
return ext;
} catch (Exception exc) {
if (exc instanceof MCRException) {
throw (MCRException) exc;
}
String msg = "Could not build MCRAudioVideoExtender instance";
throw new MCRConfigurationException(msg, exc);
}
} | static MCRAudioVideoExtender buildExtender(MCRFile file) { if (file == null !providesAudioVideoExtender(file.getStoreID())) { return null; } Class<? extends MCRAudioVideoExtender> cl = getExtenderClass(file.getStoreID()); try { MCRAudioVideoExtender ext = cl.getDeclaredConstructor().newInstance(); ext.init(file); return ext; } catch (Exception exc) { if (exc instanceof MCRException) { throw (MCRException) exc; } String msg = STR; throw new MCRConfigurationException(msg, exc); } } | /**
* If the MCRContentStore of the MCRFile given provides an
* MCRAudioVideoExtender implementation, this method creates and initializes
* the MCRAudioVideoExtender instance for the MCRFile. The instance that is
* returned is configured by the property
* <code>MCR.IFS.AVExtender.<StoreID>.Class</code> in mycore.properties.
*
* @param file
* the non-null MCRFile that should get an MCRAudioVideoExtender
* @return the MCRAudioVideoExtender for the MCRFile given, or null
* @throws MCRConfigurationException
* if the MCRAudioVideoExtender implementation class could not
* be loaded
*/ | If the MCRContentStore of the MCRFile given provides an MCRAudioVideoExtender implementation, this method creates and initializes the MCRAudioVideoExtender instance for the MCRFile. The instance that is returned is configured by the property <code>MCR.IFS.AVExtender.<StoreID>.Class</code> in mycore.properties | buildExtender | {
"repo_name": "MyCoRe-Org/mycore",
"path": "mycore-ifs/src/main/java/org/mycore/datamodel/ifs/MCRContentStoreFactory.java",
"license": "gpl-3.0",
"size": 8752
} | [
"org.mycore.common.MCRException",
"org.mycore.common.config.MCRConfigurationException"
] | import org.mycore.common.MCRException; import org.mycore.common.config.MCRConfigurationException; | import org.mycore.common.*; import org.mycore.common.config.*; | [
"org.mycore.common"
] | org.mycore.common; | 46,310 |
PagedIterable<PolicyState> listQueryResultsForPolicySetDefinition(
PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); | PagedIterable<PolicyState> listQueryResultsForPolicySetDefinition( PolicyStatesResource policyStatesResource, String subscriptionId, String policySetDefinitionName); | /**
* Queries policy states for the subscription level policy set definition.
*
* @param policyStatesResource The virtual resource under PolicyStates resource type. In a given time range,
* 'latest' represents the latest policy state(s), whereas 'default' represents all policy state(s).
* @param subscriptionId Microsoft Azure subscription ID.
* @param policySetDefinitionName Policy set definition name.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return query results.
*/ | Queries policy states for the subscription level policy set definition | listQueryResultsForPolicySetDefinition | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/models/PolicyStates.java",
"license": "mit",
"size": 43705
} | [
"com.azure.core.http.rest.PagedIterable"
] | import com.azure.core.http.rest.PagedIterable; | import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 2,096,578 |
public MockValue get(@Nonnull String path, @Nonnull Consumer<MockResponse> consumer) {
return get(path, newContext(), consumer);
} | MockValue function(@Nonnull String path, @Nonnull Consumer<MockResponse> consumer) { return get(path, newContext(), consumer); } | /**
* Execute a GET request to the target application.
*
* @param path Path to match. Might includes the queryString.
* @param consumer Response metadata callback.
* @return Route response.
*/ | Execute a GET request to the target application | get | {
"repo_name": "jooby-project/jooby",
"path": "modules/jooby-test/src/main/java/io/jooby/MockRouter.java",
"license": "apache-2.0",
"size": 14724
} | [
"java.util.function.Consumer",
"javax.annotation.Nonnull"
] | import java.util.function.Consumer; import javax.annotation.Nonnull; | import java.util.function.*; import javax.annotation.*; | [
"java.util",
"javax.annotation"
] | java.util; javax.annotation; | 734,105 |
Boolean activatePendingSubscriptionsUpTo(final DateTime upToDateTime, long maxActiveSubscriptions); | Boolean activatePendingSubscriptionsUpTo(final DateTime upToDateTime, long maxActiveSubscriptions); | /**
* Activate the all pending subscriptions up to (but not including) the given date/time
* @param upToDateTime The date/time up to which all pending subscriptions will be activated
*/ | Activate the all pending subscriptions up to (but not including) the given date/time | activatePendingSubscriptionsUpTo | {
"repo_name": "motech-implementations/mim",
"path": "kilkari/src/main/java/org/motechproject/nms/kilkari/service/SubscriptionService.java",
"license": "bsd-3-clause",
"size": 10425
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 614,375 |
EAttribute getOperatingShare_Percentage(); | EAttribute getOperatingShare_Percentage(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61970.Core.OperatingShare#getPercentage <em>Percentage</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Percentage</em>'.
* @see CIM.IEC61970.Core.OperatingShare#getPercentage()
* @see #getOperatingShare()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61970.Core.OperatingShare#getPercentage Percentage</code>'. | getOperatingShare_Percentage | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Core/CorePackage.java",
"license": "mit",
"size": 253784
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,481,120 |
AwDrawFnImpl.DrawFnAccess getDrawFnAccess();
} | AwDrawFnImpl.DrawFnAccess getDrawFnAccess(); } | /**
* Used for draw_fn functor. Only one of these methods need to return non-null.
* Prefer this over createGLFunctor.
*/ | Used for draw_fn functor. Only one of these methods need to return non-null. Prefer this over createGLFunctor | getDrawFnAccess | {
"repo_name": "scheib/chromium",
"path": "android_webview/java/src/org/chromium/android_webview/AwContents.java",
"license": "bsd-3-clause",
"size": 184448
} | [
"org.chromium.android_webview.gfx.AwDrawFnImpl"
] | import org.chromium.android_webview.gfx.AwDrawFnImpl; | import org.chromium.android_webview.gfx.*; | [
"org.chromium.android_webview"
] | org.chromium.android_webview; | 1,028,329 |
public String attributeToPrintValue(String value) {
return HTMLEncode.encode(value);
} | String function(String value) { return HTMLEncode.encode(value); } | /**
* Template method to allow subclasses to process the attribute value before printing it
*
* @param value the raw attribute value
* @return the attribute value in a form adopted for html printing
*/ | Template method to allow subclasses to process the attribute value before printing it | attributeToPrintValue | {
"repo_name": "NetHome/NetHomeServer",
"path": "home-items/web-items/src/main/java/nu/nethome/home/items/web/servergui/attributes/StringAttributePrinter.java",
"license": "gpl-3.0",
"size": 3959
} | [
"nu.nethome.home.items.web.servergui.HTMLEncode"
] | import nu.nethome.home.items.web.servergui.HTMLEncode; | import nu.nethome.home.items.web.servergui.*; | [
"nu.nethome.home"
] | nu.nethome.home; | 2,053,322 |
@Override
protected void checkRole() throws CmsRoleViolationException {
OpenCms.getRoleManager().checkRole(getCms(), CmsRole.EDITOR);
} | void function() throws CmsRoleViolationException { OpenCms.getRoleManager().checkRole(getCms(), CmsRole.EDITOR); } | /**
* Checks that the current user is a workplace user.<p>
*
* @throws CmsRoleViolationException if the user does not have the required role
*/ | Checks that the current user is a workplace user | checkRole | {
"repo_name": "alkacon/opencms-core",
"path": "src/org/opencms/workplace/editors/CmsEditorBase.java",
"license": "lgpl-2.1",
"size": 5030
} | [
"org.opencms.main.OpenCms",
"org.opencms.security.CmsRole",
"org.opencms.security.CmsRoleViolationException"
] | import org.opencms.main.OpenCms; import org.opencms.security.CmsRole; import org.opencms.security.CmsRoleViolationException; | import org.opencms.main.*; import org.opencms.security.*; | [
"org.opencms.main",
"org.opencms.security"
] | org.opencms.main; org.opencms.security; | 549,593 |
private static ArrayList<ArrayList<Integer>> readFile(String inputFile){
ArrayList<ArrayList<Integer>> adj_matrix = new ArrayList<>();
try{
BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFile));
String line = bufferedReader.readLine();
while (line != null) {
String[] split = line.split(" ");
ArrayList<Integer> l = new ArrayList<>();
for(String s : split) {
l.add(Integer.parseInt(s));
}
adj_matrix.add(l);
line = bufferedReader.readLine();
}
bufferedReader.close();
}
catch (Exception e) {
e.printStackTrace();
}
return adj_matrix;
} | static ArrayList<ArrayList<Integer>> function(String inputFile){ ArrayList<ArrayList<Integer>> adj_matrix = new ArrayList<>(); try{ BufferedReader bufferedReader = new BufferedReader(new FileReader(inputFile)); String line = bufferedReader.readLine(); while (line != null) { String[] split = line.split(" "); ArrayList<Integer> l = new ArrayList<>(); for(String s : split) { l.add(Integer.parseInt(s)); } adj_matrix.add(l); line = bufferedReader.readLine(); } bufferedReader.close(); } catch (Exception e) { e.printStackTrace(); } return adj_matrix; } | /**
* This function will read a file and return the corresponding adjacency matrix.
*
* @param inputFile the file to be read
* @return the adjacency matrix. A value of -1 means the two nodes are not connected.
*/ | This function will read a file and return the corresponding adjacency matrix | readFile | {
"repo_name": "VikramGaru/Projects",
"path": "CSE331-Algorithms/HW8/Driver.java",
"license": "unlicense",
"size": 2119
} | [
"java.io.BufferedReader",
"java.io.FileReader",
"java.util.ArrayList"
] | import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,886,322 |
public void getClosestPoint (final Vec2 out) {
switch (m_count) {
case 0:
assert (false);
out.setZero();
return;
case 1:
out.set(m_v1.w);
return;
case 2:
case22.set(m_v2.w).mulLocal(m_v2.a);
case2.set(m_v1.w).mulLocal(m_v1.a).addLocal(case22);
out.set(case2);
return;
case 3:
out.setZero();
return;
default:
assert (false);
out.setZero();
return;
}
}
// djm pooled, and from above
private final Vec2 case3 = new Vec2();
private final Vec2 case33 = new Vec2(); | void function (final Vec2 out) { switch (m_count) { case 0: assert (false); out.setZero(); return; case 1: out.set(m_v1.w); return; case 2: case22.set(m_v2.w).mulLocal(m_v2.a); case2.set(m_v1.w).mulLocal(m_v1.a).addLocal(case22); out.set(case2); return; case 3: out.setZero(); return; default: assert (false); out.setZero(); return; } } private final Vec2 case3 = new Vec2(); private final Vec2 case33 = new Vec2(); | /** this returns pooled objects. don't keep or modify them
*
* @return */ | this returns pooled objects. don't keep or modify them | getClosestPoint | {
"repo_name": "MathieuDuponchelle/gdx",
"path": "backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/org/jbox2d/collision/Distance.java",
"license": "apache-2.0",
"size": 20372
} | [
"org.jbox2d.common.Vec2"
] | import org.jbox2d.common.Vec2; | import org.jbox2d.common.*; | [
"org.jbox2d.common"
] | org.jbox2d.common; | 2,424,524 |
private void createMainPanel ()
{
log.config(": " + m_product);
this.getChildren().clear();
//this.invalidate();
//this.setBorder(null);
m_selectionList.clear();
m_productList.clear();
m_qtyList.clear();
m_buttonGroups.clear();
this.appendChild(new Separator());
this.appendChild(grpSelectionPanel);
this.appendChild(new Separator());
this.appendChild(grpSelectProd);
this.appendChild(new Separator());
this.appendChild(confirmPanel);
this.appendChild(new Separator());
this.setBorder("normal");
Caption title = new Caption(Msg.getMsg(Env.getCtx(), "SelectProduct"));
grpSelectProd.getChildren().clear();
grpSelectProd.appendChild(title);
if (m_product != null && m_product.get_ID() > 0)
{
title.setLabel(m_product.getName());
if (m_product.getDescription() != null && m_product.getDescription().length() > 0)
;//this.setsetToolTipText(m_product.getDescription());
m_bomLine = 0;
addBOMLines(m_product, m_qty);
}
} // createMainPanel
| void function () { log.config(STR + m_product); this.getChildren().clear(); m_selectionList.clear(); m_productList.clear(); m_qtyList.clear(); m_buttonGroups.clear(); this.appendChild(new Separator()); this.appendChild(grpSelectionPanel); this.appendChild(new Separator()); this.appendChild(grpSelectProd); this.appendChild(new Separator()); this.appendChild(confirmPanel); this.appendChild(new Separator()); this.setBorder(STR); Caption title = new Caption(Msg.getMsg(Env.getCtx(), STR)); grpSelectProd.getChildren().clear(); grpSelectProd.appendChild(title); if (m_product != null && m_product.get_ID() > 0) { title.setLabel(m_product.getName()); if (m_product.getDescription() != null && m_product.getDescription().length() > 0) ; m_bomLine = 0; addBOMLines(m_product, m_qty); } } | /**************************************************************************
* Create Main Panel.
* Called when changing Product
*/ | Create Main Panel. Called when changing Product | createMainPanel | {
"repo_name": "erpcya/adempierePOS",
"path": "zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java",
"license": "gpl-2.0",
"size": 23719
} | [
"org.compiere.util.Env",
"org.compiere.util.Msg",
"org.zkoss.zul.Caption",
"org.zkoss.zul.Separator"
] | import org.compiere.util.Env; import org.compiere.util.Msg; import org.zkoss.zul.Caption; import org.zkoss.zul.Separator; | import org.compiere.util.*; import org.zkoss.zul.*; | [
"org.compiere.util",
"org.zkoss.zul"
] | org.compiere.util; org.zkoss.zul; | 1,263,961 |
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
}
return itemPropertyDescriptors;
} | List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); } return itemPropertyDescriptors; } | /**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the property descriptors for the adapted class. | getPropertyDescriptors | {
"repo_name": "thiliniish/developer-studio",
"path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EnqueueMediatorInputConnectorItemProvider.java",
"license": "apache-2.0",
"size": 3053
} | [
"java.util.List",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor"
] | import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 630,348 |
public static void setPartitionsToPrune(Configuration configuration,
List<PartitionSpec> partitions) {
if (partitions == null) {
return;
}
try {
String partitionString =
ObjectSerializationUtil.convertObjectToString(new ArrayList<>(partitions));
configuration.set(PARTITIONS_TO_PRUNE, partitionString);
} catch (Exception e) {
throw new RuntimeException(
"Error while setting partition information to Job" + partitions, e);
}
} | static void function(Configuration configuration, List<PartitionSpec> partitions) { if (partitions == null) { return; } try { String partitionString = ObjectSerializationUtil.convertObjectToString(new ArrayList<>(partitions)); configuration.set(PARTITIONS_TO_PRUNE, partitionString); } catch (Exception e) { throw new RuntimeException( STR + partitions, e); } } | /**
* set list of partitions to prune
*/ | set list of partitions to prune | setPartitionsToPrune | {
"repo_name": "zzcclp/carbondata",
"path": "hadoop/src/main/java/org/apache/carbondata/hadoop/api/CarbonInputFormat.java",
"license": "apache-2.0",
"size": 39129
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.carbondata.core.indexstore.PartitionSpec",
"org.apache.carbondata.core.util.ObjectSerializationUtil",
"org.apache.hadoop.conf.Configuration"
] | import java.util.ArrayList; import java.util.List; import org.apache.carbondata.core.indexstore.PartitionSpec; import org.apache.carbondata.core.util.ObjectSerializationUtil; import org.apache.hadoop.conf.Configuration; | import java.util.*; import org.apache.carbondata.core.indexstore.*; import org.apache.carbondata.core.util.*; import org.apache.hadoop.conf.*; | [
"java.util",
"org.apache.carbondata",
"org.apache.hadoop"
] | java.util; org.apache.carbondata; org.apache.hadoop; | 1,650,205 |
public PDTextStream getBefore()
{
return PDTextStream.createTextStream( js.getDictionaryObject( COSName.BEFORE ) );
}
| PDTextStream function() { return PDTextStream.createTextStream( js.getDictionaryObject( COSName.BEFORE ) ); } | /**
* This will get the javascript that is executed before the import.
*
* @return Some javascript code.
*/ | This will get the javascript that is executed before the import | getBefore | {
"repo_name": "mdamt/PdfBox-Android",
"path": "library/src/main/java/org/apache/pdfbox/pdmodel/fdf/FDFJavaScript.java",
"license": "apache-2.0",
"size": 3971
} | [
"org.apache.pdfbox.cos.COSName",
"org.apache.pdfbox.pdmodel.common.PDTextStream"
] | import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.common.PDTextStream; | import org.apache.pdfbox.cos.*; import org.apache.pdfbox.pdmodel.common.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 815,201 |
public Set<GemEntity> getVisibleGemEntities(MetaModule module) {
// Check that module != null
Assert.isNotNullArgument(module, "module");
int nEntities = module.getNGemEntities();
ModuleTypeInfo workingModuleTypeInfo = getWorkingModuleTypeInfo();
// Add all entities from the working module, or only public entities from non-working modules.
Set<GemEntity> visibleEntitySet = new LinkedHashSet<GemEntity>();
for (int i = 0; i < nEntities; i++) {
GemEntity gemEntity = module.getNthGemEntity(i);
if (workingModuleTypeInfo.isEntityVisible(gemEntity.getFunctionalAgent())) {
visibleEntitySet.add(gemEntity);
}
}
// Apply the view policy if any.
if (gemEntityViewer != null) {
visibleEntitySet = new LinkedHashSet<GemEntity>(gemEntityViewer.view(visibleEntitySet));
}
return visibleEntitySet;
}
| Set<GemEntity> function(MetaModule module) { Assert.isNotNullArgument(module, STR); int nEntities = module.getNGemEntities(); ModuleTypeInfo workingModuleTypeInfo = getWorkingModuleTypeInfo(); Set<GemEntity> visibleEntitySet = new LinkedHashSet<GemEntity>(); for (int i = 0; i < nEntities; i++) { GemEntity gemEntity = module.getNthGemEntity(i); if (workingModuleTypeInfo.isEntityVisible(gemEntity.getFunctionalAgent())) { visibleEntitySet.add(gemEntity); } } if (gemEntityViewer != null) { visibleEntitySet = new LinkedHashSet<GemEntity>(gemEntityViewer.view(visibleEntitySet)); } return visibleEntitySet; } | /**
* Get the visible entities in a module.
* Visibility is determined by the current working module.
* @param module the module in which to look.
* @return the set of visible entities.
*/ | Get the visible entities in a module. Visibility is determined by the current working module | getVisibleGemEntities | {
"repo_name": "levans/Open-Quark",
"path": "src/CAL_Platform/src/org/openquark/cal/services/Perspective.java",
"license": "bsd-3-clause",
"size": 18169
} | [
"java.util.LinkedHashSet",
"java.util.Set",
"org.openquark.cal.compiler.ModuleTypeInfo"
] | import java.util.LinkedHashSet; import java.util.Set; import org.openquark.cal.compiler.ModuleTypeInfo; | import java.util.*; import org.openquark.cal.compiler.*; | [
"java.util",
"org.openquark.cal"
] | java.util; org.openquark.cal; | 893,975 |
private static CxxLink createSharedLibrary(
BuildRuleParams params,
BuildRuleResolver ruleResolver,
SourcePathResolver pathResolver,
SourcePathRuleFinder ruleFinder,
CellPathResolver cellRoots,
CxxBuckConfig cxxBuckConfig,
CxxPlatform cxxPlatform,
Arg args,
ImmutableSet<BuildRule> deps,
ImmutableList<StringWithMacros> linkerFlags,
ImmutableSet<FrameworkPath> frameworks,
ImmutableSet<FrameworkPath> libraries,
Optional<String> soname,
Optional<Linker.CxxRuntimeType> cxxRuntimeType,
Linker.LinkType linkType,
Linker.LinkableDepType linkableDepType,
Optional<SourcePath> bundleLoader,
ImmutableSet<BuildTarget> blacklist)
throws NoSuchBuildTargetException {
Optional<LinkerMapMode> flavoredLinkerMapMode = LinkerMapMode.FLAVOR_DOMAIN.getValue(
params.getBuildTarget());
params = LinkerMapMode.removeLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode);
// Create rules for compiling the PIC object files.
ImmutableMap<CxxPreprocessAndCompile, SourcePath> objects =
requireObjects(
params,
ruleResolver,
pathResolver,
ruleFinder,
cxxBuckConfig,
cxxPlatform,
CxxSourceRuleFactory.PicType.PIC,
args,
deps);
// Setup the rules to link the shared library.
BuildTarget sharedTarget =
CxxDescriptionEnhancer.createSharedLibraryBuildTarget(
LinkerMapMode.restoreLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode)
.getBuildTarget(),
cxxPlatform.getFlavor(),
linkType);
String sharedLibrarySoname = CxxDescriptionEnhancer.getSharedLibrarySoname(
soname,
params.getBuildTarget(),
cxxPlatform);
Path sharedLibraryPath = CxxDescriptionEnhancer.getSharedLibraryPath(
params.getProjectFilesystem(),
sharedTarget,
sharedLibrarySoname);
ImmutableList.Builder<StringWithMacros> extraLdFlagsBuilder = ImmutableList.builder();
extraLdFlagsBuilder.addAll(linkerFlags);
ImmutableList<StringWithMacros> extraLdFlags = extraLdFlagsBuilder.build();
return CxxLinkableEnhancer.createCxxLinkableBuildRule(
cxxBuckConfig,
cxxPlatform,
LinkerMapMode.restoreLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode),
ruleResolver,
pathResolver,
ruleFinder,
sharedTarget,
linkType,
Optional.of(sharedLibrarySoname),
sharedLibraryPath,
linkableDepType,
args.thinLto,
RichStream.from(deps)
.filter(NativeLinkable.class)
.toImmutableList(),
cxxRuntimeType,
bundleLoader,
blacklist,
NativeLinkableInput.builder()
.addAllArgs(
CxxDescriptionEnhancer.toStringWithMacrosArgs(
params.getBuildTarget(),
cellRoots,
ruleResolver,
cxxPlatform,
extraLdFlags))
.addAllArgs(SourcePathArg.from(objects.values()))
.setFrameworks(frameworks)
.setLibraries(libraries)
.build());
} | static CxxLink function( BuildRuleParams params, BuildRuleResolver ruleResolver, SourcePathResolver pathResolver, SourcePathRuleFinder ruleFinder, CellPathResolver cellRoots, CxxBuckConfig cxxBuckConfig, CxxPlatform cxxPlatform, Arg args, ImmutableSet<BuildRule> deps, ImmutableList<StringWithMacros> linkerFlags, ImmutableSet<FrameworkPath> frameworks, ImmutableSet<FrameworkPath> libraries, Optional<String> soname, Optional<Linker.CxxRuntimeType> cxxRuntimeType, Linker.LinkType linkType, Linker.LinkableDepType linkableDepType, Optional<SourcePath> bundleLoader, ImmutableSet<BuildTarget> blacklist) throws NoSuchBuildTargetException { Optional<LinkerMapMode> flavoredLinkerMapMode = LinkerMapMode.FLAVOR_DOMAIN.getValue( params.getBuildTarget()); params = LinkerMapMode.removeLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode); ImmutableMap<CxxPreprocessAndCompile, SourcePath> objects = requireObjects( params, ruleResolver, pathResolver, ruleFinder, cxxBuckConfig, cxxPlatform, CxxSourceRuleFactory.PicType.PIC, args, deps); BuildTarget sharedTarget = CxxDescriptionEnhancer.createSharedLibraryBuildTarget( LinkerMapMode.restoreLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode) .getBuildTarget(), cxxPlatform.getFlavor(), linkType); String sharedLibrarySoname = CxxDescriptionEnhancer.getSharedLibrarySoname( soname, params.getBuildTarget(), cxxPlatform); Path sharedLibraryPath = CxxDescriptionEnhancer.getSharedLibraryPath( params.getProjectFilesystem(), sharedTarget, sharedLibrarySoname); ImmutableList.Builder<StringWithMacros> extraLdFlagsBuilder = ImmutableList.builder(); extraLdFlagsBuilder.addAll(linkerFlags); ImmutableList<StringWithMacros> extraLdFlags = extraLdFlagsBuilder.build(); return CxxLinkableEnhancer.createCxxLinkableBuildRule( cxxBuckConfig, cxxPlatform, LinkerMapMode.restoreLinkerMapModeFlavorInParams(params, flavoredLinkerMapMode), ruleResolver, pathResolver, ruleFinder, sharedTarget, linkType, Optional.of(sharedLibrarySoname), sharedLibraryPath, linkableDepType, args.thinLto, RichStream.from(deps) .filter(NativeLinkable.class) .toImmutableList(), cxxRuntimeType, bundleLoader, blacklist, NativeLinkableInput.builder() .addAllArgs( CxxDescriptionEnhancer.toStringWithMacrosArgs( params.getBuildTarget(), cellRoots, ruleResolver, cxxPlatform, extraLdFlags)) .addAllArgs(SourcePathArg.from(objects.values())) .setFrameworks(frameworks) .setLibraries(libraries) .build()); } | /**
* Create all build rules needed to generate the shared library.
*
* @return the {@link CxxLink} rule representing the actual shared library.
*/ | Create all build rules needed to generate the shared library | createSharedLibrary | {
"repo_name": "vschs007/buck",
"path": "src/com/facebook/buck/cxx/CxxLibraryDescription.java",
"license": "apache-2.0",
"size": 47341
} | [
"com.facebook.buck.model.BuildTarget",
"com.facebook.buck.parser.NoSuchBuildTargetException",
"com.facebook.buck.rules.BuildRule",
"com.facebook.buck.rules.BuildRuleParams",
"com.facebook.buck.rules.BuildRuleResolver",
"com.facebook.buck.rules.CellPathResolver",
"com.facebook.buck.rules.SourcePath",
"com.facebook.buck.rules.SourcePathResolver",
"com.facebook.buck.rules.SourcePathRuleFinder",
"com.facebook.buck.rules.args.SourcePathArg",
"com.facebook.buck.rules.coercer.FrameworkPath",
"com.facebook.buck.rules.macros.StringWithMacros",
"com.facebook.buck.util.RichStream",
"com.google.common.collect.ImmutableList",
"com.google.common.collect.ImmutableMap",
"com.google.common.collect.ImmutableSet",
"java.nio.file.Path",
"java.util.Optional"
] | import com.facebook.buck.model.BuildTarget; import com.facebook.buck.parser.NoSuchBuildTargetException; import com.facebook.buck.rules.BuildRule; import com.facebook.buck.rules.BuildRuleParams; import com.facebook.buck.rules.BuildRuleResolver; import com.facebook.buck.rules.CellPathResolver; import com.facebook.buck.rules.SourcePath; import com.facebook.buck.rules.SourcePathResolver; import com.facebook.buck.rules.SourcePathRuleFinder; import com.facebook.buck.rules.args.SourcePathArg; import com.facebook.buck.rules.coercer.FrameworkPath; import com.facebook.buck.rules.macros.StringWithMacros; import com.facebook.buck.util.RichStream; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import java.nio.file.Path; import java.util.Optional; | import com.facebook.buck.model.*; import com.facebook.buck.parser.*; import com.facebook.buck.rules.*; import com.facebook.buck.rules.args.*; import com.facebook.buck.rules.coercer.*; import com.facebook.buck.rules.macros.*; import com.facebook.buck.util.*; import com.google.common.collect.*; import java.nio.file.*; import java.util.*; | [
"com.facebook.buck",
"com.google.common",
"java.nio",
"java.util"
] | com.facebook.buck; com.google.common; java.nio; java.util; | 1,772,254 |
T convert(CMCard card); | T convert(CMCard card); | /**
* Converts a card into a {@link T}.
*
* @param card
* the cards that needs to be converted.
*
* @return the instance of {@link T} representing the card.
*/ | Converts a card into a <code>T</code> | convert | {
"repo_name": "jzinedine/CMDBuild",
"path": "core/src/main/java/org/cmdbuild/data/store/DataViewStore.java",
"license": "agpl-3.0",
"size": 11566
} | [
"org.cmdbuild.dao.entry.CMCard"
] | import org.cmdbuild.dao.entry.CMCard; | import org.cmdbuild.dao.entry.*; | [
"org.cmdbuild.dao"
] | org.cmdbuild.dao; | 446,356 |
public static Vector3d getTranslScrewComponent(Matrix4d m) {
int foldType = SpaceGroup.getRotAxisType(m);
// For reference see:
// http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf
Vector3d transl = null;
Matrix3d W =
new Matrix3d(m.m00,m.m01,m.m02,
m.m10,m.m11,m.m12,
m.m20,m.m21,m.m22);
if (foldType>=0) {
// the Y matrix: Y = W^k-1 + W^k-2 ... + W + I ; with k the fold type
Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1);
Matrix3d Wk = new Matrix3d(1,0,0, 0,1,0, 0,0,1);
for (int k=0;k<foldType;k++) {
Wk.mul(W); // k=0 Wk=W, k=1 Wk=W^2, k=2 Wk=W^3, ... k=foldType-1, Wk=W^foldType
if (k!=foldType-1) Y.add(Wk);
}
transl = new Vector3d(m.m03, m.m13, m.m23);
Y.transform(transl);
transl.scale(1.0/foldType);
} else {
if (foldType==-2) { // there are glide planes only in -2
Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1);
Y.add(W);
transl = new Vector3d(m.m03, m.m13, m.m23);
Y.transform(transl);
transl.scale(1.0/2.0);
} else { // for -1, -3, -4 and -6 there's nothing to do: fill with 0s
transl = new Vector3d(0,0,0);
}
}
return transl;
} | static Vector3d function(Matrix4d m) { int foldType = SpaceGroup.getRotAxisType(m); Vector3d transl = null; Matrix3d W = new Matrix3d(m.m00,m.m01,m.m02, m.m10,m.m11,m.m12, m.m20,m.m21,m.m22); if (foldType>=0) { Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Matrix3d Wk = new Matrix3d(1,0,0, 0,1,0, 0,0,1); for (int k=0;k<foldType;k++) { Wk.mul(W); if (k!=foldType-1) Y.add(Wk); } transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/foldType); } else { if (foldType==-2) { Matrix3d Y = new Matrix3d(1,0,0, 0,1,0, 0,0,1); Y.add(W); transl = new Vector3d(m.m03, m.m13, m.m23); Y.transform(transl); transl.scale(1.0/2.0); } else { transl = new Vector3d(0,0,0); } } return transl; } | /**
* Given a transformation matrix containing a rotation and translation returns the
* screw component of the rotation.
* See http://www.crystallography.fr/mathcryst/pdf/Gargnano/Aroyo_Gargnano_1.pdf
* @param m
* @return
*/ | Given a transformation matrix containing a rotation and translation returns the screw component of the rotation. See HREF | getTranslScrewComponent | {
"repo_name": "fionakim/biojava",
"path": "biojava-structure/src/main/java/org/biojava/nbio/structure/xtal/CrystalTransform.java",
"license": "lgpl-2.1",
"size": 13822
} | [
"javax.vecmath.Matrix3d",
"javax.vecmath.Matrix4d",
"javax.vecmath.Vector3d"
] | import javax.vecmath.Matrix3d; import javax.vecmath.Matrix4d; import javax.vecmath.Vector3d; | import javax.vecmath.*; | [
"javax.vecmath"
] | javax.vecmath; | 1,782,071 |
public synchronized void prefetchAds(Context context) {
mContext = new WeakReference<>(context);
} | synchronized void function(Context context) { mContext = new WeakReference<>(context); } | /**
* Fetches a new native ad.
*
* @param context the current context.
* @see #destroyAllAds()
*/ | Fetches a new native ad | prefetchAds | {
"repo_name": "clockbyte/admobadapter",
"path": "admobadapter/src/main/java/com/clockbyte/admobadapter/AdmobFetcherBase.java",
"license": "apache-2.0",
"size": 6329
} | [
"android.content.Context",
"java.lang.ref.WeakReference"
] | import android.content.Context; import java.lang.ref.WeakReference; | import android.content.*; import java.lang.ref.*; | [
"android.content",
"java.lang"
] | android.content; java.lang; | 683,379 |
public MergedSpectrum mergeAcrossSamples(ParameterSet parameters, FeatureListRow row) {
return mergeAcrossFragmentSpectra(parameters,
row.getFeatures().stream().map(r -> mergeFromSameSample(parameters, r))
.filter(x -> x.data.length > 0).collect(Collectors.toList()));
} | MergedSpectrum function(ParameterSet parameters, FeatureListRow row) { return mergeAcrossFragmentSpectra(parameters, row.getFeatures().stream().map(r -> mergeFromSameSample(parameters, r)) .filter(x -> x.data.length > 0).collect(Collectors.toList())); } | /**
* Merge across samples. It is recommended to use #merge(PeakListRow,String) instead. Note, that
* this method will not remove noise peaks from the merged spectra.
*
* @param row the feature which MS/MS should be merged
* @return the merged MS/MS of all fragment spectra belonging to the feature row
*/ | Merge across samples. It is recommended to use #merge(PeakListRow,String) instead. Note, that this method will not remove noise peaks from the merged spectra | mergeAcrossSamples | {
"repo_name": "tomas-pluskal/mzmine3",
"path": "src/main/java/io/github/mzmine/modules/tools/msmsspectramerge/MsMsSpectraMergeModule.java",
"license": "gpl-2.0",
"size": 23207
} | [
"io.github.mzmine.datamodel.features.FeatureListRow",
"io.github.mzmine.parameters.ParameterSet",
"java.util.stream.Collectors"
] | import io.github.mzmine.datamodel.features.FeatureListRow; import io.github.mzmine.parameters.ParameterSet; import java.util.stream.Collectors; | import io.github.mzmine.datamodel.features.*; import io.github.mzmine.parameters.*; import java.util.stream.*; | [
"io.github.mzmine",
"java.util"
] | io.github.mzmine; java.util; | 2,862,725 |
CloseFuture getCloseFuture(); | CloseFuture getCloseFuture(); | /**
* Returns the {@link CloseFuture} of this session. This method returns
* the same instance whenever user calls it.
*/ | Returns the <code>CloseFuture</code> of this session. This method returns the same instance whenever user calls it | getCloseFuture | {
"repo_name": "chao-sun-kaazing/gateway",
"path": "mina.core/core/src/main/java/org/apache/mina/core/session/IoSession.java",
"license": "apache-2.0",
"size": 19468
} | [
"org.apache.mina.core.future.CloseFuture"
] | import org.apache.mina.core.future.CloseFuture; | import org.apache.mina.core.future.*; | [
"org.apache.mina"
] | org.apache.mina; | 1,696,767 |
public void handleCreate(ZCreateEvent event, ZMailbox mailbox) throws ServiceException {
// do nothing by default
} | void function(ZCreateEvent event, ZMailbox mailbox) throws ServiceException { } | /**
*
* default implementation is a no-op
*
* @param event the create event
* @param mailbox the mailbox that had the event
*/ | default implementation is a no-op | handleCreate | {
"repo_name": "nico01f/z-pec",
"path": "ZimbraClient/src/java/com/zimbra/client/event/ZEventHandler.java",
"license": "mit",
"size": 1897
} | [
"com.zimbra.client.ZMailbox",
"com.zimbra.common.service.ServiceException"
] | import com.zimbra.client.ZMailbox; import com.zimbra.common.service.ServiceException; | import com.zimbra.client.*; import com.zimbra.common.service.*; | [
"com.zimbra.client",
"com.zimbra.common"
] | com.zimbra.client; com.zimbra.common; | 797,694 |
public void desactivar(){
if(!this.validateDesactivar()){
return;
}
this.setEstado(Estado.INACTIVO.getId());
GdeDAOFactory.getMultaDetDAO().update(this);
}
| void function(){ if(!this.validateDesactivar()){ return; } this.setEstado(Estado.INACTIVO.getId()); GdeDAOFactory.getMultaDetDAO().update(this); } | /**
* Desactiva el MultaDet. Previamente valida la desactivacion.
*
*/ | Desactiva el MultaDet. Previamente valida la desactivacion | desactivar | {
"repo_name": "avdata99/SIAT",
"path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/gde/buss/bean/MultaDet.java",
"license": "gpl-3.0",
"size": 6560
} | [
"ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory",
"coop.tecso.demoda.iface.model.Estado"
] | import ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory; import coop.tecso.demoda.iface.model.Estado; | import ar.gov.rosario.siat.gde.buss.dao.*; import coop.tecso.demoda.iface.model.*; | [
"ar.gov.rosario",
"coop.tecso.demoda"
] | ar.gov.rosario; coop.tecso.demoda; | 395,812 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.