method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public Room updateChatRoom(
final RoomData roomUpdate,
final int roomId) {
final UUID locationId = UUID.fromString("3d0e7ee0-a6c9-497e-9a2c-23b687e860e2"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("roomId", roomId); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH,
locationId,
routeValues,
apiVersion,
roomUpdate,
VssMediaTypes.APPLICATION_JSON_TYPE,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, Room.class);
} | Room function( final RoomData roomUpdate, final int roomId) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, roomId); final VssRestRequest httpRequest = super.createRequest(HttpMethod.PATCH, locationId, routeValues, apiVersion, roomUpdate, VssMediaTypes.APPLICATION_JSON_TYPE, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, Room.class); } | /**
* [Preview API 3.1-preview.1] Update information on a single chat room
*
* @param roomUpdate
* Room information
* @param roomId
* Id of the room to update
* @return Room
*/ | [Preview API 3.1-preview.1] Update information on a single chat room | updateChatRoom | {
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-tfs-client/src/main/generated/com/microsoft/alm/teamfoundation/chat/webapi/ChatHttpClientBase.java",
"license": "mit",
"size": 18876
} | [
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.teamfoundation.chat.webapi.Room",
"com.microsoft.alm.teamfoundation.chat.webapi.RoomData",
"com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion",
"... | import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.teamfoundation.chat.webapi.Room; import com.microsoft.alm.teamfoundation.chat.webapi.RoomData; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.microsoft.alm.client.*; import com.microsoft.alm.teamfoundation.chat.webapi.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*; | [
"com.microsoft.alm",
"java.util"
] | com.microsoft.alm; java.util; | 2,835,693 |
public void toggleExpansionState(Annotation annotation) {
if (annotation instanceof ProjectionAnnotation) {
ProjectionAnnotation projection= (ProjectionAnnotation) annotation;
if (projection.isCollapsed())
projection.markExpanded();
else
projection.markCollapsed();
modifyAnnotation(projection, true);
}
} | void function(Annotation annotation) { if (annotation instanceof ProjectionAnnotation) { ProjectionAnnotation projection= (ProjectionAnnotation) annotation; if (projection.isCollapsed()) projection.markExpanded(); else projection.markCollapsed(); modifyAnnotation(projection, true); } } | /**
* Toggles the expansion state of the given annotation. An appropriate
* annotation model change event is sent out.
*
* @param annotation the annotation
*/ | Toggles the expansion state of the given annotation. An appropriate annotation model change event is sent out | toggleExpansionState | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.jface.text/src/org/eclipse/jface/text/source/projection/ProjectionAnnotationModel.java",
"license": "epl-1.0",
"size": 5754
} | [
"org.eclipse.jface.text.source.Annotation"
] | import org.eclipse.jface.text.source.Annotation; | import org.eclipse.jface.text.source.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,336,494 |
private BinaryObjectException wrapFieldException(String fieldName, Exception e) {
if (S.includeSensitive())
return new BinaryObjectException("Failed to read field: " + fieldName, e);
else
return new BinaryObjectException("Failed to read field.", e);
} | BinaryObjectException function(String fieldName, Exception e) { if (S.includeSensitive()) return new BinaryObjectException(STR + fieldName, e); else return new BinaryObjectException(STR, e); } | /**
* Wraps an exception by adding the fieldName
*
* @param fieldName the name of the field, causes failure
* @param e the cause of the deserialization failure
* @return wrapping exception
*/ | Wraps an exception by adding the fieldName | wrapFieldException | {
"repo_name": "andrey-kuznetsov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryReaderExImpl.java",
"license": "apache-2.0",
"size": 72843
} | [
"org.apache.ignite.binary.BinaryObjectException",
"org.apache.ignite.internal.util.typedef.internal.S"
] | import org.apache.ignite.binary.BinaryObjectException; import org.apache.ignite.internal.util.typedef.internal.S; | import org.apache.ignite.binary.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,130,383 |
SubscriptionCollection getSubscriptions(ListSubscriptionsRequest request); | SubscriptionCollection getSubscriptions(ListSubscriptionsRequest request); | /**
* Retrieves the Subscriptions collection referenced by this resource.
*/ | Retrieves the Subscriptions collection referenced by this resource | getSubscriptions | {
"repo_name": "smartpcr/aws-sdk-java-resources",
"path": "aws-resources-sns/src/main/java/com/amazonaws/resources/sns/SNS.java",
"license": "apache-2.0",
"size": 5301
} | [
"com.amazonaws.services.sns.model.ListSubscriptionsRequest"
] | import com.amazonaws.services.sns.model.ListSubscriptionsRequest; | import com.amazonaws.services.sns.model.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 2,632,430 |
public FileObject getFileAppenderFile() throws IOException
{
return fileAppender.getFile();
}
| FileObject function() throws IOException { return fileAppender.getFile(); } | /**
* This is not thread safe: please try to get the file appender yourself using the static constructor and work from there
*/ | This is not thread safe: please try to get the file appender yourself using the static constructor and work from there | getFileAppenderFile | {
"repo_name": "icholy/geokettle-2.0",
"path": "src-core/org/pentaho/di/core/logging/LogWriter.java",
"license": "lgpl-2.1",
"size": 17012
} | [
"java.io.IOException",
"org.apache.commons.vfs.FileObject"
] | import java.io.IOException; import org.apache.commons.vfs.FileObject; | import java.io.*; import org.apache.commons.vfs.*; | [
"java.io",
"org.apache.commons"
] | java.io; org.apache.commons; | 2,785,453 |
public Scan setFilter(Filter filter) {
this.filter = filter;
return this;
} | Scan function(Filter filter) { this.filter = filter; return this; } | /**
* Apply the specified server-side filter when performing the Scan.
* @param filter filter to run on the server
* @return this
*/ | Apply the specified server-side filter when performing the Scan | setFilter | {
"repo_name": "lichongxin/hbase-snapshot",
"path": "src/main/java/org/apache/hadoop/hbase/client/Scan.java",
"license": "apache-2.0",
"size": 19621
} | [
"org.apache.hadoop.hbase.filter.Filter"
] | import org.apache.hadoop.hbase.filter.Filter; | import org.apache.hadoop.hbase.filter.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 695,005 |
@Nonnull
public java.util.concurrent.CompletableFuture<OrganizationalBranding> patchAsync(@Nonnull final OrganizationalBranding sourceOrganizationalBranding) {
return sendAsync(HttpMethod.PATCH, sourceOrganizationalBranding);
} | java.util.concurrent.CompletableFuture<OrganizationalBranding> function(@Nonnull final OrganizationalBranding sourceOrganizationalBranding) { return sendAsync(HttpMethod.PATCH, sourceOrganizationalBranding); } | /**
* Patches this OrganizationalBranding with a source
*
* @param sourceOrganizationalBranding the source object with updates
* @return a future with the result
*/ | Patches this OrganizationalBranding with a source | patchAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/OrganizationalBrandingRequest.java",
"license": "mit",
"size": 6504
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.OrganizationalBranding",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.OrganizationalBranding; import javax.annotation.Nonnull; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 568,667 |
public OpenMapRealVector append(OpenMapRealVector v) {
OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension());
Iterator iter = v.entries.iterator();
while (iter.hasNext()) {
iter.advance();
res.setEntry(iter.key() + virtualSize, iter.value());
}
return res;
}
| OpenMapRealVector function(OpenMapRealVector v) { OpenMapRealVector res = new OpenMapRealVector(this, v.getDimension()); Iterator iter = v.entries.iterator(); while (iter.hasNext()) { iter.advance(); res.setEntry(iter.key() + virtualSize, iter.value()); } return res; } | /**
* Optimized method to append a OpenMapRealVector.
* @param v vector to append
* @return The result of appending <code>v</code> to self
*/ | Optimized method to append a OpenMapRealVector | append | {
"repo_name": "SpoonLabs/astor",
"path": "examples/Math-issue-288/src/main/java/org/apache/commons/math/linear/OpenMapRealVector.java",
"license": "gpl-2.0",
"size": 41127
} | [
"org.apache.commons.math.util.OpenIntToDoubleHashMap"
] | import org.apache.commons.math.util.OpenIntToDoubleHashMap; | import org.apache.commons.math.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 855,679 |
public static void extract(ZipFile zip, String entry, File dest) throws IOException {
extract(zip, entry, dest, false);
} | static void function(ZipFile zip, String entry, File dest) throws IOException { extract(zip, entry, dest, false); } | /**
* Extracts the entry by the given name from this extractor's ZipFile.
* @param zip the ZIP archive to extract from
* @param entry the name of the entry to extract
* @param dest the file to extract to
* @throws IOException if the entry is not found or an error occurs while extracting to disk
*/ | Extracts the entry by the given name from this extractor's ZipFile | extract | {
"repo_name": "caseif/Quartz",
"path": "src/main/java/net/caseif/quartz/util/Extractor.java",
"license": "mit",
"size": 7535
} | [
"java.io.File",
"java.io.IOException",
"java.util.zip.ZipFile"
] | import java.io.File; import java.io.IOException; import java.util.zip.ZipFile; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 132,460 |
Object importObject(Class clazz,
Type genericType,
Annotation[] annotations,
InputStream inputStream,
Map<Object, List<Object>> headers)
throws IOException; | Object importObject(Class clazz, Type genericType, Annotation[] annotations, InputStream inputStream, Map<Object, List<Object>> headers) throws IOException; | /**
* Import the object quantified by clazz and genericType and qualified by
* the annotaitons from the inpuStream and use the headers to retrieve meta
* informations regarding the object.
* @param clazz The class of the object
* @param genericType The generic used with the object.
* @param annotations Annotations qualifying the object's class.
* @param inputStream The input stream to read and parse the object from.
* @param headers The headers that holds the meta information
* @return The object formed by from the input stream. Should never be NULL.
* @throws java.io.IOException If any error in reading from the stream, i.e.
* either format error or any other error.
*/ | Import the object quantified by clazz and genericType and qualified by the annotaitons from the inpuStream and use the headers to retrieve meta informations regarding the object | importObject | {
"repo_name": "imyousuf/smart-dao",
"path": "smart-exim/smart-exim-api/src/main/java/com/smartitengineering/exim/Importer.java",
"license": "lgpl-3.0",
"size": 3339
} | [
"java.io.IOException",
"java.io.InputStream",
"java.lang.annotation.Annotation",
"java.lang.reflect.Type",
"java.util.List",
"java.util.Map"
] | import java.io.IOException; import java.io.InputStream; import java.lang.annotation.Annotation; import java.lang.reflect.Type; import java.util.List; import java.util.Map; | import java.io.*; import java.lang.annotation.*; import java.lang.reflect.*; import java.util.*; | [
"java.io",
"java.lang",
"java.util"
] | java.io; java.lang; java.util; | 1,461,603 |
public void use(GL3 gl) throws UninitializedException {
if (getPointer() != 0 && initialized) {
gl.glUseProgram(getPointer());
for (Entry<String, FloatBuffer> var : uniformFloatMatrices.entrySet()) {
passUniformMat(gl, var.getKey(), var.getValue());
}
for (Entry<String, FloatBuffer> var : uniformFloatVectors.entrySet()) {
passUniformVec(gl, var.getKey(), var.getValue());
}
for (Entry<String, Boolean> var : uniformBooleans.entrySet()) {
passUniform(gl, var.getKey(), var.getValue());
}
for (Entry<String, Integer> var : uniformInts.entrySet()) {
passUniform(gl, var.getKey(), var.getValue());
}
for (Entry<String, Float> var : uniformFloats.entrySet()) {
passUniform(gl, var.getKey(), var.getValue());
}
for (Entry<String, Double> var : uniformDoubles.entrySet()) {
passUniform(gl, var.getKey(), var.getValue());
}
checkUniforms(vs, fs);
// Check for errors
printError(gl, "use");
} else {
throw new UninitializedException();
}
}
| void function(GL3 gl) throws UninitializedException { if (getPointer() != 0 && initialized) { gl.glUseProgram(getPointer()); for (Entry<String, FloatBuffer> var : uniformFloatMatrices.entrySet()) { passUniformMat(gl, var.getKey(), var.getValue()); } for (Entry<String, FloatBuffer> var : uniformFloatVectors.entrySet()) { passUniformVec(gl, var.getKey(), var.getValue()); } for (Entry<String, Boolean> var : uniformBooleans.entrySet()) { passUniform(gl, var.getKey(), var.getValue()); } for (Entry<String, Integer> var : uniformInts.entrySet()) { passUniform(gl, var.getKey(), var.getValue()); } for (Entry<String, Float> var : uniformFloats.entrySet()) { passUniform(gl, var.getKey(), var.getValue()); } for (Entry<String, Double> var : uniformDoubles.entrySet()) { passUniform(gl, var.getKey(), var.getValue()); } checkUniforms(vs, fs); printError(gl, "use"); } else { throw new UninitializedException(); } } | /**
* use method for this shader. sets this shader as the current rendering
* shader and loads all staged uniform variables. Also checks for the
* presence of all uniforms and checks for additional opengl errors.
*
* @param gl
* The opengl instance.
* @throws UninitializedException
* if this ShaderProgram was used without initialization.
*/ | use method for this shader. sets this shader as the current rendering shader and loads all staged uniform variables. Also checks for the presence of all uniforms and checks for additional opengl errors | use | {
"repo_name": "NLeSC/Neon",
"path": "src/nl/esciencecenter/neon/shaders/ShaderProgram.java",
"license": "apache-2.0",
"size": 29467
} | [
"java.nio.FloatBuffer",
"java.util.Map",
"nl.esciencecenter.neon.exceptions.UninitializedException"
] | import java.nio.FloatBuffer; import java.util.Map; import nl.esciencecenter.neon.exceptions.UninitializedException; | import java.nio.*; import java.util.*; import nl.esciencecenter.neon.exceptions.*; | [
"java.nio",
"java.util",
"nl.esciencecenter.neon"
] | java.nio; java.util; nl.esciencecenter.neon; | 2,589,273 |
private static boolean isSimplePreferences(Context context) {
return ALWAYS_SIMPLE_PREFS
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
|| !isXLargeTablet(context);
}
/**
* {@inheritDoc} | static boolean function(Context context) { return ALWAYS_SIMPLE_PREFS Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB !isXLargeTablet(context); } /** * {@inheritDoc} | /**
* Determines whether the simplified settings UI should be shown. This is
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
* doesn't have an extra-large screen. In these cases, a single-pane
* "simplified" settings UI should be shown.
*/ | Determines whether the simplified settings UI should be shown. This is true if this is forced via <code>#ALWAYS_SIMPLE_PREFS</code>, or the device doesn't have newer APIs like <code>PreferenceFragment</code>, or the device doesn't have an extra-large screen. In these cases, a single-pane "simplified" settings UI should be shown | isSimplePreferences | {
"repo_name": "JGarrido/who-me",
"path": "app/src/main/java/net/kodefi/who_me/SettingsActivity.java",
"license": "apache-2.0",
"size": 14254
} | [
"android.content.Context",
"android.os.Build"
] | import android.content.Context; import android.os.Build; | import android.content.*; import android.os.*; | [
"android.content",
"android.os"
] | android.content; android.os; | 2,818,449 |
public void doInit()
throws StartupException
{
Iterator<InitializationTask> i = processingQueue.iterator();
//Tell all listeners that we're about to start.
notifyStart();
//Execute all pending tasks.
while (i.hasNext()) {
currentTask = i.next();
notifyExecute(); //Tell listeners we're about to exec a task.
currentTask.execute();
doneTasks.push(currentTask); //For later rollback if needed.
}
}
| void function() throws StartupException { Iterator<InitializationTask> i = processingQueue.iterator(); notifyStart(); while (i.hasNext()) { currentTask = i.next(); notifyExecute(); currentTask.execute(); doneTasks.push(currentTask); } } | /**
* Performs the initialization procedure.
*
* @throws StartupException If an error occurs while executing an
* initialization task.
*/ | Performs the initialization procedure | doInit | {
"repo_name": "knabar/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/env/init/Initializer.java",
"license": "gpl-2.0",
"size": 11164
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 338,070 |
private void writeRSLSETRM(DRDAStatement stmt) throws DRDAProtocolException,SQLException
{
int numResults = stmt.getNumResultSets();
writer.createDssReply();
writer.startDdm(CodePoint.RSLSETRM);
writer.writeScalar2Bytes(CodePoint.SVRCOD, 0);
writer.startDdm(CodePoint.PKGSNLST);
for (int i = 0; i < numResults; i++)
writePKGNAMCSN(stmt.getResultSetPkgcnstkn(i).getBytes());
writer.endDdm();
writer.endDdmAndDss();
}
| void function(DRDAStatement stmt) throws DRDAProtocolException,SQLException { int numResults = stmt.getNumResultSets(); writer.createDssReply(); writer.startDdm(CodePoint.RSLSETRM); writer.writeScalar2Bytes(CodePoint.SVRCOD, 0); writer.startDdm(CodePoint.PKGSNLST); for (int i = 0; i < numResults; i++) writePKGNAMCSN(stmt.getResultSetPkgcnstkn(i).getBytes()); writer.endDdm(); writer.endDdmAndDss(); } | /**
* Write RSLSETRM
* Instance variables
* SVRCOD - Severity code - Information only - required
* PKGSNLST - list of PKGNAMCSN -required
* SRVDGN - Server Diagnostic Information -optional
*
* @throws DRDAProtocolException
* @throws SQLException
*/ | Write RSLSETRM Instance variables SVRCOD - Severity code - Information only - required PKGSNLST - list of PKGNAMCSN -required SRVDGN - Server Diagnostic Information -optional | writeRSLSETRM | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfirexd/core/src/drda/java/com/pivotal/gemfirexd/internal/impl/drda/DRDAConnThread.java",
"license": "apache-2.0",
"size": 357866
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,617,879 |
public static String getDataTypeNameFromClass(Class<?> c, boolean highlightNameSpaces) {
SkylarkModule module = SkylarkInterfaceUtils.getSkylarkModule(c);
if (module != null) {
return module.name()
+ ((module.namespace() && highlightNameSpaces) ? " (a language module)" : "");
} else if (c.equals(Object.class)) {
return "unknown";
} else if (c.equals(String.class)) {
return "string";
} else if (c.equals(Integer.class)) {
return "int";
} else if (c.equals(Boolean.class)) {
return "bool";
} else if (List.class.isAssignableFrom(c)) { // This is a Java List that isn't a SkylarkList
return "List"; // This case shouldn't happen in normal code, but we keep it for debugging.
} else if (Map.class.isAssignableFrom(c)) { // This is a Java Map that isn't a SkylarkDict
return "Map"; // This case shouldn't happen in normal code, but we keep it for debugging.
} else if (StarlarkCallable.class.isAssignableFrom(c)) {
// TODO(adonovan): each StarlarkCallable should report its own type string.
return "function";
} else if (c.equals(SelectorValue.class)) {
return "select";
} else {
if (c.getSimpleName().isEmpty()) {
return c.getName();
} else {
return c.getSimpleName();
}
}
} | static String function(Class<?> c, boolean highlightNameSpaces) { SkylarkModule module = SkylarkInterfaceUtils.getSkylarkModule(c); if (module != null) { return module.name() + ((module.namespace() && highlightNameSpaces) ? STR : STRunknownSTRstringSTRintSTRboolSTRListSTRMapSTRfunctionSTRselect"; } else { if (c.getSimpleName().isEmpty()) { return c.getName(); } else { return c.getSimpleName(); } } } | /**
* Returns a pretty name for the datatype equivalent of class 'c' in the Build language.
* @param highlightNameSpaces Determines whether the result should also contain a special comment
* when the given class identifies a Skylark name space.
*/ | Returns a pretty name for the datatype equivalent of class 'c' in the Build language | getDataTypeNameFromClass | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/lib/syntax/EvalUtils.java",
"license": "apache-2.0",
"size": 45162
} | [
"com.google.devtools.build.lib.skylarkinterface.SkylarkInterfaceUtils",
"com.google.devtools.build.lib.skylarkinterface.SkylarkModule"
] | import com.google.devtools.build.lib.skylarkinterface.SkylarkInterfaceUtils; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; | import com.google.devtools.build.lib.skylarkinterface.*; | [
"com.google.devtools"
] | com.google.devtools; | 2,816,007 |
private synchronized boolean equalsTopology(Set<OfMockLink> topo) {
if (topo.size() != getEdgeCount()) {
return false;
}
for (OfMockLink link: getEdges()) {
if (!topo.contains(link)) {
return false;
}
}
return true;
} | synchronized boolean function(Set<OfMockLink> topo) { if (topo.size() != getEdgeCount()) { return false; } for (OfMockLink link: getEdges()) { if (!topo.contains(link)) { return false; } } return true; } | /**
* Determine whether the current network topology is equal to the given
* topology or not.
*
* @param topo A set of {@link OfMockLink} instances which indicates the
* expected topology.
* @return {@code true} only if the given topology is equal to the current
* topology.
*/ | Determine whether the current network topology is equal to the given topology or not | equalsTopology | {
"repo_name": "opendaylight/vtn",
"path": "manager/it/ofmock/src/main/java/org/opendaylight/vtn/manager/it/ofmock/impl/RoutingTable.java",
"license": "epl-1.0",
"size": 16843
} | [
"java.util.Set",
"org.opendaylight.vtn.manager.it.ofmock.OfMockLink"
] | import java.util.Set; import org.opendaylight.vtn.manager.it.ofmock.OfMockLink; | import java.util.*; import org.opendaylight.vtn.manager.it.ofmock.*; | [
"java.util",
"org.opendaylight.vtn"
] | java.util; org.opendaylight.vtn; | 2,568,109 |
@SuppressWarnings("unchecked")
private <T> T convertFlag(final String[] values, final Class<T> clazz) {
final String joined = StringUtils.join(values, ' ');
if (String[].class.isAssignableFrom(clazz)) {
return (T) values;
} else if (String.class.isAssignableFrom(clazz)) {
return (T) joined;
} else if (Integer.class.isAssignableFrom(clazz)) {
return (T) (Integer) Integer.parseInt(joined);
} else if (Short.class.isAssignableFrom(clazz)) {
return (T) (Short) Short.parseShort(joined);
} else if (Long.class.isAssignableFrom(clazz)) {
return (T) (Long) Long.parseLong(joined);
} else if (Float.class.isAssignableFrom(clazz)) {
return (T) (Float) Float.parseFloat(joined);
}
return null;
} | @SuppressWarnings(STR) <T> T function(final String[] values, final Class<T> clazz) { final String joined = StringUtils.join(values, ' '); if (String[].class.isAssignableFrom(clazz)) { return (T) values; } else if (String.class.isAssignableFrom(clazz)) { return (T) joined; } else if (Integer.class.isAssignableFrom(clazz)) { return (T) (Integer) Integer.parseInt(joined); } else if (Short.class.isAssignableFrom(clazz)) { return (T) (Short) Short.parseShort(joined); } else if (Long.class.isAssignableFrom(clazz)) { return (T) (Long) Long.parseLong(joined); } else if (Float.class.isAssignableFrom(clazz)) { return (T) (Float) Float.parseFloat(joined); } return null; } | /**
* Attempts to convert the given values to the given class.
*
* @param values Values to convert (will be joined if necessary)
* @param clazz Class to convert to
* @param <T> Type to return (will cast)
* @return Converted value
*/ | Attempts to convert the given values to the given class | convertFlag | {
"repo_name": "RoyalDev/RoyalCommands",
"path": "modules/RoyalCommands/src/main/java/org/royaldev/royalcommands/rcommands/BaseCommand.java",
"license": "mpl-2.0",
"size": 25215
} | [
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 622,674 |
static HystrixCommandProperties asMock(final Setter builder) {
return new HystrixCommandProperties(TestKey.TEST) { | static HystrixCommandProperties asMock(final Setter builder) { return new HystrixCommandProperties(TestKey.TEST) { | /**
* Return a static representation of the properties with values from the Builder so that UnitTests can create properties that are not affected by the actual implementations which pick up their
* values dynamically.
*
* @param builder command properties builder
* @return HystrixCommandProperties
*/ | Return a static representation of the properties with values from the Builder so that UnitTests can create properties that are not affected by the actual implementations which pick up their values dynamically | asMock | {
"repo_name": "fluxcapacitor/pipeline",
"path": "predict/dashboard/hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandPropertiesTest.java",
"license": "apache-2.0",
"size": 18385
} | [
"com.netflix.hystrix.HystrixCommandProperties"
] | import com.netflix.hystrix.HystrixCommandProperties; | import com.netflix.hystrix.*; | [
"com.netflix.hystrix"
] | com.netflix.hystrix; | 927,405 |
@Override
public AuthRequest authenticate(AuthRequest who) throws AccountException {
if (Strings.isNullOrEmpty(who.getPassword()) &&
!Strings.isNullOrEmpty(who.getEmailAddress())) {
return who;
}
if (Strings.isNullOrEmpty(who.getAuthPlugin())
|| Strings.isNullOrEmpty(who.getAuthProvider())) {
throw new AccountException("Cannot authenticate");
}
OAuthLoginProvider loginProvider =
loginProviders.get(who.getAuthPlugin(), who.getAuthProvider());
if (loginProvider == null) {
throw new AccountException("Cannot authenticate");
}
OAuthUserInfo userInfo;
try {
userInfo = loginProvider.login(who.getUserName(), who.getPassword());
} catch (IOException e) {
throw new AccountException("Cannot authenticate", e);
}
if (userInfo == null) {
throw new AccountException("Cannot authenticate");
}
if (!Strings.isNullOrEmpty(userInfo.getEmailAddress())) {
who.setEmailAddress(userInfo.getEmailAddress());
}
if (!Strings.isNullOrEmpty(userInfo.getDisplayName())) {
who.setDisplayName(userInfo.getDisplayName());
}
return who;
} | AuthRequest function(AuthRequest who) throws AccountException { if (Strings.isNullOrEmpty(who.getPassword()) && !Strings.isNullOrEmpty(who.getEmailAddress())) { return who; } if (Strings.isNullOrEmpty(who.getAuthPlugin()) Strings.isNullOrEmpty(who.getAuthProvider())) { throw new AccountException(STR); } OAuthLoginProvider loginProvider = loginProviders.get(who.getAuthPlugin(), who.getAuthProvider()); if (loginProvider == null) { throw new AccountException(STR); } OAuthUserInfo userInfo; try { userInfo = loginProvider.login(who.getUserName(), who.getPassword()); } catch (IOException e) { throw new AccountException(STR, e); } if (userInfo == null) { throw new AccountException(STR); } if (!Strings.isNullOrEmpty(userInfo.getEmailAddress())) { who.setEmailAddress(userInfo.getEmailAddress()); } if (!Strings.isNullOrEmpty(userInfo.getDisplayName())) { who.setDisplayName(userInfo.getDisplayName()); } return who; } | /**
* Authenticates with the {@link OAuthLoginProvider} specified
* in the authentication request.
*
* {@link AccountManager} calls this method without password
* if authenticity of the user has already been established.
* In that case the {@link AuthRequest} is supposed to contain
* a resolved email address and we can skip the authentication
* request to the {@code OAuthLoginService}.
*
* @param who the authentication request.
*
* @return the authentication request with resolved email address
* and display name in case the authenticity of the user could
* be established; otherwise {@code who} is returned unchanged.
*
* @throws AccountException if the authentication request with
* the OAuth2 server failed or no {@code OAuthLoginProvider} was
* available to handle the request.
*/ | Authenticates with the <code>OAuthLoginProvider</code> specified in the authentication request. <code>AccountManager</code> calls this method without password if authenticity of the user has already been established. In that case the <code>AuthRequest</code> is supposed to contain a resolved email address and we can skip the authentication request to the OAuthLoginService | authenticate | {
"repo_name": "MerritCR/merrit",
"path": "gerrit-server/src/main/java/com/google/gerrit/server/auth/oauth/OAuthRealm.java",
"license": "apache-2.0",
"size": 4717
} | [
"com.google.common.base.Strings",
"com.google.gerrit.extensions.auth.oauth.OAuthLoginProvider",
"com.google.gerrit.extensions.auth.oauth.OAuthUserInfo",
"com.google.gerrit.server.account.AccountException",
"com.google.gerrit.server.account.AuthRequest",
"java.io.IOException"
] | import com.google.common.base.Strings; import com.google.gerrit.extensions.auth.oauth.OAuthLoginProvider; import com.google.gerrit.extensions.auth.oauth.OAuthUserInfo; import com.google.gerrit.server.account.AccountException; import com.google.gerrit.server.account.AuthRequest; import java.io.IOException; | import com.google.common.base.*; import com.google.gerrit.extensions.auth.oauth.*; import com.google.gerrit.server.account.*; import java.io.*; | [
"com.google.common",
"com.google.gerrit",
"java.io"
] | com.google.common; com.google.gerrit; java.io; | 584,005 |
public boolean isSelected(InstallData idata, File basedir, String filename, File file) throws Exception
{
// throw BuildException on error
validate();
// Determine file whose existence is to be checked
String[] destfiles = map.mapFileName(filename);
// If filename does not match the To attribute of the mapper
// then filter it out of the files we are considering
if (destfiles == null)
{
return false;
}
// Sanity check
if (destfiles.length != 1 || destfiles[0] == null)
{
throw new Exception("Invalid destination file results for "
+ targetdir + " with filename " + filename);
}
String destname = destfiles[0];
File destfile = new File(targetdir, destname);
return destfile.exists() == destmustexist;
}
public enum FilePresence
{
SRCONLY("srconly"), BOTH("both");
private static Map<String, FilePresence> lookup;
private String attribute;
FilePresence(String attribute)
{
this.attribute = attribute;
}
static
{
lookup = new HashMap<String, FilePresence>();
for (FilePresence mapperType : EnumSet.allOf(FilePresence.class))
{
lookup.put(mapperType.getAttribute(), mapperType);
}
} | boolean function(InstallData idata, File basedir, String filename, File file) throws Exception { validate(); String[] destfiles = map.mapFileName(filename); if (destfiles == null) { return false; } if (destfiles.length != 1 destfiles[0] == null) { throw new Exception(STR + targetdir + STR + filename); } String destname = destfiles[0]; File destfile = new File(targetdir, destname); return destfile.exists() == destmustexist; } public enum FilePresence { SRCONLY(STR), BOTH("both"); private static Map<String, FilePresence> lookup; private String attribute; FilePresence(String attribute) { this.attribute = attribute; } static { lookup = new HashMap<String, FilePresence>(); for (FilePresence mapperType : EnumSet.allOf(FilePresence.class)) { lookup.put(mapperType.getAttribute(), mapperType); } } | /**
* The heart of the matter. This is where the selector gets to decide
* on the inclusion of a file in a particular fileset.
*
* @param basedir the base directory the scan is being done from
* @param filename is the name of the file to check
* @param file is a java.io.File object the selector can use
* @return whether the file should be selected or not
*/ | The heart of the matter. This is where the selector gets to decide on the inclusion of a file in a particular fileset | isSelected | {
"repo_name": "mtjandra/izpack",
"path": "izpack-util/src/main/java/com/izforge/izpack/util/file/types/selectors/PresentSelector.java",
"license": "apache-2.0",
"size": 6599
} | [
"com.izforge.izpack.api.data.InstallData",
"java.io.File",
"java.util.EnumSet",
"java.util.HashMap",
"java.util.Map"
] | import com.izforge.izpack.api.data.InstallData; import java.io.File; import java.util.EnumSet; import java.util.HashMap; import java.util.Map; | import com.izforge.izpack.api.data.*; import java.io.*; import java.util.*; | [
"com.izforge.izpack",
"java.io",
"java.util"
] | com.izforge.izpack; java.io; java.util; | 560,991 |
String getEvaluatedResult(File file, String xpath, Map<String, String> namespaces); | String getEvaluatedResult(File file, String xpath, Map<String, String> namespaces); | /**
* Returns the output of an evaluated XPath expression on a given XML file.
*
* @param file XML file
* @param xpath XPath expression
* @return Evaluated output as a string
*/ | Returns the output of an evaluated XPath expression on a given XML file | getEvaluatedResult | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb/src/org/wso2/developerstudio/eclipse/gmf/esb/util/XPathValidator.java",
"license": "apache-2.0",
"size": 2562
} | [
"java.io.File",
"java.util.Map"
] | import java.io.File; import java.util.Map; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,592,988 |
public void tableChanged(TableModelEvent ev)
{
vector=tableModel.getVector();
} | void function(TableModelEvent ev) { vector=tableModel.getVector(); } | /**
* Updates the related Vector object whenever TableModel datas were changed.
*/ | Updates the related Vector object whenever TableModel datas were changed | tableChanged | {
"repo_name": "jupsal/schmies-jTEM",
"path": "libUnzipped/de/jtem/blas/VectorEditorPanel.java",
"license": "bsd-2-clause",
"size": 6449
} | [
"javax.swing.event.TableModelEvent"
] | import javax.swing.event.TableModelEvent; | import javax.swing.event.*; | [
"javax.swing"
] | javax.swing; | 1,735,038 |
public Object get(String name, Scriptable start) {
Object ret_val = NOT_FOUND;
if(propertyNames.contains(name)) {
ret_val = length;
}
return ret_val;
} | Object function(String name, Scriptable start) { Object ret_val = NOT_FOUND; if(propertyNames.contains(name)) { ret_val = length; } return ret_val; } | /**
* Get the value of the named function. If no function object is
* registex for this name, the method will return null.
*
* @param name The variable name
* @param start The object where the lookup began
* @return the corresponding function object or null
*/ | Get the value of the named function. If no function object is registex for this name, the method will return null | get | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/web3d/vrml/scripting/ecmascript/x3d/ComponentInfoArray.java",
"license": "gpl-2.0",
"size": 2950
} | [
"org.mozilla.javascript.Scriptable"
] | import org.mozilla.javascript.Scriptable; | import org.mozilla.javascript.*; | [
"org.mozilla.javascript"
] | org.mozilla.javascript; | 1,273,449 |
public void setQualifiedName(final QName aQualifiedName) {
pQName = aQualifiedName;
} | void function(final QName aQualifiedName) { pQName = aQualifiedName; } | /**
* Sets the qualified name of this object
*
* @param aQualifiedName
* A qualified name
*/ | Sets the qualified name of this object | setQualifiedName | {
"repo_name": "isandlaTech/cohorte-runtime",
"path": "java/deprecated/isolates/org.psem2m.sca.converter/src/org/psem2m/sca/converter/model/AbstractNameableSCAElement.java",
"license": "apache-2.0",
"size": 3461
} | [
"org.psem2m.sca.converter.utils.QName"
] | import org.psem2m.sca.converter.utils.QName; | import org.psem2m.sca.converter.utils.*; | [
"org.psem2m.sca"
] | org.psem2m.sca; | 408,852 |
public void addListener(AgentRosterListener listener) {
synchronized (listeners) {
if (!listeners.contains(listener)) {
listeners.add(listener);
// Fire events for the existing entries and presences in the roster
for (EntityBareJid jid : getAgents()) {
// Check again in case the agent is no longer in the roster (highly unlikely
// but possible)
if (entries.contains(jid)) {
// Fire the agent added event
listener.agentAdded(jid);
Jid j;
try {
j = JidCreate.from(jid);
}
catch (XmppStringprepException e) {
throw new IllegalStateException(e);
}
Map<Resourcepart, Presence> userPresences = presenceMap.get(j);
if (userPresences != null) {
Iterator<Presence> presences = userPresences.values().iterator();
while (presences.hasNext()) {
// Fire the presence changed event
listener.presenceChanged(presences.next());
}
}
}
}
}
}
} | void function(AgentRosterListener listener) { synchronized (listeners) { if (!listeners.contains(listener)) { listeners.add(listener); for (EntityBareJid jid : getAgents()) { if (entries.contains(jid)) { listener.agentAdded(jid); Jid j; try { j = JidCreate.from(jid); } catch (XmppStringprepException e) { throw new IllegalStateException(e); } Map<Resourcepart, Presence> userPresences = presenceMap.get(j); if (userPresences != null) { Iterator<Presence> presences = userPresences.values().iterator(); while (presences.hasNext()) { listener.presenceChanged(presences.next()); } } } } } } } | /**
* Adds a listener to this roster. The listener will be fired anytime one or more
* changes to the roster are pushed from the server.
*
* @param listener an agent roster listener.
*/ | Adds a listener to this roster. The listener will be fired anytime one or more changes to the roster are pushed from the server | addListener | {
"repo_name": "igniterealtime/Smack",
"path": "smack-legacy/src/main/java/org/jivesoftware/smackx/workgroup/agent/AgentRoster.java",
"license": "apache-2.0",
"size": 16430
} | [
"java.util.Iterator",
"java.util.Map",
"org.jivesoftware.smack.packet.Presence",
"org.jxmpp.jid.EntityBareJid",
"org.jxmpp.jid.Jid",
"org.jxmpp.jid.impl.JidCreate",
"org.jxmpp.jid.parts.Resourcepart",
"org.jxmpp.stringprep.XmppStringprepException"
] | import java.util.Iterator; import java.util.Map; import org.jivesoftware.smack.packet.Presence; import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.Jid; import org.jxmpp.jid.impl.JidCreate; import org.jxmpp.jid.parts.Resourcepart; import org.jxmpp.stringprep.XmppStringprepException; | import java.util.*; import org.jivesoftware.smack.packet.*; import org.jxmpp.jid.*; import org.jxmpp.jid.impl.*; import org.jxmpp.jid.parts.*; import org.jxmpp.stringprep.*; | [
"java.util",
"org.jivesoftware.smack",
"org.jxmpp.jid",
"org.jxmpp.stringprep"
] | java.util; org.jivesoftware.smack; org.jxmpp.jid; org.jxmpp.stringprep; | 1,816,512 |
private void restoreTableDescriptor(final MasterProcedureEnv env) throws IOException {
env.getMasterServices().getTableDescriptors().add(unmodifiedTableDescriptor);
// Make sure regions are opened after table descriptor is updated.
//reOpenAllRegionsIfTableIsOnline(env);
// TODO: NUKE ROLLBACK!!!!
} | void function(final MasterProcedureEnv env) throws IOException { env.getMasterServices().getTableDescriptors().add(unmodifiedTableDescriptor); } | /**
* Restore back to the old descriptor
* @param env MasterProcedureEnv
* @throws IOException
**/ | Restore back to the old descriptor | restoreTableDescriptor | {
"repo_name": "JingchengDu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/DeleteColumnFamilyProcedure.java",
"license": "apache-2.0",
"size": 13423
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,832,192 |
@ApiModelProperty(value = "Limit access to before this date.")
public DateTime getAccessUntil() {
return accessUntil;
} | @ApiModelProperty(value = STR) DateTime function() { return accessUntil; } | /**
* Limit access to before this date.
* @return accessUntil
**/ | Limit access to before this date | getAccessUntil | {
"repo_name": "iterate-ch/cyberduck",
"path": "storegate/src/main/java/ch/cyberduck/core/storegate/io/swagger/client/model/CreateFileShareRequest.java",
"license": "gpl-3.0",
"size": 13214
} | [
"io.swagger.annotations.ApiModelProperty",
"org.joda.time.DateTime"
] | import io.swagger.annotations.ApiModelProperty; import org.joda.time.DateTime; | import io.swagger.annotations.*; import org.joda.time.*; | [
"io.swagger.annotations",
"org.joda.time"
] | io.swagger.annotations; org.joda.time; | 30,918 |
public void startNewVoting() {
logger.info("startNewVoting: explicitly starting new voting...");
ResourceResolver resourceResolver = null;
try {
resourceResolver = getResourceResolver();
final Resource clusterNodesRes = ResourceHelper.getOrCreateResource(
resourceResolver, config.getClusterInstancesPath());
final Set<String> liveInstances = ViewHelper.determineLiveInstances(
clusterNodesRes, config);
doStartNewVoting(resourceResolver, liveInstances);
logger.info("startNewVoting: explicit new voting was started.");
} catch (LoginException e) {
logger.error("startNewVoting: could not log in administratively: " + e,
e);
} catch (PersistenceException e) {
logger.error(
"startNewVoting: encountered a persistence exception during view check: "
+ e, e);
} finally {
if (resourceResolver != null) {
resourceResolver.close();
}
}
} | void function() { logger.info(STR); ResourceResolver resourceResolver = null; try { resourceResolver = getResourceResolver(); final Resource clusterNodesRes = ResourceHelper.getOrCreateResource( resourceResolver, config.getClusterInstancesPath()); final Set<String> liveInstances = ViewHelper.determineLiveInstances( clusterNodesRes, config); doStartNewVoting(resourceResolver, liveInstances); logger.info(STR); } catch (LoginException e) { logger.error(STR + e, e); } catch (PersistenceException e) { logger.error( STR + e, e); } finally { if (resourceResolver != null) { resourceResolver.close(); } } } | /**
* Management function to trigger the otherwise algorithm-dependent
* start of a new voting.
* This can make sense when explicitly trying to force a leader
* change (which is otherwise not allowed by the discovery API)
*/ | Management function to trigger the otherwise algorithm-dependent start of a new voting. This can make sense when explicitly trying to force a leader change (which is otherwise not allowed by the discovery API) | startNewVoting | {
"repo_name": "gutsy/sling",
"path": "bundles/extensions/discovery/impl/src/main/java/org/apache/sling/discovery/impl/common/heartbeat/HeartbeatHandler.java",
"license": "apache-2.0",
"size": 32055
} | [
"java.util.Set",
"org.apache.sling.api.resource.LoginException",
"org.apache.sling.api.resource.PersistenceException",
"org.apache.sling.api.resource.Resource",
"org.apache.sling.api.resource.ResourceResolver",
"org.apache.sling.discovery.impl.common.ViewHelper",
"org.apache.sling.discovery.impl.common.... | import java.util.Set; import org.apache.sling.api.resource.LoginException; import org.apache.sling.api.resource.PersistenceException; import org.apache.sling.api.resource.Resource; import org.apache.sling.api.resource.ResourceResolver; import org.apache.sling.discovery.impl.common.ViewHelper; import org.apache.sling.discovery.impl.common.resource.ResourceHelper; | import java.util.*; import org.apache.sling.api.resource.*; import org.apache.sling.discovery.impl.common.*; import org.apache.sling.discovery.impl.common.resource.*; | [
"java.util",
"org.apache.sling"
] | java.util; org.apache.sling; | 917,532 |
int processResults(Result result, List<JSModule> modules, B options)
throws FlagUsageException, IOException {
if (config.printPassGraph) {
if (compiler.getRoot() == null) {
return 1;
} else {
jsOutput.append(
DotFormatter.toDot(compiler.getPassConfig().getPassGraph()));
jsOutput.append('\n');
return 0;
}
}
if (config.printAst) {
if (compiler.getRoot() == null) {
return 1;
} else {
ControlFlowGraph<Node> cfg = compiler.computeCFG();
DotFormatter.appendDot(
compiler.getRoot().getLastChild(), cfg, jsOutput);
jsOutput.append('\n');
return 0;
}
}
if (config.printTree) {
if (compiler.getRoot() == null) {
jsOutput.append("Code contains errors; no tree was generated.\n");
return 1;
} else {
compiler.getRoot().appendStringTree(jsOutput);
jsOutput.append("\n");
return 0;
}
}
rootRelativePathsMap = constructRootRelativePathsMap();
if (config.skipNormalOutputs) {
// Output the manifest and bundle files if requested.
outputManifest();
outputBundle();
outputModuleGraphJson();
return 0;
} else if (result.success) {
outputModuleGraphJson();
if (modules == null) {
outputSingleBinary();
// Output the source map if requested.
outputSourceMap(options, config.jsOutputFile);
} else {
outputModuleBinaryAndSourceMaps(modules, options);
}
// Output the externs if required.
if (options.externExportsPath != null) {
Writer eeOut =
openExternExportsStream(options, config.jsOutputFile);
eeOut.append(result.externExport);
eeOut.close();
}
// Output the variable and property name maps if requested.
outputNameMaps();
// Output the manifest and bundle files if requested.
outputManifest();
outputBundle();
}
// return 0 if no errors, the error count otherwise
return Math.min(result.errors.length, 0x7f);
} | int processResults(Result result, List<JSModule> modules, B options) throws FlagUsageException, IOException { if (config.printPassGraph) { if (compiler.getRoot() == null) { return 1; } else { jsOutput.append( DotFormatter.toDot(compiler.getPassConfig().getPassGraph())); jsOutput.append('\n'); return 0; } } if (config.printAst) { if (compiler.getRoot() == null) { return 1; } else { ControlFlowGraph<Node> cfg = compiler.computeCFG(); DotFormatter.appendDot( compiler.getRoot().getLastChild(), cfg, jsOutput); jsOutput.append('\n'); return 0; } } if (config.printTree) { if (compiler.getRoot() == null) { jsOutput.append(STR); return 1; } else { compiler.getRoot().appendStringTree(jsOutput); jsOutput.append("\n"); return 0; } } rootRelativePathsMap = constructRootRelativePathsMap(); if (config.skipNormalOutputs) { outputManifest(); outputBundle(); outputModuleGraphJson(); return 0; } else if (result.success) { outputModuleGraphJson(); if (modules == null) { outputSingleBinary(); outputSourceMap(options, config.jsOutputFile); } else { outputModuleBinaryAndSourceMaps(modules, options); } if (options.externExportsPath != null) { Writer eeOut = openExternExportsStream(options, config.jsOutputFile); eeOut.append(result.externExport); eeOut.close(); } outputNameMaps(); outputManifest(); outputBundle(); } return Math.min(result.errors.length, 0x7f); } | /**
* Processes the results of the compile job, and returns an error code.
*/ | Processes the results of the compile job, and returns an error code | processResults | {
"repo_name": "ksheedlo/closure-compiler",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 64695
} | [
"com.google.javascript.rhino.Node",
"java.io.IOException",
"java.io.Writer",
"java.util.List"
] | import com.google.javascript.rhino.Node; import java.io.IOException; import java.io.Writer; import java.util.List; | import com.google.javascript.rhino.*; import java.io.*; import java.util.*; | [
"com.google.javascript",
"java.io",
"java.util"
] | com.google.javascript; java.io; java.util; | 1,758,260 |
public void maybeShowPopup(MouseEvent evt) {
Point p = unzoomPoint(evt.getPoint());
PlayPenComponent c = contentPane.getComponentAt(p);
if(!mouseMode.equals(MouseModeType.CREATING_RELATIONSHIP) &&
!mouseMode.equals(MouseModeType.CREATING_TABLE)) {
if (c != null) {
if(!c.isBeingDragged()) {
p.translate(-c.getX(), -c.getY());
if (evt.isPopupTrigger() && !evt.isConsumed()) {
c.showPopup(p);
}
}
} else {
if (evt.isPopupTrigger() && popupFactory != null) {
JPanel pp = (JPanel) evt.getSource();
//XXX we should let popupfactory to produce playpencomponent popup as well
JPopupMenu popup = popupFactory.createPopupMenu(null);
popup.show(pp, evt.getX(), evt.getY());
}
}
}
}
} | void function(MouseEvent evt) { Point p = unzoomPoint(evt.getPoint()); PlayPenComponent c = contentPane.getComponentAt(p); if(!mouseMode.equals(MouseModeType.CREATING_RELATIONSHIP) && !mouseMode.equals(MouseModeType.CREATING_TABLE)) { if (c != null) { if(!c.isBeingDragged()) { p.translate(-c.getX(), -c.getY()); if (evt.isPopupTrigger() && !evt.isConsumed()) { c.showPopup(p); } } } else { if (evt.isPopupTrigger() && popupFactory != null) { JPanel pp = (JPanel) evt.getSource(); JPopupMenu popup = popupFactory.createPopupMenu(null); popup.show(pp, evt.getX(), evt.getY()); } } } } } | /**
* Shows the popup menus if appropriate.
*/ | Shows the popup menus if appropriate | maybeShowPopup | {
"repo_name": "ptrptr/power-architect",
"path": "src/main/java/ca/sqlpower/architect/swingui/PlayPen.java",
"license": "gpl-3.0",
"size": 137696
} | [
"java.awt.Point",
"java.awt.event.MouseEvent",
"javax.swing.JPanel",
"javax.swing.JPopupMenu"
] | import java.awt.Point; import java.awt.event.MouseEvent; import javax.swing.JPanel; import javax.swing.JPopupMenu; | import java.awt.*; import java.awt.event.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,456,468 |
private String getUserName(String userAccessToken)
throws BimExchangeException {
String query = "SELECT AUTHZ_USER FROM IDN_OAUTH2_ACCESS_TOKEN WHERE ACCESS_TOKEN='"
+ userAccessToken.split(" ")[1]
+ "' AND USER_TYPE = 'APPLICATION_USER' AND TOKEN_STATE='ACTIVE'";
try {
return execute(query, "AUTHZ_USER", BimExConstants.APIM_DB_SCHEMA)
.get(0);
} catch (BimExchangeException e) {
LOG.error("Error occurred in selecting the user name for the user access token: \n"
+ e);
throw e;
}
} | String function(String userAccessToken) throws BimExchangeException { String query = STR + userAccessToken.split(" ")[1] + STR; try { return execute(query, STR, BimExConstants.APIM_DB_SCHEMA) .get(0); } catch (BimExchangeException e) { LOG.error(STR + e); throw e; } } | /**
* Return the name of the user for the given user access token.
*
* @param userAccessToken
* access token of the user.
* @return name of the user.
* @throws BimExchangeException
* custom exception.
*/ | Return the name of the user for the given user access token | getUserName | {
"repo_name": "bbrangeo/OpenSourceBIMaaS",
"path": "dev/esb/core/src/main/java/com/bimaas/connect/AuthorizingUserForProjectMediator.java",
"license": "apache-2.0",
"size": 5577
} | [
"com.bimaas.connect.constants.BimExConstants",
"com.bimaas.connect.exception.BimExchangeException"
] | import com.bimaas.connect.constants.BimExConstants; import com.bimaas.connect.exception.BimExchangeException; | import com.bimaas.connect.constants.*; import com.bimaas.connect.exception.*; | [
"com.bimaas.connect"
] | com.bimaas.connect; | 883,941 |
private boolean cmd_saveInvoice (int C_Invoice_ID)
{
log.config("C_Invoice_ID=" + C_Invoice_ID);
MInvoice invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null);
if (invoice.get_ID() == 0)
{
log.log(Level.SEVERE, "Not found - C_Invoice_ID=" + C_Invoice_ID);
return false;
}
int lineCount = 0;
// for all bom lines
for (int i = 0; i < m_selectionList.size(); i++)
{
if (isSelectionSelected(m_selectionList.get(i)))
{
BigDecimal qty = m_qtyList.get(i).getValue();
int M_Product_ID = m_productList.get(i).intValue();
// Create Line
MInvoiceLine il = new MInvoiceLine (invoice);
il.setM_Product_ID(M_Product_ID, true);
il.setQty(qty);
il.setPrice();
il.setTax();
if (il.save())
lineCount++;
else
log.log(Level.SEVERE, "Line not saved");
} // line selected
} // for all bom lines
FDialog.info(-1, this, invoice.getDocumentInfo() + " " + Msg.translate(Env.getCtx(), "Inserted") + "=" + lineCount);
log.config("#" + lineCount);
return true;
} // cmd_saveInvoice | boolean function (int C_Invoice_ID) { log.config(STR + C_Invoice_ID); MInvoice invoice = new MInvoice (Env.getCtx(), C_Invoice_ID, null); if (invoice.get_ID() == 0) { log.log(Level.SEVERE, STR + C_Invoice_ID); return false; } int lineCount = 0; for (int i = 0; i < m_selectionList.size(); i++) { if (isSelectionSelected(m_selectionList.get(i))) { BigDecimal qty = m_qtyList.get(i).getValue(); int M_Product_ID = m_productList.get(i).intValue(); MInvoiceLine il = new MInvoiceLine (invoice); il.setM_Product_ID(M_Product_ID, true); il.setQty(qty); il.setPrice(); il.setTax(); if (il.save()) lineCount++; else log.log(Level.SEVERE, STR); } } FDialog.info(-1, this, invoice.getDocumentInfo() + " " + Msg.translate(Env.getCtx(), STR) + "=" + lineCount); log.config("#" + lineCount); return true; } | /**
* Save to Invoice
* @param C_Invoice_ID id
* @return true if saved
*/ | Save to Invoice | cmd_saveInvoice | {
"repo_name": "erpcya/adempierePOS",
"path": "zkwebui/WEB-INF/src/org/adempiere/webui/apps/form/WBOMDrop.java",
"license": "gpl-2.0",
"size": 23719
} | [
"java.math.BigDecimal",
"java.util.logging.Level",
"org.adempiere.webui.window.FDialog",
"org.compiere.model.MInvoice",
"org.compiere.model.MInvoiceLine",
"org.compiere.util.Env",
"org.compiere.util.Msg"
] | import java.math.BigDecimal; import java.util.logging.Level; import org.adempiere.webui.window.FDialog; import org.compiere.model.MInvoice; import org.compiere.model.MInvoiceLine; import org.compiere.util.Env; import org.compiere.util.Msg; | import java.math.*; import java.util.logging.*; import org.adempiere.webui.window.*; import org.compiere.model.*; import org.compiere.util.*; | [
"java.math",
"java.util",
"org.adempiere.webui",
"org.compiere.model",
"org.compiere.util"
] | java.math; java.util; org.adempiere.webui; org.compiere.model; org.compiere.util; | 1,263,970 |
public Locale getLocale() {
return mLocale;
} | Locale function() { return mLocale; } | /**
* Gets the locale.
*
* @return the locale
*/ | Gets the locale | getLocale | {
"repo_name": "hopestar720/aioweb",
"path": "src/com/xhsoft/framework/common/date/FastDateFormat.java",
"license": "apache-2.0",
"size": 35462
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,030,764 |
val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context);
if (request.getMethod().equalsIgnoreCase(HttpMethod.POST.name())) {
WebUtils.putInitialHttpRequestPostParameters(context);
}
} | val request = WebUtils.getHttpServletRequestFromExternalWebflowContext(context); if (request.getMethod().equalsIgnoreCase(HttpMethod.POST.name())) { WebUtils.putInitialHttpRequestPostParameters(context); } } | /**
* Configure the POST parameters in webflow.
*
* @param context the webflow context
*/ | Configure the POST parameters in webflow | configureWebflowForPostParameters | {
"repo_name": "fogbeam/cas_mirror",
"path": "support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/login/InitialFlowSetupAction.java",
"license": "apache-2.0",
"size": 10805
} | [
"org.apereo.cas.web.support.WebUtils",
"org.springframework.http.HttpMethod"
] | import org.apereo.cas.web.support.WebUtils; import org.springframework.http.HttpMethod; | import org.apereo.cas.web.support.*; import org.springframework.http.*; | [
"org.apereo.cas",
"org.springframework.http"
] | org.apereo.cas; org.springframework.http; | 1,021,835 |
public Adapter createDiagramExtensionDescriptionAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '
* {@link org.eclipse.sirius.diagram.description.DiagramExtensionDescription
* <em>Diagram Extension Description</em>}'. <!-- begin-user-doc --> This
* default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases
* anyway. <!-- end-user-doc -->
*
* @return the new adapter.
* @see org.eclipse.sirius.diagram.description.DiagramExtensionDescription
* @generated
*/ | Creates a new adapter for an object of class ' <code>org.eclipse.sirius.diagram.description.DiagramExtensionDescription Diagram Extension Description</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createDiagramExtensionDescriptionAdapter | {
"repo_name": "FTSRG/iq-sirius-integration",
"path": "host/org.eclipse.sirius.diagram/src-gen/org/eclipse/sirius/diagram/description/util/DescriptionAdapterFactory.java",
"license": "epl-1.0",
"size": 31915
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,076,853 |
private static DataModel parseDataModel(String dataModel) throws TasteException {
if (!new File(dataModel).exists()) {
throw new IllegalArgumentException("Error: unable to find the the data model file.");
}
DataModel result;
try {
result = new StringUserDataModel(new File(dataModel));
} catch (IOException e) {
throw new IllegalStateException("Error: unable to load the data model.", e);
}
// check
if (result.getNumUsers() == 0 || result.getNumItems() == 0) {
throw new IllegalArgumentException("Error: the data model doesn't contain any data.");
}
return result;
} | static DataModel function(String dataModel) throws TasteException { if (!new File(dataModel).exists()) { throw new IllegalArgumentException(STR); } DataModel result; try { result = new StringUserDataModel(new File(dataModel)); } catch (IOException e) { throw new IllegalStateException(STR, e); } if (result.getNumUsers() == 0 result.getNumItems() == 0) { throw new IllegalArgumentException(STR); } return result; } | /**
* Parses and checks the "data-model" option.
*/ | Parses and checks the "data-model" option | parseDataModel | {
"repo_name": "norbertdev/mynemo",
"path": "src/main/java/norbert/mynemo/ui/RecommendCommandParser.java",
"license": "apache-2.0",
"size": 17270
} | [
"java.io.File",
"java.io.IOException",
"norbert.mynemo.dataimport.StringUserDataModel",
"org.apache.mahout.cf.taste.common.TasteException",
"org.apache.mahout.cf.taste.model.DataModel"
] | import java.io.File; import java.io.IOException; import norbert.mynemo.dataimport.StringUserDataModel; import org.apache.mahout.cf.taste.common.TasteException; import org.apache.mahout.cf.taste.model.DataModel; | import java.io.*; import norbert.mynemo.dataimport.*; import org.apache.mahout.cf.taste.common.*; import org.apache.mahout.cf.taste.model.*; | [
"java.io",
"norbert.mynemo.dataimport",
"org.apache.mahout"
] | java.io; norbert.mynemo.dataimport; org.apache.mahout; | 195,759 |
protected static void markRlzNotified() {
SharedPreferencesManager.getInstance().writeBoolean(
ChromePreferenceKeys.RLZ_NOTIFIED, true);
} | static void function() { SharedPreferencesManager.getInstance().writeBoolean( ChromePreferenceKeys.RLZ_NOTIFIED, true); } | /**
* Stores that the RLZ provider has been notified that the first search has occurred.
*/ | Stores that the RLZ provider has been notified that the first search has occurred | markRlzNotified | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/java/src/org/chromium/chrome/browser/rlz/RevenueStats.java",
"license": "bsd-3-clause",
"size": 2229
} | [
"org.chromium.chrome.browser.preferences.ChromePreferenceKeys",
"org.chromium.chrome.browser.preferences.SharedPreferencesManager"
] | import org.chromium.chrome.browser.preferences.ChromePreferenceKeys; import org.chromium.chrome.browser.preferences.SharedPreferencesManager; | import org.chromium.chrome.browser.preferences.*; | [
"org.chromium.chrome"
] | org.chromium.chrome; | 2,016,628 |
public void setCollapsedTitleTextColor(@NonNull ColorStateList colors) {
collapsingTextHelper.setCollapsedTextColor(colors);
} | void function(@NonNull ColorStateList colors) { collapsingTextHelper.setCollapsedTextColor(colors); } | /**
* Sets the text colors of the collapsed title.
*
* @param colors ColorStateList containing the new text colors
*/ | Sets the text colors of the collapsed title | setCollapsedTitleTextColor | {
"repo_name": "material-components/material-components-android",
"path": "lib/java/com/google/android/material/appbar/CollapsingToolbarLayout.java",
"license": "apache-2.0",
"size": 60621
} | [
"android.content.res.ColorStateList",
"androidx.annotation.NonNull"
] | import android.content.res.ColorStateList; import androidx.annotation.NonNull; | import android.content.res.*; import androidx.annotation.*; | [
"android.content",
"androidx.annotation"
] | android.content; androidx.annotation; | 881,865 |
public ParallelInference build() {
if (this.inferenceMode == InferenceMode.INPLACE) {
val inf = new InplaceParallelInference();
inf.inferenceMode = this.inferenceMode;
inf.model = this.model;
inf.workers = this.workers;
inf.loadBalanceMode = this.loadBalanceMode;
inf.init();
return inf;
} else {
ParallelInference inference = new ParallelInference();
inference.batchLimit = this.batchLimit;
inference.queueLimit = this.queueLimit;
inference.inferenceMode = this.inferenceMode;
inference.model = this.model;
inference.workers = this.workers;
inference.loadBalanceMode = this.loadBalanceMode;
inference.init();
return inference;
}
}
}
private class InferenceWorker extends Thread implements Runnable {
private BlockingQueue<InferenceObservable> inputQueue;
private AtomicBoolean shouldWork = new AtomicBoolean(true);
private AtomicBoolean isStopped = new AtomicBoolean(false);
private Model protoModel;
private Model replicatedModel;
private AtomicLong counter = new AtomicLong(0);
private boolean rootDevice;
private int deviceId;
private ReentrantReadWriteLock modelLock = new ReentrantReadWriteLock();
private InferenceWorker(int id, @NonNull Model model, @NonNull BlockingQueue inputQueue, boolean rootDevice, int deviceId) {
this.inputQueue = inputQueue;
this.protoModel = model;
this.rootDevice = rootDevice;
this.deviceId = deviceId;
this.setDaemon(true);
this.setName("InferenceThread-" + id);
} | ParallelInference function() { if (this.inferenceMode == InferenceMode.INPLACE) { val inf = new InplaceParallelInference(); inf.inferenceMode = this.inferenceMode; inf.model = this.model; inf.workers = this.workers; inf.loadBalanceMode = this.loadBalanceMode; inf.init(); return inf; } else { ParallelInference inference = new ParallelInference(); inference.batchLimit = this.batchLimit; inference.queueLimit = this.queueLimit; inference.inferenceMode = this.inferenceMode; inference.model = this.model; inference.workers = this.workers; inference.loadBalanceMode = this.loadBalanceMode; inference.init(); return inference; } } } private class InferenceWorker extends Thread implements Runnable { private BlockingQueue<InferenceObservable> inputQueue; private AtomicBoolean shouldWork = new AtomicBoolean(true); private AtomicBoolean isStopped = new AtomicBoolean(false); private Model protoModel; private Model replicatedModel; private AtomicLong counter = new AtomicLong(0); private boolean rootDevice; private int deviceId; private ReentrantReadWriteLock modelLock = new ReentrantReadWriteLock(); private InferenceWorker(int id, @NonNull Model model, @NonNull BlockingQueue inputQueue, boolean rootDevice, int deviceId) { this.inputQueue = inputQueue; this.protoModel = model; this.rootDevice = rootDevice; this.deviceId = deviceId; this.setDaemon(true); this.setName(STR + id); } | /**
* This method builds new ParallelInference instance
*
* @return
*/ | This method builds new ParallelInference instance | build | {
"repo_name": "RobAltena/deeplearning4j",
"path": "deeplearning4j/deeplearning4j-scaleout/deeplearning4j-scaleout-parallelwrapper/src/main/java/org/deeplearning4j/parallelism/ParallelInference.java",
"license": "apache-2.0",
"size": 21826
} | [
"java.util.concurrent.BlockingQueue",
"java.util.concurrent.atomic.AtomicBoolean",
"java.util.concurrent.atomic.AtomicLong",
"java.util.concurrent.locks.ReentrantReadWriteLock",
"org.deeplearning4j.nn.api.Model",
"org.deeplearning4j.parallelism.inference.InferenceMode",
"org.deeplearning4j.parallelism.i... | import java.util.concurrent.BlockingQueue; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantReadWriteLock; import org.deeplearning4j.nn.api.Model; import org.deeplearning4j.parallelism.inference.InferenceMode; import org.deeplearning4j.parallelism.inference.InferenceObservable; | import java.util.concurrent.*; import java.util.concurrent.atomic.*; import java.util.concurrent.locks.*; import org.deeplearning4j.nn.api.*; import org.deeplearning4j.parallelism.inference.*; | [
"java.util",
"org.deeplearning4j.nn",
"org.deeplearning4j.parallelism"
] | java.util; org.deeplearning4j.nn; org.deeplearning4j.parallelism; | 1,837,424 |
public DataSourceType<T> removeMaxStatements()
{
childNode.removeChildren("max-statements");
return this;
}
// --------------------------------------------------------------------------------------------------------||
// ClassName: DataSourceType ElementName: xsd:ID ElementType : id
// MaxOccurs: - isGeneric: true isAttribute: true isEnum: false isDataType: true
// --------------------------------------------------------------------------------------------------------|| | DataSourceType<T> function() { childNode.removeChildren(STR); return this; } | /**
* Removes the <code>max-statements</code> element
* @return the current instance of <code>DataSourceType<T></code>
*/ | Removes the <code>max-statements</code> element | removeMaxStatements | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaee6/DataSourceTypeImpl.java",
"license": "epl-1.0",
"size": 28456
} | [
"org.jboss.shrinkwrap.descriptor.api.javaee6.DataSourceType"
] | import org.jboss.shrinkwrap.descriptor.api.javaee6.DataSourceType; | import org.jboss.shrinkwrap.descriptor.api.javaee6.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 789,214 |
@Test
public void testUpdateRoles_giveAllRights() {
Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser( "roles-" + UUID.randomUUID().toString());
Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser( "roles-" + UUID.randomUUID().toString());
Roles roles = securityManager.getRoles(id1);
Assert.assertNotNull(roles);
dbInstance.commitAndCloseSession();
//update roles
Roles modifiedRoles = new Roles(true, true, true, true, false, true, true, false);
securityManager.updateRoles(id2, id1, modifiedRoles);
dbInstance.commitAndCloseSession();
//check roles
Roles reloadRoles = securityManager.getRoles(id1);
Assert.assertNotNull(reloadRoles);
Assert.assertTrue(reloadRoles.isAuthor());
Assert.assertTrue(reloadRoles.isGroupManager());
Assert.assertFalse(reloadRoles.isGuestOnly());
Assert.assertTrue(reloadRoles.isInstitutionalResourceManager());
Assert.assertFalse(reloadRoles.isInvitee());
Assert.assertTrue(reloadRoles.isOLATAdmin());
Assert.assertTrue(reloadRoles.isPoolAdmin());
Assert.assertTrue(reloadRoles.isUserManager());
}
| void function() { Identity id1 = JunitTestHelper.createAndPersistIdentityAsUser( STR + UUID.randomUUID().toString()); Identity id2 = JunitTestHelper.createAndPersistIdentityAsUser( STR + UUID.randomUUID().toString()); Roles roles = securityManager.getRoles(id1); Assert.assertNotNull(roles); dbInstance.commitAndCloseSession(); Roles modifiedRoles = new Roles(true, true, true, true, false, true, true, false); securityManager.updateRoles(id2, id1, modifiedRoles); dbInstance.commitAndCloseSession(); Roles reloadRoles = securityManager.getRoles(id1); Assert.assertNotNull(reloadRoles); Assert.assertTrue(reloadRoles.isAuthor()); Assert.assertTrue(reloadRoles.isGroupManager()); Assert.assertFalse(reloadRoles.isGuestOnly()); Assert.assertTrue(reloadRoles.isInstitutionalResourceManager()); Assert.assertFalse(reloadRoles.isInvitee()); Assert.assertTrue(reloadRoles.isOLATAdmin()); Assert.assertTrue(reloadRoles.isPoolAdmin()); Assert.assertTrue(reloadRoles.isUserManager()); } | /**
* Update roles
*/ | Update roles | testUpdateRoles_giveAllRights | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/test/java/org/olat/basesecurity/BaseSecurityManagerTest.java",
"license": "apache-2.0",
"size": 45118
} | [
"java.util.UUID",
"org.junit.Assert",
"org.olat.core.id.Identity",
"org.olat.core.id.Roles",
"org.olat.test.JunitTestHelper"
] | import java.util.UUID; import org.junit.Assert; import org.olat.core.id.Identity; import org.olat.core.id.Roles; import org.olat.test.JunitTestHelper; | import java.util.*; import org.junit.*; import org.olat.core.id.*; import org.olat.test.*; | [
"java.util",
"org.junit",
"org.olat.core",
"org.olat.test"
] | java.util; org.junit; org.olat.core; org.olat.test; | 492,575 |
public void find(BundleContext context, String name, String filter,
boolean allServices, Collection references) {
if (!MENU_OPERATION_NAME.equals(name)) {
// It's not the managed service
// Do nothing
return;
}
if (context.getBundle().getBundleId() == 0) {
// Don't hide anything from the system bundle
return;
}
if (references.isEmpty()) {
// Nothing to do
return;
}
if (bundleContext.equals(context)) {
// Don't hide anything to myself
return;
}
// Remove all ServiceReferes except MenuOpertationProxy service
for (Iterator iter = references.iterator(); iter.hasNext();) {
ServiceReference sr = (ServiceReference) iter.next();
if (isGvNIXOperations(sr)) {
// logger.finest(" - gvNIX Menu op ( Removing)");
iter.remove();
}
else if (isProxy(sr)) {
// Don't remove proxy
continue;
}
else {
// logger.finest(" - Roo Menu op ( Removing)");
iter.remove();
}
}
} | void function(BundleContext context, String name, String filter, boolean allServices, Collection references) { if (!MENU_OPERATION_NAME.equals(name)) { return; } if (context.getBundle().getBundleId() == 0) { return; } if (references.isEmpty()) { return; } if (bundleContext.equals(context)) { return; } for (Iterator iter = references.iterator(); iter.hasNext();) { ServiceReference sr = (ServiceReference) iter.next(); if (isGvNIXOperations(sr)) { iter.remove(); } else if (isProxy(sr)) { continue; } else { iter.remove(); } } } | /**
* Filter request returned by framework related to {@link MenuOperations}. <br>
* This method only manage the {@link MenuOperations} service request,
* removing from returned collection {@code references} all services except
* {@link MenuOperationsProxy}. <br>
* For request inside this bundle all services are returned.
*
* @see org.osgi.framework.hooks.service.FindHook#find(org.osgi.framework.BundleContext,
* java.lang.String, java.lang.String, boolean, java.util.Collection)
*/ | Filter request returned by framework related to <code>MenuOperations</code>. This method only manage the <code>MenuOperations</code> service request, removing from returned collection references all services except <code>MenuOperationsProxy</code>. For request inside this bundle all services are returned | find | {
"repo_name": "osroca/gvnix",
"path": "addon-web-mvc-menu/src/main/java/org/gvnix/web/menu/roo/addon/FilterMenuOperationsHook.java",
"license": "gpl-3.0",
"size": 5910
} | [
"java.util.Collection",
"java.util.Iterator",
"org.osgi.framework.BundleContext",
"org.osgi.framework.ServiceReference"
] | import java.util.Collection; import java.util.Iterator; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; | import java.util.*; import org.osgi.framework.*; | [
"java.util",
"org.osgi.framework"
] | java.util; org.osgi.framework; | 282,777 |
public static DocumentIterator getInstance( DocumentIterator... documentIterator ) throws IOException {
if ( documentIterator.length == 0 ) throw new IllegalArgumentException( "The provided array of document iterators is empty." );
return new OrDocumentIterator( documentIterator );
}
protected OrDocumentIterator( final DocumentIterator... documentIterators ) throws IOException {
try{
for ( DocumentIterator documentIterator: documentIterators ) indices.addAll( documentIterator.indices() );
for ( DocumentIterator documentIterator: documentIterators ) {
long documentPointer;
while ( ( documentPointer = documentIterator.nextDocument() ) != END_OF_LIST ) {
for ( Index index: indices ) {
if ( !index.hasPositions ) {
addTrueIteratorDocument( documentPointer, index );
continue;
}
IntervalIterator intervalIterator = documentIterator.intervalIterator( index );
Reference2ReferenceArrayMap<Index, IntervalSet> index2IntervalMap = elements.get( documentPointer );
if ( intervalIterator == IntervalIterators.FALSE ) continue;
if ( intervalIterator == IntervalIterators.TRUE ) {
if ( index2IntervalMap == null || ! index2IntervalMap.containsKey( index ) )
addTrueIteratorDocument( documentPointer, index );
continue;
}
// Cleanup TRUE if we find intervals.
if ( index2IntervalMap != null && index2IntervalMap.get( index ) == TRUE ) index2IntervalMap.remove( index );
for( Interval interval; ( interval = intervalIterator.nextInterval() ) != null; ) {
addIntervalForDocument( documentPointer, index, interval );
}
}
}
}
for ( DocumentIterator documentIterator: documentIterators ) documentIterator.dispose();
start( true );
} catch ( IOException e ) {
throw new RuntimeException( e );
}
} | static DocumentIterator function( DocumentIterator... documentIterator ) throws IOException { if ( documentIterator.length == 0 ) throw new IllegalArgumentException( STR ); return new OrDocumentIterator( documentIterator ); } protected OrDocumentIterator( final DocumentIterator... documentIterators ) throws IOException { try{ for ( DocumentIterator documentIterator: documentIterators ) indices.addAll( documentIterator.indices() ); for ( DocumentIterator documentIterator: documentIterators ) { long documentPointer; while ( ( documentPointer = documentIterator.nextDocument() ) != END_OF_LIST ) { for ( Index index: indices ) { if ( !index.hasPositions ) { addTrueIteratorDocument( documentPointer, index ); continue; } IntervalIterator intervalIterator = documentIterator.intervalIterator( index ); Reference2ReferenceArrayMap<Index, IntervalSet> index2IntervalMap = elements.get( documentPointer ); if ( intervalIterator == IntervalIterators.FALSE ) continue; if ( intervalIterator == IntervalIterators.TRUE ) { if ( index2IntervalMap == null ! index2IntervalMap.containsKey( index ) ) addTrueIteratorDocument( documentPointer, index ); continue; } if ( index2IntervalMap != null && index2IntervalMap.get( index ) == TRUE ) index2IntervalMap.remove( index ); for( Interval interval; ( interval = intervalIterator.nextInterval() ) != null; ) { addIntervalForDocument( documentPointer, index, interval ); } } } } for ( DocumentIterator documentIterator: documentIterators ) documentIterator.dispose(); start( true ); } catch ( IOException e ) { throw new RuntimeException( e ); } } | /** Returns a document iterator that computes the OR of the given nonzero-length array of iterators.
*
* <P>Note that the special case of the singleton array is handled efficiently.
*
* @param documentIterator the iterators to be joined.
* @return a document iterator that computes the OR of <code>it</code>.
* @throws IOException
*/ | Returns a document iterator that computes the OR of the given nonzero-length array of iterators. Note that the special case of the singleton array is handled efficiently | getInstance | {
"repo_name": "JC-R/mg4j",
"path": "test/it/unimi/di/big/mg4j/mock/search/OrDocumentIterator.java",
"license": "gpl-3.0",
"size": 4572
} | [
"it.unimi.di.big.mg4j.index.Index",
"it.unimi.di.big.mg4j.search.DocumentIterator",
"it.unimi.di.big.mg4j.search.IntervalIterator",
"it.unimi.di.big.mg4j.search.IntervalIterators",
"it.unimi.dsi.fastutil.objects.Reference2ReferenceArrayMap",
"it.unimi.dsi.util.Interval",
"java.io.IOException"
] | import it.unimi.di.big.mg4j.index.Index; import it.unimi.di.big.mg4j.search.DocumentIterator; import it.unimi.di.big.mg4j.search.IntervalIterator; import it.unimi.di.big.mg4j.search.IntervalIterators; import it.unimi.dsi.fastutil.objects.Reference2ReferenceArrayMap; import it.unimi.dsi.util.Interval; import java.io.IOException; | import it.unimi.di.big.mg4j.index.*; import it.unimi.di.big.mg4j.search.*; import it.unimi.dsi.fastutil.objects.*; import it.unimi.dsi.util.*; import java.io.*; | [
"it.unimi.di",
"it.unimi.dsi",
"java.io"
] | it.unimi.di; it.unimi.dsi; java.io; | 2,868,469 |
private ATCommandResponsePacket createPacket(int frameId, ATCommandStatus status,
XBee16BitAddress addr16, XBee64BitAddress addr64, String ni, XBee16BitAddress parentAddr,
byte role, byte rssi, boolean raw802Packet) {
byte[] value = new byte[2 + 8 + ni.length() + 1
+ 2 + 1 + 1 + 2
+ 2 + 4 + 1 ];
byte[] profile = new byte[]{(byte)0xC1, 0x05};
byte[] manufacturer = new byte[]{0x10, 0x1E};
byte[] dd = new byte[]{0x00, 0x03, 0x00, 0x00};
System.arraycopy(addr16.getValue(), 0, value, 0, 2);
System.arraycopy(addr64.getValue(), 0, value, 2, 8);
if (raw802Packet) {
value[10] = rssi;
System.arraycopy(ni.getBytes(), 0, value, 11, ni.length());
} else {
System.arraycopy(ni.getBytes(), 0, value, 10, ni.length());
value[10 + ni.length()] = 0x00;
System.arraycopy(parentAddr.getValue(), 0, value, 11 + ni.length(), 2);
value[13 + ni.length()] = role;
value[14 + ni.length()] = 0x00;
System.arraycopy(profile, 0, value, 15 + ni.length(), 2);
System.arraycopy(manufacturer, 0, value, 17 + ni.length(), 2);
System.arraycopy(dd, 0, value, 19 + ni.length(), 4);
value[23 + ni.length()] = rssi;
}
return new ATCommandResponsePacket(frameId, status, "ND", value);
}
static class DiscoveryListener implements IDiscoveryListener {
List<RemoteXBeeDevice> discoveredDevices;
List<String> errors;
boolean finish;
String finishError;
public DiscoveryListener() {
discoveredDevices = new ArrayList<RemoteXBeeDevice>(0);
errors = new ArrayList<String>(0);
finish = false;
}
| ATCommandResponsePacket function(int frameId, ATCommandStatus status, XBee16BitAddress addr16, XBee64BitAddress addr64, String ni, XBee16BitAddress parentAddr, byte role, byte rssi, boolean raw802Packet) { byte[] value = new byte[2 + 8 + ni.length() + 1 + 2 + 1 + 1 + 2 + 2 + 4 + 1 ]; byte[] profile = new byte[]{(byte)0xC1, 0x05}; byte[] manufacturer = new byte[]{0x10, 0x1E}; byte[] dd = new byte[]{0x00, 0x03, 0x00, 0x00}; System.arraycopy(addr16.getValue(), 0, value, 0, 2); System.arraycopy(addr64.getValue(), 0, value, 2, 8); if (raw802Packet) { value[10] = rssi; System.arraycopy(ni.getBytes(), 0, value, 11, ni.length()); } else { System.arraycopy(ni.getBytes(), 0, value, 10, ni.length()); value[10 + ni.length()] = 0x00; System.arraycopy(parentAddr.getValue(), 0, value, 11 + ni.length(), 2); value[13 + ni.length()] = role; value[14 + ni.length()] = 0x00; System.arraycopy(profile, 0, value, 15 + ni.length(), 2); System.arraycopy(manufacturer, 0, value, 17 + ni.length(), 2); System.arraycopy(dd, 0, value, 19 + ni.length(), 4); value[23 + ni.length()] = rssi; } return new ATCommandResponsePacket(frameId, status, "ND", value); } static class DiscoveryListener implements IDiscoveryListener { List<RemoteXBeeDevice> discoveredDevices; List<String> errors; boolean finish; String finishError; public DiscoveryListener() { discoveredDevices = new ArrayList<RemoteXBeeDevice>(0); errors = new ArrayList<String>(0); finish = false; } | /**
* Helper method to create ND responses.
*
* @param frameId
* @param status
* @param addr16
* @param addr64
* @param ni
* @param parentAddr
* @param role
* @param rssi
* @param raw802Packet
* @return
*/ | Helper method to create ND responses | createPacket | {
"repo_name": "digidotcom/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/NodeDiscoveryDiscoverDevicesListenerTest.java",
"license": "mpl-2.0",
"size": 32152
} | [
"com.digi.xbee.api.RemoteXBeeDevice",
"com.digi.xbee.api.listeners.IDiscoveryListener",
"com.digi.xbee.api.models.ATCommandStatus",
"com.digi.xbee.api.models.XBee16BitAddress",
"com.digi.xbee.api.models.XBee64BitAddress",
"com.digi.xbee.api.packet.common.ATCommandResponsePacket",
"java.util.ArrayList",
... | import com.digi.xbee.api.RemoteXBeeDevice; import com.digi.xbee.api.listeners.IDiscoveryListener; import com.digi.xbee.api.models.ATCommandStatus; import com.digi.xbee.api.models.XBee16BitAddress; import com.digi.xbee.api.models.XBee64BitAddress; import com.digi.xbee.api.packet.common.ATCommandResponsePacket; import java.util.ArrayList; import java.util.List; | import com.digi.xbee.api.*; import com.digi.xbee.api.listeners.*; import com.digi.xbee.api.models.*; import com.digi.xbee.api.packet.common.*; import java.util.*; | [
"com.digi.xbee",
"java.util"
] | com.digi.xbee; java.util; | 1,303,946 |
public void evaluate(Dataset data, BaseEntryGenerator generator,
BaseDatasetFilter filter) throws Exception {
// Get iterator from the entry generator
EntryIterator = generator.iterator();
// Execute
if (Magpie.NThreads == 1) {
// Create clone used to store results
Dataset runData = data.emptyClone();
// Evaluate in serial
data.addEntries(runAndFilter(Model, runData, filter));
} else {
// Store number of threads and original batch size information
int nThreads = Magpie.NThreads;
int origBatchSize = BatchSize;
// Turn off parallelism for any other parts of the code
Magpie.NThreads = 1;
BatchSize /= nThreads;
// Create executor service
ExecutorService executor = Executors.newFixedThreadPool(nThreads);
// Make final pointer to input data and filter
final Dataset dataPtr = data;
final BaseDatasetFilter filterPtr = filter;
// Start threads
List<Future<List<BaseEntry>>> results = new ArrayList<>(nThreads);
for (int i=0; i<nThreads; i++) {
Callable<List<BaseEntry>> thread = new Callable<List<BaseEntry>>() {
| void function(Dataset data, BaseEntryGenerator generator, BaseDatasetFilter filter) throws Exception { EntryIterator = generator.iterator(); if (Magpie.NThreads == 1) { Dataset runData = data.emptyClone(); data.addEntries(runAndFilter(Model, runData, filter)); } else { int nThreads = Magpie.NThreads; int origBatchSize = BatchSize; Magpie.NThreads = 1; BatchSize /= nThreads; ExecutorService executor = Executors.newFixedThreadPool(nThreads); final Dataset dataPtr = data; final BaseDatasetFilter filterPtr = filter; List<Future<List<BaseEntry>>> results = new ArrayList<>(nThreads); for (int i=0; i<nThreads; i++) { Callable<List<BaseEntry>> thread = new Callable<List<BaseEntry>>() { | /**
* Generate entries and store them in a dataset. Optionally, filter data
* before adding it to dataset
* @param data Dataset to be added to
* @param generator Generator for creating entries
* @param filter Filter to be used before adding entries to data
* @throws java.lang.Exception
*/ | Generate entries and store them in a dataset. Optionally, filter data before adding it to dataset | evaluate | {
"repo_name": "amarkrishna/demo1",
"path": "src/magpie/utility/tools/BatchModelEvaluator.java",
"license": "mit",
"size": 14751
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.concurrent.Callable",
"java.util.concurrent.ExecutorService",
"java.util.concurrent.Executors",
"java.util.concurrent.Future"
] | import java.util.ArrayList; import java.util.List; import java.util.concurrent.Callable; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; | import java.util.*; import java.util.concurrent.*; | [
"java.util"
] | java.util; | 326,089 |
public Builder preProcessor(BitmapProcessor preProcessor) {
this.preProcessor = preProcessor;
return this;
} | Builder function(BitmapProcessor preProcessor) { this.preProcessor = preProcessor; return this; } | /**
* Sets bitmap processor which will be process bitmaps before they will be cached in memory. So memory cache
* will contain bitmap processed by incoming preProcessor.<br />
* Image will be pre-processed even if caching in memory is disabled.
*/ | Sets bitmap processor which will be process bitmaps before they will be cached in memory. So memory cache will contain bitmap processed by incoming preProcessor. Image will be pre-processed even if caching in memory is disabled | preProcessor | {
"repo_name": "jixieshi999/juahya",
"path": "JuahyaLibrary/src/com/nostra13/universalimageloader/core/DisplayImageOptions.java",
"license": "apache-2.0",
"size": 10774
} | [
"com.nostra13.universalimageloader.core.process.BitmapProcessor"
] | import com.nostra13.universalimageloader.core.process.BitmapProcessor; | import com.nostra13.universalimageloader.core.process.*; | [
"com.nostra13.universalimageloader"
] | com.nostra13.universalimageloader; | 2,499,967 |
public static String localTimeToString(LocalTime time, String emptyTimeString) {
return (time == null) ? emptyTimeString : time.toString();
} | static String function(LocalTime time, String emptyTimeString) { return (time == null) ? emptyTimeString : time.toString(); } | /**
* localTimeToString, This will return the supplied time as a string. If the time is null, this
* will return the value of emptyTimeString.
*
* <p>Time values will be output in one of the following ISO-8601 formats: "HH:mm", "HH:mm:ss",
* "HH:mm:ss.SSS", "HH:mm:ss.SSSSSS", "HH:mm:ss.SSSSSSSSS".
*
* <p>The format used will be the shortest that outputs the full value of the time where the
* omitted parts are implied to be zero.
*/ | localTimeToString, This will return the supplied time as a string. If the time is null, this will return the value of emptyTimeString. The format used will be the shortest that outputs the full value of the time where the omitted parts are implied to be zero | localTimeToString | {
"repo_name": "LGoodDatePicker/LGoodDatePicker",
"path": "Project/src/main/java/com/github/lgooddatepicker/optionalusertools/PickerUtilities.java",
"license": "mit",
"size": 10950
} | [
"java.time.LocalTime"
] | import java.time.LocalTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,944,379 |
SmithWatermanAlignment align(final byte[] ref, final byte[] alt, SWParameters parameters, SWOverhangStrategy overhangStrategy);
@Override
default void close() {} | SmithWatermanAlignment align(final byte[] ref, final byte[] alt, SWParameters parameters, SWOverhangStrategy overhangStrategy); default void close() {} | /**
* perform a Smith-Waterman alignment of alt against ref
*
* @param ref bases to align to, values must be the byte equivalent of uppercase chars
* @param alt bases to align against ref, values must be the byte equivalent of uppercase chars
* @param parameters a set of weights to use when performing the alignment
* @param overhangStrategy how to treat overhangs during alignment
*/ | perform a Smith-Waterman alignment of alt against ref | align | {
"repo_name": "BGI-flexlab/SOAPgaeaDevelopment4.0",
"path": "src/main/java/org/bgi/flexlab/gaea/tools/haplotypecaller/smithwaterman/SmithWatermanAligner.java",
"license": "gpl-3.0",
"size": 2493
} | [
"org.bgi.flexlab.gaea.tools.haplotypecaller.smithwaterman.SmithWatermanJavaAligner"
] | import org.bgi.flexlab.gaea.tools.haplotypecaller.smithwaterman.SmithWatermanJavaAligner; | import org.bgi.flexlab.gaea.tools.haplotypecaller.smithwaterman.*; | [
"org.bgi.flexlab"
] | org.bgi.flexlab; | 1,533,916 |
public boolean hasWorldPermission(Player player, String world) {
if (!player.hasPermission("jobs.use")) {
return false;
} else {
return player.hasPermission("jobs.world."+world.toLowerCase());
}
} | boolean function(Player player, String world) { if (!player.hasPermission(STR)) { return false; } else { return player.hasPermission(STR+world.toLowerCase()); } } | /**
* Check World permissions
*/ | Check World permissions | hasWorldPermission | {
"repo_name": "GamingMesh/Jobs",
"path": "src/main/java/com/gamingmesh/jobs/PermissionHandler.java",
"license": "apache-2.0",
"size": 6261
} | [
"org.bukkit.entity.Player"
] | import org.bukkit.entity.Player; | import org.bukkit.entity.*; | [
"org.bukkit.entity"
] | org.bukkit.entity; | 1,558,585 |
static String getDisplayID(Identified sbolElement) {
if (sbolElement.isSetDisplayId()) {
return sbolElement.getDisplayId();
}
String identity = sbolElement.getIdentity().toString();
return identity.substring(identity.lastIndexOf("/") + 1);
}
| static String getDisplayID(Identified sbolElement) { if (sbolElement.isSetDisplayId()) { return sbolElement.getDisplayId(); } String identity = sbolElement.getIdentity().toString(); return identity.substring(identity.lastIndexOf("/") + 1); } | /**
* Returns the specified SBOL object's displayId. This means the prefix of the SBOL element's displayId will be cut off.
* @param sbolElement - The SBOL element to retrieve its displayId
* @return The displayId of the given SBOL element.
*/ | Returns the specified SBOL object's displayId. This means the prefix of the SBOL element's displayId will be cut off | getDisplayID | {
"repo_name": "MyersResearchGroup/iBioSim",
"path": "conversion/src/main/java/edu/utah/ece/async/ibiosim/conversion/SBOL2SBML.java",
"license": "apache-2.0",
"size": 84633
} | [
"org.sbolstandard.core2.Identified"
] | import org.sbolstandard.core2.Identified; | import org.sbolstandard.core2.*; | [
"org.sbolstandard.core2"
] | org.sbolstandard.core2; | 382,293 |
public String toXml(Object root, String encoding) {
try {
StringWriter writer = new StringWriter();
createMarshaller(encoding).marshal(root, writer);
return writer.toString();
} catch (JAXBException e) {
LangUtils.throwBaseException(e);
}
return null;
}
| String function(Object root, String encoding) { try { StringWriter writer = new StringWriter(); createMarshaller(encoding).marshal(root, writer); return writer.toString(); } catch (JAXBException e) { LangUtils.throwBaseException(e); } return null; } | /**
* Java Object to Xml with encoding.
*/ | Java Object to Xml with encoding | toXml | {
"repo_name": "wayshall/onetwo",
"path": "core/modules/common/src/main/java/org/onetwo/common/xml/jaxb/JaxbMapper.java",
"license": "apache-2.0",
"size": 5760
} | [
"java.io.StringWriter",
"javax.xml.bind.JAXBException",
"org.onetwo.common.utils.LangUtils"
] | import java.io.StringWriter; import javax.xml.bind.JAXBException; import org.onetwo.common.utils.LangUtils; | import java.io.*; import javax.xml.bind.*; import org.onetwo.common.utils.*; | [
"java.io",
"javax.xml",
"org.onetwo.common"
] | java.io; javax.xml; org.onetwo.common; | 232,884 |
static public Vector<ScenarioObserver> importThisObserverList(final String fName, final java.io.InputStream is)
{
// create the new handler
final ASSETReaderWriter xr = new ASSETReaderWriter();
final Vector<ScenarioObserver> res = new Vector<ScenarioObserver>(0, 1);
| static Vector<ScenarioObserver> function(final String fName, final java.io.InputStream is) { final ASSETReaderWriter xr = new ASSETReaderWriter(); final Vector<ScenarioObserver> res = new Vector<ScenarioObserver>(0, 1); | /**
* handle the import of XML data, creating a new session for it
*/ | handle the import of XML data, creating a new session for it | importThisObserverList | {
"repo_name": "theanuradha/debrief",
"path": "org.mwc.asset.legacy/src/ASSET/Util/XML/ASSETReaderWriter.java",
"license": "epl-1.0",
"size": 15975
} | [
"java.util.Vector"
] | import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 347,638 |
public void init() {
try {
M_log.info("init()");
} catch (Exception t) {
M_log.warn("init(): ", t);
}
getServices();
// Check to see if all out properties are defined
ArrayList<String> strings = foorm.checkI18NStrings(LTIService.TOOL_MODEL, rb);
for (String str : strings) {
M_log.warn(str + "=Missing LTIService Translation");
}
strings = foorm.checkI18NStrings(LTIService.CONTENT_MODEL, rb);
for (String str : strings) {
M_log.warn(str + "=Missing LTIService Translation");
}
strings = foorm.checkI18NStrings(LTIService.DEPLOY_MODEL, rb);
for (String str : strings) {
M_log.warn(str + "=Missing LTIService Translation");
}
} | void function() { try { M_log.info(STR); } catch (Exception t) { M_log.warn(STR, t); } getServices(); ArrayList<String> strings = foorm.checkI18NStrings(LTIService.TOOL_MODEL, rb); for (String str : strings) { M_log.warn(str + STR); } strings = foorm.checkI18NStrings(LTIService.CONTENT_MODEL, rb); for (String str : strings) { M_log.warn(str + STR); } strings = foorm.checkI18NStrings(LTIService.DEPLOY_MODEL, rb); for (String str : strings) { M_log.warn(str + STR); } } | /**
* Final initialization, once all dependencies are set.
*/ | Final initialization, once all dependencies are set | init | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "basiclti/basiclti-impl/src/java/org/sakaiproject/lti/impl/BaseLTIService.java",
"license": "apache-2.0",
"size": 27418
} | [
"java.util.ArrayList",
"org.sakaiproject.lti.api.LTIService"
] | import java.util.ArrayList; import org.sakaiproject.lti.api.LTIService; | import java.util.*; import org.sakaiproject.lti.api.*; | [
"java.util",
"org.sakaiproject.lti"
] | java.util; org.sakaiproject.lti; | 2,841,759 |
public static String getDirectoryAbsolutePath(final File dir) {
return dir.isDirectory() ? dir.getAbsolutePath() : dir.getParentFile().getAbsolutePath();
}
| static String function(final File dir) { return dir.isDirectory() ? dir.getAbsolutePath() : dir.getParentFile().getAbsolutePath(); } | /**
* Returns the absolute path of directory specified by dir,
* or its parent directory if dir specifies a file.
* @param dir The directory or its child file.
* @return The absolute path of directory specified by dir,
* or its parent directory if dir specifies a file.
*/ | Returns the absolute path of directory specified by dir, or its parent directory if dir specifies a file | getDirectoryAbsolutePath | {
"repo_name": "colinpalmer/dawnsci",
"path": "org.eclipse.dawnsci.remotedataset.test/src/org/eclipse/dawnsci/remotedataset/test/mock/FileUtils.java",
"license": "epl-1.0",
"size": 32437
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 301,583 |
public interface Listener {
void onMetadataUpdate(Cluster cluster, Set<String> unavailableTopics);
} | interface Listener { void function(Cluster cluster, Set<String> unavailableTopics); } | /**
* Callback invoked on metadata update.
*
* @param cluster the cluster containing metadata for topics with valid metadata
* @param unavailableTopics topics which are non-existent or have one or more partitions whose
* leader is not known
*/ | Callback invoked on metadata update | onMetadataUpdate | {
"repo_name": "ollie314/kafka",
"path": "clients/src/main/java/org/apache/kafka/clients/Metadata.java",
"license": "apache-2.0",
"size": 16934
} | [
"java.util.Set",
"org.apache.kafka.common.Cluster"
] | import java.util.Set; import org.apache.kafka.common.Cluster; | import java.util.*; import org.apache.kafka.common.*; | [
"java.util",
"org.apache.kafka"
] | java.util; org.apache.kafka; | 2,735,222 |
public void emitDirect(int taskId, String streamId, List<Object> tuple, Object messageId) {
delegate.emitDirect(taskId, streamId, tuple, messageId);
} | void function(int taskId, String streamId, List<Object> tuple, Object messageId) { delegate.emitDirect(taskId, streamId, tuple, messageId); } | /**
* Emits a tuple to the specified task on the specified output stream. This output
* stream must have been declared as a direct stream, and the specified task must
* use a direct grouping on this stream to receive the message. The emitted values must be
* immutable.
*/ | Emits a tuple to the specified task on the specified output stream. This output stream must have been declared as a direct stream, and the specified task must use a direct grouping on this stream to receive the message. The emitted values must be immutable | emitDirect | {
"repo_name": "twitter/heron",
"path": "storm-compatibility/v0.10.2/src/java/backtype/storm/spout/SpoutOutputCollector.java",
"license": "apache-2.0",
"size": 5646
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,747,432 |
private static void formatting(final String name, final String before)
throws ValidationException {
// @checkstyle MultipleStringLiterals (3 lines)
final String after = new Prettifier(before).prettify()
.replace("\r\n", "\n");
final String bnormalized = before.replace("\r\n", "\n");
final List<String> blines =
Arrays.asList(bnormalized.split(XmlValidator.ESCAPED_EOL, -1));
final Patch filter = XmlValidator.filter(
DiffUtils.diff(
blines,
Arrays.asList(after.split(XmlValidator.ESCAPED_EOL, -1))
)
);
if (!filter.getDeltas().isEmpty()) {
final int context = 5;
throw new ValidationException(
// @checkstyle LineLength (1 line)
"The provided XML %s is not well formatted, it should look like this:\n%s\npatch:\n%s",
name, after,
StringUtils.join(
DiffUtils.generateUnifiedDiff(
"before", "after", blines,
filter, context
), "\n"
)
);
}
} | static void function(final String name, final String before) throws ValidationException { final String after = new Prettifier(before).prettify() .replace("\r\n", "\n"); final String bnormalized = before.replace("\r\n", "\n"); final List<String> blines = Arrays.asList(bnormalized.split(XmlValidator.ESCAPED_EOL, -1)); final Patch filter = XmlValidator.filter( DiffUtils.diff( blines, Arrays.asList(after.split(XmlValidator.ESCAPED_EOL, -1)) ) ); if (!filter.getDeltas().isEmpty()) { final int context = 5; throw new ValidationException( STR, name, after, StringUtils.join( DiffUtils.generateUnifiedDiff( STR, "after", blines, filter, context ), "\n" ) ); } } | /**
* Check formatting of given XML.
* @param name Name of XML file.
* @param before XML to check.
* @throws ValidationException In case of validation error.
*/ | Check formatting of given XML | formatting | {
"repo_name": "vkuchyn/qulice",
"path": "qulice-xml/src/main/java/com/qulice/xml/XmlValidator.java",
"license": "bsd-3-clause",
"size": 7397
} | [
"com.qulice.spi.ValidationException",
"java.util.Arrays",
"java.util.List",
"org.apache.commons.lang3.StringUtils"
] | import com.qulice.spi.ValidationException; import java.util.Arrays; import java.util.List; import org.apache.commons.lang3.StringUtils; | import com.qulice.spi.*; import java.util.*; import org.apache.commons.lang3.*; | [
"com.qulice.spi",
"java.util",
"org.apache.commons"
] | com.qulice.spi; java.util; org.apache.commons; | 1,945,611 |
// TODO: We should add: ObjectMapper#getParentObjectMapper()
public ObjectMapper findParentObjectMapper(ObjectMapper objectMapper) {
int indexOfLastDot = objectMapper.fullPath().lastIndexOf('.');
if (indexOfLastDot != -1) {
String parentNestObjectPath = objectMapper.fullPath().substring(0, indexOfLastDot);
return objectMappers().get(parentNestObjectPath);
} else {
return null;
}
} | ObjectMapper function(ObjectMapper objectMapper) { int indexOfLastDot = objectMapper.fullPath().lastIndexOf('.'); if (indexOfLastDot != -1) { String parentNestObjectPath = objectMapper.fullPath().substring(0, indexOfLastDot); return objectMappers().get(parentNestObjectPath); } else { return null; } } | /**
* Returns the parent {@link ObjectMapper} instance of the specified object mapper or <code>null</code> if there
* isn't any.
*/ | Returns the parent <code>ObjectMapper</code> instance of the specified object mapper or <code>null</code> if there isn't any | findParentObjectMapper | {
"repo_name": "zuoyebushiwo/ElasticSearch-Final",
"path": "src/main/java/org/elasticsearch/index/mapper/DocumentMapper.java",
"license": "apache-2.0",
"size": 28306
} | [
"org.elasticsearch.index.mapper.object.ObjectMapper"
] | import org.elasticsearch.index.mapper.object.ObjectMapper; | import org.elasticsearch.index.mapper.object.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 1,137,424 |
public boolean setFixedTilesAndReference( final int fixTilesIndex, final int mapBackIndex, final GlobalOptimizationType type )
{
final List< GlobalOptimizationSubset > subsets = type.getAllViewPairs();
//
// define fixed tiles
//
final Set< ViewId > fixedTiles = new HashSet< ViewId >();
if ( fixTilesIndex == 0 ) // all first tiles
{
for ( final GlobalOptimizationSubset subset : subsets )
{
if ( subset.getViews().size() == 0 )
IOFunctions.println( "Nothing to do for: " + subset.getDescription() + ". No tiles fixed." );
else
fixedTiles.add( subset.getViews().get( 0 ) );
}
}
else if ( fixTilesIndex == 1 )
{
// select fixed tiles (this assumes that one subset consists of one timepoint)
if ( subsets.size() > 1 )
{
final GenericDialog gd1 = new GenericDialog( "Type of manual choice" );
gd1.addCheckbox( "Same_fixed_view(s) for each timepoint", defaultSameFixedViews );
gd1.showDialog();
if ( gd1.wasCanceled() )
return false;
if ( defaultSameFixedViews = gd1.getNextBoolean() )
{
// check which viewsetups are available in all subsets
final ArrayList< ViewSetup > setupList = getListOfViewSetupPresentInAllSubsets( subsets, type );
if ( setupList.size() == 0 )
{
IOFunctions.println( "No Viewsetup is available in all Timepoints." );
return false;
}
if ( defaultFixedTiles == null || defaultFixedTiles.length != setupList.size() )
defaultFixedTiles = new boolean[ setupList.size() ];
final GenericDialog gd2 = new GenericDialog( "Select ViewSetups to be fixed for each of the timepoints" );
for ( int i = 0; i < setupList.size(); ++i )
{
final ViewSetup vs = setupList.get( i );
gd2.addCheckbox( "Angle_" + vs.getAngle().getName() + "_Channel_" + vs.getChannel().getName() + "_Illum_" + vs.getIllumination().getName(), defaultFixedTiles[ i ] );
}
GUIHelper.addScrollBars( gd2 );
gd2.showDialog();
if ( gd2.wasCanceled() )
return false;
for ( int i = 0; i < setupList.size(); ++i )
if ( defaultFixedTiles[ i ] = gd2.getNextBoolean() )
for ( final GlobalOptimizationSubset subset : subsets )
fixedTiles.add( new ViewId( subset.getViews().get( 0 ).getTimePointId(), setupList.get( i ).getId() ) );
}
else
{
for ( final GlobalOptimizationSubset subset : subsets )
if ( !askForFixedTiles( subset, type, fixedTiles, "Select fixed ViewIds for timepoint " + subset.getViews().get( 0 ).getTimePointId() ) )
return false;
}
}
else
{
// there is just one subset
if ( !askForFixedTiles( subsets.get( 0 ), type, fixedTiles, "Select fixed ViewIds" ) )
return false;
}
}
else
{
// no fixed tiles or reference timepoint
}
if ( fixTilesIndex >= 0 )
type.setFixedTiles( fixedTiles );
IOFunctions.println( "Following tiles are fixed:" );
for ( final ViewId id : type.getFixedTiles() )
{
final ViewDescription vd = type.getSpimData().getSequenceDescription().getViewDescription( id );
final ViewSetup vs = vd.getViewSetup();
IOFunctions.println( "Angle:" + vs.getAngle().getName() + " Channel:" + vs.getChannel().getName() + " Illum:" + vs.getIllumination().getName() + " TimePoint:" + vd.getTimePoint().getId() );
}
//
// now the reference tile(s)
//
if ( mapBackIndex == 0 )
{
type.setMapBackModel( null );
type.setMapBackReferenceTiles( new HashMap< GlobalOptimizationSubset, ViewId >() );
}
else if ( mapBackIndex == 1 || mapBackIndex == 3 )
{
type.setMapBackModel( new TranslationModel3D() );
}
else
{
type.setMapBackModel( new RigidModel3D() );
}
if ( mapBackIndex == 1 || mapBackIndex == 2 )
{
for ( final GlobalOptimizationSubset subset : subsets )
type.setMapBackReferenceTile( subset, subset.getViews().get( 0 ) );
}
else if ( mapBackIndex == 3 || mapBackIndex == 4 )
{
// select reference tile
// select fixed tiles (this assumes that one subset consists of one timepoint)
if ( subsets.size() > 1 )
{
final GenericDialog gd1 = new GenericDialog( "Type of manual choice" );
gd1.addCheckbox( "Same_reference_view(s) for each timepoint", defaultSameReferenceView );
gd1.showDialog();
if ( gd1.wasCanceled() )
return false;
if ( defaultSameReferenceView = gd1.getNextBoolean() )
{
// check which viewsetups are available in all subsets
final ArrayList< ViewSetup > setupList = getListOfViewSetupPresentInAllSubsets( subsets, type );
if ( setupList.size() == 0 )
{
IOFunctions.println( "No Viewsetup is available in all Timepoints." );
return false;
}
final GenericDialog gd2 = new GenericDialog( "Select Reference ViewSetup each of the timepoints" );
final String[] choices = new String[ setupList.size() ];
for ( int i = 0; i < setupList.size(); ++ i )
{
final ViewSetup vs = setupList.get( i );
choices[ i ] = "Angle_" + vs.getAngle().getName() + "_Channel_" + vs.getChannel().getName() + "_Illum_" + vs.getIllumination().getName();
}
if ( defaultReferenceTile >= choices.length )
defaultReferenceTile = 0;
gd2.addChoice( "Select_Reference_ViewSetup", choices, choices[ defaultReferenceTile ] );
gd2.showDialog();
if ( gd2.wasCanceled() )
return false;
final int index = defaultReferenceTile = gd2.getNextChoiceIndex();
for ( final GlobalOptimizationSubset subset : subsets )
type.setMapBackReferenceTile( subset, new ViewId( subset.getViews().get( 0 ).getTimePointId(), setupList.get( index ).getId() ) );
}
else
{
for ( final GlobalOptimizationSubset subset : subsets )
if ( !askForReferenceTile( subset, type, "Select Reference Views" ) )
return false;
}
}
else
{
if ( !askForReferenceTile( subsets.get( 0 ), type, "Select Reference View" ) )
return false;
}
}
else
{
// no reference tile
}
IOFunctions.println( "Following tiles are reference tiles (for mapping back if there are no fixed tiles):" );
for ( final GlobalOptimizationSubset subset : subsets )
{
final ViewId id = type.getMapBackReferenceTile( subset );
if ( id != null )
{
final ViewDescription vd = type.getSpimData().getSequenceDescription().getViewDescription( id );
final ViewSetup vs = vd.getViewSetup();
IOFunctions.println( "Angle:" + vs.getAngle().getName() + " Channel:" + vs.getChannel().getName() + " Illum:" + vs.getIllumination().getName() + " TimePoint:" + vd.getTimePoint().getId() );
}
}
return true;
} | boolean function( final int fixTilesIndex, final int mapBackIndex, final GlobalOptimizationType type ) { final List< GlobalOptimizationSubset > subsets = type.getAllViewPairs(); if ( fixTilesIndex == 0 ) { for ( final GlobalOptimizationSubset subset : subsets ) { if ( subset.getViews().size() == 0 ) IOFunctions.println( STR + subset.getDescription() + STR ); else fixedTiles.add( subset.getViews().get( 0 ) ); } } else if ( fixTilesIndex == 1 ) { if ( subsets.size() > 1 ) { final GenericDialog gd1 = new GenericDialog( STR ); gd1.addCheckbox( STR, defaultSameFixedViews ); gd1.showDialog(); if ( gd1.wasCanceled() ) return false; if ( defaultSameFixedViews = gd1.getNextBoolean() ) { final ArrayList< ViewSetup > setupList = getListOfViewSetupPresentInAllSubsets( subsets, type ); if ( setupList.size() == 0 ) { IOFunctions.println( STR ); return false; } if ( defaultFixedTiles == null defaultFixedTiles.length != setupList.size() ) defaultFixedTiles = new boolean[ setupList.size() ]; final GenericDialog gd2 = new GenericDialog( STR ); for ( int i = 0; i < setupList.size(); ++i ) { final ViewSetup vs = setupList.get( i ); gd2.addCheckbox( STR + vs.getAngle().getName() + STR + vs.getChannel().getName() + STR + vs.getIllumination().getName(), defaultFixedTiles[ i ] ); } GUIHelper.addScrollBars( gd2 ); gd2.showDialog(); if ( gd2.wasCanceled() ) return false; for ( int i = 0; i < setupList.size(); ++i ) if ( defaultFixedTiles[ i ] = gd2.getNextBoolean() ) for ( final GlobalOptimizationSubset subset : subsets ) fixedTiles.add( new ViewId( subset.getViews().get( 0 ).getTimePointId(), setupList.get( i ).getId() ) ); } else { for ( final GlobalOptimizationSubset subset : subsets ) if ( !askForFixedTiles( subset, type, fixedTiles, STR + subset.getViews().get( 0 ).getTimePointId() ) ) return false; } } else { if ( !askForFixedTiles( subsets.get( 0 ), type, fixedTiles, STR ) ) return false; } } else { } if ( fixTilesIndex >= 0 ) type.setFixedTiles( fixedTiles ); IOFunctions.println( STR ); for ( final ViewId id : type.getFixedTiles() ) { final ViewDescription vd = type.getSpimData().getSequenceDescription().getViewDescription( id ); final ViewSetup vs = vd.getViewSetup(); IOFunctions.println( STR + vs.getAngle().getName() + STR + vs.getChannel().getName() + STR + vs.getIllumination().getName() + STR + vd.getTimePoint().getId() ); } { type.setMapBackModel( null ); type.setMapBackReferenceTiles( new HashMap< GlobalOptimizationSubset, ViewId >() ); } else if ( mapBackIndex == 1 mapBackIndex == 3 ) { type.setMapBackModel( new TranslationModel3D() ); } else { type.setMapBackModel( new RigidModel3D() ); } if ( mapBackIndex == 1 mapBackIndex == 2 ) { for ( final GlobalOptimizationSubset subset : subsets ) type.setMapBackReferenceTile( subset, subset.getViews().get( 0 ) ); } else if ( mapBackIndex == 3 mapBackIndex == 4 ) { if ( subsets.size() > 1 ) { final GenericDialog gd1 = new GenericDialog( STR ); gd1.addCheckbox( STR, defaultSameReferenceView ); gd1.showDialog(); if ( gd1.wasCanceled() ) return false; if ( defaultSameReferenceView = gd1.getNextBoolean() ) { final ArrayList< ViewSetup > setupList = getListOfViewSetupPresentInAllSubsets( subsets, type ); if ( setupList.size() == 0 ) { IOFunctions.println( STR ); return false; } final GenericDialog gd2 = new GenericDialog( STR ); final String[] choices = new String[ setupList.size() ]; for ( int i = 0; i < setupList.size(); ++ i ) { final ViewSetup vs = setupList.get( i ); choices[ i ] = STR + vs.getAngle().getName() + STR + vs.getChannel().getName() + STR + vs.getIllumination().getName(); } if ( defaultReferenceTile >= choices.length ) defaultReferenceTile = 0; gd2.addChoice( STR, choices, choices[ defaultReferenceTile ] ); gd2.showDialog(); if ( gd2.wasCanceled() ) return false; final int index = defaultReferenceTile = gd2.getNextChoiceIndex(); for ( final GlobalOptimizationSubset subset : subsets ) type.setMapBackReferenceTile( subset, new ViewId( subset.getViews().get( 0 ).getTimePointId(), setupList.get( index ).getId() ) ); } else { for ( final GlobalOptimizationSubset subset : subsets ) if ( !askForReferenceTile( subset, type, STR ) ) return false; } } else { if ( !askForReferenceTile( subsets.get( 0 ), type, STR ) ) return false; } } else { } IOFunctions.println( STR ); for ( final GlobalOptimizationSubset subset : subsets ) { final ViewId id = type.getMapBackReferenceTile( subset ); if ( id != null ) { final ViewDescription vd = type.getSpimData().getSequenceDescription().getViewDescription( id ); final ViewSetup vs = vd.getViewSetup(); IOFunctions.println( STR + vs.getAngle().getName() + STR + vs.getChannel().getName() + STR + vs.getIllumination().getName() + STR + vd.getTimePoint().getId() ); } } return true; } | /**
* Assign the right fixed tiles and reference tiles for this type of optimization
*
* @param fixTilesIndex - "Fix first tile", "Select fixed tile", "Do not fix tiles"
* @param mapBackIndex - "Do not map back (use this if tiles are fixed)", "Map back to first tile using translation model", "Map back to first tile using rigid model", "Map back to user defined tile using translation model", "Map back to user defined tile using rigid model"
*/ | Assign the right fixed tiles and reference tiles for this type of optimization | setFixedTilesAndReference | {
"repo_name": "fiji/SPIM_Registration",
"path": "src/main/java/spim/fiji/plugin/Interest_Point_Registration.java",
"license": "gpl-2.0",
"size": 29263
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,103,372 |
public boolean containsAnyLiquid(AxisAlignedBB bb)
{
int i = MathHelper.floor_double(bb.minX);
int j = MathHelper.ceiling_double_int(bb.maxX);
int k = MathHelper.floor_double(bb.minY);
int l = MathHelper.ceiling_double_int(bb.maxY);
int i1 = MathHelper.floor_double(bb.minZ);
int j1 = MathHelper.ceiling_double_int(bb.maxZ);
BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain();
for (int k1 = i; k1 < j; ++k1)
{
for (int l1 = k; l1 < l; ++l1)
{
for (int i2 = i1; i2 < j1; ++i2)
{
IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.set(k1, l1, i2));
if (iblockstate.getMaterial().isLiquid())
{
blockpos$pooledmutableblockpos.release();
return true;
}
}
}
}
blockpos$pooledmutableblockpos.release();
return false;
} | boolean function(AxisAlignedBB bb) { int i = MathHelper.floor_double(bb.minX); int j = MathHelper.ceiling_double_int(bb.maxX); int k = MathHelper.floor_double(bb.minY); int l = MathHelper.ceiling_double_int(bb.maxY); int i1 = MathHelper.floor_double(bb.minZ); int j1 = MathHelper.ceiling_double_int(bb.maxZ); BlockPos.PooledMutableBlockPos blockpos$pooledmutableblockpos = BlockPos.PooledMutableBlockPos.retain(); for (int k1 = i; k1 < j; ++k1) { for (int l1 = k; l1 < l; ++l1) { for (int i2 = i1; i2 < j1; ++i2) { IBlockState iblockstate = this.getBlockState(blockpos$pooledmutableblockpos.set(k1, l1, i2)); if (iblockstate.getMaterial().isLiquid()) { blockpos$pooledmutableblockpos.release(); return true; } } } } blockpos$pooledmutableblockpos.release(); return false; } | /**
* Checks if any of the blocks within the aabb are liquids.
*/ | Checks if any of the blocks within the aabb are liquids | containsAnyLiquid | {
"repo_name": "danielyc/test-1.9.4",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/World.java",
"license": "gpl-3.0",
"size": 141454
} | [
"net.minecraft.block.state.IBlockState",
"net.minecraft.util.math.AxisAlignedBB",
"net.minecraft.util.math.BlockPos",
"net.minecraft.util.math.MathHelper"
] | import net.minecraft.block.state.IBlockState; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; | import net.minecraft.block.state.*; import net.minecraft.util.math.*; | [
"net.minecraft.block",
"net.minecraft.util"
] | net.minecraft.block; net.minecraft.util; | 1,463,003 |
private void beforeName() throws IOException {
JsonScope context = peek();
if (context == JsonScope.NONEMPTY_OBJECT) { // first in object
out.write(',');
} else if (context != JsonScope.EMPTY_OBJECT) { // not in an object!
throw new IllegalStateException("Nesting problem: " + stack);
}
newline();
replaceTop(JsonScope.DANGLING_NAME);
} | void function() throws IOException { JsonScope context = peek(); if (context == JsonScope.NONEMPTY_OBJECT) { out.write(','); } else if (context != JsonScope.EMPTY_OBJECT) { throw new IllegalStateException(STR + stack); } newline(); replaceTop(JsonScope.DANGLING_NAME); } | /**
* Inserts any necessary separators and whitespace before a name. Also
* adjusts the stack to expect the name's value.
*/ | Inserts any necessary separators and whitespace before a name. Also adjusts the stack to expect the name's value | beforeName | {
"repo_name": "axmadjon/AndroidSlidingMenu",
"path": "app/src/main/java/uz/greenwhite/slidingmenu/support/v10/json/android_json/JsonWriter.java",
"license": "apache-2.0",
"size": 16585
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,512,058 |
public void wipeDevice(String code, String data) {
String inputPin;
String savedPin =
Preference.getString(context,
resources.getString(R.string.shared_pref_pin));
try {
JSONObject wipeKey = new JSONObject(data);
inputPin = (String) wipeKey.get(resources.getString(R.string.shared_pref_pin));
String status;
if (inputPin.trim().equals(savedPin.trim())) {
status = resources.getString(R.string.shared_pref_default_status);
} else {
status = resources.getString(R.string.shared_pref_false_status);
}
resultBuilder.build(code, status);
if (inputPin.trim().equals(savedPin.trim())) {
Toast.makeText(context, resources.getString(R.string.toast_message_wipe),
Toast.LENGTH_LONG).show();
try {
Thread.sleep(PRE_WIPE_WAIT_TIME);
} catch (InterruptedException e) {
Log.e(TAG, "Wipe pause interrupted :" + e.toString());
}
devicePolicyManager.wipeData(ACTIVATION_REQUEST);
} else {
Toast.makeText(context, resources.getString(R.string.toast_message_wipe_failed),
Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
Log.e(TAG, "Invalid JSON format." + e);
}
} | void function(String code, String data) { String inputPin; String savedPin = Preference.getString(context, resources.getString(R.string.shared_pref_pin)); try { JSONObject wipeKey = new JSONObject(data); inputPin = (String) wipeKey.get(resources.getString(R.string.shared_pref_pin)); String status; if (inputPin.trim().equals(savedPin.trim())) { status = resources.getString(R.string.shared_pref_default_status); } else { status = resources.getString(R.string.shared_pref_false_status); } resultBuilder.build(code, status); if (inputPin.trim().equals(savedPin.trim())) { Toast.makeText(context, resources.getString(R.string.toast_message_wipe), Toast.LENGTH_LONG).show(); try { Thread.sleep(PRE_WIPE_WAIT_TIME); } catch (InterruptedException e) { Log.e(TAG, STR + e.toString()); } devicePolicyManager.wipeData(ACTIVATION_REQUEST); } else { Toast.makeText(context, resources.getString(R.string.toast_message_wipe_failed), Toast.LENGTH_LONG).show(); } } catch (JSONException e) { Log.e(TAG, STR + e); } } | /**
* Wipe the device.
* @param code - Operation code.
* @param data - Data required by the operation(PIN).
*/ | Wipe the device | wipeDevice | {
"repo_name": "ayyoob/product-iot-server",
"path": "modules/tools/mdm-android-agent-archetype/src/main/resources/archetype-resources/src/main/java/org/wso2/mdm/agent/services/Operation.java",
"license": "apache-2.0",
"size": 31674
} | [
"android.util.Log",
"android.widget.Toast",
"org.wso2.mdm.agent.utils.Preference"
] | import android.util.Log; import android.widget.Toast; import org.wso2.mdm.agent.utils.Preference; | import android.util.*; import android.widget.*; import org.wso2.mdm.agent.utils.*; | [
"android.util",
"android.widget",
"org.wso2.mdm"
] | android.util; android.widget; org.wso2.mdm; | 403,455 |
public void addUser(User user){
ArrayList<User> users = loadUsersFromFile();
if (userExists(user.getUsername(), user.getPassword()) == false) {
users.add(user);
saveToFile(users);
}
else {
Log.e("TOD", "Warning: tried to add user that already existed.");
}
} | void function(User user){ ArrayList<User> users = loadUsersFromFile(); if (userExists(user.getUsername(), user.getPassword()) == false) { users.add(user); saveToFile(users); } else { Log.e("TOD", STR); } } | /**
* Adds a user to the local save file.
* @param user the user
*/ | Adds a user to the local save file | addUser | {
"repo_name": "CMPUT301W16T10/WhateverIsOkay",
"path": "app/src/main/java/com/example/suhussai/gameshare/LocalStorageAwareAppCompatActivity.java",
"license": "apache-2.0",
"size": 6202
} | [
"android.util.Log",
"java.util.ArrayList"
] | import android.util.Log; import java.util.ArrayList; | import android.util.*; import java.util.*; | [
"android.util",
"java.util"
] | android.util; java.util; | 1,018,705 |
@Advice.OnMethodExit
@SuppressFBWarnings(value = {"UC_USELESS_VOID_METHOD", "DLS_DEAD_LOCAL_STORE"}, justification = "Advice method serves as a template")
protected static void exit(@Advice.Return(readOnly = false, typing = Assigner.Typing.DYNAMIC) Object returned, @CachedReturnPlugin.CacheField Object cached) {
if (returned == null) {
returned = cached;
} else {
cached = returned;
}
} | @Advice.OnMethodExit @SuppressFBWarnings(value = {STR, STR}, justification = STR) static void function(@Advice.Return(readOnly = false, typing = Assigner.Typing.DYNAMIC) Object returned, @CachedReturnPlugin.CacheField Object cached) { if (returned == null) { returned = cached; } else { cached = returned; } } | /**
* The exit advice.
*
* @param returned The value that was returned by the method's execution or {@code 0} if it was not executed.
* @param cached The previously cached value or {@code 0} if no previous value exists.
*/ | The exit advice | exit | {
"repo_name": "DALDEI/byte-buddy",
"path": "byte-buddy-dep/src/precompiled/java/net/bytebuddy/build/CachedReturnPlugin$Object.java",
"license": "apache-2.0",
"size": 1571
} | [
"edu.umd.cs.findbugs.annotations.SuppressFBWarnings",
"net.bytebuddy.asm.Advice",
"net.bytebuddy.implementation.bytecode.assign.Assigner"
] | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import net.bytebuddy.asm.Advice; import net.bytebuddy.implementation.bytecode.assign.Assigner; | import edu.umd.cs.findbugs.annotations.*; import net.bytebuddy.asm.*; import net.bytebuddy.implementation.bytecode.assign.*; | [
"edu.umd.cs",
"net.bytebuddy.asm",
"net.bytebuddy.implementation"
] | edu.umd.cs; net.bytebuddy.asm; net.bytebuddy.implementation; | 345,887 |
@Override()
@NotNull()
String toString(); | @Override() @NotNull() String toString(); | /**
* Retrieves a string representation of this LDIF record. Note that it will
* be a single-line string representation and will therefore not be an LDIF
* representation.
*
* @return A string representation of this LDIF record.
*/ | Retrieves a string representation of this LDIF record. Note that it will be a single-line string representation and will therefore not be an LDIF representation | toString | {
"repo_name": "UnboundID/ldapsdk",
"path": "src/com/unboundid/ldif/LDIFRecord.java",
"license": "gpl-2.0",
"size": 7239
} | [
"com.unboundid.util.NotNull"
] | import com.unboundid.util.NotNull; | import com.unboundid.util.*; | [
"com.unboundid.util"
] | com.unboundid.util; | 1,492,599 |
public HttpServlet getServlet() {
return servlet;
} | HttpServlet function() { return servlet; } | /**
* The HTTP servlet.
*
* @return the servlet
*/ | The HTTP servlet | getServlet | {
"repo_name": "ROAMSYS/swaggerapi",
"path": "src/main/java/com/roamsys/swagger/data/SwaggerAPIContext.java",
"license": "mit",
"size": 1826
} | [
"javax.servlet.http.HttpServlet"
] | import javax.servlet.http.HttpServlet; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 567,603 |
public CollectionExpression buildCollectionExpression() {
List<AbstractExpression> children = new ArrayList<AbstractExpression>(1);
children.add((AbstractExpression) getSelectExpression());
List<Boolean> commas = new ArrayList<Boolean>(1);
commas.add(Boolean.FALSE);
List<Boolean> spaces = new ArrayList<Boolean>(1);
spaces.add(Boolean.FALSE);
return new CollectionExpression(this, children, commas, spaces, true);
}
/**
* {@inheritDoc} | CollectionExpression function() { List<AbstractExpression> children = new ArrayList<AbstractExpression>(1); children.add((AbstractExpression) getSelectExpression()); List<Boolean> commas = new ArrayList<Boolean>(1); commas.add(Boolean.FALSE); List<Boolean> spaces = new ArrayList<Boolean>(1); spaces.add(Boolean.FALSE); return new CollectionExpression(this, children, commas, spaces, true); } /** * {@inheritDoc} | /**
* Creates a new {@link CollectionExpression} that will wrap the single select item.
*
* @return The single select item represented by a temporary collection
*/ | Creates a new <code>CollectionExpression</code> that will wrap the single select item | buildCollectionExpression | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "jpa/org.eclipse.persistence.jpa.jpql/src/org/eclipse/persistence/jpa/jpql/parser/AbstractSelectClause.java",
"license": "epl-1.0",
"size": 8836
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,653,663 |
public static FileInfo getDefaultFloat32BigEndianFileInfo(Grid1D grid){
FileInfo fI = new FileInfo();
fI.fileFormat = FileInfo.RAW;
fI.fileType = FileInfo.GRAY32_FLOAT;
fI.height = 1;
fI.width = grid.getSize()[0];
fI.nImages = 1;
fI.intelByteOrder = false;
fI.directory = "";
fI.fileName = "";
return fI;
} | static FileInfo function(Grid1D grid){ FileInfo fI = new FileInfo(); fI.fileFormat = FileInfo.RAW; fI.fileType = FileInfo.GRAY32_FLOAT; fI.height = 1; fI.width = grid.getSize()[0]; fI.nImages = 1; fI.intelByteOrder = false; fI.directory = STR"; return fI; } | /**
* The default float 32, big endian format for CONRAD.
* @param grid the 1D grid to process
* @return the FileInfo object
*/ | The default float 32, big endian format for CONRAD | getDefaultFloat32BigEndianFileInfo | {
"repo_name": "YixingHuang/CONRAD",
"path": "src/edu/stanford/rsl/conrad/io/GridRawIOUtil.java",
"license": "gpl-3.0",
"size": 9126
} | [
"edu.stanford.rsl.conrad.data.numeric.Grid1D"
] | import edu.stanford.rsl.conrad.data.numeric.Grid1D; | import edu.stanford.rsl.conrad.data.numeric.*; | [
"edu.stanford.rsl"
] | edu.stanford.rsl; | 423,516 |
private void autoconnect() {
// If we don't have any servers to go with.
if( Atomic.getInstance().getServersAsArrayList().size() < 1 )
return;
// Or we've done this already
if( !doAutoconnect.getValue() )
return;
// We don't need to get this far.
// Are we connected to the greater wide not-us?
NetworkInfo ninf = ((ConnectivityManager)(this.getSystemService(Service.CONNECTIVITY_SERVICE))).getActiveNetworkInfo();
// If there's no way out, or we aren't actually connected,
if( ninf == null || ninf.getState() != NetworkInfo.State.CONNECTED ) {
// We don't need to bother, but we should say something.
Toast.makeText(this, "Autoconnect skipped due to network outage", Toast.LENGTH_LONG).show();
return;
}
// Some slime...
Log.d("ServerList", "Doing autoconnect");
for( int idx = 0; idx < adapter.getCount(); idx++ ) {
Server s = adapter.getItem(idx);
if( s.getAutoconnect() && s.getStatus() == Status.DISCONNECTED ) {
ConnectServer(s);
}
}
} | void function() { if( Atomic.getInstance().getServersAsArrayList().size() < 1 ) return; if( !doAutoconnect.getValue() ) return; NetworkInfo ninf = ((ConnectivityManager)(this.getSystemService(Service.CONNECTIVITY_SERVICE))).getActiveNetworkInfo(); if( ninf == null ninf.getState() != NetworkInfo.State.CONNECTED ) { Toast.makeText(this, STR, Toast.LENGTH_LONG).show(); return; } Log.d(STR, STR); for( int idx = 0; idx < adapter.getCount(); idx++ ) { Server s = adapter.getItem(idx); if( s.getAutoconnect() && s.getStatus() == Status.DISCONNECTED ) { ConnectServer(s); } } } | /**
* Do the autoconnect stuff
*/ | Do the autoconnect stuff | autoconnect | {
"repo_name": "14mRh4X0r/Atomic",
"path": "application/src/main/java/indrora/atomic/activity/ServersActivity.java",
"license": "gpl-3.0",
"size": 12699
} | [
"android.app.Service",
"android.net.ConnectivityManager",
"android.net.NetworkInfo",
"android.util.Log",
"android.widget.Toast"
] | import android.app.Service; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.util.Log; import android.widget.Toast; | import android.app.*; import android.net.*; import android.util.*; import android.widget.*; | [
"android.app",
"android.net",
"android.util",
"android.widget"
] | android.app; android.net; android.util; android.widget; | 1,654,280 |
public TreeItem insertItem(int beforeIndex, SafeHtml itemHtml) {
return root.insertItem(beforeIndex, itemHtml);
} | TreeItem function(int beforeIndex, SafeHtml itemHtml) { return root.insertItem(beforeIndex, itemHtml); } | /**
* Inserts a child tree item at the specified index containing the specified
* html.
*
* @param beforeIndex the index where the item will be inserted
* @param itemHtml the html of the item to be added
* @return the item that was added
* @throws IndexOutOfBoundsException if the index is out of range
*/ | Inserts a child tree item at the specified index containing the specified html | insertItem | {
"repo_name": "syntelos/gwtcc",
"path": "src/com/google/gwt/user/client/ui/Tree.java",
"license": "apache-2.0",
"size": 41667
} | [
"com.google.gwt.safehtml.shared.SafeHtml"
] | import com.google.gwt.safehtml.shared.SafeHtml; | import com.google.gwt.safehtml.shared.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,250,040 |
@CanIgnoreReturnValue
@Deprecated
@Override
public final boolean removeIf(Predicate<? super E> filter) {
throw new UnsupportedOperationException();
} | final boolean function(Predicate<? super E> filter) { throw new UnsupportedOperationException(); } | /**
* Guaranteed to throw an exception and leave the collection unmodified.
*
* @throws UnsupportedOperationException always
* @deprecated Unsupported operation.
*/ | Guaranteed to throw an exception and leave the collection unmodified | removeIf | {
"repo_name": "EdwardLee03/guava",
"path": "guava/src/com/google/common/collect/ImmutableCollection.java",
"license": "apache-2.0",
"size": 17092
} | [
"java.util.function.Predicate"
] | import java.util.function.Predicate; | import java.util.function.*; | [
"java.util"
] | java.util; | 269,476 |
private Element createDataSourceElement(Document doc, String id,
String name, String url, String type, String display,
boolean visible, boolean editable, String blur, String color) {
// Set rootElement to "DataSource"
Element rootElement = doc.createElement("datasource");
// add attribute id to rootElement
rootElement.setAttribute("id", id);
// create "Name" Element and add it to rootElement
Element nameElement = doc.createElement("name");
nameElement.appendChild(doc.createTextNode(name));
rootElement.appendChild(nameElement);
// create "Url" Element and add it to rootElement
Element urlElement = doc.createElement("url");
urlElement.appendChild(doc.createTextNode(url));
rootElement.appendChild(urlElement);
// create "Type" Element and add it to rootElement
Element typeElement = doc.createElement("type");
typeElement.appendChild(doc.createTextNode(type));
rootElement.appendChild(typeElement);
// create "Display" Element and add it to rootElement
Element displayElement = doc.createElement("display");
displayElement.appendChild(doc.createTextNode(display));
rootElement.appendChild(displayElement);
// create "enabled" Element and add it to rootElement
Element enabled = doc.createElement("visible");
enabled.appendChild(doc.createTextNode(String.valueOf(visible)));
rootElement.appendChild(enabled);
// create "enabled" Element and add it to rootElement
Element editableElement = doc.createElement("editable");
editableElement
.appendChild(doc.createTextNode(String.valueOf(editable)));
rootElement.appendChild(editableElement);
// create "Display" Element and add it to rootElement
Element blurElement = doc.createElement("blur");
blurElement.appendChild(doc.createTextNode(blur));
rootElement.appendChild(blurElement);
// create "color" Element and add it to rootElement
Element colorElement = doc.createElement("color");
colorElement.appendChild(doc.createTextNode(color));
rootElement.appendChild(colorElement);
return rootElement;
} | Element function(Document doc, String id, String name, String url, String type, String display, boolean visible, boolean editable, String blur, String color) { Element rootElement = doc.createElement(STR); rootElement.setAttribute("id", id); Element nameElement = doc.createElement("name"); nameElement.appendChild(doc.createTextNode(name)); rootElement.appendChild(nameElement); Element urlElement = doc.createElement("url"); urlElement.appendChild(doc.createTextNode(url)); rootElement.appendChild(urlElement); Element typeElement = doc.createElement("type"); typeElement.appendChild(doc.createTextNode(type)); rootElement.appendChild(typeElement); Element displayElement = doc.createElement(STR); displayElement.appendChild(doc.createTextNode(display)); rootElement.appendChild(displayElement); Element enabled = doc.createElement(STR); enabled.appendChild(doc.createTextNode(String.valueOf(visible))); rootElement.appendChild(enabled); Element editableElement = doc.createElement(STR); editableElement .appendChild(doc.createTextNode(String.valueOf(editable))); rootElement.appendChild(editableElement); Element blurElement = doc.createElement("blur"); blurElement.appendChild(doc.createTextNode(blur)); rootElement.appendChild(blurElement); Element colorElement = doc.createElement("color"); colorElement.appendChild(doc.createTextNode(color)); rootElement.appendChild(colorElement); return rootElement; } | /**
* Creates a XML Element in this form:
*
* <pre>
* <datasource id="0">
* <name></name>
* <url></url>
* <type></type>
* <display></display>
* <visible></visible>
* <blur></blur>
* </datasource>
* </pre>
*
* @param doc
* The XML Document to create the Element
* @param id
* The id of the DataSource
* @param name
* The name of the DataSource
* @param url
* The Url of the DataSource
* @param type
* The Type of the DataSource
* @param display
* The Displaytype of the DataSource
* @param visible
* The Visibility of the DataSource
* @param blur
* How the GPS location should be blurred
* @return The XML Element of the DataSource
*/ | Creates a XML Element in this form: <code> </code> | createDataSourceElement | {
"repo_name": "pokerazor/mixare",
"path": "src/org/mixare/data/DataSourceStorage.java",
"license": "gpl-3.0",
"size": 13428
} | [
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import org.w3c.dom.Document; import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,325,401 |
public ViewObjectImpl getAlbumsView1() {
return (ViewObjectImpl) findViewObject("AlbumsView1");
} | ViewObjectImpl function() { return (ViewObjectImpl) findViewObject(STR); } | /**
* Container's getter for AlbumsView1.
* @return AlbumsView1
*/ | Container's getter for AlbumsView1 | getAlbumsView1 | {
"repo_name": "lucasjellema/APM-Demo-App-WorldView",
"path": "Model/src/nl/amis/world/model/SoaringProposalServiceImpl.java",
"license": "apache-2.0",
"size": 2581
} | [
"oracle.jbo.server.ViewObjectImpl"
] | import oracle.jbo.server.ViewObjectImpl; | import oracle.jbo.server.*; | [
"oracle.jbo.server"
] | oracle.jbo.server; | 1,040,033 |
@Override
public void endAttributes()
throws JspParseException
{
} | void function() throws JspParseException { } | /**
* Called after all the attributes from the tag.
*/ | Called after all the attributes from the tag | endAttributes | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/jsp/java/JstlCoreWhen.java",
"license": "gpl-2.0",
"size": 3695
} | [
"com.caucho.jsp.JspParseException"
] | import com.caucho.jsp.JspParseException; | import com.caucho.jsp.*; | [
"com.caucho.jsp"
] | com.caucho.jsp; | 2,631,069 |
@SuppressWarnings("deprecation")
private String makeDeathMessage(Attack attack, EntityDamageEvent.DamageCause damageCause) {
String attackerText;
Client victim = Client.getClient(attack.victim);
String victimText = victim.getTeam().getColor() + attack.victim.getName();
ChatColor c = ChatColor.GRAY;
if (attack.attacker instanceof Player) {
Client attacker = Client.getClient((Player) attack.attacker);
attackerText = attacker.getTeam().getColor() + attacker.getPlayer().getName();
if (wasTeamKill(attack, damageCause)) c = ChatColor.DARK_RED;
} else {
attackerText = attack.attacker.getType().getName();
}
String attackText;
switch (attack.cause) {
case HIT:
attackText = "knocked";
break;
case SHOOT:
attackText = "shot";
break;
case SPLEEF:
attackText = "spleefed";
break;
default:
attackText = "";
break;
}
String siteText;
switch (attack.from) {
case LADDER:
siteText = " off a ladder";
break;
case WATER:
siteText = " out of the water";
break;
default:
siteText = "";
break;
}
String damageText;
if (attack.from == Attack.From.FLOOR) {
switch (damageCause) {
case VOID:
damageText = " out of the world";
break;
case FALL:
damageText = " off a high place";
break;
case LAVA:
case FIRE_TICK:
damageText = " into lava";
break;
case SUICIDE:
damageText = " to their death (suicide/battle log)";
break;
default:
damageText = " to their death";
}
} else {
switch (damageCause) {
case VOID:
damageText = " and into the void";
break;
case FALL:
damageText = "";
break;
case LAVA:
case FIRE_TICK:
damageText = " and into lava";
break;
case SUICIDE:
damageText = " to their death (suicide/battle log)";
break;
default:
damageText = " to their death";
}
}
return victimText + c + " was " + attackText + siteText + damageText + c + " by " + attackerText;
}
| @SuppressWarnings(STR) String function(Attack attack, EntityDamageEvent.DamageCause damageCause) { String attackerText; Client victim = Client.getClient(attack.victim); String victimText = victim.getTeam().getColor() + attack.victim.getName(); ChatColor c = ChatColor.GRAY; if (attack.attacker instanceof Player) { Client attacker = Client.getClient((Player) attack.attacker); attackerText = attacker.getTeam().getColor() + attacker.getPlayer().getName(); if (wasTeamKill(attack, damageCause)) c = ChatColor.DARK_RED; } else { attackerText = attack.attacker.getType().getName(); } String attackText; switch (attack.cause) { case HIT: attackText = STR; break; case SHOOT: attackText = "shot"; break; case SPLEEF: attackText = STR; break; default: attackText = STR off a ladderSTR out of the waterSTRSTR out of the worldSTR off a high placeSTR into lavaSTR to their death (suicide/battle log)STR to their deathSTR and into the voidSTRSTR and into lavaSTR to their death (suicide/battle log)STR to their deathSTR was STR by " + attackerText; } | /**
* Generates a death message based on the various circumstances of a falling
* kill.
*
* @param attack
* The fall that resulted in a kill
* @param damageCause
* The final cause of death
* @return A text message describing the kill
*/ | Generates a death message based on the various circumstances of a falling kill | makeDeathMessage | {
"repo_name": "ProjectRixor/Rixor",
"path": "src/main/java/com/projectrixor/rixor/scrimmage/tracker/GravityKillTracker.java",
"license": "mit",
"size": 25364
} | [
"com.projectrixor.rixor.scrimmage.player.Client",
"org.bukkit.ChatColor",
"org.bukkit.entity.Player",
"org.bukkit.event.entity.EntityDamageEvent"
] | import com.projectrixor.rixor.scrimmage.player.Client; import org.bukkit.ChatColor; import org.bukkit.entity.Player; import org.bukkit.event.entity.EntityDamageEvent; | import com.projectrixor.rixor.scrimmage.player.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.event.entity.*; | [
"com.projectrixor.rixor",
"org.bukkit",
"org.bukkit.entity",
"org.bukkit.event"
] | com.projectrixor.rixor; org.bukkit; org.bukkit.entity; org.bukkit.event; | 436,724 |
protected void handleDirectoryEnd(final File directory, final int depth, final Collection<T> results) throws IOException {
// do nothing - overridable by subclass
} | void function(final File directory, final int depth, final Collection<T> results) throws IOException { } | /**
* Overridable callback method invoked at the end of processing each directory.
* <p>
* This implementation does nothing.
*
* @param directory the directory being processed
* @param depth the current directory level (starting directory = 0)
* @param results the collection of result objects, may be updated
* @throws IOException if an I/O Error occurs
*/ | Overridable callback method invoked at the end of processing each directory. This implementation does nothing | handleDirectoryEnd | {
"repo_name": "stereokrauts/stereoscope",
"path": "org.apache.commons.io/src/main/java/org/apache/commons/io/DirectoryWalker.java",
"license": "gpl-2.0",
"size": 26008
} | [
"java.io.File",
"java.io.IOException",
"java.util.Collection"
] | import java.io.File; import java.io.IOException; import java.util.Collection; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,269,096 |
public static MozuClient<com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket> createUserAuthTicketClient(com.mozu.api.contracts.core.UserAuthInfo userAuthInfo) throws Exception
{
return createUserAuthTicketClient( userAuthInfo, null, null);
} | static MozuClient<com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket> function(com.mozu.api.contracts.core.UserAuthInfo userAuthInfo) throws Exception { return createUserAuthTicketClient( userAuthInfo, null, null); } | /**
* Creates an authentication ticket for the supplied user to specify in API requests associated with the supplied tenant.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket> mozuClient=CreateUserAuthTicketClient( userAuthInfo);
* client.setBaseAddress(url);
* client.executeRequest();
* TenantAdminUserAuthTicket tenantAdminUserAuthTicket = client.Result();
* </code></pre></p>
* @param userAuthInfo Information required to authenticate a user.
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket>
* @see com.mozu.api.contracts.adminuser.TenantAdminUserAuthTicket
* @see com.mozu.api.contracts.core.UserAuthInfo
*/ | Creates an authentication ticket for the supplied user to specify in API requests associated with the supplied tenant. <code><code> MozuClient mozuClient=CreateUserAuthTicketClient( userAuthInfo); client.setBaseAddress(url); client.executeRequest(); TenantAdminUserAuthTicket tenantAdminUserAuthTicket = client.Result(); </code></code> | createUserAuthTicketClient | {
"repo_name": "sanjaymandadi/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/platform/adminuser/TenantAdminUserAuthTicketClient.java",
"license": "mit",
"size": 7271
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,355,539 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<VpnClientConnectionHealthDetailListResultInner> getVpnclientConnectionHealthAsync(
String resourceGroupName, String virtualNetworkGatewayName); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<VpnClientConnectionHealthDetailListResultInner> getVpnclientConnectionHealthAsync( String resourceGroupName, String virtualNetworkGatewayName); | /**
* Get VPN client connection health detail per P2S client connection of the virtual network gateway in the specified
* resource group.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return vPN client connection health detail per P2S client connection of the virtual network gateway in the
* specified resource group.
*/ | Get VPN client connection health detail per P2S client connection of the virtual network gateway in the specified resource group | getVpnclientConnectionHealthAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VirtualNetworkGatewaysClient.java",
"license": "mit",
"size": 135947
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.network.fluent.models.VpnClientConnectionHealthDetailListResultInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.VpnClientConnectionHealthDetailListResultInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,644,802 |
public PaddingConfig getPadding()
{
return this.padding;
} //-- PaddingConfig getPadding() | PaddingConfig function() { return this.padding; } | /**
* Get sets paddings of the chart content<br /><br /><a
* href="http://docs.webix.com/api__link__ui.datasuggest_padding_config.html">Webix
* API Reference</a>
*
* @return PaddingConfig
*/ | Get sets paddings of the chart contentWebix API Reference | getPadding | {
"repo_name": "zhv/webix-api",
"path": "src/main/java/com/webix/ui/model/context/Datasuggest.java",
"license": "bsd-3-clause",
"size": 24253
} | [
"com.webix.ui.model.PaddingConfig"
] | import com.webix.ui.model.PaddingConfig; | import com.webix.ui.model.*; | [
"com.webix.ui"
] | com.webix.ui; | 614,047 |
public Node lastNode(Node node)
{
return node;
} | Node function(Node node) { return node; } | /**
* Returns the last node in the selection order.
*
* @param node the current node
*
* @return the last node
*/ | Returns the last node in the selection order | lastNode | {
"repo_name": "christianchristensen/resin",
"path": "modules/kernel/src/com/caucho/xpath/pattern/FromPrevious.java",
"license": "gpl-2.0",
"size": 6090
} | [
"org.w3c.dom.Node"
] | import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 374,745 |
public Period periodUntil(final DateConstraint other) {
if (equals(other)) {
return Period.ZERO;
} else if (other instanceof PlusMinusPeriodDateConstraint) {
return ((PlusMinusPeriodDateConstraint) other).periodUntil(this).negated();
} else {
throw new IllegalArgumentException(other + " - " + this);
}
} | Period function(final DateConstraint other) { if (equals(other)) { return Period.ZERO; } else if (other instanceof PlusMinusPeriodDateConstraint) { return ((PlusMinusPeriodDateConstraint) other).periodUntil(this).negated(); } else { throw new IllegalArgumentException(other + STR + this); } } | /**
* Approximates the period difference between two constraints, that is the period that must be added to this constraint to get the same value as the other
* one.
*
* @param other
* the other constraint, not null
* @return the difference as a period, not null
* @throws IllegalArgumentException
* if the constraints are not sufficiently compatible
*/ | Approximates the period difference between two constraints, that is the period that must be added to this constraint to get the same value as the other one | periodUntil | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/main/java/com/opengamma/financial/analytics/timeseries/DateConstraint.java",
"license": "apache-2.0",
"size": 18955
} | [
"org.threeten.bp.Period"
] | import org.threeten.bp.Period; | import org.threeten.bp.*; | [
"org.threeten.bp"
] | org.threeten.bp; | 1,202,893 |
HsqlName getSchemaHsqlName(String name) {
return name == null ? currentSchema
: database.schemaManager.getSchemaHsqlName(name);
} | HsqlName getSchemaHsqlName(String name) { return name == null ? currentSchema : database.schemaManager.getSchemaHsqlName(name); } | /**
* If schemaName is null, return the current schema name, else return
* the HsqlName object for the schema. If schemaName does not exist,
* throw.
*/ | If schemaName is null, return the current schema name, else return the HsqlName object for the schema. If schemaName does not exist, throw | getSchemaHsqlName | {
"repo_name": "kumarrus/voltdb",
"path": "src/hsqldb19b3/org/hsqldb_voltpatches/Session.java",
"license": "agpl-3.0",
"size": 60910
} | [
"org.hsqldb_voltpatches.HsqlNameManager"
] | import org.hsqldb_voltpatches.HsqlNameManager; | import org.hsqldb_voltpatches.*; | [
"org.hsqldb_voltpatches"
] | org.hsqldb_voltpatches; | 2,193,126 |
@Named("health_monitor:get")
@GET
@Path("/health_monitors/{id}")
@SelectJson("health_monitor")
@Fallback(NullOnNotFoundOr404.class)
@Nullable
HealthMonitor getHealthMonitor(@PathParam("id") String id); | @Named(STR) @Path(STR) @SelectJson(STR) @Fallback(NullOnNotFoundOr404.class) HealthMonitor getHealthMonitor(@PathParam("id") String id); | /**
* Returns the details for a specific HealthMonitor.
*
* @param id the id of the HealthMonitor to return.
* @return Health Monitor or null if not found.
*/ | Returns the details for a specific HealthMonitor | getHealthMonitor | {
"repo_name": "asankasanjaya/stratos",
"path": "dependencies/jclouds/apis/openstack-neutron/1.8.1-stratos/src/main/java/org/jclouds/openstack/neutron/v2/extensions/lbaas/v1/LBaaSApi.java",
"license": "apache-2.0",
"size": 14416
} | [
"javax.inject.Named",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"org.jclouds.Fallbacks",
"org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor",
"org.jclouds.rest.annotations.Fallback",
"org.jclouds.rest.annotations.SelectJson"
] | import javax.inject.Named; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.jclouds.Fallbacks; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitor; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.SelectJson; | import javax.inject.*; import javax.ws.rs.*; import org.jclouds.*; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.*; import org.jclouds.rest.annotations.*; | [
"javax.inject",
"javax.ws",
"org.jclouds",
"org.jclouds.openstack",
"org.jclouds.rest"
] | javax.inject; javax.ws; org.jclouds; org.jclouds.openstack; org.jclouds.rest; | 2,603,914 |
public Observable<ServiceResponse<Void>> beginStopWithServiceResponseAsync(String resourceGroupName, String jobName) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (jobName == null) {
throw new IllegalArgumentException("Parameter jobName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Void>> function(String resourceGroupName, String jobName) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (jobName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param jobName The name of the streaming job.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/ | Stops a running streaming job. This will cause a running streaming job to stop processing input events and producing output | beginStopWithServiceResponseAsync | {
"repo_name": "hovsepm/azure-sdk-for-java",
"path": "streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java",
"license": "mit",
"size": 143599
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 1,389,133 |
@Test
public void testSlopOnDelayedFailingAsyncPut_2_1_1() {
String key = "a";
String val = "xyz";
Versioned<byte[]> versionedVal = new Versioned<byte[]>(val.getBytes());
ByteArray keyByteArray = new ByteArray(key.getBytes());
List<Integer> failingNodeIdList = null;
// Set the correct replication config
REPLICATION_FACTOR = 2;
P_READS = 1;
R_READS = 1;
P_WRITES = 1;
R_WRITES = 1;
try {
failingNodeIdList = customSetup(keyByteArray);
} catch(Exception e) {
logger.info(e.getMessage());
fail("Error in setup.");
}
this.store.put(keyByteArray, versionedVal, null);
// Check the slop stores
Set<ByteArray> failedKeys = Sets.newHashSet();
failedKeys.add(keyByteArray);
Set<ByteArray> slopKeys = makeSlopKeys(keyByteArray, failingNodeIdList);
Set<Slop> registeredSlops = getAllSlops(slopKeys);
if(registeredSlops.size() == 0) {
fail("Should have seen some slops. But could not find any.");
} else if(registeredSlops.size() != 1) {
fail("Number of slops registered != 1");
}
} | void function() { String key = "a"; String val = "xyz"; Versioned<byte[]> versionedVal = new Versioned<byte[]>(val.getBytes()); ByteArray keyByteArray = new ByteArray(key.getBytes()); List<Integer> failingNodeIdList = null; REPLICATION_FACTOR = 2; P_READS = 1; R_READS = 1; P_WRITES = 1; R_WRITES = 1; try { failingNodeIdList = customSetup(keyByteArray); } catch(Exception e) { logger.info(e.getMessage()); fail(STR); } this.store.put(keyByteArray, versionedVal, null); Set<ByteArray> failedKeys = Sets.newHashSet(); failedKeys.add(keyByteArray); Set<ByteArray> slopKeys = makeSlopKeys(keyByteArray, failingNodeIdList); Set<Slop> registeredSlops = getAllSlops(slopKeys); if(registeredSlops.size() == 0) { fail(STR); } else if(registeredSlops.size() != 1) { fail(STR); } } | /**
* Test to ensure that when an asynchronous put completes (with a failure)
* after PerformParallelPut has finished processing the responses and before
* the hinted handoff actually begins, a slop is still registered for the
* same.
*
* This is for the 2-1-1 configuration.
*/ | Test to ensure that when an asynchronous put completes (with a failure) after PerformParallelPut has finished processing the responses and before the hinted handoff actually begins, a slop is still registered for the same. This is for the 2-1-1 configuration | testSlopOnDelayedFailingAsyncPut_2_1_1 | {
"repo_name": "medallia/voldemort",
"path": "test/unit/voldemort/store/routed/HintedHandoffFailureTest.java",
"license": "apache-2.0",
"size": 35706
} | [
"com.google.common.collect.Sets",
"java.util.List",
"java.util.Set",
"org.junit.Assert"
] | import com.google.common.collect.Sets; import java.util.List; import java.util.Set; import org.junit.Assert; | import com.google.common.collect.*; import java.util.*; import org.junit.*; | [
"com.google.common",
"java.util",
"org.junit"
] | com.google.common; java.util; org.junit; | 866,668 |
ArtifactRoot getCoverageMetadataDirectory() {
return coverageDirectory;
} | ArtifactRoot getCoverageMetadataDirectory() { return coverageDirectory; } | /**
* Returns the directory where coverage-related artifacts and metadata files should be stored.
* This includes for example uninstrumented class files needed for Jacoco's coverage reporting
* tools.
*/ | Returns the directory where coverage-related artifacts and metadata files should be stored. This includes for example uninstrumented class files needed for Jacoco's coverage reporting tools | getCoverageMetadataDirectory | {
"repo_name": "aehlig/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/config/OutputDirectories.java",
"license": "apache-2.0",
"size": 10313
} | [
"com.google.devtools.build.lib.actions.ArtifactRoot"
] | import com.google.devtools.build.lib.actions.ArtifactRoot; | import com.google.devtools.build.lib.actions.*; | [
"com.google.devtools"
] | com.google.devtools; | 958,337 |
@Test
public final void testSetRFDataNullData() {
// Setup the resources for the test.
byte[] origData = new byte[]{0x68, 0x6F, 0x6C, 0x61};
byte[] data = null;
GenericXBeePacket packet = new GenericXBeePacket(origData);
// Call the method under test.
packet.setRFData(data);
byte[] result = packet.getRFData();
// Verify the result.
assertThat("RF Data must be the same", result, is(equalTo(data)));
assertThat("RF Data must be null", result, is(nullValue(byte[].class)));
}
| final void function() { byte[] origData = new byte[]{0x68, 0x6F, 0x6C, 0x61}; byte[] data = null; GenericXBeePacket packet = new GenericXBeePacket(origData); packet.setRFData(data); byte[] result = packet.getRFData(); assertThat(STR, result, is(equalTo(data))); assertThat(STR, result, is(nullValue(byte[].class))); } | /**
* Test method for {@link com.digi.xbee.api.packet.GenericXBeePacket#setRFData(byte[])}.
*/ | Test method for <code>com.digi.xbee.api.packet.GenericXBeePacket#setRFData(byte[])</code> | testSetRFDataNullData | {
"repo_name": "brucetsao/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/packet/GenericXBeePacketTest.java",
"license": "mpl-2.0",
"size": 13989
} | [
"com.digi.xbee.api.packet.GenericXBeePacket",
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import com.digi.xbee.api.packet.GenericXBeePacket; import org.hamcrest.core.Is; import org.junit.Assert; | import com.digi.xbee.api.packet.*; import org.hamcrest.core.*; import org.junit.*; | [
"com.digi.xbee",
"org.hamcrest.core",
"org.junit"
] | com.digi.xbee; org.hamcrest.core; org.junit; | 759,999 |
@SuppressWarnings("unchecked")
private static Map<String, String> getCurrentUsers(HttpSession httpSession) {
Map<String, String> currentUsers = (Map<String, String>) httpSession.getServletContext().getAttribute(
WebConstants.CURRENT_USERS);
if (currentUsers == null) {
currentUsers = init(httpSession.getServletContext());
}
return currentUsers;
}
| @SuppressWarnings(STR) static Map<String, String> function(HttpSession httpSession) { Map<String, String> currentUsers = (Map<String, String>) httpSession.getServletContext().getAttribute( WebConstants.CURRENT_USERS); if (currentUsers == null) { currentUsers = init(httpSession.getServletContext()); } return currentUsers; } | /**
* Get the current list of map of users stored in the session
*
* @param httpSession the current session
* @return map of users logged in
*/ | Get the current list of map of users stored in the session | getCurrentUsers | {
"repo_name": "Bhamni/openmrs-core",
"path": "web/src/main/java/org/openmrs/web/user/CurrentUsers.java",
"license": "mpl-2.0",
"size": 3697
} | [
"java.util.Map",
"javax.servlet.http.HttpSession",
"org.openmrs.web.WebConstants"
] | import java.util.Map; import javax.servlet.http.HttpSession; import org.openmrs.web.WebConstants; | import java.util.*; import javax.servlet.http.*; import org.openmrs.web.*; | [
"java.util",
"javax.servlet",
"org.openmrs.web"
] | java.util; javax.servlet; org.openmrs.web; | 1,451,739 |
boolean buildCompleted = true;
// Use Rhino's global object's as prototype for top scope because
// logger.js assumes access to "print" function.
Global global = new Global();
Context cx = ContextFactory.getGlobal().enterContext();
global.init(cx);
// Set up standard scripts objects
Scriptable topScope = cx.initStandardObjects(global);
// Enforce conversion of the Java string arguments array to JavaScript native versions.
// Leaving this as true, causes issues in the build scripts.
cx.getWrapFactory().setJavaPrimitiveWrap(false);
// Rhino may throw a number of exceptions due to a variety of the build errors, use generic catch to
// get details and store for access.
try {
String moduleLoaderScript = readModuleLoaderSource();
Script moduleLoader = cx.compileString(moduleLoaderScript, "moduleLoader", 1, null);
// Pretend these arguments came from the command line by stuffing them into the top context,
// module loader expects to read them from here.
ScriptableObject.putConstProperty(topScope, "arguments", getBuildScriptArguments());
// Execute the build system scripts to generate optimised dojo builds
moduleLoader.exec(cx, topScope);
} catch (Exception buildError) {
buildCompleted = false;
this.buildError = buildError;
}
return buildCompleted;
}
| boolean buildCompleted = true; Global global = new Global(); Context cx = ContextFactory.getGlobal().enterContext(); global.init(cx); Scriptable topScope = cx.initStandardObjects(global); cx.getWrapFactory().setJavaPrimitiveWrap(false); try { String moduleLoaderScript = readModuleLoaderSource(); Script moduleLoader = cx.compileString(moduleLoaderScript, STR, 1, null); ScriptableObject.putConstProperty(topScope, STR, getBuildScriptArguments()); moduleLoader.exec(cx, topScope); } catch (Exception buildError) { buildCompleted = false; this.buildError = buildError; } return buildCompleted; } | /**
* Initiate the build process for the profile given. Will try to execute
* the JS build system scripts for this profile, reporting whether it
* executed successfully.
*
* @return Build completed successfully
*/ | Initiate the build process for the profile given. Will try to execute the JS build system scripts for this profile, reporting whether it executed successfully | executeBuild | {
"repo_name": "aguadev/aguadev",
"path": "html/dojo-1.8.3/dwb/src/main/java/org/dtk/resources/build/ProfileBuilder.java",
"license": "mit",
"size": 5850
} | [
"org.mozilla.javascript.Context",
"org.mozilla.javascript.ContextFactory",
"org.mozilla.javascript.Script",
"org.mozilla.javascript.Scriptable",
"org.mozilla.javascript.ScriptableObject",
"org.mozilla.javascript.tools.shell.Global"
] | import org.mozilla.javascript.Context; import org.mozilla.javascript.ContextFactory; import org.mozilla.javascript.Script; import org.mozilla.javascript.Scriptable; import org.mozilla.javascript.ScriptableObject; import org.mozilla.javascript.tools.shell.Global; | import org.mozilla.javascript.*; import org.mozilla.javascript.tools.shell.*; | [
"org.mozilla.javascript"
] | org.mozilla.javascript; | 2,886,955 |
public CognitiveServicesAccountCreateParameters withTags(Map<String, String> tags) {
this.tags = tags;
return this;
} | CognitiveServicesAccountCreateParameters function(Map<String, String> tags) { this.tags = tags; return this; } | /**
* Set the tags value.
*
* @param tags the tags value to set
* @return the CognitiveServicesAccountCreateParameters object itself.
*/ | Set the tags value | withTags | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/cognitiveservices/mgmt-v2017_04_18/src/main/java/com/microsoft/azure/management/cognitiveservices/v2017_04_18/CognitiveServicesAccountCreateParameters.java",
"license": "mit",
"size": 4537
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 972,963 |
void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final HRegionInfo regionInfo, final boolean force) throws IOException; | void postUnassign(final ObserverContext<MasterCoprocessorEnvironment> ctx, final HRegionInfo regionInfo, final boolean force) throws IOException; | /**
* Called after the region unassignment has been requested.
* @param ctx the environment to interact with the framework and master
* @param regionInfo
* @param force whether to force unassignment or not
*/ | Called after the region unassignment has been requested | postUnassign | {
"repo_name": "daidong/DominoHBase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java",
"license": "apache-2.0",
"size": 21042
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.HRegionInfo"
] | import java.io.IOException; import org.apache.hadoop.hbase.HRegionInfo; | import java.io.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 459,994 |
protected void addTestHooks(BaseTestResult result) {
result.addSkipCheck(new MinAndroidSdkLevelSkipCheck());
result.addSkipCheck(new RestrictionSkipCheck(getTargetContext()));
result.addSkipCheck(new DisableIfSkipCheck());
} | void function(BaseTestResult result) { result.addSkipCheck(new MinAndroidSdkLevelSkipCheck()); result.addSkipCheck(new RestrictionSkipCheck(getTargetContext())); result.addSkipCheck(new DisableIfSkipCheck()); } | /**
* Override this method to register hooks and checks to be run for each test. Make sure to call
* the base implementation if you do so.
*
* @see BaseTestResult#addSkipCheck(BaseTestResult.SkipCheck)
* @see BaseTestResult#addPreTestHook(BaseTestResult.PreTestHook)
*/ | Override this method to register hooks and checks to be run for each test. Make sure to call the base implementation if you do so | addTestHooks | {
"repo_name": "danakj/chromium",
"path": "base/test/android/javatests/src/org/chromium/base/test/BaseInstrumentationTestRunner.java",
"license": "bsd-3-clause",
"size": 2669
} | [
"org.chromium.base.test.util.DisableIfSkipCheck",
"org.chromium.base.test.util.MinAndroidSdkLevelSkipCheck",
"org.chromium.base.test.util.RestrictionSkipCheck"
] | import org.chromium.base.test.util.DisableIfSkipCheck; import org.chromium.base.test.util.MinAndroidSdkLevelSkipCheck; import org.chromium.base.test.util.RestrictionSkipCheck; | import org.chromium.base.test.util.*; | [
"org.chromium.base"
] | org.chromium.base; | 1,362,317 |
void customize(EntityManagerFactoryBuilder builder); | void customize(EntityManagerFactoryBuilder builder); | /**
* Customize the given {@code builder}.
* @param builder the builder to customize
*/ | Customize the given builder | customize | {
"repo_name": "lburgazzoli/spring-boot",
"path": "spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/EntityManagerFactoryBuilderCustomizer.java",
"license": "apache-2.0",
"size": 1146
} | [
"org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder"
] | import org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder; | import org.springframework.boot.orm.jpa.*; | [
"org.springframework.boot"
] | org.springframework.boot; | 1,539,379 |
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void createTestDataInNewTransactionWithCheckedException(TestData testData)
throws TestJPAServiceException
{
createTestData(testData);
throw new TestJPAServiceException("Failed with a checked exception in a new transaction");
} | @Transactional(propagation = Propagation.REQUIRES_NEW) void function(TestData testData) throws TestJPAServiceException { createTestData(testData); throw new TestJPAServiceException(STR); } | /**
* Create the test data in a new transaction with a checked exception.
*
* @param testData the test data
*/ | Create the test data in a new transaction with a checked exception | createTestDataInNewTransactionWithCheckedException | {
"repo_name": "marcusportmann/mmp-java",
"path": "src/mmp-application/src/test/java/guru/mmp/application/test/TestJPAService.java",
"license": "apache-2.0",
"size": 6056
} | [
"org.springframework.transaction.annotation.Propagation",
"org.springframework.transaction.annotation.Transactional"
] | import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; | import org.springframework.transaction.annotation.*; | [
"org.springframework.transaction"
] | org.springframework.transaction; | 1,346,740 |
@Type(type="org.jadira.usertype.dateandtime.threeten.PersistentLocalDateTime")
@Basic( optional = true )
@Column( name = "date_created" )
public LocalDateTime getDateCreated() {
return this.dateCreated;
} | @Type(type=STR) @Basic( optional = true ) @Column( name = STR ) LocalDateTime function() { return this.dateCreated; } | /**
* Return the value associated with the column: dateCreated.
* @return A LocalDateTime object (this.dateCreated)
*/ | Return the value associated with the column: dateCreated | getDateCreated | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "bed-inventory/src/main/java/com/servinglynk/hmis/entity/ClientEntity.java",
"license": "mpl-2.0",
"size": 5955
} | [
"java.time.LocalDateTime",
"javax.persistence.Basic",
"javax.persistence.Column",
"org.hibernate.annotations.Type"
] | import java.time.LocalDateTime; import javax.persistence.Basic; import javax.persistence.Column; import org.hibernate.annotations.Type; | import java.time.*; import javax.persistence.*; import org.hibernate.annotations.*; | [
"java.time",
"javax.persistence",
"org.hibernate.annotations"
] | java.time; javax.persistence; org.hibernate.annotations; | 1,387,909 |
public String cpfAsText(CpfOptions options) {
long cpf = cpf();
String unmasked = new DecimalFormat("00000000000").format(cpf);
switch (options) {
case masked:
return Cpf.format(unmasked);
case unmasked:
return unmasked;
default:
throw new AssertionError();
}
} | String function(CpfOptions options) { long cpf = cpf(); String unmasked = new DecimalFormat(STR).format(cpf); switch (options) { case masked: return Cpf.format(unmasked); case unmasked: return unmasked; default: throw new AssertionError(); } } | /**
* Return a random valid Brazilian CPF, either unmasked (00000000000) or
* masked (000.000.000-00).
* <pre>
* chance.cpfAsText(CpfOptions.masked);
* => "506.385.808-20"
* chance.cpfAsText(CpfOptions.ummasked);
* => "50638580820"
* </pre>
*
* @param options Masked or unmasked CPF
* @return A random valid CPF
*/ | Return a random valid Brazilian CPF, either unmasked (00000000000) or masked (000.000.000-00). <code> chance.cpfAsText(CpfOptions.masked); => "506.385.808-20" chance.cpfAsText(CpfOptions.ummasked); => "50638580820" </code> | cpfAsText | {
"repo_name": "open-fidias/chance4j",
"path": "src/main/java/br/com/fidias/chance4j/Chance.java",
"license": "gpl-3.0",
"size": 58799
} | [
"br.com.fidias.chance4j.person.Cpf",
"br.com.fidias.chance4j.person.CpfOptions",
"java.text.DecimalFormat"
] | import br.com.fidias.chance4j.person.Cpf; import br.com.fidias.chance4j.person.CpfOptions; import java.text.DecimalFormat; | import br.com.fidias.chance4j.person.*; import java.text.*; | [
"br.com.fidias",
"java.text"
] | br.com.fidias; java.text; | 750,778 |
protected androidx.media2.common.MediaMetadata getMetadata(MediaItem exoPlayerMediaItem) {
@Nullable CharSequence title = exoPlayerMediaItem.mediaMetadata.title;
androidx.media2.common.MediaMetadata.Builder metadataBuilder =
new androidx.media2.common.MediaMetadata.Builder()
.putString(METADATA_KEY_MEDIA_ID, exoPlayerMediaItem.mediaId);
if (title != null) {
metadataBuilder.putString(METADATA_KEY_TITLE, title.toString());
metadataBuilder.putString(METADATA_KEY_DISPLAY_TITLE, title.toString());
}
return metadataBuilder.build();
} | androidx.media2.common.MediaMetadata function(MediaItem exoPlayerMediaItem) { @Nullable CharSequence title = exoPlayerMediaItem.mediaMetadata.title; androidx.media2.common.MediaMetadata.Builder metadataBuilder = new androidx.media2.common.MediaMetadata.Builder() .putString(METADATA_KEY_MEDIA_ID, exoPlayerMediaItem.mediaId); if (title != null) { metadataBuilder.putString(METADATA_KEY_TITLE, title.toString()); metadataBuilder.putString(METADATA_KEY_DISPLAY_TITLE, title.toString()); } return metadataBuilder.build(); } | /**
* Returns a {@link androidx.media2.common.MediaMetadata} corresponding to the given {@link
* MediaItem ExoPlayer MediaItem}.
*/ | Returns a <code>androidx.media2.common.MediaMetadata</code> corresponding to the given <code>MediaItem ExoPlayer MediaItem</code> | getMetadata | {
"repo_name": "google/ExoPlayer",
"path": "extensions/media2/src/main/java/com/google/android/exoplayer2/ext/media2/DefaultMediaItemConverter.java",
"license": "apache-2.0",
"size": 5722
} | [
"androidx.annotation.Nullable",
"com.google.android.exoplayer2.MediaItem",
"com.google.android.exoplayer2.MediaMetadata"
] | import androidx.annotation.Nullable; import com.google.android.exoplayer2.MediaItem; import com.google.android.exoplayer2.MediaMetadata; | import androidx.annotation.*; import com.google.android.exoplayer2.*; | [
"androidx.annotation",
"com.google.android"
] | androidx.annotation; com.google.android; | 1,198,668 |
public static Set<String> getCountEnabledUserStores() throws UserStoreCounterException {
RealmConfiguration realmConfiguration;
Set<String> userStoreList = new HashSet<>();
try {
realmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration();
while (realmConfiguration != null) {
if (!Boolean.valueOf(realmConfiguration.getUserStoreProperty(
UserCoreConstants.RealmConfig.USER_STORE_DISABLED))) {
if (StringUtils.isNotEmpty(realmConfiguration.getUserStoreProperty(countRetrieverClass))) {
userStoreList.add(realmConfiguration
.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME));
}
}
realmConfiguration = realmConfiguration.getSecondaryRealmConfig();
}
} catch (UserStoreException e) {
throw new UserStoreCounterException("Error while getting the count enabled user stores", e);
}
return userStoreList;
} | static Set<String> function() throws UserStoreCounterException { RealmConfiguration realmConfiguration; Set<String> userStoreList = new HashSet<>(); try { realmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration(); while (realmConfiguration != null) { if (!Boolean.valueOf(realmConfiguration.getUserStoreProperty( UserCoreConstants.RealmConfig.USER_STORE_DISABLED))) { if (StringUtils.isNotEmpty(realmConfiguration.getUserStoreProperty(countRetrieverClass))) { userStoreList.add(realmConfiguration .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME)); } } realmConfiguration = realmConfiguration.getSecondaryRealmConfig(); } } catch (UserStoreException e) { throw new UserStoreCounterException(STR, e); } return userStoreList; } | /**
* Get the domain names of user stores which has count functionality enabled
*
* @return
*/ | Get the domain names of user stores which has count functionality enabled | getCountEnabledUserStores | {
"repo_name": "PasinduTennage/carbon-identity-framework",
"path": "components/user-store/org.wso2.carbon.identity.user.store.count/src/main/java/org/wso2/carbon/identity/user/store/count/util/UserStoreCountUtils.java",
"license": "apache-2.0",
"size": 9797
} | [
"java.util.HashSet",
"java.util.Set",
"org.apache.commons.lang.StringUtils",
"org.wso2.carbon.context.CarbonContext",
"org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException",
"org.wso2.carbon.user.api.RealmConfiguration",
"org.wso2.carbon.user.api.UserStoreException",
"org.wso2... | import java.util.HashSet; import java.util.Set; import org.apache.commons.lang.StringUtils; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.identity.user.store.count.exception.UserStoreCounterException; import org.wso2.carbon.user.api.RealmConfiguration; import org.wso2.carbon.user.api.UserStoreException; import org.wso2.carbon.user.core.UserCoreConstants; | import java.util.*; import org.apache.commons.lang.*; import org.wso2.carbon.context.*; import org.wso2.carbon.identity.user.store.count.exception.*; import org.wso2.carbon.user.api.*; import org.wso2.carbon.user.core.*; | [
"java.util",
"org.apache.commons",
"org.wso2.carbon"
] | java.util; org.apache.commons; org.wso2.carbon; | 2,109,449 |
@PublicAPI(usage = ACCESS)
CONJUNCTION haveNameStartingWith(String prefix); | @PublicAPI(usage = ACCESS) CONJUNCTION haveNameStartingWith(String prefix); | /**
* Matches members with a name starting with the specified prefix.
*
* @param prefix A prefix the member name should start with
* @return A syntax conjunction element, which can be completed to form a full rule
*/ | Matches members with a name starting with the specified prefix | haveNameStartingWith | {
"repo_name": "TNG/ArchUnit",
"path": "archunit/src/main/java/com/tngtech/archunit/lang/syntax/elements/MembersThat.java",
"license": "apache-2.0",
"size": 18147
} | [
"com.tngtech.archunit.PublicAPI"
] | import com.tngtech.archunit.PublicAPI; | import com.tngtech.archunit.*; | [
"com.tngtech.archunit"
] | com.tngtech.archunit; | 95,376 |
public void initialize() {
super.initialize();
services = new HashMap(serializable + 1);
bcsListeners = new ArrayList(1);
} | void function() { super.initialize(); services = new HashMap(serializable + 1); bcsListeners = new ArrayList(1); } | /**
* called by BeanContextSupport superclass during construction and
* deserialization to initialize subclass transient state.
*
* subclasses may envelope this method, but should not override it or
* call it directly.
*/ | called by BeanContextSupport superclass during construction and deserialization to initialize subclass transient state. subclasses may envelope this method, but should not override it or call it directly | initialize | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/java/beans/beancontext/BeanContextServicesSupport.java",
"license": "mit",
"size": 42459
} | [
"java.util.ArrayList",
"java.util.HashMap"
] | import java.util.ArrayList; import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,053,949 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.