method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Servlet getServletInstance()
{
return _servlet;
} | Servlet function() { return _servlet; } | /** Get the servlet instance (no initialization done).
* @return The servlet or null
*/ | Get the servlet instance (no initialization done) | getServletInstance | {
"repo_name": "sdw2330976/Research-jetty-9.2.5",
"path": "jetty-servlet/src/main/java/org/eclipse/jetty/servlet/ServletHolder.java",
"license": "apache-2.0",
"size": 38588
} | [
"javax.servlet.Servlet"
] | import javax.servlet.Servlet; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 1,922,349 |
public static final Vector2 getAreaWeightedCenter(Vector2... points) {
// check for null array
if (points == null) throw new NullPointerException(Messages.getString("geometry.nullPointArray"));
// get the size
int size = points.length;
// check for empty array
if (size == 0) throw new IllegalArgumentException(Messages.getString("geometry.invalidSizePointArray1"));
// check for array of one point
if (size == 1) {
Vector2 p = points[0];
// check for null
if (p == null) throw new NullPointerException(Messages.getString("geometry.nullPointArrayElements"));
return p.copy();
}
// otherwise perform the computation
// get the average center
Vector2 ac = new Vector2();
for (int i = 0; i < size; i++) {
Vector2 p = points[i];
// check for null
if (p == null) throw new NullPointerException(Messages.getString("geometry.nullPointArrayElements"));
ac.add(p);
}
ac.multiply(1.0 / size);
Vector2 center = new Vector2();
double area = 0.0;
// loop through the vertices
for (int i = 0; i < size; i++) {
// get two verticies
Vector2 p1 = points[i];
Vector2 p2 = i + 1 < size ? points[i + 1] : points[0];
p1 = p1.difference(ac);
p2 = p2.difference(ac);
// perform the cross product (yi * x(i+1) - y(i+1) * xi)
double d = p1.cross(p2);
// multiply by half
double triangleArea = 0.5 * d;
// add it to the total area
area += triangleArea;
// area weighted centroid
// (p1 + p2) * (D / 3)
// = (x1 + x2) * (yi * x(i+1) - y(i+1) * xi) / 3
// we will divide by the total area later
center.add(p1.add(p2).multiply(INV_3).multiply(triangleArea));
}
// check for zero area
if (Math.abs(area) <= Epsilon.E) {
// zero area can only happen if all the points are the same point
// in which case just return a copy of the first
return points[0].copy();
}
// finish the centroid calculation by dividing by the total area
center.multiply(1.0 / area);
center.add(ac);
// return the center
return center;
} | static final Vector2 function(Vector2... points) { if (points == null) throw new NullPointerException(Messages.getString(STR)); int size = points.length; if (size == 0) throw new IllegalArgumentException(Messages.getString(STR)); if (size == 1) { Vector2 p = points[0]; if (p == null) throw new NullPointerException(Messages.getString(STR)); return p.copy(); } Vector2 ac = new Vector2(); for (int i = 0; i < size; i++) { Vector2 p = points[i]; if (p == null) throw new NullPointerException(Messages.getString(STR)); ac.add(p); } ac.multiply(1.0 / size); Vector2 center = new Vector2(); double area = 0.0; for (int i = 0; i < size; i++) { Vector2 p1 = points[i]; Vector2 p2 = i + 1 < size ? points[i + 1] : points[0]; p1 = p1.difference(ac); p2 = p2.difference(ac); double d = p1.cross(p2); double triangleArea = 0.5 * d; area += triangleArea; center.add(p1.add(p2).multiply(INV_3).multiply(triangleArea)); } if (Math.abs(area) <= Epsilon.E) { return points[0].copy(); } center.multiply(1.0 / area); center.add(ac); return center; } | /**
* Returns the area weighted centroid for the given points.
* @see #getAreaWeightedCenter(List)
* @param points the {@link Polygon} points
* @return {@link Vector2} the area weighted centroid
* @throws NullPointerException if points is null or an element of points is null
* @throws IllegalArgumentException if points is empty
*/ | Returns the area weighted centroid for the given points | getAreaWeightedCenter | {
"repo_name": "dmitrykolesnikovich/dyn4j",
"path": "src/org/dyn4j/geometry/Geometry.java",
"license": "bsd-3-clause",
"size": 69307
} | [
"org.dyn4j.Epsilon",
"org.dyn4j.resources.Messages"
] | import org.dyn4j.Epsilon; import org.dyn4j.resources.Messages; | import org.dyn4j.*; import org.dyn4j.resources.*; | [
"org.dyn4j",
"org.dyn4j.resources"
] | org.dyn4j; org.dyn4j.resources; | 2,377,064 |
private static void addError(List<AclPortStats> lstAclPortStats, AclPortStatsBuilder aclStatsBuilder,
String errMsg) {
aclStatsBuilder.setError(new ErrorBuilder().setErrorMessage(errMsg).build());
lstAclPortStats.add(aclStatsBuilder.build());
} | static void function(List<AclPortStats> lstAclPortStats, AclPortStatsBuilder aclStatsBuilder, String errMsg) { aclStatsBuilder.setError(new ErrorBuilder().setErrorMessage(errMsg).build()); lstAclPortStats.add(aclStatsBuilder.build()); } | /**
* Adds the error.
*
* @param lstAclPortStats the lst acl port stats
* @param aclStatsBuilder the acl stats builder
* @param errMsg the error message
*/ | Adds the error | addError | {
"repo_name": "opendaylight/netvirt",
"path": "aclservice/impl/src/main/java/org/opendaylight/netvirt/aclservice/stats/AclLiveStatisticsHelper.java",
"license": "epl-1.0",
"size": 17939
} | [
"java.util.List",
"org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats",
"org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStatsBuilder",
"org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.ErrorBuilder"
] | import java.util.List; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStatsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.ErrorBuilder; | import java.util.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.*; | [
"java.util",
"org.opendaylight.yang"
] | java.util; org.opendaylight.yang; | 2,565,702 |
public static void generate(ConfigurationImpl configuration) {
PackageIndexFrameWriter packgen;
DocPath filename = DocPaths.OVERVIEW_FRAME;
try {
packgen = new PackageIndexFrameWriter(configuration, filename);
packgen.buildPackageIndexFile("doclet.Window_Overview", false);
} catch (IOException exc) {
Messages messages = configuration.getMessages();
messages.error("doclet.exception_encountered",
exc.toString(), filename);
throw new DocletAbortException(exc);
}
}
/**
* {@inheritDoc} | static void function(ConfigurationImpl configuration) { PackageIndexFrameWriter packgen; DocPath filename = DocPaths.OVERVIEW_FRAME; try { packgen = new PackageIndexFrameWriter(configuration, filename); packgen.buildPackageIndexFile(STR, false); } catch (IOException exc) { Messages messages = configuration.getMessages(); messages.error(STR, exc.toString(), filename); throw new DocletAbortException(exc); } } /** * {@inheritDoc} | /**
* Generate the package index file named "overview-frame.html".
* @throws DocletAbortException
*/ | Generate the package index file named "overview-frame.html" | generate | {
"repo_name": "FauxFaux/jdk9-langtools",
"path": "src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/PackageIndexFrameWriter.java",
"license": "gpl-2.0",
"size": 7397
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 393,422 |
public static void main(String[] args) {
JFrame frame = new JFrame();
Container content = frame.getContentPane();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
content.add(new TreeLayoutDemo());
frame.pack();
frame.setVisible(true);
} | static void function(String[] args) { JFrame frame = new JFrame(); Container content = frame.getContentPane(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); content.add(new TreeLayoutDemo()); frame.pack(); frame.setVisible(true); } | /**
* a driver for this demo
*/ | a driver for this demo | main | {
"repo_name": "echalkpad/t4f-data",
"path": "graph/jung/src/main/java/io/datalayer/jung/TreeLayoutDemo.java",
"license": "apache-2.0",
"size": 9417
} | [
"java.awt.Container",
"javax.swing.JFrame"
] | import java.awt.Container; import javax.swing.JFrame; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 401,359 |
protected void doResponseHeaders(HttpServletResponse response, Resource resource, String mimeType)
{
if (mimeType!=null)
response.setContentType(mimeType);
long length=resource.length();
if (response instanceof Response)
{
HttpFields fields = ((Response)response).getHttpFields();
if (length>0)
fields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER,length);
if (_cacheControl!=null)
fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl);
}
else
{
if (length>0)
response.setHeader(HttpHeaders.CONTENT_LENGTH,Long.toString(length));
if (_cacheControl!=null)
response.setHeader(HttpHeaders.CACHE_CONTROL,_cacheControl.toString());
}
} | void function(HttpServletResponse response, Resource resource, String mimeType) { if (mimeType!=null) response.setContentType(mimeType); long length=resource.length(); if (response instanceof Response) { HttpFields fields = ((Response)response).getHttpFields(); if (length>0) fields.putLongField(HttpHeaders.CONTENT_LENGTH_BUFFER,length); if (_cacheControl!=null) fields.put(HttpHeaders.CACHE_CONTROL_BUFFER,_cacheControl); } else { if (length>0) response.setHeader(HttpHeaders.CONTENT_LENGTH,Long.toString(length)); if (_cacheControl!=null) response.setHeader(HttpHeaders.CACHE_CONTROL,_cacheControl.toString()); } } | /** Set the response headers.
* This method is called to set the response headers such as content type and content length.
* May be extended to add additional headers.
* @param response
* @param resource
* @param mimeType
*/ | Set the response headers. This method is called to set the response headers such as content type and content length. May be extended to add additional headers | doResponseHeaders | {
"repo_name": "jamiepg1/jetty.project",
"path": "jetty-server/src/main/java/org/eclipse/jetty/server/handler/ResourceHandler.java",
"license": "apache-2.0",
"size": 15803
} | [
"javax.servlet.http.HttpServletResponse",
"org.eclipse.jetty.http.HttpFields",
"org.eclipse.jetty.http.HttpHeaders",
"org.eclipse.jetty.server.Response",
"org.eclipse.jetty.util.resource.Resource"
] | import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.http.HttpFields; import org.eclipse.jetty.http.HttpHeaders; import org.eclipse.jetty.server.Response; import org.eclipse.jetty.util.resource.Resource; | import javax.servlet.http.*; import org.eclipse.jetty.http.*; import org.eclipse.jetty.server.*; import org.eclipse.jetty.util.resource.*; | [
"javax.servlet",
"org.eclipse.jetty"
] | javax.servlet; org.eclipse.jetty; | 1,455,576 |
static class Allocator implements TypeAllocator<MastersType> {
public MastersType newInstance(String elementName, ComplexDataType parent) {
return new MastersType(elementName, parent);
}
}
private static Allocator allocator = new Allocator();
| static class Allocator implements TypeAllocator<MastersType> { MastersType function(String elementName, ComplexDataType parent) { return new MastersType(elementName, parent); } } private static Allocator allocator = new Allocator(); | /**
* method for getting a new instance of type MastersType.
*
* @param elementName the name of the originating XML tag
* @param parent the parent data
* @return new instance
*/ | method for getting a new instance of type MastersType | newInstance | {
"repo_name": "lolkedijkstra/xml2j-gen",
"path": "samples/discogs/masters_rd/src/main/java/com/xml2j/discogs/masters_rd/MastersType.java",
"license": "mit",
"size": 3614
} | [
"com.xml2j.xml.core.ComplexDataType",
"com.xml2j.xml.core.TypeAllocator"
] | import com.xml2j.xml.core.ComplexDataType; import com.xml2j.xml.core.TypeAllocator; | import com.xml2j.xml.core.*; | [
"com.xml2j.xml"
] | com.xml2j.xml; | 281,506 |
public static Event debug(@Nullable Location location, String message) {
return new Event(EventKind.DEBUG, location, message, null);
} | static Event function(@Nullable Location location, String message) { return new Event(EventKind.DEBUG, location, message, null); } | /**
* Reports a debug message.
*/ | Reports a debug message | debug | {
"repo_name": "dropbox/bazel",
"path": "src/main/java/com/google/devtools/build/lib/events/Event.java",
"license": "apache-2.0",
"size": 6700
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,531,966 |
public IndexPrice getIndex() {
return _index;
} | IndexPrice function() { return _index; } | /**
* Gets the Ibor index for which the volatility is valid.
* @return The index.
*/ | Gets the Ibor index for which the volatility is valid | getIndex | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/model/option/parameters/BlackSmileCapInflationZeroCouponParameters.java",
"license": "apache-2.0",
"size": 7781
} | [
"com.opengamma.analytics.financial.instrument.index.IndexPrice"
] | import com.opengamma.analytics.financial.instrument.index.IndexPrice; | import com.opengamma.analytics.financial.instrument.index.*; | [
"com.opengamma.analytics"
] | com.opengamma.analytics; | 565,770 |
public DateTimeFormatterBuilder appendFixedDecimal(
DateTimeFieldType fieldType, int numDigits) {
if (fieldType == null) {
throw new IllegalArgumentException("Field type must not be null");
}
if (numDigits <= 0) {
throw new IllegalArgumentException("Illegal number of digits: " + numDigits);
}
return append0(new FixedNumber(fieldType, numDigits, false));
} | DateTimeFormatterBuilder function( DateTimeFieldType fieldType, int numDigits) { if (fieldType == null) { throw new IllegalArgumentException(STR); } if (numDigits <= 0) { throw new IllegalArgumentException(STR + numDigits); } return append0(new FixedNumber(fieldType, numDigits, false)); } | /**
* Instructs the printer to emit a field value as a fixed-width decimal
* number (smaller numbers will be left-padded with zeros), and the parser
* to expect an unsigned decimal number with the same fixed width.
*
* @param fieldType type of field to append
* @param numDigits the exact number of digits to parse or print, except if
* printed value requires more digits
* @return this DateTimeFormatterBuilder, for chaining
* @throws IllegalArgumentException if field type is null or if <code>numDigits <= 0</code>
* @since 1.5
*/ | Instructs the printer to emit a field value as a fixed-width decimal number (smaller numbers will be left-padded with zeros), and the parser to expect an unsigned decimal number with the same fixed width | appendFixedDecimal | {
"repo_name": "aparo/scalajs-joda",
"path": "src/main/scala/org/joda/time/format/DateTimeFormatterBuilder.java",
"license": "apache-2.0",
"size": 99092
} | [
"org.joda.time.DateTimeFieldType"
] | import org.joda.time.DateTimeFieldType; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,020,204 |
public void setConfigMaster(ConfigMaster configMaster) {
JodaBeanUtils.notNull(configMaster, "configMaster");
this._configMaster = configMaster;
} | void function(ConfigMaster configMaster) { JodaBeanUtils.notNull(configMaster, STR); this._configMaster = configMaster; } | /**
* Sets the config master.
* @param configMaster the new value of the property, not null
*/ | Sets the config master | setConfigMaster | {
"repo_name": "McLeodMoores/starling",
"path": "projects/component-rest/src/main/java/com/opengamma/component/factory/web/WebsiteBasicsComponentFactory.java",
"license": "apache-2.0",
"size": 73331
} | [
"com.opengamma.master.config.ConfigMaster",
"org.joda.beans.JodaBeanUtils"
] | import com.opengamma.master.config.ConfigMaster; import org.joda.beans.JodaBeanUtils; | import com.opengamma.master.config.*; import org.joda.beans.*; | [
"com.opengamma.master",
"org.joda.beans"
] | com.opengamma.master; org.joda.beans; | 394,264 |
public static void close(@Nullable URLClassLoader clsLdr, @Nullable IgniteLogger log) {
if (clsLdr != null)
try {
URLClassPath path = SharedSecrets.getJavaNetAccess().getURLClassPath(clsLdr);
Field ldrFld = path.getClass().getDeclaredField("loaders");
ldrFld.setAccessible(true);
Iterable ldrs = (Iterable)ldrFld.get(path);
for (Object ldr : ldrs)
if (ldr.getClass().getName().endsWith("JarLoader"))
try {
Field jarFld = ldr.getClass().getDeclaredField("jar");
jarFld.setAccessible(true);
ZipFile jar = (ZipFile)jarFld.get(ldr);
jar.close();
}
catch (Exception e) {
warn(log, "Failed to close resource: " + e.getMessage());
}
}
catch (Exception e) {
warn(log, "Failed to close resource: " + e.getMessage());
}
} | static void function(@Nullable URLClassLoader clsLdr, @Nullable IgniteLogger log) { if (clsLdr != null) try { URLClassPath path = SharedSecrets.getJavaNetAccess().getURLClassPath(clsLdr); Field ldrFld = path.getClass().getDeclaredField(STR); ldrFld.setAccessible(true); Iterable ldrs = (Iterable)ldrFld.get(path); for (Object ldr : ldrs) if (ldr.getClass().getName().endsWith(STR)) try { Field jarFld = ldr.getClass().getDeclaredField("jar"); jarFld.setAccessible(true); ZipFile jar = (ZipFile)jarFld.get(ldr); jar.close(); } catch (Exception e) { warn(log, STR + e.getMessage()); } } catch (Exception e) { warn(log, STR + e.getMessage()); } } | /**
* Closes class loader logging possible checked exception.
* Note: this issue for problem <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5041014">
* http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5041014</a>.
*
* @param clsLdr Class loader. If it's {@code null} - it's no-op.
* @param log Logger to log possible checked exception with (optional).
*/ | Closes class loader logging possible checked exception. Note: this issue for problem HREF | close | {
"repo_name": "WilliamDo/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 325083
} | [
"java.lang.reflect.Field",
"java.net.URLClassLoader",
"java.util.zip.ZipFile",
"org.apache.ignite.IgniteLogger",
"org.jetbrains.annotations.Nullable"
] | import java.lang.reflect.Field; import java.net.URLClassLoader; import java.util.zip.ZipFile; import org.apache.ignite.IgniteLogger; import org.jetbrains.annotations.Nullable; | import java.lang.reflect.*; import java.net.*; import java.util.zip.*; import org.apache.ignite.*; import org.jetbrains.annotations.*; | [
"java.lang",
"java.net",
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.lang; java.net; java.util; org.apache.ignite; org.jetbrains.annotations; | 1,202,641 |
private static void expand(InputStream input, File file)
throws IOException {
BufferedOutputStream output = null;
try {
output =
new BufferedOutputStream(new FileOutputStream(file));
byte buffer[] = new byte[2048];
while (true) {
int n = input.read(buffer);
if (n <= 0)
break;
output.write(buffer, 0, n);
}
} finally {
if (output != null) {
try {
output.close();
} catch (IOException e) {
// Ignore
}
}
}
} | static void function(InputStream input, File file) throws IOException { BufferedOutputStream output = null; try { output = new BufferedOutputStream(new FileOutputStream(file)); byte buffer[] = new byte[2048]; while (true) { int n = input.read(buffer); if (n <= 0) break; output.write(buffer, 0, n); } } finally { if (output != null) { try { output.close(); } catch (IOException e) { } } } } | /**
* Expand the specified input stream into the specified file.
*
* @param input InputStream to be copied
* @param file The file to be created
*
* @exception IOException if an input/output error occurs
*/ | Expand the specified input stream into the specified file | expand | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.0/ExpandWar.java",
"license": "mit",
"size": 14045
} | [
"java.io.BufferedOutputStream",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.BufferedOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,457,088 |
public static void registerContributor(final IDebugBarContributor contrib,
final Application application)
{
if (contrib == null)
{
throw new IllegalArgumentException("contrib can not be null");
}
List<IDebugBarContributor> contributors = getContributors(application);
contributors.add(contrib);
application.setMetaData(CONTRIBS_META_KEY, contributors);
} | static void function(final IDebugBarContributor contrib, final Application application) { if (contrib == null) { throw new IllegalArgumentException(STR); } List<IDebugBarContributor> contributors = getContributors(application); contributors.add(contrib); application.setMetaData(CONTRIBS_META_KEY, contributors); } | /**
* Register your own custom contributor that will be part of the debug bar. You must have the
* context of an application for this thread at the time of calling this method.
*
* @param application
* @param contrib
* custom contributor - can not be null
*/ | Register your own custom contributor that will be part of the debug bar. You must have the context of an application for this thread at the time of calling this method | registerContributor | {
"repo_name": "zwsong/wicket",
"path": "wicket-devutils/src/main/java/org/apache/wicket/devutils/debugbar/DebugBar.java",
"license": "apache-2.0",
"size": 6573
} | [
"java.util.List",
"org.apache.wicket.Application"
] | import java.util.List; import org.apache.wicket.Application; | import java.util.*; import org.apache.wicket.*; | [
"java.util",
"org.apache.wicket"
] | java.util; org.apache.wicket; | 891,644 |
boolean isItemValid(ItemStack stack); | boolean isItemValid(ItemStack stack); | /**
* Essentially a passthrough so an arbitrary criterion can be checked against.
*/ | Essentially a passthrough so an arbitrary criterion can be checked against | isItemValid | {
"repo_name": "aanthony3/Equivalent-Exchange-3",
"path": "src/main/java/com/pahimar/repackage/cofh/lib/gui/slot/ISlotValidator.java",
"license": "gpl-3.0",
"size": 363
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 1,861,326 |
public boolean determines(List<Node> z, Node x) throws UnsupportedOperationException {
int[] parents = new int[z.size()];
for (int j = 0; j < parents.length; j++) {
parents[j] = covMatrix.getVariables().indexOf(z.get(j));
}
int i = covMatrix.getVariables().indexOf(x);
double variance = covMatrix.getValue(i, i);
if (parents.length > 0) {
// Regress z onto i, yielding regression coefficients b.
TetradMatrix Czz = covMatrix.getSelection(parents, parents);
TetradMatrix inverse;
try {
inverse = Czz.inverse();
} catch (Exception e) {
return true;
}
TetradVector Cyz = covMatrix.getSelection(parents, new int[]{i}).getColumn(0);
TetradVector b = inverse.times(Cyz);
variance -= Cyz.dotProduct(b);
}
return variance < 1e-20;
} | boolean function(List<Node> z, Node x) throws UnsupportedOperationException { int[] parents = new int[z.size()]; for (int j = 0; j < parents.length; j++) { parents[j] = covMatrix.getVariables().indexOf(z.get(j)); } int i = covMatrix.getVariables().indexOf(x); double variance = covMatrix.getValue(i, i); if (parents.length > 0) { TetradMatrix Czz = covMatrix.getSelection(parents, parents); TetradMatrix inverse; try { inverse = Czz.inverse(); } catch (Exception e) { return true; } TetradVector Cyz = covMatrix.getSelection(parents, new int[]{i}).getColumn(0); TetradVector b = inverse.times(Cyz); variance -= Cyz.dotProduct(b); } return variance < 1e-20; } | /**
* If <code>isDeterminismAllowed()</code>, deters to IndTestFisherZD; otherwise throws
* UnsupportedOperationException.
*/ | If <code>isDeterminismAllowed()</code>, deters to IndTestFisherZD; otherwise throws UnsupportedOperationException | determines | {
"repo_name": "ekummerfeld/GdistanceP",
"path": "tetrad-lib/src/main/java/edu/cmu/tetrad/search/IndTestDirichletScore.java",
"license": "gpl-2.0",
"size": 10166
} | [
"edu.cmu.tetrad.graph.Node",
"edu.cmu.tetrad.util.TetradMatrix",
"edu.cmu.tetrad.util.TetradVector",
"java.util.List"
] | import edu.cmu.tetrad.graph.Node; import edu.cmu.tetrad.util.TetradMatrix; import edu.cmu.tetrad.util.TetradVector; import java.util.List; | import edu.cmu.tetrad.graph.*; import edu.cmu.tetrad.util.*; import java.util.*; | [
"edu.cmu.tetrad",
"java.util"
] | edu.cmu.tetrad; java.util; | 1,905,253 |
@Override
@SuppressWarnings("unchecked")
protected void renderReport(JasperPrint populatedReport, Map<String, Object> model, HttpServletResponse response)
throws Exception {
net.sf.jasperreports.engine.JRExporter exporter = createExporter();
Map<net.sf.jasperreports.engine.JRExporterParameter, Object> mergedExporterParameters = getConvertedExporterParameters();
if (!CollectionUtils.isEmpty(mergedExporterParameters)) {
exporter.setParameters(mergedExporterParameters);
}
if (useWriter()) {
renderReportUsingWriter(exporter, populatedReport, response);
}
else {
renderReportUsingOutputStream(exporter, populatedReport, response);
}
} | @SuppressWarnings(STR) void function(JasperPrint populatedReport, Map<String, Object> model, HttpServletResponse response) throws Exception { net.sf.jasperreports.engine.JRExporter exporter = createExporter(); Map<net.sf.jasperreports.engine.JRExporterParameter, Object> mergedExporterParameters = getConvertedExporterParameters(); if (!CollectionUtils.isEmpty(mergedExporterParameters)) { exporter.setParameters(mergedExporterParameters); } if (useWriter()) { renderReportUsingWriter(exporter, populatedReport, response); } else { renderReportUsingOutputStream(exporter, populatedReport, response); } } | /**
* Perform rendering for a single Jasper Reports exporter, that is,
* for a pre-defined output format.
*/ | Perform rendering for a single Jasper Reports exporter, that is, for a pre-defined output format | renderReport | {
"repo_name": "QBNemo/spring-mvc-showcase",
"path": "src/main/java/org/springframework/web/servlet/view/jasperreports/AbstractJasperReportsSingleFormatView.java",
"license": "apache-2.0",
"size": 5383
} | [
"java.util.Map",
"javax.servlet.http.HttpServletResponse",
"net.sf.jasperreports.engine.JasperPrint",
"org.springframework.util.CollectionUtils"
] | import java.util.Map; import javax.servlet.http.HttpServletResponse; import net.sf.jasperreports.engine.JasperPrint; import org.springframework.util.CollectionUtils; | import java.util.*; import javax.servlet.http.*; import net.sf.jasperreports.engine.*; import org.springframework.util.*; | [
"java.util",
"javax.servlet",
"net.sf.jasperreports",
"org.springframework.util"
] | java.util; javax.servlet; net.sf.jasperreports; org.springframework.util; | 837,393 |
@Messages({"NewRuleSetPanel.attributeRule.name=Attribute",
"NewRuleSetPanel.fullPathRule.name=Full Path",
"NewRuleSetPanel.attributeRule.description=Search for files based on one or more attributes or metadata fields.",
"NewRuleSetPanel.fullPathRule.description=Search for files based on full exact match path."})
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
chooseLabel = new javax.swing.JLabel();
chooseComboBox = new javax.swing.JComboBox<>();
sharedLayeredPane = new javax.swing.JLayeredPane();
ruleDescription = new javax.swing.JLabel();
org.openide.awt.Mnemonics.setLocalizedText(chooseLabel, org.openide.util.NbBundle.getMessage(NewRulePanel.class, "NewRulePanel.chooseLabel.text")); // NOI18N | @Messages({STR, STR, STR, STR}) @SuppressWarnings(STR) void function() { chooseLabel = new javax.swing.JLabel(); chooseComboBox = new javax.swing.JComboBox<>(); sharedLayeredPane = new javax.swing.JLayeredPane(); ruleDescription = new javax.swing.JLabel(); org.openide.awt.Mnemonics.setLocalizedText(chooseLabel, org.openide.util.NbBundle.getMessage(NewRulePanel.class, STR)); | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "esaunders/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/logicalimager/configuration/NewRulePanel.java",
"license": "apache-2.0",
"size": 8696
} | [
"org.openide.util.NbBundle"
] | import org.openide.util.NbBundle; | import org.openide.util.*; | [
"org.openide.util"
] | org.openide.util; | 2,051,677 |
public void setScriptCollection(final List<Script> scriptList) {
_scriptList = scriptList;
} | void function(final List<Script> scriptList) { _scriptList = scriptList; } | /**
* Sets the value of '_scriptList' by setting it to the given Vector. No
* type checking is performed.
*
* @deprecated
*
* @param scriptList
* the Vector to set.
*/ | Sets the value of '_scriptList' by setting it to the given Vector. No type checking is performed | setScriptCollection | {
"repo_name": "dzonekl/oss2nms",
"path": "plugins/com.netxforge.oss2.model/src/com/netxforge/oss2/xml/event/Event.java",
"license": "gpl-3.0",
"size": 46316
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,578,553 |
PersistentTopicInternalStats getInternalStats(String topic) throws PulsarAdminException; | PersistentTopicInternalStats getInternalStats(String topic) throws PulsarAdminException; | /**
* Get the internal stats for the topic.
* <p>
* Access the internal state of the topic
*
* @param topic
* topic name
* @return the topic statistics
*
* @throws NotAuthorizedException
* Don't have admin permission
* @throws NotFoundException
* Topic does not exist
* @throws PulsarAdminException
* Unexpected error
*/ | Get the internal stats for the topic. Access the internal state of the topic | getInternalStats | {
"repo_name": "jai1/pulsar",
"path": "pulsar-client-admin/src/main/java/org/apache/pulsar/client/admin/Topics.java",
"license": "apache-2.0",
"size": 37663
} | [
"org.apache.pulsar.common.policies.data.PersistentTopicInternalStats"
] | import org.apache.pulsar.common.policies.data.PersistentTopicInternalStats; | import org.apache.pulsar.common.policies.data.*; | [
"org.apache.pulsar"
] | org.apache.pulsar; | 2,468,900 |
SwitchStmt withSelector(Mutation<Expr> mutation); | SwitchStmt withSelector(Mutation<Expr> mutation); | /**
* Mutates the selector of this 'switch' statement.
*
* @param mutation the mutation to apply to the selector of this 'switch' statement.
* @return the resulting mutated 'switch' statement.
*/ | Mutates the selector of this 'switch' statement | withSelector | {
"repo_name": "ptitjes/jlato",
"path": "src/main/java/org/jlato/tree/stmt/SwitchStmt.java",
"license": "lgpl-3.0",
"size": 2313
} | [
"org.jlato.tree.expr.Expr",
"org.jlato.util.Mutation"
] | import org.jlato.tree.expr.Expr; import org.jlato.util.Mutation; | import org.jlato.tree.expr.*; import org.jlato.util.*; | [
"org.jlato.tree",
"org.jlato.util"
] | org.jlato.tree; org.jlato.util; | 2,740,646 |
public static Append toAppend(final MutationProto proto, final CellScanner cellScanner)
throws IOException {
MutationType type = proto.getMutateType();
assert type == MutationType.APPEND : type.name();
byte [] row = proto.hasRow()? proto.getRow().toByteArray(): null;
Append append = null;
int cellCount = proto.hasAssociatedCellCount()? proto.getAssociatedCellCount(): 0;
if (cellCount > 0) {
// The proto has metadata only and the data is separate to be found in the cellScanner.
if (cellScanner == null) {
throw new DoNotRetryIOException("Cell count of " + cellCount + " but no cellScanner: " +
toShortString(proto));
}
for (int i = 0; i < cellCount; i++) {
if (!cellScanner.advance()) {
throw new DoNotRetryIOException("Cell count of " + cellCount + " but at index " + i +
" no cell returned: " + toShortString(proto));
}
Cell cell = cellScanner.current();
if (append == null) {
append = new Append(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength());
}
append.add(cell);
}
} else {
append = new Append(row);
for (ColumnValue column: proto.getColumnValueList()) {
byte[] family = column.getFamily().toByteArray();
for (QualifierValue qv: column.getQualifierValueList()) {
byte[] qualifier = qv.getQualifier().toByteArray();
if (!qv.hasValue()) {
throw new DoNotRetryIOException(
"Missing required field: qualifier value");
}
byte[] value = qv.getValue().toByteArray();
byte[] tags = null;
if (qv.hasTags()) {
tags = qv.getTags().toByteArray();
}
append.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(),
KeyValue.Type.Put, value, tags));
}
}
}
append.setDurability(toDurability(proto.getDurability()));
for (NameBytesPair attribute: proto.getAttributeList()) {
append.setAttribute(attribute.getName(), attribute.getValue().toByteArray());
}
return append;
} | static Append function(final MutationProto proto, final CellScanner cellScanner) throws IOException { MutationType type = proto.getMutateType(); assert type == MutationType.APPEND : type.name(); byte [] row = proto.hasRow()? proto.getRow().toByteArray(): null; Append append = null; int cellCount = proto.hasAssociatedCellCount()? proto.getAssociatedCellCount(): 0; if (cellCount > 0) { if (cellScanner == null) { throw new DoNotRetryIOException(STR + cellCount + STR + toShortString(proto)); } for (int i = 0; i < cellCount; i++) { if (!cellScanner.advance()) { throw new DoNotRetryIOException(STR + cellCount + STR + i + STR + toShortString(proto)); } Cell cell = cellScanner.current(); if (append == null) { append = new Append(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength()); } append.add(cell); } } else { append = new Append(row); for (ColumnValue column: proto.getColumnValueList()) { byte[] family = column.getFamily().toByteArray(); for (QualifierValue qv: column.getQualifierValueList()) { byte[] qualifier = qv.getQualifier().toByteArray(); if (!qv.hasValue()) { throw new DoNotRetryIOException( STR); } byte[] value = qv.getValue().toByteArray(); byte[] tags = null; if (qv.hasTags()) { tags = qv.getTags().toByteArray(); } append.add(CellUtil.createCell(row, family, qualifier, qv.getTimestamp(), KeyValue.Type.Put, value, tags)); } } } append.setDurability(toDurability(proto.getDurability())); for (NameBytesPair attribute: proto.getAttributeList()) { append.setAttribute(attribute.getName(), attribute.getValue().toByteArray()); } return append; } | /**
* Convert a protocol buffer Mutate to an Append
* @param cellScanner
* @param proto the protocol buffer Mutate to convert
* @return the converted client Append
* @throws IOException
*/ | Convert a protocol buffer Mutate to an Append | toAppend | {
"repo_name": "drewpope/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java",
"license": "apache-2.0",
"size": 114457
} | [
"java.io.IOException",
"java.lang.reflect.Type",
"org.apache.hadoop.hbase.Cell",
"org.apache.hadoop.hbase.CellScanner",
"org.apache.hadoop.hbase.CellUtil",
"org.apache.hadoop.hbase.DoNotRetryIOException",
"org.apache.hadoop.hbase.KeyValue",
"org.apache.hadoop.hbase.client.Append",
"org.apache.hadoop.hbase.client.Put",
"org.apache.hadoop.hbase.protobuf.generated.ClientProtos",
"org.apache.hadoop.hbase.protobuf.generated.HBaseProtos"
] | import java.io.IOException; import java.lang.reflect.Type; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellScanner; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.DoNotRetryIOException; import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Put; import org.apache.hadoop.hbase.protobuf.generated.ClientProtos; import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos; | import java.io.*; import java.lang.reflect.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.client.*; import org.apache.hadoop.hbase.protobuf.generated.*; | [
"java.io",
"java.lang",
"org.apache.hadoop"
] | java.io; java.lang; org.apache.hadoop; | 106,002 |
@Override public Vector divide(double d) {
return mapOverValues(v -> v / d);
} | @Override Vector function(double d) { return mapOverValues(v -> v / d); } | /**
* Return the same matrix with updates values (broken contract).
*
* @param d Value to divide to.
*/ | Return the same matrix with updates values (broken contract) | divide | {
"repo_name": "psadusumilli/ignite",
"path": "modules/ml/src/main/java/org/apache/ignite/ml/math/impls/vector/SparseDistributedVector.java",
"license": "apache-2.0",
"size": 4481
} | [
"org.apache.ignite.ml.math.Vector"
] | import org.apache.ignite.ml.math.Vector; | import org.apache.ignite.ml.math.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,972,630 |
void send(@NonNull TestRunEvent event) throws TestEventClientException; | void send(@NonNull TestRunEvent event) throws TestEventClientException; | /**
* Sends a test status event and its related {@link androidx.test.services.events.TestCase} and
* {@link androidx.test.services.events.Failure} parcelables.
*
* @param event an object that extends {@link androidx.test.services.events.run.TestRunEvent} to
* indicate the test run progress and status
* @throws TestEventClientException throws an exception if the connection to the Orchestrator
* fails
*/ | Sends a test status event and its related <code>androidx.test.services.events.TestCase</code> and <code>androidx.test.services.events.Failure</code> parcelables | send | {
"repo_name": "android/android-test",
"path": "runner/android_junit_runner/java/androidx/test/internal/events/client/TestRunEventService.java",
"license": "apache-2.0",
"size": 1481
} | [
"androidx.annotation.NonNull",
"androidx.test.services.events.run.TestRunEvent"
] | import androidx.annotation.NonNull; import androidx.test.services.events.run.TestRunEvent; | import androidx.annotation.*; import androidx.test.services.events.run.*; | [
"androidx.annotation",
"androidx.test"
] | androidx.annotation; androidx.test; | 2,183,493 |
@JsonGetter("resultCount")
public int getResultCount ( ) {
return this.resultCount;
}
| @JsonGetter(STR) int function ( ) { return this.resultCount; } | /** GETTER
* The total amount of voice URIs found
*/ | GETTER The total amount of voice URIs found | getResultCount | {
"repo_name": "voxbone/voxapi-client-java",
"path": "APIv3SandboxLib/src/com/voxbone/sandbox/models/VoiceUriListModel.java",
"license": "mit",
"size": 1192
} | [
"com.fasterxml.jackson.annotation.JsonGetter"
] | import com.fasterxml.jackson.annotation.JsonGetter; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 1,953,742 |
public void loadXML( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace )
throws KettleXMLException, KettleMissingPluginsException {
loadXML( transnode, rep, setInternalVariables, parentVariableSpace, null );
} | void function( Node transnode, Repository rep, boolean setInternalVariables, VariableSpace parentVariableSpace ) throws KettleXMLException, KettleMissingPluginsException { loadXML( transnode, rep, setInternalVariables, parentVariableSpace, null ); } | /**
* Parses an XML DOM (starting at the specified Node) that describes the transformation.
*
* @param transnode
* The XML node to load from
* @param rep
* The repository to load the default list of database connections from (null if no repository is available)
* @param setInternalVariables
* true if you want to set the internal variables based on this transformation information
* @param parentVariableSpace
* the parent variable space to use during TransMeta construction
* @throws KettleXMLException
* if any errors occur during parsing of the specified file
* @throws KettleMissingPluginsException
* in case missing plugins were found (details are in the exception in that case)
*/ | Parses an XML DOM (starting at the specified Node) that describes the transformation | loadXML | {
"repo_name": "Advent51/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java",
"license": "apache-2.0",
"size": 225587
} | [
"org.pentaho.di.core.exception.KettleMissingPluginsException",
"org.pentaho.di.core.exception.KettleXMLException",
"org.pentaho.di.core.variables.VariableSpace",
"org.pentaho.di.repository.Repository",
"org.w3c.dom.Node"
] | import org.pentaho.di.core.exception.KettleMissingPluginsException; import org.pentaho.di.core.exception.KettleXMLException; import org.pentaho.di.core.variables.VariableSpace; import org.pentaho.di.repository.Repository; import org.w3c.dom.Node; | import org.pentaho.di.core.exception.*; import org.pentaho.di.core.variables.*; import org.pentaho.di.repository.*; import org.w3c.dom.*; | [
"org.pentaho.di",
"org.w3c.dom"
] | org.pentaho.di; org.w3c.dom; | 2,712,996 |
@Override
public Constructor<CompilerPhase> getClassConstructor() {
return constructor;
} | Constructor<CompilerPhase> function() { return constructor; } | /**
* Get a constructor object for this compiler phase
* @return compiler phase constructor
*/ | Get a constructor object for this compiler phase | getClassConstructor | {
"repo_name": "CodeOffloading/JikesRVM-CCO",
"path": "jikesrvm-3.1.3/rvm/src/org/jikesrvm/compilers/opt/Simple.java",
"license": "epl-1.0",
"size": 23413
} | [
"java.lang.reflect.Constructor",
"org.jikesrvm.compilers.opt.driver.CompilerPhase"
] | import java.lang.reflect.Constructor; import org.jikesrvm.compilers.opt.driver.CompilerPhase; | import java.lang.reflect.*; import org.jikesrvm.compilers.opt.driver.*; | [
"java.lang",
"org.jikesrvm.compilers"
] | java.lang; org.jikesrvm.compilers; | 2,025,660 |
EReference getComponent_Mode(); | EReference getComponent_Mode(); | /**
* Returns the meta object for the containment reference list '{@link org.eclipse.xtext.resource.locationprovidertest.Component#getMode <em>Mode</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Mode</em>'.
* @see org.eclipse.xtext.resource.locationprovidertest.Component#getMode()
* @see #getComponent()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.eclipse.xtext.resource.locationprovidertest.Component#getMode Mode</code>'. | getComponent_Mode | {
"repo_name": "miklossy/xtext-core",
"path": "org.eclipse.xtext.tests/src-gen/org/eclipse/xtext/resource/locationprovidertest/LocationprovidertestPackage.java",
"license": "epl-1.0",
"size": 30586
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,294,062 |
public void setRaftHandle(RaftHandle raftHandle) {
this.raftHandle = raftHandle;
} | void function(RaftHandle raftHandle) { this.raftHandle = raftHandle; } | /**
* RaftHandle to use.
*/ | RaftHandle to use | setRaftHandle | {
"repo_name": "Fabryprog/camel",
"path": "components/camel-jgroups-raft/src/main/java/org/apache/camel/component/jgroups/raft/JGroupsRaftComponent.java",
"license": "apache-2.0",
"size": 3362
} | [
"org.jgroups.raft.RaftHandle"
] | import org.jgroups.raft.RaftHandle; | import org.jgroups.raft.*; | [
"org.jgroups.raft"
] | org.jgroups.raft; | 2,044,229 |
public SystemIncludePath createSysIncludePath() {
final Project p = getProject();
if (p == null) {
throw new java.lang.IllegalStateException("project must be set");
}
if (isReference()) {
throw noChildrenAllowed();
}
final SystemIncludePath path = new SystemIncludePath(p);
this.sysIncludePaths.addElement(path);
return path;
} | SystemIncludePath function() { final Project p = getProject(); if (p == null) { throw new java.lang.IllegalStateException(STR); } if (isReference()) { throw noChildrenAllowed(); } final SystemIncludePath path = new SystemIncludePath(p); this.sysIncludePaths.addElement(path); return path; } | /**
* Creates a system include path. Locations and timestamps of files located
* using the system include paths are not used in dependency analysis.
*
*
* Standard include locations should not be specified. The compiler
* adapters should recognized the settings from the appropriate environment
* variables or configuration files.
*/ | Creates a system include path. Locations and timestamps of files located using the system include paths are not used in dependency analysis. Standard include locations should not be specified. The compiler adapters should recognized the settings from the appropriate environment variables or configuration files | createSysIncludePath | {
"repo_name": "manu4linux/nar-maven-plugin",
"path": "src/main/java/com/github/maven_nar/cpptasks/CompilerDef.java",
"license": "apache-2.0",
"size": 16317
} | [
"com.github.maven_nar.cpptasks.types.SystemIncludePath",
"org.apache.tools.ant.Project"
] | import com.github.maven_nar.cpptasks.types.SystemIncludePath; import org.apache.tools.ant.Project; | import com.github.maven_nar.cpptasks.types.*; import org.apache.tools.ant.*; | [
"com.github.maven_nar",
"org.apache.tools"
] | com.github.maven_nar; org.apache.tools; | 994,575 |
public boolean isProgram() {
return bindingConfig instanceof ProgramConfig;
} | boolean function() { return bindingConfig instanceof ProgramConfig; } | /**
* Returns true if the bindingConfig is a program.
*/ | Returns true if the bindingConfig is a program | isProgram | {
"repo_name": "mattnl/openhab",
"path": "bundles/binding/org.openhab.binding.homematic/src/main/java/org/openhab/binding/homematic/internal/communicator/Event.java",
"license": "epl-1.0",
"size": 4029
} | [
"org.openhab.binding.homematic.internal.config.binding.ProgramConfig"
] | import org.openhab.binding.homematic.internal.config.binding.ProgramConfig; | import org.openhab.binding.homematic.internal.config.binding.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 1,998,541 |
T visitExpressionLt(@NotNull BigDataScriptParser.ExpressionLtContext ctx); | T visitExpressionLt(@NotNull BigDataScriptParser.ExpressionLtContext ctx); | /**
* Visit a parse tree produced by {@link BigDataScriptParser#expressionLt}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>BigDataScriptParser#expressionLt</code> | visitExpressionLt | {
"repo_name": "leepc12/BigDataScript",
"path": "src/org/bds/antlr/BigDataScriptVisitor.java",
"license": "apache-2.0",
"size": 22181
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,315,925 |
JobInfoWrapper executeGenePatternJob(ServerConnectionProfile server, AnalysisMethodInvocation invocation)
throws WebServiceException; | JobInfoWrapper executeGenePatternJob(ServerConnectionProfile server, AnalysisMethodInvocation invocation) throws WebServiceException; | /**
* Executes a job on a GenePattern server.
*
* @param server the GenePattern server
* @param invocation contains the configuration of the job to execute
* @return the Wrapper for the JobInfo retrieved from GenePattern.
* @throws WebServiceException if the service couldn't be reached.
*/ | Executes a job on a GenePattern server | executeGenePatternJob | {
"repo_name": "NCIP/caintegrator",
"path": "caintegrator-war/src/gov/nih/nci/caintegrator/application/analysis/AnalysisService.java",
"license": "bsd-3-clause",
"size": 9143
} | [
"gov.nih.nci.caintegrator.external.ServerConnectionProfile",
"org.genepattern.webservice.WebServiceException"
] | import gov.nih.nci.caintegrator.external.ServerConnectionProfile; import org.genepattern.webservice.WebServiceException; | import gov.nih.nci.caintegrator.external.*; import org.genepattern.webservice.*; | [
"gov.nih.nci",
"org.genepattern.webservice"
] | gov.nih.nci; org.genepattern.webservice; | 1,723,015 |
private static void startRmiServers(String agencyId) {
// Start up all of the RMI servers
PredictionsServer.start(agencyId, PredictionDataCache.getInstance());
VehiclesServer.start(agencyId, VehicleDataCache.getInstance());
ConfigServer.start(agencyId);
ServerStatusServer.start(agencyId);
CommandsServer.start(agencyId);
}
| static void function(String agencyId) { PredictionsServer.start(agencyId, PredictionDataCache.getInstance()); VehiclesServer.start(agencyId, VehicleDataCache.getInstance()); ConfigServer.start(agencyId); ServerStatusServer.start(agencyId); CommandsServer.start(agencyId); } | /**
* Start the RMI Servers so that clients can obtain data
* on predictions, vehicles locations, etc.
*
* @param agencyId
*/ | Start the RMI Servers so that clients can obtain data on predictions, vehicles locations, etc | startRmiServers | {
"repo_name": "edsfocci/Transitime_core",
"path": "transitime/src/main/java/org/transitime/applications/Core.java",
"license": "gpl-3.0",
"size": 13780
} | [
"org.transitime.core.dataCache.PredictionDataCache",
"org.transitime.core.dataCache.VehicleDataCache",
"org.transitime.ipc.servers.CommandsServer",
"org.transitime.ipc.servers.ConfigServer",
"org.transitime.ipc.servers.PredictionsServer",
"org.transitime.ipc.servers.ServerStatusServer",
"org.transitime.ipc.servers.VehiclesServer"
] | import org.transitime.core.dataCache.PredictionDataCache; import org.transitime.core.dataCache.VehicleDataCache; import org.transitime.ipc.servers.CommandsServer; import org.transitime.ipc.servers.ConfigServer; import org.transitime.ipc.servers.PredictionsServer; import org.transitime.ipc.servers.ServerStatusServer; import org.transitime.ipc.servers.VehiclesServer; | import org.transitime.core.*; import org.transitime.ipc.servers.*; | [
"org.transitime.core",
"org.transitime.ipc"
] | org.transitime.core; org.transitime.ipc; | 504,827 |
public List queryByType(final String restrictedType) {
final String query = "select v from" + " org.olat.repository.RepositoryEntry v" + " inner join fetch v.olatResource as res"
+ " where res.resName= :restrictedType";
final DBQuery dbquery = DBFactory.getInstance().createQuery(query);
dbquery.setString("restrictedType", restrictedType);
dbquery.setCacheable(true);
return dbquery.list();
} | List function(final String restrictedType) { final String query = STR + STR + STR + STR; final DBQuery dbquery = DBFactory.getInstance().createQuery(query); dbquery.setString(STR, restrictedType); dbquery.setCacheable(true); return dbquery.list(); } | /**
* Query by type without any other limitations
*
* @param restrictedType
* @param roles
* @return Results
*/ | Query by type without any other limitations | queryByType | {
"repo_name": "RLDevOps/Demo",
"path": "src/main/java/org/olat/repository/RepositoryManager.java",
"license": "apache-2.0",
"size": 42875
} | [
"java.util.List",
"org.olat.core.commons.persistence.DBFactory",
"org.olat.core.commons.persistence.DBQuery"
] | import java.util.List; import org.olat.core.commons.persistence.DBFactory; import org.olat.core.commons.persistence.DBQuery; | import java.util.*; import org.olat.core.commons.persistence.*; | [
"java.util",
"org.olat.core"
] | java.util; org.olat.core; | 1,415,840 |
public EventTransformation findEventTransformation(String eventName) {
for (EventTransformation et : getTransformations()) {
if (et.getEventType().getName().equals(eventName)) {
return et;
}
}
// Not found
return null;
}
| EventTransformation function(String eventName) { for (EventTransformation et : getTransformations()) { if (et.getEventType().getName().equals(eventName)) { return et; } } return null; } | /**
* Finds the EventTransformation given the eventName.
*
* @param eventName The name of the event
* @return EventTransformation The EventTransformation or null if no event transformation can be found
*/ | Finds the EventTransformation given the eventName | findEventTransformation | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/page/core/com.odcgroup.page.transformmodel/src/generated/java/com/odcgroup/page/transformmodel/impl/EventTransformationsImpl.java",
"license": "epl-1.0",
"size": 4948
} | [
"com.odcgroup.page.transformmodel.EventTransformation"
] | import com.odcgroup.page.transformmodel.EventTransformation; | import com.odcgroup.page.transformmodel.*; | [
"com.odcgroup.page"
] | com.odcgroup.page; | 2,833,630 |
@ApiModelProperty(value = "The rewards to give at the end of the challenge. When creating/updating only id is used. Reward set must be pre-existing")
public RewardSetResource getRewardSet() {
return rewardSet;
} | @ApiModelProperty(value = STR) RewardSetResource function() { return rewardSet; } | /**
* The rewards to give at the end of the challenge. When creating/updating only id is used. Reward set must be pre-existing
* @return rewardSet
**/ | The rewards to give at the end of the challenge. When creating/updating only id is used. Reward set must be pre-existing | getRewardSet | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/model/ChallengeResource.java",
"license": "apache-2.0",
"size": 14967
} | [
"com.knetikcloud.model.RewardSetResource",
"io.swagger.annotations.ApiModelProperty"
] | import com.knetikcloud.model.RewardSetResource; import io.swagger.annotations.ApiModelProperty; | import com.knetikcloud.model.*; import io.swagger.annotations.*; | [
"com.knetikcloud.model",
"io.swagger.annotations"
] | com.knetikcloud.model; io.swagger.annotations; | 2,682,350 |
@Test void testPushFilterPastAggFour() {
final String sql = "select emp.deptno, count(*) from emp where emp.sal > '12'\n"
+ "group by emp.deptno";
sql(sql)
.withPreRule(CoreRules.AGGREGATE_PROJECT_MERGE,
CoreRules.AGGREGATE_FILTER_TRANSPOSE)
.withRule(CoreRules.FILTER_AGGREGATE_TRANSPOSE)
.check();
} | @Test void testPushFilterPastAggFour() { final String sql = STR + STR; sql(sql) .withPreRule(CoreRules.AGGREGATE_PROJECT_MERGE, CoreRules.AGGREGATE_FILTER_TRANSPOSE) .withRule(CoreRules.FILTER_AGGREGATE_TRANSPOSE) .check(); } | /** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1109">[CALCITE-1109]
* FilterAggregateTransposeRule pushes down incorrect condition</a>. */ | Test case for [CALCITE-1109] | testPushFilterPastAggFour | {
"repo_name": "datametica/calcite",
"path": "core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java",
"license": "apache-2.0",
"size": 264929
} | [
"org.apache.calcite.rel.rules.CoreRules",
"org.junit.jupiter.api.Test"
] | import org.apache.calcite.rel.rules.CoreRules; import org.junit.jupiter.api.Test; | import org.apache.calcite.rel.rules.*; import org.junit.jupiter.api.*; | [
"org.apache.calcite",
"org.junit.jupiter"
] | org.apache.calcite; org.junit.jupiter; | 166,818 |
return TextUtils.isEmpty(cs);
} | return TextUtils.isEmpty(cs); } | /**
* Uses StringUtils.isBlank() API to check for blank strings.
*
* @param cs
* The String, for which the check has to be made.
* @return false, if the String passed is null or empty. True, otherwise.
*/ | Uses StringUtils.isBlank() API to check for blank strings | isBlank | {
"repo_name": "InMobi/api-monetization",
"path": "android/android_inmobi/src/main/java/com/inmobi/monetization/api/utils/InternalUtil.java",
"license": "mit",
"size": 1060
} | [
"android.text.TextUtils"
] | import android.text.TextUtils; | import android.text.*; | [
"android.text"
] | android.text; | 2,856,223 |
@Override
public void close() throws IOException
{
closed = true;
scanner.close();
reader.close();
fsdis.close();
} | void function() throws IOException { closed = true; scanner.close(); reader.close(); fsdis.close(); } | /**
* Unlike the TFile.Reader.close method this will close the wrapped InputStream.
* @see java.io.Closeable#close()
*/ | Unlike the TFile.Reader.close method this will close the wrapped InputStream | close | {
"repo_name": "ananthc/apex-malhar",
"path": "library/src/main/java/org/apache/apex/malhar/lib/fileaccess/TFileReader.java",
"license": "apache-2.0",
"size": 3702
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,831,054 |
@ThreadSafe // but not atomic
public static void writeIsoLatin1(Path file, String... lines) throws IOException {
writeLinesAs(file, ISO_8859_1, lines);
} | @ThreadSafe static void function(Path file, String... lines) throws IOException { writeLinesAs(file, ISO_8859_1, lines); } | /**
* Writes lines to file using ISO-8859-1 encoding (isolatin1).
*/ | Writes lines to file using ISO-8859-1 encoding (isolatin1) | writeIsoLatin1 | {
"repo_name": "twitter-forks/bazel",
"path": "src/main/java/com/google/devtools/build/lib/vfs/FileSystemUtils.java",
"license": "apache-2.0",
"size": 34674
} | [
"com.google.devtools.build.lib.concurrent.ThreadSafety",
"java.io.IOException"
] | import com.google.devtools.build.lib.concurrent.ThreadSafety; import java.io.IOException; | import com.google.devtools.build.lib.concurrent.*; import java.io.*; | [
"com.google.devtools",
"java.io"
] | com.google.devtools; java.io; | 2,227,280 |
public Bitmap getCover(INotifiableManager manager, ICoverArt cover, int size);
| Bitmap function(INotifiableManager manager, ICoverArt cover, int size); | /**
* Returns a cover as bitmap
* @param cover
* @return Cover
*/ | Returns a cover as bitmap | getCover | {
"repo_name": "r00li/RHome",
"path": "Android/RHome/lib-src/org/xbmc/api/data/ITvShowClient.java",
"license": "gpl-3.0",
"size": 3013
} | [
"android.graphics.Bitmap",
"org.xbmc.api.business.INotifiableManager",
"org.xbmc.api.object.ICoverArt"
] | import android.graphics.Bitmap; import org.xbmc.api.business.INotifiableManager; import org.xbmc.api.object.ICoverArt; | import android.graphics.*; import org.xbmc.api.business.*; import org.xbmc.api.object.*; | [
"android.graphics",
"org.xbmc.api"
] | android.graphics; org.xbmc.api; | 2,780,423 |
public void setResourceLocalService(
ResourceLocalService resourceLocalService) {
this.resourceLocalService = resourceLocalService;
} | void function( ResourceLocalService resourceLocalService) { this.resourceLocalService = resourceLocalService; } | /**
* Sets the resource local service.
*
* @param resourceLocalService the resource local service
*/ | Sets the resource local service | setResourceLocalService | {
"repo_name": "iucn-whp/world-heritage-outlook",
"path": "portlets/iucn-dbservice-portlet/docroot/WEB-INF/src/com/iucn/whp/dbservice/service/base/conservation_outlook_rating_lkpLocalServiceBaseImpl.java",
"license": "gpl-2.0",
"size": 177188
} | [
"com.liferay.portal.service.ResourceLocalService"
] | import com.liferay.portal.service.ResourceLocalService; | import com.liferay.portal.service.*; | [
"com.liferay.portal"
] | com.liferay.portal; | 1,374,306 |
Serializable getUserSetting( UserSettingKey key );
| Serializable getUserSetting( UserSettingKey key ); | /**
* Returns the value of the user setting specified by the given name.
*
* @param key the user setting key.
* @return the value corresponding to the named user setting, or null if
* there is no match.
*/ | Returns the value of the user setting specified by the given name | getUserSetting | {
"repo_name": "vietnguyen/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java",
"license": "bsd-3-clause",
"size": 5519
} | [
"java.io.Serializable"
] | import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 2,396,630 |
protected void processSubtype0(TTFDataStream data) throws IOException
{
byte[] glyphMapping = data.read(256);
glyphIdToCharacterCode = newGlyphIdToCharacterCode(256);
characterCodeToGlyphId = new HashMap<Integer, Integer>(glyphMapping.length);
for (int i = 0; i < glyphMapping.length; i++)
{
int glyphIndex = (glyphMapping[i] + 256) % 256;
glyphIdToCharacterCode[glyphIndex] = i;
characterCodeToGlyphId.put(i, glyphIndex);
}
} | void function(TTFDataStream data) throws IOException { byte[] glyphMapping = data.read(256); glyphIdToCharacterCode = newGlyphIdToCharacterCode(256); characterCodeToGlyphId = new HashMap<Integer, Integer>(glyphMapping.length); for (int i = 0; i < glyphMapping.length; i++) { int glyphIndex = (glyphMapping[i] + 256) % 256; glyphIdToCharacterCode[glyphIndex] = i; characterCodeToGlyphId.put(i, glyphIndex); } } | /**
* Initialize the CMapEntry when it is a subtype 0.
*
* @param data the data stream of the to be parsed ttf font
* @throws IOException If there is an error parsing the true type font.
*/ | Initialize the CMapEntry when it is a subtype 0 | processSubtype0 | {
"repo_name": "joansmith/pdfbox",
"path": "fontbox/src/main/java/org/apache/fontbox/ttf/CmapSubtable.java",
"license": "apache-2.0",
"size": 23533
} | [
"java.io.IOException",
"java.util.HashMap"
] | import java.io.IOException; import java.util.HashMap; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,260,097 |
public Object getObject (int columnIndex) throws SQLException
{
validateResultSet();
return resultSet_.getObject(columnIndex);
} | Object function (int columnIndex) throws SQLException { validateResultSet(); return resultSet_.getObject(columnIndex); } | /**
* Returns the value of a column as a Java Object.
* This can be used to get values from columns with all
* SQL types. If the column is a user-defined type, then the
* connection's type map is used to created the object.
*
* @param columnIndex The column index (1-based).
* @return The column value or null if the value is SQL NULL.
*
* @exception SQLException If the result set is not open,
* the cursor is not positioned on a row,
* the column index is not valid, or the
* requested conversion is not valid.
**/ | Returns the value of a column as a Java Object. This can be used to get values from columns with all SQL types. If the column is a user-defined type, then the connection's type map is used to created the object | getObject | {
"repo_name": "piguangming/jt400",
"path": "cvsroot/src/com/ibm/as400/access/AS400JDBCRowSet.java",
"license": "epl-1.0",
"size": 311708
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,810,363 |
List<JobRecord> generateImplicitJobs(JobRecord job); | List<JobRecord> generateImplicitJobs(JobRecord job); | /**
* For a given job, generates all the implicit jobs that need to be done
*
* This is the jesus nut of the the event cluster animation.
*
* @param jobId
*
* @return the list of jobs generated
* @throws SQLException
*/ | For a given job, generates all the implicit jobs that need to be done This is the jesus nut of the the event cluster animation | generateImplicitJobs | {
"repo_name": "ChiralBehaviors/Ultrastructure",
"path": "animations/src/main/java/com/chiralbehaviors/CoRE/meta/JobModel.java",
"license": "agpl-3.0",
"size": 14497
} | [
"com.chiralbehaviors.CoRE",
"java.util.List"
] | import com.chiralbehaviors.CoRE; import java.util.List; | import com.chiralbehaviors.*; import java.util.*; | [
"com.chiralbehaviors",
"java.util"
] | com.chiralbehaviors; java.util; | 1,636,187 |
IStructuredDocumentRegion getFirstStructuredDocumentRegion(); | IStructuredDocumentRegion getFirstStructuredDocumentRegion(); | /**
* Gets the first structured document region of this node.
*
* ISSUE: need to resolve getFirst/getStart confusion
*
* @return the first structured document region of this node.
*/ | Gets the first structured document region of this node | getFirstStructuredDocumentRegion | {
"repo_name": "ttimbul/eclipse.wst",
"path": "bundles/org.eclipse.wst.xml.core/src/org/eclipse/wst/xml/core/internal/provisional/document/IDOMNode.java",
"license": "epl-1.0",
"size": 7739
} | [
"org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion"
] | import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion; | import org.eclipse.wst.sse.core.internal.provisional.text.*; | [
"org.eclipse.wst"
] | org.eclipse.wst; | 1,442,619 |
@GwtCompatible(serializable = true)
@Deprecated
public static <T> Ordering<T> from(Ordering<T> ordering) {
return checkNotNull(ordering);
} | @GwtCompatible(serializable = true) static <T> Ordering<T> function(Ordering<T> ordering) { return checkNotNull(ordering); } | /**
* Simply returns its argument.
*
* @deprecated no need to use this
*/ | Simply returns its argument | from | {
"repo_name": "migue/voltdb",
"path": "third_party/java/src/com/google_voltpatches/common/collect/Ordering.java",
"license": "agpl-3.0",
"size": 40399
} | [
"com.google_voltpatches.common.annotations.GwtCompatible",
"com.google_voltpatches.common.base.Preconditions"
] | import com.google_voltpatches.common.annotations.GwtCompatible; import com.google_voltpatches.common.base.Preconditions; | import com.google_voltpatches.common.annotations.*; import com.google_voltpatches.common.base.*; | [
"com.google_voltpatches.common"
] | com.google_voltpatches.common; | 2,126,611 |
public GlyphMetrics getGlyphMetrics(){
return glMetrics;
}
| GlyphMetrics function(){ return glMetrics; } | /**
* Retruns GlyphMetrics of this glyph object with precise metrics.
*/ | Retruns GlyphMetrics of this glyph object with precise metrics | getGlyphMetrics | {
"repo_name": "mike10004/appengine-imaging",
"path": "gaecompat-awt-imaging/src/awt/org/apache/harmony/awt/gl/font/Glyph.java",
"license": "apache-2.0",
"size": 6375
} | [
"com.google.code.appengine.awt.font.GlyphMetrics"
] | import com.google.code.appengine.awt.font.GlyphMetrics; | import com.google.code.appengine.awt.font.*; | [
"com.google.code"
] | com.google.code; | 2,194,329 |
@Test
public void testImportConflictsFail2() throws IOException {
assertEqual(createFile("importConflictFail2"), "testImportFail2", "0",
ErrorCodes.IMPORT, ErrorCodes.IMPORT);
// one for importing a model with interfaces but not its interface
} | void function() throws IOException { assertEqual(createFile(STR), STR, "0", ErrorCodes.IMPORT, ErrorCodes.IMPORT); } | /**
* Tests Imports-conflicts (erroneous model).
*
* @throws IOException
* should not occur
*/ | Tests Imports-conflicts (erroneous model) | testImportConflictsFail2 | {
"repo_name": "SSEHUB/EASyProducer",
"path": "Plugins/IVML/de.uni_hildesheim.sse.ivml.tests/src/test/de/uni_hildesheim/sse/AdvancedTests.java",
"license": "apache-2.0",
"size": 34167
} | [
"de.uni_hildesheim.sse.translation.ErrorCodes",
"java.io.IOException"
] | import de.uni_hildesheim.sse.translation.ErrorCodes; import java.io.IOException; | import de.uni_hildesheim.sse.translation.*; import java.io.*; | [
"de.uni_hildesheim.sse",
"java.io"
] | de.uni_hildesheim.sse; java.io; | 796,492 |
@NotNull
@Override
public Map<String, String> getTemplateVariables() {
Map<String, String> ret = new HashMap<String, String>();
ret.put("name", name);
ret.put("onlineResource", onlineResource);
return ret;
}
@DatabaseField(generatedId = true)
private int id;
@NotNull
@DatabaseField(canBeNull = false)
private String name;
@NotNull
@DatabaseField(canBeNull = false)
private String onlineResource; | Map<String, String> function() { Map<String, String> ret = new HashMap<String, String>(); ret.put("name", name); ret.put(STR, onlineResource); return ret; } @DatabaseField(generatedId = true) private int id; @DatabaseField(canBeNull = false) private String name; @DatabaseField(canBeNull = false) private String onlineResource; | /**
* Returns for each variable allowed in the template a corresponding values. The variable name should include the $ prefix
*
* @return a map of form (variableKey -> variableValue)
*/ | Returns for each variable allowed in the template a corresponding values. The variable name should include the $ prefix | getTemplateVariables | {
"repo_name": "diogo-andrade/DataHubSystem",
"path": "petascope/src/main/java/petascope/wms2/metadata/AuthorityURL.java",
"license": "agpl-3.0",
"size": 3077
} | [
"com.j256.ormlite.field.DatabaseField",
"java.util.HashMap",
"java.util.Map"
] | import com.j256.ormlite.field.DatabaseField; import java.util.HashMap; import java.util.Map; | import com.j256.ormlite.field.*; import java.util.*; | [
"com.j256.ormlite",
"java.util"
] | com.j256.ormlite; java.util; | 1,128,327 |
public final void startInference(IProgressMonitor monitor)
{
preProcess(monitor);
processInference(monitor);
}
| final void function(IProgressMonitor monitor) { preProcess(monitor); processInference(monitor); } | /**
* Runs the inference process implemented by this strategy class on this strategy instance's pattern rule catalog.
* <p>
* Before the inference process is started {@link #preProcess()} is called. The inference process itself is started
* by a call of the method {@link #processInference()}.
*
* @see #preProcess()
* @see #processInference()
*/ | Runs the inference process implemented by this strategy class on this strategy instance's pattern rule catalog. Before the inference process is started <code>#preProcess()</code> is called. The inference process itself is started by a call of the method <code>#processInference()</code> | startInference | {
"repo_name": "CloudScale-Project/StaticSpotter",
"path": "plugins/org.reclipse.structure.inference/src/org/reclipse/structure/inference/InferenceStrategy.java",
"license": "apache-2.0",
"size": 4626
} | [
"org.eclipse.core.runtime.IProgressMonitor"
] | import org.eclipse.core.runtime.IProgressMonitor; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,414,677 |
static Token[] lexx(final String format) {
final char[] array = format.toCharArray();
final ArrayList<Token> list = new ArrayList<Token>(array.length);
boolean inLiteral = false;
// Although the buffer is stored in a Token, the Tokens are only
// used internally, so cannot be accessed by other threads
StringBuilder buffer = null;
Token previous = null;
final int sz = array.length;
for (int i = 0; i < sz; i++) {
final char ch = array[i];
if (inLiteral && ch != '\'') {
buffer.append(ch); // buffer can't be null if inLiteral is true
continue;
}
Object value = null;
switch (ch) {
// TODO: Need to handle escaping of '
case '\'':
if (inLiteral) {
buffer = null;
inLiteral = false;
} else {
buffer = new StringBuilder();
list.add(new Token(buffer));
inLiteral = true;
}
break;
case 'y':
value = y;
break;
case 'M':
value = M;
break;
case 'd':
value = d;
break;
case 'H':
value = H;
break;
case 'm':
value = m;
break;
case 's':
value = s;
break;
case 'S':
value = S;
break;
default:
if (buffer == null) {
buffer = new StringBuilder();
list.add(new Token(buffer));
}
buffer.append(ch);
}
if (value != null) {
if (previous != null && previous.getValue() == value) {
previous.increment();
} else {
final Token token = new Token(value);
list.add(token);
previous = token;
}
buffer = null;
}
}
return list.toArray(new Token[list.size()]);
}
//-----------------------------------------------------------------------
static class Token { | static Token[] lexx(final String format) { final char[] array = format.toCharArray(); final ArrayList<Token> list = new ArrayList<Token>(array.length); boolean inLiteral = false; StringBuilder buffer = null; Token previous = null; final int sz = array.length; for (int i = 0; i < sz; i++) { final char ch = array[i]; if (inLiteral && ch != '\'') { buffer.append(ch); continue; } Object value = null; switch (ch) { case '\'': if (inLiteral) { buffer = null; inLiteral = false; } else { buffer = new StringBuilder(); list.add(new Token(buffer)); inLiteral = true; } break; case 'y': value = y; break; case 'M': value = M; break; case 'd': value = d; break; case 'H': value = H; break; case 'm': value = m; break; case 's': value = s; break; case 'S': value = S; break; default: if (buffer == null) { buffer = new StringBuilder(); list.add(new Token(buffer)); } buffer.append(ch); } if (value != null) { if (previous != null && previous.getValue() == value) { previous.increment(); } else { final Token token = new Token(value); list.add(token); previous = token; } buffer = null; } } return list.toArray(new Token[list.size()]); } static class Token { | /**
* Parses a classic date format string into Tokens
*
* @param format the format to parse, not null
* @return array of Token[]
*/ | Parses a classic date format string into Tokens | lexx | {
"repo_name": "mureinik/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/time/DurationFormatUtils.java",
"license": "apache-2.0",
"size": 26061
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,838,446 |
private void deleteKey(KeyShell ks, String keyName) throws Exception {
int rc;
outContent.reset();
final String[] delArgs =
{"delete", keyName, "-f", "-provider", jceksProvider};
rc = ks.run(delArgs);
assertEquals(0, rc);
assertTrue(outContent.toString().contains(keyName + " has been " +
"successfully deleted."));
} | void function(KeyShell ks, String keyName) throws Exception { int rc; outContent.reset(); final String[] delArgs = {STR, keyName, "-f", STR, jceksProvider}; rc = ks.run(delArgs); assertEquals(0, rc); assertTrue(outContent.toString().contains(keyName + STR + STR)); } | /**
* Delete a key from the default jceksProvider
* @param ks The KeyShell instance
* @param keyName The key to delete
* @throws Exception
*/ | Delete a key from the default jceksProvider | deleteKey | {
"repo_name": "NJUJYB/disYarn",
"path": "hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/crypto/key/TestKeyShell.java",
"license": "apache-2.0",
"size": 10268
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 469,142 |
private static void disableAndDropNonSystemTables() throws Exception {
if (driver == null) return;
Admin admin = driver.getConnectionQueryServices(null, null).getAdmin();
try {
TableDescriptor[] tables = admin.listTables();
for (TableDescriptor table : tables) {
String schemaName = SchemaUtil.getSchemaNameFromFullName(table.getTableName().getName());
if (!QueryConstants.SYSTEM_SCHEMA_NAME.equals(schemaName)) {
disableAndDropTable(admin, table.getTableName());
}
}
} finally {
admin.close();
}
} | static void function() throws Exception { if (driver == null) return; Admin admin = driver.getConnectionQueryServices(null, null).getAdmin(); try { TableDescriptor[] tables = admin.listTables(); for (TableDescriptor table : tables) { String schemaName = SchemaUtil.getSchemaNameFromFullName(table.getTableName().getName()); if (!QueryConstants.SYSTEM_SCHEMA_NAME.equals(schemaName)) { disableAndDropTable(admin, table.getTableName()); } } } finally { admin.close(); } } | /**
* Disable and drop all the tables except SYSTEM.CATALOG and SYSTEM.SEQUENCE
*/ | Disable and drop all the tables except SYSTEM.CATALOG and SYSTEM.SEQUENCE | disableAndDropNonSystemTables | {
"repo_name": "ohadshacham/phoenix",
"path": "phoenix-core/src/test/java/org/apache/phoenix/query/BaseTest.java",
"license": "apache-2.0",
"size": 85614
} | [
"org.apache.hadoop.hbase.client.Admin",
"org.apache.hadoop.hbase.client.TableDescriptor",
"org.apache.phoenix.util.SchemaUtil"
] | import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.TableDescriptor; import org.apache.phoenix.util.SchemaUtil; | import org.apache.hadoop.hbase.client.*; import org.apache.phoenix.util.*; | [
"org.apache.hadoop",
"org.apache.phoenix"
] | org.apache.hadoop; org.apache.phoenix; | 2,292,467 |
@Test
public void testSubstrFilterQuery() {
// Create the producer
JdbcProducer producer = null;
try {
producer = new JdbcProducer(dataSource);
} catch (Exception e) {
fail();
}
// Build up an InteractionContext
MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl<String>();
// Create name by taking a substring at runtime
queryParams.add(ODataParser.FILTER_KEY, VARCHAR_FIELD_NAME + " " + SqlRelation.EQ.getoDataString() + " "
+ SqlRelation.SUBSTR.getoDataString() + "('" + "JUNK" + TEST_VARCHAR_DATA + "2', '5')");
MultivaluedMap<String, String> pathParams = new MultivaluedMapImpl<String>();
InteractionContext ctx = new InteractionContext(mock(UriInfo.class), mock(HttpHeaders.class), pathParams,
queryParams, mock(ResourceState.class), mock(Metadata.class));
// Run a query
SqlRowSet rs = null;
try {
rs = producer.query(TEST_TABLE_NAME, null, ctx);
} catch (Exception e) {
fail();
}
// Check the results. Should get all fields of the single row we
// filtered for.
assertFalse(null == rs);
int rowCount = 0;
while (rs.next()) {
assertEquals(TEST_KEY_DATA + 2, rs.getString(KEY_FIELD_NAME));
assertEquals(TEST_VARCHAR_DATA + 2, rs.getString(VARCHAR_FIELD_NAME));
assertEquals(TEST_INTEGER_DATA + 2, rs.getInt(INTEGER_FIELD_NAME));
rowCount++;
}
assertEquals(1, rowCount);
} | void function() { JdbcProducer producer = null; try { producer = new JdbcProducer(dataSource); } catch (Exception e) { fail(); } MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl<String>(); queryParams.add(ODataParser.FILTER_KEY, VARCHAR_FIELD_NAME + " " + SqlRelation.EQ.getoDataString() + " " + SqlRelation.SUBSTR.getoDataString() + "('" + "JUNK" + TEST_VARCHAR_DATA + STR); MultivaluedMap<String, String> pathParams = new MultivaluedMapImpl<String>(); InteractionContext ctx = new InteractionContext(mock(UriInfo.class), mock(HttpHeaders.class), pathParams, queryParams, mock(ResourceState.class), mock(Metadata.class)); SqlRowSet rs = null; try { rs = producer.query(TEST_TABLE_NAME, null, ctx); } catch (Exception e) { fail(); } assertFalse(null == rs); int rowCount = 0; while (rs.next()) { assertEquals(TEST_KEY_DATA + 2, rs.getString(KEY_FIELD_NAME)); assertEquals(TEST_VARCHAR_DATA + 2, rs.getString(VARCHAR_FIELD_NAME)); assertEquals(TEST_INTEGER_DATA + 2, rs.getInt(INTEGER_FIELD_NAME)); rowCount++; } assertEquals(1, rowCount); } | /**
* Test access to database using 'substr' in a $filter term.
*/ | Test access to database using 'substr' in a $filter term | testSubstrFilterQuery | {
"repo_name": "ssethupathi/IRIS",
"path": "interaction-jdbc-producer/src/test/java/com/temenos/interaction/jdbc/producer/TestIrisFilter.java",
"license": "agpl-3.0",
"size": 18918
} | [
"com.temenos.interaction.core.MultivaluedMapImpl",
"com.temenos.interaction.core.command.InteractionContext",
"com.temenos.interaction.core.entity.Metadata",
"com.temenos.interaction.core.hypermedia.ResourceState",
"com.temenos.interaction.jdbc.SqlRelation",
"com.temenos.interaction.odataext.odataparser.ODataParser",
"javax.ws.rs.core.HttpHeaders",
"javax.ws.rs.core.MultivaluedMap",
"javax.ws.rs.core.UriInfo",
"org.junit.Assert",
"org.mockito.Mockito",
"org.springframework.jdbc.support.rowset.SqlRowSet"
] | import com.temenos.interaction.core.MultivaluedMapImpl; import com.temenos.interaction.core.command.InteractionContext; import com.temenos.interaction.core.entity.Metadata; import com.temenos.interaction.core.hypermedia.ResourceState; import com.temenos.interaction.jdbc.SqlRelation; import com.temenos.interaction.odataext.odataparser.ODataParser; import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MultivaluedMap; import javax.ws.rs.core.UriInfo; import org.junit.Assert; import org.mockito.Mockito; import org.springframework.jdbc.support.rowset.SqlRowSet; | import com.temenos.interaction.core.*; import com.temenos.interaction.core.command.*; import com.temenos.interaction.core.entity.*; import com.temenos.interaction.core.hypermedia.*; import com.temenos.interaction.jdbc.*; import com.temenos.interaction.odataext.odataparser.*; import javax.ws.rs.core.*; import org.junit.*; import org.mockito.*; import org.springframework.jdbc.support.rowset.*; | [
"com.temenos.interaction",
"javax.ws",
"org.junit",
"org.mockito",
"org.springframework.jdbc"
] | com.temenos.interaction; javax.ws; org.junit; org.mockito; org.springframework.jdbc; | 657,786 |
public Builder putAllExtraParam(Map<String, Object> map) {
if (this.extraParams == null) {
this.extraParams = new HashMap<>();
}
this.extraParams.putAll(map);
return this;
} | Builder function(Map<String, Object> map) { if (this.extraParams == null) { this.extraParams = new HashMap<>(); } this.extraParams.putAll(map); return this; } | /**
* Add all map key/value pairs to `extraParams` map. A map is initialized for the first
* `put/putAll` call, and subsequent calls add additional key/value pairs to the original
* map. See {@link SubscriptionScheduleUpdateParams.Phase.AddInvoiceItem#extraParams} for
* the field documentation.
*/ | Add all map key/value pairs to `extraParams` map. A map is initialized for the first `put/putAll` call, and subsequent calls add additional key/value pairs to the original map. See <code>SubscriptionScheduleUpdateParams.Phase.AddInvoiceItem#extraParams</code> for the field documentation | putAllExtraParam | {
"repo_name": "stripe/stripe-java",
"path": "src/main/java/com/stripe/param/SubscriptionScheduleUpdateParams.java",
"license": "mit",
"size": 111931
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,310,579 |
@Authorized( { PrivilegeConstants.VIEW_PROGRAMS })
public List<Program> getPrograms(String nameFragment) throws APIException;
| @Authorized( { PrivilegeConstants.VIEW_PROGRAMS }) List<Program> function(String nameFragment) throws APIException; | /**
* Returns programs that match the given string. A null list will never be returned. An empty
* list will be returned if there are no programs matching this <code>nameFragment</code>
*
* @param nameFragment is the string used to search for programs
* @return List<Program> - list of Programs whose name matches the input parameter
* @throws APIException
* @should return all programs with partial name match
* @should return all programs when exact name match
* @should return empty list when name does not match
* @should not return a null list
* @should return programs when nameFragment matches beginning of program name
* @should return programs when nameFragment matches ending of program name
* @should return programs when nameFragment matches middle of program name
* @should return programs when nameFragment matches entire program name
* @should return programs ordered by name
* @should return empty list when nameFragment does not match any
*/ | Returns programs that match the given string. A null list will never be returned. An empty list will be returned if there are no programs matching this <code>nameFragment</code> | getPrograms | {
"repo_name": "shiangree/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/ProgramWorkflowService.java",
"license": "mpl-2.0",
"size": 43017
} | [
"java.util.List",
"org.openmrs.Program",
"org.openmrs.annotation.Authorized",
"org.openmrs.util.PrivilegeConstants"
] | import java.util.List; import org.openmrs.Program; import org.openmrs.annotation.Authorized; import org.openmrs.util.PrivilegeConstants; | import java.util.*; import org.openmrs.*; import org.openmrs.annotation.*; import org.openmrs.util.*; | [
"java.util",
"org.openmrs",
"org.openmrs.annotation",
"org.openmrs.util"
] | java.util; org.openmrs; org.openmrs.annotation; org.openmrs.util; | 1,991,634 |
public void testUrlInValidWithUnderscore() {
// start by initialising the mock context
setParameterToInitMockMethod("http://myurl.com/a/b_2/c/index.html", TestSolution.FAILED);
SeoRule01081 test = new SeoRule01081();
test.setProcessResultDataService(mockProcessResultDataService);
test.setTest(mockTest);
ProcessResult processResult = test.processImpl(mockSspHandler);
assertEquals(mockDefiniteResult, processResult);
} | void function() { setParameterToInitMockMethod("http: SeoRule01081 test = new SeoRule01081(); test.setProcessResultDataService(mockProcessResultDataService); test.setTest(mockTest); ProcessResult processResult = test.processImpl(mockSspHandler); assertEquals(mockDefiniteResult, processResult); } | /**
* Test to invalidate a complexe url with the underscore character in the
* middle.
*/ | Test to invalidate a complexe url with the underscore character in the middle | testUrlInValidWithUnderscore | {
"repo_name": "Asqatasun/Asqatasun",
"path": "rules/rules-seo1.0/src/test/java/org/asqatasun/rules/seo/SeoRule01081Test.java",
"license": "agpl-3.0",
"size": 6600
} | [
"junit.framework.Assert",
"org.asqatasun.entity.audit.ProcessResult"
] | import junit.framework.Assert; import org.asqatasun.entity.audit.ProcessResult; | import junit.framework.*; import org.asqatasun.entity.audit.*; | [
"junit.framework",
"org.asqatasun.entity"
] | junit.framework; org.asqatasun.entity; | 619,567 |
@NotNull
CommitBuilder addNode(@NotNull DocumentNodeState node)
throws DocumentStoreException {
checkNotNull(node);
Path path = node.getPath();
UpdateOp op = node.asOperation(revision);
if (operations.containsKey(path)) {
String msg = "Node already added: " + path;
throw new DocumentStoreException(msg);
}
if (isBranchCommit()) {
NodeDocument.setBranchCommit(op, revision);
}
operations.put(path, op);
addedNodes.add(path);
return this;
} | CommitBuilder addNode(@NotNull DocumentNodeState node) throws DocumentStoreException { checkNotNull(node); Path path = node.getPath(); UpdateOp op = node.asOperation(revision); if (operations.containsKey(path)) { String msg = STR + path; throw new DocumentStoreException(msg); } if (isBranchCommit()) { NodeDocument.setBranchCommit(op, revision); } operations.put(path, op); addedNodes.add(path); return this; } | /**
* Add a the given node and its properties to the commit.
*
* @param node the node state to add.
* @return {@code this} builder.
* @throws DocumentStoreException if there's already a modification for
* a node at the given {@code path} in this commit builder.
*/ | Add a the given node and its properties to the commit | addNode | {
"repo_name": "stillalex/jackrabbit-oak",
"path": "oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/CommitBuilder.java",
"license": "apache-2.0",
"size": 10702
} | [
"com.google.common.base.Preconditions",
"org.jetbrains.annotations.NotNull"
] | import com.google.common.base.Preconditions; import org.jetbrains.annotations.NotNull; | import com.google.common.base.*; import org.jetbrains.annotations.*; | [
"com.google.common",
"org.jetbrains.annotations"
] | com.google.common; org.jetbrains.annotations; | 1,423,693 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<PrivateEndpointConnectionInner> getWithResponse(
String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) {
return getWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<PrivateEndpointConnectionInner> function( String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { return getWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context).block(); } | /**
* Gets a private endpoint connection.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param scopeName The name of the Azure Arc PrivateLinkScope resource.
* @param privateEndpointConnectionName The name of the private endpoint connection.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a private endpoint connection.
*/ | Gets a private endpoint connection | getWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/hybridcompute/azure-resourcemanager-hybridcompute/src/main/java/com/azure/resourcemanager/hybridcompute/implementation/PrivateEndpointConnectionsClientImpl.java",
"license": "mit",
"size": 58874
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.hybridcompute.fluent.models.PrivateEndpointConnectionInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.hybridcompute.fluent.models.PrivateEndpointConnectionInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.hybridcompute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,237,987 |
@NonNull
public static String getCodePoint(@Nullable final Object caller) {
return getCodePoint(caller, 1);
} | static String function(@Nullable final Object caller) { return getCodePoint(caller, 1); } | /**
* Returns line of code from where this method called.
*
* @param caller Object who is calling for code point;
* @return String represents code point.
*/ | Returns line of code from where this method called | getCodePoint | {
"repo_name": "TouchInstinct/RoboSwag-core",
"path": "src/main/java/ru/touchin/roboswag/core/log/Lc.java",
"license": "apache-2.0",
"size": 10938
} | [
"android.support.annotation.Nullable"
] | import android.support.annotation.Nullable; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,274,548 |
public void setAutomatedCashInvestmentModelDao(AutomatedCashInvestmentModelDao automatedCashInvestmentModelDao) {
this.automatedCashInvestmentModelDao = automatedCashInvestmentModelDao;
}
| void function(AutomatedCashInvestmentModelDao automatedCashInvestmentModelDao) { this.automatedCashInvestmentModelDao = automatedCashInvestmentModelDao; } | /**
* Sets the automatedCashInvestmentModelDao attribute value.
*
* @param automatedCashInvestmentModelDao The automatedCashInvestmentModelDao to set.
*/ | Sets the automatedCashInvestmentModelDao attribute value | setAutomatedCashInvestmentModelDao | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/endow/batch/service/impl/RollFrequencyDatesServiceImpl.java",
"license": "agpl-3.0",
"size": 19718
} | [
"org.kuali.kfs.module.endow.dataaccess.AutomatedCashInvestmentModelDao"
] | import org.kuali.kfs.module.endow.dataaccess.AutomatedCashInvestmentModelDao; | import org.kuali.kfs.module.endow.dataaccess.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 1,397,596 |
public void compareCritics(Person target, List<Person> group, int flag) {
ArrayList<Review> reviewsByTarget = target.getReviews();
Double score = new Double(0.0);
//Calculate scores for each critic
for(Person critic : group) {
List<List<Review>> items = findCommonItems(reviewsByTarget, critic.getReviews());
if(flag == EUCLIDEAN_SCORE) {
score = euclideanSimDistance(items);
} else if(flag == PEARSON_SCORE ) {
score = pearsonCorrelationScore(items);
}
critic.setComparisonScore(score);
}
}
| void function(Person target, List<Person> group, int flag) { ArrayList<Review> reviewsByTarget = target.getReviews(); Double score = new Double(0.0); for(Person critic : group) { List<List<Review>> items = findCommonItems(reviewsByTarget, critic.getReviews()); if(flag == EUCLIDEAN_SCORE) { score = euclideanSimDistance(items); } else if(flag == PEARSON_SCORE ) { score = pearsonCorrelationScore(items); } critic.setComparisonScore(score); } } | /**
*Compares each member of the group against a target individual. The comparison score
*will be updated for each person in the group.
*
* @param target The individual being compared against the other group members
* @param group The collective data set
* @param flag int value indicating which comparison method should be used
*
*/ | Compares each member of the group against a target individual. The comparison score will be updated for each person in the group | compareCritics | {
"repo_name": "ShaunPlummer/Collaborative-Filtering",
"path": "src/recommend/Recommender.java",
"license": "mit",
"size": 11587
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,365,009 |
public static Long getLatestPackageEqualInTree(Long channelId,
String packageName) {
SelectMode m = ModeFactory.getMode("Channel_queries",
"latest_package_equal_in_tree");
Map params = new HashMap();
params.put("cid", channelId);
params.put("name", packageName);
List results = m.execute(params);
if (results != null && results.size() > 0) {
Map row = (Map) results.get(0);
return (Long) row.get("package_id");
}
return null;
} | static Long function(Long channelId, String packageName) { SelectMode m = ModeFactory.getMode(STR, STR); Map params = new HashMap(); params.put("cid", channelId); params.put("name", packageName); List results = m.execute(params); if (results != null && results.size() > 0) { Map row = (Map) results.get(0); return (Long) row.get(STR); } return null; } | /**
* Get the id of latest packages located in the channel tree where channelId
* is a parent
*
* @param channelId to lookup package against
* @param packageName to check
* @return List containing Maps of "CP.package_id, CP.name_id, CP.evr_id"
*/ | Get the id of latest packages located in the channel tree where channelId is a parent | getLatestPackageEqualInTree | {
"repo_name": "dmacvicar/spacewalk",
"path": "java/code/src/com/redhat/rhn/manager/channel/ChannelManager.java",
"license": "gpl-2.0",
"size": 105505
} | [
"com.redhat.rhn.common.db.datasource.ModeFactory",
"com.redhat.rhn.common.db.datasource.SelectMode",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] | import com.redhat.rhn.common.db.datasource.ModeFactory; import com.redhat.rhn.common.db.datasource.SelectMode; import java.util.HashMap; import java.util.List; import java.util.Map; | import com.redhat.rhn.common.db.datasource.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 1,312,005 |
protected Rectangle getCurrentConstraintFor(GraphicalEditPart child) {
IFigure fig = child.getFigure();
return (Rectangle) fig.getParent().getLayoutManager()
.getConstraint(fig);
} | Rectangle function(GraphicalEditPart child) { IFigure fig = child.getFigure(); return (Rectangle) fig.getParent().getLayoutManager() .getConstraint(fig); } | /**
* Retrieves the child's current constraint from the
* <code>LayoutManager</code>.
*
* @param child
* the child
* @return the current constraint
*/ | Retrieves the child's current constraint from the <code>LayoutManager</code> | getCurrentConstraintFor | {
"repo_name": "archimatetool/archi",
"path": "org.eclipse.gef/src/org/eclipse/gef/editpolicies/XYLayoutEditPolicy.java",
"license": "mit",
"size": 5942
} | [
"org.eclipse.draw2d.IFigure",
"org.eclipse.draw2d.geometry.Rectangle",
"org.eclipse.gef.GraphicalEditPart"
] | import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.geometry.Rectangle; import org.eclipse.gef.GraphicalEditPart; | import org.eclipse.draw2d.*; import org.eclipse.draw2d.geometry.*; import org.eclipse.gef.*; | [
"org.eclipse.draw2d",
"org.eclipse.gef"
] | org.eclipse.draw2d; org.eclipse.gef; | 2,882,785 |
@Idempotent
ContentSummary getContentSummary(String path) throws IOException;
/**
* Set the quota for a directory.
* @param path The string representation of the path to the directory
* @param namespaceQuota Limit on the number of names in the tree rooted
* at the directory
* @param storagespaceQuota Limit on storage space occupied all the files
* under this directory.
* @param type StorageType that the space quota is intended to be set on.
* It may be null when called by traditional space/namespace
* quota. When type is is not null, the storagespaceQuota
* parameter is for type specified and namespaceQuota must be
* {@link HdfsConstants#QUOTA_DONT_SET}.
*
* <br><br>
*
* The quota can have three types of values : (1) 0 or more will set
* the quota to that value, (2) {@link HdfsConstants#QUOTA_DONT_SET} implies
* the quota will not be changed, and (3) {@link HdfsConstants#QUOTA_RESET} | ContentSummary getContentSummary(String path) throws IOException; /** * Set the quota for a directory. * @param path The string representation of the path to the directory * @param namespaceQuota Limit on the number of names in the tree rooted * at the directory * @param storagespaceQuota Limit on storage space occupied all the files * under this directory. * @param type StorageType that the space quota is intended to be set on. * It may be null when called by traditional space/namespace * quota. When type is is not null, the storagespaceQuota * parameter is for type specified and namespaceQuota must be * {@link HdfsConstants#QUOTA_DONT_SET}. * * <br><br> * * The quota can have three types of values : (1) 0 or more will set * the quota to that value, (2) {@link HdfsConstants#QUOTA_DONT_SET} implies * the quota will not be changed, and (3) {@link HdfsConstants#QUOTA_RESET} | /**
* Get {@link ContentSummary} rooted at the specified directory.
* @param path The string representation of the path
*
* @throws org.apache.hadoop.security.AccessControlException permission denied
* @throws java.io.FileNotFoundException file <code>path</code> is not found
* @throws org.apache.hadoop.fs.UnresolvedLinkException if <code>path</code>
* contains a symlink.
* @throws IOException If an I/O error occurred
*/ | Get <code>ContentSummary</code> rooted at the specified directory | getContentSummary | {
"repo_name": "NJUJYB/disYarn",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 60058
} | [
"java.io.IOException",
"org.apache.hadoop.fs.ContentSummary",
"org.apache.hadoop.fs.StorageType"
] | import java.io.IOException; import org.apache.hadoop.fs.ContentSummary; import org.apache.hadoop.fs.StorageType; | import java.io.*; import org.apache.hadoop.fs.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,903,881 |
public synchronized Tag addTag(String tagName, ReferenceDescriptor ref, Profile profile)
throws TagNameException, TagNamePermissionException {
String objIdentifier = ref.getClassDescriptor().getSimpleName() + "." + ref.getName();
if (ref instanceof CollectionDescriptor) {
return addTag(tagName, objIdentifier, TagTypes.COLLECTION, profile);
} else {
return addTag(tagName, objIdentifier, TagTypes.REFERENCE, profile);
}
} | synchronized Tag function(String tagName, ReferenceDescriptor ref, Profile profile) throws TagNameException, TagNamePermissionException { String objIdentifier = ref.getClassDescriptor().getSimpleName() + "." + ref.getName(); if (ref instanceof CollectionDescriptor) { return addTag(tagName, objIdentifier, TagTypes.COLLECTION, profile); } else { return addTag(tagName, objIdentifier, TagTypes.REFERENCE, profile); } } | /**
* Associate a reference with a certain tag.
* @param tagName The tag we want to give this reference.
* @param ref the reference.
* @param profile The profile to associate this tag with.
* @return A tag object.
* @throws TagNameException If the name is invalid (contains illegal characters)
* @throws TagNamePermissionException If this tag name is restricted.
*/ | Associate a reference with a certain tag | addTag | {
"repo_name": "elsiklab/intermine",
"path": "intermine/api/main/src/org/intermine/api/profile/TagManager.java",
"license": "lgpl-2.1",
"size": 29383
} | [
"org.intermine.api.tag.TagTypes",
"org.intermine.metadata.CollectionDescriptor",
"org.intermine.metadata.ReferenceDescriptor",
"org.intermine.model.userprofile.Tag"
] | import org.intermine.api.tag.TagTypes; import org.intermine.metadata.CollectionDescriptor; import org.intermine.metadata.ReferenceDescriptor; import org.intermine.model.userprofile.Tag; | import org.intermine.api.tag.*; import org.intermine.metadata.*; import org.intermine.model.userprofile.*; | [
"org.intermine.api",
"org.intermine.metadata",
"org.intermine.model"
] | org.intermine.api; org.intermine.metadata; org.intermine.model; | 269,780 |
private void writeWorkspaceSchemesForProjects(
ImmutableMap<BuildTarget, PBXTarget> buildTargetToPBXTarget,
ImmutableSet<PBXTarget> schemeTargets,
ImmutableSetMultimap<PBXProject, PBXTarget> generatedProjectToPbxTargets,
ImmutableMap<PBXTarget, Path> targetToProjectPathMap,
ImmutableSetMultimap<String, PBXTarget> buildForTestTargets,
ImmutableSetMultimap<String, PBXTarget> ungroupedTestTargets)
throws IOException {
ImmutableSetMultimap<PBXTarget, BuildTarget> pbxTargetToBuildTarget =
buildTargetToPBXTarget.asMultimap().inverse();
// create all the scheme generators for each project
for (PBXProject project : generatedProjectToPbxTargets.keys()) {
String schemeName = project.getName();
ImmutableSet<PBXTarget> projectTargets = generatedProjectToPbxTargets.get(project);
ImmutableSet<PBXTarget> orderedBuildTestTargets =
projectTargets.stream()
.filter(pbxTarget -> buildForTestTargets.values().contains(pbxTarget))
.collect(ImmutableSet.toImmutableSet());
ImmutableSet<PBXTarget> orderedRunTestTargets =
projectTargets.stream()
.filter(pbxTarget -> ungroupedTestTargets.values().contains(pbxTarget))
.collect(ImmutableSet.toImmutableSet());
// add all non-test targets as full build targets
ImmutableSet<PBXTarget> orderedBuildTargets =
projectTargets.stream()
.filter(pbxTarget -> schemeTargets.contains(pbxTarget))
.filter(pbxTarget -> !orderedBuildTestTargets.contains(pbxTarget))
.collect(ImmutableSet.toImmutableSet());
// generate scheme inside xcodeproj
ImmutableSet<BuildTarget> buildTargets =
pbxTargetToBuildTarget.get(project.getTargets().get(0));
BuildTarget buildTarget = buildTargets.iterator().next();
Path projectOutputDirectory =
buildTarget
.getCellRelativeBasePath()
.getPath()
.toPath(rootCell.getFilesystem().getFileSystem())
.resolve(project.getName() + ".xcodeproj");
SchemeGenerator schemeGenerator =
buildSchemeGenerator(
targetToProjectPathMap,
projectOutputDirectory,
schemeName,
Optional.empty(),
Optional.empty(),
orderedBuildTargets,
orderedBuildTestTargets,
orderedRunTestTargets,
Optional.empty(),
Optional.empty(),
Optional.empty());
schemeGenerator.writeScheme();
schemeGenerators.put(schemeName, schemeGenerator);
}
} | void function( ImmutableMap<BuildTarget, PBXTarget> buildTargetToPBXTarget, ImmutableSet<PBXTarget> schemeTargets, ImmutableSetMultimap<PBXProject, PBXTarget> generatedProjectToPbxTargets, ImmutableMap<PBXTarget, Path> targetToProjectPathMap, ImmutableSetMultimap<String, PBXTarget> buildForTestTargets, ImmutableSetMultimap<String, PBXTarget> ungroupedTestTargets) throws IOException { ImmutableSetMultimap<PBXTarget, BuildTarget> pbxTargetToBuildTarget = buildTargetToPBXTarget.asMultimap().inverse(); for (PBXProject project : generatedProjectToPbxTargets.keys()) { String schemeName = project.getName(); ImmutableSet<PBXTarget> projectTargets = generatedProjectToPbxTargets.get(project); ImmutableSet<PBXTarget> orderedBuildTestTargets = projectTargets.stream() .filter(pbxTarget -> buildForTestTargets.values().contains(pbxTarget)) .collect(ImmutableSet.toImmutableSet()); ImmutableSet<PBXTarget> orderedRunTestTargets = projectTargets.stream() .filter(pbxTarget -> ungroupedTestTargets.values().contains(pbxTarget)) .collect(ImmutableSet.toImmutableSet()); ImmutableSet<PBXTarget> orderedBuildTargets = projectTargets.stream() .filter(pbxTarget -> schemeTargets.contains(pbxTarget)) .filter(pbxTarget -> !orderedBuildTestTargets.contains(pbxTarget)) .collect(ImmutableSet.toImmutableSet()); ImmutableSet<BuildTarget> buildTargets = pbxTargetToBuildTarget.get(project.getTargets().get(0)); BuildTarget buildTarget = buildTargets.iterator().next(); Path projectOutputDirectory = buildTarget .getCellRelativeBasePath() .getPath() .toPath(rootCell.getFilesystem().getFileSystem()) .resolve(project.getName() + STR); SchemeGenerator schemeGenerator = buildSchemeGenerator( targetToProjectPathMap, projectOutputDirectory, schemeName, Optional.empty(), Optional.empty(), orderedBuildTargets, orderedBuildTestTargets, orderedRunTestTargets, Optional.empty(), Optional.empty(), Optional.empty()); schemeGenerator.writeScheme(); schemeGenerators.put(schemeName, schemeGenerator); } } | /**
* Create individual schemes for each project and associated tests. Provided as a workaround for a
* change in Xcode 10 where Apple started building all scheme targets and tests when clicking on a
* single item from the test navigator. These schemes will be written inside of the xcodeproj.
*
* @param buildTargetToPBXTarget Map that, when reversed, is used to look up of the BuildTarget to
* generate the output directory for the scheme.
* @param schemeTargets Targets to be considered for scheme. Allows external filtering of targets
* included in the project's scheme.
* @param generatedProjectToPbxTargets
* @param targetToProjectPathMap
* @param buildForTestTargets
* @param ungroupedTestTargets
* @throws IOException
*/ | Create individual schemes for each project and associated tests. Provided as a workaround for a change in Xcode 10 where Apple started building all scheme targets and tests when clicking on a single item from the test navigator. These schemes will be written inside of the xcodeproj | writeWorkspaceSchemesForProjects | {
"repo_name": "nguyentruongtho/buck",
"path": "src/com/facebook/buck/features/apple/project/WorkspaceAndProjectGenerator.java",
"license": "apache-2.0",
"size": 57021
} | [
"com.facebook.buck.apple.xcode.xcodeproj.PBXProject",
"com.facebook.buck.apple.xcode.xcodeproj.PBXTarget",
"com.facebook.buck.core.model.BuildTarget",
"com.google.common.collect.ImmutableMap",
"com.google.common.collect.ImmutableSet",
"com.google.common.collect.ImmutableSetMultimap",
"java.io.IOException",
"java.nio.file.Path",
"java.util.Optional"
] | import com.facebook.buck.apple.xcode.xcodeproj.PBXProject; import com.facebook.buck.apple.xcode.xcodeproj.PBXTarget; import com.facebook.buck.core.model.BuildTarget; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSetMultimap; import java.io.IOException; import java.nio.file.Path; import java.util.Optional; | import com.facebook.buck.apple.xcode.xcodeproj.*; import com.facebook.buck.core.model.*; import com.google.common.collect.*; import java.io.*; import java.nio.file.*; import java.util.*; | [
"com.facebook.buck",
"com.google.common",
"java.io",
"java.nio",
"java.util"
] | com.facebook.buck; com.google.common; java.io; java.nio; java.util; | 2,565,013 |
public Attribute add(String id, Object value, String name) {
return add(id, value, name, namespace);
} | Attribute function(String id, Object value, String name) { return add(id, value, name, namespace); } | /**
* Adds an attribute to the complex attribute being built. <br>
*
* <p>The result of {@link #getNamespaceURI()} to build a qualified attribute name.
*
* <p>This method uses the type supplied in {@link #setType(AttributeType)} in order to
* determine the attribute type.
*
* @param id The id of the attribute.
* @param name The name of the attribute.
* @param value The value of the attribute.
*/ | Adds an attribute to the complex attribute being built. The result of <code>#getNamespaceURI()</code> to build a qualified attribute name. This method uses the type supplied in <code>#setType(AttributeType)</code> in order to determine the attribute type | add | {
"repo_name": "geotools/geotools",
"path": "modules/library/main/src/main/java/org/geotools/feature/AttributeBuilder.java",
"license": "lgpl-2.1",
"size": 20078
} | [
"org.opengis.feature.Attribute"
] | import org.opengis.feature.Attribute; | import org.opengis.feature.*; | [
"org.opengis.feature"
] | org.opengis.feature; | 2,301,712 |
public static void sqlpower(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException {
twoArgumentsFunctionCall(buf, "pow(", "power", parsedArgs);
} | static void function(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { twoArgumentsFunctionCall(buf, "pow(", "power", parsedArgs); } | /**
* power to pow translation
*
* @param buf The buffer to append into
* @param parsedArgs arguments
* @throws SQLException if something wrong happens
*/ | power to pow translation | sqlpower | {
"repo_name": "golovnin/pgjdbc",
"path": "pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java",
"license": "bsd-2-clause",
"size": 25169
} | [
"java.sql.SQLException",
"java.util.List"
] | import java.sql.SQLException; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,012,300 |
public Configurable withLogOptions(HttpLogOptions httpLogOptions) {
this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null.");
return this;
} | Configurable function(HttpLogOptions httpLogOptions) { this.httpLogOptions = Objects.requireNonNull(httpLogOptions, STR); return this; } | /**
* Sets the logging options to the HTTP pipeline.
*
* @param httpLogOptions the HTTP log options.
* @return the configurable object itself.
*/ | Sets the logging options to the HTTP pipeline | withLogOptions | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/subscription/azure-resourcemanager-subscription/src/main/java/com/azure/resourcemanager/subscription/SubscriptionManager.java",
"license": "mit",
"size": 10888
} | [
"com.azure.core.http.policy.HttpLogOptions",
"java.util.Objects"
] | import com.azure.core.http.policy.HttpLogOptions; import java.util.Objects; | import com.azure.core.http.policy.*; import java.util.*; | [
"com.azure.core",
"java.util"
] | com.azure.core; java.util; | 937,534 |
@Test (expected = AssertionError.class)
public void emptyMessageTest()
throws AssertionError
{
new SwException("");
fail("no assertion error thrown");
} | @Test (expected = AssertionError.class) void function() throws AssertionError { new SwException(STRno assertion error thrown"); } | /**
* Test the constructor throws an exception with invalid arguments.
*
* @throws AssertionError the generated exception
*/ | Test the constructor throws an exception with invalid arguments | emptyMessageTest | {
"repo_name": "shawware/Util",
"path": "src/test/java/au/com/shawware/util/SwExceptionTest.java",
"license": "gpl-3.0",
"size": 4528
} | [
"org.junit.Test"
] | import org.junit.Test; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,311,079 |
public Parabola2D reverse() {
return new Parabola2D(xv, yv, -a, Angle2D.formatAngle(theta + PI));
}
| Parabola2D function() { return new Parabola2D(xv, yv, -a, Angle2D.formatAngle(theta + PI)); } | /**
* Returns the parabola with same vertex, direction vector in opposite
* direction and opposite parameter <code>p</code>.
*/ | Returns the parabola with same vertex, direction vector in opposite direction and opposite parameter <code>p</code> | reverse | {
"repo_name": "pokowaka/android-geom",
"path": "geom/src/main/java/math/geom2d/conic/Parabola2D.java",
"license": "lgpl-2.1",
"size": 20182
} | [
"math.geom2d.Angle2D"
] | import math.geom2d.Angle2D; | import math.geom2d.*; | [
"math.geom2d"
] | math.geom2d; | 1,325,573 |
@Test
public void testGracefulFailureRequestContextWithSemaphoreIsolatedAsynchronousObservable() {
RequestContextTestResults results = testRequestContextOnGracefulFailure(ExecutionIsolationStrategy.SEMAPHORE, Schedulers.newThread());
assertFalse(results.isContextInitialized.get()); // it won't have request context as it's on a user provided thread/scheduler
assertTrue(results.originThread.get().getName().startsWith("RxNewThread")); // the user provided thread/scheduler
assertTrue(results.isContextInitializedObserveOn.get()); // we capture and set the context once the user provided Observable emits
assertTrue(results.observeOnThread.get().getName().startsWith("RxNewThread")); // the user provided thread/scheduler
// semaphore isolated
assertFalse(results.command.isExecutedInThread());
} | void function() { RequestContextTestResults results = testRequestContextOnGracefulFailure(ExecutionIsolationStrategy.SEMAPHORE, Schedulers.newThread()); assertFalse(results.isContextInitialized.get()); assertTrue(results.originThread.get().getName().startsWith(STR)); assertTrue(results.isContextInitializedObserveOn.get()); assertTrue(results.observeOnThread.get().getName().startsWith(STR)); assertFalse(results.command.isExecutedInThread()); } | /**
* Async Observable and semaphore isolation. User provided thread [RxNewThread] does everything.
*
* NOTE: RequestContext will NOT exist on that thread.
*
* An async Observable running on its own thread will not have access to the request context unless the user manages the context.
*/ | Async Observable and semaphore isolation. User provided thread [RxNewThread] does everything. An async Observable running on its own thread will not have access to the request context unless the user manages the context | testGracefulFailureRequestContextWithSemaphoreIsolatedAsynchronousObservable | {
"repo_name": "daveray/Hystrix",
"path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixObservableCommandTest.java",
"license": "apache-2.0",
"size": 357869
} | [
"com.netflix.hystrix.HystrixCommandProperties",
"org.junit.Assert"
] | import com.netflix.hystrix.HystrixCommandProperties; import org.junit.Assert; | import com.netflix.hystrix.*; import org.junit.*; | [
"com.netflix.hystrix",
"org.junit"
] | com.netflix.hystrix; org.junit; | 2,004,391 |
private void readRecordDefinitionsFromFile(final Path path) {
try {
List<TemplateRecordConfiguration> fileDefinitions =
objectMapper.readValue(
Files.newBufferedReader(path, StandardCharsets.UTF_8),
objectMapper
.getTypeFactory()
.constructCollectionType(List.class, TemplateRecordConfiguration.class));
String namespace = path.toFile().getName();
recordDefinitions.putAll(namespace, fileDefinitions);
} catch (IOException e) {
getMonitor().warn("Failed to read from recordDefinitions from file " + path, e);
}
} | void function(final Path path) { try { List<TemplateRecordConfiguration> fileDefinitions = objectMapper.readValue( Files.newBufferedReader(path, StandardCharsets.UTF_8), objectMapper .getTypeFactory() .constructCollectionType(List.class, TemplateRecordConfiguration.class)); String namespace = path.toFile().getName(); recordDefinitions.putAll(namespace, fileDefinitions); } catch (IOException e) { getMonitor().warn(STR + path, e); } } | /**
* Read record definitions from YAML file.
*
* @param path the path
*/ | Read record definitions from YAML file | readRecordDefinitionsFromFile | {
"repo_name": "dstl/baleen",
"path": "baleen-annotators/src/main/java/uk/gov/dstl/baleen/annotators/templates/AbstractTemplateAnnotator.java",
"license": "apache-2.0",
"size": 2974
} | [
"java.io.IOException",
"java.nio.charset.StandardCharsets",
"java.nio.file.Files",
"java.nio.file.Path",
"java.util.List"
] | import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.util.List; | import java.io.*; import java.nio.charset.*; import java.nio.file.*; import java.util.*; | [
"java.io",
"java.nio",
"java.util"
] | java.io; java.nio; java.util; | 1,788,214 |
public HashSet<Integer> getChosenColors() {
return chosenColors;
} | HashSet<Integer> function() { return chosenColors; } | /**
* Returns the set of already used colors.
*
* @return HashSet of used colors
*/ | Returns the set of already used colors | getChosenColors | {
"repo_name": "ghavelan/Four",
"path": "app/src/main/java/be/ghavelan/fastfill/GameView.java",
"license": "mit",
"size": 23052
} | [
"java.util.HashSet"
] | import java.util.HashSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,657,143 |
public static void encode(byte[] data, int off, int len, Writer writer) throws IOException {
if (len <= 0)
return;
char[] out = new char[4];
int rindex = off;
int rest = len - off;
int output = 0;
while (rest >= 3) {
int i = ((data[rindex] & 0xff) << 16)
+ ((data[rindex + 1] & 0xff) << 8)
+ (data[rindex + 2] & 0xff);
out[0] = S_BASE64CHAR[i >> 18];
out[1] = S_BASE64CHAR[(i >> 12) & 0x3f];
out[2] = S_BASE64CHAR[(i >> 6) & 0x3f];
out[3] = S_BASE64CHAR[i & 0x3f];
writer.write(out, 0, 4);
rindex += 3;
rest -= 3;
output += 4;
if (output % 76 == 0)
writer.write("\n");
}
if (rest == 1) {
int i = data[rindex] & 0xff;
out[0] = S_BASE64CHAR[i >> 2];
out[1] = S_BASE64CHAR[(i << 4) & 0x3f];
out[2] = S_BASE64PAD;
out[3] = S_BASE64PAD;
writer.write(out, 0, 4);
} else if (rest == 2) {
int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff);
out[0] = S_BASE64CHAR[i >> 10];
out[1] = S_BASE64CHAR[(i >> 4) & 0x3f];
out[2] = S_BASE64CHAR[(i << 2) & 0x3f];
out[3] = S_BASE64PAD;
writer.write(out, 0, 4);
}
} | static void function(byte[] data, int off, int len, Writer writer) throws IOException { if (len <= 0) return; char[] out = new char[4]; int rindex = off; int rest = len - off; int output = 0; while (rest >= 3) { int i = ((data[rindex] & 0xff) << 16) + ((data[rindex + 1] & 0xff) << 8) + (data[rindex + 2] & 0xff); out[0] = S_BASE64CHAR[i >> 18]; out[1] = S_BASE64CHAR[(i >> 12) & 0x3f]; out[2] = S_BASE64CHAR[(i >> 6) & 0x3f]; out[3] = S_BASE64CHAR[i & 0x3f]; writer.write(out, 0, 4); rindex += 3; rest -= 3; output += 4; if (output % 76 == 0) writer.write("\n"); } if (rest == 1) { int i = data[rindex] & 0xff; out[0] = S_BASE64CHAR[i >> 2]; out[1] = S_BASE64CHAR[(i << 4) & 0x3f]; out[2] = S_BASE64PAD; out[3] = S_BASE64PAD; writer.write(out, 0, 4); } else if (rest == 2) { int i = ((data[rindex] & 0xff) << 8) + (data[rindex + 1] & 0xff); out[0] = S_BASE64CHAR[i >> 10]; out[1] = S_BASE64CHAR[(i >> 4) & 0x3f]; out[2] = S_BASE64CHAR[(i << 2) & 0x3f]; out[3] = S_BASE64PAD; writer.write(out, 0, 4); } } | /**
* Outputs base64 representation of the specified byte array to a character stream.
*/ | Outputs base64 representation of the specified byte array to a character stream | encode | {
"repo_name": "kgibm/open-liberty",
"path": "dev/com.ibm.ws.security.oauth/src/com/ibm/ws/security/oauth20/util/Base64.java",
"license": "epl-1.0",
"size": 12851
} | [
"java.io.IOException",
"java.io.Writer"
] | import java.io.IOException; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 214,233 |
private static IIOMetadataNode getNode(IIOMetadataNode rootNode,
String nodeName) {
int nNodes = rootNode.getLength();
for (int i = 0; i < nNodes; i++) {
if (rootNode.item(i).getNodeName().compareToIgnoreCase(nodeName) == 0) {
return ((IIOMetadataNode) rootNode.item(i));
}
}
IIOMetadataNode node = new IIOMetadataNode(nodeName);
rootNode.appendChild(node);
return (node);
}
| static IIOMetadataNode function(IIOMetadataNode rootNode, String nodeName) { int nNodes = rootNode.getLength(); for (int i = 0; i < nNodes; i++) { if (rootNode.item(i).getNodeName().compareToIgnoreCase(nodeName) == 0) { return ((IIOMetadataNode) rootNode.item(i)); } } IIOMetadataNode node = new IIOMetadataNode(nodeName); rootNode.appendChild(node); return (node); } | /**
* Returns an existing child node, or creates and returns a new child node
* (if the requested node does not exist).
*
* @param rootNode
* the <tt>IIOMetadataNode</tt> to search for the child node.
* @param nodeName
* the name of the child node.
*
* @return the child node, if found or a new node created with the given
* name.
*/ | Returns an existing child node, or creates and returns a new child node (if the requested node does not exist) | getNode | {
"repo_name": "p-smith/open-ig",
"path": "src/hu/openig/tools/ani/GifSequenceWriter.java",
"license": "lgpl-3.0",
"size": 9235
} | [
"javax.imageio.metadata.IIOMetadataNode"
] | import javax.imageio.metadata.IIOMetadataNode; | import javax.imageio.metadata.*; | [
"javax.imageio"
] | javax.imageio; | 2,140,983 |
public QNameComparator getQNameComparator(){
return qNameComparator;
} | QNameComparator function(){ return qNameComparator; } | /**
* Utility method just to access to the QName comparator
* @return the comparator used to comare QName's
*/ | Utility method just to access to the QName comparator | getQNameComparator | {
"repo_name": "iCarto/siga",
"path": "libGPE-KML/src/org/gvsig/gpe/kml/parser/GPEDefaultKmlParser.java",
"license": "gpl-3.0",
"size": 5602
} | [
"org.gvsig.gpe.xml.utils.QNameComparator"
] | import org.gvsig.gpe.xml.utils.QNameComparator; | import org.gvsig.gpe.xml.utils.*; | [
"org.gvsig.gpe"
] | org.gvsig.gpe; | 37,524 |
ApplicationId appId(); | ApplicationId appId(); | /**
* The id of the application which created this meter.
*
* @return an application id
*/ | The id of the application which created this meter | appId | {
"repo_name": "oplinkoms/onos",
"path": "core/api/src/main/java/org/onosproject/net/meter/MeterRequest.java",
"license": "apache-2.0",
"size": 3386
} | [
"org.onosproject.core.ApplicationId"
] | import org.onosproject.core.ApplicationId; | import org.onosproject.core.*; | [
"org.onosproject.core"
] | org.onosproject.core; | 1,591,511 |
public static int getDocumentsPageSize() {
try {
return getConfiguration().getInt("documents.page.size", DEFAULT_DOCUMENTS_PAGE_SIZE);
} catch (ConfigurationException e) {
// Silently return the default value and log the exception.
Sophie.log.warn("Unable to get page size from configuration file", e);
return DEFAULT_DOCUMENTS_PAGE_SIZE;
}
} | static int function() { try { return getConfiguration().getInt(STR, DEFAULT_DOCUMENTS_PAGE_SIZE); } catch (ConfigurationException e) { Sophie.log.warn(STR, e); return DEFAULT_DOCUMENTS_PAGE_SIZE; } } | /**
* Get page size from the properties file. If no value is listed in the
* properties file, return DEFAULT_DOCUMENTS_PAGE_SIZE
*
* @return Page size used in the documents table.
*/ | Get page size from the properties file. If no value is listed in the properties file, return DEFAULT_DOCUMENTS_PAGE_SIZE | getDocumentsPageSize | {
"repo_name": "Fengtan/solr-gui",
"path": "src/main/java/com/github/fengtan/sophie/beans/Config.java",
"license": "mit",
"size": 5377
} | [
"com.github.fengtan.sophie.Sophie",
"org.apache.commons.configuration.ConfigurationException"
] | import com.github.fengtan.sophie.Sophie; import org.apache.commons.configuration.ConfigurationException; | import com.github.fengtan.sophie.*; import org.apache.commons.configuration.*; | [
"com.github.fengtan",
"org.apache.commons"
] | com.github.fengtan; org.apache.commons; | 764,756 |
interface WithSku {
WithCreate withSku(Sku sku);
}
interface WithCreate extends Creatable<RelayNamespace>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithSku {
}
}
interface Update extends Appliable<RelayNamespace>, Resource.UpdateWithTags<Update>, UpdateStages.WithSku {
} | interface WithSku { WithCreate withSku(Sku sku); } interface WithCreate extends Creatable<RelayNamespace>, Resource.DefinitionWithTags<WithCreate>, DefinitionStages.WithSku { } } interface Update extends Appliable<RelayNamespace>, Resource.UpdateWithTags<Update>, UpdateStages.WithSku { } | /**
* Specifies sku.
* @param sku SKU of the namespace
* @return the next definition stage
*/ | Specifies sku | withSku | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/relay/mgmt-v2017_04_01/src/main/java/com/microsoft/azure/management/relay/v2017_04_01/RelayNamespace.java",
"license": "mit",
"size": 3917
} | [
"com.microsoft.azure.arm.model.Appliable",
"com.microsoft.azure.arm.model.Creatable",
"com.microsoft.azure.arm.resources.models.Resource"
] | import com.microsoft.azure.arm.model.Appliable; import com.microsoft.azure.arm.model.Creatable; import com.microsoft.azure.arm.resources.models.Resource; | import com.microsoft.azure.arm.model.*; import com.microsoft.azure.arm.resources.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 616,273 |
public static boolean deleteRecursively(File file) {
if (file.isDirectory()) {
deleteContents(file);
}
// if I can delete directory then I know everything was deleted
return file.delete();
} | static boolean function(File file) { if (file.isDirectory()) { deleteContents(file); } return file.delete(); } | /**
* Deletes the file and if it's a directory deletes also any content in it
*
* @param file a file or directory
* @return true if the file/directory could be deleted
*/ | Deletes the file and if it's a directory deletes also any content in it | deleteRecursively | {
"repo_name": "facebook/fresco",
"path": "fbcore/src/main/java/com/facebook/common/file/FileTree.java",
"license": "mit",
"size": 2242
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 482,440 |
public RoutingChangesObserver changes() {
return routingChangesObserver;
} | RoutingChangesObserver function() { return routingChangesObserver; } | /**
* Returns observer to use for changes made to the routing nodes
*/ | Returns observer to use for changes made to the routing nodes | changes | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/cluster/routing/allocation/RoutingAllocation.java",
"license": "apache-2.0",
"size": 10369
} | [
"org.elasticsearch.cluster.routing.RoutingChangesObserver"
] | import org.elasticsearch.cluster.routing.RoutingChangesObserver; | import org.elasticsearch.cluster.routing.*; | [
"org.elasticsearch.cluster"
] | org.elasticsearch.cluster; | 1,169,202 |
public void putSingleInstance(RootFragment fragment) {
ArrayList<RootFragment> frags = new ArrayList<>();
frags.add(fragment);
stackList.add(frags);
} | void function(RootFragment fragment) { ArrayList<RootFragment> frags = new ArrayList<>(); frags.add(fragment); stackList.add(frags); } | /**
* singleInstance mode,Create a new task stack at a time.
*
* @param fragment 加入的fragment
*/ | singleInstance mode,Create a new task stack at a time | putSingleInstance | {
"repo_name": "Mr-wangyong/FragmentStack",
"path": "stacklibrary/src/main/java/com/mrwang/stacklibrary/FragmentStack.java",
"license": "apache-2.0",
"size": 4674
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 659,299 |
public E poll() {
final ReentrantLock lock = this.lock;
lock.lock();
long t = now();
TenantQueue.Item item = null;
try {
TenantQueue q = nextQueue(t);
if (q == null || q.next > t)
return null;
else {
item = q.poll(t);
return item == null ? null : item.element;
}
} finally {
lock.unlock();
done(item, t);
}
}
/**
* Retrieves and removes the head of this queue, waiting if necessary until
* an element with an expired delay is available on this queue.
*
* @return the head of this queue
* @throws InterruptedException
* {@inheritDoc} | E function() { final ReentrantLock lock = this.lock; lock.lock(); long t = now(); TenantQueue.Item item = null; try { TenantQueue q = nextQueue(t); if (q == null q.next > t) return null; else { item = q.poll(t); return item == null ? null : item.element; } } finally { lock.unlock(); done(item, t); } } /** * Retrieves and removes the head of this queue, waiting if necessary until * an element with an expired delay is available on this queue. * * @return the head of this queue * @throws InterruptedException * {@inheritDoc} | /**
* Retrieves and removes the head of this queue, or returns <tt>null</tt> if
* this queue has no elements with an expired delay.
*
* @return the head of this queue, or <tt>null</tt> if this queue has no
* elements with an expired delay
*/ | Retrieves and removes the head of this queue, or returns null if this queue has no elements with an expired delay | poll | {
"repo_name": "brownsys/tracing-framework",
"path": "retro/throttling/src/main/java/edu/brown/cs/systems/retro/throttling/throttlingqueues/ThrottlingLockingQueue.java",
"license": "bsd-3-clause",
"size": 27084
} | [
"java.util.concurrent.locks.ReentrantLock"
] | import java.util.concurrent.locks.ReentrantLock; | import java.util.concurrent.locks.*; | [
"java.util"
] | java.util; | 1,856,323 |
public void setRootPane(JRootPane root) {
super.setRootPane(root);
}
| void function(JRootPane root) { super.setRootPane(root); } | /**
* Overloaded to make this public.
*/ | Overloaded to make this public | setRootPane | {
"repo_name": "mbshopM/openconcerto",
"path": "OpenConcerto/src/org/jdesktop/swingx/JXFrame.java",
"license": "gpl-3.0",
"size": 2904
} | [
"javax.swing.JRootPane"
] | import javax.swing.JRootPane; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,253,089 |
@Test
public void getEntityType_notSet() {
assertNull("An incomplete accessId will return null",
AccessIdUtil.getEntityType(defaultRealm + "/uniqueId"));
} | void function() { assertNull(STR, AccessIdUtil.getEntityType(defaultRealm + STR)); } | /**
* Test method for {@link com.ibm.ws.security.AccessIdUtil#getEntityType(java.lang.String)}.
*/ | Test method for <code>com.ibm.ws.security.AccessIdUtil#getEntityType(java.lang.String)</code> | getEntityType_notSet | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security/test/com/ibm/ws/security/AccessIdUtilTest.java",
"license": "epl-1.0",
"size": 26900
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,318,951 |
@Override
public void contributeToMenu(IMenuManager menuManager) {
super.contributeToMenu(menuManager);
IMenuManager submenuManager = new MenuManager(vpmEditorPlugin.INSTANCE.getString("_UI_variabilityEditor_menu"),
"org.splevo.vpm.variabilityMenuID");
menuManager.insertAfter("additions", submenuManager);
submenuManager.add(new Separator("settings"));
submenuManager.add(new Separator("actions"));
submenuManager.add(new Separator("additions"));
submenuManager.add(new Separator("additions-end"));
// Prepare for CreateChild item addition or removal.
//
createChildMenuManager = new MenuManager(vpmEditorPlugin.INSTANCE.getString("_UI_CreateChild_menu_item"));
submenuManager.insertBefore("additions", createChildMenuManager);
// Prepare for CreateSibling item addition or removal.
//
createSiblingMenuManager = new MenuManager(vpmEditorPlugin.INSTANCE.getString("_UI_CreateSibling_menu_item"));
submenuManager.insertBefore("additions", createSiblingMenuManager); | void function(IMenuManager menuManager) { super.contributeToMenu(menuManager); IMenuManager submenuManager = new MenuManager(vpmEditorPlugin.INSTANCE.getString(STR), STR); menuManager.insertAfter(STR, submenuManager); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.add(new Separator(STR)); submenuManager.insertBefore(STR, createChildMenuManager); submenuManager.insertBefore(STR, createSiblingMenuManager); | /**
* This adds to the menu bar a menu and some separators for editor additions,
* as well as the sub-menus for object creation items.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This adds to the menu bar a menu and some separators for editor additions, as well as the sub-menus for object creation items. | contributeToMenu | {
"repo_name": "kopl/SPLevo",
"path": "VPM/org.splevo.vpm.editor/src-gen/org/splevo/vpm/variability/presentation/variabilityActionBarContributor.java",
"license": "epl-1.0",
"size": 15954
} | [
"org.eclipse.jface.action.IMenuManager",
"org.eclipse.jface.action.MenuManager",
"org.eclipse.jface.action.Separator"
] | import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; | import org.eclipse.jface.action.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 135,312 |
private String extractLabel(JsonNode node) {
if (node != null && node.has(LABEL)) {
return node.get(LABEL).asText();
}
return null;
} | String function(JsonNode node) { if (node != null && node.has(LABEL)) { return node.get(LABEL).asText(); } return null; } | /**
* Extract the label from a node
* @param node The node to have the label extracted from
* @return The string for the label of the node
*/ | Extract the label from a node | extractLabel | {
"repo_name": "common-workflow-language/cwlviewer",
"path": "src/main/java/org/commonwl/view/cwl/CWLService.java",
"license": "apache-2.0",
"size": 40945
} | [
"com.fasterxml.jackson.databind.JsonNode"
] | import com.fasterxml.jackson.databind.JsonNode; | import com.fasterxml.jackson.databind.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,426,251 |
protected String getActorName(String actorPath) {
int indexOfLastSlash = StringUtils.lastIndexOf(actorPath, "/");
return actorPath.substring(indexOfLastSlash+1);
} | String function(String actorPath) { int indexOfLastSlash = StringUtils.lastIndexOf(actorPath, "/"); return actorPath.substring(indexOfLastSlash+1); } | /**
* Returns the name of the Actor specified by <b>actorPath</b>. <br>
* Example: <br>
* getActorName("/user/ActorSupervisor/Some/Actor/Stuff") -> "Stuff"
*
* @param actorPath ActorPath (/user/ActorSupervisor/Some/Actor)
* @return ActorName
*/ | Returns the name of the Actor specified by actorPath. Example: getActorName("/user/ActorSupervisor/Some/Actor/Stuff") -> "Stuff" | getActorName | {
"repo_name": "SES-fortiss/SmartGridCoSimulation",
"path": "core/gridarchitect/src/main/java/topology/ActorTopology.java",
"license": "apache-2.0",
"size": 10704
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,342,906 |
public static List<Surfer> getRandomSurferList() {
List<Surfer> list = getSurferList();
Collections.shuffle(list);
return list.subList(0, RANDOM_SURFER_LIST_SIZE);
} | static List<Surfer> function() { List<Surfer> list = getSurferList(); Collections.shuffle(list); return list.subList(0, RANDOM_SURFER_LIST_SIZE); } | /**
* Get a randomized List of 3 Surfers.
* @return A List of 3 random Surfers.
*/ | Get a randomized List of 3 Surfers | getRandomSurferList | {
"repo_name": "andrewpw/surferpedia",
"path": "app/models/SurferDB.java",
"license": "apache-2.0",
"size": 4615
} | [
"java.util.Collections",
"java.util.List"
] | import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,212,796 |
@Override
public String validateEdge(Object _edge, Object _source, Object _target) {
// cast
mxCell edge = (mxCell) _edge;
// get user objects
ComponentWrapper source = (ComponentWrapper) ((mxCell) _source)
.getValue();
ComponentWrapper target = (ComponentWrapper) ((mxCell) _target)
.getValue();
MediatorFactory factory = MediatorFactory.getInstance();
Mediator m = factory.getMediator(source.getComponent(),
target.getComponent());
if (m != null) {
MediatorWrapper wrapper = new MediatorWrapper(m);
edge.setValue(wrapper);
edge.setStyle(wrapper.getStyle());
return "";
} else {
return mxResources.get("invalid_link");
}
}
// @Override
// public boolean isValidConnection(Object arg0, Object arg1) {
// // TODO Auto-generated method stub
// return false;
// } | String function(Object _edge, Object _source, Object _target) { mxCell edge = (mxCell) _edge; ComponentWrapper source = (ComponentWrapper) ((mxCell) _source) .getValue(); ComponentWrapper target = (ComponentWrapper) ((mxCell) _target) .getValue(); MediatorFactory factory = MediatorFactory.getInstance(); Mediator m = factory.getMediator(source.getComponent(), target.getComponent()); if (m != null) { MediatorWrapper wrapper = new MediatorWrapper(m); edge.setValue(wrapper); edge.setStyle(wrapper.getStyle()); return STRinvalid_link"); } } | /**
* Overrides the method to use the currently selected edge template for new
* edges.
*
* @param graph
* @param parent
* @param id
* @param value
* @param source
* @param target
* @param style
* @return
*/ | Overrides the method to use the currently selected edge template for new edges | validateEdge | {
"repo_name": "jmarginier/simulator",
"path": "gui-simulator/src/main/java/fr/ensicaen/gui_simulator/gui/main/CustomGraph.java",
"license": "apache-2.0",
"size": 5843
} | [
"fr.ensicaen.gui_simulator.gui.bridge.ComponentWrapper",
"fr.ensicaen.gui_simulator.gui.bridge.MediatorWrapper",
"fr.ensicaen.simulator.model.factory.MediatorFactory",
"fr.ensicaen.simulator.model.mediator.Mediator"
] | import fr.ensicaen.gui_simulator.gui.bridge.ComponentWrapper; import fr.ensicaen.gui_simulator.gui.bridge.MediatorWrapper; import fr.ensicaen.simulator.model.factory.MediatorFactory; import fr.ensicaen.simulator.model.mediator.Mediator; | import fr.ensicaen.gui_simulator.gui.bridge.*; import fr.ensicaen.simulator.model.factory.*; import fr.ensicaen.simulator.model.mediator.*; | [
"fr.ensicaen.gui_simulator",
"fr.ensicaen.simulator"
] | fr.ensicaen.gui_simulator; fr.ensicaen.simulator; | 722,655 |
public static JSONArray getJSONArray(String jsonData, String key,
JSONArray defaultValue) {
if (StringUtils.isEmpty(jsonData)) {
return defaultValue;
}
try {
JSONObject jsonObject = new JSONObject(jsonData);
return getJSONArray(jsonObject, key, defaultValue);
} catch (JSONException e) {
if (isPrintException) {
e.printStackTrace();
}
return defaultValue;
}
} | static JSONArray function(String jsonData, String key, JSONArray defaultValue) { if (StringUtils.isEmpty(jsonData)) { return defaultValue; } try { JSONObject jsonObject = new JSONObject(jsonData); return getJSONArray(jsonObject, key, defaultValue); } catch (JSONException e) { if (isPrintException) { e.printStackTrace(); } return defaultValue; } } | /**
* get JSONArray from jsonData
*
* @param jsonData
* @param key
* @param defaultValue
* @return <ul>
* <li>if jsonObject is null, return defaultValue</li>
* <li>if jsonData {@link JSONObject#JSONObject(String)} exception,
* return defaultValue</li>
* <li>return
* {@link JSONUtils#getJSONArray(JSONObject, String, JSONObject)}</li>
* </ul>
*/ | get JSONArray from jsonData | getJSONArray | {
"repo_name": "zhangjining9517/zhanglibrary",
"path": "zhangLibrary/src/com/zhang/zhanglibrary/util/JSONUtils.java",
"license": "gpl-2.0",
"size": 23381
} | [
"org.json.JSONArray",
"org.json.JSONException",
"org.json.JSONObject"
] | import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 2,661,958 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<Response<VpnSiteInner>> updateTagsWithResponseAsync(
String resourceGroupName, String vpnSiteName, TagsObject vpnSiteParameters); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<VpnSiteInner>> updateTagsWithResponseAsync( String resourceGroupName, String vpnSiteName, TagsObject vpnSiteParameters); | /**
* Updates VpnSite tags.
*
* @param resourceGroupName The resource group name of the VpnSite.
* @param vpnSiteName The name of the VpnSite being updated.
* @param vpnSiteParameters Parameters supplied to update VpnSite tags.
* @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 vpnSite Resource along with {@link Response} on successful completion of {@link Mono}.
*/ | Updates VpnSite tags | updateTagsWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VpnSitesClient.java",
"license": "mit",
"size": 22869
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.resourcemanager.network.fluent.models.VpnSiteInner",
"com.azure.resourcemanager.network.models.TagsObject"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.network.fluent.models.VpnSiteInner; import com.azure.resourcemanager.network.models.TagsObject; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.network.fluent.models.*; import com.azure.resourcemanager.network.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,996,403 |
protected void refillLeft(){
if(!shouldRepeat && isSrollingDisabled) return; //prevent next layout calls to override first init to scrolling disabled by falling to this branch
if(getChildCount() == 0) return;
final int leftScreenEdge = getScrollX();
View child = getChildAt(0);
int childLeft = child.getLeft();
int currLayoutRight = childLeft - ((LoopLayoutParams)child.getLayoutParams()).leftMargin;
while(currLayoutRight > leftScreenEdge){
mFirstItemPosition--;
if(mFirstItemPosition < 0) mFirstItemPosition = mAdapter.getCount()-1;
child = mAdapter.getView(mFirstItemPosition, getCachedView(), this);
Validate.notNull(child,"Your adapter has returned null from getView.");
child = addAndMeasureChildHorizontal(child, LAYOUT_MODE_TO_BEFORE);
currLayoutRight = layoutChildHorizontalToBefore(child, currLayoutRight, (LoopLayoutParams) child.getLayoutParams());
childLeft = child.getLeft() - ((LoopLayoutParams)child.getLayoutParams()).leftMargin;
//update left edge of children in container
mLeftChildEdge = childLeft;
//if selected view is going to screen, set selected state on him
if(mFirstItemPosition == mSelectedPosition){
child.setSelected(true);
}
}
}
//
// protected void refillLeft(){
// if(!shouldRepeat && isSrollingDisabled) return; //prevent next layout calls to override override first init to scrolling disabled by falling to this branch
// final int leftScreenEdge = getScrollX();
//
// View child = getChildAt(0);
// int currLayoutRight = child.getRight();
// while(currLayoutRight > leftScreenEdge){
// mFirstItemPosition--;
// if(mFirstItemPosition < 0) mFirstItemPosition = mAdapter.getCount()-1;
//
// child = mAdapter.getView(mFirstItemPosition, getCachedView(mFirstItemPosition), this);
// child = addAndMeasureChildHorizontal(child, LAYOUT_MODE_TO_BEFORE);
// currLayoutRight = layoutChildHorizontalToBefore(child, currLayoutRight, (LoopLayoutParams) child.getLayoutParams());
//
// //update left edge of children in container
// mLeftChildEdge = child.getLeft();
//
// //if selected view is going to screen, set selected state on him
// if(mFirstItemPosition == mSelectedPosition){
// child.setSelected(true);
// }
// }
// }
| void function(){ if(!shouldRepeat && isSrollingDisabled) return; if(getChildCount() == 0) return; final int leftScreenEdge = getScrollX(); View child = getChildAt(0); int childLeft = child.getLeft(); int currLayoutRight = childLeft - ((LoopLayoutParams)child.getLayoutParams()).leftMargin; while(currLayoutRight > leftScreenEdge){ mFirstItemPosition--; if(mFirstItemPosition < 0) mFirstItemPosition = mAdapter.getCount()-1; child = mAdapter.getView(mFirstItemPosition, getCachedView(), this); Validate.notNull(child,STR); child = addAndMeasureChildHorizontal(child, LAYOUT_MODE_TO_BEFORE); currLayoutRight = layoutChildHorizontalToBefore(child, currLayoutRight, (LoopLayoutParams) child.getLayoutParams()); childLeft = child.getLeft() - ((LoopLayoutParams)child.getLayoutParams()).leftMargin; mLeftChildEdge = childLeft; if(mFirstItemPosition == mSelectedPosition){ child.setSelected(true); } } } | /**
* Checks and refills empty area on the left
*/ | Checks and refills empty area on the left | refillLeft | {
"repo_name": "android-plugin/uexCoverFlow",
"path": "src/it/moondroid/coverflow/components/ui/containers/EndlessLoopAdapterContainer.java",
"license": "lgpl-3.0",
"size": 41989
} | [
"android.view.View",
"it.moondroid.coverflow.components.general.Validate"
] | import android.view.View; import it.moondroid.coverflow.components.general.Validate; | import android.view.*; import it.moondroid.coverflow.components.general.*; | [
"android.view",
"it.moondroid.coverflow"
] | android.view; it.moondroid.coverflow; | 1,952,176 |
@AfterThrowing(pointcut = "selectAll()", throwing = "ex")
public void AfterThrowingAdvice(IllegalArgumentException ex) {
System.out.println("There has been an exception: " + ex.toString());
}
| @AfterThrowing(pointcut = STR, throwing = "ex") void function(IllegalArgumentException ex) { System.out.println(STR + ex.toString()); } | /**
* This is the method which I would like to execute if there is an exception
* raised by any method.
*/ | This is the method which I would like to execute if there is an exception raised by any method | AfterThrowingAdvice | {
"repo_name": "n5xm/testspring",
"path": "src/com/yiibai/Logging2.java",
"license": "mit",
"size": 1612
} | [
"org.aspectj.lang.annotation.AfterThrowing"
] | import org.aspectj.lang.annotation.AfterThrowing; | import org.aspectj.lang.annotation.*; | [
"org.aspectj.lang"
] | org.aspectj.lang; | 2,809,540 |
EAttribute getAsset_PurchasePrice(); | EAttribute getAsset_PurchasePrice(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61968.Assets.Asset#getPurchasePrice <em>Purchase Price</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Purchase Price</em>'.
* @see CIM.IEC61968.Assets.Asset#getPurchasePrice()
* @see #getAsset()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61968.Assets.Asset#getPurchasePrice Purchase Price</code>'. | getAsset_PurchasePrice | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61968/Assets/AssetsPackage.java",
"license": "mit",
"size": 88490
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,317,962 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.