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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Set<Tag> getTags() {
return tags;
} | Set<Tag> function() { return tags; } | /**
* Return the tags created by this User
* @return
*/ | Return the tags created by this User | getTags | {
"repo_name": "fregaham/KiWi",
"path": "src/model/kiwi/model/user/User.java",
"license": "bsd-3-clause",
"size": 19827
} | [
"java.util.Set",
"kiwi.model.tagging.Tag"
] | import java.util.Set; import kiwi.model.tagging.Tag; | import java.util.*; import kiwi.model.tagging.*; | [
"java.util",
"kiwi.model.tagging"
] | java.util; kiwi.model.tagging; | 305,991 |
private void writeObject(ObjectOutputStream s) throws IOException {
}
// ///////////////
// Accessibility support
// ////////////// | void function(ObjectOutputStream s) throws IOException { } | /**
* See readObject() and writeObject() in JComponent for more information
* about serialization in Swing.
*/ | See readObject() and writeObject() in JComponent for more information about serialization in Swing | writeObject | {
"repo_name": "javalovercn/j2se_for_android",
"path": "src/javax/swing/JTextArea.java",
"license": "gpl-2.0",
"size": 18478
} | [
"java.io.IOException",
"java.io.ObjectOutputStream"
] | import java.io.IOException; import java.io.ObjectOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,366,309 |
@VisibleForTesting
Path getNameNodeInfoPath() throws IOException {
return new Path(getRemoteStoragePath(getConf(), infraAppId),
DynoConstants.NN_INFO_FILE_NAME);
} | Path getNameNodeInfoPath() throws IOException { return new Path(getRemoteStoragePath(getConf(), infraAppId), DynoConstants.NN_INFO_FILE_NAME); } | /**
* Return the path to the property file containing information about the
* launched NameNode.
*/ | Return the path to the property file containing information about the launched NameNode | getNameNodeInfoPath | {
"repo_name": "steveloughran/hadoop",
"path": "hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/Client.java",
"license": "apache-2.0",
"size": 48758
} | [
"java.io.IOException",
"org.apache.hadoop.fs.Path"
] | import java.io.IOException; import org.apache.hadoop.fs.Path; | import java.io.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,505,315 |
public Observable<ServiceResponse<ConnectivityInformationInner>> checkConnectivityWithServiceResponseAsync(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (networkWatcherName == null) {
throw new IllegalArgumentException("Parameter networkWatcherName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
Validator.validate(parameters);
final String apiVersion = "2019-04-01";
Observable<Response<ResponseBody>> observable = service.checkConnectivity(resourceGroupName, networkWatcherName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent());
return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken<ConnectivityInformationInner>() { }.getType());
} | Observable<ServiceResponse<ConnectivityInformationInner>> function(String resourceGroupName, String networkWatcherName, ConnectivityParameters parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (networkWatcherName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } Validator.validate(parameters); final String apiVersion = STR; Observable<Response<ResponseBody>> observable = service.checkConnectivity(resourceGroupName, networkWatcherName, this.client.subscriptionId(), parameters, apiVersion, this.client.acceptLanguage(), this.client.userAgent()); return client.getAzureClient().getPostOrDeleteResultAsync(observable, new LongRunningOperationOptions().withFinalStateVia(LongRunningFinalState.LOCATION), new TypeToken<ConnectivityInformationInner>() { }.getType()); } | /**
* Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server.
*
* @param resourceGroupName The name of the network watcher resource group.
* @param networkWatcherName The name of the network watcher resource.
* @param parameters Parameters that determine how the connectivity check will be performed.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable for the request
*/ | Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another VM or an arbitrary remote server | checkConnectivityWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/NetworkWatchersInner.java",
"license": "mit",
"size": 186527
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.azure.LongRunningFinalState",
"com.microsoft.azure.LongRunningOperationOptions",
"com.microsoft.azure.management.network.v2019_04_01.ConnectivityParameters",
"com.microsoft.rest.ServiceResponse",
"com.microsoft.rest.Validator"
] | import com.google.common.reflect.TypeToken; import com.microsoft.azure.LongRunningFinalState; import com.microsoft.azure.LongRunningOperationOptions; import com.microsoft.azure.management.network.v2019_04_01.ConnectivityParameters; import com.microsoft.rest.ServiceResponse; import com.microsoft.rest.Validator; | import com.google.common.reflect.*; import com.microsoft.azure.*; import com.microsoft.azure.management.network.v2019_04_01.*; import com.microsoft.rest.*; | [
"com.google.common",
"com.microsoft.azure",
"com.microsoft.rest"
] | com.google.common; com.microsoft.azure; com.microsoft.rest; | 624,909 |
@Override
public boolean onDoubleTap(MotionEvent event) {
float zoomX = event.getX();
float zoomY = event.getY();
MultiLevelSingleTapZoomNetworkImageView.this.zoomOut(zoomX, zoomY);
return EVENT_DONE;
}
});
} | boolean function(MotionEvent event) { float zoomX = event.getX(); float zoomY = event.getY(); MultiLevelSingleTapZoomNetworkImageView.this.zoomOut(zoomX, zoomY); return EVENT_DONE; } }); } | /**
* Zoom out when double-tapping
*/ | Zoom out when double-tapping | onDoubleTap | {
"repo_name": "roydang/AndroyVolleyExt",
"path": "src_lib/com/navercorp/volleyextensions/view/MultiLevelSingleTapZoomNetworkImageView.java",
"license": "apache-2.0",
"size": 4750
} | [
"android.view.MotionEvent"
] | import android.view.MotionEvent; | import android.view.*; | [
"android.view"
] | android.view; | 702,368 |
private static FieldInfo extractFieldFromGetterOrSetter(Method method) {
String name = method.getName();
if (name.length() < 4)
return null;
String firstLetter = name.substring(3, 4);
// check if the 4th letter is in upper case
if (!firstLetter.toUpperCase().equals(firstLetter))
return null;
FieldInfo field = null;
if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class && name.startsWith("get")) {
// if method name begins with 'get', has no args and returns non-void, this is getter
field = new FieldInfo(firstLetter.toLowerCase() + name.substring(4), getClassRef(method.getReturnType()), true, false);
// if method name begins with 'set', has one arg and returns void, this is setter
} else if (method.getParameterTypes().length == 1 && method.getReturnType() == void.class && name.startsWith("set")) {
field = new FieldInfo(firstLetter.toLowerCase() + name.substring(4), getClassRef(method.getParameterTypes()[0]), false, true);
}
return field;
} | static FieldInfo function(Method method) { String name = method.getName(); if (name.length() < 4) return null; String firstLetter = name.substring(3, 4); if (!firstLetter.toUpperCase().equals(firstLetter)) return null; FieldInfo field = null; if (method.getParameterTypes().length == 0 && method.getReturnType() != void.class && name.startsWith("get")) { field = new FieldInfo(firstLetter.toLowerCase() + name.substring(4), getClassRef(method.getReturnType()), true, false); } else if (method.getParameterTypes().length == 1 && method.getReturnType() == void.class && name.startsWith("set")) { field = new FieldInfo(firstLetter.toLowerCase() + name.substring(4), getClassRef(method.getParameterTypes()[0]), false, true); } return field; } | /**
* Checks if method is getter or setter
* @param method
* @return FieldInfo
*/ | Checks if method is getter or setter | extractFieldFromGetterOrSetter | {
"repo_name": "zenframework/easy-services",
"path": "easy-services-util/src/main/java/org/zenframework/easyservices/util/cls/ClassInfo.java",
"license": "mit",
"size": 15190
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 101,713 |
public static Map<String, Object> updateImage(DispatchContext dctx, Map<String, ? extends Object> context) {
Map<String, Object> result = updateImageMethod(dctx, context);
return result;
} | static Map<String, Object> function(DispatchContext dctx, Map<String, ? extends Object> context) { Map<String, Object> result = updateImageMethod(dctx, context); return result; } | /**
* A service wrapper for the updateImageMethod method. Forces permissions to be checked.
*/ | A service wrapper for the updateImageMethod method. Forces permissions to be checked | updateImage | {
"repo_name": "rohankarthik/Ofbiz",
"path": "applications/content/src/main/java/org/apache/ofbiz/content/data/DataServices.java",
"license": "apache-2.0",
"size": 33016
} | [
"java.util.Map",
"org.apache.ofbiz.service.DispatchContext"
] | import java.util.Map; import org.apache.ofbiz.service.DispatchContext; | import java.util.*; import org.apache.ofbiz.service.*; | [
"java.util",
"org.apache.ofbiz"
] | java.util; org.apache.ofbiz; | 850,803 |
interface WithRouteFilter {
Update withRouteFilter(SubResource routeFilter);
} | interface WithRouteFilter { Update withRouteFilter(SubResource routeFilter); } | /**
* Specifies routeFilter.
* @param routeFilter The reference to the RouteFilter resource
* @return the next update stage
*/ | Specifies routeFilter | withRouteFilter | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/ExpressRouteCircuitPeering.java",
"license": "mit",
"size": 23162
} | [
"com.microsoft.azure.SubResource"
] | import com.microsoft.azure.SubResource; | import com.microsoft.azure.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,242,518 |
public void setTokenStream(TokenStream tokenStream) {
this.isIndexed = true;
this.isTokenized = true;
this.tokenStream = tokenStream;
}
public Field(String name, String value, Store store, Index index) {
this(name, value, store, index, TermVector.NO);
}
public Field(String name, String value, Store store, Index index, TermVector termVector) {
this(name, true, value, store, index, termVector);
}
public Field(String name, boolean internName, String value, Store store, Index index, TermVector termVector) {
if (name == null)
throw new NullPointerException("name cannot be null");
if (value == null)
throw new NullPointerException("value cannot be null");
if (index == Index.NO && store == Store.NO)
throw new IllegalArgumentException("it doesn't make sense to have a field that "
+ "is neither indexed nor stored");
if (index == Index.NO && termVector != TermVector.NO)
throw new IllegalArgumentException("cannot store term vector information "
+ "for a field that is not indexed");
if (internName) // field names are optionally interned
name = StringHelper.intern(name);
this.name = name;
this.fieldsData = value;
this.isStored = store.isStored();
this.isIndexed = index.isIndexed();
this.isTokenized = index.isAnalyzed();
this.omitNorms = index.omitNorms();
if (index == Index.NO) {
// note: now this reads even wierder than before
this.indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
}
this.isBinary = false;
setStoreTermVector(termVector);
}
public Field(String name, Reader reader) {
this(name, reader, TermVector.NO);
}
public Field(String name, Reader reader, TermVector termVector) {
if (name == null)
throw new NullPointerException("name cannot be null");
if (reader == null)
throw new NullPointerException("reader cannot be null");
this.name = StringHelper.intern(name); // field names are interned
this.fieldsData = reader;
this.isStored = false;
this.isIndexed = true;
this.isTokenized = true;
this.isBinary = false;
setStoreTermVector(termVector);
}
public Field(String name, TokenStream tokenStream) {
this(name, tokenStream, TermVector.NO);
}
public Field(String name, TokenStream tokenStream, TermVector termVector) {
if (name == null)
throw new NullPointerException("name cannot be null");
if (tokenStream == null)
throw new NullPointerException("tokenStream cannot be null");
this.name = StringHelper.intern(name); // field names are interned
this.fieldsData = null;
this.tokenStream = tokenStream;
this.isStored = false;
this.isIndexed = true;
this.isTokenized = true;
this.isBinary = false;
setStoreTermVector(termVector);
}
@Deprecated
public Field(String name, byte[] value, Store store) {
this(name, value, 0, value.length);
if (store == Store.NO) {
throw new IllegalArgumentException("binary values can't be unstored");
}
}
public Field(String name, byte[] value) {
this(name, value, 0, value.length);
}
@Deprecated
public Field(String name, byte[] value, int offset, int length, Store store) {
this(name, value, offset, length);
if (store == Store.NO) {
throw new IllegalArgumentException("binary values can't be unstored");
}
}
public Field(String name, byte[] value, int offset, int length) {
if (name == null)
throw new IllegalArgumentException("name cannot be null");
if (value == null)
throw new IllegalArgumentException("value cannot be null");
this.name = StringHelper.intern(name); // field names are interned
fieldsData = value;
isStored = true;
isIndexed = false;
isTokenized = false;
indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
omitNorms = true;
isBinary = true;
binaryLength = length;
binaryOffset = offset;
setStoreTermVector(TermVector.NO);
} | void function(TokenStream tokenStream) { this.isIndexed = true; this.isTokenized = true; this.tokenStream = tokenStream; } public Field(String name, String value, Store store, Index index) { this(name, value, store, index, TermVector.NO); } public Field(String name, String value, Store store, Index index, TermVector termVector) { this(name, true, value, store, index, termVector); } public Field(String name, boolean internName, String value, Store store, Index index, TermVector termVector) { if (name == null) throw new NullPointerException(STR); if (value == null) throw new NullPointerException(STR); if (index == Index.NO && store == Store.NO) throw new IllegalArgumentException(STR + STR); if (index == Index.NO && termVector != TermVector.NO) throw new IllegalArgumentException(STR + STR); if (internName) name = StringHelper.intern(name); this.name = name; this.fieldsData = value; this.isStored = store.isStored(); this.isIndexed = index.isIndexed(); this.isTokenized = index.isAnalyzed(); this.omitNorms = index.omitNorms(); if (index == Index.NO) { this.indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; } this.isBinary = false; setStoreTermVector(termVector); } public Field(String name, Reader reader) { this(name, reader, TermVector.NO); } public Field(String name, Reader reader, TermVector termVector) { if (name == null) throw new NullPointerException(STR); if (reader == null) throw new NullPointerException(STR); this.name = StringHelper.intern(name); this.fieldsData = reader; this.isStored = false; this.isIndexed = true; this.isTokenized = true; this.isBinary = false; setStoreTermVector(termVector); } public Field(String name, TokenStream tokenStream) { this(name, tokenStream, TermVector.NO); } public Field(String name, TokenStream tokenStream, TermVector termVector) { if (name == null) throw new NullPointerException(STR); if (tokenStream == null) throw new NullPointerException(STR); this.name = StringHelper.intern(name); this.fieldsData = null; this.tokenStream = tokenStream; this.isStored = false; this.isIndexed = true; this.isTokenized = true; this.isBinary = false; setStoreTermVector(termVector); } public Field(String name, byte[] value, Store store) { this(name, value, 0, value.length); if (store == Store.NO) { throw new IllegalArgumentException(STR); } } public Field(String name, byte[] value) { this(name, value, 0, value.length); } public Field(String name, byte[] value, int offset, int length, Store store) { this(name, value, offset, length); if (store == Store.NO) { throw new IllegalArgumentException(STR); } } public Field(String name, byte[] value, int offset, int length) { if (name == null) throw new IllegalArgumentException(STR); if (value == null) throw new IllegalArgumentException(STR); this.name = StringHelper.intern(name); fieldsData = value; isStored = true; isIndexed = false; isTokenized = false; indexOptions = IndexOptions.DOCS_AND_FREQS_AND_POSITIONS; omitNorms = true; isBinary = true; binaryLength = length; binaryOffset = offset; setStoreTermVector(TermVector.NO); } | /** Expert: sets the token stream to be used for indexing and causes isIndexed() and isTokenized() to return true.
* May be combined with stored values from stringValue() or getBinaryValue() */ | Expert: sets the token stream to be used for indexing and causes isIndexed() and isTokenized() to return true | setTokenStream | {
"repo_name": "fnp/pylucene",
"path": "lucene-java-3.5.0/lucene/src/java/org/apache/lucene/document/Field.java",
"license": "apache-2.0",
"size": 21331
} | [
"java.io.Reader",
"org.apache.lucene.analysis.TokenStream",
"org.apache.lucene.index.FieldInfo",
"org.apache.lucene.util.StringHelper"
] | import java.io.Reader; import org.apache.lucene.analysis.TokenStream; import org.apache.lucene.index.FieldInfo; import org.apache.lucene.util.StringHelper; | import java.io.*; import org.apache.lucene.analysis.*; import org.apache.lucene.index.*; import org.apache.lucene.util.*; | [
"java.io",
"org.apache.lucene"
] | java.io; org.apache.lucene; | 1,836,096 |
@Deprecated()
private ZuluExecutionResult processRequest(final ImmutableZuluServerRequest req, final ImmutableQuery q, final ZuluExecutionScope scope) {
final ExecutionResult.Builder res = ExecutionResult.builder();
final ZuluResultReceiver receiver = q.resultReceiver();
// compile the query. may use cache if it already exists.
final ZuluCompileResult compileResult = this.compile(q.query(), q.operationName(), q.persistedQuery());
if (!compileResult.warnings().isEmpty()) {
res.addAllNotes(compileResult.warnings());
}
final ZuluExecutable doc = compileResult.executable();
if (doc == null) {
// an error occured. messages will have been handled by the warnings.
return res.build();
}
if (doc.outputType() == null) {
res.addNote(new ZuluWarning.ParseWarning(ZuluWarningKind.INVALID_OPERATION, "unsupported operation type for this endpoint", null));
return res.build();
}
final Stopwatch timer = Stopwatch.createStarted();
Object instance;
try {
instance = req.injector().newInstance(compileResult.executable().javaType());
}
catch (final RuntimeException e) {
throw e;
}
catch (final Throwable e) {
throw new RuntimeException(e);
}
if (doc.executable().operationType() == GQLOpType.Subscription) {
// subscriptions are handled separately - we first use the instance to set up the subscription
// and then perform an execution on each value it returns. the main difference is the same
// field
// may be returned multiple times.
// flow control is important here - we may have a slow subscriber, and need to do some
// buffering and then
// abort the subscription with a buffer overflow error if they can't keep up (or switch to
// on-disk spooling, etc).
final ZuluSubscriptionContext sub = doc.executable().subscribe(instance, scope, new ZuluRequest(q.variables()));
// then, subscribe to each event that is emitted by the subscription and execute against that.
}
else {
// bind to the context for this caller.
final ZuluContext ctx = doc.executable().bind(instance, scope);
// execute
final ZuluExecutionResult execres = ctx.execute(new ZuluRequest(q.variables()), receiver);
// add the notes from execution to the response.
res.addAllNotes(execres.notes());
}
// and execute it.
try {
return res.build();
}
finally {
timer.stop();
this.addTiming(timer);
}
} | @Deprecated() ZuluExecutionResult function(final ImmutableZuluServerRequest req, final ImmutableQuery q, final ZuluExecutionScope scope) { final ExecutionResult.Builder res = ExecutionResult.builder(); final ZuluResultReceiver receiver = q.resultReceiver(); final ZuluCompileResult compileResult = this.compile(q.query(), q.operationName(), q.persistedQuery()); if (!compileResult.warnings().isEmpty()) { res.addAllNotes(compileResult.warnings()); } final ZuluExecutable doc = compileResult.executable(); if (doc == null) { return res.build(); } if (doc.outputType() == null) { res.addNote(new ZuluWarning.ParseWarning(ZuluWarningKind.INVALID_OPERATION, STR, null)); return res.build(); } final Stopwatch timer = Stopwatch.createStarted(); Object instance; try { instance = req.injector().newInstance(compileResult.executable().javaType()); } catch (final RuntimeException e) { throw e; } catch (final Throwable e) { throw new RuntimeException(e); } if (doc.executable().operationType() == GQLOpType.Subscription) { final ZuluSubscriptionContext sub = doc.executable().subscribe(instance, scope, new ZuluRequest(q.variables())); } else { final ZuluContext ctx = doc.executable().bind(instance, scope); final ZuluExecutionResult execres = ctx.execute(new ZuluRequest(q.variables()), receiver); res.addAllNotes(execres.notes()); } try { return res.build(); } finally { timer.stop(); this.addTiming(timer); } } | /**
* use bind() instead.
*
* @param req
* @param q
* @param scope
* @return
*
*/ | use bind() instead | processRequest | {
"repo_name": "zourzouvillys/graphql",
"path": "graphql-runtime/src/main/java/io/zrz/graphql/zulu/engine/ZuluEngine.java",
"license": "apache-2.0",
"size": 14929
} | [
"com.google.common.base.Stopwatch",
"io.zrz.graphql.core.doc.GQLOpType",
"io.zrz.graphql.zulu.server.ImmutableQuery",
"io.zrz.graphql.zulu.server.ImmutableZuluServerRequest"
] | import com.google.common.base.Stopwatch; import io.zrz.graphql.core.doc.GQLOpType; import io.zrz.graphql.zulu.server.ImmutableQuery; import io.zrz.graphql.zulu.server.ImmutableZuluServerRequest; | import com.google.common.base.*; import io.zrz.graphql.core.doc.*; import io.zrz.graphql.zulu.server.*; | [
"com.google.common",
"io.zrz.graphql"
] | com.google.common; io.zrz.graphql; | 2,316,900 |
public Builder requiresConfigurationFragments(Class<?>... configurationFragments) {
configurationFragmentPolicy.requiresConfigurationFragments(
ImmutableSet.<Class<?>>copyOf(configurationFragments));
return this;
} | Builder function(Class<?>... configurationFragments) { configurationFragmentPolicy.requiresConfigurationFragments( ImmutableSet.<Class<?>>copyOf(configurationFragments)); return this; } | /**
* Declares that the implementation of the associated rule class requires the given
* fragments to be present in this rule's host and target configurations.
*
* <p>The value is inherited by subclasses.
*/ | Declares that the implementation of the associated rule class requires the given fragments to be present in this rule's host and target configurations. The value is inherited by subclasses | requiresConfigurationFragments | {
"repo_name": "variac/bazel",
"path": "src/main/java/com/google/devtools/build/lib/packages/RuleClass.java",
"license": "apache-2.0",
"size": 82582
} | [
"com.google.common.collect.ImmutableSet"
] | import com.google.common.collect.ImmutableSet; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 2,280,665 |
public static Checksum checksum(File file, Checksum checksum) throws IOException {
if (file.isDirectory()) {
throw new IllegalArgumentException("Checksums can't be computed on directories");
}
InputStream in = null;
try {
in = new CheckedInputStream(new FileInputStream(file), checksum);
IOUtils.copy(in, new NullOutputStream());
} finally {
IOUtils.closeQuietly(in);
}
return checksum;
} | static Checksum function(File file, Checksum checksum) throws IOException { if (file.isDirectory()) { throw new IllegalArgumentException(STR); } InputStream in = null; try { in = new CheckedInputStream(new FileInputStream(file), checksum); IOUtils.copy(in, new NullOutputStream()); } finally { IOUtils.closeQuietly(in); } return checksum; } | /**
* Computes the checksum of a file using the specified checksum object.
* Multiple files may be checked using one <code>Checksum</code> instance
* if desired simply by reusing the same checksum object.
* For example:
* <pre>
* long csum = FileUtils.checksum(file, new CRC32()).getValue();
* </pre>
*
* @param file the file to checksum, must not be <code>null</code>
* @param checksum the checksum object to be used, must not be <code>null</code>
* @return the checksum specified, updated with the content of the file
* @throws NullPointerException if the file or checksum is <code>null</code>
* @throws IllegalArgumentException if the file is a directory
* @throws IOException if an IO error occurs reading the file
* @since Commons IO 1.3
*/ | Computes the checksum of a file using the specified checksum object. Multiple files may be checked using one <code>Checksum</code> instance if desired simply by reusing the same checksum object. For example: <code> long csum = FileUtils.checksum(file, new CRC32()).getValue(); </code> | checksum | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "packages/apps/UnifiedEmail/src/org/apache/commons/io/FileUtils.java",
"license": "gpl-3.0",
"size": 77172
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.util.zip.CheckedInputStream",
"java.util.zip.Checksum",
"org.apache.commons.io.output.NullOutputStream"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.CheckedInputStream; import java.util.zip.Checksum; import org.apache.commons.io.output.NullOutputStream; | import java.io.*; import java.util.zip.*; import org.apache.commons.io.output.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 2,830,262 |
public final void printNode(CorePrinter output) {
} | final void function(CorePrinter output) { } | /**
* We don't print anything - we use {@link ASTPrintVisitor} instead
*/ | We don't print anything - we use <code>ASTPrintVisitor</code> instead | printNode | {
"repo_name": "vovagrechka/fucking-everything",
"path": "phizdets/phizdets-idea/eclipse-src/org.eclipse.php.core/src/org/eclipse/php/core/compiler/ast/nodes/CatchClause.java",
"license": "apache-2.0",
"size": 2767
} | [
"org.eclipse.dltk.utils.CorePrinter"
] | import org.eclipse.dltk.utils.CorePrinter; | import org.eclipse.dltk.utils.*; | [
"org.eclipse.dltk"
] | org.eclipse.dltk; | 391,019 |
public static String getCharSetEncoding(String contentType) {
if (log.isDebugEnabled()) {
log.debug("Input contentType (" + contentType + ")");
}
if (contentType == null) {
// Using the default UTF-8
if (log.isDebugEnabled()) {
log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING +
")");
}
return MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING);
if (index == -1) { // Charset encoding not found in the content-type header
// Using the default UTF-8
if (log.isDebugEnabled()) {
log.debug("CharSetEncoding defaulted (" + MessageContext.DEFAULT_CHAR_SET_ENCODING +
")");
}
return MessageContext.DEFAULT_CHAR_SET_ENCODING;
}
return extractCharSetValue(contentType);
} | static String function(String contentType) { if (log.isDebugEnabled()) { log.debug(STR + contentType + ")"); } if (contentType == null) { if (log.isDebugEnabled()) { log.debug(STR + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")"); } return MessageContext.DEFAULT_CHAR_SET_ENCODING; } int index = contentType.indexOf(HTTPConstants.CHAR_SET_ENCODING); if (index == -1) { if (log.isDebugEnabled()) { log.debug(STR + MessageContext.DEFAULT_CHAR_SET_ENCODING + ")"); } return MessageContext.DEFAULT_CHAR_SET_ENCODING; } return extractCharSetValue(contentType); } | /**
* Extracts and returns the character set encoding from the Content-type header
* <p/>
* Example: "Content-Type: text/xml; charset=utf-8" would return "utf-8"
*
* @param contentType a content-type (from HTTP or MIME, for instance)
* @return the character set encoding if found, or MessageContext.DEFAULT_CHAR_SET_ENCODING
*/ | Extracts and returns the character set encoding from the Content-type header Example: "Content-Type: text/xml; charset=utf-8" would return "utf-8" | getCharSetEncoding | {
"repo_name": "wso2/wso2-axis2",
"path": "modules/kernel/src/org/apache/axis2/builder/BuilderUtil.java",
"license": "apache-2.0",
"size": 39428
} | [
"org.apache.axis2.context.MessageContext",
"org.apache.axis2.transport.http.HTTPConstants"
] | import org.apache.axis2.context.MessageContext; import org.apache.axis2.transport.http.HTTPConstants; | import org.apache.axis2.context.*; import org.apache.axis2.transport.http.*; | [
"org.apache.axis2"
] | org.apache.axis2; | 2,674,033 |
public void setGameRoles(List<GameRole> gameRoles) {
this.gameRoles = gameRoles;
} | void function(List<GameRole> gameRoles) { this.gameRoles = gameRoles; } | /**
* Sets game roles.
*
* @param gameRoles the game roles
*/ | Sets game roles | setGameRoles | {
"repo_name": "thefinerthingsclub/finerleague",
"path": "finerleague-data/finerleague-data-entity/src/main/java/com/everis/alicante/thefinerthingsclub/finerleague/data/entity/Game.java",
"license": "gpl-3.0",
"size": 2996
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,604,219 |
public static Jid from(String localpart, String domainpart, String resource, JxmppContext context) throws XmppStringprepException {
// Every JID must come with an domainpart.
if (domainpart.isEmpty()) {
throw XmppStringprepException.MissingDomainpart.from(localpart, resource);
}
String jidString = XmppStringUtils.completeJidFrom(localpart, domainpart, resource);
Jid jid;
if (context.isCachingEnabled()) {
jid = JID_CACHE.lookup(jidString);
if (jid != null) {
return jid;
}
}
jid = null;
if (localpart != null && resource != null) {
jid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource, context);
} else if (localpart != null && resource == null) {
jid = new LocalAndDomainpartJid(localpart, domainpart, context);
} else if (localpart == null && resource == null) {
jid = new DomainpartJid(domainpart, context);
} else if (localpart == null && resource != null) {
jid = new DomainAndResourcepartJid(domainpart, resource, context);
}
assert jid != null;
if (context.isCachingEnabled()) {
JID_CACHE.put(jidString, jid);
}
return jid;
}
/**
* Like {@link #from(CharSequence)} but does throw an unchecked {@link IllegalArgumentException} instead of a
* {@link XmppStringprepException}.
*
* @param cs the character sequence which should be transformed to a {@link Jid} | static Jid function(String localpart, String domainpart, String resource, JxmppContext context) throws XmppStringprepException { if (domainpart.isEmpty()) { throw XmppStringprepException.MissingDomainpart.from(localpart, resource); } String jidString = XmppStringUtils.completeJidFrom(localpart, domainpart, resource); Jid jid; if (context.isCachingEnabled()) { jid = JID_CACHE.lookup(jidString); if (jid != null) { return jid; } } jid = null; if (localpart != null && resource != null) { jid = new LocalDomainAndResourcepartJid(localpart, domainpart, resource, context); } else if (localpart != null && resource == null) { jid = new LocalAndDomainpartJid(localpart, domainpart, context); } else if (localpart == null && resource == null) { jid = new DomainpartJid(domainpart, context); } else if (localpart == null && resource != null) { jid = new DomainAndResourcepartJid(domainpart, resource, context); } assert jid != null; if (context.isCachingEnabled()) { JID_CACHE.put(jidString, jid); } return jid; } /** * Like {@link #from(CharSequence)} but does throw an unchecked {@link IllegalArgumentException} instead of a * {@link XmppStringprepException}. * * @param cs the character sequence which should be transformed to a {@link Jid} | /**
* Get a {@link Jid} from the given parts.
* <p>
* Only the domainpart is required.
* </p>
*
* @param localpart a optional localpart.
* @param domainpart a required domainpart.
* @param resource a optional resourcepart.
* @param context the JXMPP context.
* @return a JID which consists of the given parts.
* @throws XmppStringprepException if an error occurs.
*/ | Get a <code>Jid</code> from the given parts. Only the domainpart is required. | from | {
"repo_name": "Flowdalic/jxmpp",
"path": "jxmpp-jid/src/main/java/org/jxmpp/jid/impl/JidCreate.java",
"license": "apache-2.0",
"size": 48033
} | [
"org.jxmpp.JxmppContext",
"org.jxmpp.jid.Jid",
"org.jxmpp.stringprep.XmppStringprepException",
"org.jxmpp.util.XmppStringUtils"
] | import org.jxmpp.JxmppContext; import org.jxmpp.jid.Jid; import org.jxmpp.stringprep.XmppStringprepException; import org.jxmpp.util.XmppStringUtils; | import org.jxmpp.*; import org.jxmpp.jid.*; import org.jxmpp.stringprep.*; import org.jxmpp.util.*; | [
"org.jxmpp",
"org.jxmpp.jid",
"org.jxmpp.stringprep",
"org.jxmpp.util"
] | org.jxmpp; org.jxmpp.jid; org.jxmpp.stringprep; org.jxmpp.util; | 68,161 |
EReference getStatement_S6(); | EReference getStatement_S6(); | /**
* Returns the meta object for the containment reference '{@link com.euclideanspace.spad.editor.Statement#getS6 <em>S6</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>S6</em>'.
* @see com.euclideanspace.spad.editor.Statement#getS6()
* @see #getStatement()
* @generated
*/ | Returns the meta object for the containment reference '<code>com.euclideanspace.spad.editor.Statement#getS6 S6</code>'. | getStatement_S6 | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,228,709 |
public ServiceFuture<OperationStatusResponseInner> deleteAsync(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback<OperationStatusResponseInner> serviceCallback) {
return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback);
} | ServiceFuture<OperationStatusResponseInner> function(String resourceGroupName, String vmScaleSetName, String instanceId, final ServiceCallback<OperationStatusResponseInner> serviceCallback) { return ServiceFuture.fromResponse(deleteWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId), serviceCallback); } | /**
* Deletes a virtual machine from a VM scale set.
*
* @param resourceGroupName The name of the resource group.
* @param vmScaleSetName The name of the VM scale set.
* @param instanceId The instance ID of the virtual machine.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Deletes a virtual machine from a VM scale set | deleteAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/compute/mgmt-v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetVMsInner.java",
"license": "mit",
"size": 121964
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,718,921 |
public Set<NotificationTopic> getNotificationTopics();
| Set<NotificationTopic> function(); | /**
* Ask for the notfication <em>types</em> supported, and expected to be
* sent by this notification provider.
*/ | Ask for the notfication types supported, and expected to be sent by this notification provider | getNotificationTopics | {
"repo_name": "afbits/OneCMDBwithMaven",
"path": "src/org.onecmdb.core/src/main/java/org/onecmdb/core/internal/notification/NotificationProvider.java",
"license": "gpl-2.0",
"size": 1962
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,714,382 |
public synchronized void stopThread() {
mStopRequested = true;
mConnected = true;
notify();
Log.i(TAG,"Requesting a stop");
} | synchronized void function() { mStopRequested = true; mConnected = true; notify(); Log.i(TAG,STR); } | /**
* Stops the thread by forcing the run() method to return.
* Called when there's no valid WIFI.
*/ | Stops the thread by forcing the run() method to return. Called when there's no valid WIFI | stopThread | {
"repo_name": "trishan/posit-mobile",
"path": "android/src/org/hfoss/posit/web/SyncThread.java",
"license": "lgpl-2.1",
"size": 11687
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,260,771 |
@Test
public void testECOWithFormB05() {
LocalTime eventStartTime = new LocalTime(16, 30, 0);
LocalTime eventStopTime = new LocalTime(17, 50, 0);
LocalTime formStartTime = new LocalTime(16, 10, 0);
LocalTime formStopTime = new LocalTime(17, 0, 0);
LocalTime absenceTime = new LocalTime(16, 20, 0);
absenceWithClassConflictFormHelper(eventStartTime, eventStopTime,
formStartTime, formStopTime, absenceTime,
Absence.Type.EarlyCheckOut, Absence.Status.Pending);
} | void function() { LocalTime eventStartTime = new LocalTime(16, 30, 0); LocalTime eventStopTime = new LocalTime(17, 50, 0); LocalTime formStartTime = new LocalTime(16, 10, 0); LocalTime formStopTime = new LocalTime(17, 0, 0); LocalTime absenceTime = new LocalTime(16, 20, 0); absenceWithClassConflictFormHelper(eventStartTime, eventStopTime, formStartTime, formStopTime, absenceTime, Absence.Type.EarlyCheckOut, Absence.Status.Pending); } | /**
* class times overlap event start, tardy time within class, before event
*/ | class times overlap event start, tardy time within class, before event | testECOWithFormB05 | {
"repo_name": "curtisullerich/attendance",
"path": "src/test/java/edu/iastate/music/marching/attendance/test/model/interact/FormClassConflictSimpleTest.java",
"license": "mit",
"size": 48344
} | [
"edu.iastate.music.marching.attendance.model.store.Absence",
"org.joda.time.LocalTime"
] | import edu.iastate.music.marching.attendance.model.store.Absence; import org.joda.time.LocalTime; | import edu.iastate.music.marching.attendance.model.store.*; import org.joda.time.*; | [
"edu.iastate.music",
"org.joda.time"
] | edu.iastate.music; org.joda.time; | 2,368,329 |
public View getStickyHeader() {
return mDrawerBuilder.mStickyHeaderView;
} | View function() { return mDrawerBuilder.mStickyHeaderView; } | /**
* get the StickyHeader View if set else NULL
*
* @return
*/ | get the StickyHeader View if set else NULL | getStickyHeader | {
"repo_name": "MaTriXy/MaterialDrawer",
"path": "library/src/main/java/com/mikepenz/materialdrawer/Drawer.java",
"license": "apache-2.0",
"size": 36601
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 768,948 |
@Override
public boolean deleteItem(Vehicle vehicle, User user) {
try {
database.begin();
PreparedStatement ps = database.prepareQuery("DELETE FROM dat_vehicles WHERE id = ?;");
ps.setInt(1, vehicle.getId());
ps.executeUpdate();
ps = database.prepareQuery("UPDATE dat_drivers SET vehicle_id=0 WHERE vehicle_id = ?;");
ps.setInt(1, vehicle.getId());
ps.executeUpdate();
database.commit();
} catch (SQLException e) {
try {
database.rollback();
}
catch (SQLException ex2) { System.err.println(ex2); }
System.err.println(Lang.get("Error.Sql", e));
lastError = Lang.get("Error.Sql", e.getMessage());
return false;
}
return true;
}
| boolean function(Vehicle vehicle, User user) { try { database.begin(); PreparedStatement ps = database.prepareQuery(STR); ps.setInt(1, vehicle.getId()); ps.executeUpdate(); ps = database.prepareQuery(STR); ps.setInt(1, vehicle.getId()); ps.executeUpdate(); database.commit(); } catch (SQLException e) { try { database.rollback(); } catch (SQLException ex2) { System.err.println(ex2); } System.err.println(Lang.get(STR, e)); lastError = Lang.get(STR, e.getMessage()); return false; } return true; } | /**
* Metoda usuwa element ze slownika
* @param vehicle Element do usuniecia
* @param user Obiekt zalogowanego uzytkownika
* @return true jezeli OK
*/ | Metoda usuwa element ze slownika | deleteItem | {
"repo_name": "makaw/somado",
"path": "src/main/java/datamodel/glossaries/GlossVehicles.java",
"license": "mit",
"size": 7914
} | [
"java.sql.PreparedStatement",
"java.sql.SQLException"
] | import java.sql.PreparedStatement; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,937,204 |
public ChannelFuture bind(SocketAddress localAddress) {
validate();
if (localAddress == null) {
throw new NullPointerException("localAddress");
}
return doBind(localAddress);
} | ChannelFuture function(SocketAddress localAddress) { validate(); if (localAddress == null) { throw new NullPointerException(STR); } return doBind(localAddress); } | /**
* Create a new {@link Channel} and bind it.
*/ | Create a new <code>Channel</code> and bind it | bind | {
"repo_name": "raksuns/netty_raks",
"path": "transport/src/main/java/io/netty/bootstrap/AbstractBootstrap.java",
"license": "apache-2.0",
"size": 12376
} | [
"io.netty.channel.ChannelFuture",
"java.net.SocketAddress"
] | import io.netty.channel.ChannelFuture; import java.net.SocketAddress; | import io.netty.channel.*; import java.net.*; | [
"io.netty.channel",
"java.net"
] | io.netty.channel; java.net; | 1,404,788 |
public long getRemainingDelay(final long nanoTimeNow, final Settings settings, final Settings indexSettings) {
final long delayTimeoutNanos = getAllocationDelayTimeoutSettingNanos(settings, indexSettings);
if (delayTimeoutNanos == 0L) {
return 0L;
} else {
assert nanoTimeNow >= unassignedTimeNanos;
return Math.max(0L, delayTimeoutNanos - (nanoTimeNow - unassignedTimeNanos));
}
} | long function(final long nanoTimeNow, final Settings settings, final Settings indexSettings) { final long delayTimeoutNanos = getAllocationDelayTimeoutSettingNanos(settings, indexSettings); if (delayTimeoutNanos == 0L) { return 0L; } else { assert nanoTimeNow >= unassignedTimeNanos; return Math.max(0L, delayTimeoutNanos - (nanoTimeNow - unassignedTimeNanos)); } } | /**
* Calculates the delay left based on current time (in nanoseconds) and index/node settings.
*
* @return calculated delay in nanoseconds
*/ | Calculates the delay left based on current time (in nanoseconds) and index/node settings | getRemainingDelay | {
"repo_name": "mmaracic/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/cluster/routing/UnassignedInfo.java",
"license": "apache-2.0",
"size": 14497
} | [
"org.elasticsearch.common.settings.Settings"
] | import org.elasticsearch.common.settings.Settings; | import org.elasticsearch.common.settings.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,510,526 |
protected NettyConfiguration parseConfiguration(NettyConfiguration configuration, String remaining, Map<String, Object> parameters) throws Exception {
configuration.parseURI(new URI(remaining), parameters, this, "tcp", "udp");
return configuration;
} | NettyConfiguration function(NettyConfiguration configuration, String remaining, Map<String, Object> parameters) throws Exception { configuration.parseURI(new URI(remaining), parameters, this, "tcp", "udp"); return configuration; } | /**
* Parses the configuration
*
* @return the parsed and valid configuration to use
*/ | Parses the configuration | parseConfiguration | {
"repo_name": "lburgazzoli/apache-camel",
"path": "components/camel-netty4/src/main/java/org/apache/camel/component/netty4/NettyComponent.java",
"license": "apache-2.0",
"size": 6018
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 959,601 |
@Override
public int getBaseType() throws SQLException {
try {
debugCodeCall("getBaseType");
checkClosed();
return Types.NULL;
} catch (Exception e) {
throw logAndConvert(e);
}
} | int function() throws SQLException { try { debugCodeCall(STR); checkClosed(); return Types.NULL; } catch (Exception e) { throw logAndConvert(e); } } | /**
* Returns the base type of the array. This database does support mixed type
* arrays and therefore there is no base type.
*
* @return Types.NULL
*/ | Returns the base type of the array. This database does support mixed type arrays and therefore there is no base type | getBaseType | {
"repo_name": "vdr007/ThriftyPaxos",
"path": "src/applications/h2/src/main/org/h2/jdbc/JdbcArray.java",
"license": "apache-2.0",
"size": 8810
} | [
"java.sql.SQLException",
"java.sql.Types"
] | import java.sql.SQLException; import java.sql.Types; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,833,902 |
public static PyExpr convertMapToOrderedDict(Map<PyExpr, PyExpr> dict) {
List<String> values = new ArrayList<>();
for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) {
values.add("(" + entry.getKey().getText() + ", " + entry.getValue().getText() + ")");
}
Joiner joiner = Joiner.on(", ");
return new PyExpr("collections.OrderedDict([" + joiner.join(values) + "])", Integer.MAX_VALUE);
} | static PyExpr function(Map<PyExpr, PyExpr> dict) { List<String> values = new ArrayList<>(); for (Map.Entry<PyExpr, PyExpr> entry : dict.entrySet()) { values.add("(" + entry.getKey().getText() + STR + entry.getValue().getText() + ")"); } Joiner joiner = Joiner.on(STR); return new PyExpr(STR + joiner.join(values) + "])", Integer.MAX_VALUE); } | /**
* Convert a java Map to valid PyExpr as dict.
*
* @param dict A Map to be converted to PyExpr as a dictionary, both key and value should be
* PyExpr.
*/ | Convert a java Map to valid PyExpr as dict | convertMapToOrderedDict | {
"repo_name": "rpatil26/closure-templates",
"path": "java/src/com/google/template/soy/pysrc/restricted/PyExprUtils.java",
"license": "apache-2.0",
"size": 12457
} | [
"com.google.common.base.Joiner",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import com.google.common.base.Joiner; import java.util.ArrayList; import java.util.List; import java.util.Map; | import com.google.common.base.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,433,270 |
public LIRPhaseSuite<PostAllocationOptimizationContext> getPostAllocationOptimizationStage() {
return postAllocStage;
} | LIRPhaseSuite<PostAllocationOptimizationContext> function() { return postAllocStage; } | /**
* {@link PostAllocationOptimizationPhase}s are executed after register allocation and before
* machine code generation.
* <p>
* A {@link PostAllocationOptimizationPhase} must not introduce new {@link Variable}s,
* {@link VirtualStackSlot}s or {@link StackSlot}s.
*/ | <code>PostAllocationOptimizationPhase</code>s are executed after register allocation and before machine code generation. A <code>PostAllocationOptimizationPhase</code> must not introduce new <code>Variable</code>s, <code>VirtualStackSlot</code>s or <code>StackSlot</code>s | getPostAllocationOptimizationStage | {
"repo_name": "smarr/GraalCompiler",
"path": "graal/com.oracle.graal.lir/src/com/oracle/graal/lir/phases/LIRSuites.java",
"license": "gpl-2.0",
"size": 3813
} | [
"com.oracle.graal.lir.phases.PostAllocationOptimizationPhase"
] | import com.oracle.graal.lir.phases.PostAllocationOptimizationPhase; | import com.oracle.graal.lir.phases.*; | [
"com.oracle.graal"
] | com.oracle.graal; | 405,208 |
@ResponseStatus(code = HttpStatus.NO_CONTENT)
@RequestMapping(value = "/{filterId}/enable", method = { RequestMethod.PATCH, RequestMethod.PUT })
@PreAuthorize("hasAuthority('" + CoreGroupPermission.MODULE_UPDATE + "')")
@ApiOperation(
value = "Activate filter builder",
nickname = "activateFilterBuilder",
tags = { FilterBuilderController.TAG },
authorizations = {
@Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = {
@AuthorizationScope(scope = CoreGroupPermission.MODULE_UPDATE, description = "") }),
@Authorization(value = SwaggerConfig.AUTHENTICATION_CIDMST, scopes = {
@AuthorizationScope(scope = CoreGroupPermission.MODULE_UPDATE, description = "") })
})
public void enable(
@ApiParam(value = "Filter builder's identifier.", required = true)
@PathVariable @NotNull String filterId) {
filterManager.enable(filterId);
} | @ResponseStatus(code = HttpStatus.NO_CONTENT) @RequestMapping(value = STR, method = { RequestMethod.PATCH, RequestMethod.PUT }) @PreAuthorize(STR + CoreGroupPermission.MODULE_UPDATE + "')") @ApiOperation( value = STR, nickname = STR, tags = { FilterBuilderController.TAG }, authorizations = { @Authorization(value = SwaggerConfig.AUTHENTICATION_BASIC, scopes = { @AuthorizationScope(scope = CoreGroupPermission.MODULE_UPDATE, description = STRSTRFilter builder's identifier.", required = true) @PathVariable @NotNull String filterId) { filterManager.enable(filterId); } | /**
* Enable filter builder
*
* @param filterId
*/ | Enable filter builder | enable | {
"repo_name": "bcvsolutions/CzechIdMng",
"path": "Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/rest/impl/FilterBuilderController.java",
"license": "mit",
"size": 4628
} | [
"eu.bcvsolutions.idm.core.api.config.swagger.SwaggerConfig",
"eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission",
"io.swagger.annotations.ApiOperation",
"io.swagger.annotations.Authorization",
"io.swagger.annotations.AuthorizationScope",
"javax.validation.constraints.NotNull",
"org.springframework.http.HttpStatus",
"org.springframework.security.access.prepost.PreAuthorize",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.bind.annotation.ResponseStatus"
] | import eu.bcvsolutions.idm.core.api.config.swagger.SwaggerConfig; import eu.bcvsolutions.idm.core.model.domain.CoreGroupPermission; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.Authorization; import io.swagger.annotations.AuthorizationScope; import javax.validation.constraints.NotNull; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseStatus; | import eu.bcvsolutions.idm.core.api.config.swagger.*; import eu.bcvsolutions.idm.core.model.domain.*; import io.swagger.annotations.*; import javax.validation.constraints.*; import org.springframework.http.*; import org.springframework.security.access.prepost.*; import org.springframework.web.bind.annotation.*; | [
"eu.bcvsolutions.idm",
"io.swagger.annotations",
"javax.validation",
"org.springframework.http",
"org.springframework.security",
"org.springframework.web"
] | eu.bcvsolutions.idm; io.swagger.annotations; javax.validation; org.springframework.http; org.springframework.security; org.springframework.web; | 1,095,559 |
public List<Source> getXSLTemplates() {
ArrayList<Source> sourceList = PrintingUtils
.getXSLTforReport(BudgetPrintType.BUDGET_SUMMARY_TOTAL_REPORT
.getBudgetPrintType());
return sourceList;
} | List<Source> function() { ArrayList<Source> sourceList = PrintingUtils .getXSLTforReport(BudgetPrintType.BUDGET_SUMMARY_TOTAL_REPORT .getBudgetPrintType()); return sourceList; } | /**
* This method fetches the XSL style-sheets required for transforming the
* generated XML into PDF.
*
* @return {@link ArrayList}} of {@link Source} XSLs
*/ | This method fetches the XSL style-sheets required for transforming the generated XML into PDF | getXSLTemplates | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/coeus/common/budget/impl/print/BudgetSummaryTotalPrint.java",
"license": "apache-2.0",
"size": 2239
} | [
"java.util.ArrayList",
"java.util.List",
"javax.xml.transform.Source",
"org.kuali.coeus.common.budget.framework.print.BudgetPrintType",
"org.kuali.coeus.common.framework.print.util.PrintingUtils"
] | import java.util.ArrayList; import java.util.List; import javax.xml.transform.Source; import org.kuali.coeus.common.budget.framework.print.BudgetPrintType; import org.kuali.coeus.common.framework.print.util.PrintingUtils; | import java.util.*; import javax.xml.transform.*; import org.kuali.coeus.common.budget.framework.print.*; import org.kuali.coeus.common.framework.print.util.*; | [
"java.util",
"javax.xml",
"org.kuali.coeus"
] | java.util; javax.xml; org.kuali.coeus; | 810,351 |
public AsynchronousJobStatus getAsynchJobStatus(DispatcherServlet instance, Long userId, String jobId) throws Exception {
MockHttpServletRequest request = ServletTestHelperUtils.initRequest(
HTTPMODE.GET, UrlHelpers.ASYNCHRONOUS_JOB+"/"+jobId, userId, null);
MockHttpServletResponse response = new MockHttpServletResponse();
instance.service(request, response);
String reponseString = response.getContentAsString();
if(response.getStatus() == 200){
return EntityFactory.createEntityFromJSONString(reponseString, AsynchronousJobStatus.class);
}else{
ServletTestHelperUtils.handleException(response.getStatus(), response.getContentAsString());
return null;
}
}
| AsynchronousJobStatus function(DispatcherServlet instance, Long userId, String jobId) throws Exception { MockHttpServletRequest request = ServletTestHelperUtils.initRequest( HTTPMODE.GET, UrlHelpers.ASYNCHRONOUS_JOB+"/"+jobId, userId, null); MockHttpServletResponse response = new MockHttpServletResponse(); instance.service(request, response); String reponseString = response.getContentAsString(); if(response.getStatus() == 200){ return EntityFactory.createEntityFromJSONString(reponseString, AsynchronousJobStatus.class); }else{ ServletTestHelperUtils.handleException(response.getStatus(), response.getContentAsString()); return null; } } | /**
* Get the status for a job
*
* @param instance
* @param userId
* @param jobId
* @return
* @throws Exception
*/ | Get the status for a job | getAsynchJobStatus | {
"repo_name": "hhu94/Synapse-Repository-Services",
"path": "services/repository/src/test/java/org/sagebionetworks/repo/web/controller/ServletTestHelper.java",
"license": "apache-2.0",
"size": 93773
} | [
"org.sagebionetworks.repo.model.asynch.AsynchronousJobStatus",
"org.sagebionetworks.repo.web.UrlHelpers",
"org.sagebionetworks.schema.adapter.org.json.EntityFactory",
"org.springframework.mock.web.MockHttpServletRequest",
"org.springframework.mock.web.MockHttpServletResponse",
"org.springframework.web.servlet.DispatcherServlet"
] | import org.sagebionetworks.repo.model.asynch.AsynchronousJobStatus; import org.sagebionetworks.repo.web.UrlHelpers; import org.sagebionetworks.schema.adapter.org.json.EntityFactory; import org.springframework.mock.web.MockHttpServletRequest; import org.springframework.mock.web.MockHttpServletResponse; import org.springframework.web.servlet.DispatcherServlet; | import org.sagebionetworks.repo.model.asynch.*; import org.sagebionetworks.repo.web.*; import org.sagebionetworks.schema.adapter.org.json.*; import org.springframework.mock.web.*; import org.springframework.web.servlet.*; | [
"org.sagebionetworks.repo",
"org.sagebionetworks.schema",
"org.springframework.mock",
"org.springframework.web"
] | org.sagebionetworks.repo; org.sagebionetworks.schema; org.springframework.mock; org.springframework.web; | 631,758 |
private void doSaveManifest(Jar dot) throws Exception {
String output = getProperty(SAVEMANIFEST);
if (output == null)
return;
File f = getFile(output);
if (f.isDirectory()) {
f = new File(f, "MANIFEST.MF");
}
if (!f.exists() || f.lastModified() < dot.lastModified()) {
IO.delete(f);
File fp = f.getParentFile();
IO.mkdirs(fp);
try (OutputStream out = IO.outputStream(f)) {
Jar.writeManifest(dot.getManifest(), out);
}
changedFile(f);
}
}
protected void changedFile(@SuppressWarnings("unused") File f) {} | void function(Jar dot) throws Exception { String output = getProperty(SAVEMANIFEST); if (output == null) return; File f = getFile(output); if (f.isDirectory()) { f = new File(f, STR); } if (!f.exists() f.lastModified() < dot.lastModified()) { IO.delete(f); File fp = f.getParentFile(); IO.mkdirs(fp); try (OutputStream out = IO.outputStream(f)) { Jar.writeManifest(dot.getManifest(), out); } changedFile(f); } } protected void changedFile(@SuppressWarnings(STR) File f) {} | /**
* Get the manifest and write it out separately if -savemanifest is set
*
* @param dot
*/ | Get the manifest and write it out separately if -savemanifest is set | doSaveManifest | {
"repo_name": "mcculls/bnd",
"path": "biz.aQute.bndlib/src/aQute/bnd/osgi/Builder.java",
"license": "apache-2.0",
"size": 50886
} | [
"java.io.File",
"java.io.OutputStream"
] | import java.io.File; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,316,410 |
public Date getGeneralizedTime(int len) throws IOException {
if (len > available())
throw new IOException("short read of DER Generalized Time");
if (len < 13)
throw new IOException("DER Generalized Time length error");
return getTime(len, true);
} | Date function(int len) throws IOException { if (len > available()) throw new IOException(STR); if (len < 13) throw new IOException(STR); return getTime(len, true); } | /**
* Returns the Generalized Time value that takes up the specified
* number of bytes in this buffer.
* @param len the number of bytes to use
*/ | Returns the Generalized Time value that takes up the specified number of bytes in this buffer | getGeneralizedTime | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/java.base/share/classes/sun/security/util/DerInputBuffer.java",
"license": "gpl-2.0",
"size": 15762
} | [
"java.io.IOException",
"java.util.Date"
] | import java.io.IOException; import java.util.Date; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,308,012 |
public Boolean getAllowsRecordDeletion(MaintenanceDocument document); | Boolean function(MaintenanceDocument document); | /**
* Indicates whether the given maintenance document is configured to allow record deletions
*
* @param document - maintenance document instance to check
* @return Boolean true if record deletion is allowed, false if not allowed, null if not configured
*/ | Indicates whether the given maintenance document is configured to allow record deletions | getAllowsRecordDeletion | {
"repo_name": "sbower/kuali-rice-1",
"path": "kns/src/main/java/org/kuali/rice/kns/service/MaintenanceDocumentDictionaryService.java",
"license": "apache-2.0",
"size": 12083
} | [
"org.kuali.rice.kns.document.MaintenanceDocument"
] | import org.kuali.rice.kns.document.MaintenanceDocument; | import org.kuali.rice.kns.document.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,188,312 |
public static Test suite(String property) {
return suite(addAll(property), getMissing(property));
} | static Test function(String property) { return suite(addAll(property), getMissing(property)); } | /**
* Generates a TestSuite for the given ClassLister property
* and returns it. Potentially missing test classes are output.
*
* @param property the GPC property to generate a test suite from
* @return the generated test suite
*/ | Generates a TestSuite for the given ClassLister property and returns it. Potentially missing test classes are output | suite | {
"repo_name": "automenta/adams-core",
"path": "src/test/java/adams/test/AdamsTestSuite.java",
"license": "gpl-3.0",
"size": 9261
} | [
"junit.framework.Test"
] | import junit.framework.Test; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 2,331,992 |
public void AddAtom(Atom atom){
if(this.getChildNode(atom.getAtomAsReteKey()) == null){
//System.out.println("Adding new SelectionNode!: " + atom);
SelectionNode sel = new SelectionNode(atom.getAtomAsReteKey(), this.rete);
//System.err.println("I am: " + this + "of size: " + this.pred.getArity() + " - I'm adding positive selectionNode: " + sel);
this.basicChildren.add(sel);
}
}
/*public Collection<Instance> select(Term[] selectionCriteria){
return memory.select(selectionCriteria);
}
public boolean containsInstance(Instance instance){
return memory.containsInstance(instance);
} | void function(Atom atom){ if(this.getChildNode(atom.getAtomAsReteKey()) == null){ SelectionNode sel = new SelectionNode(atom.getAtomAsReteKey(), this.rete); this.basicChildren.add(sel); } } /*public Collection<Instance> select(Term[] selectionCriteria){ return memory.select(selectionCriteria); } public boolean containsInstance(Instance instance){ return memory.containsInstance(instance); } | /**
*
* this registers an Atom to this basicNode. The basicNode creates a selectionNode for that atom and adds it to it's children
*
* @param atom the atom you want to register to this basicNode. (Has to be of same predicate as the BasicNodes predicate)
*/ | this registers an Atom to this basicNode. The basicNode creates a selectionNode for that atom and adds it to it's children | AddAtom | {
"repo_name": "AntoniusW/omiga",
"path": "src/Datastructure/Rete/BasicNode.java",
"license": "bsd-2-clause",
"size": 6317
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,902,253 |
public Ticket get(final String ticketId) {
final TicketDefinition metadata = this.ticketCatalog.find(ticketId);
if (metadata != null) {
final Map<String, AttributeValue> keys = new HashMap<>();
keys.put(ColumnNames.ID.getName(), new AttributeValue(ticketId));
final GetItemRequest request = new GetItemRequest()
.withKey(keys)
.withTableName(metadata.getProperties().getStorageName());
LOGGER.debug("Submitting request [{}] to get ticket item [{}]", request, ticketId);
final Map<String, AttributeValue> returnItem = amazonDynamoDBClient.getItem(request).getItem();
if (returnItem != null) {
final Ticket ticket = deserializeTicket(returnItem);
LOGGER.debug("Located ticket [{}]", ticket);
return ticket;
}
} else {
LOGGER.warn("No ticket definition could be found in the catalog to match [{}]", ticketId);
}
return null;
} | Ticket function(final String ticketId) { final TicketDefinition metadata = this.ticketCatalog.find(ticketId); if (metadata != null) { final Map<String, AttributeValue> keys = new HashMap<>(); keys.put(ColumnNames.ID.getName(), new AttributeValue(ticketId)); final GetItemRequest request = new GetItemRequest() .withKey(keys) .withTableName(metadata.getProperties().getStorageName()); LOGGER.debug(STR, request, ticketId); final Map<String, AttributeValue> returnItem = amazonDynamoDBClient.getItem(request).getItem(); if (returnItem != null) { final Ticket ticket = deserializeTicket(returnItem); LOGGER.debug(STR, ticket); return ticket; } } else { LOGGER.warn(STR, ticketId); } return null; } | /**
* Get ticket.
*
* @param ticketId the ticket id
* @return the ticket
*/ | Get ticket | get | {
"repo_name": "petracvv/cas",
"path": "support/cas-server-support-dynamodb-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/DynamoDbTicketRegistryFacilitator.java",
"license": "apache-2.0",
"size": 11337
} | [
"com.amazonaws.services.dynamodbv2.model.AttributeValue",
"com.amazonaws.services.dynamodbv2.model.GetItemRequest",
"java.util.HashMap",
"java.util.Map",
"org.apereo.cas.ticket.Ticket",
"org.apereo.cas.ticket.TicketDefinition"
] | import com.amazonaws.services.dynamodbv2.model.AttributeValue; import com.amazonaws.services.dynamodbv2.model.GetItemRequest; import java.util.HashMap; import java.util.Map; import org.apereo.cas.ticket.Ticket; import org.apereo.cas.ticket.TicketDefinition; | import com.amazonaws.services.dynamodbv2.model.*; import java.util.*; import org.apereo.cas.ticket.*; | [
"com.amazonaws.services",
"java.util",
"org.apereo.cas"
] | com.amazonaws.services; java.util; org.apereo.cas; | 1,797,096 |
public void setContainerHLAnnotationHLAPI(
HLAnnotationHLAPI elem){
if(elem!=null)
item.setContainerHLAnnotation((HLAnnotation)elem.getContainedItem());
}
| void function( HLAnnotationHLAPI elem){ if(elem!=null) item.setContainerHLAnnotation((HLAnnotation)elem.getContainedItem()); } | /**
* set ContainerHLAnnotation
*/ | set ContainerHLAnnotation | setContainerHLAnnotationHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/strings/hlapi/SubstringHLAPI.java",
"license": "epl-1.0",
"size": 111893
} | [
"fr.lip6.move.pnml.hlpn.hlcorestructure.HLAnnotation",
"fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.HLAnnotationHLAPI"
] | import fr.lip6.move.pnml.hlpn.hlcorestructure.HLAnnotation; import fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.HLAnnotationHLAPI; | import fr.lip6.move.pnml.hlpn.hlcorestructure.*; import fr.lip6.move.pnml.hlpn.hlcorestructure.hlapi.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 1,719,617 |
ReportingTaskEntity deleteReportingTask(Revision revision, String reportingTaskId); | ReportingTaskEntity deleteReportingTask(Revision revision, String reportingTaskId); | /**
* Deletes the specified reporting task.
*
* @param revision Revision to compare with current base revision
* @param reportingTaskId The reporting task id
* @return snapshot
*/ | Deletes the specified reporting task | deleteReportingTask | {
"repo_name": "jskora/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java",
"license": "apache-2.0",
"size": 83710
} | [
"org.apache.nifi.web.api.entity.ReportingTaskEntity"
] | import org.apache.nifi.web.api.entity.ReportingTaskEntity; | import org.apache.nifi.web.api.entity.*; | [
"org.apache.nifi"
] | org.apache.nifi; | 1,253,498 |
private List<Pair<String, Serializable>> searchForUniqueValuesOfOldestInstances(PropertyDefinition propertyDefinition, String definitionId, String fieldUri) {
String query = getUniqueValuesOfOldestInstancesSemanticQuery(propertyDefinition);
Map<String, Serializable> bindings = new HashMap<>(2);
bindings.put("definitionIdVariable", definitionId);
bindings.put("fieldUriVariable", fieldUri);
SearchArguments<Instance> arguments = new SearchArguments<>();
arguments.setPermissionsType(SearchArguments.QueryResultPermissionFilter.NONE);
arguments.setDialect(SearchDialects.SPARQL);
arguments.setStringQuery(query);
arguments.setArguments(bindings);
arguments.setPageSize(0);
try (Stream<ResultItem> stream = searchService.stream(arguments, ResultItemTransformer.asIs())) {
return stream.map(
item -> new Pair<>(item.getString("instance"), item.getResultValue("uniqueValue")))
.collect(Collectors.toList());
}
} | List<Pair<String, Serializable>> function(PropertyDefinition propertyDefinition, String definitionId, String fieldUri) { String query = getUniqueValuesOfOldestInstancesSemanticQuery(propertyDefinition); Map<String, Serializable> bindings = new HashMap<>(2); bindings.put(STR, definitionId); bindings.put(STR, fieldUri); SearchArguments<Instance> arguments = new SearchArguments<>(); arguments.setPermissionsType(SearchArguments.QueryResultPermissionFilter.NONE); arguments.setDialect(SearchDialects.SPARQL); arguments.setStringQuery(query); arguments.setArguments(bindings); arguments.setPageSize(0); try (Stream<ResultItem> stream = searchService.stream(arguments, ResultItemTransformer.asIs())) { return stream.map( item -> new Pair<>(item.getString(STR), item.getResultValue(STR))) .collect(Collectors.toList()); } } | /**
* Searches all different values of couples <code>definitionId</code> and <code>fieldUri</code> and returns oldest
* instances for every one of them.
*
* @return list with pairs. A pair contain the instance id of oldest instance and the value.
*/ | Searches all different values of couples <code>definitionId</code> and <code>fieldUri</code> and returns oldest instances for every one of them | searchForUniqueValuesOfOldestInstances | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/domain-model/instance-core/src/main/java/com/sirma/itt/sep/instance/unique/UniqueValueValidationServiceImpl.java",
"license": "lgpl-3.0",
"size": 17099
} | [
"com.sirma.itt.seip.Pair",
"com.sirma.itt.seip.domain.definition.PropertyDefinition",
"com.sirma.itt.seip.domain.instance.Instance",
"com.sirma.itt.seip.domain.search.SearchArguments",
"com.sirma.itt.seip.domain.search.SearchDialects",
"com.sirma.itt.seip.search.ResultItem",
"com.sirma.itt.seip.search.ResultItemTransformer",
"java.io.Serializable",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.stream.Collectors",
"java.util.stream.Stream"
] | import com.sirma.itt.seip.Pair; import com.sirma.itt.seip.domain.definition.PropertyDefinition; import com.sirma.itt.seip.domain.instance.Instance; import com.sirma.itt.seip.domain.search.SearchArguments; import com.sirma.itt.seip.domain.search.SearchDialects; import com.sirma.itt.seip.search.ResultItem; import com.sirma.itt.seip.search.ResultItemTransformer; import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; | import com.sirma.itt.seip.*; import com.sirma.itt.seip.domain.definition.*; import com.sirma.itt.seip.domain.instance.*; import com.sirma.itt.seip.domain.search.*; import com.sirma.itt.seip.search.*; import java.io.*; import java.util.*; import java.util.stream.*; | [
"com.sirma.itt",
"java.io",
"java.util"
] | com.sirma.itt; java.io; java.util; | 1,774,200 |
public static java.util.List<de.fraunhofer.fokus.movepla.model.Entitlement> findByc(
long companyId)
throws com.liferay.portal.kernel.exception.SystemException {
return getPersistence().findByc(companyId);
} | static java.util.List<de.fraunhofer.fokus.movepla.model.Entitlement> function( long companyId) throws com.liferay.portal.kernel.exception.SystemException { return getPersistence().findByc(companyId); } | /**
* Returns all the entitlements where companyId = ?.
*
* @param companyId the company ID
* @return the matching entitlements
* @throws SystemException if a system exception occurred
*/ | Returns all the entitlements where companyId = ? | findByc | {
"repo_name": "fraunhoferfokus/govapps",
"path": "data-portlet/src/main/java/de/fraunhofer/fokus/movepla/service/persistence/EntitlementUtil.java",
"license": "bsd-3-clause",
"size": 25989
} | [
"com.liferay.portal.kernel.exception.SystemException",
"de.fraunhofer.fokus.movepla.model.Entitlement",
"java.util.List"
] | import com.liferay.portal.kernel.exception.SystemException; import de.fraunhofer.fokus.movepla.model.Entitlement; import java.util.List; | import com.liferay.portal.kernel.exception.*; import de.fraunhofer.fokus.movepla.model.*; import java.util.*; | [
"com.liferay.portal",
"de.fraunhofer.fokus",
"java.util"
] | com.liferay.portal; de.fraunhofer.fokus; java.util; | 100,073 |
@Nullable
public UpdateEnvironment getStatusEnvironment() {
return null;
} | UpdateEnvironment function() { return null; } | /**
* Returns the interface for performing "check status" operations (operations which show the differences between
* the local working copy state and the latest server state).
*
* @return the status interface, or null if the check status operation is not supported or required by the VCS.
*/ | Returns the interface for performing "check status" operations (operations which show the differences between the local working copy state and the latest server state) | getStatusEnvironment | {
"repo_name": "hurricup/intellij-community",
"path": "platform/vcs-api/src/com/intellij/openapi/vcs/AbstractVcs.java",
"license": "apache-2.0",
"size": 20104
} | [
"com.intellij.openapi.vcs.update.UpdateEnvironment"
] | import com.intellij.openapi.vcs.update.UpdateEnvironment; | import com.intellij.openapi.vcs.update.*; | [
"com.intellij.openapi"
] | com.intellij.openapi; | 825,279 |
try {
TestClient tc = new TestClient();
m = WSMarshallerFactory.createInstance();
m.removeAllTypeClasses();
m.addXmlTypeClass(Status.class);
// Wait some seconds until the SAL comes up
Thread.sleep(2500);
} catch (Exception e) {
logger.debug(e.getMessage(), e);
Assert.fail();
}
} | try { TestClient tc = new TestClient(); m = WSMarshallerFactory.createInstance(); m.removeAllTypeClasses(); m.addXmlTypeClass(Status.class); Thread.sleep(2500); } catch (Exception e) { logger.debug(e.getMessage(), e); Assert.fail(); } } | /**
* Start up the TestClient.
*
* @throws Exception
*/ | Start up the TestClient | setUpClass | {
"repo_name": "adelapie/open-ecard-IRMA",
"path": "bindings/http/src/test/java/org/openecard/control/binding/http/HTTPBindingTest.java",
"license": "apache-2.0",
"size": 8143
} | [
"org.openecard.ws.marshal.WSMarshallerFactory",
"org.openecard.ws.schema.Status",
"org.testng.Assert"
] | import org.openecard.ws.marshal.WSMarshallerFactory; import org.openecard.ws.schema.Status; import org.testng.Assert; | import org.openecard.ws.marshal.*; import org.openecard.ws.schema.*; import org.testng.*; | [
"org.openecard.ws",
"org.testng"
] | org.openecard.ws; org.testng; | 13,035 |
public void generate()
{
final XMLReader xmlReader = new XMLReader();
final Element doc = xmlReader.read(reader);
final NodeList nodeList = doc.getElementsByTagName("factionhub");
int size = nodeList.getLength();
final Map<String, Point> nameToPoint = new TreeMap<String, Point>();
for (int i = 0; i < size; i++)
{
final Node node = nodeList.item(i);
final Node nameNode = node.getFirstChild();
final String name = nameNode.getTextContent().trim();
final Node locationNode = node.getFirstChild().getNextSibling().getNextSibling();
final String xString = locationNode.getAttributes().getNamedItem("X").getTextContent();
final int x = Integer.parseInt(xString);
final String yString = locationNode.getAttributes().getNamedItem("Y").getTextContent();
final int y = Integer.parseInt(yString);
nameToPoint.put(name, new Point(x, y));
}
size = nameToPoint.size();
int count = 0;
try
{
for (final Entry<String, Point> entry : nameToPoint.entrySet())
{
final String name = entry.getKey();
final Point location = entry.getValue();
final String enumName = createEnumName(name);
writer.write("\n\n");
writer.write(enumName);
writer.write("(\"");
writer.write(name);
writer.write("\", ");
writer.write(String.valueOf(location.x));
writer.write(", ");
writer.write(String.valueOf(location.y));
writer.write(")");
if (count < (size - 1))
{
writer.write(",");
}
else
{
writer.write(";");
}
writer.write("\n");
count++;
}
}
catch (final IOException e)
{
throw new RuntimeException(e);
}
finally
{
final FileUtilities fileUtils = new FileUtilities();
fileUtils.close(reader);
}
} | void function() { final XMLReader xmlReader = new XMLReader(); final Element doc = xmlReader.read(reader); final NodeList nodeList = doc.getElementsByTagName(STR); int size = nodeList.getLength(); final Map<String, Point> nameToPoint = new TreeMap<String, Point>(); for (int i = 0; i < size; i++) { final Node node = nodeList.item(i); final Node nameNode = node.getFirstChild(); final String name = nameNode.getTextContent().trim(); final Node locationNode = node.getFirstChild().getNextSibling().getNextSibling(); final String xString = locationNode.getAttributes().getNamedItem("X").getTextContent(); final int x = Integer.parseInt(xString); final String yString = locationNode.getAttributes().getNamedItem("Y").getTextContent(); final int y = Integer.parseInt(yString); nameToPoint.put(name, new Point(x, y)); } size = nameToPoint.size(); int count = 0; try { for (final Entry<String, Point> entry : nameToPoint.entrySet()) { final String name = entry.getKey(); final Point location = entry.getValue(); final String enumName = createEnumName(name); writer.write("\n\n"); writer.write(enumName); writer.write("(\"STR\STR); writer.write(String.valueOf(location.x)); writer.write(STR); writer.write(String.valueOf(location.y)); writer.write(")"); if (count < (size - 1)) { writer.write(","); } else { writer.write(";"); } writer.write("\n"); count++; } } catch (final IOException e) { throw new RuntimeException(e); } finally { final FileUtilities fileUtils = new FileUtilities(); fileUtils.close(reader); } } | /**
* Generate enums.
*/ | Generate enums | generate | {
"repo_name": "jmthompson2015/vizzini",
"path": "game/illyriad/src/main/java/org/vizzini/illyriad/TradeHubEnumGenerator.java",
"license": "mit",
"size": 4462
} | [
"java.awt.Point",
"java.io.IOException",
"java.util.Map",
"java.util.TreeMap",
"org.vizzini.core.XMLReader",
"org.w3c.dom.Element",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import java.awt.Point; import java.io.IOException; import java.util.Map; import java.util.TreeMap; import org.vizzini.core.XMLReader; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import java.awt.*; import java.io.*; import java.util.*; import org.vizzini.core.*; import org.w3c.dom.*; | [
"java.awt",
"java.io",
"java.util",
"org.vizzini.core",
"org.w3c.dom"
] | java.awt; java.io; java.util; org.vizzini.core; org.w3c.dom; | 1,787,364 |
public void addChangeListener(PropertyChangeListener listener) {
jobExecutorStateChangeSupport.addPropertyChangeListener(listener);
} | void function(PropertyChangeListener listener) { jobExecutorStateChangeSupport.addPropertyChangeListener(listener); } | /**
* Adds a listener for general task execution state (how many tasks are running etc).
*/ | Adds a listener for general task execution state (how many tasks are running etc) | addChangeListener | {
"repo_name": "chipster/chipster",
"path": "src/main/java/fi/csc/microarray/client/tasks/TaskExecutor.java",
"license": "mit",
"size": 22296
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 2,785,001 |
public void countUserBindings() throws Exception {
GroupSpaceBinding groupSpaceBinding = this.getGroupSpaceBindingInstance(1, spaceId, "/platform/administrators");
groupSpaceBinding = groupSpaceBindingStorage.saveGroupSpaceBinding(groupSpaceBinding);
tearDownGroupbindingList.add(groupSpaceBinding);
UserSpaceBinding userSpaceBinding = this.getUserBindingInstance(1, "john", groupSpaceBinding);
userSpaceBinding = groupSpaceBindingStorage.saveUserBinding(userSpaceBinding);
tearDownUserbindingList.add(userSpaceBinding);
assertEquals("groupSpaceBindingStorage.countUserBindings(" + spaceId + ",'john') must return 1 ",
1,
groupSpaceBindingStorage.countUserBindings(spaceId, "john"));
assertEquals("groupSpaceBindingStorage.countUserBindings(" + spaceId + ",'mary') must return 0 ",
0,
groupSpaceBindingStorage.countUserBindings(spaceId, "mary"));
}
/**
* Test
* {@link org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage#findUserAllBindingsbyGroup(String)} | void function() throws Exception { GroupSpaceBinding groupSpaceBinding = this.getGroupSpaceBindingInstance(1, spaceId, STR); groupSpaceBinding = groupSpaceBindingStorage.saveGroupSpaceBinding(groupSpaceBinding); tearDownGroupbindingList.add(groupSpaceBinding); UserSpaceBinding userSpaceBinding = this.getUserBindingInstance(1, "john", groupSpaceBinding); userSpaceBinding = groupSpaceBindingStorage.saveUserBinding(userSpaceBinding); tearDownUserbindingList.add(userSpaceBinding); assertEquals(STR + spaceId + STR, 1, groupSpaceBindingStorage.countUserBindings(spaceId, "john")); assertEquals(STR + spaceId + STR, 0, groupSpaceBindingStorage.countUserBindings(spaceId, "mary")); } /** * Test * {@link org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage#findUserAllBindingsbyGroup(String)} | /**
* Test
* {@link org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage#getUserBindings(String, String)}
*
* @throws Exception
**/ | Test <code>org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage#getUserBindings(String, String)</code> | countUserBindings | {
"repo_name": "exodev/social",
"path": "component/core/src/test/java/org/exoplatform/social/core/binding/spi/RDBMSGroupSpaceBindingStorageTest.java",
"license": "lgpl-3.0",
"size": 21805
} | [
"org.exoplatform.social.core.binding.model.GroupSpaceBinding",
"org.exoplatform.social.core.binding.model.UserSpaceBinding",
"org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage"
] | import org.exoplatform.social.core.binding.model.GroupSpaceBinding; import org.exoplatform.social.core.binding.model.UserSpaceBinding; import org.exoplatform.social.core.storage.api.GroupSpaceBindingStorage; | import org.exoplatform.social.core.binding.model.*; import org.exoplatform.social.core.storage.api.*; | [
"org.exoplatform.social"
] | org.exoplatform.social; | 2,577,618 |
ToStringContext<NAMETYPE> parent();
class EmptyStringContext<NAMETYPE extends Name> implements ToStringContext<NAMETYPE> {
@Override
public String getBinding(String name) { return null; } | ToStringContext<NAMETYPE> parent(); class EmptyStringContext<NAMETYPE extends Name> implements ToStringContext<NAMETYPE> { public String getBinding(String name) { return null; } | /**
* Returns the parent context of this (the context we're in scope of when this is created),
* or null if this is the root.
*/ | Returns the parent context of this (the context we're in scope of when this is created), or null if this is the root | parent | {
"repo_name": "vespa-engine/vespa",
"path": "vespajlib/src/main/java/com/yahoo/tensor/functions/ToStringContext.java",
"license": "apache-2.0",
"size": 1386
} | [
"com.yahoo.tensor.evaluation.Name"
] | import com.yahoo.tensor.evaluation.Name; | import com.yahoo.tensor.evaluation.*; | [
"com.yahoo.tensor"
] | com.yahoo.tensor; | 2,475,850 |
protected String getVfsPrefix() {
if (null == m_vfsPrefix) {
m_vfsPrefix = OpenCms.getStaticExportManager().getVfsPrefix();
}
return m_vfsPrefix;
} | String function() { if (null == m_vfsPrefix) { m_vfsPrefix = OpenCms.getStaticExportManager().getVfsPrefix(); } return m_vfsPrefix; } | /**
* Initializes m_vfsPrefix lazily, otherwise it does not work.
* @return the VFS prefix as added to internal links
*/ | Initializes m_vfsPrefix lazily, otherwise it does not work | getVfsPrefix | {
"repo_name": "gallardo/opencms-core",
"path": "test/org/opencms/xml/content/TestCmsXmlContentWithVfs.java",
"license": "lgpl-2.1",
"size": 110539
} | [
"org.opencms.main.OpenCms"
] | import org.opencms.main.OpenCms; | import org.opencms.main.*; | [
"org.opencms.main"
] | org.opencms.main; | 389,544 |
public boolean isNear( Point2D q ) {
if ( waypoints.length == 0 )
return false;
return isNear( q, 0, waypoints.length - 1 );
}
private static class Segment {
int first;
int last;
int closest;
public Segment() {
this(-1, -2);
}
public Segment(int first, int last) {
this.first = first;
this.last = last;
closest = -1;
} | boolean function( Point2D q ) { if ( waypoints.length == 0 ) return false; return isNear( q, 0, waypoints.length - 1 ); } private static class Segment { int first; int last; int closest; public Segment() { this(-1, -2); } public Segment(int first, int last) { this.first = first; this.last = last; closest = -1; } | /**
* Determine if the given waypoint is within the target distance from any point in the sequence.
* @param q
* @return true if the waypoint is near the sequence, otherwise false.
*/ | Determine if the given waypoint is within the target distance from any point in the sequence | isNear | {
"repo_name": "melato/next-bus",
"path": "src/org/melato/geometry/gpx/ProximityFinder.java",
"license": "gpl-3.0",
"size": 11333
} | [
"org.melato.gps.Point2D"
] | import org.melato.gps.Point2D; | import org.melato.gps.*; | [
"org.melato.gps"
] | org.melato.gps; | 1,524,779 |
public DocumentMutation setOrReplace(@NonNullable FieldPath path, @NonNullable Document doc); | DocumentMutation function(@NonNullable FieldPath path, @NonNullable Document doc); | /**
* Sets or replaces the field at the given FieldPath to the specified
* {@code Document}.
*
* @param path path of the field that needs to be updated
* @param doc the new value to set at the FieldPath
* @return {@code this} for chained invocation
*/ | Sets or replaces the field at the given FieldPath to the specified Document | setOrReplace | {
"repo_name": "ojai/ojai",
"path": "java/core/src/main/java/org/ojai/store/DocumentMutation.java",
"license": "apache-2.0",
"size": 47815
} | [
"org.ojai.Document",
"org.ojai.FieldPath",
"org.ojai.annotation.API"
] | import org.ojai.Document; import org.ojai.FieldPath; import org.ojai.annotation.API; | import org.ojai.*; import org.ojai.annotation.*; | [
"org.ojai",
"org.ojai.annotation"
] | org.ojai; org.ojai.annotation; | 2,771,533 |
try {
CReilInstructionDialog.show(parent, codeNode);
} catch (final InternalTranslationException exception) {
CUtilityFunctions.logException(exception);
final String message = "E00XXX: " + "Could not show REIL code";
final String description =
CUtilityFunctions.createDescription(
String.format("BinNavi could not show the REIL code of node at '%X'.",
codeNode.getAddress()),
new String[] {"The node could not be converted to REIL code."},
new String[] {"You can not fix this problem yourself. Please contact the "
+ "BinNavi support."});
NaviErrorDialog.show(parent, message, description, exception);
}
} | try { CReilInstructionDialog.show(parent, codeNode); } catch (final InternalTranslationException exception) { CUtilityFunctions.logException(exception); final String message = STR + STR; final String description = CUtilityFunctions.createDescription( String.format(STR, codeNode.getAddress()), new String[] {STR}, new String[] {STR + STR}); NaviErrorDialog.show(parent, message, description, exception); } } | /**
* Shows the REIL code for a code node.
*
* @param parent Parent window used for dialogs.
* @param codeNode The code node whose REIL code is shown.
*/ | Shows the REIL code for a code node | showReilCode | {
"repo_name": "google/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/ZyGraph/Implementations/CInstructionFunctions.java",
"license": "apache-2.0",
"size": 3382
} | [
"com.google.security.zynamics.binnavi.CUtilityFunctions",
"com.google.security.zynamics.binnavi.Gui",
"com.google.security.zynamics.reil.translators.InternalTranslationException"
] | import com.google.security.zynamics.binnavi.CUtilityFunctions; import com.google.security.zynamics.binnavi.Gui; import com.google.security.zynamics.reil.translators.InternalTranslationException; | import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.reil.translators.*; | [
"com.google.security"
] | com.google.security; | 1,749,931 |
protected Transformation<RowData> createSourceFunctionTransformation(
StreamExecutionEnvironment env,
SourceFunction<RowData> function,
boolean isBounded,
String operatorName,
TypeInformation<RowData> outputTypeInfo) {
env.clean(function);
final int parallelism;
if (function instanceof ParallelSourceFunction) {
parallelism = env.getParallelism();
} else {
parallelism = 1;
}
final Boundedness boundedness;
if (isBounded) {
boundedness = Boundedness.BOUNDED;
} else {
boundedness = Boundedness.CONTINUOUS_UNBOUNDED;
}
final StreamSource<RowData, ?> sourceOperator = new StreamSource<>(function, !isBounded);
return new LegacySourceTransformation<>(
operatorName, sourceOperator, outputTypeInfo, parallelism, boundedness);
} | Transformation<RowData> function( StreamExecutionEnvironment env, SourceFunction<RowData> function, boolean isBounded, String operatorName, TypeInformation<RowData> outputTypeInfo) { env.clean(function); final int parallelism; if (function instanceof ParallelSourceFunction) { parallelism = env.getParallelism(); } else { parallelism = 1; } final Boundedness boundedness; if (isBounded) { boundedness = Boundedness.BOUNDED; } else { boundedness = Boundedness.CONTINUOUS_UNBOUNDED; } final StreamSource<RowData, ?> sourceOperator = new StreamSource<>(function, !isBounded); return new LegacySourceTransformation<>( operatorName, sourceOperator, outputTypeInfo, parallelism, boundedness); } | /**
* Adopted from {@link StreamExecutionEnvironment#addSource(SourceFunction, String,
* TypeInformation)} but with custom {@link Boundedness}.
*/ | Adopted from <code>StreamExecutionEnvironment#addSource(SourceFunction, String, TypeInformation)</code> but with custom <code>Boundedness</code> | createSourceFunctionTransformation | {
"repo_name": "StephanEwen/incubator-flink",
"path": "flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/plan/nodes/exec/common/CommonExecTableSourceScan.java",
"license": "apache-2.0",
"size": 7740
} | [
"org.apache.flink.api.common.typeinfo.TypeInformation",
"org.apache.flink.api.connector.source.Boundedness",
"org.apache.flink.api.dag.Transformation",
"org.apache.flink.streaming.api.environment.StreamExecutionEnvironment",
"org.apache.flink.streaming.api.functions.source.ParallelSourceFunction",
"org.apache.flink.streaming.api.functions.source.SourceFunction",
"org.apache.flink.streaming.api.operators.StreamSource",
"org.apache.flink.streaming.api.transformations.LegacySourceTransformation",
"org.apache.flink.table.data.RowData"
] | import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.connector.source.Boundedness; import org.apache.flink.api.dag.Transformation; import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment; import org.apache.flink.streaming.api.functions.source.ParallelSourceFunction; import org.apache.flink.streaming.api.functions.source.SourceFunction; import org.apache.flink.streaming.api.operators.StreamSource; import org.apache.flink.streaming.api.transformations.LegacySourceTransformation; import org.apache.flink.table.data.RowData; | import org.apache.flink.api.common.typeinfo.*; import org.apache.flink.api.connector.source.*; import org.apache.flink.api.dag.*; import org.apache.flink.streaming.api.environment.*; import org.apache.flink.streaming.api.functions.source.*; import org.apache.flink.streaming.api.operators.*; import org.apache.flink.streaming.api.transformations.*; import org.apache.flink.table.data.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,561,960 |
public static boolean hasController(HasMetadata resource) {
return getControllerUid(resource) != null;
} | static boolean function(HasMetadata resource) { return getControllerUid(resource) != null; } | /**
* Checks whether the resource has some controller(parent) or not.
*
* @param resource resource
* @return boolean value indicating whether it's a child or not.
*/ | Checks whether the resource has some controller(parent) or not | hasController | {
"repo_name": "fabric8io/kubernetes-client",
"path": "kubernetes-client-api/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java",
"license": "apache-2.0",
"size": 14662
} | [
"io.fabric8.kubernetes.api.model.HasMetadata"
] | import io.fabric8.kubernetes.api.model.HasMetadata; | import io.fabric8.kubernetes.api.model.*; | [
"io.fabric8.kubernetes"
] | io.fabric8.kubernetes; | 410,615 |
public List<ResourceReference> getResourceDependencies( JobMeta jobMeta ) {
return new ArrayList<ResourceReference>( 5 ); // default: return an empty resource dependency list. Lower the
// initial capacity
} | List<ResourceReference> function( JobMeta jobMeta ) { return new ArrayList<ResourceReference>( 5 ); } | /**
* Gets a list of all the resource dependencies that the step is depending on. In JobEntryBase, this method returns an
* empty resource dependency list.
*
* @return an empty list of ResourceReferences
* @see ResourceReference
*/ | Gets a list of all the resource dependencies that the step is depending on. In JobEntryBase, this method returns an empty resource dependency list | getResourceDependencies | {
"repo_name": "apratkin/pentaho-kettle",
"path": "engine/src/org/pentaho/di/job/entry/JobEntryBase.java",
"license": "apache-2.0",
"size": 41980
} | [
"java.util.ArrayList",
"java.util.List",
"org.pentaho.di.job.JobMeta",
"org.pentaho.di.resource.ResourceReference"
] | import java.util.ArrayList; import java.util.List; import org.pentaho.di.job.JobMeta; import org.pentaho.di.resource.ResourceReference; | import java.util.*; import org.pentaho.di.job.*; import org.pentaho.di.resource.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 1,989,425 |
loadUrl(NOTIFICATION_TEST_PAGE);
setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW);
Notification notification = showAndGetNotification("MyNotification", "{ body: 'Hello' }");
// Validate the contents of the notification.
assertEquals("MyNotification", notification.extras.getString(Notification.EXTRA_TITLE));
assertEquals("Hello", notification.extras.getString(Notification.EXTRA_TEXT));
assertEquals(UrlUtilities.formatUrlForSecurityDisplay(getOrigin(), false ),
notification.extras.getString(Notification.EXTRA_SUB_TEXT));
// Verify that the ticker text contains the notification's title and body.
String tickerText = notification.tickerText.toString();
assertTrue(tickerText.contains("MyNotification"));
assertTrue(tickerText.contains("Hello"));
// Validate the appearance style of the notification. The EXTRA_TEMPLATE was introduced
// in Android Lollipop, we cannot verify this in earlier versions.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
&& !NotificationUIManager.useCustomLayouts()) {
assertEquals("android.app.Notification$BigTextStyle",
notification.extras.getString(Notification.EXTRA_TEMPLATE));
}
assertNotNull(notification.largeIcon);
// Validate the notification's behavior.
assertEquals(Notification.DEFAULT_ALL, notification.defaults);
assertEquals(Notification.PRIORITY_DEFAULT, notification.priority);
} | loadUrl(NOTIFICATION_TEST_PAGE); setNotificationContentSettingForCurrentOrigin(ContentSetting.ALLOW); Notification notification = showAndGetNotification(STR, STR); assertEquals(STR, notification.extras.getString(Notification.EXTRA_TITLE)); assertEquals("Hello", notification.extras.getString(Notification.EXTRA_TEXT)); assertEquals(UrlUtilities.formatUrlForSecurityDisplay(getOrigin(), false ), notification.extras.getString(Notification.EXTRA_SUB_TEXT)); String tickerText = notification.tickerText.toString(); assertTrue(tickerText.contains(STR)); assertTrue(tickerText.contains("Hello")); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && !NotificationUIManager.useCustomLayouts()) { assertEquals(STR, notification.extras.getString(Notification.EXTRA_TEMPLATE)); } assertNotNull(notification.largeIcon); assertEquals(Notification.DEFAULT_ALL, notification.defaults); assertEquals(Notification.PRIORITY_DEFAULT, notification.priority); } | /**
* Verifies that the intended default properties of a notification will indeed be set on the
* Notification object that will be send to Android.
*/ | Verifies that the intended default properties of a notification will indeed be set on the Notification object that will be send to Android | testDefaultNotificationProperties | {
"repo_name": "js0701/chromium-crosswalk",
"path": "chrome/android/javatests/src/org/chromium/chrome/browser/notifications/NotificationUIManagerTest.java",
"license": "bsd-3-clause",
"size": 14563
} | [
"android.app.Notification",
"android.os.Build",
"org.chromium.chrome.browser.preferences.website.ContentSetting",
"org.chromium.chrome.browser.util.UrlUtilities"
] | import android.app.Notification; import android.os.Build; import org.chromium.chrome.browser.preferences.website.ContentSetting; import org.chromium.chrome.browser.util.UrlUtilities; | import android.app.*; import android.os.*; import org.chromium.chrome.browser.preferences.website.*; import org.chromium.chrome.browser.util.*; | [
"android.app",
"android.os",
"org.chromium.chrome"
] | android.app; android.os; org.chromium.chrome; | 763,296 |
public TestResult[] getBadChecksumTests() {
return badChecksumTests;
} | TestResult[] function() { return badChecksumTests; } | /**
* Get a list of tests that had bad checksums during the analysis.
* @return A set of tests, or null if none.
*/ | Get a list of tests that had bad checksums during the analysis | getBadChecksumTests | {
"repo_name": "Distrotech/icedtea7-2.3",
"path": "test/jtreg/com/sun/javatest/audit/Audit.java",
"license": "gpl-2.0",
"size": 27280
} | [
"com.sun.javatest.TestResult"
] | import com.sun.javatest.TestResult; | import com.sun.javatest.*; | [
"com.sun.javatest"
] | com.sun.javatest; | 1,421,347 |
public void testSimpleJPQL() {
// Clear db first.
testSetup();
EntityManager em = createEntityManager();
try {
// all
Query query = em.createQuery("Select o from Order o");
List results = query.getResultList();
if (results.size() != 10) {
fail("Expected 10 results: " + results);
}
Order order = (Order)results.get(0);
// =
query = em.createQuery("Select o from Order o where o.id = :oid");
query.setParameter("oid", order.id);
results = query.getResultList();
if (results.size() != 1) {
fail("Expected 1 result: " + results);
}
// !=
query = em.createQuery("Select o from Order o where o.id <> :nextId");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 9) {
fail("Expected 9 result: " + results);
}
// in
query = em.createQuery("Select o from Order o where o.orderedBy in (:by, :by)");
query.setParameter("by", "ACME");
results = query.getResultList();
if (results.size() != 10) {
fail("Expected 1 result: " + results);
}
// nin
query = em.createQuery("Select o from Order o where o.orderedBy not in (:by, :by)");
query.setParameter("by", "ACME");
results = query.getResultList();
if (results.size() != 0) {
fail("Expected 0 result: " + results);
}
// and
query = em.createQuery("Select o from Order o where o.id = :nextId and o.orderedBy = 'ACME'");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 1) {
fail("Expected 1 result: " + results);
}
// or
query = em.createQuery("Select o from Order o where o.id = :nextId or o.orderedBy = 'ACME'");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 10) {
fail("Expected 10 result: " + results);
}
// not
query = em.createQuery("Select o from Order o where o.id = :nextId or not(o.orderedBy = 'ACME')");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 1) {
fail("Expected 1 result: " + results);
}
// > <
query = em.createQuery("Select o from Order o where o.id > :nextId and o.id < :nextId");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 0) {
fail("Expected 0 result: " + results);
}
// >= <=
query = em.createQuery("Select o from Order o where o.id >= :nextId and o.id <= :nextId");
query.setParameter("nextId", order.id);
results = query.getResultList();
if (results.size() != 1) {
fail("Expected 1 result: " + results);
}
} finally {
closeEntityManager(em);
}
} | void function() { testSetup(); EntityManager em = createEntityManager(); try { Query query = em.createQuery(STR); List results = query.getResultList(); if (results.size() != 10) { fail(STR + results); } Order order = (Order)results.get(0); query = em.createQuery(STR); query.setParameter("oid", order.id); results = query.getResultList(); if (results.size() != 1) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 9) { fail(STR + results); } query = em.createQuery(STR); query.setParameter("by", "ACME"); results = query.getResultList(); if (results.size() != 10) { fail(STR + results); } query = em.createQuery(STR); query.setParameter("by", "ACME"); results = query.getResultList(); if (results.size() != 0) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 1) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 10) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 1) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 0) { fail(STR + results); } query = em.createQuery(STR); query.setParameter(STR, order.id); results = query.getResultList(); if (results.size() != 1) { fail(STR + results); } } finally { closeEntityManager(em); } } | /**
* Test JPQL.
*/ | Test JPQL | testSimpleJPQL | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "foundation/eclipselink.extension.nosql.test/src/org/eclipse/persistence/testing/tests/jpa/mongo/MongoTestSuite.java",
"license": "epl-1.0",
"size": 30664
} | [
"java.util.List",
"javax.persistence.EntityManager",
"javax.persistence.Query",
"org.eclipse.persistence.testing.models.jpa.mongo.Order"
] | import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; import org.eclipse.persistence.testing.models.jpa.mongo.Order; | import java.util.*; import javax.persistence.*; import org.eclipse.persistence.testing.models.jpa.mongo.*; | [
"java.util",
"javax.persistence",
"org.eclipse.persistence"
] | java.util; javax.persistence; org.eclipse.persistence; | 2,096,737 |
public static void bbSmileytoEmoji(SpannableStringBuilder ssb){
//Take care of emoticons that have others as their prefix, ie. :ohnoes:, :ohno:, :omg:
//:ohno: is a prefix of :ohnoes: and :o is a prefix of all 3
String[] conflicts = {":ohnoes:", ":ohno:", ":omg:"};
for (String emoticon : conflicts){
String emoji = emojisBB.get(emoticon);
for (int i = WhatBBParser.indexOf(ssb, emoticon); i != -1; i = WhatBBParser.indexOf(ssb, emoticon, i)){
ssb.replace(i, i + emoticon.length(), emoji);
}
}
for (Map.Entry<String, String> e : emojisBB.entrySet()){
for (int i = WhatBBParser.indexOf(ssb, e.getKey()); i != -1; i = WhatBBParser.indexOf(ssb, e.getKey(), i)){
ssb.replace(i, i + e.getKey().length(), e.getValue());
}
}
}
static{
emojisHtml = new HashMap<String, Pattern>();
emojisHtml.put("😡", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/(angry|paddle).gif\"[^>]*>)"));
emojisHtml.put("😄", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/biggrin.gif\"[^>]*>)"));
emojisHtml.put("😐", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/blank.gif\"[^>]*>)"));
emojisHtml.put("😳", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/blush.gif\"[^>]*>)"));
emojisHtml.put("😎", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/cool.gif\"[^>]*>)"));
emojisHtml.put("😢", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/(crying|sad|sorry).gif\"[^>]*>)"));
emojisHtml.put("😙", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/eyesright.gif\"[^>]*>)"));
emojisHtml.put("😏", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/creepy.gif\"[^>]*>)"));
emojisHtml.put("😞", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/(frown|no).gif\"[^>]*>)"));
emojisHtml.put("❤", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/heart.gif\"[^>]*>)"));
emojisHtml.put("😔", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/hmm.gif\"[^>]*>)"));
emojisHtml.put("❤ What.CD", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/ilu.gif\"[^>]*>)"));
emojisHtml.put("😆", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/laughing.gif\"[^>]*>)"));
emojisHtml.put("❤ FLAC", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/loveflac.gif\"[^>]*>)"));
emojisHtml.put("😷", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/ninja.gif\"[^>]*>)"));
emojisHtml.put("😁", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/nod.gif\"[^>]*>)"));
emojisHtml.put("😨", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/ohnoes.gif\"[^>]*>)"));
emojisHtml.put("😲", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/(omg|ohshit|wtf).gif\"[^>]*>)"));
emojisHtml.put("😒", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/shifty.gif\"[^>]*>)"));
emojisHtml.put("😣", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/sick.gif\"[^>]*>)"));
emojisHtml.put("😊", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/smile.gif\"[^>]*>)"));
emojisHtml.put("😄 Thanks!", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/thanks.gif\"[^>]*>)"));
emojisHtml.put("😋", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/tongue.gif\"[^>]*>)"));
emojisHtml.put("👋", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/wave.gif\"[^>]*>)"));
emojisHtml.put("😉", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/wink.gif\"[^>]*>)"));
emojisHtml.put("😓", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/worried.gif\"[^>]*>)"));
emojisHtml.put("😍", Pattern.compile("(<img [^>]*src=\"[^\"]+smileys/wub.gif\"[^>]*>)"));
emojisBB = new HashMap<String, String>();
emojisBB.put(":angry:", "\uD83D\uDE21");
emojisBB.put(":paddle:", "\uD83D\uDE21");
emojisBB.put(":D", "\uD83D\uDE04");
emojisBB.put(":-D", "\uD83D\uDE04");
emojisBB.put(":|", "\uD83D\uDE10");
emojisBB.put(":-|", "\uD83D\uDE10");
emojisBB.put(":blush:", "\uD83D\uDE33");
emojisBB.put(":cool:", "\uD83D\uDE0E");
emojisBB.put(":'(", "\uD83D\uDE22");
emojisBB.put(":sorry:", "\uD83D\uDE22");
emojisBB.put(">.>", "\uD83D\uDE19");
emojisBB.put(":creepy:", "\uD83D\uDE0F");
emojisBB.put(":frown:", "\uD83D\uDE20");
emojisBB.put("<3", "\u2764\uFE0F");
emojisBB.put(":unsure:", "\uD83D\uDE1F");
emojisBB.put(":no:", "\uD83D\uDE1F");
emojisBB.put(":whatlove:", "\u2764\uFE0F What.CD");
emojisBB.put(":lol:", "\uD83D\uDE06");
emojisBB.put(":loveflac:", "\u2764\uFE0F FLAC");
emojisBB.put(":flaclove:", "\u2764\uFE0F FLAC");
emojisBB.put(":ninja:", "\uD83D\uDE37");
emojisBB.put(":nod:", "\uD83D\uDE0A");
emojisBB.put(":ohno:", "\uD83D\uDE27");
emojisBB.put(":ohnoes:", "\uD83D\uDE27");
emojisBB.put(":omg:", "\uD83D\uDE32");
emojisBB.put(":o", "\uD83D\uDE32");
emojisBB.put(":O", "\uD83D\uDE32");
emojisBB.put(":wtf:", "\uD83D\uDE32");
emojisBB.put(":(", "\uD83D\uDE1E");
emojisBB.put(":-(", "\uD83D\uDE1E");
emojisBB.put(":shifty:", "\uD83D\uDE12");
emojisBB.put(":sick:", "\uD83D\uDE30");
emojisBB.put(":)", "\uD83D\uDE00");
emojisBB.put(":-)", "\uD83D\uDE00");
emojisBB.put(":thanks:", "\uD83D\uDE04 Thanks!");
emojisBB.put(":P", "\uD83D\uDE1B");
emojisBB.put(":-P", "\uD83D\uDE1B");
emojisBB.put(":-p", "\uD83D\uDE1B");
emojisBB.put(":wave:", "\uD83D\uDC4B");
emojisBB.put(":wink:", "\uD83D\uDE09");
emojisBB.put(":worried:", "\uD83D\uDE2F");
emojisBB.put(":wub:", "\uD83D\uDE0D");
} | static void function(SpannableStringBuilder ssb){ String[] conflicts = {STR, STR, ":omg:"}; for (String emoticon : conflicts){ String emoji = emojisBB.get(emoticon); for (int i = WhatBBParser.indexOf(ssb, emoticon); i != -1; i = WhatBBParser.indexOf(ssb, emoticon, i)){ ssb.replace(i, i + emoticon.length(), emoji); } } for (Map.Entry<String, String> e : emojisBB.entrySet()){ for (int i = WhatBBParser.indexOf(ssb, e.getKey()); i != -1; i = WhatBBParser.indexOf(ssb, e.getKey(), i)){ ssb.replace(i, i + e.getKey().length(), e.getValue()); } } } static{ emojisHtml = new HashMap<String, Pattern>(); emojisHtml.put(STR, Pattern.compile(STR[^\STR[^>]*>)STR😄", Pattern.compile(STR[^\"]+smileys/biggrin.gif\"[^>]*>)STR😐", Pattern.compile(STR[^\STR[^>]*>)STR😳", Pattern.compile(STR[^\"]+smileys/blush.gif\"[^>]*>)STR😎", Pattern.compile(STR[^\STR[^>]*>)STR😢", Pattern.compile(STR[^\"]+smileys/(crying sad sorry).gif\"[^>]*>)STR😙", Pattern.compile(STR[^\STR[^>]*>)STR😏", Pattern.compile(STR[^\"]+smileys/creepy.gif\"[^>]*>)STR😞", Pattern.compile(STR[^\STR[^>]*>)STR❤", Pattern.compile(STR[^\"]+smileys/heart.gif\"[^>]*>)STR😔", Pattern.compile(STR[^\STR[^>]*>)STR❤ What.CD", Pattern.compile(STR[^\"]+smileys/ilu.gif\"[^>]*>)STR😆", Pattern.compile(STR[^\STR[^>]*>)STR❤ FLAC", Pattern.compile(STR[^\"]+smileys/loveflac.gif\"[^>]*>)STR😷", Pattern.compile(STR[^\STR[^>]*>)STR😁", Pattern.compile(STR[^\"]+smileys/nod.gif\"[^>]*>)STR😨", Pattern.compile(STR[^\STR[^>]*>)STR😲", Pattern.compile(STR[^\"]+smileys/(omg ohshit wtf).gif\"[^>]*>)STR😒", Pattern.compile(STR[^\STR[^>]*>)STR😣", Pattern.compile(STR[^\"]+smileys/sick.gif\"[^>]*>)STR😊", Pattern.compile(STR[^\STR[^>]*>)STR😄 Thanks!", Pattern.compile(STR[^\"]+smileys/thanks.gif\"[^>]*>)STR😋", Pattern.compile(STR[^\STR[^>]*>)STR👋", Pattern.compile(STR[^\"]+smileys/wave.gif\"[^>]*>)STR😉", Pattern.compile(STR[^\STR[^>]*>)STR😓", Pattern.compile(STR[^\"]+smileys/worried.gif\"[^>]*>)STR😍", Pattern.compile(STR[^\"]+smileys/wub.gif\STR)); emojisBB = new HashMap<String, String>(); emojisBB.put(":angry:STR\uD83D\uDE21STR:paddle:STR\uD83D\uDE21STR:DSTR\uD83D\uDE04STR:-DSTR\uD83D\uDE04STR: STR\uD83D\uDE10STR:- STR\uD83D\uDE10STR:blush:STR\uD83D\uDE33STR:cool:STR\uD83D\uDE0ESTR:'(STR\uD83D\uDE22STR:sorry:STR\uD83D\uDE22STR>.>STR\uD83D\uDE19STR:creepy:STR\uD83D\uDE0FSTR:frown:STR\uD83D\uDE20STR<3STR\u2764\uFE0FSTR:unsure:STR\uD83D\uDE1FSTR:no:STR\uD83D\uDE1FSTR:whatlove:STR\u2764\uFE0F What.CDSTR:lol:STR\uD83D\uDE06STR:loveflac:STR\u2764\uFE0F FLACSTR:flaclove:STR\u2764\uFE0F FLACSTR:ninja:STR\uD83D\uDE37STR:nod:STR\uD83D\uDE0A"); emojisBB.put(STR, "\uD83D\uDE27"); emojisBB.put(STR, "\uD83D\uDE27STR:omg:STR\uD83D\uDE32STR:oSTR\uD83D\uDE32STR:OSTR\uD83D\uDE32STR:wtf:STR\uD83D\uDE32STR:(STR\uD83D\uDE1ESTR:-(STR\uD83D\uDE1ESTR:shifty:STR\uD83D\uDE12STR:sick:STR\uD83D\uDE30STR:)STR\uD83D\uDE00STR:-)STR\uD83D\uDE00STR:thanks:STR\uD83D\uDE04 Thanks!STR:PSTR\uD83D\uDE1BSTR:-PSTR\uD83D\uDE1BSTR:-pSTR\uD83D\uDE1BSTR:wave:STR\uD83D\uDC4BSTR:wink:STR\uD83D\uDE09STR:worried:STR\uD83D\uDE2FSTR:wub:STR\uD83D\uDE0D"); } | /**
* Find site bb formatted smilies in the text and convert them to emoji characters in the text
* and the spannable string
*
* @param ssb spannable string to convert emojis in
*/ | Find site bb formatted smilies in the text and convert them to emoji characters in the text and the spannable string | bbSmileytoEmoji | {
"repo_name": "stuxo/WhatAndroid",
"path": "WhatAndroid/src/main/java/what/whatandroid/comments/SmileyProcessor.java",
"license": "bsd-2-clause",
"size": 6839
} | [
"android.text.SpannableStringBuilder",
"java.util.HashMap",
"java.util.Map",
"java.util.regex.Pattern"
] | import android.text.SpannableStringBuilder; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; | import android.text.*; import java.util.*; import java.util.regex.*; | [
"android.text",
"java.util"
] | android.text; java.util; | 1,795,727 |
private PointF transformCoordTouchToBitmap(float x, float y, boolean clipToBitmap) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float finalX = ((x - transX) * origW) / getImageWidth();
float finalY = ((y - transY) * origH) / getImageHeight();
if (clipToBitmap) {
finalX = Math.min(Math.max(finalX, 0), origW);
finalY = Math.min(Math.max(finalY, 0), origH);
}
return new PointF(finalX , finalY);
} | PointF function(float x, float y, boolean clipToBitmap) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float transX = m[Matrix.MTRANS_X]; float transY = m[Matrix.MTRANS_Y]; float finalX = ((x - transX) * origW) / getImageWidth(); float finalY = ((y - transY) * origH) / getImageHeight(); if (clipToBitmap) { finalX = Math.min(Math.max(finalX, 0), origW); finalY = Math.min(Math.max(finalY, 0), origH); } return new PointF(finalX , finalY); } | /**
* This function will transform the coordinates in the touch event to the coordinate
* system of the drawable that the imageview contain
* @param x x-coordinate of touch event
* @param y y-coordinate of touch event
* @param clipToBitmap Touch event may occur within view, but outside image content. True, to clip return value
* to the bounds of the bitmap size.
* @return Coordinates of the point touched, in the coordinate system of the original drawable.
*/ | This function will transform the coordinates in the touch event to the coordinate system of the drawable that the imageview contain | transformCoordTouchToBitmap | {
"repo_name": "gianei/SmartCatalogSPL",
"path": "core/src/main/java/com/glsebastiany/smartcatalogspl/core/presentation/widget/TouchImageView.java",
"license": "gpl-3.0",
"size": 43480
} | [
"android.graphics.Matrix",
"android.graphics.PointF"
] | import android.graphics.Matrix; import android.graphics.PointF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,871,227 |
@Deployment(order = 1)
private ResourceAdapterArchive createResourceAdapter() throws Throwable
{
return ResourceAdapterFactory.createUnifiedSecurityRar();
} | @Deployment(order = 1) ResourceAdapterArchive function() throws Throwable { return ResourceAdapterFactory.createUnifiedSecurityRar(); } | /**
* The resource adapter
*
* @throws Throwable In case of an error
*/ | The resource adapter | createResourceAdapter | {
"repo_name": "jandsu/ironjacamar",
"path": "testsuite/src/test/java/org/ironjacamar/core/connectionmanager/pool/dflt/FlushFailingConnectionOnlyTestCase.java",
"license": "epl-1.0",
"size": 6221
} | [
"org.ironjacamar.embedded.Deployment",
"org.ironjacamar.rars.ResourceAdapterFactory",
"org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive"
] | import org.ironjacamar.embedded.Deployment; import org.ironjacamar.rars.ResourceAdapterFactory; import org.jboss.shrinkwrap.api.spec.ResourceAdapterArchive; | import org.ironjacamar.embedded.*; import org.ironjacamar.rars.*; import org.jboss.shrinkwrap.api.spec.*; | [
"org.ironjacamar.embedded",
"org.ironjacamar.rars",
"org.jboss.shrinkwrap"
] | org.ironjacamar.embedded; org.ironjacamar.rars; org.jboss.shrinkwrap; | 285,105 |
public ModelNode execute(ModelNode request) throws Exception {
ModelControllerClient mcc = getModelControllerClient();
return mcc.execute(request, OperationMessageHandler.logging);
} | ModelNode function(ModelNode request) throws Exception { ModelControllerClient mcc = getModelControllerClient(); return mcc.execute(request, OperationMessageHandler.logging); } | /**
* Convienence method that executes the request.
*
* @param request request to execute
* @return results results of execution
* @throws Exception any error
*/ | Convienence method that executes the request | execute | {
"repo_name": "jsanda/hawkular-agent",
"path": "hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/JBossASClient.java",
"license": "apache-2.0",
"size": 17638
} | [
"org.jboss.as.controller.client.ModelControllerClient",
"org.jboss.as.controller.client.OperationMessageHandler",
"org.jboss.dmr.ModelNode"
] | import org.jboss.as.controller.client.ModelControllerClient; import org.jboss.as.controller.client.OperationMessageHandler; import org.jboss.dmr.ModelNode; | import org.jboss.as.controller.client.*; import org.jboss.dmr.*; | [
"org.jboss.as",
"org.jboss.dmr"
] | org.jboss.as; org.jboss.dmr; | 681,428 |
public BigFraction subtract(final long l) {
return subtract(BigInteger.valueOf(l));
} | BigFraction function(final long l) { return subtract(BigInteger.valueOf(l)); } | /**
* <p>
* Subtracts the value of a {@code long} from the value of this
* {@code BigFraction}, returning the result in reduced form.
* </p>
*
* @param l the {@code long} to subtract.
* @return a {@code BigFraction} instance with the resulting values.
*/ | Subtracts the value of a long from the value of this BigFraction, returning the result in reduced form. | subtract | {
"repo_name": "charles-cooper/idylfin",
"path": "src/org/apache/commons/math3/fraction/BigFraction.java",
"license": "apache-2.0",
"size": 38428
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 690,913 |
public Groups getGroups() {
if (groups == null) {
groups = accountRepository.getGroups(account);
}
return groups;
} | Groups function() { if (groups == null) { groups = accountRepository.getGroups(account); } return groups; } | /**
* Returns the value of account groups. Users list is lazy loaded from
* accounts api on demand.
*
* @return {@link #groups} - account groups
*/ | Returns the value of account groups. Users list is lazy loaded from accounts api on demand | getGroups | {
"repo_name": "ow2-xlcloud/vcms",
"path": "vcms-gui/modules/accounts/src/main/java/org/xlcloud/console/accounts/controllers/AccountBean.java",
"license": "apache-2.0",
"size": 16571
} | [
"org.xlcloud.service.Groups"
] | import org.xlcloud.service.Groups; | import org.xlcloud.service.*; | [
"org.xlcloud.service"
] | org.xlcloud.service; | 2,512,197 |
public Reader getLargeStringReader(String text) throws IOException {
long[] borders = largeStringPos.get(text);
if (borders == null)
throw new IllegalArgumentException("It's not large string");
return getLargeStringReader(borders[0], borders[1]);
}
| Reader function(String text) throws IOException { long[] borders = largeStringPos.get(text); if (borders == null) throw new IllegalArgumentException(STR); return getLargeStringReader(borders[0], borders[1]); } | /**
* Search large string position and allow to read this large string as reader.
* @param text
* @return reader substituting large strings
* @throws IOException
*/ | Search large string position and allow to read this large string as reader | getLargeStringReader | {
"repo_name": "MrCreosote/java_common",
"path": "src/us/kbase/common/service/JsonTokenStream.java",
"license": "mit",
"size": 44129
} | [
"java.io.IOException",
"java.io.Reader"
] | import java.io.IOException; import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 2,586,017 |
public static int compareDaysBetween(final Object object0, final Object object1, final boolean descending) {
try {
if (null == object0) {
return (null == object1) ? DominoUtils.EQUAL : (descending) ? DominoUtils.GREATER_THAN : DominoUtils.LESS_THAN;
} else if (null == object1) {
return (descending) ? DominoUtils.LESS_THAN : DominoUtils.GREATER_THAN;
}
final Date date0 = Dates.getDate(object0);
final Date date1 = Dates.getDate(object1);
if (null == date0) {
return (null == date1) ? DominoUtils.EQUAL : (descending) ? DominoUtils.GREATER_THAN : DominoUtils.LESS_THAN;
} else if (null == date1) {
return (descending) ? DominoUtils.LESS_THAN : DominoUtils.GREATER_THAN;
}
if (date0.equals(date1)) {
return DominoUtils.EQUAL;
} else {
final int daysbetween = Dates.getDaysBetween(date0, date1);
if (0 == daysbetween) {
return DominoUtils.EQUAL;
}
final int temp = (daysbetween > 0) ? DominoUtils.LESS_THAN : (daysbetween < 0) ? DominoUtils.GREATER_THAN
: DominoUtils.EQUAL;
return (descending) ? -1 * temp : temp;
}
} catch (final Exception e) {
DominoUtils.handleException(e);
throw new RuntimeException("EXCEPTION in Dates.compareDaysBetween()");
}
}
| static int function(final Object object0, final Object object1, final boolean descending) { try { if (null == object0) { return (null == object1) ? DominoUtils.EQUAL : (descending) ? DominoUtils.GREATER_THAN : DominoUtils.LESS_THAN; } else if (null == object1) { return (descending) ? DominoUtils.LESS_THAN : DominoUtils.GREATER_THAN; } final Date date0 = Dates.getDate(object0); final Date date1 = Dates.getDate(object1); if (null == date0) { return (null == date1) ? DominoUtils.EQUAL : (descending) ? DominoUtils.GREATER_THAN : DominoUtils.LESS_THAN; } else if (null == date1) { return (descending) ? DominoUtils.LESS_THAN : DominoUtils.GREATER_THAN; } if (date0.equals(date1)) { return DominoUtils.EQUAL; } else { final int daysbetween = Dates.getDaysBetween(date0, date1); if (0 == daysbetween) { return DominoUtils.EQUAL; } final int temp = (daysbetween > 0) ? DominoUtils.LESS_THAN : (daysbetween < 0) ? DominoUtils.GREATER_THAN : DominoUtils.EQUAL; return (descending) ? -1 * temp : temp; } } catch (final Exception e) { DominoUtils.handleException(e); throw new RuntimeException(STR); } } | /**
* Compares two Objects as Dates
*
* Arguments are first compared by existence, then by value.
*
* @param object0
* First date to compare.
*
* @param object1
* Second date to compare.
*
* @param descending
* flags indicating comparison order. true = descending, false = ascending.
*
* @return a negative integer, zero, or a positive integer indicating if the first object is less than, equal to, or greater than the
* second object.
*
* @throws RuntimeException
* if a failure occurs comparing object0 and object1 as Date objects.
* @see java.lang.Comparable#compareTo(Object)
* @see DominoUtils#LESS_THAN
* @see DominoUtils#EQUAL
* @see DominoUtils#GREATER_THAN
*/ | Compares two Objects as Dates Arguments are first compared by existence, then by value | compareDaysBetween | {
"repo_name": "OpenNTF/org.openntf.domino",
"path": "domino/core/src/main/java/org/openntf/domino/utils/Dates.java",
"license": "apache-2.0",
"size": 47487
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 280,256 |
public void waitWhilePresent(String cssSelector, WebDriver webDriver, long timeOutInSeconds) {
WebDriverWait webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds, calcSleepTimeMillis(timeOutInSeconds));
webDriverWait.until(ExpectedConditions.numberOfElementsToBe(By.cssSelector(cssSelector), 0));
}
| void function(String cssSelector, WebDriver webDriver, long timeOutInSeconds) { WebDriverWait webDriverWait = new WebDriverWait(webDriver, timeOutInSeconds, calcSleepTimeMillis(timeOutInSeconds)); webDriverWait.until(ExpectedConditions.numberOfElementsToBe(By.cssSelector(cssSelector), 0)); } | /**
* Wait until the selector matches zero elements
* @param cssSelector
* @param webDriver
* @param timeOutInSeconds
*/ | Wait until the selector matches zero elements | waitWhilePresent | {
"repo_name": "xtianus/yadaframework",
"path": "YadaWeb/src/main/java/net/yadaframework/selenium/YadaSeleniumUtil.java",
"license": "mit",
"size": 29078
} | [
"org.openqa.selenium.By",
"org.openqa.selenium.WebDriver",
"org.openqa.selenium.support.ui.ExpectedConditions",
"org.openqa.selenium.support.ui.WebDriverWait"
] | import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; | import org.openqa.selenium.*; import org.openqa.selenium.support.ui.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 130,570 |
protected HttpURLConnection post(String url, String body)
throws IOException {
return post(url, "application/x-www-form-urlencoded;charset=UTF-8", body);
} | HttpURLConnection function(String url, String body) throws IOException { return post(url, STR, body); } | /**
* Make an HTTP post to a given URL.
*
* @return HTTP response.
*/ | Make an HTTP post to a given URL | post | {
"repo_name": "avram/gcm",
"path": "gcm-server/src/com/google/android/gcm/server/Sender.java",
"license": "apache-2.0",
"size": 23652
} | [
"java.io.IOException",
"java.net.HttpURLConnection"
] | import java.io.IOException; import java.net.HttpURLConnection; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 304,724 |
private Node tryFoldAssignment(Node subtree) {
Preconditions.checkState(subtree.isAssign());
Node left = subtree.getFirstChild();
Node right = subtree.getLastChild();
// Only names
if (left.isName()
&& right.isName()
&& left.getString().equals(right.getString())) {
subtree.getParent().replaceChild(subtree, right.detachFromParent());
reportCodeChange();
return right;
}
return subtree;
} | Node function(Node subtree) { Preconditions.checkState(subtree.isAssign()); Node left = subtree.getFirstChild(); Node right = subtree.getLastChild(); if (left.isName() && right.isName() && left.getString().equals(right.getString())) { subtree.getParent().replaceChild(subtree, right.detachFromParent()); reportCodeChange(); return right; } return subtree; } | /**
* Try removing identity assignments
* @return the replacement node, if changed, or the original if not
*/ | Try removing identity assignments | tryFoldAssignment | {
"repo_name": "redforks/closure-compiler",
"path": "src/com/google/javascript/jscomp/PeepholeRemoveDeadCode.java",
"license": "apache-2.0",
"size": 32888
} | [
"com.google.common.base.Preconditions",
"com.google.javascript.rhino.Node"
] | import com.google.common.base.Preconditions; import com.google.javascript.rhino.Node; | import com.google.common.base.*; import com.google.javascript.rhino.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 2,793,435 |
public void paintBar(Graphics2D g2, XYBarRenderer renderer, int row,
int column, RectangularShape bar, RectangleEdge base) {
Paint itemPaint = renderer.getItemPaint(row, column);
Color c0, c1;
if (itemPaint instanceof Color) {
c0 = (Color) itemPaint;
c1 = c0.brighter();
}
else if (itemPaint instanceof GradientPaint) {
GradientPaint gp = (GradientPaint) itemPaint;
c0 = gp.getColor1();
c1 = gp.getColor2();
}
else {
c0 = Color.blue;
c1 = Color.blue.brighter();
}
// as a special case, if the bar colour has alpha == 0, we draw
// nothing.
if (c0.getAlpha() == 0) {
return;
}
if (base == RectangleEdge.TOP || base == RectangleEdge.BOTTOM) {
Rectangle2D[] regions = splitVerticalBar(bar, this.g1, this.g2,
this.g3);
GradientPaint gp = new GradientPaint((float) regions[0].getMinX(),
0.0f, c0, (float) regions[0].getMaxX(), 0.0f, Color.white);
g2.setPaint(gp);
g2.fill(regions[0]);
gp = new GradientPaint((float) regions[1].getMinX(), 0.0f,
Color.white, (float) regions[1].getMaxX(), 0.0f, c0);
g2.setPaint(gp);
g2.fill(regions[1]);
gp = new GradientPaint((float) regions[2].getMinX(), 0.0f, c0,
(float) regions[2].getMaxX(), 0.0f, c1);
g2.setPaint(gp);
g2.fill(regions[2]);
gp = new GradientPaint((float) regions[3].getMinX(), 0.0f, c1,
(float) regions[3].getMaxX(), 0.0f, c0);
g2.setPaint(gp);
g2.fill(regions[3]);
}
else if (base == RectangleEdge.LEFT || base == RectangleEdge.RIGHT) {
Rectangle2D[] regions = splitHorizontalBar(bar, this.g1, this.g2,
this.g3);
GradientPaint gp = new GradientPaint(0.0f,
(float) regions[0].getMinY(), c0, 0.0f,
(float) regions[0].getMaxX(), Color.white);
g2.setPaint(gp);
g2.fill(regions[0]);
gp = new GradientPaint(0.0f, (float) regions[1].getMinY(),
Color.white, 0.0f, (float) regions[1].getMaxY(), c0);
g2.setPaint(gp);
g2.fill(regions[1]);
gp = new GradientPaint(0.0f, (float) regions[2].getMinY(), c0,
0.0f, (float) regions[2].getMaxY(), c1);
g2.setPaint(gp);
g2.fill(regions[2]);
gp = new GradientPaint(0.0f, (float) regions[3].getMinY(), c1,
0.0f, (float) regions[3].getMaxY(), c0);
g2.setPaint(gp);
g2.fill(regions[3]);
}
// draw the outline...
if (renderer.isDrawBarOutline()
) {
Stroke stroke = renderer.getItemOutlineStroke(row, column);
Paint paint = renderer.getItemPaint(row, column);
if (stroke != null && paint != null) {
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(bar);
}
}
}
| void function(Graphics2D g2, XYBarRenderer renderer, int row, int column, RectangularShape bar, RectangleEdge base) { Paint itemPaint = renderer.getItemPaint(row, column); Color c0, c1; if (itemPaint instanceof Color) { c0 = (Color) itemPaint; c1 = c0.brighter(); } else if (itemPaint instanceof GradientPaint) { GradientPaint gp = (GradientPaint) itemPaint; c0 = gp.getColor1(); c1 = gp.getColor2(); } else { c0 = Color.blue; c1 = Color.blue.brighter(); } if (c0.getAlpha() == 0) { return; } if (base == RectangleEdge.TOP base == RectangleEdge.BOTTOM) { Rectangle2D[] regions = splitVerticalBar(bar, this.g1, this.g2, this.g3); GradientPaint gp = new GradientPaint((float) regions[0].getMinX(), 0.0f, c0, (float) regions[0].getMaxX(), 0.0f, Color.white); g2.setPaint(gp); g2.fill(regions[0]); gp = new GradientPaint((float) regions[1].getMinX(), 0.0f, Color.white, (float) regions[1].getMaxX(), 0.0f, c0); g2.setPaint(gp); g2.fill(regions[1]); gp = new GradientPaint((float) regions[2].getMinX(), 0.0f, c0, (float) regions[2].getMaxX(), 0.0f, c1); g2.setPaint(gp); g2.fill(regions[2]); gp = new GradientPaint((float) regions[3].getMinX(), 0.0f, c1, (float) regions[3].getMaxX(), 0.0f, c0); g2.setPaint(gp); g2.fill(regions[3]); } else if (base == RectangleEdge.LEFT base == RectangleEdge.RIGHT) { Rectangle2D[] regions = splitHorizontalBar(bar, this.g1, this.g2, this.g3); GradientPaint gp = new GradientPaint(0.0f, (float) regions[0].getMinY(), c0, 0.0f, (float) regions[0].getMaxX(), Color.white); g2.setPaint(gp); g2.fill(regions[0]); gp = new GradientPaint(0.0f, (float) regions[1].getMinY(), Color.white, 0.0f, (float) regions[1].getMaxY(), c0); g2.setPaint(gp); g2.fill(regions[1]); gp = new GradientPaint(0.0f, (float) regions[2].getMinY(), c0, 0.0f, (float) regions[2].getMaxY(), c1); g2.setPaint(gp); g2.fill(regions[2]); gp = new GradientPaint(0.0f, (float) regions[3].getMinY(), c1, 0.0f, (float) regions[3].getMaxY(), c0); g2.setPaint(gp); g2.fill(regions[3]); } if (renderer.isDrawBarOutline() ) { Stroke stroke = renderer.getItemOutlineStroke(row, column); Paint paint = renderer.getItemPaint(row, column); if (stroke != null && paint != null) { g2.setStroke(stroke); g2.setPaint(paint); g2.draw(bar); } } } | /**
* Paints a single bar instance.
*
* @param g2 the graphics target.
* @param renderer the renderer.
* @param row the row index.
* @param column the column index.
* @param bar the bar
* @param base indicates which side of the rectangle is the base of the
* bar.
*/ | Paints a single bar instance | paintBar | {
"repo_name": "integrated/jfreechart",
"path": "source/org/jfree/chart/renderer/xy/GradientXYBarPainter.java",
"license": "lgpl-2.1",
"size": 12909
} | [
"java.awt.Color",
"java.awt.GradientPaint",
"java.awt.Graphics2D",
"java.awt.Paint",
"java.awt.Stroke",
"java.awt.geom.Rectangle2D",
"java.awt.geom.RectangularShape",
"org.jfree.ui.RectangleEdge"
] | import java.awt.Color; import java.awt.GradientPaint; import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Stroke; import java.awt.geom.Rectangle2D; import java.awt.geom.RectangularShape; import org.jfree.ui.RectangleEdge; | import java.awt.*; import java.awt.geom.*; import org.jfree.ui.*; | [
"java.awt",
"org.jfree.ui"
] | java.awt; org.jfree.ui; | 718,882 |
@Override
public void process(WatchedEvent event) {
if (Event.EventType.None == event.getType()
&& Event.KeeperState.Expired == event.getState()) {
Set<String> keySet = new HashSet<String>(listeners.keySet());
for (String logSegmentsPath : keySet) {
scheduleTask(logSegmentsPath, new ReadLogSegmentsTask(logSegmentsPath, this), 0L);
}
return;
}
String path = event.getPath();
if (null == path) {
return;
}
switch (event.getType()) {
case NodeDeleted:
listeners.remove(path);
break;
case NodeChildrenChanged:
new ReadLogSegmentsTask(path, this).run();
break;
default:
break;
}
} | void function(WatchedEvent event) { if (Event.EventType.None == event.getType() && Event.KeeperState.Expired == event.getState()) { Set<String> keySet = new HashSet<String>(listeners.keySet()); for (String logSegmentsPath : keySet) { scheduleTask(logSegmentsPath, new ReadLogSegmentsTask(logSegmentsPath, this), 0L); } return; } String path = event.getPath(); if (null == path) { return; } switch (event.getType()) { case NodeDeleted: listeners.remove(path); break; case NodeChildrenChanged: new ReadLogSegmentsTask(path, this).run(); break; default: break; } } | /**
* Process the watched events for registered listeners
*/ | Process the watched events for registered listeners | process | {
"repo_name": "twitter/distributedlog",
"path": "distributedlog-core/src/main/java/com/twitter/distributedlog/impl/ZKLogSegmentMetadataStore.java",
"license": "apache-2.0",
"size": 13941
} | [
"java.util.HashSet",
"java.util.Set",
"org.apache.zookeeper.WatchedEvent"
] | import java.util.HashSet; import java.util.Set; import org.apache.zookeeper.WatchedEvent; | import java.util.*; import org.apache.zookeeper.*; | [
"java.util",
"org.apache.zookeeper"
] | java.util; org.apache.zookeeper; | 2,648,889 |
public final void writePingAck() throws ProtocolException {
try {
out.writeByte(MessageResponse.PING_ACK.getValue());
} catch (IOException e) {
throw new ProtocolException("I/O Error Marshaling a ProtocolAck", e);
}
} | final void function() throws ProtocolException { try { out.writeByte(MessageResponse.PING_ACK.getValue()); } catch (IOException e) { throw new ProtocolException(STR, e); } } | /**
* Writes a {@link MessageResponse#PING_ACK} into the ouput stream.
*
* @throws ProtocolException
* if there is an error in the underlying protocol
*/ | Writes a <code>MessageResponse#PING_ACK</code> into the ouput stream | writePingAck | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/modules/rmi2/src/ar/org/fitc/rmi/transport/jrmp/ServerProtocolHandler.java",
"license": "apache-2.0",
"size": 4604
} | [
"ar.org.fitc.rmi.transport.ProtocolException",
"java.io.IOException"
] | import ar.org.fitc.rmi.transport.ProtocolException; import java.io.IOException; | import ar.org.fitc.rmi.transport.*; import java.io.*; | [
"ar.org.fitc",
"java.io"
] | ar.org.fitc; java.io; | 1,404,992 |
public void setCodeTemplates(Map<String, CodeTemplate> codeTemplates) {
this.codeTemplates = codeTemplates;
} | void function(Map<String, CodeTemplate> codeTemplates) { this.codeTemplates = codeTemplates; } | /**
* Setter method for property <tt>codeTemplates</tt>.
*
* @param codeTemplates value to be assigned to property codeTemplates
*/ | Setter method for property codeTemplates | setCodeTemplates | {
"repo_name": "yunjuanyunshu-mayuan/CodeGenerate",
"path": "src/main/java/com/yunjuanyunshu/CodeMakerSettings.java",
"license": "apache-2.0",
"size": 10688
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,268,804 |
private void ageDeliveryPreds() {
double timeDiff = (SimClock.getTime() - this.lastAgeUpdate)
/ secondsInTimeUnit;
if (timeDiff == 0) {
return;
}
double mult = Math.pow(GAMMA, timeDiff);
for (Map.Entry<DTNHost, Double> e : preds.entrySet()) {
e.setValue(e.getValue() * mult);
}
this.lastAgeUpdate = SimClock.getTime();
} | void function() { double timeDiff = (SimClock.getTime() - this.lastAgeUpdate) / secondsInTimeUnit; if (timeDiff == 0) { return; } double mult = Math.pow(GAMMA, timeDiff); for (Map.Entry<DTNHost, Double> e : preds.entrySet()) { e.setValue(e.getValue() * mult); } this.lastAgeUpdate = SimClock.getTime(); } | /**
* Ages all entries in the delivery predictions.
* <CODE>P(a,b) = P(a,b)_old * (GAMMA ^ k)</CODE>, where k is number of time
* units that have elapsed since the last time the metric was aged.
*
* @see #SECONDS_IN_UNIT_S
*/ | Ages all entries in the delivery predictions. <code>P(a,b) = P(a,b)_old * (GAMMA ^ k)</code>, where k is number of time units that have elapsed since the last time the metric was aged | ageDeliveryPreds | {
"repo_name": "barun-saha/one-simulator",
"path": "one_1.5.1-RC2/routing/SnwPtuRouter.java",
"license": "gpl-3.0",
"size": 11540
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,748,379 |
public boolean isBasketEmpty() {
return basket == null || basket.isEmpty();
}
/**
* Increments the quantity of the specified item in the basket by the
* quantity sent into the method.
*
* @param item
* The {@link com.idega.block.basket.data.BasketItem BasketItem} | boolean function() { return basket == null basket.isEmpty(); } /** * Increments the quantity of the specified item in the basket by the * quantity sent into the method. * * @param item * The {@link com.idega.block.basket.data.BasketItem BasketItem} | /**
* Returns whether basket is empty or not
*
* @return boolean
*/ | Returns whether basket is empty or not | isBasketEmpty | {
"repo_name": "idega/com.idega.block.basket",
"path": "src/java/com/idega/block/basket/business/BasketBusinessBean.java",
"license": "gpl-3.0",
"size": 5773
} | [
"com.idega.block.basket.data.BasketItem"
] | import com.idega.block.basket.data.BasketItem; | import com.idega.block.basket.data.*; | [
"com.idega.block"
] | com.idega.block; | 2,805,545 |
void addMetaData(String key, String data) throws ActiveMQException; | void addMetaData(String key, String data) throws ActiveMQException; | /**
* Attach any metadata to the session.
*
* @throws ActiveMQException
*/ | Attach any metadata to the session | addMetaData | {
"repo_name": "tabish121/activemq-artemis",
"path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/client/ClientSession.java",
"license": "apache-2.0",
"size": 54407
} | [
"org.apache.activemq.artemis.api.core.ActiveMQException"
] | import org.apache.activemq.artemis.api.core.ActiveMQException; | import org.apache.activemq.artemis.api.core.*; | [
"org.apache.activemq"
] | org.apache.activemq; | 1,555,965 |
public GHCommit getCommit() throws IOException {
return getOwner().getCommit(getSHA1());
} | GHCommit function() throws IOException { return getOwner().getCommit(getSHA1()); } | /**
* Gets the commit to which this comment is associated with.
*/ | Gets the commit to which this comment is associated with | getCommit | {
"repo_name": "appbank2020/GitRobot",
"path": "src/org/kohsuke/github/GHCommitComment.java",
"license": "apache-2.0",
"size": 2776
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,195,485 |
public Task getCreationTask() throws ProcessManagerException {
try {
Task creationTask = Workflow.getTaskManager().getCreationTask(
currentUser, currentRole, processModel);
return creationTask;
} catch (WorkflowException e) {
throw new ProcessManagerException("SessionController",
"processManager.CREATION_TASK_UNAVAILABLE", e);
}
} | Task function() throws ProcessManagerException { try { Task creationTask = Workflow.getTaskManager().getCreationTask( currentUser, currentRole, processModel); return creationTask; } catch (WorkflowException e) { throw new ProcessManagerException(STR, STR, e); } } | /**
* Returns the creation task.
*/ | Returns the creation task | getCreationTask | {
"repo_name": "CecileBONIN/Silverpeas-Components",
"path": "process-manager/process-manager-war/src/main/java/com/silverpeas/processManager/ProcessManagerSessionController.java",
"license": "agpl-3.0",
"size": 73623
} | [
"com.silverpeas.workflow.api.Workflow",
"com.silverpeas.workflow.api.WorkflowException",
"com.silverpeas.workflow.api.task.Task"
] | import com.silverpeas.workflow.api.Workflow; import com.silverpeas.workflow.api.WorkflowException; import com.silverpeas.workflow.api.task.Task; | import com.silverpeas.workflow.api.*; import com.silverpeas.workflow.api.task.*; | [
"com.silverpeas.workflow"
] | com.silverpeas.workflow; | 409,911 |
// FIXME: merge with NFSv4 defaults
if (filename.length() > 256) {
throw new NameTooLongException();
}
if (filename.length() == 0 || filename.indexOf('/') != -1 || filename.indexOf('\0') != -1 ) {
throw new AccessException();
}
} | if (filename.length() > 256) { throw new NameTooLongException(); } if (filename.length() == 0 filename.indexOf('/') != -1 filename.indexOf('\0') != -1 ) { throw new AccessException(); } } | /**
* Validate ${code filename} requirements.
* @param filename
* @throws AccessException if filename does not meet expected constrains
* @throws NameTooLongException if filename is longer than negotiated with PATHCONF operation.
*/ | Validate ${code filename} requirements | checkFilename | {
"repo_name": "devsunny/app-galleries",
"path": "dcache-nfs/src/main/java/org/dcache/nfs/v3/NameUtils.java",
"license": "mit",
"size": 1807
} | [
"org.dcache.nfs.status.AccessException",
"org.dcache.nfs.status.NameTooLongException"
] | import org.dcache.nfs.status.AccessException; import org.dcache.nfs.status.NameTooLongException; | import org.dcache.nfs.status.*; | [
"org.dcache.nfs"
] | org.dcache.nfs; | 1,649,367 |
private String getTaskId(Task task)
{
return task.getGUID() == null
? getIntegerString(task.getUniqueID())
: task.getGUID().toString();
} | String function(Task task) { return task.getGUID() == null ? getIntegerString(task.getUniqueID()) : task.getGUID().toString(); } | /**
* Gets the task id, using GUID if available else unique id
*/ | Gets the task id, using GUID if available else unique id | getTaskId | {
"repo_name": "ddelemeny/calligra",
"path": "filters/plan/mpxj/planconvert/src/plan/PlanWriter.java",
"license": "gpl-2.0",
"size": 54275
} | [
"net.sf.mpxj.Task"
] | import net.sf.mpxj.Task; | import net.sf.mpxj.*; | [
"net.sf.mpxj"
] | net.sf.mpxj; | 1,914,106 |
public InternalCache getCache() {
return _cache;
} | InternalCache function() { return _cache; } | /**
* Returns the GemFire cache
*
* @return the GemFire cache
*/ | Returns the GemFire cache | getCache | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java",
"license": "apache-2.0",
"size": 70723
} | [
"org.apache.geode.internal.cache.InternalCache"
] | import org.apache.geode.internal.cache.InternalCache; | import org.apache.geode.internal.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,634,502 |
@Override
public void fit(INDArray input, INDArray labels) {
setInput(input);
setLabels(labels);
applyDropOutIfNecessary(true);
if (solver == null) {
solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build();
//Set the updater state view array. For MLN and CG, this is done by MultiLayerUpdater and ComputationGraphUpdater respectively
Updater updater = solver.getOptimizer().getUpdater();
int updaterStateSize = updater.stateSizeForLayer(this);
if (updaterStateSize > 0)
updater.setStateViewArray(this, Nd4j.createUninitialized(new int[] {1, updaterStateSize}, Nd4j.order()),
true);
}
solver.optimize();
} | void function(INDArray input, INDArray labels) { setInput(input); setLabels(labels); applyDropOutIfNecessary(true); if (solver == null) { solver = new Solver.Builder().configure(conf()).listeners(getListeners()).model(this).build(); Updater updater = solver.getOptimizer().getUpdater(); int updaterStateSize = updater.stateSizeForLayer(this); if (updaterStateSize > 0) updater.setStateViewArray(this, Nd4j.createUninitialized(new int[] {1, updaterStateSize}, Nd4j.order()), true); } solver.optimize(); } | /**
* Fit the model
*
* @param input the examples to classify (one example in each row)
* @param labels the example labels(a binary outcome matrix)
*/ | Fit the model | fit | {
"repo_name": "crockpotveggies/deeplearning4j",
"path": "deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/LossLayer.java",
"license": "apache-2.0",
"size": 13180
} | [
"org.deeplearning4j.nn.api.Updater",
"org.deeplearning4j.optimize.Solver",
"org.nd4j.linalg.api.ndarray.INDArray",
"org.nd4j.linalg.factory.Nd4j"
] | import org.deeplearning4j.nn.api.Updater; import org.deeplearning4j.optimize.Solver; import org.nd4j.linalg.api.ndarray.INDArray; import org.nd4j.linalg.factory.Nd4j; | import org.deeplearning4j.nn.api.*; import org.deeplearning4j.optimize.*; import org.nd4j.linalg.api.ndarray.*; import org.nd4j.linalg.factory.*; | [
"org.deeplearning4j.nn",
"org.deeplearning4j.optimize",
"org.nd4j.linalg"
] | org.deeplearning4j.nn; org.deeplearning4j.optimize; org.nd4j.linalg; | 1,793,284 |
private static HashMap readHashMap(final InputStreamer input) throws IOException
{
HashMap map = null;
int numberOfFields = input.readInt();
if( numberOfFields > 0 ) map = new HashMap();
String key;
Object value;
int valueType;
for(int i=0; i<numberOfFields; i++)
{
key = input.readUTF();
valueType = input.readByte();
if( valueType == 1 ) // UTF String
{
value = input.readUTF();
}
else if( valueType == 2 ) // Object
{
try{
value = input.getContextObjectInputStream().readObject();
}catch(ClassNotFoundException e){throw new IOException("Caught ClassNotFoundException: " + e);}
}
else // Null
{
value = null;
}
map.put(key, value);
}
return map;
}
| static HashMap function(final InputStreamer input) throws IOException { HashMap map = null; int numberOfFields = input.readInt(); if( numberOfFields > 0 ) map = new HashMap(); String key; Object value; int valueType; for(int i=0; i<numberOfFields; i++) { key = input.readUTF(); valueType = input.readByte(); if( valueType == 1 ) { value = input.readUTF(); } else if( valueType == 2 ) { try{ value = input.getContextObjectInputStream().readObject(); }catch(ClassNotFoundException e){throw new IOException(STR + e);} } else { value = null; } map.put(key, value); } return map; } | /**
* Internal method for deserializing a HashMap from an InputStreamer.
*/ | Internal method for deserializing a HashMap from an InputStreamer | readHashMap | {
"repo_name": "tolo/JServer",
"path": "src/java/com/teletalk/jserver/tcp/messaging/MessageHeader.java",
"license": "apache-2.0",
"size": 27161
} | [
"com.teletalk.jserver.util.InputStreamer",
"java.io.IOException",
"java.util.HashMap"
] | import com.teletalk.jserver.util.InputStreamer; import java.io.IOException; import java.util.HashMap; | import com.teletalk.jserver.util.*; import java.io.*; import java.util.*; | [
"com.teletalk.jserver",
"java.io",
"java.util"
] | com.teletalk.jserver; java.io; java.util; | 2,167,974 |
@Test
public void testGetByUnexistantCode() {
System.out.print("test Language getByCode with unexistant code");
String code = "dd";
Language result = lDao.getByCode(code);
Assert.assertNull(result);
} | void function() { System.out.print(STR); String code = "dd"; Language result = lDao.getByCode(code); Assert.assertNull(result); } | /**
* Test of getByCode method with null fecthing, of class LanguageDAOImpl.
*/ | Test of getByCode method with null fecthing, of class LanguageDAOImpl | testGetByUnexistantCode | {
"repo_name": "motech/MOTECH-Mobile",
"path": "motech-mobile-core/src/test/java/org/motechproject/mobile/core/dao/hibernate/LanguageDAOImplTest.java",
"license": "bsd-3-clause",
"size": 7478
} | [
"org.junit.Assert",
"org.motechproject.mobile.core.model.Language"
] | import org.junit.Assert; import org.motechproject.mobile.core.model.Language; | import org.junit.*; import org.motechproject.mobile.core.model.*; | [
"org.junit",
"org.motechproject.mobile"
] | org.junit; org.motechproject.mobile; | 113,039 |
@Override
public AuthenticatorFlowStatus process(HttpServletRequest request, HttpServletResponse response,
AuthenticationContext context)
throws AuthenticationFailedException, LogoutFailedException {
if (context.isLogoutRequest()) {
return AuthenticatorFlowStatus.SUCCESS_COMPLETED;
} else if (request.getParameter(TOTPAuthenticatorConstants.SEND_TOKEN) != null) {
if (generateTOTPToken(context)) {
return AuthenticatorFlowStatus.INCOMPLETE;
} else {
return AuthenticatorFlowStatus.FAIL_COMPLETED;
}
} else if (StringUtils
.isNotEmpty(request.getParameter(TOTPAuthenticatorConstants.ENABLE_TOTP))) {
// if the request comes with MOBILE_NUMBER, it will go through this flow.
initiateAuthenticationRequest(request, response, context);
if (context.getProperty(TOTPAuthenticatorConstants.AUTHENTICATION)
.equals(TOTPAuthenticatorConstants.AUTHENTICATOR_NAME)) {
return AuthenticatorFlowStatus.INCOMPLETE;
} else {
return AuthenticatorFlowStatus.SUCCESS_COMPLETED;
}
} else if (request.getParameter(TOTPAuthenticatorConstants.TOKEN) == null) {
initiateAuthenticationRequest(request, response, context);
if (context.getProperty(TOTPAuthenticatorConstants.AUTHENTICATION)
.equals(TOTPAuthenticatorConstants.AUTHENTICATOR_NAME)) {
return AuthenticatorFlowStatus.INCOMPLETE;
} else {
return AuthenticatorFlowStatus.SUCCESS_COMPLETED;
}
} else {
return super.process(request, response, context);
}
} | AuthenticatorFlowStatus function(HttpServletRequest request, HttpServletResponse response, AuthenticationContext context) throws AuthenticationFailedException, LogoutFailedException { if (context.isLogoutRequest()) { return AuthenticatorFlowStatus.SUCCESS_COMPLETED; } else if (request.getParameter(TOTPAuthenticatorConstants.SEND_TOKEN) != null) { if (generateTOTPToken(context)) { return AuthenticatorFlowStatus.INCOMPLETE; } else { return AuthenticatorFlowStatus.FAIL_COMPLETED; } } else if (StringUtils .isNotEmpty(request.getParameter(TOTPAuthenticatorConstants.ENABLE_TOTP))) { initiateAuthenticationRequest(request, response, context); if (context.getProperty(TOTPAuthenticatorConstants.AUTHENTICATION) .equals(TOTPAuthenticatorConstants.AUTHENTICATOR_NAME)) { return AuthenticatorFlowStatus.INCOMPLETE; } else { return AuthenticatorFlowStatus.SUCCESS_COMPLETED; } } else if (request.getParameter(TOTPAuthenticatorConstants.TOKEN) == null) { initiateAuthenticationRequest(request, response, context); if (context.getProperty(TOTPAuthenticatorConstants.AUTHENTICATION) .equals(TOTPAuthenticatorConstants.AUTHENTICATOR_NAME)) { return AuthenticatorFlowStatus.INCOMPLETE; } else { return AuthenticatorFlowStatus.SUCCESS_COMPLETED; } } else { return super.process(request, response, context); } } | /**
* This method is overridden to check additional condition like whether request is having
* sendToken, token parameters, generateTOTPToken and authentication name.
*
* @param request Http servlet request
* @param response Http servlet response
* @param context AuthenticationContext
* @return AuthenticatorFlowStatus
* @throws AuthenticationFailedException User tenant domain mismatch
* @throws LogoutFailedException Error while checking logout request
*/ | This method is overridden to check additional condition like whether request is having sendToken, token parameters, generateTOTPToken and authentication name | process | {
"repo_name": "keerthu/identity-outbound-auth-totp",
"path": "component/authenticator/src/main/java/org/wso2/carbon/identity/application/authenticator/totp/TOTPAuthenticator.java",
"license": "apache-2.0",
"size": 20210
} | [
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.commons.lang.StringUtils",
"org.wso2.carbon.identity.application.authentication.framework.AuthenticatorFlowStatus",
"org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext",
"org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException",
"org.wso2.carbon.identity.application.authentication.framework.exception.LogoutFailedException"
] | import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang.StringUtils; import org.wso2.carbon.identity.application.authentication.framework.AuthenticatorFlowStatus; import org.wso2.carbon.identity.application.authentication.framework.context.AuthenticationContext; import org.wso2.carbon.identity.application.authentication.framework.exception.AuthenticationFailedException; import org.wso2.carbon.identity.application.authentication.framework.exception.LogoutFailedException; | import javax.servlet.http.*; import org.apache.commons.lang.*; import org.wso2.carbon.identity.application.authentication.framework.*; import org.wso2.carbon.identity.application.authentication.framework.context.*; import org.wso2.carbon.identity.application.authentication.framework.exception.*; | [
"javax.servlet",
"org.apache.commons",
"org.wso2.carbon"
] | javax.servlet; org.apache.commons; org.wso2.carbon; | 428,635 |
void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ); | void expandPluginConfiguration( Model model, ModelBuildingRequest request, ModelProblemCollector problems ); | /**
* Merges values from general build plugin configuration into the individual plugin executions of the given model.
*
* @param model The model whose build plugin configuration should be expanded, must not be <code>null</code>.
* @param request The model building request that holds further settings, must not be {@code null}.
* @param problems The container used to collect problems that were encountered, must not be {@code null}.
*/ | Merges values from general build plugin configuration into the individual plugin executions of the given model | expandPluginConfiguration | {
"repo_name": "Distrotech/maven",
"path": "maven-model-builder/src/main/java/org/apache/maven/model/plugin/PluginConfigurationExpander.java",
"license": "apache-2.0",
"size": 1774
} | [
"org.apache.maven.model.Model",
"org.apache.maven.model.building.ModelBuildingRequest",
"org.apache.maven.model.building.ModelProblemCollector"
] | import org.apache.maven.model.Model; import org.apache.maven.model.building.ModelBuildingRequest; import org.apache.maven.model.building.ModelProblemCollector; | import org.apache.maven.model.*; import org.apache.maven.model.building.*; | [
"org.apache.maven"
] | org.apache.maven; | 2,652,315 |
private static void addTotalRow(Table table, Object[] contents, RtfFont font, int borderTop,
int borderBottom) {
Cell labelCell = ReportServiceHelper.createTableCell(contents[0], font, null,
ReportServiceHelper.RTF_ALIGN_RIGHT, null, 2);
labelCell.setBorderWidthTop(borderTop);
labelCell.setBorderWidthBottom(borderBottom);
table.addCell(labelCell);
Cell numberCell = ReportServiceHelper.createTableCell(contents[1], font, null,
ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1);
numberCell.setBorderWidthTop(borderTop);
numberCell.setBorderWidthBottom(borderBottom);
table.addCell(numberCell);
Cell totalCell = ReportServiceHelper.createTableCell(contents.length == 3 ? contents[2] : null, font, null,
ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1);
totalCell.setBorderWidthTop(borderTop);
totalCell.setBorderWidthBottom(borderBottom);
table.addCell(totalCell);
Cell emptyCell = ReportServiceHelper.createEmptyCell(1, null);
emptyCell.setBorderWidthTop(borderTop);
emptyCell.setBorderWidthBottom(borderBottom);
table.addCell(emptyCell);
} | static void function(Table table, Object[] contents, RtfFont font, int borderTop, int borderBottom) { Cell labelCell = ReportServiceHelper.createTableCell(contents[0], font, null, ReportServiceHelper.RTF_ALIGN_RIGHT, null, 2); labelCell.setBorderWidthTop(borderTop); labelCell.setBorderWidthBottom(borderBottom); table.addCell(labelCell); Cell numberCell = ReportServiceHelper.createTableCell(contents[1], font, null, ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1); numberCell.setBorderWidthTop(borderTop); numberCell.setBorderWidthBottom(borderBottom); table.addCell(numberCell); Cell totalCell = ReportServiceHelper.createTableCell(contents.length == 3 ? contents[2] : null, font, null, ReportServiceHelper.RTF_ALIGN_RIGHT, null, 1); totalCell.setBorderWidthTop(borderTop); totalCell.setBorderWidthBottom(borderBottom); table.addCell(totalCell); Cell emptyCell = ReportServiceHelper.createEmptyCell(1, null); emptyCell.setBorderWidthTop(borderTop); emptyCell.setBorderWidthBottom(borderBottom); table.addCell(emptyCell); } | /**
* Adds a total row to the table.
*
* @param table
* the table.
* @param contents
* the columns contents.
* @param font
* the font to use.
* @param borderTop
* the border top width.
* @param borderBottom
* the border bottom width.
*/ | Adds a total row to the table | addTotalRow | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/ejb/gov/opm/scrd/services/impl/reporting/BalancedScorecardPaymentReportService.java",
"license": "apache-2.0",
"size": 81516
} | [
"com.lowagie.text.Cell",
"com.lowagie.text.Table",
"com.lowagie.text.rtf.style.RtfFont"
] | import com.lowagie.text.Cell; import com.lowagie.text.Table; import com.lowagie.text.rtf.style.RtfFont; | import com.lowagie.text.*; import com.lowagie.text.rtf.style.*; | [
"com.lowagie.text"
] | com.lowagie.text; | 1,514,372 |
public static Map<String, Object> getBufferedImage(String fileLocation, Locale locale)
throws IllegalArgumentException, IOException {
BufferedImage bufImg;
Map<String, Object> result = new LinkedHashMap<String, Object>();
try {
bufImg = ImageIO.read(new File(fileLocation));
} catch (IllegalArgumentException e) {
String errMsg = UtilProperties.getMessage(resource, "ImageTransform.input_is_null", locale) + " : " + fileLocation + " ; " + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
return result;
} catch (IOException e) {
String errMsg = UtilProperties.getMessage(resource, "ImageTransform.error_occurs_during_reading", locale) + " : " + fileLocation + " ; " + e.toString();
Debug.logError(errMsg, module);
result.put(ModelService.ERROR_MESSAGE, errMsg);
return result;
}
result.put("responseMessage", "success");
result.put("bufferedImage", bufImg);
return result;
} | static Map<String, Object> function(String fileLocation, Locale locale) throws IllegalArgumentException, IOException { BufferedImage bufImg; Map<String, Object> result = new LinkedHashMap<String, Object>(); try { bufImg = ImageIO.read(new File(fileLocation)); } catch (IllegalArgumentException e) { String errMsg = UtilProperties.getMessage(resource, STR, locale) + STR + fileLocation + STR + e.toString(); Debug.logError(errMsg, module); result.put(ModelService.ERROR_MESSAGE, errMsg); return result; } catch (IOException e) { String errMsg = UtilProperties.getMessage(resource, STR, locale) + STR + fileLocation + STR + e.toString(); Debug.logError(errMsg, module); result.put(ModelService.ERROR_MESSAGE, errMsg); return result; } result.put(STR, STR); result.put(STR, bufImg); return result; } | /**
* getBufferedImage
* <p>
* Set a buffered image
*
* @param fileLocation Full file Path or URL
* @return URL images for all different size types
* @throws IOException Error prevents the document from being fully parsed
* @throws IllegalArgumentException Errors occur in parsing
*/ | getBufferedImage Set a buffered image | getBufferedImage | {
"repo_name": "rohankarthik/Ofbiz",
"path": "framework/common/src/main/java/org/apache/ofbiz/common/image/ImageTransform.java",
"license": "apache-2.0",
"size": 13355
} | [
"java.awt.image.BufferedImage",
"java.io.File",
"java.io.IOException",
"java.util.LinkedHashMap",
"java.util.Locale",
"java.util.Map",
"javax.imageio.ImageIO",
"org.apache.ofbiz.base.util.Debug",
"org.apache.ofbiz.base.util.UtilProperties",
"org.apache.ofbiz.service.ModelService"
] | import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.util.LinkedHashMap; import java.util.Locale; import java.util.Map; import javax.imageio.ImageIO; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.service.ModelService; | import java.awt.image.*; import java.io.*; import java.util.*; import javax.imageio.*; import org.apache.ofbiz.base.util.*; import org.apache.ofbiz.service.*; | [
"java.awt",
"java.io",
"java.util",
"javax.imageio",
"org.apache.ofbiz"
] | java.awt; java.io; java.util; javax.imageio; org.apache.ofbiz; | 933,771 |
public Collection<HelpTopic> getHelpTopics(); | Collection<HelpTopic> function(); | /**
* Returns a collection of all the registered help topics.
*
* @return All the registered help topics.
*/ | Returns a collection of all the registered help topics | getHelpTopics | {
"repo_name": "XKnucklesX/Offit",
"path": "src/org/Offit/help/HelpMap.java",
"license": "gpl-2.0",
"size": 2900
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 438,701 |
private void sortAirportsByHemipshere (AirportStatistics airportStats, JsonArray airportArray) {
int northernAirports = 0;
int southernAirports = 0;
for (int i = 0; i < airportArray.size(); i++) {
if (airportArray.getJsonObject(i).getDouble("longitude") >= 0) {
northernAirports ++;
} else {
southernAirports ++;
}
airportStats.increaseRegion(airportArray.getJsonObject(i).getString("area_timezone").split("/")[0]);
}
airportStats.setNorthernAirports(northernAirports);
airportStats.setSouthernAirports(southernAirports);
airportStats.setTotalUsedAirports(airportArray.size());
}
| void function (AirportStatistics airportStats, JsonArray airportArray) { int northernAirports = 0; int southernAirports = 0; for (int i = 0; i < airportArray.size(); i++) { if (airportArray.getJsonObject(i).getDouble(STR) >= 0) { northernAirports ++; } else { southernAirports ++; } airportStats.increaseRegion(airportArray.getJsonObject(i).getString(STR).split("/")[0]); } airportStats.setNorthernAirports(northernAirports); airportStats.setSouthernAirports(southernAirports); airportStats.setTotalUsedAirports(airportArray.size()); } | /**
*
* Helper method
*
* @param airportStats - AirportStatistics object to fill
* @param resultArray - JsonArray to parse
*/ | Helper method | sortAirportsByHemipshere | {
"repo_name": "sasa-radovanovic/ff-flight-diary",
"path": "src/main/java/frequentFlyer/flight_diary/repos/AirportRepo.java",
"license": "mit",
"size": 11405
} | [
"io.vertx.core.json.JsonArray"
] | import io.vertx.core.json.JsonArray; | import io.vertx.core.json.*; | [
"io.vertx.core"
] | io.vertx.core; | 1,831,664 |
public Entity<T> removeIdClass()
{
childNode.removeChildren("id-class");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: Entity ElementName: orm:inheritance ElementType : inheritance
// MaxOccurs: - isGeneric: true isAttribute: false isEnum: false isDataType: false
// --------------------------------------------------------------------------------------------------------|| | Entity<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes the <code>id-class</code> element
* @return the current instance of <code>Entity<T></code>
*/ | Removes the <code>id-class</code> element | removeIdClass | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm10/EntityImpl.java",
"license": "epl-1.0",
"size": 47108
} | [
"org.jboss.shrinkwrap.descriptor.api.orm10.Entity"
] | import org.jboss.shrinkwrap.descriptor.api.orm10.Entity; | import org.jboss.shrinkwrap.descriptor.api.orm10.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 1,769,088 |
@SmallTest
@Feature({"ContextualSearch"})
@Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
public void testTapGestureSelects() throws InterruptedException, TimeoutException {
clickWordNode("intelligence");
assertEquals("Intelligence", getSelectedText());
fakeResponse(false, 200, "Intelligence", "Intelligence", "alternate-term", false);
assertContainsParameters("Intelligence", "alternate-term");
waitForPanelToPeek();
assertLoadedLowPriorityUrl();
clickNode("question-mark");
waitForGestureProcessing();
assertNull(getSelectedText());
} | @Feature({STR}) @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) void function() throws InterruptedException, TimeoutException { clickWordNode(STR); assertEquals(STR, getSelectedText()); fakeResponse(false, 200, STR, STR, STR, false); assertContainsParameters(STR, STR); waitForPanelToPeek(); assertLoadedLowPriorityUrl(); clickNode(STR); waitForGestureProcessing(); assertNull(getSelectedText()); } | /**
* Tests that a Tap gesture selects the expected text.
*/ | Tests that a Tap gesture selects the expected text | testTapGestureSelects | {
"repo_name": "was4444/chromium.src",
"path": "chrome/android/javatests/src/org/chromium/chrome/browser/contextualsearch/ContextualSearchManagerTest.java",
"license": "bsd-3-clause",
"size": 103579
} | [
"java.util.concurrent.TimeoutException",
"org.chromium.base.test.util.Feature",
"org.chromium.base.test.util.Restriction"
] | import java.util.concurrent.TimeoutException; import org.chromium.base.test.util.Feature; import org.chromium.base.test.util.Restriction; | import java.util.concurrent.*; import org.chromium.base.test.util.*; | [
"java.util",
"org.chromium.base"
] | java.util; org.chromium.base; | 1,448,190 |
public LocalDateTime getCreatedAt() {
return createdAt;
} | LocalDateTime function() { return createdAt; } | /**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column ASYNC_PROCESS.CREATED_AT
*
* @return the value of ASYNC_PROCESS.CREATED_AT
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method returns the value of the database column ASYNC_PROCESS.CREATED_AT | getCreatedAt | {
"repo_name": "agwlvssainokuni/springapp",
"path": "common/src/generated/java/cherry/common/db/gen/dto/AsyncProcess.java",
"license": "apache-2.0",
"size": 16723
} | [
"org.joda.time.LocalDateTime"
] | import org.joda.time.LocalDateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 2,511,340 |
protected void tabletypeinfo() {
clear();
try {
this.fetch.add(getMetaData().getTableTypes());
} catch (SQLException e) {
throw zxJDBC.makeException(e);
}
}
| void function() { clear(); try { this.fetch.add(getMetaData().getTableTypes()); } catch (SQLException e) { throw zxJDBC.makeException(e); } } | /**
* Gets a description of possible table types.
*/ | Gets a description of possible table types | tabletypeinfo | {
"repo_name": "DarioGT/OMS-PluginXML",
"path": "org.modelsphere.sms/lib/jython-2.2.1/src/java/src/com/ziclix/python/sql/PyExtendedCursor.java",
"license": "gpl-3.0",
"size": 18278
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 498,167 |
public ServiceFuture<SqlVirtualMachineGroupInner> updateAsync(String resourceGroupName, String sqlVirtualMachineGroupName, Map<String, String> tags, final ServiceCallback<SqlVirtualMachineGroupInner> serviceCallback) {
return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, sqlVirtualMachineGroupName, tags), serviceCallback);
} | ServiceFuture<SqlVirtualMachineGroupInner> function(String resourceGroupName, String sqlVirtualMachineGroupName, Map<String, String> tags, final ServiceCallback<SqlVirtualMachineGroupInner> serviceCallback) { return ServiceFuture.fromResponse(updateWithServiceResponseAsync(resourceGroupName, sqlVirtualMachineGroupName, tags), serviceCallback); } | /**
* Updates SQL virtual machine group tags.
*
* @param resourceGroupName Name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param sqlVirtualMachineGroupName Name of the SQL virtual machine group.
* @param tags Resource tags.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Updates SQL virtual machine group tags | updateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/sqlvirtualmachine/mgmt-v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sqlvirtualmachine/v2017_03_01_preview/implementation/SqlVirtualMachineGroupsInner.java",
"license": "mit",
"size": 82749
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture",
"java.util.Map"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; import java.util.Map; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 526,115 |
@Override
public List<Comparable> getColumnKeys() {
List<Comparable> result = new java.util.ArrayList<Comparable>();
int last = lastCategoryIndex();
for (int i = this.firstCategoryIndex; i < last; i++) {
result.add(this.underlying.getColumnKey(i));
}
return Collections.unmodifiableList(result);
}
| List<Comparable> function() { List<Comparable> result = new java.util.ArrayList<Comparable>(); int last = lastCategoryIndex(); for (int i = this.firstCategoryIndex; i < last; i++) { result.add(this.underlying.getColumnKey(i)); } return Collections.unmodifiableList(result); } | /**
* Returns the column keys.
*
* @return The keys.
*
* @see #getColumnKey(int)
*/ | Returns the column keys | getColumnKeys | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/data/gantt/SlidingGanttCategoryDataset.java",
"license": "lgpl-2.1",
"size": 20229
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 705,352 |
super.setEnvironment(environment);
this.reader.setEnvironment(environment);
this.scanner.setEnvironment(environment);
}
/**
* Provide a custom {@link BeanNameGenerator} for use with
* {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner}
* , if any.
* <p>
* Default is
* {@link org.springframework.context.annotation.AnnotationBeanNameGenerator}.
* <p>
* Any call to this method must occur prior to calls to {@link #register(Class...)} | super.setEnvironment(environment); this.reader.setEnvironment(environment); this.scanner.setEnvironment(environment); } /** * Provide a custom {@link BeanNameGenerator} for use with * {@link AnnotatedBeanDefinitionReader} and/or {@link ClassPathBeanDefinitionScanner} * , if any. * <p> * Default is * {@link org.springframework.context.annotation.AnnotationBeanNameGenerator}. * <p> * Any call to this method must occur prior to calls to {@link #register(Class...)} | /**
* {@inheritDoc}
* <p>
* Delegates given environment to underlying {@link AnnotatedBeanDefinitionReader} and
* {@link ClassPathBeanDefinitionScanner} members.
*/ | Delegates given environment to underlying <code>AnnotatedBeanDefinitionReader</code> and <code>ClassPathBeanDefinitionScanner</code> members | setEnvironment | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/spring-boot-master/spring-boot/src/main/java/org/springframework/boot/context/embedded/AnnotationConfigEmbeddedWebApplicationContext.java",
"license": "mit",
"size": 7281
} | [
"org.springframework.beans.factory.support.BeanNameGenerator",
"org.springframework.context.annotation.AnnotatedBeanDefinitionReader",
"org.springframework.context.annotation.ClassPathBeanDefinitionScanner"
] | import org.springframework.beans.factory.support.BeanNameGenerator; import org.springframework.context.annotation.AnnotatedBeanDefinitionReader; import org.springframework.context.annotation.ClassPathBeanDefinitionScanner; | import org.springframework.beans.factory.support.*; import org.springframework.context.annotation.*; | [
"org.springframework.beans",
"org.springframework.context"
] | org.springframework.beans; org.springframework.context; | 1,175,923 |
public String getIdentifier()
{
return ID3v24Frames.FRAME_ID_ENCODING_TIME;
} | String function() { return ID3v24Frames.FRAME_ID_ENCODING_TIME; } | /**
* The ID3v2 frame identifier
*
* @return the ID3v2 frame identifier for this frame type
*/ | The ID3v2 frame identifier | getIdentifier | {
"repo_name": "syntelos/cddb",
"path": "src/org/jaudiotagger/tag/id3/framebody/FrameBodyTDEN.java",
"license": "lgpl-3.0",
"size": 2147
} | [
"org.jaudiotagger.tag.id3.ID3v24Frames"
] | import org.jaudiotagger.tag.id3.ID3v24Frames; | import org.jaudiotagger.tag.id3.*; | [
"org.jaudiotagger.tag"
] | org.jaudiotagger.tag; | 1,107,799 |
public Client masterClient() {
NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName()));
if (randomNodeAndClient != null) {
return randomNodeAndClient.nodeClient(); // ensure node client master is requested
}
throw new AssertionError("No master client found");
} | Client function() { NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName())); if (randomNodeAndClient != null) { return randomNodeAndClient.nodeClient(); } throw new AssertionError(STR); } | /**
* Returns a node client to the current master node.
* Note: use this with care tests should not rely on a certain nodes client.
*/ | Returns a node client to the current master node. Note: use this with care tests should not rely on a certain nodes client | masterClient | {
"repo_name": "jmluy/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java",
"license": "apache-2.0",
"size": 110894
} | [
"org.elasticsearch.client.Client"
] | import org.elasticsearch.client.Client; | import org.elasticsearch.client.*; | [
"org.elasticsearch.client"
] | org.elasticsearch.client; | 2,763,973 |
public static void main(final String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Verifies the given class.");
System.err.println("Usage: CheckClassAdapter "
+ "<fully qualified class name or class file name>");
return;
}
ClassReader cr;
if (args[0].endsWith(".class")) {
cr = new ClassReader(new FileInputStream(args[0]));
} else {
cr = new ClassReader(args[0]);
}
verify(cr, false, new PrintWriter(System.err));
} | static void function(final String[] args) throws Exception { if (args.length != 1) { System.err.println(STR); System.err.println(STR + STR); return; } ClassReader cr; if (args[0].endsWith(STR)) { cr = new ClassReader(new FileInputStream(args[0])); } else { cr = new ClassReader(args[0]); } verify(cr, false, new PrintWriter(System.err)); } | /**
* Checks a given class. <p> Usage: CheckClassAdapter <fully qualified
* class name or class file name>
*
* @param args the command line arguments.
*
* @throws Exception if the class cannot be found, or if an IO exception
* occurs.
*/ | Checks a given class. Usage: CheckClassAdapter <fully qualified class name or class file name> | main | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/tools/external/asm/org/objectweb/asm/util/CheckClassAdapter.java",
"license": "gpl-2.0",
"size": 15719
} | [
"java.io.FileInputStream",
"java.io.PrintWriter",
"org.objectweb.asm.ClassReader"
] | import java.io.FileInputStream; import java.io.PrintWriter; import org.objectweb.asm.ClassReader; | import java.io.*; import org.objectweb.asm.*; | [
"java.io",
"org.objectweb.asm"
] | java.io; org.objectweb.asm; | 648,893 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.