method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
protected AuthnRequest retrieveSamlAuthenticationRequestFromHttpRequest(final HttpServletRequest request,
final HttpServletResponse response) throws Exception {
LOGGER.debug("Retrieving authentication request from scope");
val context = new JEEContext(request, response);
val requestValue = samlProfileHandlerConfigurationContext.getSessionStore()
.get(context, SamlProtocolConstants.PARAMETER_SAML_REQUEST).orElse(StringUtils.EMPTY).toString();
if (StringUtils.isBlank(requestValue)) {
throw new IllegalArgumentException("SAML request could not be determined from the authentication request");
}
val encodedRequest = EncodingUtils.decodeBase64(requestValue.getBytes(StandardCharsets.UTF_8));
return (AuthnRequest) XMLObjectSupport.unmarshallFromInputStream(
samlProfileHandlerConfigurationContext.getOpenSamlConfigBean().getParserPool(),
new ByteArrayInputStream(encodedRequest));
} | AuthnRequest function(final HttpServletRequest request, final HttpServletResponse response) throws Exception { LOGGER.debug(STR); val context = new JEEContext(request, response); val requestValue = samlProfileHandlerConfigurationContext.getSessionStore() .get(context, SamlProtocolConstants.PARAMETER_SAML_REQUEST).orElse(StringUtils.EMPTY).toString(); if (StringUtils.isBlank(requestValue)) { throw new IllegalArgumentException(STR); } val encodedRequest = EncodingUtils.decodeBase64(requestValue.getBytes(StandardCharsets.UTF_8)); return (AuthnRequest) XMLObjectSupport.unmarshallFromInputStream( samlProfileHandlerConfigurationContext.getOpenSamlConfigBean().getParserPool(), new ByteArrayInputStream(encodedRequest)); } | /**
* Retrieve authn request authn request.
*
* @param request the request
* @param response the response
* @return the authn request
* @throws Exception the exception
*/ | Retrieve authn request authn request | retrieveSamlAuthenticationRequestFromHttpRequest | {
"repo_name": "pdrados/cas",
"path": "support/cas-server-support-saml-idp-web/src/main/java/org/apereo/cas/support/saml/web/idp/profile/AbstractSamlIdPProfileHandlerController.java",
"license": "apache-2.0",
"size": 23741
} | [
"java.io.ByteArrayInputStream",
"java.nio.charset.StandardCharsets",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.commons.lang3.StringUtils",
"org.apereo.cas.support.saml.SamlProtocolConstants",
"org.apereo.cas.util.EncodingUtils",
"org.opensaml.core.x... | import java.io.ByteArrayInputStream; import java.nio.charset.StandardCharsets; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.apereo.cas.support.saml.SamlProtocolConstants; import org.apereo.cas.util.EncodingUtils; import org.opensaml.core.xml.util.XMLObjectSupport; import org.opensaml.saml.saml2.core.AuthnRequest; import org.pac4j.core.context.JEEContext; | import java.io.*; import java.nio.charset.*; import javax.servlet.http.*; import org.apache.commons.lang3.*; import org.apereo.cas.support.saml.*; import org.apereo.cas.util.*; import org.opensaml.core.xml.util.*; import org.opensaml.saml.saml2.core.*; import org.pac4j.core.context.*; | [
"java.io",
"java.nio",
"javax.servlet",
"org.apache.commons",
"org.apereo.cas",
"org.opensaml.core",
"org.opensaml.saml",
"org.pac4j.core"
] | java.io; java.nio; javax.servlet; org.apache.commons; org.apereo.cas; org.opensaml.core; org.opensaml.saml; org.pac4j.core; | 2,414,770 |
public void removeSlot(int slot) {
Validate.isTrue(slot >= 0 && slot < slots.length);
slots[slot] = null;
}
| void function(int slot) { Validate.isTrue(slot >= 0 && slot < slots.length); slots[slot] = null; } | /**
* Clears a slot
* @param slot The slot to change.
*/ | Clears a slot | removeSlot | {
"repo_name": "Razz0991/BuildTools",
"path": "src/main/java/au/com/mineauz/buildtools/menu/MenuPageInventory.java",
"license": "lgpl-3.0",
"size": 1654
} | [
"org.apache.commons.lang.Validate"
] | import org.apache.commons.lang.Validate; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,601,510 |
public void restoreHierarchyState(SparseArray<Parcelable> container) {
dispatchRestoreInstanceState(container);
} | void function(SparseArray<Parcelable> container) { dispatchRestoreInstanceState(container); } | /**
* Restore this view hierarchy's frozen state from the given container.
*
* @param container The SparseArray which holds previously frozen states.
*
* @see #saveHierarchyState
* @see #dispatchRestoreInstanceState
* @see #onRestoreInstanceState
*/ | Restore this view hierarchy's frozen state from the given container | restoreHierarchyState | {
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/view/View.java",
"license": "gpl-3.0",
"size": 347830
} | [
"android.os.Parcelable",
"android.util.SparseArray"
] | import android.os.Parcelable; import android.util.SparseArray; | import android.os.*; import android.util.*; | [
"android.os",
"android.util"
] | android.os; android.util; | 251,966 |
private static void setupPropertyEncryption() {
// get/set the current encryption key
Encryptor keyEncryptor = new AesEncryptor();
String encryptedKey = securityProperties.getProperty(ENCRYPTION_KEY_CURRENT);
if (encryptedKey == null || encryptedKey.isEmpty()) {
currentKey = null;
} else {
currentKey = keyEncryptor.decrypt(encryptedKey);
}
// check to see if a new key has been defined
String newKey = securityProperties.getProperty(ENCRYPTION_KEY_NEW, false);
if (newKey != null) {
Log.info("Detected new encryption key; updating encrypted properties");
// if a new key has been provided, check to see if the old key matches
// the current key, otherwise log an error and ignore the new key
String oldKey = securityProperties.getProperty(ENCRYPTION_KEY_OLD);
if (oldKey == null) {
if (currentKey != null) {
Log.warn("Old encryption key was not provided; ignoring new encryption key");
return;
}
} else {
if (!oldKey.equals(currentKey)) {
Log.warn("Old encryption key does not match current encryption key; ignoring new encryption key");
return;
}
}
// load DB properties using the current key
if (properties == null) {
properties = JiveProperties.getInstance();
}
// load XML properties using the current key
Map<String, String> openfireProps = new HashMap<String, String>();
for (String xmlProp : openfireProperties.getAllPropertyNames()) {
if (isPropertyEncrypted(xmlProp)) {
openfireProps.put(xmlProp, openfireProperties.getProperty(xmlProp));
}
}
// rewrite existing encrypted properties using new encryption key
currentKey = newKey == null || newKey.isEmpty() ? null : newKey;
propertyEncryptor = null;
for (String propertyName : securityProperties.getProperties(ENCRYPTED_PROPERTY_NAMES, true)) {
Log.info("Updating encrypted value for " + propertyName);
if (openfireProps.containsKey(propertyName)) {
openfireProperties.setProperty(propertyName, openfireProps.get(propertyName));
} else if (!resetProperty(propertyName)) {
Log.warn("Failed to reset encrypted property value for " + propertyName);
};
}
securityProperties.deleteProperty(ENCRYPTION_KEY_NEW);
securityProperties.deleteProperty(ENCRYPTION_KEY_OLD);
}
// (re)write the encryption key to the security XML file
securityProperties.setProperty(ENCRYPTION_KEY_CURRENT, keyEncryptor.encrypt(currentKey));
} | static void function() { Encryptor keyEncryptor = new AesEncryptor(); String encryptedKey = securityProperties.getProperty(ENCRYPTION_KEY_CURRENT); if (encryptedKey == null encryptedKey.isEmpty()) { currentKey = null; } else { currentKey = keyEncryptor.decrypt(encryptedKey); } String newKey = securityProperties.getProperty(ENCRYPTION_KEY_NEW, false); if (newKey != null) { Log.info(STR); String oldKey = securityProperties.getProperty(ENCRYPTION_KEY_OLD); if (oldKey == null) { if (currentKey != null) { Log.warn(STR); return; } } else { if (!oldKey.equals(currentKey)) { Log.warn(STR); return; } } if (properties == null) { properties = JiveProperties.getInstance(); } Map<String, String> openfireProps = new HashMap<String, String>(); for (String xmlProp : openfireProperties.getAllPropertyNames()) { if (isPropertyEncrypted(xmlProp)) { openfireProps.put(xmlProp, openfireProperties.getProperty(xmlProp)); } } currentKey = newKey == null newKey.isEmpty() ? null : newKey; propertyEncryptor = null; for (String propertyName : securityProperties.getProperties(ENCRYPTED_PROPERTY_NAMES, true)) { Log.info(STR + propertyName); if (openfireProps.containsKey(propertyName)) { openfireProperties.setProperty(propertyName, openfireProps.get(propertyName)); } else if (!resetProperty(propertyName)) { Log.warn(STR + propertyName); }; } securityProperties.deleteProperty(ENCRYPTION_KEY_NEW); securityProperties.deleteProperty(ENCRYPTION_KEY_OLD); } securityProperties.setProperty(ENCRYPTION_KEY_CURRENT, keyEncryptor.encrypt(currentKey)); } | /**
* Setup the property encryption key, rewriting encrypted values as appropriate
*/ | Setup the property encryption key, rewriting encrypted values as appropriate | setupPropertyEncryption | {
"repo_name": "trimnguye/JavaChatServer",
"path": "src/java/org/jivesoftware/util/JiveGlobals.java",
"license": "apache-2.0",
"size": 42411
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 193,701 |
FileItemStream next() throws FileUploadException, IOException; | FileItemStream next() throws FileUploadException, IOException; | /**
* Returns the next available {@link FileItemStream}.
*
* @throws java.util.NoSuchElementException
* No more items are available. Use {@link #hasNext()} to prevent this exception.
* @throws FileUploadException
* Parsing or processing the file item failed.
* @throws IOException
* Reading the file item failed.
* @return FileItemStream instance, which provides access to the next file item.
*/ | Returns the next available <code>FileItemStream</code> | next | {
"repo_name": "Servoy/wicket",
"path": "wicket/src/main/java/org/apache/wicket/util/upload/FileItemIterator.java",
"license": "apache-2.0",
"size": 1927
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 499,770 |
private Map<String, String> findChildProjectDashboards()
{
// Get the DashboardTask for all child projects of this task's project.
Collection<DashboardTask> aChildTasks =
getProject()
.getChildProjects()
.values()
.stream()
.map(p -> Projects.getTask(p, TASK_NAME, DashboardTask.class))
.filter(Objects::nonNull)
.collect(Collectors.toList());
if (aChildTasks.isEmpty())
return Collections.emptyMap();
// Create a map from child project name to dashboard report file path.
Map<String, String> aChildProjectsDashboards = new HashMap<>();
Path aBasePath = Reports.getOutputLocation(getReports().getHtml()).toPath().getParent();
for (DashboardTask aChildTask : aChildTasks)
{
Path aChildReportPath = Reports.getOutputLocation(aChildTask.getReports().getHtml()).toPath();
String aRelativePath = aBasePath.relativize(aChildReportPath).toString();
aChildProjectsDashboards.put(aChildTask.getProject().getName(), aRelativePath);
}
return aChildProjectsDashboards;
}
static private class DashboardSectionSpec implements Serializable
{
static private final long serialVersionUID = 1L;
private final String fName;
private final DashboardSectionFile fInputReportFile;
private final DashboardSectionFile fDetailedReportFile;
private final DashboardSectionFile fXslFile;
DashboardSectionSpec(DashboardSection pSection)
{
fName = pSection.getName();
fInputReportFile = toDashboardSectionFile(getReportFileSpec(pSection.getReport()));
fDetailedReportFile = toDashboardSectionFile(getReportFileSpec(pSection.getDetailedReport()));
fXslFile = toDashboardSectionFile(pSection.getXslFile());
} | Map<String, String> function() { Collection<DashboardTask> aChildTasks = getProject() .getChildProjects() .values() .stream() .map(p -> Projects.getTask(p, TASK_NAME, DashboardTask.class)) .filter(Objects::nonNull) .collect(Collectors.toList()); if (aChildTasks.isEmpty()) return Collections.emptyMap(); Map<String, String> aChildProjectsDashboards = new HashMap<>(); Path aBasePath = Reports.getOutputLocation(getReports().getHtml()).toPath().getParent(); for (DashboardTask aChildTask : aChildTasks) { Path aChildReportPath = Reports.getOutputLocation(aChildTask.getReports().getHtml()).toPath(); String aRelativePath = aBasePath.relativize(aChildReportPath).toString(); aChildProjectsDashboards.put(aChildTask.getProject().getName(), aRelativePath); } return aChildProjectsDashboards; } static private class DashboardSectionSpec implements Serializable { static private final long serialVersionUID = 1L; private final String fName; private final DashboardSectionFile fInputReportFile; private final DashboardSectionFile fDetailedReportFile; private final DashboardSectionFile fXslFile; DashboardSectionSpec(DashboardSection pSection) { fName = pSection.getName(); fInputReportFile = toDashboardSectionFile(getReportFileSpec(pSection.getReport())); fDetailedReportFile = toDashboardSectionFile(getReportFileSpec(pSection.getDetailedReport())); fXslFile = toDashboardSectionFile(pSection.getXslFile()); } | /**
* Find all child projects that have a {@code DashboardTask} and return a mapping from the
* project name to the path of the dashboard report.
*
* @return The child projects with dashboard reports, or an empty map if the task's project has
* no child projects with a {@code DashboardTask}.
*/ | Find all child projects that have a DashboardTask and return a mapping from the project name to the path of the dashboard report | findChildProjectDashboards | {
"repo_name": "handmadecode/quill",
"path": "src/main/java/org/myire/quill/dashboard/DashboardTask.java",
"license": "apache-2.0",
"size": 14155
} | [
"java.io.Serializable",
"java.nio.file.Path",
"java.util.Collection",
"java.util.Collections",
"java.util.HashMap",
"java.util.Map",
"java.util.Objects",
"java.util.stream.Collectors",
"org.myire.quill.common.Projects",
"org.myire.quill.report.Reports"
] | import java.io.Serializable; import java.nio.file.Path; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.Objects; import java.util.stream.Collectors; import org.myire.quill.common.Projects; import org.myire.quill.report.Reports; | import java.io.*; import java.nio.file.*; import java.util.*; import java.util.stream.*; import org.myire.quill.common.*; import org.myire.quill.report.*; | [
"java.io",
"java.nio",
"java.util",
"org.myire.quill"
] | java.io; java.nio; java.util; org.myire.quill; | 1,969,066 |
@ApiModelProperty(required = true, value = "The ID of the document.")
public String getDocumentId() {
return documentId;
} | @ApiModelProperty(required = true, value = STR) String function() { return documentId; } | /**
* The ID of the document.
* @return documentId
**/ | The ID of the document | getDocumentId | {
"repo_name": "GenesysPureEngage/workspace-client-java",
"path": "src/main/java/com/genesys/internal/workspace/model/MediamediatypeinteractionsidadddocumentData.java",
"license": "mit",
"size": 4285
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 201,264 |
public static List<Radian> calculateCirclePoints(final double aLatitude, final double aLongitude,
final double aRadius) {
double r = (aRadius / (EARTH_RADIUS * Math.cos(aLatitude * RAD))) / RAD;
final CartesianPoint vec = CartesianPoint.fromRadian(new Radian(aLatitude, aLongitude));
final CartesianPoint pt = CartesianPoint.fromRadian(new Radian(aLatitude, aLongitude + r));
final List<Radian> pts = new LinkedList<Radian>();
for (int i = 0; i < CORNER_COUNT; i++) {
pts.add(Radian.fromCartesian(rotatePoint(vec, pt, (2 * Math.PI / CORNER_COUNT) * i)));
}
pts.add(pts.get(0));
return pts;
} | static List<Radian> function(final double aLatitude, final double aLongitude, final double aRadius) { double r = (aRadius / (EARTH_RADIUS * Math.cos(aLatitude * RAD))) / RAD; final CartesianPoint vec = CartesianPoint.fromRadian(new Radian(aLatitude, aLongitude)); final CartesianPoint pt = CartesianPoint.fromRadian(new Radian(aLatitude, aLongitude + r)); final List<Radian> pts = new LinkedList<Radian>(); for (int i = 0; i < CORNER_COUNT; i++) { pts.add(Radian.fromCartesian(rotatePoint(vec, pt, (2 * Math.PI / CORNER_COUNT) * i))); } pts.add(pts.get(0)); return pts; } | /**
* Calculate points that form a circle with the given radius around the
* given position on the surface of the earth
*
* @param aLatitude
* The position's latitude
* @param aLongitude
* The position's longitude
* @param aRadius
* The radius in meters
* @return A list of radian values describing the points on the surface of
* the earth that form the desired circle.
*/ | Calculate points that form a circle with the given radius around the given position on the surface of the earth | calculateCirclePoints | {
"repo_name": "joachimeichborn/GeoTag",
"path": "GeoTag/src/main/java/joachimeichborn/geotag/io/writer/kml/CirclePolygon.java",
"license": "gpl-3.0",
"size": 8806
} | [
"java.util.LinkedList",
"java.util.List"
] | import java.util.LinkedList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 496,085 |
private static void writeClientConnectorConfiguration(BinaryRawWriter w, ClientConnectorConfiguration cfg) {
assert w != null;
if (cfg != null) {
w.writeBoolean(true);
w.writeString(cfg.getHost());
w.writeInt(cfg.getPort());
w.writeInt(cfg.getPortRange());
w.writeInt(cfg.getSocketSendBufferSize());
w.writeInt(cfg.getSocketReceiveBufferSize());
w.writeBoolean(cfg.isTcpNoDelay());
w.writeInt(cfg.getMaxOpenCursorsPerConnection());
w.writeInt(cfg.getThreadPoolSize());
w.writeLong(cfg.getIdleTimeout());
w.writeBoolean(cfg.isThinClientEnabled());
w.writeBoolean(cfg.isOdbcEnabled());
w.writeBoolean(cfg.isJdbcEnabled());
} else {
w.writeBoolean(false);
}
} | static void function(BinaryRawWriter w, ClientConnectorConfiguration cfg) { assert w != null; if (cfg != null) { w.writeBoolean(true); w.writeString(cfg.getHost()); w.writeInt(cfg.getPort()); w.writeInt(cfg.getPortRange()); w.writeInt(cfg.getSocketSendBufferSize()); w.writeInt(cfg.getSocketReceiveBufferSize()); w.writeBoolean(cfg.isTcpNoDelay()); w.writeInt(cfg.getMaxOpenCursorsPerConnection()); w.writeInt(cfg.getThreadPoolSize()); w.writeLong(cfg.getIdleTimeout()); w.writeBoolean(cfg.isThinClientEnabled()); w.writeBoolean(cfg.isOdbcEnabled()); w.writeBoolean(cfg.isJdbcEnabled()); } else { w.writeBoolean(false); } } | /**
* Writes the client connector configuration.
*
* @param w Writer.
*/ | Writes the client connector configuration | writeClientConnectorConfiguration | {
"repo_name": "amirakhmedov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/utils/PlatformConfigurationUtils.java",
"license": "apache-2.0",
"size": 75809
} | [
"org.apache.ignite.binary.BinaryRawWriter",
"org.apache.ignite.configuration.ClientConnectorConfiguration"
] | import org.apache.ignite.binary.BinaryRawWriter; import org.apache.ignite.configuration.ClientConnectorConfiguration; | import org.apache.ignite.binary.*; import org.apache.ignite.configuration.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,361,349 |
public List<NodeIdAndType> getChildren(String parentId, long limit,
long offset);
| List<NodeIdAndType> function(String parentId, long limit, long offset); | /**
* A single page of IDs and types for a given parentIds.
*
* @param parentId
* @param limit
* @param offset
* @return
*/ | A single page of IDs and types for a given parentIds | getChildren | {
"repo_name": "zimingd/Synapse-Repository-Services",
"path": "lib/models/src/main/java/org/sagebionetworks/repo/model/NodeDAO.java",
"license": "apache-2.0",
"size": 20217
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,595,308 |
private static String readAddressFromInterface(final String interfaceName) {
try {
final String filePath = "/sys/class/net/" + interfaceName + "/address";
final StringBuilder fileData = new StringBuilder(1000);
final BufferedReader reader = new BufferedReader(new FileReader(filePath), 1024);
final char[] buf = new char[1024];
int numRead;
String readData;
while ((numRead = reader.read(buf)) != -1) {
readData = String.valueOf(buf, 0, numRead);
fileData.append(readData);
}
reader.close();
return fileData.toString();
} catch (IOException e) {
return null;
}
} | static String function(final String interfaceName) { try { final String filePath = STR + interfaceName + STR; final StringBuilder fileData = new StringBuilder(1000); final BufferedReader reader = new BufferedReader(new FileReader(filePath), 1024); final char[] buf = new char[1024]; int numRead; String readData; while ((numRead = reader.read(buf)) != -1) { readData = String.valueOf(buf, 0, numRead); fileData.append(readData); } reader.close(); return fileData.toString(); } catch (IOException e) { return null; } } | /**
* Read MAC address without requiring the ACCESS_WIFI_STATE permission.
* @param interfaceName
* @return
*/ | Read MAC address without requiring the ACCESS_WIFI_STATE permission | readAddressFromInterface | {
"repo_name": "mpire-nxus/nxus_android_sdk",
"path": "library/src/main/java/com/nxus/measurement/utils/NetworkUtils.java",
"license": "mit",
"size": 6121
} | [
"java.io.BufferedReader",
"java.io.FileReader",
"java.io.IOException"
] | import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 773,422 |
public StraightLine2D parallel(Point2D point) {
return new LineSegment2D(p1, p2).parallel(point);
}
| StraightLine2D function(Point2D point) { return new LineSegment2D(p1, p2).parallel(point); } | /**
* Creates a straight line parallel to this object, and passing through the
* given point.
*
* @param point
* the point to go through
* @return the parallel through the point
*/ | Creates a straight line parallel to this object, and passing through the given point | parallel | {
"repo_name": "pokowaka/android-geom",
"path": "geom/src/main/java/math/geom2d/line/Line2D.java",
"license": "lgpl-2.1",
"size": 21812
} | [
"math.geom2d.Point2D"
] | import math.geom2d.Point2D; | import math.geom2d.*; | [
"math.geom2d"
] | math.geom2d; | 2,604,807 |
public static <T> T splitEachLine(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options={"List<String>","String[]"},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException {
return splitEachLine(self, Pattern.compile(regex.toString()), closure);
} | static <T> T function(CharSequence self, CharSequence regex, @ClosureParams(value=FromString.class,options={STR,STR},conflictResolutionStrategy=PickFirstResolver.class) Closure<T> closure) throws IOException { return splitEachLine(self, Pattern.compile(regex.toString()), closure); } | /**
* Iterates through the given CharSequence line by line, splitting each line using
* the given regex delimiter. The list of tokens for each line is then passed to
* the given closure.
*
* @param self a CharSequence
* @param regex the delimiting regular expression
* @param closure a closure
* @return the last value returned by the closure
* @throws java.io.IOException if an error occurs
* @throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid
* @see #splitEachLine(CharSequence, java.util.regex.Pattern, groovy.lang.Closure)
* @since 1.8.2
*/ | Iterates through the given CharSequence line by line, splitting each line using the given regex delimiter. The list of tokens for each line is then passed to the given closure | splitEachLine | {
"repo_name": "bsideup/incubator-groovy",
"path": "src/main/org/codehaus/groovy/runtime/StringGroovyMethods.java",
"license": "apache-2.0",
"size": 141076
} | [
"groovy.lang.Closure",
"groovy.transform.stc.ClosureParams",
"groovy.transform.stc.FromString",
"groovy.transform.stc.PickFirstResolver",
"java.io.IOException",
"java.util.regex.Pattern"
] | import groovy.lang.Closure; import groovy.transform.stc.ClosureParams; import groovy.transform.stc.FromString; import groovy.transform.stc.PickFirstResolver; import java.io.IOException; import java.util.regex.Pattern; | import groovy.lang.*; import groovy.transform.stc.*; import java.io.*; import java.util.regex.*; | [
"groovy.lang",
"groovy.transform.stc",
"java.io",
"java.util"
] | groovy.lang; groovy.transform.stc; java.io; java.util; | 2,264,742 |
private Result pMultiplicativeOperator(final int yyStart)
throws IOException {
Result yyResult;
String yyValue;
ParseError yyError = ParseError.DUMMY;
// Alternative <Times>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("*")) {
yyValue = "*";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Over>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("/")) {
yyValue = "/";
return yyResult.createValue(yyValue, yyError);
}
// Alternative <Modulo>.
yyResult = pSymbol(yyStart);
if (yyResult.hasValue("%")) {
yyValue = "%";
return yyResult.createValue(yyValue, yyError);
}
// Done.
yyError = yyError.select("multiplicative operator expected", yyStart);
return yyError;
}
// ========================================================================= | Result function(final int yyStart) throws IOException { Result yyResult; String yyValue; ParseError yyError = ParseError.DUMMY; yyResult = pSymbol(yyStart); if (yyResult.hasValue("*")) { yyValue = "*"; return yyResult.createValue(yyValue, yyError); } yyResult = pSymbol(yyStart); if (yyResult.hasValue("/")) { yyValue = "/"; return yyResult.createValue(yyValue, yyError); } yyResult = pSymbol(yyStart); if (yyResult.hasValue("%")) { yyValue = "%"; return yyResult.createValue(yyValue, yyError); } yyError = yyError.select(STR, yyStart); return yyError; } | /**
* Parse nonterminal xtc.lang.JavaFive.MultiplicativeOperator.
*
* @param yyStart The index.
* @return The result.
* @throws IOException Signals an I/O error.
*/ | Parse nonterminal xtc.lang.JavaFive.MultiplicativeOperator | pMultiplicativeOperator | {
"repo_name": "wandoulabs/xtc-rats",
"path": "xtc-core/src/main/java/xtc/lang/JavaFiveParser.java",
"license": "lgpl-2.1",
"size": 313913
} | [
"java.io.IOException",
"xtc.parser.ParseError",
"xtc.parser.Result"
] | import java.io.IOException; import xtc.parser.ParseError; import xtc.parser.Result; | import java.io.*; import xtc.parser.*; | [
"java.io",
"xtc.parser"
] | java.io; xtc.parser; | 2,746,281 |
public Map getSpecialOperations() {
return specialOperations;
} | Map function() { return specialOperations; } | /**
* PUBLIC:
* The special operations to use in place of <code>equal</code>.
* @return A hashtable where the keys are <code>Class</code> objects and the values
* are the names of operations to use for attributes of that <code>Class</code>.
* @see #addSpecialOperation
*/ | The special operations to use in place of <code>equal</code> | getSpecialOperations | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/queries/QueryByExamplePolicy.java",
"license": "epl-1.0",
"size": 25823
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 712,515 |
// COMPLETE (14) Create a method called showJsonDataView to show the data and hide the error
private void showJsonDataView () {
// Show retrieved data
mSearchResultsTextView.setVisibility(View.VISIBLE);
// Hide error messages
errorMessageTextView.setVisibility(View.INVISIBLE);
} | void function () { mSearchResultsTextView.setVisibility(View.VISIBLE); errorMessageTextView.setVisibility(View.INVISIBLE); } | /**
* This method shows the retrieved data on the user interface while hiding any error messages
* that may be present from previous usage.
*/ | This method shows the retrieved data on the user interface while hiding any error messages that may be present from previous usage | showJsonDataView | {
"repo_name": "CHaller6/ud851-Exercises",
"path": "Lesson02-GitHub-Repo-Search/T02.06-Exercise-AddPolish/app/src/main/java/com/example/android/datafrominternet/MainActivity.java",
"license": "apache-2.0",
"size": 5787
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,203,159 |
public void testTasksCumulativelyExceedingTTPhysicalLimits()
throws Exception {
// Run the test only if memory management is enabled
if (!isProcfsBasedTreeAvailable()) {
return;
}
// Start cluster with proper configuration.
JobConf fConf = new JobConf();
// very small value, so that no task escapes to successful completion.
fConf.set(TaskMemoryManagerThread.TT_MEMORY_MANAGER_MONITORING_INTERVAL,
String.valueOf(300));
// reserve all memory on TT so that the job will exceed memory limits
LinuxResourceCalculatorPlugin memoryCalculatorPlugin =
new LinuxResourceCalculatorPlugin();
long totalPhysicalMemory = memoryCalculatorPlugin.getPhysicalMemorySize();
long reservedPhysicalMemory = totalPhysicalMemory / (1024 * 1024) + 1;
fConf.setLong(JobConf.MAPRED_JOB_MAP_MEMORY_MB_PROPERTY, 1024 * 1024L);
fConf.setLong(JobConf.MAPRED_JOB_REDUCE_MEMORY_MB_PROPERTY, 1024 * 1024L);
fConf.setLong(TaskMemoryManagerThread.TT_RESERVED_PHYSICAL_MEMORY_MB,
reservedPhysicalMemory);
long maxRssMemoryAllowedForAllTasks = totalPhysicalMemory -
reservedPhysicalMemory * 1024 * 1024L;
Pattern physicalMemoryOverLimitPattern = Pattern.compile(
"Killing.*" + maxRssMemoryAllowedForAllTasks);
TaskMemoryManagerThread.disableUpdateReservedPhysicalMemory();
startCluster(fConf);
Matcher mat = null;
// Set up job.
JobConf conf = new JobConf(miniMRCluster.createJobConf());
JobClient jClient = new JobClient(conf);
SleepJob sleepJob = new SleepJob();
sleepJob.setConf(conf);
// Start the job
RunningJob job =
jClient.submitJob(sleepJob.setupJobConf(1, 1, 5000, 1, 1000, 1));
boolean TTOverFlowMsgPresent = false;
while (true) {
List<TaskReport> allTaskReports = new ArrayList<TaskReport>();
allTaskReports.addAll(Arrays.asList(jClient
.getSetupTaskReports((org.apache.hadoop.mapred.JobID) job.getID())));
allTaskReports.addAll(Arrays.asList(jClient
.getMapTaskReports((org.apache.hadoop.mapred.JobID) job.getID())));
for (TaskReport tr : allTaskReports) {
String[] diag = tr.getDiagnostics();
for (String str : diag) {
mat = physicalMemoryOverLimitPattern.matcher(str);
if (mat.find()) {
TTOverFlowMsgPresent = true;
}
}
}
if (TTOverFlowMsgPresent) {
break;
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// nothing
}
}
// If it comes here without a test-timeout, it means there was a task that
// was killed because of crossing cumulative TT limit.
// Test succeeded, kill the job.
job.killJob();
} | void function() throws Exception { if (!isProcfsBasedTreeAvailable()) { return; } JobConf fConf = new JobConf(); fConf.set(TaskMemoryManagerThread.TT_MEMORY_MANAGER_MONITORING_INTERVAL, String.valueOf(300)); LinuxResourceCalculatorPlugin memoryCalculatorPlugin = new LinuxResourceCalculatorPlugin(); long totalPhysicalMemory = memoryCalculatorPlugin.getPhysicalMemorySize(); long reservedPhysicalMemory = totalPhysicalMemory / (1024 * 1024) + 1; fConf.setLong(JobConf.MAPRED_JOB_MAP_MEMORY_MB_PROPERTY, 1024 * 1024L); fConf.setLong(JobConf.MAPRED_JOB_REDUCE_MEMORY_MB_PROPERTY, 1024 * 1024L); fConf.setLong(TaskMemoryManagerThread.TT_RESERVED_PHYSICAL_MEMORY_MB, reservedPhysicalMemory); long maxRssMemoryAllowedForAllTasks = totalPhysicalMemory - reservedPhysicalMemory * 1024 * 1024L; Pattern physicalMemoryOverLimitPattern = Pattern.compile( STR + maxRssMemoryAllowedForAllTasks); TaskMemoryManagerThread.disableUpdateReservedPhysicalMemory(); startCluster(fConf); Matcher mat = null; JobConf conf = new JobConf(miniMRCluster.createJobConf()); JobClient jClient = new JobClient(conf); SleepJob sleepJob = new SleepJob(); sleepJob.setConf(conf); RunningJob job = jClient.submitJob(sleepJob.setupJobConf(1, 1, 5000, 1, 1000, 1)); boolean TTOverFlowMsgPresent = false; while (true) { List<TaskReport> allTaskReports = new ArrayList<TaskReport>(); allTaskReports.addAll(Arrays.asList(jClient .getSetupTaskReports((org.apache.hadoop.mapred.JobID) job.getID()))); allTaskReports.addAll(Arrays.asList(jClient .getMapTaskReports((org.apache.hadoop.mapred.JobID) job.getID()))); for (TaskReport tr : allTaskReports) { String[] diag = tr.getDiagnostics(); for (String str : diag) { mat = physicalMemoryOverLimitPattern.matcher(str); if (mat.find()) { TTOverFlowMsgPresent = true; } } } if (TTOverFlowMsgPresent) { break; } try { Thread.sleep(1000); } catch (InterruptedException e) { } } job.killJob(); } | /**
* Test for verifying that tasks causing cumulative usage of physical memory
* to go beyond TT's limit get killed.
*
* @throws Exception
*/ | Test for verifying that tasks causing cumulative usage of physical memory to go beyond TT's limit get killed | testTasksCumulativelyExceedingTTPhysicalLimits | {
"repo_name": "nvoron23/hadoop-20",
"path": "src/test/org/apache/hadoop/mapred/TestTaskTrackerMemoryManager.java",
"license": "apache-2.0",
"size": 20218
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.List",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.apache.hadoop.examples.SleepJob",
"org.apache.hadoop.util.LinuxResourceCalculatorPlugin"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.apache.hadoop.examples.SleepJob; import org.apache.hadoop.util.LinuxResourceCalculatorPlugin; | import java.util.*; import java.util.regex.*; import org.apache.hadoop.examples.*; import org.apache.hadoop.util.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,865,812 |
@Override
public void dump( final DataOutputStream file ) throws IOException {
super.dump(file);
file.writeShort(exceptionIndexTable.length);
for (final int index : exceptionIndexTable) {
file.writeShort(index);
}
} | void function( final DataOutputStream file ) throws IOException { super.dump(file); file.writeShort(exceptionIndexTable.length); for (final int index : exceptionIndexTable) { file.writeShort(index); } } | /**
* Dump exceptions attribute to file stream in binary format.
*
* @param file Output file stream
* @throws IOException
*/ | Dump exceptions attribute to file stream in binary format | dump | {
"repo_name": "apache/commons-bcel",
"path": "src/main/java/org/apache/bcel/classfile/ExceptionTable.java",
"license": "apache-2.0",
"size": 6213
} | [
"java.io.DataOutputStream",
"java.io.IOException"
] | import java.io.DataOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,155,382 |
void setProcessIdForJob(
@NotBlank(message = "No job id entered. Unable to set process id")
final String id,
final int pid
) throws GenieException; | void setProcessIdForJob( @NotBlank(message = STR) final String id, final int pid ) throws GenieException; | /**
* Set the java process id that will run the given job.
*
* @param id The id of the job to attach the process to.
* @param pid The id of the process that will run the job.
* @throws GenieException if there is an error
*/ | Set the java process id that will run the given job | setProcessIdForJob | {
"repo_name": "chen0031/genie",
"path": "genie-server/src/main/java/com/netflix/genie/server/services/JobService.java",
"license": "apache-2.0",
"size": 10236
} | [
"com.netflix.genie.common.exceptions.GenieException",
"org.hibernate.validator.constraints.NotBlank"
] | import com.netflix.genie.common.exceptions.GenieException; import org.hibernate.validator.constraints.NotBlank; | import com.netflix.genie.common.exceptions.*; import org.hibernate.validator.constraints.*; | [
"com.netflix.genie",
"org.hibernate.validator"
] | com.netflix.genie; org.hibernate.validator; | 2,642,369 |
@Test
public void testJMXBeanAfterRoleChange() throws Exception {
qu = new QuorumUtil(1); // create 3 servers
qu.disableJMXTest = true;
qu.startAll();
ZooKeeper[] zkArr = createHandles(qu);
// changing a server's role / port is done by "adding" it with the same
// id but different role / port
List<String> joiningServers = new ArrayList<String>();
// assert remotePeerBean.1 of ReplicatedServer_2
int changingIndex = 1;
int replica2 = 2;
QuorumPeer peer2 = qu.getPeer(replica2).peer;
QuorumServer changingQS2 = peer2.getView().get(new Long(changingIndex));
String remotePeerBean2 = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + replica2 + ",name1=replica."
+ changingIndex;
assertRemotePeerMXBeanAttributes(changingQS2, remotePeerBean2);
// assert remotePeerBean.1 of ReplicatedServer_3
int replica3 = 3;
QuorumPeer peer3 = qu.getPeer(replica3).peer;
QuorumServer changingQS3 = peer3.getView().get(new Long(changingIndex));
String remotePeerBean3 = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + replica3 + ",name1=replica."
+ changingIndex;
assertRemotePeerMXBeanAttributes(changingQS3, remotePeerBean3);
String newRole = "observer";
ZooKeeper zk = zkArr[changingIndex];
// exactly as it is now, except for role change
joiningServers.add("server." + changingIndex + "=127.0.0.1:"
+ qu.getPeer(changingIndex).peer.getQuorumAddress().getPort()
+ ":"
+ qu.getPeer(changingIndex).peer.getElectionAddress().getPort()
+ ":" + newRole + ";127.0.0.1:"
+ qu.getPeer(changingIndex).peer.getClientPort());
reconfig(zk, joiningServers, null, null, -1);
testNormalOperation(zkArr[changingIndex], zk);
Assert.assertTrue(qu.getPeer(changingIndex).peer.observer != null
&& qu.getPeer(changingIndex).peer.follower == null
&& qu.getPeer(changingIndex).peer.leader == null);
Assert.assertTrue(qu.getPeer(changingIndex).peer.getPeerState() == ServerState.OBSERVING);
QuorumPeer qp = qu.getPeer(changingIndex).peer;
String localPeerBeanName = CommonNames.DOMAIN
+ ":name0=ReplicatedServer_id" + changingIndex
+ ",name1=replica." + changingIndex;
// localPeerBean.1 of ReplicatedServer_1
assertLocalPeerMXBeanAttributes(qp, localPeerBeanName, true);
// assert remotePeerBean.1 of ReplicatedServer_2
changingQS2 = peer2.getView().get(new Long(changingIndex));
assertRemotePeerMXBeanAttributes(changingQS2, remotePeerBean2);
// assert remotePeerBean.1 of ReplicatedServer_3
changingQS3 = peer3.getView().get(new Long(changingIndex));
assertRemotePeerMXBeanAttributes(changingQS3, remotePeerBean3);
closeAllHandles(zkArr);
} | void function() throws Exception { qu = new QuorumUtil(1); qu.disableJMXTest = true; qu.startAll(); ZooKeeper[] zkArr = createHandles(qu); List<String> joiningServers = new ArrayList<String>(); int changingIndex = 1; int replica2 = 2; QuorumPeer peer2 = qu.getPeer(replica2).peer; QuorumServer changingQS2 = peer2.getView().get(new Long(changingIndex)); String remotePeerBean2 = CommonNames.DOMAIN + STR + replica2 + STR + changingIndex; assertRemotePeerMXBeanAttributes(changingQS2, remotePeerBean2); int replica3 = 3; QuorumPeer peer3 = qu.getPeer(replica3).peer; QuorumServer changingQS3 = peer3.getView().get(new Long(changingIndex)); String remotePeerBean3 = CommonNames.DOMAIN + STR + replica3 + STR + changingIndex; assertRemotePeerMXBeanAttributes(changingQS3, remotePeerBean3); String newRole = STR; ZooKeeper zk = zkArr[changingIndex]; joiningServers.add(STR + changingIndex + STR + qu.getPeer(changingIndex).peer.getQuorumAddress().getPort() + ":" + qu.getPeer(changingIndex).peer.getElectionAddress().getPort() + ":" + newRole + STR + qu.getPeer(changingIndex).peer.getClientPort()); reconfig(zk, joiningServers, null, null, -1); testNormalOperation(zkArr[changingIndex], zk); Assert.assertTrue(qu.getPeer(changingIndex).peer.observer != null && qu.getPeer(changingIndex).peer.follower == null && qu.getPeer(changingIndex).peer.leader == null); Assert.assertTrue(qu.getPeer(changingIndex).peer.getPeerState() == ServerState.OBSERVING); QuorumPeer qp = qu.getPeer(changingIndex).peer; String localPeerBeanName = CommonNames.DOMAIN + STR + changingIndex + STR + changingIndex; assertLocalPeerMXBeanAttributes(qp, localPeerBeanName, true); changingQS2 = peer2.getView().get(new Long(changingIndex)); assertRemotePeerMXBeanAttributes(changingQS2, remotePeerBean2); changingQS3 = peer3.getView().get(new Long(changingIndex)); assertRemotePeerMXBeanAttributes(changingQS3, remotePeerBean3); closeAllHandles(zkArr); } | /**
* Tests verifies the jmx attributes of local and remote peer bean - change
* participant to observer role
*/ | Tests verifies the jmx attributes of local and remote peer bean - change participant to observer role | testJMXBeanAfterRoleChange | {
"repo_name": "ervinyang/tutorial_zookeeper",
"path": "zookeeper-trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java",
"license": "mit",
"size": 42462
} | [
"java.util.ArrayList",
"java.util.List",
"org.apache.zookeeper.ZooKeeper",
"org.apache.zookeeper.jmx.CommonNames",
"org.apache.zookeeper.server.quorum.QuorumPeer",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.List; import org.apache.zookeeper.ZooKeeper; import org.apache.zookeeper.jmx.CommonNames; import org.apache.zookeeper.server.quorum.QuorumPeer; import org.junit.Assert; | import java.util.*; import org.apache.zookeeper.*; import org.apache.zookeeper.jmx.*; import org.apache.zookeeper.server.quorum.*; import org.junit.*; | [
"java.util",
"org.apache.zookeeper",
"org.junit"
] | java.util; org.apache.zookeeper; org.junit; | 653,070 |
public Set<String> listObjects(String namespace); | Set<String> function(String namespace); | /**
* List all objects in given namespace.
*/ | List all objects in given namespace | listObjects | {
"repo_name": "rockmkd/datacollector",
"path": "container/src/main/java/com/streamsets/datacollector/blobstore/BlobStoreTask.java",
"license": "apache-2.0",
"size": 1379
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,857,822 |
@Nonnull
static BigInteger integerComponent(@Nonnull Number number) {
requireNonNull(number);
if (number instanceof BigDecimal) {
BigDecimal numberAsBigDecimal = (BigDecimal) number;
return numberAsBigDecimal.toBigInteger();
}
return toBigDecimal(number).toBigInteger();
} | static BigInteger integerComponent(@Nonnull Number number) { requireNonNull(number); if (number instanceof BigDecimal) { BigDecimal numberAsBigDecimal = (BigDecimal) number; return numberAsBigDecimal.toBigInteger(); } return toBigDecimal(number).toBigInteger(); } | /**
* Determines the integer component of the given number.
* <p>
* For example:
* <p>
* <ul>
* <li>{@code 2} has an integer component of {@code 2}</li>
* <li>{@code 1.234} has an integer component of {@code 1}</li>
* <li>{@code -1.5} has an integer component of {@code -1}</li>
* <li>{@code .5} has an integer component of {@code 0}</li>
* </ul>
*
* @param number the number for which we are determining the integer component, not null
* @return the integer component, not null
*/ | Determines the integer component of the given number. For example: 2 has an integer component of 2 1.234 has an integer component of 1 -1.5 has an integer component of -1 .5 has an integer component of 0 | integerComponent | {
"repo_name": "lokalized/lokalized-java",
"path": "src/main/java/com/lokalized/NumberUtils.java",
"license": "apache-2.0",
"size": 14239
} | [
"java.math.BigDecimal",
"java.math.BigInteger",
"java.util.Objects",
"javax.annotation.Nonnull"
] | import java.math.BigDecimal; import java.math.BigInteger; import java.util.Objects; import javax.annotation.Nonnull; | import java.math.*; import java.util.*; import javax.annotation.*; | [
"java.math",
"java.util",
"javax.annotation"
] | java.math; java.util; javax.annotation; | 1,044,823 |
private void setBufferSize(int size)
{
buf = new byte[size + 3];
buf_length = size;
count = 0;
}
public SerializerTraceWriter(Writer out, SerializerTrace tracer)
{
m_writer = out;
m_tracer = tracer;
setBufferSize(1024);
} | void function(int size) { buf = new byte[size + 3]; buf_length = size; count = 0; } SerializerTraceWriter(Writer out, SerializerTrace tracer) { m_writer = out; m_tracer = tracer; function(1024); } | /**
* Creates or replaces the internal buffer, and makes sure it has a few
* extra bytes slight overflow of the last UTF8 encoded character.
* @param size
*/ | Creates or replaces the internal buffer, and makes sure it has a few extra bytes slight overflow of the last UTF8 encoded character | setBufferSize | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xml/internal/serializer/SerializerTraceWriter.java",
"license": "apache-2.0",
"size": 10311
} | [
"java.io.Writer"
] | import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 492,081 |
EClass getType(); | EClass getType(); | /**
* Returns the meta object for class '{@link org.eclipse.vorto.core.api.model.datatype.Type <em>Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Type</em>'.
* @see org.eclipse.vorto.core.api.model.datatype.Type
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.vorto.core.api.model.datatype.Type Type</code>'. | getType | {
"repo_name": "hrohmer/vorto",
"path": "bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/datatype/DatatypePackage.java",
"license": "epl-1.0",
"size": 57755
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 194,940 |
protected MapEntryUpdateResult.Status clear(Commit<? extends Clear> commit) {
try {
Iterator<Map.Entry<String, MapEntryValue>> iterator = mapEntries
.entrySet().iterator();
while (iterator.hasNext()) {
Map.Entry<String, MapEntryValue> entry = iterator.next();
String key = entry.getKey();
MapEntryValue value = entry.getValue();
Versioned<byte[]> removedValue = new Versioned<>(value.value(),
value.version());
publish(Lists.newArrayList(new MapEvent<>("", key, null, removedValue)));
value.discard();
iterator.remove();
}
return MapEntryUpdateResult.Status.OK;
} finally {
commit.close();
}
} | MapEntryUpdateResult.Status function(Commit<? extends Clear> commit) { try { Iterator<Map.Entry<String, MapEntryValue>> iterator = mapEntries .entrySet().iterator(); while (iterator.hasNext()) { Map.Entry<String, MapEntryValue> entry = iterator.next(); String key = entry.getKey(); MapEntryValue value = entry.getValue(); Versioned<byte[]> removedValue = new Versioned<>(value.value(), value.version()); publish(Lists.newArrayList(new MapEvent<>("", key, null, removedValue))); value.discard(); iterator.remove(); } return MapEntryUpdateResult.Status.OK; } finally { commit.close(); } } | /**
* Handles a clear commit.
*
* @param commit clear commit
* @return clear result
*/ | Handles a clear commit | clear | {
"repo_name": "sonu283304/onos",
"path": "core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixConsistentMapState.java",
"license": "apache-2.0",
"size": 22603
} | [
"com.google.common.collect.Lists",
"io.atomix.copycat.server.Commit",
"java.util.Iterator",
"java.util.Map",
"org.onosproject.store.primitives.resources.impl.AtomixConsistentMapCommands",
"org.onosproject.store.service.MapEvent",
"org.onosproject.store.service.Versioned"
] | import com.google.common.collect.Lists; import io.atomix.copycat.server.Commit; import java.util.Iterator; import java.util.Map; import org.onosproject.store.primitives.resources.impl.AtomixConsistentMapCommands; import org.onosproject.store.service.MapEvent; import org.onosproject.store.service.Versioned; | import com.google.common.collect.*; import io.atomix.copycat.server.*; import java.util.*; import org.onosproject.store.primitives.resources.impl.*; import org.onosproject.store.service.*; | [
"com.google.common",
"io.atomix.copycat",
"java.util",
"org.onosproject.store"
] | com.google.common; io.atomix.copycat; java.util; org.onosproject.store; | 1,709,138 |
@Test
public void testBasic() throws SAXException, IOException, SchemaException {
MidPointPrismContextFactory factory = getContextFactory();
PrismContext context = factory.createInitializedPrismContext();
SchemaRegistry reg = context.getSchemaRegistry();
Schema javaxSchema = reg.getJavaxSchema();
assertNotNull(javaxSchema);
// Try to use the schema to validate Jack
// PrismObject<UserType> user = context.parseObject(new File("src/test/resources/common/user-jack.xml"));
// Element document = context.serializeToDom(user);
Document document = DOMUtil.parseFile("src/test/resources/common/user-jack.xml");
Validator validator = javaxSchema.newValidator();
DOMResult validationResult = new DOMResult();
validator.validate(new DOMSource(document), validationResult);
// System.out.println("Validation result:");
// System.out.println(DOMUtil.serializeDOMToString(validationResult.getNode()));
} | void function() throws SAXException, IOException, SchemaException { MidPointPrismContextFactory factory = getContextFactory(); PrismContext context = factory.createInitializedPrismContext(); SchemaRegistry reg = context.getSchemaRegistry(); Schema javaxSchema = reg.getJavaxSchema(); assertNotNull(javaxSchema); Document document = DOMUtil.parseFile(STR); Validator validator = javaxSchema.newValidator(); DOMResult validationResult = new DOMResult(); validator.validate(new DOMSource(document), validationResult); } | /**
* Test whether the midpoint prism context was constructed OK and if it can validate
* ordinary user object.
*/ | Test whether the midpoint prism context was constructed OK and if it can validate ordinary user object | testBasic | {
"repo_name": "rpudil/midpoint",
"path": "infra/schema/src/test/java/com/evolveum/midpoint/schema/TestSchemaRegistry.java",
"license": "apache-2.0",
"size": 11077
} | [
"com.evolveum.midpoint.prism.PrismContext",
"com.evolveum.midpoint.prism.schema.SchemaRegistry",
"com.evolveum.midpoint.util.DOMUtil",
"com.evolveum.midpoint.util.exception.SchemaException",
"java.io.IOException",
"javax.xml.transform.dom.DOMResult",
"javax.xml.transform.dom.DOMSource",
"javax.xml.val... | import com.evolveum.midpoint.prism.PrismContext; import com.evolveum.midpoint.prism.schema.SchemaRegistry; import com.evolveum.midpoint.util.DOMUtil; import com.evolveum.midpoint.util.exception.SchemaException; import java.io.IOException; import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMSource; import javax.xml.validation.Schema; import javax.xml.validation.Validator; import org.testng.AssertJUnit; import org.w3c.dom.Document; import org.xml.sax.SAXException; | import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.prism.schema.*; import com.evolveum.midpoint.util.*; import com.evolveum.midpoint.util.exception.*; import java.io.*; import javax.xml.transform.dom.*; import javax.xml.validation.*; import org.testng.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.evolveum.midpoint",
"java.io",
"javax.xml",
"org.testng",
"org.w3c.dom",
"org.xml.sax"
] | com.evolveum.midpoint; java.io; javax.xml; org.testng; org.w3c.dom; org.xml.sax; | 2,264,004 |
private static boolean isVirtualDocument(Uri uri) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return false;
if (uri == null) return false;
if (!DocumentsContract.isDocumentUri(ContextUtils.getApplicationContext(), uri)) {
return false;
}
ContentResolver contentResolver = ContextUtils.getApplicationContext().getContentResolver();
Cursor cursor = null;
try {
cursor = contentResolver.query(uri, null, null, null, null);
if (cursor != null && cursor.getCount() >= 1) {
cursor.moveToFirst();
return hasVirtualFlag(cursor);
}
} catch (NullPointerException e) {
// Some android models don't handle the provider call correctly.
// see crbug.com/345393
return false;
} finally {
if (cursor != null) {
try {
cursor.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
return false;
} | static boolean function(Uri uri) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return false; if (uri == null) return false; if (!DocumentsContract.isDocumentUri(ContextUtils.getApplicationContext(), uri)) { return false; } ContentResolver contentResolver = ContextUtils.getApplicationContext().getContentResolver(); Cursor cursor = null; try { cursor = contentResolver.query(uri, null, null, null, null); if (cursor != null && cursor.getCount() >= 1) { cursor.moveToFirst(); return hasVirtualFlag(cursor); } } catch (NullPointerException e) { return false; } finally { if (cursor != null) { try { cursor.close(); } catch (Exception e) { e.printStackTrace(); } } } return false; } | /**
* Checks whether the passed Uri represents a virtual document.
*
* @param uri the content URI to be resolved.
* @return True for virtual file, false for any other file.
*/ | Checks whether the passed Uri represents a virtual document | isVirtualDocument | {
"repo_name": "lizhangqu/chromium-net-for-android",
"path": "cronet-native/src/main/java/org/chromium/base/ContentUriUtils.java",
"license": "bsd-3-clause",
"size": 11258
} | [
"android.content.ContentResolver",
"android.database.Cursor",
"android.net.Uri",
"android.os.Build",
"android.provider.DocumentsContract"
] | import android.content.ContentResolver; import android.database.Cursor; import android.net.Uri; import android.os.Build; import android.provider.DocumentsContract; | import android.content.*; import android.database.*; import android.net.*; import android.os.*; import android.provider.*; | [
"android.content",
"android.database",
"android.net",
"android.os",
"android.provider"
] | android.content; android.database; android.net; android.os; android.provider; | 2,072,390 |
@Override
public void endWindow()
{
if (!mergedTuple.isEmpty()) {
mergedport.emit(mergedTuple);
mergedTuple = new HashMap<K, V>();
}
} | void function() { if (!mergedTuple.isEmpty()) { mergedport.emit(mergedTuple); mergedTuple = new HashMap<K, V>(); } } | /**
* emits mergedTuple on mergedport if it is not empty
*/ | emits mergedTuple on mergedport if it is not empty | endWindow | {
"repo_name": "skekre98/apex-mlhr",
"path": "library/src/main/java/com/datatorrent/lib/util/UnifierHashMap.java",
"license": "apache-2.0",
"size": 2538
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 143,770 |
DataValueDescriptor getValue()
{
return value;
}
//////////////////////////////////////////////////////////////////
//
// CALLABLE STATEMENT
//
////////////////////////////////////////////////////////////////// | DataValueDescriptor getValue() { return value; } | /**
* Get the parameter value. Doesn't check to
* see if it has been initialized or not.
*
* @return the parameter value, may return null
*/ | Get the parameter value. Doesn't check to see if it has been initialized or not | getValue | {
"repo_name": "kavin256/Derby",
"path": "java/engine/org/apache/derby/impl/sql/GenericParameter.java",
"license": "apache-2.0",
"size": 8227
} | [
"org.apache.derby.iapi.types.DataValueDescriptor"
] | import org.apache.derby.iapi.types.DataValueDescriptor; | import org.apache.derby.iapi.types.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,779,335 |
private static final boolean unaligned = Platform.unaligned();
public static boolean arrayEqualsBlock(
MemoryBlock leftBase, long leftOffset, MemoryBlock rightBase, long rightOffset, long length) {
return arrayEquals(leftBase.getBaseObject(), leftBase.getBaseOffset() + leftOffset,
rightBase.getBaseObject(), rightBase.getBaseOffset() + rightOffset, length);
} | static final boolean unaligned = Platform.unaligned(); public static boolean function( MemoryBlock leftBase, long leftOffset, MemoryBlock rightBase, long rightOffset, long length) { return arrayEquals(leftBase.getBaseObject(), leftBase.getBaseOffset() + leftOffset, rightBase.getBaseObject(), rightBase.getBaseOffset() + rightOffset, length); } | /**
* MemoryBlock equality check for MemoryBlocks.
* @return true if the arrays are equal, false otherwise
*/ | MemoryBlock equality check for MemoryBlocks | arrayEqualsBlock | {
"repo_name": "sahilTakiar/spark",
"path": "common/unsafe/src/main/java/org/apache/spark/unsafe/array/ByteArrayMethods.java",
"license": "apache-2.0",
"size": 4035
} | [
"org.apache.spark.unsafe.Platform",
"org.apache.spark.unsafe.memory.MemoryBlock"
] | import org.apache.spark.unsafe.Platform; import org.apache.spark.unsafe.memory.MemoryBlock; | import org.apache.spark.unsafe.*; import org.apache.spark.unsafe.memory.*; | [
"org.apache.spark"
] | org.apache.spark; | 1,628,562 |
protected boolean isExcluded(final File file) {
return !filenameFilter.accept(file.getParentFile(), file.getName());
} | boolean function(final File file) { return !filenameFilter.accept(file.getParentFile(), file.getName()); } | /**
* Utility method to determine if the file is excluded by the
* inclusion/exclusion filter.
*
* @param file
* the file
* @return true if the file is excluded, or false if it is to be included
*/ | Utility method to determine if the file is excluded by the inclusion/exclusion filter | isExcluded | {
"repo_name": "DICE-UNC/jargon-modeshape",
"path": "irods-connector/attic/IRODSWriteableConnector.java",
"license": "bsd-3-clause",
"size": 45386
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 834,701 |
@Override
public void writeObject(File file, OutputStream outputStream) throws IOException,
SerializationException {
InputStream inputStream = null;
try {
inputStream = new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE);
for (int data = inputStream.read(); data != -1; data = inputStream.read()) {
outputStream.write((byte)data);
}
} finally {
if (inputStream != null) {
inputStream.close();
}
}
} | void function(File file, OutputStream outputStream) throws IOException, SerializationException { InputStream inputStream = null; try { inputStream = new BufferedInputStream(new FileInputStream(file), BUFFER_SIZE); for (int data = inputStream.read(); data != -1; data = inputStream.read()) { outputStream.write((byte)data); } } finally { if (inputStream != null) { inputStream.close(); } } } | /**
* Writes a file to an output stream.
*/ | Writes a file to an output stream | writeObject | {
"repo_name": "ggeorg/chillverse",
"path": "src/org/apache/pivot/io/FileSerializer.java",
"license": "apache-2.0",
"size": 3787
} | [
"java.io.BufferedInputStream",
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream",
"org.apache.pivot.serialization.SerializationException"
] | import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import org.apache.pivot.serialization.SerializationException; | import java.io.*; import org.apache.pivot.serialization.*; | [
"java.io",
"org.apache.pivot"
] | java.io; org.apache.pivot; | 2,471,293 |
public static ArrayList<Instruction> recompileHopsDag2Forced( Hop hops, long tid, ExecType et )
throws DMLRuntimeException, HopsException, LopsException, IOException
{
ArrayList<Instruction> newInst = null;
//need for synchronization as we do temp changes in shared hops/lops
synchronized( hops )
{
LOG.debug ("\n**************** Optimizer (Recompile) *************\nMemory Budget = " +
OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + " MB");
// clear existing lops
hops.resetVisitStatus();
rClearLops( hops );
// update exec type
hops.resetVisitStatus();
rSetExecType( hops, et );
hops.resetVisitStatus();
// construct lops
Dag<Lop> dag = new Dag<>();
Lop lops = hops.constructLops();
lops.addToDag(dag);
// generate runtime instructions (incl piggybacking)
newInst = dag.getJobs(null, ConfigurationManager.getDMLConfig());
}
// replace thread ids in new instructions
if( tid != 0 ) //only in parfor context
newInst = ProgramConverter.createDeepCopyInstructionSet(newInst, tid, -1, null, null, null, false, false);
return newInst;
} | static ArrayList<Instruction> function( Hop hops, long tid, ExecType et ) throws DMLRuntimeException, HopsException, LopsException, IOException { ArrayList<Instruction> newInst = null; synchronized( hops ) { LOG.debug (STR + OptimizerUtils.toMB(OptimizerUtils.getLocalMemBudget()) + STR); hops.resetVisitStatus(); rClearLops( hops ); hops.resetVisitStatus(); rSetExecType( hops, et ); hops.resetVisitStatus(); Dag<Lop> dag = new Dag<>(); Lop lops = hops.constructLops(); lops.addToDag(dag); newInst = dag.getJobs(null, ConfigurationManager.getDMLConfig()); } if( tid != 0 ) newInst = ProgramConverter.createDeepCopyInstructionSet(newInst, tid, -1, null, null, null, false, false); return newInst; } | /**
* D) Recompile predicate hop DAG (single root), but forced to CP.
*
* This happens always 'inplace', without statistics updates, and
* without dynamic rewrites.
*
* @param hops list of high-level operators
* @param tid thread id
* @param et execution type
* @return list of instructions
* @throws DMLRuntimeException if DMLRuntimeException occurs
* @throws HopsException if HopsException occurs
* @throws LopsException if LopsException occurs
* @throws IOException if IOException occurs
*/ | D) Recompile predicate hop DAG (single root), but forced to CP. This happens always 'inplace', without statistics updates, and without dynamic rewrites | recompileHopsDag2Forced | {
"repo_name": "asurve/incubator-systemml",
"path": "src/main/java/org/apache/sysml/hops/recompile/Recompiler.java",
"license": "apache-2.0",
"size": 69505
} | [
"java.io.IOException",
"java.util.ArrayList",
"org.apache.sysml.conf.ConfigurationManager",
"org.apache.sysml.hops.Hop",
"org.apache.sysml.hops.HopsException",
"org.apache.sysml.hops.OptimizerUtils",
"org.apache.sysml.lops.Lop",
"org.apache.sysml.lops.LopProperties",
"org.apache.sysml.lops.LopsExcep... | import java.io.IOException; import java.util.ArrayList; import org.apache.sysml.conf.ConfigurationManager; import org.apache.sysml.hops.Hop; import org.apache.sysml.hops.HopsException; import org.apache.sysml.hops.OptimizerUtils; import org.apache.sysml.lops.Lop; import org.apache.sysml.lops.LopProperties; import org.apache.sysml.lops.LopsException; import org.apache.sysml.lops.compile.Dag; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.parfor.ProgramConverter; import org.apache.sysml.runtime.instructions.Instruction; | import java.io.*; import java.util.*; import org.apache.sysml.conf.*; import org.apache.sysml.hops.*; import org.apache.sysml.lops.*; import org.apache.sysml.lops.compile.*; import org.apache.sysml.runtime.*; import org.apache.sysml.runtime.controlprogram.parfor.*; import org.apache.sysml.runtime.instructions.*; | [
"java.io",
"java.util",
"org.apache.sysml"
] | java.io; java.util; org.apache.sysml; | 975,753 |
private void output(String string) throws IOException {
int length = string.length();
if (tempChars == null || tempChars.length < length) {
tempChars = new char[length];
}
string.getChars(0, length, tempChars, 0);
super.output(tempChars, 0, length);
}
class OptionListModel extends DefaultListModel implements ListSelectionModel, Serializable {
private static final int MIN = -1;
private static final int MAX = Integer.MAX_VALUE;
private int selectionMode = SINGLE_SELECTION;
private int minIndex = MAX;
private int maxIndex = MIN;
private int anchorIndex = -1;
private int leadIndex = -1;
private int firstChangedIndex = MAX;
private int lastChangedIndex = MIN;
private boolean isAdjusting = false;
private BitSet value = new BitSet(32);
private BitSet initialValue = new BitSet(32);
protected EventListenerList listenerList = new EventListenerList();
protected boolean leadAnchorNotificationEnabled = true;
| void function(String string) throws IOException { int length = string.length(); if (tempChars == null tempChars.length < length) { tempChars = new char[length]; } string.getChars(0, length, tempChars, 0); super.output(tempChars, 0, length); } class OptionListModel extends DefaultListModel implements ListSelectionModel, Serializable { private static final int MIN = -1; private static final int MAX = Integer.MAX_VALUE; private int selectionMode = SINGLE_SELECTION; private int minIndex = MAX; private int maxIndex = MIN; private int anchorIndex = -1; private int leadIndex = -1; private int firstChangedIndex = MAX; private int lastChangedIndex = MIN; private boolean isAdjusting = false; private BitSet value = new BitSet(32); private BitSet initialValue = new BitSet(32); protected EventListenerList listenerList = new EventListenerList(); protected boolean leadAnchorNotificationEnabled = true; | /**
* This directly invokes super's <code>output</code> after converting
* <code>string</code> to a char[].
*/ | This directly invokes super's <code>output</code> after converting <code>string</code> to a char[] | output | {
"repo_name": "cst316/spring16project-Team-Flagstaff",
"path": "src/net/sf/memoranda/ui/htmleditor/AltHTMLWriter.java",
"license": "gpl-2.0",
"size": 84375
} | [
"java.io.IOException",
"java.io.Serializable",
"java.util.BitSet",
"javax.swing.DefaultListModel",
"javax.swing.ListSelectionModel",
"javax.swing.event.EventListenerList"
] | import java.io.IOException; import java.io.Serializable; import java.util.BitSet; import javax.swing.DefaultListModel; import javax.swing.ListSelectionModel; import javax.swing.event.EventListenerList; | import java.io.*; import java.util.*; import javax.swing.*; import javax.swing.event.*; | [
"java.io",
"java.util",
"javax.swing"
] | java.io; java.util; javax.swing; | 482,758 |
@SafeVarargs
final List<V> get(Object... keyComponentArray) {
return get(new KeyComponentArray(keyComponentArray));
}
| final List<V> get(Object... keyComponentArray) { return get(new KeyComponentArray(keyComponentArray)); } | /**
* Invoked to get all values with composite-key matching the submitted
* keyComponentArray.
*
* @param keyComponentArray array of key objects.
* @return all values with composite-key matching the submitted keyComponentArray
*/ | Invoked to get all values with composite-key matching the submitted keyComponentArray | get | {
"repo_name": "dvimont/OrderedSet",
"path": "src/main/java/org/commonvox/collections/MapNode.java",
"license": "apache-2.0",
"size": 25679
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,466,414 |
public static void main(String argv[]) throws Exception {
StringUtils.startupShutdownMessage(TaskTracker.class, argv, LOG);
try {
if (argv.length == 0) {
JobConf conf = new JobConf();
ReflectionUtils.setContentionTracing
(conf.getBoolean("tasktracker.contention.tracking", false));
new TaskTracker(conf).run();
return;
}
if ("-instance".equals(argv[0]) && argv.length == 2) {
int instance = Integer.parseInt(argv[1]);
if (instance == 0 || instance == 1) {
JobConf conf = new JobConf();
JobConf.overrideConfiguration(conf, instance);
// enable the server to track time spent waiting on locks
ReflectionUtils.setContentionTracing
(conf.getBoolean("tasktracker.contention.tracking", false));
new TaskTracker(conf).run();
return;
}
}
System.out.println("usage: TaskTracker [-instance <0|1>]");
System.exit(-1);
} catch (Throwable e) {
LOG.error("Can not start task tracker because "+
StringUtils.stringifyException(e));
System.exit(-1);
}
} | static void function(String argv[]) throws Exception { StringUtils.startupShutdownMessage(TaskTracker.class, argv, LOG); try { if (argv.length == 0) { JobConf conf = new JobConf(); ReflectionUtils.setContentionTracing (conf.getBoolean(STR, false)); new TaskTracker(conf).run(); return; } if (STR.equals(argv[0]) && argv.length == 2) { int instance = Integer.parseInt(argv[1]); if (instance == 0 instance == 1) { JobConf conf = new JobConf(); JobConf.overrideConfiguration(conf, instance); ReflectionUtils.setContentionTracing (conf.getBoolean(STR, false)); new TaskTracker(conf).run(); return; } } System.out.println(STR); System.exit(-1); } catch (Throwable e) { LOG.error(STR+ StringUtils.stringifyException(e)); System.exit(-1); } } | /**
* Start the TaskTracker, point toward the indicated JobTracker
*/ | Start the TaskTracker, point toward the indicated JobTracker | main | {
"repo_name": "rvadali/fb-raid-refactoring",
"path": "src/mapred/org/apache/hadoop/mapred/TaskTracker.java",
"license": "apache-2.0",
"size": 135755
} | [
"org.apache.hadoop.util.ReflectionUtils",
"org.apache.hadoop.util.StringUtils"
] | import org.apache.hadoop.util.ReflectionUtils; import org.apache.hadoop.util.StringUtils; | import org.apache.hadoop.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,677,866 |
public static Writer createWriter(final Configuration conf, final FileSystem fs, final Path path,
final boolean overwritable, long blocksize) throws IOException {
// Configuration already does caching for the Class lookup.
Class<? extends Writer> logWriterClass =
conf.getClass("hbase.regionserver.hlog.writer.impl", ProtobufLogWriter.class,
Writer.class);
Writer writer = null;
try {
writer = logWriterClass.getDeclaredConstructor().newInstance();
FileSystem rootFs = FileSystem.get(path.toUri(), conf);
writer.init(rootFs, path, conf, overwritable, blocksize);
return writer;
} catch (Exception e) {
if (e instanceof CommonFSUtils.StreamLacksCapabilityException) {
LOG.error("The RegionServer write ahead log provider for FileSystem implementations " +
"relies on the ability to call " + e.getMessage() + " for proper operation during " +
"component failures, but the current FileSystem does not support doing so. Please " +
"check the config value of '" + CommonFSUtils.HBASE_WAL_DIR + "' and ensure " +
"it points to a FileSystem mount that has suitable capabilities for output streams.");
} else {
LOG.debug("Error instantiating log writer.", e);
}
if (writer != null) {
try{
writer.close();
} catch(IOException ee){
LOG.error("cannot close log writer", ee);
}
}
throw new IOException("cannot get log writer", e);
}
} | static Writer function(final Configuration conf, final FileSystem fs, final Path path, final boolean overwritable, long blocksize) throws IOException { Class<? extends Writer> logWriterClass = conf.getClass(STR, ProtobufLogWriter.class, Writer.class); Writer writer = null; try { writer = logWriterClass.getDeclaredConstructor().newInstance(); FileSystem rootFs = FileSystem.get(path.toUri(), conf); writer.init(rootFs, path, conf, overwritable, blocksize); return writer; } catch (Exception e) { if (e instanceof CommonFSUtils.StreamLacksCapabilityException) { LOG.error(STR + STR + e.getMessage() + STR + STR + STR + CommonFSUtils.HBASE_WAL_DIR + STR + STR); } else { LOG.debug(STR, e); } if (writer != null) { try{ writer.close(); } catch(IOException ee){ LOG.error(STR, ee); } } throw new IOException(STR, e); } } | /**
* Public because of FSHLog. Should be package-private
*/ | Public because of FSHLog. Should be package-private | createWriter | {
"repo_name": "HubSpot/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/wal/FSHLogProvider.java",
"license": "apache-2.0",
"size": 4914
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.regionserver.wal.ProtobufLogWriter",
"org.apache.hadoop.hbase.util.CommonFSUtils"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.regionserver.wal.ProtobufLogWriter; import org.apache.hadoop.hbase.util.CommonFSUtils; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.regionserver.wal.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,767,712 |
private ExecRow getRowFromHashTable(int position)
throws StandardException
{
// Get the row from the hash table
positionInHashTable.setValue(position);
DataValueDescriptor[] hashRowArray = getCurrentRowFromHashtable();
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(hashRowArray != null,
"hashRowArray expected to be non-null");
}
// Copy out the Object[] without the position.
DataValueDescriptor[] resultRowArray = new
DataValueDescriptor[hashRowArray.length - extraColumns];
System.arraycopy(hashRowArray, extraColumns, resultRowArray, 0,
resultRowArray.length);
resultRow.setRowArray(resultRowArray);
// Reset the current position to the user position
currentPosition = position;
numFromHashTable++;
if (resultRow != null)
{
beforeFirst = false;
afterLast = false;
}
if (isForUpdate()) {
RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION];
// Keep source and target with the same currentRow
((NoPutResultSet)target).setCurrentRow(resultRow);
((NoPutResultSet)target).positionScanAtRowLocation(rowLoc);
needsRepositioning = true;
}
setCurrentRow(resultRow);
return resultRow;
}
| ExecRow function(int position) throws StandardException { positionInHashTable.setValue(position); DataValueDescriptor[] hashRowArray = getCurrentRowFromHashtable(); if (SanityManager.DEBUG) { SanityManager.ASSERT(hashRowArray != null, STR); } DataValueDescriptor[] resultRowArray = new DataValueDescriptor[hashRowArray.length - extraColumns]; System.arraycopy(hashRowArray, extraColumns, resultRowArray, 0, resultRowArray.length); resultRow.setRowArray(resultRowArray); currentPosition = position; numFromHashTable++; if (resultRow != null) { beforeFirst = false; afterLast = false; } if (isForUpdate()) { RowLocation rowLoc = (RowLocation) hashRowArray[POS_ROWLOCATION]; ((NoPutResultSet)target).setCurrentRow(resultRow); ((NoPutResultSet)target).positionScanAtRowLocation(rowLoc); needsRepositioning = true; } setCurrentRow(resultRow); return resultRow; } | /**
* Get the row at the specified position
* from the hash table.
*
* @param position The specified position.
*
* @return The row at that position.
*
* @exception StandardException thrown on failure
*/ | Get the row at the specified position from the hash table | getRowFromHashTable | {
"repo_name": "scnakandala/derby",
"path": "java/engine/org/apache/derby/impl/sql/execute/ScrollInsensitiveResultSet.java",
"license": "apache-2.0",
"size": 33262
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.sql.execute.ExecRow",
"org.apache.derby.iapi.sql.execute.NoPutResultSet",
"org.apache.derby.iapi.types.DataValueDescriptor",
"org.apache.derby.iapi.types.RowLocation",
"org.apache.derby.shared.common.sanity.SanityManager"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.sql.execute.ExecRow; import org.apache.derby.iapi.sql.execute.NoPutResultSet; import org.apache.derby.iapi.types.DataValueDescriptor; import org.apache.derby.iapi.types.RowLocation; import org.apache.derby.shared.common.sanity.SanityManager; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.sql.execute.*; import org.apache.derby.iapi.types.*; import org.apache.derby.shared.common.sanity.*; | [
"org.apache.derby"
] | org.apache.derby; | 12,986 |
private void writeRequests() throws IOException
{
if (!setRequests)
{
if (!failedOnce)
{
requests.prepend(method + " " + http.getURLFile() + " " + HTTP_VERSION, null);
}
if (!getUseCaches())
{
requests.setIfNotSet("Cache-Control", "no-cache");
requests.setIfNotSet("Pragma", "no-cache");
}
requests.setIfNotSet("User-Agent", userAgent);
final int port = url.getPort();
String host = url.getHost();
if (port != -1 && port != url.getDefaultPort())
{
host += ":" + String.valueOf(port);
}
requests.setIfNotSet("Host", host);
requests.setIfNotSet("Accept", ACCEPT_STRING);
// Try keep-alive only on first attempt
if (!failedOnce && http.getHttpKeepAliveSet())
{
requests.setIfNotSet("Connection", "keep-alive");
}
else
{
requests.setIfNotSet("Connection", "close");
}
// Set modified since if necessary
final long modTime = getIfModifiedSince();
if (modTime != 0)
{
final Date date = new Date(modTime);
// use the preferred date format according to RFC 2068(HTTP1.1),
// RFC 822 and RFC 1123
final SimpleDateFormat fo = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", Locale.US);
fo.setTimeZone(TimeZone.getTimeZone("GMT"));
requests.setIfNotSet("If-Modified-Since", fo.format(date));
}
// check for preemptive authorization
final AuthenticationInfo sauth = AuthenticationInfo.getServerAuth(url);
if (sauth != null && sauth.supportsPreemptiveAuthorization())
{
// Sets "Authorization"
requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url, method));
currentServerCredentials = sauth;
}
if (!method.equals("PUT") && (poster != null || streaming()))
{
requests.setIfNotSet("Content-type", "application/x-www-form-urlencoded");
}
if (streaming())
{
if (chunkLength != -1)
{
requests.set("Transfer-Encoding", "chunked");
}
else
{
if (fixedContentLengthLong != -1)
{
requests.set("Content-Length", String.valueOf(fixedContentLengthLong));
}
else if (fixedContentLength != -1)
{
requests.set("Content-Length", String.valueOf(fixedContentLength));
}
}
}
else if (poster != null)
{
synchronized (poster)
{
poster.close();
requests.set("Content-Length", String.valueOf(poster.size()));
}
}
// get applicable cookies based on the uri and request headers
// add them to the existing request headers
setCookieHeader();
setRequests = true;
}
if (logger.isDebugEnabled())
{
logger.debug(requests.toString());
}
http.writeRequests(requests, poster);
if (ps.checkError())
{
final String proxyHost = http.getProxyHostUsed();
final int proxyPort = http.getProxyPortUsed();
disconnectInternal();
if (failedOnce)
{
throw new IOException("Error writing to server");
}
else
{ // try once more
failedOnce = true;
if (proxyHost != null)
{
setProxiedClient(url, proxyHost, proxyPort);
}
else
{
setNewClient(url);
}
ps = (PrintStream) http.getOutputStream();
connected = true;
responses = new MessageHeader();
setRequests = false;
writeRequests();
}
}
} | void function() throws IOException { if (!setRequests) { if (!failedOnce) { requests.prepend(method + " " + http.getURLFile() + " " + HTTP_VERSION, null); } if (!getUseCaches()) { requests.setIfNotSet(STR, STR); requests.setIfNotSet(STR, STR); } requests.setIfNotSet(STR, userAgent); final int port = url.getPort(); String host = url.getHost(); if (port != -1 && port != url.getDefaultPort()) { host += ":" + String.valueOf(port); } requests.setIfNotSet("Host", host); requests.setIfNotSet(STR, ACCEPT_STRING); if (!failedOnce && http.getHttpKeepAliveSet()) { requests.setIfNotSet(STR, STR); } else { requests.setIfNotSet(STR, "close"); } final long modTime = getIfModifiedSince(); if (modTime != 0) { final Date date = new Date(modTime); final SimpleDateFormat fo = new SimpleDateFormat(STR, Locale.US); fo.setTimeZone(TimeZone.getTimeZone("GMT")); requests.setIfNotSet(STR, fo.format(date)); } final AuthenticationInfo sauth = AuthenticationInfo.getServerAuth(url); if (sauth != null && sauth.supportsPreemptiveAuthorization()) { requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url, method)); currentServerCredentials = sauth; } if (!method.equals("PUT") && (poster != null streaming())) { requests.setIfNotSet(STR, STR); } if (streaming()) { if (chunkLength != -1) { requests.set(STR, STR); } else { if (fixedContentLengthLong != -1) { requests.set(STR, String.valueOf(fixedContentLengthLong)); } else if (fixedContentLength != -1) { requests.set(STR, String.valueOf(fixedContentLength)); } } } else if (poster != null) { synchronized (poster) { poster.close(); requests.set(STR, String.valueOf(poster.size())); } } setCookieHeader(); setRequests = true; } if (logger.isDebugEnabled()) { logger.debug(requests.toString()); } http.writeRequests(requests, poster); if (ps.checkError()) { final String proxyHost = http.getProxyHostUsed(); final int proxyPort = http.getProxyPortUsed(); disconnectInternal(); if (failedOnce) { throw new IOException(STR); } else { failedOnce = true; if (proxyHost != null) { setProxiedClient(url, proxyHost, proxyPort); } else { setNewClient(url); } ps = (PrintStream) http.getOutputStream(); connected = true; responses = new MessageHeader(); setRequests = false; writeRequests(); } } } | /**
* adds the standard key/val pairs to reqests if necessary & write to given
* PrintStream.
*/ | adds the standard key/val pairs to reqests if necessary & write to given PrintStream | writeRequests | {
"repo_name": "rovemonteux/silvertunnel-monteux",
"path": "src/main/java/cf/monteux/silvertunnel/netlib/adapter/url/impl/net/http/HttpURLConnection.java",
"license": "lgpl-3.0",
"size": 91765
} | [
"java.io.IOException",
"java.io.PrintStream",
"java.text.SimpleDateFormat",
"java.util.Date",
"java.util.Locale",
"java.util.TimeZone"
] | import java.io.IOException; import java.io.PrintStream; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; import java.util.TimeZone; | import java.io.*; import java.text.*; import java.util.*; | [
"java.io",
"java.text",
"java.util"
] | java.io; java.text; java.util; | 2,045,844 |
public List<HashMap<String, String>> getFields(String moduleId) {
List<HashMap<String, String>> fields = new ArrayList<>();
JSONObject moduleData = (JSONObject) ((JSONObject) data.get("fields")).get(moduleId);
for (Object key : moduleData.keySet()) {
HashMap<String, String> properties = (HashMap<String, String>) moduleData.get(key);
fields.add(properties);
}
return fields;
} | List<HashMap<String, String>> function(String moduleId) { List<HashMap<String, String>> fields = new ArrayList<>(); JSONObject moduleData = (JSONObject) ((JSONObject) data.get(STR)).get(moduleId); for (Object key : moduleData.keySet()) { HashMap<String, String> properties = (HashMap<String, String>) moduleData.get(key); fields.add(properties); } return fields; } | /**
* returns the list of modules
*
* @param moduleId
* @return
*/ | returns the list of modules | getFields | {
"repo_name": "CognizantQAHub/Cognizant-Intelligent-Test-Scripter",
"path": "IDE/src/main/java/com/cognizant/cognizantits/ide/main/explorer/settings/ReportingModuleSettings.java",
"license": "apache-2.0",
"size": 4901
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List",
"org.json.simple.JSONObject"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.simple.JSONObject; | import java.util.*; import org.json.simple.*; | [
"java.util",
"org.json.simple"
] | java.util; org.json.simple; | 2,332,586 |
@Schema(required = true, description = "Set `true` to enable encryption for this customer")
public Boolean isEnableCustomerEncryption() {
return enableCustomerEncryption;
} | @Schema(required = true, description = STR) Boolean function() { return enableCustomerEncryption; } | /**
* Set `true` to enable encryption for this customer
* @return enableCustomerEncryption
**/ | Set `true` to enable encryption for this customer | isEnableCustomerEncryption | {
"repo_name": "iterate-ch/cyberduck",
"path": "dracoon/src/main/java/ch/cyberduck/core/sds/io/swagger/client/model/EnableCustomerEncryptionRequest.java",
"license": "gpl-3.0",
"size": 4187
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 256,998 |
public double nextWeibull(double shape, double scale) throws NotStrictlyPositiveException {
return new WeibullDistribution(getRan(), shape, scale,
WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample();
}
/**
* Generates a random value from the {@link ZipfDistribution Zipf Distribution}.
*
* @param numberOfElements the number of elements of the ZipfDistribution
* @param exponent the exponent of the ZipfDistribution
* @return random value sampled from the Zipf(numberOfElements, exponent) distribution
* @exception NotStrictlyPositiveException if {@code numberOfElements <= 0} | double function(double shape, double scale) throws NotStrictlyPositiveException { return new WeibullDistribution(getRan(), shape, scale, WeibullDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY).sample(); } /** * Generates a random value from the {@link ZipfDistribution Zipf Distribution}. * * @param numberOfElements the number of elements of the ZipfDistribution * @param exponent the exponent of the ZipfDistribution * @return random value sampled from the Zipf(numberOfElements, exponent) distribution * @exception NotStrictlyPositiveException if {@code numberOfElements <= 0} | /**
* Generates a random value from the {@link WeibullDistribution Weibull Distribution}.
*
* @param shape the shape parameter of the Weibull distribution
* @param scale the scale parameter of the Weibull distribution
* @return random value sampled from the Weibull(shape, size) distribution
* @throws NotStrictlyPositiveException if {@code shape <= 0} or
* {@code scale <= 0}.
*/ | Generates a random value from the <code>WeibullDistribution Weibull Distribution</code> | nextWeibull | {
"repo_name": "charles-cooper/idylfin",
"path": "src/org/apache/commons/math3/random/RandomDataGenerator.java",
"license": "apache-2.0",
"size": 31656
} | [
"org.apache.commons.math3.distribution.WeibullDistribution",
"org.apache.commons.math3.distribution.ZipfDistribution",
"org.apache.commons.math3.exception.NotStrictlyPositiveException"
] | import org.apache.commons.math3.distribution.WeibullDistribution; import org.apache.commons.math3.distribution.ZipfDistribution; import org.apache.commons.math3.exception.NotStrictlyPositiveException; | import org.apache.commons.math3.distribution.*; import org.apache.commons.math3.exception.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,509,288 |
protected void configureViewResolvers(ViewResolverRegistry registry) {
}
private static final class EmptyHandlerMapping extends AbstractHandlerMapping { | void function(ViewResolverRegistry registry) { } private static final class EmptyHandlerMapping extends AbstractHandlerMapping { | /**
* Override this method to configure view resolution.
* @see ViewResolverRegistry
*/ | Override this method to configure view resolution | configureViewResolvers | {
"repo_name": "qobel/esoguproject",
"path": "spring-framework/spring-webmvc/src/main/java/org/springframework/web/servlet/config/annotation/WebMvcConfigurationSupport.java",
"license": "apache-2.0",
"size": 35035
} | [
"org.springframework.web.servlet.handler.AbstractHandlerMapping"
] | import org.springframework.web.servlet.handler.AbstractHandlerMapping; | import org.springframework.web.servlet.handler.*; | [
"org.springframework.web"
] | org.springframework.web; | 1,135,412 |
@Test
public void testLedgerMetadataContainsHostNameAsBookieID()
throws Exception {
stopBKCluster();
bkc = new BookKeeperTestClient(baseClientConf);
// start bookie with useHostNameAsBookieID=false, as old bookie
ServerConfiguration serverConf1 = newServerConfiguration();
// start 2 more bookies with useHostNameAsBookieID=true
ServerConfiguration serverConf2 = newServerConfiguration();
serverConf2.setUseHostNameAsBookieID(true);
ServerConfiguration serverConf3 = newServerConfiguration();
serverConf3.setUseHostNameAsBookieID(true);
startAndAddBookie(serverConf1);
startAndAddBookie(serverConf2);
startAndAddBookie(serverConf3);
List<LedgerHandle> listOfLedgerHandle = createLedgersAndAddEntries(1, 5);
LedgerHandle lh = listOfLedgerHandle.get(0);
int ledgerReplicaIndex = 0;
final SortedMap<Long, ? extends List<BookieId>> ensembles = lh.getLedgerMetadata().getAllEnsembles();
final List<BookieId> bkAddresses = ensembles.get(0L);
BookieId replicaToKillAddr = bkAddresses.get(0);
for (BookieId bookieSocketAddress : bkAddresses) {
if (isCreatedFromIp(bookieSocketAddress)) {
replicaToKillAddr = bookieSocketAddress;
LOG.info("Kill bookie which has registered using ipaddress");
break;
}
}
final String urLedgerZNode = getUrLedgerZNode(lh);
ledgerReplicaIndex = getReplicaIndexInLedger(lh, replicaToKillAddr);
CountDownLatch latch = new CountDownLatch(1);
assertNull("UrLedger already exists!",
watchUrLedgerNode(urLedgerZNode, latch));
LOG.info("Killing Bookie :" + replicaToKillAddr);
killBookie(replicaToKillAddr);
// waiting to publish urLedger znode by Auditor
latch.await();
latch = new CountDownLatch(1);
LOG.info("Watching on urLedgerPath:" + urLedgerZNode
+ " to know the status of rereplication process");
assertNotNull("UrLedger doesn't exists!",
watchUrLedgerNode(urLedgerZNode, latch));
// creates new bkclient
bkc = new BookKeeperTestClient(baseClientConf);
// starting the replication service, so that he will be able to act as
// target bookie
ServerConfiguration serverConf = newServerConfiguration();
serverConf.setUseHostNameAsBookieID(true);
startAndAddBookie(serverConf);
int newBookieIndex = lastBookieIndex();
BookieServer newBookieServer = serverByIndex(newBookieIndex);
LOG.debug("Waiting to finish the replication of failed bookie : "
+ replicaToKillAddr);
latch.await();
// grace period to update the urledger metadata in zookeeper
LOG.info("Waiting to update the urledger metadata in zookeeper");
verifyLedgerEnsembleMetadataAfterReplication(newBookieServer,
listOfLedgerHandle.get(0), ledgerReplicaIndex);
} | void function() throws Exception { stopBKCluster(); bkc = new BookKeeperTestClient(baseClientConf); ServerConfiguration serverConf1 = newServerConfiguration(); ServerConfiguration serverConf2 = newServerConfiguration(); serverConf2.setUseHostNameAsBookieID(true); ServerConfiguration serverConf3 = newServerConfiguration(); serverConf3.setUseHostNameAsBookieID(true); startAndAddBookie(serverConf1); startAndAddBookie(serverConf2); startAndAddBookie(serverConf3); List<LedgerHandle> listOfLedgerHandle = createLedgersAndAddEntries(1, 5); LedgerHandle lh = listOfLedgerHandle.get(0); int ledgerReplicaIndex = 0; final SortedMap<Long, ? extends List<BookieId>> ensembles = lh.getLedgerMetadata().getAllEnsembles(); final List<BookieId> bkAddresses = ensembles.get(0L); BookieId replicaToKillAddr = bkAddresses.get(0); for (BookieId bookieSocketAddress : bkAddresses) { if (isCreatedFromIp(bookieSocketAddress)) { replicaToKillAddr = bookieSocketAddress; LOG.info(STR); break; } } final String urLedgerZNode = getUrLedgerZNode(lh); ledgerReplicaIndex = getReplicaIndexInLedger(lh, replicaToKillAddr); CountDownLatch latch = new CountDownLatch(1); assertNull(STR, watchUrLedgerNode(urLedgerZNode, latch)); LOG.info(STR + replicaToKillAddr); killBookie(replicaToKillAddr); latch.await(); latch = new CountDownLatch(1); LOG.info(STR + urLedgerZNode + STR); assertNotNull(STR, watchUrLedgerNode(urLedgerZNode, latch)); bkc = new BookKeeperTestClient(baseClientConf); ServerConfiguration serverConf = newServerConfiguration(); serverConf.setUseHostNameAsBookieID(true); startAndAddBookie(serverConf); int newBookieIndex = lastBookieIndex(); BookieServer newBookieServer = serverByIndex(newBookieIndex); LOG.debug(STR + replicaToKillAddr); latch.await(); LOG.info(STR); verifyLedgerEnsembleMetadataAfterReplication(newBookieServer, listOfLedgerHandle.get(0), ledgerReplicaIndex); } | /**
* Test verifies bookie recovery, the host (recorded via useHostName in
* ledgermetadata).
*/ | Test verifies bookie recovery, the host (recorded via useHostName in ledgermetadata) | testLedgerMetadataContainsHostNameAsBookieID | {
"repo_name": "apache/bookkeeper",
"path": "bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieAutoRecoveryTest.java",
"license": "apache-2.0",
"size": 26610
} | [
"java.util.List",
"java.util.SortedMap",
"java.util.concurrent.CountDownLatch",
"org.apache.bookkeeper.client.BookKeeperTestClient",
"org.apache.bookkeeper.client.LedgerHandle",
"org.apache.bookkeeper.conf.ServerConfiguration",
"org.apache.bookkeeper.net.BookieId",
"org.apache.bookkeeper.proto.BookieS... | import java.util.List; import java.util.SortedMap; import java.util.concurrent.CountDownLatch; import org.apache.bookkeeper.client.BookKeeperTestClient; import org.apache.bookkeeper.client.LedgerHandle; import org.apache.bookkeeper.conf.ServerConfiguration; import org.apache.bookkeeper.net.BookieId; import org.apache.bookkeeper.proto.BookieServer; import org.junit.Assert; | import java.util.*; import java.util.concurrent.*; import org.apache.bookkeeper.client.*; import org.apache.bookkeeper.conf.*; import org.apache.bookkeeper.net.*; import org.apache.bookkeeper.proto.*; import org.junit.*; | [
"java.util",
"org.apache.bookkeeper",
"org.junit"
] | java.util; org.apache.bookkeeper; org.junit; | 2,549,122 |
public Properties getJaxRpcServiceProperties() {
return this.jaxRpcServiceProperties;
}
| Properties function() { return this.jaxRpcServiceProperties; } | /**
* Return JAX-RPC service properties to be passed to the ServiceFactory, if any.
*/ | Return JAX-RPC service properties to be passed to the ServiceFactory, if any | getJaxRpcServiceProperties | {
"repo_name": "codeApeFromChina/resource",
"path": "frame_packages/java_libs/spring-2.5.6-src/src/org/springframework/remoting/jaxrpc/LocalJaxRpcServiceFactory.java",
"license": "unlicense",
"size": 11175
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 2,666,452 |
@SuppressWarnings(value="unchecked")
public int compare(Object o1, Object o2, Schema s) {
if (o1 == o2) return 0;
switch (s.getType()) {
case RECORD:
for (Field f : s.getFields()) {
if (f.order() == Field.Order.IGNORE)
continue; // ignore this field
int pos = f.pos();
String name = f.name();
int compare =
compare(getField(o1, name, pos), getField(o2, name, pos), f.schema());
if (compare != 0) // not equal
return f.order() == Field.Order.DESCENDING ? -compare : compare;
}
return 0;
case ENUM:
return s.getEnumOrdinal(o1.toString()) - s.getEnumOrdinal(o2.toString());
case ARRAY:
Collection a1 = (Collection)o1;
Collection a2 = (Collection)o2;
Iterator e1 = a1.iterator();
Iterator e2 = a2.iterator();
Schema elementType = s.getElementType();
while(e1.hasNext() && e2.hasNext()) {
int compare = compare(e1.next(), e2.next(), elementType);
if (compare != 0) return compare;
}
return e1.hasNext() ? 1 : (e2.hasNext() ? -1 : 0);
case MAP:
throw new AvroRuntimeException("Can't compare maps!");
case UNION:
int i1 = resolveUnion(s, o1);
int i2 = resolveUnion(s, o2);
return (i1 == i2)
? compare(o1, o2, s.getTypes().get(i1))
: i1 - i2;
case NULL:
return 0;
case STRING:
Utf8 u1 = o1 instanceof Utf8 ? (Utf8)o1 : new Utf8(o1.toString());
Utf8 u2 = o2 instanceof Utf8 ? (Utf8)o2 : new Utf8(o2.toString());
return u1.compareTo(u2);
default:
return ((Comparable)o1).compareTo(o2);
}
} | @SuppressWarnings(value=STR) int function(Object o1, Object o2, Schema s) { if (o1 == o2) return 0; switch (s.getType()) { case RECORD: for (Field f : s.getFields()) { if (f.order() == Field.Order.IGNORE) continue; int pos = f.pos(); String name = f.name(); int compare = compare(getField(o1, name, pos), getField(o2, name, pos), f.schema()); if (compare != 0) return f.order() == Field.Order.DESCENDING ? -compare : compare; } return 0; case ENUM: return s.getEnumOrdinal(o1.toString()) - s.getEnumOrdinal(o2.toString()); case ARRAY: Collection a1 = (Collection)o1; Collection a2 = (Collection)o2; Iterator e1 = a1.iterator(); Iterator e2 = a2.iterator(); Schema elementType = s.getElementType(); while(e1.hasNext() && e2.hasNext()) { int compare = compare(e1.next(), e2.next(), elementType); if (compare != 0) return compare; } return e1.hasNext() ? 1 : (e2.hasNext() ? -1 : 0); case MAP: throw new AvroRuntimeException(STR); case UNION: int i1 = resolveUnion(s, o1); int i2 = resolveUnion(s, o2); return (i1 == i2) ? compare(o1, o2, s.getTypes().get(i1)) : i1 - i2; case NULL: return 0; case STRING: Utf8 u1 = o1 instanceof Utf8 ? (Utf8)o1 : new Utf8(o1.toString()); Utf8 u2 = o2 instanceof Utf8 ? (Utf8)o2 : new Utf8(o2.toString()); return u1.compareTo(u2); default: return ((Comparable)o1).compareTo(o2); } } | /** Compare objects according to their schema. If equal, return zero. If
* greater-than, return 1, if less than return -1. Order is consistent with
* that of {@link BinaryData#compare(byte[], int, byte[], int, Schema)}.
*/ | Compare objects according to their schema. If equal, return zero. If greater-than, return 1, if less than return -1. Order is consistent with that of <code>BinaryData#compare(byte[], int, byte[], int, Schema)</code> | compare | {
"repo_name": "cloudera/avro",
"path": "lang/java/avro/src/main/java/org/apache/avro/generic/GenericData.java",
"license": "apache-2.0",
"size": 21455
} | [
"java.util.Collection",
"java.util.Iterator",
"org.apache.avro.AvroRuntimeException",
"org.apache.avro.Schema",
"org.apache.avro.util.Utf8"
] | import java.util.Collection; import java.util.Iterator; import org.apache.avro.AvroRuntimeException; import org.apache.avro.Schema; import org.apache.avro.util.Utf8; | import java.util.*; import org.apache.avro.*; import org.apache.avro.util.*; | [
"java.util",
"org.apache.avro"
] | java.util; org.apache.avro; | 1,288,939 |
public void testWarningLevel0() {
ForteCCCompiler compiler = ForteCCCompiler.getInstance();
Vector args = new Vector();
compiler.addWarningSwitch(args, 0);
assertEquals(1, args.size());
assertEquals("-w", args.elementAt(0));
} | void function() { ForteCCCompiler compiler = ForteCCCompiler.getInstance(); Vector args = new Vector(); compiler.addWarningSwitch(args, 0); assertEquals(1, args.size()); assertEquals("-w", args.elementAt(0)); } | /**
* Tests command line switches for warning = 0
*/ | Tests command line switches for warning = 0 | testWarningLevel0 | {
"repo_name": "maven-nar/cpptasks-parallel",
"path": "src/test/java/com/github/maven_nar/cpptasks/sun/TestForteCCCompiler.java",
"license": "apache-2.0",
"size": 4817
} | [
"com.github.maven_nar.cpptasks.sun.ForteCCCompiler",
"java.util.Vector"
] | import com.github.maven_nar.cpptasks.sun.ForteCCCompiler; import java.util.Vector; | import com.github.maven_nar.cpptasks.sun.*; import java.util.*; | [
"com.github.maven_nar",
"java.util"
] | com.github.maven_nar; java.util; | 1,007,139 |
public static <E> Counter<E> divisionNonNaN(Counter<E> c1, Counter<E> c2) {
Counter<E> result = c1.getFactory().create();
for (E key : Sets.union(c1.keySet(), c2.keySet())) {
if(c2.getCount(key) != 0)
result.setCount(key, c1.getCount(key) / c2.getCount(key));
}
return result;
} | static <E> Counter<E> function(Counter<E> c1, Counter<E> c2) { Counter<E> result = c1.getFactory().create(); for (E key : Sets.union(c1.keySet(), c2.keySet())) { if(c2.getCount(key) != 0) result.setCount(key, c1.getCount(key) / c2.getCount(key)); } return result; } | /**
* Returns c1 divided by c2. Safe - will not calculate scores for keys that are zero or that do not exist in c2
*
* @return c1 divided by c2.
*/ | Returns c1 divided by c2. Safe - will not calculate scores for keys that are zero or that do not exist in c2 | divisionNonNaN | {
"repo_name": "codev777/CoreNLP",
"path": "src/edu/stanford/nlp/stats/Counters.java",
"license": "gpl-2.0",
"size": 100293
} | [
"edu.stanford.nlp.util.Sets"
] | import edu.stanford.nlp.util.Sets; | import edu.stanford.nlp.util.*; | [
"edu.stanford.nlp"
] | edu.stanford.nlp; | 549,040 |
public static double[] calculateSunPositionLowTT(double Mjd_TT)
{
// Constants
final double eps = 23.43929111*AstroConst.Rad; // Obliquity of J2000 ecliptic
final double T = (Mjd_TT-AstroConst.MJD_J2000)/36525.0; // Julian cent. since J2000
// Variables
double L, M, r;
double[] r_Sun = new double[3];
// Mean anomaly, ecliptic longitude and radius
M = 2.0*Math.PI * MathUtils.Frac( 0.9931267 + 99.9973583*T); // [rad]
L = 2.0*Math.PI * MathUtils.Frac ( 0.7859444 + M/(2.0*Math.PI) +
(6892.0*Math.sin(M)+72.0*Math.sin(2.0*M)) / 1296.0e3); // [rad]
r = 149.619e9 - 2.499e9*Math.cos(M) - 0.021e9*Math.cos(2*M); // [m]
// Equatorial position vector
double[] temp = {r*Math.cos(L),r*Math.sin(L),0.0};
r_Sun = MathUtils.mult(MathUtils.R_x(-eps) , temp);
return r_Sun;
} // SunPositionLow
| static double[] function(double Mjd_TT) { final double eps = 23.43929111*AstroConst.Rad; final double T = (Mjd_TT-AstroConst.MJD_J2000)/36525.0; double L, M, r; double[] r_Sun = new double[3]; M = 2.0*Math.PI * MathUtils.Frac( 0.9931267 + 99.9973583*T); L = 2.0*Math.PI * MathUtils.Frac ( 0.7859444 + M/(2.0*Math.PI) + (6892.0*Math.sin(M)+72.0*Math.sin(2.0*M)) / 1296.0e3); r = 149.619e9 - 2.499e9*Math.cos(M) - 0.021e9*Math.cos(2*M); double[] temp = {r*Math.cos(L),r*Math.sin(L),0.0}; r_Sun = MathUtils.mult(MathUtils.R_x(-eps) , temp); return r_Sun; } | /**
* Computes the Sun's geocentric position using a low precision analytical series
*
* @param Mjd_TT Terrestrial Time (Modified Julian Date)
* @return Solar position vector [m] with respect to the mean equator and equinox of J2000 (EME2000, ICRF)
*/ | Computes the Sun's geocentric position using a low precision analytical series | calculateSunPositionLowTT | {
"repo_name": "AlexFalappa/hcc",
"path": "wwj-toolkit/src/main/java/name/gano/astro/bodies/Sun.java",
"license": "apache-2.0",
"size": 8421
} | [
"name.gano.astro.AstroConst",
"name.gano.astro.MathUtils"
] | import name.gano.astro.AstroConst; import name.gano.astro.MathUtils; | import name.gano.astro.*; | [
"name.gano.astro"
] | name.gano.astro; | 1,090,125 |
List<User> getAllUsers(String configName); | List<User> getAllUsers(String configName); | /**
* Returns a list of all users on the OpenMRS server. Configuration with the given {@code configName} will be used
* while performing this action.
*
* @param configName the name of the configuration
* @return the list of all users
*/ | Returns a list of all users on the OpenMRS server. Configuration with the given configName will be used while performing this action | getAllUsers | {
"repo_name": "wstrzelczyk/modules",
"path": "openmrs-19/src/main/java/org/motechproject/openmrs19/service/OpenMRSUserService.java",
"license": "bsd-3-clause",
"size": 4099
} | [
"java.util.List",
"org.motechproject.openmrs19.domain.User"
] | import java.util.List; import org.motechproject.openmrs19.domain.User; | import java.util.*; import org.motechproject.openmrs19.domain.*; | [
"java.util",
"org.motechproject.openmrs19"
] | java.util; org.motechproject.openmrs19; | 531,365 |
@Override
public InteractionResult handlePlayerInteraction(Player entityhuman, InteractionHand enumhand, ItemStack itemStack) {
if (super.handlePlayerInteraction(entityhuman, enumhand, itemStack).consumesAction()) {
return InteractionResult.CONSUME;
}
if (getOwner().equals(entityhuman) && itemStack != null) {
if (itemStack.getItem() == Items.SHEARS && getOwner().getPlayer().isSneaking() && canEquip()) {
boolean hadEquipment = false;
for (EquipmentSlot slot : EquipmentSlot.values()) {
ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(slot));
if (itemInSlot != null && itemInSlot.getItem() != Items.AIR) {
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot);
entityitem.pickupDelay = 10;
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0));
this.level.addFreshEntity(entityitem);
getMyPet().setEquipment(slot, null);
hadEquipment = true;
}
}
if (hadEquipment) {
if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) {
try {
itemStack.hurtAndBreak(1, entityhuman, (entityhuman1) -> entityhuman1.broadcastBreakEvent(enumhand));
} catch (Error e) {
// TODO REMOVE
itemStack.hurtAndBreak(1, entityhuman, (entityhuman1) -> {
try {
CompatManager.ENTITY_LIVING_broadcastItemBreak.invoke(entityhuman1, enumhand);
} catch (IllegalAccessException | InvocationTargetException ex) {
ex.printStackTrace();
}
});
}
}
}
return InteractionResult.CONSUME;
} else if (MyPetApi.getPlatformHelper().isEquipment(CraftItemStack.asBukkitCopy(itemStack)) && getOwner().getPlayer().isSneaking() && canEquip()) {
EquipmentSlot slot = EquipmentSlot.getSlotById(Mob.getEquipmentSlotForItem(itemStack).getFilterFlag());
if (slot == EquipmentSlot.MainHand) {
ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(slot));
if (itemInSlot != null && itemInSlot.getItem() != Items.AIR && itemInSlot != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) {
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot);
entityitem.pickupDelay = 10;
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0));
this.level.addFreshEntity(entityitem);
}
getMyPet().setEquipment(slot, CraftItemStack.asBukkitCopy(itemStack));
if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) {
itemStack.shrink(1);
if (itemStack.getCount() <= 0) {
entityhuman.getInventory().setItem(entityhuman.getInventory().selected, ItemStack.EMPTY);
}
}
return InteractionResult.CONSUME;
}
} else if (itemStack.getItem() instanceof BannerItem && getOwner().getPlayer().isSneaking() && canEquip()) {
ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(EquipmentSlot.Helmet));
if (itemInSlot != null && itemInSlot.getItem() != Items.AIR && itemInSlot != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) {
ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot);
entityitem.pickupDelay = 10;
entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0));
this.level.addFreshEntity(entityitem);
}
getMyPet().setEquipment(EquipmentSlot.Helmet, CraftItemStack.asBukkitCopy(itemStack));
if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) {
itemStack.shrink(1);
if (itemStack.getCount() <= 0) {
entityhuman.getInventory().setItem(entityhuman.getInventory().selected, ItemStack.EMPTY);
}
}
return InteractionResult.CONSUME;
}
}
return InteractionResult.PASS;
} | InteractionResult function(Player entityhuman, InteractionHand enumhand, ItemStack itemStack) { if (super.handlePlayerInteraction(entityhuman, enumhand, itemStack).consumesAction()) { return InteractionResult.CONSUME; } if (getOwner().equals(entityhuman) && itemStack != null) { if (itemStack.getItem() == Items.SHEARS && getOwner().getPlayer().isSneaking() && canEquip()) { boolean hadEquipment = false; for (EquipmentSlot slot : EquipmentSlot.values()) { ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(slot)); if (itemInSlot != null && itemInSlot.getItem() != Items.AIR) { ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot); entityitem.pickupDelay = 10; entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0)); this.level.addFreshEntity(entityitem); getMyPet().setEquipment(slot, null); hadEquipment = true; } } if (hadEquipment) { if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) { try { itemStack.hurtAndBreak(1, entityhuman, (entityhuman1) -> entityhuman1.broadcastBreakEvent(enumhand)); } catch (Error e) { itemStack.hurtAndBreak(1, entityhuman, (entityhuman1) -> { try { CompatManager.ENTITY_LIVING_broadcastItemBreak.invoke(entityhuman1, enumhand); } catch (IllegalAccessException InvocationTargetException ex) { ex.printStackTrace(); } }); } } } return InteractionResult.CONSUME; } else if (MyPetApi.getPlatformHelper().isEquipment(CraftItemStack.asBukkitCopy(itemStack)) && getOwner().getPlayer().isSneaking() && canEquip()) { EquipmentSlot slot = EquipmentSlot.getSlotById(Mob.getEquipmentSlotForItem(itemStack).getFilterFlag()); if (slot == EquipmentSlot.MainHand) { ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(slot)); if (itemInSlot != null && itemInSlot.getItem() != Items.AIR && itemInSlot != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) { ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot); entityitem.pickupDelay = 10; entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0)); this.level.addFreshEntity(entityitem); } getMyPet().setEquipment(slot, CraftItemStack.asBukkitCopy(itemStack)); if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) { itemStack.shrink(1); if (itemStack.getCount() <= 0) { entityhuman.getInventory().setItem(entityhuman.getInventory().selected, ItemStack.EMPTY); } } return InteractionResult.CONSUME; } } else if (itemStack.getItem() instanceof BannerItem && getOwner().getPlayer().isSneaking() && canEquip()) { ItemStack itemInSlot = CraftItemStack.asNMSCopy(getMyPet().getEquipment(EquipmentSlot.Helmet)); if (itemInSlot != null && itemInSlot.getItem() != Items.AIR && itemInSlot != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) { ItemEntity entityitem = new ItemEntity(this.level, this.getX(), this.getY() + 1, this.getZ(), itemInSlot); entityitem.pickupDelay = 10; entityitem.setDeltaMovement(entityitem.getDeltaMovement().add(0, this.random.nextFloat() * 0.05F, 0)); this.level.addFreshEntity(entityitem); } getMyPet().setEquipment(EquipmentSlot.Helmet, CraftItemStack.asBukkitCopy(itemStack)); if (itemStack != ItemStack.EMPTY && !entityhuman.getAbilities().instabuild) { itemStack.shrink(1); if (itemStack.getCount() <= 0) { entityhuman.getInventory().setItem(entityhuman.getInventory().selected, ItemStack.EMPTY); } } return InteractionResult.CONSUME; } } return InteractionResult.PASS; } | /**
* Is called when player rightclicks this MyPet
* return:
* true: there was a reaction on rightclick
* false: no reaction on rightclick
*/ | Is called when player rightclicks this MyPet return: true: there was a reaction on rightclick false: no reaction on rightclick | handlePlayerInteraction | {
"repo_name": "xXKeyleXx/MyPet",
"path": "modules/v1_17_R1/src/main/java/de/Keyle/MyPet/compat/v1_17_R1/entity/types/EntityMyPillager.java",
"license": "lgpl-3.0",
"size": 8779
} | [
"java.lang.reflect.InvocationTargetException",
"net.minecraft.world.InteractionHand",
"net.minecraft.world.InteractionResult",
"net.minecraft.world.entity.Mob",
"net.minecraft.world.entity.item.ItemEntity",
"net.minecraft.world.entity.player.Player",
"net.minecraft.world.item.BannerItem",
"net.minecra... | import java.lang.reflect.InvocationTargetException; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.BannerItem; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import org.bukkit.craftbukkit.v1_17_R1.inventory.CraftItemStack; | import java.lang.reflect.*; import net.minecraft.world.*; import net.minecraft.world.entity.*; import net.minecraft.world.entity.item.*; import net.minecraft.world.entity.player.*; import net.minecraft.world.item.*; import org.bukkit.craftbukkit.*; | [
"java.lang",
"net.minecraft.world",
"org.bukkit.craftbukkit"
] | java.lang; net.minecraft.world; org.bukkit.craftbukkit; | 2,909,962 |
private void assertNodesMvccIs(boolean enabled, IgniteEx... nodes) {
for (IgniteEx n: nodes)
assertEquals("Check node: " + n.name(), enabled, n.context().coordinators().mvccEnabled());
} | void function(boolean enabled, IgniteEx... nodes) { for (IgniteEx n: nodes) assertEquals(STR + n.name(), enabled, n.context().coordinators().mvccEnabled()); } | /**
* Asserts if any node MVCC status doesn't equal expected
*/ | Asserts if any node MVCC status doesn't equal expected | assertNodesMvccIs | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccClientTopologyTest.java",
"license": "apache-2.0",
"size": 10252
} | [
"org.apache.ignite.internal.IgniteEx"
] | import org.apache.ignite.internal.IgniteEx; | import org.apache.ignite.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 834,904 |
public void addCloseListener(BiConsumer<Void, Throwable> listener) {
closeContext.whenComplete(listener);
} | void function(BiConsumer<Void, Throwable> listener) { closeContext.whenComplete(listener); } | /**
* Add a listener that will be called when the channel is closed.
*
* @param listener to be called
*/ | Add a listener that will be called when the channel is closed | addCloseListener | {
"repo_name": "s1monw/elasticsearch",
"path": "libs/elasticsearch-nio/src/main/java/org/elasticsearch/nio/ChannelContext.java",
"license": "apache-2.0",
"size": 3754
} | [
"java.util.function.BiConsumer"
] | import java.util.function.BiConsumer; | import java.util.function.*; | [
"java.util"
] | java.util; | 2,674,580 |
public SnowflakeDataset withTable(Object table) {
if (this.innerTypeProperties() == null) {
this.innerTypeProperties = new SnowflakeDatasetTypeProperties();
}
this.innerTypeProperties().withTable(table);
return this;
} | SnowflakeDataset function(Object table) { if (this.innerTypeProperties() == null) { this.innerTypeProperties = new SnowflakeDatasetTypeProperties(); } this.innerTypeProperties().withTable(table); return this; } | /**
* Set the table property: The table name of the Snowflake database. Type: string (or Expression with resultType
* string).
*
* @param table the table value to set.
* @return the SnowflakeDataset object itself.
*/ | Set the table property: The table name of the Snowflake database. Type: string (or Expression with resultType string) | withTable | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datafactory/azure-resourcemanager-datafactory/src/main/java/com/azure/resourcemanager/datafactory/models/SnowflakeDataset.java",
"license": "mit",
"size": 4989
} | [
"com.azure.resourcemanager.datafactory.fluent.models.SnowflakeDatasetTypeProperties"
] | import com.azure.resourcemanager.datafactory.fluent.models.SnowflakeDatasetTypeProperties; | import com.azure.resourcemanager.datafactory.fluent.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 5,378 |
public static java.util.Set extractAdminEventSet(ims.domain.ILightweightDomainFactory domainFactory, ims.pathways.vo.AdminEventVoCollection voCollection)
{
return extractAdminEventSet(domainFactory, voCollection, null, new HashMap());
}
| static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.pathways.vo.AdminEventVoCollection voCollection) { return extractAdminEventSet(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.pathways.domain.objects.AdminEvent set from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.pathways.domain.objects.AdminEvent set from the value object collection | extractAdminEventSet | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/pathways/vo/domain/AdminEventVoAssembler.java",
"license": "agpl-3.0",
"size": 19283
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,440,788 |
@Override
@Post("text")
public Representation responsePost(Representation param) {
try {
@SuppressWarnings("unchecked")
Series<Header> responseHeaders =
(Series<Header>) getResponse().getAttributes().get("org.restlet.http.headers");
if (responseHeaders == null) {
responseHeaders = new Series<Header>(Header.class);
getResponse().getAttributes().put("org.restlet.http.headers", responseHeaders);
}
responseHeaders.add("Access-Control-Allow-Origin", "*");
Map<String, String> params = new HashMap<String, String>();
byte[] speech = IOUtils.toByteArray(param.getStream());
params.put("lang" , getQueryValue("lang" ));
params.put("format", getQueryValue("format"));
params.put("mode", getQueryValue("mode"));
return getRepresentation(speech, params);
} catch (Exception e) {
setStatus(Status.CLIENT_ERROR_NOT_FOUND);
return null;
}
}
| @Post("text") Representation function(Representation param) { try { @SuppressWarnings(STR) Series<Header> responseHeaders = (Series<Header>) getResponse().getAttributes().get(STR); if (responseHeaders == null) { responseHeaders = new Series<Header>(Header.class); getResponse().getAttributes().put(STR, responseHeaders); } responseHeaders.add(STR, "*"); Map<String, String> params = new HashMap<String, String>(); byte[] speech = IOUtils.toByteArray(param.getStream()); params.put("lang" , getQueryValue("lang" )); params.put(STR, getQueryValue(STR)); params.put("mode", getQueryValue("mode")); return getRepresentation(speech, params); } catch (Exception e) { setStatus(Status.CLIENT_ERROR_NOT_FOUND); return null; } } | /**
* Responde requsicoes via metodo POST.
* @param param Corpo da Requisicao (contem o parametro <code>speech</code>).
* @return Resposta (JSON).
*/ | Responde requsicoes via metodo POST | responsePost | {
"repo_name": "robsonsmartins/acaas",
"path": "source/acaas.jboss7/AcaaS/src/com/robsonmartins/acaas/stt/STTResource.java",
"license": "gpl-3.0",
"size": 4746
} | [
"java.util.HashMap",
"java.util.Map",
"org.apache.commons.io.IOUtils",
"org.restlet.data.Status",
"org.restlet.engine.header.Header",
"org.restlet.representation.Representation",
"org.restlet.resource.Post",
"org.restlet.util.Series"
] | import java.util.HashMap; import java.util.Map; import org.apache.commons.io.IOUtils; import org.restlet.data.Status; import org.restlet.engine.header.Header; import org.restlet.representation.Representation; import org.restlet.resource.Post; import org.restlet.util.Series; | import java.util.*; import org.apache.commons.io.*; import org.restlet.data.*; import org.restlet.engine.header.*; import org.restlet.representation.*; import org.restlet.resource.*; import org.restlet.util.*; | [
"java.util",
"org.apache.commons",
"org.restlet.data",
"org.restlet.engine",
"org.restlet.representation",
"org.restlet.resource",
"org.restlet.util"
] | java.util; org.apache.commons; org.restlet.data; org.restlet.engine; org.restlet.representation; org.restlet.resource; org.restlet.util; | 2,358,838 |
public static void setProperties(final ChronoElement element, final Map<String, Object> properties) {
for (Map.Entry<String, Object> property : properties.entrySet()) {
element.setProperty(property.getKey(), property.getValue());
}
} | static void function(final ChronoElement element, final Map<String, Object> properties) { for (Map.Entry<String, Object> property : properties.entrySet()) { element.setProperty(property.getKey(), property.getValue()); } } | /**
* Set the properties of the provided element using the provided map.
*
* @param element
* the element to set the properties of
* @param properties
* the properties to set as a Map
*/ | Set the properties of the provided element using the provided map | setProperties | {
"repo_name": "JaewookByun/epcis",
"path": "otg/src/main/java/org/oliot/khronos/persistent/ElementHelper.java",
"license": "apache-2.0",
"size": 8470
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,537,077 |
static public boolean isAssignableFrom (Class c1, Class c2) {
Type c1Type = ReflectionCache.getType(c1);
Type c2Type = ReflectionCache.getType(c2);
return c1Type.isAssignableFrom(c2Type);
}
| static boolean function (Class c1, Class c2) { Type c1Type = ReflectionCache.getType(c1); Type c2Type = ReflectionCache.getType(c2); return c1Type.isAssignableFrom(c2Type); } | /** Determines if the class or interface represented by first Class parameter is either the same as, or is a superclass or
* superinterface of, the class or interface represented by the second Class parameter. */ | Determines if the class or interface represented by first Class parameter is either the same as, or is a superclass or | isAssignableFrom | {
"repo_name": "azakhary/libgdx",
"path": "backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/com/badlogic/gdx/utils/reflect/ClassReflection.java",
"license": "apache-2.0",
"size": 10401
} | [
"com.badlogic.gwtref.client.ReflectionCache",
"com.badlogic.gwtref.client.Type"
] | import com.badlogic.gwtref.client.ReflectionCache; import com.badlogic.gwtref.client.Type; | import com.badlogic.gwtref.client.*; | [
"com.badlogic.gwtref"
] | com.badlogic.gwtref; | 1,630,810 |
private void pirateRecipe(String text)
{
if ("excitedze".equals(text))
{
LanguageManager languagemanager = this.mc.getLanguageManager();
Language language = languagemanager.getLanguage("en_pt");
if (languagemanager.getCurrentLanguage().compareTo(language) == 0)
{
return;
}
languagemanager.setCurrentLanguage(language);
this.mc.gameSettings.language = language.getLanguageCode();
this.mc.refreshResources();
this.mc.fontRenderer.setUnicodeFlag(this.mc.getLanguageManager().isCurrentLocaleUnicode() || this.mc.gameSettings.forceUnicodeFont);
this.mc.fontRenderer.setBidiFlag(languagemanager.isCurrentLanguageBidirectional());
this.mc.gameSettings.saveOptions();
}
} | void function(String text) { if (STR.equals(text)) { LanguageManager languagemanager = this.mc.getLanguageManager(); Language language = languagemanager.getLanguage("en_pt"); if (languagemanager.getCurrentLanguage().compareTo(language) == 0) { return; } languagemanager.setCurrentLanguage(language); this.mc.gameSettings.language = language.getLanguageCode(); this.mc.refreshResources(); this.mc.fontRenderer.setUnicodeFlag(this.mc.getLanguageManager().isCurrentLocaleUnicode() this.mc.gameSettings.forceUnicodeFont); this.mc.fontRenderer.setBidiFlag(languagemanager.isCurrentLanguageBidirectional()); this.mc.gameSettings.saveOptions(); } } | /**
* "Check if we should activate the pirate speak easter egg"
*
* @param text 'if equal to "excitedze", activate the easter egg'
*/ | "Check if we should activate the pirate speak easter egg" | pirateRecipe | {
"repo_name": "TheGreatAndPowerfulWeegee/wipunknown",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/gui/recipebook/GuiRecipeBook.java",
"license": "gpl-3.0",
"size": 29145
} | [
"net.minecraft.client.resources.Language",
"net.minecraft.client.resources.LanguageManager"
] | import net.minecraft.client.resources.Language; import net.minecraft.client.resources.LanguageManager; | import net.minecraft.client.resources.*; | [
"net.minecraft.client"
] | net.minecraft.client; | 2,750,507 |
public void setDocFilePersistence(DocFilePersistence docFilePersistence) {
this.docFilePersistence = docFilePersistence;
} | void function(DocFilePersistence docFilePersistence) { this.docFilePersistence = docFilePersistence; } | /**
* Sets the doc file persistence.
*
* @param docFilePersistence the doc file persistence
*/ | Sets the doc file persistence | setDocFilePersistence | {
"repo_name": "openegovplatform/OEPv2",
"path": "oep-dossier-portlet/docroot/WEB-INF/src/org/oep/dossiermgt/service/base/DossierTagServiceBaseImpl.java",
"license": "apache-2.0",
"size": 49313
} | [
"org.oep.dossiermgt.service.persistence.DocFilePersistence"
] | import org.oep.dossiermgt.service.persistence.DocFilePersistence; | import org.oep.dossiermgt.service.persistence.*; | [
"org.oep.dossiermgt"
] | org.oep.dossiermgt; | 112,463 |
public void endBook() throws IOException {
if (uploadingBook) {
uploadingBook = false;
write("ENDBOOK");
String line;
if (!"ENDBOOKOK".equals(line = read()))
throw new IOException("Invalid response " + line);
}
} | void function() throws IOException { if (uploadingBook) { uploadingBook = false; write(STR); String line; if (!STR.equals(line = read())) throw new IOException(STR + line); } } | /**
* Conclude the book upload
*
* @throws IOException
*/ | Conclude the book upload | endBook | {
"repo_name": "schierla/jbeagle",
"path": "src/de/schierla/jbeagle/BeagleConnector.java",
"license": "gpl-3.0",
"size": 7943
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,636,007 |
public Optional<ExpandedSwapLeg> getLeg(PayReceive payReceive) {
return legs.stream().filter(leg -> leg.getPayReceive() == payReceive).findFirst();
} | Optional<ExpandedSwapLeg> function(PayReceive payReceive) { return legs.stream().filter(leg -> leg.getPayReceive() == payReceive).findFirst(); } | /**
* Gets the first pay or receive leg of the swap.
* <p>
* This returns the first pay or receive leg of the swap, empty if no matching leg.
*
* @param payReceive the pay or receive flag
* @return the first matching leg of the swap
*/ | Gets the first pay or receive leg of the swap. This returns the first pay or receive leg of the swap, empty if no matching leg | getLeg | {
"repo_name": "nssales/Strata",
"path": "modules/finance/src/main/java/com/opengamma/strata/finance/rate/swap/ExpandedSwap.java",
"license": "apache-2.0",
"size": 13585
} | [
"com.opengamma.strata.basics.PayReceive",
"java.util.Optional"
] | import com.opengamma.strata.basics.PayReceive; import java.util.Optional; | import com.opengamma.strata.basics.*; import java.util.*; | [
"com.opengamma.strata",
"java.util"
] | com.opengamma.strata; java.util; | 2,323,709 |
public static void saveMimeInputStreamAsFile(HttpServletResponse response, String contentType,
InputStream inStream, String fileName, int fileSize) throws IOException {
// If there are quotes in the name, we should replace them to avoid issues.
// The filename will be wrapped with quotes below when it is set in the header
String updateFileName;
if(fileName.contains("\"")) {
updateFileName = fileName.replaceAll("\"", "");
} else {
updateFileName = fileName;
}
// set response
response.setContentType(contentType);
response.setHeader("Content-disposition", "attachment; filename=\"" + updateFileName + "\"");
response.setHeader("Expires", "0");
response.setHeader("Cache-Control", "must-revalidate, post-check=0, pre-check=0");
response.setHeader("Pragma", "public");
response.setContentLength(fileSize);
// write to output
OutputStream out = response.getOutputStream();
while (inStream.available() > 0) {
out.write(inStream.read());
}
out.flush();
}
| static void function(HttpServletResponse response, String contentType, InputStream inStream, String fileName, int fileSize) throws IOException { String updateFileName; if(fileName.contains("\"STR\STRSTRContent-dispositionSTRattachment; filename=\STR\STRExpiresSTR0STRCache-ControlSTRmust-revalidate, post-check=0, pre-check=0STRPragmaSTRpublic"); response.setContentLength(fileSize); OutputStream out = response.getOutputStream(); while (inStream.available() > 0) { out.write(inStream.read()); } out.flush(); } | /**
* A file that is not of type text/plain or text/html can be output through
* the response using this method.
*
* @param response
* @param contentType
* @param inStream
* @param fileName
*/ | A file that is not of type text/plain or text/html can be output through the response using this method | saveMimeInputStreamAsFile | {
"repo_name": "mztaylor/rice-git",
"path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/util/WebUtils.java",
"license": "apache-2.0",
"size": 38590
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 541,136 |
public static Request listenForRequest(BluetoothConnection connection) throws IOException {
Request request = new Request("", "", connection);
return request.listen() ? request : null;
} | static Request function(BluetoothConnection connection) throws IOException { Request request = new Request(STR", connection); return request.listen() ? request : null; } | /**
* This is a blocking method, which will wait until a full Request is received.
*/ | This is a blocking method, which will wait until a full Request is received | listenForRequest | {
"repo_name": "krakerbelin/AVCPStore",
"path": "F-Droid/src/org/fdroid/fdroid/net/bluetooth/httpish/Request.java",
"license": "gpl-3.0",
"size": 6156
} | [
"java.io.IOException",
"org.fdroid.fdroid.net.bluetooth.BluetoothConnection"
] | import java.io.IOException; import org.fdroid.fdroid.net.bluetooth.BluetoothConnection; | import java.io.*; import org.fdroid.fdroid.net.bluetooth.*; | [
"java.io",
"org.fdroid.fdroid"
] | java.io; org.fdroid.fdroid; | 62,227 |
public static List<CurrencyCode> getByCountry(String country, boolean caseSensitive)
{
return getByCountry(CountryCode.getByCode(country, caseSensitive));
} | static List<CurrencyCode> function(String country, boolean caseSensitive) { return getByCountry(CountryCode.getByCode(country, caseSensitive)); } | /**
* Get a list of {@code CurrencyCode} instances whose country
* list contains the specified country.
*
* <p>
* This method is an alias of {@link #getByCountry(CountryCode)
* getByCountry}{@code (}{@link CountryCode}{@code .}{@link
* CountryCode#getByCode(String, boolean) getByCode}{@code
* (country, caseSensitive))}.
* </p>
*
* @param country
* Country code. ISO 3166-1 alpha-2 or alpha-3.
*
* @param caseSensitive
* If {@code true}, the given code should consist of uppercase
* letters only. If {@code false}, case is ignored.
*
* @return
* List of {@code CurrencyCode} instances. If there is no
* {@code CurrencyCode} instance whose country list contains
* the specified country, the size of the returned list is zero.
*/ | Get a list of CurrencyCode instances whose country list contains the specified country. This method is an alias of <code>#getByCountry(CountryCode) getByCountry</code>(<code>CountryCode</code>.<code>CountryCode#getByCode(String, boolean) getByCode</code>(country, caseSensitive)). | getByCountry | {
"repo_name": "TakahikoKawasaki/nv-i18n",
"path": "src/main/java/com/neovisionaries/i18n/CurrencyCode.java",
"license": "apache-2.0",
"size": 79951
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 226,173 |
Map<String, TransportConfiguration> getConnectorConfigurations(); | Map<String, TransportConfiguration> getConnectorConfigurations(); | /**
* Returns the connectors configured for this server.
*/ | Returns the connectors configured for this server | getConnectorConfigurations | {
"repo_name": "mnovak1/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/config/Configuration.java",
"license": "apache-2.0",
"size": 38918
} | [
"java.util.Map",
"org.apache.activemq.artemis.api.core.TransportConfiguration"
] | import java.util.Map; import org.apache.activemq.artemis.api.core.TransportConfiguration; | import java.util.*; import org.apache.activemq.artemis.api.core.*; | [
"java.util",
"org.apache.activemq"
] | java.util; org.apache.activemq; | 2,695,204 |
private View makeAndAddView(int position) {
View child;
if (!mDataChanged) {
child = mRecycler.get(position);
if (child != null) {
// Position the view
setUpChild(child);
return child;
}
}
// Nothing found in the recycler -- ask the adapter for a view
child = mAdapter.getView(position, null, this);
// Position the view
setUpChild(child);
return child;
} | View function(int position) { View child; if (!mDataChanged) { child = mRecycler.get(position); if (child != null) { setUpChild(child); return child; } } child = mAdapter.getView(position, null, this); setUpChild(child); return child; } | /**
* Obtain a view, either by pulling an existing view from the recycler or
* by getting a new one from the adapter. If we are animating, make sure
* there is enough information in the view's layout parameters to animate
* from the old to new positions.
*
* @param position Position in the spinner for the view to obtain
* @return A view that has been added to the spinner
*/ | Obtain a view, either by pulling an existing view from the recycler or by getting a new one from the adapter. If we are animating, make sure there is enough information in the view's layout parameters to animate from the old to new positions | makeAndAddView | {
"repo_name": "mateor/pdroid",
"path": "android-4.0.3_r1/trunk/frameworks/base/core/java/android/widget/Spinner.java",
"license": "gpl-3.0",
"size": 25688
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,334,203 |
public void setChannel(SubscribableChannel channel) {
this.channel = channel;
} | void function(SubscribableChannel channel) { this.channel = channel; } | /**
* Sets the Spring Messaging Channel that this event bus should publish events to.
*
* @param channel the channel to publish events to
*/ | Sets the Spring Messaging Channel that this event bus should publish events to | setChannel | {
"repo_name": "soulrebel/AxonFramework",
"path": "spring/src/main/java/org/axonframework/spring/messaging/eventbus/SpringMessagingTerminal.java",
"license": "apache-2.0",
"size": 3679
} | [
"org.springframework.messaging.SubscribableChannel"
] | import org.springframework.messaging.SubscribableChannel; | import org.springframework.messaging.*; | [
"org.springframework.messaging"
] | org.springframework.messaging; | 2,048,901 |
public Set<FieldDescriptor> getSuggestedFields() {
return suggestions.keySet();
} | Set<FieldDescriptor> function() { return suggestions.keySet(); } | /**
* Gets the fields descriptors which are queried for suggestions.
* @return {@link FieldDescriptor} with the suggested fields.
*/ | Gets the fields descriptors which are queried for suggestions | getSuggestedFields | {
"repo_name": "RBMHTechnology/vind",
"path": "api/src/main/java/com/rbmhtechnology/vind/api/result/SuggestionResult.java",
"license": "apache-2.0",
"size": 4464
} | [
"com.rbmhtechnology.vind.model.FieldDescriptor",
"java.util.Set"
] | import com.rbmhtechnology.vind.model.FieldDescriptor; import java.util.Set; | import com.rbmhtechnology.vind.model.*; import java.util.*; | [
"com.rbmhtechnology.vind",
"java.util"
] | com.rbmhtechnology.vind; java.util; | 2,278,468 |
public Call<ResponseBody> postPathGlobalValidAsync(final ServiceCallback<Void> serviceCallback) {
if (this.client.getSubscriptionId() == null) {
serviceCallback.failure(new ServiceException(
new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null.")));
} | Call<ResponseBody> function(final ServiceCallback<Void> serviceCallback) { if (this.client.getSubscriptionId() == null) { serviceCallback.failure(new ServiceException( new IllegalArgumentException(STR))); } | /**
* POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed
*
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
*/ | POST method with subscriptionId modeled in credentials. Set the credential subscriptionId to '1234-5678-9012-3456' to succeed | postPathGlobalValidAsync | {
"repo_name": "BretJohnson/autorest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/azurespecials/SubscriptionInCredentialsImpl.java",
"license": "mit",
"size": 14802
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceException",
"com.squareup.okhttp.ResponseBody"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceException; import com.squareup.okhttp.ResponseBody; | import com.microsoft.rest.*; import com.squareup.okhttp.*; | [
"com.microsoft.rest",
"com.squareup.okhttp"
] | com.microsoft.rest; com.squareup.okhttp; | 2,204,958 |
public LoadBalancerInner withProbes(List<ProbeInner> probes) {
this.probes = probes;
return this;
} | LoadBalancerInner function(List<ProbeInner> probes) { this.probes = probes; return this; } | /**
* Set the probes value.
*
* @param probes the probes value to set
* @return the LoadBalancerInner object itself.
*/ | Set the probes value | withProbes | {
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-mgmt-network/src/main/java/com/microsoft/azure/management/network/implementation/LoadBalancerInner.java",
"license": "mit",
"size": 8731
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,599,114 |
public void debugPrint(Writer out, String prefix, boolean verbose) {
IndentingWriter iw = new IndentingWriter(out, 0, prefix);
int sz = size();
try {
for (int i = 0; i < sz; i++) {
DalvInsn insn = (DalvInsn) get0(i);
String s;
if ((insn.codeSize() != 0) || verbose) {
s = insn.listingString("", 0, verbose);
} else {
s = null;
}
if (s != null) {
iw.write(s);
}
}
iw.flush();
} catch (IOException ex) {
throw new RuntimeException(ex);
}
} | void function(Writer out, String prefix, boolean verbose) { IndentingWriter iw = new IndentingWriter(out, 0, prefix); int sz = size(); try { for (int i = 0; i < sz; i++) { DalvInsn insn = (DalvInsn) get0(i); String s; if ((insn.codeSize() != 0) verbose) { s = insn.listingString("", 0, verbose); } else { s = null; } if (s != null) { iw.write(s); } } iw.flush(); } catch (IOException ex) { throw new RuntimeException(ex); } } | /**
* Does a human-friendly dump of this instance.
*
* @param out {@code non-null;} where to dump
* @param prefix {@code non-null;} prefix to attach to each line of output
* @param verbose whether to be verbose; verbose output includes
* lines for zero-size instructions and explicit constant pool indices
*/ | Does a human-friendly dump of this instance | debugPrint | {
"repo_name": "alibaba/atlas",
"path": "atlas-gradle-plugin/dexpatch/src/main/java/com/taobao/android/dx/dex/code/DalvInsnList.java",
"license": "apache-2.0",
"size": 8339
} | [
"com.taobao.android.dx.util.IndentingWriter",
"java.io.IOException",
"java.io.Writer"
] | import com.taobao.android.dx.util.IndentingWriter; import java.io.IOException; import java.io.Writer; | import com.taobao.android.dx.util.*; import java.io.*; | [
"com.taobao.android",
"java.io"
] | com.taobao.android; java.io; | 779,305 |
public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
{
this.theInventory[par1] = par2ItemStack;
if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
{
par2ItemStack.stackSize = this.getInventoryStackLimit();
}
if (this.inventoryResetNeededOnSlotChange(par1))
{
this.resetRecipeAndSlots();
}
} | void function(int par1, ItemStack par2ItemStack) { this.theInventory[par1] = par2ItemStack; if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit()) { par2ItemStack.stackSize = this.getInventoryStackLimit(); } if (this.inventoryResetNeededOnSlotChange(par1)) { this.resetRecipeAndSlots(); } } | /**
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/ | Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections) | setInventorySlotContents | {
"repo_name": "wildex999/stjerncraft_mcpc",
"path": "src/minecraft/net/minecraft/inventory/InventoryMerchant.java",
"license": "gpl-3.0",
"size": 7957
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 1,216,034 |
public static java.util.Set extractCatsReferralSet(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralForClinicListVoCollection voCollection)
{
return extractCatsReferralSet(domainFactory, voCollection, null, new HashMap());
}
| static java.util.Set function(ims.domain.ILightweightDomainFactory domainFactory, ims.RefMan.vo.CatsReferralForClinicListVoCollection voCollection) { return extractCatsReferralSet(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.RefMan.domain.objects.CatsReferral set from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.RefMan.domain.objects.CatsReferral set from the value object collection | extractCatsReferralSet | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/RefMan/vo/domain/CatsReferralForClinicListVoAssembler.java",
"license": "agpl-3.0",
"size": 18310
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 920,455 |
public String toTextString() {
ByteArrayOutputStream out = new ByteArrayOutputStream();
InputStream input = null;
try {
input = createInputStream();
IOUtils.copy(input, out);
} catch (IOException e) {
return "";
} finally {
IOUtils.closeQuietly(input);
}
COSString string = new COSString(out.toByteArray());
return string.getString();
} | String function() { ByteArrayOutputStream out = new ByteArrayOutputStream(); InputStream input = null; try { input = createInputStream(); IOUtils.copy(input, out); } catch (IOException e) { return ""; } finally { IOUtils.closeQuietly(input); } COSString string = new COSString(out.toByteArray()); return string.getString(); } | /**
* Returns the contents of the stream as a PDF "text string".
*/ | Returns the contents of the stream as a PDF "text string" | toTextString | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/cos/COSStream.java",
"license": "apache-2.0",
"size": 11813
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.InputStream",
"org.apache.pdfbox.io.IOUtils"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import org.apache.pdfbox.io.IOUtils; | import java.io.*; import org.apache.pdfbox.io.*; | [
"java.io",
"org.apache.pdfbox"
] | java.io; org.apache.pdfbox; | 2,566,572 |
public Builder setProperty(IProperty<?> mappedProperty) {
property = mappedProperty;
return this;
} | Builder function(IProperty<?> mappedProperty) { property = mappedProperty; return this; } | /**
* Sets the property used when mapping states to resource locations.
*/ | Sets the property used when mapping states to resource locations | setProperty | {
"repo_name": "BlazeLoader/BlazeLoader",
"path": "src/client/com/blazeloader/api/client/ModStateMap.java",
"license": "bsd-2-clause",
"size": 3307
} | [
"net.minecraft.block.properties.IProperty"
] | import net.minecraft.block.properties.IProperty; | import net.minecraft.block.properties.*; | [
"net.minecraft.block"
] | net.minecraft.block; | 2,827,784 |
public static void writeMyEphemeralNodeOnDisk(String fileContent) {
String fileName = ZNodeClearer.getMyEphemeralNodeFileName();
if (fileName == null) {
LOG.warn("Environment variable HBASE_ZNODE_FILE not set; znodes will not be cleared " +
"on crash by start scripts (Longer MTTR!)");
return;
}
FileWriter fstream;
try {
fstream = new FileWriter(fileName);
} catch (IOException e) {
LOG.warn("Can't write znode file "+fileName, e);
return;
}
BufferedWriter out = new BufferedWriter(fstream);
try {
try {
out.write(fileContent + "\n");
} finally {
try {
out.close();
} finally {
fstream.close();
}
}
} catch (IOException e) {
LOG.warn("Can't write znode file "+fileName, e);
}
} | static void function(String fileContent) { String fileName = ZNodeClearer.getMyEphemeralNodeFileName(); if (fileName == null) { LOG.warn(STR + STR); return; } FileWriter fstream; try { fstream = new FileWriter(fileName); } catch (IOException e) { LOG.warn(STR+fileName, e); return; } BufferedWriter out = new BufferedWriter(fstream); try { try { out.write(fileContent + "\n"); } finally { try { out.close(); } finally { fstream.close(); } } } catch (IOException e) { LOG.warn(STR+fileName, e); } } | /**
* Logs the errors without failing on exception.
*/ | Logs the errors without failing on exception | writeMyEphemeralNodeOnDisk | {
"repo_name": "JingchengDu/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/ZNodeClearer.java",
"license": "apache-2.0",
"size": 7295
} | [
"java.io.BufferedWriter",
"java.io.FileWriter",
"java.io.IOException"
] | import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,158,740 |
public static int getIntValue(Element ele, String tagName) {
//in production application you would catch the exception
return Integer.parseInt(getTextValue(ele, tagName));
} | static int function(Element ele, String tagName) { return Integer.parseInt(getTextValue(ele, tagName)); } | /**
* Calls getTextValue and returns a int value
*
* @param ele
* @param tagName
* @return
*/ | Calls getTextValue and returns a int value | getIntValue | {
"repo_name": "marpet/seadas",
"path": "seadas-processing/src/main/java/gov/nasa/gsfc/seadas/processing/general/XmlReader.java",
"license": "gpl-3.0",
"size": 2900
} | [
"org.w3c.dom.Element"
] | import org.w3c.dom.Element; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,347,417 |
static public long executeUpdate(//
final BigdataSailRepositoryConnection conn,//
final ASTContainer astContainer,//
final Dataset dataset,
final boolean includeInferred,//
final QueryBindingSet bs
) throws UpdateExecutionException {
if(conn == null)
throw new IllegalArgumentException();
if(astContainer == null)
throw new IllegalArgumentException();
final DeferredResolutionResult resolved;
try {
// @see https://jira.blazegraph.com/browse/BLZG-1176
resolved = ASTDeferredIVResolution.resolveUpdate(conn.getTripleStore(), astContainer, bs, dataset);
} catch (MalformedQueryException e) {
throw new UpdateExecutionException(e.getMessage(), e);
}
try {
if (dataset != null) {
applyDataSet(conn.getTripleStore(), astContainer, resolved.dataset);
}
final AST2BOpUpdateContext ctx = new AST2BOpUpdateContext(
astContainer, conn);
doSparqlLogging(ctx);
// Propagate attribute.
ctx.setIncludeInferred(includeInferred);
// Batch resolve Values to IVs and convert to bigdata binding set.
final IBindingSet[] bindingSets = toBindingSet(resolved.bindingSet) ;
// Propagate bindings
ctx.setQueryBindingSet(bs);
ctx.setBindings(bindingSets);
ctx.setDataset(dataset);
AST2BOpUpdate.optimizeUpdateRoot(ctx);
AST2BOpUpdate.convertUpdate(ctx);
return ctx.getCommitTime();
} catch (Exception ex) {
ex.printStackTrace();
throw new UpdateExecutionException(ex);
}
}
| static long function( final BigdataSailRepositoryConnection conn, final ASTContainer astContainer, final Dataset dataset, final boolean includeInferred, final QueryBindingSet bs ) throws UpdateExecutionException { if(conn == null) throw new IllegalArgumentException(); if(astContainer == null) throw new IllegalArgumentException(); final DeferredResolutionResult resolved; try { resolved = ASTDeferredIVResolution.resolveUpdate(conn.getTripleStore(), astContainer, bs, dataset); } catch (MalformedQueryException e) { throw new UpdateExecutionException(e.getMessage(), e); } try { if (dataset != null) { applyDataSet(conn.getTripleStore(), astContainer, resolved.dataset); } final AST2BOpUpdateContext ctx = new AST2BOpUpdateContext( astContainer, conn); doSparqlLogging(ctx); ctx.setIncludeInferred(includeInferred); final IBindingSet[] bindingSets = toBindingSet(resolved.bindingSet) ; ctx.setQueryBindingSet(bs); ctx.setBindings(bindingSets); ctx.setDataset(dataset); AST2BOpUpdate.optimizeUpdateRoot(ctx); AST2BOpUpdate.convertUpdate(ctx); return ctx.getCommitTime(); } catch (Exception ex) { ex.printStackTrace(); throw new UpdateExecutionException(ex); } } | /**
* Evaluate a SPARQL UPDATE request (core method).
*
* @param astContainer
* The query model.
* @param ctx
* The evaluation context.
* @param dataset
* A dataset which will override the data set declaration for
* each {@link DeleteInsertGraph} operation in the update
* sequence (optional).
* @param includeInferred
* if inferences should be included in various operations.
*
* @return The timestamp of the commit point.
*
* @throws SailException
*
* TODO timeout for update?
*/ | Evaluate a SPARQL UPDATE request (core method) | executeUpdate | {
"repo_name": "blazegraph/database",
"path": "bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/sparql/ast/eval/ASTEvalHelper.java",
"license": "gpl-2.0",
"size": 48261
} | [
"com.bigdata.bop.IBindingSet",
"com.bigdata.rdf.sail.BigdataSailRepositoryConnection",
"com.bigdata.rdf.sparql.ast.ASTContainer",
"com.bigdata.rdf.sparql.ast.eval.ASTDeferredIVResolution",
"org.openrdf.query.Dataset",
"org.openrdf.query.MalformedQueryException",
"org.openrdf.query.UpdateExecutionExcepti... | import com.bigdata.bop.IBindingSet; import com.bigdata.rdf.sail.BigdataSailRepositoryConnection; import com.bigdata.rdf.sparql.ast.ASTContainer; import com.bigdata.rdf.sparql.ast.eval.ASTDeferredIVResolution; import org.openrdf.query.Dataset; import org.openrdf.query.MalformedQueryException; import org.openrdf.query.UpdateExecutionException; import org.openrdf.query.algebra.evaluation.QueryBindingSet; | import com.bigdata.bop.*; import com.bigdata.rdf.sail.*; import com.bigdata.rdf.sparql.ast.*; import com.bigdata.rdf.sparql.ast.eval.*; import org.openrdf.query.*; import org.openrdf.query.algebra.evaluation.*; | [
"com.bigdata.bop",
"com.bigdata.rdf",
"org.openrdf.query"
] | com.bigdata.bop; com.bigdata.rdf; org.openrdf.query; | 975,504 |
private void onSpam(List<MessageReference> messages) {
if (QMail.confirmSpam()) {
// remember the message selection for #onCreateDialog(int)
activeMessages = messages;
showDialog(R.id.dialog_confirm_spam);
} else {
onSpamConfirmed(messages);
}
} | void function(List<MessageReference> messages) { if (QMail.confirmSpam()) { activeMessages = messages; showDialog(R.id.dialog_confirm_spam); } else { onSpamConfirmed(messages); } } | /**
* Move messages to the spam folder.
*
* @param messages
* The messages to move to the spam folder. Never {@code null}.
*/ | Move messages to the spam folder | onSpam | {
"repo_name": "philipwhiuk/q-mail",
"path": "qmail/src/main/java/com/fsck/k9/fragment/MessageListFragment.java",
"license": "apache-2.0",
"size": 101650
} | [
"com.fsck.k9.QMail",
"com.fsck.k9.activity.MessageReference",
"java.util.List"
] | import com.fsck.k9.QMail; import com.fsck.k9.activity.MessageReference; import java.util.List; | import com.fsck.k9.*; import com.fsck.k9.activity.*; import java.util.*; | [
"com.fsck.k9",
"java.util"
] | com.fsck.k9; java.util; | 2,311,832 |
private int indexOfUnclosedParen() {
final int cursor = textArea.getCaretPosition();
final String text = textArea.getText();
final Stack<Integer> stack = new Stack<Integer>();
int column = 0;
for (int i = 0; i < cursor; i++) {
final char c = text.charAt(i);
if (isOpen(c)) {
stack.push(column);
} else if (isClose(c)) {
if (stack.size() == 0) {
// Syntax error; bail.
return -1;
}
stack.pop();
}
if (c == '\n') {
column = 0;
} else {
column++;
}
}
return stack.size() > 0 ? stack.pop() : -1;
} | int function() { final int cursor = textArea.getCaretPosition(); final String text = textArea.getText(); final Stack<Integer> stack = new Stack<Integer>(); int column = 0; for (int i = 0; i < cursor; i++) { final char c = text.charAt(i); if (isOpen(c)) { stack.push(column); } else if (isClose(c)) { if (stack.size() == 0) { return -1; } stack.pop(); } if (c == '\n') { column = 0; } else { column++; } } return stack.size() > 0 ? stack.pop() : -1; } | /**
* Search for an unterminated paren or bracket. If found, return
* its index in the given text. Otherwise return -1.
* <p>Ignores syntax errors, treating (foo] as a valid construct.
* <p>Assumes that the text contains no surrogate characters.
* @param cursor The current cursor position in the given text.
* @param text The text to search for an unterminated paren or bracket.
* @return The index of the unterminated paren, or -1.
*/ | Search for an unterminated paren or bracket. If found, return its index in the given text. Otherwise return -1. Ignores syntax errors, treating (foo] as a valid construct. Assumes that the text contains no surrogate characters | indexOfUnclosedParen | {
"repo_name": "tildebyte/processing.py",
"path": "runtime/src/jycessing/mode/PyInputHandler.java",
"license": "apache-2.0",
"size": 13459
} | [
"java.util.Stack"
] | import java.util.Stack; | import java.util.*; | [
"java.util"
] | java.util; | 647,847 |
BufferedImage createZoomedLensImage(BufferedImage image)
{
if (lens == null) return null;
try
{
return lens.createZoomedImage(image);
}
catch(Exception e)
{
return null;
}
} | BufferedImage createZoomedLensImage(BufferedImage image) { if (lens == null) return null; try { return lens.createZoomedImage(image); } catch(Exception e) { return null; } } | /**
* Creates a zoomed version of the passed image.
*
* @param image The image to zoom.
* @return See above.
* @throws Exception
*/ | Creates a zoomed version of the passed image | createZoomedLensImage | {
"repo_name": "tp81/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerUI.java",
"license": "gpl-2.0",
"size": 80326
} | [
"java.awt.image.BufferedImage"
] | import java.awt.image.BufferedImage; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 2,009,909 |
public final BasicTransform getBasicTransform( ) {
BasicTransform basicTransform = null;
try {
if( _basicTransform == null )
throw new JWaveFailure( "Transform - BasicTransform object is null!" );
if( !( _basicTransform instanceof BasicTransform ) )
throw new JWaveFailure( "Transform - getBasicTransform - "
+ "member is not of type BasicTransform!" );
basicTransform = _basicTransform;
} catch( JWaveException e ) {
e.showMessage( );
e.printStackTrace( );
} // try
return basicTransform;
} // getBasicTransform | final BasicTransform function( ) { BasicTransform basicTransform = null; try { if( _basicTransform == null ) throw new JWaveFailure( STR ); if( !( _basicTransform instanceof BasicTransform ) ) throw new JWaveFailure( STR + STR ); basicTransform = _basicTransform; } catch( JWaveException e ) { e.showMessage( ); e.printStackTrace( ); } return basicTransform; } | /**
* Return the used object of type BasicTransform.
*
* @author Christian Scheiblich (cscheiblich@gmail.com)
* @date 14.03.2015 18:19:13
* @return identifier of object of type Basic Transform
*/ | Return the used object of type BasicTransform | getBasicTransform | {
"repo_name": "RaineForest/ECG-Viewer",
"path": "JWave/src/math/jwave/Transform.java",
"license": "gpl-2.0",
"size": 16283
} | [
"math.jwave.exceptions.JWaveException",
"math.jwave.exceptions.JWaveFailure",
"math.jwave.transforms.BasicTransform"
] | import math.jwave.exceptions.JWaveException; import math.jwave.exceptions.JWaveFailure; import math.jwave.transforms.BasicTransform; | import math.jwave.exceptions.*; import math.jwave.transforms.*; | [
"math.jwave.exceptions",
"math.jwave.transforms"
] | math.jwave.exceptions; math.jwave.transforms; | 1,433,996 |
public void earlyReadonly(final String serviceURI, final CoordinationContextType coordinationContext)
throws SoapFault, IOException
{
final String messageId = MessageId.getMessageId() ;
final MAP map = AddressingHelper.createRequestContext(serviceURI, messageId) ;
SyncParticipantClient.getClient().sendEarlyReadonly(coordinationContext, map) ;
} | void function(final String serviceURI, final CoordinationContextType coordinationContext) throws SoapFault, IOException { final String messageId = MessageId.getMessageId() ; final MAP map = AddressingHelper.createRequestContext(serviceURI, messageId) ; SyncParticipantClient.getClient().sendEarlyReadonly(coordinationContext, map) ; } | /**
* Send an earlyReadonly request.
* @param serviceURI The target service URI.
* @param coordinationContext The coordination context.
* @throws SoapFault For any errors.
* @throws IOException for any transport errors.
*/ | Send an earlyReadonly request | earlyReadonly | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/XTS/localjunit/WSTFSC07-interop/src/main/java/com/jboss/transaction/wstf/webservices/sc007/SyncParticipantStub.java",
"license": "apache-2.0",
"size": 11630
} | [
"com.arjuna.webservices.SoapFault",
"com.arjuna.webservices11.wsaddr.AddressingHelper",
"com.arjuna.wsc11.messaging.MessageId",
"com.jboss.transaction.wstf.webservices.sc007.client.SyncParticipantClient",
"java.io.IOException",
"org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType"
] | import com.arjuna.webservices.SoapFault; import com.arjuna.webservices11.wsaddr.AddressingHelper; import com.arjuna.wsc11.messaging.MessageId; import com.jboss.transaction.wstf.webservices.sc007.client.SyncParticipantClient; import java.io.IOException; import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType; | import com.arjuna.webservices.*; import com.arjuna.webservices11.wsaddr.*; import com.arjuna.wsc11.messaging.*; import com.jboss.transaction.wstf.webservices.sc007.client.*; import java.io.*; import org.oasis_open.docs.ws_tx.wscoor.*; | [
"com.arjuna.webservices",
"com.arjuna.webservices11",
"com.arjuna.wsc11",
"com.jboss.transaction",
"java.io",
"org.oasis_open.docs"
] | com.arjuna.webservices; com.arjuna.webservices11; com.arjuna.wsc11; com.jboss.transaction; java.io; org.oasis_open.docs; | 1,364,808 |
public ServerState userVisibleState() {
return this.userVisibleState;
} | ServerState function() { return this.userVisibleState; } | /**
* Get a state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled'.
*
* @return the userVisibleState value
*/ | Get a state of a server that is visible to user. Possible values include: 'Ready', 'Dropping', 'Disabled' | userVisibleState | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/mysql/mgmt-v2017_12_01/src/main/java/com/microsoft/azure/management/mysql/v2017_12_01/implementation/ServerInner.java",
"license": "mit",
"size": 9224
} | [
"com.microsoft.azure.management.mysql.v2017_12_01.ServerState"
] | import com.microsoft.azure.management.mysql.v2017_12_01.ServerState; | import com.microsoft.azure.management.mysql.v2017_12_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 960,921 |
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public static final VideoIntelligenceServiceClient create(VideoIntelligenceServiceStub stub) {
return new VideoIntelligenceServiceClient(stub);
}
protected VideoIntelligenceServiceClient(VideoIntelligenceServiceSettings settings)
throws IOException {
this.settings = settings;
this.stub = ((VideoIntelligenceServiceStubSettings) settings.getStubSettings()).createStub();
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
protected VideoIntelligenceServiceClient(VideoIntelligenceServiceStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient = OperationsClient.create(this.stub.getOperationsStub());
} | @BetaApi(STR) static final VideoIntelligenceServiceClient function(VideoIntelligenceServiceStub stub) { return new VideoIntelligenceServiceClient(stub); } protected VideoIntelligenceServiceClient(VideoIntelligenceServiceSettings settings) throws IOException { this.settings = settings; this.stub = ((VideoIntelligenceServiceStubSettings) settings.getStubSettings()).createStub(); this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } @BetaApi(STR) protected VideoIntelligenceServiceClient(VideoIntelligenceServiceStub stub) { this.settings = null; this.stub = stub; this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); } | /**
* Constructs an instance of VideoIntelligenceServiceClient, using the given stub for making
* calls. This is for advanced usage - prefer using create(VideoIntelligenceServiceSettings).
*/ | Constructs an instance of VideoIntelligenceServiceClient, using the given stub for making calls. This is for advanced usage - prefer using create(VideoIntelligenceServiceSettings) | create | {
"repo_name": "googleapis/java-video-intelligence",
"path": "google-cloud-video-intelligence/src/main/java/com/google/cloud/videointelligence/v1/VideoIntelligenceServiceClient.java",
"license": "apache-2.0",
"size": 13781
} | [
"com.google.api.core.BetaApi",
"com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStub",
"com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings",
"com.google.longrunning.OperationsClient",
"java.io.IOException"
] | import com.google.api.core.BetaApi; import com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStub; import com.google.cloud.videointelligence.v1.stub.VideoIntelligenceServiceStubSettings; import com.google.longrunning.OperationsClient; import java.io.IOException; | import com.google.api.core.*; import com.google.cloud.videointelligence.v1.stub.*; import com.google.longrunning.*; import java.io.*; | [
"com.google.api",
"com.google.cloud",
"com.google.longrunning",
"java.io"
] | com.google.api; com.google.cloud; com.google.longrunning; java.io; | 1,901,716 |
protected UserSession replaceSessionWithRoutedBy(Award parentAward) {
String routedByUserId = parentAward.getAwardDocument().getDocumentHeader().getWorkflowDocument().getRoutedByPrincipalId();
Person person = getPersonService().getPerson(routedByUserId);
UserSession oldSession = GlobalVariables.getUserSession();
GlobalVariables.setUserSession(new UserSession(person.getPrincipalName()));
return oldSession;
} | UserSession function(Award parentAward) { String routedByUserId = parentAward.getAwardDocument().getDocumentHeader().getWorkflowDocument().getRoutedByPrincipalId(); Person person = getPersonService().getPerson(routedByUserId); UserSession oldSession = GlobalVariables.getUserSession(); GlobalVariables.setUserSession(new UserSession(person.getPrincipalName())); return oldSession; } | /**
* Replace the UserSession with one for the user who routed the parent award.
* @param parentAward
* @return
*/ | Replace the UserSession with one for the user who routed the parent award | replaceSessionWithRoutedBy | {
"repo_name": "sanjupolus/KC6.oLatest",
"path": "coeus-impl/src/main/java/org/kuali/kra/award/awardhierarchy/sync/service/AwardSyncServiceImpl.java",
"license": "agpl-3.0",
"size": 43278
} | [
"org.kuali.kra.award.home.Award",
"org.kuali.rice.kim.api.identity.Person",
"org.kuali.rice.krad.UserSession",
"org.kuali.rice.krad.util.GlobalVariables"
] | import org.kuali.kra.award.home.Award; import org.kuali.rice.kim.api.identity.Person; import org.kuali.rice.krad.UserSession; import org.kuali.rice.krad.util.GlobalVariables; | import org.kuali.kra.award.home.*; import org.kuali.rice.kim.api.identity.*; import org.kuali.rice.krad.*; import org.kuali.rice.krad.util.*; | [
"org.kuali.kra",
"org.kuali.rice"
] | org.kuali.kra; org.kuali.rice; | 957,394 |
PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException; | PlatformAsyncResult processInStreamAsync(int type, BinaryRawReaderEx reader) throws IgniteCheckedException; | /**
* Process asynchronous operation.
*
* @param type Type.
* @param reader Binary reader.
* @return Async result (should not be null).
* @throws IgniteCheckedException In case of exception.
*/ | Process asynchronous operation | processInStreamAsync | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformTarget.java",
"license": "apache-2.0",
"size": 4177
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.binary.BinaryRawReaderEx"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.binary.BinaryRawReaderEx; | import org.apache.ignite.*; import org.apache.ignite.internal.binary.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,707,413 |
private void checkClosed() {
getParent().getCancelCriterion().checkCancelInProgress(null);
if (!this.closed) {
return;
}
throw new OplogCancelledException("This Oplog has been closed.");
} | void function() { getParent().getCancelCriterion().checkCancelInProgress(null); if (!this.closed) { return; } throw new OplogCancelledException(STR); } | /**
* A check to confirm that the oplog has been closed because of the cache being closed
*
*/ | A check to confirm that the oplog has been closed because of the cache being closed | checkClosed | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java",
"license": "apache-2.0",
"size": 283255
} | [
"org.apache.geode.distributed.OplogCancelledException"
] | import org.apache.geode.distributed.OplogCancelledException; | import org.apache.geode.distributed.*; | [
"org.apache.geode"
] | org.apache.geode; | 307,100 |
// [START list_datasets]
public static void listDatasets(final Bigquery bigquery, final String projectId)
throws IOException {
Datasets.List datasetRequest = bigquery.datasets().list(projectId);
DatasetList datasetList = datasetRequest.execute();
if (datasetList.getDatasets() != null) {
List<DatasetList.Datasets> datasets = datasetList.getDatasets();
System.out.println("Available datasets\n----------------");
System.out.println(datasets.toString());
for (DatasetList.Datasets dataset : datasets) {
System.out.format("%s\n", dataset.getDatasetReference().getDatasetId());
}
}
}
// [END list_datasets] | static void function(final Bigquery bigquery, final String projectId) throws IOException { Datasets.List datasetRequest = bigquery.datasets().list(projectId); DatasetList datasetList = datasetRequest.execute(); if (datasetList.getDatasets() != null) { List<DatasetList.Datasets> datasets = datasetList.getDatasets(); System.out.println(STR); System.out.println(datasets.toString()); for (DatasetList.Datasets dataset : datasets) { System.out.format("%s\n", dataset.getDatasetReference().getDatasetId()); } } } | /**
* Display all BigQuery datasets associated with a project.
*
* @param bigquery an authorized BigQuery client
* @param projectId a string containing the current project ID
* @throws IOException Thrown if there is a network error connecting to
* Bigquery.
*/ | Display all BigQuery datasets associated with a project | listDatasets | {
"repo_name": "ErinJoan/mostly_empty_directory",
"path": "bigquery/src/main/java/com/google/cloud/bigquery/samples/BigqueryUtils.java",
"license": "apache-2.0",
"size": 6350
} | [
"com.google.api.services.bigquery.Bigquery",
"com.google.api.services.bigquery.model.DatasetList",
"java.io.IOException",
"java.util.List"
] | import com.google.api.services.bigquery.Bigquery; import com.google.api.services.bigquery.model.DatasetList; import java.io.IOException; import java.util.List; | import com.google.api.services.bigquery.*; import com.google.api.services.bigquery.model.*; import java.io.*; import java.util.*; | [
"com.google.api",
"java.io",
"java.util"
] | com.google.api; java.io; java.util; | 1,350,269 |
public synchronized <SK,PK,E1,E2 extends E1> SecondaryIndex<SK,PK,E2>
getSecondaryIndex(PrimaryIndex<PK,E1> primaryIndex,
Class<E2> entityClass,
String entityClassName,
Class<SK> keyClass,
String keyClassName,
String keyName)
throws DatabaseException {
assert (rawAccess && keyClassName == null) ||
(!rawAccess && keyClassName != null);
checkOpen();
EntityMetadata entityMeta = null;
SecondaryKeyMetadata secKeyMeta = null;
if (entityClass != primaryIndex.getEntityClass()) {
entityMeta = model.getEntityMetadata(entityClassName);
assert entityMeta != null;
secKeyMeta = checkSecKey(entityMeta, keyName);
String subclassName = entityClass.getName();
String declaringClassName = secKeyMeta.getDeclaringClassName();
if (!subclassName.equals(declaringClassName)) {
throw new IllegalArgumentException
("Key for subclass " + subclassName +
" is declared in a different class: " +
makeSecName(declaringClassName, keyName));
}
}
String secName = makeSecName(entityClassName, keyName);
SecondaryIndex<SK,PK,E2> secIndex = secIndexMap.get(secName);
if (secIndex == null) {
if (entityMeta == null) {
entityMeta = model.getEntityMetadata(entityClassName);
assert entityMeta != null;
}
if (secKeyMeta == null) {
secKeyMeta = checkSecKey(entityMeta, keyName);
}
if (keyClassName == null) {
keyClassName = getSecKeyClass(secKeyMeta);
} else {
String expectClsName = getSecKeyClass(secKeyMeta);
if (!keyClassName.equals(expectClsName)) {
throw new IllegalArgumentException
("Wrong secondary key class: " + keyClassName +
" Correct class is: " + expectClsName);
}
}
secIndex = openSecondaryIndex
(null, primaryIndex, entityClass, entityMeta,
keyClass, keyClassName, secKeyMeta, secName,
false , null );
}
return secIndex;
} | synchronized <SK,PK,E1,E2 extends E1> SecondaryIndex<SK,PK,E2> function(PrimaryIndex<PK,E1> primaryIndex, Class<E2> entityClass, String entityClassName, Class<SK> keyClass, String keyClassName, String keyName) throws DatabaseException { assert (rawAccess && keyClassName == null) (!rawAccess && keyClassName != null); checkOpen(); EntityMetadata entityMeta = null; SecondaryKeyMetadata secKeyMeta = null; if (entityClass != primaryIndex.getEntityClass()) { entityMeta = model.getEntityMetadata(entityClassName); assert entityMeta != null; secKeyMeta = checkSecKey(entityMeta, keyName); String subclassName = entityClass.getName(); String declaringClassName = secKeyMeta.getDeclaringClassName(); if (!subclassName.equals(declaringClassName)) { throw new IllegalArgumentException (STR + subclassName + STR + makeSecName(declaringClassName, keyName)); } } String secName = makeSecName(entityClassName, keyName); SecondaryIndex<SK,PK,E2> secIndex = secIndexMap.get(secName); if (secIndex == null) { if (entityMeta == null) { entityMeta = model.getEntityMetadata(entityClassName); assert entityMeta != null; } if (secKeyMeta == null) { secKeyMeta = checkSecKey(entityMeta, keyName); } if (keyClassName == null) { keyClassName = getSecKeyClass(secKeyMeta); } else { String expectClsName = getSecKeyClass(secKeyMeta); if (!keyClassName.equals(expectClsName)) { throw new IllegalArgumentException (STR + keyClassName + STR + expectClsName); } } secIndex = openSecondaryIndex (null, primaryIndex, entityClass, entityMeta, keyClass, keyClassName, secKeyMeta, secName, false , null ); } return secIndex; } | /**
* A getSecondaryIndex with extra parameters for opening a raw store.
* keyClassName is used for consistency checking and should be null for a
* raw store only.
*/ | A getSecondaryIndex with extra parameters for opening a raw store. keyClassName is used for consistency checking and should be null for a raw store only | getSecondaryIndex | {
"repo_name": "plast-lab/DelphJ",
"path": "examples/berkeleydb/com/sleepycat/persist/impl/Store.java",
"license": "mit",
"size": 55422
} | [
"com.sleepycat.je.DatabaseException",
"com.sleepycat.persist.PrimaryIndex",
"com.sleepycat.persist.SecondaryIndex",
"com.sleepycat.persist.model.EntityMetadata",
"com.sleepycat.persist.model.SecondaryKeyMetadata"
] | import com.sleepycat.je.DatabaseException; import com.sleepycat.persist.PrimaryIndex; import com.sleepycat.persist.SecondaryIndex; import com.sleepycat.persist.model.EntityMetadata; import com.sleepycat.persist.model.SecondaryKeyMetadata; | import com.sleepycat.je.*; import com.sleepycat.persist.*; import com.sleepycat.persist.model.*; | [
"com.sleepycat.je",
"com.sleepycat.persist"
] | com.sleepycat.je; com.sleepycat.persist; | 427,715 |
public File getSelectedNode(){
return selectedNode_;
}
| File function(){ return selectedNode_; } | /**
* Methode d'acces pour l'attribut selectedNode_
* @return
*/ | Methode d'acces pour l'attribut selectedNode_ | getSelectedNode | {
"repo_name": "Fidouda/LOG8430",
"path": "TP1Option1/src/Model/SimpleModel.java",
"license": "gpl-2.0",
"size": 5564
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,111,522 |
@ServiceMethod(returns = ReturnType.SINGLE)
public FrontendIpConfigurationInner get(
String resourceGroupName, String loadBalancerName, String frontendIpConfigurationName) {
return getAsync(resourceGroupName, loadBalancerName, frontendIpConfigurationName).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) FrontendIpConfigurationInner function( String resourceGroupName, String loadBalancerName, String frontendIpConfigurationName) { return getAsync(resourceGroupName, loadBalancerName, frontendIpConfigurationName).block(); } | /**
* Gets load balancer frontend IP configuration.
*
* @param resourceGroupName The name of the resource group.
* @param loadBalancerName The name of the load balancer.
* @param frontendIpConfigurationName The name of the frontend IP configuration.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return load balancer frontend IP configuration.
*/ | Gets load balancer frontend IP configuration | get | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/LoadBalancerFrontendIpConfigurationsClientImpl.java",
"license": "mit",
"size": 24678
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.network.fluent.models.FrontendIpConfigurationInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,090,979 |
public void initMetaData() {
EiColumn eiColumn;
eiColumn = new EiColumn("providerId");
eiColumn.setFieldLength(10);
eiColumn.setDescName("供应商代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("providerName");
eiColumn.setFieldLength(100);
eiColumn.setDescName("供应商名称");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("contractSubid");
eiColumn.setFieldLength(23);
eiColumn.setDescName("合同子项号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("productId");
eiColumn.setFieldLength(20);
eiColumn.setDescName("资源号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("prodTypeDesc");
eiColumn.setFieldLength(60);
eiColumn.setDescName("品名");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("shopsign");
eiColumn.setFieldLength(100);
eiColumn.setDescName("牌号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("spec");
eiColumn.setFieldLength(300);
eiColumn.setDescName("规格");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("producingAreaName");
eiColumn.setFieldLength(50);
eiColumn.setDescName("产地");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("techStandard");
eiColumn.setFieldLength(200);
eiColumn.setDescName("技术标准");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("q_grade");
eiColumn.setFieldLength(100);
eiColumn.setDescName("质量等级");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("weightQty");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("采购量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("purPriceAt");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("采购单价(含税)");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("putinWeight");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("入库量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("settleQty");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("结算量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("nosettleWeight");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("未结算量");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("nosettleAmount");
eiColumn.setType("N");
eiColumn.setScaleLength(6);
eiColumn.setFieldLength(18);
eiColumn.setDescName("未结算金额");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("purDate");
eiColumn.setFieldLength(10);
eiColumn.setDescName("采购日期");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("contSubstatus");
eiColumn.setFieldLength(100);
eiColumn.setDescName("子项状态");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("contractId");
eiColumn.setFieldLength(20);
eiColumn.setDescName("采购合同号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("userId");
eiColumn.setFieldLength(30);
eiColumn.setDescName("业务员代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("segNo");
eiColumn.setFieldLength(20);
eiColumn.setDescName("业务单元号");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("productTypeId");
eiColumn.setFieldLength(10);
eiColumn.setDescName("品种代码");
eiMetadata.addMeta(eiColumn);
eiColumn = new EiColumn("producingAreaCode");
eiColumn.setFieldLength(20);
eiColumn.setDescName("产地代码");
eiMetadata.addMeta(eiColumn);
}
public STRP0104() {
initMetaData();
}
| void function() { EiColumn eiColumn; eiColumn = new EiColumn(STR); eiColumn.setFieldLength(10); eiColumn.setDescName("供应商代码"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(100); eiColumn.setDescName("供应商名称"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(23); eiColumn.setDescName("合同子项号"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(20); eiColumn.setDescName("资源号"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(60); eiColumn.setDescName("品名"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(100); eiColumn.setDescName("牌号"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn("spec"); eiColumn.setFieldLength(300); eiColumn.setDescName("规格"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(50); eiColumn.setDescName("产地"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(200); eiColumn.setDescName("技术标准"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(100); eiColumn.setDescName("质量等级"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName("采购量"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName(STR); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName("入库量"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName("结算量"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName("未结算量"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setType("N"); eiColumn.setScaleLength(6); eiColumn.setFieldLength(18); eiColumn.setDescName("未结算金额"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(10); eiColumn.setDescName("采购日期"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(100); eiColumn.setDescName("子项状态"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(20); eiColumn.setDescName("采购合同号"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(30); eiColumn.setDescName("业务员代码"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn("segNo"); eiColumn.setFieldLength(20); eiColumn.setDescName("业务单元号"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(10); eiColumn.setDescName("品种代码"); eiMetadata.addMeta(eiColumn); eiColumn = new EiColumn(STR); eiColumn.setFieldLength(20); eiColumn.setDescName("产地代码"); eiMetadata.addMeta(eiColumn); } STRP0104() { function(); } | /**
* initialize the metadata
*/ | initialize the metadata | initMetaData | {
"repo_name": "stserp/erp1",
"path": "source/src/com/baosight/sts/st/rp/domain/STRP0104.java",
"license": "apache-2.0",
"size": 17401
} | [
"com.baosight.iplat4j.core.ei.EiColumn"
] | import com.baosight.iplat4j.core.ei.EiColumn; | import com.baosight.iplat4j.core.ei.*; | [
"com.baosight.iplat4j"
] | com.baosight.iplat4j; | 734,063 |
EReference getPhysicalDevice_LogicalDevice(); | EReference getPhysicalDevice_LogicalDevice(); | /**
* Returns the meta object for the reference list '{@link COSEM.PhysicalDevice#getLogicalDevice <em>Logical Device</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference list '<em>Logical Device</em>'.
* @see COSEM.PhysicalDevice#getLogicalDevice()
* @see #getPhysicalDevice()
* @generated
*/ | Returns the meta object for the reference list '<code>COSEM.PhysicalDevice#getLogicalDevice Logical Device</code>'. | getPhysicalDevice_LogicalDevice | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/COSEM/COSEMPackage.java",
"license": "mit",
"size": 60487
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,873,378 |
if (isInited) return (MindstormsPackage)EPackage.Registry.INSTANCE.getEPackage(MindstormsPackage.eNS_URI);
// Obtain or create and register package
MindstormsPackageImpl theMindstormsPackage = (MindstormsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MindstormsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MindstormsPackageImpl());
isInited = true;
// Create package meta-data objects
theMindstormsPackage.createPackageContents();
// Initialize created meta-data
theMindstormsPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theMindstormsPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(MindstormsPackage.eNS_URI, theMindstormsPackage);
return theMindstormsPackage;
} | if (isInited) return (MindstormsPackage)EPackage.Registry.INSTANCE.getEPackage(MindstormsPackage.eNS_URI); MindstormsPackageImpl theMindstormsPackage = (MindstormsPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof MindstormsPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new MindstormsPackageImpl()); isInited = true; theMindstormsPackage.createPackageContents(); theMindstormsPackage.initializePackageContents(); theMindstormsPackage.freeze(); EPackage.Registry.INSTANCE.put(MindstormsPackage.eNS_URI, theMindstormsPackage); return theMindstormsPackage; } | /**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link MindstormsPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/ | Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>MindstormsPackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. | init | {
"repo_name": "mbats/mindstorms",
"path": "plugins/fr.obeo.dsl.mindstorms/src-gen/fr/obeo/dsl/mindstorms/impl/MindstormsPackageImpl.java",
"license": "epl-1.0",
"size": 32889
} | [
"fr.obeo.dsl.mindstorms.MindstormsPackage",
"org.eclipse.emf.ecore.EPackage"
] | import fr.obeo.dsl.mindstorms.MindstormsPackage; import org.eclipse.emf.ecore.EPackage; | import fr.obeo.dsl.mindstorms.*; import org.eclipse.emf.ecore.*; | [
"fr.obeo.dsl",
"org.eclipse.emf"
] | fr.obeo.dsl; org.eclipse.emf; | 2,647,808 |
default Optional<String> parameter(String parameter) {
List<String> values = parameters().get(parameter);
if (values != null) {
return Optional.ofNullable(values.get(0));
} else {
return Optional.empty();
}
}
/**
* The headers of the request message.
* Deprecated in favor of {@link Request#headerEntries()} | default Optional<String> parameter(String parameter) { List<String> values = parameters().get(parameter); if (values != null) { return Optional.ofNullable(values.get(0)); } else { return Optional.empty(); } } /** * The headers of the request message. * Deprecated in favor of {@link Request#headerEntries()} | /**
* A uri query parameter of the request message, or empty if no parameter with that name is found.
* Returns the first query parameter value if it is repeated. Use {@link #parameters()} to get
* all repeated values.
*/ | A uri query parameter of the request message, or empty if no parameter with that name is found. Returns the first query parameter value if it is repeated. Use <code>#parameters()</code> to get all repeated values | parameter | {
"repo_name": "spotify/apollo",
"path": "apollo-api/src/main/java/com/spotify/apollo/Request.java",
"license": "apache-2.0",
"size": 5271
} | [
"java.util.List",
"java.util.Optional"
] | import java.util.List; import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 2,546,444 |
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
{
return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
}
public void openInventory() {}
| boolean function(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; } public void openInventory() {} | /**
* Do not make give this method the name canInteractWith because it clashes with Container
*/ | Do not make give this method the name canInteractWith because it clashes with Container | isUseableByPlayer | {
"repo_name": "NEMESIS13cz/Evercraft",
"path": "java/evercraft/NEMESIS13cz/TileEntity/TileEntity/TileEntityEnricher.java",
"license": "gpl-3.0",
"size": 20611
} | [
"net.minecraft.entity.player.EntityPlayer"
] | import net.minecraft.entity.player.EntityPlayer; | import net.minecraft.entity.player.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 2,441,548 |
public void testGetQueueDefault() {
HttpServletRequest req = createMock(HttpServletRequest.class);
expect(req.getHeader("X-AppEngine-QueueName")).andReturn(null);
expect(req.getParameter(AppEngineJobContext.JOB_ID_PARAMETER_NAME))
.andReturn(jobId.toString())
.anyTimes();
replay(req);
Configuration conf = new Configuration(false);
persistMRState(jobId, conf);
AppEngineJobContext context = new AppEngineJobContext(req, false);
assertEquals("default", context.getWorkerQueue().getQueueName());
verify(req);
} | void function() { HttpServletRequest req = createMock(HttpServletRequest.class); expect(req.getHeader(STR)).andReturn(null); expect(req.getParameter(AppEngineJobContext.JOB_ID_PARAMETER_NAME)) .andReturn(jobId.toString()) .anyTimes(); replay(req); Configuration conf = new Configuration(false); persistMRState(jobId, conf); AppEngineJobContext context = new AppEngineJobContext(req, false); assertEquals(STR, context.getWorkerQueue().getQueueName()); verify(req); } | /**
* Ensures that {@link AppEngineJobContext#getWorkerQueue()} falls back
* to the default queue.
*/ | Ensures that <code>AppEngineJobContext#getWorkerQueue()</code> falls back to the default queue | testGetQueueDefault | {
"repo_name": "bradseefeld/AppEngine-MapReduce",
"path": "test/com/google/appengine/tools/mapreduce/AppEngineJobContextTest.java",
"license": "apache-2.0",
"size": 7038
} | [
"javax.servlet.http.HttpServletRequest",
"org.apache.hadoop.conf.Configuration",
"org.easymock.EasyMock"
] | import javax.servlet.http.HttpServletRequest; import org.apache.hadoop.conf.Configuration; import org.easymock.EasyMock; | import javax.servlet.http.*; import org.apache.hadoop.conf.*; import org.easymock.*; | [
"javax.servlet",
"org.apache.hadoop",
"org.easymock"
] | javax.servlet; org.apache.hadoop; org.easymock; | 1,482,675 |
@Override
public boolean supportsGroupByUnrelated() throws SQLException {
return realDatabaseMetaData.supportsGroupByUnrelated();
} | boolean function() throws SQLException { return realDatabaseMetaData.supportsGroupByUnrelated(); } | /**
* Retrieves whether this database supports using a column that is
* not in the <code>SELECT</code> statement in a
* <code>GROUP BY</code> clause.
*
* @return <code>true</code> if so; <code>false</code> otherwise
* @throws SQLException if a database access error occurs
*/ | Retrieves whether this database supports using a column that is not in the <code>SELECT</code> statement in a <code>GROUP BY</code> clause | supportsGroupByUnrelated | {
"repo_name": "mattyb149/pdi-presto-jdbc",
"path": "src/main/java/org/pentaho/community/di/plugins/database/presto/delegate/DelegateDatabaseMetaData.java",
"license": "apache-2.0",
"size": 148362
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,219,059 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.