method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public static boolean matches(Set<Type> types1, Set<Type> types2) {
for (Type type : types1) {
if (matches(type, types2)) {
return true;
}
}
return false;
}
|
static boolean function(Set<Type> types1, Set<Type> types2) { for (Type type : types1) { if (matches(type, types2)) { return true; } } return false; }
|
/**
* Check whether whether any of the types1 matches a type in types2
*
* @param types1
* @param types2
* @return
*/
|
Check whether whether any of the types1 matches a type in types2
|
matches
|
{
"repo_name": "Repeid/repeid",
"path": "common/src/main/java/org/repeid/common/util/reflections/Reflections.java",
"license": "gpl-2.0",
"size": 38193
}
|
[
"java.lang.reflect.Type",
"java.util.Set"
] |
import java.lang.reflect.Type; import java.util.Set;
|
import java.lang.reflect.*; import java.util.*;
|
[
"java.lang",
"java.util"
] |
java.lang; java.util;
| 1,696,080
|
public List<T> toList();
|
List<T> function();
|
/**
* Returns the List of DataRecords that this collection is based upon.
*
* @return List<DataRecord>
*/
|
Returns the List of DataRecords that this collection is based upon
|
toList
|
{
"repo_name": "SciGaP/DEPRECATED-Cipres-Airavata-POC",
"path": "saminda/cipres-airavata/sdk/src/main/java/org/ngbw/sdk/api/core/GenericDataRecordCollection.java",
"license": "apache-2.0",
"size": 3124
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 552,724
|
protected void parseShapeElem(Element elem, mxVsdxModel model)
{
String childName = elem.getNodeName();
if (childName.equals("Cell"))
{
this.cellElements.put(elem.getAttribute("N"), elem);
}
else if (childName.equals("Section"))
{
this.parseSection(elem);
}
}
|
void function(Element elem, mxVsdxModel model) { String childName = elem.getNodeName(); if (childName.equals("Cell")) { this.cellElements.put(elem.getAttribute("N"), elem); } else if (childName.equals(STR)) { this.parseSection(elem); } }
|
/**
* Caches the specified element
* @param elem the element to cache
*/
|
Caches the specified element
|
parseShapeElem
|
{
"repo_name": "flyingCloudRain/drawio",
"path": "src/com/mxgraph/io/vsdx/Style.java",
"license": "apache-2.0",
"size": 31639
}
|
[
"org.w3c.dom.Element"
] |
import org.w3c.dom.Element;
|
import org.w3c.dom.*;
|
[
"org.w3c.dom"
] |
org.w3c.dom;
| 2,250,010
|
public ActionForward doBar(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
barCount++;
ActionMessages messages = new ActionMessages();
messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
saveMessages(request, messages);
return (mapping.findForward("success"));
}
|
ActionForward function(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { barCount++; ActionMessages messages = new ActionMessages(); messages.add("bar", new ActionMessage(STR, barCount+STRsuccess")); }
|
/**
* Example "bar" method.
*
* @param mapping The ActionMapping used to select this instance
* @param form The optional ActionForm bean for this request
* @param request The servlet request we are processing
* @param response The servlet response we are creating
*
* @exception Exception if business logic throws an exception
*/
|
Example "bar" method
|
doBar
|
{
"repo_name": "davcamer/clients",
"path": "projects-for-testing/struts/apps/examples/src/main/java/org/apache/struts/webapp/dispatch/MappingDispatchExampleAction.java",
"license": "apache-2.0",
"size": 3338
}
|
[
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping",
"org.apache.struts.action.ActionMessage",
"org.apache.struts.action.ActionMessages"
] |
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages;
|
import javax.servlet.http.*; import org.apache.struts.action.*;
|
[
"javax.servlet",
"org.apache.struts"
] |
javax.servlet; org.apache.struts;
| 1,274,111
|
public int read(
byte[] b,
int off,
int len)
throws IOException
{
if (bufOff >= maxBuf)
{
if (nextChunk() < 0)
{
return -1;
}
}
int toSupply = Math.min(len, available());
System.arraycopy(buf, bufOff, b, off, toSupply);
bufOff += toSupply;
return toSupply;
}
|
int function( byte[] b, int off, int len) throws IOException { if (bufOff >= maxBuf) { if (nextChunk() < 0) { return -1; } } int toSupply = Math.min(len, available()); System.arraycopy(buf, bufOff, b, off, toSupply); bufOff += toSupply; return toSupply; }
|
/**
* Reads data from the underlying stream and processes it with the cipher until the cipher
* outputs data, and then returns up to <code>len</code> bytes in the provided array.
* <p>
* If the underlying stream is exhausted by this call, the cipher will be finalised.
* </p>
* @param b the buffer into which the data is read.
* @param off the start offset in the destination array <code>b</code>
* @param len the maximum number of bytes read.
* @return the total number of bytes read into the buffer, or <code>-1</code> if there is no
* more data because the end of the stream has been reached.
* @throws IOException if there was an error closing the input stream.
* @throws InvalidCipherTextIOException if the data read from the stream was invalid ciphertext
* (e.g. the cipher is an AEAD cipher and the ciphertext tag check fails).
*/
|
Reads data from the underlying stream and processes it with the cipher until the cipher outputs data, and then returns up to <code>len</code> bytes in the provided array. If the underlying stream is exhausted by this call, the cipher will be finalised.
|
read
|
{
"repo_name": "Skywalker-11/spongycastle",
"path": "core/src/main/java/org/spongycastle/crypto/io/CipherInputStream.java",
"license": "mit",
"size": 13812
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 589,288
|
public void addListDataListener(ListDataListener l) {
listenerList.add(ListDataListener.class, l);
}
|
void function(ListDataListener l) { listenerList.add(ListDataListener.class, l); }
|
/**
* Adds a listener to the list that's notified each time a change to the data
* model occurs.
*
* @param l
* the <code>ListDataListener</code> to be added
*/
|
Adds a listener to the list that's notified each time a change to the data model occurs
|
addListDataListener
|
{
"repo_name": "wangqi/gameserver",
"path": "admin/src/main/java/com/xinqihd/sns/gameserver/admin/model/MyTableModel.java",
"license": "apache-2.0",
"size": 10525
}
|
[
"javax.swing.event.ListDataListener"
] |
import javax.swing.event.ListDataListener;
|
import javax.swing.event.*;
|
[
"javax.swing"
] |
javax.swing;
| 1,224,093
|
static RetryRule onStatus(HttpStatus... statuses) {
return builder().onStatus(statuses).thenBackoff();
}
|
static RetryRule onStatus(HttpStatus... statuses) { return builder().onStatus(statuses).thenBackoff(); }
|
/**
* Returns a newly created {@link RetryRule} that will retry with the
* {@linkplain Backoff#ofDefault() default backoff} if the response status is one of
* the specified {@link HttpStatus}es.
*/
|
Returns a newly created <code>RetryRule</code> that will retry with the Backoff#ofDefault() default backoff if the response status is one of the specified <code>HttpStatus</code>es
|
onStatus
|
{
"repo_name": "minwoox/armeria",
"path": "core/src/main/java/com/linecorp/armeria/client/retry/RetryRule.java",
"license": "apache-2.0",
"size": 11880
}
|
[
"com.linecorp.armeria.common.HttpStatus"
] |
import com.linecorp.armeria.common.HttpStatus;
|
import com.linecorp.armeria.common.*;
|
[
"com.linecorp.armeria"
] |
com.linecorp.armeria;
| 278,058
|
return (Statement) getSource();
}
|
return (Statement) getSource(); }
|
/**
* Get the DML statement.
*
* @return the DML statement.
*/
|
Get the DML statement
|
getStatement
|
{
"repo_name": "GoogleCloudPlatform/spring-cloud-gcp",
"path": "spring-cloud-gcp-data-spanner/src/main/java/com/google/cloud/spring/data/spanner/core/mapping/event/ExecuteDmlEvent.java",
"license": "apache-2.0",
"size": 1579
}
|
[
"com.google.cloud.spanner.Statement"
] |
import com.google.cloud.spanner.Statement;
|
import com.google.cloud.spanner.*;
|
[
"com.google.cloud"
] |
com.google.cloud;
| 1,586,288
|
public IStreamingResponse<T> onFailure(Consumer<Throwable> error);
|
IStreamingResponse<T> function(Consumer<Throwable> error);
|
/**
* Callback for consumption of failure both from the endpoint and internally
* @param data
*/
|
Callback for consumption of failure both from the endpoint and internally
|
onFailure
|
{
"repo_name": "seanlruff/org.binxance.api",
"path": "src/main/java/org/binxance/api/IStreamingResponse.java",
"license": "mit",
"size": 904
}
|
[
"java.util.function.Consumer"
] |
import java.util.function.Consumer;
|
import java.util.function.*;
|
[
"java.util"
] |
java.util;
| 596,422
|
protected Node firstChild(Node n) {
if (n.getNodeType() == Node.ENTITY_REFERENCE_NODE &&
!expandEntityReferences) {
return null;
}
Node result = n.getFirstChild();
if (result == null) {
return null;
}
switch (acceptNode(result)) {
case NodeFilter.FILTER_ACCEPT:
return result;
case NodeFilter.FILTER_SKIP:
Node t = firstChild(result);
if (t != null) {
return t;
}
// Fall through
default: // NodeFilter.FILTER_REJECT
return nextSibling(result, n);
}
}
|
Node function(Node n) { if (n.getNodeType() == Node.ENTITY_REFERENCE_NODE && !expandEntityReferences) { return null; } Node result = n.getFirstChild(); if (result == null) { return null; } switch (acceptNode(result)) { case NodeFilter.FILTER_ACCEPT: return result; case NodeFilter.FILTER_SKIP: Node t = firstChild(result); if (t != null) { return t; } default: return nextSibling(result, n); } }
|
/**
* Returns the first child of the given node.
*/
|
Returns the first child of the given node
|
firstChild
|
{
"repo_name": "shyamalschandra/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/dom/traversal/DOMTreeWalker.java",
"license": "apache-2.0",
"size": 10742
}
|
[
"org.w3c.dom.Node",
"org.w3c.dom.traversal.NodeFilter"
] |
import org.w3c.dom.Node; import org.w3c.dom.traversal.NodeFilter;
|
import org.w3c.dom.*; import org.w3c.dom.traversal.*;
|
[
"org.w3c.dom"
] |
org.w3c.dom;
| 2,826,352
|
@NonNull
public static <T> String notInSelection(@NonNull final String column,
@NonNull final Iterable<T> arguments) {
//noinspection ConstantConditions
if (column == null || column.isEmpty()) {
throw new IllegalArgumentException("column must not be null or empty");
}
final StringBuilder selection = new StringBuilder(256);
selection.append(column);
selection.append(" NOT IN ");
selection.append('(');
appendCommaSeparatedArguments(selection, arguments);
selection.append(')');
return selection.toString();
}
|
static <T> String function(@NonNull final String column, @NonNull final Iterable<T> arguments) { if (column == null column.isEmpty()) { throw new IllegalArgumentException(STR); } final StringBuilder selection = new StringBuilder(256); selection.append(column); selection.append(STR); selection.append('('); appendCommaSeparatedArguments(selection, arguments); selection.append(')'); return selection.toString(); }
|
/**
* Builds IN selection with long args
*
* @param column the column name to build selection for
* @param arguments the arguments
* @return the IN selection
*/
|
Builds IN selection with long args
|
notInSelection
|
{
"repo_name": "Doctoror/PainlessMusicPlayer",
"path": "data/src/main/java/com/doctoror/fuckoffmusicplayer/data/util/SelectionUtils.java",
"license": "apache-2.0",
"size": 6292
}
|
[
"android.support.annotation.NonNull"
] |
import android.support.annotation.NonNull;
|
import android.support.annotation.*;
|
[
"android.support"
] |
android.support;
| 1,265,472
|
public static String print1DArray(Object aObject) {
if (aObject.getClass().isArray()) {
if (aObject instanceof Object[]) // can we cast to Object[]
return Arrays.toString((Object[]) aObject);
else { // we can't cast to Object[] - case of primitive arrays
int length = Array.getLength(aObject);
Object[] objArr = new Object[length];
for (int i=0; i<length; i++)
objArr[i] = Array.get(aObject, i);
return Arrays.toString(objArr);
}
}
return "[]";
}
|
static String function(Object aObject) { if (aObject.getClass().isArray()) { if (aObject instanceof Object[]) return Arrays.toString((Object[]) aObject); else { int length = Array.getLength(aObject); Object[] objArr = new Object[length]; for (int i=0; i<length; i++) objArr[i] = Array.get(aObject, i); return Arrays.toString(objArr); } } return "[]"; }
|
/**
* Prints the specified array to a returned String.
*
* @param aObject the array object to print.
* @return the array in string form suitable for display.
*/
|
Prints the specified array to a returned String
|
print1DArray
|
{
"repo_name": "antidata/htm.java",
"path": "src/main/java/org/numenta/nupic/util/SparseMatrix.java",
"license": "agpl-3.0",
"size": 15209
}
|
[
"java.lang.reflect.Array",
"java.util.Arrays"
] |
import java.lang.reflect.Array; import java.util.Arrays;
|
import java.lang.reflect.*; import java.util.*;
|
[
"java.lang",
"java.util"
] |
java.lang; java.util;
| 1,703,072
|
private boolean synchronizedRequestPermissionToExecute() {
boolean result = false;
synchronized (this) {
switch (state.get()) {
case CLOSED:
result = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Allowing execution in closed state");
}
break;
case HALF_OPEN:
// Limit the number of concurrent executions when we're half-open
if (halfOpenRunningExecutions < policy.getSuccessThreshold()) {
halfOpenRunningExecutions++;
halfOpenLastExecutionStarted = System.nanoTime();
result = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Allowing execution in half-open state. Now running ({0}/{1})", halfOpenRunningExecutions, policy.getSuccessThreshold());
}
} else {
// If the user runs an operation which never returns (possible using CompletionStage), we might end up stuck in half-open state
// denying all executions forever. For this reason, if we stay in half-open state for longer than the open state delay time,
// allow another execution
if (System.nanoTime() - halfOpenLastExecutionStarted > policyDelayNanos) {
halfOpenLastExecutionStarted = System.nanoTime();
result = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Allowing execution in half-open state because enough time has passed without a trial executions completing");
}
} else {
result = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Denying execution in half-open state, trial execution limit reached");
}
}
}
break;
case OPEN:
if (System.nanoTime() - openStateStartTime > policyDelayNanos) {
// We've been in open state for long enough, transition to half-open
stateHalfOpen();
halfOpenRunningExecutions++;
halfOpenLastExecutionStarted = System.nanoTime();
result = true;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Allowing execution because we just changed to half-open state");
}
} else {
result = false;
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Denying execution in open state");
}
}
break;
}
}
return result;
}
|
boolean function() { boolean result = false; synchronized (this) { switch (state.get()) { case CLOSED: result = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR); } break; case HALF_OPEN: if (halfOpenRunningExecutions < policy.getSuccessThreshold()) { halfOpenRunningExecutions++; halfOpenLastExecutionStarted = System.nanoTime(); result = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR, halfOpenRunningExecutions, policy.getSuccessThreshold()); } } else { if (System.nanoTime() - halfOpenLastExecutionStarted > policyDelayNanos) { halfOpenLastExecutionStarted = System.nanoTime(); result = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR); } } else { result = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR); } } } break; case OPEN: if (System.nanoTime() - openStateStartTime > policyDelayNanos) { stateHalfOpen(); halfOpenRunningExecutions++; halfOpenLastExecutionStarted = System.nanoTime(); result = true; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR); } } else { result = false; if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR); } } break; } } return result; }
|
/**
* Implements the logic for requestPermissionToExecute for the cases where synchronization is required
*
* @return whether execution is permitted
*/
|
Implements the logic for requestPermissionToExecute for the cases where synchronization is required
|
synchronizedRequestPermissionToExecute
|
{
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.microprofile.faulttolerance.2.0/src/com/ibm/ws/microprofile/faulttolerance20/state/impl/CircuitBreakerStateImpl.java",
"license": "epl-1.0",
"size": 12326
}
|
[
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent"
] |
import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent;
|
import com.ibm.websphere.ras.*;
|
[
"com.ibm.websphere"
] |
com.ibm.websphere;
| 1,357,065
|
private StringBuilder handleElementAttributes(Node node) {
StringBuilder attributePath = new StringBuilder();
if (node.hasAttributes()) {
NamedNodeMap attributes = node.getAttributes();
if (attributes.getLength() > 0) {
attributePath.append("[");
for (int i = 0; i < attributes.getLength(); i++) {
if (i > 0) {
attributePath.append(" and ");
}
Node attribute = attributes.item(i);
attributePath.append("@").append(attribute.getNodeName()).append("='")
.append(attribute.getNodeValue()).append("'");
}
attributePath.append("]");
}
}
return attributePath;
}
|
StringBuilder function(Node node) { StringBuilder attributePath = new StringBuilder(); if (node.hasAttributes()) { NamedNodeMap attributes = node.getAttributes(); if (attributes.getLength() > 0) { attributePath.append("["); for (int i = 0; i < attributes.getLength(); i++) { if (i > 0) { attributePath.append(STR); } Node attribute = attributes.item(i); attributePath.append("@").append(attribute.getNodeName()).append("='") .append(attribute.getNodeValue()).append("'"); } attributePath.append("]"); } } return attributePath; }
|
/**
* Handle the attributes for an element in an XPath expression.
*
* @param node the node to get the attributes from.
* @return the attributes of the node as XPath expression.
*/
|
Handle the attributes for an element in an XPath expression
|
handleElementAttributes
|
{
"repo_name": "uweplonus/tool-jpa-processor",
"path": "aggregator/test-util/src/main/java/org/sw4j/tool/annotation/jpa/test/util/ITUtil.java",
"license": "gpl-3.0",
"size": 9950
}
|
[
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node"
] |
import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node;
|
import org.w3c.dom.*;
|
[
"org.w3c.dom"
] |
org.w3c.dom;
| 1,910,396
|
private void jButton1ActionPerformed(final java.awt.event.ActionEvent evt) { //GEN-FIRST:event_jButton1ActionPerformed
final int position = jXTable1.getSelectedRow();
new SwingWorker<Boolean, Object>() {
|
void function(final java.awt.event.ActionEvent evt) { final int position = jXTable1.getSelectedRow(); new SwingWorker<Boolean, Object>() {
|
/**
* DOCUMENT ME!
*
* @param evt DOCUMENT ME!
*/
|
DOCUMENT ME
|
jButton1ActionPerformed
|
{
"repo_name": "cismet/cismap-commons",
"path": "src/main/java/de/cismet/cismap/commons/rasterservice/georeferencing/RasterGeoReferencingPanel.java",
"license": "lgpl-3.0",
"size": 50569
}
|
[
"javax.swing.SwingWorker"
] |
import javax.swing.SwingWorker;
|
import javax.swing.*;
|
[
"javax.swing"
] |
javax.swing;
| 1,130,277
|
public CSVRecord lowestHumidityInManyFiles() {
DirectoryResource dr = new DirectoryResource();
CSVRecord lowest = null;
for (File file : dr.selectedFiles()) {
FileResource fr = new FileResource(file);
CSVParser parser = fr.getCSVParser();
CSVRecord current = lowestHumidityInFile(parser);
if (lowest == null) lowest = current;
else {
double currentHum = Double.parseDouble(current.get(HUM_NAME));
double lowestHum = Double.parseDouble(lowest.get(HUM_NAME));
if (currentHum < lowestHum) lowest = current;
}
}
pl("Lowest Humidity was " + lowest.get(HUM_NAME) + " at " + lowest.get(UTC_DATE));
return lowest;
}
|
CSVRecord function() { DirectoryResource dr = new DirectoryResource(); CSVRecord lowest = null; for (File file : dr.selectedFiles()) { FileResource fr = new FileResource(file); CSVParser parser = fr.getCSVParser(); CSVRecord current = lowestHumidityInFile(parser); if (lowest == null) lowest = current; else { double currentHum = Double.parseDouble(current.get(HUM_NAME)); double lowestHum = Double.parseDouble(lowest.get(HUM_NAME)); if (currentHum < lowestHum) lowest = current; } } pl(STR + lowest.get(HUM_NAME) + STR + lowest.get(UTC_DATE)); return lowest; }
|
/**
* Find a lowest humidity in many files selected.
* @return CSVRecord found with the lowest humidity
*/
|
Find a lowest humidity in many files selected
|
lowestHumidityInManyFiles
|
{
"repo_name": "polde-live/duke-java-1",
"path": "CSVWeather/CSVWeatherReader.java",
"license": "unlicense",
"size": 6465
}
|
[
"edu.duke.DirectoryResource",
"edu.duke.FileResource",
"java.io.File",
"org.apache.commons.csv.CSVParser"
] |
import edu.duke.DirectoryResource; import edu.duke.FileResource; import java.io.File; import org.apache.commons.csv.CSVParser;
|
import edu.duke.*; import java.io.*; import org.apache.commons.csv.*;
|
[
"edu.duke",
"java.io",
"org.apache.commons"
] |
edu.duke; java.io; org.apache.commons;
| 1,593,022
|
EClass getCastExpression();
|
EClass getCastExpression();
|
/**
* Returns the meta object for class '{@link org.xtext.example.delphi.astm.CastExpression <em>Cast Expression</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Cast Expression</em>'.
* @see org.xtext.example.delphi.astm.CastExpression
* @generated
*/
|
Returns the meta object for class '<code>org.xtext.example.delphi.astm.CastExpression Cast Expression</code>'.
|
getCastExpression
|
{
"repo_name": "adolfosbh/cs2as",
"path": "org.xtext.example.delphi/emf-gen/org/xtext/example/delphi/astm/AstmPackage.java",
"license": "epl-1.0",
"size": 670467
}
|
[
"org.eclipse.emf.ecore.EClass"
] |
import org.eclipse.emf.ecore.EClass;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 2,037,385
|
public BigInteger getPublicExponent() {
if (exponent == null) {
publicKeyBlob = getPublicKeyBlob(hCryptKey);
exponent = new BigInteger(getExponent(publicKeyBlob));
}
return exponent;
}
|
BigInteger function() { if (exponent == null) { publicKeyBlob = getPublicKeyBlob(hCryptKey); exponent = new BigInteger(getExponent(publicKeyBlob)); } return exponent; }
|
/**
* Returns the public exponent.
*/
|
Returns the public exponent
|
getPublicExponent
|
{
"repo_name": "andreagenso/java2scala",
"path": "test/J2s/java/openjdk-6-src-b27/jdk/src/windows/classes/sun/security/mscapi/RSAPublicKey.java",
"license": "apache-2.0",
"size": 5609
}
|
[
"java.math.BigInteger"
] |
import java.math.BigInteger;
|
import java.math.*;
|
[
"java.math"
] |
java.math;
| 2,799,523
|
@ServiceMethod(returns = ReturnType.SINGLE)
VirtualMachineExtensionInner createOrUpdate(
String resourceGroupName,
String vmName,
String vmExtensionName,
VirtualMachineExtensionInner extensionParameters);
|
@ServiceMethod(returns = ReturnType.SINGLE) VirtualMachineExtensionInner createOrUpdate( String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionInner extensionParameters);
|
/**
* The operation to create or update the extension.
*
* @param resourceGroupName The name of the resource group.
* @param vmName The name of the virtual machine where the extension should be created or updated.
* @param vmExtensionName The name of the virtual machine extension.
* @param extensionParameters Parameters supplied to the Create Virtual Machine Extension operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return describes a Virtual Machine Extension.
*/
|
The operation to create or update the extension
|
createOrUpdate
|
{
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/VirtualMachineExtensionsClient.java",
"license": "mit",
"size": 30057
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.compute.fluent.models.VirtualMachineExtensionInner"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineExtensionInner;
|
import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.fluent.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 1,896,098
|
private Map<GroupStoreKeyMapKey, StoredGroupEntry>
getGroupStoreKeyMap() {
return groupStoreEntriesByKey.asJavaMap();
}
|
Map<GroupStoreKeyMapKey, StoredGroupEntry> function() { return groupStoreEntriesByKey.asJavaMap(); }
|
/**
* Returns the group store eventual consistent key map.
*
* @return Map representing group key table.
*/
|
Returns the group store eventual consistent key map
|
getGroupStoreKeyMap
|
{
"repo_name": "opennetworkinglab/onos",
"path": "core/store/dist/src/main/java/org/onosproject/store/group/impl/DistributedGroupStore.java",
"license": "apache-2.0",
"size": 75910
}
|
[
"java.util.Map",
"org.onosproject.net.group.StoredGroupEntry"
] |
import java.util.Map; import org.onosproject.net.group.StoredGroupEntry;
|
import java.util.*; import org.onosproject.net.group.*;
|
[
"java.util",
"org.onosproject.net"
] |
java.util; org.onosproject.net;
| 2,004,032
|
if (isInited) return (FunctionblockPackage)EPackage.Registry.INSTANCE.getEPackage(FunctionblockPackage.eNS_URI);
// Obtain or create and register package
FunctionblockPackageImpl theFunctionblockPackage = (FunctionblockPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FunctionblockPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FunctionblockPackageImpl());
isInited = true;
// Initialize simple dependencies
DatatypePackage.eINSTANCE.eClass();
// Obtain or create and register interdependencies
ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) : ModelPackage.eINSTANCE);
// Create package meta-data objects
theFunctionblockPackage.createPackageContents();
theModelPackage.createPackageContents();
// Initialize created meta-data
theFunctionblockPackage.initializePackageContents();
theModelPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theFunctionblockPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(FunctionblockPackage.eNS_URI, theFunctionblockPackage);
return theFunctionblockPackage;
}
|
if (isInited) return (FunctionblockPackage)EPackage.Registry.INSTANCE.getEPackage(FunctionblockPackage.eNS_URI); FunctionblockPackageImpl theFunctionblockPackage = (FunctionblockPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof FunctionblockPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new FunctionblockPackageImpl()); isInited = true; DatatypePackage.eINSTANCE.eClass(); ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI) : ModelPackage.eINSTANCE); theFunctionblockPackage.createPackageContents(); theModelPackage.createPackageContents(); theFunctionblockPackage.initializePackageContents(); theModelPackage.initializePackageContents(); theFunctionblockPackage.freeze(); EPackage.Registry.INSTANCE.put(FunctionblockPackage.eNS_URI, theFunctionblockPackage); return theFunctionblockPackage; }
|
/**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link FunctionblockPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/
|
Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>FunctionblockPackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
|
init
|
{
"repo_name": "nagavijays/vorto",
"path": "bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/impl/FunctionblockPackageImpl.java",
"license": "epl-1.0",
"size": 25401
}
|
[
"org.eclipse.emf.ecore.EPackage",
"org.eclipse.vorto.core.api.model.datatype.DatatypePackage",
"org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage",
"org.eclipse.vorto.core.api.model.model.ModelPackage",
"org.eclipse.vorto.core.api.model.model.impl.ModelPackageImpl"
] |
import org.eclipse.emf.ecore.EPackage; import org.eclipse.vorto.core.api.model.datatype.DatatypePackage; import org.eclipse.vorto.core.api.model.functionblock.FunctionblockPackage; import org.eclipse.vorto.core.api.model.model.ModelPackage; import org.eclipse.vorto.core.api.model.model.impl.ModelPackageImpl;
|
import org.eclipse.emf.ecore.*; import org.eclipse.vorto.core.api.model.datatype.*; import org.eclipse.vorto.core.api.model.functionblock.*; import org.eclipse.vorto.core.api.model.model.*; import org.eclipse.vorto.core.api.model.model.impl.*;
|
[
"org.eclipse.emf",
"org.eclipse.vorto"
] |
org.eclipse.emf; org.eclipse.vorto;
| 2,822,006
|
boolean validTreeLocation()
{
int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]};
int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]};
int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]);
Block soil = Block.blocksList[i];
boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling));
if (!isValidSoil)
{
return false;
}
else
{
int j = this.checkBlockLine(aint, aint1);
if (j == -1)
{
return true;
}
else if (j < 6)
{
return false;
}
else
{
this.heightLimit = j;
return true;
}
}
}
|
boolean validTreeLocation() { int[] aint = new int[] {this.basePos[0], this.basePos[1], this.basePos[2]}; int[] aint1 = new int[] {this.basePos[0], this.basePos[1] + this.heightLimit - 1, this.basePos[2]}; int i = this.worldObj.getBlockId(this.basePos[0], this.basePos[1] - 1, this.basePos[2]); Block soil = Block.blocksList[i]; boolean isValidSoil = (soil != null && soil.canSustainPlant(worldObj, basePos[0], basePos[1] - 1, basePos[2], ForgeDirection.UP, (BlockSapling)Block.sapling)); if (!isValidSoil) { return false; } else { int j = this.checkBlockLine(aint, aint1); if (j == -1) { return true; } else if (j < 6) { return false; } else { this.heightLimit = j; return true; } } }
|
/**
* Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height
* limit, is valid.
*/
|
Returns a boolean indicating whether or not the current location for the tree, spanning basePos to to the height limit, is valid
|
validTreeLocation
|
{
"repo_name": "Stormister/Rediscovered-Mod-1.6.4",
"path": "source/main/RediscoveredMod/WorldGenBigCherryTrees.java",
"license": "gpl-3.0",
"size": 16634
}
|
[
"net.minecraft.block.Block",
"net.minecraft.block.BlockSapling",
"net.minecraftforge.common.ForgeDirection"
] |
import net.minecraft.block.Block; import net.minecraft.block.BlockSapling; import net.minecraftforge.common.ForgeDirection;
|
import net.minecraft.block.*; import net.minecraftforge.common.*;
|
[
"net.minecraft.block",
"net.minecraftforge.common"
] |
net.minecraft.block; net.minecraftforge.common;
| 2,768,995
|
EReference getExplorationCandidate_ApplicationAlternatives();
|
EReference getExplorationCandidate_ApplicationAlternatives();
|
/**
* Returns the meta object for the reference list '{@link ch.hilbri.assist.model.ExplorationCandidate#getApplicationAlternatives <em>Application Alternatives</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Application Alternatives</em>'.
* @see ch.hilbri.assist.model.ExplorationCandidate#getApplicationAlternatives()
* @see #getExplorationCandidate()
* @generated
*/
|
Returns the meta object for the reference list '<code>ch.hilbri.assist.model.ExplorationCandidate#getApplicationAlternatives Application Alternatives</code>'.
|
getExplorationCandidate_ApplicationAlternatives
|
{
"repo_name": "RobertHilbrich/assist",
"path": "ch.hilbri.assist.model/src-gen/ch/hilbri/assist/model/ModelPackage.java",
"license": "gpl-2.0",
"size": 419306
}
|
[
"org.eclipse.emf.ecore.EReference"
] |
import org.eclipse.emf.ecore.EReference;
|
import org.eclipse.emf.ecore.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 304,267
|
public String getRefClass(ObjectOutput out) {
return "UnicastServerRef";
}
|
String function(ObjectOutput out) { return STR; }
|
/**
* Returns the class of the ref type to be serialized.
*/
|
Returns the class of the ref type to be serialized
|
getRefClass
|
{
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java",
"license": "gpl-2.0",
"size": 24303
}
|
[
"java.io.ObjectOutput"
] |
import java.io.ObjectOutput;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 59,693
|
Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> c,
final Append append)
throws IOException;
|
Result preAppend(final ObserverContext<RegionCoprocessorEnvironment> c, final Append append) throws IOException;
|
/**
* Called before Append
* <p>
* Call CoprocessorEnvironment#bypass to skip default actions
* <p>
* Call CoprocessorEnvironment#complete to skip any subsequent chained
* coprocessors
* @param c the environment provided by the region server
* @param append Append object
* @return result to return to the client if bypassing default processing
* @throws IOException if an error occurred on the coprocessor
*/
|
Called before Append Call CoprocessorEnvironment#bypass to skip default actions Call CoprocessorEnvironment#complete to skip any subsequent chained coprocessors
|
preAppend
|
{
"repo_name": "daidong/DominoHBase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/RegionObserver.java",
"license": "apache-2.0",
"size": 34195
}
|
[
"java.io.IOException",
"org.apache.hadoop.hbase.client.Append",
"org.apache.hadoop.hbase.client.Result"
] |
import java.io.IOException; import org.apache.hadoop.hbase.client.Append; import org.apache.hadoop.hbase.client.Result;
|
import java.io.*; import org.apache.hadoop.hbase.client.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 2,377,319
|
@AfterEach
public void tearDown() throws FileSystemException {
if (manager != null) {
manager.close();
manager = null;
}
}
|
void function() throws FileSystemException { if (manager != null) { manager.close(); manager = null; } }
|
/**
* JUnit Fixture: Tear Down the FSM.
*
* @throws FileSystemException for runtime problems
*/
|
JUnit Fixture: Tear Down the FSM
|
tearDown
|
{
"repo_name": "apache/commons-vfs",
"path": "commons-vfs2/src/test/java/org/apache/commons/vfs2/operations/BasicOperationsTest.java",
"license": "apache-2.0",
"size": 7175
}
|
[
"org.apache.commons.vfs2.FileSystemException"
] |
import org.apache.commons.vfs2.FileSystemException;
|
import org.apache.commons.vfs2.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 2,386,410
|
private boolean removeFromHmsParameters(String k) {
org.apache.hadoop.hive.metastore.api.Database msDb = thriftDb_.metastore_db;
Preconditions.checkNotNull(msDb);
if (msDb.getParameters() == null) return false;
return msDb.getParameters().remove(k) != null;
}
public boolean isSystemDb() { return isSystemDb_; }
|
boolean function(String k) { org.apache.hadoop.hive.metastore.api.Database msDb = thriftDb_.metastore_db; Preconditions.checkNotNull(msDb); if (msDb.getParameters() == null) return false; return msDb.getParameters().remove(k) != null; } public boolean isSystemDb() { return isSystemDb_; }
|
/**
* Updates the hms parameters map by removing the <k,v> pair corresponding to
* input key <k>. Returns true if the parameters map contains a pair <k,v>
* corresponding to input k and it is removed, false otherwise.
*/
|
Updates the hms parameters map by removing the pair corresponding to input key . Returns true if the parameters map contains a pair corresponding to input k and it is removed, false otherwise
|
removeFromHmsParameters
|
{
"repo_name": "924060929/impala-frontend",
"path": "fe/src/main/java/org/apache/impala/catalog/Db.java",
"license": "apache-2.0",
"size": 17728
}
|
[
"com.google.common.base.Preconditions"
] |
import com.google.common.base.Preconditions;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 424,397
|
public Timestamp getCreated();
public static final String COLUMNNAME_CreatedBy = "CreatedBy";
|
Timestamp function(); public static final String COLUMNNAME_CreatedBy = STR;
|
/** Get Created.
* Date this record was created
*/
|
Get Created. Date this record was created
|
getCreated
|
{
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/model/I_AD_User.java",
"license": "gpl-2.0",
"size": 13937
}
|
[
"java.sql.Timestamp"
] |
import java.sql.Timestamp;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,101,948
|
public List<Deployment> searchDeployments(String application_id, long start_time, long end_time, String status);
|
List<Deployment> function(String application_id, long start_time, long end_time, String status);
|
/**
* Search deployments.
*
* @param application_id
* the application_id
* @param start_time
* the start_time
* @param end_time
* the end_time
* @param status
* the status
* @return the list
*/
|
Search deployments
|
searchDeployments
|
{
"repo_name": "CELAR/cloud-is",
"path": "cloud-is-core/dataCollectionModule/src/main/java/eu/celarcloud/cloud_is/dataCollectionModule/common/dtSource/IApplicationMetadata.java",
"license": "apache-2.0",
"size": 3463
}
|
[
"eu.celarcloud.cloud_is.dataCollectionModule.common.beans.Deployment",
"java.util.List"
] |
import eu.celarcloud.cloud_is.dataCollectionModule.common.beans.Deployment; import java.util.List;
|
import eu.celarcloud.cloud_is.*; import java.util.*;
|
[
"eu.celarcloud.cloud_is",
"java.util"
] |
eu.celarcloud.cloud_is; java.util;
| 463,915
|
public void commitIfPrepared(IgniteInternalTx tx, Set<UUID> failedNodeIds) {
assert tx instanceof GridDhtTxLocal || tx instanceof GridDhtTxRemote : tx;
assert !F.isEmpty(tx.transactionNodes()) : tx;
assert tx.nearXidVersion() != null : tx;
GridCacheTxRecoveryFuture fut = new GridCacheTxRecoveryFuture(
cctx,
tx,
failedNodeIds,
tx.transactionNodes());
cctx.mvcc().addFuture(fut, fut.futureId());
if (log.isDebugEnabled())
log.debug("Checking optimistic transaction state on remote nodes [tx=" + tx + ", fut=" + fut + ']');
fut.prepare();
}
|
void function(IgniteInternalTx tx, Set<UUID> failedNodeIds) { assert tx instanceof GridDhtTxLocal tx instanceof GridDhtTxRemote : tx; assert !F.isEmpty(tx.transactionNodes()) : tx; assert tx.nearXidVersion() != null : tx; GridCacheTxRecoveryFuture fut = new GridCacheTxRecoveryFuture( cctx, tx, failedNodeIds, tx.transactionNodes()); cctx.mvcc().addFuture(fut, fut.futureId()); if (log.isDebugEnabled()) log.debug(STR + tx + STR + fut + ']'); fut.prepare(); }
|
/**
* Commits transaction in case when node started transaction failed, but all related
* transactions were prepared (invalidates transaction if it is not fully prepared).
*
* @param tx Transaction.
* @param failedNodeIds Failed nodes IDs.
*/
|
Commits transaction in case when node started transaction failed, but all related transactions were prepared (invalidates transaction if it is not fully prepared)
|
commitIfPrepared
|
{
"repo_name": "nivanov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java",
"license": "apache-2.0",
"size": 89685
}
|
[
"java.util.Set",
"org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture",
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal",
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote",
"org.apache.ignite.internal.util.typedef.F"
] |
import java.util.Set; import org.apache.ignite.internal.processors.cache.distributed.GridCacheTxRecoveryFuture; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal; import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxRemote; import org.apache.ignite.internal.util.typedef.F;
|
import java.util.*; import org.apache.ignite.internal.processors.cache.distributed.*; import org.apache.ignite.internal.processors.cache.distributed.dht.*; import org.apache.ignite.internal.util.typedef.*;
|
[
"java.util",
"org.apache.ignite"
] |
java.util; org.apache.ignite;
| 2,381,629
|
public JspServletWrapper getWrapper(String jspUri) {
return jsps.get(jspUri);
}
|
JspServletWrapper function(String jspUri) { return jsps.get(jspUri); }
|
/**
* Get an already existing JspServletWrapper.
*
* @param jspUri JSP URI
* @return JspServletWrapper for JSP
*/
|
Get an already existing JspServletWrapper
|
getWrapper
|
{
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.0/JspRuntimeContext.java",
"license": "mit",
"size": 19299
}
|
[
"org.apache.jasper.servlet.JspServletWrapper"
] |
import org.apache.jasper.servlet.JspServletWrapper;
|
import org.apache.jasper.servlet.*;
|
[
"org.apache.jasper"
] |
org.apache.jasper;
| 1,219,534
|
protected void comma()
throws SyntaxErrorException {
int ch = nextCh();
if ( ch != (int)',' ) {
if ( ch >= (int)' ' && ch <= (int)'~' ) {
throw new SyntaxErrorException( "next character ('" + (char)ch + "') is not a comma" );
} else {
throw new SyntaxErrorException( "next character (0x" + fmtHex( ch ) + ") is not a comma" );
}
}
}
|
void function() throws SyntaxErrorException { int ch = nextCh(); if ( ch != (int)',' ) { if ( ch >= (int)' ' && ch <= (int)'~' ) { throw new SyntaxErrorException( STR + (char)ch + STR ); } else { throw new SyntaxErrorException( STR + fmtHex( ch ) + STR ); } } }
|
/**
* Consume the next character (which must be a comma).
*
* @throws SyntaxErrorException if the next character is not a comma.
*/
|
Consume the next character (which must be a comma)
|
comma
|
{
"repo_name": "safedoorpm/Pipestone",
"path": "src/com/obtuse/util/CSVParser.java",
"license": "apache-2.0",
"size": 15448
}
|
[
"com.obtuse.util.exceptions.SyntaxErrorException"
] |
import com.obtuse.util.exceptions.SyntaxErrorException;
|
import com.obtuse.util.exceptions.*;
|
[
"com.obtuse.util"
] |
com.obtuse.util;
| 1,495,897
|
public static ChannelBuffer copiedBuffer(ByteOrder endianness, char[] array, Charset charset) {
return copiedBuffer(endianness, array, 0, array.length, charset);
}
|
static ChannelBuffer function(ByteOrder endianness, char[] array, Charset charset) { return copiedBuffer(endianness, array, 0, array.length, charset); }
|
/**
* Creates a new buffer with the specified {@code endianness} whose
* content is the specified {@code array} encoded in the specified
* {@code charset}. The new buffer's {@code readerIndex} and
* {@code writerIndex} are {@code 0} and the length of the encoded string
* respectively.
*/
|
Creates a new buffer with the specified endianness whose content is the specified array encoded in the specified charset. The new buffer's readerIndex and writerIndex are 0 and the length of the encoded string respectively
|
copiedBuffer
|
{
"repo_name": "ferdiknight/leon",
"path": "demo/src/main/java/com/blueferdi/leon/demo/typeahead/buffer/ChannelBuffers.java",
"license": "lgpl-3.0",
"size": 42046
}
|
[
"java.nio.ByteOrder",
"java.nio.charset.Charset"
] |
import java.nio.ByteOrder; import java.nio.charset.Charset;
|
import java.nio.*; import java.nio.charset.*;
|
[
"java.nio"
] |
java.nio;
| 2,548,121
|
void setLocale(Locale loc);
|
void setLocale(Locale loc);
|
/**
* Changes the locale of this response.
*
* @param loc the new locale
*/
|
Changes the locale of this response
|
setLocale
|
{
"repo_name": "kalikov/lighthouse",
"path": "app/src/main/java/ru/radiomayak/http/HttpResponse.java",
"license": "apache-2.0",
"size": 5174
}
|
[
"java.util.Locale"
] |
import java.util.Locale;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 87,959
|
public void listen(View view){
//If the Bluetooth module is off, turn it on. This is possible thanks to android.permission.BLUETOOTH_ADMIN.
//Otherwise we should have asked the user to turn it on via a Dialog.
if (!bluetoothAdapter.isEnabled()){
bluetoothAdapter.enable();
turnedOnByApp = true;
}
receivedText.setText("No text has been received yet.");
//Check if the phone is already discoverable.
if (bluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE){
//Make the phone discoverable on Bluetooth network for 60s.
Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, BLUETOOTH_DISCOVERY_DURATION);
startActivityForResult(discoverableIntent, BLUETOOTH_DISCOVERY);
}
else{
Toast.makeText(this, "Your device is still discoverable and is currently connectable", Toast.LENGTH_SHORT).show();
}
}
|
void function(View view){ if (!bluetoothAdapter.isEnabled()){ bluetoothAdapter.enable(); turnedOnByApp = true; } receivedText.setText(STR); if (bluetoothAdapter.getScanMode() != BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE){ Intent discoverableIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE); discoverableIntent.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, BLUETOOTH_DISCOVERY_DURATION); startActivityForResult(discoverableIntent, BLUETOOTH_DISCOVERY); } else{ Toast.makeText(this, STR, Toast.LENGTH_SHORT).show(); } }
|
/**
* Method called when clicking on the "Listen" button.
* It enables Bluetooth, makes the phone discoverable and launches the server.
*/
|
Method called when clicking on the "Listen" button. It enables Bluetooth, makes the phone discoverable and launches the server
|
listen
|
{
"repo_name": "QSchulz/BluetoothCommunicationAndroid-PC",
"path": "Android/app/src/main/java/com/wordpress/tricksandprojects/bluetoothcommunication/Home.java",
"license": "gpl-2.0",
"size": 6575
}
|
[
"android.bluetooth.BluetoothAdapter",
"android.content.Intent",
"android.view.View",
"android.widget.Toast"
] |
import android.bluetooth.BluetoothAdapter; import android.content.Intent; import android.view.View; import android.widget.Toast;
|
import android.bluetooth.*; import android.content.*; import android.view.*; import android.widget.*;
|
[
"android.bluetooth",
"android.content",
"android.view",
"android.widget"
] |
android.bluetooth; android.content; android.view; android.widget;
| 32,974
|
static void configurePartitioner(Job job, List<ImmutableBytesWritable> splitPoints)
throws IOException {
Configuration conf = job.getConfiguration();
// create the partitions file
FileSystem fs = FileSystem.get(conf);
Path partitionsPath = new Path(conf.get("hadoop.tmp.dir"), "partitions_" + UUID.randomUUID());
fs.makeQualified(partitionsPath);
writePartitions(conf, partitionsPath, splitPoints);
fs.deleteOnExit(partitionsPath);
// configure job to use it
job.setPartitionerClass(TotalOrderPartitioner.class);
TotalOrderPartitioner.setPartitionFile(conf, partitionsPath);
}
|
static void configurePartitioner(Job job, List<ImmutableBytesWritable> splitPoints) throws IOException { Configuration conf = job.getConfiguration(); FileSystem fs = FileSystem.get(conf); Path partitionsPath = new Path(conf.get(STR), STR + UUID.randomUUID()); fs.makeQualified(partitionsPath); writePartitions(conf, partitionsPath, splitPoints); fs.deleteOnExit(partitionsPath); job.setPartitionerClass(TotalOrderPartitioner.class); TotalOrderPartitioner.setPartitionFile(conf, partitionsPath); }
|
/**
* Configure <code>job</code> with a TotalOrderPartitioner, partitioning against
* <code>splitPoints</code>. Cleans up the partitions file after job exists.
*/
|
Configure <code>job</code> with a TotalOrderPartitioner, partitioning against <code>splitPoints</code>. Cleans up the partitions file after job exists
|
configurePartitioner
|
{
"repo_name": "andrewmains12/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/mapreduce/HFileOutputFormat2.java",
"license": "apache-2.0",
"size": 30845
}
|
[
"java.io.IOException",
"java.util.List",
"java.util.UUID",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.io.ImmutableBytesWritable",
"org.apache.hadoop.mapreduce.Job",
"org.apache.hadoop.mapreduce.lib.partition.TotalOrderPartitioner"
] |
import java.io.IOException; import java.util.List; import java.util.UUID; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.io.ImmutableBytesWritable; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.partition.TotalOrderPartitioner;
|
import java.io.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.io.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.partition.*;
|
[
"java.io",
"java.util",
"org.apache.hadoop"
] |
java.io; java.util; org.apache.hadoop;
| 721,362
|
public Img getPointStyleAsImage() {
return getConfiguration().getElements().getPoint().getPointStyleAsImage();
}
|
Img function() { return getConfiguration().getElements().getPoint().getPointStyleAsImage(); }
|
/**
* Returns the style of the point as image.
*
* @return the style of the point as image.
*/
|
Returns the style of the point as image
|
getPointStyleAsImage
|
{
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/configuration/Point.java",
"license": "apache-2.0",
"size": 15183
}
|
[
"org.pepstock.charba.client.dom.elements.Img"
] |
import org.pepstock.charba.client.dom.elements.Img;
|
import org.pepstock.charba.client.dom.elements.*;
|
[
"org.pepstock.charba"
] |
org.pepstock.charba;
| 1,089,371
|
public long getCurrentValue() throws IOException {
synchronized (READ_WRITE_LOCK) {
ensureOpen();
//io.force(true); // this takes unreasonable amount of time for some reason - at least on windows with java7
buffer.clear();
io.position(0);
io.read(buffer);
buffer.flip();
return buffer.getLong();
}
}
|
long function() throws IOException { synchronized (READ_WRITE_LOCK) { ensureOpen(); buffer.clear(); io.position(0); io.read(buffer); buffer.flip(); return buffer.getLong(); } }
|
/**
* Should only be used for initialization of sequence values.
* Use {@link #getAndSet(int)} for advancing sequences to higher values.
* @return
* @throws IOException
*/
|
Should only be used for initialization of sequence values. Use <code>#getAndSet(int)</code> for advancing sequences to higher values
|
getCurrentValue
|
{
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.sequence/src/org/jetel/sequence/SimpleSequenceSynchronizer.java",
"license": "lgpl-2.1",
"size": 10334
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 711,220
|
public boolean restrict(final String[] roleNames, final Subject subject);
|
boolean function(final String[] roleNames, final Subject subject);
|
/**
* Check if the specified subject has all the roles
*
* @param roleNames
* an array of role names
* @param subject
* a subject
* @return true if the user has all the specified roles
*/
|
Check if the specified subject has all the roles
|
restrict
|
{
"repo_name": "theAgileFactory/app-framework",
"path": "app/framework/security/ISecurityService.java",
"license": "gpl-2.0",
"size": 5438
}
|
[
"be.objectify.deadbolt.core.models.Subject"
] |
import be.objectify.deadbolt.core.models.Subject;
|
import be.objectify.deadbolt.core.models.*;
|
[
"be.objectify.deadbolt"
] |
be.objectify.deadbolt;
| 2,531,588
|
public void setHostCalibrationData(List<HostEnergyCalibrationData> datapoints);
|
void function(List<HostEnergyCalibrationData> datapoints);
|
/**
* This sets the host calibration data for this agent.
* @param datapoints The datapoints to use for estimating energy usage.
*/
|
This sets the host calibration data for this agent
|
setHostCalibrationData
|
{
"repo_name": "TANGO-Project/code-optimiser-plugin",
"path": "bundles/org.jvmmonitor.agent/src/org/jvmmonitor/internal/agent/PowerMXBean.java",
"license": "apache-2.0",
"size": 1418
}
|
[
"eu.tango.energymodeller.types.energyuser.usage.HostEnergyCalibrationData",
"java.util.List"
] |
import eu.tango.energymodeller.types.energyuser.usage.HostEnergyCalibrationData; import java.util.List;
|
import eu.tango.energymodeller.types.energyuser.usage.*; import java.util.*;
|
[
"eu.tango.energymodeller",
"java.util"
] |
eu.tango.energymodeller; java.util;
| 2,483,232
|
public MetricAlertSingleResourceMultipleMetricCriteria withAllOf(List<MetricCriteria> allOf) {
this.allOf = allOf;
return this;
}
|
MetricAlertSingleResourceMultipleMetricCriteria function(List<MetricCriteria> allOf) { this.allOf = allOf; return this; }
|
/**
* Set the list of metric criteria for this 'all of' operation.
*
* @param allOf the allOf value to set
* @return the MetricAlertSingleResourceMultipleMetricCriteria object itself.
*/
|
Set the list of metric criteria for this 'all of' operation
|
withAllOf
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/monitor/mgmt-v2018_03_01/src/main/java/com/microsoft/azure/management/monitor/v2018_03_01/MetricAlertSingleResourceMultipleMetricCriteria.java",
"license": "mit",
"size": 1585
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,262,443
|
public String[] readDiscIds() {
String line = getTagText("DISCID");
StringTokenizer st = new StringTokenizer(line, ", ");
List<String> discIds = new ArrayList<String>();
while (st.hasMoreTokens()) {
discIds.add(st.nextToken());
}
return discIds.toArray(new String[discIds.size()]);
}
|
String[] function() { String line = getTagText(STR); StringTokenizer st = new StringTokenizer(line, STR); List<String> discIds = new ArrayList<String>(); while (st.hasMoreTokens()) { discIds.add(st.nextToken()); } return discIds.toArray(new String[discIds.size()]); }
|
/**
* Parses for possibly multiple disc ids to support
* searching for disc ids that link to the same file
*/
|
Parses for possibly multiple disc ids to support searching for disc ids that link to the same file
|
readDiscIds
|
{
"repo_name": "cpesch/MetaMusic",
"path": "retrieval-tools/src/main/java/slash/metamusic/freedb/CDDBXmcdParser.java",
"license": "gpl-2.0",
"size": 18411
}
|
[
"java.util.ArrayList",
"java.util.List",
"java.util.StringTokenizer"
] |
import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,909,578
|
@Test
public void testRequireNonNullNamespace() throws Exception {
AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE);
ValueStateDescriptor<IntValue> kvId = new ValueStateDescriptor<>("id", IntValue.class, new IntValue(-1));
try {
backend.getPartitionedState(null, VoidNamespaceSerializer.INSTANCE, kvId);
fail("Did not throw expected NullPointerException");
} catch (NullPointerException ignored) {
}
try {
backend.getPartitionedState(VoidNamespace.INSTANCE, null, kvId);
fail("Did not throw expected NullPointerException");
} catch (NullPointerException ignored) {
}
try {
backend.getPartitionedState(null, null, kvId);
fail("Did not throw expected NullPointerException");
} catch (NullPointerException ignored) {
}
backend.dispose();
}
|
void function() throws Exception { AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE); ValueStateDescriptor<IntValue> kvId = new ValueStateDescriptor<>("id", IntValue.class, new IntValue(-1)); try { backend.getPartitionedState(null, VoidNamespaceSerializer.INSTANCE, kvId); fail(STR); } catch (NullPointerException ignored) { } try { backend.getPartitionedState(VoidNamespace.INSTANCE, null, kvId); fail(STR); } catch (NullPointerException ignored) { } try { backend.getPartitionedState(null, null, kvId); fail(STR); } catch (NullPointerException ignored) { } backend.dispose(); }
|
/**
* Previously, it was possible to create partitioned state with
* <code>null</code> namespace. This test makes sure that this is
* prohibited now.
*/
|
Previously, it was possible to create partitioned state with <code>null</code> namespace. This test makes sure that this is prohibited now
|
testRequireNonNullNamespace
|
{
"repo_name": "DieBauer/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java",
"license": "apache-2.0",
"size": 91277
}
|
[
"org.apache.flink.api.common.state.ValueStateDescriptor",
"org.apache.flink.api.common.typeutils.base.IntSerializer",
"org.apache.flink.types.IntValue",
"org.junit.Assert"
] |
import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeutils.base.IntSerializer; import org.apache.flink.types.IntValue; import org.junit.Assert;
|
import org.apache.flink.api.common.state.*; import org.apache.flink.api.common.typeutils.base.*; import org.apache.flink.types.*; import org.junit.*;
|
[
"org.apache.flink",
"org.junit"
] |
org.apache.flink; org.junit;
| 2,644,752
|
public MetaProperty<LocalDate> endDate() {
return endDate;
}
|
MetaProperty<LocalDate> function() { return endDate; }
|
/**
* The meta-property for the {@code endDate} property.
* @return the meta-property, not null
*/
|
The meta-property for the endDate property
|
endDate
|
{
"repo_name": "nssales/Strata",
"path": "modules/finance/src/main/java/com/opengamma/strata/finance/rate/OvernightCompoundedRateObservation.java",
"license": "apache-2.0",
"size": 22392
}
|
[
"java.time.LocalDate",
"org.joda.beans.MetaProperty"
] |
import java.time.LocalDate; import org.joda.beans.MetaProperty;
|
import java.time.*; import org.joda.beans.*;
|
[
"java.time",
"org.joda.beans"
] |
java.time; org.joda.beans;
| 146,422
|
public void processPlayerDigging(C07PacketPlayerDigging packetIn)
{
PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer());
WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
BlockPos blockpos = packetIn.getPosition();
this.playerEntity.markPlayerActive();
switch (packetIn.getStatus())
{
case DROP_ITEM:
if (!this.playerEntity.isSpectator())
{
this.playerEntity.dropOneItem(false);
}
return;
case DROP_ALL_ITEMS:
if (!this.playerEntity.isSpectator())
{
this.playerEntity.dropOneItem(true);
}
return;
case RELEASE_USE_ITEM:
this.playerEntity.stopUsingItem();
return;
case START_DESTROY_BLOCK:
case ABORT_DESTROY_BLOCK:
case STOP_DESTROY_BLOCK:
double d0 = this.playerEntity.posX - ((double)blockpos.getX() + 0.5D);
double d1 = this.playerEntity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D;
double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1;
dist *= dist;
if (d3 > dist)
{
return;
}
else if (blockpos.getY() >= this.serverController.getBuildLimit())
{
return;
}
else
{
if (packetIn.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK)
{
if (!this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos))
{
this.playerEntity.theItemInWorldManager.onBlockClicked(blockpos, packetIn.getFacing());
}
else
{
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
}
}
else
{
if (packetIn.getStatus() == C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK)
{
this.playerEntity.theItemInWorldManager.blockRemoving(blockpos);
}
else if (packetIn.getStatus() == C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK)
{
this.playerEntity.theItemInWorldManager.cancelDestroyingBlock();
}
if (worldserver.getBlockState(blockpos).getBlock().getMaterial() != Material.air)
{
this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos));
}
}
return;
}
default:
throw new IllegalArgumentException("Invalid player action");
}
}
|
void function(C07PacketPlayerDigging packetIn) { PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerForPlayer()); WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension); BlockPos blockpos = packetIn.getPosition(); this.playerEntity.markPlayerActive(); switch (packetIn.getStatus()) { case DROP_ITEM: if (!this.playerEntity.isSpectator()) { this.playerEntity.dropOneItem(false); } return; case DROP_ALL_ITEMS: if (!this.playerEntity.isSpectator()) { this.playerEntity.dropOneItem(true); } return; case RELEASE_USE_ITEM: this.playerEntity.stopUsingItem(); return; case START_DESTROY_BLOCK: case ABORT_DESTROY_BLOCK: case STOP_DESTROY_BLOCK: double d0 = this.playerEntity.posX - ((double)blockpos.getX() + 0.5D); double d1 = this.playerEntity.posY - ((double)blockpos.getY() + 0.5D) + 1.5D; double d2 = this.playerEntity.posZ - ((double)blockpos.getZ() + 0.5D); double d3 = d0 * d0 + d1 * d1 + d2 * d2; double dist = playerEntity.theItemInWorldManager.getBlockReachDistance() + 1; dist *= dist; if (d3 > dist) { return; } else if (blockpos.getY() >= this.serverController.getBuildLimit()) { return; } else { if (packetIn.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) { if (!this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos)) { this.playerEntity.theItemInWorldManager.onBlockClicked(blockpos, packetIn.getFacing()); } else { this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); } } else { if (packetIn.getStatus() == C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK) { this.playerEntity.theItemInWorldManager.blockRemoving(blockpos); } else if (packetIn.getStatus() == C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK) { this.playerEntity.theItemInWorldManager.cancelDestroyingBlock(); } if (worldserver.getBlockState(blockpos).getBlock().getMaterial() != Material.air) { this.playerEntity.playerNetServerHandler.sendPacket(new S23PacketBlockChange(worldserver, blockpos)); } } return; } default: throw new IllegalArgumentException(STR); } }
|
/**
* Processes the player initiating/stopping digging on a particular spot, as well as a player dropping items?. (0:
* initiated, 1: reinitiated, 2? , 3-4 drop item (respectively without or with player control), 5: stopped; x,y,z,
* side clicked on;)
*/
|
Processes the player initiating/stopping digging on a particular spot, as well as a player dropping items?. (0: initiated, 1: reinitiated, 2? , 3-4 drop item (respectively without or with player control), 5: stopped; x,y,z, side clicked on;)
|
processPlayerDigging
|
{
"repo_name": "tomtomtom09/CampCraft",
"path": "build/tmp/recompileMc/sources/net/minecraft/network/NetHandlerPlayServer.java",
"license": "gpl-3.0",
"size": 64328
}
|
[
"net.minecraft.block.material.Material",
"net.minecraft.network.play.client.C07PacketPlayerDigging",
"net.minecraft.network.play.server.S23PacketBlockChange",
"net.minecraft.util.BlockPos",
"net.minecraft.world.WorldServer"
] |
import net.minecraft.block.material.Material; import net.minecraft.network.play.client.C07PacketPlayerDigging; import net.minecraft.network.play.server.S23PacketBlockChange; import net.minecraft.util.BlockPos; import net.minecraft.world.WorldServer;
|
import net.minecraft.block.material.*; import net.minecraft.network.play.client.*; import net.minecraft.network.play.server.*; import net.minecraft.util.*; import net.minecraft.world.*;
|
[
"net.minecraft.block",
"net.minecraft.network",
"net.minecraft.util",
"net.minecraft.world"
] |
net.minecraft.block; net.minecraft.network; net.minecraft.util; net.minecraft.world;
| 1,800,903
|
public static String[] splitIgnoreInQuotes(final String source,
final char splitChar,
final boolean deleteHeadTailQuotes) throws Exception
{
// Trim, replace tabs with spaces so we only need to handle
// space in the following; only if not splitting on TAB
final String trimmedSource;
if (splitChar != TAB) {
trimmedSource = source.replace(TAB, SPACE).trim();
}
else {
trimmedSource = source;
}
final String escapedSource = substituteEscapedQuotes(trimmedSource);
String fullRegex = splitChar + splitRegex;
if (splitChar == PIPE) {
fullRegex = "\\" + fullRegex;
}
return Pattern.compile(fullRegex)
.splitAsStream(escapedSource)
.filter(item -> !item.isEmpty())
.map(item -> item.trim())
.map(item -> deleteHeadTailQuotes ? removeQuotes(item) : item)
.map(item -> revertQuoteSubsitutions(item))
.toArray(size -> new String[size]);
}
|
static String[] function(final String source, final char splitChar, final boolean deleteHeadTailQuotes) throws Exception { final String trimmedSource; if (splitChar != TAB) { trimmedSource = source.replace(TAB, SPACE).trim(); } else { trimmedSource = source; } final String escapedSource = substituteEscapedQuotes(trimmedSource); String fullRegex = splitChar + splitRegex; if (splitChar == PIPE) { fullRegex = "\\" + fullRegex; } return Pattern.compile(fullRegex) .splitAsStream(escapedSource) .filter(item -> !item.isEmpty()) .map(item -> item.trim()) .map(item -> deleteHeadTailQuotes ? removeQuotes(item) : item) .map(item -> revertQuoteSubsitutions(item)) .toArray(size -> new String[size]); }
|
/** Split source string into an array of elements separated by the splitting character,
* but ignoring split characters enclosed in quotes.
*
* @param trimmedSource String to be split
* @param splitChar Character used to split the source string, e.g. ',' or ' '
* @param deleteHeadTailQuotes Delete quotes in the head and tail of individual elements
* if <code>true</code>
* @return Array of individual elements
* @throws Exception on parse error (missing end of quoted string)
*/
|
Split source string into an array of elements separated by the splitting character, but ignoring split characters enclosed in quotes
|
splitIgnoreInQuotes
|
{
"repo_name": "fqqb/yamcs-studio",
"path": "bundles/org.csstudio.ui.util/src/org/csstudio/java/string/StringSplitter.java",
"license": "epl-1.0",
"size": 5023
}
|
[
"java.util.regex.Pattern"
] |
import java.util.regex.Pattern;
|
import java.util.regex.*;
|
[
"java.util"
] |
java.util;
| 932,190
|
public AVMService getAvmService()
{
if (this.avmService == null)
{
this.avmService = Repository.getServiceRegistry(
FacesContext.getCurrentInstance()).getAVMService();
}
return this.avmService;
}
|
AVMService function() { if (this.avmService == null) { this.avmService = Repository.getServiceRegistry( FacesContext.getCurrentInstance()).getAVMService(); } return this.avmService; }
|
/**
* Get avmService property for this bean
*
* @return avmService property value for this bean
*/
|
Get avmService property for this bean
|
getAvmService
|
{
"repo_name": "loftuxab/community-edition-old",
"path": "projects/web-client/source/java/org/alfresco/web/bean/wcm/FilePickerBean.java",
"license": "lgpl-3.0",
"size": 39604
}
|
[
"javax.faces.context.FacesContext",
"org.alfresco.service.cmr.avm.AVMService",
"org.alfresco.web.bean.repository.Repository"
] |
import javax.faces.context.FacesContext; import org.alfresco.service.cmr.avm.AVMService; import org.alfresco.web.bean.repository.Repository;
|
import javax.faces.context.*; import org.alfresco.service.cmr.avm.*; import org.alfresco.web.bean.repository.*;
|
[
"javax.faces",
"org.alfresco.service",
"org.alfresco.web"
] |
javax.faces; org.alfresco.service; org.alfresco.web;
| 2,757,236
|
// TODO(binfan): make this private and use whitebox to access this method in test
public TTransport getClientTransport(String username, String password, String impersonationUser,
InetSocketAddress serverAddress) throws UnauthenticatedException {
TTransport baseTransport = ThriftUtils.createThriftSocket(serverAddress);
try {
return new TSaslClientTransport(PlainSaslServerProvider.MECHANISM, impersonationUser, null,
null, new HashMap<String, String>(),
new PlainSaslClientCallbackHandler(username, password), baseTransport);
} catch (SaslException e) {
throw new UnauthenticatedException(e.getMessage(), e);
}
}
|
TTransport function(String username, String password, String impersonationUser, InetSocketAddress serverAddress) throws UnauthenticatedException { TTransport baseTransport = ThriftUtils.createThriftSocket(serverAddress); try { return new TSaslClientTransport(PlainSaslServerProvider.MECHANISM, impersonationUser, null, null, new HashMap<String, String>(), new PlainSaslClientCallbackHandler(username, password), baseTransport); } catch (SaslException e) { throw new UnauthenticatedException(e.getMessage(), e); } }
|
/**
* Gets a PLAIN mechanism transport for client side.
*
* @param username User Name of PlainClient
* @param password Password of PlainClient
* @param impersonationUser impersonation user (not used if null)
* @param serverAddress address of the server
* @return Wrapped transport with PLAIN mechanism
*/
|
Gets a PLAIN mechanism transport for client side
|
getClientTransport
|
{
"repo_name": "Reidddddd/alluxio",
"path": "core/common/src/main/java/alluxio/security/authentication/PlainSaslTransportProvider.java",
"license": "apache-2.0",
"size": 5107
}
|
[
"java.net.InetSocketAddress",
"java.util.HashMap",
"javax.security.sasl.SaslException",
"org.apache.thrift.transport.TSaslClientTransport",
"org.apache.thrift.transport.TTransport"
] |
import java.net.InetSocketAddress; import java.util.HashMap; import javax.security.sasl.SaslException; import org.apache.thrift.transport.TSaslClientTransport; import org.apache.thrift.transport.TTransport;
|
import java.net.*; import java.util.*; import javax.security.sasl.*; import org.apache.thrift.transport.*;
|
[
"java.net",
"java.util",
"javax.security",
"org.apache.thrift"
] |
java.net; java.util; javax.security; org.apache.thrift;
| 1,594,236
|
public static void copyFromStreamToBuffer(ByteBuffer out,
DataInputStream in, int length) throws IOException {
if (out.hasArray()) {
in.readFully(out.array(), out.position() + out.arrayOffset(),
length);
skip(out, length);
} else {
for (int i = 0; i < length; ++i) {
out.put(in.readByte());
}
}
}
|
static void function(ByteBuffer out, DataInputStream in, int length) throws IOException { if (out.hasArray()) { in.readFully(out.array(), out.position() + out.arrayOffset(), length); skip(out, length); } else { for (int i = 0; i < length; ++i) { out.put(in.readByte()); } } }
|
/**
* Copy the given number of bytes from the given stream and put it at the
* current position of the given buffer, updating the position in the buffer.
* @param out the buffer to write data to
* @param in the stream to read data from
* @param length the number of bytes to read/write
*/
|
Copy the given number of bytes from the given stream and put it at the current position of the given buffer, updating the position in the buffer
|
copyFromStreamToBuffer
|
{
"repo_name": "Jackygq1982/hbase_src",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/util/ByteBufferUtils.java",
"license": "apache-2.0",
"size": 13495
}
|
[
"java.io.DataInputStream",
"java.io.IOException",
"java.nio.ByteBuffer"
] |
import java.io.DataInputStream; import java.io.IOException; import java.nio.ByteBuffer;
|
import java.io.*; import java.nio.*;
|
[
"java.io",
"java.nio"
] |
java.io; java.nio;
| 75,230
|
@Test(expected = Exception.class)
public void testGetFileException() throws Exception {
// Null exception must be thrown
factory.getFile(null);
}
|
@Test(expected = Exception.class) void function() throws Exception { factory.getFile(null); }
|
/**
* Tests exception handling for getting files
*/
|
Tests exception handling for getting files
|
testGetFileException
|
{
"repo_name": "venicegeo/pz-jobcommon",
"path": "src/test/java/model/data/FileAccessTest.java",
"license": "apache-2.0",
"size": 3833
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 452,078
|
@ServiceMethod(returns = ReturnType.SINGLE)
public DeleteOperationResultInner delete(String resourceGroupName, String profileName) {
return deleteAsync(resourceGroupName, profileName).block();
}
|
@ServiceMethod(returns = ReturnType.SINGLE) DeleteOperationResultInner function(String resourceGroupName, String profileName) { return deleteAsync(resourceGroupName, profileName).block(); }
|
/**
* Deletes a Traffic Manager profile.
*
* @param resourceGroupName The name of the resource group containing the Traffic Manager profile to be deleted.
* @param profileName The name of the Traffic Manager profile to be deleted.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the result of the request or operation.
*/
|
Deletes a Traffic Manager profile
|
delete
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-trafficmanager/src/main/java/com/azure/resourcemanager/trafficmanager/implementation/ProfilesClientImpl.java",
"license": "mit",
"size": 57785
}
|
[
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.trafficmanager.fluent.models.DeleteOperationResultInner"
] |
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.trafficmanager.fluent.models.DeleteOperationResultInner;
|
import com.azure.core.annotation.*; import com.azure.resourcemanager.trafficmanager.fluent.models.*;
|
[
"com.azure.core",
"com.azure.resourcemanager"
] |
com.azure.core; com.azure.resourcemanager;
| 235,459
|
public static boolean isAllowed(String url, String method) throws IOException {
FaceletsAuthorizeTag authorizeTag = new FaceletsAuthorizeTag();
authorizeTag.setUrl(url);
authorizeTag.setMethod(method);
return authorizeTag.authorizeUsingUrlCheck();
}
|
static boolean function(String url, String method) throws IOException { FaceletsAuthorizeTag authorizeTag = new FaceletsAuthorizeTag(); authorizeTag.setUrl(url); authorizeTag.setMethod(method); return authorizeTag.authorizeUsingUrlCheck(); }
|
/**
* Returns true if the user is allowed to access the given URL and HTTP
* method combination. The HTTP method is optional and case insensitive.
* @param url to be accessed.
* @param method to be called.
* @return computation if the user is allowed to access the given URL and HTTP method.
* @throws IOException io exception
*/
|
Returns true if the user is allowed to access the given URL and HTTP method combination. The HTTP method is optional and case insensitive
|
isAllowed
|
{
"repo_name": "larsgrefer/joinfaces",
"path": "joinfaces-security-taglib/src/main/java/org/joinfaces/security/taglib/FaceletsAuthorizeTagUtils.java",
"license": "apache-2.0",
"size": 4138
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,929,356
|
public void addAccessToClass(org.ontoware.rdfreactor.schema.rdfs.Class value) {
Base.add(this.model, this.getResource(), ACCESS_TO_CLASS, value);
}
|
void function(org.ontoware.rdfreactor.schema.rdfs.Class value) { Base.add(this.model, this.getResource(), ACCESS_TO_CLASS, value); }
|
/**
* Adds a value to property AccessToClass from an instance of
* org.ontoware.rdfreactor.schema.rdfs.Class [Generated from RDFReactor
* template rule #add4dynamic]
*/
|
Adds a value to property AccessToClass from an instance of org.ontoware.rdfreactor.schema.rdfs.Class [Generated from RDFReactor template rule #add4dynamic]
|
addAccessToClass
|
{
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-w3-wacl/src/main/java/org/w3/ns/auth/acl/Authorization.java",
"license": "mit",
"size": 78044
}
|
[
"org.ontoware.rdfreactor.runtime.Base"
] |
import org.ontoware.rdfreactor.runtime.Base;
|
import org.ontoware.rdfreactor.runtime.*;
|
[
"org.ontoware.rdfreactor"
] |
org.ontoware.rdfreactor;
| 675,203
|
public void close() throws IOException {
if (in != null) {
try {
in.close();
} finally {
in = null;
}
}
}
|
void function() throws IOException { if (in != null) { try { in.close(); } finally { in = null; } } }
|
/**
* Closes the stream and calls <code>in.close()</code>.
* If the stream was already closed, this does nothing.
*
* @throws IOException if thrown by <code>in.close()</code>
*/
|
Closes the stream and calls <code>in.close()</code>. If the stream was already closed, this does nothing
|
close
|
{
"repo_name": "itsgreco/VirtueRS3",
"path": "src/org/virtue/cache/utility/tukaani/DeltaInputStream.java",
"license": "mit",
"size": 4188
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,726,248
|
public void addAttachment(String name, InputStream content) {
try {
byte[] binaryData = StreamUtils.toByteArray(content);
attachments.put(name, map("content_type", MimeUtil.mostSpecificContentType(binaryData), "data", new String(
Base64.encodeBase64(binaryData))));
} catch (IOException e) {
throw new Couch4JException(e);
}
}
|
void function(String name, InputStream content) { try { byte[] binaryData = StreamUtils.toByteArray(content); attachments.put(name, map(STR, MimeUtil.mostSpecificContentType(binaryData), "data", new String( Base64.encodeBase64(binaryData)))); } catch (IOException e) { throw new Couch4JException(e); } }
|
/**
* Add an attachment to the document using the name and the given
* {@link InputStream}.
* <p>
* This method should only be used for "small-ish" attachments.
* <p>
* For larger attachments use the
* {@link Database#saveAttachment(Document, String, InputStream)}.
*
* @param name
* The name for the attachment.
* @param content
* InputStream
*/
|
Add an attachment to the document using the name and the given <code>InputStream</code>. This method should only be used for "small-ish" attachments. For larger attachments use the <code>Database#saveAttachment(Document, String, InputStream)</code>
|
addAttachment
|
{
"repo_name": "lettas/couch4j",
"path": "src/main/java/org/couch4j/api/Document.java",
"license": "mit",
"size": 5784
}
|
[
"java.io.IOException",
"java.io.InputStream",
"org.apache.commons.codec.binary.Base64",
"org.couch4j.exceptions.Couch4JException",
"org.couch4j.util.CollectionUtils",
"org.couch4j.util.MimeUtil",
"org.couch4j.util.StreamUtils"
] |
import java.io.IOException; import java.io.InputStream; import org.apache.commons.codec.binary.Base64; import org.couch4j.exceptions.Couch4JException; import org.couch4j.util.CollectionUtils; import org.couch4j.util.MimeUtil; import org.couch4j.util.StreamUtils;
|
import java.io.*; import org.apache.commons.codec.binary.*; import org.couch4j.exceptions.*; import org.couch4j.util.*;
|
[
"java.io",
"org.apache.commons",
"org.couch4j.exceptions",
"org.couch4j.util"
] |
java.io; org.apache.commons; org.couch4j.exceptions; org.couch4j.util;
| 2,824,188
|
@Override
public double cumulativeProbability(int x) throws MathException {
if (x < 0) {
return 0;
}
if (x == Integer.MAX_VALUE) {
return 1;
}
return Gamma.regularizedGammaQ((double) x + 1, mean, epsilon, maxIterations);
}
|
double function(int x) throws MathException { if (x < 0) { return 0; } if (x == Integer.MAX_VALUE) { return 1; } return Gamma.regularizedGammaQ((double) x + 1, mean, epsilon, maxIterations); }
|
/**
* The probability distribution function P(X <= x) for a Poisson
* distribution.
*
* @param x the value at which the PDF is evaluated.
* @return Poisson distribution function evaluated at x
* @throws MathException if the cumulative probability can not be computed
* due to convergence or other numerical errors.
*/
|
The probability distribution function P(X <= x) for a Poisson distribution
|
cumulativeProbability
|
{
"repo_name": "rbouckaert/YABBY",
"path": "src/yabby/org/apache/commons/math/distribution/PoissonDistributionImpl.java",
"license": "lgpl-3.0",
"size": 9658
}
|
[
"org.apache.commons.math.MathException",
"org.apache.commons.math.special.Gamma"
] |
import org.apache.commons.math.MathException; import org.apache.commons.math.special.Gamma;
|
import org.apache.commons.math.*; import org.apache.commons.math.special.*;
|
[
"org.apache.commons"
] |
org.apache.commons;
| 2,486,486
|
@Override
public Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
EntryEventImpl clientEvent, boolean returnTombstones)
throws TimeoutException, CacheLoaderException {
validateKey(key);
checkReadiness();
checkForNoAccess();
discoverJTA();
boolean miss = true;
Object value = getDataView().findObject(getKeyInfo(key, aCallbackArgument), this,
true, generateCallbacks, null , disableCopyOnRead,
preferCD, requestingClient, clientEvent, returnTombstones);
if (value != null && !Token.isInvalid(value)) {
miss = false;
}
return value;
}
|
Object function(Object key, Object aCallbackArgument, boolean generateCallbacks, boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient, EntryEventImpl clientEvent, boolean returnTombstones) throws TimeoutException, CacheLoaderException { validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); boolean miss = true; Object value = getDataView().findObject(getKeyInfo(key, aCallbackArgument), this, true, generateCallbacks, null , disableCopyOnRead, preferCD, requestingClient, clientEvent, returnTombstones); if (value != null && !Token.isInvalid(value)) { miss = false; } return value; }
|
/**
* override the one in LocalRegion since we don't need to do getDeserialized.
*/
|
override the one in LocalRegion since we don't need to do getDeserialized
|
get
|
{
"repo_name": "davebarnes97/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java",
"license": "apache-2.0",
"size": 381189
}
|
[
"org.apache.geode.cache.CacheLoaderException",
"org.apache.geode.cache.TimeoutException",
"org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID"
] |
import org.apache.geode.cache.CacheLoaderException; import org.apache.geode.cache.TimeoutException; import org.apache.geode.internal.cache.tier.sockets.ClientProxyMembershipID;
|
import org.apache.geode.cache.*; import org.apache.geode.internal.cache.tier.sockets.*;
|
[
"org.apache.geode"
] |
org.apache.geode;
| 1,247,721
|
public String getDefaultsPackageContent() {
return DefaultsPackage.getDefaultsPackageContent(configurationOptions);
}
|
String function() { return DefaultsPackage.getDefaultsPackageContent(configurationOptions); }
|
/**
* Returns the defaults package for the default settings.
*/
|
Returns the defaults package for the default settings
|
getDefaultsPackageContent
|
{
"repo_name": "kamalmarhubi/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/ConfiguredRuleClassProvider.java",
"license": "apache-2.0",
"size": 18621
}
|
[
"com.google.devtools.build.lib.analysis.config.DefaultsPackage"
] |
import com.google.devtools.build.lib.analysis.config.DefaultsPackage;
|
import com.google.devtools.build.lib.analysis.config.*;
|
[
"com.google.devtools"
] |
com.google.devtools;
| 1,450,642
|
public List<String> getClassIdsForUserWithRole(
final String username, final Clazz.Role role)
throws DataAccessException {
try {
return getJdbcTemplate().query(
SQL_GET_CLASS_IDS_FOR_USER_WITH_ROLE,
new Object[] { username, role.toString() },
new SingleColumnRowMapper<String>()
);
}
catch(org.springframework.dao.DataAccessException e) {
throw new DataAccessException(
"Error executing SQL '" +
SQL_GET_CLASS_IDS_FOR_USER_WITH_ROLE +
"' with parameters: " +
username +
", " +
role.toString(),
e);
}
}
|
List<String> function( final String username, final Clazz.Role role) throws DataAccessException { try { return getJdbcTemplate().query( SQL_GET_CLASS_IDS_FOR_USER_WITH_ROLE, new Object[] { username, role.toString() }, new SingleColumnRowMapper<String>() ); } catch(org.springframework.dao.DataAccessException e) { throw new DataAccessException( STR + SQL_GET_CLASS_IDS_FOR_USER_WITH_ROLE + STR + username + STR + role.toString(), e); } }
|
/**
* Retrieves the list of class identifiers for a user with a given role in
* that class.
*
* @param username The user's username.
*
* @param role The user's class role.
*
* @return The list of class identifiers.
*
* @throws DataAccessException Thrown if there is an error.
*/
|
Retrieves the list of class identifiers for a user with a given role in that class
|
getClassIdsForUserWithRole
|
{
"repo_name": "HaiJiaoXinHeng/server-1",
"path": "src/org/ohmage/query/impl/UserClassQueries.java",
"license": "apache-2.0",
"size": 14373
}
|
[
"java.util.List",
"org.ohmage.domain.Clazz",
"org.ohmage.exception.DataAccessException",
"org.springframework.jdbc.core.SingleColumnRowMapper"
] |
import java.util.List; import org.ohmage.domain.Clazz; import org.ohmage.exception.DataAccessException; import org.springframework.jdbc.core.SingleColumnRowMapper;
|
import java.util.*; import org.ohmage.domain.*; import org.ohmage.exception.*; import org.springframework.jdbc.core.*;
|
[
"java.util",
"org.ohmage.domain",
"org.ohmage.exception",
"org.springframework.jdbc"
] |
java.util; org.ohmage.domain; org.ohmage.exception; org.springframework.jdbc;
| 134,456
|
public void testContainsAll() {
TreeSet q = populatedSet(SIZE);
TreeSet p = new TreeSet();
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.containsAll(p));
assertFalse(p.containsAll(q));
p.add(new Integer(i));
}
assertTrue(p.containsAll(q));
}
|
void function() { TreeSet q = populatedSet(SIZE); TreeSet p = new TreeSet(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); }
|
/**
* containsAll(c) is true when c contains a subset of elements
*/
|
containsAll(c) is true when c contains a subset of elements
|
testContainsAll
|
{
"repo_name": "md-5/jdk10",
"path": "test/jdk/java/util/concurrent/tck/TreeSetTest.java",
"license": "gpl-2.0",
"size": 30637
}
|
[
"java.util.TreeSet"
] |
import java.util.TreeSet;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,009,332
|
@Test
public void shouldHandleErrorAtEndOfWalk() throws IOException, InterruptedException {
expect(configuration.createPDU(PDU.GETBULK)).andReturn(new PDU());
expect(target.getVersion()).andReturn(SnmpConstants.version2c);
expect(configuration.getMaxRepetitions()).andReturn(1);
expectToGetBulkAndGenerateException(DUMMY_OID1);
replayAll();
final WalkResponse response = session.walkDevice(variableHandler, oidList);
assertFalse(response.isSuccess());
verifyAll();
}
|
void function() throws IOException, InterruptedException { expect(configuration.createPDU(PDU.GETBULK)).andReturn(new PDU()); expect(target.getVersion()).andReturn(SnmpConstants.version2c); expect(configuration.getMaxRepetitions()).andReturn(1); expectToGetBulkAndGenerateException(DUMMY_OID1); replayAll(); final WalkResponse response = session.walkDevice(variableHandler, oidList); assertFalse(response.isSuccess()); verifyAll(); }
|
/**
* Should handle error at end of walk.
*
* @throws IOException the io exception
* @throws InterruptedException the interrupted exception
*/
|
Should handle error at end of walk
|
shouldHandleErrorAtEndOfWalk
|
{
"repo_name": "btisystems/snmp-core",
"path": "src/test/java/com/btisystems/pronx/ems/core/snmp/SnmpSessionTest.java",
"license": "apache-2.0",
"size": 28791
}
|
[
"java.io.IOException",
"org.easymock.EasyMock",
"org.junit.Assert",
"org.snmp4j.mp.SnmpConstants"
] |
import java.io.IOException; import org.easymock.EasyMock; import org.junit.Assert; import org.snmp4j.mp.SnmpConstants;
|
import java.io.*; import org.easymock.*; import org.junit.*; import org.snmp4j.mp.*;
|
[
"java.io",
"org.easymock",
"org.junit",
"org.snmp4j.mp"
] |
java.io; org.easymock; org.junit; org.snmp4j.mp;
| 2,210,288
|
public static void setName(Model model,
org.ontoware.rdf2go.model.node.Resource instanceResource,
java.lang.String value) {
Base.set(model, instanceResource, NAME, value);
}
|
static void function(Model model, org.ontoware.rdf2go.model.node.Resource instanceResource, java.lang.String value) { Base.set(model, instanceResource, NAME, value); }
|
/**
* Sets a value of property Name from an instance of java.lang.String First,
* all existing values are removed, then this value is added. Cardinality
* constraints are not checked, but this method exists only for properties
* with no minCardinality or minCardinality == 1.
*
* @param model an RDF2Go model
* @param resource an RDF2Go resource
* @param value the value to be added [Generated from RDFReactor template
* rule #set3static]
*/
|
Sets a value of property Name from an instance of java.lang.String First, all existing values are removed, then this value is added. Cardinality constraints are not checked, but this method exists only for properties with no minCardinality or minCardinality == 1
|
setName
|
{
"repo_name": "m0ep/master-thesis",
"path": "source/apis/rdf2go/rdf2go-foaf/src/main/java/com/xmlns/foaf/Thing.java",
"license": "mit",
"size": 274766
}
|
[
"org.ontoware.rdf2go.model.Model",
"org.ontoware.rdfreactor.runtime.Base"
] |
import org.ontoware.rdf2go.model.Model; import org.ontoware.rdfreactor.runtime.Base;
|
import org.ontoware.rdf2go.model.*; import org.ontoware.rdfreactor.runtime.*;
|
[
"org.ontoware.rdf2go",
"org.ontoware.rdfreactor"
] |
org.ontoware.rdf2go; org.ontoware.rdfreactor;
| 2,809,991
|
boolean updateAddressInfo(SimpleString address, Collection<RoutingType> routingTypes) throws Exception;
|
boolean updateAddressInfo(SimpleString address, Collection<RoutingType> routingTypes) throws Exception;
|
/**
* Updates an {@code AddressInfo} on the broker with the specified routing types.
*
* @param address the name of the {@code AddressInfo} to update
* @param routingTypes the routing types to update the {@code AddressInfo} with
* @return {@code true} if the {@code AddressInfo} was updated, {@code false} otherwise
* @throws Exception
*/
|
Updates an AddressInfo on the broker with the specified routing types
|
updateAddressInfo
|
{
"repo_name": "pgfox/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/server/ActiveMQServer.java",
"license": "apache-2.0",
"size": 17573
}
|
[
"java.util.Collection",
"org.apache.activemq.artemis.api.core.RoutingType",
"org.apache.activemq.artemis.api.core.SimpleString"
] |
import java.util.Collection; import org.apache.activemq.artemis.api.core.RoutingType; import org.apache.activemq.artemis.api.core.SimpleString;
|
import java.util.*; import org.apache.activemq.artemis.api.core.*;
|
[
"java.util",
"org.apache.activemq"
] |
java.util; org.apache.activemq;
| 1,765,856
|
public List<HostRoleCommand> getRequestTasks(long requestId);
|
List<HostRoleCommand> function(long requestId);
|
/**
* Given a request id, get all the tasks that belong to this request
*/
|
Given a request id, get all the tasks that belong to this request
|
getRequestTasks
|
{
"repo_name": "arenadata/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionDBAccessor.java",
"license": "apache-2.0",
"size": 8089
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,191,963
|
public void onPartitionEvicted(GridDhtLocalPartition part, boolean updateSeq) {
if (!enterBusy())
return;
try {
top.onEvicted(part, updateSeq);
if (cctx.events().isRecordable(EVT_CACHE_REBALANCE_PART_UNLOADED))
cctx.events().addUnloadEvent(part.id());
if (updateSeq)
cctx.shared().exchange().scheduleResendPartitions();
}
finally {
leaveBusy();
}
}
|
void function(GridDhtLocalPartition part, boolean updateSeq) { if (!enterBusy()) return; try { top.onEvicted(part, updateSeq); if (cctx.events().isRecordable(EVT_CACHE_REBALANCE_PART_UNLOADED)) cctx.events().addUnloadEvent(part.id()); if (updateSeq) cctx.shared().exchange().scheduleResendPartitions(); } finally { leaveBusy(); } }
|
/**
* Resends partitions on partition evict within configured timeout.
*
* @param part Evicted partition.
* @param updateSeq Update sequence.
*/
|
Resends partitions on partition evict within configured timeout
|
onPartitionEvicted
|
{
"repo_name": "agoncharuk/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/preloader/GridDhtPreloader.java",
"license": "apache-2.0",
"size": 23372
}
|
[
"org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition"
] |
import org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtLocalPartition;
|
import org.apache.ignite.internal.processors.cache.distributed.dht.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 1,767,767
|
public static void remove(final Connection connection, final String filename, boolean useLike) {
try {
String query =
"DELETE FROM " + TABLE_NAME + " WHERE FILENAME " +
(useLike ? "LIKE " : "= ") + sqlQuote(filename);
try (Statement statement = connection.createStatement()) {
int rows = statement.executeUpdate(query);
LOGGER.trace("Removed entries {} in " + TABLE_NAME + " for filename \"{}\"", rows, filename);
}
} catch (SQLException e) {
LOGGER.error(LOG_ERROR_WHILE_IN_FOR, DATABASE_NAME, "removing entries", TABLE_NAME, filename, e.getMessage());
LOGGER.trace("", e);
}
}
|
static void function(final Connection connection, final String filename, boolean useLike) { try { String query = STR + TABLE_NAME + STR + (useLike ? STR : STR) + sqlQuote(filename); try (Statement statement = connection.createStatement()) { int rows = statement.executeUpdate(query); LOGGER.trace(STR + TABLE_NAME + STR{}\STRremoving entriesSTR", e); } }
|
/**
* Removes an entry or entries based on its FILENAME. If {@code useLike} is
* {@code true}, {@code filename} must be properly escaped.
*
* @see Tables#sqlLikeEscape(String)
*
* @param connection the db connection
* @param filename the filename to remove
* @param useLike {@code true} if {@code LIKE} should be used as the compare
* operator, {@code false} if {@code =} should be used.
*/
|
Removes an entry or entries based on its FILENAME. If useLike is true, filename must be properly escaped
|
remove
|
{
"repo_name": "UniversalMediaServer/UniversalMediaServer",
"path": "src/main/java/net/pms/database/MediaTableVideoMetadataActors.java",
"license": "gpl-2.0",
"size": 6500
}
|
[
"java.sql.Connection",
"java.sql.Statement"
] |
import java.sql.Connection; import java.sql.Statement;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,645,518
|
protected void changeGeneralLedgerPendingEntriesApprovedStatusCode() {
for (GeneralLedgerPendingEntry glpe : getGeneralLedgerPendingEntries()) {
glpe.setFinancialDocumentApprovedCode(KFSConstants.DocumentStatusCodes.APPROVED);
}
}
|
void function() { for (GeneralLedgerPendingEntry glpe : getGeneralLedgerPendingEntries()) { glpe.setFinancialDocumentApprovedCode(KFSConstants.DocumentStatusCodes.APPROVED); } }
|
/**
* This method iterates over all of the GLPEs for a document and sets their approved status code to APPROVED "A".
*/
|
This method iterates over all of the GLPEs for a document and sets their approved status code to APPROVED "A"
|
changeGeneralLedgerPendingEntriesApprovedStatusCode
|
{
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/sys/document/GeneralLedgerPostingDocumentBase.java",
"license": "agpl-3.0",
"size": 9160
}
|
[
"org.kuali.kfs.sys.KFSConstants",
"org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry"
] |
import org.kuali.kfs.sys.KFSConstants; import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry;
|
import org.kuali.kfs.sys.*; import org.kuali.kfs.sys.businessobject.*;
|
[
"org.kuali.kfs"
] |
org.kuali.kfs;
| 340,731
|
void setHeaders(Map<String, Header> headers);
|
void setHeaders(Map<String, Header> headers);
|
/**
* Headers property of an Encoding is a map that allows additional information to be provided as headers
* <p>
* This method sets the headers property of Encoding instance to the passed headers argument.
* </p>
* @param headers a map of name to corresponding header object
*/
|
Headers property of an Encoding is a map that allows additional information to be provided as headers This method sets the headers property of Encoding instance to the passed headers argument.
|
setHeaders
|
{
"repo_name": "arthurdm/microprofile-open-api",
"path": "api/src/main/java/org/eclipse/microprofile/openapi/models/media/Encoding.java",
"license": "apache-2.0",
"size": 9197
}
|
[
"java.util.Map",
"org.eclipse.microprofile.openapi.models.headers.Header"
] |
import java.util.Map; import org.eclipse.microprofile.openapi.models.headers.Header;
|
import java.util.*; import org.eclipse.microprofile.openapi.models.headers.*;
|
[
"java.util",
"org.eclipse.microprofile"
] |
java.util; org.eclipse.microprofile;
| 1,302,561
|
public void addPages() {
// Create a page, set the title, and the initial model file name.
//
newFileCreationPage = new SoamodelModelWizardNewFileCreationPage("Whatever", selection);
newFileCreationPage.setTitle(SoaModelEditorPlugin.INSTANCE.getString("_UI_SoamodelModelWizard_label"));
newFileCreationPage.setDescription(SoaModelEditorPlugin.INSTANCE.getString("_UI_SoamodelModelWizard_description"));
newFileCreationPage.setFileName(SoaModelEditorPlugin.INSTANCE.getString("_UI_SoamodelEditorFilenameDefaultBase") + "." + (String)FILE_EXTENSIONS.get(0));
addPage(newFileCreationPage);
// Try and get the resource selection to determine a current directory for the file dialog.
//
if (selection != null && !selection.isEmpty()) {
// Get the resource...
//
Object selectedElement = selection.iterator().next();
if (selectedElement instanceof IResource) {
// Get the resource parent, if its a file.
//
IResource selectedResource = (IResource)selectedElement;
if (selectedResource.getType() == IResource.FILE) {
selectedResource = selectedResource.getParent();
}
// This gives us a directory...
//
if (selectedResource instanceof IFolder || selectedResource instanceof IProject) {
// Set this for the container.
//
newFileCreationPage.setContainerFullPath(selectedResource.getFullPath());
// Make up a unique new name here.
//
String defaultModelBaseFilename = SoaModelEditorPlugin.INSTANCE.getString("_UI_SoamodelEditorFilenameDefaultBase");
String defaultModelFilenameExtension = (String)FILE_EXTENSIONS.get(0);
String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension;
for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) {
modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension;
}
newFileCreationPage.setFileName(modelFilename);
}
}
}
initialObjectCreationPage = new SoamodelModelWizardInitialObjectCreationPage("Whatever2");
initialObjectCreationPage.setTitle(SoaModelEditorPlugin.INSTANCE.getString("_UI_SoamodelModelWizard_label"));
initialObjectCreationPage.setDescription(SoaModelEditorPlugin.INSTANCE.getString("_UI_Wizard_initial_object_description"));
addPage(initialObjectCreationPage);
}
|
void function() { newFileCreationPage = new SoamodelModelWizardNewFileCreationPage(STR, selection); newFileCreationPage.setTitle(SoaModelEditorPlugin.INSTANCE.getString(STR)); newFileCreationPage.setDescription(SoaModelEditorPlugin.INSTANCE.getString(STR)); newFileCreationPage.setFileName(SoaModelEditorPlugin.INSTANCE.getString(STR) + "." + (String)FILE_EXTENSIONS.get(0)); addPage(newFileCreationPage); if (selection != null && !selection.isEmpty()) { Object selectedElement = selection.iterator().next(); if (selectedElement instanceof IResource) { IResource selectedResource = (IResource)selectedElement; if (selectedResource.getType() == IResource.FILE) { selectedResource = selectedResource.getParent(); } if (selectedResource instanceof IFolder selectedResource instanceof IProject) { newFileCreationPage.setContainerFullPath(selectedResource.getFullPath()); String defaultModelBaseFilename = SoaModelEditorPlugin.INSTANCE.getString(STR); String defaultModelFilenameExtension = (String)FILE_EXTENSIONS.get(0); String modelFilename = defaultModelBaseFilename + "." + defaultModelFilenameExtension; for (int i = 1; ((IContainer)selectedResource).findMember(modelFilename) != null; ++i) { modelFilename = defaultModelBaseFilename + i + "." + defaultModelFilenameExtension; } newFileCreationPage.setFileName(modelFilename); } } } initialObjectCreationPage = new SoamodelModelWizardInitialObjectCreationPage(STR); initialObjectCreationPage.setTitle(SoaModelEditorPlugin.INSTANCE.getString(STR)); initialObjectCreationPage.setDescription(SoaModelEditorPlugin.INSTANCE.getString(STR)); addPage(initialObjectCreationPage); }
|
/**
* The framework calls this to create the contents of the wizard.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
The framework calls this to create the contents of the wizard.
|
addPages
|
{
"repo_name": "darvasd/gsoaarchitect",
"path": "hu.bme.mit.inf.gs.dsl.editor/src/soamodel/presentation/SoamodelModelWizard.java",
"license": "mit",
"size": 18390
}
|
[
"org.eclipse.core.resources.IContainer",
"org.eclipse.core.resources.IFolder",
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.IResource"
] |
import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IFolder; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.*;
|
[
"org.eclipse.core"
] |
org.eclipse.core;
| 2,712,299
|
public Enumeration listOptions () {
Vector result = new Vector();
result.addElement(new Option(
"\tnumber of clusters. If omitted or -1 specified, then \n"
+ "\tcross validation is used to select the number of clusters.",
"N", 1, "-N <num>"));
result.addElement(new Option(
"\tmax iterations."
+ "\n(default 100)",
"I", 1, "-I <num>"));
result.addElement(new Option(
"\tverbose.",
"V", 0, "-V"));
result.addElement(new Option(
"\tminimum allowable standard deviation for normal density\n"
+ "\tcomputation\n"
+ "\t(default 1e-6)",
"M",1,"-M <num>"));
result.addElement(
new Option("\tDisplay model in old format (good when there are "
+ "many clusters)\n",
"O", 0, "-O"));
Enumeration en = super.listOptions();
while (en.hasMoreElements())
result.addElement(en.nextElement());
return result.elements();
}
|
Enumeration function () { Vector result = new Vector(); result.addElement(new Option( STR + STR, "N", 1, STR)); result.addElement(new Option( STR + STR, "I", 1, STR)); result.addElement(new Option( STR, "V", 0, "-V")); result.addElement(new Option( STR + STR + STR, "M",1,STR)); result.addElement( new Option(STR + STR, "O", 0, "-O")); Enumeration en = super.listOptions(); while (en.hasMoreElements()) result.addElement(en.nextElement()); return result.elements(); }
|
/**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/
|
Returns an enumeration describing the available options
|
listOptions
|
{
"repo_name": "BaldoAgosta/weka-dev",
"path": "src/weka/clusterers/EM_wedo_user_doc.java",
"license": "apache-2.0",
"size": 41563
}
|
[
"java.util.Enumeration",
"java.util.Vector"
] |
import java.util.Enumeration; import java.util.Vector;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 956,152
|
public static Object createInstance(String userClassName,
ClassLoader classLoader) {
Class<?> theCls;
try {
theCls = Class.forName(userClassName, true, classLoader);
} catch (ClassNotFoundException | NoClassDefFoundError cnfe) {
throw new RuntimeException("User class must be in class path", cnfe);
}
Object result;
try {
Constructor<?> meth = constructorCache.get(theCls);
if (null == meth) {
meth = theCls.getDeclaredConstructor();
meth.setAccessible(true);
constructorCache.put(theCls, meth);
}
result = meth.newInstance();
} catch (InstantiationException ie) {
throw new RuntimeException("User class must be concrete", ie);
} catch (NoSuchMethodException e) {
throw new RuntimeException("User class doesn't have such method", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("User class must have a no-arg constructor", e);
} catch (InvocationTargetException e) {
throw new RuntimeException("User class constructor throws exception", e);
}
return result;
}
|
static Object function(String userClassName, ClassLoader classLoader) { Class<?> theCls; try { theCls = Class.forName(userClassName, true, classLoader); } catch (ClassNotFoundException NoClassDefFoundError cnfe) { throw new RuntimeException(STR, cnfe); } Object result; try { Constructor<?> meth = constructorCache.get(theCls); if (null == meth) { meth = theCls.getDeclaredConstructor(); meth.setAccessible(true); constructorCache.put(theCls, meth); } result = meth.newInstance(); } catch (InstantiationException ie) { throw new RuntimeException(STR, ie); } catch (NoSuchMethodException e) { throw new RuntimeException(STR, e); } catch (IllegalAccessException e) { throw new RuntimeException(STR, e); } catch (InvocationTargetException e) { throw new RuntimeException(STR, e); } return result; }
|
/**
* Create an instance of <code>userClassName</code> using provided <code>classLoader</code>.
*
* @param userClassName user class name
* @param classLoader class loader to load the class.
* @return the instance
*/
|
Create an instance of <code>userClassName</code> using provided <code>classLoader</code>
|
createInstance
|
{
"repo_name": "yahoo/pulsar",
"path": "pulsar-common/src/main/java/org/apache/pulsar/common/util/Reflections.java",
"license": "apache-2.0",
"size": 13015
}
|
[
"java.lang.reflect.Constructor",
"java.lang.reflect.InvocationTargetException"
] |
import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 1,859,124
|
@SuppressWarnings("unchecked")
public static void addAdvice(Class cls, Advice advice) {
getServiceContext().addAdvice(cls, advice);
}
|
@SuppressWarnings(STR) static void function(Class cls, Advice advice) { getServiceContext().addAdvice(cls, advice); }
|
/**
* Adds an AOP advice object around the given Class <code>cls</code>
* <p>
* Advice comes in the form of before or afterReturning methods
*
* @param cls
* @param advice
*/
|
Adds an AOP advice object around the given Class <code>cls</code> Advice comes in the form of before or afterReturning methods
|
addAdvice
|
{
"repo_name": "preethi29/openmrs-core",
"path": "api/src/main/java/org/openmrs/api/context/Context.java",
"license": "mpl-2.0",
"size": 41482
}
|
[
"org.aopalliance.aop.Advice"
] |
import org.aopalliance.aop.Advice;
|
import org.aopalliance.aop.*;
|
[
"org.aopalliance.aop"
] |
org.aopalliance.aop;
| 2,173,884
|
void purgeHistory() {
java.util.Date cutOff = new java.util.Date(System.currentTimeMillis() -
historyInterval);
List<String> toRemove = new java.util.ArrayList<String>();
for (String key: history.keySet()) {
java.util.Date item = history.get(key);
if (item.before(cutOff)) {
toRemove.add(key);
}
}
for (String key: toRemove) {
LOG.info("Removing " + key + " from history");
history.remove(key);
}
}
|
void purgeHistory() { java.util.Date cutOff = new java.util.Date(System.currentTimeMillis() - historyInterval); List<String> toRemove = new java.util.ArrayList<String>(); for (String key: history.keySet()) { java.util.Date item = history.get(key); if (item.before(cutOff)) { toRemove.add(key); } } for (String key: toRemove) { LOG.info(STR + key + STR); history.remove(key); } }
|
/**
* We maintain history of fixed files because a fixed file may appear in
* the list of corrupt files if we loop around too quickly.
* This function removes the old items in the history so that we can
* recognize files that have actually become corrupt since being fixed.
*/
|
We maintain history of fixed files because a fixed file may appear in the list of corrupt files if we loop around too quickly. This function removes the old items in the history so that we can recognize files that have actually become corrupt since being fixed
|
purgeHistory
|
{
"repo_name": "leonhong/hadoop-20-warehouse",
"path": "src/contrib/raid/src/java/org/apache/hadoop/raid/LocalBlockFixer.java",
"license": "apache-2.0",
"size": 5335
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,035,335
|
private void userCreate(String userId, HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, DatabaseException, NoSuchAlgorithmException, AccessDeniedException {
log.debug("userCreate({}, {}, {})", new Object[] { userId, request, response });
if (WebUtils.getBoolean(request, "persist")) {
String reqCsrft = WebUtils.getString(request, "csrft");
String sesCsrft = (String) request.getSession().getAttribute("csrft");
if (reqCsrft.equals(sesCsrft)) {
String usrId = WebUtils.getString(request, "usr_id");
if (AuthDAO.findUserByPk(usrId) == null) {
if (usrId.matches(Config.PRINCIPAL_IDENTIFIER_VALIDATION)) {
User usr = new User();
usr.setId(usrId);
usr.setName(WebUtils.getString(request, "usr_name"));
usr.setPassword(WebUtils.getString(request, "usr_password"));
usr.setEmail(WebUtils.getString(request, "usr_email"));
usr.setActive(WebUtils.getBoolean(request, "usr_active"));
List<String> usrRoles = WebUtils.getStringList(request, "usr_roles");
for (String rolId : usrRoles) {
usr.getRoles().add(AuthDAO.findRoleByPk(rolId));
}
AuthDAO.createUser(usr);
// Activity log
UserActivity.log(userId, "ADMIN_USER_CREATE", usr.getId(), null, usr.toString());
} else {
throw new DatabaseException("Invalid identifier");
}
} else {
throw new DatabaseException("User name already taken");
}
} else {
// Activity log
UserActivity.log(request.getRemoteUser(), "ADMIN_SECURITY_RISK", request.getRemoteHost(), null, null);
throw new AccessDeniedException("Security risk detected");
}
} else {
String genCsrft = SecureStore.md5Encode(UUID.randomUUID().toString().getBytes());
request.getSession().setAttribute("csrft", genCsrft);
ServletContext sc = getServletContext();
sc.setAttribute("action", WebUtils.getString(request, "action"));
sc.setAttribute("persist", true);
sc.setAttribute("csrft", genCsrft);
sc.setAttribute("roles", AuthDAO.findAllRoles());
sc.setAttribute("usr", null);
sc.getRequestDispatcher("/admin/user_edit.jsp").forward(request, response);
}
log.debug("userCreate: void");
}
|
void function(String userId, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, DatabaseException, NoSuchAlgorithmException, AccessDeniedException { log.debug(STR, new Object[] { userId, request, response }); if (WebUtils.getBoolean(request, STR)) { String reqCsrft = WebUtils.getString(request, "csrft"); String sesCsrft = (String) request.getSession().getAttribute("csrft"); if (reqCsrft.equals(sesCsrft)) { String usrId = WebUtils.getString(request, STR); if (AuthDAO.findUserByPk(usrId) == null) { if (usrId.matches(Config.PRINCIPAL_IDENTIFIER_VALIDATION)) { User usr = new User(); usr.setId(usrId); usr.setName(WebUtils.getString(request, STR)); usr.setPassword(WebUtils.getString(request, STR)); usr.setEmail(WebUtils.getString(request, STR)); usr.setActive(WebUtils.getBoolean(request, STR)); List<String> usrRoles = WebUtils.getStringList(request, STR); for (String rolId : usrRoles) { usr.getRoles().add(AuthDAO.findRoleByPk(rolId)); } AuthDAO.createUser(usr); UserActivity.log(userId, STR, usr.getId(), null, usr.toString()); } else { throw new DatabaseException(STR); } } else { throw new DatabaseException(STR); } } else { UserActivity.log(request.getRemoteUser(), STR, request.getRemoteHost(), null, null); throw new AccessDeniedException(STR); } } else { String genCsrft = SecureStore.md5Encode(UUID.randomUUID().toString().getBytes()); request.getSession().setAttribute("csrft", genCsrft); ServletContext sc = getServletContext(); sc.setAttribute(STR, WebUtils.getString(request, STR)); sc.setAttribute(STR, true); sc.setAttribute("csrft", genCsrft); sc.setAttribute("roles", AuthDAO.findAllRoles()); sc.setAttribute("usr", null); sc.getRequestDispatcher(STR).forward(request, response); } log.debug(STR); }
|
/**
* New user
*/
|
New user
|
userCreate
|
{
"repo_name": "papamas/DMS-KANGREG-XI-MANADO",
"path": "src/main/java/com/openkm/servlet/admin/AuthServlet.java",
"license": "gpl-3.0",
"size": 27126
}
|
[
"com.openkm.core.AccessDeniedException",
"com.openkm.core.Config",
"com.openkm.core.DatabaseException",
"com.openkm.dao.AuthDAO",
"com.openkm.dao.bean.User",
"com.openkm.util.SecureStore",
"com.openkm.util.UserActivity",
"com.openkm.util.WebUtils",
"java.io.IOException",
"java.security.NoSuchAlgorithmException",
"java.util.List",
"java.util.UUID",
"javax.servlet.ServletContext",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] |
import com.openkm.core.AccessDeniedException; import com.openkm.core.Config; import com.openkm.core.DatabaseException; import com.openkm.dao.AuthDAO; import com.openkm.dao.bean.User; import com.openkm.util.SecureStore; import com.openkm.util.UserActivity; import com.openkm.util.WebUtils; import java.io.IOException; import java.security.NoSuchAlgorithmException; import java.util.List; import java.util.UUID; import javax.servlet.ServletContext; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse;
|
import com.openkm.core.*; import com.openkm.dao.*; import com.openkm.dao.bean.*; import com.openkm.util.*; import java.io.*; import java.security.*; import java.util.*; import javax.servlet.*; import javax.servlet.http.*;
|
[
"com.openkm.core",
"com.openkm.dao",
"com.openkm.util",
"java.io",
"java.security",
"java.util",
"javax.servlet"
] |
com.openkm.core; com.openkm.dao; com.openkm.util; java.io; java.security; java.util; javax.servlet;
| 2,552,365
|
protected SqlNode[] reorder(SqlNode[] operands) {
assert operands.length == order.length;
SqlNode[] newOrder = new SqlNode[operands.length];
for (int i = 0; i < operands.length; i++) {
assert operands[i] != null;
int joyDivision = order[i];
assert newOrder[joyDivision] == null : "mapping is not 1:1";
newOrder[joyDivision] = operands[i];
}
return newOrder;
}
}
private static class JdbcToInternalLookupTable {
static final JdbcToInternalLookupTable INSTANCE =
new JdbcToInternalLookupTable();
private final Map<String, MakeCall> map;
private JdbcToInternalLookupTable() {
// A table of all functions can be found at
// http://java.sun.com/products/jdbc/driverdevs.html
// which is also provided in the javadoc for this class.
// See also SqlOperatorTests.testJdbcFn, which contains the list.
ImmutableMap.Builder<String, MakeCall> map = ImmutableMap.builder();
map.put("ABS", simple(SqlStdOperatorTable.ABS));
map.put("ACOS", simple(SqlStdOperatorTable.ACOS));
map.put("ASIN", simple(SqlStdOperatorTable.ASIN));
map.put("ATAN", simple(SqlStdOperatorTable.ATAN));
map.put("ATAN2", simple(SqlStdOperatorTable.ATAN2));
map.put("CEILING", simple(SqlStdOperatorTable.CEIL));
map.put("COS", simple(SqlStdOperatorTable.COS));
map.put("COT", simple(SqlStdOperatorTable.COT));
map.put("DEGREES", simple(SqlStdOperatorTable.DEGREES));
map.put("EXP", simple(SqlStdOperatorTable.EXP));
map.put("FLOOR", simple(SqlStdOperatorTable.FLOOR));
map.put("LOG", simple(SqlStdOperatorTable.LN));
map.put("LOG10", simple(SqlStdOperatorTable.LOG10));
map.put("MOD", simple(SqlStdOperatorTable.MOD));
map.put("PI", simple(SqlStdOperatorTable.PI));
map.put("POWER", simple(SqlStdOperatorTable.POWER));
map.put("RADIANS", simple(SqlStdOperatorTable.RADIANS));
map.put("RAND", simple(SqlStdOperatorTable.RAND));
map.put("ROUND", simple(SqlStdOperatorTable.ROUND));
map.put("SIGN", simple(SqlStdOperatorTable.SIGN));
map.put("SIN", simple(SqlStdOperatorTable.SIN));
map.put("SQRT", simple(SqlStdOperatorTable.SQRT));
map.put("TAN", simple(SqlStdOperatorTable.TAN));
map.put("TRUNCATE", simple(SqlStdOperatorTable.TRUNCATE));
|
SqlNode[] function(SqlNode[] operands) { assert operands.length == order.length; SqlNode[] newOrder = new SqlNode[operands.length]; for (int i = 0; i < operands.length; i++) { assert operands[i] != null; int joyDivision = order[i]; assert newOrder[joyDivision] == null : STR; newOrder[joyDivision] = operands[i]; } return newOrder; } } private static class JdbcToInternalLookupTable { static final JdbcToInternalLookupTable INSTANCE = new JdbcToInternalLookupTable(); private final Map<String, MakeCall> map; private JdbcToInternalLookupTable() { ImmutableMap.Builder<String, MakeCall> map = ImmutableMap.builder(); map.put("ABS", simple(SqlStdOperatorTable.ABS)); map.put("ACOS", simple(SqlStdOperatorTable.ACOS)); map.put("ASIN", simple(SqlStdOperatorTable.ASIN)); map.put("ATAN", simple(SqlStdOperatorTable.ATAN)); map.put("ATAN2", simple(SqlStdOperatorTable.ATAN2)); map.put(STR, simple(SqlStdOperatorTable.CEIL)); map.put("COS", simple(SqlStdOperatorTable.COS)); map.put("COT", simple(SqlStdOperatorTable.COT)); map.put(STR, simple(SqlStdOperatorTable.DEGREES)); map.put("EXP", simple(SqlStdOperatorTable.EXP)); map.put("FLOOR", simple(SqlStdOperatorTable.FLOOR)); map.put("LOG", simple(SqlStdOperatorTable.LN)); map.put("LOG10", simple(SqlStdOperatorTable.LOG10)); map.put("MOD", simple(SqlStdOperatorTable.MOD)); map.put("PI", simple(SqlStdOperatorTable.PI)); map.put("POWER", simple(SqlStdOperatorTable.POWER)); map.put(STR, simple(SqlStdOperatorTable.RADIANS)); map.put("RAND", simple(SqlStdOperatorTable.RAND)); map.put("ROUND", simple(SqlStdOperatorTable.ROUND)); map.put("SIGN", simple(SqlStdOperatorTable.SIGN)); map.put("SIN", simple(SqlStdOperatorTable.SIN)); map.put("SQRT", simple(SqlStdOperatorTable.SQRT)); map.put("TAN", simple(SqlStdOperatorTable.TAN)); map.put(STR, simple(SqlStdOperatorTable.TRUNCATE));
|
/**
* Uses the data in {@link #order} to reorder a SqlNode[] array.
*
* @param operands Operands
*/
|
Uses the data in <code>#order</code> to reorder a SqlNode[] array
|
reorder
|
{
"repo_name": "minji-kim/calcite",
"path": "core/src/main/java/org/apache/calcite/sql/SqlJdbcFunctionCall.java",
"license": "apache-2.0",
"size": 25631
}
|
[
"com.google.common.collect.ImmutableMap",
"java.util.Map",
"org.apache.calcite.sql.fun.SqlStdOperatorTable"
] |
import com.google.common.collect.ImmutableMap; import java.util.Map; import org.apache.calcite.sql.fun.SqlStdOperatorTable;
|
import com.google.common.collect.*; import java.util.*; import org.apache.calcite.sql.fun.*;
|
[
"com.google.common",
"java.util",
"org.apache.calcite"
] |
com.google.common; java.util; org.apache.calcite;
| 1,196,574
|
public void removeInviteOnly(Channel chan) {
setMode("-i");
}
|
void function(Channel chan) { setMode("-i"); }
|
/**
* Removes invite only (-i) status from the channel. May require operator
* privileges in the channel
* @param chan The channel to preform the mode change on
*/
|
Removes invite only (-i) status from the channel. May require operator privileges in the channel
|
removeInviteOnly
|
{
"repo_name": "AnyBot/AnyBot-Lib",
"path": "src/org/pircbotx/output/OutputChannel.java",
"license": "gpl-3.0",
"size": 19720
}
|
[
"org.pircbotx.Channel"
] |
import org.pircbotx.Channel;
|
import org.pircbotx.*;
|
[
"org.pircbotx"
] |
org.pircbotx;
| 1,677,440
|
public Graphics getGraphics()
{
XGraphics2D xg2d = new XGraphics2D(xwindow);
xg2d.setColor(awtComponent.getForeground());
xg2d.setBackground(awtComponent.getBackground());
xg2d.setFont(awtComponent.getFont());
return xg2d;
}
|
Graphics function() { XGraphics2D xg2d = new XGraphics2D(xwindow); xg2d.setColor(awtComponent.getForeground()); xg2d.setBackground(awtComponent.getBackground()); xg2d.setFont(awtComponent.getFont()); return xg2d; }
|
/**
* Returns a XGraphics suitable for drawing on this frame.
*
* @return a XGraphics suitable for drawing on this frame
*/
|
Returns a XGraphics suitable for drawing on this frame
|
getGraphics
|
{
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/gnu/java/awt/peer/x/XWindowPeer.java",
"license": "gpl-2.0",
"size": 9706
}
|
[
"java.awt.Graphics"
] |
import java.awt.Graphics;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 580,200
|
public Verification verify(final String rawString) throws VerificationError {
Base64 decoder = new Base64();
if (StringUtils.isBlank(rawString)) {
throw new VerificationError("token is blank");
}
String[] pieces = rawString.split("\\.");
if (pieces.length != 3) {
throw new VerificationError("Illegal JWT token.");
}
JSONObject header, claims;
long expiry;
String issuer;
String audience;
try {
header = new JSONObject(new String(decoder.decode(pieces[0])));
claims = new JSONObject(new String(decoder.decode(pieces[1])));
expiry = claims.getLong("exp");
issuer = claims.getString("iss");
audience = claims.optString("aud");
} catch (JSONException e) {
throw new VerificationError("Could not parse token: " + e.getMessage());
}
verifyAudience(audience);
// expiry is, as per spec, the number of seconds since the epoch.
long secondsSinceExpiry = (System.currentTimeMillis() / 1000L) - expiry;
if (secondsSinceExpiry >= 0) {
throw new VerificationError(
String.format("This token expired %d seconds ago", secondsSinceExpiry));
}
if (!canVerify(
header,
claims,
pieces[0] + "." + pieces[1],
decoder.decode(pieces[2]))) {
throw new VerificationError("Could not verify signature.");
}
return new Verification(issuer, getPrincipal(claims), getEmail(claims));
}
|
Verification function(final String rawString) throws VerificationError { Base64 decoder = new Base64(); if (StringUtils.isBlank(rawString)) { throw new VerificationError(STR); } String[] pieces = rawString.split("\\."); if (pieces.length != 3) { throw new VerificationError(STR); } JSONObject header, claims; long expiry; String issuer; String audience; try { header = new JSONObject(new String(decoder.decode(pieces[0]))); claims = new JSONObject(new String(decoder.decode(pieces[1]))); expiry = claims.getLong("exp"); issuer = claims.getString("iss"); audience = claims.optString("aud"); } catch (JSONException e) { throw new VerificationError(STR + e.getMessage()); } verifyAudience(audience); long secondsSinceExpiry = (System.currentTimeMillis() / 1000L) - expiry; if (secondsSinceExpiry >= 0) { throw new VerificationError( String.format(STR, secondsSinceExpiry)); } if (!canVerify( header, claims, pieces[0] + "." + pieces[1], decoder.decode(pieces[2]))) { throw new VerificationError(STR); } return new Verification(issuer, getPrincipal(claims), getEmail(claims)); }
|
/**
* Verify this token and return a verification result.
*
* @param rawString The string representation of the token.
* @return The verification result.
* @throws VerificationError if this claim cannot be verified.
*/
|
Verify this token and return a verification result
|
verify
|
{
"repo_name": "JoeCarlson/intermine",
"path": "intermine/web/main/src/org/intermine/webservice/server/JWTVerifier.java",
"license": "lgpl-2.1",
"size": 11370
}
|
[
"org.apache.commons.codec.binary.Base64",
"org.apache.commons.lang.StringUtils",
"org.json.JSONException",
"org.json.JSONObject"
] |
import org.apache.commons.codec.binary.Base64; import org.apache.commons.lang.StringUtils; import org.json.JSONException; import org.json.JSONObject;
|
import org.apache.commons.codec.binary.*; import org.apache.commons.lang.*; import org.json.*;
|
[
"org.apache.commons",
"org.json"
] |
org.apache.commons; org.json;
| 669,982
|
UNBOUNDED() {
@Override
public ImList<Angle> steps(Angle start, Angle stepSize) {
final int stepSizeDegrees = (int) stepSize.toDegrees();
final int numSteps = (stepSizeDegrees == 0) ? 1 : 360 / stepSizeDegrees;
final List<Angle> angles = IntStream.range(0, numSteps).mapToObj(i -> start.$plus(stepSize.$times(i))).collect(Collectors.toList());
return DefaultImList.create(angles);
}
|
UNBOUNDED() { ImList<Angle> function(Angle start, Angle stepSize) { final int stepSizeDegrees = (int) stepSize.toDegrees(); final int numSteps = (stepSizeDegrees == 0) ? 1 : 360 / stepSizeDegrees; final List<Angle> angles = IntStream.range(0, numSteps).mapToObj(i -> start.$plus(stepSize.$times(i))).collect(Collectors.toList()); return DefaultImList.create(angles); }
|
/**
* Steps through position angles from the start angle through 360 degrees
* by step size.
*/
|
Steps through position angles from the start angle through 360 degrees by step size
|
steps
|
{
"repo_name": "spakzad/ocs",
"path": "bundle/edu.gemini.pot/src/main/java/edu/gemini/spModel/telescope/PosAngleConstraint.java",
"license": "bsd-3-clause",
"size": 3474
}
|
[
"edu.gemini.shared.util.immutable.DefaultImList",
"edu.gemini.shared.util.immutable.ImList",
"edu.gemini.spModel.core.Angle",
"java.util.List",
"java.util.stream.Collectors",
"java.util.stream.IntStream"
] |
import edu.gemini.shared.util.immutable.DefaultImList; import edu.gemini.shared.util.immutable.ImList; import edu.gemini.spModel.core.Angle; import java.util.List; import java.util.stream.Collectors; import java.util.stream.IntStream;
|
import edu.gemini.*; import edu.gemini.shared.util.immutable.*; import java.util.*; import java.util.stream.*;
|
[
"edu.gemini",
"edu.gemini.shared",
"java.util"
] |
edu.gemini; edu.gemini.shared; java.util;
| 161,113
|
@SuppressWarnings("unchecked")
public List<AdverseEventRecommendedReportQuery> searchAdverseEventRecommendedReports(final AdverseEventRecommendedReportQuery query, int firstrow, int maxrows) {
String queryString = query.getQueryString();
log.debug(">>> " + queryString.toString());
return (List<AdverseEventRecommendedReportQuery>) super.search(query, firstrow, maxrows);
}
|
@SuppressWarnings(STR) List<AdverseEventRecommendedReportQuery> function(final AdverseEventRecommendedReportQuery query, int firstrow, int maxrows) { String queryString = query.getQueryString(); log.debug(STR + queryString.toString()); return (List<AdverseEventRecommendedReportQuery>) super.search(query, firstrow, maxrows); }
|
/**
* Search for integration logs using query.
*
* @param query The query used to search for integration logs
* @return The list of integration logs.
*/
|
Search for integration logs using query
|
searchAdverseEventRecommendedReports
|
{
"repo_name": "NCIP/caaers",
"path": "caAERS/software/core/src/main/java/gov/nih/nci/cabig/caaers/dao/AdverseEventRecommendedReportDao.java",
"license": "bsd-3-clause",
"size": 5366
}
|
[
"gov.nih.nci.cabig.caaers.dao.query.AdverseEventRecommendedReportQuery",
"java.util.List"
] |
import gov.nih.nci.cabig.caaers.dao.query.AdverseEventRecommendedReportQuery; import java.util.List;
|
import gov.nih.nci.cabig.caaers.dao.query.*; import java.util.*;
|
[
"gov.nih.nci",
"java.util"
] |
gov.nih.nci; java.util;
| 2,494,916
|
public void setLastDirection(Direction lastDirection) {
this.lastDirection = lastDirection;
}
|
void function(Direction lastDirection) { this.lastDirection = lastDirection; }
|
/**
* Set the last direction this mob was facing.
*
* @param lastDirection The direction to set.
*/
|
Set the last direction this mob was facing
|
setLastDirection
|
{
"repo_name": "Major-/apollo",
"path": "game/src/main/org/apollo/game/model/entity/Mob.java",
"license": "isc",
"size": 13644
}
|
[
"org.apollo.game.model.Direction"
] |
import org.apollo.game.model.Direction;
|
import org.apollo.game.model.*;
|
[
"org.apollo.game"
] |
org.apollo.game;
| 2,541,773
|
public void show()
{
if (mListener == null)
{
throw new NullPointerException(
"Attempting to bind null listener to SlideDayTimePicker");
}
SlideDayTimeDialogFragment dialogFragment =
SlideDayTimeDialogFragment.newInstance(
mListener,
mIsCustomDaysArraySpecified,
mCustomDaysArray,
mInitialDay,
mInitialHour,
mInitialMinute,
mIsClientSpecified24HourTime,
mIs24HourTime,
mTheme,
mIndicatorColor);
dialogFragment.show(mFragmentManager,
SlideDayTimeDialogFragment.TAG_SLIDE_DAY_TIME_DIALOG_FRAGMENT);
}
public static class Builder
{
// Required
private FragmentManager fm;
private SlideDayTimeListener listener;
// Optional
private String[] customDaysArray;
private int initialDay;
private int initialHour;
private int initialMinute;
private boolean isClientSpecified24HourTime;
private boolean is24HourTime;
private int theme;
private int indicatorColor;
public Builder(FragmentManager fm)
{
this.fm = fm;
}
|
void function() { if (mListener == null) { throw new NullPointerException( STR); } SlideDayTimeDialogFragment dialogFragment = SlideDayTimeDialogFragment.newInstance( mListener, mIsCustomDaysArraySpecified, mCustomDaysArray, mInitialDay, mInitialHour, mInitialMinute, mIsClientSpecified24HourTime, mIs24HourTime, mTheme, mIndicatorColor); dialogFragment.show(mFragmentManager, SlideDayTimeDialogFragment.TAG_SLIDE_DAY_TIME_DIALOG_FRAGMENT); } public static class Builder { private FragmentManager fm; private SlideDayTimeListener listener; private String[] customDaysArray; private int initialDay; private int initialHour; private int initialMinute; private boolean isClientSpecified24HourTime; private boolean is24HourTime; private int theme; private int indicatorColor; public Builder(FragmentManager fm) { this.fm = fm; }
|
/**
* Show the dialog to the user. Make sure to set the listener before calling this.
*/
|
Show the dialog to the user. Make sure to set the listener before calling this
|
show
|
{
"repo_name": "0359xiaodong/SlideDayTimePicker",
"path": "slideDayTimePicker/src/main/java/com/github/jjobes/slidedaytimepicker/SlideDayTimePicker.java",
"license": "apache-2.0",
"size": 10355
}
|
[
"android.support.v4.app.FragmentManager"
] |
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.*;
|
[
"android.support"
] |
android.support;
| 1,010,564
|
public boolean importData(JComponent c, Transferable t)
{
boolean result = false;
if (isLocalDrag())
{
// Enables visual feedback on the Mac
result = true;
}
else
{
try
{
updateImportCount(t);
if (c instanceof mxGraphComponent)
{
mxGraphComponent graphComponent = (mxGraphComponent) c;
if (graphComponent.isEnabled()
&& t.isDataFlavorSupported(mxGraphTransferable.dataFlavor))
{
mxGraphTransferable gt = (mxGraphTransferable) t
.getTransferData(mxGraphTransferable.dataFlavor);
if (gt.getCells() != null)
{
result = importGraphTransferable(graphComponent, gt);
}
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
return result;
}
|
boolean function(JComponent c, Transferable t) { boolean result = false; if (isLocalDrag()) { result = true; } else { try { updateImportCount(t); if (c instanceof mxGraphComponent) { mxGraphComponent graphComponent = (mxGraphComponent) c; if (graphComponent.isEnabled() && t.isDataFlavorSupported(mxGraphTransferable.dataFlavor)) { mxGraphTransferable gt = (mxGraphTransferable) t .getTransferData(mxGraphTransferable.dataFlavor); if (gt.getCells() != null) { result = importGraphTransferable(graphComponent, gt); } } } } catch (Exception ex) { ex.printStackTrace(); } } return result; }
|
/**
* Checks if the mxGraphTransferable data flavour is supported and calls
* importGraphTransferable if possible.
*/
|
Checks if the mxGraphTransferable data flavour is supported and calls importGraphTransferable if possible
|
importData
|
{
"repo_name": "dpisarewski/gka_wise12",
"path": "src/com/mxgraph/swing/handler/mxGraphTransferHandler.java",
"license": "lgpl-2.1",
"size": 10363
}
|
[
"java.awt.datatransfer.Transferable",
"javax.swing.JComponent"
] |
import java.awt.datatransfer.Transferable; import javax.swing.JComponent;
|
import java.awt.datatransfer.*; import javax.swing.*;
|
[
"java.awt",
"javax.swing"
] |
java.awt; javax.swing;
| 2,377,503
|
public void testTestJavadoc()
throws Exception
{
File testPom =
new File( getBasedir(),
"src/test/resources/unit/test-javadoc-test/test-javadoc-test-plugin-config.xml" );
TestJavadocReport mojo = (TestJavadocReport) lookupMojo( "test-javadoc", testPom );
MojoExecution mojoExec = new MojoExecution( new Plugin(), "test-javadoc", null );
setVariableValueToObject( mojo, "mojo", mojoExec );
MavenProject currentProject = new MavenProjectStub();
currentProject.setGroupId( "GROUPID" );
currentProject.setArtifactId( "ARTIFACTID" );
setVariableValueToObject( mojo, "session", newMavenSession( currentProject ) );
mojo.execute();
File generatedFile =
new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/maven/AppTest.html" );
assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) );
File options = new File( getBasedir(), "target/test/unit/test-javadoc-test/target/site/apidocs/options");
FileUtils.fileRead( options ).contains( "junit-3.8.1.jar" );
}
|
void function() throws Exception { File testPom = new File( getBasedir(), STR ); TestJavadocReport mojo = (TestJavadocReport) lookupMojo( STR, testPom ); MojoExecution mojoExec = new MojoExecution( new Plugin(), STR, null ); setVariableValueToObject( mojo, "mojo", mojoExec ); MavenProject currentProject = new MavenProjectStub(); currentProject.setGroupId( STR ); currentProject.setArtifactId( STR ); setVariableValueToObject( mojo, STR, newMavenSession( currentProject ) ); mojo.execute(); File generatedFile = new File( getBasedir(), STR ); assertTrue( FileUtils.fileExists( generatedFile.getAbsolutePath() ) ); File options = new File( getBasedir(), STR); FileUtils.fileRead( options ).contains( STR ); }
|
/**
* Test the test-javadoc configuration for the plugin
*
* @throws Exception if any
*/
|
Test the test-javadoc configuration for the plugin
|
testTestJavadoc
|
{
"repo_name": "mcculls/maven-plugins",
"path": "maven-javadoc-plugin/src/test/java/org/apache/maven/plugins/javadoc/TestJavadocReportTest.java",
"license": "apache-2.0",
"size": 2697
}
|
[
"java.io.File",
"org.apache.maven.model.Plugin",
"org.apache.maven.plugin.MojoExecution",
"org.apache.maven.plugin.testing.stubs.MavenProjectStub",
"org.apache.maven.project.MavenProject",
"org.codehaus.plexus.util.FileUtils"
] |
import java.io.File; import org.apache.maven.model.Plugin; import org.apache.maven.plugin.MojoExecution; import org.apache.maven.plugin.testing.stubs.MavenProjectStub; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.util.FileUtils;
|
import java.io.*; import org.apache.maven.model.*; import org.apache.maven.plugin.*; import org.apache.maven.plugin.testing.stubs.*; import org.apache.maven.project.*; import org.codehaus.plexus.util.*;
|
[
"java.io",
"org.apache.maven",
"org.codehaus.plexus"
] |
java.io; org.apache.maven; org.codehaus.plexus;
| 1,256,190
|
public void setVehicleMode(VehicleMode newMode, AbstractCommandListener listener) {
Bundle params = new Bundle();
params.putParcelable(EXTRA_VEHICLE_MODE, newMode);
drone.performAsyncActionOnDroneThread(new Action(ACTION_SET_VEHICLE_MODE, params), listener);
}
|
void function(VehicleMode newMode, AbstractCommandListener listener) { Bundle params = new Bundle(); params.putParcelable(EXTRA_VEHICLE_MODE, newMode); drone.performAsyncActionOnDroneThread(new Action(ACTION_SET_VEHICLE_MODE, params), listener); }
|
/**
* Change the vehicle mode for the connected drone.
*
* @param newMode new vehicle mode.
* @param listener Register a callback to receive update of the command execution state.
*/
|
Change the vehicle mode for the connected drone
|
setVehicleMode
|
{
"repo_name": "offbye/Tower",
"path": "Android/src/com/o3dr/android/client/apis/VehicleApi.java",
"license": "gpl-3.0",
"size": 10448
}
|
[
"android.os.Bundle",
"com.o3dr.services.android.lib.drone.property.VehicleMode",
"com.o3dr.services.android.lib.model.AbstractCommandListener",
"com.o3dr.services.android.lib.model.action.Action"
] |
import android.os.Bundle; import com.o3dr.services.android.lib.drone.property.VehicleMode; import com.o3dr.services.android.lib.model.AbstractCommandListener; import com.o3dr.services.android.lib.model.action.Action;
|
import android.os.*; import com.o3dr.services.android.lib.drone.property.*; import com.o3dr.services.android.lib.model.*; import com.o3dr.services.android.lib.model.action.*;
|
[
"android.os",
"com.o3dr.services"
] |
android.os; com.o3dr.services;
| 1,889,927
|
public V localPeek(K key, CachePeekMode... peekModes);
|
V function(K key, CachePeekMode... peekModes);
|
/**
* Peeks at in-memory cached value using default optional peek mode.
* <p>
* This method will not load value from any persistent store or from a remote node.
* <h2 class="header">Transactions</h2>
* This method does not participate in any transactions.
*
* @param key Entry key.
* @param peekModes Peek modes.
* @return Peeked value, or {@code null} if not found.
* @throws NullPointerException If key is {@code null}.
*/
|
Peeks at in-memory cached value using default optional peek mode. This method will not load value from any persistent store or from a remote node. Transactions This method does not participate in any transactions
|
localPeek
|
{
"repo_name": "irudyak/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/IgniteCache.java",
"license": "apache-2.0",
"size": 72051
}
|
[
"org.apache.ignite.cache.CachePeekMode"
] |
import org.apache.ignite.cache.CachePeekMode;
|
import org.apache.ignite.cache.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 1,861,544
|
void verifyCanDelete(Snippet snippet);
|
void verifyCanDelete(Snippet snippet);
|
/**
* Ensures that deleting the given snippet is a valid operation at this
* point in time, depending on the state of this ProcessGroup
*
* @param snippet to delete
*
* @throws IllegalStateException if deleting the Snippet is not valid at
* this time
*/
|
Ensures that deleting the given snippet is a valid operation at this point in time, depending on the state of this ProcessGroup
|
verifyCanDelete
|
{
"repo_name": "InspurUSA/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core-api/src/main/java/org/apache/nifi/groups/ProcessGroup.java",
"license": "apache-2.0",
"size": 33748
}
|
[
"org.apache.nifi.controller.Snippet"
] |
import org.apache.nifi.controller.Snippet;
|
import org.apache.nifi.controller.*;
|
[
"org.apache.nifi"
] |
org.apache.nifi;
| 2,821,284
|
public void testBug41484() throws Exception {
try {
this.rs = this.stmt.executeQuery("select 1 as abc");
this.rs.next();
this.rs.getString("abc");
this.rs.close();
this.rs.getString("abc");
} catch (SQLException ex) {
assertEquals(0, ex.getErrorCode());
assertEquals("S1000", ex.getSQLState());
}
}
|
void function() throws Exception { try { this.rs = this.stmt.executeQuery(STR); this.rs.next(); this.rs.getString("abc"); this.rs.close(); this.rs.getString("abc"); } catch (SQLException ex) { assertEquals(0, ex.getErrorCode()); assertEquals("S1000", ex.getSQLState()); } }
|
/**
* Bug #41484 Accessing fields by name after the ResultSet is closed throws
* NullPointerException.
*/
|
Bug #41484 Accessing fields by name after the ResultSet is closed throws NullPointerException
|
testBug41484
|
{
"repo_name": "hansmeets/bio2rdf-scripts",
"path": "linkedSPLs/LinkedSPLs-update/lib/mysql-connector-java-5.1.33/src/testsuite/regression/ResultSetRegressionTest.java",
"license": "mit",
"size": 182284
}
|
[
"java.sql.SQLException"
] |
import java.sql.SQLException;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 2,197,602
|
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
String submit = request.getParameter("submit");
// front end validation when save is clicked.
if (submit != null) {
if ((pathName == null) || (pathName.length()<1)) {
errors.add("pathName",
new ActionError("error.pathName.required"));
}
}
return errors;
}
|
ActionErrors function(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); String submit = request.getParameter(STR); if (submit != null) { if ((pathName == null) (pathName.length()<1)) { errors.add(STR, new ActionError(STR)); } } return errors; }
|
/**
* Validate the properties that have been set from this HTTP request,
* and return an <code>ActionErrors</code> object that encapsulates any
* validation errors that have been found. If no errors are found, return
* <code>null</code> or an <code>ActionErrors</code> object with no
* recorded error messages.
*
* @param mapping The mapping used to select this instance
* @param request The servlet request we are processing
*/
|
Validate the properties that have been set from this HTTP request, and return an <code>ActionErrors</code> object that encapsulates any validation errors that have been found. If no errors are found, return <code>null</code> or an <code>ActionErrors</code> object with no recorded error messages
|
validate
|
{
"repo_name": "devjin24/howtomcatworks",
"path": "bookrefer/jakarta-tomcat-4.1.12-src/webapps/admin/WEB-INF/classes/org/apache/webapp/admin/realm/MemoryRealmForm.java",
"license": "apache-2.0",
"size": 6052
}
|
[
"javax.servlet.http.HttpServletRequest",
"org.apache.struts.action.ActionError",
"org.apache.struts.action.ActionErrors",
"org.apache.struts.action.ActionMapping"
] |
import javax.servlet.http.HttpServletRequest; import org.apache.struts.action.ActionError; import org.apache.struts.action.ActionErrors; import org.apache.struts.action.ActionMapping;
|
import javax.servlet.http.*; import org.apache.struts.action.*;
|
[
"javax.servlet",
"org.apache.struts"
] |
javax.servlet; org.apache.struts;
| 2,700,407
|
public static String join(Collection c, String left, String right, String separator) {
if (c == null || c.size() == 0) {
return null;
}
StringBuffer sb = new StringBuffer();
boolean firstFlag = true;
for (Iterator it = c.iterator(); it.hasNext();) {
if (firstFlag) {
firstFlag = false;
} else if (separator != null) {
sb.append(separator);
}
String s = (String) it.next();
if (left != null) {
sb.append(left);
}
sb.append(s);
if (right != null) {
sb.append(right);
}
}
return sb.toString();
}
|
static String function(Collection c, String left, String right, String separator) { if (c == null c.size() == 0) { return null; } StringBuffer sb = new StringBuffer(); boolean firstFlag = true; for (Iterator it = c.iterator(); it.hasNext();) { if (firstFlag) { firstFlag = false; } else if (separator != null) { sb.append(separator); } String s = (String) it.next(); if (left != null) { sb.append(left); } sb.append(s); if (right != null) { sb.append(right); } } return sb.toString(); }
|
/**
* Return a String object join all String object in param c, and add
* param left and param right to every String object on the left side
* and right side, separaing with param separator.
*
* <pre>
* join(["s1", "s2"], "left", "right", ",") = "lefts1right,lefts2right"
* </pre>
*
* @throws ClassCastException
* if the object in the Collection is
* not a String object.
*/
|
Return a String object join all String object in param c, and add param left and param right to every String object on the left side and right side, separaing with param separator. <code> join(["s1", "s2"], "left", "right", ",") = "lefts1right,lefts2right" </code>
|
join
|
{
"repo_name": "joshLV/uue",
"path": "uue-core/src/main/java/lab/uue/core/util/ExtStringUtils.java",
"license": "apache-2.0",
"size": 27952
}
|
[
"java.util.Collection",
"java.util.Iterator"
] |
import java.util.Collection; import java.util.Iterator;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,768,170
|
@Test
public void testTemplateRunnerWithUploadGraph() throws Exception {
File existingFile = tmpFolder.newFile();
DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class);
options.setExperiments(Arrays.asList("upload_graph"));
options.setJobName("TestJobName");
options.setGcpCredential(new TestCredential());
options.setPathValidatorClass(NoopPathValidator.class);
options.setProject("test-project");
options.setRegion(REGION_ID);
options.setRunner(DataflowRunner.class);
options.setTemplateLocation(existingFile.getPath());
options.setTempLocation(tmpFolder.getRoot().getPath());
Pipeline p = Pipeline.create(options);
p.apply(Create.of(ImmutableList.of(1)));
p.run();
expectedLogs.verifyInfo("Template successfully created");
ObjectMapper objectMapper = new ObjectMapper();
JsonNode node = objectMapper.readTree(existingFile);
assertEquals(0, node.get("steps").size());
assertNotNull(node.get("stepsLocation"));
}
|
void function() throws Exception { File existingFile = tmpFolder.newFile(); DataflowPipelineOptions options = PipelineOptionsFactory.as(DataflowPipelineOptions.class); options.setExperiments(Arrays.asList(STR)); options.setJobName(STR); options.setGcpCredential(new TestCredential()); options.setPathValidatorClass(NoopPathValidator.class); options.setProject(STR); options.setRegion(REGION_ID); options.setRunner(DataflowRunner.class); options.setTemplateLocation(existingFile.getPath()); options.setTempLocation(tmpFolder.getRoot().getPath()); Pipeline p = Pipeline.create(options); p.apply(Create.of(ImmutableList.of(1))); p.run(); expectedLogs.verifyInfo(STR); ObjectMapper objectMapper = new ObjectMapper(); JsonNode node = objectMapper.readTree(existingFile); assertEquals(0, node.get("steps").size()); assertNotNull(node.get(STR)); }
|
/**
* Tests that the {@link DataflowRunner} with {@code --templateLocation} returns normally when the
* runner is successfully run with upload_graph experiment turned on. The result template should
* not contain raw steps and stepsLocation file should be set.
*/
|
Tests that the <code>DataflowRunner</code> with --templateLocation returns normally when the runner is successfully run with upload_graph experiment turned on. The result template should not contain raw steps and stepsLocation file should be set
|
testTemplateRunnerWithUploadGraph
|
{
"repo_name": "robertwb/incubator-beam",
"path": "runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/DataflowRunnerTest.java",
"license": "apache-2.0",
"size": 81813
}
|
[
"com.fasterxml.jackson.databind.JsonNode",
"com.fasterxml.jackson.databind.ObjectMapper",
"java.io.File",
"java.util.Arrays",
"org.apache.beam.runners.dataflow.options.DataflowPipelineOptions",
"org.apache.beam.sdk.Pipeline",
"org.apache.beam.sdk.extensions.gcp.auth.TestCredential",
"org.apache.beam.sdk.extensions.gcp.storage.NoopPathValidator",
"org.apache.beam.sdk.options.PipelineOptionsFactory",
"org.apache.beam.sdk.transforms.Create",
"org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList",
"org.junit.Assert"
] |
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import java.io.File; import java.util.Arrays; import org.apache.beam.runners.dataflow.options.DataflowPipelineOptions; import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.extensions.gcp.auth.TestCredential; import org.apache.beam.sdk.extensions.gcp.storage.NoopPathValidator; import org.apache.beam.sdk.options.PipelineOptionsFactory; import org.apache.beam.sdk.transforms.Create; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList; import org.junit.Assert;
|
import com.fasterxml.jackson.databind.*; import java.io.*; import java.util.*; import org.apache.beam.runners.dataflow.options.*; import org.apache.beam.sdk.*; import org.apache.beam.sdk.extensions.gcp.auth.*; import org.apache.beam.sdk.extensions.gcp.storage.*; import org.apache.beam.sdk.options.*; import org.apache.beam.sdk.transforms.*; import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.*; import org.junit.*;
|
[
"com.fasterxml.jackson",
"java.io",
"java.util",
"org.apache.beam",
"org.junit"
] |
com.fasterxml.jackson; java.io; java.util; org.apache.beam; org.junit;
| 2,246,258
|
void delete(ObjectId id);
|
void delete(ObjectId id);
|
/**
* Deletes an existing Dashboard instance.
*
* @param id unique identifier of Dashboard to delete
*/
|
Deletes an existing Dashboard instance
|
delete
|
{
"repo_name": "amitmawkin/Hygieia",
"path": "api/src/main/java/com/capitalone/dashboard/service/DashboardService.java",
"license": "apache-2.0",
"size": 6674
}
|
[
"org.bson.types.ObjectId"
] |
import org.bson.types.ObjectId;
|
import org.bson.types.*;
|
[
"org.bson.types"
] |
org.bson.types;
| 31,997
|
public synchronized void refreshNodes() throws IOException {
String user = UserGroupInformation.getCurrentUser().getShortUserName();
// check access
if (!aclsManager.isMRAdmin(UserGroupInformation.getCurrentUser())) {
AuditLogger.logFailure(user, Constants.REFRESH_NODES,
aclsManager.getAdminsAcl().toString(), Constants.JOBTRACKER,
Constants.UNAUTHORIZED_USER);
throw new AccessControlException(user +
" is not authorized to refresh nodes.");
}
AuditLogger.logSuccess(user, Constants.REFRESH_NODES, Constants.JOBTRACKER);
// call the actual api
refreshHosts();
}
|
synchronized void function() throws IOException { String user = UserGroupInformation.getCurrentUser().getShortUserName(); if (!aclsManager.isMRAdmin(UserGroupInformation.getCurrentUser())) { AuditLogger.logFailure(user, Constants.REFRESH_NODES, aclsManager.getAdminsAcl().toString(), Constants.JOBTRACKER, Constants.UNAUTHORIZED_USER); throw new AccessControlException(user + STR); } AuditLogger.logSuccess(user, Constants.REFRESH_NODES, Constants.JOBTRACKER); refreshHosts(); }
|
/**
* Rereads the config to get hosts and exclude list file names.
* Rereads the files to update the hosts and exclude lists.
*/
|
Rereads the config to get hosts and exclude list file names. Rereads the files to update the hosts and exclude lists
|
refreshNodes
|
{
"repo_name": "zxqt223/hadoop-ha.1.0.3",
"path": "src/mapred/org/apache/hadoop/mapred/JobTracker.java",
"license": "apache-2.0",
"size": 199505
}
|
[
"java.io.IOException",
"org.apache.hadoop.mapred.AuditLogger",
"org.apache.hadoop.security.AccessControlException",
"org.apache.hadoop.security.UserGroupInformation"
] |
import java.io.IOException; import org.apache.hadoop.mapred.AuditLogger; import org.apache.hadoop.security.AccessControlException; import org.apache.hadoop.security.UserGroupInformation;
|
import java.io.*; import org.apache.hadoop.mapred.*; import org.apache.hadoop.security.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 1,906,892
|
@Override
protected EventSourcedAggregate<T> doLoadWithLock(String aggregateIdentifier, Long expectedVersion) {
EventSourcedAggregate<T> aggregate = null;
CacheEntry<T> cacheEntry = cache.get(aggregateIdentifier);
if (cacheEntry != null) {
aggregate = cacheEntry.recreateAggregate(aggregateModel(), eventStore, snapshotTriggerDefinition);
}
if (aggregate == null) {
aggregate = super.doLoadWithLock(aggregateIdentifier, expectedVersion);
} else if (aggregate.isDeleted()) {
throw new AggregateDeletedException(aggregateIdentifier);
}
CurrentUnitOfWork.get().onRollback(u -> cache.remove(aggregateIdentifier));
return aggregate;
}
private static class CacheEntry<T> implements Serializable {
private final T aggregateRoot;
private final Long version;
private final boolean deleted;
private final SnapshotTrigger snapshotTrigger;
private final transient EventSourcedAggregate<T> aggregate;
public CacheEntry(EventSourcedAggregate<T> aggregate) {
this.aggregate = aggregate;
this.aggregateRoot = aggregate.getAggregateRoot();
this.version = aggregate.version();
this.deleted = aggregate.isDeleted();
this.snapshotTrigger = (aggregate.getSnapshotTrigger() instanceof Serializable)
? aggregate.getSnapshotTrigger()
: NoSnapshotTriggerDefinition.TRIGGER;
}
|
EventSourcedAggregate<T> function(String aggregateIdentifier, Long expectedVersion) { EventSourcedAggregate<T> aggregate = null; CacheEntry<T> cacheEntry = cache.get(aggregateIdentifier); if (cacheEntry != null) { aggregate = cacheEntry.recreateAggregate(aggregateModel(), eventStore, snapshotTriggerDefinition); } if (aggregate == null) { aggregate = super.doLoadWithLock(aggregateIdentifier, expectedVersion); } else if (aggregate.isDeleted()) { throw new AggregateDeletedException(aggregateIdentifier); } CurrentUnitOfWork.get().onRollback(u -> cache.remove(aggregateIdentifier)); return aggregate; } private static class CacheEntry<T> implements Serializable { private final T aggregateRoot; private final Long version; private final boolean deleted; private final SnapshotTrigger snapshotTrigger; private final transient EventSourcedAggregate<T> aggregate; public CacheEntry(EventSourcedAggregate<T> aggregate) { this.aggregate = aggregate; this.aggregateRoot = aggregate.getAggregateRoot(); this.version = aggregate.version(); this.deleted = aggregate.isDeleted(); this.snapshotTrigger = (aggregate.getSnapshotTrigger() instanceof Serializable) ? aggregate.getSnapshotTrigger() : NoSnapshotTriggerDefinition.TRIGGER; }
|
/**
* Perform the actual loading of an aggregate. The necessary locks have been obtained. If the aggregate is
* available in the cache, it is returned from there. Otherwise the underlying persistence logic is called to
* retrieve the aggregate.
*
* @param aggregateIdentifier the identifier of the aggregate to load
* @param expectedVersion The expected version of the aggregate
* @return the fully initialized aggregate
*/
|
Perform the actual loading of an aggregate. The necessary locks have been obtained. If the aggregate is available in the cache, it is returned from there. Otherwise the underlying persistence logic is called to retrieve the aggregate
|
doLoadWithLock
|
{
"repo_name": "bojanv55/AxonFramework",
"path": "core/src/main/java/org/axonframework/eventsourcing/CachingEventSourcingRepository.java",
"license": "apache-2.0",
"size": 8667
}
|
[
"java.io.Serializable",
"org.axonframework.messaging.unitofwork.CurrentUnitOfWork"
] |
import java.io.Serializable; import org.axonframework.messaging.unitofwork.CurrentUnitOfWork;
|
import java.io.*; import org.axonframework.messaging.unitofwork.*;
|
[
"java.io",
"org.axonframework.messaging"
] |
java.io; org.axonframework.messaging;
| 2,172,493
|
AccessPolicy updateAccessPolicy(AccessPolicyDTO accessPolicyDTO);
|
AccessPolicy updateAccessPolicy(AccessPolicyDTO accessPolicyDTO);
|
/**
* Updates the specified access policy.
*
* @param accessPolicyDTO The access policy DTO
* @return The access policy transfer object
*/
|
Updates the specified access policy
|
updateAccessPolicy
|
{
"repo_name": "speddy93/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-api/src/main/java/org/apache/nifi/web/dao/AccessPolicyDAO.java",
"license": "apache-2.0",
"size": 3332
}
|
[
"org.apache.nifi.authorization.AccessPolicy",
"org.apache.nifi.web.api.dto.AccessPolicyDTO"
] |
import org.apache.nifi.authorization.AccessPolicy; import org.apache.nifi.web.api.dto.AccessPolicyDTO;
|
import org.apache.nifi.authorization.*; import org.apache.nifi.web.api.dto.*;
|
[
"org.apache.nifi"
] |
org.apache.nifi;
| 1,092,972
|
public synchronized void deleteGroup(String name) throws Exception {
// Check if the group exists
if (name != null && !name.equals("")) {
if (m_groups.containsKey(name)) {
// Remove the group.
m_groups.remove(name);
} else
throw new Exception("GroupFactory:delete Group doesnt exist:" + name);
} else {
throw new Exception("GroupFactory:delete Invalid user group:" + name);
}
// Saves into "groups.xml" file
saveGroups();
}
|
synchronized void function(String name) throws Exception { if (name != null && !name.equals(STRGroupFactory:delete Group doesnt exist:STRGroupFactory:delete Invalid user group:" + name); } saveGroups(); }
|
/**
* Removes the group from the list of groups. Then overwrites to the
* "groups.xml"
*
* @param name a {@link java.lang.String} object.
* @throws java.lang.Exception if any.
*/
|
Removes the group from the list of groups. Then overwrites to the "groups.xml"
|
deleteGroup
|
{
"repo_name": "rdkgit/opennms",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/GroupManager.java",
"license": "agpl-3.0",
"size": 26481
}
|
[
"org.opennms.netmgt.config.groups.Group"
] |
import org.opennms.netmgt.config.groups.Group;
|
import org.opennms.netmgt.config.groups.*;
|
[
"org.opennms.netmgt"
] |
org.opennms.netmgt;
| 901,866
|
public InetSocketAddress getXferAddress() {
return streamingAddr;
}
|
InetSocketAddress function() { return streamingAddr; }
|
/**
* NB: The datanode can perform data transfer on the streaming
* address however clients are given the IPC IP address for data
* transfer, and that may be a different address.
*
* @return socket address for data transfer
*/
|
address however clients are given the IPC IP address for data transfer, and that may be a different address
|
getXferAddress
|
{
"repo_name": "zhe-thoughts/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/DataNode.java",
"license": "apache-2.0",
"size": 116668
}
|
[
"java.net.InetSocketAddress"
] |
import java.net.InetSocketAddress;
|
import java.net.*;
|
[
"java.net"
] |
java.net;
| 1,699,199
|
@Override
public Context getInitialContext(Hashtable<?,?> env)
throws NamingException
{
AbstractModel model = createRoot();
return new ContextImpl(model, env);
}
|
Context function(Hashtable<?,?> env) throws NamingException { AbstractModel model = createRoot(); return new ContextImpl(model, env); }
|
/**
* Returns the initial context for the current thread.
*/
|
Returns the initial context for the current thread
|
getInitialContext
|
{
"repo_name": "christianchristensen/resin",
"path": "modules/kernel/src/com/caucho/naming/InitialContextFactoryImpl.java",
"license": "gpl-2.0",
"size": 3273
}
|
[
"java.util.Hashtable",
"javax.naming.Context",
"javax.naming.NamingException"
] |
import java.util.Hashtable; import javax.naming.Context; import javax.naming.NamingException;
|
import java.util.*; import javax.naming.*;
|
[
"java.util",
"javax.naming"
] |
java.util; javax.naming;
| 2,604,490
|
private static boolean checkStandardUPCEANChecksum(String s) throws FormatException {
int length = s.length();
if (length == 0) {
return false;
}
int sum = 0;
for (int i = length - 2; i >= 0; i -= 2) {
int digit = (int) s.charAt(i) - (int) '0';
if (digit < 0 || digit > 9) {
throw FormatException.getFormatInstance();
}
sum += digit;
}
sum *= 3;
for (int i = length - 1; i >= 0; i -= 2) {
int digit = (int) s.charAt(i) - (int) '0';
if (digit < 0 || digit > 9) {
throw FormatException.getFormatInstance();
}
sum += digit;
}
return sum % 10 == 0;
}
|
static boolean function(String s) throws FormatException { int length = s.length(); if (length == 0) { return false; } int sum = 0; for (int i = length - 2; i >= 0; i -= 2) { int digit = (int) s.charAt(i) - (int) '0'; if (digit < 0 digit > 9) { throw FormatException.getFormatInstance(); } sum += digit; } sum *= 3; for (int i = length - 1; i >= 0; i -= 2) { int digit = (int) s.charAt(i) - (int) '0'; if (digit < 0 digit > 9) { throw FormatException.getFormatInstance(); } sum += digit; } return sum % 10 == 0; }
|
/**
* Computes the UPC/EAN checksum on a string of digits, and reports
* whether the checksum is correct or not.
*
* @param s string of digits to check
* @return true iff string of digits passes the UPC/EAN checksum algorithm
* @throws FormatException if the string does not contain only digits
*/
|
Computes the UPC/EAN checksum on a string of digits, and reports whether the checksum is correct or not
|
checkStandardUPCEANChecksum
|
{
"repo_name": "helsinki-city-library/pocketlibrary",
"path": "android/LibraryProject/src/com/google/zxing/oned/UPCEANReader.java",
"license": "agpl-3.0",
"size": 12842
}
|
[
"com.google.zxing.FormatException"
] |
import com.google.zxing.FormatException;
|
import com.google.zxing.*;
|
[
"com.google.zxing"
] |
com.google.zxing;
| 2,586,615
|
void quoteTimeLiteral(
StringBuilder buf,
Time value);
|
void quoteTimeLiteral( StringBuilder buf, Time value);
|
/**
* Appends to a buffer a time literal.
*
* <p>For example, in the default dialect,
* <code>quoteStringLiteral(buf, "12:34:56")</code>
* appends <code>TIME '12:34:56'</code>.
*
* @param buf Buffer to append to
* @param value Literal
*/
|
Appends to a buffer a time literal. For example, in the default dialect, <code>quoteStringLiteral(buf, "12:34:56")</code> appends <code>TIME '12:34:56'</code>
|
quoteTimeLiteral
|
{
"repo_name": "citycloud-bigdata/mondrian",
"path": "src/main/mondrian/spi/Dialect.java",
"license": "epl-1.0",
"size": 40288
}
|
[
"java.sql.Time"
] |
import java.sql.Time;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 1,223,175
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.