method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Request withEntity(HttpEntity entity) {
mEntity = entity;
return this;
} | Request function(HttpEntity entity) { mEntity = entity; return this; } | /**
* Adds an arbitrary entity to the request (used with POST/PUT)
* @param entity the entity to POST/PUT
* @return this
*/ | Adds an arbitrary entity to the request (used with POST/PUT) | withEntity | {
"repo_name": "OnlyInAmerica/SecureShareLib",
"path": "SecureShareUILibrary/src/io/scal/secureshareui/soundcloud/Request.java",
"license": "apache-2.0",
"size": 21170
} | [
"org.apache.http.HttpEntity"
] | import org.apache.http.HttpEntity; | import org.apache.http.*; | [
"org.apache.http"
] | org.apache.http; | 2,229,027 |
public static <T extends Number> ILine4<T> revertRotate(
final ILine4<T> lineToRotate, final IRotation<?> rotation) {
IPoint4<T> rotatedSource = GeometricOperations.revertRotate(
lineToRotate.getSource(), rotation);
IPoint4<T> rotatedSink = GeometricOperations.revertRotate(
lineToRotate.getSink(), rotation);
return new Line4<>(rotatedSource, rotatedSink, lineToRotate.getType());
} | static <T extends Number> ILine4<T> function( final ILine4<T> lineToRotate, final IRotation<?> rotation) { IPoint4<T> rotatedSource = GeometricOperations.revertRotate( lineToRotate.getSource(), rotation); IPoint4<T> rotatedSink = GeometricOperations.revertRotate( lineToRotate.getSink(), rotation); return new Line4<>(rotatedSource, rotatedSink, lineToRotate.getType()); } | /**
* Reverts the rotation of the {@link ILine4 Line} by the provided
* {@link IRotation Angle-Axis Rotation}.
*
* @param <T>
* the {@link Number} type of the {@link ILine4 Line} to rotate.
*
* @param lineToRotate
* the {@link ILine4 Line} to rotate.
* @param rotation
* the {@link IRotation Angle-Axis Rotation}.
* @return the rotated {@link ILine4 Line}.
*/ | Reverts the rotation of the <code>ILine4 Line</code> by the provided <code>IRotation Angle-Axis Rotation</code> | revertRotate | {
"repo_name": "aftenkap/jutility",
"path": "jutility-math/src/main/java/org/jutility/math/geometry/GeometricOperations.java",
"license": "apache-2.0",
"size": 125764
} | [
"org.jutility.math.vectoralgebra.IPoint4"
] | import org.jutility.math.vectoralgebra.IPoint4; | import org.jutility.math.vectoralgebra.*; | [
"org.jutility.math"
] | org.jutility.math; | 2,838,878 |
private void dispatchOnOutgoingCall(IMXCall call) {
Log.d(LOG_TAG, "dispatchOnOutgoingCall " + call.getCallId());
Collection<IMXCallsManagerListener> listeners = getListeners();
for (IMXCallsManagerListener l : listeners) {
try {
l.onOutgoingCall(call);
} catch (Exception e) {
Log.e(LOG_TAG, "dispatchOnOutgoingCall " + e.getMessage(), e);
}
}
} | void function(IMXCall call) { Log.d(LOG_TAG, STR + call.getCallId()); Collection<IMXCallsManagerListener> listeners = getListeners(); for (IMXCallsManagerListener l : listeners) { try { l.onOutgoingCall(call); } catch (Exception e) { Log.e(LOG_TAG, STR + e.getMessage(), e); } } } | /**
* dispatch the call creation to the listeners
*
* @param call the call
*/ | dispatch the call creation to the listeners | dispatchOnOutgoingCall | {
"repo_name": "matrix-org/matrix-android-sdk",
"path": "matrix-sdk/src/main/java/org/matrix/androidsdk/call/MXCallsManager.java",
"license": "apache-2.0",
"size": 50683
} | [
"java.util.Collection",
"org.matrix.androidsdk.core.Log"
] | import java.util.Collection; import org.matrix.androidsdk.core.Log; | import java.util.*; import org.matrix.androidsdk.core.*; | [
"java.util",
"org.matrix.androidsdk"
] | java.util; org.matrix.androidsdk; | 1,638,607 |
public static void main(String[] args) {
try {
LaunchEnvironment env = new LaunchEnvironment(args);
(new PingTopology(env)).setup();
} catch (Exception e) {
System.exit(handleLaunchException(e));
}
} | static void function(String[] args) { try { LaunchEnvironment env = new LaunchEnvironment(args); (new PingTopology(env)).setup(); } catch (Exception e) { System.exit(handleLaunchException(e)); } } | /**
* Topology entry point.
*/ | Topology entry point | main | {
"repo_name": "jonvestal/open-kilda",
"path": "src-java/ping-topology/ping-storm-topology/src/main/java/org/openkilda/wfm/topology/ping/PingTopology.java",
"license": "apache-2.0",
"size": 12730
} | [
"org.openkilda.wfm.LaunchEnvironment"
] | import org.openkilda.wfm.LaunchEnvironment; | import org.openkilda.wfm.*; | [
"org.openkilda.wfm"
] | org.openkilda.wfm; | 246,194 |
public AttributeInfo copy(ConstPool newCp, Map classnames) {
BootstrapMethod[] methods = getMethods();
ConstPool thisCp = getConstPool();
for (int i = 0; i < methods.length; i++) {
BootstrapMethod m = methods[i];
m.methodRef = thisCp.copy(m.methodRef, newCp, classnames);
for (int k = 0; k < m.arguments.length; k++)
m.arguments[k] = thisCp.copy(m.arguments[k], newCp, classnames);
}
return new BootstrapMethodsAttribute(newCp, methods);
}
| AttributeInfo function(ConstPool newCp, Map classnames) { BootstrapMethod[] methods = getMethods(); ConstPool thisCp = getConstPool(); for (int i = 0; i < methods.length; i++) { BootstrapMethod m = methods[i]; m.methodRef = thisCp.copy(m.methodRef, newCp, classnames); for (int k = 0; k < m.arguments.length; k++) m.arguments[k] = thisCp.copy(m.arguments[k], newCp, classnames); } return new BootstrapMethodsAttribute(newCp, methods); } | /**
* Makes a copy. Class names are replaced according to the
* given <code>Map</code> object.
*
* @param newCp the constant pool table used by the new copy.
* @param classnames pairs of replaced and substituted
* class names.
*/ | Makes a copy. Class names are replaced according to the given <code>Map</code> object | copy | {
"repo_name": "mariusj/org.openntf.domino",
"path": "domino/externals/javassist/src/main/java/javassist/bytecode/BootstrapMethodsAttribute.java",
"license": "apache-2.0",
"size": 4154
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,037,887 |
public Document asDocument() throws WeiboException {
if (null == responseAsDocument) {
try {
// it should be faster to read the inputstream directly.
// but makes it difficult to troubleshoot
this.responseAsDocument = builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8")));
} catch (SAXException saxe) {
throw new WeiboException("The response body was not well-formed:\n" + responseAsString, saxe);
} catch (IOException ioe) {
throw new WeiboException("There's something with the connection.", ioe);
}
}
return responseAsDocument;
} | Document function() throws WeiboException { if (null == responseAsDocument) { try { this.responseAsDocument = builders.get().parse(new ByteArrayInputStream(asString().getBytes("UTF-8"))); } catch (SAXException saxe) { throw new WeiboException(STR + responseAsString, saxe); } catch (IOException ioe) { throw new WeiboException(STR, ioe); } } return responseAsDocument; } | /**
* Returns the response body as org.w3c.dom.Document.<br>
* Disconnects the internal HttpURLConnection silently.
* @return response body as org.w3c.dom.Document
* @throws WeiboException
*/ | Returns the response body as org.w3c.dom.Document. Disconnects the internal HttpURLConnection silently | asDocument | {
"repo_name": "jaguar-zc/icooding",
"path": "icooding-cms/icooding-weibo/src/main/java/com/icooding/weibo/http/Response.java",
"license": "apache-2.0",
"size": 9986
} | [
"com.icooding.weibo.model.WeiboException",
"java.io.ByteArrayInputStream",
"java.io.IOException",
"org.w3c.dom.Document",
"org.xml.sax.SAXException"
] | import com.icooding.weibo.model.WeiboException; import java.io.ByteArrayInputStream; import java.io.IOException; import org.w3c.dom.Document; import org.xml.sax.SAXException; | import com.icooding.weibo.model.*; import java.io.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.icooding.weibo",
"java.io",
"org.w3c.dom",
"org.xml.sax"
] | com.icooding.weibo; java.io; org.w3c.dom; org.xml.sax; | 1,335,357 |
List<PsiElement> filterImports(@NotNull List<UsageInfo> usageInfos, @NotNull Project project); | List<PsiElement> filterImports(@NotNull List<UsageInfo> usageInfos, @NotNull Project project); | /**
* filters out import usages from results. Returns all found import usages
*/ | filters out import usages from results. Returns all found import usages | filterImports | {
"repo_name": "caot/intellij-community",
"path": "java/java-impl/src/com/intellij/refactoring/move/moveClassesOrPackages/MoveClassToInnerHandler.java",
"license": "apache-2.0",
"size": 1887
} | [
"com.intellij.openapi.project.Project",
"com.intellij.psi.PsiElement",
"com.intellij.usageView.UsageInfo",
"java.util.List",
"org.jetbrains.annotations.NotNull"
] | import com.intellij.openapi.project.Project; import com.intellij.psi.PsiElement; import com.intellij.usageView.UsageInfo; import java.util.List; import org.jetbrains.annotations.NotNull; | import com.intellij.*; import com.intellij.openapi.project.*; import com.intellij.psi.*; import java.util.*; import org.jetbrains.annotations.*; | [
"com.intellij",
"com.intellij.openapi",
"com.intellij.psi",
"java.util",
"org.jetbrains.annotations"
] | com.intellij; com.intellij.openapi; com.intellij.psi; java.util; org.jetbrains.annotations; | 1,362,457 |
private void startTimerNotification() {
// Get Emergency Callback Mode timeout value
long ecmTimeout = SystemProperties.getLong(
TelephonyProperties.PROPERTY_ECM_EXIT_TIMER, DEFAULT_ECM_EXIT_TIMER_VALUE);
// Show the notification
showNotification(ecmTimeout);
// Start countdown timer for the notification updates
mTimer = new CountDownTimer(ecmTimeout, 1000) {
| void function() { long ecmTimeout = SystemProperties.getLong( TelephonyProperties.PROPERTY_ECM_EXIT_TIMER, DEFAULT_ECM_EXIT_TIMER_VALUE); showNotification(ecmTimeout); mTimer = new CountDownTimer(ecmTimeout, 1000) { | /**
* Start timer notification for Emergency Callback Mode
*/ | Start timer notification for Emergency Callback Mode | startTimerNotification | {
"repo_name": "risingsunm/Phone_4.0",
"path": "src/com/android/phone/EmergencyCallbackModeService.java",
"license": "gpl-3.0",
"size": 9185
} | [
"android.os.CountDownTimer",
"android.os.SystemProperties",
"com.android.internal.telephony.TelephonyProperties"
] | import android.os.CountDownTimer; import android.os.SystemProperties; import com.android.internal.telephony.TelephonyProperties; | import android.os.*; import com.android.internal.telephony.*; | [
"android.os",
"com.android.internal"
] | android.os; com.android.internal; | 971,949 |
private void assertExpressionAuthorized(final Expression expression) throws SecurityException {
final Class<? extends Expression> clazz = expression.getClass();
if (expressionsBlacklist != null && expressionsBlacklist.contains(clazz)) {
throw new SecurityException(clazz.getSimpleName() + "s are not allowed: " + expression.getText());
} else if (expressionsWhitelist != null && !expressionsWhitelist.contains(clazz)) {
throw new SecurityException(clazz.getSimpleName() + "s are not allowed: " + expression.getText());
}
for (ExpressionChecker expressionChecker : expressionCheckers) {
if (!expressionChecker.isAuthorized(expression)) {
throw new SecurityException("Expression [" + clazz.getSimpleName() + "] is not allowed: " + expression.getText());
}
}
if (isIndirectImportCheckEnabled) {
try {
if (expression instanceof ConstructorCallExpression) {
assertImportIsAllowed(expression.getType().getName());
} else if (expression instanceof MethodCallExpression) {
MethodCallExpression expr = (MethodCallExpression) expression;
ClassNode objectExpressionType = expr.getObjectExpression().getType();
final String typename = getExpressionType(objectExpressionType).getName();
assertImportIsAllowed(typename);
assertStaticImportIsAllowed(expr.getMethodAsString(), typename);
} else if (expression instanceof StaticMethodCallExpression) {
StaticMethodCallExpression expr = (StaticMethodCallExpression) expression;
final String typename = expr.getOwnerType().getName();
assertImportIsAllowed(typename);
assertStaticImportIsAllowed(expr.getMethod(), typename);
} else if (expression instanceof MethodPointerExpression) {
MethodPointerExpression expr = (MethodPointerExpression) expression;
final String typename = expr.getType().getName();
assertImportIsAllowed(typename);
assertStaticImportIsAllowed(expr.getText(), typename);
}
} catch (SecurityException e) {
throw new SecurityException("Indirect import checks prevents usage of expression", e);
}
}
} | void function(final Expression expression) throws SecurityException { final Class<? extends Expression> clazz = expression.getClass(); if (expressionsBlacklist != null && expressionsBlacklist.contains(clazz)) { throw new SecurityException(clazz.getSimpleName() + STR + expression.getText()); } else if (expressionsWhitelist != null && !expressionsWhitelist.contains(clazz)) { throw new SecurityException(clazz.getSimpleName() + STR + expression.getText()); } for (ExpressionChecker expressionChecker : expressionCheckers) { if (!expressionChecker.isAuthorized(expression)) { throw new SecurityException(STR + clazz.getSimpleName() + STR + expression.getText()); } } if (isIndirectImportCheckEnabled) { try { if (expression instanceof ConstructorCallExpression) { assertImportIsAllowed(expression.getType().getName()); } else if (expression instanceof MethodCallExpression) { MethodCallExpression expr = (MethodCallExpression) expression; ClassNode objectExpressionType = expr.getObjectExpression().getType(); final String typename = getExpressionType(objectExpressionType).getName(); assertImportIsAllowed(typename); assertStaticImportIsAllowed(expr.getMethodAsString(), typename); } else if (expression instanceof StaticMethodCallExpression) { StaticMethodCallExpression expr = (StaticMethodCallExpression) expression; final String typename = expr.getOwnerType().getName(); assertImportIsAllowed(typename); assertStaticImportIsAllowed(expr.getMethod(), typename); } else if (expression instanceof MethodPointerExpression) { MethodPointerExpression expr = (MethodPointerExpression) expression; final String typename = expr.getType().getName(); assertImportIsAllowed(typename); assertStaticImportIsAllowed(expr.getText(), typename); } } catch (SecurityException e) { throw new SecurityException(STR, e); } } } | /**
* Checks that a given expression is either in the whitelist or not in the blacklist.
*
* @param expression the expression to be checked
* @throws SecurityException if usage of this expression class is forbidden
*/ | Checks that a given expression is either in the whitelist or not in the blacklist | assertExpressionAuthorized | {
"repo_name": "russel/incubator-groovy",
"path": "src/main/java/org/codehaus/groovy/control/customizers/SecureASTCustomizer.java",
"license": "apache-2.0",
"size": 52295
} | [
"org.codehaus.groovy.ast.ClassNode",
"org.codehaus.groovy.ast.expr.ConstructorCallExpression",
"org.codehaus.groovy.ast.expr.Expression",
"org.codehaus.groovy.ast.expr.MethodCallExpression",
"org.codehaus.groovy.ast.expr.MethodPointerExpression",
"org.codehaus.groovy.ast.expr.StaticMethodCallExpression"
] | import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.expr.ConstructorCallExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.MethodCallExpression; import org.codehaus.groovy.ast.expr.MethodPointerExpression; import org.codehaus.groovy.ast.expr.StaticMethodCallExpression; | import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.expr.*; | [
"org.codehaus.groovy"
] | org.codehaus.groovy; | 442,678 |
private NotificationPacket decodeCeaseNotificationPacket(ChannelBuffer buffer, int errorSubcode) {
NotificationPacket packet = null;
switch(errorSubcode) {
default:
log.info("cannot handle cease notification subcode {}", errorSubcode);
case CeaseNotificationPacket.SUBCODE_UNSPECIFIC:
packet = new UnspecifiedCeaseNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_MAXIMUM_NUMBER_OF_PREFIXES_REACHED:
packet = new MaximumNumberOfPrefixesReachedNotificationPacket();
try {
AddressFamily afi = AddressFamily.fromCode(buffer.readUnsignedShort());
SubsequentAddressFamily safi = SubsequentAddressFamily.fromCode(buffer.readUnsignedByte());
int prefixUpperBounds = (int)buffer.readUnsignedInt();
packet = new MaximumNumberOfPrefixesReachedNotificationPacket(afi, safi, prefixUpperBounds);
} catch(RuntimeException e) {
log.info("cannot decode specific reason for CEASE maximum number of prefixes reached notification", e);
}
break;
case CeaseNotificationPacket.SUBCODE_ADMINSTRATIVE_SHUTDOWN:
packet = new AdministrativeShutdownNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_PEER_DECONFIGURED:
packet = new PeerDeconfiguredNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_ADMINSTRATIVE_RESET:
packet = new AdministrativeResetNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_CONNECTION_REJECTED:
packet = new ConnectionRejectedNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_OTHER_CONFIGURATION_CHANGE:
packet = new OtherConfigurationChangeNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_CONNECTION_COLLISION_RESOLUTION:
packet = new ConnectionCollisionResolutionNotificationPacket();
break;
case CeaseNotificationPacket.SUBCODE_OUT_OF_RESOURCES:
packet = new OutOfResourcesNotificationPacket();
break;
}
return packet;
} | NotificationPacket function(ChannelBuffer buffer, int errorSubcode) { NotificationPacket packet = null; switch(errorSubcode) { default: log.info(STR, errorSubcode); case CeaseNotificationPacket.SUBCODE_UNSPECIFIC: packet = new UnspecifiedCeaseNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_MAXIMUM_NUMBER_OF_PREFIXES_REACHED: packet = new MaximumNumberOfPrefixesReachedNotificationPacket(); try { AddressFamily afi = AddressFamily.fromCode(buffer.readUnsignedShort()); SubsequentAddressFamily safi = SubsequentAddressFamily.fromCode(buffer.readUnsignedByte()); int prefixUpperBounds = (int)buffer.readUnsignedInt(); packet = new MaximumNumberOfPrefixesReachedNotificationPacket(afi, safi, prefixUpperBounds); } catch(RuntimeException e) { log.info(STR, e); } break; case CeaseNotificationPacket.SUBCODE_ADMINSTRATIVE_SHUTDOWN: packet = new AdministrativeShutdownNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_PEER_DECONFIGURED: packet = new PeerDeconfiguredNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_ADMINSTRATIVE_RESET: packet = new AdministrativeResetNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_CONNECTION_REJECTED: packet = new ConnectionRejectedNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_OTHER_CONFIGURATION_CHANGE: packet = new OtherConfigurationChangeNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_CONNECTION_COLLISION_RESOLUTION: packet = new ConnectionCollisionResolutionNotificationPacket(); break; case CeaseNotificationPacket.SUBCODE_OUT_OF_RESOURCES: packet = new OutOfResourcesNotificationPacket(); break; } return packet; } | /**
* decode the NOTIFICATION network packet for error code "Cease".
*
* @param buffer the buffer containing the data.
* @return
*/ | decode the NOTIFICATION network packet for error code "Cease" | decodeCeaseNotificationPacket | {
"repo_name": "tking/BGP4J",
"path": "lib/netty-bgp4/src/main/java/org/bgp4j/netty/protocol/BGPv4PacketDecoder.java",
"license": "apache-2.0",
"size": 6914
} | [
"org.bgp4j.net.AddressFamily",
"org.bgp4j.net.SubsequentAddressFamily",
"org.jboss.netty.buffer.ChannelBuffer"
] | import org.bgp4j.net.AddressFamily; import org.bgp4j.net.SubsequentAddressFamily; import org.jboss.netty.buffer.ChannelBuffer; | import org.bgp4j.net.*; import org.jboss.netty.buffer.*; | [
"org.bgp4j.net",
"org.jboss.netty"
] | org.bgp4j.net; org.jboss.netty; | 180,373 |
default AdvancedZooKeeperMasterEndpointBuilder exchangePattern(
ExchangePattern exchangePattern) {
doSetProperty("exchangePattern", exchangePattern);
return this;
} | default AdvancedZooKeeperMasterEndpointBuilder exchangePattern( ExchangePattern exchangePattern) { doSetProperty(STR, exchangePattern); return this; } | /**
* Sets the exchange pattern when the consumer creates an exchange.
*
* The option is a: <code>org.apache.camel.ExchangePattern</code> type.
*
* Group: consumer (advanced)
*/ | Sets the exchange pattern when the consumer creates an exchange. The option is a: <code>org.apache.camel.ExchangePattern</code> type. Group: consumer (advanced) | exchangePattern | {
"repo_name": "CodeSmell/camel",
"path": "core/camel-endpointdsl/src/main/java/org/apache/camel/builder/endpoint/dsl/ZooKeeperMasterEndpointBuilderFactory.java",
"license": "apache-2.0",
"size": 10212
} | [
"org.apache.camel.ExchangePattern"
] | import org.apache.camel.ExchangePattern; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 150,555 |
public void analyzeNoThrow(Analyzer analyzer) {
try {
analyze(analyzer);
} catch (AnalysisException e) {
throw new IllegalStateException(e);
}
} | void function(Analyzer analyzer) { try { analyze(analyzer); } catch (AnalysisException e) { throw new IllegalStateException(e); } } | /**
* Helper function to analyze this expr and assert that the analysis was successful.
* TODO: This function could be used in many more places to clean up. Consider
* adding an IAnalyzable interface or similar to and move this helper into Analyzer
* such that non-Expr things can use the helper also.
*/ | Helper function to analyze this expr and assert that the analysis was successful. adding an IAnalyzable interface or similar to and move this helper into Analyzer such that non-Expr things can use the helper also | analyzeNoThrow | {
"repo_name": "924060929/impala-frontend",
"path": "fe/src/main/java/org/apache/impala/analysis/Expr.java",
"license": "apache-2.0",
"size": 45366
} | [
"org.apache.impala.common.AnalysisException"
] | import org.apache.impala.common.AnalysisException; | import org.apache.impala.common.*; | [
"org.apache.impala"
] | org.apache.impala; | 2,517,210 |
public void enterCharacter_value_expression(SQLParser.Character_value_expressionContext ctx) { } | public void enterCharacter_value_expression(SQLParser.Character_value_expressionContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitString_value_expression | {
"repo_name": "HEIG-GAPS/slasher",
"path": "slasher.corrector/src/main/java/ch/gaps/slasher/corrector/SQLParserBaseListener.java",
"license": "mit",
"size": 73849
} | [
"ch.gaps.slasher.corrector.SQLParser"
] | import ch.gaps.slasher.corrector.SQLParser; | import ch.gaps.slasher.corrector.*; | [
"ch.gaps.slasher"
] | ch.gaps.slasher; | 761,180 |
@Override
protected boolean validatePage() {
if (super.validatePage()) {
String extension = new Path(getFileName()).getFileExtension();
if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
setErrorMessage(RequirementsEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
}
return false;
}
| boolean function() { if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); if (extension == null !FILE_EXTENSIONS.contains(extension)) { String key = FILE_EXTENSIONS.size() > 1 ? STR : STR; setErrorMessage(RequirementsEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); return false; } return true; } return false; } | /**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | The framework calls this to see if the file is correct. | validatePage | {
"repo_name": "uppaal-emf/uppaal",
"path": "requirements/org.muml.uppaal.requirements.editor/src/org/muml/uppaal/requirements/presentation/RequirementsModelWizard.java",
"license": "epl-1.0",
"size": 18566
} | [
"org.eclipse.core.runtime.Path"
] | import org.eclipse.core.runtime.Path; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,167,143 |
void writeHeader();
void writeResult(MatchedXlinkedPeptide match) throws IOException; | void writeHeader(); void writeResult(MatchedXlinkedPeptide match) throws IOException; | /**
* outputs the actual data/results for one peptide spectra match
* @param match
*/ | outputs the actual data/results for one peptide spectra match | writeResult | {
"repo_name": "lutzfischer/XiSearch",
"path": "src/main/java/rappsilber/ms/dataAccess/output/ResultWriter.java",
"license": "apache-2.0",
"size": 2415
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 891,615 |
public Observable<ServiceResponse<RedisResourceInner>> beginCreateWithServiceResponseAsync(String resourceGroupName, String name, RedisCreateParameters parameters) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (name == null) {
throw new IllegalArgumentException("Parameter name is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<RedisResourceInner>> function(String resourceGroupName, String name, RedisCreateParameters parameters) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (name == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (parameters == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache.
*
* @param resourceGroupName The name of the resource group.
* @param name The name of the Redis cache.
* @param parameters Parameters supplied to the Create Redis operation.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the RedisResourceInner object
*/ | Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache | beginCreateWithServiceResponseAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/redis/mgmt-v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/RedisInner.java",
"license": "mit",
"size": 110186
} | [
"com.microsoft.azure.management.redis.v2018_03_01.RedisCreateParameters",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.management.redis.v2018_03_01.RedisCreateParameters; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.management.redis.v2018_03_01.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,768,314 |
public static String sqlweek(List<?> parsedArgs) throws SQLException {
return singleArgumentFunctionCall("extract(week from ", "week", parsedArgs);
} | static String function(List<?> parsedArgs) throws SQLException { return singleArgumentFunctionCall(STR, "week", parsedArgs); } | /**
* week translation.
*
* @param parsedArgs arguments
* @return sql call
* @throws SQLException if something wrong happens
*/ | week translation | sqlweek | {
"repo_name": "AlexElin/pgjdbc",
"path": "pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java",
"license": "bsd-2-clause",
"size": 25138
} | [
"java.sql.SQLException",
"java.util.List"
] | import java.sql.SQLException; import java.util.List; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 2,589,793 |
public double[] calculateKinship(
GenomeDataSource genoData,
Set<String> strains)
throws IOException
{
strains = new HashSet<String>(strains);
strains.retainAll(genoData.getAvailableStrains());
String[] commonStrains = strains.toArray(new String[0]);
Arrays.sort(commonStrains);
int strainCount = commonStrains.length;
int snpCount = 0;
for(ChromosomeDataSource currChr : genoData.getChromosomeDataSources().values())
{
snpCount += currChr.getSnpPositionInputStream().getSnpCount();
}
double[] genos = new double[snpCount * strainCount];
int currStartIndex = 0;
for(ChromosomeDataSource currChr : genoData.getChromosomeDataSources().values())
{
SdpInputStream sdpStream = currChr.getSdpInputStream(commonStrains);
int currSnpCount = (int)currChr.getSnpPositionInputStream().getSnpCount();
for(int i = 0; i < currSnpCount; i++)
{
int currSnp = currStartIndex + i;
BitSet currSdp = sdpStream.getNextSdp();
for(int strainIndex = 0; strainIndex < strainCount; strainIndex++)
{
double currCall = currSdp.get(strainIndex) ? 1.0 : 0.0;
genos[currSnp * strainCount + strainIndex] = currCall;
}
}
}
return calculateKinship(strainCount, genos);
} | double[] function( GenomeDataSource genoData, Set<String> strains) throws IOException { strains = new HashSet<String>(strains); strains.retainAll(genoData.getAvailableStrains()); String[] commonStrains = strains.toArray(new String[0]); Arrays.sort(commonStrains); int strainCount = commonStrains.length; int snpCount = 0; for(ChromosomeDataSource currChr : genoData.getChromosomeDataSources().values()) { snpCount += currChr.getSnpPositionInputStream().getSnpCount(); } double[] genos = new double[snpCount * strainCount]; int currStartIndex = 0; for(ChromosomeDataSource currChr : genoData.getChromosomeDataSources().values()) { SdpInputStream sdpStream = currChr.getSdpInputStream(commonStrains); int currSnpCount = (int)currChr.getSnpPositionInputStream().getSnpCount(); for(int i = 0; i < currSnpCount; i++) { int currSnp = currStartIndex + i; BitSet currSdp = sdpStream.getNextSdp(); for(int strainIndex = 0; strainIndex < strainCount; strainIndex++) { double currCall = currSdp.get(strainIndex) ? 1.0 : 0.0; genos[currSnp * strainCount + strainIndex] = currCall; } } } return calculateKinship(strainCount, genos); } | /**
* Calculate the kinship values
* @param genoData
* the genotype data to base it on
* @param strains
* a map of strain names
* @return
* the kinship
* @throws
* IOException
*/ | Calculate the kinship values | calculateKinship | {
"repo_name": "cgd/haplotype-analysis",
"path": "src/java/org/jax/haplotype/analysis/EMMAAssociationTest.java",
"license": "gpl-3.0",
"size": 21973
} | [
"java.io.IOException",
"java.util.Arrays",
"java.util.BitSet",
"java.util.HashSet",
"java.util.Set",
"org.jax.haplotype.data.ChromosomeDataSource",
"org.jax.haplotype.data.GenomeDataSource",
"org.jax.haplotype.io.SdpInputStream"
] | import java.io.IOException; import java.util.Arrays; import java.util.BitSet; import java.util.HashSet; import java.util.Set; import org.jax.haplotype.data.ChromosomeDataSource; import org.jax.haplotype.data.GenomeDataSource; import org.jax.haplotype.io.SdpInputStream; | import java.io.*; import java.util.*; import org.jax.haplotype.data.*; import org.jax.haplotype.io.*; | [
"java.io",
"java.util",
"org.jax.haplotype"
] | java.io; java.util; org.jax.haplotype; | 329,075 |
public boolean isChecked() {
return ((RemoteWebElement) getElement()).isSelected();
} | boolean function() { return ((RemoteWebElement) getElement()).isSelected(); } | /**
* The RadioButton isChecked function
*
* It invokes SeLion session to handle the isChecked function against the element.
*/ | The RadioButton isChecked function It invokes SeLion session to handle the isChecked function against the element | isChecked | {
"repo_name": "mengchen2/SeLion_Demo",
"path": "client/src/main/java/com/paypal/selion/platform/html/RadioButton.java",
"license": "apache-2.0",
"size": 5568
} | [
"org.openqa.selenium.remote.RemoteWebElement"
] | import org.openqa.selenium.remote.RemoteWebElement; | import org.openqa.selenium.remote.*; | [
"org.openqa.selenium"
] | org.openqa.selenium; | 597,063 |
public String scrape(InputStream is) {
//This disables the delimiter and then uses the scanner to convert the stream from the URL into text
try (Scanner s = new Scanner(is); Scanner sc = s.useDelimiter("\\A")) {
return scrape(sc);
}
}
| String function(InputStream is) { try (Scanner s = new Scanner(is); Scanner sc = s.useDelimiter("\\A")) { return scrape(sc); } } | /**
* Scrapes the text in the given {@link InputStream}.
*
* @param is
* the {@link InputStream} containing the text to scrape
* @return the scraped text
*/ | Scrapes the text in the given <code>InputStream</code> | scrape | {
"repo_name": "beallej/event-detection",
"path": "src/eventdetection/downloader/Scraper.java",
"license": "mit",
"size": 10155
} | [
"java.io.InputStream",
"java.util.Scanner"
] | import java.io.InputStream; import java.util.Scanner; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,787,335 |
public static List<ResourceManager<?>> getManagersForWorkspacePath( Workspace workspace, String path ) {
List<ResourceManager<?>> result = new ArrayList<ResourceManager<?>>();
List<ResourceManager<?>> list = workspace.getResourceManagers();
for ( ResourceManager<?> mgr : list ) {
ResourceManagerMetadata<?> md = mgr.getMetadata();
if ( path.startsWith( md.getWorkspacePath() ) ) {
result.add( mgr );
}
}
return result;
} | static List<ResourceManager<?>> function( Workspace workspace, String path ) { List<ResourceManager<?>> result = new ArrayList<ResourceManager<?>>(); List<ResourceManager<?>> list = workspace.getResourceManagers(); for ( ResourceManager<?> mgr : list ) { ResourceManagerMetadata<?> md = mgr.getMetadata(); if ( path.startsWith( md.getWorkspacePath() ) ) { result.add( mgr ); } } return result; } | /**
* Searches for resource managers corresponding to a workspace path.
*
* @param workspace
* may not be <code>null</code>
* @param path
* may not be <code>null</code>, may contain other path elements
* @return a list of matching resource managers, may be empty but never <code>null</code>
*/ | Searches for resource managers corresponding to a workspace path | getManagersForWorkspacePath | {
"repo_name": "deegree/deegree3",
"path": "deegree-core/deegree-core-workspace/src/main/java/org/deegree/workspace/WorkspaceUtils.java",
"license": "lgpl-2.1",
"size": 9977
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,325,562 |
@Test
public void testSFRemoteHomeCreateWithMultiArgs() throws Exception {
SFRa ejb1 = null;
try {
ejb1 = fhome1.create(true, (byte) 9, 'C', (short) 0, 0, 0, (float) 0.0, 0.0, "String stringValue");
assertNotNull("Create EJB was null.", ejb1);
} finally {
if (ejb1 != null) {
ejb1.remove();
svLogger.info("Cleanup completed, EJB removed");
}
}
} | void function() throws Exception { SFRa ejb1 = null; try { ejb1 = fhome1.create(true, (byte) 9, 'C', (short) 0, 0, 0, (float) 0.0, 0.0, STR); assertNotNull(STR, ejb1); } finally { if (ejb1 != null) { ejb1.remove(); svLogger.info(STR); } } } | /**
* (hcl01) Test Stateful remote home create (with multiple args)
*/ | (hcl01) Test Stateful remote home create (with multiple args) | testSFRemoteHomeCreateWithMultiArgs | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB2XRemoteSpecWeb.war/src/com/ibm/ejb2x/base/spec/sfr/web/SFRemoteHomeCreateServlet.java",
"license": "epl-1.0",
"size": 4266
} | [
"com.ibm.ejb2x.base.spec.sfr.ejb.SFRa",
"org.junit.Assert"
] | import com.ibm.ejb2x.base.spec.sfr.ejb.SFRa; import org.junit.Assert; | import com.ibm.ejb2x.base.spec.sfr.ejb.*; import org.junit.*; | [
"com.ibm.ejb2x",
"org.junit"
] | com.ibm.ejb2x; org.junit; | 393,364 |
@Override
public void printCreate(WriteStream os)
throws IOException
{
os.print("new com.caucho.el.NeExpr(");
_left.printCreate(os);
os.print(", ");
_right.printCreate(os);
os.print(")");
} | void function(WriteStream os) throws IOException { os.print(STR); _left.printCreate(os); os.print(STR); _right.printCreate(os); os.print(")"); } | /**
* Prints the code to create an LongLiteral.
*/ | Prints the code to create an LongLiteral | printCreate | {
"repo_name": "CleverCloud/Quercus",
"path": "resin/src/main/java/com/caucho/el/NeExpr.java",
"license": "gpl-2.0",
"size": 4148
} | [
"com.caucho.vfs.WriteStream",
"java.io.IOException"
] | import com.caucho.vfs.WriteStream; import java.io.IOException; | import com.caucho.vfs.*; import java.io.*; | [
"com.caucho.vfs",
"java.io"
] | com.caucho.vfs; java.io; | 366,724 |
@Override
public void output(XMLStreamWriter writer) throws XMLStreamException {
if(isRoot) {
SMOutputDocument doc = SMOutputFactory.createOutputDocument(writer);
SMNamespace modsNS = doc.getNamespace(XMLNS,modsNSC.getPrefix());
SMOutputElement root = doc.addElement(modsNS,"mods");
RootXmlHelper.output(writer,getAllNamespaceSchemaContexts(),root);
Iterator<String> attrIter = attributes.keySet().iterator();
while (attrIter.hasNext ()) {
String key = attrIter.next ();
String value = attributes.get (key);
root.addAttribute (key, value);
}
headlessOutput(modsNS,root);
doc.closeRoot();
}
else {
SMRootFragment frag = SMOutputFactory.createOutputFragment(writer);
SMNamespace modsNS = frag.getNamespace(XMLNS,modsNSC.getPrefix());
SMOutputElement root = frag.addElement(modsNS,"mods");
String value = attributes.get ("ID");
if(value != null)
root.addAttribute ("ID", value);
value = attributes.get ("version");
if(value != null)
root.addAttribute ("version", value);
headlessOutput(modsNS,root);
frag.closeRoot();
}
} | void function(XMLStreamWriter writer) throws XMLStreamException { if(isRoot) { SMOutputDocument doc = SMOutputFactory.createOutputDocument(writer); SMNamespace modsNS = doc.getNamespace(XMLNS,modsNSC.getPrefix()); SMOutputElement root = doc.addElement(modsNS,"mods"); RootXmlHelper.output(writer,getAllNamespaceSchemaContexts(),root); Iterator<String> attrIter = attributes.keySet().iterator(); while (attrIter.hasNext ()) { String key = attrIter.next (); String value = attributes.get (key); root.addAttribute (key, value); } headlessOutput(modsNS,root); doc.closeRoot(); } else { SMRootFragment frag = SMOutputFactory.createOutputFragment(writer); SMNamespace modsNS = frag.getNamespace(XMLNS,modsNSC.getPrefix()); SMOutputElement root = frag.addElement(modsNS,"mods"); String value = attributes.get ("ID"); if(value != null) root.addAttribute ("ID", value); value = attributes.get (STR); if(value != null) root.addAttribute (STR, value); headlessOutput(modsNS,root); frag.closeRoot(); } } | /** Top-level output method.
* The top level can be either mods or modsCollection. What do I need
* to do to make that work?
*/ | Top-level output method. The top level can be either mods or modsCollection. What do I need to do to make that work | output | {
"repo_name": "opf-labs/ots-schema",
"path": "src/edu/harvard/hul/ois/ots/schemas/ModsMD/Mods.java",
"license": "gpl-3.0",
"size": 20723
} | [
"edu.harvard.hul.ois.ots.schemas.StaxUtils",
"java.util.Iterator",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamWriter",
"org.codehaus.staxmate.SMOutputFactory",
"org.codehaus.staxmate.out.SMNamespace",
"org.codehaus.staxmate.out.SMOutputDocument",
"org.codehaus.staxmate.out.SMOutputElement",
"org.codehaus.staxmate.out.SMRootFragment"
] | import edu.harvard.hul.ois.ots.schemas.StaxUtils; import java.util.Iterator; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import org.codehaus.staxmate.SMOutputFactory; import org.codehaus.staxmate.out.SMNamespace; import org.codehaus.staxmate.out.SMOutputDocument; import org.codehaus.staxmate.out.SMOutputElement; import org.codehaus.staxmate.out.SMRootFragment; | import edu.harvard.hul.ois.ots.schemas.*; import java.util.*; import javax.xml.stream.*; import org.codehaus.staxmate.*; import org.codehaus.staxmate.out.*; | [
"edu.harvard.hul",
"java.util",
"javax.xml",
"org.codehaus.staxmate"
] | edu.harvard.hul; java.util; javax.xml; org.codehaus.staxmate; | 876,633 |
public Builder withOutputTransformer(Class<? extends UnaryOperator<CharSequence>> newValue) {
return withOutputTransformer(asSupplier(newValue));
} | Builder function(Class<? extends UnaryOperator<CharSequence>> newValue) { return withOutputTransformer(asSupplier(newValue)); } | /**
* Sets the output transformer class.
* @param newValue the output transformer class
* @return this
*/ | Sets the output transformer class | withOutputTransformer | {
"repo_name": "akirakw/asakusafw",
"path": "core-project/text/src/main/java/com/asakusafw/runtime/io/text/tabular/TabularTextFormat.java",
"license": "apache-2.0",
"size": 7999
} | [
"java.util.function.UnaryOperator"
] | import java.util.function.UnaryOperator; | import java.util.function.*; | [
"java.util"
] | java.util; | 2,772,589 |
public static void showScriptingDialog(final JFrame parent) {
final String defaultLanguage =
ConfigManager.instance().getGeneralSettings().getDefaultScriptingLanguage();
final CScriptingDialog dlg =
new CScriptingDialog(parent, defaultLanguage, PluginInterface.instance());
GuiHelper.centerChildToParent(parent, dlg, true);
dlg.setVisible(true);
GuiHelper.applyWindowFix(dlg);
} | static void function(final JFrame parent) { final String defaultLanguage = ConfigManager.instance().getGeneralSettings().getDefaultScriptingLanguage(); final CScriptingDialog dlg = new CScriptingDialog(parent, defaultLanguage, PluginInterface.instance()); GuiHelper.centerChildToParent(parent, dlg, true); dlg.setVisible(true); GuiHelper.applyWindowFix(dlg); } | /**
* Opens the main window scripting dialog.
*
* @param parent Parent window used for dialogs.
*/ | Opens the main window scripting dialog | showScriptingDialog | {
"repo_name": "Spacular/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Gui/MainWindow/Implementations/CWindowFunctions.java",
"license": "apache-2.0",
"size": 5267
} | [
"com.google.security.zynamics.binnavi.API",
"com.google.security.zynamics.binnavi.Gui",
"com.google.security.zynamics.binnavi.config.ConfigManager",
"com.google.security.zynamics.zylib.gui.GuiHelper",
"javax.swing.JFrame"
] | import com.google.security.zynamics.binnavi.API; import com.google.security.zynamics.binnavi.Gui; import com.google.security.zynamics.binnavi.config.ConfigManager; import com.google.security.zynamics.zylib.gui.GuiHelper; import javax.swing.JFrame; | import com.google.security.zynamics.binnavi.*; import com.google.security.zynamics.binnavi.config.*; import com.google.security.zynamics.zylib.gui.*; import javax.swing.*; | [
"com.google.security",
"javax.swing"
] | com.google.security; javax.swing; | 1,995,645 |
public Collection<Object> asCollectionOfFacts();
| Collection<Object> function(); | /**
*
* Aggregates are the boundaries by which we design decision services. This method provides a flat representation of the Aggregate for easier business rules authoring
*/ | Aggregates are the boundaries by which we design decision services. This method provides a flat representation of the Aggregate for easier business rules authoring | asCollectionOfFacts | {
"repo_name": "sherl0cks/maven-archetypes",
"path": "camel-kie-spring-eap-war-source/camel-kie-spring-eap-war-source-domain/src/main/java/com/rhc/aggregates/AggregateRoot.java",
"license": "apache-2.0",
"size": 667
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 951,479 |
private synchronized void connect(BluetoothDevice device) {
if (D)
Log.d(TAG, "connect to: " + device);
// Cancel any thread attempting to make a connection
if (mState == STATE_CONNECTING) {
if (mConnectThread != null) {
mConnectThread.cancel();
mConnectThread = null;
}
}
// Cancel any thread currently running a connection
if (mConnectedThread != null) {
mConnectedThread.cancel();
mConnectedThread = null;
}
// Start the thread to connect with the given device
mConnectThread = new ConnectThread(device);
mConnectThread.start();
setState(STATE_CONNECTING);
} | synchronized void function(BluetoothDevice device) { if (D) Log.d(TAG, STR + device); if (mState == STATE_CONNECTING) { if (mConnectThread != null) { mConnectThread.cancel(); mConnectThread = null; } } if (mConnectedThread != null) { mConnectedThread.cancel(); mConnectedThread = null; } mConnectThread = new ConnectThread(device); mConnectThread.start(); setState(STATE_CONNECTING); } | /**
* Start the ConnectThread to initiate a connection to a remote device.
*
* @param device
* The BluetoothDevice to connect
*/ | Start the ConnectThread to initiate a connection to a remote device | connect | {
"repo_name": "as013/ika",
"path": "Android/Gluco/app/src/main/java/com/gluco/modul/Bluetooth.java",
"license": "gpl-2.0",
"size": 19868
} | [
"android.bluetooth.BluetoothDevice",
"android.util.Log"
] | import android.bluetooth.BluetoothDevice; import android.util.Log; | import android.bluetooth.*; import android.util.*; | [
"android.bluetooth",
"android.util"
] | android.bluetooth; android.util; | 59,710 |
private Map<Comparable, Paint> readPaintMap(ObjectInputStream in)
throws IOException, ClassNotFoundException {
boolean isNull = in.readBoolean();
if (isNull) {
return null;
}
Map<Comparable, Paint> result = new HashMap<Comparable, Paint>();
int count = in.readInt();
for (int i = 0; i < count; i++) {
Comparable category = (Comparable) in.readObject();
Paint paint = SerialUtilities.readPaint(in);
result.put(category, paint);
}
return result;
} | Map<Comparable, Paint> function(ObjectInputStream in) throws IOException, ClassNotFoundException { boolean isNull = in.readBoolean(); if (isNull) { return null; } Map<Comparable, Paint> result = new HashMap<Comparable, Paint>(); int count = in.readInt(); for (int i = 0; i < count; i++) { Comparable category = (Comparable) in.readObject(); Paint paint = SerialUtilities.readPaint(in); result.put(category, paint); } return result; } | /**
* Reads a <code>Map</code> of (<code>Comparable</code>, <code>Paint</code>)
* elements from a stream.
*
* @param in the input stream.
*
* @return The map.
*
* @throws IOException
* @throws ClassNotFoundException
*
* @see #writePaintMap(Map, ObjectOutputStream)
*/ | Reads a <code>Map</code> of (<code>Comparable</code>, <code>Paint</code>) elements from a stream | readPaintMap | {
"repo_name": "akardapolov/ASH-Viewer",
"path": "jfreechart-fse/src/main/java/org/jfree/chart/axis/CategoryAxis.java",
"license": "gpl-3.0",
"size": 54058
} | [
"java.awt.Paint",
"java.io.IOException",
"java.io.ObjectInputStream",
"java.util.HashMap",
"java.util.Map",
"org.jfree.chart.util.SerialUtilities"
] | import java.awt.Paint; import java.io.IOException; import java.io.ObjectInputStream; import java.util.HashMap; import java.util.Map; import org.jfree.chart.util.SerialUtilities; | import java.awt.*; import java.io.*; import java.util.*; import org.jfree.chart.util.*; | [
"java.awt",
"java.io",
"java.util",
"org.jfree.chart"
] | java.awt; java.io; java.util; org.jfree.chart; | 1,193,301 |
protected boolean isJARPath(String path) {
boolean jarURL = (path.indexOf("!") > 0) && (path.indexOf(".jar") > 0);
boolean jarFile = new File(path).isFile() && path.endsWith(".jar");
return jarURL || jarFile;
} | boolean function(String path) { boolean jarURL = (path.indexOf("!") > 0) && (path.indexOf(".jar") > 0); boolean jarFile = new File(path).isFile() && path.endsWith(".jar"); return jarURL jarFile; } | /**
* Is this path pointing at a JAR file?
*/ | Is this path pointing at a JAR file | isJARPath | {
"repo_name": "rjnichols/visural-common",
"path": "src/main/java/com/visural/common/ClassFinder.java",
"license": "apache-2.0",
"size": 14217
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,445,594 |
private int readU8(int address) throws IOException {
return device.read(address);
} | int function(int address) throws IOException { return device.read(address); } | /**
* Read unsigned 1 byte from address
*
* @param address
*
* @return Value
*
* @throws IOException
*/ | Read unsigned 1 byte from address | readU8 | {
"repo_name": "git4gecko/jMeasurement",
"path": "src/de/us/rpi/jMeasurement/bmp085/BMP085Device.java",
"license": "gpl-2.0",
"size": 4903
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,650,289 |
final CompletableFuture<T> promise = new CompletableFuture<>();
scheduler.schedule(() -> {
final TimeoutException ex = new TimeoutException(timeoutMessage + " " + duration);
return promise.completeExceptionally(ex);
}, duration.toMillis(), MILLISECONDS);
return promise;
} | final CompletableFuture<T> promise = new CompletableFuture<>(); scheduler.schedule(() -> { final TimeoutException ex = new TimeoutException(timeoutMessage + " " + duration); return promise.completeExceptionally(ex); }, duration.toMillis(), MILLISECONDS); return promise; } | /**
* Fail a {@link CompletableFuture} after the specified {@link Duration}.
*
* @param duration the {@link Duration}to wait before failing.
*/ | Fail a <code>CompletableFuture</code> after the specified <code>Duration</code> | failAfter | {
"repo_name": "USEF-Foundation/ri.usef.energy",
"path": "usef-build/usef-core/usef-core-commons/src/main/java/energy/usef/core/util/ConcurrentUtil.java",
"license": "apache-2.0",
"size": 2381
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.TimeoutException"
] | import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeoutException; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,835,677 |
public void updateFile(OCFile file) {
setFile(file);
} | void function(OCFile file) { setFile(file); } | /**
* Update the file of the fragment with file value
*
* @param file The new file to set
*/ | Update the file of the fragment with file value | updateFile | {
"repo_name": "ekeitho/android",
"path": "src/com/owncloud/android/ui/preview/PreviewTextFragment.java",
"license": "gpl-2.0",
"size": 13049
} | [
"com.owncloud.android.datamodel.OCFile"
] | import com.owncloud.android.datamodel.OCFile; | import com.owncloud.android.datamodel.*; | [
"com.owncloud.android"
] | com.owncloud.android; | 1,185,207 |
int write(ChannelBuffer bb) throws PcepParseException;
interface Builder { | int write(ChannelBuffer bb) throws PcepParseException; interface Builder { | /**
* Writes the RP Object into channel buffer.
*
* @param bb channel buffer
* @return Returns the writerIndex of this buffer
* @throws PcepParseException while writing RP object into Channel Buffer.
*/ | Writes the RP Object into channel buffer | write | {
"repo_name": "kuujo/onos",
"path": "protocols/pcep/pcepio/src/main/java/org/onosproject/pcepio/protocol/PcepRPObject.java",
"license": "apache-2.0",
"size": 6389
} | [
"org.jboss.netty.buffer.ChannelBuffer",
"org.onosproject.pcepio.exceptions.PcepParseException"
] | import org.jboss.netty.buffer.ChannelBuffer; import org.onosproject.pcepio.exceptions.PcepParseException; | import org.jboss.netty.buffer.*; import org.onosproject.pcepio.exceptions.*; | [
"org.jboss.netty",
"org.onosproject.pcepio"
] | org.jboss.netty; org.onosproject.pcepio; | 1,789,203 |
public void setApplySet(Set<Apply> applySet) {
this.applySet = applySet;
}
| void function(Set<Apply> applySet) { this.applySet = applySet; } | /**
* Sets the apply set.
*
* @param applySet the new apply set
*/ | Sets the apply set | setApplySet | {
"repo_name": "aholake/hiringviet",
"path": "src/main/java/vn/com/hiringviet/model/Member.java",
"license": "apache-2.0",
"size": 5862
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 230,503 |
protected Log createLogger() {
return ((nonStaticLog != null) ? nonStaticLog : LogFactory.getLog(getClass()));
} | Log function() { return ((nonStaticLog != null) ? nonStaticLog : LogFactory.getLog(getClass())); } | /**
* Instantiating log4j logger
*
* @return
*/ | Instantiating log4j logger | createLogger | {
"repo_name": "alameluchidambaram/CONNECT",
"path": "Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/transform/subdisc/HL7PRPA201306Transforms.java",
"license": "bsd-3-clause",
"size": 33884
} | [
"org.apache.commons.logging.Log",
"org.apache.commons.logging.LogFactory"
] | import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; | import org.apache.commons.logging.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,412,700 |
public void setup(long cairo_t_pointer)
{
nativePointer = init(cairo_t_pointer);
setRenderingHints(new RenderingHints(getDefaultHints()));
setFont(new Font("SansSerif", Font.PLAIN, 12));
setColor(Color.black);
setBackground(Color.white);
setPaint(Color.black);
setStroke(new BasicStroke());
setTransform(new AffineTransform());
cairoSetAntialias(nativePointer, antialias);
} | void function(long cairo_t_pointer) { nativePointer = init(cairo_t_pointer); setRenderingHints(new RenderingHints(getDefaultHints())); setFont(new Font(STR, Font.PLAIN, 12)); setColor(Color.black); setBackground(Color.white); setPaint(Color.black); setStroke(new BasicStroke()); setTransform(new AffineTransform()); cairoSetAntialias(nativePointer, antialias); } | /**
* Sets up the default values and allocates the native cairographics2d structure
* @param cairo_t_pointer a native pointer to a cairo_t of the context.
*/ | Sets up the default values and allocates the native cairographics2d structure | setup | {
"repo_name": "julianwi/awtonandroid",
"path": "java/src/julianwi/awtpeer/CairoGraphics2D.java",
"license": "gpl-3.0",
"size": 64890
} | [
"java.awt.BasicStroke",
"java.awt.Color",
"java.awt.Font",
"java.awt.RenderingHints",
"java.awt.geom.AffineTransform"
] | import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; import java.awt.RenderingHints; import java.awt.geom.AffineTransform; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 190,389 |
default void merge(BlockVolume right, BlockVolumeMerger merger) {
merge(right, merger, getVolume());
} | default void merge(BlockVolume right, BlockVolumeMerger merger) { merge(right, merger, getVolume()); } | /**
* Similar to {@link BlockVolumeWorker#merge(BlockVolume,
* BlockVolumeMerger, MutableBlockVolume)} but uses the operating volume as
* the destination. Precautions must be taken as the volume is modified
* while the operation is being performed, and so the surrounding blocks
* might not be the original ones.
*
* @param merger The merging operation
*/ | Similar to <code>BlockVolumeWorker#merge(BlockVolume, BlockVolumeMerger, MutableBlockVolume)</code> but uses the operating volume as the destination. Precautions must be taken as the volume is modified while the operation is being performed, and so the surrounding blocks might not be the original ones | merge | {
"repo_name": "kashike/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/world/extent/worker/MutableBlockVolumeWorker.java",
"license": "mit",
"size": 3065
} | [
"org.spongepowered.api.world.extent.BlockVolume",
"org.spongepowered.api.world.extent.worker.procedure.BlockVolumeMerger"
] | import org.spongepowered.api.world.extent.BlockVolume; import org.spongepowered.api.world.extent.worker.procedure.BlockVolumeMerger; | import org.spongepowered.api.world.extent.*; import org.spongepowered.api.world.extent.worker.procedure.*; | [
"org.spongepowered.api"
] | org.spongepowered.api; | 1,619,596 |
public CountDownLatch validateProductAsync(com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, AsyncCallback<com.mozu.api.contracts.productruntime.ProductValidationSummary> callback) throws Exception
{
return validateProductAsync( productOptionSelections, productCode, null, null, null, callback);
} | CountDownLatch function(com.mozu.api.contracts.productruntime.ProductOptionSelections productOptionSelections, String productCode, AsyncCallback<com.mozu.api.contracts.productruntime.ProductValidationSummary> callback) throws Exception { return validateProductAsync( productOptionSelections, productCode, null, null, null, callback); } | /**
* Validate the final state of shopper-selected options.
* <p><pre><code>
* Product product = new Product();
* CountDownLatch latch = product.validateProduct( productOptionSelections, productCode, callback );
* latch.await() * </code></pre></p>
* @param productCode Merchant-created code that uniquely identifies the product such as a SKU or item number. Once created, the product code is read-only.
* @param callback callback handler for asynchronous operations
* @param productOptionSelections For a product with shopper-configurable options, the properties of the product options selected by the shopper.
* @return com.mozu.api.contracts.productruntime.ProductValidationSummary
* @see com.mozu.api.contracts.productruntime.ProductValidationSummary
* @see com.mozu.api.contracts.productruntime.ProductOptionSelections
*/ | Validate the final state of shopper-selected options. <code><code> Product product = new Product(); CountDownLatch latch = product.validateProduct( productOptionSelections, productCode, callback ); latch.await() * </code></code> | validateProductAsync | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/catalog/storefront/ProductResource.java",
"license": "mit",
"size": 50989
} | [
"com.mozu.api.AsyncCallback",
"java.util.concurrent.CountDownLatch"
] | import com.mozu.api.AsyncCallback; import java.util.concurrent.CountDownLatch; | import com.mozu.api.*; import java.util.concurrent.*; | [
"com.mozu.api",
"java.util"
] | com.mozu.api; java.util; | 582,555 |
private static AuthStatus handleLogoutEndpoint(final HttpServletRequest req,
final HttpServletResponse resp) throws AuthException,
ServletException,
IOException {
final String postLogoutRedirectUri = req.getParameter(POST_LOGOUT_REDIRECT_URI);
if (postLogoutRedirectUri != null) {
final String postLogoutRedirectUriNormalized = URI.create(postLogoutRedirectUri).normalize().toASCIIString();
// Check that the post logout redirect uri is relative to the application if not fail.
final String contextUri = URI.create(req.getRequestURL().toString()).resolve(req.getContextPath()).toASCIIString();
if (!postLogoutRedirectUriNormalized.startsWith(contextUri)) {
throw new AuthException("invalid post_logout_redirect_uri");
}
final Cookie cookie = new Cookie(SUBJECT_COOKIE_KEY, "");
cookie.setMaxAge(0);
cookie.setSecure(true);
resp.addCookie(cookie);
resp.sendRedirect(postLogoutRedirectUriNormalized);
return AuthStatus.SEND_SUCCESS;
}
throw new AuthException("missing post_logout_redirect_uri");
}
/**
* Builds the redirect URI including the assembly of <code>state</code>.
*
* @param req
* servlet request
* @param resp
* servlet response
* @return {@link AuthStatus#SEND_SUCCESS}
| static AuthStatus function(final HttpServletRequest req, final HttpServletResponse resp) throws AuthException, ServletException, IOException { final String postLogoutRedirectUri = req.getParameter(POST_LOGOUT_REDIRECT_URI); if (postLogoutRedirectUri != null) { final String postLogoutRedirectUriNormalized = URI.create(postLogoutRedirectUri).normalize().toASCIIString(); final String contextUri = URI.create(req.getRequestURL().toString()).resolve(req.getContextPath()).toASCIIString(); if (!postLogoutRedirectUriNormalized.startsWith(contextUri)) { throw new AuthException(STR); } final Cookie cookie = new Cookie(SUBJECT_COOKIE_KEY, STRmissing post_logout_redirect_uri"); } /** * Builds the redirect URI including the assembly of <code>state</code>. * * @param req * servlet request * @param resp * servlet response * @return {@link AuthStatus#SEND_SUCCESS} | /**
* Handle the logout endpoint. This will clear the cookie and redirect to
* the URI that has been specified.
*
* @param req
* request
* @param resp
* response
* @return authentication status
* @throws AuthException
* happens when there is invalid request data
* @throws IOException
* servlet error
* @throws ServletException
* servlet error
*/ | Handle the logout endpoint. This will clear the cookie and redirect to the URI that has been specified | handleLogoutEndpoint | {
"repo_name": "trajano/jaspic-tester",
"path": "test-server-auth-module/src/main/java/net/trajano/auth/TestServerAuthModule.java",
"license": "epl-1.0",
"size": 16522
} | [
"java.io.IOException",
"java.net.URI",
"javax.security.auth.message.AuthException",
"javax.security.auth.message.AuthStatus",
"javax.servlet.ServletException",
"javax.servlet.http.Cookie",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import java.net.URI; import javax.security.auth.message.AuthException; import javax.security.auth.message.AuthStatus; import javax.servlet.ServletException; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import java.net.*; import javax.security.auth.message.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"java.net",
"javax.security",
"javax.servlet"
] | java.io; java.net; javax.security; javax.servlet; | 1,453,896 |
//-----------------------------------------------------------------------
private Map<String, Object> getArguments() {
return arguments;
} | Map<String, Object> function() { return arguments; } | /**
* Gets constructor arguments used for building function instances, keyed by parameter name.
* @return the value of the property, not null
*/ | Gets constructor arguments used for building function instances, keyed by parameter name | getArguments | {
"repo_name": "nssales/Strata",
"path": "modules/engine/src/main/java/com/opengamma/strata/engine/config/FunctionConfig.java",
"license": "apache-2.0",
"size": 20194
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,883,268 |
DistributedMember getCoordinator(); | DistributedMember getCoordinator(); | /**
* returns the coordinator of the current membership view. This is who created and distributed the
* view. See NetView.
*/ | returns the coordinator of the current membership view. This is who created and distributed the view. See NetView | getCoordinator | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/main/java/org/apache/geode/distributed/internal/membership/gms/interfaces/Manager.java",
"license": "apache-2.0",
"size": 3795
} | [
"org.apache.geode.distributed.DistributedMember"
] | import org.apache.geode.distributed.DistributedMember; | import org.apache.geode.distributed.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,813,649 |
public void remove(RenderedImage owner, int tileX, int tileY) {
removeTile(createTileId(owner, tileX, tileY));
} | void function(RenderedImage owner, int tileX, int tileY) { removeTile(createTileId(owner, tileX, tileY)); } | /**
* Advises the cache that a tile is no longer needed. It is legal
* to implement this method as a no-op.
*
* @param owner The <code>RenderedImage</code> that the tile belongs to.
* @param tileX The X index of the tile in the owner's tile grid.
* @param tileY The Y index of the tile in the owner's tile grid.
*/ | Advises the cache that a tile is no longer needed. It is legal to implement this method as a no-op | remove | {
"repo_name": "arraydev/snap-engine",
"path": "snap-core/src/main/java/org/esa/snap/jai/FileTileCache.java",
"license": "gpl-3.0",
"size": 25337
} | [
"java.awt.image.RenderedImage"
] | import java.awt.image.RenderedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 1,090,068 |
public void testBoxing() {
// return
assertEquals(4, exec("return params.get(\"x\");", Collections.singletonMap("x", 4), true));
// assignment
assertEquals(4, exec("int y = params.get(\"x\"); return y;", Collections.singletonMap("x", 4), true));
// comparison
assertEquals(true, exec("return 5 > params.get(\"x\");", Collections.singletonMap("x", 4), true));
} | void function() { assertEquals(4, exec(STRx\");", Collections.singletonMap("x", 4), true)); assertEquals(4, exec(STRx\STR, Collections.singletonMap("x", 4), true)); assertEquals(true, exec(STRx\");", Collections.singletonMap("x", 4), true)); } | /**
* Test boxed def objects in various places
*/ | Test boxed def objects in various places | testBoxing | {
"repo_name": "wuranbo/elasticsearch",
"path": "modules/lang-painless/src/test/java/org/elasticsearch/painless/BasicExpressionTests.java",
"license": "apache-2.0",
"size": 12523
} | [
"java.util.Collections"
] | import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 853,848 |
public void doPoll(long delay) {
long now = System.currentTimeMillis();
ArrayList<QEntry> l = new ArrayList<QEntry>();
synchronized(m_features) {
int spacing = 0;
for (DeviceFeature i : m_features.values()) {
if (i.hasListeners()) {
Msg m = i.makePollMsg();
if (m != null) {
l.add(new QEntry(i, m, now + delay + spacing));
spacing += TIME_BETWEEN_POLL_MESSAGES;
}
}
}
}
if (l.isEmpty()) return;
synchronized (m_requestQueue) {
for (QEntry e : l) {
m_requestQueue.add(e);
}
}
RequestQueueManager.s_instance().addQueue(this, now + delay);
if (!l.isEmpty()) {
synchronized(m_lastTimePolled) {
m_lastTimePolled = now;
}
}
} | void function(long delay) { long now = System.currentTimeMillis(); ArrayList<QEntry> l = new ArrayList<QEntry>(); synchronized(m_features) { int spacing = 0; for (DeviceFeature i : m_features.values()) { if (i.hasListeners()) { Msg m = i.makePollMsg(); if (m != null) { l.add(new QEntry(i, m, now + delay + spacing)); spacing += TIME_BETWEEN_POLL_MESSAGES; } } } } if (l.isEmpty()) return; synchronized (m_requestQueue) { for (QEntry e : l) { m_requestQueue.add(e); } } RequestQueueManager.s_instance().addQueue(this, now + delay); if (!l.isEmpty()) { synchronized(m_lastTimePolled) { m_lastTimePolled = now; } } } | /**
* Execute poll on this device: create an array of messages,
* add them to the request queue, and schedule the queue
* for processing.
* @param delay scheduling delay (in milliseconds)
*/ | Execute poll on this device: create an array of messages, add them to the request queue, and schedule the queue for processing | doPoll | {
"repo_name": "curtisstpierre/openhab",
"path": "bundles/binding/org.openhab.binding.insteonplm/src/main/java/org/openhab/binding/insteonplm/internal/device/InsteonDevice.java",
"license": "epl-1.0",
"size": 16839
} | [
"java.util.ArrayList",
"org.openhab.binding.insteonplm.internal.message.Msg"
] | import java.util.ArrayList; import org.openhab.binding.insteonplm.internal.message.Msg; | import java.util.*; import org.openhab.binding.insteonplm.internal.message.*; | [
"java.util",
"org.openhab.binding"
] | java.util; org.openhab.binding; | 1,513,550 |
public String[] getCaptions(String lang) {
String regex = "(@.+?\\([^" + CAPSC + "]+\\))";
Matcher m = Pattern.compile(regex).matcher(getCaptionString());
while (m.find()) {
String result = m.group().trim(); // Return: "@en(man in nothing.black and white)"
if (result.startsWith("@" + lang)) {
return result.substring(("@(" + lang).length(), result.length() - 1).trim().split("\\.");
}
}
return new String[]{};
} | String[] function(String lang) { String regex = STR + CAPSC + STR; Matcher m = Pattern.compile(regex).matcher(getCaptionString()); while (m.find()) { String result = m.group().trim(); if (result.startsWith("@" + lang)) { return result.substring(("@(" + lang).length(), result.length() - 1).trim().split("\\."); } } return new String[]{}; } | /**
* Get all captions by lang.
*
* @param lang language of caption.
* @return list of caption
*/ | Get all captions by lang | getCaptions | {
"repo_name": "graphicsminer/image-captions-acquisition",
"path": "frontend-android/app/src/main/java/the/miner/engine/database/model/GMImage.java",
"license": "mit",
"size": 19072
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 316,872 |
public SubmissionReceipt getSubmissionReceipt(int submissionReceiptId); | SubmissionReceipt function(int submissionReceiptId); | /**
* Get SubmissionReceipt with given id.
*
* @param submissionReceiptId the submission receipt id
* @return the SubmissionReceipt with the given id, or null if there is no such
* SubmissionReceipt
*/ | Get SubmissionReceipt with given id | getSubmissionReceipt | {
"repo_name": "aayushmudgal/CloudCoder",
"path": "CloudCoderModelClassesPersistence/src/org/cloudcoder/app/server/persist/IDatabase.java",
"license": "agpl-3.0",
"size": 26221
} | [
"org.cloudcoder.app.shared.model.SubmissionReceipt"
] | import org.cloudcoder.app.shared.model.SubmissionReceipt; | import org.cloudcoder.app.shared.model.*; | [
"org.cloudcoder.app"
] | org.cloudcoder.app; | 1,992,325 |
@Override
protected HAServiceTarget resolveTarget(String nnId) {
HdfsConfiguration conf = (HdfsConfiguration)getConf();
return new NNHAServiceTarget(conf, nameserviceId, nnId);
} | HAServiceTarget function(String nnId) { HdfsConfiguration conf = (HdfsConfiguration)getConf(); return new NNHAServiceTarget(conf, nameserviceId, nnId); } | /**
* Try to map the given namenode ID to its service address.
*/ | Try to map the given namenode ID to its service address | resolveTarget | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/DFSHAAdmin.java",
"license": "apache-2.0",
"size": 11154
} | [
"org.apache.hadoop.ha.HAServiceTarget",
"org.apache.hadoop.hdfs.HdfsConfiguration"
] | import org.apache.hadoop.ha.HAServiceTarget; import org.apache.hadoop.hdfs.HdfsConfiguration; | import org.apache.hadoop.ha.*; import org.apache.hadoop.hdfs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 639,827 |
private StoreBuild getBuild(String guid) {
StoreBuildCriteria criteria = new StoreBuildCriteria();
criteria.setGuid(guid);
return buildService.getBuild(criteria);
} | StoreBuild function(String guid) { StoreBuildCriteria criteria = new StoreBuildCriteria(); criteria.setGuid(guid); return buildService.getBuild(criteria); } | /**
* Gets the build by GUID.
*
* @param guid the build GUID.
* @return the build.
*/ | Gets the build by GUID | getBuild | {
"repo_name": "lorislab/armonitor",
"path": "armonitor-ejb/src/main/java/org/lorislab/armonitor/activity/ejb/ActivityProcessServiceBean.java",
"license": "apache-2.0",
"size": 16341
} | [
"org.lorislab.armonitor.store.criteria.StoreBuildCriteria",
"org.lorislab.armonitor.store.model.StoreBuild"
] | import org.lorislab.armonitor.store.criteria.StoreBuildCriteria; import org.lorislab.armonitor.store.model.StoreBuild; | import org.lorislab.armonitor.store.criteria.*; import org.lorislab.armonitor.store.model.*; | [
"org.lorislab.armonitor"
] | org.lorislab.armonitor; | 2,031,106 |
public int read(final byte[] dest, final int timeoutMillis) throws IOException; | int function(final byte[] dest, final int timeoutMillis) throws IOException; | /**
* Reads as many bytes as possible into the destination buffer.
*
* @param dest the destination byte buffer
* @param timeoutMillis the timeout for reading
* @return the actual number of bytes read
* @throws IOException if an error occurred during reading
*/ | Reads as many bytes as possible into the destination buffer | read | {
"repo_name": "mluessi/dronin",
"path": "androidgcs/src/com/hoho/android/usbserial/driver/UsbSerialDriver.java",
"license": "gpl-3.0",
"size": 6903
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,149,610 |
public static List<Approval> getApprovalHistoryApp(int applicationId,
String operator) throws Exception {
BillingDAO billingDAO = new BillingDAO();
List<Approval> api_request = billingDAO
.getApprovalHistoryApp(applicationId, operator);
return api_request;
} | static List<Approval> function(int applicationId, String operator) throws Exception { BillingDAO billingDAO = new BillingDAO(); List<Approval> api_request = billingDAO .getApprovalHistoryApp(applicationId, operator); return api_request; } | /**
* Gets the approval history app.
*
* @param applicationId the application id
* @param operator the operator
* @return the approval history app
* @throws Exception
*/ | Gets the approval history app | getApprovalHistoryApp | {
"repo_name": "WSO2Telco/component-dep",
"path": "components/reporting-service/src/main/java/com/wso2telco/dep/reportingservice/northbound/NbHostObjectUtils.java",
"license": "apache-2.0",
"size": 117356
} | [
"com.wso2telco.dep.reportingservice.dao.Approval",
"com.wso2telco.dep.reportingservice.dao.BillingDAO",
"java.util.List"
] | import com.wso2telco.dep.reportingservice.dao.Approval; import com.wso2telco.dep.reportingservice.dao.BillingDAO; import java.util.List; | import com.wso2telco.dep.reportingservice.dao.*; import java.util.*; | [
"com.wso2telco.dep",
"java.util"
] | com.wso2telco.dep; java.util; | 2,051,647 |
protected void initializeUnassignedShard(RoutingAllocation allocation, RoutingNodes routingNodes, RoutingNode routingNode,
ShardRouting shardRouting, @Nullable Consumer<ShardRouting> shardRoutingChanges) {
for (RoutingNodes.UnassignedShards.UnassignedIterator it = routingNodes.unassigned().iterator(); it.hasNext(); ) {
ShardRouting unassigned = it.next();
if (!unassigned.equalsIgnoringMetaData(shardRouting)) {
continue;
}
if (shardRoutingChanges != null) {
shardRoutingChanges.accept(unassigned);
}
it.initialize(routingNode.nodeId(), null, allocation.clusterInfo().getShardSize(unassigned, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE));
return;
}
assert false : "shard to initialize not found in list of unassigned shards";
} | void function(RoutingAllocation allocation, RoutingNodes routingNodes, RoutingNode routingNode, ShardRouting shardRouting, @Nullable Consumer<ShardRouting> shardRoutingChanges) { for (RoutingNodes.UnassignedShards.UnassignedIterator it = routingNodes.unassigned().iterator(); it.hasNext(); ) { ShardRouting unassigned = it.next(); if (!unassigned.equalsIgnoringMetaData(shardRouting)) { continue; } if (shardRoutingChanges != null) { shardRoutingChanges.accept(unassigned); } it.initialize(routingNode.nodeId(), null, allocation.clusterInfo().getShardSize(unassigned, ShardRouting.UNAVAILABLE_EXPECTED_SHARD_SIZE)); return; } assert false : STR; } | /**
* Initializes an unassigned shard on a node and removes it from the unassigned
*
* @param allocation the allocation
* @param routingNodes the routing nodes
* @param routingNode the node to initialize it to
* @param shardRouting the shard routing that is to be matched in unassigned shards
* @param shardRoutingChanges changes to apply for shard routing in unassigned shards before initialization
*/ | Initializes an unassigned shard on a node and removes it from the unassigned | initializeUnassignedShard | {
"repo_name": "mmaracic/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/cluster/routing/allocation/command/AbstractAllocateAllocationCommand.java",
"license": "apache-2.0",
"size": 8817
} | [
"java.util.function.Consumer",
"org.elasticsearch.cluster.routing.RoutingNode",
"org.elasticsearch.cluster.routing.RoutingNodes",
"org.elasticsearch.cluster.routing.ShardRouting",
"org.elasticsearch.cluster.routing.allocation.RoutingAllocation",
"org.elasticsearch.common.Nullable"
] | import java.util.function.Consumer; import org.elasticsearch.cluster.routing.RoutingNode; import org.elasticsearch.cluster.routing.RoutingNodes; import org.elasticsearch.cluster.routing.ShardRouting; import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; import org.elasticsearch.common.Nullable; | import java.util.function.*; import org.elasticsearch.cluster.routing.*; import org.elasticsearch.cluster.routing.allocation.*; import org.elasticsearch.common.*; | [
"java.util",
"org.elasticsearch.cluster",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.cluster; org.elasticsearch.common; | 1,517,498 |
public Collection<ExportedService> getServices(); | Collection<ExportedService> function(); | /**
* Get the exported services
* @return exported services
*/ | Get the exported services | getServices | {
"repo_name": "WouterBanckenACA/aries",
"path": "application/application-api/src/main/java/org/apache/aries/application/modelling/ParsedServiceElements.java",
"license": "apache-2.0",
"size": 1327
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 830,688 |
public void testNumberValueType() throws Exception {
// isXxx
assertFalse(NUMBER_TYPE.isArrayType());
assertFalse(NUMBER_TYPE.isBooleanObjectType());
assertFalse(NUMBER_TYPE.isBooleanValueType());
assertFalse(NUMBER_TYPE.isDateType());
assertFalse(NUMBER_TYPE.isEnumElementType());
assertFalse(NUMBER_TYPE.isNamedType());
assertFalse(NUMBER_TYPE.isNullType());
assertTrue(NUMBER_TYPE.isNumber());
assertFalse(NUMBER_TYPE.isNumberObjectType());
assertTrue(NUMBER_TYPE.isNumberValueType());
assertFalse(NUMBER_TYPE.isFunctionPrototypeType());
assertFalse(NUMBER_TYPE.isRegexpType());
assertFalse(NUMBER_TYPE.isString());
assertFalse(NUMBER_TYPE.isStringObjectType());
assertFalse(NUMBER_TYPE.isStringValueType());
assertFalse(NUMBER_TYPE.isEnumType());
assertFalse(NUMBER_TYPE.isUnionType());
assertFalse(NUMBER_TYPE.isStruct());
assertFalse(NUMBER_TYPE.isDict());
assertFalse(NUMBER_TYPE.isAllType());
assertFalse(NUMBER_TYPE.isVoidType());
assertFalse(NUMBER_TYPE.isConstructor());
assertFalse(NUMBER_TYPE.isInstanceType());
// autoboxesTo
assertTypeEquals(NUMBER_OBJECT_TYPE, NUMBER_TYPE.autoboxesTo());
// isSubtype
assertTrue(NUMBER_TYPE.isSubtype(ALL_TYPE));
assertFalse(NUMBER_TYPE.isSubtype(STRING_OBJECT_TYPE));
assertTrue(NUMBER_TYPE.isSubtype(NUMBER_TYPE));
assertFalse(NUMBER_TYPE.isSubtype(functionType));
assertFalse(NUMBER_TYPE.isSubtype(NULL_TYPE));
assertFalse(NUMBER_TYPE.isSubtype(OBJECT_TYPE));
assertFalse(NUMBER_TYPE.isSubtype(DATE_TYPE));
assertTrue(NUMBER_TYPE.isSubtype(unresolvedNamedType));
assertFalse(NUMBER_TYPE.isSubtype(namedGoogBar));
assertTrue(NUMBER_TYPE.isSubtype(
createUnionType(NUMBER_TYPE, NULL_TYPE)));
assertTrue(NUMBER_TYPE.isSubtype(UNKNOWN_TYPE));
// canBeCalled
assertFalse(NUMBER_TYPE.canBeCalled());
// canTestForEqualityWith
assertCanTestForEqualityWith(NUMBER_TYPE, NO_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, NO_OBJECT_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, ALL_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, NUMBER_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, STRING_OBJECT_TYPE);
assertCannotTestForEqualityWith(NUMBER_TYPE, functionType);
assertCannotTestForEqualityWith(NUMBER_TYPE, VOID_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, OBJECT_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, DATE_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, REGEXP_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, ARRAY_TYPE);
assertCanTestForEqualityWith(NUMBER_TYPE, UNKNOWN_TYPE);
// canTestForShallowEqualityWith
assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(NO_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(DATE_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(ERROR_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(functionType));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NULL_TYPE));
assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE));
assertFalse(NUMBER_TYPE.
canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(STRING_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE));
assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(ALL_TYPE));
assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(VOID_TYPE));
assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE));
// isNullable
assertFalse(NUMBER_TYPE.isNullable());
// getLeastSupertype
assertTypeEquals(ALL_TYPE,
NUMBER_TYPE.getLeastSupertype(ALL_TYPE));
assertTypeEquals(createUnionType(NUMBER_TYPE, STRING_OBJECT_TYPE),
NUMBER_TYPE.getLeastSupertype(STRING_OBJECT_TYPE));
assertTypeEquals(NUMBER_TYPE,
NUMBER_TYPE.getLeastSupertype(NUMBER_TYPE));
assertTypeEquals(createUnionType(NUMBER_TYPE, functionType),
NUMBER_TYPE.getLeastSupertype(functionType));
assertTypeEquals(createUnionType(NUMBER_TYPE, OBJECT_TYPE),
NUMBER_TYPE.getLeastSupertype(OBJECT_TYPE));
assertTypeEquals(createUnionType(NUMBER_TYPE, DATE_TYPE),
NUMBER_TYPE.getLeastSupertype(DATE_TYPE));
assertTypeEquals(createUnionType(NUMBER_TYPE, REGEXP_TYPE),
NUMBER_TYPE.getLeastSupertype(REGEXP_TYPE));
// matchesXxx
assertTrue(NUMBER_TYPE.matchesInt32Context());
assertTrue(NUMBER_TYPE.matchesNumberContext());
assertTrue(NUMBER_TYPE.matchesObjectContext());
assertTrue(NUMBER_TYPE.matchesStringContext());
assertTrue(NUMBER_TYPE.matchesUint32Context());
// toString
assertEquals("number", NUMBER_TYPE.toString());
assertTrue(NUMBER_TYPE.hasDisplayName());
assertEquals("number", NUMBER_TYPE.getDisplayName());
Asserts.assertResolvesToSame(NUMBER_TYPE);
assertFalse(NUMBER_TYPE.isNominalConstructor());
} | void function() throws Exception { assertFalse(NUMBER_TYPE.isArrayType()); assertFalse(NUMBER_TYPE.isBooleanObjectType()); assertFalse(NUMBER_TYPE.isBooleanValueType()); assertFalse(NUMBER_TYPE.isDateType()); assertFalse(NUMBER_TYPE.isEnumElementType()); assertFalse(NUMBER_TYPE.isNamedType()); assertFalse(NUMBER_TYPE.isNullType()); assertTrue(NUMBER_TYPE.isNumber()); assertFalse(NUMBER_TYPE.isNumberObjectType()); assertTrue(NUMBER_TYPE.isNumberValueType()); assertFalse(NUMBER_TYPE.isFunctionPrototypeType()); assertFalse(NUMBER_TYPE.isRegexpType()); assertFalse(NUMBER_TYPE.isString()); assertFalse(NUMBER_TYPE.isStringObjectType()); assertFalse(NUMBER_TYPE.isStringValueType()); assertFalse(NUMBER_TYPE.isEnumType()); assertFalse(NUMBER_TYPE.isUnionType()); assertFalse(NUMBER_TYPE.isStruct()); assertFalse(NUMBER_TYPE.isDict()); assertFalse(NUMBER_TYPE.isAllType()); assertFalse(NUMBER_TYPE.isVoidType()); assertFalse(NUMBER_TYPE.isConstructor()); assertFalse(NUMBER_TYPE.isInstanceType()); assertTypeEquals(NUMBER_OBJECT_TYPE, NUMBER_TYPE.autoboxesTo()); assertTrue(NUMBER_TYPE.isSubtype(ALL_TYPE)); assertFalse(NUMBER_TYPE.isSubtype(STRING_OBJECT_TYPE)); assertTrue(NUMBER_TYPE.isSubtype(NUMBER_TYPE)); assertFalse(NUMBER_TYPE.isSubtype(functionType)); assertFalse(NUMBER_TYPE.isSubtype(NULL_TYPE)); assertFalse(NUMBER_TYPE.isSubtype(OBJECT_TYPE)); assertFalse(NUMBER_TYPE.isSubtype(DATE_TYPE)); assertTrue(NUMBER_TYPE.isSubtype(unresolvedNamedType)); assertFalse(NUMBER_TYPE.isSubtype(namedGoogBar)); assertTrue(NUMBER_TYPE.isSubtype( createUnionType(NUMBER_TYPE, NULL_TYPE))); assertTrue(NUMBER_TYPE.isSubtype(UNKNOWN_TYPE)); assertFalse(NUMBER_TYPE.canBeCalled()); assertCanTestForEqualityWith(NUMBER_TYPE, NO_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, NO_OBJECT_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, ALL_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, NUMBER_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, STRING_OBJECT_TYPE); assertCannotTestForEqualityWith(NUMBER_TYPE, functionType); assertCannotTestForEqualityWith(NUMBER_TYPE, VOID_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, OBJECT_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, DATE_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, REGEXP_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, ARRAY_TYPE); assertCanTestForEqualityWith(NUMBER_TYPE, UNKNOWN_TYPE); assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(NO_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NO_OBJECT_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(ARRAY_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(BOOLEAN_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(BOOLEAN_OBJECT_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(DATE_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(ERROR_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(EVAL_ERROR_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(functionType)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NULL_TYPE)); assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(NUMBER_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(NUMBER_OBJECT_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(OBJECT_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(URI_ERROR_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(RANGE_ERROR_TYPE)); assertFalse(NUMBER_TYPE. canTestForShallowEqualityWith(REFERENCE_ERROR_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(REGEXP_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(STRING_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(STRING_OBJECT_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(SYNTAX_ERROR_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(TYPE_ERROR_TYPE)); assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(ALL_TYPE)); assertFalse(NUMBER_TYPE.canTestForShallowEqualityWith(VOID_TYPE)); assertTrue(NUMBER_TYPE.canTestForShallowEqualityWith(UNKNOWN_TYPE)); assertFalse(NUMBER_TYPE.isNullable()); assertTypeEquals(ALL_TYPE, NUMBER_TYPE.getLeastSupertype(ALL_TYPE)); assertTypeEquals(createUnionType(NUMBER_TYPE, STRING_OBJECT_TYPE), NUMBER_TYPE.getLeastSupertype(STRING_OBJECT_TYPE)); assertTypeEquals(NUMBER_TYPE, NUMBER_TYPE.getLeastSupertype(NUMBER_TYPE)); assertTypeEquals(createUnionType(NUMBER_TYPE, functionType), NUMBER_TYPE.getLeastSupertype(functionType)); assertTypeEquals(createUnionType(NUMBER_TYPE, OBJECT_TYPE), NUMBER_TYPE.getLeastSupertype(OBJECT_TYPE)); assertTypeEquals(createUnionType(NUMBER_TYPE, DATE_TYPE), NUMBER_TYPE.getLeastSupertype(DATE_TYPE)); assertTypeEquals(createUnionType(NUMBER_TYPE, REGEXP_TYPE), NUMBER_TYPE.getLeastSupertype(REGEXP_TYPE)); assertTrue(NUMBER_TYPE.matchesInt32Context()); assertTrue(NUMBER_TYPE.matchesNumberContext()); assertTrue(NUMBER_TYPE.matchesObjectContext()); assertTrue(NUMBER_TYPE.matchesStringContext()); assertTrue(NUMBER_TYPE.matchesUint32Context()); assertEquals(STR, NUMBER_TYPE.toString()); assertTrue(NUMBER_TYPE.hasDisplayName()); assertEquals(STR, NUMBER_TYPE.getDisplayName()); Asserts.assertResolvesToSame(NUMBER_TYPE); assertFalse(NUMBER_TYPE.isNominalConstructor()); } | /**
* Tests the behavior of the number value type.
*/ | Tests the behavior of the number value type | testNumberValueType | {
"repo_name": "robbert/closure-compiler",
"path": "test/com/google/javascript/rhino/jstype/JSTypeTest.java",
"license": "apache-2.0",
"size": 266744
} | [
"com.google.javascript.rhino.testing.Asserts"
] | import com.google.javascript.rhino.testing.Asserts; | import com.google.javascript.rhino.testing.*; | [
"com.google.javascript"
] | com.google.javascript; | 1,059,203 |
public void purge() {
throw new SubclassResponsibilityException();
} | void function() { throw new SubclassResponsibilityException(); } | /**
* Flush everything out to disk and remove all purgeable imaged objects from memory.
*/ | Flush everything out to disk and remove all purgeable imaged objects from memory | purge | {
"repo_name": "jonesd/udanax-gold2java",
"path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/snarf/DiskManager.java",
"license": "mit",
"size": 23713
} | [
"info.dgjones.abora.gold.java.exception.SubclassResponsibilityException"
] | import info.dgjones.abora.gold.java.exception.SubclassResponsibilityException; | import info.dgjones.abora.gold.java.exception.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 2,766,373 |
@Override
public View getView(int position,View view,ViewGroup parent)
{
LayoutInflater inflater=context.getLayoutInflater();
View rowView=inflater.inflate(R.layout.row_achievements, parent, false);
TextView titleText = (TextView) rowView.findViewById(R.id.item);
ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
TextView flavorText = (TextView) rowView.findViewById(R.id.context);
String fullString = itemNames.get((itemNames.size()-1) - position);
String [] strings = fullString.split(",");
titleText.setText(strings[0]);
flavorText.setText(strings[1]);
FileHandler fh = FileHandler.getInstance();
imageView.setImageResource(fh.getResourceID(strings[2], "drawable"));
if(locked == true)
imageView.setColorFilter(Color.GRAY);
return rowView;
} | View function(int position,View view,ViewGroup parent) { LayoutInflater inflater=context.getLayoutInflater(); View rowView=inflater.inflate(R.layout.row_achievements, parent, false); TextView titleText = (TextView) rowView.findViewById(R.id.item); ImageView imageView = (ImageView) rowView.findViewById(R.id.icon); TextView flavorText = (TextView) rowView.findViewById(R.id.context); String fullString = itemNames.get((itemNames.size()-1) - position); String [] strings = fullString.split(","); titleText.setText(strings[0]); flavorText.setText(strings[1]); FileHandler fh = FileHandler.getInstance(); imageView.setImageResource(fh.getResourceID(strings[2], STR)); if(locked == true) imageView.setColorFilter(Color.GRAY); return rowView; } | /**
* Sets up the view within the list.
* @param position Position in the list view.
* @param view The list view.
* @param parent The parent to this view.
* @return Returns the view.
*/ | Sets up the view within the list | getView | {
"repo_name": "Jooster2/DAT255",
"path": "app/src/main/java/com/soctec/soctec/core/AchievementsAdapter.java",
"license": "apache-2.0",
"size": 2428
} | [
"android.graphics.Color",
"android.view.LayoutInflater",
"android.view.View",
"android.view.ViewGroup",
"android.widget.ImageView",
"android.widget.TextView",
"com.soctec.soctec.utils.FileHandler"
] | import android.graphics.Color; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.soctec.soctec.utils.FileHandler; | import android.graphics.*; import android.view.*; import android.widget.*; import com.soctec.soctec.utils.*; | [
"android.graphics",
"android.view",
"android.widget",
"com.soctec.soctec"
] | android.graphics; android.view; android.widget; com.soctec.soctec; | 567,031 |
public void generateExpression(ExpressionClassBuilder acb,
MethodBuilder mb)
throws StandardException
{
if (this instanceof BinaryRelationalOperatorNode)
{
InListOperatorNode ilon =
((BinaryRelationalOperatorNode)this).getInListOp();
if (ilon != null)
{
ilon.generateExpression(acb, mb);
return;
}
}
String resultTypeName;
String receiverType;
// If we're dealing with XMLEXISTS or XMLQUERY, there is some
// additional work to be done.
boolean xmlGen =
(operatorType == XMLQUERY_OP) || (operatorType == XMLEXISTS_OP);
if (xmlGen) {
// We create an execution-time object so that we can retrieve
// saved objects (esp. our compiled query expression) from
// the activation. We do this for two reasons: 1) this level
// of indirection allows us to separate the XML data type
// from the required XML implementation classes (esp. JAXP
// and Xalan classes)--for more on how this works, see the
// comments in SqlXmlUtil.java; and 2) we can take
// the XML query expression, which we've already compiled,
// and pass it to the execution-time object for each row,
// which means that we only have to compile the query
// expression once per SQL statement (instead of once per
// row); see SqlXmlExecutor.java for more.
mb.pushNewStart(
"com.pivotal.gemfirexd.internal.impl.sql.execute.SqlXmlExecutor");
mb.pushNewComplete(addXmlOpMethodParams(acb, mb));
}
if (leftOperand.getTypeId().typePrecedence() >
rightOperand.getTypeId().typePrecedence())
{
receiver = leftOperand;
receiverType = (operatorType == -1)
? getReceiverInterfaceName()
: leftInterfaceType;
leftOperand.generateExpression(acb, mb);
mb.cast(receiverType); // cast the method instance
// stack: left
mb.dup();
mb.cast(leftInterfaceType);
// stack: left, left
rightOperand.generateExpression(acb, mb);
mb.cast(rightInterfaceType); // second arg with cast
// stack: left, left, right
}
else
{
receiver = rightOperand;
receiverType = (operatorType == -1)
? getReceiverInterfaceName()
: rightInterfaceType;
rightOperand.generateExpression(acb, mb);
mb.cast(receiverType); // cast the method instance
// stack: right
if (!xmlGen) {
mb.dup();
mb.cast(rightInterfaceType);
// stack: right,right
}
leftOperand.generateExpression(acb, mb);
mb.cast(leftInterfaceType); // second arg with cast
// stack: right,right,left
mb.swap();
// stack: right,left,right
}
resultTypeName = (operatorType == -1)
? getTypeCompiler().interfaceName()
: resultInterfaceType;
// Boolean return types don't need a result field
boolean needField = !getTypeId().isBooleanTypeId();
if (needField) {
LocalField resultField =
acb.newFieldDeclaration(Modifier.PRIVATE, resultTypeName);
mb.getField(resultField); // third arg
//following method is special code for concatenation where if field is null, we want it to be initialized to NULL SQLxxx type object
//before generating code "field = method(p1, p2, field);"
initializeResultField(acb, mb, resultField);
int jdbcType;
if(isForAVG()) {
String typeName = this.leftOperand.getTypeId().getSQLTypeName();
int scale ;
if ( typeName.equals(TypeId.TINYINT_NAME)
|| typeName.equals(TypeId.SMALLINT_NAME)
|| typeName.equals(TypeId.INTEGER_NAME)
|| typeName.equals(TypeId.LONGINT_NAME)) {
scale = 0;
} else if ( typeName.equals(TypeId.REAL_NAME)
|| typeName.equals(TypeId.DOUBLE_NAME)) {
scale = TypeId.DECIMAL_SCALE;
} else {
// DECIMAL
//scale = ((NumberDataValue) value).getDecimalValueScale();
//if (scale < NumberDataValue.MIN_DECIMAL_DIVIDE_SCALE)
scale = NumberDataValue.MIN_DECIMAL_DIVIDE_SCALE;
}
mb.push(getTypeServices().getScale()); // 4th arg
mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 4);
} else {
if ((getTypeServices() != null) &&
((jdbcType = getTypeServices().getJDBCTypeId()) == java.sql.Types.DECIMAL ||
jdbcType == java.sql.Types.NUMERIC) &&
operator.equals("/"))
{
mb.push(getTypeServices().getScale()); // 4th arg
mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 4);
}
else if (xmlGen) {
// This is for an XMLQUERY operation, so invoke the method
// on our execution-time object.
mb.callMethod(VMOpcode.INVOKEVIRTUAL, null,
methodName, resultTypeName, 3);
}
else
mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 3);
}
//the need for following if was realized while fixing bug 5704 where decimal*decimal was resulting an overflow value but we were not detecting it
if (getTypeId().variableLength())//since result type is numeric variable length, generate setWidth code.
{
if (getTypeId().isNumericTypeId())
{
// to leave the DataValueDescriptor value on the stack, since setWidth is void
mb.dup();
mb.push(getTypeServices().getPrecision());
mb.push(getTypeServices().getScale());
mb.push(true);
mb.callMethod(VMOpcode.INVOKEINTERFACE, ClassName.VariableSizeDataValue, "setWidth", "void", 3);
}
}
mb.putField(resultField);
} else {
if (xmlGen) {
// This is for an XMLEXISTS operation, so invoke the method
// on our execution-time object.
mb.callMethod(VMOpcode.INVOKEVIRTUAL, null,
methodName, resultTypeName, 2);
}
else {
mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType,
methodName, resultTypeName, 2);
}
}
} | void function(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException { if (this instanceof BinaryRelationalOperatorNode) { InListOperatorNode ilon = ((BinaryRelationalOperatorNode)this).getInListOp(); if (ilon != null) { ilon.generateExpression(acb, mb); return; } } String resultTypeName; String receiverType; boolean xmlGen = (operatorType == XMLQUERY_OP) (operatorType == XMLEXISTS_OP); if (xmlGen) { mb.pushNewStart( STR); mb.pushNewComplete(addXmlOpMethodParams(acb, mb)); } if (leftOperand.getTypeId().typePrecedence() > rightOperand.getTypeId().typePrecedence()) { receiver = leftOperand; receiverType = (operatorType == -1) ? getReceiverInterfaceName() : leftInterfaceType; leftOperand.generateExpression(acb, mb); mb.cast(receiverType); mb.dup(); mb.cast(leftInterfaceType); rightOperand.generateExpression(acb, mb); mb.cast(rightInterfaceType); } else { receiver = rightOperand; receiverType = (operatorType == -1) ? getReceiverInterfaceName() : rightInterfaceType; rightOperand.generateExpression(acb, mb); mb.cast(receiverType); if (!xmlGen) { mb.dup(); mb.cast(rightInterfaceType); } leftOperand.generateExpression(acb, mb); mb.cast(leftInterfaceType); mb.swap(); } resultTypeName = (operatorType == -1) ? getTypeCompiler().interfaceName() : resultInterfaceType; boolean needField = !getTypeId().isBooleanTypeId(); if (needField) { LocalField resultField = acb.newFieldDeclaration(Modifier.PRIVATE, resultTypeName); mb.getField(resultField); initializeResultField(acb, mb, resultField); int jdbcType; if(isForAVG()) { String typeName = this.leftOperand.getTypeId().getSQLTypeName(); int scale ; if ( typeName.equals(TypeId.TINYINT_NAME) typeName.equals(TypeId.SMALLINT_NAME) typeName.equals(TypeId.INTEGER_NAME) typeName.equals(TypeId.LONGINT_NAME)) { scale = 0; } else if ( typeName.equals(TypeId.REAL_NAME) typeName.equals(TypeId.DOUBLE_NAME)) { scale = TypeId.DECIMAL_SCALE; } else { scale = NumberDataValue.MIN_DECIMAL_DIVIDE_SCALE; } mb.push(getTypeServices().getScale()); mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 4); } else { if ((getTypeServices() != null) && ((jdbcType = getTypeServices().getJDBCTypeId()) == java.sql.Types.DECIMAL jdbcType == java.sql.Types.NUMERIC) && operator.equals("/")) { mb.push(getTypeServices().getScale()); mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 4); } else if (xmlGen) { mb.callMethod(VMOpcode.INVOKEVIRTUAL, null, methodName, resultTypeName, 3); } else mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 3); } if (getTypeId().variableLength()) { if (getTypeId().isNumericTypeId()) { mb.dup(); mb.push(getTypeServices().getPrecision()); mb.push(getTypeServices().getScale()); mb.push(true); mb.callMethod(VMOpcode.INVOKEINTERFACE, ClassName.VariableSizeDataValue, STR, "void", 3); } } mb.putField(resultField); } else { if (xmlGen) { mb.callMethod(VMOpcode.INVOKEVIRTUAL, null, methodName, resultTypeName, 2); } else { mb.callMethod(VMOpcode.INVOKEINTERFACE, receiverType, methodName, resultTypeName, 2); } } } | /**
* Do code generation for this binary operator.
*
* @param acb The ExpressionClassBuilder for the class we're generating
* @param mb The method the code to place the code
*
*
* @exception StandardException Thrown on error
*/ | Do code generation for this binary operator | generateExpression | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/BinaryOperatorNode.java",
"license": "apache-2.0",
"size": 33353
} | [
"com.pivotal.gemfirexd.internal.iapi.error.StandardException",
"com.pivotal.gemfirexd.internal.iapi.reference.ClassName",
"com.pivotal.gemfirexd.internal.iapi.services.classfile.VMOpcode",
"com.pivotal.gemfirexd.internal.iapi.services.compiler.LocalField",
"com.pivotal.gemfirexd.internal.iapi.services.compiler.MethodBuilder",
"com.pivotal.gemfirexd.internal.iapi.types.NumberDataValue",
"com.pivotal.gemfirexd.internal.iapi.types.TypeId",
"com.pivotal.gemfirexd.internal.impl.sql.compile.ExpressionClassBuilder",
"java.lang.reflect.Modifier",
"java.sql.Types"
] | import com.pivotal.gemfirexd.internal.iapi.error.StandardException; import com.pivotal.gemfirexd.internal.iapi.reference.ClassName; import com.pivotal.gemfirexd.internal.iapi.services.classfile.VMOpcode; import com.pivotal.gemfirexd.internal.iapi.services.compiler.LocalField; import com.pivotal.gemfirexd.internal.iapi.services.compiler.MethodBuilder; import com.pivotal.gemfirexd.internal.iapi.types.NumberDataValue; import com.pivotal.gemfirexd.internal.iapi.types.TypeId; import com.pivotal.gemfirexd.internal.impl.sql.compile.ExpressionClassBuilder; import java.lang.reflect.Modifier; import java.sql.Types; | import com.pivotal.gemfirexd.internal.iapi.error.*; import com.pivotal.gemfirexd.internal.iapi.reference.*; import com.pivotal.gemfirexd.internal.iapi.services.classfile.*; import com.pivotal.gemfirexd.internal.iapi.services.compiler.*; import com.pivotal.gemfirexd.internal.iapi.types.*; import com.pivotal.gemfirexd.internal.impl.sql.compile.*; import java.lang.reflect.*; import java.sql.*; | [
"com.pivotal.gemfirexd",
"java.lang",
"java.sql"
] | com.pivotal.gemfirexd; java.lang; java.sql; | 1,563,112 |
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if (action.equals(DELETE)) {
deleteArgument();
} else if (action.equals(ADD)) {
addArgument();
}
} | void function(ActionEvent e) { String action = e.getActionCommand(); if (action.equals(DELETE)) { deleteArgument(); } else if (action.equals(ADD)) { addArgument(); } } | /**
* Invoked when an action occurs. This implementation supports the add and
* delete buttons.
*
* @param e
* the event that has occurred
*/ | Invoked when an action occurs. This implementation supports the add and delete buttons | actionPerformed | {
"repo_name": "thomsonreuters/jmeter",
"path": "src/protocol/ldap/org/apache/jmeter/protocol/ldap/config/gui/LDAPArgumentsPanel.java",
"license": "apache-2.0",
"size": 12686
} | [
"java.awt.event.ActionEvent"
] | import java.awt.event.ActionEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 969,018 |
public Set<InspireLanguageISO6392B> getSupportedLanguages() {
if (supportedLanguages.size() != Configurator.getInstance().getCache().getSupportedLanguages().size()) {
updateSupportedLanguages();
}
return supportedLanguages;
} | Set<InspireLanguageISO6392B> function() { if (supportedLanguages.size() != Configurator.getInstance().getCache().getSupportedLanguages().size()) { updateSupportedLanguages(); } return supportedLanguages; } | /**
* Get the supported languages
*
* @return the supporte languages
*/ | Get the supported languages | getSupportedLanguages | {
"repo_name": "impulze/SOS",
"path": "extensions/inspire/code/src/main/java/org/n52/sos/inspire/InspireHelper.java",
"license": "gpl-2.0",
"size": 9391
} | [
"java.util.Set",
"org.n52.sos.service.Configurator"
] | import java.util.Set; import org.n52.sos.service.Configurator; | import java.util.*; import org.n52.sos.service.*; | [
"java.util",
"org.n52.sos"
] | java.util; org.n52.sos; | 2,075,336 |
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == this)
{
Date dateTarget = this.getTargetDate();
JCalendarPopup popup = JCalendarPopup.createCalendarPopup(this.getDateParam(), dateTarget, this, m_strLanguage);
popup.addPropertyChangeListener(this);
}
} | void function(ActionEvent e) { if (e.getSource() == this) { Date dateTarget = this.getTargetDate(); JCalendarPopup popup = JCalendarPopup.createCalendarPopup(this.getDateParam(), dateTarget, this, m_strLanguage); popup.addPropertyChangeListener(this); } } | /**
* The user pressed the button, display the JCalendarPopup.
* @param e The ActionEvent.
*/ | The user pressed the button, display the JCalendarPopup | actionPerformed | {
"repo_name": "kralisch/jams",
"path": "JAMScommon/src/jams/gui/input/JCalendarButton.java",
"license": "lgpl-3.0",
"size": 4898
} | [
"java.awt.event.ActionEvent",
"java.util.Date"
] | import java.awt.event.ActionEvent; import java.util.Date; | import java.awt.event.*; import java.util.*; | [
"java.awt",
"java.util"
] | java.awt; java.util; | 2,203,280 |
public CallSite createConstructorSite(CallSite site, Object[] args) {
if (!(this instanceof AdaptingMetaClass)) {
Class[] params = MetaClassHelper.convertToTypeArray(args);
CachedConstructor constructor = (CachedConstructor) chooseMethod("<init>", constructors, params);
if (constructor != null) {
return ConstructorSite.createConstructorSite(site, this,constructor,params, args);
}
else {
if (args.length == 1 && args[0] instanceof Map) {
constructor = (CachedConstructor) chooseMethod("<init>", constructors, MetaClassHelper.EMPTY_TYPE_ARRAY);
if (constructor != null) {
return new ConstructorSite.NoParamSite(site, this,constructor,params);
}
} else if (args.length == 2 && theClass.getEnclosingClass() != null && args[1] instanceof Map) {
Class enclosingClass = theClass.getEnclosingClass();
String enclosingInstanceParamType = args[0] != null ? args[0].getClass().getName() : "";
if(enclosingClass.getName().equals(enclosingInstanceParamType)) {
constructor = (CachedConstructor) chooseMethod("<init>", constructors, new Class[]{enclosingClass});
if (constructor != null) {
return new ConstructorSite.NoParamSiteInnerClass(site, this,constructor,params);
}
}
}
}
}
return new MetaClassConstructorSite(site, this);
} | CallSite function(CallSite site, Object[] args) { if (!(this instanceof AdaptingMetaClass)) { Class[] params = MetaClassHelper.convertToTypeArray(args); CachedConstructor constructor = (CachedConstructor) chooseMethod(STR, constructors, params); if (constructor != null) { return ConstructorSite.createConstructorSite(site, this,constructor,params, args); } else { if (args.length == 1 && args[0] instanceof Map) { constructor = (CachedConstructor) chooseMethod(STR, constructors, MetaClassHelper.EMPTY_TYPE_ARRAY); if (constructor != null) { return new ConstructorSite.NoParamSite(site, this,constructor,params); } } else if (args.length == 2 && theClass.getEnclosingClass() != null && args[1] instanceof Map) { Class enclosingClass = theClass.getEnclosingClass(); String enclosingInstanceParamType = args[0] != null ? args[0].getClass().getName() : ""; if(enclosingClass.getName().equals(enclosingInstanceParamType)) { constructor = (CachedConstructor) chooseMethod(STR, constructors, new Class[]{enclosingClass}); if (constructor != null) { return new ConstructorSite.NoParamSiteInnerClass(site, this,constructor,params); } } } } } return new MetaClassConstructorSite(site, this); } | /**
* Create a CallSite
*/ | Create a CallSite | createConstructorSite | {
"repo_name": "jwagenleitner/incubator-groovy",
"path": "src/main/groovy/groovy/lang/MetaClassImpl.java",
"license": "apache-2.0",
"size": 173564
} | [
"java.util.Map",
"org.codehaus.groovy.reflection.CachedConstructor",
"org.codehaus.groovy.runtime.MetaClassHelper",
"org.codehaus.groovy.runtime.callsite.CallSite",
"org.codehaus.groovy.runtime.callsite.ConstructorSite",
"org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite"
] | import java.util.Map; import org.codehaus.groovy.reflection.CachedConstructor; import org.codehaus.groovy.runtime.MetaClassHelper; import org.codehaus.groovy.runtime.callsite.CallSite; import org.codehaus.groovy.runtime.callsite.ConstructorSite; import org.codehaus.groovy.runtime.callsite.MetaClassConstructorSite; | import java.util.*; import org.codehaus.groovy.reflection.*; import org.codehaus.groovy.runtime.*; import org.codehaus.groovy.runtime.callsite.*; | [
"java.util",
"org.codehaus.groovy"
] | java.util; org.codehaus.groovy; | 1,897,831 |
private MetricField convertToSketchEstimateIfNeeded(MetricField originalSourceMetric) {
return originalSourceMetric instanceof SketchAggregation ?
getSketchConverter().asSketchEstimate((SketchAggregation) originalSourceMetric) :
originalSourceMetric;
} | MetricField function(MetricField originalSourceMetric) { return originalSourceMetric instanceof SketchAggregation ? getSketchConverter().asSketchEstimate((SketchAggregation) originalSourceMetric) : originalSourceMetric; } | /**
* If the aggregation being averaged is a sketch, the inner query must convert it to a numerical type so that it
* can be summed.
*
* @param originalSourceMetric The metric being target for sums
*
* @return Either the original MetricField, or a new SketchEstimate post aggregation
*/ | If the aggregation being averaged is a sketch, the inner query must convert it to a numerical type so that it can be summed | convertToSketchEstimateIfNeeded | {
"repo_name": "yahoo/fili",
"path": "fili-core/src/main/java/com/yahoo/bard/webservice/data/config/metric/makers/AggregationAverageMaker.java",
"license": "apache-2.0",
"size": 11709
} | [
"com.yahoo.bard.webservice.druid.model.MetricField",
"com.yahoo.bard.webservice.druid.model.aggregation.SketchAggregation",
"com.yahoo.bard.webservice.druid.util.FieldConverterSupplier"
] | import com.yahoo.bard.webservice.druid.model.MetricField; import com.yahoo.bard.webservice.druid.model.aggregation.SketchAggregation; import com.yahoo.bard.webservice.druid.util.FieldConverterSupplier; | import com.yahoo.bard.webservice.druid.model.*; import com.yahoo.bard.webservice.druid.model.aggregation.*; import com.yahoo.bard.webservice.druid.util.*; | [
"com.yahoo.bard"
] | com.yahoo.bard; | 696,570 |
void setInet(InetAddress inet) {
this.inet = inet;
}
| void setInet(InetAddress inet) { this.inet = inet; } | /**
* [Package Private] Set the InetAddress of the remote client of
* this request.
*
* @param inet The new InetAddress
*/ | [Package Private] Set the InetAddress of the remote client of this request | setInet | {
"repo_name": "c-rainstorm/jerrydog",
"path": "src/main/java/org/apache/catalina/connector/http/HttpRequestImpl.java",
"license": "gpl-3.0",
"size": 8893
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 2,207,756 |
private final void mapActionStatusToTotalTargetCountStatus(
final List<TotalTargetCountActionStatus> targetCountActionStatus) {
if (targetCountActionStatus == null) {
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount);
return;
}
statusTotalCountMap.put(Status.RUNNING, 0L);
Long notStartedTargetCount = totalTargetCount;
for (final TotalTargetCountActionStatus item : targetCountActionStatus) {
convertStatus(item);
notStartedTargetCount -= item.getCount();
}
statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount);
} | final void function( final List<TotalTargetCountActionStatus> targetCountActionStatus) { if (targetCountActionStatus == null) { statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, totalTargetCount); return; } statusTotalCountMap.put(Status.RUNNING, 0L); Long notStartedTargetCount = totalTargetCount; for (final TotalTargetCountActionStatus item : targetCountActionStatus) { convertStatus(item); notStartedTargetCount -= item.getCount(); } statusTotalCountMap.put(TotalTargetCountStatus.Status.NOTSTARTED, notStartedTargetCount); } | /**
* Populate all target status to a the given map
*
* @param statusTotalCountMap
* the map
* @param rolloutStatusCountItems
* all target {@link Status} with total count
*/ | Populate all target status to a the given map | mapActionStatusToTotalTargetCountStatus | {
"repo_name": "stormc/hawkbit",
"path": "hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/model/TotalTargetCountStatus.java",
"license": "epl-1.0",
"size": 5024
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,672,426 |
public void setEntityState(Entity entityIn, byte state)
{
this.getEntityTracker().sendToTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state));
} | void function(Entity entityIn, byte state) { this.getEntityTracker().sendToTrackingAndSelf(entityIn, new SPacketEntityStatus(entityIn, state)); } | /**
* sends a Packet 38 (Entity Status) to all tracked players of that entity
*/ | sends a Packet 38 (Entity Status) to all tracked players of that entity | setEntityState | {
"repo_name": "danielyc/test-1.9.4",
"path": "build/tmp/recompileMc/sources/net/minecraft/world/WorldServer.java",
"license": "gpl-3.0",
"size": 54443
} | [
"net.minecraft.entity.Entity",
"net.minecraft.network.play.server.SPacketEntityStatus"
] | import net.minecraft.entity.Entity; import net.minecraft.network.play.server.SPacketEntityStatus; | import net.minecraft.entity.*; import net.minecraft.network.play.server.*; | [
"net.minecraft.entity",
"net.minecraft.network"
] | net.minecraft.entity; net.minecraft.network; | 2,563,676 |
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorToSectionWithinRange(
String feedbackSessionName, String courseId, String userEmail, String section, int range)
throws EntityDoesNotExistException {
CourseRoster roster = new CourseRoster(
studentsLogic.getStudentsForCourse(courseId),
instructorsLogic.getInstructorsForCourse(courseId));
Map<String, String> params = new HashMap<>();
params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true");
params.put(PARAM_IN_SECTION, "false");
params.put(PARAM_FROM_SECTION, "false");
params.put(PARAM_TO_SECTION, "true");
params.put(PARAM_SECTION, section);
if (range > 0) {
params.put(PARAM_RANGE, String.valueOf(range));
}
return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail,
UserRole.INSTRUCTOR, roster, params);
} | FeedbackSessionResultsBundle function( String feedbackSessionName, String courseId, String userEmail, String section, int range) throws EntityDoesNotExistException { CourseRoster roster = new CourseRoster( studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId)); Map<String, String> params = new HashMap<>(); params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true"); params.put(PARAM_IN_SECTION, "false"); params.put(PARAM_FROM_SECTION, "false"); params.put(PARAM_TO_SECTION, "true"); params.put(PARAM_SECTION, section); if (range > 0) { params.put(PARAM_RANGE, String.valueOf(range)); } return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params); } | /**
* Gets results of a feedback session to show to an instructor in a section in an indicated range.
*/ | Gets results of a feedback session to show to an instructor in a section in an indicated range | getFeedbackSessionResultsForInstructorToSectionWithinRange | {
"repo_name": "shivanshsoni/teammates",
"path": "src/main/java/teammates/logic/core/FeedbackSessionsLogic.java",
"license": "gpl-2.0",
"size": 114711
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 172,848 |
void applyExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color,
int outlineColor, int thickness) {
applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, true,
thickness);
} | void applyExpensiveOutlineWithBlur(Bitmap srcDst, Canvas srcDstCanvas, int color, int outlineColor, int thickness) { applyExpensiveOutlineWithBlur(srcDst, srcDstCanvas, color, outlineColor, true, thickness); } | /**
* Applies a more expensive and accurate outline to whatever is currently drawn in a specified
* bitmap.
*/ | Applies a more expensive and accurate outline to whatever is currently drawn in a specified bitmap | applyExpensiveOutlineWithBlur | {
"repo_name": "craigacgomez/flaming_monkey_packages_apps_Launcher2",
"path": "src/com/android/launcher2/HolographicOutlineHelper.java",
"license": "apache-2.0",
"size": 9214
} | [
"android.graphics.Bitmap",
"android.graphics.Canvas"
] | import android.graphics.Bitmap; import android.graphics.Canvas; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,597,619 |
public boolean shouldExecute()
{
if (!this.theDefendingTameable.isTamed())
{
return false;
}
else
{
EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner();
if (entitylivingbase == null)
{
return false;
}
else
{
this.theOwnerAttacker = entitylivingbase.getAITarget();
int i = entitylivingbase.getRevengeTimer();
return i != this.timestamp && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.shouldAttackEntity(this.theOwnerAttacker, entitylivingbase);
}
}
}
| boolean function() { if (!this.theDefendingTameable.isTamed()) { return false; } else { EntityLivingBase entitylivingbase = this.theDefendingTameable.getOwner(); if (entitylivingbase == null) { return false; } else { this.theOwnerAttacker = entitylivingbase.getAITarget(); int i = entitylivingbase.getRevengeTimer(); return i != this.timestamp && this.isSuitableTarget(this.theOwnerAttacker, false) && this.theDefendingTameable.shouldAttackEntity(this.theOwnerAttacker, entitylivingbase); } } } | /**
* Returns whether the EntityAIBase should begin execution.
*/ | Returns whether the EntityAIBase should begin execution | shouldExecute | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/entity/ai/EntityAIOwnerHurtByTarget.java",
"license": "mpl-2.0",
"size": 1832
} | [
"net.minecraft.entity.EntityLivingBase"
] | import net.minecraft.entity.EntityLivingBase; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 1,731,687 |
VariableInstance getVariableInstance(String executionId, String variableName); | VariableInstance getVariableInstance(String executionId, String variableName); | /**
* The variable. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given
* name or when the value is set to null.
*
* @param executionId
* id of execution, cannot be null.
* @param variableName
* name of variable, cannot be null.
* @return the variable or null if the variable is undefined.
* @throws FlowableObjectNotFoundException
* when no execution is found for the given executionId.
*/ | The variable. Searching for the variable is done in all scopes that are visible to the given execution (including parent scopes). Returns null when no variable value is found with the given name or when the value is set to null | getVariableInstance | {
"repo_name": "paulstapleton/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/RuntimeService.java",
"license": "apache-2.0",
"size": 63251
} | [
"org.flowable.variable.api.persistence.entity.VariableInstance"
] | import org.flowable.variable.api.persistence.entity.VariableInstance; | import org.flowable.variable.api.persistence.entity.*; | [
"org.flowable.variable"
] | org.flowable.variable; | 177,240 |
public Object getObjectInstance(Object obj, Name name, Context nameCtx,
Hashtable environment)
throws Exception {
// We only know how to deal with <code>javax.naming.Reference</code>s
// that specify a class name of "org.apache.catalina.UserDatabase"
if ((obj == null) || !(obj instanceof Reference)) {
return (null);
}
Reference ref = (Reference) obj;
if (!"org.apache.catalina.UserDatabase".equals(ref.getClassName())) {
return (null);
}
// Create and configure a MemoryUserDatabase instance based on the
// RefAddr values associated with this Reference
MemoryUserDatabase database = new MemoryUserDatabase(name.toString());
RefAddr ra = null;
ra = ref.get("pathname");
if (ra != null) {
database.setPathname(ra.getContent().toString());
}
// Return the configured database instance
database.open();
database.save();
return (database);
} | Object function(Object obj, Name name, Context nameCtx, Hashtable environment) throws Exception { if ((obj == null) !(obj instanceof Reference)) { return (null); } Reference ref = (Reference) obj; if (!STR.equals(ref.getClassName())) { return (null); } MemoryUserDatabase database = new MemoryUserDatabase(name.toString()); RefAddr ra = null; ra = ref.get(STR); if (ra != null) { database.setPathname(ra.getContent().toString()); } database.open(); database.save(); return (database); } | /**
* <p>Create and return a new <code>MemoryUserDatabase</code> instance
* that has been configured according to the properties of the
* specified <code>Reference</code>. If you instance can be created,
* return <code>null</code> instead.</p>
*
* @param obj The possibly null object containing location or
* reference information that can be used in creating an object
* @param name The name of this object relative to <code>nameCtx</code>
* @param nameCtx The context relative to which the <code>name</code>
* parameter is specified, or <code>null</code> if <code>name</code>
* is relative to the default initial context
* @param environment The possibly null environment that is used in
* creating this object
*/ | Create and return a new <code>MemoryUserDatabase</code> instance that has been configured according to the properties of the specified <code>Reference</code>. If you instance can be created, return <code>null</code> instead | getObjectInstance | {
"repo_name": "NorthFacing/step-by-Java",
"path": "fra-tomcat/fra-tomcat-analysis/source/book01/HowTomcatWorks/src/org/apache/catalina/users/MemoryUserDatabaseFactory.java",
"license": "gpl-2.0",
"size": 5988
} | [
"java.util.Hashtable",
"javax.naming.Context",
"javax.naming.Name",
"javax.naming.RefAddr",
"javax.naming.Reference"
] | import java.util.Hashtable; import javax.naming.Context; import javax.naming.Name; import javax.naming.RefAddr; import javax.naming.Reference; | import java.util.*; import javax.naming.*; | [
"java.util",
"javax.naming"
] | java.util; javax.naming; | 755,276 |
@Override
public Response createContactForNamedItemInNamedAuthority(
String parentspecifier,
String itemspecifier,
PoxPayloadOut xmlPayload) {
return getProxy().createContactForNamedItemInNamedAuthority(parentspecifier, itemspecifier,
xmlPayload.getBytes());
} | Response function( String parentspecifier, String itemspecifier, PoxPayloadOut xmlPayload) { return getProxy().createContactForNamedItemInNamedAuthority(parentspecifier, itemspecifier, xmlPayload.getBytes()); } | /**
* Creates the contact.
*
* @param parentspecifier (shortIdentifier)
* @param itemspecifier (shortIdentifier)
* @param multipart
* @return the client response
*/ | Creates the contact | createContactForNamedItemInNamedAuthority | {
"repo_name": "cherryhill/collectionspace-services",
"path": "services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClientImpl.java",
"license": "apache-2.0",
"size": 8924
} | [
"javax.ws.rs.core.Response"
] | import javax.ws.rs.core.Response; | import javax.ws.rs.core.*; | [
"javax.ws"
] | javax.ws; | 2,432,893 |
@Test
public void testExchangedBgpOpenMessages()
throws InterruptedException, TestUtilsException {
// Initiate the connections
peer1.connect(connectToSocket);
peer2.connect(connectToSocket);
peer3.connect(connectToSocket);
//
// Test the fields from the BGP OPEN message:
// BGP version, AS number, BGP ID
//
for (TestBgpPeer peer : peers) {
assertThat(peer.peerFrameDecoder.remoteInfo.bgpVersion(),
is(BgpConstants.BGP_VERSION));
assertThat(peer.peerFrameDecoder.remoteInfo.bgpId(),
is(IP_LOOPBACK_ID));
assertThat(peer.peerFrameDecoder.remoteInfo.asNumber(),
is(TestBgpPeerChannelHandler.PEER_AS));
}
//
// Test that the BgpSession instances have been created
//
assertThat(bgpSessionManager.getMyBgpId(), is(IP_LOOPBACK_ID));
assertThat(bgpSessionManager.getBgpSessions(), hasSize(3));
assertThat(bgpSession1, notNullValue());
assertThat(bgpSession2, notNullValue());
assertThat(bgpSession3, notNullValue());
for (BgpSession bgpSession : bgpSessionManager.getBgpSessions()) {
long sessionAs = bgpSession.localInfo().asNumber();
assertThat(sessionAs, is(TestBgpPeerChannelHandler.PEER_AS));
}
} | void function() throws InterruptedException, TestUtilsException { peer1.connect(connectToSocket); peer2.connect(connectToSocket); peer3.connect(connectToSocket); assertThat(peer.peerFrameDecoder.remoteInfo.bgpVersion(), is(BgpConstants.BGP_VERSION)); assertThat(peer.peerFrameDecoder.remoteInfo.bgpId(), is(IP_LOOPBACK_ID)); assertThat(peer.peerFrameDecoder.remoteInfo.asNumber(), is(TestBgpPeerChannelHandler.PEER_AS)); } assertThat(bgpSessionManager.getBgpSessions(), hasSize(3)); assertThat(bgpSession1, notNullValue()); assertThat(bgpSession2, notNullValue()); assertThat(bgpSession3, notNullValue()); for (BgpSession bgpSession : bgpSessionManager.getBgpSessions()) { long sessionAs = bgpSession.localInfo().asNumber(); assertThat(sessionAs, is(TestBgpPeerChannelHandler.PEER_AS)); } } | /**
* Tests that the BGP OPEN messages have been exchanged, followed by
* KEEPALIVE.
* <p>
* The BGP Peer opens the sessions and transmits OPEN Message, eventually
* followed by KEEPALIVE. The tested BGP listener should respond by
* OPEN Message, followed by KEEPALIVE.
* </p>
*
* @throws TestUtilsException TestUtils error
*/ | Tests that the BGP OPEN messages have been exchanged, followed by KEEPALIVE. The BGP Peer opens the sessions and transmits OPEN Message, eventually followed by KEEPALIVE. The tested BGP listener should respond by OPEN Message, followed by KEEPALIVE. | testExchangedBgpOpenMessages | {
"repo_name": "Shashikanth-Huawei/bmp",
"path": "apps/routing/src/test/java/org/onosproject/routing/bgp/BgpSessionManagerTest.java",
"license": "apache-2.0",
"size": 35424
} | [
"org.hamcrest.Matchers",
"org.junit.Assert",
"org.onlab.junit.TestUtils"
] | import org.hamcrest.Matchers; import org.junit.Assert; import org.onlab.junit.TestUtils; | import org.hamcrest.*; import org.junit.*; import org.onlab.junit.*; | [
"org.hamcrest",
"org.junit",
"org.onlab.junit"
] | org.hamcrest; org.junit; org.onlab.junit; | 1,112,505 |
@SafeVarargs
public final Builder<T> addElements(T element, T... elements) {
TimestampedValue<T> firstElement = TimestampedValue.of(element, currentWatermark);
@SuppressWarnings({"unchecked", "rawtypes"})
TimestampedValue<T>[] remainingElements = new TimestampedValue[elements.length];
for (int i = 0; i < elements.length; i++) {
remainingElements[i] = TimestampedValue.of(elements[i], currentWatermark);
}
return addElements(firstElement, remainingElements);
} | final Builder<T> function(T element, T... elements) { TimestampedValue<T> firstElement = TimestampedValue.of(element, currentWatermark); @SuppressWarnings({STR, STR}) TimestampedValue<T>[] remainingElements = new TimestampedValue[elements.length]; for (int i = 0; i < elements.length; i++) { remainingElements[i] = TimestampedValue.of(elements[i], currentWatermark); } return addElements(firstElement, remainingElements); } | /**
* Adds the specified elements to the source with timestamp equal to the current watermark.
*
* @return A {@link TestStream.Builder} like this one that will add the provided elements after
* all earlier events have completed.
*/ | Adds the specified elements to the source with timestamp equal to the current watermark | addElements | {
"repo_name": "markflyhigh/incubator-beam",
"path": "sdks/java/core/src/main/java/org/apache/beam/sdk/testing/TestStream.java",
"license": "apache-2.0",
"size": 15270
} | [
"org.apache.beam.sdk.values.TimestampedValue"
] | import org.apache.beam.sdk.values.TimestampedValue; | import org.apache.beam.sdk.values.*; | [
"org.apache.beam"
] | org.apache.beam; | 2,386,580 |
ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema,
List<Operation> operations);
| ListenableFuture<List<JsonNode>> transact(DatabaseSchema dbSchema, List<Operation> operations); | /**
* This RPC method causes the database server to execute a series of
* operations in the specified order on a given database.
* @param dbSchema database schema
* @param operations the operations to execute
* @return result the transact result
*/ | This RPC method causes the database server to execute a series of operations in the specified order on a given database | transact | {
"repo_name": "kuangrewawa/OnosFw",
"path": "ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/jsonrpc/OvsdbRPC.java",
"license": "apache-2.0",
"size": 2725
} | [
"com.fasterxml.jackson.databind.JsonNode",
"com.google.common.util.concurrent.ListenableFuture",
"java.util.List",
"org.onosproject.ovsdb.rfc.operations.Operation",
"org.onosproject.ovsdb.rfc.schema.DatabaseSchema"
] | import com.fasterxml.jackson.databind.JsonNode; import com.google.common.util.concurrent.ListenableFuture; import java.util.List; import org.onosproject.ovsdb.rfc.operations.Operation; import org.onosproject.ovsdb.rfc.schema.DatabaseSchema; | import com.fasterxml.jackson.databind.*; import com.google.common.util.concurrent.*; import java.util.*; import org.onosproject.ovsdb.rfc.operations.*; import org.onosproject.ovsdb.rfc.schema.*; | [
"com.fasterxml.jackson",
"com.google.common",
"java.util",
"org.onosproject.ovsdb"
] | com.fasterxml.jackson; com.google.common; java.util; org.onosproject.ovsdb; | 883,970 |
public static String getGCMClientRegistrationId(Context context) {
final SharedPreferences prefs = getSharedPreferences(context);
String registrationId = prefs.getString(ApplicationConstants.PROPERTY_GCM_REG_ID, "");
if (registrationId.isEmpty()) {
Log.i(TAG, "Registration not found.");
return "";
}
// Check if app was updated; if so, it must remove the registration ID
// since the existing regID is not guaranteed to work with the new
// app version.
int registeredVersion = prefs.getInt(ApplicationConstants.PROPERTY_APP_VERSION,
Integer.MIN_VALUE);
int currentVersion = getAppVersion(context);
if (registeredVersion != currentVersion) {
Log.i(TAG, "App version changed.");
return "";
}
return registrationId;
} | static String function(Context context) { final SharedPreferences prefs = getSharedPreferences(context); String registrationId = prefs.getString(ApplicationConstants.PROPERTY_GCM_REG_ID, STRRegistration not found.STRSTRApp version changed.STR"; } return registrationId; } | /**
* This method returns the GCM client registration id stored in shared
* preference. If it doesn't find then it return an empty string.
* @param context
* @return
*/ | This method returns the GCM client registration id stored in shared preference. If it doesn't find then it return an empty string | getGCMClientRegistrationId | {
"repo_name": "ksweta/ETA",
"path": "ETA/src/com/eta/util/ApplicationSharedPreferences.java",
"license": "apache-2.0",
"size": 7352
} | [
"android.content.Context",
"android.content.SharedPreferences"
] | import android.content.Context; import android.content.SharedPreferences; | import android.content.*; | [
"android.content"
] | android.content; | 2,552,668 |
public List<Report> getReports() {
return reports;
} | List<Report> function() { return reports; } | /**
* Gets the reports.
*
* @return the reports
*/ | Gets the reports | getReports | {
"repo_name": "smartsheet-platform/smartsheet-java-sdk",
"path": "src/main/java/com/smartsheet/api/models/Folder.java",
"license": "apache-2.0",
"size": 7147
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,559,575 |
boolean supports(Event event,
Authentication authentication,
RegisteredService registeredService,
HttpServletRequest request); | boolean supports(Event event, Authentication authentication, RegisteredService registeredService, HttpServletRequest request); | /**
* Indicates whether the current active event is supported by
* this mfa provider based on the given authentication and service definition.
* This allows each mfa provider to design bypass rules based on traits
* of the service or authentication, or both.
*
* @param event the event
* @param authentication the authentication
* @param registeredService the registered service
* @param request the request
* @return true if supported
*/ | Indicates whether the current active event is supported by this mfa provider based on the given authentication and service definition. This allows each mfa provider to design bypass rules based on traits of the service or authentication, or both | supports | {
"repo_name": "robertoschwald/cas",
"path": "api/cas-server-core-api-services/src/main/java/org/apereo/cas/services/MultifactorAuthenticationProvider.java",
"license": "apache-2.0",
"size": 2700
} | [
"javax.servlet.http.HttpServletRequest",
"org.apereo.cas.authentication.Authentication",
"org.springframework.webflow.execution.Event"
] | import javax.servlet.http.HttpServletRequest; import org.apereo.cas.authentication.Authentication; import org.springframework.webflow.execution.Event; | import javax.servlet.http.*; import org.apereo.cas.authentication.*; import org.springframework.webflow.execution.*; | [
"javax.servlet",
"org.apereo.cas",
"org.springframework.webflow"
] | javax.servlet; org.apereo.cas; org.springframework.webflow; | 2,293,183 |
protected void setupFromContext(ServletContext context) {
this.context = context;
this.webAppRootDir = context.getRealPath("/");
this.tmpDir = (File) context.getAttribute(Globals.WORK_DIR_ATTR);
} | void function(ServletContext context) { this.context = context; this.webAppRootDir = context.getRealPath("/"); this.tmpDir = (File) context.getAttribute(Globals.WORK_DIR_ATTR); } | /**
* Uses the ServletContext to set some CGI variables
*
* @param context ServletContext for information provided by the
* Servlet API
*/ | Uses the ServletContext to set some CGI variables | setupFromContext | {
"repo_name": "plumer/codana",
"path": "tomcat_files/6.0.0/CGIServlet.java",
"license": "mit",
"size": 71704
} | [
"java.io.File",
"javax.servlet.ServletContext",
"org.apache.catalina.Globals"
] | import java.io.File; import javax.servlet.ServletContext; import org.apache.catalina.Globals; | import java.io.*; import javax.servlet.*; import org.apache.catalina.*; | [
"java.io",
"javax.servlet",
"org.apache.catalina"
] | java.io; javax.servlet; org.apache.catalina; | 2,510,644 |
public String encode() {
StringBuffer retval = new StringBuffer();
ListIterator li = sdpFields.listIterator();
while (li.hasNext()) {
SDPField sdphdr = (SDPField) li.next();
retval.append(sdphdr.encode());
}
return retval.toString();
} | String function() { StringBuffer retval = new StringBuffer(); ListIterator li = sdpFields.listIterator(); while (li.hasNext()) { SDPField sdphdr = (SDPField) li.next(); retval.append(sdphdr.encode()); } return retval.toString(); } | /**
* Encode into a canonical string.
*/ | Encode into a canonical string | encode | {
"repo_name": "mmxuxp/rtsp-proxy",
"path": "src/main/java/gov/nist/javax/sdp/fields/SDPFieldList.java",
"license": "gpl-2.0",
"size": 4796
} | [
"java.util.ListIterator"
] | import java.util.ListIterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,826,028 |
public void loadConfigFromFile(String filename) throws IOException{
if(prop == null)
prop = new Properties();
java.io.File f = new java.io.File(filename);
InputStream in = new java.io.FileInputStream(f);//cotton.Cotton.class.getResourceAsStream(filename);
if(in == null)
throw new IOException("Configuration file not found: "+filename);
else
prop.load(in);
} | void function(String filename) throws IOException{ if(prop == null) prop = new Properties(); java.io.File f = new java.io.File(filename); InputStream in = new java.io.FileInputStream(f); if(in == null) throw new IOException(STR+filename); else prop.load(in); } | /**
* Loads configuration file from filename.
*
* @param filename The name of the file to load
*/ | Loads configuration file from filename | loadConfigFromFile | {
"repo_name": "kahre/Cotton",
"path": "src/cotton/configuration/Configurator.java",
"license": "bsd-3-clause",
"size": 13075
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.Properties"
] | import java.io.IOException; import java.io.InputStream; import java.util.Properties; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,014,598 |
public Ipv6ExpressRouteCircuitPeeringConfig ipv6PeeringConfig() {
return this.ipv6PeeringConfig;
} | Ipv6ExpressRouteCircuitPeeringConfig function() { return this.ipv6PeeringConfig; } | /**
* Get the IPv6 peering configuration.
*
* @return the ipv6PeeringConfig value
*/ | Get the IPv6 peering configuration | ipv6PeeringConfig | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/implementation/ExpressRouteCrossConnectionPeeringInner.java",
"license": "mit",
"size": 11847
} | [
"com.microsoft.azure.management.network.v2019_09_01.Ipv6ExpressRouteCircuitPeeringConfig"
] | import com.microsoft.azure.management.network.v2019_09_01.Ipv6ExpressRouteCircuitPeeringConfig; | import com.microsoft.azure.management.network.v2019_09_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,440,141 |
@SkylarkCallable(name = "bin_dir", structField = true,
doc = "The root corresponding to bin directory.")
public Root getBinDirectory() {
return outputRoots.binDirectory;
} | @SkylarkCallable(name = STR, structField = true, doc = STR) Root function() { return outputRoots.binDirectory; } | /**
* Returns the bin directory for this build configuration.
*/ | Returns the bin directory for this build configuration | getBinDirectory | {
"repo_name": "vt09/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java",
"license": "apache-2.0",
"size": 92111
} | [
"com.google.devtools.build.lib.actions.Root",
"com.google.devtools.build.lib.syntax.SkylarkCallable"
] | import com.google.devtools.build.lib.actions.Root; import com.google.devtools.build.lib.syntax.SkylarkCallable; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.syntax.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,573,037 |
public KeyValueStreamListener<K, V> end() throws IOException {
if (prev != null) {
prev.source(current.source());
end(prev);
}
prev = newObject();
current = newObject();
return this;
} | KeyValueStreamListener<K, V> function() throws IOException { if (prev != null) { prev.source(current.source()); end(prev); } prev = newObject(); current = newObject(); return this; } | /**
* End of values.
*
* @return this value listener
* @throws java.io.IOException
*/ | End of values | end | {
"repo_name": "zuoyebushiwo/elasticsearch-1.5.0",
"path": "src/main/java/org/xbib/elasticsearch/plugin/jdbc/util/PlainKeyValueStreamListener.java",
"license": "apache-2.0",
"size": 12172
} | [
"java.io.IOException",
"org.xbib.elasticsearch.plugin.jdbc.keyvalue.KeyValueStreamListener"
] | import java.io.IOException; import org.xbib.elasticsearch.plugin.jdbc.keyvalue.KeyValueStreamListener; | import java.io.*; import org.xbib.elasticsearch.plugin.jdbc.keyvalue.*; | [
"java.io",
"org.xbib.elasticsearch"
] | java.io; org.xbib.elasticsearch; | 2,008,942 |
@Nonnull
public static GeneReport newReport(@Nonnull GeneCall geneCall) {
return new GeneReport(geneCall.getGene());
} | static GeneReport function(@Nonnull GeneCall geneCall) { return new GeneReport(geneCall.getGene()); } | /**
* Make a specific {@link GeneReport} object based on information found in the GeneCall. Could be a base GeneCall
* or a gene-specific extended GeneReport class
* @param geneCall the {@link GeneCall} object to create a report for
* @return an initialized, unpopulated GeneReport
*/ | Make a specific <code>GeneReport</code> object based on information found in the GeneCall. Could be a base GeneCall or a gene-specific extended GeneReport class | newReport | {
"repo_name": "PharmGKB/PharmCAT",
"path": "src/main/java/org/pharmgkb/pharmcat/reporter/GeneReportFactory.java",
"license": "mpl-2.0",
"size": 1053
} | [
"javax.annotation.Nonnull",
"org.pharmgkb.pharmcat.haplotype.model.GeneCall",
"org.pharmgkb.pharmcat.reporter.model.result.GeneReport"
] | import javax.annotation.Nonnull; import org.pharmgkb.pharmcat.haplotype.model.GeneCall; import org.pharmgkb.pharmcat.reporter.model.result.GeneReport; | import javax.annotation.*; import org.pharmgkb.pharmcat.haplotype.model.*; import org.pharmgkb.pharmcat.reporter.model.result.*; | [
"javax.annotation",
"org.pharmgkb.pharmcat"
] | javax.annotation; org.pharmgkb.pharmcat; | 1,924,498 |
public String getFileName() {
String fileName;
if (name == null) {
fileName = ""; //$NON-NLS-1$
} else {
fileName = name.trim();
if (fileName.length() > 0 && fileName.indexOf('.') == -1) {
fileName = fileName + SdkConstants.DOT_XML;
}
}
return fileName;
} | String function() { String fileName; if (name == null) { fileName = ""; } else { fileName = name.trim(); if (fileName.length() > 0 && fileName.indexOf('.') == -1) { fileName = fileName + SdkConstants.DOT_XML; } } return fileName; } | /**
* Returns the destination filename or an empty string.
*
* @return the filename, never null.
*/ | Returns the destination filename or an empty string | getFileName | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileWizard.java",
"license": "gpl-2.0",
"size": 16847
} | [
"com.android.SdkConstants"
] | import com.android.SdkConstants; | import com.android.*; | [
"com.android"
] | com.android; | 2,244,820 |
public File getSuggestedConfigurationFile()
{
return suggestedConfigFile;
} | File function() { return suggestedConfigFile; } | /**
* Get a suggested configuration file for this mod. It will be of the form <modid>.cfg
* @return A suggested configuration file name for this mod
*/ | Get a suggested configuration file for this mod. It will be of the form <modid>.cfg | getSuggestedConfigurationFile | {
"repo_name": "SuperUnitato/UnLonely",
"path": "build/tmp/recompileMc/sources/net/minecraftforge/fml/common/event/FMLPreInitializationEvent.java",
"license": "lgpl-2.1",
"size": 5985
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 306,902 |
public DistanceUnit unit() {
return this.unit;
} | DistanceUnit function() { return this.unit; } | /**
* Get the radius unit of the circle
*/ | Get the radius unit of the circle | unit | {
"repo_name": "jbertouch/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/common/geo/builders/CircleBuilder.java",
"license": "apache-2.0",
"size": 5632
} | [
"org.elasticsearch.common.unit.DistanceUnit"
] | import org.elasticsearch.common.unit.DistanceUnit; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,038,885 |
public static void main(String[] args)
throws Exception
{
//@@@ get network interface from command line arguments, too?
//@@@ Use ArgsInterpreter and SingleCommandHandlerBase?
int port = 1088; // default for the exercises (RMI default is 1099)
int capacity = 8;
try {
if (args.length > 0)
port = Integer.parseInt(args[0]);
if (args.length > 1)
capacity = Integer.parseInt(args[1]);
} catch (NumberFormatException nfx) {
System.out.println(Catalog.fixEOL(Catalog.USAGE.lookup()));
System.exit(1);
}
// The server name or IP address has to be set as a system property.
// Otherwise, stubs will point to some version of 'localhost' and be
// useless on other machines. Report whether the property is set.
checkForHostnameProperty();
LogConfig.configure(Main.class);
LOGGER.log(Level.INFO, "starting Message Board server");
MixedMessageBoard mmb = new MixedMessageBoardImpl(capacity);
TicketManager tim = new DefaultTicketManager();
RemoteMessageBoardImpl rmbi = new RemoteMessageBoardImpl(mmb, tim);
RemoteTicketIssuerImpl rtii = new RemoteTicketIssuerImpl(tim, true);
RemoteOutletManagerImpl romi = new RemoteOutletManagerImpl(tim);
// These objects will most likely listen on another port than the registry.
// It depends on the RMI implementation whether they share the same port.
Remote rmbistub = UnicastRemoteObject.exportObject(rmbi, 0);
Remote rtiistub = UnicastRemoteObject.exportObject(rtii, 0);
Remote romistub = UnicastRemoteObject.exportObject(romi, 0);
//@@@ NLS light?
System.out.println(rmbistub);
System.out.println(rtiistub);
System.out.println(romistub);
mmb.putSystemMessage(null, Catalog.SYSMSG_OPEN.lookup());
mmb.putSystemMessage(null, Catalog.SYSMSG_CAPACITY_1.format(capacity));
Registry mainreg = createDefaultRegistry(port);
mainreg.bind(RegistryNames.MESSAGE_BOARD.lookupName, rmbi);
mainreg.bind(RegistryNames.TICKET_ISSUER.lookupName, rtii);
mainreg.bind(RemoteOutletManager.REGISTRY_NAME, romi);
// If we just return here, the Java program keeps running. There are
// service threads for the RMI Registry and remotely callable objects.
// So wait a while, then shut down explicitly.
Thread.sleep(3600000); // milliseconds
System.exit(0);
//@@@ shut down gracefully
} | static void function(String[] args) throws Exception { int port = 1088; int capacity = 8; try { if (args.length > 0) port = Integer.parseInt(args[0]); if (args.length > 1) capacity = Integer.parseInt(args[1]); } catch (NumberFormatException nfx) { System.out.println(Catalog.fixEOL(Catalog.USAGE.lookup())); System.exit(1); } checkForHostnameProperty(); LogConfig.configure(Main.class); LOGGER.log(Level.INFO, STR); MixedMessageBoard mmb = new MixedMessageBoardImpl(capacity); TicketManager tim = new DefaultTicketManager(); RemoteMessageBoardImpl rmbi = new RemoteMessageBoardImpl(mmb, tim); RemoteTicketIssuerImpl rtii = new RemoteTicketIssuerImpl(tim, true); RemoteOutletManagerImpl romi = new RemoteOutletManagerImpl(tim); Remote rmbistub = UnicastRemoteObject.exportObject(rmbi, 0); Remote rtiistub = UnicastRemoteObject.exportObject(rtii, 0); Remote romistub = UnicastRemoteObject.exportObject(romi, 0); System.out.println(rmbistub); System.out.println(rtiistub); System.out.println(romistub); mmb.putSystemMessage(null, Catalog.SYSMSG_OPEN.lookup()); mmb.putSystemMessage(null, Catalog.SYSMSG_CAPACITY_1.format(capacity)); Registry mainreg = createDefaultRegistry(port); mainreg.bind(RegistryNames.MESSAGE_BOARD.lookupName, rmbi); mainreg.bind(RegistryNames.TICKET_ISSUER.lookupName, rtii); mainreg.bind(RemoteOutletManager.REGISTRY_NAME, romi); Thread.sleep(3600000); System.exit(0); } | /**
* Main entry point.
*
* @param args the command line arguments
*
* @throws Exception in case of a problem
*/ | Main entry point | main | {
"repo_name": "rolandweber/pityoulish",
"path": "src/main/java/pityoulish/jrmi/server/Main.java",
"license": "cc0-1.0",
"size": 5085
} | [
"java.rmi.Remote",
"java.rmi.registry.Registry",
"java.rmi.server.UnicastRemoteObject",
"java.util.logging.Level"
] | import java.rmi.Remote; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; import java.util.logging.Level; | import java.rmi.*; import java.rmi.registry.*; import java.rmi.server.*; import java.util.logging.*; | [
"java.rmi",
"java.util"
] | java.rmi; java.util; | 2,342,198 |
Set<String> getAttachmentNames(); | Set<String> getAttachmentNames(); | /**
* Returns a set of attachment names of the message
*
* @return a set of attachment names
*/ | Returns a set of attachment names of the message | getAttachmentNames | {
"repo_name": "nikhilvibhav/camel",
"path": "components/camel-attachments/src/main/java/org/apache/camel/attachment/AttachmentMessage.java",
"license": "apache-2.0",
"size": 3304
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,057,899 |
// Get path
URI wsURL = uri();
String path = rawPath(wsURL);
// Get 16 bit nonce and base 64 encode it
byte[] nonce = WebSocketUtil.randomBytes(16);
String key = WebSocketUtil.base64(nonce);
String acceptSeed = key + MAGIC_GUID;
byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII));
expectedChallengeResponseString = WebSocketUtil.base64(sha1);
if (logger.isDebugEnabled()) {
logger.debug(
"WebSocket version 08 client handshake key: {}, expected response: {}",
key, expectedChallengeResponseString);
}
// Format request
FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path);
HttpHeaders headers = request.headers();
headers.add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET)
.add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE)
.add(HttpHeaderNames.SEC_WEBSOCKET_KEY, key)
.add(HttpHeaderNames.HOST, wsURL.getHost());
int wsPort = wsURL.getPort();
String originValue = "http://" + wsURL.getHost();
if (wsPort != 80 && wsPort != 443) {
// if the port is not standard (80/443) its needed to add the port to the header.
// See http://tools.ietf.org/html/rfc6454#section-6.2
originValue = originValue + ':' + wsPort;
}
headers.add(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, originValue);
String expectedSubprotocol = expectedSubprotocol();
if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) {
headers.add(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol);
}
headers.add(HttpHeaderNames.SEC_WEBSOCKET_VERSION, "8");
if (customHeaders != null) {
headers.add(customHeaders);
}
return request;
} | URI wsURL = uri(); String path = rawPath(wsURL); byte[] nonce = WebSocketUtil.randomBytes(16); String key = WebSocketUtil.base64(nonce); String acceptSeed = key + MAGIC_GUID; byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { logger.debug( STR, key, expectedChallengeResponseString); } FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); HttpHeaders headers = request.headers(); headers.add(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET) .add(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE) .add(HttpHeaderNames.SEC_WEBSOCKET_KEY, key) .add(HttpHeaderNames.HOST, wsURL.getHost()); int wsPort = wsURL.getPort(); String originValue = STR8"); if (customHeaders != null) { headers.add(customHeaders); } return request; } | /**
* /**
* <p>
* Sends the opening request to the server:
* </p>
*
* <pre>
* GET /chat HTTP/1.1
* Host: server.example.com
* Upgrade: websocket
* Connection: Upgrade
* Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
* Sec-WebSocket-Origin: http://example.com
* Sec-WebSocket-Protocol: chat, superchat
* Sec-WebSocket-Version: 8
* </pre>
*
*/ | Sends the opening request to the server: <code> GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Origin: HREF Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 8 </code> | newHandshakeRequest | {
"repo_name": "zzcclp/netty",
"path": "codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java",
"license": "apache-2.0",
"size": 9525
} | [
"io.netty.handler.codec.http.DefaultFullHttpRequest",
"io.netty.handler.codec.http.FullHttpRequest",
"io.netty.handler.codec.http.HttpHeaderNames",
"io.netty.handler.codec.http.HttpHeaderValues",
"io.netty.handler.codec.http.HttpHeaders",
"io.netty.handler.codec.http.HttpMethod",
"io.netty.handler.codec.http.HttpVersion",
"io.netty.util.CharsetUtil"
] | import io.netty.handler.codec.http.DefaultFullHttpRequest; import io.netty.handler.codec.http.FullHttpRequest; import io.netty.handler.codec.http.HttpHeaderNames; import io.netty.handler.codec.http.HttpHeaderValues; import io.netty.handler.codec.http.HttpHeaders; import io.netty.handler.codec.http.HttpMethod; import io.netty.handler.codec.http.HttpVersion; import io.netty.util.CharsetUtil; | import io.netty.handler.codec.http.*; import io.netty.util.*; | [
"io.netty.handler",
"io.netty.util"
] | io.netty.handler; io.netty.util; | 1,241,921 |
public static TaskTimer getTimer()
{
return new SimpleTimer(JOBNAME, 10L * 1000);
} | static TaskTimer function() { return new SimpleTimer(JOBNAME, 10L * 1000); } | /**
* Run every 10 Sec
*/ | Run every 10 Sec | getTimer | {
"repo_name": "vinaykumarchella/Priam",
"path": "priam/src/main/java/com/netflix/priam/backup/IncrementalBackup.java",
"license": "apache-2.0",
"size": 9437
} | [
"com.netflix.priam.scheduler.SimpleTimer",
"com.netflix.priam.scheduler.TaskTimer"
] | import com.netflix.priam.scheduler.SimpleTimer; import com.netflix.priam.scheduler.TaskTimer; | import com.netflix.priam.scheduler.*; | [
"com.netflix.priam"
] | com.netflix.priam; | 2,625,947 |
@Test(expected=AccessControlException.class)
public void testInternalModifyAclEntries() throws IOException {
fcView.modifyAclEntries(new Path("/internalDir"),
new ArrayList<AclEntry>());
} | @Test(expected=AccessControlException.class) void function() throws IOException { fcView.modifyAclEntries(new Path(STR), new ArrayList<AclEntry>()); } | /**
* Verify the behavior of ACL operations on paths above the root of
* any mount table entry.
*/ | Verify the behavior of ACL operations on paths above the root of any mount table entry | testInternalModifyAclEntries | {
"repo_name": "ZhangXFeng/hadoop",
"path": "src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/fs/viewfs/ViewFsBaseTest.java",
"license": "apache-2.0",
"size": 31703
} | [
"java.io.IOException",
"java.util.ArrayList",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.fs.permission.AclEntry",
"org.apache.hadoop.security.AccessControlException",
"org.junit.Test"
] | import java.io.IOException; import java.util.ArrayList; import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.permission.AclEntry; import org.apache.hadoop.security.AccessControlException; import org.junit.Test; | import java.io.*; import java.util.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.security.*; import org.junit.*; | [
"java.io",
"java.util",
"org.apache.hadoop",
"org.junit"
] | java.io; java.util; org.apache.hadoop; org.junit; | 558,525 |
public static void createThumbnail(File input, String size, File output) throws RuntimeException {
log.debug("createThumbnail({}, {}, {})", new Object[] { input, size, output });
String params = "-thumbnail " + size + " -background white -flatten ${fileIn} ${fileOut}";
ImageMagickConvert(input, output, params);
} | static void function(File input, String size, File output) throws RuntimeException { log.debug(STR, new Object[] { input, size, output }); String params = STR + size + STR; ImageMagickConvert(input, output, params); } | /**
* Create image thumbnail.
*/ | Create image thumbnail | createThumbnail | {
"repo_name": "codelibs/n2dms",
"path": "src/main/java/com/openkm/util/ImageUtils.java",
"license": "gpl-2.0",
"size": 7644
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,303,905 |
public IDocument getDocument() {
checkState();
return fDocument;
}
| IDocument function() { checkState(); return fDocument; } | /**
* Returns the document with the buffer contents. Whitespace variables are decorated with
* comments.
*
* @return the buffer document
*/ | Returns the document with the buffer contents. Whitespace variables are decorated with comments | getDocument | {
"repo_name": "boniatillo-com/PhaserEditor",
"path": "source/thirdparty/jsdt/org.eclipse.wst.jsdt.ui/src/org/eclipse/wst/jsdt/internal/corext/template/java/JavaFormatter.java",
"license": "epl-1.0",
"size": 12594
} | [
"org.eclipse.jface.text.IDocument"
] | import org.eclipse.jface.text.IDocument; | import org.eclipse.jface.text.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 2,886,259 |
private int chooseLevels(
final RexNode[] exprs,
int conditionOrdinal,
int[] exprLevels,
int[] levelTypeOrdinals) {
final int inputFieldCount = program.getInputRowType().getFieldCount();
int levelCount = 0;
final MaxInputFinder maxInputFinder = new MaxInputFinder(exprLevels);
boolean[] relTypesPossibleForTopLevel = new boolean[relTypes.length];
Arrays.fill(relTypesPossibleForTopLevel, true);
// Compute the order in which to visit expressions.
final List<Set<Integer>> cohorts = getCohorts();
final List<Integer> permutation =
computeTopologicalOrdering(exprs, cohorts);
for (int i : permutation) {
RexNode expr = exprs[i];
final boolean condition = i == conditionOrdinal;
if (i < inputFieldCount) {
assert expr instanceof RexInputRef;
exprLevels[i] = -1;
continue;
}
// Deduce the minimum level of the expression. An expression must
// be at a level greater than or equal to all of its inputs.
int level = maxInputFinder.maxInputFor(expr);
// If the expression is in a cohort, it can occur no lower than the
// levels of other expressions in the same cohort.
Set<Integer> cohort = findCohort(cohorts, i);
if (cohort != null) {
for (Integer exprOrdinal : cohort) {
if (exprOrdinal == i) {
// Already did this member of the cohort. It's a waste
// of effort to repeat.
continue;
}
final RexNode cohortExpr = exprs[exprOrdinal];
int cohortLevel = maxInputFinder.maxInputFor(cohortExpr);
if (cohortLevel > level) {
level = cohortLevel;
}
}
}
// Try to implement this expression at this level.
// If that is not possible, try to implement it at higher levels.
levelLoop:
for (;; ++level) {
if (level >= levelCount) {
// This is a new level. We can use any type we like.
for (int relTypeOrdinal = 0;
relTypeOrdinal < relTypes.length;
relTypeOrdinal++) {
if (!relTypesPossibleForTopLevel[relTypeOrdinal]) {
continue;
}
if (relTypes[relTypeOrdinal].canImplement(
expr,
condition)) {
// Success. We have found a type where we can
// implement this expression.
exprLevels[i] = level;
levelTypeOrdinals[level] = relTypeOrdinal;
assert (level == 0)
|| (levelTypeOrdinals[level - 1]
!= levelTypeOrdinals[level])
: "successive levels of same type";
// Figure out which of the other reltypes are
// still possible for this level.
// Previous reltypes are not possible.
for (int j = 0; j < relTypeOrdinal; ++j) {
relTypesPossibleForTopLevel[j] = false;
}
// Successive reltypes may be possible.
for (int j = relTypeOrdinal + 1;
j < relTypes.length;
++j) {
if (relTypesPossibleForTopLevel[j]) {
relTypesPossibleForTopLevel[j] =
relTypes[j].canImplement(
expr,
condition);
}
}
// Move to next level.
levelTypeOrdinals[levelCount] =
firstSet(relTypesPossibleForTopLevel);
++levelCount;
Arrays.fill(relTypesPossibleForTopLevel, true);
break levelLoop;
}
}
// None of the reltypes still active for this level could
// implement expr. But maybe we could succeed with a new
// level, with all options open?
if (count(relTypesPossibleForTopLevel) >= relTypes.length) {
// Cannot implement for any type.
throw Util.newInternal("cannot implement " + expr);
}
levelTypeOrdinals[levelCount] =
firstSet(relTypesPossibleForTopLevel);
++levelCount;
Arrays.fill(relTypesPossibleForTopLevel, true);
} else {
final int levelTypeOrdinal = levelTypeOrdinals[level];
if (!relTypes[levelTypeOrdinal].canImplement(
expr,
condition)) {
// Cannot implement this expression in this type;
// continue to next level.
continue;
}
exprLevels[i] = level;
break;
}
}
}
if (levelCount > 0) {
// The latest level should be CalcRelType otherwise literals cannot be
// implemented.
assert "CalcRelType".equals(relTypes[0].name)
: "The first RelType should be CalcRelType for proper RexLiteral"
+ " implementation at the last level, got " + relTypes[0].name;
if (levelTypeOrdinals[levelCount - 1] != 0) {
levelCount++;
}
}
return levelCount;
} | int function( final RexNode[] exprs, int conditionOrdinal, int[] exprLevels, int[] levelTypeOrdinals) { final int inputFieldCount = program.getInputRowType().getFieldCount(); int levelCount = 0; final MaxInputFinder maxInputFinder = new MaxInputFinder(exprLevels); boolean[] relTypesPossibleForTopLevel = new boolean[relTypes.length]; Arrays.fill(relTypesPossibleForTopLevel, true); final List<Set<Integer>> cohorts = getCohorts(); final List<Integer> permutation = computeTopologicalOrdering(exprs, cohorts); for (int i : permutation) { RexNode expr = exprs[i]; final boolean condition = i == conditionOrdinal; if (i < inputFieldCount) { assert expr instanceof RexInputRef; exprLevels[i] = -1; continue; } int level = maxInputFinder.maxInputFor(expr); Set<Integer> cohort = findCohort(cohorts, i); if (cohort != null) { for (Integer exprOrdinal : cohort) { if (exprOrdinal == i) { continue; } final RexNode cohortExpr = exprs[exprOrdinal]; int cohortLevel = maxInputFinder.maxInputFor(cohortExpr); if (cohortLevel > level) { level = cohortLevel; } } } levelLoop: for (;; ++level) { if (level >= levelCount) { for (int relTypeOrdinal = 0; relTypeOrdinal < relTypes.length; relTypeOrdinal++) { if (!relTypesPossibleForTopLevel[relTypeOrdinal]) { continue; } if (relTypes[relTypeOrdinal].canImplement( expr, condition)) { exprLevels[i] = level; levelTypeOrdinals[level] = relTypeOrdinal; assert (level == 0) (levelTypeOrdinals[level - 1] != levelTypeOrdinals[level]) : STR; for (int j = 0; j < relTypeOrdinal; ++j) { relTypesPossibleForTopLevel[j] = false; } for (int j = relTypeOrdinal + 1; j < relTypes.length; ++j) { if (relTypesPossibleForTopLevel[j]) { relTypesPossibleForTopLevel[j] = relTypes[j].canImplement( expr, condition); } } levelTypeOrdinals[levelCount] = firstSet(relTypesPossibleForTopLevel); ++levelCount; Arrays.fill(relTypesPossibleForTopLevel, true); break levelLoop; } } if (count(relTypesPossibleForTopLevel) >= relTypes.length) { throw Util.newInternal(STR + expr); } levelTypeOrdinals[levelCount] = firstSet(relTypesPossibleForTopLevel); ++levelCount; Arrays.fill(relTypesPossibleForTopLevel, true); } else { final int levelTypeOrdinal = levelTypeOrdinals[level]; if (!relTypes[levelTypeOrdinal].canImplement( expr, condition)) { continue; } exprLevels[i] = level; break; } } } if (levelCount > 0) { assert STR.equals(relTypes[0].name) : STR + STR + relTypes[0].name; if (levelTypeOrdinals[levelCount - 1] != 0) { levelCount++; } } return levelCount; } | /**
* Figures out which expressions to calculate at which level.
*
* @param exprs Array of expressions
* @param conditionOrdinal Ordinal of the condition expression, or -1 if no
* condition
* @param exprLevels Level ordinal for each expression (output)
* @param levelTypeOrdinals The type of each level (output)
* @return Number of levels required
*/ | Figures out which expressions to calculate at which level | chooseLevels | {
"repo_name": "yeongwei/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/rel/rules/CalcRelSplitter.java",
"license": "apache-2.0",
"size": 33952
} | [
"java.util.Arrays",
"java.util.List",
"java.util.Set",
"org.apache.calcite.rex.RexInputRef",
"org.apache.calcite.rex.RexNode",
"org.apache.calcite.util.Util"
] | import java.util.Arrays; import java.util.List; import java.util.Set; import org.apache.calcite.rex.RexInputRef; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.Util; | import java.util.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*; | [
"java.util",
"org.apache.calcite"
] | java.util; org.apache.calcite; | 852,893 |
public static void main(String[] args) {
AbstractAdaptor.main(new NamedResourceFirehose(), args);
} | static void function(String[] args) { AbstractAdaptor.main(new NamedResourceFirehose(), args); } | /** Call default main for adaptors.
* @param args argv
*/ | Call default main for adaptors | main | {
"repo_name": "googlegsa/library",
"path": "src/com/google/enterprise/adaptor/experimental/NamedResourceFirehose.java",
"license": "apache-2.0",
"size": 10549
} | [
"com.google.enterprise.adaptor.AbstractAdaptor"
] | import com.google.enterprise.adaptor.AbstractAdaptor; | import com.google.enterprise.adaptor.*; | [
"com.google.enterprise"
] | com.google.enterprise; | 2,654,602 |
public void startAttlist(String elementName, Augmentations augs) throws XNIException {
} // startAttlist(String) | void function(String elementName, Augmentations augs) throws XNIException { } | /**
* The start of an attribute list.
*
* @param elementName The name of the element that this attribute
* list is associated with.
* @param augs Additional information that may include infoset
* augmentations.
*
* @throws XNIException Thrown by handler to signal an error.
*/ | The start of an attribute list | startAttlist | {
"repo_name": "BIORIMP/biorimp",
"path": "BIO-RIMP/test_data/code/xerces/src/org/apache/xerces/parsers/AbstractXMLDocumentParser.java",
"license": "gpl-2.0",
"size": 30995
} | [
"org.apache.xerces.xni.Augmentations",
"org.apache.xerces.xni.XNIException"
] | import org.apache.xerces.xni.Augmentations; import org.apache.xerces.xni.XNIException; | import org.apache.xerces.xni.*; | [
"org.apache.xerces"
] | org.apache.xerces; | 288,193 |
@ObjectiveCName("registerApplePushWithApnsId:withToken:")
public void registerApplePush(int apnsId, String token) {
modules.getPushesModule().registerApplePush(apnsId, token);
} | @ObjectiveCName(STR) void function(int apnsId, String token) { modules.getPushesModule().registerApplePush(apnsId, token); } | /**
* Register apple push
*
* @param apnsId internal APNS cert key
* @param token APNS token
*/ | Register apple push | registerApplePush | {
"repo_name": "luoxiaoshenghustedu/actor-platform",
"path": "actor-apps/core/src/main/java/im/actor/core/Messenger.java",
"license": "mit",
"size": 52564
} | [
"com.google.j2objc.annotations.ObjectiveCName"
] | import com.google.j2objc.annotations.ObjectiveCName; | import com.google.j2objc.annotations.*; | [
"com.google.j2objc"
] | com.google.j2objc; | 48,188 |
protected void removeLinkFromStorage(Link lt) {
String id = getLinkId(lt);
storageSourceService.deleteRowAsync(LINK_TABLE_NAME, id);
} | void function(Link lt) { String id = getLinkId(lt); storageSourceService.deleteRowAsync(LINK_TABLE_NAME, id); } | /**
* Removes a link from storage using an asynchronous call.
*
* @param lt
* The LinkTuple to delete.
*/ | Removes a link from storage using an asynchronous call | removeLinkFromStorage | {
"repo_name": "thisthat/floodlight-controller",
"path": "src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java",
"license": "apache-2.0",
"size": 72066
} | [
"net.floodlightcontroller.routing.Link"
] | import net.floodlightcontroller.routing.Link; | import net.floodlightcontroller.routing.*; | [
"net.floodlightcontroller.routing"
] | net.floodlightcontroller.routing; | 1,531,286 |
public Transactions collectorTransactionsGet(String xProgrammeKey, String authorization, TransactionFilter request, String xCallref) throws ApiException {
ApiResponse<Transactions> resp = collectorTransactionsGetWithHttpInfo(xProgrammeKey, authorization, request, xCallref);
return resp.getData();
} | Transactions function(String xProgrammeKey, String authorization, TransactionFilter request, String xCallref) throws ApiException { ApiResponse<Transactions> resp = collectorTransactionsGetWithHttpInfo(xProgrammeKey, authorization, request, xCallref); return resp.getData(); } | /**
*
* Retrieve All Transactions with the specified parameters.
* @param xProgrammeKey This identifies your tenant and programme within OPE. The typical format is `tenantId|programmeId`, for example `team-01|3749203750`. (required)
* @param authorization This is the authorisation token that you receive after logging into the API with your credentials. To login, you need to perform a `POST` call on `/auth/login` with your credentials. (required)
* @param request (required)
* @param xCallref A unique call reference to provide correlation between application and system. This can be generated by your application. (optional)
* @return Transactions
* @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
*/ | Retrieve All Transactions with the specified parameters | collectorTransactionsGet | {
"repo_name": "ixaris/ope-applicationclients",
"path": "java-client/src/main/java/com/ixaris/ope/applications/client/api/CollectorApi.java",
"license": "mit",
"size": 110960
} | [
"com.ixaris.ope.applications.client.ApiException",
"com.ixaris.ope.applications.client.ApiResponse",
"com.ixaris.ope.applications.client.model.TransactionFilter",
"com.ixaris.ope.applications.client.model.Transactions"
] | import com.ixaris.ope.applications.client.ApiException; import com.ixaris.ope.applications.client.ApiResponse; import com.ixaris.ope.applications.client.model.TransactionFilter; import com.ixaris.ope.applications.client.model.Transactions; | import com.ixaris.ope.applications.client.*; import com.ixaris.ope.applications.client.model.*; | [
"com.ixaris.ope"
] | com.ixaris.ope; | 2,078,080 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.