method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
sequence
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
sequence
libraries_info
stringlengths
6
661
id
int64
0
2.92M
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { return false; }
boolean function(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) { return false; }
/** * Called upon block activation (right click on the block.) */
Called upon block activation (right click on the block.)
onBlockActivated
{ "repo_name": "wildex999/stjerncraft_mcpc", "path": "src/minecraft/net/minecraft/block/BlockPistonBase.java", "license": "gpl-3.0", "size": 21159 }
[ "net.minecraft.entity.player.EntityPlayer", "net.minecraft.world.World" ]
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World;
import net.minecraft.entity.player.*; import net.minecraft.world.*;
[ "net.minecraft.entity", "net.minecraft.world" ]
net.minecraft.entity; net.minecraft.world;
2,145,151
public String uploadFile(File file) throws IOException { PostMethod post = null; try { // prepare the post method post = new PostMethod(getUploadURL()); post.setDoAuthentication(true); post.getParams().setParameter("Connection", "Keep-Alive"); // chunked encoding is not required by the Fedora server, // but makes uploading very large files possible post.setContentChunked(true); // add the file part Part[] parts = {new FilePart("file", file)}; post.setRequestEntity(new MultipartRequestEntity(parts, post .getParams())); // execute and get the response int responseCode = getHttpClient().executeMethod(post); String body = null; try { body = post.getResponseBodyAsString(); } catch (Exception e) { logger.warn("Error reading response body", e); } if (body == null) { body = "[empty response body]"; } body = body.trim(); if (responseCode != HttpStatus.SC_CREATED) { throw new IOException("Upload failed: " + HttpStatus.getStatusText(responseCode) + ": " + replaceNewlines(body, " ")); } else { return replaceNewlines(body, ""); } } finally { if (post != null) { post.releaseConnection(); } } }
String function(File file) throws IOException { PostMethod post = null; try { post = new PostMethod(getUploadURL()); post.setDoAuthentication(true); post.getParams().setParameter(STR, STR); post.setContentChunked(true); Part[] parts = {new FilePart("file", file)}; post.setRequestEntity(new MultipartRequestEntity(parts, post .getParams())); int responseCode = getHttpClient().executeMethod(post); String body = null; try { body = post.getResponseBodyAsString(); } catch (Exception e) { logger.warn(STR, e); } if (body == null) { body = STR; } body = body.trim(); if (responseCode != HttpStatus.SC_CREATED) { throw new IOException(STR + HttpStatus.getStatusText(responseCode) + STR + replaceNewlines(body, " ")); } else { return replaceNewlines(body, ""); } } finally { if (post != null) { post.releaseConnection(); } } }
/** * Upload the given file to Fedora's upload interface via HTTP POST. * * @return the temporary id which can then be passed to API-M requests as a * URL. It will look like uploaded://123 */
Upload the given file to Fedora's upload interface via HTTP POST
uploadFile
{ "repo_name": "fcrepo4-archive/fcrepo", "path": "fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/FedoraClient.java", "license": "apache-2.0", "size": 32110 }
[ "java.io.File", "java.io.IOException", "org.apache.commons.httpclient.HttpStatus", "org.apache.commons.httpclient.methods.PostMethod", "org.apache.commons.httpclient.methods.multipart.FilePart", "org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity", "org.apache.commons.httpclient.methods.multipart.Part" ]
import java.io.File; import java.io.IOException; import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.methods.PostMethod; import org.apache.commons.httpclient.methods.multipart.FilePart; import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; import org.apache.commons.httpclient.methods.multipart.Part;
import java.io.*; import org.apache.commons.httpclient.*; import org.apache.commons.httpclient.methods.*; import org.apache.commons.httpclient.methods.multipart.*;
[ "java.io", "org.apache.commons" ]
java.io; org.apache.commons;
246,432
public static void main(String[] args) { PipelineOptionsFactory.register(Options.class); Options options = PipelineOptionsFactory.fromArgs(args) .withValidation() .as(Options.class); run(options); } @VisibleForTesting public static class CommonLog { String user_id; String ip; float lat; float lng; String timestamp; String http_request; String user_agent; int http_response; int num_bytes; CommonLog(String user_id, String ip, float lat, float lng, String timestamp, String http_request, String user_agent, int http_response, int num_bytes) { this.user_id = user_id; this.ip = ip; this.lat = lat; this.lng = lng; this.timestamp = timestamp; this.http_request = http_request; this.user_agent = user_agent; this.http_response = http_response; this.num_bytes = num_bytes; } }
static void function(String[] args) { PipelineOptionsFactory.register(Options.class); Options options = PipelineOptionsFactory.fromArgs(args) .withValidation() .as(Options.class); run(options); } public static class CommonLog { String user_id; String ip; float lat; float lng; String timestamp; String http_request; String user_agent; int http_response; int num_bytes; CommonLog(String user_id, String ip, float lat, float lng, String timestamp, String http_request, String user_agent, int http_response, int num_bytes) { this.user_id = user_id; this.ip = ip; this.lat = lat; this.lng = lng; this.timestamp = timestamp; this.http_request = http_request; this.user_agent = user_agent; this.http_response = http_response; this.num_bytes = num_bytes; } }
/** * The main entry-point for pipeline execution. This method will start the pipeline but will not * wait for it's execution to finish. If blocking execution is required, use the {@link * SamplePipelineDataflowTemplate#run(Options)} method to start the pipeline and invoke * {@code result.waitUntilFinish()} on the {@link PipelineResult}. * * @param args The command-line args passed by the executor. */
The main entry-point for pipeline execution. This method will start the pipeline but will not wait for it's execution to finish. If blocking execution is required, use the <code>SamplePipelineDataflowTemplate#run(Options)</code> method to start the pipeline and invoke result.waitUntilFinish() on the <code>PipelineResult</code>
main
{ "repo_name": "turbomanage/training-data-analyst", "path": "quests/dataflow/2_Branching_Pipelines/solution/src/main/java/com/mypackage/pipeline/SamplePipelineDataflowTemplate.java", "license": "apache-2.0", "size": 8601 }
[ "org.apache.beam.sdk.options.PipelineOptionsFactory" ]
import org.apache.beam.sdk.options.PipelineOptionsFactory;
import org.apache.beam.sdk.options.*;
[ "org.apache.beam" ]
org.apache.beam;
1,004,893
@Override public void sendResponsePdu(PduResponse pdu) throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException { // assign the next PDU sequence # if its not yet assigned if (!pdu.hasSequenceNumberAssigned()) { pdu.setSequenceNumber(this.sequenceNumber.next()); } if(this.sessionHandler instanceof SmppSessionListener) { if(!((SmppSessionListener)this.sessionHandler).firePduDispatch(pdu)) { logger.info("dispatched response PDU discarded: {}", pdu); return; } } // encode the pdu into a buffer ChannelBuffer buffer = transcoder.encode(pdu); // we need to log the PDU after encoding since some things only happen // during the encoding process such as looking up the result message if (configuration.getLoggingOptions().isLogPduEnabled()) { logger.info("send PDU: {}", pdu); } // write the pdu out & wait timeout amount of time ChannelFuture channelFuture = this.channel.write(buffer).await(); // check if the write was a success if (!channelFuture.isSuccess()) { // the write failed, make sure to throw an exception throw new SmppChannelException(channelFuture.getCause().getMessage(), channelFuture.getCause()); } }
void function(PduResponse pdu) throws RecoverablePduException, UnrecoverablePduException, SmppChannelException, InterruptedException { if (!pdu.hasSequenceNumberAssigned()) { pdu.setSequenceNumber(this.sequenceNumber.next()); } if(this.sessionHandler instanceof SmppSessionListener) { if(!((SmppSessionListener)this.sessionHandler).firePduDispatch(pdu)) { logger.info(STR, pdu); return; } } ChannelBuffer buffer = transcoder.encode(pdu); if (configuration.getLoggingOptions().isLogPduEnabled()) { logger.info(STR, pdu); } ChannelFuture channelFuture = this.channel.write(buffer).await(); if (!channelFuture.isSuccess()) { throw new SmppChannelException(channelFuture.getCause().getMessage(), channelFuture.getCause()); } }
/** * Asynchronously sends a PDU and does not wait for a response PDU. * This method will wait for the PDU to be written to the underlying channel. * @param pdu The PDU to send (can be either a response or request) * @throws RecoverablePduEncodingException * @throws UnrecoverablePduEncodingException * @throws SmppChannelException * @throws InterruptedException */
Asynchronously sends a PDU and does not wait for a response PDU. This method will wait for the PDU to be written to the underlying channel
sendResponsePdu
{ "repo_name": "andreasschmidtjensen/cloudhopper-smpp", "path": "src/main/java/com/cloudhopper/smpp/impl/DefaultSmppSession.java", "license": "apache-2.0", "size": 43511 }
[ "com.cloudhopper.smpp.SmppSessionListener", "com.cloudhopper.smpp.pdu.PduResponse", "com.cloudhopper.smpp.type.RecoverablePduException", "com.cloudhopper.smpp.type.SmppChannelException", "com.cloudhopper.smpp.type.UnrecoverablePduException", "org.jboss.netty.buffer.ChannelBuffer", "org.jboss.netty.channel.ChannelFuture" ]
import com.cloudhopper.smpp.SmppSessionListener; import com.cloudhopper.smpp.pdu.PduResponse; import com.cloudhopper.smpp.type.RecoverablePduException; import com.cloudhopper.smpp.type.SmppChannelException; import com.cloudhopper.smpp.type.UnrecoverablePduException; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.channel.ChannelFuture;
import com.cloudhopper.smpp.*; import com.cloudhopper.smpp.pdu.*; import com.cloudhopper.smpp.type.*; import org.jboss.netty.buffer.*; import org.jboss.netty.channel.*;
[ "com.cloudhopper.smpp", "org.jboss.netty" ]
com.cloudhopper.smpp; org.jboss.netty;
2,025,328
InputStream inputStream();
InputStream inputStream();
/** * Get the input stream associated with this keyval, if any * @return input stream if set, or null */
Get the input stream associated with this keyval, if any
inputStream
{ "repo_name": "ngocbd/jsoup", "path": "src/main/java/org/jsoup/Connection.java", "license": "mit", "size": 24127 }
[ "java.io.InputStream" ]
import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
513,834
protected BigInteger ruleNumberToDisplay(String latticeDescription) { // fixes the rule number at RULE_NUMBER return new BigInteger("" + WOLFRAM_RULE_NUMBER); }
BigInteger function(String latticeDescription) { return new BigInteger("" + WOLFRAM_RULE_NUMBER); }
/** * Tells the graphics what value should be displayed for the "Rule number" * text field. By default, the number is whatever value was previously * displayed. * * @param latticeDescription * The display name of the lattice. * * @return The rule number that will be displayed. */
Tells the graphics what value should be displayed for the "Rule number" text field. By default, the number is whatever value was previously displayed
ruleNumberToDisplay
{ "repo_name": "KEOpenSource/CAExplorer", "path": "cellularAutomata/rules/Rule110.java", "license": "apache-2.0", "size": 8579 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
1,663,882
public Object removeProperty(String name) throws GVScriptException { isInitialized(); return bindings.remove(name); }
Object function(String name) throws GVScriptException { isInitialized(); return bindings.remove(name); }
/** * Remove the named property from the script Bindings. * * @param name * the property name * @return the previous property value, or null if not present * @throws GVScriptException */
Remove the named property from the script Bindings
removeProperty
{ "repo_name": "green-vulcano/gv-engine", "path": "gvengine/gvbase/src/main/java/it/greenvulcano/script/impl/ScriptExecutorImpl.java", "license": "lgpl-3.0", "size": 14848 }
[ "it.greenvulcano.script.GVScriptException" ]
import it.greenvulcano.script.GVScriptException;
import it.greenvulcano.script.*;
[ "it.greenvulcano.script" ]
it.greenvulcano.script;
1,434,264
public static Element findChildElementWithAttribute(Element elem, String attrName, String attrValue) { for (Node n = elem.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { if (attrValue.equals(DOMUtils.getAttribute((Element) n, attrName))) { return (Element) n; } } } return null; }
static Element function(Element elem, String attrName, String attrValue) { for (Node n = elem.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() == Node.ELEMENT_NODE) { if (attrValue.equals(DOMUtils.getAttribute((Element) n, attrName))) { return (Element) n; } } } return null; }
/** * Return the first child element of the given element which has the given * attribute with the given value. * * @param elem the element whose children are to be searched * @param attrName the attrib that must be present * @param attrValue the desired value of the attribute * * @return the first matching child element. */
Return the first child element of the given element which has the given attribute with the given value
findChildElementWithAttribute
{ "repo_name": "Subasinghe/ode", "path": "utils/src/main/java/org/apache/ode/utils/DOMUtils.java", "license": "apache-2.0", "size": 49085 }
[ "org.w3c.dom.Element", "org.w3c.dom.Node" ]
import org.w3c.dom.Element; import org.w3c.dom.Node;
import org.w3c.dom.*;
[ "org.w3c.dom" ]
org.w3c.dom;
2,097,458
@Override public Enumeration<Option> listOptions() { Vector<Option> newVector = new Vector<Option>(); newVector.add(new Option("\tThe JDBC URL to connect to.\n" + "\t(default: from DatabaseUtils.props file)", "url", 1, "-url <JDBC URL>")); newVector.add(new Option("\tThe user to connect with to the database.\n" + "\t(default: none)", "user", 1, "-user <name>")); newVector .add(new Option("\tThe password to connect with to the database.\n" + "\t(default: none)", "password", 1, "-password <password>")); newVector.add(new Option("\tSQL query of the form\n" + "\t\tSELECT <list of columns>|* FROM <table> [WHERE]\n" + "\tto execute.\n" + "\t(default: Select * From Results0)", "Q", 1, "-Q <query>")); newVector.add(new Option( "\tList of column names uniquely defining a DB row\n" + "\t(separated by ', ').\n" + "\tUsed for incremental loading.\n" + "\tIf not specified, the key will be determined automatically,\n" + "\tif possible with the used JDBC driver.\n" + "\tThe auto ID column created by the DatabaseSaver won't be loaded.", "P", 1, "-P <list of column names>")); newVector.add(new Option("\tSets incremental loading", "I", 0, "-I")); newVector.addElement(new Option( "\tReturn sparse rather than normal instances.", "S", 0, "-S")); newVector.add(new Option( "\tThe custom properties file to use instead of default ones,\n" + "\tcontaining the database parameters.\n" + "\t(default: none)", "custom-props", 1, "-custom-props <file>")); return newVector.elements(); }
Enumeration<Option> function() { Vector<Option> newVector = new Vector<Option>(); newVector.add(new Option(STR + STR, "url", 1, STR)); newVector.add(new Option(STR + STR, "user", 1, STR)); newVector .add(new Option(STR + STR, STR, 1, STR)); newVector.add(new Option(STR + STR + STR + STR, "Q", 1, STR)); newVector.add(new Option( STR + STR + STR + STR + STR + STR, "P", 1, STR)); newVector.add(new Option(STR, "I", 0, "-I")); newVector.addElement(new Option( STR, "S", 0, "-S")); newVector.add(new Option( STR + STR + STR, STR, 1, STR)); return newVector.elements(); }
/** * Lists the available options * * @return an enumeration of the available options */
Lists the available options
listOptions
{ "repo_name": "Scauser/j2ee", "path": "Weka_Parallel_Test/weka/weka/core/converters/DatabaseLoader.java", "license": "apache-2.0", "size": 52270 }
[ "java.util.Enumeration", "java.util.Vector" ]
import java.util.Enumeration; import java.util.Vector;
import java.util.*;
[ "java.util" ]
java.util;
646,189
public Vector3f getNormal(Vector2f xz);
Vector3f function(Vector2f xz);
/** * Get the normal vector for the surface of the terrain at the specified * X-Z coordinate. This normal vector can be a close approximation. It does not * take into account any normal maps on the material. * @param xz the X-Z world coordinate * @return the normal vector at the given point */
Get the normal vector for the surface of the terrain at the specified X-Z coordinate. This normal vector can be a close approximation. It does not take into account any normal maps on the material
getNormal
{ "repo_name": "atomixnmc/jmonkeyengine", "path": "jme3-terrain/src/main/java/com/jme3/terrain/Terrain.java", "license": "bsd-3-clause", "size": 8365 }
[ "com.jme3.math.Vector2f", "com.jme3.math.Vector3f" ]
import com.jme3.math.Vector2f; import com.jme3.math.Vector3f;
import com.jme3.math.*;
[ "com.jme3.math" ]
com.jme3.math;
272,010
public void removeItemDeleteListener(ItemDeleteListener listener) { PacketListener conListener = itemDeleteToListenerMap .remove(listener); if (conListener != null) con.removePacketListener(conListener); }
void function(ItemDeleteListener listener) { PacketListener conListener = itemDeleteToListenerMap .remove(listener); if (conListener != null) con.removePacketListener(conListener); }
/** * Unregister a listener for item delete events. * * @param listener The handler to unregister */
Unregister a listener for item delete events
removeItemDeleteListener
{ "repo_name": "AndrewGeorge/androidpn-client", "path": "asmark/org/jivesoftware/smackx/pubsub/Node.java", "license": "apache-2.0", "size": 17117 }
[ "org.jivesoftware.smack.PacketListener", "org.jivesoftware.smackx.pubsub.listener.ItemDeleteListener" ]
import org.jivesoftware.smack.PacketListener; import org.jivesoftware.smackx.pubsub.listener.ItemDeleteListener;
import org.jivesoftware.smack.*; import org.jivesoftware.smackx.pubsub.listener.*;
[ "org.jivesoftware.smack", "org.jivesoftware.smackx" ]
org.jivesoftware.smack; org.jivesoftware.smackx;
1,373,705
public Vec3 getPositionVector() { return new Vec3(this.posX, this.posY, this.posZ); }
Vec3 function() { return new Vec3(this.posX, this.posY, this.posZ); }
/** * Get the position vector. <b>{@code null} is not allowed!</b> If you are not an entity in the world, return 0.0D, * 0.0D, 0.0D */
Get the position vector. null is not allowed! If you are not an entity in the world, return 0.0D, 0.0D, 0.0D
getPositionVector
{ "repo_name": "TorchPowered/Thallium", "path": "src/main/java/net/minecraft/entity/Entity.java", "license": "mit", "size": 81824 }
[ "net.minecraft.util.Vec3" ]
import net.minecraft.util.Vec3;
import net.minecraft.util.*;
[ "net.minecraft.util" ]
net.minecraft.util;
2,687,920
public void intoMap(Map<? super K, ? super V> map) { map.put(key, value); }
void function(Map<? super K, ? super V> map) { map.put(key, value); }
/** * Puts the pair into specified map. * * @param map target map. * * @since v1.1.0 */
Puts the pair into specified map
intoMap
{ "repo_name": "soulwarelabs/jCommons-API", "path": "src/main/java/com/soulwarelabs/jcommons/Pair.java", "license": "apache-2.0", "size": 3861 }
[ "java.util.Map" ]
import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,407,551
public static Address[] unpack(String addressList) { if (addressList == null) { return new Address[] { }; } ArrayList<Address> addresses = new ArrayList<Address>(); int length = addressList.length(); int pairStartIndex = 0; int pairEndIndex = 0; int addressEndIndex = 0; while (pairStartIndex < length) { pairEndIndex = addressList.indexOf(",\u0000", pairStartIndex); if (pairEndIndex == -1) { pairEndIndex = length; } addressEndIndex = addressList.indexOf(";\u0000", pairStartIndex); String address = null; String personal = null; if (addressEndIndex == -1 || addressEndIndex > pairEndIndex) { address = addressList.substring(pairStartIndex, pairEndIndex); } else { address = addressList.substring(pairStartIndex, addressEndIndex); personal = addressList.substring(addressEndIndex + 2, pairEndIndex); } addresses.add(new Address(address, personal, false)); pairStartIndex = pairEndIndex + 2; } return addresses.toArray(new Address[addresses.size()]); }
static Address[] function(String addressList) { if (addressList == null) { return new Address[] { }; } ArrayList<Address> addresses = new ArrayList<Address>(); int length = addressList.length(); int pairStartIndex = 0; int pairEndIndex = 0; int addressEndIndex = 0; while (pairStartIndex < length) { pairEndIndex = addressList.indexOf(STR, pairStartIndex); if (pairEndIndex == -1) { pairEndIndex = length; } addressEndIndex = addressList.indexOf(STR, pairStartIndex); String address = null; String personal = null; if (addressEndIndex == -1 addressEndIndex > pairEndIndex) { address = addressList.substring(pairStartIndex, pairEndIndex); } else { address = addressList.substring(pairStartIndex, addressEndIndex); personal = addressList.substring(addressEndIndex + 2, pairEndIndex); } addresses.add(new Address(address, personal, false)); pairStartIndex = pairEndIndex + 2; } return addresses.toArray(new Address[addresses.size()]); }
/** * Unpacks an address list previously packed with packAddressList() * @param addressList Packed address list. * @return Unpacked list. */
Unpacks an address list previously packed with packAddressList()
unpack
{ "repo_name": "AvatarBlueray/k9-mail-5.002-spam-filter-edition", "path": "src/com/fsck/k9/mail/Address.java", "license": "bsd-3-clause", "size": 12335 }
[ "java.util.ArrayList" ]
import java.util.ArrayList;
import java.util.*;
[ "java.util" ]
java.util;
610,025
List<String> getArgs(int executionNumber);
List<String> getArgs(int executionNumber);
/** * The list of arguments to be passed to the program, for the specified execution number. * * @param executionNumber execution number for which arguments are requested. * @return the list of arguments to be passed to the program, for the specified execution number. */
The list of arguments to be passed to the program, for the specified execution number
getArgs
{ "repo_name": "powsybl/powsybl-core", "path": "computation/src/main/java/com/powsybl/computation/SimpleCommand.java", "license": "mpl-2.0", "size": 1695 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,822,580
public static List<String> convertCOSStringCOSArrayToList( COSArray stringArray ) { List<String> retval = null; if( stringArray != null ) { List<String> string = new ArrayList<String>(); for( int i=0; i<stringArray.size(); i++ ) { string.add( ((COSString)stringArray.getObject( i )).getString() ); } retval = new COSArrayList<String>( string, stringArray ); } return retval; }
static List<String> function( COSArray stringArray ) { List<String> retval = null; if( stringArray != null ) { List<String> string = new ArrayList<String>(); for( int i=0; i<stringArray.size(); i++ ) { string.add( ((COSString)stringArray.getObject( i )).getString() ); } retval = new COSArrayList<String>( string, stringArray ); } return retval; }
/** * This will take an array of COSString and return a COSArrayList of * java.lang.String values. * * @param stringArray The existing name Array. * * @return The list of String objects. */
This will take an array of COSString and return a COSArrayList of java.lang.String values
convertCOSStringCOSArrayToList
{ "repo_name": "ZhenyaM/veraPDF-pdfbox", "path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/common/COSArrayList.java", "license": "apache-2.0", "size": 17654 }
[ "java.util.ArrayList", "java.util.List", "org.apache.pdfbox.cos.COSArray", "org.apache.pdfbox.cos.COSString" ]
import java.util.ArrayList; import java.util.List; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSString;
import java.util.*; import org.apache.pdfbox.cos.*;
[ "java.util", "org.apache.pdfbox" ]
java.util; org.apache.pdfbox;
2,635,030
public VaadinRequest getRequest() { return request; }
VaadinRequest function() { return request; }
/** * Getter for request * * @return VaadinRequest the current Vaadin request */
Getter for request
getRequest
{ "repo_name": "paulswithers/Key-Dates", "path": "osgiworlds/src/uk/co/intec/keyDatesApp/MainUI.java", "license": "apache-2.0", "size": 6516 }
[ "com.vaadin.server.VaadinRequest" ]
import com.vaadin.server.VaadinRequest;
import com.vaadin.server.*;
[ "com.vaadin.server" ]
com.vaadin.server;
157,627
public void setElementsOrder(Comparator<T> elementsOrder) { this.scrollableListComponent.setElementsOrder(elementsOrder); }
void function(Comparator<T> elementsOrder) { this.scrollableListComponent.setElementsOrder(elementsOrder); }
/** * Sets a new way to sort the list. * * @param elementsOrder The elementsOrder to set. */
Sets a new way to sort the list
setElementsOrder
{ "repo_name": "sacooper/ECSE-429-Project-Group1", "path": "ca.mcgill.sel.ram.gui/src/ca/mcgill/sel/ram/ui/components/RamSelectorComponent.java", "license": "gpl-2.0", "size": 16425 }
[ "java.util.Comparator" ]
import java.util.Comparator;
import java.util.*;
[ "java.util" ]
java.util;
1,493,869
// ************************** // PROTECTED IMPLEMENTATION * // ************************** protected ThreadPoolExecutor createThreadPool() { BlockingQueue<Runnable> queue = createWorkQueue(); ThreadFactory factory = createThreadFactory(); RejectedExecutionHandler handler = createRejectedHandler(); ThreadPoolExecutor tpe = new TurboThreadPool(corePoolSize, maxPoolSize, keepAlive, TimeUnit.SECONDS, queue, factory, handler); tpe.prestartCoreThread(); return tpe; }
ThreadPoolExecutor function() { BlockingQueue<Runnable> queue = createWorkQueue(); ThreadFactory factory = createThreadFactory(); RejectedExecutionHandler handler = createRejectedHandler(); ThreadPoolExecutor tpe = new TurboThreadPool(corePoolSize, maxPoolSize, keepAlive, TimeUnit.SECONDS, queue, factory, handler); tpe.prestartCoreThread(); return tpe; }
/** * Allow subclasses to create a different type of thread pool. * * @return */
Allow subclasses to create a different type of thread pool
createThreadPool
{ "repo_name": "marcusbb/bag-o-util", "path": "src/main/java/provision/util/turbo/DefaultTurboServer.java", "license": "apache-2.0", "size": 7205 }
[ "java.util.concurrent.BlockingQueue", "java.util.concurrent.RejectedExecutionHandler", "java.util.concurrent.ThreadFactory", "java.util.concurrent.ThreadPoolExecutor", "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.BlockingQueue; import java.util.concurrent.RejectedExecutionHandler; import java.util.concurrent.ThreadFactory; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,950,332
private List<Pattern> loadExceptionList(){ List<String> lines = Helper.getLinesOfPage("CurrikiCode/LoginToViewExceptions", context); for (int i = 0; i < lines.size(); i++) { String line = ".*" + lines.get(i) + ".*"; lines.set(i,line); } return Helper.compileStringsToPatterns(lines); }
List<Pattern> function(){ List<String> lines = Helper.getLinesOfPage(STR, context); for (int i = 0; i < lines.size(); i++) { String line = ".*" + lines.get(i) + ".*"; lines.set(i,line); } return Helper.compileStringsToPatterns(lines); }
/** * Create the list for the exceptions. Read from an xwiki page. * @return the exception patterns */
Create the list for the exceptions. Read from an xwiki page
loadExceptionList
{ "repo_name": "xwiki-contrib/currikiorg", "path": "plugins/currikianalytics/src/main/java/org/curriki/plugin/analytics/module/logintoview/LoginToViewAnalyticsModule.java", "license": "lgpl-2.1", "size": 6718 }
[ "java.util.List", "java.util.regex.Pattern", "org.curriki.plugin.analytics.Helper" ]
import java.util.List; import java.util.regex.Pattern; import org.curriki.plugin.analytics.Helper;
import java.util.*; import java.util.regex.*; import org.curriki.plugin.analytics.*;
[ "java.util", "org.curriki.plugin" ]
java.util; org.curriki.plugin;
2,308,786
private void _init() { this.layoutDialog(); if (BinaryLogic.containsAll(this.flagMask, Dialog.LOGIC_COUNTDOWN)) { this.timerLbl.addMouseListener(new MouseAdapter() {
void function() { this.layoutDialog(); if (BinaryLogic.containsAll(this.flagMask, Dialog.LOGIC_COUNTDOWN)) { this.timerLbl.addMouseListener(new MouseAdapter() {
/** * this function will init and show the dialog */
this function will init and show the dialog
_init
{ "repo_name": "Horstman/AppWorkUtils", "path": "src/org/appwork/utils/swing/dialog/AbstractDialog.java", "license": "artistic-2.0", "size": 21044 }
[ "java.awt.event.MouseAdapter", "org.appwork.utils.BinaryLogic" ]
import java.awt.event.MouseAdapter; import org.appwork.utils.BinaryLogic;
import java.awt.event.*; import org.appwork.utils.*;
[ "java.awt", "org.appwork.utils" ]
java.awt; org.appwork.utils;
702,562
void setClusterName(final PlotCluster cluster, final String name);
void setClusterName(final PlotCluster cluster, final String name);
/** * Rename a cluster */
Rename a cluster
setClusterName
{ "repo_name": "SilverCory/PlotSquared", "path": "Core/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java", "license": "gpl-3.0", "size": 10403 }
[ "com.intellectualcrafters.plot.object.PlotCluster" ]
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.*;
[ "com.intellectualcrafters.plot" ]
com.intellectualcrafters.plot;
1,313,429
public File getBase() { return base; }
File function() { return base; }
/** * Returns the base directory for relative paths, the directory that was * passed to the constructor. */
Returns the base directory for relative paths, the directory that was passed to the constructor
getBase
{ "repo_name": "tools4j/unix4j", "path": "unix4j-core/unix4j-base/src/main/java/org/unix4j/util/RelativePathBase.java", "license": "mit", "size": 12247 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,034,653
public void setTransactionDate(Date transactionDate) { this.transactionDate = transactionDate; }
void function(Date transactionDate) { this.transactionDate = transactionDate; }
/** * Sets the value of the field <code>transactionDate</code>. * * @param transactionDate the transactionDate to set */
Sets the value of the field <code>transactionDate</code>
setTransactionDate
{ "repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application", "path": "Code/SCRD_BRE/src/java/ejb/gov/opm/scrd/services/impl/reporting/SuspenseResolutionReportResponseItem.java", "license": "apache-2.0", "size": 5291 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
1,245,599
return OpenWireMessage.DATA_STRUCTURE_TYPE; }
return OpenWireMessage.DATA_STRUCTURE_TYPE; }
/** * Return the type of Data Structure we marshal * * @return short representation of the type data structure */
Return the type of Data Structure we marshal
getDataStructureType
{ "repo_name": "tabish121/OpenWire", "path": "openwire-legacy/src/main/java/io/openwire/codec/v6/OpenWireMessageMarshaller.java", "license": "apache-2.0", "size": 3456 }
[ "io.openwire.commands.OpenWireMessage" ]
import io.openwire.commands.OpenWireMessage;
import io.openwire.commands.*;
[ "io.openwire.commands" ]
io.openwire.commands;
2,354,956
public static void ifReindex (final VoidDelegate delegate) throws DotSecurityException, DotDataException { if (isReindex()) { delegate.execute(); } }
static void function (final VoidDelegate delegate) throws DotSecurityException, DotDataException { if (isReindex()) { delegate.execute(); } }
/** * Executes the delegate if the reindex is set to true for the current thread * @param delegate * @throws DotSecurityException * @throws DotDataException */
Executes the delegate if the reindex is set to true for the current thread
ifReindex
{ "repo_name": "dotCMS/core", "path": "dotCMS/src/main/java/com/dotcms/util/ThreadContextUtil.java", "license": "gpl-3.0", "size": 3218 }
[ "com.dotmarketing.exception.DotDataException", "com.dotmarketing.exception.DotSecurityException" ]
import com.dotmarketing.exception.DotDataException; import com.dotmarketing.exception.DotSecurityException;
import com.dotmarketing.exception.*;
[ "com.dotmarketing.exception" ]
com.dotmarketing.exception;
1,117,638
protected void addDistribution_voltage_BPropertyDescriptor(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString("_UI_Substation_distribution_voltage_B_feature"), getString("_UI_PropertyDescriptor_description", "_UI_Substation_distribution_voltage_B_feature", "_UI_Substation_type"), VisGridPackage.eINSTANCE.getSubstation_Distribution_voltage_B(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), VisGridPackage.eINSTANCE.getSubstation_Distribution_voltage_B(), true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
/** * This adds a property descriptor for the Distribution voltage B feature. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
This adds a property descriptor for the Distribution voltage B feature.
addDistribution_voltage_BPropertyDescriptor
{ "repo_name": "mikesligo/visGrid", "path": "ie.tcd.gmf.visGrid.edit/src/visGrid/provider/SubstationItemProvider.java", "license": "gpl-3.0", "size": 29813 }
[ "org.eclipse.emf.edit.provider.ComposeableAdapterFactory", "org.eclipse.emf.edit.provider.ItemPropertyDescriptor" ]
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
2,354,128
public void writeVector(ArrayList vector) throws IOException { writeVectorHeader(vector.size()); for (Object obj : vector) { write(obj); } }
void function(ArrayList vector) throws IOException { writeVectorHeader(vector.size()); for (Object obj : vector) { write(obj); } }
/** * Writes a vector as a typed bytes sequence. * * @param vector the vector to be written * @throws IOException */
Writes a vector as a typed bytes sequence
writeVector
{ "repo_name": "tseen/Federated-HDFS", "path": "tseenliu/FedHDFS-hadoop-src/hadoop-tools/hadoop-streaming/src/main/java/org/apache/hadoop/typedbytes/TypedBytesOutput.java", "license": "apache-2.0", "size": 8485 }
[ "java.io.IOException", "java.util.ArrayList" ]
import java.io.IOException; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
1,195,207
public void setSourceBounds(Rect r) { if (r != null) { mSourceBounds = new Rect(r); } else { mSourceBounds = null; } } @IntDef(flag = true, value = { FILL_IN_ACTION, FILL_IN_DATA, FILL_IN_CATEGORIES, FILL_IN_COMPONENT, FILL_IN_PACKAGE, FILL_IN_SOURCE_BOUNDS, FILL_IN_SELECTOR, FILL_IN_CLIP_DATA }) @Retention(RetentionPolicy.SOURCE) public @interface FillInFlags {} public static final int FILL_IN_ACTION = 1<<0; public static final int FILL_IN_DATA = 1<<1; public static final int FILL_IN_CATEGORIES = 1<<2; public static final int FILL_IN_COMPONENT = 1<<3; public static final int FILL_IN_PACKAGE = 1<<4; public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; public static final int FILL_IN_SELECTOR = 1<<6; public static final int FILL_IN_CLIP_DATA = 1<<7; /** * Copy the contents of <var>other</var> in to this object, but only * where fields are not defined by this object. For purposes of a field * being defined, the following pieces of data in the Intent are * considered to be separate fields: * * <ul> * <li> action, as set by {@link #setAction}. * <li> data Uri and MIME type, as set by {@link #setData(Uri)}, * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. * <li> categories, as set by {@link #addCategory}. * <li> package, as set by {@link #setPackage}. * <li> component, as set by {@link #setComponent(ComponentName)} or * related methods. * <li> source bounds, as set by {@link #setSourceBounds}. * <li> selector, as set by {@link #setSelector(Intent)}. * <li> clip data, as set by {@link #setClipData(ClipData)}. * <li> each top-level name in the associated extras. * </ul> * * <p>In addition, you can use the {@link #FILL_IN_ACTION}, * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override * the restriction where the corresponding field will not be replaced if * it is already set. * * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} * is explicitly specified. The selector will only be copied if * {@link #FILL_IN_SELECTOR} is explicitly specified. * * <p>For example, consider Intent A with {data="foo", categories="bar"}
void function(Rect r) { if (r != null) { mSourceBounds = new Rect(r); } else { mSourceBounds = null; } } @IntDef(flag = true, value = { FILL_IN_ACTION, FILL_IN_DATA, FILL_IN_CATEGORIES, FILL_IN_COMPONENT, FILL_IN_PACKAGE, FILL_IN_SOURCE_BOUNDS, FILL_IN_SELECTOR, FILL_IN_CLIP_DATA }) @Retention(RetentionPolicy.SOURCE) public @interface FillInFlags {} public static final int FILL_IN_ACTION = 1<<0; public static final int FILL_IN_DATA = 1<<1; public static final int FILL_IN_CATEGORIES = 1<<2; public static final int FILL_IN_COMPONENT = 1<<3; public static final int FILL_IN_PACKAGE = 1<<4; public static final int FILL_IN_SOURCE_BOUNDS = 1<<5; public static final int FILL_IN_SELECTOR = 1<<6; public static final int FILL_IN_CLIP_DATA = 1<<7; /** * Copy the contents of <var>other</var> in to this object, but only * where fields are not defined by this object. For purposes of a field * being defined, the following pieces of data in the Intent are * considered to be separate fields: * * <ul> * <li> action, as set by {@link #setAction}. * <li> data Uri and MIME type, as set by {@link #setData(Uri)}, * {@link #setType(String)}, or {@link #setDataAndType(Uri, String)}. * <li> categories, as set by {@link #addCategory}. * <li> package, as set by {@link #setPackage}. * <li> component, as set by {@link #setComponent(ComponentName)} or * related methods. * <li> source bounds, as set by {@link #setSourceBounds}. * <li> selector, as set by {@link #setSelector(Intent)}. * <li> clip data, as set by {@link #setClipData(ClipData)}. * <li> each top-level name in the associated extras. * </ul> * * <p>In addition, you can use the {@link #FILL_IN_ACTION}, * {@link #FILL_IN_DATA}, {@link #FILL_IN_CATEGORIES}, {@link #FILL_IN_PACKAGE}, * {@link #FILL_IN_COMPONENT}, {@link #FILL_IN_SOURCE_BOUNDS}, * {@link #FILL_IN_SELECTOR}, and {@link #FILL_IN_CLIP_DATA} to override * the restriction where the corresponding field will not be replaced if * it is already set. * * <p>Note: The component field will only be copied if {@link #FILL_IN_COMPONENT} * is explicitly specified. The selector will only be copied if * {@link #FILL_IN_SELECTOR} is explicitly specified. * * <p>For example, consider Intent A with {data="foo", categories="bar"}
/** * Set the bounds of the sender of this intent, in screen coordinates. This can be * used as a hint to the receiver for animations and the like. Null means that there * is no source bounds. */
Set the bounds of the sender of this intent, in screen coordinates. This can be used as a hint to the receiver for animations and the like. Null means that there is no source bounds
setSourceBounds
{ "repo_name": "syslover33/ctank", "path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/content/Intent.java", "license": "gpl-3.0", "size": 343964 }
[ "android.annotation.IntDef", "android.graphics.Rect", "android.net.Uri", "java.lang.annotation.Retention", "java.lang.annotation.RetentionPolicy" ]
import android.annotation.IntDef; import android.graphics.Rect; import android.net.Uri; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy;
import android.annotation.*; import android.graphics.*; import android.net.*; import java.lang.annotation.*;
[ "android.annotation", "android.graphics", "android.net", "java.lang" ]
android.annotation; android.graphics; android.net; java.lang;
2,598,449
public static void forceLogin(Player player) { management.forceLogin(player); }
static void function(Player player) { management.forceLogin(player); }
/** * Force a player to log in. * * @param player The player to log in */
Force a player to log in
forceLogin
{ "repo_name": "DmitryRendov/AuthMeReloaded", "path": "src/main/java/fr/xephi/authme/api/API.java", "license": "gpl-3.0", "size": 5173 }
[ "org.bukkit.entity.Player" ]
import org.bukkit.entity.Player;
import org.bukkit.entity.*;
[ "org.bukkit.entity" ]
org.bukkit.entity;
693,813
public DomainSocket accept() throws IOException { refCount.reference(); boolean exc = true; try { DomainSocket ret = new DomainSocket(path, accept0(fd)); exc = false; return ret; } finally { unreference(exc); } }
DomainSocket function() throws IOException { refCount.reference(); boolean exc = true; try { DomainSocket ret = new DomainSocket(path, accept0(fd)); exc = false; return ret; } finally { unreference(exc); } }
/** * Accept a new UNIX domain connection. * * This method can only be used on sockets that were bound with bind(). * * @return The new connection. * @throws IOException If there was an I/O error performing the accept-- * such as the socket being closed from under us. * Particularly when the accept is timed out, it throws * SocketTimeoutException. */
Accept a new UNIX domain connection. This method can only be used on sockets that were bound with bind()
accept
{ "repo_name": "nandakumar131/hadoop", "path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/net/unix/DomainSocket.java", "license": "apache-2.0", "size": 18521 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
683,775
@Override public void restoreDividers(Split split) { // Unused var boolean nextDividerVisible = false; ListIterator<Node<?>> splitChildren = split.getChildren().listIterator(); while (splitChildren.hasNext()) { Node<?> splitChild = splitChildren.next(); if (splitChild instanceof Divider) { Node<?> prev = splitChild.previousSibling(); if (prev.isVisible()) { Node<?> next = splitChild.nextSibling(); while (next != null) { if (next.isVisible()) { splitChild.setVisible(true); break; } next = next.nextSibling(); } } } } if (split.getParent() != null) { restoreDividers(split.getParent()); } }
void function(Split split) { ListIterator<Node<?>> splitChildren = split.getChildren().listIterator(); while (splitChildren.hasNext()) { Node<?> splitChild = splitChildren.next(); if (splitChild instanceof Divider) { Node<?> prev = splitChild.previousSibling(); if (prev.isVisible()) { Node<?> next = splitChild.nextSibling(); while (next != null) { if (next.isVisible()) { splitChild.setVisible(true); break; } next = next.nextSibling(); } } } } if (split.getParent() != null) { restoreDividers(split.getParent()); } }
/** * Restore any of the hidden dividers that are required to separate visible nodes * * @param split * the node to check */
Restore any of the hidden dividers that are required to separate visible nodes
restoreDividers
{ "repo_name": "openflexo-team/gina", "path": "flexographicutils/src/main/java/org/openflexo/swing/layout/MultiSplitLayout.java", "license": "gpl-3.0", "size": 80916 }
[ "java.util.ListIterator" ]
import java.util.ListIterator;
import java.util.*;
[ "java.util" ]
java.util;
2,453,008
public static String charToHexEncode( ValueMetaInterface meta, Object data ) throws KettleValueException { final char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; if ( meta.isNull( data ) ) { return null; } String hex = meta.getString( data ); char[] s = hex.toCharArray(); StringBuffer hexString = new StringBuffer( 2 * s.length ); for ( int i = 0; i < s.length; i++ ) { hexString.append( hexDigits[( s[i] & 0xF000 ) >> 12] ); // hex 1 hexString.append( hexDigits[( s[i] & 0x0F00 ) >> 8] ); // hex 2 hexString.append( hexDigits[( s[i] & 0x00F0 ) >> 4] ); // hex 3 hexString.append( hexDigits[s[i] & 0x000F] ); // hex 4 } return hexString.toString(); }
static String function( ValueMetaInterface meta, Object data ) throws KettleValueException { final char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; if ( meta.isNull( data ) ) { return null; } String hex = meta.getString( data ); char[] s = hex.toCharArray(); StringBuffer hexString = new StringBuffer( 2 * s.length ); for ( int i = 0; i < s.length; i++ ) { hexString.append( hexDigits[( s[i] & 0xF000 ) >> 12] ); hexString.append( hexDigits[( s[i] & 0x0F00 ) >> 8] ); hexString.append( hexDigits[( s[i] & 0x00F0 ) >> 4] ); hexString.append( hexDigits[s[i] & 0x000F] ); } return hexString.toString(); }
/** * Change a string into its hexadecimal representation. E.g. if Value contains string "a" afterwards it would contain * value "0061". * * Note that transformations happen in groups of 4 hex characters, so the value of a characters is always in the range * 0-65535. * * @return A string with Hex code * @throws KettleValueException * In case of a data conversion problem. */
Change a string into its hexadecimal representation. E.g. if Value contains string "a" afterwards it would contain value "0061". Note that transformations happen in groups of 4 hex characters, so the value of a characters is always in the range 0-65535
charToHexEncode
{ "repo_name": "IvanNikolaychuk/pentaho-kettle", "path": "core/src/org/pentaho/di/core/row/ValueDataUtil.java", "license": "apache-2.0", "size": 61850 }
[ "org.pentaho.di.core.exception.KettleValueException" ]
import org.pentaho.di.core.exception.KettleValueException;
import org.pentaho.di.core.exception.*;
[ "org.pentaho.di" ]
org.pentaho.di;
716,954
protected List<LogSegmentMetadata> getCachedLogSegments(Comparator<LogSegmentMetadata> comparator) throws UnexpectedException { try { return logSegmentCache.getLogSegments(comparator); } catch (UnexpectedException ue) { // the log segments cache went wrong LOG.error("Unexpected exception on getting log segments from the cache for stream {}", getFullyQualifiedName(), ue); metadataException.compareAndSet(null, ue); throw ue; } }
List<LogSegmentMetadata> function(Comparator<LogSegmentMetadata> comparator) throws UnexpectedException { try { return logSegmentCache.getLogSegments(comparator); } catch (UnexpectedException ue) { LOG.error(STR, getFullyQualifiedName(), ue); metadataException.compareAndSet(null, ue); throw ue; } }
/** * Get the cached log segments. * * @param comparator the comparator to sort the returned log segments. * @return list of sorted log segments * @throws UnexpectedException if unexpected condition detected. */
Get the cached log segments
getCachedLogSegments
{ "repo_name": "sijie/incubator-distributedlog", "path": "distributedlog-core/src/main/java/org/apache/distributedlog/BKLogHandler.java", "license": "apache-2.0", "size": 33217 }
[ "java.util.Comparator", "java.util.List", "org.apache.distributedlog.exceptions.UnexpectedException" ]
import java.util.Comparator; import java.util.List; import org.apache.distributedlog.exceptions.UnexpectedException;
import java.util.*; import org.apache.distributedlog.exceptions.*;
[ "java.util", "org.apache.distributedlog" ]
java.util; org.apache.distributedlog;
2,312,374
public void init(Object name, Object defaultNode, Object type, Object autoIncrementInfo) throws StandardException { super.init(name); this.type = (DataTypeDescriptor)type; if (defaultNode instanceof UntypedNullConstantNode) { // TODO: Can make properly typed null using this.type now. } else if (defaultNode instanceof GenerationClauseNode) { generationClauseNode = (GenerationClauseNode)defaultNode; } else { assert (defaultNode == null || (defaultNode instanceof DefaultNode)); this.defaultNode = (DefaultNode)defaultNode; if (autoIncrementInfo != null) { long[] aii = (long[])autoIncrementInfo; autoincrementStart = aii[QueryTreeNode.AUTOINCREMENT_START_INDEX]; autoincrementIncrement = aii[QueryTreeNode.AUTOINCREMENT_INC_INDEX]; //Parser has passed the info about autoincrement column's status in the //following array element. It will tell if the autoinc column is part of //a create table or if is a part of alter table. And if it is part of //alter table, is it for changing the increment value or for changing //the start value? autoinc_create_or_modify_Start_Increment = aii[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY]; autoincrementVerify = (aii[QueryTreeNode.AUTOINCREMENT_IS_AUTOINCREMENT_INDEX] > 0) ? false : true; isAutoincrement = true; // an autoincrement column cannot be null-- setting // non-nullability for this column is needed because // you could create a column with ai default, add data, drop // the default, and try to add it back again you'll get an // error because the column is marked nullable. if (type != null) setNullability(false); } } // ColumnDefinitionNode instances can be subclassed by // ModifyColumnNode for use in ALTER TABLE .. ALTER COLUMN // statements, in which case the node represents the intended // changes to the column definition. For such a case, we // record whether or not the statement specified that the // column's default value should be changed. If we are to // keep the current default, ModifyColumnNode will re-read // the current default from the system catalogs prior to // performing the column alteration. See DERBY-4006 // for more discussion of this behavior. this.keepCurrentDefault = (defaultNode == null); }
void function(Object name, Object defaultNode, Object type, Object autoIncrementInfo) throws StandardException { super.init(name); this.type = (DataTypeDescriptor)type; if (defaultNode instanceof UntypedNullConstantNode) { } else if (defaultNode instanceof GenerationClauseNode) { generationClauseNode = (GenerationClauseNode)defaultNode; } else { assert (defaultNode == null (defaultNode instanceof DefaultNode)); this.defaultNode = (DefaultNode)defaultNode; if (autoIncrementInfo != null) { long[] aii = (long[])autoIncrementInfo; autoincrementStart = aii[QueryTreeNode.AUTOINCREMENT_START_INDEX]; autoincrementIncrement = aii[QueryTreeNode.AUTOINCREMENT_INC_INDEX]; autoinc_create_or_modify_Start_Increment = aii[QueryTreeNode.AUTOINCREMENT_CREATE_MODIFY]; autoincrementVerify = (aii[QueryTreeNode.AUTOINCREMENT_IS_AUTOINCREMENT_INDEX] > 0) ? false : true; isAutoincrement = true; if (type != null) setNullability(false); } } this.keepCurrentDefault = (defaultNode == null); }
/** * Initializer for a ColumnDefinitionNode * * @param name The name of the column * @param defaultNode The default value of the column * @param type A DataTypeDescriptor telling the type of the column * @param autoIncrementInfo Info for autoincrement columns * */
Initializer for a ColumnDefinitionNode
init
{ "repo_name": "storyeah/sql-parser", "path": "src/main/java/com/akiban/sql/parser/ColumnDefinitionNode.java", "license": "epl-1.0", "size": 11040 }
[ "com.akiban.sql.StandardException", "com.akiban.sql.types.DataTypeDescriptor" ]
import com.akiban.sql.StandardException; import com.akiban.sql.types.DataTypeDescriptor;
import com.akiban.sql.*; import com.akiban.sql.types.*;
[ "com.akiban.sql" ]
com.akiban.sql;
1,714,228
int insertSelective(ProjectRole record);
int insertSelective(ProjectRole record);
/** * This method was generated by MyBatis Generator. * This method corresponds to the database table m_prj_role * * @mbggenerated Tue Sep 08 09:15:22 ICT 2015 */
This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_role
insertSelective
{ "repo_name": "onlylin/mycollab", "path": "mycollab-services/src/main/java/com/esofthead/mycollab/module/project/dao/ProjectRoleMapper.java", "license": "agpl-3.0", "size": 5550 }
[ "com.esofthead.mycollab.module.project.domain.ProjectRole" ]
import com.esofthead.mycollab.module.project.domain.ProjectRole;
import com.esofthead.mycollab.module.project.domain.*;
[ "com.esofthead.mycollab" ]
com.esofthead.mycollab;
1,583,096
public List<DatabaseMeta> readDatabases() throws KettleException { List<DatabaseMeta> databases = new ArrayList<DatabaseMeta>(); ObjectId[] ids = getDatabaseIDs( false ); for ( int i = 0; i < ids.length; i++ ) { DatabaseMeta databaseMeta = loadDatabaseMeta( ids[i], null ); // reads last // versions databases.add( databaseMeta ); } return databases; }
List<DatabaseMeta> function() throws KettleException { List<DatabaseMeta> databases = new ArrayList<DatabaseMeta>(); ObjectId[] ids = getDatabaseIDs( false ); for ( int i = 0; i < ids.length; i++ ) { DatabaseMeta databaseMeta = loadDatabaseMeta( ids[i], null ); databases.add( databaseMeta ); } return databases; }
/** * Read all the databases defined in the repository * * @return a list of all the databases defined in the repository * @throws KettleException */
Read all the databases defined in the repository
readDatabases
{ "repo_name": "rfellows/pentaho-kettle", "path": "engine/src/org/pentaho/di/repository/kdr/KettleDatabaseRepository.java", "license": "apache-2.0", "size": 84888 }
[ "java.util.ArrayList", "java.util.List", "org.pentaho.di.core.database.DatabaseMeta", "org.pentaho.di.core.exception.KettleException", "org.pentaho.di.repository.ObjectId" ]
import java.util.ArrayList; import java.util.List; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.ObjectId;
import java.util.*; import org.pentaho.di.core.database.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*;
[ "java.util", "org.pentaho.di" ]
java.util; org.pentaho.di;
1,806,633
void onDownloadFileCreated(DownloadFileInfo downloadFileInfo);
void onDownloadFileCreated(DownloadFileInfo downloadFileInfo);
/** * an new DownloadFile created * * @param downloadFileInfo new DownloadFile created */
an new DownloadFile created
onDownloadFileCreated
{ "repo_name": "wlfcolin/file-downloader", "path": "FileDownloader/src/main/java/org/wlf/filedownloader/listener/OnDownloadFileChangeListener.java", "license": "apache-2.0", "size": 4113 }
[ "org.wlf.filedownloader.DownloadFileInfo" ]
import org.wlf.filedownloader.DownloadFileInfo;
import org.wlf.filedownloader.*;
[ "org.wlf.filedownloader" ]
org.wlf.filedownloader;
2,651,345
@Test public void dollarQuote() throws Exception { flyway.setLocations("migration/dbsupport/postgresql/sql/dollar"); flyway.migrate(); assertEquals(9, jdbcTemplate.queryForInt("select count(*) from dollar")); }
void function() throws Exception { flyway.setLocations(STR); flyway.migrate(); assertEquals(9, jdbcTemplate.queryForInt(STR)); }
/** * Tests parsing support for $$ string literals. */
Tests parsing support for $$ string literals
dollarQuote
{ "repo_name": "Muni10/flyway", "path": "flyway-core/src/test/java/org/flywaydb/core/internal/dbsupport/postgresql/PostgreSQLMigrationMediumTest.java", "license": "apache-2.0", "size": 11242 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
2,088,513
public void startMiniMapReduceCluster() throws IOException { startMiniMapReduceCluster(2); }
void function() throws IOException { startMiniMapReduceCluster(2); }
/** * Starts a <code>MiniMRCluster</code> with a default number of * <code>TaskTracker</code>'s. * * @throws IOException When starting the cluster fails. */
Starts a <code>MiniMRCluster</code> with a default number of <code>TaskTracker</code>'s
startMiniMapReduceCluster
{ "repo_name": "abaranau/hbase", "path": "src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java", "license": "apache-2.0", "size": 40327 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,767,219
public static boolean checkIfActive(TileEntity tileEntity) { if (tileEntity.getWorld() == null || tileEntity.getWorld().isRemote || !(tileEntity instanceof ITickable)) { return true; } final World world = tileEntity.getWorld(); final IMixinChunk activeChunk = ((IMixinTileEntity) tileEntity).getActiveChunk(); if (activeChunk == null) { // Should never happen but just in case for mods, always tick return true; } long currentTick = SpongeImpl.getServer().getTickCounter(); IModData_Activation spongeTileEntity = (IModData_Activation) tileEntity; boolean isActive = activeChunk.isPersistedChunk() || spongeTileEntity.getActivatedTick() >= currentTick || spongeTileEntity.getDefaultActivationState(); // Should this entity tick? if (!isActive) { if (spongeTileEntity.getActivatedTick() == Integer.MIN_VALUE) { // Has not come across a player return false; } } // check tick rate if (isActive && world.getWorldInfo().getWorldTotalTime() % spongeTileEntity.getSpongeTickRate() != 0L) { isActive = false; } return isActive; }
static boolean function(TileEntity tileEntity) { if (tileEntity.getWorld() == null tileEntity.getWorld().isRemote !(tileEntity instanceof ITickable)) { return true; } final World world = tileEntity.getWorld(); final IMixinChunk activeChunk = ((IMixinTileEntity) tileEntity).getActiveChunk(); if (activeChunk == null) { return true; } long currentTick = SpongeImpl.getServer().getTickCounter(); IModData_Activation spongeTileEntity = (IModData_Activation) tileEntity; boolean isActive = activeChunk.isPersistedChunk() spongeTileEntity.getActivatedTick() >= currentTick spongeTileEntity.getDefaultActivationState(); if (!isActive) { if (spongeTileEntity.getActivatedTick() == Integer.MIN_VALUE) { return false; } } if (isActive && world.getWorldInfo().getWorldTotalTime() % spongeTileEntity.getSpongeTickRate() != 0L) { isActive = false; } return isActive; }
/** * Checks if the tileentity is active for this tick. * * @param tileEntity The tileentity to check for activity * @return Whether the given tileentity should be active */
Checks if the tileentity is active for this tick
checkIfActive
{ "repo_name": "Grinch/SpongeCommon", "path": "src/main/java/org/spongepowered/common/mixin/plugin/tileentityactivation/TileEntityActivation.java", "license": "mit", "size": 12112 }
[ "net.minecraft.tileentity.TileEntity", "net.minecraft.util.ITickable", "net.minecraft.world.World", "org.spongepowered.common.SpongeImpl", "org.spongepowered.common.interfaces.IMixinChunk", "org.spongepowered.common.interfaces.block.tile.IMixinTileEntity" ]
import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; import net.minecraft.world.World; import org.spongepowered.common.SpongeImpl; import org.spongepowered.common.interfaces.IMixinChunk; import org.spongepowered.common.interfaces.block.tile.IMixinTileEntity;
import net.minecraft.tileentity.*; import net.minecraft.util.*; import net.minecraft.world.*; import org.spongepowered.common.*; import org.spongepowered.common.interfaces.*; import org.spongepowered.common.interfaces.block.tile.*;
[ "net.minecraft.tileentity", "net.minecraft.util", "net.minecraft.world", "org.spongepowered.common" ]
net.minecraft.tileentity; net.minecraft.util; net.minecraft.world; org.spongepowered.common;
2,635,344
public Builder setUnit(TimeUnit unit) { this.unit = unit; return this; } /** * Sets the work queue type {@link BlockingQueue}
Builder function(TimeUnit unit) { this.unit = unit; return this; } /** * Sets the work queue type {@link BlockingQueue}
/** * Sets unit of keep alive time * * @param unit time unit */
Sets unit of keep alive time
setUnit
{ "repo_name": "GregoryHo/FastHook", "path": "fast-hook/src/main/java/com/ns/greg/library/fasthook/ThreadExecutorFactory.java", "license": "mit", "size": 8923 }
[ "java.util.concurrent.BlockingQueue", "java.util.concurrent.TimeUnit" ]
import java.util.concurrent.BlockingQueue; import java.util.concurrent.TimeUnit;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,453,637
public void updateUserStore(UserStoreDTO userStoreDTO) throws Exception { stub.editUserStore(userStoreDTO); }
void function(UserStoreDTO userStoreDTO) throws Exception { stub.editUserStore(userStoreDTO); }
/** * Update user store without changing the domain name * * @param userStoreDTO New properties of the user store * @throws Exception */
Update user store without changing the domain name
updateUserStore
{ "repo_name": "maheshika/carbon-utils", "path": "components/userstore-config/org.wso2.carbon.identity.user.store.configuration.ui/src/main/java/org/wso2/carbon/identity/user/store/configuration/ui/client/UserStoreConfigAdminServiceClient.java", "license": "apache-2.0", "size": 5096 }
[ "org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO" ]
import org.wso2.carbon.identity.user.store.configuration.stub.dto.UserStoreDTO;
import org.wso2.carbon.identity.user.store.configuration.stub.dto.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
625,109
@Test public void subTreeBytesShouldBeCorrectWithInternalStreamClose() throws Http2Exception { // Block the connection exhaustStreamWindow(CONNECTION_STREAM_ID); Http2Stream stream0 = connection.connectionStream(); Http2Stream streamA = connection.stream(STREAM_A); Http2Stream streamB = connection.stream(STREAM_B); Http2Stream streamC = connection.stream(STREAM_C); Http2Stream streamD = connection.stream(STREAM_D); // Send a bunch of data on each stream. final IntObjectMap<Integer> streamSizes = new IntObjectHashMap<Integer>(4); streamSizes.put(STREAM_A, 400); streamSizes.put(STREAM_B, 500); streamSizes.put(STREAM_C, 600); streamSizes.put(STREAM_D, 700); FakeFlowControlled dataA = new FakeFlowControlled(streamSizes.get(STREAM_A)); FakeFlowControlled dataB = new FakeFlowControlled(streamSizes.get(STREAM_B)); FakeFlowControlled dataC = new FakeFlowControlled(streamSizes.get(STREAM_C)); FakeFlowControlled dataD = new FakeFlowControlled(streamSizes.get(STREAM_D)); sendData(STREAM_A, dataA); sendData(STREAM_B, dataB); sendData(STREAM_C, dataC); sendData(STREAM_D, dataD); dataA.assertNotWritten(); dataB.assertNotWritten(); dataC.assertNotWritten(); dataD.assertNotWritten(); streamA.close(); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_B, STREAM_C, STREAM_D)), streamableBytesForTree(stream0)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_C, STREAM_D)), streamableBytesForTree(streamA)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_B)), streamableBytesForTree(streamB)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_C)), streamableBytesForTree(streamC)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_D)), streamableBytesForTree(streamD)); }
void function() throws Http2Exception { exhaustStreamWindow(CONNECTION_STREAM_ID); Http2Stream stream0 = connection.connectionStream(); Http2Stream streamA = connection.stream(STREAM_A); Http2Stream streamB = connection.stream(STREAM_B); Http2Stream streamC = connection.stream(STREAM_C); Http2Stream streamD = connection.stream(STREAM_D); final IntObjectMap<Integer> streamSizes = new IntObjectHashMap<Integer>(4); streamSizes.put(STREAM_A, 400); streamSizes.put(STREAM_B, 500); streamSizes.put(STREAM_C, 600); streamSizes.put(STREAM_D, 700); FakeFlowControlled dataA = new FakeFlowControlled(streamSizes.get(STREAM_A)); FakeFlowControlled dataB = new FakeFlowControlled(streamSizes.get(STREAM_B)); FakeFlowControlled dataC = new FakeFlowControlled(streamSizes.get(STREAM_C)); FakeFlowControlled dataD = new FakeFlowControlled(streamSizes.get(STREAM_D)); sendData(STREAM_A, dataA); sendData(STREAM_B, dataB); sendData(STREAM_C, dataC); sendData(STREAM_D, dataD); dataA.assertNotWritten(); dataB.assertNotWritten(); dataC.assertNotWritten(); dataD.assertNotWritten(); streamA.close(); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_B, STREAM_C, STREAM_D)), streamableBytesForTree(stream0)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_C, STREAM_D)), streamableBytesForTree(streamA)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_B)), streamableBytesForTree(streamB)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_C)), streamableBytesForTree(streamC)); assertEquals(calculateStreamSizeSum(streamSizes, Arrays.asList(STREAM_D)), streamableBytesForTree(streamD)); }
/** * In this test, we block all streams and close an internal stream in the priority tree but tree should not change * * <pre> * [0] * / \ * A B * / \ * C D * </pre> */
In this test, we block all streams and close an internal stream in the priority tree but tree should not change <code> [0] \ A B \ C D </code>
subTreeBytesShouldBeCorrectWithInternalStreamClose
{ "repo_name": "wuyinxian124/netty", "path": "codec-http2/src/test/java/io/netty/handler/codec/http2/DefaultHttp2RemoteFlowControllerTest.java", "license": "apache-2.0", "size": 48519 }
[ "io.netty.util.collection.IntObjectHashMap", "io.netty.util.collection.IntObjectMap", "java.util.Arrays", "org.junit.Assert" ]
import io.netty.util.collection.IntObjectHashMap; import io.netty.util.collection.IntObjectMap; import java.util.Arrays; import org.junit.Assert;
import io.netty.util.collection.*; import java.util.*; import org.junit.*;
[ "io.netty.util", "java.util", "org.junit" ]
io.netty.util; java.util; org.junit;
469,959
default void onAddressBlocked(InetAddress address, String reason, long time) { }
default void onAddressBlocked(InetAddress address, String reason, long time) { }
/** * Called when an address is blocked by the server. * * @param address the address that was blocked. * @param reason the reason the address was blocked. * @param time how long the address is blocked for (Note: -1 is permanent). */
Called when an address is blocked by the server
onAddressBlocked
{ "repo_name": "KernelFreeze/PocketProxy", "path": "src/main/java/me/kernelfreeze/bedrockproxy/raknet/server/RakNetServerListener.java", "license": "mit", "size": 6994 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
1,877,958
public void testFirebirdUrl() { assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql://localhost:8080/path/to/db.fdb")); assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:native:localhost/8080:/path/to/db.fdb")); assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:local://localhost:8080:/path/to/db.fdb")); assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, "jdbc:firebirdsql:embedded:localhost/8080:/path/to/db.fdb")); }
void function() { assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, STRjdbc:firebirdsql:native:localhost/8080:/path/to/db.fdbSTRjdbc:firebirdsql:local: assertEquals(FirebirdPlatform.DATABASENAME, _platformUtils.determineDatabaseType(null, STR)); }
/** * Tests the determination of the Firebird platform via JDBC connection urls. */
Tests the determination of the Firebird platform via JDBC connection urls
testFirebirdUrl
{ "repo_name": "etiago/apache-ddlutils", "path": "src/test/org/apache/ddlutils/platform/TestPlatformUtils.java", "license": "apache-2.0", "size": 19409 }
[ "org.apache.ddlutils.platform.firebird.FirebirdPlatform" ]
import org.apache.ddlutils.platform.firebird.FirebirdPlatform;
import org.apache.ddlutils.platform.firebird.*;
[ "org.apache.ddlutils" ]
org.apache.ddlutils;
2,172,972
@Override public void enterComment(@NotNull MicroParser.CommentContext ctx) { }
@Override public void enterComment(@NotNull MicroParser.CommentContext ctx) { }
/** * {@inheritDoc} * <p/> * The default implementation does nothing. */
The default implementation does nothing
exitExpr_list_tail
{ "repo_name": "ssabpisa/compiler-468", "path": "ssabpisa/build/MicroBaseListener.java", "license": "agpl-3.0", "size": 15720 }
[ "org.antlr.v4.runtime.misc.NotNull" ]
import org.antlr.v4.runtime.misc.NotNull;
import org.antlr.v4.runtime.misc.*;
[ "org.antlr.v4" ]
org.antlr.v4;
1,051,039
public static File getSystemConfigDir() { File configDir = null; String ceylonConfigDir = System.getProperty(Constants.PROP_CEYLON_CONFIG_DIR); if (ceylonConfigDir != null) { configDir = new File(ceylonConfigDir); } else { if (OSUtil.isWindows()) { String appDir = System.getenv("ALLUSERSPROFILE"); if (appDir != null) { configDir = new File(appDir, "ceylon"); } } else if (OSUtil.isMac()) { configDir = new File("/etc/ceylon"); } else { // Assume a "regular" unix OS configDir = new File("/etc/ceylon"); } } return configDir; } /** * The installation directory. As given by the {@code ceylon.home}
static File function() { File configDir = null; String ceylonConfigDir = System.getProperty(Constants.PROP_CEYLON_CONFIG_DIR); if (ceylonConfigDir != null) { configDir = new File(ceylonConfigDir); } else { if (OSUtil.isWindows()) { String appDir = System.getenv(STR); if (appDir != null) { configDir = new File(appDir, STR); } } else if (OSUtil.isMac()) { configDir = new File(STR); } else { configDir = new File(STR); } } return configDir; } /** * The installation directory. As given by the {@code ceylon.home}
/** * The OS-specific directory where global application data can be stored. * As given by the {@code ceylon.config.dir} system property or the default * OS-dependent directory if the property doesn't exist. (/etc/ceylon on * Unix-like systems and %ALLUSERSPROFILE%/ceylon on Windows) */
The OS-specific directory where global application data can be stored. As given by the ceylon.config.dir system property or the default OS-dependent directory if the property doesn't exist. (/etc/ceylon on Unix-like systems and %ALLUSERSPROFILE%/ceylon on Windows)
getSystemConfigDir
{ "repo_name": "gijsleussink/ceylon", "path": "common/src/com/redhat/ceylon/common/FileUtil.java", "license": "apache-2.0", "size": 18162 }
[ "java.io.File" ]
import java.io.File;
import java.io.*;
[ "java.io" ]
java.io;
2,788,554
Observable<UserEntity> get(final int userId);
Observable<UserEntity> get(final int userId);
/** * Gets an {@link rx.Observable} which will emit a {@link UserEntity}. * * @param userId The user id to retrieve data. */
Gets an <code>rx.Observable</code> which will emit a <code>UserEntity</code>
get
{ "repo_name": "hejunbinlan/Android-CleanArchitecture", "path": "data/src/main/java/com/fernandocejas/android10/sample/data/cache/UserCache.java", "license": "apache-2.0", "size": 1622 }
[ "com.fernandocejas.android10.sample.data.entity.UserEntity" ]
import com.fernandocejas.android10.sample.data.entity.UserEntity;
import com.fernandocejas.android10.sample.data.entity.*;
[ "com.fernandocejas.android10" ]
com.fernandocejas.android10;
2,611,946
public ServiceCall removeNodesAsync(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException("ServiceCallback is required for async calls."); } if (poolId == null) { serviceCallback.failure(new IllegalArgumentException("Parameter poolId is required and cannot be null.")); return null; } if (nodeRemoveParameter == null) { serviceCallback.failure(new IllegalArgumentException("Parameter nodeRemoveParameter is required and cannot be null.")); return null; } if (this.client.apiVersion() == null) { serviceCallback.failure(new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.")); return null; } Validator.validate(nodeRemoveParameter, serviceCallback); Validator.validate(poolRemoveNodesOptions, serviceCallback); Integer timeout = null; if (poolRemoveNodesOptions != null) { timeout = poolRemoveNodesOptions.timeout(); } String clientRequestId = null; if (poolRemoveNodesOptions != null) { clientRequestId = poolRemoveNodesOptions.clientRequestId(); } Boolean returnClientRequestId = null; if (poolRemoveNodesOptions != null) { returnClientRequestId = poolRemoveNodesOptions.returnClientRequestId(); } DateTime ocpDate = null; if (poolRemoveNodesOptions != null) { ocpDate = poolRemoveNodesOptions.ocpDate(); } String ifMatch = null; if (poolRemoveNodesOptions != null) { ifMatch = poolRemoveNodesOptions.ifMatch(); } String ifNoneMatch = null; if (poolRemoveNodesOptions != null) { ifNoneMatch = poolRemoveNodesOptions.ifNoneMatch(); } DateTime ifModifiedSince = null; if (poolRemoveNodesOptions != null) { ifModifiedSince = poolRemoveNodesOptions.ifModifiedSince(); } DateTime ifUnmodifiedSince = null; if (poolRemoveNodesOptions != null) { ifUnmodifiedSince = poolRemoveNodesOptions.ifUnmodifiedSince(); } DateTimeRfc1123 ocpDateConverted = null; if (ocpDate != null) { ocpDateConverted = new DateTimeRfc1123(ocpDate); } DateTimeRfc1123 ifModifiedSinceConverted = null; if (ifModifiedSince != null) { ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); } DateTimeRfc1123 ifUnmodifiedSinceConverted = null; if (ifUnmodifiedSince != null) { ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); }
ServiceCall function(String poolId, NodeRemoveParameter nodeRemoveParameter, PoolRemoveNodesOptions poolRemoveNodesOptions, final ServiceCallback<Void> serviceCallback) throws IllegalArgumentException { if (serviceCallback == null) { throw new IllegalArgumentException(STR); } if (poolId == null) { serviceCallback.failure(new IllegalArgumentException(STR)); return null; } if (nodeRemoveParameter == null) { serviceCallback.failure(new IllegalArgumentException(STR)); return null; } if (this.client.apiVersion() == null) { serviceCallback.failure(new IllegalArgumentException(STR)); return null; } Validator.validate(nodeRemoveParameter, serviceCallback); Validator.validate(poolRemoveNodesOptions, serviceCallback); Integer timeout = null; if (poolRemoveNodesOptions != null) { timeout = poolRemoveNodesOptions.timeout(); } String clientRequestId = null; if (poolRemoveNodesOptions != null) { clientRequestId = poolRemoveNodesOptions.clientRequestId(); } Boolean returnClientRequestId = null; if (poolRemoveNodesOptions != null) { returnClientRequestId = poolRemoveNodesOptions.returnClientRequestId(); } DateTime ocpDate = null; if (poolRemoveNodesOptions != null) { ocpDate = poolRemoveNodesOptions.ocpDate(); } String ifMatch = null; if (poolRemoveNodesOptions != null) { ifMatch = poolRemoveNodesOptions.ifMatch(); } String ifNoneMatch = null; if (poolRemoveNodesOptions != null) { ifNoneMatch = poolRemoveNodesOptions.ifNoneMatch(); } DateTime ifModifiedSince = null; if (poolRemoveNodesOptions != null) { ifModifiedSince = poolRemoveNodesOptions.ifModifiedSince(); } DateTime ifUnmodifiedSince = null; if (poolRemoveNodesOptions != null) { ifUnmodifiedSince = poolRemoveNodesOptions.ifUnmodifiedSince(); } DateTimeRfc1123 ocpDateConverted = null; if (ocpDate != null) { ocpDateConverted = new DateTimeRfc1123(ocpDate); } DateTimeRfc1123 ifModifiedSinceConverted = null; if (ifModifiedSince != null) { ifModifiedSinceConverted = new DateTimeRfc1123(ifModifiedSince); } DateTimeRfc1123 ifUnmodifiedSinceConverted = null; if (ifUnmodifiedSince != null) { ifUnmodifiedSinceConverted = new DateTimeRfc1123(ifUnmodifiedSince); }
/** * Removes compute nodes from the specified pool. * * @param poolId The id of the pool from which you want to remove nodes. * @param nodeRemoveParameter The parameters for the request. * @param poolRemoveNodesOptions Additional parameters for the operation * @param serviceCallback the async ServiceCallback to handle successful and failed responses. * @throws IllegalArgumentException thrown if callback is null * @return the {@link Call} object */
Removes compute nodes from the specified pool
removeNodesAsync
{ "repo_name": "pomortaz/azure-sdk-for-java", "path": "azure-batch/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java", "license": "mit", "size": 237401 }
[ "com.microsoft.azure.batch.protocol.models.NodeRemoveParameter", "com.microsoft.azure.batch.protocol.models.PoolRemoveNodesOptions", "com.microsoft.rest.DateTimeRfc1123", "com.microsoft.rest.ServiceCall", "com.microsoft.rest.ServiceCallback", "com.microsoft.rest.Validator", "org.joda.time.DateTime" ]
import com.microsoft.azure.batch.protocol.models.NodeRemoveParameter; import com.microsoft.azure.batch.protocol.models.PoolRemoveNodesOptions; import com.microsoft.rest.DateTimeRfc1123; import com.microsoft.rest.ServiceCall; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.Validator; import org.joda.time.DateTime;
import com.microsoft.azure.batch.protocol.models.*; import com.microsoft.rest.*; import org.joda.time.*;
[ "com.microsoft.azure", "com.microsoft.rest", "org.joda.time" ]
com.microsoft.azure; com.microsoft.rest; org.joda.time;
657,953
private String[] removeEmptyStrings(final String[] originals) { if (originals == null) { return null; } else { List<String> parsed = new ArrayList<>(); for (String original : originals) { if (original != null && original.length() > 0) { parsed.add(original); } } return parsed.toArray(new String[parsed.size()]); } }
String[] function(final String[] originals) { if (originals == null) { return null; } else { List<String> parsed = new ArrayList<>(); for (String original : originals) { if (original != null && original.length() > 0) { parsed.add(original); } } return parsed.toArray(new String[parsed.size()]); } }
/** * Helper that removes empty/null string from the <code>original</code> string array. * * @param originals The string array from which the null/empty strings should be removed from. * @return Array of non empty strings from the <code>original</code> string array. */
Helper that removes empty/null string from the <code>original</code> string array
removeEmptyStrings
{ "repo_name": "Joshua-Barclay/wcomponents", "path": "wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WDataTable.java", "license": "gpl-3.0", "size": 52311 }
[ "java.util.ArrayList", "java.util.List" ]
import java.util.ArrayList; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,842,823
public void testSetup() { Assert.assertEquals(MorseCodeConverter.GAP, 100); Assert.assertEquals(MorseCodeConverter.DASH, 300); Assert.assertEquals(MorseCodeConverter.DOT, 100); }
void function() { Assert.assertEquals(MorseCodeConverter.GAP, 100); Assert.assertEquals(MorseCodeConverter.DASH, 300); Assert.assertEquals(MorseCodeConverter.DOT, 100); }
/** * Test the timing parameters for signals. */
Test the timing parameters for signals
testSetup
{ "repo_name": "CJstar/android-maven-plugin", "path": "src/test/projects/morseflash/morseflash-lib/src/test/java/com/simpligility/android/morse/MorseCodeConverterTest.java", "license": "apache-2.0", "size": 2400 }
[ "org.junit.Assert" ]
import org.junit.Assert;
import org.junit.*;
[ "org.junit" ]
org.junit;
1,735,876
//----------------------------------------------------------------------- @FromString public static Instant parse(String str) { return parse(str, ISODateTimeFormat.dateTimeParser()); }
static Instant function(String str) { return parse(str, ISODateTimeFormat.dateTimeParser()); }
/** * Parses an {@code Instant} from the specified string. * <p> * This uses {@link ISODateTimeFormat#dateTimeParser()}. * * @param str the string to parse, not null * @since 2.0 */
Parses an Instant from the specified string. This uses <code>ISODateTimeFormat#dateTimeParser()</code>
parse
{ "repo_name": "JodaOrg/joda-time", "path": "src/main/java/org/joda/time/Instant.java", "license": "apache-2.0", "size": 14950 }
[ "org.joda.time.format.ISODateTimeFormat" ]
import org.joda.time.format.ISODateTimeFormat;
import org.joda.time.format.*;
[ "org.joda.time" ]
org.joda.time;
1,512,421
private boolean implies2(RexNode first, RexNode second) { if (second.isAlwaysFalse()) { // f cannot imply s return false; } // E.g. "x is null" implies "x is null". if (RexUtil.eq(first, second)) { return true; }
boolean function(RexNode first, RexNode second) { if (second.isAlwaysFalse()) { return false; } if (RexUtil.eq(first, second)) { return true; }
/** Returns whether the predicate {@code first} (not a conjunction) * implies {@code second}. */
Returns whether the predicate first (not a conjunction)
implies2
{ "repo_name": "minji-kim/calcite", "path": "core/src/main/java/org/apache/calcite/plan/RexImplicationChecker.java", "license": "apache-2.0", "size": 17464 }
[ "org.apache.calcite.rex.RexNode", "org.apache.calcite.rex.RexUtil" ]
import org.apache.calcite.rex.RexNode; import org.apache.calcite.rex.RexUtil;
import org.apache.calcite.rex.*;
[ "org.apache.calcite" ]
org.apache.calcite;
699,382
// source: http://stackoverflow.com/a/13605411 if (img instanceof BufferedImage) { return (BufferedImage) img; } // Create a buffered image with transparency BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); // Draw the image on to the buffered image Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); // Return the buffered image return bimage; }
if (img instanceof BufferedImage) { return (BufferedImage) img; } BufferedImage bimage = new BufferedImage(img.getWidth(null), img.getHeight(null), BufferedImage.TYPE_INT_ARGB); Graphics2D bGr = bimage.createGraphics(); bGr.drawImage(img, 0, 0, null); bGr.dispose(); return bimage; }
/** * Transforms a Image into a BufferedImage. * * @param img * @return */
Transforms a Image into a BufferedImage
transformImageToBufferedImage
{ "repo_name": "RoseTec/JigSPuzzle", "path": "src/main/java/jigspuzzle/util/ImageUtil.java", "license": "gpl-3.0", "size": 3288 }
[ "java.awt.Graphics2D", "java.awt.image.BufferedImage" ]
import java.awt.Graphics2D; import java.awt.image.BufferedImage;
import java.awt.*; import java.awt.image.*;
[ "java.awt" ]
java.awt;
766,220
public JSONObject asJSONObject(T nativeObject) throws Exception;
JSONObject function(T nativeObject) throws Exception;
/** * Transfroms native object into a org.json.JSONObject * @param nativeObject * @return org.json.JSONObject representation of an object * * @throws Exception */
Transfroms native object into a org.json.JSONObject
asJSONObject
{ "repo_name": "vals-productions/sqlighter", "path": "distr/current/android/com/vals/a2ios/amfibian/intf/AnObject.java", "license": "apache-2.0", "size": 4171 }
[ "org.json.JSONObject" ]
import org.json.JSONObject;
import org.json.*;
[ "org.json" ]
org.json;
1,012,484
public int getChildCount(Object parent) { if (parent instanceof TreeNode) return ((TreeNode) parent).getChildCount(); return 0; }
int function(Object parent) { if (parent instanceof TreeNode) return ((TreeNode) parent).getChildCount(); return 0; }
/** * Returns the number of children of <I>parent </I>. Returns 0 if the node * is a leaf or if it has no children. <I>parent </I> must be a node * previously obtained from this data source. * * @param parent * a node in the tree, obtained from this data source * @return the number of children of the node <I>parent </I> */
Returns the number of children of parent . Returns 0 if the node is a leaf or if it has no children. parent must be a node previously obtained from this data source
getChildCount
{ "repo_name": "yawlfoundation/editor", "path": "source/org/jgraph/graph/DefaultGraphModel.java", "license": "lgpl-3.0", "size": 56297 }
[ "javax.swing.tree.TreeNode" ]
import javax.swing.tree.TreeNode;
import javax.swing.tree.*;
[ "javax.swing" ]
javax.swing;
1,689,176
@Test(expectedExceptions = XL4JRuntimeException.class, expectedExceptionsMessageRegExp = ".*?message2.*") public void testNotNullOrEmptyArray() { ArgumentChecker.notNullOrEmpty(new String[] { "Hello" }, "message"); ArgumentChecker.notNullOrEmpty(new String[0], "message2"); }
@Test(expectedExceptions = XL4JRuntimeException.class, expectedExceptionsMessageRegExp = STR) void function() { ArgumentChecker.notNullOrEmpty(new String[] { "Hello" }, STR); ArgumentChecker.notNullOrEmpty(new String[0], STR); }
/** * Tests notNullOrEmpty(). */
Tests notNullOrEmpty()
testNotNullOrEmptyArray
{ "repo_name": "McLeodMoores/xl4j", "path": "xll-core/src/test/java/com/mcleodmoores/xl4j/v1/ArgumentCheckerTests.java", "license": "gpl-3.0", "size": 3223 }
[ "com.mcleodmoores.xl4j.v1.util.ArgumentChecker", "com.mcleodmoores.xl4j.v1.util.XL4JRuntimeException", "org.testng.annotations.Test" ]
import com.mcleodmoores.xl4j.v1.util.ArgumentChecker; import com.mcleodmoores.xl4j.v1.util.XL4JRuntimeException; import org.testng.annotations.Test;
import com.mcleodmoores.xl4j.v1.util.*; import org.testng.annotations.*;
[ "com.mcleodmoores.xl4j", "org.testng.annotations" ]
com.mcleodmoores.xl4j; org.testng.annotations;
1,511,525
private void removeTrigger() { LOGGER.debug("Obtaining selected trigger for removal."); final String selection = (String) triggerTable.getValue(); if (selection == null) { LOGGER.debug("Nothing selected."); return; } ConfirmationWindow7.showConfirmation("Remove Trigger", "Do you really want to remove the trigger '" + selection + "' from job '" + getIdField().getValue() + "'?", ConfirmationWindow7.OPTION_TYPE.YES_NO_OPTION, (ConfirmationWindow7.RESULT pResult) -> { switch (pResult) { case YES: ISchedulerManager manager = SchedulerManagement.getSchedulerManagement().getSchedulerManager(); LOGGER.debug("Removing trigger with id '{}'", selection); try { if (manager.removeTrigger(selection)) { LOGGER.debug("Trigger with id '{}' successfully removed.", selection); } reloadTriggers(); } catch (UnauthorizedAccessAttemptException ex) { LOGGER.error("Not authorized to remove trigger with id '" + selection + "'.", ex); } } }); }
void function() { LOGGER.debug(STR); final String selection = (String) triggerTable.getValue(); if (selection == null) { LOGGER.debug(STR); return; } ConfirmationWindow7.showConfirmation(STR, STR + selection + STR + getIdField().getValue() + "'?", ConfirmationWindow7.OPTION_TYPE.YES_NO_OPTION, (ConfirmationWindow7.RESULT pResult) -> { switch (pResult) { case YES: ISchedulerManager manager = SchedulerManagement.getSchedulerManagement().getSchedulerManager(); LOGGER.debug(STR, selection); try { if (manager.removeTrigger(selection)) { LOGGER.debug(STR, selection); } reloadTriggers(); } catch (UnauthorizedAccessAttemptException ex) { LOGGER.error(STR + selection + "'.", ex); } } }); }
/** * Remove the selected trigger. */
Remove the selected trigger
removeTrigger
{ "repo_name": "kit-data-manager/base", "path": "UserInterface/AdminUI/src/main/java/edu/kit/dama/ui/admin/schedule/SchedulerBasePropertiesLayout.java", "license": "apache-2.0", "size": 11852 }
[ "edu.kit.dama.authorization.exceptions.UnauthorizedAccessAttemptException", "edu.kit.dama.scheduler.SchedulerManagement", "edu.kit.dama.scheduler.manager.ISchedulerManager", "edu.kit.dama.ui.admin.workflow.DataWorkflowBasePropertiesLayout", "edu.kit.dama.ui.components.ConfirmationWindow7" ]
import edu.kit.dama.authorization.exceptions.UnauthorizedAccessAttemptException; import edu.kit.dama.scheduler.SchedulerManagement; import edu.kit.dama.scheduler.manager.ISchedulerManager; import edu.kit.dama.ui.admin.workflow.DataWorkflowBasePropertiesLayout; import edu.kit.dama.ui.components.ConfirmationWindow7;
import edu.kit.dama.authorization.exceptions.*; import edu.kit.dama.scheduler.*; import edu.kit.dama.scheduler.manager.*; import edu.kit.dama.ui.admin.workflow.*; import edu.kit.dama.ui.components.*;
[ "edu.kit.dama" ]
edu.kit.dama;
1,823,101
public List<QuerySelectable> getFlatSelect() { ArrayList<QuerySelectable> retval = new ArrayList<QuerySelectable>(); addFlatSelect(retval, query.getSelect(), null, null); return retval; }
List<QuerySelectable> function() { ArrayList<QuerySelectable> retval = new ArrayList<QuerySelectable>(); addFlatSelect(retval, query.getSelect(), null, null); return retval; }
/** * Converts a SELECT list from a normal query into a representation of the columns returned * in this converted list. * * @return a List of QuerySelectables corresponding to the columns returned in this list */
Converts a SELECT list from a normal query into a representation of the columns returned in this converted list
getFlatSelect
{ "repo_name": "JoeCarlson/intermine", "path": "intermine/api/main/src/org/intermine/api/results/flatouterjoins/ResultsFlatOuterJoinsImpl.java", "license": "lgpl-2.1", "size": 14196 }
[ "java.util.ArrayList", "java.util.List", "org.intermine.objectstore.query.QuerySelectable" ]
import java.util.ArrayList; import java.util.List; import org.intermine.objectstore.query.QuerySelectable;
import java.util.*; import org.intermine.objectstore.query.*;
[ "java.util", "org.intermine.objectstore" ]
java.util; org.intermine.objectstore;
2,281,736
private FormData layoutEditOptionButton( Button button ) { FormData fd = new FormData(); Image editButton = GUIResource.getInstance().getEditOptionButton(); if ( editButton != null ) { button.setImage( editButton ); button.setBackground( GUIResource.getInstance().getColorWhite() ); fd.width = editButton.getBounds().width + 20; fd.height = editButton.getBounds().height; } else { button.setText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit" ) ); } button.setToolTipText( BaseMessages.getString( PKG, "EnterOptionsDialog.Button.Edit.Tooltip" ) ); return fd; }
FormData function( Button button ) { FormData fd = new FormData(); Image editButton = GUIResource.getInstance().getEditOptionButton(); if ( editButton != null ) { button.setImage( editButton ); button.setBackground( GUIResource.getInstance().getColorWhite() ); fd.width = editButton.getBounds().width + 20; fd.height = editButton.getBounds().height; } else { button.setText( BaseMessages.getString( PKG, STR ) ); } button.setToolTipText( BaseMessages.getString( PKG, STR ) ); return fd; }
/** * Setting the layout of an <i>Edit</i> option button. Either a button image is set - if existing - or a text. * * @param button * The button */
Setting the layout of an Edit option button. Either a button image is set - if existing - or a text
layoutEditOptionButton
{ "repo_name": "skofra0/pentaho-kettle", "path": "ui/src/main/java/org/pentaho/di/ui/core/dialog/EnterOptionsDialog.java", "license": "apache-2.0", "size": 69157 }
[ "org.eclipse.swt.graphics.Image", "org.eclipse.swt.layout.FormData", "org.eclipse.swt.widgets.Button", "org.pentaho.di.i18n.BaseMessages", "org.pentaho.di.ui.core.gui.GUIResource" ]
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.FormData; import org.eclipse.swt.widgets.Button; import org.pentaho.di.i18n.BaseMessages; import org.pentaho.di.ui.core.gui.GUIResource;
import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; import org.pentaho.di.i18n.*; import org.pentaho.di.ui.core.gui.*;
[ "org.eclipse.swt", "org.pentaho.di" ]
org.eclipse.swt; org.pentaho.di;
2,585,527
public static final String Sha256_crypt(String keyStr, String saltStr, int roundsCount) { MessageDigest ctx = getSHA256(); MessageDigest alt_ctx = getSHA256(); byte[] alt_result; byte[] temp_result; byte[] p_bytes = null; byte[] s_bytes = null; int cnt, cnt2; int rounds = ROUNDS_DEFAULT; // Default number of rounds. StringBuilder buffer; boolean include_round_count = false; if (saltStr != null) { if (saltStr.startsWith(sha256_salt_prefix)) { saltStr = saltStr.substring(sha256_salt_prefix.length()); } if (saltStr.startsWith(sha256_rounds_prefix)) { String num = saltStr.substring(sha256_rounds_prefix.length(), saltStr.indexOf('$')); int srounds = Integer.valueOf(num).intValue(); saltStr = saltStr.substring(saltStr.indexOf('$')+1); rounds = Math.max(ROUNDS_MIN, Math.min(srounds, ROUNDS_MAX)); include_round_count = true; } if (saltStr.length() > SALT_LEN_MAX) { saltStr = saltStr.substring(0, SALT_LEN_MAX); } // gnu libc's crypt(3) implementation allows the salt to end // in $ which is then ignored. if (saltStr.endsWith("$")) { saltStr = saltStr.substring(0, saltStr.length() - 1); } else { if (saltStr.indexOf("$") != -1) { saltStr = saltStr.substring(0, saltStr.indexOf("$")); } } } else { java.util.Random randgen = new java.util.Random(); StringBuilder saltBuf = new StringBuilder(); while (saltBuf.length() < 16) { int index = (int) (randgen.nextFloat() * SALTCHARS.length()); saltBuf.append(SALTCHARS.substring(index, index+1)); } saltStr = saltBuf.toString(); } if (roundsCount != 0) { rounds = Math.max(ROUNDS_MIN, Math.min(roundsCount, ROUNDS_MAX)); } byte[] key = keyStr.getBytes(); byte[] salt = saltStr.getBytes(); ctx.reset(); ctx.update(key, 0, key.length); ctx.update(salt, 0, salt.length); alt_ctx.reset(); alt_ctx.update(key, 0, key.length); alt_ctx.update(salt, 0, salt.length); alt_ctx.update(key, 0, key.length); alt_result = alt_ctx.digest(); for (cnt = key.length; cnt > 32; cnt -= 32) { ctx.update(alt_result, 0, 32); } ctx.update(alt_result, 0, cnt); for (cnt = key.length; cnt > 0; cnt >>= 1) { if ((cnt & 1) != 0) { ctx.update(alt_result, 0, 32); } else { ctx.update(key, 0, key.length); } } alt_result = ctx.digest(); alt_ctx.reset(); for (cnt = 0; cnt < key.length; ++cnt) { alt_ctx.update(key, 0, key.length); } temp_result = alt_ctx.digest(); p_bytes = new byte[key.length]; for (cnt2 = 0, cnt = p_bytes.length; cnt >= 32; cnt -= 32) { System.arraycopy(temp_result, 0, p_bytes, cnt2, 32); cnt2 += 32; } System.arraycopy(temp_result, 0, p_bytes, cnt2, cnt); alt_ctx.reset(); for (cnt = 0; cnt < 16 + (alt_result[0]&0xFF); ++cnt) { alt_ctx.update(salt, 0, salt.length); } temp_result = alt_ctx.digest(); s_bytes = new byte[salt.length]; for (cnt2 = 0, cnt = s_bytes.length; cnt >= 32; cnt -= 32) { System.arraycopy(temp_result, 0, s_bytes, cnt2, 32); cnt2 += 32; } System.arraycopy(temp_result, 0, s_bytes, cnt2, cnt); for (cnt = 0; cnt < rounds; ++cnt) { ctx.reset(); if ((cnt & 1) != 0) { ctx.update(p_bytes, 0, key.length); } else { ctx.update (alt_result, 0, 32); } if (cnt % 3 != 0) { ctx.update(s_bytes, 0, salt.length); } if (cnt % 7 != 0) { ctx.update(p_bytes, 0, key.length); } if ((cnt & 1) != 0) { ctx.update(alt_result, 0, 32); } else { ctx.update(p_bytes, 0, key.length); } alt_result = ctx.digest(); } buffer = new StringBuilder(sha256_salt_prefix); if (include_round_count || rounds != ROUNDS_DEFAULT) { buffer.append(sha256_rounds_prefix); buffer.append(rounds); buffer.append("$"); } buffer.append(saltStr); buffer.append("$"); buffer.append(b64_from_24bit (alt_result[0], alt_result[10], alt_result[20], 4)); buffer.append(b64_from_24bit (alt_result[21], alt_result[1], alt_result[11], 4)); buffer.append(b64_from_24bit (alt_result[12], alt_result[22], alt_result[2], 4)); buffer.append(b64_from_24bit (alt_result[3], alt_result[13], alt_result[23], 4)); buffer.append(b64_from_24bit (alt_result[24], alt_result[4], alt_result[14], 4)); buffer.append(b64_from_24bit (alt_result[15], alt_result[25], alt_result[5], 4)); buffer.append(b64_from_24bit (alt_result[6], alt_result[16], alt_result[26], 4)); buffer.append(b64_from_24bit (alt_result[27], alt_result[7], alt_result[17], 4)); buffer.append(b64_from_24bit (alt_result[18], alt_result[28], alt_result[8], 4)); buffer.append(b64_from_24bit (alt_result[9], alt_result[19], alt_result[29], 4)); buffer.append(b64_from_24bit ((byte)0x00, alt_result[31], alt_result[30], 3)); ctx.reset(); return buffer.toString(); }
static final String function(String keyStr, String saltStr, int roundsCount) { MessageDigest ctx = getSHA256(); MessageDigest alt_ctx = getSHA256(); byte[] alt_result; byte[] temp_result; byte[] p_bytes = null; byte[] s_bytes = null; int cnt, cnt2; int rounds = ROUNDS_DEFAULT; StringBuilder buffer; boolean include_round_count = false; if (saltStr != null) { if (saltStr.startsWith(sha256_salt_prefix)) { saltStr = saltStr.substring(sha256_salt_prefix.length()); } if (saltStr.startsWith(sha256_rounds_prefix)) { String num = saltStr.substring(sha256_rounds_prefix.length(), saltStr.indexOf('$')); int srounds = Integer.valueOf(num).intValue(); saltStr = saltStr.substring(saltStr.indexOf('$')+1); rounds = Math.max(ROUNDS_MIN, Math.min(srounds, ROUNDS_MAX)); include_round_count = true; } if (saltStr.length() > SALT_LEN_MAX) { saltStr = saltStr.substring(0, SALT_LEN_MAX); } if (saltStr.endsWith("$")) { saltStr = saltStr.substring(0, saltStr.length() - 1); } else { if (saltStr.indexOf("$") != -1) { saltStr = saltStr.substring(0, saltStr.indexOf("$")); } } } else { java.util.Random randgen = new java.util.Random(); StringBuilder saltBuf = new StringBuilder(); while (saltBuf.length() < 16) { int index = (int) (randgen.nextFloat() * SALTCHARS.length()); saltBuf.append(SALTCHARS.substring(index, index+1)); } saltStr = saltBuf.toString(); } if (roundsCount != 0) { rounds = Math.max(ROUNDS_MIN, Math.min(roundsCount, ROUNDS_MAX)); } byte[] key = keyStr.getBytes(); byte[] salt = saltStr.getBytes(); ctx.reset(); ctx.update(key, 0, key.length); ctx.update(salt, 0, salt.length); alt_ctx.reset(); alt_ctx.update(key, 0, key.length); alt_ctx.update(salt, 0, salt.length); alt_ctx.update(key, 0, key.length); alt_result = alt_ctx.digest(); for (cnt = key.length; cnt > 32; cnt -= 32) { ctx.update(alt_result, 0, 32); } ctx.update(alt_result, 0, cnt); for (cnt = key.length; cnt > 0; cnt >>= 1) { if ((cnt & 1) != 0) { ctx.update(alt_result, 0, 32); } else { ctx.update(key, 0, key.length); } } alt_result = ctx.digest(); alt_ctx.reset(); for (cnt = 0; cnt < key.length; ++cnt) { alt_ctx.update(key, 0, key.length); } temp_result = alt_ctx.digest(); p_bytes = new byte[key.length]; for (cnt2 = 0, cnt = p_bytes.length; cnt >= 32; cnt -= 32) { System.arraycopy(temp_result, 0, p_bytes, cnt2, 32); cnt2 += 32; } System.arraycopy(temp_result, 0, p_bytes, cnt2, cnt); alt_ctx.reset(); for (cnt = 0; cnt < 16 + (alt_result[0]&0xFF); ++cnt) { alt_ctx.update(salt, 0, salt.length); } temp_result = alt_ctx.digest(); s_bytes = new byte[salt.length]; for (cnt2 = 0, cnt = s_bytes.length; cnt >= 32; cnt -= 32) { System.arraycopy(temp_result, 0, s_bytes, cnt2, 32); cnt2 += 32; } System.arraycopy(temp_result, 0, s_bytes, cnt2, cnt); for (cnt = 0; cnt < rounds; ++cnt) { ctx.reset(); if ((cnt & 1) != 0) { ctx.update(p_bytes, 0, key.length); } else { ctx.update (alt_result, 0, 32); } if (cnt % 3 != 0) { ctx.update(s_bytes, 0, salt.length); } if (cnt % 7 != 0) { ctx.update(p_bytes, 0, key.length); } if ((cnt & 1) != 0) { ctx.update(alt_result, 0, 32); } else { ctx.update(p_bytes, 0, key.length); } alt_result = ctx.digest(); } buffer = new StringBuilder(sha256_salt_prefix); if (include_round_count rounds != ROUNDS_DEFAULT) { buffer.append(sha256_rounds_prefix); buffer.append(rounds); buffer.append("$"); } buffer.append(saltStr); buffer.append("$"); buffer.append(b64_from_24bit (alt_result[0], alt_result[10], alt_result[20], 4)); buffer.append(b64_from_24bit (alt_result[21], alt_result[1], alt_result[11], 4)); buffer.append(b64_from_24bit (alt_result[12], alt_result[22], alt_result[2], 4)); buffer.append(b64_from_24bit (alt_result[3], alt_result[13], alt_result[23], 4)); buffer.append(b64_from_24bit (alt_result[24], alt_result[4], alt_result[14], 4)); buffer.append(b64_from_24bit (alt_result[15], alt_result[25], alt_result[5], 4)); buffer.append(b64_from_24bit (alt_result[6], alt_result[16], alt_result[26], 4)); buffer.append(b64_from_24bit (alt_result[27], alt_result[7], alt_result[17], 4)); buffer.append(b64_from_24bit (alt_result[18], alt_result[28], alt_result[8], 4)); buffer.append(b64_from_24bit (alt_result[9], alt_result[19], alt_result[29], 4)); buffer.append(b64_from_24bit ((byte)0x00, alt_result[31], alt_result[30], 3)); ctx.reset(); return buffer.toString(); }
/** * <p>This method actually generates an Sha256 crypted password hash * from a plaintext password and a salt.</p> * * <p>The resulting string will be in the form * '$5$&lt;rounds=n&gt;$&lt;salt&gt;$&lt;hashed mess&gt;</p> * * @param keyStr Plaintext password * * @param saltStr An encoded salt/roundes which will be consulted to determine the salt * and round count, if not null * * @param roundsCount If this value is not 0, this many rounds will * used to generate the hash text. * * @return The Sha256 Unix Crypt hash text for the keyStr */
This method actually generates an Sha256 crypted password hash from a plaintext password and a salt. The resulting string will be in the form '$5$&lt;rounds=n&gt;$&lt;salt&gt;$&lt;hashed mess&gt
Sha256_crypt
{ "repo_name": "nervepoint/identity4j", "path": "identity4j-utils/src/main/java/com/identity4j/util/unix/Sha256Crypt.java", "license": "lgpl-3.0", "size": 15478 }
[ "java.security.MessageDigest" ]
import java.security.MessageDigest;
import java.security.*;
[ "java.security" ]
java.security;
1,404,748
@AuthenticationStatus static int canAuthenticate( @NonNull android.hardware.biometrics.BiometricManager biometricManager) { return biometricManager.canAuthenticate(); } /** * Checks for and returns the hidden {@link android.hardware.biometrics.BiometricManager}
static int canAuthenticate( @NonNull android.hardware.biometrics.BiometricManager biometricManager) { return biometricManager.canAuthenticate(); } /** * Checks for and returns the hidden {@link android.hardware.biometrics.BiometricManager}
/** * Calls {@link android.hardware.biometrics.BiometricManager#canAuthenticate()} for the * given biometric manager. * * @param biometricManager An instance of * {@link android.hardware.biometrics.BiometricManager}. * @return The result of * {@link android.hardware.biometrics.BiometricManager#canAuthenticate()}. */
Calls <code>android.hardware.biometrics.BiometricManager#canAuthenticate()</code> for the given biometric manager
canAuthenticate
{ "repo_name": "AndroidX/androidx", "path": "biometric/biometric/src/main/java/androidx/biometric/BiometricManager.java", "license": "apache-2.0", "size": 47032 }
[ "androidx.annotation.NonNull" ]
import androidx.annotation.NonNull;
import androidx.annotation.*;
[ "androidx.annotation" ]
androidx.annotation;
1,501,718
public void testLinkedFileWithDifferentName() throws Exception { ResourceHelper.createWorkspaceFolder("OutsideFolder"); IPath realFile = ResourceHelper.createWorkspaceFile("OutsideFolder/RealFileWithDifferentName.c"); ResourceHelper.createFolder(fProject, "Folder"); ResourceHelper.createLinkedFile(fProject, "Folder/testLinkedFileWithDifferentName.c", realFile); parseOutput("RealFileWithDifferentName.c:1:error"); assertEquals(1, errorList.size()); ProblemMarkerInfo problemMarkerInfo = errorList.get(0); assertEquals("L/FindMatchingFilesTest/Folder/testLinkedFileWithDifferentName.c",problemMarkerInfo.file.toString()); assertEquals("error",problemMarkerInfo.description); }
void function() throws Exception { ResourceHelper.createWorkspaceFolder(STR); IPath realFile = ResourceHelper.createWorkspaceFile(STR); ResourceHelper.createFolder(fProject, STR); ResourceHelper.createLinkedFile(fProject, STR, realFile); parseOutput(STR); assertEquals(1, errorList.size()); ProblemMarkerInfo problemMarkerInfo = errorList.get(0); assertEquals(STR,problemMarkerInfo.file.toString()); assertEquals("error",problemMarkerInfo.description); }
/** * Checks if a file from error output can be found. * @throws Exception... */
Checks if a file from error output can be found
testLinkedFileWithDifferentName
{ "repo_name": "Yuerr14/RepeatedFixes", "path": "RepeatedFixes/misc/org/eclipse/cdt/core/internal/errorparsers/tests/ErrorParserFileMatchingTest.java", "license": "mit", "size": 60376 }
[ "org.eclipse.cdt.core.ProblemMarkerInfo", "org.eclipse.cdt.core.testplugin.ResourceHelper", "org.eclipse.core.runtime.IPath" ]
import org.eclipse.cdt.core.ProblemMarkerInfo; import org.eclipse.cdt.core.testplugin.ResourceHelper; import org.eclipse.core.runtime.IPath;
import org.eclipse.cdt.core.*; import org.eclipse.cdt.core.testplugin.*; import org.eclipse.core.runtime.*;
[ "org.eclipse.cdt", "org.eclipse.core" ]
org.eclipse.cdt; org.eclipse.core;
679,697
// Override this to use convertVector. public void setConvertVectorElement(int elementNum) throws IOException { throw new RuntimeException("Expected this method to be overriden"); }
void function(int elementNum) throws IOException { throw new RuntimeException(STR); }
/** * Override this to use convertVector. * Source and result are member variables in the subclass with the right * type. * @param elementNum * @throws IOException */
Override this to use convertVector. Source and result are member variables in the subclass with the right type
setConvertVectorElement
{ "repo_name": "pudidic/orc", "path": "java/core/src/java/org/apache/orc/impl/ConvertTreeReaderFactory.java", "license": "apache-2.0", "size": 100996 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
1,459,266
public static <T> Observable<T> toObservable(final FutureProvider<T> provider) { return Observable.create(new FutureProviderToStreamHandler<>(provider)); }
static <T> Observable<T> function(final FutureProvider<T> provider) { return Observable.create(new FutureProviderToStreamHandler<>(provider)); }
/** * creates new observable given future provider, * translating the future results into stream. * the sequence will be evaluated on subscribe. * * @param provider the future provider for translation * @param <T> the stream type * @return the stream */
creates new observable given future provider, translating the future results into stream. the sequence will be evaluated on subscribe
toObservable
{ "repo_name": "outbrain/ob1k", "path": "ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java", "license": "apache-2.0", "size": 33207 }
[ "com.outbrain.ob1k.concurrent.handlers.FutureProvider", "com.outbrain.ob1k.concurrent.stream.FutureProviderToStreamHandler" ]
import com.outbrain.ob1k.concurrent.handlers.FutureProvider; import com.outbrain.ob1k.concurrent.stream.FutureProviderToStreamHandler;
import com.outbrain.ob1k.concurrent.handlers.*; import com.outbrain.ob1k.concurrent.stream.*;
[ "com.outbrain.ob1k" ]
com.outbrain.ob1k;
2,562,417
public DataObjectModification<VtnNode> newMergeModification( VtnNodeBuildHelper before) { List<DataObjectModification<?>> children = new ArrayList<>(); Set<SalPort> oldPorts = before.getPortKeys(); for (Entry<SalPort, VtnPortBuildHelper> entry: portBuilders.entrySet()) { SalPort sport = entry.getKey(); VtnPortBuildHelper child = entry.getValue(); if (oldPorts.remove(sport)) { VtnPortBuildHelper old = before.getPort(sport); if (child.isChanged(old)) { children.add(child.newMergeModification(old)); } } else { children.add(child.newCreatedModification()); } } for (SalPort sport: oldPorts) { VtnPortBuildHelper old = before.getPort(sport); children.add(old.newDeletedModification()); } return newKeyedModification(before.build(), build(), children); }
DataObjectModification<VtnNode> function( VtnNodeBuildHelper before) { List<DataObjectModification<?>> children = new ArrayList<>(); Set<SalPort> oldPorts = before.getPortKeys(); for (Entry<SalPort, VtnPortBuildHelper> entry: portBuilders.entrySet()) { SalPort sport = entry.getKey(); VtnPortBuildHelper child = entry.getValue(); if (oldPorts.remove(sport)) { VtnPortBuildHelper old = before.getPort(sport); if (child.isChanged(old)) { children.add(child.newMergeModification(old)); } } else { children.add(child.newCreatedModification()); } } for (SalPort sport: oldPorts) { VtnPortBuildHelper old = before.getPort(sport); children.add(old.newDeletedModification()); } return newKeyedModification(before.build(), build(), children); }
/** * Create a new data object modification that represents changes of the * vtn-node made by merge operation. * * @param before A {@link VtnNodeBuildHelper} instance that indicates * the vtn-node value before modification. * @return A {@link DataObjectModification} instance. */
Create a new data object modification that represents changes of the vtn-node made by merge operation
newMergeModification
{ "repo_name": "opendaylight/vtn", "path": "manager/implementation/src/test/java/org/opendaylight/vtn/manager/internal/inventory/VtnNodeBuildHelper.java", "license": "epl-1.0", "size": 7702 }
[ "java.util.ArrayList", "java.util.List", "java.util.Map", "java.util.Set", "org.opendaylight.controller.md.sal.binding.api.DataObjectModification", "org.opendaylight.vtn.manager.internal.TestBase", "org.opendaylight.vtn.manager.internal.util.inventory.SalPort", "org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.inventory.rev150209.vtn.nodes.VtnNode" ]
import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.opendaylight.controller.md.sal.binding.api.DataObjectModification; import org.opendaylight.vtn.manager.internal.TestBase; import org.opendaylight.vtn.manager.internal.util.inventory.SalPort; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.inventory.rev150209.vtn.nodes.VtnNode;
import java.util.*; import org.opendaylight.controller.md.sal.binding.api.*; import org.opendaylight.vtn.manager.internal.*; import org.opendaylight.vtn.manager.internal.util.inventory.*; import org.opendaylight.yang.gen.v1.urn.opendaylight.vtn.impl.inventory.rev150209.vtn.nodes.*;
[ "java.util", "org.opendaylight.controller", "org.opendaylight.vtn", "org.opendaylight.yang" ]
java.util; org.opendaylight.controller; org.opendaylight.vtn; org.opendaylight.yang;
1,714,885
@XmlTransient public AgentStartConfiguration getAgentStartConfiguration() { if (this.agentStartConfiguration == null) { this.agentStartConfiguration = new AgentStartConfiguration(); this.setAgentStartConfigurationUpdated(); } return agentStartConfiguration; }
AgentStartConfiguration function() { if (this.agentStartConfiguration == null) { this.agentStartConfiguration = new AgentStartConfiguration(); this.setAgentStartConfigurationUpdated(); } return agentStartConfiguration; }
/** * Returns the agent configuration. * @return the agent configuration */
Returns the agent configuration
getAgentStartConfiguration
{ "repo_name": "EnFlexIT/AgentWorkbench", "path": "eclipseProjects/org.agentgui/bundles/org.agentgui.core/src/agentgui/core/project/Project.java", "license": "lgpl-2.1", "size": 78478 }
[ "de.enflexit.common.ontology.AgentStartConfiguration" ]
import de.enflexit.common.ontology.AgentStartConfiguration;
import de.enflexit.common.ontology.*;
[ "de.enflexit.common" ]
de.enflexit.common;
2,138,939
private void toStringWithChildren(StringBuffer buffer, int indent) { internalToString(buffer, indent); if (fChildren != null) { for (Iterator<TextEdit> iterator = fChildren.iterator(); iterator.hasNext(); ) { TextEdit child = iterator.next(); buffer.append('\n'); child.toStringWithChildren(buffer, indent + 1); } } } // ---- Copying -------------------------------------------------------------
void function(StringBuffer buffer, int indent) { internalToString(buffer, indent); if (fChildren != null) { for (Iterator<TextEdit> iterator = fChildren.iterator(); iterator.hasNext(); ) { TextEdit child = iterator.next(); buffer.append('\n'); child.toStringWithChildren(buffer, indent + 1); } } }
/** * Adds the string representation for this text edit and its children to the given string buffer. * * @param buffer * the string buffer * @param indent * the indent level in number of spaces * @since 3.3 */
Adds the string representation for this text edit and its children to the given string buffer
toStringWithChildren
{ "repo_name": "stour/che", "path": "plugins/plugin-java/che-plugin-java-ext-lang-client/src/main/java/org/eclipse/che/ide/ext/java/jdt/text/edits/TextEdit.java", "license": "epl-1.0", "size": 33384 }
[ "java.util.Iterator" ]
import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
87,168
Database getDatabase(String databaseName) throws NoSuchObjectException, MetaException, TException;
Database getDatabase(String databaseName) throws NoSuchObjectException, MetaException, TException;
/** * Get a Database Object * @param databaseName name of the database to fetch * @return the database * @throws NoSuchObjectException The database does not exist * @throws MetaException Could not fetch the database * @throws TException A thrift communication error occurred */
Get a Database Object
getDatabase
{ "repo_name": "WANdisco/amplab-hive", "path": "metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java", "license": "apache-2.0", "size": 53647 }
[ "org.apache.hadoop.hive.metastore.api.Database", "org.apache.hadoop.hive.metastore.api.MetaException", "org.apache.hadoop.hive.metastore.api.NoSuchObjectException", "org.apache.thrift.TException" ]
import org.apache.hadoop.hive.metastore.api.Database; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.NoSuchObjectException; import org.apache.thrift.TException;
import org.apache.hadoop.hive.metastore.api.*; import org.apache.thrift.*;
[ "org.apache.hadoop", "org.apache.thrift" ]
org.apache.hadoop; org.apache.thrift;
1,902,666
public List<Comment> getComments(User user, Integer page, Integer perPage) { URLBuilder url = new URLBuilder(host, "/api/comments/user.xml").addFieldValuePair("user_id", user.getId()); InputStream httpStream = httpConnection.doGet(url.toURL()); return resourceFactory.buildComments(httpStream); }
List<Comment> function(User user, Integer page, Integer perPage) { URLBuilder url = new URLBuilder(host, STR).addFieldValuePair(STR, user.getId()); InputStream httpStream = httpConnection.doGet(url.toURL()); return resourceFactory.buildComments(httpStream); }
/** * Find all comments for a specific user * * @param user * @param page * @param perPage * @return */
Find all comments for a specific user
getComments
{ "repo_name": "raupachz/raupach-me.com", "path": "src/main/java/org/beanstalk4j/BeanstalkApi.java", "license": "apache-2.0", "size": 38736 }
[ "java.io.InputStream", "java.util.List", "org.beanstalk4j.http.URLBuilder", "org.beanstalk4j.model.Comment", "org.beanstalk4j.model.User" ]
import java.io.InputStream; import java.util.List; import org.beanstalk4j.http.URLBuilder; import org.beanstalk4j.model.Comment; import org.beanstalk4j.model.User;
import java.io.*; import java.util.*; import org.beanstalk4j.http.*; import org.beanstalk4j.model.*;
[ "java.io", "java.util", "org.beanstalk4j.http", "org.beanstalk4j.model" ]
java.io; java.util; org.beanstalk4j.http; org.beanstalk4j.model;
1,105,854
public static void main(String... a) throws Exception { TestBase test = TestBase.createCaller().init(); test.config.big = true; test.test(); }
static void function(String... a) throws Exception { TestBase test = TestBase.createCaller().init(); test.config.big = true; test.test(); }
/** * Run just this test. * * @param a ignored */
Run just this test
main
{ "repo_name": "paulnguyen/data", "path": "sqldbs/h2java/src/test/org/h2/test/db/TestLob.java", "license": "apache-2.0", "size": 60495 }
[ "org.h2.test.TestBase" ]
import org.h2.test.TestBase;
import org.h2.test.*;
[ "org.h2.test" ]
org.h2.test;
668,878
public static void writeLines(File file, Collection<?> lines) throws IOException { writeLines(file, null, lines, null, false); }
static void function(File file, Collection<?> lines) throws IOException { writeLines(file, null, lines, null, false); }
/** * Writes the <code>toString()</code> value of each item in a collection to * the specified <code>File</code> line by line. * The default VM encoding and the default line ending will be used. * * @param file the file to write to * @param lines the lines to write, {@code null} entries produce blank lines * @throws IOException in case of an I/O error * @since 1.3 */
Writes the <code>toString()</code> value of each item in a collection to the specified <code>File</code> line by line. The default VM encoding and the default line ending will be used
writeLines
{ "repo_name": "wzx54321/XinFramework", "path": "app/src/main/java/com/xin/framework/xinframwork/utils/common/io/FileUtils.java", "license": "apache-2.0", "size": 107383 }
[ "java.io.File", "java.io.IOException", "java.util.Collection" ]
import java.io.File; import java.io.IOException; import java.util.Collection;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
266,930
public boolean attackEntityFrom(DamageSource source, float amount) { Entity entity = source.getEntity(); return this.isBeingRidden() && entity != null && this.isRidingOrBeingRiddenBy(entity) ? false : super.attackEntityFrom(source, amount); }
boolean function(DamageSource source, float amount) { Entity entity = source.getEntity(); return this.isBeingRidden() && entity != null && this.isRidingOrBeingRiddenBy(entity) ? false : super.attackEntityFrom(source, amount); }
/** * Called when the entity is attacked. */
Called when the entity is attacked
attackEntityFrom
{ "repo_name": "MartyParty21/AwakenDreamsClient", "path": "mcp/src/minecraft/net/minecraft/entity/passive/EntityHorse.java", "license": "gpl-3.0", "size": 60902 }
[ "net.minecraft.entity.Entity", "net.minecraft.util.DamageSource" ]
import net.minecraft.entity.Entity; import net.minecraft.util.DamageSource;
import net.minecraft.entity.*; import net.minecraft.util.*;
[ "net.minecraft.entity", "net.minecraft.util" ]
net.minecraft.entity; net.minecraft.util;
1,716,496
public void unread( final char[] buffer, final int offset, final int length ) throws IOException { // ensure preconditions ensureOpen(); if ( buffer == null ) { throw new IllegalArgumentException( "buffer cannot be null" ); } if ( offset < 0 ) { throw new IllegalArgumentException( "offset must be positive" ); } if ( length < 0 ) { throw new IllegalArgumentException( "length must be positive" ); } if ( length > ( buffer.length - offset ) ) { throw new IllegalArgumentException( "length must be less or equal to free space available in the buffer" ); } // method implementation if ( length == 0 ) { return; } if ( length > pushPosition ) { throw new IOException( "Pushback buffer is full" ); } pushPosition -= length; System.arraycopy( buffer, offset, pushBuffer, pushPosition, length ); }
void function( final char[] buffer, final int offset, final int length ) throws IOException { ensureOpen(); if ( buffer == null ) { throw new IllegalArgumentException( STR ); } if ( offset < 0 ) { throw new IllegalArgumentException( STR ); } if ( length < 0 ) { throw new IllegalArgumentException( STR ); } if ( length > ( buffer.length - offset ) ) { throw new IllegalArgumentException( STR ); } if ( length == 0 ) { return; } if ( length > pushPosition ) { throw new IOException( STR ); } pushPosition -= length; System.arraycopy( buffer, offset, pushBuffer, pushPosition, length ); }
/** * Push back <B>length</B> characters from this buffer starting from specified <B>offset</B> position * so these are visible to next read attempts. * * @param buffer holding characters to be pushed back * @param offset to start copy from * @param length count of characters to process * @throws IOException if some I/O error occurs */
Push back length characters from this buffer starting from specified offset position so these are visible to next read attempts
unread
{ "repo_name": "fossnova/io", "path": "src/main/java/org/fossnova/io/PushbackReader.java", "license": "lgpl-2.1", "size": 12226 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
755,569
private void queueReportedBlock(DatanodeStorageInfo storageInfo, Block block, ReplicaState reportedState, String reason) { assert shouldPostponeBlocksFromFuture; if (LOG.isDebugEnabled()) { LOG.debug("Queueing reported block " + block + " in state " + reportedState + " from datanode " + storageInfo.getDatanodeDescriptor() + " for later processing because " + reason + "."); } pendingDNMessages.enqueueReportedBlock(storageInfo, block, reportedState); }
void function(DatanodeStorageInfo storageInfo, Block block, ReplicaState reportedState, String reason) { assert shouldPostponeBlocksFromFuture; if (LOG.isDebugEnabled()) { LOG.debug(STR + block + STR + reportedState + STR + storageInfo.getDatanodeDescriptor() + STR + reason + "."); } pendingDNMessages.enqueueReportedBlock(storageInfo, block, reportedState); }
/** * Queue the given reported block for later processing in the * standby node. @see PendingDataNodeMessages. * @param reason a textual reason to report in the debug logs */
Queue the given reported block for later processing in the standby node. @see PendingDataNodeMessages
queueReportedBlock
{ "repo_name": "busbey/hadoop", "path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java", "license": "apache-2.0", "size": 148493 }
[ "org.apache.hadoop.hdfs.protocol.Block", "org.apache.hadoop.hdfs.server.common.HdfsServerConstants" ]
import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.common.*;
[ "org.apache.hadoop" ]
org.apache.hadoop;
2,724,861
@Override public Time getTime( int parameterIndex ) throws SQLException { return realCallableStatement.getTime( parameterIndex ); }
Time function( int parameterIndex ) throws SQLException { return realCallableStatement.getTime( parameterIndex ); }
/** * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a * <code>java.sql.Time</code> object. * * @param parameterIndex the first parameter is 1, the second is 2, * and so on * @return the parameter value. If the value is SQL <code>NULL</code>, the result * is <code>null</code>. * @throws SQLException if the parameterIndex is not valid; * if a database access error occurs or * this method is called on a closed <code>CallableStatement</code> * @see #setTime */
Retrieves the value of the designated JDBC <code>TIME</code> parameter as a <code>java.sql.Time</code> object
getTime
{ "repo_name": "mattyb149/pentaho-orientdb-jdbc", "path": "src/main/java/org/pentaho/community/di/database/orientdb/delegate/DelegateCallableStatement.java", "license": "apache-2.0", "size": 266443 }
[ "java.sql.SQLException", "java.sql.Time" ]
import java.sql.SQLException; import java.sql.Time;
import java.sql.*;
[ "java.sql" ]
java.sql;
567,407
public T ognl(String text) { return expression(new OgnlExpression(text)); }
T function(String text) { return expression(new OgnlExpression(text)); }
/** * Evaluates an <a href="http://camel.apache.org/ognl.html">OGNL * expression</a> * * @param text the expression to be evaluated * @return the builder to continue processing the DSL */
Evaluates an OGNL expression
ognl
{ "repo_name": "engagepoint/camel", "path": "camel-core/src/main/java/org/apache/camel/builder/ExpressionClauseSupport.java", "license": "apache-2.0", "size": 26802 }
[ "org.apache.camel.model.language.OgnlExpression" ]
import org.apache.camel.model.language.OgnlExpression;
import org.apache.camel.model.language.*;
[ "org.apache.camel" ]
org.apache.camel;
1,179,573
public static void renderChildren(FacesContext fc, UIComponent component) throws IOException { for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
static void function(FacesContext fc, UIComponent component) throws IOException { for (Iterator<UIComponent> iterator = component.getChildren().iterator(); iterator.hasNext();) { UIComponent child = (UIComponent) iterator.next(); renderChild(fc, child); } }
/** * Renders the Childrens of a Component * * @param fc * @param component * @throws IOException */
Renders the Childrens of a Component
renderChildren
{ "repo_name": "mtvweb/BootsFaces-OSP", "path": "src/main/java/net/bootsfaces/render/R.java", "license": "apache-2.0", "size": 9704 }
[ "java.io.IOException", "java.util.Iterator", "javax.faces.component.UIComponent", "javax.faces.context.FacesContext" ]
import java.io.IOException; import java.util.Iterator; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext;
import java.io.*; import java.util.*; import javax.faces.component.*; import javax.faces.context.*;
[ "java.io", "java.util", "javax.faces" ]
java.io; java.util; javax.faces;
153,883
@ExceptionHandler( MethodArgumentNotValidException.class ) @ResponseStatus( HttpStatus.BAD_REQUEST ) @ResponseBody public ValidationError processValidationError( MethodArgumentNotValidException exeption ) { return this.processFieldErrors( exeption.getBindingResult().getFieldErrors() ); }
@ExceptionHandler( MethodArgumentNotValidException.class ) @ResponseStatus( HttpStatus.BAD_REQUEST ) ValidationError function( MethodArgumentNotValidException exeption ) { return this.processFieldErrors( exeption.getBindingResult().getFieldErrors() ); }
/** * Handle validation errors. * * @param exeption Object that contain description for this exception. * * @return ValidationError Object for response about error. */
Handle validation errors
processValidationError
{ "repo_name": "coffeine-009/Virtuoso", "path": "src/main/java/com/thecoffeine/virtuoso/error/controller/ErrorController.java", "license": "mit", "size": 4570 }
[ "com.thecoffeine.virtuoso.error.model.entity.ValidationError", "org.springframework.http.HttpStatus", "org.springframework.web.bind.MethodArgumentNotValidException", "org.springframework.web.bind.annotation.ExceptionHandler", "org.springframework.web.bind.annotation.ResponseStatus" ]
import com.thecoffeine.virtuoso.error.model.entity.ValidationError; import org.springframework.http.HttpStatus; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ResponseStatus;
import com.thecoffeine.virtuoso.error.model.entity.*; import org.springframework.http.*; import org.springframework.web.bind.*; import org.springframework.web.bind.annotation.*;
[ "com.thecoffeine.virtuoso", "org.springframework.http", "org.springframework.web" ]
com.thecoffeine.virtuoso; org.springframework.http; org.springframework.web;
1,440,249
public void setWhenNoDataType(WhenNoDataTypeEnum whenNoDataType);
void function(WhenNoDataTypeEnum whenNoDataType);
/** * Sets the report behavior in case of empty datasources. */
Sets the report behavior in case of empty datasources
setWhenNoDataType
{ "repo_name": "sikachu/jasperreports", "path": "src/net/sf/jasperreports/engine/JRReport.java", "license": "lgpl-3.0", "size": 7989 }
[ "net.sf.jasperreports.engine.type.WhenNoDataTypeEnum" ]
import net.sf.jasperreports.engine.type.WhenNoDataTypeEnum;
import net.sf.jasperreports.engine.type.*;
[ "net.sf.jasperreports" ]
net.sf.jasperreports;
2,827,171
public static void enableFullscreenFlags( Resources resources, Context context, int resControlContainerHeight) { ContentApplication.initCommandLine(context); CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return; TypedValue threshold = new TypedValue(); resources.getValue(R.dimen.top_controls_show_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString()); resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString()); }
static void function( Resources resources, Context context, int resControlContainerHeight) { ContentApplication.initCommandLine(context); CommandLine commandLine = CommandLine.getInstance(); if (commandLine.hasSwitch(ChromeSwitches.DISABLE_FULLSCREEN)) return; TypedValue threshold = new TypedValue(); resources.getValue(R.dimen.top_controls_show_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_SHOW_THRESHOLD, threshold.coerceToString().toString()); resources.getValue(R.dimen.top_controls_hide_threshold, threshold, true); commandLine.appendSwitchWithValue( ContentSwitches.TOP_CONTROLS_HIDE_THRESHOLD, threshold.coerceToString().toString()); }
/** * Enable fullscreen related startup flags. * @param resources Resources to use while calculating initialization constants. * @param resControlContainerHeight The resource id for the height of the top controls. */
Enable fullscreen related startup flags
enableFullscreenFlags
{ "repo_name": "vadimtk/chrome4sdp", "path": "chrome/android/java/src/org/chromium/chrome/browser/ApplicationInitialization.java", "license": "bsd-3-clause", "size": 1749 }
[ "android.content.Context", "android.content.res.Resources", "android.util.TypedValue", "org.chromium.base.CommandLine", "org.chromium.content.app.ContentApplication", "org.chromium.content.common.ContentSwitches" ]
import android.content.Context; import android.content.res.Resources; import android.util.TypedValue; import org.chromium.base.CommandLine; import org.chromium.content.app.ContentApplication; import org.chromium.content.common.ContentSwitches;
import android.content.*; import android.content.res.*; import android.util.*; import org.chromium.base.*; import org.chromium.content.app.*; import org.chromium.content.common.*;
[ "android.content", "android.util", "org.chromium.base", "org.chromium.content" ]
android.content; android.util; org.chromium.base; org.chromium.content;
510,694
protected ResultSet getEFactors(Connection connection) throws SQLException { String query = "SELECT ep.experiment_id, ep.name, ep.value, ep.rank " + " FROM experiment_prop ep " + " where ep.name = 'Experimental Factor Name' " + " OR ep.name = 'Experimental Factor Type' " + " ORDER BY 1,4,2"; return doQuery(connection, query, "getEFactors"); }
ResultSet function(Connection connection) throws SQLException { String query = STR + STR + STR + STR + STR; return doQuery(connection, query, STR); }
/** * Return the rows needed for the experimental factors. * This is a protected method so that it can be overridden for testing * * @param connection the db connection * @return the SQL result set * @throws SQLException if a database problem occurs */
Return the rows needed for the experimental factors. This is a protected method so that it can be overridden for testing
getEFactors
{ "repo_name": "tomck/intermine", "path": "bio/sources/chado-db/main/src/org/intermine/bio/dataconversion/ModEncodeMetaDataProcessor.java", "license": "lgpl-2.1", "size": 176582 }
[ "java.sql.Connection", "java.sql.ResultSet", "java.sql.SQLException" ]
import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException;
import java.sql.*;
[ "java.sql" ]
java.sql;
2,873,465
public APIResult schedule( @Context HttpServletRequest request, @Dimension("entityType") @PathParam("type") String type, @Dimension("entityName") @PathParam("entity") String entity, @Dimension("colo") @PathParam("colo") String colo) { checkColo(colo); try { audit(request, entity, type, "SCHEDULED"); scheduleInternal(type, entity); return new APIResult(APIResult.Status.SUCCEEDED, entity + "(" + type + ") scheduled successfully"); } catch (Throwable e) { LOG.error("Unable to schedule workflow", e); throw FalconWebException.newException(e, Response.Status.BAD_REQUEST); } }
APIResult function( @Context HttpServletRequest request, @Dimension(STR) @PathParam("type") String type, @Dimension(STR) @PathParam(STR) String entity, @Dimension("colo") @PathParam("colo") String colo) { checkColo(colo); try { audit(request, entity, type, STR); scheduleInternal(type, entity); return new APIResult(APIResult.Status.SUCCEEDED, entity + "(" + type + STR); } catch (Throwable e) { LOG.error(STR, e); throw FalconWebException.newException(e, Response.Status.BAD_REQUEST); } }
/** * Schedules an submitted entity immediately. * * @param type * @param entity * @return APIResult */
Schedules an submitted entity immediately
schedule
{ "repo_name": "InMobi/incubator-falcon", "path": "prism/src/main/java/org/apache/falcon/resource/AbstractSchedulableEntityManager.java", "license": "apache-2.0", "size": 7430 }
[ "javax.servlet.http.HttpServletRequest", "javax.ws.rs.PathParam", "javax.ws.rs.core.Context", "javax.ws.rs.core.Response", "org.apache.falcon.FalconWebException", "org.apache.falcon.monitors.Dimension" ]
import javax.servlet.http.HttpServletRequest; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import org.apache.falcon.FalconWebException; import org.apache.falcon.monitors.Dimension;
import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.falcon.*; import org.apache.falcon.monitors.*;
[ "javax.servlet", "javax.ws", "org.apache.falcon" ]
javax.servlet; javax.ws; org.apache.falcon;
1,720,192
private static void setDateHeader(FullHttpResponse response) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); dateFormatter.setTimeZone(TimeZone.getTimeZone(HTTP_DATE_GMT_TIMEZONE)); Calendar time = new GregorianCalendar(); response.headers().set(DATE, dateFormatter.format(time.getTime())); }
static void function(FullHttpResponse response) { SimpleDateFormat dateFormatter = new SimpleDateFormat(HTTP_DATE_FORMAT, Locale.US); dateFormatter.setTimeZone(TimeZone.getTimeZone(HTTP_DATE_GMT_TIMEZONE)); Calendar time = new GregorianCalendar(); response.headers().set(DATE, dateFormatter.format(time.getTime())); }
/** * Sets the Date header for the HTTP response * * @param response * HTTP response */
Sets the Date header for the HTTP response
setDateHeader
{ "repo_name": "camunda/camunda-bpm-workbench", "path": "api/debug-service-websocket/src/main/java/org/camunda/bpm/debugger/server/netty/staticresource/HttpClasspathServerHandler.java", "license": "agpl-3.0", "size": 9959 }
[ "io.netty.handler.codec.http.FullHttpResponse", "java.text.SimpleDateFormat", "java.util.Calendar", "java.util.GregorianCalendar", "java.util.Locale", "java.util.TimeZone" ]
import io.netty.handler.codec.http.FullHttpResponse; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Locale; import java.util.TimeZone;
import io.netty.handler.codec.http.*; import java.text.*; import java.util.*;
[ "io.netty.handler", "java.text", "java.util" ]
io.netty.handler; java.text; java.util;
564,057
public void write(int cc) throws IOException { final byte c = (byte) cc; BufferInfo bufferInfo = getBufferInfo(); if (c == '\n') { // LF is always end of line (i.e. CRLF or single LF) bufferInfo.buffer.write(cc); processBuffer(bufferInfo.buffer); } else { if (bufferInfo.crSeen) { // CR without LF - send buffer then add char processBuffer(bufferInfo.buffer); } // add into buffer bufferInfo.buffer.write(cc); } bufferInfo.crSeen = (c == '\r'); if (!bufferInfo.crSeen && bufferInfo.buffer.size() > MAX_SIZE) { processBuffer(bufferInfo.buffer); } }
void function(int cc) throws IOException { final byte c = (byte) cc; BufferInfo bufferInfo = getBufferInfo(); if (c == '\n') { bufferInfo.buffer.write(cc); processBuffer(bufferInfo.buffer); } else { if (bufferInfo.crSeen) { processBuffer(bufferInfo.buffer); } bufferInfo.buffer.write(cc); } bufferInfo.crSeen = (c == '\r'); if (!bufferInfo.crSeen && bufferInfo.buffer.size() > MAX_SIZE) { processBuffer(bufferInfo.buffer); } }
/** * Writes the data to the buffer and flushes the buffer if a line * separator is detected or if the buffer has reached its maximum size. * * @param cc data to log (byte). * @exception IOException if the data cannot be written to the stream */
Writes the data to the buffer and flushes the buffer if a line separator is detected or if the buffer has reached its maximum size
write
{ "repo_name": "Mayo-WE01051879/mayosapp", "path": "Build/src/main/org/apache/tools/ant/DemuxOutputStream.java", "license": "mit", "size": 8029 }
[ "java.io.IOException" ]
import java.io.IOException;
import java.io.*;
[ "java.io" ]
java.io;
2,122,008
@Test public void testUpdate() throws ConvocatoriaException { int codigo = 0; Convocatoria expected = sc.getById(0); expected.setNombre("Segunda"); sc.update(expected); Convocatoria actual = sc.getById(codigo); // pongo .getCodigo() porque NO tengo implementado el metodo equals en Convocatoria Assert.assertEquals("La convocatoria de codigo: " + expected.getCodigo() + " no coincide.", expected.getCodigo(), actual.getCodigo()); }
void function() throws ConvocatoriaException { int codigo = 0; Convocatoria expected = sc.getById(0); expected.setNombre(STR); sc.update(expected); Convocatoria actual = sc.getById(codigo); Assert.assertEquals(STR + expected.getCodigo() + STR, expected.getCodigo(), actual.getCodigo()); }
/** * Se comprobara que se actualizan correctamete los datos que se cambian en la convocatoria * * @throws ConvocatoriaException */
Se comprobara que se actualizan correctamete los datos que se cambian en la convocatoria
testUpdate
{ "repo_name": "airamg/gestoralumnos", "path": "test/com/ipartek/formacion/service/ConvocatoriaServiceTest.java", "license": "mit", "size": 2919 }
[ "com.ipartek.formacion.bean.Convocatoria", "com.ipartek.formacion.exceptions.ConvocatoriaException", "org.junit.Assert" ]
import com.ipartek.formacion.bean.Convocatoria; import com.ipartek.formacion.exceptions.ConvocatoriaException; import org.junit.Assert;
import com.ipartek.formacion.bean.*; import com.ipartek.formacion.exceptions.*; import org.junit.*;
[ "com.ipartek.formacion", "org.junit" ]
com.ipartek.formacion; org.junit;
154,522
public void serialize(InfoflowResults results, String fileName) throws FileNotFoundException, XMLStreamException { OutputStream out = new FileOutputStream(fileName); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement(XmlConstants.Tags.root); writer.writeAttribute(XmlConstants.Attributes.fileFormatVersion, FILE_FORMAT_VERSION + ""); writer.writeStartElement(XmlConstants.Tags.results); writeDataFlows(results, writer); writer.writeEndElement(); writer.writeEndDocument(); writer.close(); }
void function(InfoflowResults results, String fileName) throws FileNotFoundException, XMLStreamException { OutputStream out = new FileOutputStream(fileName); XMLOutputFactory factory = XMLOutputFactory.newInstance(); XMLStreamWriter writer = factory.createXMLStreamWriter(out); writer.writeStartDocument(); writer.writeStartElement(XmlConstants.Tags.root); writer.writeAttribute(XmlConstants.Attributes.fileFormatVersion, FILE_FORMAT_VERSION + ""); writer.writeStartElement(XmlConstants.Tags.results); writeDataFlows(results, writer); writer.writeEndElement(); writer.writeEndDocument(); writer.close(); }
/** * Serializes the given FlowDroid result object into the given file * @param results The result object to serialize * @param fileName The target file name * @throws FileNotFoundException Thrown if target file cannot be used * @throws XMLStreamException Thrown if the XML data cannot be written */
Serializes the given FlowDroid result object into the given file
serialize
{ "repo_name": "jgarci40/soot-infoflow", "path": "src/soot/jimple/infoflow/results/xml/InfoflowResultsSerializer.java", "license": "lgpl-2.1", "size": 6912 }
[ "java.io.FileNotFoundException", "java.io.FileOutputStream", "java.io.OutputStream", "javax.xml.stream.XMLOutputFactory", "javax.xml.stream.XMLStreamException", "javax.xml.stream.XMLStreamWriter" ]
import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStream; import javax.xml.stream.XMLOutputFactory; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter;
import java.io.*; import javax.xml.stream.*;
[ "java.io", "javax.xml" ]
java.io; javax.xml;
1,494,475
public interface OnChildScrollUpCallback { boolean canChildScrollUp(@NonNull SwipeRefreshLayout parent, @Nullable View child); }
interface OnChildScrollUpCallback { boolean function(@NonNull SwipeRefreshLayout parent, @Nullable View child); }
/** * Callback that will be called when {@link SwipeRefreshLayout#canChildScrollUp()} method * is called to allow the implementer to override its behavior. * * @param parent SwipeRefreshLayout that this callback is overriding. * @param child The child view of SwipeRefreshLayout. * * @return Whether it is possible for the child view of parent layout to scroll up. */
Callback that will be called when <code>SwipeRefreshLayout#canChildScrollUp()</code> method is called to allow the implementer to override its behavior
canChildScrollUp
{ "repo_name": "AndroidX/androidx", "path": "swiperefreshlayout/swiperefreshlayout/src/main/java/androidx/swiperefreshlayout/widget/SwipeRefreshLayout.java", "license": "apache-2.0", "size": 54426 }
[ "android.view.View", "androidx.annotation.NonNull", "androidx.annotation.Nullable" ]
import android.view.View; import androidx.annotation.NonNull; import androidx.annotation.Nullable;
import android.view.*; import androidx.annotation.*;
[ "android.view", "androidx.annotation" ]
android.view; androidx.annotation;
750,077
@Override protected void setDefaultLayerStyle(ConfigManager configManager, WMSLayerConfig layer) { List<LayerStyleConfig> styles = layer.getStyles(); if (styles != null && !styles.isEmpty()) { styles.get(0).setDefault(true); } }
void function(ConfigManager configManager, WMSLayerConfig layer) { List<LayerStyleConfig> styles = layer.getStyles(); if (styles != null && !styles.isEmpty()) { styles.get(0).setDefault(true); } }
/** * Set default styles * The default style is always the first one. * @param configManager * @param layer */
Set default styles The default style is always the first one
setDefaultLayerStyle
{ "repo_name": "atlasmapper/atlasmapper", "path": "src/main/java/au/gov/aims/atlasmapperserver/layerGenerator/WMSLayerGenerator.java", "license": "gpl-3.0", "size": 1937 }
[ "au.gov.aims.atlasmapperserver.ConfigManager", "au.gov.aims.atlasmapperserver.layerConfig.LayerStyleConfig", "au.gov.aims.atlasmapperserver.layerConfig.WMSLayerConfig", "java.util.List" ]
import au.gov.aims.atlasmapperserver.ConfigManager; import au.gov.aims.atlasmapperserver.layerConfig.LayerStyleConfig; import au.gov.aims.atlasmapperserver.layerConfig.WMSLayerConfig; import java.util.List;
import au.gov.aims.atlasmapperserver.*; import java.util.*;
[ "au.gov.aims", "java.util" ]
au.gov.aims; java.util;
1,822,475
public boolean matches(Item item) throws RepositoryException { return true; } /** * {@inheritDoc}
boolean function(Item item) throws RepositoryException { return true; } /** * {@inheritDoc}
/** * Returns {@code true}. Subclasses can override to implement something * useful that is dependant of the depth. * * @param item the item to match * @return {@code true} if the item matches; {@code false} otherwise. * @throws RepositoryException if an error occurs. */
Returns true. Subclasses can override to implement something useful that is dependant of the depth
matches
{ "repo_name": "tripodsan/jackrabbit-filevault", "path": "vault-core/src/main/java/org/apache/jackrabbit/vault/fs/filter/DepthItemFilter.java", "license": "apache-2.0", "size": 3188 }
[ "javax.jcr.Item", "javax.jcr.RepositoryException" ]
import javax.jcr.Item; import javax.jcr.RepositoryException;
import javax.jcr.*;
[ "javax.jcr" ]
javax.jcr;
78,011
private Map<ItemSimple, Set<Integer>> findSequencesContainingItems(SequenceDatabase contexte) { // the following set is to remember if an item was already seen for a sequence Set<Integer> alreadyCounted = new HashSet<Integer>(); // The latest sequence that was scanned Sequence lastSequence = null; // We use a map to store the sequence IDs where an item appear // Key : item Value : a set of sequence IDs Map<ItemSimple, Set<Integer>> mapSequenceID = new HashMap<ItemSimple, Set<Integer>>(); // for each sequence for(Sequence sequence : contexte.getSequences()){ // If we scan a new sequence (with a different id), // then reset the set of items that we have seen... if(lastSequence == null || lastSequence.getId() != sequence.getId()){ // FIX alreadyCounted.clear(); lastSequence = sequence; } // for each itemset in that sequence for(Itemset itemset : sequence.getItemsets()){ // for each item for(ItemSimple item : itemset.getItems()){ // if we have not seen this item yet for that sequence if(!alreadyCounted.contains(item.getId())){ // get the set of sequence ids for that item Set<Integer> sequenceIDs = mapSequenceID.get(item); if(sequenceIDs == null){ // if null create a new set sequenceIDs = new HashSet<Integer>(); mapSequenceID.put(item, sequenceIDs); } // add the current sequence id to this set sequenceIDs.add(sequence.getId()); // remember that we have seen this item alreadyCounted.add(item.getId()); } } } } // return the map return mapSequenceID; }
Map<ItemSimple, Set<Integer>> function(SequenceDatabase contexte) { Set<Integer> alreadyCounted = new HashSet<Integer>(); Sequence lastSequence = null; Map<ItemSimple, Set<Integer>> mapSequenceID = new HashMap<ItemSimple, Set<Integer>>(); for(Sequence sequence : contexte.getSequences()){ if(lastSequence == null lastSequence.getId() != sequence.getId()){ alreadyCounted.clear(); lastSequence = sequence; } for(Itemset itemset : sequence.getItemsets()){ for(ItemSimple item : itemset.getItems()){ if(!alreadyCounted.contains(item.getId())){ Set<Integer> sequenceIDs = mapSequenceID.get(item); if(sequenceIDs == null){ sequenceIDs = new HashSet<Integer>(); mapSequenceID.put(item, sequenceIDs); } sequenceIDs.add(sequence.getId()); alreadyCounted.add(item.getId()); } } } } return mapSequenceID; }
/** * For each item, calculate the sequence id of sequences containing that item * @param database the current sequence database * @return Map of items to sequence IDs that contains each item */
For each item, calculate the sequence id of sequences containing that item
findSequencesContainingItems
{ "repo_name": "dragonzhou/humor", "path": "src/ca/pfv/spmf/algorithms/sequentialpatterns/fournier2008_seqdim/AlgoFournierViger08.java", "license": "apache-2.0", "size": 48661 }
[ "java.util.HashMap", "java.util.HashSet", "java.util.Map", "java.util.Set" ]
import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
662,450
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorFromQuestionInSection( String feedbackSessionName, String courseId, String userEmail, String questionId, String selectedSection) throws EntityDoesNotExistException { CourseRoster roster = new CourseRoster( studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId)); Map<String, String> params = new HashMap<String, String>(); params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true"); params.put(PARAM_IN_SECTION, "true"); params.put(PARAM_FROM_SECTION, "false"); params.put(PARAM_TO_SECTION, "false"); params.put(PARAM_QUESTION_ID, questionId); params.put(PARAM_SECTION, selectedSection); return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params); }
FeedbackSessionResultsBundle function( String feedbackSessionName, String courseId, String userEmail, String questionId, String selectedSection) throws EntityDoesNotExistException { CourseRoster roster = new CourseRoster( studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId)); Map<String, String> params = new HashMap<String, String>(); params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true"); params.put(PARAM_IN_SECTION, "true"); params.put(PARAM_FROM_SECTION, "false"); params.put(PARAM_TO_SECTION, "false"); params.put(PARAM_QUESTION_ID, questionId); params.put(PARAM_SECTION, selectedSection); return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params); }
/** * Gets results of a feedback session to show to an instructor from an indicated question * and in a section. * This will not retrieve the list of comments for this question. */
Gets results of a feedback session to show to an instructor from an indicated question and in a section. This will not retrieve the list of comments for this question
getFeedbackSessionResultsForInstructorFromQuestionInSection
{ "repo_name": "aacoba/teammates", "path": "src/main/java/teammates/logic/core/FeedbackSessionsLogic.java", "license": "gpl-2.0", "size": 118079 }
[ "java.util.HashMap", "java.util.Map" ]
import java.util.HashMap; import java.util.Map;
import java.util.*;
[ "java.util" ]
java.util;
2,694,418
public void beforeExchange(GridDhtPartitionsExchangeFuture exchFut, boolean affReady) throws IgniteCheckedException;
void function(GridDhtPartitionsExchangeFuture exchFut, boolean affReady) throws IgniteCheckedException;
/** * Pre-initializes this topology. * * @param exchFut Exchange future. * @param affReady Affinity ready flag. * @throws IgniteCheckedException If failed. */
Pre-initializes this topology
beforeExchange
{ "repo_name": "a1vanov/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/GridDhtPartitionTopology.java", "license": "apache-2.0", "size": 10591 }
[ "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture" ]
import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.GridDhtPartitionsExchangeFuture;
import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.distributed.dht.preloader.*;
[ "org.apache.ignite" ]
org.apache.ignite;
917,598
private void writeSetOrAppendMembersToXml(EwsServiceXmlWriter writer, List<GroupMember> members, boolean setMode) throws Exception { if (!members.isEmpty()) { writer.writeStartElement(XmlNamespace.Types, setMode ? XmlElementNames.SetItemField : XmlElementNames.AppendToItemField); ContactGroupSchema.Members.writeToXml(writer); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.DistributionList); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.Members); for (GroupMember member : members) { member.writeToXml(writer, XmlElementNames.Member); } writer.writeEndElement(); // Members writer.writeEndElement(); // Group writer.writeEndElement(); // setMode ? SetItemField : // AppendItemField } }
void function(EwsServiceXmlWriter writer, List<GroupMember> members, boolean setMode) throws Exception { if (!members.isEmpty()) { writer.writeStartElement(XmlNamespace.Types, setMode ? XmlElementNames.SetItemField : XmlElementNames.AppendToItemField); ContactGroupSchema.Members.writeToXml(writer); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.DistributionList); writer.writeStartElement(XmlNamespace.Types, XmlElementNames.Members); for (GroupMember member : members) { member.writeToXml(writer, XmlElementNames.Member); } writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); } }
/** * Write set or append members to xml. * * @param writer * the writer * @param members * the members * @param setMode * the set mode * @throws Exception * the exception */
Write set or append members to xml
writeSetOrAppendMembersToXml
{ "repo_name": "daitangio/exchangews", "path": "src/main/java/microsoft/exchange/webservices/data/GroupMemberCollection.java", "license": "lgpl-3.0", "size": 14131 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
244,508
public void setCreatedDate(Date createdDate) throws CharonException { //create the created date attribute as defined in schema. SimpleAttribute createdDateAttribute = new SimpleAttribute( SCIMConstants.CommonSchemaConstants.CREATED, null, createdDate, DataType.DATE_TIME, true, false); createdDateAttribute = (SimpleAttribute) DefaultAttributeFactory.createAttribute( SCIMSchemaDefinitions.CREATED, createdDateAttribute); //check meta complex attribute already exist. if (getMetaAttribute() != null) { ComplexAttribute metaAttribute = getMetaAttribute(); //check created date attribute already exist if (metaAttribute.isSubAttributeExist(createdDateAttribute.getName())) { //log info level log that created date already set and can't set again. throw new CharonException(ResponseCodeConstants.ATTRIBUTE_READ_ONLY); } else { metaAttribute.setSubAttribute(createdDateAttribute); } } else { //create meta attribute and set the sub attribute. createMetaAttribute(); getMetaAttribute().setSubAttribute(createdDateAttribute); } }
void function(Date createdDate) throws CharonException { SimpleAttribute createdDateAttribute = new SimpleAttribute( SCIMConstants.CommonSchemaConstants.CREATED, null, createdDate, DataType.DATE_TIME, true, false); createdDateAttribute = (SimpleAttribute) DefaultAttributeFactory.createAttribute( SCIMSchemaDefinitions.CREATED, createdDateAttribute); if (getMetaAttribute() != null) { ComplexAttribute metaAttribute = getMetaAttribute(); if (metaAttribute.isSubAttributeExist(createdDateAttribute.getName())) { throw new CharonException(ResponseCodeConstants.ATTRIBUTE_READ_ONLY); } else { metaAttribute.setSubAttribute(createdDateAttribute); } } else { createMetaAttribute(); getMetaAttribute().setSubAttribute(createdDateAttribute); } }
/** * Set created date sub attribute of Meta attribute. * * @param createdDate * @throws org.wso2.charon.core.exceptions.CharonException * */
Set created date sub attribute of Meta attribute
setCreatedDate
{ "repo_name": "maheshika/charon", "path": "modules/charon-core/src/main/java/org/wso2/charon/core/objects/AbstractSCIMObject.java", "license": "apache-2.0", "size": 17826 }
[ "java.util.Date", "org.wso2.charon.core.attributes.ComplexAttribute", "org.wso2.charon.core.attributes.DefaultAttributeFactory", "org.wso2.charon.core.attributes.SimpleAttribute", "org.wso2.charon.core.exceptions.CharonException", "org.wso2.charon.core.protocol.ResponseCodeConstants", "org.wso2.charon.core.schema.SCIMConstants", "org.wso2.charon.core.schema.SCIMSchemaDefinitions" ]
import java.util.Date; import org.wso2.charon.core.attributes.ComplexAttribute; import org.wso2.charon.core.attributes.DefaultAttributeFactory; import org.wso2.charon.core.attributes.SimpleAttribute; import org.wso2.charon.core.exceptions.CharonException; import org.wso2.charon.core.protocol.ResponseCodeConstants; import org.wso2.charon.core.schema.SCIMConstants; import org.wso2.charon.core.schema.SCIMSchemaDefinitions;
import java.util.*; import org.wso2.charon.core.attributes.*; import org.wso2.charon.core.exceptions.*; import org.wso2.charon.core.protocol.*; import org.wso2.charon.core.schema.*;
[ "java.util", "org.wso2.charon" ]
java.util; org.wso2.charon;
2,829,742
public IToken nextToken() { IToken token; while (true) { fTokenOffset = fOffset; fColumn = UNDEFINED; for (int i = 0; i < fRules.length; i++) { token = (fRules[i].evaluate(this)); if (!token.isUndefined()) return token; } if (read() == EOF) return Token.EOF; else return fDefaultToken; } }
IToken function() { IToken token; while (true) { fTokenOffset = fOffset; fColumn = UNDEFINED; for (int i = 0; i < fRules.length; i++) { token = (fRules[i].evaluate(this)); if (!token.isUndefined()) return token; } if (read() == EOF) return Token.EOF; else return fDefaultToken; } }
/** * Returns the next token in the document. * * @return the next token in the document */
Returns the next token in the document
nextToken
{ "repo_name": "matthias-wolff/dLabPro-Plugin", "path": "Plugin/src/de/tudresden/ias/eclipse/dlabpro/editors/AbstractScanner.java", "license": "lgpl-3.0", "size": 9922 }
[ "org.eclipse.jface.text.rules.IToken", "org.eclipse.jface.text.rules.Token" ]
import org.eclipse.jface.text.rules.IToken; import org.eclipse.jface.text.rules.Token;
import org.eclipse.jface.text.rules.*;
[ "org.eclipse.jface" ]
org.eclipse.jface;
2,441,821
public static BundleContext getContext() { return context; }
static BundleContext function() { return context; }
/** * Returns the bundle context of this bundle * * @return the bundle context */
Returns the bundle context of this bundle
getContext
{ "repo_name": "hubermi/openhab", "path": "bundles/binding/org.openhab.binding.ihc/src/main/java/org/openhab/binding/ihc/internal/IhcActivator.java", "license": "epl-1.0", "size": 1340 }
[ "org.osgi.framework.BundleContext" ]
import org.osgi.framework.BundleContext;
import org.osgi.framework.*;
[ "org.osgi.framework" ]
org.osgi.framework;
2,164,371
public void setTrailers(List<TMDbTrailer> trailers) { this.trailers.clear(); this.trailers.addAll(trailers); }
void function(List<TMDbTrailer> trailers) { this.trailers.clear(); this.trailers.addAll(trailers); }
/** * Sets the movie trailers. * * @param trailers The movie trailers */
Sets the movie trailers
setTrailers
{ "repo_name": "makgyver/MKtmdb", "path": "src/mk/tmdb/entity/movie/TMDbMovieFull.java", "license": "gpl-3.0", "size": 6692 }
[ "java.util.List", "mk.tmdb.entity.trailer.TMDbTrailer" ]
import java.util.List; import mk.tmdb.entity.trailer.TMDbTrailer;
import java.util.*; import mk.tmdb.entity.trailer.*;
[ "java.util", "mk.tmdb.entity" ]
java.util; mk.tmdb.entity;
1,046,916
public Set<String> ids() { return this.ids; }
Set<String> function() { return this.ids; }
/** * Returns the ids for the query. */
Returns the ids for the query
ids
{ "repo_name": "nezirus/elasticsearch", "path": "core/src/main/java/org/elasticsearch/index/query/IdsQueryBuilder.java", "license": "apache-2.0", "size": 6484 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
1,479,578