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
@Override public boolean isDirty() { return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); }
boolean function() { return ((BasicCommandStack) editingDomain.getCommandStack()).isSaveNeeded(); }
/** * This is for implementing {@link IEditorPart} and simply tests the command * stack. <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated */
This is for implementing <code>IEditorPart</code> and simply tests the command stack.
isDirty
{ "repo_name": "theArchonius/mervin", "path": "plugins/at.bitandart.zoubek.mervin.model.editor/src/at/bitandart/zoubek/mervin/model/modelreview/presentation/ModelReviewEditor.java", "license": "epl-1.0", "size": 54743 }
[ "org.eclipse.emf.common.command.BasicCommandStack" ]
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,742,743
public Jerry first() { List<Node> result = new NodeList(nodes.length); if (nodes.length > 0) { result.add(nodes[0]); } return new Jerry(this, result); }
Jerry function() { List<Node> result = new NodeList(nodes.length); if (nodes.length > 0) { result.add(nodes[0]); } return new Jerry(this, result); }
/** * Reduces the set of matched elements to the first in the set. */
Reduces the set of matched elements to the first in the set
first
{ "repo_name": "vilmospapp/jodd", "path": "jodd-lagarto/src/main/java/jodd/jerry/Jerry.java", "license": "bsd-2-clause", "size": 34951 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,810,973
private static boolean handleInvokeException(Exception e, String description) { boolean handled = false; if (e instanceof InvocationTargetException) { // This wraps an exception thrown by the method invoked. Throwable t = e.getCause(); if (t != null) { handled = handleBshError((Exception) t, description); } } else if (e instanceof IllegalArgumentException) { System.out.println(description + ": " + e.getMessage()); if (DEBUG) { e.printStackTrace(System.out); } } else if (e instanceof IllegalAccessException) { System.out.println(description + ": " + e.getMessage()); if (DEBUG) { e.printStackTrace(System.out); } } else { System.out.println("Unhandled Exception: "); System.out.println(description + ": " + e.getMessage()); e.printStackTrace(System.out); handled = false; } return handled; }
static boolean function(Exception e, String description) { boolean handled = false; if (e instanceof InvocationTargetException) { Throwable t = e.getCause(); if (t != null) { handled = handleBshError((Exception) t, description); } } else if (e instanceof IllegalArgumentException) { System.out.println(description + STR + e.getMessage()); if (DEBUG) { e.printStackTrace(System.out); } } else if (e instanceof IllegalAccessException) { System.out.println(description + STR + e.getMessage()); if (DEBUG) { e.printStackTrace(System.out); } } else { System.out.println(STR); System.out.println(description + STR + e.getMessage()); e.printStackTrace(System.out); handled = false; } return handled; }
/** * Handle exceptions thrown by attempting to invoke a reflected method or constructor. * @param e The exception thrown by the invoked method or constructor. * @param description a description of the event to be printed with the error message. * @return true if exception handled (error message printed), false if not */
Handle exceptions thrown by attempting to invoke a reflected method or constructor
handleInvokeException
{ "repo_name": "imr/Electric8", "path": "com/sun/electric/database/variable/EvalJavaBsh.java", "license": "gpl-3.0", "size": 22692 }
[ "java.lang.reflect.InvocationTargetException" ]
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
2,252,098
public static Calendar toCalendar(DateTime dateTime) { return dateTimesHelper.toCalendar(dateTime); }
static Calendar function(DateTime dateTime) { return dateTimesHelper.toCalendar(dateTime); }
/** * Gets a calendar for a {@code DateTime} using the default locale, * i.e. Locale.getDefault(). */
Gets a calendar for a DateTime using the default locale, i.e. Locale.getDefault()
toCalendar
{ "repo_name": "raja15792/googleads-java-lib", "path": "modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/utils/v201411/DateTimes.java", "license": "apache-2.0", "size": 5971 }
[ "com.google.api.ads.dfp.jaxws.v201411.DateTime", "java.util.Calendar" ]
import com.google.api.ads.dfp.jaxws.v201411.DateTime; import java.util.Calendar;
import com.google.api.ads.dfp.jaxws.v201411.*; import java.util.*;
[ "com.google.api", "java.util" ]
com.google.api; java.util;
226,503
public Date getDateTime(TimeZone tz) { // JDK9: use Optional.or() Optional<Date> date = readDate(ExifSubIFDDirectory.class, ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL, tz); if (!date.isPresent()) { date = readDate(ExifSubIFDDirectory.class, ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED, tz); } if (!date.isPresent()) { date = readDate(ExifIFD0Directory.class, ExifIFD0Directory.TAG_DATETIME, tz); } return date.orElse(null); }
Date function(TimeZone tz) { Optional<Date> date = readDate(ExifSubIFDDirectory.class, ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL, tz); if (!date.isPresent()) { date = readDate(ExifSubIFDDirectory.class, ExifSubIFDDirectory.TAG_DATETIME_DIGITIZED, tz); } if (!date.isPresent()) { date = readDate(ExifIFD0Directory.class, ExifIFD0Directory.TAG_DATETIME, tz); } return date.orElse(null); }
/** * Gets the date and time when the picture was taken according to the EXIF data. * * @param tz * The camera's TimeZone * @return Date and time, or {@code null} if the information could not be retrieved */
Gets the date and time when the picture was taken according to the EXIF data
getDateTime
{ "repo_name": "shred/cilla", "path": "cilla-service/src/main/java/org/shredzone/cilla/service/resource/ExifAnalyzer.java", "license": "agpl-3.0", "size": 23849 }
[ "com.drew.metadata.exif.ExifIFD0Directory", "com.drew.metadata.exif.ExifSubIFDDirectory", "java.util.Date", "java.util.Optional", "java.util.TimeZone" ]
import com.drew.metadata.exif.ExifIFD0Directory; import com.drew.metadata.exif.ExifSubIFDDirectory; import java.util.Date; import java.util.Optional; import java.util.TimeZone;
import com.drew.metadata.exif.*; import java.util.*;
[ "com.drew.metadata", "java.util" ]
com.drew.metadata; java.util;
2,662,180
String readFileToString(File file, String encoding) throws IOException;
String readFileToString(File file, String encoding) throws IOException;
/** * reads the file content * * @param file the file to read * @param encoding * @return * @throws IOException */
reads the file content
readFileToString
{ "repo_name": "andrehertwig/admintool", "path": "admin-tools-filebrowser/src/main/java/de/chandre/admintool/fileviewer/AdminToolFileviewerService.java", "license": "mit", "size": 1997 }
[ "java.io.File", "java.io.IOException" ]
import java.io.File; import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
860,904
public IResourceAggregate getProdDedicatedConsumption() { return prodDedicatedConsumption; }
IResourceAggregate function() { return prodDedicatedConsumption; }
/** * Resources consumed by production jobs from a dedicated resource pool. * * @return Production dedicated job consumption. */
Resources consumed by production jobs from a dedicated resource pool
getProdDedicatedConsumption
{ "repo_name": "protochron/aurora", "path": "src/main/java/org/apache/aurora/scheduler/quota/QuotaInfo.java", "license": "apache-2.0", "size": 4051 }
[ "org.apache.aurora.scheduler.storage.entities.IResourceAggregate" ]
import org.apache.aurora.scheduler.storage.entities.IResourceAggregate;
import org.apache.aurora.scheduler.storage.entities.*;
[ "org.apache.aurora" ]
org.apache.aurora;
1,073,563
Boolean canProcess(File file, Map<String, String> params);
Boolean canProcess(File file, Map<String, String> params);
/** * Indicates whether or not the class can handle the file with the associated parameters. * @param file File to Store * @param params Map of parameters indicating or hinting how the processing should work. * @return Whether or not this class can handle the given input */
Indicates whether or not the class can handle the file with the associated parameters
canProcess
{ "repo_name": "ronq/geomesa", "path": "geomesa-blobstore/geomesa-blobstore-api/src/main/java/org/locationtech/geomesa/blob/api/FileHandler.java", "license": "apache-2.0", "size": 1475 }
[ "java.io.File", "java.util.Map" ]
import java.io.File; import java.util.Map;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,304,350
public State addTransition(Transition transition, int weight) { if (transition == null) { throw new IllegalArgumentException("transition"); } transitionHolders.add(new TransitionHolder(transition, weight)); Collections.sort(transitionHolders); updateTransitions(); return this; }
State function(Transition transition, int weight) { if (transition == null) { throw new IllegalArgumentException(STR); } transitionHolders.add(new TransitionHolder(transition, weight)); Collections.sort(transitionHolders); updateTransitions(); return this; }
/** * Adds an outgoing {@link Transition} to this {@link State} with the * specified weight. The higher the weight the less important a * {@link Transition} is. If two {@link Transition}s match the same * {@link Event} the {@link Transition} with the lower weight will * be executed. * * @param transition the {@link Transition} to add. * @return this {@link State}. */
Adds an outgoing <code>Transition</code> to this <code>State</code> with the specified weight. The higher the weight the less important a <code>Transition</code> is. If two <code>Transition</code>s match the same <code>Event</code> the <code>Transition</code> with the lower weight will be executed
addTransition
{ "repo_name": "zuoyebushiwo/apache-mina-2.0.9", "path": "src/mina-statemachine/src/main/java/org/apache/mina/statemachine/State.java", "license": "apache-2.0", "size": 7426 }
[ "java.util.Collections", "org.apache.mina.statemachine.transition.Transition" ]
import java.util.Collections; import org.apache.mina.statemachine.transition.Transition;
import java.util.*; import org.apache.mina.statemachine.transition.*;
[ "java.util", "org.apache.mina" ]
java.util; org.apache.mina;
2,674,440
public void addPotentialRoot(NativeLinkable node) { Optional<NativeLinkTarget> target = NativeLinkables.getNativeLinkTarget(node, cxxPlatform); if (target.isPresent() && !excludes.contains(node.getBuildTarget())) { addIncludedRoot(target.get()); } else { addExcludedRoot(node); } }
void function(NativeLinkable node) { Optional<NativeLinkTarget> target = NativeLinkables.getNativeLinkTarget(node, cxxPlatform); if (target.isPresent() && !excludes.contains(node.getBuildTarget())) { addIncludedRoot(target.get()); } else { addExcludedRoot(node); } }
/** * Add a node which may qualify as either an included root, and excluded root, or neither. * * @return whether the node was added as a root. */
Add a node which may qualify as either an included root, and excluded root, or neither
addPotentialRoot
{ "repo_name": "dsyang/buck", "path": "src/com/facebook/buck/cxx/AbstractOmnibusRoots.java", "license": "apache-2.0", "size": 6144 }
[ "com.facebook.buck.cxx.platform.NativeLinkTarget", "com.facebook.buck.cxx.platform.NativeLinkable", "com.facebook.buck.cxx.platform.NativeLinkables", "java.util.Optional" ]
import com.facebook.buck.cxx.platform.NativeLinkTarget; import com.facebook.buck.cxx.platform.NativeLinkable; import com.facebook.buck.cxx.platform.NativeLinkables; import java.util.Optional;
import com.facebook.buck.cxx.platform.*; import java.util.*;
[ "com.facebook.buck", "java.util" ]
com.facebook.buck; java.util;
593,638
@BeanTagAttribute(name = "validationMessageParams", type = BeanTagAttribute.AttributeType.LISTVALUE) public List<String> getValidationMessageParams() { return this.validationMessageParams; }
@BeanTagAttribute(name = STR, type = BeanTagAttribute.AttributeType.LISTVALUE) List<String> function() { return this.validationMessageParams; }
/** * Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of * the param * * @return the validationMessageParams */
Parameters to be used in the string retrieved by this constraint's messageKey, ordered by number of the param
getValidationMessageParams
{ "repo_name": "bhutchinson/rice", "path": "rice-framework/krad-web-framework/src/main/java/org/kuali/rice/krad/datadictionary/validation/constraint/BaseConstraint.java", "license": "apache-2.0", "size": 11699 }
[ "java.util.List", "org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute" ]
import java.util.List; import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
import java.util.*; import org.kuali.rice.krad.datadictionary.parse.*;
[ "java.util", "org.kuali.rice" ]
java.util; org.kuali.rice;
1,644,596
protected void printContext() { HttpServletResponse res = ServletActionContext.getResponse(); res.setContentType("text/xml"); try { PrettyPrintWriter writer = new PrettyPrintWriter( ServletActionContext.getResponse().getWriter()); printContext(writer); writer.close(); } catch (IOException ex) { ex.printStackTrace(); } }
void function() { HttpServletResponse res = ServletActionContext.getResponse(); res.setContentType(STR); try { PrettyPrintWriter writer = new PrettyPrintWriter( ServletActionContext.getResponse().getWriter()); printContext(writer); writer.close(); } catch (IOException ex) { ex.printStackTrace(); } }
/** * Prints the current context to the response in XML format. */
Prints the current context to the response in XML format
printContext
{ "repo_name": "xiaguangme/struts2-src-study", "path": "src/org/apache/struts2/interceptor/debugging/DebuggingInterceptor.java", "license": "apache-2.0", "size": 18722 }
[ "java.io.IOException", "javax.servlet.http.HttpServletResponse", "org.apache.struts2.ServletActionContext" ]
import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.apache.struts2.ServletActionContext;
import java.io.*; import javax.servlet.http.*; import org.apache.struts2.*;
[ "java.io", "javax.servlet", "org.apache.struts2" ]
java.io; javax.servlet; org.apache.struts2;
505,110
public Collection<UndertowDeploymentInfoCustomizer> getDeploymentInfoCustomizers() { return this.deploymentInfoCustomizers; }
Collection<UndertowDeploymentInfoCustomizer> function() { return this.deploymentInfoCustomizers; }
/** * Returns a mutable collection of the {@link UndertowDeploymentInfoCustomizer}s that * will be applied to the Undertow {@link DeploymentInfo} . * @return the customizers that will be applied */
Returns a mutable collection of the <code>UndertowDeploymentInfoCustomizer</code>s that will be applied to the Undertow <code>DeploymentInfo</code>
getDeploymentInfoCustomizers
{ "repo_name": "thomasdarimont/spring-boot", "path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/undertow/UndertowEmbeddedServletContainerFactory.java", "license": "apache-2.0", "size": 21316 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,135,918
@Test public void testToArray() { // NOPMD (assert missing) for (int i=0;i<ARRAY_LENGTH;i++) { // initialize ClassLoadingRecord record = new ClassLoadingRecord(LONG_VALUES.get(i % LONG_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), INT_VALUES.get(i % INT_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size())); // check values Assert.assertEquals("ClassLoadingRecord.timestamp values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals("ClassLoadingRecord.hostname values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null?"":STRING_VALUES.get(i % STRING_VALUES.size()), record.getHostname()); Assert.assertEquals("ClassLoadingRecord.vmName values are not equal.", STRING_VALUES.get(i % STRING_VALUES.size()) == null?"":STRING_VALUES.get(i % STRING_VALUES.size()), record.getVmName()); Assert.assertEquals("ClassLoadingRecord.totalLoadedClassCount values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTotalLoadedClassCount()); Assert.assertEquals("ClassLoadingRecord.loadedClassCount values are not equal.", (int) INT_VALUES.get(i % INT_VALUES.size()), record.getLoadedClassCount()); Assert.assertEquals("ClassLoadingRecord.unloadedClassCount values are not equal.", (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getUnloadedClassCount()); Object[] values = record.toArray(); Assert.assertNotNull("Record array serialization failed. No values array returned.", values); Assert.assertEquals("Record array size does not match expected number of properties 6.", 6, values.length); // check all object values exist Assert.assertNotNull("Array value [0] of type Long must be not null.", values[0]); Assert.assertNotNull("Array value [1] of type String must be not null.", values[1]); Assert.assertNotNull("Array value [2] of type String must be not null.", values[2]); Assert.assertNotNull("Array value [3] of type Long must be not null.", values[3]); Assert.assertNotNull("Array value [4] of type Integer must be not null.", values[4]); Assert.assertNotNull("Array value [5] of type Long must be not null.", values[5]); // check all types Assert.assertTrue("Type of array value [0] " + values[0].getClass().getCanonicalName() + " does not match the desired type Long", values[0] instanceof Long); Assert.assertTrue("Type of array value [1] " + values[1].getClass().getCanonicalName() + " does not match the desired type String", values[1] instanceof String); Assert.assertTrue("Type of array value [2] " + values[2].getClass().getCanonicalName() + " does not match the desired type String", values[2] instanceof String); Assert.assertTrue("Type of array value [3] " + values[3].getClass().getCanonicalName() + " does not match the desired type Long", values[3] instanceof Long); Assert.assertTrue("Type of array value [4] " + values[4].getClass().getCanonicalName() + " does not match the desired type Integer", values[4] instanceof Integer); Assert.assertTrue("Type of array value [5] " + values[5].getClass().getCanonicalName() + " does not match the desired type Long", values[5] instanceof Long); // check all object values Assert.assertEquals("Array value [0] " + values[0] + " does not match the desired value " + LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), values[0] ); Assert.assertEquals("Array value [1] " + values[1] + " does not match the desired value " + STRING_VALUES.get(i % STRING_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()) == null?"":STRING_VALUES.get(i % STRING_VALUES.size()), values[1] ); Assert.assertEquals("Array value [2] " + values[2] + " does not match the desired value " + STRING_VALUES.get(i % STRING_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()) == null?"":STRING_VALUES.get(i % STRING_VALUES.size()), values[2] ); Assert.assertEquals("Array value [3] " + values[3] + " does not match the desired value " + LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), values[3] ); Assert.assertEquals("Array value [4] " + values[4] + " does not match the desired value " + INT_VALUES.get(i % INT_VALUES.size()), INT_VALUES.get(i % INT_VALUES.size()), values[4] ); Assert.assertEquals("Array value [5] " + values[5] + " does not match the desired value " + LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), values[5] ); } }
void function() { for (int i=0;i<ARRAY_LENGTH;i++) { ClassLoadingRecord record = new ClassLoadingRecord(LONG_VALUES.get(i % LONG_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), STRING_VALUES.get(i % STRING_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), INT_VALUES.get(i % INT_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size())); Assert.assertEquals(STR, (long) LONG_VALUES.get(i % LONG_VALUES.size()), record.getTimestamp()); Assert.assertEquals(STR, STRING_VALUES.get(i % STRING_VALUES.size()) == null?STRClassLoadingRecord.vmName values are not equal.STRSTRClassLoadingRecord.totalLoadedClassCount values are not equal.STRClassLoadingRecord.loadedClassCount values are not equal.STRClassLoadingRecord.unloadedClassCount values are not equal.STRRecord array serialization failed. No values array returned.STRRecord array size does not match expected number of properties 6.STRArray value [0] of type Long must be not null.STRArray value [1] of type String must be not null.STRArray value [2] of type String must be not null.STRArray value [3] of type Long must be not null.STRArray value [4] of type Integer must be not null.STRArray value [5] of type Long must be not null.STRType of array value [0] STR does not match the desired type LongSTRType of array value [1] STR does not match the desired type StringSTRType of array value [2] STR does not match the desired type StringSTRType of array value [3] STR does not match the desired type LongSTRType of array value [4] STR does not match the desired type IntegerSTRType of array value [5] STR does not match the desired type LongSTRArray value [0] STR does not match the desired value STRArray value [1] STR does not match the desired value STRSTRArray value [2] STR does not match the desired value STRSTRArray value [3] STR does not match the desired value STRArray value [4] STR does not match the desired value STRArray value [5] STR does not match the desired value " + LONG_VALUES.get(i % LONG_VALUES.size()), LONG_VALUES.get(i % LONG_VALUES.size()), values[5] ); } }
/** * Tests {@link ClassLoadingRecord#TestClassLoadingRecord(String, String, long, long, long, String, int, int)}. */
Tests <code>ClassLoadingRecord#TestClassLoadingRecord(String, String, long, long, long, String, int, int)</code>
testToArray
{ "repo_name": "HaStr/kieker", "path": "kieker-common/test-gen/kieker/test/common/junit/record/jvm/TestGeneratedClassLoadingRecord.java", "license": "apache-2.0", "size": 9593 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,488,738
public void renderFather(final StringBuilder builder, final int pad, final Person father) { renderParent(builder, pad, father, "Father"); }
void function(final StringBuilder builder, final int pad, final Person father) { renderParent(builder, pad, father, STR); }
/** * This method is public for testing purposes only. Do not try to call it * outside of the context of the rendering engine. * * @param builder Buffer for holding the rendition * @param pad Minimum number spaces for padding each line of the output * @param father Father */
This method is public for testing purposes only. Do not try to call it outside of the context of the rendering engine
renderFather
{ "repo_name": "dickschoeller/gedbrowser", "path": "gedbrowser-renderer/src/main/java/org/schoellerfamily/gedbrowser/renderer/ParentsRenderer.java", "license": "apache-2.0", "size": 5233 }
[ "org.schoellerfamily.gedbrowser.datamodel.Person" ]
import org.schoellerfamily.gedbrowser.datamodel.Person;
import org.schoellerfamily.gedbrowser.datamodel.*;
[ "org.schoellerfamily.gedbrowser" ]
org.schoellerfamily.gedbrowser;
2,729,512
public static long copyAndClose(InputStream is, OutputStream os) throws IOException { try { final long retval = ByteStreams.copy(is, os); // Workarround for http://hg.openjdk.java.net/jdk8/jdk8/jdk/rev/759aa847dcaf os.flush(); return retval; } finally { is.close(); os.close(); } }
static long function(InputStream is, OutputStream os) throws IOException { try { final long retval = ByteStreams.copy(is, os); os.flush(); return retval; } finally { is.close(); os.close(); } }
/** * Copy from `is` to `os` and close the streams regardless of the result. * * @param is The `InputStream` to copy results from. It is closed * @param os The `OutputStream` to copy results to. It is closed * * @return The count of bytes written to `os` * * @throws IOException */
Copy from `is` to `os` and close the streams regardless of the result
copyAndClose
{ "repo_name": "praveev/druid", "path": "java-util/src/main/java/io/druid/java/util/common/StreamUtils.java", "license": "apache-2.0", "size": 3291 }
[ "com.google.common.io.ByteStreams", "java.io.IOException", "java.io.InputStream", "java.io.OutputStream" ]
import com.google.common.io.ByteStreams; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
import com.google.common.io.*; import java.io.*;
[ "com.google.common", "java.io" ]
com.google.common; java.io;
2,696,335
@Generated @Selector("setRemoteParticipantVolume:") public native void setRemoteParticipantVolume(float value);
@Selector(STR) native void function(float value);
/** * default 1.0 (max is 1.0, min is 0.0) */
default 1.0 (max is 1.0, min is 0.0)
setRemoteParticipantVolume
{ "repo_name": "multi-os-engine/moe-core", "path": "moe.apple/moe.platform.ios/src/main/java/apple/gamekit/GKVoiceChatService.java", "license": "apache-2.0", "size": 9255 }
[ "org.moe.natj.objc.ann.Selector" ]
import org.moe.natj.objc.ann.Selector;
import org.moe.natj.objc.ann.*;
[ "org.moe.natj" ]
org.moe.natj;
814,537
protected void createMBeans(Server server) throws Exception { // Create the MBean for the Server itself if (debug >= 2) log("Creating MBean for Server " + server); MBeanUtils.createMBean(server); if (server instanceof StandardServer) { ((StandardServer) server).addPropertyChangeListener(this); } // Create the MBeans for the global NamingResources (if any) NamingResources resources = server.getGlobalNamingResources(); if (resources != null) { createMBeans(resources); } // Create the MBeans for each child Service Service services[] = server.findServices(); for (int i = 0; i < services.length; i++) { // FIXME - Warp object hierarchy not currently supported if (services[i].getContainer().getClass().getName().equals ("org.apache.catalina.connector.warp.WarpEngine")) { if (debug >= 1) { log("Skipping MBean for Service " + services[i]); } continue; } createMBeans(services[i]); } }
void function(Server server) throws Exception { if (debug >= 2) log(STR + server); MBeanUtils.createMBean(server); if (server instanceof StandardServer) { ((StandardServer) server).addPropertyChangeListener(this); } NamingResources resources = server.getGlobalNamingResources(); if (resources != null) { createMBeans(resources); } Service services[] = server.findServices(); for (int i = 0; i < services.length; i++) { if (services[i].getContainer().getClass().getName().equals (STR)) { if (debug >= 1) { log(STR + services[i]); } continue; } createMBeans(services[i]); } }
/** * Create the MBeans for the specified Server and its nested components. * * @param server Server for which to create MBeans * @throws Exception if an exception is thrown during MBean creation */
Create the MBeans for the specified Server and its nested components
createMBeans
{ "repo_name": "NorthFacing/step-by-Java", "path": "fra-tomcat/fra-tomcat-analysis/source/book01/HowTomcatWorks/src/org/apache/catalina/mbeans/ServerLifecycleListener.java", "license": "gpl-2.0", "size": 51276 }
[ "org.apache.catalina.Server", "org.apache.catalina.Service", "org.apache.catalina.core.StandardServer", "org.apache.catalina.deploy.NamingResources" ]
import org.apache.catalina.Server; import org.apache.catalina.Service; import org.apache.catalina.core.StandardServer; import org.apache.catalina.deploy.NamingResources;
import org.apache.catalina.*; import org.apache.catalina.core.*; import org.apache.catalina.deploy.*;
[ "org.apache.catalina" ]
org.apache.catalina;
1,587,803
@Override public List<String> getGroups(String user) { return Collections.emptyList(); }
List<String> function(String user) { return Collections.emptyList(); }
/** * Returns an empty list. * @param user ignored * @return an empty list */
Returns an empty list
getGroups
{ "repo_name": "dennishuo/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/NullGroupsMapping.java", "license": "apache-2.0", "size": 1370 }
[ "java.util.Collections", "java.util.List" ]
import java.util.Collections; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
296,737
@ApiModelProperty(value = "") public List<EndpointDTO> getList() { return list; }
@ApiModelProperty(value = "") List<EndpointDTO> function() { return list; }
/** * Get list * @return list **/
Get list
getList
{ "repo_name": "jaadds/product-apim", "path": "modules/integration/tests-common/clients/publisher/src/gen/java/org/wso2/am/integration/clients/publisher/api/v1/dto/EndpointListDTO.java", "license": "apache-2.0", "size": 3307 }
[ "io.swagger.annotations.ApiModelProperty", "java.util.List", "org.wso2.am.integration.clients.publisher.api.v1.dto.EndpointDTO" ]
import io.swagger.annotations.ApiModelProperty; import java.util.List; import org.wso2.am.integration.clients.publisher.api.v1.dto.EndpointDTO;
import io.swagger.annotations.*; import java.util.*; import org.wso2.am.integration.clients.publisher.api.v1.dto.*;
[ "io.swagger.annotations", "java.util", "org.wso2.am" ]
io.swagger.annotations; java.util; org.wso2.am;
720,834
public Tree getParentTree(TreePath currentPath) { LOG.entering("CodeAnalyzerTreeVisitor", "getParentTree"); Iterator<Tree> it = currentPath.iterator(); it.next(); // current element in tree Tree t = it.next(); // parent element in tree // Get the parent of the blocks while (t.getKind().equals("BLOCK")) { LOG.finer("Found a Block, trying to use parent of this Block"); t = it.next(); } if (t.getKind().equals("BLOCK")) { LOG.severe("Something is wrong in the getParentTree as there is a BLOCK returned as parent"); } LOG.fine("ParentTree is type:<" + t.getKind() + ">"); return t; }
Tree function(TreePath currentPath) { LOG.entering(STR, STR); Iterator<Tree> it = currentPath.iterator(); it.next(); Tree t = it.next(); while (t.getKind().equals("BLOCK")) { LOG.finer(STR); t = it.next(); } if (t.getKind().equals("BLOCK")) { LOG.severe(STR); } LOG.fine(STR + t.getKind() + ">"); return t; }
/** * This method is a quick access to the current items parent * * @return parent as Tree * * Elements can be JCCompilationUnit, JCClassDecl MethodTree, * * auto takes next higher one in case its a block */
This method is a quick access to the current items parent
getParentTree
{ "repo_name": "bensteUEM/uem.basesDeDatos.hernandezstein", "path": "CodeAnaylzer/src/CodeAnalyzerTreeVisitor.java", "license": "lgpl-3.0", "size": 15341 }
[ "com.sun.source.tree.Tree", "com.sun.source.util.TreePath", "java.util.Iterator" ]
import com.sun.source.tree.Tree; import com.sun.source.util.TreePath; import java.util.Iterator;
import com.sun.source.tree.*; import com.sun.source.util.*; import java.util.*;
[ "com.sun.source", "java.util" ]
com.sun.source; java.util;
509,306
@Test public void testFindByNick() { Person person = personQueryService.findPersonByNick("pmuir"); assertEquals("Person's nick should be 'pmuir'", "pmuir", person.getNick()); assertEquals("Person's name should be 'Pete Muir'", "Pete Muir", person.getName()); }
void function() { Person person = personQueryService.findPersonByNick("pmuir"); assertEquals(STR, "pmuir", person.getNick()); assertEquals(STR, STR, person.getName()); }
/** * Tests findPersonByNick and insures that the result is a Person object * (as opposed to a List<Person>). */
Tests findPersonByNick and insures that the result is a Person object (as opposed to a List)
testFindByNick
{ "repo_name": "magro/jboss-as-quickstart", "path": "deltaspike-partialbean-advanced/src/test/java/org/jboss/as/quickstart/deltaspike/partialbean/test/QueryServiceTest.java", "license": "apache-2.0", "size": 4998 }
[ "org.jboss.as.quickstart.deltaspike.partialbeanadvanced.model.Person", "org.junit.Assert" ]
import org.jboss.as.quickstart.deltaspike.partialbeanadvanced.model.Person; import org.junit.Assert;
import org.jboss.as.quickstart.deltaspike.partialbeanadvanced.model.*; import org.junit.*;
[ "org.jboss.as", "org.junit" ]
org.jboss.as; org.junit;
2,793,476
Assert.isTrue(poolSize > 0, "'poolSize' must be 1 or higher"); this.poolSize = poolSize; }
Assert.isTrue(poolSize > 0, STR); this.poolSize = poolSize; }
/** * Set the ScheduledExecutorService's pool size. * Default is 1. */
Set the ScheduledExecutorService's pool size. Default is 1
setPoolSize
{ "repo_name": "deathspeeder/class-guard", "path": "spring-framework-3.2.x/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskScheduler.java", "license": "gpl-2.0", "size": 8887 }
[ "org.springframework.util.Assert" ]
import org.springframework.util.Assert;
import org.springframework.util.*;
[ "org.springframework.util" ]
org.springframework.util;
1,116,352
public void post(CoapHandler handler, byte[] payload, int format) { asynchronous(format(Request.newPost().setURI(uri).setPayload(payload), format), handler); }
void function(CoapHandler handler, byte[] payload, int format) { asynchronous(format(Request.newPost().setURI(uri).setPayload(payload), format), handler); }
/** * Sends a POST request with the specified payload and the specified content * format and invokes the specified handler when a response arrives. * * @param handler the Response handler * @param payload the payload * @param format the Content-Format */
Sends a POST request with the specified payload and the specified content format and invokes the specified handler when a response arrives
post
{ "repo_name": "tucanae47/CoAp-Android-MsgPack", "path": "app/src/main/java/org/eclipse/californium/core/CoapClient.java", "license": "mit", "size": 34238 }
[ "org.eclipse.californium.core.coap.Request" ]
import org.eclipse.californium.core.coap.Request;
import org.eclipse.californium.core.coap.*;
[ "org.eclipse.californium" ]
org.eclipse.californium;
1,001,915
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code."> @Override protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); }
/** * Handles the HTTP <code>GET</code> method. * * @param request servlet request * @param response servlet response * @throws ServletException if a servlet-specific error occurs * @throws IOException if an I/O error occurs */
Handles the HTTP <code>GET</code> method
doGet
{ "repo_name": "LordODG/archassistantV2.0", "path": "Cliente/ClienteArchAssistant/src/java/Servlets/RationaleQaw.java", "license": "agpl-3.0", "size": 11999 }
[ "java.io.IOException", "javax.servlet.ServletException", "javax.servlet.http.HttpServletRequest", "javax.servlet.http.HttpServletResponse" ]
import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
import java.io.*; import javax.servlet.*; import javax.servlet.http.*;
[ "java.io", "javax.servlet" ]
java.io; javax.servlet;
720,424
public boolean handleEvent(IEvent event) { // do nothing. return false; }
boolean function(IEvent event) { return false; }
/** * Handles event. To be implemented in subclass realization * * @param event Event context * @return Event handling result */
Handles event. To be implemented in subclass realization
handleEvent
{ "repo_name": "OpenCorrelate/red5load", "path": "red5/src/main/java/org/red5/server/BasicScope.java", "license": "lgpl-3.0", "size": 6682 }
[ "org.red5.server.api.event.IEvent" ]
import org.red5.server.api.event.IEvent;
import org.red5.server.api.event.*;
[ "org.red5.server" ]
org.red5.server;
1,415,502
public static Rectangle2D getBoundingRectangle(LocalBoundedObject object) { Rectangle2D rect = new Rectangle2D.Double(object.getXLocation() - (object.getWidth() / 2D), object.getYLocation() - (object.getLength() / 2D), object.getWidth(), object.getLength()); Path2D path = getPathFromRectangleRotation(rect, object.getFacing()); return path.getBounds2D(); }
static Rectangle2D function(LocalBoundedObject object) { Rectangle2D rect = new Rectangle2D.Double(object.getXLocation() - (object.getWidth() / 2D), object.getYLocation() - (object.getLength() / 2D), object.getWidth(), object.getLength()); Path2D path = getPathFromRectangleRotation(rect, object.getFacing()); return path.getBounds2D(); }
/** * Gets the bounding rectangle around a local bounded object with facing. * * @param object the local bounded object. * @return bounding rectangle. */
Gets the bounding rectangle around a local bounded object with facing
getBoundingRectangle
{ "repo_name": "mars-sim/mars-sim", "path": "mars-sim-core/src/main/java/org/mars_sim/msp/core/LocalAreaUtil.java", "license": "gpl-3.0", "size": 25520 }
[ "java.awt.geom.Path2D", "java.awt.geom.Rectangle2D" ]
import java.awt.geom.Path2D; import java.awt.geom.Rectangle2D;
import java.awt.geom.*;
[ "java.awt" ]
java.awt;
566,471
public Color getColor() { return color; }
Color function() { return color; }
/** * Get the colour of the shadow generated * * @return The colour of the shadow generated */
Get the colour of the shadow generated
getColor
{ "repo_name": "TomyLobo/Slick", "path": "src/main/java/org/newdawn/slick/font/effects/ShadowEffect.java", "license": "bsd-3-clause", "size": 10297 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
598,464
private Hive getSessionHive() throws HiveSQLException { try { return Hive.get(); } catch (HiveException e) { throw new HiveSQLException("Failed to get ThreadLocal Hive object", e); } }
Hive function() throws HiveSQLException { try { return Hive.get(); } catch (HiveException e) { throw new HiveSQLException(STR, e); } }
/** * Returns the ThreadLocal Hive for the current thread * @return Hive * @throws HiveSQLException */
Returns the ThreadLocal Hive for the current thread
getSessionHive
{ "repo_name": "LantaoJin/spark", "path": "sql/hive-thriftserver/v2.3.5/src/main/java/org/apache/hive/service/cli/operation/SQLOperation.java", "license": "apache-2.0", "size": 17210 }
[ "org.apache.hadoop.hive.ql.metadata.Hive", "org.apache.hadoop.hive.ql.metadata.HiveException", "org.apache.hive.service.cli.HiveSQLException" ]
import org.apache.hadoop.hive.ql.metadata.Hive; import org.apache.hadoop.hive.ql.metadata.HiveException; import org.apache.hive.service.cli.HiveSQLException;
import org.apache.hadoop.hive.ql.metadata.*; import org.apache.hive.service.cli.*;
[ "org.apache.hadoop", "org.apache.hive" ]
org.apache.hadoop; org.apache.hive;
104,072
@Test(timeout = 60000) public void testMemberCommitException() throws Exception { buildCohortMemberPair();
@Test(timeout = 60000) void function() throws Exception { buildCohortMemberPair();
/** * Handle failures if a member's commit phase fails. * * NOTE: This is the core difference that makes this different from traditional 2PC. In true * 2PC the transaction is committed just before the coordinator sends commit messages to the * member. Members are then responsible for reading its TX log. This implementation actually * rolls back, and thus breaks the normal TX guarantees. */
Handle failures if a member's commit phase fails. 2PC the transaction is committed just before the coordinator sends commit messages to the member. Members are then responsible for reading its TX log. This implementation actually rolls back, and thus breaks the normal TX guarantees
testMemberCommitException
{ "repo_name": "Guavus/hbase", "path": "hbase-server/src/test/java/org/apache/hadoop/hbase/procedure/TestProcedureMember.java", "license": "apache-2.0", "size": 17755 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
443,145
protected AstNode parseMaterializedViewStatement( DdlTokenStream tokens, AstNode parentNode ) throws ParsingException { assert tokens != null; assert parentNode != null; markStartOfStatement(tokens); boolean isLog = tokens.canConsume(STMT_CREATE_MATERIALIZED_VEIW_LOG); tokens.canConsume(STMT_CREATE_MATERIALIZED_VIEW); String name = parseName(tokens); AstNode node = null; if (isLog) { node = nodeFactory().node(name, parentNode, TYPE_CREATE_MATERIALIZED_VIEW_LOG_STATEMENT); } else { node = nodeFactory().node(name, parentNode, TYPE_CREATE_MATERIALIZED_VIEW_STATEMENT); } parseUntilTerminator(tokens); markEndOfStatement(tokens, node); return node; }
AstNode function( DdlTokenStream tokens, AstNode parentNode ) throws ParsingException { assert tokens != null; assert parentNode != null; markStartOfStatement(tokens); boolean isLog = tokens.canConsume(STMT_CREATE_MATERIALIZED_VEIW_LOG); tokens.canConsume(STMT_CREATE_MATERIALIZED_VIEW); String name = parseName(tokens); AstNode node = null; if (isLog) { node = nodeFactory().node(name, parentNode, TYPE_CREATE_MATERIALIZED_VIEW_LOG_STATEMENT); } else { node = nodeFactory().node(name, parentNode, TYPE_CREATE_MATERIALIZED_VIEW_STATEMENT); } parseUntilTerminator(tokens); markEndOfStatement(tokens, node); return node; }
/** * Parses DDL CREATE MATERIALIZED VIEW statement This could either be a standard view or a VIEW LOG ON statement. * * @param tokens the tokenized {@link DdlTokenStream} of the DDL input content; may not be null * @param parentNode the parent {@link AstNode} node; may not be null * @return the parsed CREATE MATERIALIZED VIEW statement node * @throws ParsingException */
Parses DDL CREATE MATERIALIZED VIEW statement This could either be a standard view or a VIEW LOG ON statement
parseMaterializedViewStatement
{ "repo_name": "phantomjinx/modeshape", "path": "sequencers/modeshape-sequencer-ddl/src/main/java/org/modeshape/sequencer/ddl/dialect/oracle/OracleDdlParser.java", "license": "apache-2.0", "size": 112098 }
[ "org.modeshape.common.text.ParsingException", "org.modeshape.sequencer.ddl.DdlTokenStream", "org.modeshape.sequencer.ddl.node.AstNode" ]
import org.modeshape.common.text.ParsingException; import org.modeshape.sequencer.ddl.DdlTokenStream; import org.modeshape.sequencer.ddl.node.AstNode;
import org.modeshape.common.text.*; import org.modeshape.sequencer.ddl.*; import org.modeshape.sequencer.ddl.node.*;
[ "org.modeshape.common", "org.modeshape.sequencer" ]
org.modeshape.common; org.modeshape.sequencer;
418,152
boolean declareTemplateTypeName(String newTemplateTypeName) { lazyInitInfo(); if (isTypeTransformationName(newTemplateTypeName) || hasTypedefType()) { return false; } if (info.templateTypeNames == null){ info.templateTypeNames = new ArrayList<>(); } else if (info.templateTypeNames.contains(newTemplateTypeName)) { return false; } info.templateTypeNames.add(newTemplateTypeName); return true; }
boolean declareTemplateTypeName(String newTemplateTypeName) { lazyInitInfo(); if (isTypeTransformationName(newTemplateTypeName) hasTypedefType()) { return false; } if (info.templateTypeNames == null){ info.templateTypeNames = new ArrayList<>(); } else if (info.templateTypeNames.contains(newTemplateTypeName)) { return false; } info.templateTypeNames.add(newTemplateTypeName); return true; }
/** * Declares a template type name. Template type names are described using the * {@code @template} annotation. * * @param newTemplateTypeName the template type name. */
Declares a template type name. Template type names are described using the @template annotation
declareTemplateTypeName
{ "repo_name": "tdelmas/closure-compiler", "path": "src/com/google/javascript/rhino/JSDocInfo.java", "license": "apache-2.0", "size": 61750 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
291,306
public KualiDecimal getTotal91toSYSPR() { return total91toSYSPR; }
KualiDecimal function() { return total91toSYSPR; }
/** * Gets the total91toSYSPR attribute. * @return Returns the total91toSYSPR. */
Gets the total91toSYSPR attribute
getTotal91toSYSPR
{ "repo_name": "Ariah-Group/Finance", "path": "af_webapp/src/main/java/org/kuali/kfs/module/ar/report/util/CustomerAgingReportDataHolder.java", "license": "apache-2.0", "size": 4479 }
[ "org.kuali.rice.core.api.util.type.KualiDecimal" ]
import org.kuali.rice.core.api.util.type.KualiDecimal;
import org.kuali.rice.core.api.util.type.*;
[ "org.kuali.rice" ]
org.kuali.rice;
1,191,891
private void last() throws InvalidControllerException { if (listOfData == null) { throw new InvalidControllerException(); } else { int page = (listOfData.size() / dataPerPage); logger.debug("Page = " + page); if ((page * dataPerPage) == listOfData.size()) { page--; } currentIndex = page * dataPerPage; } }
void function() throws InvalidControllerException { if (listOfData == null) { throw new InvalidControllerException(); } else { int page = (listOfData.size() / dataPerPage); logger.debug(STR + page); if ((page * dataPerPage) == listOfData.size()) { page--; } currentIndex = page * dataPerPage; } }
/** * This method moves to the last page */
This method moves to the last page
last
{ "repo_name": "BackupTheBerlios/arara-svn", "path": "core/trunk/src/main/java/net/indrix/arara/servlets/pagination/PaginationController.java", "license": "gpl-2.0", "size": 9524 }
[ "net.indrix.arara.servlets.pagination.exceptions.InvalidControllerException" ]
import net.indrix.arara.servlets.pagination.exceptions.InvalidControllerException;
import net.indrix.arara.servlets.pagination.exceptions.*;
[ "net.indrix.arara" ]
net.indrix.arara;
910,218
private void enterLameDuck() { lameDuck = true; try { getSocketPath().delete(); } catch (IOException e) { e.printStackTrace(); } serverSocket.setSoTimeout(1); }
void function() { lameDuck = true; try { getSocketPath().delete(); } catch (IOException e) { e.printStackTrace(); } serverSocket.setSoTimeout(1); }
/** * Allow one last request to be serviced. */
Allow one last request to be serviced
enterLameDuck
{ "repo_name": "vt09/bazel", "path": "src/main/java/com/google/devtools/build/lib/server/RPCServer.java", "license": "apache-2.0", "size": 21291 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,131,283
@Test public final void testDistanceMap_UntilCorners_ChessKnight2() { ByteProcessor image = new ByteProcessor(9, 9); image.setValue(255); image.fill(); image.set(6, 6, 0); float[] weights = ChamferWeights.CHESSKNIGHT.getFloatWeights(); DistanceTransform5x5Float algo = new DistanceTransform5x5Float(weights, false); ImageProcessor result = algo.distanceMap(image); assertNotNull(result); assertEquals(image.getWidth(), result.getWidth()); assertEquals(image.getHeight(), result.getHeight()); assertEquals(42, result.getf(0, 0), .01); assertEquals(32, result.getf(8, 0), .01); assertEquals(32, result.getf(0, 8), .01); assertEquals(14, result.getf(8, 8), .01); assertEquals(30, result.getf(0, 6), .01); }
final void function() { ByteProcessor image = new ByteProcessor(9, 9); image.setValue(255); image.fill(); image.set(6, 6, 0); float[] weights = ChamferWeights.CHESSKNIGHT.getFloatWeights(); DistanceTransform5x5Float algo = new DistanceTransform5x5Float(weights, false); ImageProcessor result = algo.distanceMap(image); assertNotNull(result); assertEquals(image.getWidth(), result.getWidth()); assertEquals(image.getHeight(), result.getHeight()); assertEquals(42, result.getf(0, 0), .01); assertEquals(32, result.getf(8, 0), .01); assertEquals(32, result.getf(0, 8), .01); assertEquals(14, result.getf(8, 8), .01); assertEquals(30, result.getf(0, 6), .01); }
/** * Another test for chess-knight weights, to fix a bug that incorrectly * checked image bounds. */
Another test for chess-knight weights, to fix a bug that incorrectly checked image bounds
testDistanceMap_UntilCorners_ChessKnight2
{ "repo_name": "ijpb/MorphoLibJ", "path": "src/test/java/inra/ijpb/binary/distmap/DistanceTransform5x5FloatTest.java", "license": "lgpl-3.0", "size": 6966 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
112,293
void enterCreateOutputStreamStatement(@NotNull CQLParser.CreateOutputStreamStatementContext ctx); void exitCreateOutputStreamStatement(@NotNull CQLParser.CreateOutputStreamStatementContext ctx);
void enterCreateOutputStreamStatement(@NotNull CQLParser.CreateOutputStreamStatementContext ctx); void exitCreateOutputStreamStatement(@NotNull CQLParser.CreateOutputStreamStatementContext ctx);
/** * Exit a parse tree produced by {@link CQLParser#createOutputStreamStatement}. * @param ctx the parse tree */
Exit a parse tree produced by <code>CQLParser#createOutputStreamStatement</code>
exitCreateOutputStreamStatement
{ "repo_name": "jack6215/StreamCQL", "path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserListener.java", "license": "apache-2.0", "size": 62500 }
[ "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;
2,115,681
@Override public void run() { boolean addedListener = false; EntryLogger.setSource(serverId, "RI"); try { this.system.addDisconnectListener(this); addedListener = true; if (!waitForCache()) { logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientUpdater_0_NO_CACHE_EXITING, this)); return; } processMessages(); } catch (CancelException e) { return; // just bail } finally { if (addedListener) { this.system.removeDisconnectListener(this); } this.close(); EntryLogger.clearSource(); } } // // public boolean waitForInitialization() { // boolean result = false; // // Yogesh : waiting on this thread object is a bad idea // // as when thread exits it notifies to the waiting threads. // synchronized (this) { // for (;;) { // if (quitting()) { // break; // } // boolean interrupted = Thread.interrupted(); // try { // this.wait(100); // spurious wakeup ok // timed wait, should fix lost notification problem rahul. // } // catch (InterruptedException e) { // interrupted = true; // } // finally { // if (interrupted) { // Thread.currentThread().interrupt(); // } // } // } // while // // Even if we succeed, there is a risk that we were shut down // // Can't check for cache; it isn't set yet :-( // this.system.getCancelCriterion().checkCancelInProgress(null); // result = this.continueProcessing; // } // synchronized // return result; // } // // private void notifyInitializationComplete() { // synchronized (this) { // this.initialized = true; // this.notifyAll(); // } // }
void function() { boolean addedListener = false; EntryLogger.setSource(serverId, "RI"); try { this.system.addDisconnectListener(this); addedListener = true; if (!waitForCache()) { logger.warn(LocalizedMessage.create(LocalizedStrings.CacheClientUpdater_0_NO_CACHE_EXITING, this)); return; } processMessages(); } catch (CancelException e) { return; } finally { if (addedListener) { this.system.removeDisconnectListener(this); } this.close(); EntryLogger.clearSource(); } }
/** * Performs the work of the client update thread. Creates a * <code>ServerSocket</code> and waits for the server to connect to it. */
Performs the work of the client update thread. Creates a <code>ServerSocket</code> and waits for the server to connect to it
run
{ "repo_name": "rvs/incubator-geode", "path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheClientUpdater.java", "license": "apache-2.0", "size": 72982 }
[ "com.gemstone.gemfire.CancelException", "com.gemstone.gemfire.internal.i18n.LocalizedStrings", "com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage", "com.gemstone.gemfire.internal.sequencelog.EntryLogger" ]
import com.gemstone.gemfire.CancelException; import com.gemstone.gemfire.internal.i18n.LocalizedStrings; import com.gemstone.gemfire.internal.logging.log4j.LocalizedMessage; import com.gemstone.gemfire.internal.sequencelog.EntryLogger;
import com.gemstone.gemfire.*; import com.gemstone.gemfire.internal.i18n.*; import com.gemstone.gemfire.internal.logging.log4j.*; import com.gemstone.gemfire.internal.sequencelog.*;
[ "com.gemstone.gemfire" ]
com.gemstone.gemfire;
2,796,533
@Test(timeout=60000) public void testMergeTwoIterator1() { final String stringA = "a"; final String stringB = "b"; final String stringC = "c"; final List<String> list1 = Arrays.asList(stringA, stringB, stringC); final List<Iterator<String>> iteratorList = Arrays.asList(list1.iterator(), list1.iterator()); final SortedIteratorMerger<String> sortedIteratorMerger = new SortedIteratorMerger<>(iteratorList, STRING_COMPARATOR, DEFAULT_DUPLICATE_RESOLVER); final List<String> resultList = getResultList(sortedIteratorMerger); Assert.assertEquals(6, resultList.size()); }
@Test(timeout=60000) void function() { final String stringA = "a"; final String stringB = "b"; final String stringC = "c"; final List<String> list1 = Arrays.asList(stringA, stringB, stringC); final List<Iterator<String>> iteratorList = Arrays.asList(list1.iterator(), list1.iterator()); final SortedIteratorMerger<String> sortedIteratorMerger = new SortedIteratorMerger<>(iteratorList, STRING_COMPARATOR, DEFAULT_DUPLICATE_RESOLVER); final List<String> resultList = getResultList(sortedIteratorMerger); Assert.assertEquals(6, resultList.size()); }
/** * Test merger with one iterator */
Test merger with one iterator
testMergeTwoIterator1
{ "repo_name": "jnidzwetzki/bboxdb", "path": "bboxdb-commons/src/test/java/org/bboxdb/TestSortedIteratorMerger.java", "license": "apache-2.0", "size": 8568 }
[ "java.util.Arrays", "java.util.Iterator", "java.util.List", "org.bboxdb.commons.SortedIteratorMerger", "org.junit.Assert", "org.junit.Test" ]
import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.bboxdb.commons.SortedIteratorMerger; import org.junit.Assert; import org.junit.Test;
import java.util.*; import org.bboxdb.commons.*; import org.junit.*;
[ "java.util", "org.bboxdb.commons", "org.junit" ]
java.util; org.bboxdb.commons; org.junit;
2,176,370
default @NonNull Builder add(@NonNull Context entry) { Objects.requireNonNull(entry, "entry"); add(entry.getKey(), entry.getValue()); return this; }
default @NonNull Builder add(@NonNull Context entry) { Objects.requireNonNull(entry, "entry"); add(entry.getKey(), entry.getValue()); return this; }
/** * Adds a context to the set. * * @param entry the entry to add * @return the builder * @throws NullPointerException if the entry is null * @see MutableContextSet#add(Context) */
Adds a context to the set
add
{ "repo_name": "lucko/LuckPerms", "path": "api/src/main/java/net/luckperms/api/context/ImmutableContextSet.java", "license": "mit", "size": 4844 }
[ "java.util.Objects", "org.checkerframework.checker.nullness.qual.NonNull" ]
import java.util.Objects; import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.*; import org.checkerframework.checker.nullness.qual.*;
[ "java.util", "org.checkerframework.checker" ]
java.util; org.checkerframework.checker;
2,158,602
public void addParameter(final NamedValue<?> namedValue) { parameters.add(namedValue); }
void function(final NamedValue<?> namedValue) { parameters.add(namedValue); }
/** * Add parameter * * @param namedValue * Parameter ro add */
Add parameter
addParameter
{ "repo_name": "sauloperez/sos", "path": "src/core/api/src/main/java/org/n52/sos/ogc/om/features/samplingFeatures/SamplingFeature.java", "license": "apache-2.0", "size": 10632 }
[ "org.n52.sos.ogc.om.NamedValue" ]
import org.n52.sos.ogc.om.NamedValue;
import org.n52.sos.ogc.om.*;
[ "org.n52.sos" ]
org.n52.sos;
2,383,617
public List<Route> getRoutes(){ return routes; }
List<Route> function(){ return routes; }
/** * Gets all the routes<br> * <br> * Returns <code>null</code> if database not loaded. * @return A list of <code>Route</code> instances */
Gets all the routes Returns <code>null</code> if database not loaded
getRoutes
{ "repo_name": "mob41/KmbETA-API", "path": "src/main/java/com/github/mob41/kmbeta/api/BusDatabase.java", "license": "gpl-3.0", "size": 17419 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,847,167
public void invalidateStorage(FSImage fi) throws IOException { for (Iterator<StorageDirectory> it = fi.dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); if (sd.getRoot().equals(path2) || sd.getRoot().equals(path3)) { fi.getEditLog().removeEditsForStorageDir(sd); fi.updateRemovedDirs(sd); it.remove(); } } }
void function(FSImage fi) throws IOException { for (Iterator<StorageDirectory> it = fi.dirIterator(); it.hasNext();) { StorageDirectory sd = it.next(); if (sd.getRoot().equals(path2) sd.getRoot().equals(path3)) { fi.getEditLog().removeEditsForStorageDir(sd); fi.updateRemovedDirs(sd); it.remove(); } } }
/** * invalidate storage by removing sub-directory "current" in name2 and name3 */
invalidate storage by removing sub-directory "current" in name2 and name3
invalidateStorage
{ "repo_name": "gndpig/hadoop", "path": "src/test/org/apache/hadoop/hdfs/server/namenode/TestStorageRestore.java", "license": "apache-2.0", "size": 13165 }
[ "java.io.IOException", "java.util.Iterator", "org.apache.hadoop.hdfs.server.common.Storage" ]
import java.io.IOException; import java.util.Iterator; import org.apache.hadoop.hdfs.server.common.Storage;
import java.io.*; import java.util.*; import org.apache.hadoop.hdfs.server.common.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
172,450
public void testOther() throws Exception { assertEquals("#route1#", context.getRouteDefinitions().get(0).getId()); getMockEndpoint("mock:other").expectedMessageCount(1); template.sendBody("direct:start", "Bye World"); assertMockEndpointsSatisfied(); // this should take the otherwise path assertEquals("#choice5##log3##to4#", ids); } private class MyDebuggerCheckingId implements InterceptStrategy {
void function() throws Exception { assertEquals(STR, context.getRouteDefinitions().get(0).getId()); getMockEndpoint(STR).expectedMessageCount(1); template.sendBody(STR, STR); assertMockEndpointsSatisfied(); assertEquals(STR, ids); } private class MyDebuggerCheckingId implements InterceptStrategy {
/** * Test path 2 */
Test path 2
testOther
{ "repo_name": "chicagozer/rheosoft", "path": "camel-core/src/test/java/org/apache/camel/impl/CustomIdFactoryTest.java", "license": "apache-2.0", "size": 4940 }
[ "org.apache.camel.spi.InterceptStrategy" ]
import org.apache.camel.spi.InterceptStrategy;
import org.apache.camel.spi.*;
[ "org.apache.camel" ]
org.apache.camel;
1,257,796
final void runExample() throws Exception { while (true) { try { initialize(); doWork(); shutdown(); return; } catch (InsufficientLogException insufficientLog) { NetworkRestore networkRestore = new NetworkRestore(); networkRestore.execute(insufficientLog, new NetworkRestoreConfig()); continue; } catch (RollbackException rollback) { continue; } finally { if (repEnv != null) { repEnv.close(); repEnv = null; } } } }
final void runExample() throws Exception { while (true) { try { initialize(); doWork(); shutdown(); return; } catch (InsufficientLogException insufficientLog) { NetworkRestore networkRestore = new NetworkRestore(); networkRestore.execute(insufficientLog, new NetworkRestoreConfig()); continue; } catch (RollbackException rollback) { continue; } finally { if (repEnv != null) { repEnv.close(); repEnv = null; } } } }
/** * Runs the example. It handles environment invalidating exceptions, * re-initializing the environment handle and the dao when such an * exception is encountered. * * @throws Exception to propagate any IO or Interrupt exceptions */
Runs the example. It handles environment invalidating exceptions, re-initializing the environment handle and the dao when such an exception is encountered
runExample
{ "repo_name": "prat0318/dbms", "path": "mini_dbms/je-5.0.103/examples/je/rep/quote/StockQuotes.java", "license": "mit", "size": 25677 }
[ "com.sleepycat.je.rep.InsufficientLogException", "com.sleepycat.je.rep.NetworkRestore", "com.sleepycat.je.rep.NetworkRestoreConfig", "com.sleepycat.je.rep.RollbackException" ]
import com.sleepycat.je.rep.InsufficientLogException; import com.sleepycat.je.rep.NetworkRestore; import com.sleepycat.je.rep.NetworkRestoreConfig; import com.sleepycat.je.rep.RollbackException;
import com.sleepycat.je.rep.*;
[ "com.sleepycat.je" ]
com.sleepycat.je;
661,006
@Override public Adapter createRuleSessionPropertyAdapter() { if (ruleSessionPropertyItemProvider == null) { ruleSessionPropertyItemProvider = new RuleSessionPropertyItemProvider(this); } return ruleSessionPropertyItemProvider; } protected RuleFactsConfigurationItemProvider ruleFactsConfigurationItemProvider;
Adapter function() { if (ruleSessionPropertyItemProvider == null) { ruleSessionPropertyItemProvider = new RuleSessionPropertyItemProvider(this); } return ruleSessionPropertyItemProvider; } protected RuleFactsConfigurationItemProvider ruleFactsConfigurationItemProvider;
/** * This creates an adapter for a {@link org.wso2.developerstudio.eclipse.gmf.esb.RuleSessionProperty}. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This creates an adapter for a <code>org.wso2.developerstudio.eclipse.gmf.esb.RuleSessionProperty</code>.
createRuleSessionPropertyAdapter
{ "repo_name": "rajeevanv89/developer-studio", "path": "esb/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/EsbItemProviderAdapterFactory.java", "license": "apache-2.0", "size": 286852 }
[ "org.eclipse.emf.common.notify.Adapter" ]
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,344,856
public void drawItem(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, boolean selected, int pass) { if (!getItemVisible(series, item)) { return; } // get the data point... double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (Double.isNaN(y1)) { y1 = 0.0; } double transX1 = domainAxis.valueToJava2D(x1, dataArea, plot.getDomainAxisEdge()); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, plot.getRangeAxisEdge()); // get the previous point and the next point so we can calculate a // "hot spot" for the area (used by the chart entity)... double x0 = dataset.getXValue(series, Math.max(item - 1, 0)); double y0 = dataset.getYValue(series, Math.max(item - 1, 0)); if (Double.isNaN(y0)) { y0 = 0.0; } double transX0 = domainAxis.valueToJava2D(x0, dataArea, plot.getDomainAxisEdge()); double transY0 = rangeAxis.valueToJava2D(y0, dataArea, plot.getRangeAxisEdge()); int itemCount = dataset.getItemCount(series); double x2 = dataset.getXValue(series, Math.min(item + 1, itemCount - 1)); double y2 = dataset.getYValue(series, Math.min(item + 1, itemCount - 1)); if (Double.isNaN(y2)) { y2 = 0.0; } double transX2 = domainAxis.valueToJava2D(x2, dataArea, plot.getDomainAxisEdge()); double transY2 = rangeAxis.valueToJava2D(y2, dataArea, plot.getRangeAxisEdge()); double transZero = rangeAxis.valueToJava2D(0.0, dataArea, plot.getRangeAxisEdge()); Polygon hotspot = null; if (plot.getOrientation() == PlotOrientation.HORIZONTAL) { hotspot = new Polygon(); hotspot.addPoint((int) transZero, (int) ((transX0 + transX1) / 2.0)); hotspot.addPoint((int) ((transY0 + transY1) / 2.0), (int) ((transX0 + transX1) / 2.0)); hotspot.addPoint((int) transY1, (int) transX1); hotspot.addPoint((int) ((transY1 + transY2) / 2.0), (int) ((transX1 + transX2) / 2.0)); hotspot.addPoint((int) transZero, (int) ((transX1 + transX2) / 2.0)); } else { // vertical orientation hotspot = new Polygon(); hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) transZero); hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) ((transY0 + transY1) / 2.0)); hotspot.addPoint((int) transX1, (int) transY1); hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) ((transY1 + transY2) / 2.0)); hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) transZero); } PlotOrientation orientation = plot.getOrientation(); Paint paint = getItemPaint(series, item, selected); Stroke stroke = getItemStroke(series, item, selected); g2.setPaint(paint); g2.setStroke(stroke); // Check if the item is the last item for the series. // and number of items > 0. We can't draw an area for a single point. g2.fill(hotspot); // draw an outline around the Area. if (isOutline()) { g2.setStroke(lookupSeriesOutlineStroke(series)); g2.setPaint(lookupSeriesOutlinePaint(series)); g2.draw(hotspot); } int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); XYCrosshairState crosshairState = state.getCrosshairState(); updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1, orientation); EntityCollection entities = state.getEntityCollection(); if (entities != null) { addEntity(entities, hotspot, dataset, series, item, selected, 0.0, 0.0); } }
void function(Graphics2D g2, XYItemRendererState state, Rectangle2D dataArea, XYPlot plot, ValueAxis domainAxis, ValueAxis rangeAxis, XYDataset dataset, int series, int item, boolean selected, int pass) { if (!getItemVisible(series, item)) { return; } double x1 = dataset.getXValue(series, item); double y1 = dataset.getYValue(series, item); if (Double.isNaN(y1)) { y1 = 0.0; } double transX1 = domainAxis.valueToJava2D(x1, dataArea, plot.getDomainAxisEdge()); double transY1 = rangeAxis.valueToJava2D(y1, dataArea, plot.getRangeAxisEdge()); double x0 = dataset.getXValue(series, Math.max(item - 1, 0)); double y0 = dataset.getYValue(series, Math.max(item - 1, 0)); if (Double.isNaN(y0)) { y0 = 0.0; } double transX0 = domainAxis.valueToJava2D(x0, dataArea, plot.getDomainAxisEdge()); double transY0 = rangeAxis.valueToJava2D(y0, dataArea, plot.getRangeAxisEdge()); int itemCount = dataset.getItemCount(series); double x2 = dataset.getXValue(series, Math.min(item + 1, itemCount - 1)); double y2 = dataset.getYValue(series, Math.min(item + 1, itemCount - 1)); if (Double.isNaN(y2)) { y2 = 0.0; } double transX2 = domainAxis.valueToJava2D(x2, dataArea, plot.getDomainAxisEdge()); double transY2 = rangeAxis.valueToJava2D(y2, dataArea, plot.getRangeAxisEdge()); double transZero = rangeAxis.valueToJava2D(0.0, dataArea, plot.getRangeAxisEdge()); Polygon hotspot = null; if (plot.getOrientation() == PlotOrientation.HORIZONTAL) { hotspot = new Polygon(); hotspot.addPoint((int) transZero, (int) ((transX0 + transX1) / 2.0)); hotspot.addPoint((int) ((transY0 + transY1) / 2.0), (int) ((transX0 + transX1) / 2.0)); hotspot.addPoint((int) transY1, (int) transX1); hotspot.addPoint((int) ((transY1 + transY2) / 2.0), (int) ((transX1 + transX2) / 2.0)); hotspot.addPoint((int) transZero, (int) ((transX1 + transX2) / 2.0)); } else { hotspot = new Polygon(); hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) transZero); hotspot.addPoint((int) ((transX0 + transX1) / 2.0), (int) ((transY0 + transY1) / 2.0)); hotspot.addPoint((int) transX1, (int) transY1); hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) ((transY1 + transY2) / 2.0)); hotspot.addPoint((int) ((transX1 + transX2) / 2.0), (int) transZero); } PlotOrientation orientation = plot.getOrientation(); Paint paint = getItemPaint(series, item, selected); Stroke stroke = getItemStroke(series, item, selected); g2.setPaint(paint); g2.setStroke(stroke); g2.fill(hotspot); if (isOutline()) { g2.setStroke(lookupSeriesOutlineStroke(series)); g2.setPaint(lookupSeriesOutlinePaint(series)); g2.draw(hotspot); } int domainAxisIndex = plot.getDomainAxisIndex(domainAxis); int rangeAxisIndex = plot.getRangeAxisIndex(rangeAxis); XYCrosshairState crosshairState = state.getCrosshairState(); updateCrosshairValues(crosshairState, x1, y1, domainAxisIndex, rangeAxisIndex, transX1, transY1, orientation); EntityCollection entities = state.getEntityCollection(); if (entities != null) { addEntity(entities, hotspot, dataset, series, item, selected, 0.0, 0.0); } }
/** * Draws the visual representation of a single data item. * * @param g2 the graphics device. * @param state the renderer state. * @param dataArea the area within which the data is being drawn. * @param plot the plot (can be used to obtain standard color * information etc). * @param domainAxis the domain axis. * @param rangeAxis the range axis. * @param dataset the dataset. * @param series the series index (zero-based). * @param item the item index (zero-based). * @param pass the pass index. */
Draws the visual representation of a single data item
drawItem
{ "repo_name": "ilyessou/jfreechart", "path": "source/org/jfree/chart/renderer/xy/XYAreaRenderer2.java", "license": "lgpl-2.1", "size": 17285 }
[ "java.awt.Graphics2D", "java.awt.Paint", "java.awt.Polygon", "java.awt.Stroke", "java.awt.geom.Rectangle2D", "org.jfree.chart.axis.ValueAxis", "org.jfree.chart.entity.EntityCollection", "org.jfree.chart.plot.PlotOrientation", "org.jfree.chart.plot.XYCrosshairState", "org.jfree.chart.plot.XYPlot", "org.jfree.data.xy.XYDataset" ]
import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Polygon; import java.awt.Stroke; import java.awt.geom.Rectangle2D; import org.jfree.chart.axis.ValueAxis; import org.jfree.chart.entity.EntityCollection; import org.jfree.chart.plot.PlotOrientation; import org.jfree.chart.plot.XYCrosshairState; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset;
import java.awt.*; import java.awt.geom.*; import org.jfree.chart.axis.*; import org.jfree.chart.entity.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*;
[ "java.awt", "org.jfree.chart", "org.jfree.data" ]
java.awt; org.jfree.chart; org.jfree.data;
2,346,761
public static Message<? extends IHeader, ? extends IContent> decodeMessage(byte[] rpcBytes) throws Exception { ByteBuffer messageBuf = ByteBuffer.wrap(rpcBytes); // parse header int messageId = messageBuf.getInt(); MessageType messageType = MessageType.valueOf(messageBuf.get()); SerializeType serializeType = SerializeType.valueOf(messageBuf.get()); byte[] bodyBytes = Arrays.copyOfRange(rpcBytes, 6, rpcBytes.length); if (messageType == MessageType.RPC_REQUEST) { Call call = REGISTER.find(serializeType).deserialize(bodyBytes, Call.class); return new RpcRequest(messageId, serializeType, call); } else if (messageType == MessageType.RPC_RESPONSE) { Result result = REGISTER.find(serializeType).deserialize(bodyBytes, Result.class); return new RpcResponse(messageId, serializeType, result); } else if (messageType == MessageType.HEARTBEAT_PING) { Ping ping = REGISTER.find(serializeType).deserialize(bodyBytes, Ping.class); return new HeartbeatPing(messageId, ping); } else if (messageType == MessageType.HEARTBEAT_PONG) { Pong pong = REGISTER.find(serializeType).deserialize(bodyBytes, Pong.class); return new HeartbeatPong(messageId, pong); } else { throw new IllegalStateException("unsupported content type [" + messageType + "]"); } }
static Message<? extends IHeader, ? extends IContent> function(byte[] rpcBytes) throws Exception { ByteBuffer messageBuf = ByteBuffer.wrap(rpcBytes); int messageId = messageBuf.getInt(); MessageType messageType = MessageType.valueOf(messageBuf.get()); SerializeType serializeType = SerializeType.valueOf(messageBuf.get()); byte[] bodyBytes = Arrays.copyOfRange(rpcBytes, 6, rpcBytes.length); if (messageType == MessageType.RPC_REQUEST) { Call call = REGISTER.find(serializeType).deserialize(bodyBytes, Call.class); return new RpcRequest(messageId, serializeType, call); } else if (messageType == MessageType.RPC_RESPONSE) { Result result = REGISTER.find(serializeType).deserialize(bodyBytes, Result.class); return new RpcResponse(messageId, serializeType, result); } else if (messageType == MessageType.HEARTBEAT_PING) { Ping ping = REGISTER.find(serializeType).deserialize(bodyBytes, Ping.class); return new HeartbeatPing(messageId, ping); } else if (messageType == MessageType.HEARTBEAT_PONG) { Pong pong = REGISTER.find(serializeType).deserialize(bodyBytes, Pong.class); return new HeartbeatPong(messageId, pong); } else { throw new IllegalStateException(STR + messageType + "]"); } }
/** * decode RPC Message. * * @param rpcBytes * RpcMessage bytes * @return * @throws Exception * deserialize exception */
decode RPC Message
decodeMessage
{ "repo_name": "dinstone/com.dinstone.rpc", "path": "rpc-core/src/main/java/com/dinstone/rpc/protocol/MessageCodec.java", "license": "apache-2.0", "size": 3468 }
[ "com.dinstone.rpc.serialize.SerializeType", "java.nio.ByteBuffer", "java.util.Arrays" ]
import com.dinstone.rpc.serialize.SerializeType; import java.nio.ByteBuffer; import java.util.Arrays;
import com.dinstone.rpc.serialize.*; import java.nio.*; import java.util.*;
[ "com.dinstone.rpc", "java.nio", "java.util" ]
com.dinstone.rpc; java.nio; java.util;
1,557,449
//----------------------------------------------------------------------- public String replace(final LogEvent event, final Object source) { if (source == null) { return null; } final StringBuilder buf = new StringBuilder().append(source); substitute(event, buf, 0, buf.length()); return buf.toString(); }
String function(final LogEvent event, final Object source) { if (source == null) { return null; } final StringBuilder buf = new StringBuilder().append(source); substitute(event, buf, 0, buf.length()); return buf.toString(); }
/** * Replaces all the occurrences of variables in the given source object with * their matching values from the resolver. The input source object is * converted to a string using <code>toString</code> and is not altered. * * @param event the current LogEvent, if one exists. * @param source the source to replace in, null returns null * @return the result of the replace operation */
Replaces all the occurrences of variables in the given source object with their matching values from the resolver. The input source object is converted to a string using <code>toString</code> and is not altered
replace
{ "repo_name": "GFriedrich/logging-log4j2", "path": "log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java", "license": "apache-2.0", "size": 58146 }
[ "org.apache.logging.log4j.core.LogEvent" ]
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.*;
[ "org.apache.logging" ]
org.apache.logging;
2,587,920
@Source("images/triangleDownImage.png") ImageResource triangleDownImage();
@Source(STR) ImageResource triangleDownImage();
/** * Access method.<p> * * @return the image resource */
Access method
triangleDownImage
{ "repo_name": "sbonoc/opencms-core", "path": "src-gwt/org/opencms/gwt/client/ui/css/I_CmsImageBundle.java", "license": "lgpl-2.1", "size": 14176 }
[ "com.google.gwt.resources.client.ImageResource" ]
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.*;
[ "com.google.gwt" ]
com.google.gwt;
2,119,461
private void updateVertexCache(String variable, Vertex v) { vertexCache.put(variable, vertices.get(vertexIds.get(v.getId()))); }
void function(String variable, Vertex v) { vertexCache.put(variable, vertices.get(vertexIds.get(v.getId()))); }
/** * Updates the vertex cache. * * @param variable vertex variable used in GDL script * @param v vertex from GDL loader */
Updates the vertex cache
updateVertexCache
{ "repo_name": "rostam/gradoop", "path": "gradoop-common/src/main/java/org/gradoop/common/util/AsciiGraphLoader.java", "license": "apache-2.0", "size": 17096 }
[ "org.s1ck.gdl.model.Vertex" ]
import org.s1ck.gdl.model.Vertex;
import org.s1ck.gdl.model.*;
[ "org.s1ck.gdl" ]
org.s1ck.gdl;
1,111,109
public void setSources(LegendItemSource[] sources) { if (sources == null) { throw new IllegalArgumentException("Null 'sources' argument."); } this.sources = sources; notifyListeners(new TitleChangeEvent(this)); }
void function(LegendItemSource[] sources) { if (sources == null) { throw new IllegalArgumentException(STR); } this.sources = sources; notifyListeners(new TitleChangeEvent(this)); }
/** * Sets the legend item sources and sends a {@link TitleChangeEvent} to * all registered listeners. * * @param sources the sources (<code>null</code> not permitted). */
Sets the legend item sources and sends a <code>TitleChangeEvent</code> to all registered listeners
setSources
{ "repo_name": "integrated/jfreechart", "path": "source/org/jfree/chart/title/LegendTitle.java", "license": "lgpl-2.1", "size": 21435 }
[ "org.jfree.chart.LegendItemSource", "org.jfree.chart.event.TitleChangeEvent" ]
import org.jfree.chart.LegendItemSource; import org.jfree.chart.event.TitleChangeEvent;
import org.jfree.chart.*; import org.jfree.chart.event.*;
[ "org.jfree.chart" ]
org.jfree.chart;
1,676,232
public synchronized static StringBuilder makeOrList(Collection<String> list, String itemPrefix, String itemSuffix) { return makeStringList(list, "|", itemPrefix, itemSuffix, true, null, true); }
synchronized static StringBuilder function(Collection<String> list, String itemPrefix, String itemSuffix) { return makeStringList(list, " ", itemPrefix, itemSuffix, true, null, true); }
/** * Makes a or-list out of the given list, adding the given pre- and suffixes * to each or-item.<br> * A generated list could look like:<br> * [ITEM1|ITEM2|ITEM3]<br> * or with prefix &lt; and suffix &gt;:<br> * [&lt;ITEM1&gt;|&lt;ITEM2&gt;|&lt;ITEM3&gt;] * * @param list * @param itemPrefix * @param itemSuffix * @return */
Makes a or-list out of the given list, adding the given pre- and suffixes to each or-item. A generated list could look like: [ITEM1|ITEM2|ITEM3] or with prefix &lt; and suffix &gt;: [&lt;ITEM1&gt;|&lt;ITEM2&gt;|&lt;ITEM3&gt;]
makeOrList
{ "repo_name": "thnaeff/GedcomStore", "path": "src/main/java/ch/thn/gedcom/GedcomFormatter.java", "license": "apache-2.0", "size": 15509 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
1,919,782
public boolean outputAbbrResult(String outfileName) throws IOException { if (outfileName.isEmpty()) { return false; } FileOutputStream fos = new FileOutputStream(new File(outfileName)); OutputStreamWriter os = new OutputStreamWriter(fos,"UTF-8"); BufferedWriter bw = new BufferedWriter(os); System.out.println(this.m_allWordDield.size()); for( Iterator<String> iter = this.m_allWordDield.keySet().iterator(); iter.hasNext(); ) { String abbr = iter.next().toString(); bw.write(abbr + "\t"); Vector<String> tmp = this.m_allWordDield.get(abbr); for(String val: tmp) { bw.write(val + ";"); } bw.write("\n"); } bw.close(); os.close(); fos.close(); return true; }
boolean function(String outfileName) throws IOException { if (outfileName.isEmpty()) { return false; } FileOutputStream fos = new FileOutputStream(new File(outfileName)); OutputStreamWriter os = new OutputStreamWriter(fos,"UTF-8"); BufferedWriter bw = new BufferedWriter(os); System.out.println(this.m_allWordDield.size()); for( Iterator<String> iter = this.m_allWordDield.keySet().iterator(); iter.hasNext(); ) { String abbr = iter.next().toString(); bw.write(abbr + "\t"); Vector<String> tmp = this.m_allWordDield.get(abbr); for(String val: tmp) { bw.write(val + ";"); } bw.write("\n"); } bw.close(); os.close(); fos.close(); return true; }
/** * output the vocabulary word */
output the vocabulary word
outputAbbrResult
{ "repo_name": "sunying1985/EmotionAnalysis", "path": "src/com/suny/entity/corpus/CorpusProgress.java", "license": "apache-2.0", "size": 5840 }
[ "java.io.BufferedWriter", "java.io.File", "java.io.FileOutputStream", "java.io.IOException", "java.io.OutputStreamWriter", "java.util.Iterator", "java.util.Vector" ]
import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.Iterator; import java.util.Vector;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,732,334
private void checkNotClosed() throws IOException { if (closed) { throw new IOException(uri + ": " + FSExceptionMessages.STREAM_IS_CLOSED); } }
void function() throws IOException { if (closed) { throw new IOException(uri + STR + FSExceptionMessages.STREAM_IS_CLOSED); } }
/** * Verify that the input stream is open. Non blocking; this gives * the last state of the volatile {@link #closed} field. * @throws IOException if the connection is closed */
Verify that the input stream is open. Non blocking; this gives the last state of the volatile <code>#closed</code> field
checkNotClosed
{ "repo_name": "SparkTC/stocator", "path": "src/main/java/com/ibm/stocator/fs/cos/COSInputStream.java", "license": "apache-2.0", "size": 20545 }
[ "java.io.IOException", "org.apache.hadoop.fs.FSExceptionMessages" ]
import java.io.IOException; import org.apache.hadoop.fs.FSExceptionMessages;
import java.io.*; import org.apache.hadoop.fs.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
410,636
@Override public void onSurfaceCreated(EGLConfig config) { Log.i(TAG, "onSurfaceCreated"); GLES20.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); // Dark background so text shows up well. ByteBuffer bbVertices = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_COORDS.length * 4); bbVertices.order(ByteOrder.nativeOrder()); cubeVertices = bbVertices.asFloatBuffer(); cubeVertices.put(WorldLayoutData.CUBE_COORDS); cubeVertices.position(0); ByteBuffer bbColors = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_COLORS.length * 4); bbColors.order(ByteOrder.nativeOrder()); cubeColors = bbColors.asFloatBuffer(); cubeColors.put(WorldLayoutData.CUBE_COLORS); cubeColors.position(0); ByteBuffer bbFoundColors = ByteBuffer.allocateDirect( WorldLayoutData.CUBE_FOUND_COLORS.length * 4); bbFoundColors.order(ByteOrder.nativeOrder()); cubeFoundColors = bbFoundColors.asFloatBuffer(); cubeFoundColors.put(WorldLayoutData.CUBE_FOUND_COLORS); cubeFoundColors.position(0); ByteBuffer bbNormals = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_NORMALS.length * 4); bbNormals.order(ByteOrder.nativeOrder()); cubeNormals = bbNormals.asFloatBuffer(); cubeNormals.put(WorldLayoutData.CUBE_NORMALS); cubeNormals.position(0); // make a floor ByteBuffer bbFloorVertices = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_COORDS.length * 4); bbFloorVertices.order(ByteOrder.nativeOrder()); floorVertices = bbFloorVertices.asFloatBuffer(); floorVertices.put(WorldLayoutData.FLOOR_COORDS); floorVertices.position(0); ByteBuffer bbFloorNormals = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_NORMALS.length * 4); bbFloorNormals.order(ByteOrder.nativeOrder()); floorNormals = bbFloorNormals.asFloatBuffer(); floorNormals.put(WorldLayoutData.FLOOR_NORMALS); floorNormals.position(0); ByteBuffer bbFloorColors = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_COLORS.length * 4); bbFloorColors.order(ByteOrder.nativeOrder()); floorColors = bbFloorColors.asFloatBuffer(); floorColors.put(WorldLayoutData.FLOOR_COLORS); floorColors.position(0); int vertexShader = loadGLShader(GLES20.GL_VERTEX_SHADER, R.raw.light_vertex); int gridShader = loadGLShader(GLES20.GL_FRAGMENT_SHADER, R.raw.grid_fragment); int passthroughShader = loadGLShader(GLES20.GL_FRAGMENT_SHADER, R.raw.passthrough_fragment); cubeProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(cubeProgram, vertexShader); GLES20.glAttachShader(cubeProgram, passthroughShader); GLES20.glLinkProgram(cubeProgram); GLES20.glUseProgram(cubeProgram); checkGLError("Cube program"); cubePositionParam = GLES20.glGetAttribLocation(cubeProgram, "a_Position"); cubeNormalParam = GLES20.glGetAttribLocation(cubeProgram, "a_Normal"); cubeColorParam = GLES20.glGetAttribLocation(cubeProgram, "a_Color"); cubeModelParam = GLES20.glGetUniformLocation(cubeProgram, "u_Model"); cubeModelViewParam = GLES20.glGetUniformLocation(cubeProgram, "u_MVMatrix"); cubeModelViewProjectionParam = GLES20.glGetUniformLocation(cubeProgram, "u_MVP"); cubeLightPosParam = GLES20.glGetUniformLocation(cubeProgram, "u_LightPos"); GLES20.glEnableVertexAttribArray(cubePositionParam); GLES20.glEnableVertexAttribArray(cubeNormalParam); GLES20.glEnableVertexAttribArray(cubeColorParam); checkGLError("Cube program params"); floorProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(floorProgram, vertexShader); GLES20.glAttachShader(floorProgram, gridShader); GLES20.glLinkProgram(floorProgram); GLES20.glUseProgram(floorProgram); checkGLError("Floor program"); floorModelParam = GLES20.glGetUniformLocation(floorProgram, "u_Model"); floorModelViewParam = GLES20.glGetUniformLocation(floorProgram, "u_MVMatrix"); floorModelViewProjectionParam = GLES20.glGetUniformLocation(floorProgram, "u_MVP"); floorLightPosParam = GLES20.glGetUniformLocation(floorProgram, "u_LightPos"); floorPositionParam = GLES20.glGetAttribLocation(floorProgram, "a_Position"); floorNormalParam = GLES20.glGetAttribLocation(floorProgram, "a_Normal"); floorColorParam = GLES20.glGetAttribLocation(floorProgram, "a_Color"); GLES20.glEnableVertexAttribArray(floorPositionParam); GLES20.glEnableVertexAttribArray(floorNormalParam); GLES20.glEnableVertexAttribArray(floorColorParam); checkGLError("Floor program params"); // Object first appears directly in front of user for (int i = 0; i < modelCubes.length; i++) { Matrix.setIdentityM(modelCubes[i], 0); Matrix.translateM(modelCubes[i], 0, 0,3*i, 12); } Matrix.setIdentityM(modelFloor, 0); Matrix.translateM(modelFloor, 0, 0, -floorDepth, 0); // Floor appears below user. checkGLError("onSurfaceCreated"); }
void function(EGLConfig config) { Log.i(TAG, STR); GLES20.glClearColor(0.1f, 0.1f, 0.1f, 0.5f); ByteBuffer bbVertices = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_COORDS.length * 4); bbVertices.order(ByteOrder.nativeOrder()); cubeVertices = bbVertices.asFloatBuffer(); cubeVertices.put(WorldLayoutData.CUBE_COORDS); cubeVertices.position(0); ByteBuffer bbColors = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_COLORS.length * 4); bbColors.order(ByteOrder.nativeOrder()); cubeColors = bbColors.asFloatBuffer(); cubeColors.put(WorldLayoutData.CUBE_COLORS); cubeColors.position(0); ByteBuffer bbFoundColors = ByteBuffer.allocateDirect( WorldLayoutData.CUBE_FOUND_COLORS.length * 4); bbFoundColors.order(ByteOrder.nativeOrder()); cubeFoundColors = bbFoundColors.asFloatBuffer(); cubeFoundColors.put(WorldLayoutData.CUBE_FOUND_COLORS); cubeFoundColors.position(0); ByteBuffer bbNormals = ByteBuffer.allocateDirect(WorldLayoutData.CUBE_NORMALS.length * 4); bbNormals.order(ByteOrder.nativeOrder()); cubeNormals = bbNormals.asFloatBuffer(); cubeNormals.put(WorldLayoutData.CUBE_NORMALS); cubeNormals.position(0); ByteBuffer bbFloorVertices = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_COORDS.length * 4); bbFloorVertices.order(ByteOrder.nativeOrder()); floorVertices = bbFloorVertices.asFloatBuffer(); floorVertices.put(WorldLayoutData.FLOOR_COORDS); floorVertices.position(0); ByteBuffer bbFloorNormals = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_NORMALS.length * 4); bbFloorNormals.order(ByteOrder.nativeOrder()); floorNormals = bbFloorNormals.asFloatBuffer(); floorNormals.put(WorldLayoutData.FLOOR_NORMALS); floorNormals.position(0); ByteBuffer bbFloorColors = ByteBuffer.allocateDirect(WorldLayoutData.FLOOR_COLORS.length * 4); bbFloorColors.order(ByteOrder.nativeOrder()); floorColors = bbFloorColors.asFloatBuffer(); floorColors.put(WorldLayoutData.FLOOR_COLORS); floorColors.position(0); int vertexShader = loadGLShader(GLES20.GL_VERTEX_SHADER, R.raw.light_vertex); int gridShader = loadGLShader(GLES20.GL_FRAGMENT_SHADER, R.raw.grid_fragment); int passthroughShader = loadGLShader(GLES20.GL_FRAGMENT_SHADER, R.raw.passthrough_fragment); cubeProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(cubeProgram, vertexShader); GLES20.glAttachShader(cubeProgram, passthroughShader); GLES20.glLinkProgram(cubeProgram); GLES20.glUseProgram(cubeProgram); checkGLError(STR); cubePositionParam = GLES20.glGetAttribLocation(cubeProgram, STR); cubeNormalParam = GLES20.glGetAttribLocation(cubeProgram, STR); cubeColorParam = GLES20.glGetAttribLocation(cubeProgram, STR); cubeModelParam = GLES20.glGetUniformLocation(cubeProgram, STR); cubeModelViewParam = GLES20.glGetUniformLocation(cubeProgram, STR); cubeModelViewProjectionParam = GLES20.glGetUniformLocation(cubeProgram, "u_MVP"); cubeLightPosParam = GLES20.glGetUniformLocation(cubeProgram, STR); GLES20.glEnableVertexAttribArray(cubePositionParam); GLES20.glEnableVertexAttribArray(cubeNormalParam); GLES20.glEnableVertexAttribArray(cubeColorParam); checkGLError(STR); floorProgram = GLES20.glCreateProgram(); GLES20.glAttachShader(floorProgram, vertexShader); GLES20.glAttachShader(floorProgram, gridShader); GLES20.glLinkProgram(floorProgram); GLES20.glUseProgram(floorProgram); checkGLError(STR); floorModelParam = GLES20.glGetUniformLocation(floorProgram, STR); floorModelViewParam = GLES20.glGetUniformLocation(floorProgram, STR); floorModelViewProjectionParam = GLES20.glGetUniformLocation(floorProgram, "u_MVP"); floorLightPosParam = GLES20.glGetUniformLocation(floorProgram, STR); floorPositionParam = GLES20.glGetAttribLocation(floorProgram, STR); floorNormalParam = GLES20.glGetAttribLocation(floorProgram, STR); floorColorParam = GLES20.glGetAttribLocation(floorProgram, STR); GLES20.glEnableVertexAttribArray(floorPositionParam); GLES20.glEnableVertexAttribArray(floorNormalParam); GLES20.glEnableVertexAttribArray(floorColorParam); checkGLError(STR); for (int i = 0; i < modelCubes.length; i++) { Matrix.setIdentityM(modelCubes[i], 0); Matrix.translateM(modelCubes[i], 0, 0,3*i, 12); } Matrix.setIdentityM(modelFloor, 0); Matrix.translateM(modelFloor, 0, 0, -floorDepth, 0); checkGLError(STR); }
/** * Creates the buffers we use to store information about the 3D world. * * <p>OpenGL doesn't use Java arrays, but rather needs data in a format it can understand. * Hence we use ByteBuffers. * * @param config The EGL configuration used when creating the surface. */
Creates the buffers we use to store information about the 3D world. OpenGL doesn't use Java arrays, but rather needs data in a format it can understand. Hence we use ByteBuffers
onSurfaceCreated
{ "repo_name": "Shounak/InSight-HackHarvard", "path": "CardboardSample/src/main/java/com/google/vrtoolkit/cardboard/samples/treasurehunt/MainActivity.java", "license": "apache-2.0", "size": 22014 }
[ "android.opengl.Matrix", "android.util.Log", "java.nio.ByteBuffer", "java.nio.ByteOrder", "javax.microedition.khronos.egl.EGLConfig" ]
import android.opengl.Matrix; import android.util.Log; import java.nio.ByteBuffer; import java.nio.ByteOrder; import javax.microedition.khronos.egl.EGLConfig;
import android.opengl.*; import android.util.*; import java.nio.*; import javax.microedition.khronos.egl.*;
[ "android.opengl", "android.util", "java.nio", "javax.microedition" ]
android.opengl; android.util; java.nio; javax.microedition;
315,660
private JTextArea getStatusTextArea() { if (statusTextArea == null) { statusTextArea = new JTextArea(); statusTextArea.setEditable(false); statusTextArea.setFont(new Font("Sanserif", Font.PLAIN, 10)); } return statusTextArea; }
JTextArea function() { if (statusTextArea == null) { statusTextArea = new JTextArea(); statusTextArea.setEditable(false); statusTextArea.setFont(new Font(STR, Font.PLAIN, 10)); } return statusTextArea; }
/** * This method initializes statusTextArea * * @return javax.swing.JTextArea */
This method initializes statusTextArea
getStatusTextArea
{ "repo_name": "NCIP/cagrid-core", "path": "caGrid/projects/introduce/src/java/Portal/gov/nih/nci/cagrid/introduce/portal/updater/steps/DownloadsUpdatesStep.java", "license": "bsd-3-clause", "size": 17771 }
[ "java.awt.Font", "javax.swing.JTextArea" ]
import java.awt.Font; import javax.swing.JTextArea;
import java.awt.*; import javax.swing.*;
[ "java.awt", "javax.swing" ]
java.awt; javax.swing;
2,283,437
public static void consumeErrStreamAndCloseConnection(@Nullable HttpURLConnection connection) { if (connection == null) { return; } try { InputStream es = ((HttpURLConnection) connection).getErrorStream(); consumeAndCloseStream(es); } catch (IOException ex) { throw Throwables.propagate(ex); } finally { connection.disconnect(); } }
static void function(@Nullable HttpURLConnection connection) { if (connection == null) { return; } try { InputStream es = ((HttpURLConnection) connection).getErrorStream(); consumeAndCloseStream(es); } catch (IOException ex) { throw Throwables.propagate(ex); } finally { connection.disconnect(); } }
/** * Consumes the error stream of the provided connection and then closes it. * * @param connection the connection to close */
Consumes the error stream of the provided connection and then closes it
consumeErrStreamAndCloseConnection
{ "repo_name": "state-hiu/GeoGit", "path": "src/core/src/main/java/org/geogit/remote/HttpUtils.java", "license": "bsd-3-clause", "size": 19558 }
[ "com.google.common.base.Throwables", "java.io.IOException", "java.io.InputStream", "java.net.HttpURLConnection", "javax.annotation.Nullable" ]
import com.google.common.base.Throwables; import java.io.IOException; import java.io.InputStream; import java.net.HttpURLConnection; import javax.annotation.Nullable;
import com.google.common.base.*; import java.io.*; import java.net.*; import javax.annotation.*;
[ "com.google.common", "java.io", "java.net", "javax.annotation" ]
com.google.common; java.io; java.net; javax.annotation;
2,082,051
private static String printModule(Module module) { StringBuilder writer = new StringBuilder(); printChars(writer, '-', 70, true); printChars(writer, ' ', 30, false); writer.append(module.getId() + "\n"); printChars(writer, ' ', 30, false); printChars(writer, '-', 70, true); printChars(writer, ' ', 30, false); writer.append("ID"); printChars(writer, ' ', 28, false); writer.append(module.getId() + "\n"); printChars(writer, ' ', 30, false); writer.append("TYPE_UID"); printChars(writer, ' ', 22, false); writer.append(module.getTypeUID() + "\n"); String label = module.getLabel(); if (label != null) { printChars(writer, ' ', 30, false); writer.append("LABEL"); printChars(writer, ' ', 22, false); writer.append(label + "\n"); } String description = module.getDescription(); if (description != null) { printChars(writer, ' ', 30, false); writer.append("DESCRIPTION" + "\n"); printChars(writer, ' ', 16, false); writer.append(description + "\n"); } Map<String, Object> config = module.getConfiguration(); if (config != null && !config.isEmpty()) { printChars(writer, ' ', 30, false); writer.append("CONFIGURATION"); printChars(writer, ' ', 17, false); String str = " "; writer.append(makeString(str, config)); } Set<Connection> connections = null; if (module instanceof Condition) { connections = ((Condition) module).getConnections(); } if (module instanceof Action) { connections = ((Action) module).getConnections(); } if (connections != null && !connections.isEmpty()) { printChars(writer, ' ', 30, false); writer.append("CONNECTIONS"); printChars(writer, ' ', 19, false); writer.append(makeString(connections) + "\n"); } return writer.toString(); }
static String function(Module module) { StringBuilder writer = new StringBuilder(); printChars(writer, '-', 70, true); printChars(writer, ' ', 30, false); writer.append(module.getId() + "\n"); printChars(writer, ' ', 30, false); printChars(writer, '-', 70, true); printChars(writer, ' ', 30, false); writer.append("ID"); printChars(writer, ' ', 28, false); writer.append(module.getId() + "\n"); printChars(writer, ' ', 30, false); writer.append(STR); printChars(writer, ' ', 22, false); writer.append(module.getTypeUID() + "\n"); String label = module.getLabel(); if (label != null) { printChars(writer, ' ', 30, false); writer.append("LABEL"); printChars(writer, ' ', 22, false); writer.append(label + "\n"); } String description = module.getDescription(); if (description != null) { printChars(writer, ' ', 30, false); writer.append(STR + "\n"); printChars(writer, ' ', 16, false); writer.append(description + "\n"); } Map<String, Object> config = module.getConfiguration(); if (config != null && !config.isEmpty()) { printChars(writer, ' ', 30, false); writer.append(STR); printChars(writer, ' ', 17, false); String str = " "; writer.append(makeString(str, config)); } Set<Connection> connections = null; if (module instanceof Condition) { connections = ((Condition) module).getConnections(); } if (module instanceof Action) { connections = ((Action) module).getConnections(); } if (connections != null && !connections.isEmpty()) { printChars(writer, ' ', 30, false); writer.append(STR); printChars(writer, ' ', 19, false); writer.append(makeString(connections) + "\n"); } return writer.toString(); }
/** * This method is responsible for printing the {@link Module}. * * @param module the {@link Module} for printing. * @return a formated string, representing the {@link Module}. */
This method is responsible for printing the <code>Module</code>
printModule
{ "repo_name": "danchom/smarthome", "path": "bundles/automation/org.eclipse.smarthome.automation.commands/src/main/java/org/eclipse/smarthome/automation/commands/Printer.java", "license": "epl-1.0", "size": 27901 }
[ "java.util.Map", "java.util.Set", "org.eclipse.smarthome.automation.Action", "org.eclipse.smarthome.automation.Condition", "org.eclipse.smarthome.automation.Connection", "org.eclipse.smarthome.automation.Module" ]
import java.util.Map; import java.util.Set; import org.eclipse.smarthome.automation.Action; import org.eclipse.smarthome.automation.Condition; import org.eclipse.smarthome.automation.Connection; import org.eclipse.smarthome.automation.Module;
import java.util.*; import org.eclipse.smarthome.automation.*;
[ "java.util", "org.eclipse.smarthome" ]
java.util; org.eclipse.smarthome;
1,949,224
public static float[] fromRGB(Color color) { // Get RGB values in the range 0 - 1 float[] rgb = color.getRGBColorComponents( null ); float r = rgb[0]; float g = rgb[1]; float b = rgb[2]; // Minimum and Maximum RGB values are used in the HSL calculations float min = Math.min(r, Math.min(g, b)); float max = Math.max(r, Math.max(g, b)); // Calculate the Hue float h = 0; if (max == min) h = 0; else if (max == r) h = ((60 * (g - b) / (max - min)) + 360) % 360; else if (max == g) h = (60 * (b - r) / (max - min)) + 120; else if (max == b) h = (60 * (r - g) / (max - min)) + 240; // Calculate the Luminance float l = (max + min) / 2; // Calculate the Saturation float s = 0; if (max == min) s = 0; else if (l <= .5f) s = (max - min) / (max + min); else s = (max - min) / (2 - max - min); return new float[] {h, s * 100, l * 100}; }
static float[] function(Color color) { float[] rgb = color.getRGBColorComponents( null ); float r = rgb[0]; float g = rgb[1]; float b = rgb[2]; float min = Math.min(r, Math.min(g, b)); float max = Math.max(r, Math.max(g, b)); float h = 0; if (max == min) h = 0; else if (max == r) h = ((60 * (g - b) / (max - min)) + 360) % 360; else if (max == g) h = (60 * (b - r) / (max - min)) + 120; else if (max == b) h = (60 * (r - g) / (max - min)) + 240; float l = (max + min) / 2; float s = 0; if (max == min) s = 0; else if (l <= .5f) s = (max - min) / (max + min); else s = (max - min) / (2 - max - min); return new float[] {h, s * 100, l * 100}; }
/** * Convert a RGB Color to it corresponding HSL values. * * @return an array containing the 3 HSL values. */
Convert a RGB Color to it corresponding HSL values
fromRGB
{ "repo_name": "ShapeNet/shapenet-viewer", "path": "src/main/java/edu/stanford/graphics/shapenet/colors/HSLColor.java", "license": "mit", "size": 10477 }
[ "java.awt.Color" ]
import java.awt.Color;
import java.awt.*;
[ "java.awt" ]
java.awt;
421,007
public TimeValue requestTimeout() { return requestTimeout; }
TimeValue function() { return requestTimeout; }
/** * The timeout specified on the search request */
The timeout specified on the search request
requestTimeout
{ "repo_name": "gingerwizard/elasticsearch", "path": "x-pack/plugin/sql/sql-action/src/main/java/org/elasticsearch/xpack/sql/action/AbstractSqlQueryRequest.java", "license": "apache-2.0", "size": 16017 }
[ "org.elasticsearch.common.unit.TimeValue" ]
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.unit.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,298,615
Observable<MemberVo> getVoListAll(int displayNameCode);
Observable<MemberVo> getVoListAll(int displayNameCode);
/** * * Get All Value Object List * * <p> * Overview:<br> * Get All {@link MemberVo} of Observable object.<br> * Set the screen display name by the code specified in the argument. * </p> * * @param displayNameCode Code to select name display item * @return All {@link MemberVo} of Observable */
Get All Value Object List Overview: Get All <code>MemberVo</code> of Observable object. Set the screen display name by the code specified in the argument.
getVoListAll
{ "repo_name": "manavista/LessonManager", "path": "app/src/main/java/jp/manavista/lessonmanager/service/MemberService.java", "license": "apache-2.0", "size": 2291 }
[ "io.reactivex.Observable", "jp.manavista.lessonmanager.model.vo.MemberVo" ]
import io.reactivex.Observable; import jp.manavista.lessonmanager.model.vo.MemberVo;
import io.reactivex.*; import jp.manavista.lessonmanager.model.vo.*;
[ "io.reactivex", "jp.manavista.lessonmanager" ]
io.reactivex; jp.manavista.lessonmanager;
2,003,853
List<String> getRegisteredFunctions();
List<String> getRegisteredFunctions();
/** * Access all the registered functions. * * @return A List (String) of registered functions. */
Access all the registered functions
getRegisteredFunctions
{ "repo_name": "rodriguezdevera/sakai", "path": "kernel/api/src/main/java/org/sakaiproject/authz/api/FunctionManager.java", "license": "apache-2.0", "size": 2841 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
587,482
private final int nextHeaderMarkup(final MarkupStream associatedMarkupStream) { // No associated markup => no header section if (associatedMarkupStream == null) { return -1; } // Scan the markup for <wicket:head>. MarkupElement elem = associatedMarkupStream.get(); while (elem != null) { if (elem instanceof WicketTag) { WicketTag tag = (WicketTag)elem; if (tag.isOpen() && tag.isHeadTag()) { if (noMoreWicketHeadTagsAllowed == true) { throw new MarkupException( "<wicket:head> tags are only allowed before <body>, </head>, <wicket:panel> etc. tag"); } return associatedMarkupStream.getCurrentIndex(); } // wicket:head must be before border, panel or extend // @TODO why is that? Why can't it be anywhere? (except insight wicket:fragment else if (tag.isOpen() && (tag.isPanelTag() || tag.isBorderTag() || tag.isExtendTag())) { noMoreWicketHeadTagsAllowed = true; } } else if (elem instanceof ComponentTag) { ComponentTag tag = (ComponentTag)elem; // wicket:head must be before </head> // @TODO why?? if (tag.isClose() && TagUtils.isHeadTag(tag)) { noMoreWicketHeadTagsAllowed = true; } // wicket:head must be before <body> // @TODO why?? else if (tag.isOpen() && TagUtils.isBodyTag(tag)) { noMoreWicketHeadTagsAllowed = true; } } elem = associatedMarkupStream.next(); } // No (more) wicket:head found return -1; }
final int function(final MarkupStream associatedMarkupStream) { if (associatedMarkupStream == null) { return -1; } MarkupElement elem = associatedMarkupStream.get(); while (elem != null) { if (elem instanceof WicketTag) { WicketTag tag = (WicketTag)elem; if (tag.isOpen() && tag.isHeadTag()) { if (noMoreWicketHeadTagsAllowed == true) { throw new MarkupException( STR); } return associatedMarkupStream.getCurrentIndex(); } else if (tag.isOpen() && (tag.isPanelTag() tag.isBorderTag() tag.isExtendTag())) { noMoreWicketHeadTagsAllowed = true; } } else if (elem instanceof ComponentTag) { ComponentTag tag = (ComponentTag)elem; if (tag.isClose() && TagUtils.isHeadTag(tag)) { noMoreWicketHeadTagsAllowed = true; } else if (tag.isOpen() && TagUtils.isBodyTag(tag)) { noMoreWicketHeadTagsAllowed = true; } } elem = associatedMarkupStream.next(); } return -1; }
/** * Process next header markup fragment. * * @param associatedMarkupStream * @return index or -1 when done */
Process next header markup fragment
nextHeaderMarkup
{ "repo_name": "martin-g/wicket-osgi", "path": "wicket-core/src/main/java/org/apache/wicket/markup/html/panel/AssociatedMarkupSourcingStrategy.java", "license": "apache-2.0", "size": 11740 }
[ "org.apache.wicket.markup.ComponentTag", "org.apache.wicket.markup.MarkupElement", "org.apache.wicket.markup.MarkupException", "org.apache.wicket.markup.MarkupStream", "org.apache.wicket.markup.TagUtils", "org.apache.wicket.markup.WicketTag" ]
import org.apache.wicket.markup.ComponentTag; import org.apache.wicket.markup.MarkupElement; import org.apache.wicket.markup.MarkupException; import org.apache.wicket.markup.MarkupStream; import org.apache.wicket.markup.TagUtils; import org.apache.wicket.markup.WicketTag;
import org.apache.wicket.markup.*;
[ "org.apache.wicket" ]
org.apache.wicket;
2,912,777
public static ArtifactResponseType buildArtifactResponse(Document document) throws ParsingException, ProcessingException, ConfigurationException { SAML2Object samlObject = SAML2Request.getSAML2ObjectFromDocument(document).getSamlObject(); if (samlObject instanceof StatusResponseType) { return buildArtifactResponse(samlObject, ((StatusResponseType)samlObject).getIssuer()); } else if (samlObject instanceof RequestAbstractType) { return buildArtifactResponse(samlObject, ((RequestAbstractType)samlObject).getIssuer()); } throw new ProcessingException("SAMLObject was not StatusResponseType or LogoutRequestType"); }
static ArtifactResponseType function(Document document) throws ParsingException, ProcessingException, ConfigurationException { SAML2Object samlObject = SAML2Request.getSAML2ObjectFromDocument(document).getSamlObject(); if (samlObject instanceof StatusResponseType) { return buildArtifactResponse(samlObject, ((StatusResponseType)samlObject).getIssuer()); } else if (samlObject instanceof RequestAbstractType) { return buildArtifactResponse(samlObject, ((RequestAbstractType)samlObject).getIssuer()); } throw new ProcessingException(STR); }
/** * Takes a saml document and inserts it as a body of ArtifactResponseType * @param document the document * @return An ArtifactResponse containing the saml document. */
Takes a saml document and inserts it as a body of ArtifactResponseType
buildArtifactResponse
{ "repo_name": "abstractj/keycloak", "path": "services/src/main/java/org/keycloak/protocol/saml/SamlProtocolUtils.java", "license": "apache-2.0", "size": 13214 }
[ "org.keycloak.dom.saml.v2.SAML2Object", "org.keycloak.dom.saml.v2.protocol.ArtifactResponseType", "org.keycloak.dom.saml.v2.protocol.RequestAbstractType", "org.keycloak.dom.saml.v2.protocol.StatusResponseType", "org.keycloak.saml.common.exceptions.ConfigurationException", "org.keycloak.saml.common.exceptions.ParsingException", "org.keycloak.saml.common.exceptions.ProcessingException", "org.keycloak.saml.processing.api.saml.v2.request.SAML2Request", "org.w3c.dom.Document" ]
import org.keycloak.dom.saml.v2.SAML2Object; import org.keycloak.dom.saml.v2.protocol.ArtifactResponseType; import org.keycloak.dom.saml.v2.protocol.RequestAbstractType; import org.keycloak.dom.saml.v2.protocol.StatusResponseType; import org.keycloak.saml.common.exceptions.ConfigurationException; import org.keycloak.saml.common.exceptions.ParsingException; import org.keycloak.saml.common.exceptions.ProcessingException; import org.keycloak.saml.processing.api.saml.v2.request.SAML2Request; import org.w3c.dom.Document;
import org.keycloak.dom.saml.v2.*; import org.keycloak.dom.saml.v2.protocol.*; import org.keycloak.saml.common.exceptions.*; import org.keycloak.saml.processing.api.saml.v2.request.*; import org.w3c.dom.*;
[ "org.keycloak.dom", "org.keycloak.saml", "org.w3c.dom" ]
org.keycloak.dom; org.keycloak.saml; org.w3c.dom;
1,880,097
public List<ResultPoint> getPossibleResultPoints() { return new ArrayList<>(possibleResultPoints); }
List<ResultPoint> function() { return new ArrayList<>(possibleResultPoints); }
/** * Call immediately after decode(), from the same thread. * * The result is undefined while decode() is running. * * @return possible ResultPoints from the last decode. */
Call immediately after decode(), from the same thread. The result is undefined while decode() is running
getPossibleResultPoints
{ "repo_name": "movedon2otherthings/zxing-android-embedded", "path": "zxing-android-embedded/src/com/journeyapps/barcodescanner/Decoder.java", "license": "apache-2.0", "size": 3605 }
[ "com.google.zxing.ResultPoint", "java.util.ArrayList", "java.util.List" ]
import com.google.zxing.ResultPoint; import java.util.ArrayList; import java.util.List;
import com.google.zxing.*; import java.util.*;
[ "com.google.zxing", "java.util" ]
com.google.zxing; java.util;
2,711,207
@Deprecated public StepMeta[] getNextSteps( StepMeta stepMeta ) { List<StepMeta> nextSteps = new ArrayList<>(); for ( int i = 0; i < nrTransHops(); i++ ) { // Look at all the hops; TransHopMeta hi = getTransHop( i ); if ( hi.isEnabled() && hi.getFromStep().equals( stepMeta ) ) { nextSteps.add( hi.getToStep() ); } } return nextSteps.toArray( new StepMeta[nextSteps.size()] ); }
StepMeta[] function( StepMeta stepMeta ) { List<StepMeta> nextSteps = new ArrayList<>(); for ( int i = 0; i < nrTransHops(); i++ ) { TransHopMeta hi = getTransHop( i ); if ( hi.isEnabled() && hi.getFromStep().equals( stepMeta ) ) { nextSteps.add( hi.getToStep() ); } } return nextSteps.toArray( new StepMeta[nextSteps.size()] ); }
/** * Retrieve an array of succeeding steps for a certain originating step. * * @param stepMeta * The originating step * @return an array of succeeding steps. * @deprecated use findNextSteps instead */
Retrieve an array of succeeding steps for a certain originating step
getNextSteps
{ "repo_name": "Advent51/pentaho-kettle", "path": "engine/src/main/java/org/pentaho/di/trans/TransMeta.java", "license": "apache-2.0", "size": 225587 }
[ "java.util.ArrayList", "java.util.List", "org.pentaho.di.trans.step.StepMeta" ]
import java.util.ArrayList; import java.util.List; import org.pentaho.di.trans.step.StepMeta;
import java.util.*; import org.pentaho.di.trans.step.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
2,712,968
@Nullable private IpcSharedMemoryServerEndpoint resetShmemServer() throws IgniteCheckedException { if (boundTcpShmemPort >= 0) throw new IgniteCheckedException("Shared memory server was already created on port " + boundTcpShmemPort); if (shmemPort == -1 || U.isWindows()) return null; IgniteCheckedException lastEx = null; // If configured TCP port is busy, find first available in range. for (int port = shmemPort; port < shmemPort + locPortRange; port++) { try { IgniteConfiguration cfg = ignite.configuration(); IpcSharedMemoryServerEndpoint srv = new IpcSharedMemoryServerEndpoint(log, cfg.getNodeId(), igniteInstanceName, cfg.getWorkDirectory()); srv.setPort(port); srv.omitOutOfResourcesWarning(true); srv.start(); boundTcpShmemPort = port; // Ack Port the TCP server was bound to. if (log.isInfoEnabled()) log.info("Successfully bound shared memory communication to TCP port [port=" + boundTcpShmemPort + ", locHost=" + locHost + ']'); return srv; } catch (IgniteCheckedException e) { lastEx = e; if (log.isDebugEnabled()) log.debug("Failed to bind to local port (will try next port within range) [port=" + port + ", locHost=" + locHost + ']'); } } // If free port wasn't found. throw new IgniteCheckedException("Failed to bind shared memory communication to any port within range [startPort=" + locPort + ", portRange=" + locPortRange + ", locHost=" + locHost + ']', lastEx); }
@Nullable IpcSharedMemoryServerEndpoint function() throws IgniteCheckedException { if (boundTcpShmemPort >= 0) throw new IgniteCheckedException(STR + boundTcpShmemPort); if (shmemPort == -1 U.isWindows()) return null; IgniteCheckedException lastEx = null; for (int port = shmemPort; port < shmemPort + locPortRange; port++) { try { IgniteConfiguration cfg = ignite.configuration(); IpcSharedMemoryServerEndpoint srv = new IpcSharedMemoryServerEndpoint(log, cfg.getNodeId(), igniteInstanceName, cfg.getWorkDirectory()); srv.setPort(port); srv.omitOutOfResourcesWarning(true); srv.start(); boundTcpShmemPort = port; if (log.isInfoEnabled()) log.info(STR + boundTcpShmemPort + STR + locHost + ']'); return srv; } catch (IgniteCheckedException e) { lastEx = e; if (log.isDebugEnabled()) log.debug(STR + port + STR + locHost + ']'); } } throw new IgniteCheckedException(STR + locPort + STR + locPortRange + STR + locHost + ']', lastEx); }
/** * Creates new shared memory communication server. * * @return Server. * @throws IgniteCheckedException If failed. */
Creates new shared memory communication server
resetShmemServer
{ "repo_name": "alexzaitzev/ignite", "path": "modules/core/src/main/java/org/apache/ignite/spi/communication/tcp/TcpCommunicationSpi.java", "license": "apache-2.0", "size": 183599 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.configuration.IgniteConfiguration", "org.apache.ignite.internal.util.ipc.shmem.IpcSharedMemoryServerEndpoint", "org.apache.ignite.internal.util.typedef.internal.U", "org.jetbrains.annotations.Nullable" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.configuration.IgniteConfiguration; import org.apache.ignite.internal.util.ipc.shmem.IpcSharedMemoryServerEndpoint; import org.apache.ignite.internal.util.typedef.internal.U; import org.jetbrains.annotations.Nullable;
import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.ipc.shmem.*; import org.apache.ignite.internal.util.typedef.internal.*; import org.jetbrains.annotations.*;
[ "org.apache.ignite", "org.jetbrains.annotations" ]
org.apache.ignite; org.jetbrains.annotations;
2,157,841
public static synchronized ZeppelinConfiguration create() { if (conf != null) { return conf; } ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url; url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML); if (url == null) { ClassLoader cl = ZeppelinConfiguration.class.getClassLoader(); if (cl != null) { url = cl.getResource(ZEPPELIN_SITE_XML); } } if (url == null) { url = classLoader.getResource(ZEPPELIN_SITE_XML); } if (url == null) { LOG.warn("Failed to load configuration, proceeding with a default"); conf = new ZeppelinConfiguration(); } else { try { LOG.info("Load configuration from " + url); conf = new ZeppelinConfiguration(url); } catch (ConfigurationException e) { LOG.warn("Failed to load configuration from " + url + " proceeding with a default", e); conf = new ZeppelinConfiguration(); } } LOG.info("Server Host: " + conf.getServerAddress()); if (conf.useSsl() == false) { LOG.info("Server Port: " + conf.getServerPort()); } else { LOG.info("Server SSL Port: " + conf.getServerSslPort()); } LOG.info("Context Path: " + conf.getServerContextPath()); LOG.info("Zeppelin Version: " + Util.getVersion()); return conf; }
static synchronized ZeppelinConfiguration function() { if (conf != null) { return conf; } ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); URL url; url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML); if (url == null) { ClassLoader cl = ZeppelinConfiguration.class.getClassLoader(); if (cl != null) { url = cl.getResource(ZEPPELIN_SITE_XML); } } if (url == null) { url = classLoader.getResource(ZEPPELIN_SITE_XML); } if (url == null) { LOG.warn(STR); conf = new ZeppelinConfiguration(); } else { try { LOG.info(STR + url); conf = new ZeppelinConfiguration(url); } catch (ConfigurationException e) { LOG.warn(STR + url + STR, e); conf = new ZeppelinConfiguration(); } } LOG.info(STR + conf.getServerAddress()); if (conf.useSsl() == false) { LOG.info(STR + conf.getServerPort()); } else { LOG.info(STR + conf.getServerSslPort()); } LOG.info(STR + conf.getServerContextPath()); LOG.info(STR + Util.getVersion()); return conf; }
/** * Load from resource. *url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML); * @throws ConfigurationException */
Load from resource. url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML)
create
{ "repo_name": "zetaris/zeppelin", "path": "zeppelin-interpreter/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java", "license": "apache-2.0", "size": 33471 }
[ "org.apache.commons.configuration.ConfigurationException", "org.apache.zeppelin.util.Util" ]
import org.apache.commons.configuration.ConfigurationException; import org.apache.zeppelin.util.Util;
import org.apache.commons.configuration.*; import org.apache.zeppelin.util.*;
[ "org.apache.commons", "org.apache.zeppelin" ]
org.apache.commons; org.apache.zeppelin;
248,577
public void releasePin(GPIOPin pin) throws IOException { try { if (gpioLock.writeLock().tryLock(GPIOLOCK_TIMEOUT, GPIOLOCK_TIMEOUT_UNITS)) { try { final String SYSFS_CLASS_GPIO = sysFS + "/class/gpio/"; Integer pinNumber = gpioRegistry.remove(pin); if (pinNumber == null) { throw new IllegalArgumentException("The pin object isn't registered"); } ((GPIOPinLinux) pin).stopEventProcessing(); Files.write(Paths.get(SYSFS_CLASS_GPIO + "unexport"), pinNumber.toString().getBytes()); } finally { gpioLock.writeLock().unlock(); } } else { throw new IOException("Write GPIO lock can't be aquired for " + GPIOLOCK_TIMEOUT + " " + GPIOLOCK_TIMEOUT_UNITS.toString()); } } catch (InterruptedException e) { throw new IOException("The thread was interrupted while waiting for write GPIO lock"); } }
void function(GPIOPin pin) throws IOException { try { if (gpioLock.writeLock().tryLock(GPIOLOCK_TIMEOUT, GPIOLOCK_TIMEOUT_UNITS)) { try { final String SYSFS_CLASS_GPIO = sysFS + STR; Integer pinNumber = gpioRegistry.remove(pin); if (pinNumber == null) { throw new IllegalArgumentException(STR); } ((GPIOPinLinux) pin).stopEventProcessing(); Files.write(Paths.get(SYSFS_CLASS_GPIO + STR), pinNumber.toString().getBytes()); } finally { gpioLock.writeLock().unlock(); } } else { throw new IOException(STR + GPIOLOCK_TIMEOUT + " " + GPIOLOCK_TIMEOUT_UNITS.toString()); } } catch (InterruptedException e) { throw new IOException(STR); } }
/** * Removes the pin from internal registry, uninitialize the object * and stop pin export to user space. */
Removes the pin from internal registry, uninitialize the object and stop pin export to user space
releasePin
{ "repo_name": "Greblys/openhab", "path": "bundles/io/org.openhab.io.gpio/src/main/java/org/openhab/io/gpio/linux/GPIOLinux.java", "license": "epl-1.0", "size": 9724 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Paths", "org.openhab.io.gpio.GPIOPin" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import org.openhab.io.gpio.GPIOPin;
import java.io.*; import java.nio.file.*; import org.openhab.io.gpio.*;
[ "java.io", "java.nio", "org.openhab.io" ]
java.io; java.nio; org.openhab.io;
1,102,554
void setSubmitDate(Date submitDate);
void setSubmitDate(Date submitDate);
/** * Set the date that this {@link Order} was submitted. Used in the blCheckoutWorkflow as the last step after everything * else has been completed (payments charged, integration systems notified, etc). * * @param submitDate the date that this {@link Order} was submitted. */
Set the date that this <code>Order</code> was submitted. Used in the blCheckoutWorkflow as the last step after everything else has been completed (payments charged, integration systems notified, etc)
setSubmitDate
{ "repo_name": "passion1014/metaworks_framework", "path": "core/broadleaf-framework/src/main/java/org/broadleafcommerce/core/order/domain/Order.java", "license": "apache-2.0", "size": 16996 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
54,823
Set<ProcessorEntity> getProcessors(String groupId);
Set<ProcessorEntity> getProcessors(String groupId);
/** * Gets all the Processor transfer objects for this controller. * * @param groupId group * @return List of all the Processor transfer object */
Gets all the Processor transfer objects for this controller
getProcessors
{ "repo_name": "WilliamNouet/nifi", "path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/NiFiServiceFacade.java", "license": "apache-2.0", "size": 53848 }
[ "java.util.Set", "org.apache.nifi.web.api.entity.ProcessorEntity" ]
import java.util.Set; import org.apache.nifi.web.api.entity.ProcessorEntity;
import java.util.*; import org.apache.nifi.web.api.entity.*;
[ "java.util", "org.apache.nifi" ]
java.util; org.apache.nifi;
125,531
public Builder addObjectFile(Artifact artifact) { Preconditions.checkArgument(Link.OBJECT_FILETYPES.matches(artifact.getFilename())); objectFiles.add(artifact); return this; }
Builder function(Artifact artifact) { Preconditions.checkArgument(Link.OBJECT_FILETYPES.matches(artifact.getFilename())); objectFiles.add(artifact); return this; }
/** * Adds an .o file. */
Adds an .o file
addObjectFile
{ "repo_name": "mikelikespie/bazel", "path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcCompilationOutputs.java", "license": "apache-2.0", "size": 8453 }
[ "com.google.devtools.build.lib.actions.Artifact", "com.google.devtools.build.lib.util.Preconditions" ]
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.util.*;
[ "com.google.devtools" ]
com.google.devtools;
1,107,821
protected void setServerName(String serverName) { if (CmsStringUtil.isEmpty(serverName) || (WILDCARD.equals(serverName))) { m_serverName = WILDCARD; } else { m_serverName = serverName.trim(); } }
void function(String serverName) { if (CmsStringUtil.isEmpty(serverName) (WILDCARD.equals(serverName))) { m_serverName = WILDCARD; } else { m_serverName = serverName.trim(); } }
/** * Sets the hostname (e.g. localhost) which is required to access this site.<p> * * Setting the hostname to "*" is a wildcard that matches all hostnames * * @param serverName the hostname (e.g. localhost) which is required to access this site */
Sets the hostname (e.g. localhost) which is required to access this site. Setting the hostname to "*" is a wildcard that matches all hostnames
setServerName
{ "repo_name": "it-tavis/opencms-core", "path": "src/org/opencms/site/CmsSiteMatcher.java", "license": "lgpl-2.1", "size": 12393 }
[ "org.opencms.util.CmsStringUtil" ]
import org.opencms.util.CmsStringUtil;
import org.opencms.util.*;
[ "org.opencms.util" ]
org.opencms.util;
825,580
public void processTasks(final DBBroker systemBroker, final Txn transaction) { //dont run the task if we are shutting down if (pool.isShuttingDown() || pool.isShutDown()) { return; } // broker must be running as the SYSTEM subject if (!systemBroker.getCurrentSubject().equals(pool.getSecurityManager().getSystemSubject())) { throw new IllegalArgumentException("Process tasks requires a system broker"); } synchronized (waitingSystemTasks) { if(!waitingSystemTasks.isEmpty()) { try { while (!waitingSystemTasks.isEmpty()) { final SystemTask task = waitingSystemTasks.pop(); if (pool.isShuttingDown()) { LOG.info("Skipping SystemTask: '" + task.getName() + "' as database is shutting down..."); } else if (pool.isShutDown()) { LOG.warn("Unable to execute SystemTask: '" + task.getName() + "' as database is shut down!"); } else { if (task.afterCheckpoint()) { pool.sync(systemBroker, Sync.MAJOR); } runSystemTask(task, systemBroker, transaction); } } } catch (final Exception e) { LOG.error("System maintenance task reported error: " + e.getMessage(), e); } } } }
void function(final DBBroker systemBroker, final Txn transaction) { if (pool.isShuttingDown() pool.isShutDown()) { return; } if (!systemBroker.getCurrentSubject().equals(pool.getSecurityManager().getSystemSubject())) { throw new IllegalArgumentException(STR); } synchronized (waitingSystemTasks) { if(!waitingSystemTasks.isEmpty()) { try { while (!waitingSystemTasks.isEmpty()) { final SystemTask task = waitingSystemTasks.pop(); if (pool.isShuttingDown()) { LOG.info(STR + task.getName() + STR); } else if (pool.isShutDown()) { LOG.warn(STR + task.getName() + STR); } else { if (task.afterCheckpoint()) { pool.sync(systemBroker, Sync.MAJOR); } runSystemTask(task, systemBroker, transaction); } } } catch (final Exception e) { LOG.error(STR + e.getMessage(), e); } } } }
/** * Process system tasks. * * @param systemBroker a broker running as the SYSTEM subject. * @param transaction the transaction */
Process system tasks
processTasks
{ "repo_name": "ambs/exist", "path": "exist-core/src/main/java/org/exist/storage/SystemTaskManager.java", "license": "lgpl-2.1", "size": 3965 }
[ "org.exist.storage.sync.Sync", "org.exist.storage.txn.Txn" ]
import org.exist.storage.sync.Sync; import org.exist.storage.txn.Txn;
import org.exist.storage.sync.*; import org.exist.storage.txn.*;
[ "org.exist.storage" ]
org.exist.storage;
1,799,044
public static Expression coerce(Expression lhs, Expression rhs, CompareOp op, boolean rowKeyOrderOptimizable) throws SQLException { return coerce(lhs, rhs, getWrapper(op), rowKeyOrderOptimizable); }
static Expression function(Expression lhs, Expression rhs, CompareOp op, boolean rowKeyOrderOptimizable) throws SQLException { return coerce(lhs, rhs, getWrapper(op), rowKeyOrderOptimizable); }
/** * Coerce the RHS to match the LHS type, throwing if the types are incompatible. * @param lhs left hand side expression * @param rhs right hand side expression * @param op operator being used to compare the expressions, which can affect rounding we may need to do. * @param rowKeyOrderOptimizable * @return the newly coerced expression * @throws SQLException */
Coerce the RHS to match the LHS type, throwing if the types are incompatible
coerce
{ "repo_name": "elilevine/apache-phoenix", "path": "phoenix-core/src/main/java/org/apache/phoenix/expression/BaseExpression.java", "license": "apache-2.0", "size": 11266 }
[ "java.sql.SQLException", "org.apache.hadoop.hbase.filter.CompareFilter" ]
import java.sql.SQLException; import org.apache.hadoop.hbase.filter.CompareFilter;
import java.sql.*; import org.apache.hadoop.hbase.filter.*;
[ "java.sql", "org.apache.hadoop" ]
java.sql; org.apache.hadoop;
2,377,926
public void testLastKey_throwsNoSuchElementException() { SortedMap<K, V> sortedMap = createNavigableMap(); // test with no entries try { sortedMap.lastKey(); fail("expected exception"); } catch (NoSuchElementException e) { // expected outcome } }
void function() { SortedMap<K, V> sortedMap = createNavigableMap(); try { sortedMap.lastKey(); fail(STR); } catch (NoSuchElementException e) { } }
/** * Test method for 'java.util.SortedMap.lastKey()'. * * @see java.util.SortedMap#lastKey() */
Test method for 'java.util.SortedMap.lastKey()'
testLastKey_throwsNoSuchElementException
{ "repo_name": "google/j2cl", "path": "jre/javatests/com/google/gwt/emultest/java/util/TreeMapTest.java", "license": "apache-2.0", "size": 108600 }
[ "java.util.NoSuchElementException", "java.util.SortedMap" ]
import java.util.NoSuchElementException; import java.util.SortedMap;
import java.util.*;
[ "java.util" ]
java.util;
2,391,378
public final boolean isRouteBack() { return port == 0 && Arrays.equals(address, new byte[4]); } public final InetSocketAddress endpoint() { return new InetSocketAddress(getAddress(), port); }
final boolean function() { return port == 0 && Arrays.equals(address, new byte[4]); } public final InetSocketAddress endpoint() { return new InetSocketAddress(getAddress(), port); }
/** * Indicates whether this HPAI is a route back HPAI, required for UDP NAT and TCP connections. * * @return <code>true</code> if this HPAI is a route back HPAI, <code>false</code> otherwise */
Indicates whether this HPAI is a route back HPAI, required for UDP NAT and TCP connections
isRouteBack
{ "repo_name": "selfbus/software-arm-lib", "path": "Bus-Updater/PC_updater_tool/source/src/main/java/tuwien/auto/calimero/knxnetip/util/HPAI.java", "license": "gpl-3.0", "size": 10052 }
[ "java.net.InetSocketAddress", "java.util.Arrays" ]
import java.net.InetSocketAddress; import java.util.Arrays;
import java.net.*; import java.util.*;
[ "java.net", "java.util" ]
java.net; java.util;
1,908,305
public static HttpResponse errorJSON(@Nonnull String message, @Nonnull JSONArray data) { return new JSONObjectResponse(data).error(message); } static class JSONObjectResponse implements HttpResponse { private final JSONObject jsonObject; JSONObjectResponse() { this.jsonObject = new JSONObject(); status("ok"); } JSONObjectResponse(@Nonnull JSONObject data) { this(); this.jsonObject.put("data", data); } JSONObjectResponse(@Nonnull JSONArray data) { this(); this.jsonObject.put("data", data); } JSONObjectResponse(@Nonnull Map<?,?> data) { this(); this.jsonObject.put("data", JSONObject.fromObject(data)); }
static HttpResponse function(@Nonnull String message, @Nonnull JSONArray data) { return new JSONObjectResponse(data).error(message); } static class JSONObjectResponse implements HttpResponse { private final JSONObject jsonObject; JSONObjectResponse() { this.jsonObject = new JSONObject(); status("ok"); } JSONObjectResponse(@Nonnull JSONObject data) { this(); this.jsonObject.put("data", data); } JSONObjectResponse(@Nonnull JSONArray data) { this(); this.jsonObject.put("data", data); } JSONObjectResponse(@Nonnull Map<?,?> data) { this(); this.jsonObject.put("data", JSONObject.fromObject(data)); }
/** * Set the response as an error response plus some data. * @param message The error "message" set on the response. * @param data The data. * @return {@code this} object. * * @since 2.115 */
Set the response as an error response plus some data
errorJSON
{ "repo_name": "viqueen/jenkins", "path": "core/src/main/java/hudson/util/HttpResponses.java", "license": "mit", "size": 6755 }
[ "java.util.Map", "javax.annotation.Nonnull", "net.sf.json.JSONArray", "net.sf.json.JSONObject", "org.kohsuke.stapler.HttpResponse" ]
import java.util.Map; import javax.annotation.Nonnull; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import org.kohsuke.stapler.HttpResponse;
import java.util.*; import javax.annotation.*; import net.sf.json.*; import org.kohsuke.stapler.*;
[ "java.util", "javax.annotation", "net.sf.json", "org.kohsuke.stapler" ]
java.util; javax.annotation; net.sf.json; org.kohsuke.stapler;
2,122,080
@Override protected Variable selectUnassignedVariable(Assignment assignment, CSP csp) { switch (selectionStrategy) { case MRV: return applyMRVHeuristic(csp, assignment).get(0); case MRV_DEG: List<Variable> vars = applyMRVHeuristic(csp, assignment); return applyDegreeHeuristic(vars, assignment, csp).get(0); default: for (Variable var : csp.getVariables()) { if (!(assignment.hasAssignmentFor(var))) return var; } } return null; }
Variable function(Assignment assignment, CSP csp) { switch (selectionStrategy) { case MRV: return applyMRVHeuristic(csp, assignment).get(0); case MRV_DEG: List<Variable> vars = applyMRVHeuristic(csp, assignment); return applyDegreeHeuristic(vars, assignment, csp).get(0); default: for (Variable var : csp.getVariables()) { if (!(assignment.hasAssignmentFor(var))) return var; } } return null; }
/** * Primitive operation, selecting a not yet assigned variable. */
Primitive operation, selecting a not yet assigned variable
selectUnassignedVariable
{ "repo_name": "futuristixa/aima-java", "path": "aima-core/src/main/java/aima/core/search/csp/ImprovedBacktrackingStrategy.java", "license": "mit", "size": 7701 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
451,024
public static long[] toLongArray(Collection<Long> c) { long[] ret = new long[c.size()]; int i = 0; for (Long element : c) { ret[i++] = element; } return ret; }
static long[] function(Collection<Long> c) { long[] ret = new long[c.size()]; int i = 0; for (Long element : c) { ret[i++] = element; } return ret; }
/** * Constructs an array from the given collection, with no guarantee of the ordering of the elements in the array */
Constructs an array from the given collection, with no guarantee of the ordering of the elements in the array
toLongArray
{ "repo_name": "aquirozsea/programming5", "path": "src/programming5/collections/CollectionUtils.java", "license": "gpl-3.0", "size": 33760 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,092,538
public DirRecord getNextSiblingBy(String type, Dataset keys, boolean ignorePNCase) throws IOException;
DirRecord function(String type, Dataset keys, boolean ignorePNCase) throws IOException;
/** * Gets the nextSiblingBy attribute of the DirRecord object * * @param type Description of the Parameter * @param keys Description of the Parameter * @param ignorePNCase Description of the Parameter * @return The nextSiblingBy value * @exception IOException Description of the Exception */
Gets the nextSiblingBy attribute of the DirRecord object
getNextSiblingBy
{ "repo_name": "medicayun/medicayundicom", "path": "dcm4che14/tags/DCM4CHE_1_4_6/src/java/org/dcm4che/media/DirRecord.java", "license": "apache-2.0", "size": 7515 }
[ "java.io.IOException", "org.dcm4che.data.Dataset" ]
import java.io.IOException; import org.dcm4che.data.Dataset;
import java.io.*; import org.dcm4che.data.*;
[ "java.io", "org.dcm4che.data" ]
java.io; org.dcm4che.data;
145,302
public Node toRawNode(Node node);
Node function(Node node);
/** * remove lucee node wraps (XMLStruct) from node * * @param node * @return raw node (without wrap) */
remove lucee node wraps (XMLStruct) from node
toRawNode
{ "repo_name": "gpickin/Lucee", "path": "loader/src/main/java/lucee/runtime/util/XMLUtil.java", "license": "lgpl-2.1", "size": 10273 }
[ "org.w3c.dom.Node" ]
import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
570,178
@Test public void testEqualsWithNull() { final WkbGeometryCollectionZM<WkbPointZM> collection = new WkbGeometryCollectionZM<>(new WkbPointZM(0.0, 0.0, 0.0, 0.0), new WkbPointZM(0.0, 0.0, 0.0, 0.0), new WkbPointZM(0.0, 0.0, 0.0, 0.0)); //noinspection SimplifiableJUnitAssertion,ObjectEqualsNull assertFalse("equals returned true for testing against null", collection.equals(null)); }
void function() { final WkbGeometryCollectionZM<WkbPointZM> collection = new WkbGeometryCollectionZM<>(new WkbPointZM(0.0, 0.0, 0.0, 0.0), new WkbPointZM(0.0, 0.0, 0.0, 0.0), new WkbPointZM(0.0, 0.0, 0.0, 0.0)); assertFalse(STR, collection.equals(null)); }
/** * Test equals with null */
Test equals with null
testEqualsWithNull
{ "repo_name": "GitHubRGI/swagd", "path": "GeoPackage/src/test/java/com/rgi/geopackage/features/geometry/zm/WkbGeometryCollectionZMTest.java", "license": "mit", "size": 14558 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
899,995
public Response execute(Request request) throws Exception { logger.debug("MessageDriverBean Facade execute"); Response resp = new Response(); if (request == null) { resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR); resp.getState().setErrCode("request is Null"); return resp; } String serviceName = request.getServiceName(); if (serviceName == null) { resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR); resp.getState().setErrCode("serviceName is Null"); return resp; } BaseProcessor processor = (BaseProcessor) getBeanFactory().getBean(serviceName); try { processor.doActivities(request, resp); } catch (GoOnException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); // 抛出特定的异常。 try { super.getMessageDrivenContext().setRollbackOnly(); } catch (Exception e1) { e1.printStackTrace(); throw new EJBException("事务回滚错误,抛出EJBException."); } } if (resp.getState().isOK()) { resp.setReturnCode(Response.SUCCESS); } return resp; }
Response function(Request request) throws Exception { logger.debug(STR); Response resp = new Response(); if (request == null) { resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR); resp.getState().setErrCode(STR); return resp; } String serviceName = request.getServiceName(); if (serviceName == null) { resp.setReturnCode(Response.APPLICATION_LEVEL_ERROR); resp.getState().setErrCode(STR); return resp; } BaseProcessor processor = (BaseProcessor) getBeanFactory().getBean(serviceName); try { processor.doActivities(request, resp); } catch (GoOnException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); try { super.getMessageDrivenContext().setRollbackOnly(); } catch (Exception e1) { e1.printStackTrace(); throw new EJBException(STR); } } if (resp.getState().isOK()) { resp.setReturnCode(Response.SUCCESS); } return resp; }
/** * An example business method. * * @param request * the request * @return the response * @throws Exception * the exception * @ejb.interface-method view-type = "remote" */
An example business method
execute
{ "repo_name": "8090boy/gomall.la", "path": "legendshop_util/src/java/com/legendshop/command/framework/facade/BaseMDB.java", "license": "apache-2.0", "size": 3689 }
[ "com.legendshop.command.framework.BaseProcessor", "com.legendshop.command.framework.GoOnException", "com.legendshop.command.framework.Request", "com.legendshop.command.framework.Response", "javax.ejb.EJBException" ]
import com.legendshop.command.framework.BaseProcessor; import com.legendshop.command.framework.GoOnException; import com.legendshop.command.framework.Request; import com.legendshop.command.framework.Response; import javax.ejb.EJBException;
import com.legendshop.command.framework.*; import javax.ejb.*;
[ "com.legendshop.command", "javax.ejb" ]
com.legendshop.command; javax.ejb;
2,514,734
public void encodeImage(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor("image/png"); writer.writeImage(buf, os); }
void function(BufferedImage buf, OutputStream os) throws IOException { ImageWriter writer = ImageWriterRegistry.getInstance() .getWriterFor(STR); writer.writeImage(buf, os); }
/** * Uses PNG encoding. */
Uses PNG encoding
encodeImage
{ "repo_name": "adufilie/flex-sdk", "path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/svggen/CachedImageHandlerPNGEncoder.java", "license": "apache-2.0", "size": 2672 }
[ "java.awt.image.BufferedImage", "java.io.IOException", "java.io.OutputStream", "org.apache.flex.forks.batik.ext.awt.image.spi.ImageWriter", "org.apache.flex.forks.batik.ext.awt.image.spi.ImageWriterRegistry" ]
import java.awt.image.BufferedImage; import java.io.IOException; import java.io.OutputStream; import org.apache.flex.forks.batik.ext.awt.image.spi.ImageWriter; import org.apache.flex.forks.batik.ext.awt.image.spi.ImageWriterRegistry;
import java.awt.image.*; import java.io.*; import org.apache.flex.forks.batik.ext.awt.image.spi.*;
[ "java.awt", "java.io", "org.apache.flex" ]
java.awt; java.io; org.apache.flex;
2,044,963
public Calendar getStartTime() { return startTime; }
Calendar function() { return startTime; }
/** * Gets Start Time. * * @return the Start Time */
Gets Start Time
getStartTime
{ "repo_name": "zsmartsystems/com.zsmartsystems.zigbee", "path": "com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/prepayment/CreditAdjustment.java", "license": "epl-1.0", "size": 6816 }
[ "java.util.Calendar" ]
import java.util.Calendar;
import java.util.*;
[ "java.util" ]
java.util;
1,592,405
private void ackClassPaths(RuntimeMXBean rtBean) { assert log != null; // Ack all class paths. if (log.isDebugEnabled()) { try { log.debug("Boot class path: " + rtBean.getBootClassPath()); log.debug("Class path: " + rtBean.getClassPath()); log.debug("Library path: " + rtBean.getLibraryPath()); } catch (Exception ignore) { // No-op: ignore for Java 9+ and non-standard JVMs. } } }
void function(RuntimeMXBean rtBean) { assert log != null; if (log.isDebugEnabled()) { try { log.debug(STR + rtBean.getBootClassPath()); log.debug(STR + rtBean.getClassPath()); log.debug(STR + rtBean.getLibraryPath()); } catch (Exception ignore) { } } }
/** * Prints out class paths in debug mode. * * @param rtBean Java runtime bean. */
Prints out class paths in debug mode
ackClassPaths
{ "repo_name": "SharplEr/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java", "license": "apache-2.0", "size": 153416 }
[ "java.lang.management.RuntimeMXBean" ]
import java.lang.management.RuntimeMXBean;
import java.lang.management.*;
[ "java.lang" ]
java.lang;
1,450,128
public List<LifecycleCallbackType<InterceptorType<T>>> getAllPrePassivate() { List<LifecycleCallbackType<InterceptorType<T>>> list = new ArrayList<LifecycleCallbackType<InterceptorType<T>>>(); List<Node> nodeList = childNode.get("pre-passivate"); for(Node node: nodeList) { LifecycleCallbackType<InterceptorType<T>> type = new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, "pre-passivate", childNode, node); list.add(type); } return list; }
List<LifecycleCallbackType<InterceptorType<T>>> function() { List<LifecycleCallbackType<InterceptorType<T>>> list = new ArrayList<LifecycleCallbackType<InterceptorType<T>>>(); List<Node> nodeList = childNode.get(STR); for(Node node: nodeList) { LifecycleCallbackType<InterceptorType<T>> type = new LifecycleCallbackTypeImpl<InterceptorType<T>>(this, STR, childNode, node); list.add(type); } return list; }
/** * Returns all <code>pre-passivate</code> elements * @return list of <code>pre-passivate</code> */
Returns all <code>pre-passivate</code> elements
getAllPrePassivate
{ "repo_name": "forge/javaee-descriptors", "path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar30/InterceptorTypeImpl.java", "license": "epl-1.0", "size": 39854 }
[ "java.util.ArrayList", "java.util.List", "org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType", "org.jboss.shrinkwrap.descriptor.api.javaee5.LifecycleCallbackType", "org.jboss.shrinkwrap.descriptor.impl.javaee5.LifecycleCallbackTypeImpl", "org.jboss.shrinkwrap.descriptor.spi.node.Node" ]
import java.util.ArrayList; import java.util.List; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.InterceptorType; import org.jboss.shrinkwrap.descriptor.api.javaee5.LifecycleCallbackType; import org.jboss.shrinkwrap.descriptor.impl.javaee5.LifecycleCallbackTypeImpl; import org.jboss.shrinkwrap.descriptor.spi.node.Node;
import java.util.*; import org.jboss.shrinkwrap.descriptor.api.ejbjar30.*; import org.jboss.shrinkwrap.descriptor.api.javaee5.*; import org.jboss.shrinkwrap.descriptor.impl.javaee5.*; import org.jboss.shrinkwrap.descriptor.spi.node.*;
[ "java.util", "org.jboss.shrinkwrap" ]
java.util; org.jboss.shrinkwrap;
2,516,240
public TopBuilder resetAllPositionsOnSnapshot() { this.factory = TopFactory.RESET_ON_SNAPSHOT; return this; } /** * Top configured with this strategy will be cleared at all after each {@code intervalBetweenResetting} elapsed. * * <p> * If You use this strategy inside JEE environment, * then it would be better to call {@code ResilientExecutionUtil.getInstance().shutdownBackgroundExecutor()}
TopBuilder function() { this.factory = TopFactory.RESET_ON_SNAPSHOT; return this; } /** * Top configured with this strategy will be cleared at all after each {@code intervalBetweenResetting} elapsed. * * <p> * If You use this strategy inside JEE environment, * then it would be better to call {@code ResilientExecutionUtil.getInstance().shutdownBackgroundExecutor()}
/** * Top configured with this strategy will be cleared each time when {@link Top#getPositionsInDescendingOrder()} invoked. * * @return this builder instance * @see #resetPositionsPeriodicallyByChunks(Duration, int) * @see #resetAllPositionsPeriodically(Duration) */
Top configured with this strategy will be cleared each time when <code>Top#getPositionsInDescendingOrder()</code> invoked
resetAllPositionsOnSnapshot
{ "repo_name": "vladimir-bukhtoyarov/metrics-core-addons", "path": "src/main/java/com/github/rollingmetrics/top/TopBuilder.java", "license": "apache-2.0", "size": 16506 }
[ "com.github.rollingmetrics.util.ResilientExecutionUtil" ]
import com.github.rollingmetrics.util.ResilientExecutionUtil;
import com.github.rollingmetrics.util.*;
[ "com.github.rollingmetrics" ]
com.github.rollingmetrics;
2,644,739
public List<DatePath> getInputsToProcess() { return getPlan()._inputsToProcess; }
List<DatePath> function() { return getPlan()._inputsToProcess; }
/** * Gets all inputs that will be processed. This includes both old and new data. * Must call {@link #createPlan()} first. * * @return inputs to process */
Gets all inputs that will be processed. This includes both old and new data. Must call <code>#createPlan()</code> first
getInputsToProcess
{ "repo_name": "shaohua-zhang/incubator-datafu", "path": "datafu-hourglass/src/main/java/datafu/hourglass/jobs/PartitionCollapsingExecutionPlanner.java", "license": "apache-2.0", "size": 19134 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
167,516
private int getCountOfEmptyLinesBefore(int lineNo) { int result = 0; final String[] lines = getLines(); // [lineNo - 2] is the number of the previous line // because the numbering starts from zero. int lineBeforeIndex = lineNo - 2; while (lineBeforeIndex >= 0 && CommonUtils.isBlank(lines[lineBeforeIndex])) { lineBeforeIndex--; result++; } return result; }
int function(int lineNo) { int result = 0; final String[] lines = getLines(); int lineBeforeIndex = lineNo - 2; while (lineBeforeIndex >= 0 && CommonUtils.isBlank(lines[lineBeforeIndex])) { lineBeforeIndex--; result++; } return result; }
/** * Counts empty lines before given. * @param lineNo * Line number of current import. * @return count of empty lines before given. */
Counts empty lines before given
getCountOfEmptyLinesBefore
{ "repo_name": "sharang108/checkstyle", "path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/imports/CustomImportOrderCheck.java", "license": "lgpl-2.1", "size": 33532 }
[ "com.puppycrawl.tools.checkstyle.utils.CommonUtils" ]
import com.puppycrawl.tools.checkstyle.utils.CommonUtils;
import com.puppycrawl.tools.checkstyle.utils.*;
[ "com.puppycrawl.tools" ]
com.puppycrawl.tools;
747,010
private static int setColorAlpha(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
static int function(int color, byte alpha) { return Color.argb(alpha, Color.red(color), Color.green(color), Color.blue(color)); }
/** * Set the alpha value of the {@code color} to be the given {@code alpha} value. */
Set the alpha value of the color to be the given alpha value
setColorAlpha
{ "repo_name": "ganddev/breminale_android_mvvm", "path": "app/src/main/java/de/ahlfeld/breminale/app/view/customviews/SlidingTabStrip.java", "license": "mit", "size": 5749 }
[ "android.graphics.Color" ]
import android.graphics.Color;
import android.graphics.*;
[ "android.graphics" ]
android.graphics;
1,688,427
public java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> getSubterm_multisets_CardinalityOfHLAPI(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.CardinalityOfImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI( (fr.lip6.move.pnml.hlpn.multisets.CardinalityOf)elemnt )); } } return retour; }
java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.multisets.impl.CardinalityOfImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.multisets.hlapi.CardinalityOfHLAPI( (fr.lip6.move.pnml.hlpn.multisets.CardinalityOf)elemnt )); } } return retour; }
/** * This accessor return a list of encapsulated subelement, only of CardinalityOfHLAPI kind. * WARNING : this method can creates a lot of new object in memory. */
This accessor return a list of encapsulated subelement, only of CardinalityOfHLAPI kind. WARNING : this method can creates a lot of new object in memory
getSubterm_multisets_CardinalityOfHLAPI
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/finiteIntRanges/hlapi/GreaterThanHLAPI.java", "license": "epl-1.0", "size": 108747 }
[ "fr.lip6.move.pnml.hlpn.terms.Term", "java.util.ArrayList", "java.util.List" ]
import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List;
import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*;
[ "fr.lip6.move", "java.util" ]
fr.lip6.move; java.util;
1,531,723
private static synchronized Integer calculateIDNumber(Integer projectID, TWorkItem tWorkItem) { Integer nextItemID = null; if (projectID!=null) { Connection connection = null; try { connection = Transaction.begin(DATABASE_NAME); } catch (TorqueException e) { LOGGER.error("Getting the connection for failed with " + e.getMessage()); return null; } if (connection!=null) { try { TProject tProject = null; try { tProject = TProjectPeer.retrieveByPK(projectID, connection); } catch(Exception e) { LOGGER.error("Loading of a project by primary key " + projectID + failedWith + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tProject!=null) { nextItemID = tProject.getNextItemID(); if (nextItemID==null) { nextItemID = getNextItemID(projectID); } if (tWorkItem!=null) { tWorkItem.setIDNumber(nextItemID); tWorkItem.save(connection); } tProject.setNextItemID(nextItemID.intValue()+1); TProjectPeer.doUpdate(tProject, connection); Transaction.commit(connection); } connection = null; } catch (Exception e) { LOGGER.error("Setting the project specific itemID failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { if (connection!=null) { Transaction.safeRollback(connection); } } } } return nextItemID; }
static synchronized Integer function(Integer projectID, TWorkItem tWorkItem) { Integer nextItemID = null; if (projectID!=null) { Connection connection = null; try { connection = Transaction.begin(DATABASE_NAME); } catch (TorqueException e) { LOGGER.error(STR + e.getMessage()); return null; } if (connection!=null) { try { TProject tProject = null; try { tProject = TProjectPeer.retrieveByPK(projectID, connection); } catch(Exception e) { LOGGER.error(STR + projectID + failedWith + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } if (tProject!=null) { nextItemID = tProject.getNextItemID(); if (nextItemID==null) { nextItemID = getNextItemID(projectID); } if (tWorkItem!=null) { tWorkItem.setIDNumber(nextItemID); tWorkItem.save(connection); } tProject.setNextItemID(nextItemID.intValue()+1); TProjectPeer.doUpdate(tProject, connection); Transaction.commit(connection); } connection = null; } catch (Exception e) { LOGGER.error(STR + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } finally { if (connection!=null) { Transaction.safeRollback(connection); } } } } return nextItemID; }
/** * Calculates the project specific IDNumber * If tWorkItem is specified then it is saved after setting the calculated IDNumber * Otherwise only returns the IDNumber * @param projectID * @param tWorkItem * @return */
Calculates the project specific IDNumber If tWorkItem is specified then it is saved after setting the calculated IDNumber Otherwise only returns the IDNumber
calculateIDNumber
{ "repo_name": "trackplus/Genji", "path": "src/main/java/com/aurel/track/persist/TWorkItemPeer.java", "license": "gpl-3.0", "size": 84464 }
[ "java.sql.Connection", "org.apache.commons.lang3.exception.ExceptionUtils", "org.apache.torque.TorqueException", "org.apache.torque.util.Transaction" ]
import java.sql.Connection; import org.apache.commons.lang3.exception.ExceptionUtils; import org.apache.torque.TorqueException; import org.apache.torque.util.Transaction;
import java.sql.*; import org.apache.commons.lang3.exception.*; import org.apache.torque.*; import org.apache.torque.util.*;
[ "java.sql", "org.apache.commons", "org.apache.torque" ]
java.sql; org.apache.commons; org.apache.torque;
44,186
SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); UserDetails springSecurityUser = null; String userName = null; if(authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
SecurityContext securityContext = SecurityContextHolder.getContext(); Authentication authentication = securityContext.getAuthentication(); UserDetails springSecurityUser = null; String userName = null; if(authentication != null) { if (authentication.getPrincipal() instanceof UserDetails) { springSecurityUser = (UserDetails) authentication.getPrincipal(); userName = springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { userName = (String) authentication.getPrincipal(); } } return userName; }
/** * Get the login of the current user. */
Get the login of the current user
getCurrentLogin
{ "repo_name": "asm0dey/lostodos", "path": "src/main/java/com/github/asm0dey/lostodos/security/SecurityUtils.java", "license": "mit", "size": 2677 }
[ "org.springframework.security.core.Authentication", "org.springframework.security.core.context.SecurityContext", "org.springframework.security.core.context.SecurityContextHolder", "org.springframework.security.core.userdetails.UserDetails" ]
import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.*; import org.springframework.security.core.context.*; import org.springframework.security.core.userdetails.*;
[ "org.springframework.security" ]
org.springframework.security;
1,129,734
public List<SignUpToken> getUnusedSignUpTokens();
List<SignUpToken> function();
/** * Get a list of all unused sign up tokens. * * Roles: Admin * * @return a list of all unused sign up tokens. */
Get a list of all unused sign up tokens. Roles: Admin
getUnusedSignUpTokens
{ "repo_name": "Tasktop/code2cloud.server", "path": "com.tasktop.c2c.server/com.tasktop.c2c.server.profile.api/src/main/java/com/tasktop/c2c/server/profile/service/ProfileWebService.java", "license": "epl-1.0", "size": 6987 }
[ "com.tasktop.c2c.server.profile.domain.project.SignUpToken", "java.util.List" ]
import com.tasktop.c2c.server.profile.domain.project.SignUpToken; import java.util.List;
import com.tasktop.c2c.server.profile.domain.project.*; import java.util.*;
[ "com.tasktop.c2c", "java.util" ]
com.tasktop.c2c; java.util;
2,591,415
Map<String,INDArray> paramTable(boolean backpropOnly);
Map<String,INDArray> paramTable(boolean backpropOnly);
/** * Get the parameter table for the vertex * @param backpropOnly If true: exclude unsupervised training parameters * @return Parameter table */
Get the parameter table for the vertex
paramTable
{ "repo_name": "deeplearning4j/deeplearning4j", "path": "deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/vertex/GraphVertex.java", "license": "apache-2.0", "size": 6838 }
[ "java.util.Map", "org.nd4j.linalg.api.ndarray.INDArray" ]
import java.util.Map; import org.nd4j.linalg.api.ndarray.INDArray;
import java.util.*; import org.nd4j.linalg.api.ndarray.*;
[ "java.util", "org.nd4j.linalg" ]
java.util; org.nd4j.linalg;
1,427,979
public boolean addAll(Collection coll) { return addAll(size(), coll); }
boolean function(Collection coll) { return addAll(size(), coll); }
/** * Adds an element to the end of the list if it is not already present. * <p> * <i>(Violation)</i> * The <code>List</code> interface makes the assumption that the element is * always inserted. This may not happen with this implementation. * * @param coll the collection to add */
Adds an element to the end of the list if it is not already present. (Violation) The <code>List</code> interface makes the assumption that the element is always inserted. This may not happen with this implementation
addAll
{ "repo_name": "leodmurillo/sonar", "path": "plugins/sonar-squid-java-plugin/test-resources/commons-collections-3.2.1/src/org/apache/commons/collections/list/SetUniqueList.java", "license": "lgpl-3.0", "size": 11420 }
[ "java.util.Collection" ]
import java.util.Collection;
import java.util.*;
[ "java.util" ]
java.util;
2,422,105
@Override public void close() throws IOException { this.jarOutput.close(); }
void function() throws IOException { this.jarOutput.close(); }
/** * Close the writer. * @throws IOException if the file cannot be closed */
Close the writer
close
{ "repo_name": "tiarebalbi/spring-boot", "path": "spring-boot-project/spring-boot-tools/spring-boot-loader-tools/src/main/java/org/springframework/boot/loader/tools/JarWriter.java", "license": "apache-2.0", "size": 15106 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,839,707