method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
private StorageUri getTransformedAddress() throws URISyntaxException, StorageException { return this.fileServiceClient.getCredentials().transformUri(this.storageUri); }
StorageUri function() throws URISyntaxException, StorageException { return this.fileServiceClient.getCredentials().transformUri(this.storageUri); }
/** * Returns the URI after applying the authentication transformation. * * @return A <code>java.net.URI</code> object that represents the URI after applying the authentication * transformation. * * @throws StorageException * If a storage service error occurred. * @throws URISyntaxException * If the resource URI is invalid. */
Returns the URI after applying the authentication transformation
getTransformedAddress
{ "repo_name": "jofriedm-msft/azure-storage-java", "path": "microsoft-azure-storage/src/com/microsoft/azure/storage/file/CloudFileDirectory.java", "license": "apache-2.0", "size": 54549 }
[ "com.microsoft.azure.storage.StorageException", "com.microsoft.azure.storage.StorageUri", "java.net.URISyntaxException" ]
import com.microsoft.azure.storage.StorageException; import com.microsoft.azure.storage.StorageUri; import java.net.URISyntaxException;
import com.microsoft.azure.storage.*; import java.net.*;
[ "com.microsoft.azure", "java.net" ]
com.microsoft.azure; java.net;
1,915,395
final S3ObjectWrapper fetchInstructionFile(S3ObjectId s3ObjectId, String instFileSuffix) { try { S3Object o = s3.getObject( createInstructionGetRequest(s3ObjectId, instFileSuffix)); return o == null ? null : new S3ObjectWrapper(o, s3ObjectId); } catch (AmazonServiceException e) { // If no instruction file is found, log a debug message, and return // null. if (log.isDebugEnabled()) { log.debug("Unable to retrieve instruction file : " + e.getMessage()); } return null; } }
final S3ObjectWrapper fetchInstructionFile(S3ObjectId s3ObjectId, String instFileSuffix) { try { S3Object o = s3.getObject( createInstructionGetRequest(s3ObjectId, instFileSuffix)); return o == null ? null : new S3ObjectWrapper(o, s3ObjectId); } catch (AmazonServiceException e) { if (log.isDebugEnabled()) { log.debug(STR + e.getMessage()); } return null; } }
/** * Retrieves an instruction file from S3; or null if no instruction file is * found. * * @param s3ObjectId * the S3 object id (not the instruction file id) * @param instFileSuffix * suffix of the instruction file to be retrieved; or null to use * the default suffix. * @return an instruction file, or null if no instruction file is found. */
Retrieves an instruction file from S3; or null if no instruction file is found
fetchInstructionFile
{ "repo_name": "jentfoo/aws-sdk-java", "path": "aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3CryptoModuleBase.java", "license": "apache-2.0", "size": 43226 }
[ "com.amazonaws.AmazonServiceException", "com.amazonaws.services.s3.model.S3Object", "com.amazonaws.services.s3.model.S3ObjectId" ]
import com.amazonaws.AmazonServiceException; import com.amazonaws.services.s3.model.S3Object; import com.amazonaws.services.s3.model.S3ObjectId;
import com.amazonaws.*; import com.amazonaws.services.s3.model.*;
[ "com.amazonaws", "com.amazonaws.services" ]
com.amazonaws; com.amazonaws.services;
1,111,166
private void sortTryCatchBlocks(Region methodRegion) { Iterator blocks = srcMethod.tryCatchBlocks.iterator(); while (blocks.hasNext()) { Region enclosingRegion = methodRegion; TryCatchBlockNode block = (TryCatchBlockNode) blocks.next(); Iterator regions = subroutineMap.values().iterator(); while (regions.hasNext()) { Region region = (Region) regions.next(); if (region.encloses(block)) { if (enclosingRegion == null) { enclosingRegion = region; } else { // Pick the smallest region that encloses the block if (region.getLength() < enclosingRegion.getLength()) { enclosingRegion = region; } } } } enclosingRegion.addTryCatchBlock(block); } }
void function(Region methodRegion) { Iterator blocks = srcMethod.tryCatchBlocks.iterator(); while (blocks.hasNext()) { Region enclosingRegion = methodRegion; TryCatchBlockNode block = (TryCatchBlockNode) blocks.next(); Iterator regions = subroutineMap.values().iterator(); while (regions.hasNext()) { Region region = (Region) regions.next(); if (region.encloses(block)) { if (enclosingRegion == null) { enclosingRegion = region; } else { if (region.getLength() < enclosingRegion.getLength()) { enclosingRegion = region; } } } } enclosingRegion.addTryCatchBlock(block); } }
/** * Sort the try/catch blocks such that they are associated with the smallest * region that surrounds that block. * * @param methodRegion */
Sort the try/catch blocks such that they are associated with the smallest region that surrounds that block
sortTryCatchBlocks
{ "repo_name": "v6ak/Preverifier", "path": "src/v6/java/preverifier/MethodRewriter.java", "license": "epl-1.0", "size": 41527 }
[ "java.util.Iterator", "org.objectweb.asm.tree.TryCatchBlockNode" ]
import java.util.Iterator; import org.objectweb.asm.tree.TryCatchBlockNode;
import java.util.*; import org.objectweb.asm.tree.*;
[ "java.util", "org.objectweb.asm" ]
java.util; org.objectweb.asm;
427,901
private static void appendRunfilesRelativeEntries(StringBuilder buffer, Iterable<Artifact> artifacts, char delimiter) { for (Artifact artifact : artifacts) { if (buffer.length() > 0) { buffer.append(delimiter); } buffer.append("${RUNPATH}"); buffer.append(artifact.getRootRelativePath().getPathString()); } }
static void function(StringBuilder buffer, Iterable<Artifact> artifacts, char delimiter) { for (Artifact artifact : artifacts) { if (buffer.length() > 0) { buffer.append(delimiter); } buffer.append(STR); buffer.append(artifact.getRootRelativePath().getPathString()); } }
/** * Builds a class path by concatenating the root relative paths of the artifacts separated by the * delimiter. Each relative path entry is prepended with "${RUNPATH}" which will be expanded by * the stub script at runtime, to either "${JAVA_RUNFILES}/" or if we are lucky, the empty * string. * * @param buffer the buffer to use for concatenating the entries * @param artifacts the entries to concatenate in the buffer * @param delimiter the delimiter character to separate the entries */
Builds a class path by concatenating the root relative paths of the artifacts separated by the delimiter. Each relative path entry is prepended with "${RUNPATH}" which will be expanded by the stub script at runtime, to either "${JAVA_RUNFILES}/" or if we are lucky, the empty string
appendRunfilesRelativeEntries
{ "repo_name": "gavares/bazel", "path": "src/main/java/com/google/devtools/build/lib/bazel/rules/java/BazelJavaSemantics.java", "license": "apache-2.0", "size": 14769 }
[ "com.google.devtools.build.lib.actions.Artifact" ]
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.*;
[ "com.google.devtools" ]
com.google.devtools;
2,695,869
public void zoom(Point2D p, float scale) { Graphics2D g = ((Graphics2D) this.getViewJComponent().getGraphics()); double x = p.getX(), y = p.getY(); this.trsf.translate(x, y); this.trsf.scale(scale, scale); this.trsf.translate(-x, -y); g.clearRect(0, 0, getViewJComponent().getSize().width, getViewJComponent().getSize().height); g.setTransform(trsf); this.customPanel.setScaleValue(scale); this.customPanel.setPanValues(x, y); this.paint(g); }
void function(Point2D p, float scale) { Graphics2D g = ((Graphics2D) this.getViewJComponent().getGraphics()); double x = p.getX(), y = p.getY(); this.trsf.translate(x, y); this.trsf.scale(scale, scale); this.trsf.translate(-x, -y); g.clearRect(0, 0, getViewJComponent().getSize().width, getViewJComponent().getSize().height); g.setTransform(trsf); this.customPanel.setScaleValue(scale); this.customPanel.setPanValues(x, y); this.paint(g); }
/** * Zooms the view to the given scale. * @param p anchor point for the zoom * @param scale scale for the zoom */
Zooms the view to the given scale
zoom
{ "repo_name": "jdfekete/obvious", "path": "obvious-ivtk/src/main/java/obvious/ivtk/view/IvtkObviousView.java", "license": "bsd-3-clause", "size": 7198 }
[ "java.awt.Graphics2D", "java.awt.geom.Point2D" ]
import java.awt.Graphics2D; import java.awt.geom.Point2D;
import java.awt.*; import java.awt.geom.*;
[ "java.awt" ]
java.awt;
2,859,413
public void addSelectionChangedListener(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
void function(ISelectionChangedListener listener) { selectionChangedListeners.add(listener); }
/** * This implements {@link org.eclipse.jface.viewers.ISelectionProvider}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This implements <code>org.eclipse.jface.viewers.ISelectionProvider</code>.
addSelectionChangedListener
{ "repo_name": "diverse-project/kcvl", "path": "fr.inria.diverse.kcvl.metamodel.editor/src/main/java/org/omg/CVLMetamodelMaster/cvl/presentation/CvlEditor.java", "license": "epl-1.0", "size": 53951 }
[ "org.eclipse.jface.viewers.ISelectionChangedListener" ]
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,752,352
public void setTicketKeys(byte[] keys) { if (keys == null) { throw new NullPointerException("keys"); } SSLContext.setSessionTicketKeys(ctx, keys); }
void function(byte[] keys) { if (keys == null) { throw new NullPointerException("keys"); } SSLContext.setSessionTicketKeys(ctx, keys); }
/** * Sets the SSL session ticket keys of this context. */
Sets the SSL session ticket keys of this context
setTicketKeys
{ "repo_name": "kamyu104/netty", "path": "handler/src/main/java/io/netty/handler/ssl/OpenSslServerContext.java", "license": "apache-2.0", "size": 12649 }
[ "org.apache.tomcat.jni.SSLContext" ]
import org.apache.tomcat.jni.SSLContext;
import org.apache.tomcat.jni.*;
[ "org.apache.tomcat" ]
org.apache.tomcat;
251,737
public static List<String> unpack(final byte[] pack){ try { String raw = new String(CompEx.expand(pack), default_charset); return splitAL(raw, "\n"); } catch (Exception ex) { return null; // Sollte sowieso nie vorkommen } }
static List<String> function(final byte[] pack){ try { String raw = new String(CompEx.expand(pack), default_charset); return splitAL(raw, "\n"); } catch (Exception ex) { return null; } }
/** * Unpack a Zip-compressed byte-Array in a List of Strings. * * @param pack * a packed byte array as created by pack() * @return an ArrayList of Strings * @see pack(String[]) * @see pack(Collection<String>) */
Unpack a Zip-compressed byte-Array in a List of Strings
unpack
{ "repo_name": "elexis/elexis-3-core", "path": "bundles/ch.rgw.utility/src/ch/rgw/tools/StringTool.java", "license": "epl-1.0", "size": 35760 }
[ "ch.rgw.compress.CompEx", "java.util.List" ]
import ch.rgw.compress.CompEx; import java.util.List;
import ch.rgw.compress.*; import java.util.*;
[ "ch.rgw.compress", "java.util" ]
ch.rgw.compress; java.util;
2,436,717
ExceptionAction quieter() { assert ExceptionAction.Silent.ordinal() == 0; int index = Math.max(ordinal() - 1, 0); return VALUES[index]; } } private final DiagnosticsOutputDirectory outputDirectory; private final Map<ExceptionAction, Integer> problemsHandledPerAction; public CompilationWrapper(DiagnosticsOutputDirectory outputDirectory, Map<ExceptionAction, Integer> problemsHandledPerAction) { this.outputDirectory = outputDirectory; this.problemsHandledPerAction = problemsHandledPerAction; } /** * Handles an uncaught exception. * * @param t an exception thrown during {@link #run(DebugContext)}
ExceptionAction quieter() { assert ExceptionAction.Silent.ordinal() == 0; int index = Math.max(ordinal() - 1, 0); return VALUES[index]; } } private final DiagnosticsOutputDirectory outputDirectory; private final Map<ExceptionAction, Integer> problemsHandledPerAction; public CompilationWrapper(DiagnosticsOutputDirectory outputDirectory, Map<ExceptionAction, Integer> problemsHandledPerAction) { this.outputDirectory = outputDirectory; this.problemsHandledPerAction = problemsHandledPerAction; } /** * Handles an uncaught exception. * * @param t an exception thrown during {@link #run(DebugContext)}
/** * Gets the action that is one level less verbose than this action, bottoming out at the * least verbose action. */
Gets the action that is one level less verbose than this action, bottoming out at the least verbose action
quieter
{ "repo_name": "md-5/jdk10", "path": "src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java", "license": "gpl-2.0", "size": 16098 }
[ "java.util.Map", "org.graalvm.compiler.debug.DebugContext", "org.graalvm.compiler.debug.DiagnosticsOutputDirectory" ]
import java.util.Map; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.DiagnosticsOutputDirectory;
import java.util.*; import org.graalvm.compiler.debug.*;
[ "java.util", "org.graalvm.compiler" ]
java.util; org.graalvm.compiler;
318,336
private String buildRemoteName(Account account, OCFile file) { return account.name + file.getRemotePath(); }
String function(Account account, OCFile file) { return account.name + file.getRemotePath(); }
/** * Builds a key for mPendingDownloads from the account and file to download * * @param account Account where the file to download is stored * @param file File to download */
Builds a key for mPendingDownloads from the account and file to download
buildRemoteName
{ "repo_name": "cbulloss/android", "path": "src/com/owncloud/android/files/services/FileDownloader.java", "license": "gpl-2.0", "size": 24944 }
[ "android.accounts.Account", "com.owncloud.android.datamodel.OCFile" ]
import android.accounts.Account; import com.owncloud.android.datamodel.OCFile;
import android.accounts.*; import com.owncloud.android.datamodel.*;
[ "android.accounts", "com.owncloud.android" ]
android.accounts; com.owncloud.android;
944,240
@Generated @CVariable() @MappedReturn(ObjCStringMapper.class) public static native String UIImagePickerControllerPHAsset();
@CVariable() @MappedReturn(ObjCStringMapper.class) static native String function();
/** * a PHAsset */
a PHAsset
UIImagePickerControllerPHAsset
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/c/UIKit.java", "license": "apache-2.0", "size": 134869 }
[ "org.moe.natj.c.ann.CVariable", "org.moe.natj.general.ann.MappedReturn", "org.moe.natj.objc.map.ObjCStringMapper" ]
import org.moe.natj.c.ann.CVariable; import org.moe.natj.general.ann.MappedReturn; import org.moe.natj.objc.map.ObjCStringMapper;
import org.moe.natj.c.ann.*; import org.moe.natj.general.ann.*; import org.moe.natj.objc.map.*;
[ "org.moe.natj" ]
org.moe.natj;
1,741,745
return Loader.getClient().getBaseX(); }
return Loader.getClient().getBaseX(); }
/** * Gets BaseX * * @return baseX */
Gets BaseX
getBaseX
{ "repo_name": "Fryslan/Parabot-317-API-Minified", "path": "src/org/rev317/min/api/methods/Game.java", "license": "gpl-3.0", "size": 1784 }
[ "org.rev317.min.Loader" ]
import org.rev317.min.Loader;
import org.rev317.min.*;
[ "org.rev317.min" ]
org.rev317.min;
1,266,641
@Test public void testExecutionTimeoutWithFallbackUsingThreadIsolation() { TestHystrixCommand<Boolean> command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_SUCCESS, ExecutionIsolationStrategy.THREAD); try { assertEquals(false, command.execute()); // the time should be 50+ since we timeout at 50ms assertTrue("Execution Time is: " + command.getExecutionTimeInMilliseconds(), command.getExecutionTimeInMilliseconds() >= 50); assertTrue(command.isResponseTimedOut()); assertTrue(command.isResponseFromFallback()); } catch (Exception e) { e.printStackTrace(); fail("We should have received a response from the fallback."); } assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE)); assertEquals(1, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED)); assertEquals(1, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE)); assertEquals(100, command.builder.metrics.getHealthCounts().getErrorPercentage()); assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size()); // thread isolated assertTrue(command.isExecutedInThread()); }
void function() { TestHystrixCommand<Boolean> command = new TestCommandWithTimeout(50, TestCommandWithTimeout.FALLBACK_SUCCESS, ExecutionIsolationStrategy.THREAD); try { assertEquals(false, command.execute()); assertTrue(STR + command.getExecutionTimeInMilliseconds(), command.getExecutionTimeInMilliseconds() >= 50); assertTrue(command.isResponseTimedOut()); assertTrue(command.isResponseFromFallback()); } catch (Exception e) { e.printStackTrace(); fail(STR); } assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE)); assertEquals(1, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED)); assertEquals(1, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.builder.metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE)); assertEquals(100, command.builder.metrics.getHealthCounts().getErrorPercentage()); assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size()); assertTrue(command.isExecutedInThread()); }
/** * Test a command execution timeout where the command implemented getFallback. */
Test a command execution timeout where the command implemented getFallback
testExecutionTimeoutWithFallbackUsingThreadIsolation
{ "repo_name": "daveray/Hystrix", "path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java", "license": "apache-2.0", "size": 357869 }
[ "com.netflix.hystrix.HystrixCommandProperties", "com.netflix.hystrix.util.HystrixRollingNumberEvent", "org.junit.Assert" ]
import com.netflix.hystrix.HystrixCommandProperties; import com.netflix.hystrix.util.HystrixRollingNumberEvent; import org.junit.Assert;
import com.netflix.hystrix.*; import com.netflix.hystrix.util.*; import org.junit.*;
[ "com.netflix.hystrix", "org.junit" ]
com.netflix.hystrix; org.junit;
2,004,333
RedisFuture<Map<K, Long>> pubsubNumsub(K... channels);
RedisFuture<Map<K, Long>> pubsubNumsub(K... channels);
/** * Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels. * * @param channels channel keys. * @return array-reply a list of channels and number of subscribers for every channel. */
Returns the number of subscribers (not counting clients subscribed to patterns) for the specified channels
pubsubNumsub
{ "repo_name": "lettuce-io/lettuce-core", "path": "src/main/java/io/lettuce/core/api/async/BaseRedisAsyncCommands.java", "license": "apache-2.0", "size": 6037 }
[ "io.lettuce.core.RedisFuture", "java.util.Map" ]
import io.lettuce.core.RedisFuture; import java.util.Map;
import io.lettuce.core.*; import java.util.*;
[ "io.lettuce.core", "java.util" ]
io.lettuce.core; java.util;
79,740
public static List<Method> findAllAnnotatedMethods(Class<?> clazz, Class<? extends Annotation> annotationType) { return getJavaWithCaching().findAllAnnotatedMethods(clazz, annotationType); }
static List<Method> function(Class<?> clazz, Class<? extends Annotation> annotationType) { return getJavaWithCaching().findAllAnnotatedMethods(clazz, annotationType); }
/** * Find all annotated method from a class * @param clazz The class * @param annotationType The annotation class * @return A list of method object */
Find all annotated method from a class
findAllAnnotatedMethods
{ "repo_name": "deanhiller/databus", "path": "webapp/play1.3.x/framework/src/play/utils/Java.java", "license": "mpl-2.0", "size": 20619 }
[ "java.lang.annotation.Annotation", "java.lang.reflect.Method", "java.util.List" ]
import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.List;
import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*;
[ "java.lang", "java.util" ]
java.lang; java.util;
2,015,005
@Override public final void onCreate(SQLiteDatabase db) { ConnectionSource cs = getConnectionSource(); DatabaseConnection conn = cs.getSpecialConnection(null); boolean clearSpecial = false; if (conn == null) { conn = new AndroidDatabaseConnection(db, true, cancelQueriesEnabled); try { cs.saveSpecialConnection(conn); clearSpecial = true; } catch (SQLException e) { throw new IllegalStateException("Could not save special connection", e); } } try { onCreate(db, cs); } finally { if (clearSpecial) { cs.clearSpecialConnection(conn); } } }
final void function(SQLiteDatabase db) { ConnectionSource cs = getConnectionSource(); DatabaseConnection conn = cs.getSpecialConnection(null); boolean clearSpecial = false; if (conn == null) { conn = new AndroidDatabaseConnection(db, true, cancelQueriesEnabled); try { cs.saveSpecialConnection(conn); clearSpecial = true; } catch (SQLException e) { throw new IllegalStateException(STR, e); } } try { onCreate(db, cs); } finally { if (clearSpecial) { cs.clearSpecialConnection(conn); } } }
/** * Satisfies the {@link SQLiteOpenHelper#onCreate(SQLiteDatabase)} interface method. */
Satisfies the <code>SQLiteOpenHelper#onCreate(SQLiteDatabase)</code> interface method
onCreate
{ "repo_name": "j256/ormlite-android", "path": "src/main/java/com/j256/ormlite/android/apptools/OrmLiteSqliteOpenHelper.java", "license": "isc", "size": 13206 }
[ "android.database.sqlite.SQLiteDatabase", "com.j256.ormlite.android.AndroidDatabaseConnection", "com.j256.ormlite.support.ConnectionSource", "com.j256.ormlite.support.DatabaseConnection", "java.sql.SQLException" ]
import android.database.sqlite.SQLiteDatabase; import com.j256.ormlite.android.AndroidDatabaseConnection; import com.j256.ormlite.support.ConnectionSource; import com.j256.ormlite.support.DatabaseConnection; import java.sql.SQLException;
import android.database.sqlite.*; import com.j256.ormlite.android.*; import com.j256.ormlite.support.*; import java.sql.*;
[ "android.database", "com.j256.ormlite", "java.sql" ]
android.database; com.j256.ormlite; java.sql;
2,286,634
public SystemHookEvent handleRequest(HttpServletRequest request) throws GitLabApiException { String eventName = request.getHeader("X-Gitlab-Event"); if (eventName == null || eventName.trim().isEmpty()) { String message = "X-Gitlab-Event header is missing!"; LOGGER.warning(message); return (null); } if (!isValidSecretToken(request)) { String message = "X-Gitlab-Token mismatch!"; LOGGER.warning(message); throw new GitLabApiException(message); } LOGGER.info("handleEvent: X-Gitlab-Event=" + eventName); if (!SYSTEM_HOOK_EVENT.equals(eventName)) { String message = "Unsupported X-Gitlab-Event, event Name=" + eventName; LOGGER.warning(message); throw new GitLabApiException(message); } // Get the JSON as a JsonNode tree. We do not directly unmarshal the input as special handling must // be done for "merge_request" events. JsonNode tree; try { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(HttpRequestUtils.getShortRequestDump("System Hook", true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOGGER.fine("Raw POST data:\n" + postData); tree = jacksonJson.readTree(postData); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); tree = jacksonJson.readTree(reader); } } catch (Exception e) { LOGGER.warning("Error reading JSON data, exception=" + e.getClass().getSimpleName() + ", error=" + e.getMessage()); throw new GitLabApiException(e); } // NOTE: This is a hack based on the GitLab documentation and actual content of the "merge_request" event // showing that the "event_name" property is missing from the merge_request system hook event. The hack is // to inject the "event_name" node so that the polymorphic deserialization of a SystemHookEvent works correctly // when the system hook event is a "merge_request" event. if (!tree.has("event_name") && tree.has("object_kind")) { String objectKind = tree.get("object_kind").asText(); if (MergeRequestSystemHookEvent.MERGE_REQUEST_EVENT.equals(objectKind)) { ObjectNode node = (ObjectNode)tree; node.put("event_name", MergeRequestSystemHookEvent.MERGE_REQUEST_EVENT); } else { String message = "Unsupported object_kind for system hook event, object_kind=" + objectKind; LOGGER.warning(message); throw new GitLabApiException(message); } } // Unmarshal the tree to a concrete instance of a SystemHookEvent and fire the event to any listeners SystemHookEvent event; try { event = jacksonJson.unmarshal(SystemHookEvent.class, tree); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(event.getEventName() + "\n" + jacksonJson.marshal(event) + "\n"); } StringBuffer requestUrl = request.getRequestURL(); event.setRequestUrl(requestUrl != null ? requestUrl.toString() : null); event.setRequestQueryString(request.getQueryString()); String secretToken = request.getHeader("X-Gitlab-Token"); event.setRequestSecretToken(secretToken); } catch (Exception e) { LOGGER.warning(String.format("Error processing JSON data, exception=%s, error=%s", e.getClass().getSimpleName(), e.getMessage())); throw new GitLabApiException(e); } try { fireEvent(event); return (event); } catch (Exception e) { LOGGER.warning(String.format("Error processing event, exception=%s, error=%s", e.getClass().getSimpleName(), e.getMessage())); throw new GitLabApiException(e); } }
SystemHookEvent function(HttpServletRequest request) throws GitLabApiException { String eventName = request.getHeader(STR); if (eventName == null eventName.trim().isEmpty()) { String message = STR; LOGGER.warning(message); return (null); } if (!isValidSecretToken(request)) { String message = STR; LOGGER.warning(message); throw new GitLabApiException(message); } LOGGER.info(STR + eventName); if (!SYSTEM_HOOK_EVENT.equals(eventName)) { String message = STR + eventName; LOGGER.warning(message); throw new GitLabApiException(message); } JsonNode tree; try { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(HttpRequestUtils.getShortRequestDump(STR, true, request)); String postData = HttpRequestUtils.getPostDataAsString(request); LOGGER.fine(STR + postData); tree = jacksonJson.readTree(postData); } else { InputStreamReader reader = new InputStreamReader(request.getInputStream()); tree = jacksonJson.readTree(reader); } } catch (Exception e) { LOGGER.warning(STR + e.getClass().getSimpleName() + STR + e.getMessage()); throw new GitLabApiException(e); } if (!tree.has(STR) && tree.has(STR)) { String objectKind = tree.get(STR).asText(); if (MergeRequestSystemHookEvent.MERGE_REQUEST_EVENT.equals(objectKind)) { ObjectNode node = (ObjectNode)tree; node.put(STR, MergeRequestSystemHookEvent.MERGE_REQUEST_EVENT); } else { String message = STR + objectKind; LOGGER.warning(message); throw new GitLabApiException(message); } } SystemHookEvent event; try { event = jacksonJson.unmarshal(SystemHookEvent.class, tree); if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine(event.getEventName() + "\n" + jacksonJson.marshal(event) + "\n"); } StringBuffer requestUrl = request.getRequestURL(); event.setRequestUrl(requestUrl != null ? requestUrl.toString() : null); event.setRequestQueryString(request.getQueryString()); String secretToken = request.getHeader(STR); event.setRequestSecretToken(secretToken); } catch (Exception e) { LOGGER.warning(String.format(STR, e.getClass().getSimpleName(), e.getMessage())); throw new GitLabApiException(e); } try { fireEvent(event); return (event); } catch (Exception e) { LOGGER.warning(String.format(STR, e.getClass().getSimpleName(), e.getMessage())); throw new GitLabApiException(e); } }
/** * Parses and verifies an SystemHookEvent instance from the HTTP request and * fires it off to the registered listeners. * * @param request the HttpServletRequest to read the Event instance from * @return the processed SystemHookEvent instance read from the request,null if the request * not contain a system hook event * @throws GitLabApiException if the parsed event is not supported */
Parses and verifies an SystemHookEvent instance from the HTTP request and fires it off to the registered listeners
handleRequest
{ "repo_name": "gmessner/gitlab4j-api", "path": "src/main/java/org/gitlab4j/api/systemhooks/SystemHookManager.java", "license": "mit", "size": 12253 }
[ "com.fasterxml.jackson.databind.JsonNode", "com.fasterxml.jackson.databind.node.ObjectNode", "java.io.InputStreamReader", "java.util.logging.Level", "javax.servlet.http.HttpServletRequest", "org.gitlab4j.api.GitLabApiException", "org.gitlab4j.api.utils.HttpRequestUtils" ]
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.node.ObjectNode; import java.io.InputStreamReader; import java.util.logging.Level; import javax.servlet.http.HttpServletRequest; import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.utils.HttpRequestUtils;
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import java.io.*; import java.util.logging.*; import javax.servlet.http.*; import org.gitlab4j.api.*; import org.gitlab4j.api.utils.*;
[ "com.fasterxml.jackson", "java.io", "java.util", "javax.servlet", "org.gitlab4j.api" ]
com.fasterxml.jackson; java.io; java.util; javax.servlet; org.gitlab4j.api;
2,065,902
@StaplerDispatchable // referenced by _api.jelly public PersistedList<UpdateSite> getSites() { return sites; }
@StaplerDispatchable PersistedList<UpdateSite> function() { return sites; }
/** * Returns the list of {@link UpdateSite}s to be used. * This is a live list, whose change will be persisted automatically. * * @return * can be empty but never null. */
Returns the list of <code>UpdateSite</code>s to be used. This is a live list, whose change will be persisted automatically
getSites
{ "repo_name": "batmat/jenkins", "path": "core/src/main/java/hudson/model/UpdateCenter.java", "license": "mit", "size": 88993 }
[ "hudson.util.PersistedList" ]
import hudson.util.PersistedList;
import hudson.util.*;
[ "hudson.util" ]
hudson.util;
326,118
User body = null; api.createUser(body); // TODO: test validations }
User body = null; api.createUser(body); }
/** * Create user * * This can only be done by the logged in user. * * @throws ApiException * if the Api call fails */
Create user This can only be done by the logged in user
createUserTest
{ "repo_name": "Niky4000/UsefulUtils", "path": "projects/tutorials-master/tutorials-master/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/UserApiLiveTest.java", "license": "gpl-3.0", "size": 3508 }
[ "com.baeldung.petstore.client.model.User" ]
import com.baeldung.petstore.client.model.User;
import com.baeldung.petstore.client.model.*;
[ "com.baeldung.petstore" ]
com.baeldung.petstore;
2,417,002
public void assertNullOrEmpty(AssertionInfo info, double[] actual) { arrays.assertNullOrEmpty(info, failures, actual); }
void function(AssertionInfo info, double[] actual) { arrays.assertNullOrEmpty(info, failures, actual); }
/** * Asserts that the given array is {@code null} or empty. * * @param info contains information about the assertion. * @param actual the given array. * @throws AssertionError if the given array is not {@code null} *and* contains one or more elements. */
Asserts that the given array is null or empty
assertNullOrEmpty
{ "repo_name": "yurloc/assertj-core", "path": "src/main/java/org/assertj/core/internal/DoubleArrays.java", "license": "apache-2.0", "size": 14215 }
[ "org.assertj.core.api.AssertionInfo" ]
import org.assertj.core.api.AssertionInfo;
import org.assertj.core.api.*;
[ "org.assertj.core" ]
org.assertj.core;
2,627,934
public void updateResidentIdP(IdentityProvider identityProvider) throws Exception { try { idPMgtStub.updateResidentIdP(identityProvider); } catch (Exception e) { log.error("Error in retrieving the list of Resident Identity Providers", e); throw new Exception("Error occurred while retrieving list of Identity Providers"); } }
void function(IdentityProvider identityProvider) throws Exception { try { idPMgtStub.updateResidentIdP(identityProvider); } catch (Exception e) { log.error(STR, e); throw new Exception(STR); } }
/** * Updated Resident Identity provider for a given tenant * * @return <code>FederatedIdentityProvider</code> * @throws Exception Error when getting Resident Identity Providers */
Updated Resident Identity provider for a given tenant
updateResidentIdP
{ "repo_name": "pulasthi7/carbon-identity", "path": "components/idp-mgt/org.wso2.carbon.idp.mgt.ui/src/main/java/org/wso2/carbon/idp/mgt/ui/client/IdentityProviderMgtServiceClient.java", "license": "apache-2.0", "size": 12520 }
[ "org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider" ]
import org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider;
import org.wso2.carbon.identity.application.common.model.idp.xsd.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
2,484,616
public final void setMaximumDpi(int dpi) { DisplayMetrics metrics = getResources().getDisplayMetrics(); float averageDpi = (metrics.xdpi + metrics.ydpi)/2; setMinScale(averageDpi/dpi); }
final void function(int dpi) { DisplayMetrics metrics = getResources().getDisplayMetrics(); float averageDpi = (metrics.xdpi + metrics.ydpi)/2; setMinScale(averageDpi/dpi); }
/** * This is a screen density aware alternative to {@link #setMinScale(float)}; it allows you to express the minimum * allowed scale in terms of the maximum pixel density. * @param dpi Source image pixel density at minimum zoom. */
This is a screen density aware alternative to <code>#setMinScale(float)</code>; it allows you to express the minimum allowed scale in terms of the maximum pixel density
setMaximumDpi
{ "repo_name": "augmify/subsampling-scale-image-view", "path": "library/src/com/davemorrissey/labs/subscaleview/SubsamplingScaleImageView.java", "license": "apache-2.0", "size": 114158 }
[ "android.util.DisplayMetrics" ]
import android.util.DisplayMetrics;
import android.util.*;
[ "android.util" ]
android.util;
1,944,163
// We can only skip the MemoryIndex verification when percolating a single document. // When the document being percolated contains a nested object field then the MemoryIndex contains multiple // documents. In this case the term query that indicates whether memory index verification can be skipped // can incorrectly indicate that non nested queries would match, while their nested variants would not. if (percolatorIndexSearcher.getIndexReader().maxDoc() == 1) { this.verifiedQueriesQuery = new TermQuery(new Term(extractionResultField, ExtractQueryTermsService.EXTRACTION_COMPLETE)); } this.queriesMetaDataQuery = ExtractQueryTermsService.createQueryTermsQuery( percolatorIndexSearcher.getIndexReader(), extractedTermsFieldName, // include extractionResultField:failed, because docs with this term have no extractedTermsField // and otherwise we would fail to return these docs. Docs that failed query term extraction // always need to be verified by MemoryIndex: new Term(extractionResultField, ExtractQueryTermsService.EXTRACTION_FAILED) ); }
if (percolatorIndexSearcher.getIndexReader().maxDoc() == 1) { this.verifiedQueriesQuery = new TermQuery(new Term(extractionResultField, ExtractQueryTermsService.EXTRACTION_COMPLETE)); } this.queriesMetaDataQuery = ExtractQueryTermsService.createQueryTermsQuery( percolatorIndexSearcher.getIndexReader(), extractedTermsFieldName, new Term(extractionResultField, ExtractQueryTermsService.EXTRACTION_FAILED) ); }
/** * Optionally sets a query that reduces the number of queries to percolate based on extracted terms from * the document to be percolated. * @param extractedTermsFieldName The name of the field to get the extracted terms from * @param extractionResultField The field to indicate for a document whether query term extraction was complete, * partial or failed. If query extraction was complete, the MemoryIndex doesn't */
Optionally sets a query that reduces the number of queries to percolate based on extracted terms from the document to be percolated
extractQueryTermsQuery
{ "repo_name": "cwurm/elasticsearch", "path": "modules/percolator/src/main/java/org/elasticsearch/percolator/PercolateQuery.java", "license": "apache-2.0", "size": 15801 }
[ "org.apache.lucene.index.Term", "org.apache.lucene.search.TermQuery" ]
import org.apache.lucene.index.Term; import org.apache.lucene.search.TermQuery;
import org.apache.lucene.index.*; import org.apache.lucene.search.*;
[ "org.apache.lucene" ]
org.apache.lucene;
721,387
public void overrideDuration(String durationString) { overrideDuration(XmlTypeConverter.createDuration(durationString)); }
void function(String durationString) { overrideDuration(XmlTypeConverter.createDuration(durationString)); }
/** * Extends offset on top of existing offset. */
Extends offset on top of existing offset
overrideDuration
{ "repo_name": "bshp/midPoint", "path": "infra/common/src/main/java/com/evolveum/midpoint/common/Clock.java", "license": "apache-2.0", "size": 3845 }
[ "com.evolveum.midpoint.prism.xml.XmlTypeConverter" ]
import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.prism.xml.*;
[ "com.evolveum.midpoint" ]
com.evolveum.midpoint;
2,755,448
@Requires({ "bytecode != null", "contracts != null" }) @Ensures("result != null") protected byte[] instrumentWithContracts(byte[] bytecode, ContractAnalyzer contracts) { ClassReader reader = new ClassReader(bytecode); ClassWriter writer = new NonLoadingClassWriter(reader, ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS); SpecificationClassAdapter adapter = new SpecificationClassAdapter(writer, contracts); reader.accept(adapter, ClassReader.EXPAND_FRAMES); return writer.toByteArray(); }
@Requires({ STR, STR }) @Ensures(STR) byte[] function(byte[] bytecode, ContractAnalyzer contracts) { ClassReader reader = new ClassReader(bytecode); ClassWriter writer = new NonLoadingClassWriter(reader, ClassWriter.COMPUTE_FRAMES ClassWriter.COMPUTE_MAXS); SpecificationClassAdapter adapter = new SpecificationClassAdapter(writer, contracts); reader.accept(adapter, ClassReader.EXPAND_FRAMES); return writer.toByteArray(); }
/** * Instruments the passed class file so that it contains contract * methods and calls to these methods. The contract information is * retrieved from the {@link ContractCodePool}. * * @param bytecode the bytecode of the class * @param contracts the extracted contracts for the class * @return the instrumented bytecode of the class */
Instruments the passed class file so that it contains contract methods and calls to these methods. The contract information is retrieved from the <code>ContractCodePool</code>
instrumentWithContracts
{ "repo_name": "konvergeio/cofoja", "path": "src/main/java/com/google/java/contract/core/agent/ContractClassFileTransformer.java", "license": "lgpl-3.0", "size": 13962 }
[ "com.google.java.contract.Ensures", "com.google.java.contract.Requires", "org.objectweb.asm.ClassReader", "org.objectweb.asm.ClassWriter" ]
import com.google.java.contract.Ensures; import com.google.java.contract.Requires; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter;
import com.google.java.contract.*; import org.objectweb.asm.*;
[ "com.google.java", "org.objectweb.asm" ]
com.google.java; org.objectweb.asm;
1,796,716
boolean newAccount = false; boolean setupComplete = PreferenceManager.getDefaultSharedPreferences( context).getBoolean(PREF_SETUP_COMPLETE, false); int syncFrequency = Integer.parseInt(PreferenceManager .getDefaultSharedPreferences(context).getString( Settings.KEY_SYNC_FREQUENCY, "6")); // Create account, if it's missing. (Either first run, or user has // deleted account.) Account account = GenericAccountService.getAccount(); AccountManager accountManager = (AccountManager) context .getSystemService(Context.ACCOUNT_SERVICE); if (accountManager.addAccountExplicitly(account, null, null)) { // Inform the system that this account supports sync ContentResolver.setIsSyncable(account, CONTENT_AUTHORITY, 1); // Inform the system that this account is eligible for auto sync // when the network is up ContentResolver.setSyncAutomatically(account, CONTENT_AUTHORITY, true); // Recommend a schedule for automatic synchronization. The system // may modify this based on other scheduled syncs and network // utilization. setSyncFrequency(syncFrequency); newAccount = true; } // Schedule an initial sync if we detect problems with either our // account or our local data has been deleted. (Note that it's possible // to clear app data WITHOUT affecting the account list, so wee need to // check both.) if (newAccount || !setupComplete) { triggerRefresh(); PreferenceManager.getDefaultSharedPreferences(context).edit() .putBoolean(PREF_SETUP_COMPLETE, true).commit(); } }
boolean newAccount = false; boolean setupComplete = PreferenceManager.getDefaultSharedPreferences( context).getBoolean(PREF_SETUP_COMPLETE, false); int syncFrequency = Integer.parseInt(PreferenceManager .getDefaultSharedPreferences(context).getString( Settings.KEY_SYNC_FREQUENCY, "6")); Account account = GenericAccountService.getAccount(); AccountManager accountManager = (AccountManager) context .getSystemService(Context.ACCOUNT_SERVICE); if (accountManager.addAccountExplicitly(account, null, null)) { ContentResolver.setIsSyncable(account, CONTENT_AUTHORITY, 1); ContentResolver.setSyncAutomatically(account, CONTENT_AUTHORITY, true); setSyncFrequency(syncFrequency); newAccount = true; } if (newAccount !setupComplete) { triggerRefresh(); PreferenceManager.getDefaultSharedPreferences(context).edit() .putBoolean(PREF_SETUP_COMPLETE, true).commit(); } }
/** * Create an entry for this application in the system account list, if it * isn't already there. * * @param context * Context */
Create an entry for this application in the system account list, if it isn't already there
createSyncAccount
{ "repo_name": "Trellmor/BerryMotesApp", "path": "berryMotesApp/src/main/java/com/trellmor/berrymotes/sync/SyncUtils.java", "license": "gpl-3.0", "size": 4687 }
[ "android.accounts.Account", "android.accounts.AccountManager", "android.content.ContentResolver", "android.content.Context", "android.preference.PreferenceManager", "com.trellmor.berrymotes.util.Settings" ]
import android.accounts.Account; import android.accounts.AccountManager; import android.content.ContentResolver; import android.content.Context; import android.preference.PreferenceManager; import com.trellmor.berrymotes.util.Settings;
import android.accounts.*; import android.content.*; import android.preference.*; import com.trellmor.berrymotes.util.*;
[ "android.accounts", "android.content", "android.preference", "com.trellmor.berrymotes" ]
android.accounts; android.content; android.preference; com.trellmor.berrymotes;
195,124
public CurrencyAmount presentValue( ResolvedDsfTrade trade, RatesProvider ratesProvider) { return calc.presentValue(trade, ratesProvider); } //------------------------------------------------------------------------- /** * Calculates present value sensitivity across one or more scenarios. * <p> * This is the sensitivity of * {@linkplain #presentValue(ResolvedDsfTrade, RatesMarketDataLookup, ScenarioMarketData) present value}
CurrencyAmount function( ResolvedDsfTrade trade, RatesProvider ratesProvider) { return calc.presentValue(trade, ratesProvider); } /** * Calculates present value sensitivity across one or more scenarios. * <p> * This is the sensitivity of * {@linkplain #presentValue(ResolvedDsfTrade, RatesMarketDataLookup, ScenarioMarketData) present value}
/** * Calculates present value for a single set of market data. * * @param trade the trade * @param ratesProvider the market data * @return the present value */
Calculates present value for a single set of market data
presentValue
{ "repo_name": "OpenGamma/Strata", "path": "modules/measure/src/main/java/com/opengamma/strata/measure/dsf/DsfTradeCalculations.java", "license": "apache-2.0", "size": 12802 }
[ "com.opengamma.strata.basics.currency.CurrencyAmount", "com.opengamma.strata.data.scenario.ScenarioMarketData", "com.opengamma.strata.measure.rate.RatesMarketDataLookup", "com.opengamma.strata.pricer.rate.RatesProvider", "com.opengamma.strata.product.dsf.ResolvedDsfTrade" ]
import com.opengamma.strata.basics.currency.CurrencyAmount; import com.opengamma.strata.data.scenario.ScenarioMarketData; import com.opengamma.strata.measure.rate.RatesMarketDataLookup; import com.opengamma.strata.pricer.rate.RatesProvider; import com.opengamma.strata.product.dsf.ResolvedDsfTrade;
import com.opengamma.strata.basics.currency.*; import com.opengamma.strata.data.scenario.*; import com.opengamma.strata.measure.rate.*; import com.opengamma.strata.pricer.rate.*; import com.opengamma.strata.product.dsf.*;
[ "com.opengamma.strata" ]
com.opengamma.strata;
1,257,814
public List<Task> getTasks(){ return Collections.unmodifiableList(projectTasks); }
List<Task> function(){ return Collections.unmodifiableList(projectTasks); }
/** * Returns an ArrayList of the tasks that are in this project. */
Returns an ArrayList of the tasks that are in this project
getTasks
{ "repo_name": "StevenThuriot/MOP", "path": "Java/src/model/Project.java", "license": "mit", "size": 2348 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,508,904
public String getClassNameFor(ClassInfo aInfo);
String function(ClassInfo aInfo);
/** * Get the Class name for the ClassInfo (without package name) * * @param aInfo * @return */
Get the Class name for the ClassInfo (without package name)
getClassNameFor
{ "repo_name": "schnurlei/jdynameta", "path": "jdy/jdy.base/src/main/java/de/jdynameta/base/value/ClassNameCreator.java", "license": "apache-2.0", "size": 1795 }
[ "de.jdynameta.base.metainfo.ClassInfo" ]
import de.jdynameta.base.metainfo.ClassInfo;
import de.jdynameta.base.metainfo.*;
[ "de.jdynameta.base" ]
de.jdynameta.base;
1,434,900
protected IPermissionSet cacheGet(IAuthorizationPrincipal principal) throws AuthorizationException { try { return (IPermissionSet) EntityCachingService.getEntityCachingService() .get(this.PERMISSION_SET_TYPE, principal.getPrincipalString()); } catch (CachingException ce) { throw new AuthorizationException( "Problem getting permissions for " + principal + " from cache", ce); } }
IPermissionSet function(IAuthorizationPrincipal principal) throws AuthorizationException { try { return (IPermissionSet) EntityCachingService.getEntityCachingService() .get(this.PERMISSION_SET_TYPE, principal.getPrincipalString()); } catch (CachingException ce) { throw new AuthorizationException( STR + principal + STR, ce); } }
/** * Retrieves the <code>IPermissionSet</code> for the <code>IPermissionSet</code> from the entity * cache. */
Retrieves the <code>IPermissionSet</code> for the <code>IPermissionSet</code> from the entity cache
cacheGet
{ "repo_name": "stalele/uPortal", "path": "uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java", "license": "apache-2.0", "size": 48081 }
[ "org.apereo.portal.AuthorizationException", "org.apereo.portal.concurrency.CachingException", "org.apereo.portal.security.IAuthorizationPrincipal", "org.apereo.portal.security.IPermissionSet", "org.apereo.portal.services.EntityCachingService" ]
import org.apereo.portal.AuthorizationException; import org.apereo.portal.concurrency.CachingException; import org.apereo.portal.security.IAuthorizationPrincipal; import org.apereo.portal.security.IPermissionSet; import org.apereo.portal.services.EntityCachingService;
import org.apereo.portal.*; import org.apereo.portal.concurrency.*; import org.apereo.portal.security.*; import org.apereo.portal.services.*;
[ "org.apereo.portal" ]
org.apereo.portal;
2,638,615
return ELEMENT_NAME; } /** * Receives the value of the ODFDOM attribute representation <code>FormBoundColumnAttribute</code> , See {@odf.attribute form:bound-column}
return ELEMENT_NAME; } /** * Receives the value of the ODFDOM attribute representation <code>FormBoundColumnAttribute</code> , See {@odf.attribute form:bound-column}
/** * Get the element name * * @return return <code>OdfName</code> the name of element {@odf.element form:listbox}. */
Get the element name
getOdfName
{ "repo_name": "jbjonesjr/geoproponis", "path": "external/odfdom-java-0.8.10-incubating-sources/org/odftoolkit/odfdom/dom/element/form/FormListboxElement.java", "license": "gpl-2.0", "size": 25763 }
[ "org.odftoolkit.odfdom.dom.attribute.form.FormBoundColumnAttribute" ]
import org.odftoolkit.odfdom.dom.attribute.form.FormBoundColumnAttribute;
import org.odftoolkit.odfdom.dom.attribute.form.*;
[ "org.odftoolkit.odfdom" ]
org.odftoolkit.odfdom;
337,424
public void mapDatasetToAxes(int index, List axisIndices) { if (index < 0) { throw new IllegalArgumentException("Requires 'index' >= 0."); } checkAxisIndices(axisIndices); Integer key = new Integer(index); this.datasetToAxesMap.put(key, new ArrayList(axisIndices)); // fake a dataset change event to update axes... datasetChanged(new DatasetChangeEvent(this, getDataset(index))); }
void function(int index, List axisIndices) { if (index < 0) { throw new IllegalArgumentException(STR); } checkAxisIndices(axisIndices); Integer key = new Integer(index); this.datasetToAxesMap.put(key, new ArrayList(axisIndices)); datasetChanged(new DatasetChangeEvent(this, getDataset(index))); }
/** * Maps the specified dataset to the axes in the list. Note that the * conversion of data values into Java2D space is always performed using * the first axis in the list. * * @param index the dataset index (zero-based). * @param axisIndices the axis indices ({@code null} permitted). * * @since 1.0.14 */
Maps the specified dataset to the axes in the list. Note that the conversion of data values into Java2D space is always performed using the first axis in the list
mapDatasetToAxes
{ "repo_name": "simon04/jfreechart", "path": "src/main/java/org/jfree/chart/plot/PolarPlot.java", "license": "lgpl-2.1", "size": 70680 }
[ "java.util.ArrayList", "java.util.List", "org.jfree.data.general.DatasetChangeEvent" ]
import java.util.ArrayList; import java.util.List; import org.jfree.data.general.DatasetChangeEvent;
import java.util.*; import org.jfree.data.general.*;
[ "java.util", "org.jfree.data" ]
java.util; org.jfree.data;
1,745,341
public void writeBytes(byte[] b) throws IOException { writeBytes(b, 0, b.length); }
void function(byte[] b) throws IOException { writeBytes(b, 0, b.length); }
/** * Writes an array of bytes. * * @param b the bytes to write */
Writes an array of bytes
writeBytes
{ "repo_name": "strahanjen/strahanjen.github.io", "path": "elasticsearch-master/core/src/main/java/org/elasticsearch/common/io/stream/StreamOutput.java", "license": "bsd-3-clause", "size": 30518 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
705,608
protected PostRequestBuilder POST(String pathOrUrl, boolean isFullUrl, boolean isHttps) { PostRequestBuilder client = getHttpClient().POST(createTestUrl(pathOrUrl, isFullUrl, isHttps)); if (isDisableSllCetificateErrors()) { client.disableSslCertificateErrors(); } return client; }
PostRequestBuilder function(String pathOrUrl, boolean isFullUrl, boolean isHttps) { PostRequestBuilder client = getHttpClient().POST(createTestUrl(pathOrUrl, isFullUrl, isHttps)); if (isDisableSllCetificateErrors()) { client.disableSslCertificateErrors(); } return client; }
/** * Starts an Http(s) Client builder for a POST method. * * A cookie store is automatically added. * * @param pathOrUrl a relative path or a full URL. * * @param isFullUrl if the 'pathOrUrl' parameter a full URL? If * so, it will be used as is. Otherwise it will be appended to the * base test URL. * * @param isHttps if <code>true</code>, "https:" will be used * instead of "http:". */
Starts an Http(s) Client builder for a POST method. A cookie store is automatically added
POST
{ "repo_name": "spincast/spincast-framework", "path": "spincast-testing/spincast-testing-core/src/main/java/org/spincast/testing/core/AppBasedTestingBase.java", "license": "apache-2.0", "size": 35096 }
[ "org.spincast.plugins.httpclient.builders.PostRequestBuilder" ]
import org.spincast.plugins.httpclient.builders.PostRequestBuilder;
import org.spincast.plugins.httpclient.builders.*;
[ "org.spincast.plugins" ]
org.spincast.plugins;
1,929,753
public synchronized void verifyStateIsValid() throws InvalidConfigurationException { // First, make sure all of the required fields have been set to // appropriate values. // ------------------------------------------------------------ if ( m_objectiveFunction == null && m_bulkObjectiveFunction == null ) { throw new InvalidConfigurationException( "A desired fitness function or bulk fitness function must " + "be specified in the active configuration." ); } if ( m_sampleChromosomeMaterial == null ) throw new InvalidConfigurationException( "Sample ChromosomeMaterial setup must be specified in the " + "active configuration." ); if ( m_populationSelector == null ) { throw new InvalidConfigurationException( "A desired natural selector must be specified in the active " + "configuration." ); } if ( m_randomGenerator == null ) { throw new InvalidConfigurationException( "A desired random number generator must be specified in the " + "active configuration." ); } if ( m_eventManager == null ) { throw new InvalidConfigurationException( "A desired event manager must be specified in the active " + "configuration." ); } if ( reproductionOperators.isEmpty() ) throw new InvalidConfigurationException( "At least one reproduction operator must be specified in the " + "configuration." ); // added by Tucker and James // make sure our slice of population add up to 1.0 float totalSlices = getNaturalSelector().getSurvivalRate(); Iterator it = getReproductionOperators().iterator(); while ( it.hasNext() ) { ReproductionOperator oper = (ReproductionOperator) it.next(); totalSlices += oper.getSlice(); } if ( totalSlices != 1.0f ) throw new InvalidConfigurationException( "Survival rate and reproduction rates are more than 1.0f." ); if ( m_populationSize <= 0 ) { throw new InvalidConfigurationException( "A genotype size greater than zero must be specified in " + "the active configuration." ); } }
synchronized void function() throws InvalidConfigurationException { if ( m_objectiveFunction == null && m_bulkObjectiveFunction == null ) { throw new InvalidConfigurationException( STR + STR ); } if ( m_sampleChromosomeMaterial == null ) throw new InvalidConfigurationException( STR + STR ); if ( m_populationSelector == null ) { throw new InvalidConfigurationException( STR + STR ); } if ( m_randomGenerator == null ) { throw new InvalidConfigurationException( STR + STR ); } if ( m_eventManager == null ) { throw new InvalidConfigurationException( STR + STR ); } if ( reproductionOperators.isEmpty() ) throw new InvalidConfigurationException( STR + STR ); float totalSlices = getNaturalSelector().getSurvivalRate(); Iterator it = getReproductionOperators().iterator(); while ( it.hasNext() ) { ReproductionOperator oper = (ReproductionOperator) it.next(); totalSlices += oper.getSlice(); } if ( totalSlices != 1.0f ) throw new InvalidConfigurationException( STR ); if ( m_populationSize <= 0 ) { throw new InvalidConfigurationException( STR + STR ); } }
/** * Tests the state of this Configuration object to make sure it's valid. This generally * consists of verifying that required settings have, in fact, been set. If this object is not * in a valid state, then an exception will be thrown detailing the reason the state is not * valid. * * @throws InvalidConfigurationException if the state of this Configuration is not valid. The * error message in the exception will detail the reason for invalidity. */
Tests the state of this Configuration object to make sure it's valid. This generally consists of verifying that required settings have, in fact, been set. If this object is not in a valid state, then an exception will be thrown detailing the reason the state is not valid
verifyStateIsValid
{ "repo_name": "jasoyode/gasneat", "path": "src/main/java/org/jgap/Configuration.java", "license": "gpl-3.0", "size": 20458 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
2,602,598
public void setListeners(Collection<? extends ApplicationListener<?>> listeners) { this.listeners = new ArrayList<ApplicationListener<?>>(); this.listeners.addAll(listeners); }
void function(Collection<? extends ApplicationListener<?>> listeners) { this.listeners = new ArrayList<ApplicationListener<?>>(); this.listeners.addAll(listeners); }
/** * Sets the {@link ApplicationListener}s that will be applied to the SpringApplication * and registered with the {@link ApplicationContext}. * @param listeners the listeners to set */
Sets the <code>ApplicationListener</code>s that will be applied to the SpringApplication and registered with the <code>ApplicationContext</code>
setListeners
{ "repo_name": "vgul/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/SpringApplication.java", "license": "apache-2.0", "size": 44613 }
[ "java.util.ArrayList", "java.util.Collection", "org.springframework.context.ApplicationListener" ]
import java.util.ArrayList; import java.util.Collection; import org.springframework.context.ApplicationListener;
import java.util.*; import org.springframework.context.*;
[ "java.util", "org.springframework.context" ]
java.util; org.springframework.context;
1,479,652
public static void setLookAndFeel(String laf) { try { UIManager.setLookAndFeel(laf); } catch (Exception e) { log.debug("Could not load Look-and-Feel " + laf + " . " + "Probably it is not installed."); } }
static void function(String laf) { try { UIManager.setLookAndFeel(laf); } catch (Exception e) { log.debug(STR + laf + STR + STR); } }
/** * Changes the LookAndFeel according to the settings. * */
Changes the LookAndFeel according to the settings
setLookAndFeel
{ "repo_name": "flyroom/PeerfactSimKOM_Clone", "path": "src/org/peerfact/impl/analyzer/visualization2d/util/gui/LookAndFeel.java", "license": "gpl-2.0", "size": 2772 }
[ "javax.swing.UIManager" ]
import javax.swing.UIManager;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
69,384
protected static void extractContent(ResourceToolActionPipe pipe, ContentResourceEdit resource) { logger.debug("ResourcesAction.extractContent()"); byte[] content = pipe.getRevisedContent(); if(content == null) { InputStream stream = pipe.getRevisedContentStream(); if(stream == null) { logger.debug("pipe with null content and null stream: " + pipe.getFileName()); } else { resource.setContent(stream); } } else { resource.setContent(content); } }
static void function(ResourceToolActionPipe pipe, ContentResourceEdit resource) { logger.debug(STR); byte[] content = pipe.getRevisedContent(); if(content == null) { InputStream stream = pipe.getRevisedContentStream(); if(stream == null) { logger.debug(STR + pipe.getFileName()); } else { resource.setContent(stream); } } else { resource.setContent(content); } }
/** * Utility method to get revised content either from a byte array or a stream. */
Utility method to get revised content either from a byte array or a stream
extractContent
{ "repo_name": "noondaysun/sakai", "path": "content/content-tool/tool/src/java/org/sakaiproject/content/tool/ResourcesAction.java", "license": "apache-2.0", "size": 337685 }
[ "java.io.InputStream", "org.sakaiproject.content.api.ContentResourceEdit", "org.sakaiproject.content.api.ResourceToolActionPipe" ]
import java.io.InputStream; import org.sakaiproject.content.api.ContentResourceEdit; import org.sakaiproject.content.api.ResourceToolActionPipe;
import java.io.*; import org.sakaiproject.content.api.*;
[ "java.io", "org.sakaiproject.content" ]
java.io; org.sakaiproject.content;
2,312,219
EReference getBlock_Chidren();
EReference getBlock_Chidren();
/** * Returns the meta object for the containment reference list '{@link br.ufpe.ines.decode.decode.artifacts.questionnaire.Block#getChidren <em>Chidren</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the containment reference list '<em>Chidren</em>'. * @see br.ufpe.ines.decode.decode.artifacts.questionnaire.Block#getChidren() * @see #getBlock() * @generated */
Returns the meta object for the containment reference list '<code>br.ufpe.ines.decode.decode.artifacts.questionnaire.Block#getChidren Chidren</code>'.
getBlock_Chidren
{ "repo_name": "netuh/DecodePlatformPlugin", "path": "br.ufpe.ines.decode/bundles/br.ufpe.ines.decode.model/src/br/ufpe/ines/decode/decode/artifacts/questionnaire/QuestionnairePackage.java", "license": "gpl-3.0", "size": 38583 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,290,520
public static ITMModelManager getTMModelManager() { return TMModelManager.getInstance(); }
static ITMModelManager function() { return TMModelManager.getInstance(); }
/** * Returns the TextMate model manager. * * @return the TextMate model manager. */
Returns the TextMate model manager
getTMModelManager
{ "repo_name": "angelozerr/textmate.java", "path": "org.eclipse.tm4e.ui/src/main/java/org/eclipse/tm4e/ui/TMUIPlugin.java", "license": "mit", "size": 3691 }
[ "org.eclipse.tm4e.ui.internal.model.TMModelManager", "org.eclipse.tm4e.ui.model.ITMModelManager" ]
import org.eclipse.tm4e.ui.internal.model.TMModelManager; import org.eclipse.tm4e.ui.model.ITMModelManager;
import org.eclipse.tm4e.ui.internal.model.*; import org.eclipse.tm4e.ui.model.*;
[ "org.eclipse.tm4e" ]
org.eclipse.tm4e;
2,120,109
@Test public void testNameIndexRenderer() { final HusbandRenderer renderer = createRenderer(); assertTrue("Wrong renderer type", renderer.getNameIndexRenderer() instanceof NullNameIndexRenderer); }
void function() { final HusbandRenderer renderer = createRenderer(); assertTrue(STR, renderer.getNameIndexRenderer() instanceof NullNameIndexRenderer); }
/** * Test that we are using the appropriate sub-renderers. * We will test the sub-renderers directly. */
Test that we are using the appropriate sub-renderers. We will test the sub-renderers directly
testNameIndexRenderer
{ "repo_name": "dickschoeller/gedbrowser", "path": "gedbrowser-renderer/src/test/java/org/schoellerfamily/gedbrowser/renderer/test/HusbandRendererTest.java", "license": "apache-2.0", "size": 3652 }
[ "org.junit.Assert", "org.schoellerfamily.gedbrowser.renderer.HusbandRenderer", "org.schoellerfamily.gedbrowser.renderer.NullNameIndexRenderer" ]
import org.junit.Assert; import org.schoellerfamily.gedbrowser.renderer.HusbandRenderer; import org.schoellerfamily.gedbrowser.renderer.NullNameIndexRenderer;
import org.junit.*; import org.schoellerfamily.gedbrowser.renderer.*;
[ "org.junit", "org.schoellerfamily.gedbrowser" ]
org.junit; org.schoellerfamily.gedbrowser;
1,393,005
public static String getPartialName(String originalName) { return UIUtilities.getPartialName(originalName); }
static String function(String originalName) { return UIUtilities.getPartialName(originalName); }
/** * Returns the partial name of the image's name * * @param originalName The original name. * @return See above. */
Returns the partial name of the image's name
getPartialName
{ "repo_name": "stelfrich/openmicroscopy", "path": "components/insight/SRC/org/openmicroscopy/shoola/agents/util/EditorUtil.java", "license": "gpl-2.0", "size": 91785 }
[ "org.openmicroscopy.shoola.util.ui.UIUtilities" ]
import org.openmicroscopy.shoola.util.ui.UIUtilities;
import org.openmicroscopy.shoola.util.ui.*;
[ "org.openmicroscopy.shoola" ]
org.openmicroscopy.shoola;
2,672,849
private void closeLine() throws IOException { if (out != null) { out.append("]\n"); } }
void function() throws IOException { if (out != null) { out.append("]\n"); } }
/** * End the entry for a line. */
End the entry for a line
closeLine
{ "repo_name": "ehsan/js-symbolic-executor", "path": "closure-compiler/src/com/google/javascript/jscomp/SourceMapLegacy.java", "license": "apache-2.0", "size": 19605 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
922,974
@Override protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
void function(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); }
/** * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children * that can be created under this object. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds <code>org.eclipse.emf.edit.command.CommandParameter</code>s describing the children that can be created under this object.
collectNewChildDescriptors
{ "repo_name": "debabratahazra/DS", "path": "designstudio/components/page/ui/com.odcgroup.page.edit/src/generated/java/com/odcgroup/page/uimodel/provider/ActionGroupItemProvider.java", "license": "epl-1.0", "size": 4284 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,147,700
Boolean getIsEmpty(Guid id);
Boolean getIsEmpty(Guid id);
/** * Returns the specified VDS group if it does not have any VMs or clusters. * * @param id * the group id * @return the VDS group */
Returns the specified VDS group if it does not have any VMs or clusters
getIsEmpty
{ "repo_name": "OpenUniversity/ovirt-engine", "path": "backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/ClusterDao.java", "license": "apache-2.0", "size": 5288 }
[ "org.ovirt.engine.core.compat.Guid" ]
import org.ovirt.engine.core.compat.Guid;
import org.ovirt.engine.core.compat.*;
[ "org.ovirt.engine" ]
org.ovirt.engine;
356,149
EReference getCompleteValueSetReference_ValueSet();
EReference getCompleteValueSetReference_ValueSet();
/** * Returns the meta object for the containment reference ' * {@link org.openhealthtools.mdht.cts2.valuesetdefinition.CompleteValueSetReference#getValueSet <em>Value Set</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @return the meta object for the containment reference '<em>Value Set</em>'. * @see org.openhealthtools.mdht.cts2.valuesetdefinition.CompleteValueSetReference#getValueSet() * @see #getCompleteValueSetReference() * @generated */
Returns the meta object for the containment reference ' <code>org.openhealthtools.mdht.cts2.valuesetdefinition.CompleteValueSetReference#getValueSet Value Set</code>'.
getCompleteValueSetReference_ValueSet
{ "repo_name": "drbgfc/mdht", "path": "cts2/plugins/org.openhealthtools.mdht.cts2.core/src/org/openhealthtools/mdht/cts2/valuesetdefinition/ValueSetDefinitionPackage.java", "license": "epl-1.0", "size": 132102 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,550,562
public String getInvocationAsProgram( Executable executable, ScriptEngine scriptEngine, String content, Object... arguments ) { return null; }
String function( Executable executable, ScriptEngine scriptEngine, String content, Object... arguments ) { return null; }
/** * Creates a command or series of commands to invoke an entry point * (function, method, closure, etc.) in the script. Note that for engines * that implement {@link Invocable} you must return null. * * @param executable * The composite script instance * @param scriptEngine * The script engine * @param content * The content * @param arguments * The arguments * @return A command or series of commands to call the entry point, or null * to signify that {@link Invocable} should be used */
Creates a command or series of commands to invoke an entry point (function, method, closure, etc.) in the script. Note that for engines that implement <code>Invocable</code> you must return null
getInvocationAsProgram
{ "repo_name": "tliron/scripturian", "path": "components/scripturian/source/com/threecrickets/scripturian/adapter/jsr223/Jsr223LanguageAdapter.java", "license": "lgpl-3.0", "size": 19363 }
[ "com.threecrickets.scripturian.Executable", "javax.script.ScriptEngine" ]
import com.threecrickets.scripturian.Executable; import javax.script.ScriptEngine;
import com.threecrickets.scripturian.*; import javax.script.*;
[ "com.threecrickets.scripturian", "javax.script" ]
com.threecrickets.scripturian; javax.script;
706,540
@SkylarkCallable( name = "executable", doc = "The main executable or None if it does not exist", structField = true, allowReturnNones = true ) @Nullable public Artifact getExecutable() { return executable; }
@SkylarkCallable( name = STR, doc = STR, structField = true, allowReturnNones = true ) Artifact function() { return executable; }
/** * Returns the Executable or null if it does not exist. */
Returns the Executable or null if it does not exist
getExecutable
{ "repo_name": "iamthearm/bazel", "path": "src/main/java/com/google/devtools/build/lib/analysis/FilesToRunProvider.java", "license": "apache-2.0", "size": 3912 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.skylarkinterface.SkylarkCallable" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.skylarkinterface.*;
[ "com.google.devtools" ]
com.google.devtools;
1,129,623
void stopBoundScrollAnimation() { DVUtils.cancelAnimationWithoutCallbacks(mScrollAnimator); }
void stopBoundScrollAnimation() { DVUtils.cancelAnimationWithoutCallbacks(mScrollAnimator); }
/** * Aborts any current stack scrolls */
Aborts any current stack scrolls
stopBoundScrollAnimation
{ "repo_name": "fairytale110/FTMostBeautifyThing", "path": "deckview/src/main/java/com/appeaser/deckview/views/DeckViewScroller.java", "license": "apache-2.0", "size": 6954 }
[ "com.appeaser.deckview.utilities.DVUtils" ]
import com.appeaser.deckview.utilities.DVUtils;
import com.appeaser.deckview.utilities.*;
[ "com.appeaser.deckview" ]
com.appeaser.deckview;
441,655
public Set<Failure> validateArchive(List<Validate> archiveValidationObjs, Set<Failure> failures) { // Archive validation if (!archiveValidation) { return null; } for (Validate validate : archiveValidationObjs) { if (!(validate instanceof Validate)) return null; } org.ironjacamar.validator.Validator validator = new org.ironjacamar.validator.Validator(); List<Failure> partialFailures = validator.validate(archiveValidationObjs); if (partialFailures != null) { if (failures == null) { failures = new HashSet<>(); } failures.addAll(partialFailures); } return failures; }
Set<Failure> function(List<Validate> archiveValidationObjs, Set<Failure> failures) { if (!archiveValidation) { return null; } for (Validate validate : archiveValidationObjs) { if (!(validate instanceof Validate)) return null; } org.ironjacamar.validator.Validator validator = new org.ironjacamar.validator.Validator(); List<Failure> partialFailures = validator.validate(archiveValidationObjs); if (partialFailures != null) { if (failures == null) { failures = new HashSet<>(); } failures.addAll(partialFailures); } return failures; }
/** * validate archive * * @param archiveValidationObjs archiveValidation archiveValidation classes and/or to validate. * @param failures failures failures original list of failures * @return The list of failures gotten with all new failures added. Null in case of no failures * or if validation is not run according to archiveValidation Setting. It returns null also if * the concrete implementation of this class set validateClasses instance variable to flase and the list of * archiveValidation contains one or more instance of {@link ValidateClass} type */
validate archive
validateArchive
{ "repo_name": "jandsu/ironjacamar", "path": "deployers/src/main/java/org/ironjacamar/deployers/common/AbstractResourceAdapterDeployer.java", "license": "epl-1.0", "size": 56166 }
[ "java.util.HashSet", "java.util.List", "java.util.Set", "org.ironjacamar.validator.Failure", "org.ironjacamar.validator.Validate", "org.ironjacamar.validator.Validator" ]
import java.util.HashSet; import java.util.List; import java.util.Set; import org.ironjacamar.validator.Failure; import org.ironjacamar.validator.Validate; import org.ironjacamar.validator.Validator;
import java.util.*; import org.ironjacamar.validator.*;
[ "java.util", "org.ironjacamar.validator" ]
java.util; org.ironjacamar.validator;
2,328,490
public void CommandStateChange(Variant[] args) { System.out.println("IEEvents Received (" + Thread.currentThread().getName() + "): CommandStateChange " + args.length + " parameters"); }
void function(Variant[] args) { System.out.println(STR + Thread.currentThread().getName() + STR + args.length + STR); }
/** * Internet explorer event this proxy can receive * * @param args * the COM Variant objects that this event passes in. */
Internet explorer event this proxy can receive
CommandStateChange
{ "repo_name": "joval/jacob", "path": "unittest/com/jacob/test/events/IETest.java", "license": "lgpl-2.1", "size": 12863 }
[ "com.jacob.com.Variant" ]
import com.jacob.com.Variant;
import com.jacob.com.*;
[ "com.jacob.com" ]
com.jacob.com;
1,502,714
@Test @OperateOnDeployment(SD_DEFAULT) public void testFailedAuthWrongUser(@ArquillianResource URL url) throws Exception { final URL servletUrl = new URL(url.toExternalForm() + "role1"); final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue(); queue.clear(); Utils.makeCallWithBasicAuthn(servletUrl, UNKNOWN_USER, PASSWORD, SC_UNAUTHORIZED); assertTrue("Failed authentication with wrong user was not logged", loggedFailedAuth(queue, UNKNOWN_USER)); }
@OperateOnDeployment(SD_DEFAULT) void function(@ArquillianResource URL url) throws Exception { final URL servletUrl = new URL(url.toExternalForm() + "role1"); final BlockingQueue<SyslogServerEventIF> queue = BlockedSyslogServerEventHandler.getQueue(); queue.clear(); Utils.makeCallWithBasicAuthn(servletUrl, UNKNOWN_USER, PASSWORD, SC_UNAUTHORIZED); assertTrue(STR, loggedFailedAuth(queue, UNKNOWN_USER)); }
/** * Tests whether failed authentication with wrong user was logged. */
Tests whether failed authentication with wrong user was logged
testFailedAuthWrongUser
{ "repo_name": "tomazzupan/wildfly", "path": "testsuite/integration/elytron/src/test/java/org/wildfly/test/integration/elytron/audit/AbstractSyslogAuditLogTestCase.java", "license": "lgpl-2.1", "size": 7733 }
[ "java.util.concurrent.BlockingQueue", "org.jboss.arquillian.container.test.api.OperateOnDeployment", "org.jboss.arquillian.test.api.ArquillianResource", "org.jboss.as.test.integration.security.common.Utils", "org.jboss.as.test.syslogserver.BlockedSyslogServerEventHandler", "org.junit.Assert", "org.productivity.java.syslog4j.server.SyslogServerEventIF" ]
import java.util.concurrent.BlockingQueue; import org.jboss.arquillian.container.test.api.OperateOnDeployment; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.integration.security.common.Utils; import org.jboss.as.test.syslogserver.BlockedSyslogServerEventHandler; import org.junit.Assert; import org.productivity.java.syslog4j.server.SyslogServerEventIF;
import java.util.concurrent.*; import org.jboss.arquillian.container.test.api.*; import org.jboss.arquillian.test.api.*; import org.jboss.as.test.integration.security.common.*; import org.jboss.as.test.syslogserver.*; import org.junit.*; import org.productivity.java.syslog4j.server.*;
[ "java.util", "org.jboss.arquillian", "org.jboss.as", "org.junit", "org.productivity.java" ]
java.util; org.jboss.arquillian; org.jboss.as; org.junit; org.productivity.java;
1,979,613
public InputStream openStream() throws IOException { if (((Closeable) stream).isClosed()) { throw new ItemSkippedException(); } return stream; }
InputStream function() throws IOException { if (((Closeable) stream).isClosed()) { throw new ItemSkippedException(); } return stream; }
/** * Returns an input stream, which may be used to * read the items contents. * * @return Opened input stream. * @throws IOException An I/O error occurred. */
Returns an input stream, which may be used to read the items contents
openStream
{ "repo_name": "callkalpa/product-mss", "path": "core/src/main/java/org/wso2/msf4j/formparam/FormItem.java", "license": "apache-2.0", "size": 4849 }
[ "java.io.IOException", "java.io.InputStream", "org.wso2.msf4j.formparam.util.Closeable" ]
import java.io.IOException; import java.io.InputStream; import org.wso2.msf4j.formparam.util.Closeable;
import java.io.*; import org.wso2.msf4j.formparam.util.*;
[ "java.io", "org.wso2.msf4j" ]
java.io; org.wso2.msf4j;
425,042
public synchronized void stopRandomNode(final Predicate<Settings> filter) throws IOException { ensureOpen(); NodeAndClient nodeAndClient = getRandomNodeAndClient(nc -> filter.test(nc.node.settings())); if (nodeAndClient != null) { logger.info("Closing filtered random node [{}] ", nodeAndClient.name); removeDisruptionSchemeFromNode(nodeAndClient); nodes.remove(nodeAndClient.name); nodeAndClient.close(); } }
synchronized void function(final Predicate<Settings> filter) throws IOException { ensureOpen(); NodeAndClient nodeAndClient = getRandomNodeAndClient(nc -> filter.test(nc.node.settings())); if (nodeAndClient != null) { logger.info(STR, nodeAndClient.name); removeDisruptionSchemeFromNode(nodeAndClient); nodes.remove(nodeAndClient.name); nodeAndClient.close(); } }
/** * Stops a random node in the cluster that applies to the given filter or non if the non of the nodes applies to the * filter. */
Stops a random node in the cluster that applies to the given filter or non if the non of the nodes applies to the filter
stopRandomNode
{ "repo_name": "jchampion/elasticsearch", "path": "test/framework/src/main/java/org/elasticsearch/test/InternalTestCluster.java", "license": "apache-2.0", "size": 81674 }
[ "java.io.IOException", "java.util.function.Predicate", "org.elasticsearch.common.settings.Settings" ]
import java.io.IOException; import java.util.function.Predicate; import org.elasticsearch.common.settings.Settings;
import java.io.*; import java.util.function.*; import org.elasticsearch.common.settings.*;
[ "java.io", "java.util", "org.elasticsearch.common" ]
java.io; java.util; org.elasticsearch.common;
399,769
@Test public void testSendBroadcastExplicitDataSuccess() throws TimeoutException, XBeeException { // Do nothing when the sendExplicitData(XBee64BitAddress, int, int, int, int, byte[]) method is called. Mockito.doNothing().when(digiMeshDevice).sendExplicitData(Mockito.any(XBee64BitAddress.class), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), Mockito.any(byte[].class)); digiMeshDevice.sendBroadcastExplicitData(SOURCE_ENDPOINT, DESTINATION_ENDPOINT, CLUSTER_ID, PROFILE_ID, DATA.getBytes()); // Verify the sendExplicitData(XBee64BitAddress, int, int, int, int, byte[]) method was called (64BitAddress must be the broadcast one). Mockito.verify(digiMeshDevice, Mockito.times(1)).sendExplicitData(Mockito.eq(XBee64BitAddress.BROADCAST_ADDRESS), Mockito.eq(SOURCE_ENDPOINT), Mockito.eq(DESTINATION_ENDPOINT), Mockito.eq(CLUSTER_ID), Mockito.eq(PROFILE_ID), Mockito.eq(DATA.getBytes())); }
void function() throws TimeoutException, XBeeException { Mockito.doNothing().when(digiMeshDevice).sendExplicitData(Mockito.any(XBee64BitAddress.class), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), Mockito.anyInt(), Mockito.any(byte[].class)); digiMeshDevice.sendBroadcastExplicitData(SOURCE_ENDPOINT, DESTINATION_ENDPOINT, CLUSTER_ID, PROFILE_ID, DATA.getBytes()); Mockito.verify(digiMeshDevice, Mockito.times(1)).sendExplicitData(Mockito.eq(XBee64BitAddress.BROADCAST_ADDRESS), Mockito.eq(SOURCE_ENDPOINT), Mockito.eq(DESTINATION_ENDPOINT), Mockito.eq(CLUSTER_ID), Mockito.eq(PROFILE_ID), Mockito.eq(DATA.getBytes())); }
/** * Test method for {@link com.digi.xbee.api.DigiMeshDevice#sendBroadcastExplicitData(int, int, int, int, byte[])}. * * <p>Verify that the super com.digi.xbee.api.XBeeDevice#sendBroadcastExplicitData(int, int, int, int, byte[]) method is * called when executing the com.digi.xbee.api.DigiMeshDevice#sendBroadcastExplicitData(int, int, int, int, byte[]) method.</p> * * @throws XBeeException * @throws TimeoutException */
Test method for <code>com.digi.xbee.api.DigiMeshDevice#sendBroadcastExplicitData(int, int, int, int, byte[])</code>. Verify that the super com.digi.xbee.api.XBeeDevice#sendBroadcastExplicitData(int, int, int, int, byte[]) method is called when executing the com.digi.xbee.api.DigiMeshDevice#sendBroadcastExplicitData(int, int, int, int, byte[]) method
testSendBroadcastExplicitDataSuccess
{ "repo_name": "digidotcom/XBeeJavaLibrary", "path": "library/src/test/java/com/digi/xbee/api/SendDataHighLevelDigiMeshTest.java", "license": "mpl-2.0", "size": 11590 }
[ "com.digi.xbee.api.exceptions.TimeoutException", "com.digi.xbee.api.exceptions.XBeeException", "com.digi.xbee.api.models.XBee64BitAddress", "org.mockito.Mockito" ]
import com.digi.xbee.api.exceptions.TimeoutException; import com.digi.xbee.api.exceptions.XBeeException; import com.digi.xbee.api.models.XBee64BitAddress; import org.mockito.Mockito;
import com.digi.xbee.api.exceptions.*; import com.digi.xbee.api.models.*; import org.mockito.*;
[ "com.digi.xbee", "org.mockito" ]
com.digi.xbee; org.mockito;
1,006,761
public static Schema extractParquetSchema(CarbonFile dataFile, Configuration configuration) throws IOException { ParquetReader<GenericRecord> parquetReader = buildParquetReader(dataFile.getPath(), configuration); Schema parquetSchema = parquetReader.read().getSchema(); parquetReader.close(); return parquetSchema; }
static Schema function(CarbonFile dataFile, Configuration configuration) throws IOException { ParquetReader<GenericRecord> parquetReader = buildParquetReader(dataFile.getPath(), configuration); Schema parquetSchema = parquetReader.read().getSchema(); parquetReader.close(); return parquetSchema; }
/** * TO extract the parquet schema from the given parquet file */
TO extract the parquet schema from the given parquet file
extractParquetSchema
{ "repo_name": "zzcclp/carbondata", "path": "sdk/sdk/src/main/java/org/apache/carbondata/sdk/file/ParquetCarbonWriter.java", "license": "apache-2.0", "size": 4570 }
[ "java.io.IOException", "org.apache.avro.Schema", "org.apache.avro.generic.GenericRecord", "org.apache.carbondata.core.datastore.filesystem.CarbonFile", "org.apache.hadoop.conf.Configuration", "org.apache.parquet.hadoop.ParquetReader" ]
import java.io.IOException; import org.apache.avro.Schema; import org.apache.avro.generic.GenericRecord; import org.apache.carbondata.core.datastore.filesystem.CarbonFile; import org.apache.hadoop.conf.Configuration; import org.apache.parquet.hadoop.ParquetReader;
import java.io.*; import org.apache.avro.*; import org.apache.avro.generic.*; import org.apache.carbondata.core.datastore.filesystem.*; import org.apache.hadoop.conf.*; import org.apache.parquet.hadoop.*;
[ "java.io", "org.apache.avro", "org.apache.carbondata", "org.apache.hadoop", "org.apache.parquet" ]
java.io; org.apache.avro; org.apache.carbondata; org.apache.hadoop; org.apache.parquet;
1,262,586
@VisibleForTesting public void updatePartitionCountMetric() { try { Map<SystemStream, SystemStreamMetadata> currentMetadata = getMetadata(streamsToMonitor, metadataCache); Set<SystemStream> streamsChanged = new HashSet<>(); for (Map.Entry<SystemStream, SystemStreamMetadata> metadataEntry : initialMetadata.entrySet()) { try { SystemStream systemStream = metadataEntry.getKey(); SystemStreamMetadata metadata = metadataEntry.getValue(); int currentPartitionCount = currentMetadata.get(systemStream).getSystemStreamPartitionMetadata().size(); int prevPartitionCount = metadata.getSystemStreamPartitionMetadata().size(); Gauge gauge = gauges.get(systemStream); gauge.set(currentPartitionCount); if (currentPartitionCount != prevPartitionCount) { log.warn(String.format("Change of partition count detected in stream %s. old partition count: %d, current partition count: %d", systemStream.toString(), prevPartitionCount, currentPartitionCount)); if (currentPartitionCount > prevPartitionCount) { log.error(String.format("Shutting down (stateful) or restarting (stateless) the job since current " + "partition count %d is greater than the old partition count %d for stream %s.", currentPartitionCount, prevPartitionCount, systemStream.toString())); streamsChanged.add(systemStream); } } } catch (Exception e) { log.error(String.format("Error comparing partition count differences for stream: %s", metadataEntry.getKey().toString())); } } if (!streamsChanged.isEmpty() && this.callbackMethod != null) { this.callbackMethod.onSystemStreamPartitionChange(streamsChanged); } } catch (Exception e) { log.error("Exception while updating partition count metric.", e); } }
void function() { try { Map<SystemStream, SystemStreamMetadata> currentMetadata = getMetadata(streamsToMonitor, metadataCache); Set<SystemStream> streamsChanged = new HashSet<>(); for (Map.Entry<SystemStream, SystemStreamMetadata> metadataEntry : initialMetadata.entrySet()) { try { SystemStream systemStream = metadataEntry.getKey(); SystemStreamMetadata metadata = metadataEntry.getValue(); int currentPartitionCount = currentMetadata.get(systemStream).getSystemStreamPartitionMetadata().size(); int prevPartitionCount = metadata.getSystemStreamPartitionMetadata().size(); Gauge gauge = gauges.get(systemStream); gauge.set(currentPartitionCount); if (currentPartitionCount != prevPartitionCount) { log.warn(String.format(STR, systemStream.toString(), prevPartitionCount, currentPartitionCount)); if (currentPartitionCount > prevPartitionCount) { log.error(String.format(STR + STR, currentPartitionCount, prevPartitionCount, systemStream.toString())); streamsChanged.add(systemStream); } } } catch (Exception e) { log.error(String.format(STR, metadataEntry.getKey().toString())); } } if (!streamsChanged.isEmpty() && this.callbackMethod != null) { this.callbackMethod.onSystemStreamPartitionChange(streamsChanged); } } catch (Exception e) { log.error(STR, e); } }
/** * Fetches the current partition count for each system stream from the cache, compares the current count to the * original count and updates the metric for that system stream with the delta. */
Fetches the current partition count for each system stream from the cache, compares the current count to the original count and updates the metric for that system stream with the delta
updatePartitionCountMetric
{ "repo_name": "lhaiesp/samza", "path": "samza-core/src/main/java/org/apache/samza/coordinator/StreamPartitionCountMonitor.java", "license": "apache-2.0", "size": 9645 }
[ "java.util.HashSet", "java.util.Map", "java.util.Set", "org.apache.samza.metrics.Gauge", "org.apache.samza.system.SystemStream", "org.apache.samza.system.SystemStreamMetadata" ]
import java.util.HashSet; import java.util.Map; import java.util.Set; import org.apache.samza.metrics.Gauge; import org.apache.samza.system.SystemStream; import org.apache.samza.system.SystemStreamMetadata;
import java.util.*; import org.apache.samza.metrics.*; import org.apache.samza.system.*;
[ "java.util", "org.apache.samza" ]
java.util; org.apache.samza;
439,799
public void setErrorHandler(ErrorHandler handler) { }
void function(ErrorHandler handler) { }
/** * Not supported. * * @see org.xml.sax.XMLReader#setErrorHandler(org.xml.sax.ErrorHandler) */
Not supported
setErrorHandler
{ "repo_name": "NCIP/cadsr-cgmdr-nci-uk", "path": "src/org/exist/cocoon/XMLReaderWrapper.java", "license": "bsd-3-clause", "size": 4868 }
[ "org.xml.sax.ErrorHandler" ]
import org.xml.sax.ErrorHandler;
import org.xml.sax.*;
[ "org.xml.sax" ]
org.xml.sax;
798,990
boolean CreateProcess(String lpApplicationName, String lpCommandLine, WinBase.SECURITY_ATTRIBUTES lpProcessAttributes, WinBase.SECURITY_ATTRIBUTES lpThreadAttributes, boolean bInheritHandles, DWORD dwCreationFlags, Pointer lpEnvironment, String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo, WinBase.PROCESS_INFORMATION.ByReference lpProcessInformation);
boolean CreateProcess(String lpApplicationName, String lpCommandLine, WinBase.SECURITY_ATTRIBUTES lpProcessAttributes, WinBase.SECURITY_ATTRIBUTES lpThreadAttributes, boolean bInheritHandles, DWORD dwCreationFlags, Pointer lpEnvironment, String lpCurrentDirectory, WinBase.STARTUPINFO lpStartupInfo, WinBase.PROCESS_INFORMATION.ByReference lpProcessInformation);
/** * Creates a new process and its primary thread. The new process runs in the security context of the calling * process. * * @param lpApplicationName The name of the module to be executed. * @param lpCommandLine The command line to be executed. * @param lpProcessAttributes * A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new process * object can be inherited by child processes. If lpProcessAttributes is NULL, the handle cannot be inherited. * * @param lpThreadAttributes * A pointer to a SECURITY_ATTRIBUTES structure that determines whether the returned handle to the new thread * object can be inherited by child processes. If lpThreadAttributes is NULL, the handle cannot be inherited. * * @param bInheritHandles * If this parameter TRUE, each inheritable handle in the calling process is inherited by the new process. If the * parameter is FALSE, the handles are not inherited. Note that inherited handles have the same value and access * rights as the original handles. * * @param dwCreationFlags The flags that control the priority class and the creation of the process. * @param lpEnvironment * A pointer to the environment block for the new process. If this parameter is NULL, the new process uses the * environment of the calling process. * * @param lpCurrentDirectory The full path to the current directory for the process. * @param lpStartupInfo A pointer to a STARTUPINFO or STARTUPINFOEX structure. * @param lpProcessInformation * A pointer to a PROCESS_INFORMATION structure that receives identification information about the new process. * @return If the function succeeds, the return value is nonzero. */
Creates a new process and its primary thread. The new process runs in the security context of the calling process
CreateProcess
{ "repo_name": "lahorichargha/jna", "path": "contrib/platform/src/com/sun/jna/platform/win32/WinNT.java", "license": "lgpl-2.1", "size": 126942 }
[ "com.sun.jna.Pointer", "com.sun.jna.ptr.ByReference" ]
import com.sun.jna.Pointer; import com.sun.jna.ptr.ByReference;
import com.sun.jna.*; import com.sun.jna.ptr.*;
[ "com.sun.jna" ]
com.sun.jna;
515,110
private void constructEmpty(){ transitionCount = 0; transitionTimes64 = null; typeMapData = null; typeCount = 1; typeOffsets = new int[]{0,0}; finalZone = null; finalStartYear = Integer.MAX_VALUE; finalStartMillis = Double.MAX_VALUE; transitionRulesInitialized = false; } public OlsonTimeZone(UResourceBundle top, UResourceBundle res, String id){ super(id); construct(top, res); }
void function(){ transitionCount = 0; transitionTimes64 = null; typeMapData = null; typeCount = 1; typeOffsets = new int[]{0,0}; finalZone = null; finalStartYear = Integer.MAX_VALUE; finalStartMillis = Double.MAX_VALUE; transitionRulesInitialized = false; } public OlsonTimeZone(UResourceBundle top, UResourceBundle res, String id){ super(id); construct(top, res); }
/** * Construct a GMT+0 zone with no transitions. This is done when a * constructor fails so the resultant object is well-behaved. */
Construct a GMT+0 zone with no transitions. This is done when a constructor fails so the resultant object is well-behaved
constructEmpty
{ "repo_name": "Miracle121/quickdic-dictionary.dictionary", "path": "jars/icu4j-52_1/main/classes/core/src/com/ibm/icu/impl/OlsonTimeZone.java", "license": "apache-2.0", "size": 50495 }
[ "com.ibm.icu.util.UResourceBundle" ]
import com.ibm.icu.util.UResourceBundle;
import com.ibm.icu.util.*;
[ "com.ibm.icu" ]
com.ibm.icu;
637,263
Optional<AndroidInjectorDescriptor> createIfValid(ExecutableElement method) { ErrorReporter reporter = new ErrorReporter(method, messager); if (!method.getModifiers().contains(ABSTRACT)) { reporter.reportError("@ContributesAndroidInjector methods must be abstract"); } if (!method.getParameters().isEmpty()) { reporter.reportError("@ContributesAndroidInjector methods cannot have parameters"); } AndroidInjectorDescriptor.Builder builder = new AutoValue_AndroidInjectorDescriptor.Builder().method(method); TypeElement enclosingElement = MoreElements.asType(method.getEnclosingElement()); if (!isAnnotationPresent(enclosingElement, Module.class)) { reporter.reportError("@ContributesAndroidInjector methods must be in a @Module"); } builder.enclosingModule(ClassName.get(enclosingElement)); TypeMirror injectedType = method.getReturnType(); if (MoreTypes.asDeclared(injectedType).getTypeArguments().isEmpty()) { builder.injectedType(ClassName.get(MoreTypes.asTypeElement(injectedType))); } else { reporter.reportError( "@ContributesAndroidInjector methods cannot return parameterized types"); } AnnotationMirror annotation = getAnnotationMirror(method, ContributesAndroidInjector.class).get(); for (TypeMirror module : getAnnotationValue(annotation, "modules").accept(new AllTypesVisitor(), null)) { if (isAnnotationPresent(MoreTypes.asElement(module), Module.class)) { builder.modulesBuilder().add((ClassName) TypeName.get(module)); } else { reporter.reportError(String.format("%s is not a @Module", module), annotation); } } for (AnnotationMirror scope : getAnnotatedAnnotations(method, Scope.class)) { builder.scopesBuilder().add(AnnotationSpec.get(scope)); } for (AnnotationMirror qualifier : getAnnotatedAnnotations(method, Qualifier.class)) { reporter.reportError( "@ContributesAndroidInjector methods cannot have qualifiers", qualifier); } return reporter.hasError ? Optional.empty() : Optional.of(builder.build()); } // TODO(ronshapiro): use ValidationReport once it is moved out of the compiler private static class ErrorReporter { private final Element subject; private final Messager messager; private boolean hasError; ErrorReporter(Element subject, Messager messager) { this.subject = subject; this.messager = messager; }
Optional<AndroidInjectorDescriptor> createIfValid(ExecutableElement method) { ErrorReporter reporter = new ErrorReporter(method, messager); if (!method.getModifiers().contains(ABSTRACT)) { reporter.reportError(STR); } if (!method.getParameters().isEmpty()) { reporter.reportError(STR); } AndroidInjectorDescriptor.Builder builder = new AutoValue_AndroidInjectorDescriptor.Builder().method(method); TypeElement enclosingElement = MoreElements.asType(method.getEnclosingElement()); if (!isAnnotationPresent(enclosingElement, Module.class)) { reporter.reportError(STR); } builder.enclosingModule(ClassName.get(enclosingElement)); TypeMirror injectedType = method.getReturnType(); if (MoreTypes.asDeclared(injectedType).getTypeArguments().isEmpty()) { builder.injectedType(ClassName.get(MoreTypes.asTypeElement(injectedType))); } else { reporter.reportError( STR); } AnnotationMirror annotation = getAnnotationMirror(method, ContributesAndroidInjector.class).get(); for (TypeMirror module : getAnnotationValue(annotation, STR).accept(new AllTypesVisitor(), null)) { if (isAnnotationPresent(MoreTypes.asElement(module), Module.class)) { builder.modulesBuilder().add((ClassName) TypeName.get(module)); } else { reporter.reportError(String.format(STR, module), annotation); } } for (AnnotationMirror scope : getAnnotatedAnnotations(method, Scope.class)) { builder.scopesBuilder().add(AnnotationSpec.get(scope)); } for (AnnotationMirror qualifier : getAnnotatedAnnotations(method, Qualifier.class)) { reporter.reportError( STR, qualifier); } return reporter.hasError ? Optional.empty() : Optional.of(builder.build()); } private static class ErrorReporter { private final Element subject; private final Messager messager; private boolean hasError; ErrorReporter(Element subject, Messager messager) { this.subject = subject; this.messager = messager; }
/** * Validates a {@link ContributesAndroidInjector} method, returning an {@link * AndroidInjectorDescriptor} if it is valid, or {@link Optional#empty()} otherwise. */
Validates a <code>ContributesAndroidInjector</code> method, returning an <code>AndroidInjectorDescriptor</code> if it is valid, or <code>Optional#empty()</code> otherwise
createIfValid
{ "repo_name": "cgruber/dagger", "path": "java/dagger/android/processor/AndroidInjectorDescriptor.java", "license": "apache-2.0", "size": 7045 }
[ "com.google.auto.common.AnnotationMirrors", "com.google.auto.common.MoreElements", "com.google.auto.common.MoreTypes", "com.google.auto.value.AutoValue", "com.squareup.javapoet.AnnotationSpec", "com.squareup.javapoet.ClassName", "com.squareup.javapoet.TypeName", "java.util.Optional", "javax.annotation.processing.Messager", "javax.inject.Qualifier", "javax.inject.Scope", "javax.lang.model.element.AnnotationMirror", "javax.lang.model.element.Element", "javax.lang.model.element.ExecutableElement", "javax.lang.model.element.TypeElement", "javax.lang.model.type.TypeMirror" ]
import com.google.auto.common.AnnotationMirrors; import com.google.auto.common.MoreElements; import com.google.auto.common.MoreTypes; import com.google.auto.value.AutoValue; import com.squareup.javapoet.AnnotationSpec; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.TypeName; import java.util.Optional; import javax.annotation.processing.Messager; import javax.inject.Qualifier; import javax.inject.Scope; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.type.TypeMirror;
import com.google.auto.common.*; import com.google.auto.value.*; import com.squareup.javapoet.*; import java.util.*; import javax.annotation.processing.*; import javax.inject.*; import javax.lang.model.element.*; import javax.lang.model.type.*;
[ "com.google.auto", "com.squareup.javapoet", "java.util", "javax.annotation", "javax.inject", "javax.lang" ]
com.google.auto; com.squareup.javapoet; java.util; javax.annotation; javax.inject; javax.lang;
2,469,615
@ServiceMethod(returns = ReturnType.SINGLE) public Response<Void> deleteWithResponse( String resourceGroupName, String serviceName, String opid, String ifMatch, Context context) { return deleteWithResponseAsync(resourceGroupName, serviceName, opid, ifMatch, context).block(); }
@ServiceMethod(returns = ReturnType.SINGLE) Response<Void> function( String resourceGroupName, String serviceName, String opid, String ifMatch, Context context) { return deleteWithResponseAsync(resourceGroupName, serviceName, opid, ifMatch, context).block(); }
/** * Deletes specific OpenID Connect Provider of the API Management service instance. * * @param resourceGroupName The name of the resource group. * @param serviceName The name of the API Management service. * @param opid Identifier of the OpenID Connect Provider. * @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET * request or it should be * for unconditional update. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response. */
Deletes specific OpenID Connect Provider of the API Management service instance
deleteWithResponse
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/OpenIdConnectProvidersClientImpl.java", "license": "mit", "size": 80530 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.core.http.rest.Response", "com.azure.core.util.Context" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context;
import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*;
[ "com.azure.core" ]
com.azure.core;
2,761,485
public double getEarthRadius() { return GeoUtils.EARTH_SEMI_MAJOR_AXIS / meters; }
double function() { return GeoUtils.EARTH_SEMI_MAJOR_AXIS / meters; }
/** * Measures the radius of earth in this unit * * @return length of earth radius in this unit */
Measures the radius of earth in this unit
getEarthRadius
{ "repo_name": "GlenRSmith/elasticsearch", "path": "server/src/main/java/org/elasticsearch/common/unit/DistanceUnit.java", "license": "apache-2.0", "size": 10294 }
[ "org.elasticsearch.common.geo.GeoUtils" ]
import org.elasticsearch.common.geo.GeoUtils;
import org.elasticsearch.common.geo.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
964,109
public void setAlternateSessionURLPrefix(String prefix) throws ConfigException { if (! prefix.startsWith("/")) prefix = '/' + prefix; if (prefix.lastIndexOf('/') > 0) throw new ConfigException(L.l("`{0}' is an invalidate alternate-session-url-prefix. The url-prefix must not have any embedded '/'.", prefix)); _sessionPrefix = prefix; _sessionSuffix = null; }
void function(String prefix) throws ConfigException { if (! prefix.startsWith("/")) prefix = '/' + prefix; if (prefix.lastIndexOf('/') > 0) throw new ConfigException(L.l(STR, prefix)); _sessionPrefix = prefix; _sessionSuffix = null; }
/** * Sets the alternate session url prefix. */
Sets the alternate session url prefix
setAlternateSessionURLPrefix
{ "repo_name": "mdaniel/svn-caucho-com-resin", "path": "modules/resin/src/com/caucho/server/dispatch/InvocationDecoder.java", "license": "gpl-2.0", "size": 13376 }
[ "com.caucho.config.ConfigException" ]
import com.caucho.config.ConfigException;
import com.caucho.config.*;
[ "com.caucho.config" ]
com.caucho.config;
2,314,938
public void setCondition(final String cond) { this.condition = Pattern.compile(cond); }
void function(final String cond) { this.condition = Pattern.compile(cond); }
/** * Condition regexp that has to match before checking the core one. * @param cond Regexp that has to match in file. */
Condition regexp that has to match before checking the core one
setCondition
{ "repo_name": "jrdalpra/qulice", "path": "qulice-checkstyle/src/main/java/com/qulice/checkstyle/ConditionalRegexpMultilineCheck.java", "license": "bsd-3-clause", "size": 2730 }
[ "java.util.regex.Pattern" ]
import java.util.regex.Pattern;
import java.util.regex.*;
[ "java.util" ]
java.util;
1,270,497
public Fraction multiply(Fraction multiplier) throws Exception { if (multiplier.denominator.signum() == 0) { throw new Exception("Zero is an invalid denominator"); } BigInteger resultNumerator; BigInteger resultDenominator; // The numerator and denominator are equal to multiplying the // two numerators and denominators together respectively resultDenominator = this.denominator.multiply(multiplier.denominator); resultNumerator = this.numerator.multiply(multiplier.numerator); // Return the computed value return new Fraction(resultNumerator, resultDenominator); } // multiply(Fraction)
Fraction function(Fraction multiplier) throws Exception { if (multiplier.denominator.signum() == 0) { throw new Exception(STR); } BigInteger resultNumerator; BigInteger resultDenominator; resultDenominator = this.denominator.multiply(multiplier.denominator); resultNumerator = this.numerator.multiply(multiplier.numerator); return new Fraction(resultNumerator, resultDenominator); }
/** * Multiply this fraction by another fraction */
Multiply this fraction by another fraction
multiply
{ "repo_name": "goldstei1/csc207-hw4", "path": "src/edu/grinnell/csc207/goldstei1/calc/Fraction.java", "license": "lgpl-3.0", "size": 10979 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
2,692,664
public void traverse(Node pos) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); traverseFragment(pos); this.m_contentHandler.endDocument(); }
void function(Node pos) throws org.xml.sax.SAXException { this.m_contentHandler.startDocument(); traverseFragment(pos); this.m_contentHandler.endDocument(); }
/** * Perform a pre-order traversal non-recursive style. * * Note that TreeWalker assumes that the subtree is intended to represent * a complete (though not necessarily well-formed) document and, during a * traversal, startDocument and endDocument will always be issued to the * SAX listener. * * @param pos Node in the tree where to start traversal * * @throws TransformerException */
Perform a pre-order traversal non-recursive style. Note that TreeWalker assumes that the subtree is intended to represent a complete (though not necessarily well-formed) document and, during a traversal, startDocument and endDocument will always be issued to the SAX listener
traverse
{ "repo_name": "srnsw/xena", "path": "xena/ext/src/xalan-j_2_7_1/src/org/apache/xml/utils/TreeWalker.java", "license": "gpl-3.0", "size": 14605 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
1,059,755
public void get(Context context, String url, AsyncHttpResponseHandler responseHandler) { get(context, url, null, responseHandler); }
void function(Context context, String url, AsyncHttpResponseHandler responseHandler) { get(context, url, null, responseHandler); }
/** * Perform a HTTP GET request without any parameters and track the Android Context which initiated the request. * @param context the Android Context which initiated the request. * @param url the URL to send the request to. * @param responseHandler the response handler instance that should handle the response. */
Perform a HTTP GET request without any parameters and track the Android Context which initiated the request
get
{ "repo_name": "OpenKit/openkit-android", "path": "OpenKitSDK/src/io/openkit/asynchttp/AsyncHttpClient.java", "license": "apache-2.0", "size": 27604 }
[ "android.content.Context" ]
import android.content.Context;
import android.content.*;
[ "android.content" ]
android.content;
425,254
public void setUserLocalService(UserLocalService userLocalService) { this.userLocalService = userLocalService; }
void function(UserLocalService userLocalService) { this.userLocalService = userLocalService; }
/** * Sets the user local service. * * @param userLocalService the user local service */
Sets the user local service
setUserLocalService
{ "repo_name": "RamkumarChandran/My-Courses-Portlet", "path": "docroot/WEB-INF/src/org/gnenc/internet/mycourses/service/base/HostLocalServiceBaseImpl.java", "license": "gpl-3.0", "size": 17570 }
[ "com.liferay.portal.service.UserLocalService" ]
import com.liferay.portal.service.UserLocalService;
import com.liferay.portal.service.*;
[ "com.liferay.portal" ]
com.liferay.portal;
2,485,247
public void testPutRemoveThroughHub() throws CacheException { CacheAccess<String, String> cache = JCS.getInstance( "testPutRemoveThroughHub" ); int max = cache.getCacheAttributes().getMaxObjects(); int items = max * 2; for ( int i = 0; i < items; i++ ) { cache.put( i + ":key", "myregion" + " data " + i ); } for ( int i = 0; i < items; i++ ) { cache.remove( i + ":key" ); } // Test that first items are not in the cache for ( int i = max; i >= 0; i-- ) { String value = cache.get( i + ":key" ); assertNull( "Should not have value for key [" + i + ":key" + "] in the cache.", value ); } }
void function() throws CacheException { CacheAccess<String, String> cache = JCS.getInstance( STR ); int max = cache.getCacheAttributes().getMaxObjects(); int items = max * 2; for ( int i = 0; i < items; i++ ) { cache.put( i + ":key", STR + STR + i ); } for ( int i = 0; i < items; i++ ) { cache.remove( i + ":key" ); } for ( int i = max; i >= 0; i-- ) { String value = cache.get( i + ":key" ); assertNull( STR + i + ":key" + STR, value ); } }
/** * put the max and remove each. verify that they are all null. * <p> * @throws CacheException */
put the max and remove each. verify that they are all null.
testPutRemoveThroughHub
{ "repo_name": "mohanaraosv/commons-jcs", "path": "commons-jcs-core/src/test/java/org/apache/commons/jcs/engine/memory/lru/LHMLRUMemoryCacheUnitTest.java", "license": "apache-2.0", "size": 9948 }
[ "org.apache.commons.jcs.JCS", "org.apache.commons.jcs.access.CacheAccess", "org.apache.commons.jcs.access.exception.CacheException" ]
import org.apache.commons.jcs.JCS; import org.apache.commons.jcs.access.CacheAccess; import org.apache.commons.jcs.access.exception.CacheException;
import org.apache.commons.jcs.*; import org.apache.commons.jcs.access.*; import org.apache.commons.jcs.access.exception.*;
[ "org.apache.commons" ]
org.apache.commons;
2,355,054
synchronized private void updateSubscriptionInfoByIccId() { logd("updateSubscriptionInfoByIccId:+ Start"); mSubscriptionManager.clearSubscriptionInfo(); for (int i = 0; i < PROJECT_SIM_NUM; i++) { mInsertSimState[i] = SIM_NOT_CHANGE; } int insertedSimCount = PROJECT_SIM_NUM; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (ICCID_STRING_FOR_NO_SIM.equals(mIccId[i])) { insertedSimCount--; mInsertSimState[i] = SIM_NOT_INSERT; } } logd("insertedSimCount = " + insertedSimCount); int index = 0; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_NOT_INSERT) { continue; } index = 2; for (int j = i + 1; j < PROJECT_SIM_NUM; j++) { if (mInsertSimState[j] == SIM_NOT_CHANGE && mIccId[i].equals(mIccId[j])) { mInsertSimState[i] = 1; mInsertSimState[j] = index; index++; } } } ContentResolver contentResolver = mContext.getContentResolver(); String[] oldIccId = new String[PROJECT_SIM_NUM]; for (int i = 0; i < PROJECT_SIM_NUM; i++) { oldIccId[i] = null; List<SubscriptionInfo> oldSubInfo = SubscriptionController.getInstance().getSubInfoUsingSlotIdWithCheck(i, false, mContext.getOpPackageName()); if (oldSubInfo != null) { oldIccId[i] = oldSubInfo.get(0).getIccId(); logd("updateSubscriptionInfoByIccId: oldSubId = " + oldSubInfo.get(0).getSubscriptionId()); if (mInsertSimState[i] == SIM_NOT_CHANGE && !mIccId[i].equals(oldIccId[i])) { mInsertSimState[i] = SIM_CHANGED; } if (mInsertSimState[i] != SIM_NOT_CHANGE) { ContentValues value = new ContentValues(1); value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); contentResolver.update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + Integer.toString(oldSubInfo.get(0).getSubscriptionId()), null); } } else { if (mInsertSimState[i] == SIM_NOT_CHANGE) { // no SIM inserted last time, but there is one SIM inserted now mInsertSimState[i] = SIM_CHANGED; } oldIccId[i] = ICCID_STRING_FOR_NO_SIM; logd("updateSubscriptionInfoByIccId: No SIM in slot " + i + " last time"); } } for (int i = 0; i < PROJECT_SIM_NUM; i++) { logd("updateSubscriptionInfoByIccId: oldIccId[" + i + "] = " + oldIccId[i] + ", sIccId[" + i + "] = " + mIccId[i]); } //check if the inserted SIM is new SIM int nNewCardCount = 0; int nNewSimStatus = 0; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_NOT_INSERT) { logd("updateSubscriptionInfoByIccId: No SIM inserted in slot " + i + " this time"); } else { if (mInsertSimState[i] > 0) { //some special SIMs may have the same IccIds, add suffix to distinguish them //FIXME: addSubInfoRecord can return an error. mSubscriptionManager.addSubscriptionInfoRecord(mIccId[i] + Integer.toString(mInsertSimState[i]), i); logd("SUB" + (i + 1) + " has invalid IccId"); } else { mSubscriptionManager.addSubscriptionInfoRecord(mIccId[i], i); } if (isNewSim(mIccId[i], oldIccId)) { nNewCardCount++; switch (i) { case PhoneConstants.SUB1: nNewSimStatus |= STATUS_SIM1_INSERTED; break; case PhoneConstants.SUB2: nNewSimStatus |= STATUS_SIM2_INSERTED; break; case PhoneConstants.SUB3: nNewSimStatus |= STATUS_SIM3_INSERTED; break; //case PhoneConstants.SUB3: // nNewSimStatus |= STATUS_SIM4_INSERTED; // break; } mInsertSimState[i] = SIM_NEW; } } } for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_CHANGED) { mInsertSimState[i] = SIM_REPOSITION; } logd("updateSubscriptionInfoByIccId: sInsertSimState[" + i + "] = " + mInsertSimState[i]); } List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList(); int nSubCount = (subInfos == null) ? 0 : subInfos.size(); logd("updateSubscriptionInfoByIccId: nSubCount = " + nSubCount); for (int i=0; i < nSubCount; i++) { SubscriptionInfo temp = subInfos.get(i); String msisdn = TelephonyManager.getDefault().getLine1NumberForSubscriber( temp.getSubscriptionId()); if (msisdn != null) { ContentValues value = new ContentValues(1); value.put(SubscriptionManager.NUMBER, msisdn); contentResolver.update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + Integer.toString(temp.getSubscriptionId()), null); } } // Ensure the modems are mapped correctly mSubscriptionManager.setDefaultDataSubId(mSubscriptionManager.getDefaultDataSubId()); SubscriptionController.getInstance().notifySubscriptionInfoChanged(); logd("updateSubscriptionInfoByIccId:- SsubscriptionInfo update complete"); }
synchronized void function() { logd(STR); mSubscriptionManager.clearSubscriptionInfo(); for (int i = 0; i < PROJECT_SIM_NUM; i++) { mInsertSimState[i] = SIM_NOT_CHANGE; } int insertedSimCount = PROJECT_SIM_NUM; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (ICCID_STRING_FOR_NO_SIM.equals(mIccId[i])) { insertedSimCount--; mInsertSimState[i] = SIM_NOT_INSERT; } } logd(STR + insertedSimCount); int index = 0; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_NOT_INSERT) { continue; } index = 2; for (int j = i + 1; j < PROJECT_SIM_NUM; j++) { if (mInsertSimState[j] == SIM_NOT_CHANGE && mIccId[i].equals(mIccId[j])) { mInsertSimState[i] = 1; mInsertSimState[j] = index; index++; } } } ContentResolver contentResolver = mContext.getContentResolver(); String[] oldIccId = new String[PROJECT_SIM_NUM]; for (int i = 0; i < PROJECT_SIM_NUM; i++) { oldIccId[i] = null; List<SubscriptionInfo> oldSubInfo = SubscriptionController.getInstance().getSubInfoUsingSlotIdWithCheck(i, false, mContext.getOpPackageName()); if (oldSubInfo != null) { oldIccId[i] = oldSubInfo.get(0).getIccId(); logd(STR + oldSubInfo.get(0).getSubscriptionId()); if (mInsertSimState[i] == SIM_NOT_CHANGE && !mIccId[i].equals(oldIccId[i])) { mInsertSimState[i] = SIM_CHANGED; } if (mInsertSimState[i] != SIM_NOT_CHANGE) { ContentValues value = new ContentValues(1); value.put(SubscriptionManager.SIM_SLOT_INDEX, SubscriptionManager.INVALID_SIM_SLOT_INDEX); contentResolver.update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + Integer.toString(oldSubInfo.get(0).getSubscriptionId()), null); } } else { if (mInsertSimState[i] == SIM_NOT_CHANGE) { mInsertSimState[i] = SIM_CHANGED; } oldIccId[i] = ICCID_STRING_FOR_NO_SIM; logd(STR + i + STR); } } for (int i = 0; i < PROJECT_SIM_NUM; i++) { logd(STR + i + STR + oldIccId[i] + STR + i + STR + mIccId[i]); } int nNewCardCount = 0; int nNewSimStatus = 0; for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_NOT_INSERT) { logd(STR + i + STR); } else { if (mInsertSimState[i] > 0) { mSubscriptionManager.addSubscriptionInfoRecord(mIccId[i] + Integer.toString(mInsertSimState[i]), i); logd("SUB" + (i + 1) + STR); } else { mSubscriptionManager.addSubscriptionInfoRecord(mIccId[i], i); } if (isNewSim(mIccId[i], oldIccId)) { nNewCardCount++; switch (i) { case PhoneConstants.SUB1: nNewSimStatus = STATUS_SIM1_INSERTED; break; case PhoneConstants.SUB2: nNewSimStatus = STATUS_SIM2_INSERTED; break; case PhoneConstants.SUB3: nNewSimStatus = STATUS_SIM3_INSERTED; break; } mInsertSimState[i] = SIM_NEW; } } } for (int i = 0; i < PROJECT_SIM_NUM; i++) { if (mInsertSimState[i] == SIM_CHANGED) { mInsertSimState[i] = SIM_REPOSITION; } logd(STR + i + STR + mInsertSimState[i]); } List<SubscriptionInfo> subInfos = mSubscriptionManager.getActiveSubscriptionInfoList(); int nSubCount = (subInfos == null) ? 0 : subInfos.size(); logd(STR + nSubCount); for (int i=0; i < nSubCount; i++) { SubscriptionInfo temp = subInfos.get(i); String msisdn = TelephonyManager.getDefault().getLine1NumberForSubscriber( temp.getSubscriptionId()); if (msisdn != null) { ContentValues value = new ContentValues(1); value.put(SubscriptionManager.NUMBER, msisdn); contentResolver.update(SubscriptionManager.CONTENT_URI, value, SubscriptionManager.UNIQUE_KEY_SUBSCRIPTION_ID + "=" + Integer.toString(temp.getSubscriptionId()), null); } } mSubscriptionManager.setDefaultDataSubId(mSubscriptionManager.getDefaultDataSubId()); SubscriptionController.getInstance().notifySubscriptionInfoChanged(); logd(STR); }
/** * TODO: Simplify more, as no one is interested in what happened * only what the current list contains. */
only what the current list contains
updateSubscriptionInfoByIccId
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/com/android/internal/telephony/SubscriptionInfoUpdater.java", "license": "gpl-3.0", "size": 29262 }
[ "android.content.ContentResolver", "android.content.ContentValues", "android.telephony.SubscriptionInfo", "android.telephony.SubscriptionManager", "android.telephony.TelephonyManager", "java.util.List" ]
import android.content.ContentResolver; import android.content.ContentValues; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; import java.util.List;
import android.content.*; import android.telephony.*; import java.util.*;
[ "android.content", "android.telephony", "java.util" ]
android.content; android.telephony; java.util;
2,363,601
@Override public Transaction getTransaction() { if (!initialized) { synchronized (this) { if (!initialized) { initialize(); initialized = true; } } } BasicTransactionSemantics transaction = currentTransaction.get(); if (transaction == null || transaction.getState().equals( BasicTransactionSemantics.State.CLOSED)) { transaction = createTransaction(); currentTransaction.set(transaction); } return transaction; }
Transaction function() { if (!initialized) { synchronized (this) { if (!initialized) { initialize(); initialized = true; } } } BasicTransactionSemantics transaction = currentTransaction.get(); if (transaction == null transaction.getState().equals( BasicTransactionSemantics.State.CLOSED)) { transaction = createTransaction(); currentTransaction.set(transaction); } return transaction; }
/** * <p> * Initializes the channel if it is not already, then checks to see * if there is an open transaction for this thread, creating a new * one via <code>createTransaction</code> if not. * @return the current <code>Transaction</code> object for the * calling thread * </p> */
Initializes the channel if it is not already, then checks to see if there is an open transaction for this thread, creating a new one via <code>createTransaction</code> if not
getTransaction
{ "repo_name": "wangcy6/storm_app", "path": "frame/apache-flume-1.7.0-src/flume-ng-core/src/main/java/org/apache/flume/channel/BasicChannelSemantics.java", "license": "apache-2.0", "size": 4096 }
[ "org.apache.flume.Transaction" ]
import org.apache.flume.Transaction;
import org.apache.flume.*;
[ "org.apache.flume" ]
org.apache.flume;
1,707,665
public void listSessions( com.google.spanner.v1.ListSessionsRequest request, io.grpc.stub.StreamObserver<com.google.spanner.v1.ListSessionsResponse> responseObserver) { asyncUnimplementedUnaryCall(getListSessionsMethodHelper(), responseObserver); }
void function( com.google.spanner.v1.ListSessionsRequest request, io.grpc.stub.StreamObserver<com.google.spanner.v1.ListSessionsResponse> responseObserver) { asyncUnimplementedUnaryCall(getListSessionsMethodHelper(), responseObserver); }
/** * * * <pre> * Lists all sessions in a given database. * </pre> */
<code> Lists all sessions in a given database. </code>
listSessions
{ "repo_name": "vam-google/google-cloud-java", "path": "google-api-grpc/grpc-google-cloud-spanner-v1/src/main/java/com/google/spanner/v1/SpannerGrpc.java", "license": "apache-2.0", "size": 99597 }
[ "io.grpc.stub.ServerCalls" ]
import io.grpc.stub.ServerCalls;
import io.grpc.stub.*;
[ "io.grpc.stub" ]
io.grpc.stub;
1,595,584
public void removeActionListener(ActionListener listener) { actionListeners.remove(listener); }
void function(ActionListener listener) { actionListeners.remove(listener); }
/** * Removes a previously added listener. * @param listener listener to remove. */
Removes a previously added listener
removeActionListener
{ "repo_name": "langmo/youscope", "path": "core/api/src/main/java/org/youscope/uielements/ComponentList.java", "license": "gpl-2.0", "size": 9174 }
[ "java.awt.event.ActionListener" ]
import java.awt.event.ActionListener;
import java.awt.event.*;
[ "java.awt" ]
java.awt;
252,530
public static void printPersonsWithinAgeRange(List<Person> roster, PersonCriteria criteria) { for (Person p : roster) { if (criteria.test(p)) { System.out.println(p); } } }
static void function(List<Person> roster, PersonCriteria criteria) { for (Person p : roster) { if (criteria.test(p)) { System.out.println(p); } } }
/** * Einsatz eines Interfaces, um eine Collection zu durchsuchen. * * @param roster * @param criteria */
Einsatz eines Interfaces, um eine Collection zu durchsuchen
printPersonsWithinAgeRange
{ "repo_name": "Erunafailaro/java8tutorial", "path": "src/java8tutorial/lambda/search/PersonSearch.java", "license": "apache-2.0", "size": 5060 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
848,118
public Configuration getConfiguration() { return config; }
Configuration function() { return config; }
/** * Returns the configuration object used to initialize the current database * instance. * */
Returns the configuration object used to initialize the current database instance
getConfiguration
{ "repo_name": "NCIP/cadsr-cgmdr-nci-uk", "path": "src/org/exist/storage/DBBroker.java", "license": "bsd-3-clause", "size": 25418 }
[ "org.exist.util.Configuration" ]
import org.exist.util.Configuration;
import org.exist.util.*;
[ "org.exist.util" ]
org.exist.util;
36,148
public static java.util.Set extractEmergencyAttendanceSet(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EmergencyAttendanceForDischargeLetterVoCollection voCollection) { return extractEmergencyAttendanceSet(domainFactory, voCollection, null, new HashMap()); }
static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.emergency.vo.EmergencyAttendanceForDischargeLetterVoCollection voCollection) { return extractEmergencyAttendanceSet(domainFactory, voCollection, null, new HashMap()); }
/** * Create the ims.core.admin.domain.objects.EmergencyAttendance set from the value object collection. * @param domainFactory - used to create existing (persistent) domain objects. * @param voCollection - the collection of value objects */
Create the ims.core.admin.domain.objects.EmergencyAttendance set from the value object collection
extractEmergencyAttendanceSet
{ "repo_name": "IMS-MAXIMS/openMAXIMS", "path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/emergency/vo/domain/EmergencyAttendanceForDischargeLetterVoAssembler.java", "license": "agpl-3.0", "size": 21040 }
[ "java.util.HashMap" ]
import java.util.HashMap;
import java.util.*;
[ "java.util" ]
java.util;
1,099,298
public DeviceWebDriver getWebDriver() { return webDriver; }
DeviceWebDriver function() { return webDriver; }
/** * Gets the web driver. * * @return the web driver */
Gets the web driver
getWebDriver
{ "repo_name": "xframium/xframium-java", "path": "framework/src/org/xframium/device/ConnectedDevice.java", "license": "gpl-3.0", "size": 3641 }
[ "org.xframium.device.factory.DeviceWebDriver" ]
import org.xframium.device.factory.DeviceWebDriver;
import org.xframium.device.factory.*;
[ "org.xframium.device" ]
org.xframium.device;
863,959
try { this.open(); this.layout(); if (edit) { this.appPathText.setText(model.getAppPath()); this.appPathSet = true; this.nameSet = true; this.textName.setText(model.getName()); // set checkbox according to using network engine if (model.getPlatform().equals(NetIDE.CONTROLLER_ENGINE)) { this.btnCheckButton.setSelection(true); this.platformCombo.select(this.platformCombo.indexOf(model.getClientController())); } else { int platformIndex = this.platformCombo.indexOf(model.getPlatform()); this.platformCombo.select(platformIndex); } this.platformSet = true; if(model.getFlagBackend() == null) model.setFlagBackend(""); if(model.getFlagApp() == null) model.setFlagApp(""); text_flag_app.setText(model.getFlagApp()); text_flag_backend.setText(model.getFlagBackend()); portText.setText(model.getAppPort()); checkForFinish(); } while (!this.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } catch (Exception e) { e.printStackTrace(); } } private Display display; private boolean edit; private LaunchConfigurationModel model;
try { this.open(); this.layout(); if (edit) { this.appPathText.setText(model.getAppPath()); this.appPathSet = true; this.nameSet = true; this.textName.setText(model.getName()); if (model.getPlatform().equals(NetIDE.CONTROLLER_ENGINE)) { this.btnCheckButton.setSelection(true); this.platformCombo.select(this.platformCombo.indexOf(model.getClientController())); } else { int platformIndex = this.platformCombo.indexOf(model.getPlatform()); this.platformCombo.select(platformIndex); } this.platformSet = true; if(model.getFlagBackend() == null) model.setFlagBackend(STR"); text_flag_app.setText(model.getFlagApp()); text_flag_backend.setText(model.getFlagBackend()); portText.setText(model.getAppPort()); checkForFinish(); } while (!this.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } catch (Exception e) { e.printStackTrace(); } } private Display display; private boolean edit; private LaunchConfigurationModel model;
/** * Launch the application. * * @param args */
Launch the application
openShell
{ "repo_name": "fp7-netide/IDE", "path": "plugins/eu.netide.WorkbenchConfigurationEditor/src/eu/netide/workbenchconfigurationeditor/dialogs/ConfigurationShell.java", "license": "epl-1.0", "size": 10941 }
[ "eu.netide.configuration.utils.NetIDE", "eu.netide.workbenchconfigurationeditor.model.LaunchConfigurationModel", "org.eclipse.swt.widgets.Display" ]
import eu.netide.configuration.utils.NetIDE; import eu.netide.workbenchconfigurationeditor.model.LaunchConfigurationModel; import org.eclipse.swt.widgets.Display;
import eu.netide.configuration.utils.*; import eu.netide.workbenchconfigurationeditor.model.*; import org.eclipse.swt.widgets.*;
[ "eu.netide.configuration", "eu.netide.workbenchconfigurationeditor", "org.eclipse.swt" ]
eu.netide.configuration; eu.netide.workbenchconfigurationeditor; org.eclipse.swt;
2,470,511
void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor column) throws IOException;
void preAddColumn(final ObserverContext<MasterCoprocessorEnvironment> ctx, TableName tableName, HColumnDescriptor column) throws IOException;
/** * Called prior to adding a new column family to the table. Called as part of * add column RPC call. * @param ctx the environment to interact with the framework and master * @param tableName the name of the table * @param column the HColumnDescriptor */
Called prior to adding a new column family to the table. Called as part of add column RPC call
preAddColumn
{ "repo_name": "Jackygq1982/hbase_src", "path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java", "license": "apache-2.0", "size": 31996 }
[ "java.io.IOException", "org.apache.hadoop.hbase.HColumnDescriptor", "org.apache.hadoop.hbase.TableName" ]
import java.io.IOException; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.TableName;
import java.io.*; import org.apache.hadoop.hbase.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
2,870,006
public String addNotActivatedUser(User user);
String function(User user);
/** * Creates new but not activated user * @param user Given user object * @return User key */
Creates new but not activated user
addNotActivatedUser
{ "repo_name": "ceskaexpedice/kramerius", "path": "shared/common/src/main/java/cz/incad/kramerius/users/NotActivatedUsersSingleton.java", "license": "gpl-3.0", "size": 1436 }
[ "cz.incad.kramerius.security.User" ]
import cz.incad.kramerius.security.User;
import cz.incad.kramerius.security.*;
[ "cz.incad.kramerius" ]
cz.incad.kramerius;
2,763,699
private void handleChangeManagerStatusRequest(final HttpServletRequest req, final Map<String, Object> ret, final boolean enableMetricManager) { try { logger.info("Updating metric manager status"); if ((enableMetricManager && MetricReportManager.isInstantiated()) || MetricReportManager.isAvailable()) { final MetricReportManager metricManager = MetricReportManager.getInstance(); if (enableMetricManager) { metricManager.enableManager(); } else { metricManager.disableManager(); } ret.put(STATUS_PARAM, RESPONSE_SUCCESS); } else { ret.put(RESPONSE_ERROR, "MetricManager is not available"); } } catch (final Exception e) { logger.error(e); ret.put(RESPONSE_ERROR, e.getMessage()); } }
void function(final HttpServletRequest req, final Map<String, Object> ret, final boolean enableMetricManager) { try { logger.info(STR); if ((enableMetricManager && MetricReportManager.isInstantiated()) MetricReportManager.isAvailable()) { final MetricReportManager metricManager = MetricReportManager.getInstance(); if (enableMetricManager) { metricManager.enableManager(); } else { metricManager.disableManager(); } ret.put(STATUS_PARAM, RESPONSE_SUCCESS); } else { ret.put(RESPONSE_ERROR, STR); } } catch (final Exception e) { logger.error(e); ret.put(RESPONSE_ERROR, e.getMessage()); } }
/** * enable or disable metric Manager A disable will also purge all data from all metric emitters */
enable or disable metric Manager A disable will also purge all data from all metric emitters
handleChangeManagerStatusRequest
{ "repo_name": "reallocf/azkaban", "path": "azkaban-exec-server/src/main/java/azkaban/execapp/StatsServlet.java", "license": "apache-2.0", "size": 10360 }
[ "java.util.Map", "javax.servlet.http.HttpServletRequest" ]
import java.util.Map; import javax.servlet.http.HttpServletRequest;
import java.util.*; import javax.servlet.http.*;
[ "java.util", "javax.servlet" ]
java.util; javax.servlet;
1,541,946
public List<StudentAttributes> getUnregisteredStudentsForCourse(String courseId) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); List<StudentAttributes> allStudents = getStudentsForCourse(courseId); ArrayList<StudentAttributes> unregistered = new ArrayList<StudentAttributes>(); for (StudentAttributes s : allStudents) { if (s.googleId == null || s.googleId.trim().isEmpty()) { unregistered.add(s); } } return unregistered; }
List<StudentAttributes> function(String courseId) { Assumption.assertNotNull(Const.StatusCodes.DBLEVEL_NULL_INPUT, courseId); List<StudentAttributes> allStudents = getStudentsForCourse(courseId); ArrayList<StudentAttributes> unregistered = new ArrayList<StudentAttributes>(); for (StudentAttributes s : allStudents) { if (s.googleId == null s.googleId.trim().isEmpty()) { unregistered.add(s); } } return unregistered; }
/** * Preconditions: <br> * * All parameters are non-null. * @return an empty list if no students in the course. */
Preconditions: All parameters are non-null
getUnregisteredStudentsForCourse
{ "repo_name": "ablyx/teammates", "path": "src/main/java/teammates/storage/api/StudentsDb.java", "license": "gpl-2.0", "size": 28163 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
55,549
public void removeScopeValidator(ScopeValidator scopeValidator) { scopeValidators.remove(scopeValidator); }
void function(ScopeValidator scopeValidator) { scopeValidators.remove(scopeValidator); }
/** * Remove scope validator implementation. * * @param scopeValidator Scope validator implementation. */
Remove scope validator implementation
removeScopeValidator
{ "repo_name": "darshanasbg/identity-inbound-auth-oauth", "path": "components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth/internal/OAuthComponentServiceHolder.java", "license": "apache-2.0", "size": 6509 }
[ "org.wso2.carbon.identity.oauth2.validators.scope.ScopeValidator" ]
import org.wso2.carbon.identity.oauth2.validators.scope.ScopeValidator;
import org.wso2.carbon.identity.oauth2.validators.scope.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
492,970
void setGroupResourceStatus(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) throws GroupNotDefinedOnResourceException;
void setGroupResourceStatus(PerunSession sess, Group group, Resource resource, GroupResourceStatus status) throws GroupNotDefinedOnResourceException;
/** * Sets status of given group-resource assignment to the specified status. * * @param sess session * @param group group * @param resource resource * @param status new status of the group-resource assignment * @throws GroupNotDefinedOnResourceException if there is no such group-resource assignment * @throws InternalErrorException */
Sets status of given group-resource assignment to the specified status
setGroupResourceStatus
{ "repo_name": "mvocu/perun", "path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/ResourcesManagerImplApi.java", "license": "bsd-2-clause", "size": 29312 }
[ "cz.metacentrum.perun.core.api.Group", "cz.metacentrum.perun.core.api.GroupResourceStatus", "cz.metacentrum.perun.core.api.PerunSession", "cz.metacentrum.perun.core.api.Resource", "cz.metacentrum.perun.core.api.exceptions.GroupNotDefinedOnResourceException" ]
import cz.metacentrum.perun.core.api.Group; import cz.metacentrum.perun.core.api.GroupResourceStatus; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Resource; import cz.metacentrum.perun.core.api.exceptions.GroupNotDefinedOnResourceException;
import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*;
[ "cz.metacentrum.perun" ]
cz.metacentrum.perun;
1,476,035
private void overrideDependencyMgtsWithImported(DescriptorParseContext parseContext, PomReader pomReader) throws IOException, SAXException { Map<MavenDependencyKey, PomDependencyMgt> importedDependencyMgts = parseImportedDependencyMgts(parseContext, pomReader.parseDependencyMgt()); pomReader.addImportedDependencyMgts(importedDependencyMgts); }
void function(DescriptorParseContext parseContext, PomReader pomReader) throws IOException, SAXException { Map<MavenDependencyKey, PomDependencyMgt> importedDependencyMgts = parseImportedDependencyMgts(parseContext, pomReader.parseDependencyMgt()); pomReader.addImportedDependencyMgts(importedDependencyMgts); }
/** * Overrides existing dependency management information with imported ones if existing. * * @param parseContext Parse context * @param pomReader POM reader */
Overrides existing dependency management information with imported ones if existing
overrideDependencyMgtsWithImported
{ "repo_name": "lsmaira/gradle", "path": "subprojects/dependency-management/src/main/java/org/gradle/api/internal/artifacts/ivyservice/ivyresolve/parser/GradlePomModuleDescriptorParser.java", "license": "apache-2.0", "size": 13066 }
[ "java.io.IOException", "java.util.Map", "org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey", "org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt", "org.xml.sax.SAXException" ]
import java.io.IOException; import java.util.Map; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.MavenDependencyKey; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.PomDependencyMgt; import org.xml.sax.SAXException;
import java.io.*; import java.util.*; import org.gradle.api.internal.artifacts.ivyservice.ivyresolve.parser.data.*; import org.xml.sax.*;
[ "java.io", "java.util", "org.gradle.api", "org.xml.sax" ]
java.io; java.util; org.gradle.api; org.xml.sax;
257,622
ServiceResponseWithHeaders<Void, LRORetrysDeleteAsyncRelativeRetrySucceededHeaders> beginDeleteAsyncRelativeRetrySucceeded() throws CloudException, IOException;
ServiceResponseWithHeaders<Void, LRORetrysDeleteAsyncRelativeRetrySucceededHeaders> beginDeleteAsyncRelativeRetrySucceeded() throws CloudException, IOException;
/** * Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status. * * @throws CloudException exception thrown from REST call * @throws IOException exception thrown from serialization/deserialization * @return the {@link ServiceResponseWithHeaders} object if successful. */
Long running delete request, service returns a 500, then a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status
beginDeleteAsyncRelativeRetrySucceeded
{ "repo_name": "sharadagarwal/autorest", "path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LRORetrysOperations.java", "license": "mit", "size": 29968 }
[ "com.microsoft.azure.CloudException", "com.microsoft.rest.ServiceResponseWithHeaders", "java.io.IOException" ]
import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException;
import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*;
[ "com.microsoft.azure", "com.microsoft.rest", "java.io" ]
com.microsoft.azure; com.microsoft.rest; java.io;
1,870,776
@Override public ItemStack getStackInSlotOnClosing(int par1) { if (furnaceItemStacks[par1] != null) { ItemStack itemstack = furnaceItemStacks[par1]; furnaceItemStacks[par1] = null; return itemstack; } else return null; }
ItemStack function(int par1) { if (furnaceItemStacks[par1] != null) { ItemStack itemstack = furnaceItemStacks[par1]; furnaceItemStacks[par1] = null; return itemstack; } else return null; }
/** * When some containers are closed they call this on each slot, then drop * whatever it returns as an EntityItem - like when you close a workbench * GUI. */
When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - like when you close a workbench GUI
getStackInSlotOnClosing
{ "repo_name": "Morton00000/CivCraft", "path": "common/civcraft/tiles/machines/TileCrusher1.java", "license": "gpl-3.0", "size": 12813 }
[ "net.minecraft.item.ItemStack" ]
import net.minecraft.item.ItemStack;
import net.minecraft.item.*;
[ "net.minecraft.item" ]
net.minecraft.item;
2,151,773
public static void updateConnections(IBlockReader world, BlockPos pos, @Nullable Direction side) { getCable(world, pos, side) .ifPresent(ICable::updateConnections); }
static void function(IBlockReader world, BlockPos pos, @Nullable Direction side) { getCable(world, pos, side) .ifPresent(ICable::updateConnections); }
/** * Request to update the cable connections at the given position. * @param world The world. * @param pos The position. * @param side The side. */
Request to update the cable connections at the given position
updateConnections
{ "repo_name": "CyclopsMC/IntegratedDynamics", "path": "src/main/java/org/cyclops/integrateddynamics/core/helper/CableHelpers.java", "license": "mit", "size": 19683 }
[ "javax.annotation.Nullable", "net.minecraft.util.Direction", "net.minecraft.util.math.BlockPos", "net.minecraft.world.IBlockReader", "org.cyclops.integrateddynamics.api.block.cable.ICable" ]
import javax.annotation.Nullable; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import org.cyclops.integrateddynamics.api.block.cable.ICable;
import javax.annotation.*; import net.minecraft.util.*; import net.minecraft.util.math.*; import net.minecraft.world.*; import org.cyclops.integrateddynamics.api.block.cable.*;
[ "javax.annotation", "net.minecraft.util", "net.minecraft.world", "org.cyclops.integrateddynamics" ]
javax.annotation; net.minecraft.util; net.minecraft.world; org.cyclops.integrateddynamics;
1,261,527
@Test public void testProvidedURI() { EmfInstance instance = new EmfInstance(); instance.setId("test"); Map<String, Serializable> properties = new HashMap<>(2); properties.put(DefaultProperties.ATTACHMENT_LOCATION, "test.png"); instance.setProperties(properties); String providedURI = imageAdapter.getContentUrl(instance); FTPConfiguration ftpConfig = ftpConfigMock.getImageFTPServerConfig().get(); String uri = ftpConfigMock.getImageAccessServerAddress().get() + ftpConfig.getRemoteDir() + "test.png"; assertEquals(providedURI, uri); }
void function() { EmfInstance instance = new EmfInstance(); instance.setId("test"); Map<String, Serializable> properties = new HashMap<>(2); properties.put(DefaultProperties.ATTACHMENT_LOCATION, STR); instance.setProperties(properties); String providedURI = imageAdapter.getContentUrl(instance); FTPConfiguration ftpConfig = ftpConfigMock.getImageFTPServerConfig().get(); String uri = ftpConfigMock.getImageAccessServerAddress().get() + ftpConfig.getRemoteDir() + STR; assertEquals(providedURI, uri); }
/** * Tests if the service build the uri correctly. */
Tests if the service build the uri correctly
testProvidedURI
{ "repo_name": "SirmaITT/conservation-space-1.7.0", "path": "docker/sirma-platform/platform/seip-parent/adapters/adapters-iiif/src/test/java/com/sirma/itt/seip/adapters/iiif/ImageServiceTest.java", "license": "lgpl-3.0", "size": 4142 }
[ "com.sirma.itt.seip.adapters.remote.FTPConfiguration", "com.sirma.itt.seip.domain.instance.DefaultProperties", "com.sirma.itt.seip.domain.instance.EmfInstance", "java.io.Serializable", "java.util.HashMap", "java.util.Map", "org.junit.Assert" ]
import com.sirma.itt.seip.adapters.remote.FTPConfiguration; import com.sirma.itt.seip.domain.instance.DefaultProperties; import com.sirma.itt.seip.domain.instance.EmfInstance; import java.io.Serializable; import java.util.HashMap; import java.util.Map; import org.junit.Assert;
import com.sirma.itt.seip.adapters.remote.*; import com.sirma.itt.seip.domain.instance.*; import java.io.*; import java.util.*; import org.junit.*;
[ "com.sirma.itt", "java.io", "java.util", "org.junit" ]
com.sirma.itt; java.io; java.util; org.junit;
1,153,529
private void parse(AttributeDataset data, BufferedReader reader) throws IOException, ParseException { Attribute[] attributes = data.attributes(); int n = attributes.length; if (hasRowNames) { n = n + 1; } if (responseIndex >= 0) { n = n + 1; } String line = null; while ((line = reader.readLine()) != null) { if (line.isEmpty()) { continue; } if (line.startsWith(comment)) { continue; } String[] s = line.split(delimiter, -1); if (s.length != n) { throw new ParseException(String.format("%d columns, expected %d", s.length, n), s.length); } String rowName = hasRowNames ? s[0] : null; double[] x = new double[attributes.length]; double y = Double.NaN; for (int i = hasRowNames ? 1 : 0, k = 0; i < s.length; i++) { if (i == responseIndex) { y = response.valueOf(s[i]); } else if (missing != null && missing.equalsIgnoreCase(s[i])) { x[k++] = Double.NaN; } else { x[k] = attributes[k].valueOf(s[i]); k++; } } Datum<double[]> datum = new Datum<double[]>(x, y); datum.name = rowName; data.add(datum); } reader.close(); }
void function(AttributeDataset data, BufferedReader reader) throws IOException, ParseException { Attribute[] attributes = data.attributes(); int n = attributes.length; if (hasRowNames) { n = n + 1; } if (responseIndex >= 0) { n = n + 1; } String line = null; while ((line = reader.readLine()) != null) { if (line.isEmpty()) { continue; } if (line.startsWith(comment)) { continue; } String[] s = line.split(delimiter, -1); if (s.length != n) { throw new ParseException(String.format(STR, s.length, n), s.length); } String rowName = hasRowNames ? s[0] : null; double[] x = new double[attributes.length]; double y = Double.NaN; for (int i = hasRowNames ? 1 : 0, k = 0; i < s.length; i++) { if (i == responseIndex) { y = response.valueOf(s[i]); } else if (missing != null && missing.equalsIgnoreCase(s[i])) { x[k++] = Double.NaN; } else { x[k] = attributes[k].valueOf(s[i]); k++; } } Datum<double[]> datum = new Datum<double[]>(x, y); datum.name = rowName; data.add(datum); } reader.close(); }
/** * Parse a dataset from a buffered reader. * @param data the dataset. * @param description the detailed description of dataset. * @param reader the buffered reader for data. * @param attributes the list attributes of data in proper order. * @throws java.io.IOException */
Parse a dataset from a buffered reader
parse
{ "repo_name": "wavelets/smile", "path": "SmileData/src/smile/data/parser/DelimitedTextParser.java", "license": "apache-2.0", "size": 11980 }
[ "java.io.BufferedReader", "java.io.IOException", "java.text.ParseException" ]
import java.io.BufferedReader; import java.io.IOException; import java.text.ParseException;
import java.io.*; import java.text.*;
[ "java.io", "java.text" ]
java.io; java.text;
1,832,610
private static void pipe(Reader reader, Writer writer) throws IOException { char[] buf = new char[1024]; int read = 0; while ( (read = reader.read(buf)) >= 0) { writer.write(buf, 0, read); } writer.flush(); }
static void function(Reader reader, Writer writer) throws IOException { char[] buf = new char[1024]; int read = 0; while ( (read = reader.read(buf)) >= 0) { writer.write(buf, 0, read); } writer.flush(); }
/** * Pipes everything from the reader to the writer via a buffer */
Pipes everything from the reader to the writer via a buffer
pipe
{ "repo_name": "52North/OpenSensorSearch", "path": "service/src/test/java/org/n52/oss/sir/TestSIR.java", "license": "apache-2.0", "size": 21933 }
[ "java.io.IOException", "java.io.Reader", "java.io.Writer" ]
import java.io.IOException; import java.io.Reader; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,359,583
boolean enroll(String userId, String password, PublicKey publicKey);
boolean enroll(String userId, String password, PublicKey publicKey);
/** * Enrolls a public key associated with the userId * * @param userId the unique ID of the user within the app including server side * implementation * @param password the password for the user for the server side * @param publicKey the public key object to verify the signature from the user * @return true if the enrollment was successful, false otherwise */
Enrolls a public key associated with the userId
enroll
{ "repo_name": "wiki2014/Learning-Summary", "path": "alps/developers/samples/android/security/AsymmetricFingerprintDialog/Application/src/main/java/com/example/android/asymmetricfingerprintdialog/server/StoreBackend.java", "license": "gpl-3.0", "size": 2529 }
[ "java.security.PublicKey" ]
import java.security.PublicKey;
import java.security.*;
[ "java.security" ]
java.security;
1,099,959
public BoxCollaborationWhitelistExemptTarget.Info getInfo() { URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRY_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, HttpMethod.GET); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new Info(JsonObject.readFrom(response.getJSON())); }
BoxCollaborationWhitelistExemptTarget.Info function() { URL url = COLLABORATION_WHITELIST_EXEMPT_TARGET_ENTRY_URL_TEMPLATE.build(this.getAPI().getBaseURL(), this.getID()); BoxAPIRequest request = new BoxAPIRequest(this.getAPI(), url, HttpMethod.GET); BoxJSONResponse response = (BoxJSONResponse) request.send(); return new Info(JsonObject.readFrom(response.getJSON())); }
/** * Retrieves information for a collaboration whitelist for a given whitelist ID. * * @return information about this {@link BoxCollaborationWhitelistExemptTarget}. */
Retrieves information for a collaboration whitelist for a given whitelist ID
getInfo
{ "repo_name": "itsmanishagarwal/box-java-sdk", "path": "src/main/java/com/box/sdk/BoxCollaborationWhitelistExemptTarget.java", "license": "apache-2.0", "size": 9852 }
[ "com.box.sdk.http.HttpMethod", "com.eclipsesource.json.JsonObject" ]
import com.box.sdk.http.HttpMethod; import com.eclipsesource.json.JsonObject;
import com.box.sdk.http.*; import com.eclipsesource.json.*;
[ "com.box.sdk", "com.eclipsesource.json" ]
com.box.sdk; com.eclipsesource.json;
1,663,778
public MainHelper addComponent(String key, JComponent component) { this.components.put(key, component); return this; }
MainHelper function(String key, JComponent component) { this.components.put(key, component); return this; }
/** * Inject any component that the helper should handle * @param key * @param component * @return */
Inject any component that the helper should handle
addComponent
{ "repo_name": "adrian-tilita/ezDuplicateFileFinder", "path": "src/layout/helper/MainHelper.java", "license": "mit", "size": 15551 }
[ "javax.swing.JComponent" ]
import javax.swing.JComponent;
import javax.swing.*;
[ "javax.swing" ]
javax.swing;
390,223
public static void registerCommands(final List<PluginCommand> commands){ try { CommandMap commandMap = null; if (Bukkit.getPluginManager() instanceof SimplePluginManager) { Field f = SimplePluginManager.class.getDeclaredField("commandMap"); f.setAccessible(true); commandMap = (CommandMap)f.get((Object)Bukkit.getPluginManager()); } { for (PluginCommand command : commands) { commandMap.register(ItemJoin.getInstance().getDescription().getName(), (Command)command); } } } catch (Exception e) { ServerUtils.sendDebugTrace(e); } }
static void function(final List<PluginCommand> commands){ try { CommandMap commandMap = null; if (Bukkit.getPluginManager() instanceof SimplePluginManager) { Field f = SimplePluginManager.class.getDeclaredField(STR); f.setAccessible(true); commandMap = (CommandMap)f.get((Object)Bukkit.getPluginManager()); } { for (PluginCommand command : commands) { commandMap.register(ItemJoin.getInstance().getDescription().getName(), (Command)command); } } } catch (Exception e) { ServerUtils.sendDebugTrace(e); } }
/** * Attempts to manually register a PluginCommands list for the plugin instance. * * @param commands - The PluginCommands to be registered. */
Attempts to manually register a PluginCommands list for the plugin instance
registerCommands
{ "repo_name": "RockinChaos/ItemJoin", "path": "src/me/RockinChaos/itemjoin/utils/ServerUtils.java", "license": "lgpl-3.0", "size": 9581 }
[ "java.lang.reflect.Field", "java.util.List", "org.bukkit.Bukkit", "org.bukkit.command.Command", "org.bukkit.command.CommandMap", "org.bukkit.command.PluginCommand", "org.bukkit.plugin.SimplePluginManager" ]
import java.lang.reflect.Field; import java.util.List; import org.bukkit.Bukkit; import org.bukkit.command.Command; import org.bukkit.command.CommandMap; import org.bukkit.command.PluginCommand; import org.bukkit.plugin.SimplePluginManager;
import java.lang.reflect.*; import java.util.*; import org.bukkit.*; import org.bukkit.command.*; import org.bukkit.plugin.*;
[ "java.lang", "java.util", "org.bukkit", "org.bukkit.command", "org.bukkit.plugin" ]
java.lang; java.util; org.bukkit; org.bukkit.command; org.bukkit.plugin;
530,401
@RequestMapping(value = "/deployment/group", method = RequestMethod.POST, produces = "application/json") public ResponseEntity<PiazzaResponse> createDeploymentGroup(@RequestParam(value = "createdBy", required = true) String createdBy) { try { // Create a new Deployment Group DeploymentGroup deploymentGroup = groupDeployer.createDeploymentGroup(createdBy); return new ResponseEntity<>(new DeploymentGroupResponse(deploymentGroup), HttpStatus.CREATED); } catch (Exception exception) { String error = String.format("Error Creating DeploymentGroup for user %s : %s", createdBy, exception.getMessage()); LOGGER.error(error, exception); pzLogger.log(error, Severity.ERROR, new AuditElement(ACCESS, "errorCreatingDeploymentGroup", "")); return new ResponseEntity<>(new ErrorResponse(error, ACCESS_COMPONENT_NAME), HttpStatus.INTERNAL_SERVER_ERROR); } }
@RequestMapping(value = STR, method = RequestMethod.POST, produces = STR) ResponseEntity<PiazzaResponse> function(@RequestParam(value = STR, required = true) String createdBy) { try { DeploymentGroup deploymentGroup = groupDeployer.createDeploymentGroup(createdBy); return new ResponseEntity<>(new DeploymentGroupResponse(deploymentGroup), HttpStatus.CREATED); } catch (Exception exception) { String error = String.format(STR, createdBy, exception.getMessage()); LOGGER.error(error, exception); pzLogger.log(error, Severity.ERROR, new AuditElement(ACCESS, STR, "")); return new ResponseEntity<>(new ErrorResponse(error, ACCESS_COMPONENT_NAME), HttpStatus.INTERNAL_SERVER_ERROR); } }
/** * Creates a new Deployment Group in the Piazza database. No accompanying GeoServer Layer Group will be created yet * at this point; however a placeholder GUID is associated with this Deployment Group that will be used as the title * of the eventual GeoServer Layer Group. * * @param createdBy * The user who requests the creation * @return The Deployment Group Response */
Creates a new Deployment Group in the Piazza database. No accompanying GeoServer Layer Group will be created yet at this point; however a placeholder GUID is associated with this Deployment Group that will be used as the title of the eventual GeoServer Layer Group
createDeploymentGroup
{ "repo_name": "venicegeo/pz-access", "path": "src/main/java/access/controller/AccessController.java", "license": "apache-2.0", "size": 24938 }
[ "org.springframework.http.HttpStatus", "org.springframework.http.ResponseEntity", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.bind.annotation.RequestParam" ]
import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.http.*; import org.springframework.web.bind.annotation.*;
[ "org.springframework.http", "org.springframework.web" ]
org.springframework.http; org.springframework.web;
2,374,087
public void test_canJoin_correctRejection() { @SuppressWarnings("rawtypes") final ConstantNode p = new ConstantNode(new Constant<IV>(mockIV())); @SuppressWarnings("rawtypes") final ConstantNode q = new ConstantNode(new Constant<IV>(mockIV())); @SuppressWarnings("rawtypes") final ConstantNode r = new ConstantNode(new Constant<IV>(mockIV())); final VarNode x = new VarNode("x"); final VarNode y = new VarNode("y"); final VarNode z = new VarNode("z"); final StatementPatternNode p1 = new StatementPatternNode(p, y, z); final StatementPatternNode p2 = new StatementPatternNode(x, q, r); final StaticAnalysis sa = new StaticAnalysis(new QueryRoot(QueryType.SELECT)); // correct rejection w/ null arg. try { sa.canJoin(null, p2); fail("Expecting: " + IllegalArgumentException.class); } catch (IllegalArgumentException ex) { if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex); } // correct rejection w/ null arg. try { sa.canJoin(p1, null); fail("Expecting: " + IllegalArgumentException.class); } catch (IllegalArgumentException ex) { if (log.isInfoEnabled()) log.info("Ignoring expected exception: " + ex); } }
void function() { @SuppressWarnings(STR) final ConstantNode p = new ConstantNode(new Constant<IV>(mockIV())); @SuppressWarnings(STR) final ConstantNode q = new ConstantNode(new Constant<IV>(mockIV())); @SuppressWarnings(STR) final ConstantNode r = new ConstantNode(new Constant<IV>(mockIV())); final VarNode x = new VarNode("x"); final VarNode y = new VarNode("y"); final VarNode z = new VarNode("z"); final StatementPatternNode p1 = new StatementPatternNode(p, y, z); final StatementPatternNode p2 = new StatementPatternNode(x, q, r); final StaticAnalysis sa = new StaticAnalysis(new QueryRoot(QueryType.SELECT)); try { sa.canJoin(null, p2); fail(STR + IllegalArgumentException.class); } catch (IllegalArgumentException ex) { if (log.isInfoEnabled()) log.info(STR + ex); } try { sa.canJoin(p1, null); fail(STR + IllegalArgumentException.class); } catch (IllegalArgumentException ex) { if (log.isInfoEnabled()) log.info(STR + ex); } }
/** * Correct rejection tests. * * @see StaticAnalysis#canJoin(IBindingProducerNode, IBindingProducerNode) */
Correct rejection tests
test_canJoin_correctRejection
{ "repo_name": "wikimedia/wikidata-query-blazegraph", "path": "bigdata-rdf-test/src/test/java/com/bigdata/rdf/sparql/ast/TestStaticAnalysis_CanJoin.java", "license": "gpl-2.0", "size": 6511 }
[ "com.bigdata.bop.Constant" ]
import com.bigdata.bop.Constant;
import com.bigdata.bop.*;
[ "com.bigdata.bop" ]
com.bigdata.bop;
606,983
public void printSubNodes(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (leftOperand != null) { printLabel(depth, "leftOperand: "); leftOperand.treePrint(depth + 1); } if (rightOperandList != null) { printLabel(depth, "rightOperandList: "); rightOperandList.treePrint(depth + 1); } } }
void function(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (leftOperand != null) { printLabel(depth, STR); leftOperand.treePrint(depth + 1); } if (rightOperandList != null) { printLabel(depth, STR); rightOperandList.treePrint(depth + 1); } } }
/** * Prints the sub-nodes of this object. See QueryTreeNode.java for * how tree printing is supposed to work. * * @param depth The depth of this node in the tree */
Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work
printSubNodes
{ "repo_name": "lpxz/grail-derby104", "path": "java/engine/org/apache/derby/impl/sql/compile/BinaryListOperatorNode.java", "license": "apache-2.0", "size": 12688 }
[ "org.apache.derby.iapi.services.sanity.SanityManager" ]
import org.apache.derby.iapi.services.sanity.SanityManager;
import org.apache.derby.iapi.services.sanity.*;
[ "org.apache.derby" ]
org.apache.derby;
1,607,678
public static VoltTable fromJSONObject(JSONObject json) throws JSONException, IOException { // extract the schema and creat an empty table JSONArray jsonCols = json.getJSONArray(JSON_SCHEMA_KEY); ColumnInfo[] columns = new ColumnInfo[jsonCols.length()]; for (int i = 0; i < jsonCols.length(); i++) { JSONObject jsonCol = jsonCols.getJSONObject(i); String name = jsonCol.getString(JSON_NAME_KEY); VoltType type = VoltType.get((byte) jsonCol.getInt(JSON_TYPE_KEY)); columns[i] = new ColumnInfo(name, type); } VoltTable t = new VoltTable(columns); // set the status byte byte status = (byte) json.getInt(JSON_STATUS_KEY); t.setStatusCode(status); // load the row data JSONArray data = json.getJSONArray(JSON_DATA_KEY); for (int i = 0; i < data.length(); i++) { JSONArray jsonRow = data.getJSONArray(i); assert(jsonRow.length() == jsonCols.length()); Object[] row = new Object[jsonRow.length()]; for (int j = 0; j < jsonRow.length(); j++) { row[j] = jsonRow.get(j); if (row[j] == JSONObject.NULL) row[j] = null; VoltType type = columns[j].type; // convert strings to numbers if (row[j] != null) { switch (type) { case BIGINT: case INTEGER: case SMALLINT: case TINYINT: case TIMESTAMP: if (row[j] instanceof String) { row[j] = Long.parseLong((String) row[j]); } assert(row[j] instanceof Number); break; case DECIMAL: String decVal; if (row[j] instanceof String) decVal = (String) row[j]; else decVal = row[j].toString(); if (decVal.compareToIgnoreCase("NULL") == 0) row[j] = null; else row[j] = VoltDecimalHelper.deserializeBigDecimalFromString(decVal); break; default: // empty fallthrough to make the warning go away } } } t.addRow(row); } return t; }
static VoltTable function(JSONObject json) throws JSONException, IOException { JSONArray jsonCols = json.getJSONArray(JSON_SCHEMA_KEY); ColumnInfo[] columns = new ColumnInfo[jsonCols.length()]; for (int i = 0; i < jsonCols.length(); i++) { JSONObject jsonCol = jsonCols.getJSONObject(i); String name = jsonCol.getString(JSON_NAME_KEY); VoltType type = VoltType.get((byte) jsonCol.getInt(JSON_TYPE_KEY)); columns[i] = new ColumnInfo(name, type); } VoltTable t = new VoltTable(columns); byte status = (byte) json.getInt(JSON_STATUS_KEY); t.setStatusCode(status); JSONArray data = json.getJSONArray(JSON_DATA_KEY); for (int i = 0; i < data.length(); i++) { JSONArray jsonRow = data.getJSONArray(i); assert(jsonRow.length() == jsonCols.length()); Object[] row = new Object[jsonRow.length()]; for (int j = 0; j < jsonRow.length(); j++) { row[j] = jsonRow.get(j); if (row[j] == JSONObject.NULL) row[j] = null; VoltType type = columns[j].type; if (row[j] != null) { switch (type) { case BIGINT: case INTEGER: case SMALLINT: case TINYINT: case TIMESTAMP: if (row[j] instanceof String) { row[j] = Long.parseLong((String) row[j]); } assert(row[j] instanceof Number); break; case DECIMAL: String decVal; if (row[j] instanceof String) decVal = (String) row[j]; else decVal = row[j].toString(); if (decVal.compareToIgnoreCase("NULL") == 0) row[j] = null; else row[j] = VoltDecimalHelper.deserializeBigDecimalFromString(decVal); break; default: } } } t.addRow(row); } return t; }
/** * <p>Construct a table from a JSON object. Only parses VoltDB VoltTable JSON format.</p> * * @param json String containing JSON-formatted table data. * @return Constructed <code>VoltTable</code> instance. * @throws JSONException on JSON-related error. * @throws IOException if thrown by our JSON library. */
Construct a table from a JSON object. Only parses VoltDB VoltTable JSON format
fromJSONObject
{ "repo_name": "zheguang/voltdb", "path": "src/frontend/org/voltdb/VoltTable.java", "license": "agpl-3.0", "size": 63606 }
[ "java.io.IOException", "org.json_voltpatches.JSONArray", "org.json_voltpatches.JSONException", "org.json_voltpatches.JSONObject", "org.voltdb.types.VoltDecimalHelper" ]
import java.io.IOException; import org.json_voltpatches.JSONArray; import org.json_voltpatches.JSONException; import org.json_voltpatches.JSONObject; import org.voltdb.types.VoltDecimalHelper;
import java.io.*; import org.json_voltpatches.*; import org.voltdb.types.*;
[ "java.io", "org.json_voltpatches", "org.voltdb.types" ]
java.io; org.json_voltpatches; org.voltdb.types;
2,587,559