method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public Function getFunction() {
return getRoot().evaluate();
} | Function function() { return getRoot().evaluate(); } | /**
* Gets the root function after it has been built. The function is
* automatically evaluated first, to put it into its simplest form.
*
* It should be fine if additional nodes are added after this function is
* called.
*
* @return The root function.
*/ | Gets the root function after it has been built. The function is automatically evaluated first, to put it into its simplest form. It should be fine if additional nodes are added after this function is called | getFunction | {
"repo_name": "adamheins/dervish",
"path": "src/com/adamheins/dervish/builder/FunctionBuilder.java",
"license": "mit",
"size": 1822
} | [
"com.adamheins.dervish.function.Function"
] | import com.adamheins.dervish.function.Function; | import com.adamheins.dervish.function.*; | [
"com.adamheins.dervish"
] | com.adamheins.dervish; | 717,301 |
public void setCfmMpid(Set<Long> cfmMpid) {
ColumnDescription columndesc = new ColumnDescription(
InterfaceColumn.CFMMPID
.columnName(),
"setCfmMpid",
VersionNum.VERSION400);
super.setDataHandler(columndesc, cfmMpid);
}
| void function(Set<Long> cfmMpid) { ColumnDescription columndesc = new ColumnDescription( InterfaceColumn.CFMMPID .columnName(), STR, VersionNum.VERSION400); super.setDataHandler(columndesc, cfmMpid); } | /**
* Add a Column entity which column name is "cfm_mpid" to the Row entity of
* attributes.
* @param cfmMpid the column data which column name is "cfm_mpid"
*/ | Add a Column entity which column name is "cfm_mpid" to the Row entity of attributes | setCfmMpid | {
"repo_name": "kuangrewawa/OnosFw",
"path": "ovsdb/rfc/src/main/java/org/onosproject/ovsdb/rfc/table/Interface.java",
"license": "apache-2.0",
"size": 51208
} | [
"java.util.Set",
"org.onosproject.ovsdb.rfc.tableservice.ColumnDescription"
] | import java.util.Set; import org.onosproject.ovsdb.rfc.tableservice.ColumnDescription; | import java.util.*; import org.onosproject.ovsdb.rfc.tableservice.*; | [
"java.util",
"org.onosproject.ovsdb"
] | java.util; org.onosproject.ovsdb; | 820,586 |
Set<PreferenceId> getPreferenceIds(); | Set<PreferenceId> getPreferenceIds(); | /**
* Returns all needed preference IDs.
*
* @return A {@link Set} containing all {@link PreferenceId}. Returning <code>null</code> is not
* permitted here. At least a {@link java.util.Collections#EMPTY_SET} should be
* returned.
*/ | Returns all needed preference IDs | getPreferenceIds | {
"repo_name": "kugelr/inspectIT",
"path": "inspectIT/src/info/novatec/inspectit/rcp/editor/table/input/TableInputController.java",
"license": "agpl-3.0",
"size": 6282
} | [
"info.novatec.inspectit.rcp.editor.preferences.PreferenceId",
"java.util.Set"
] | import info.novatec.inspectit.rcp.editor.preferences.PreferenceId; import java.util.Set; | import info.novatec.inspectit.rcp.editor.preferences.*; import java.util.*; | [
"info.novatec.inspectit",
"java.util"
] | info.novatec.inspectit; java.util; | 1,667,747 |
@Override public T visitDataAttribute(@NotNull SQLANNParser.DataAttributeContext ctx) { return visitChildren(ctx); } | @Override public T visitDataAttribute(@NotNull SQLANNParser.DataAttributeContext ctx) { return visitChildren(ctx); } | /**
* {@inheritDoc}
*
* <p>The default implementation returns the result of calling
* {@link #visitChildren} on {@code ctx}.</p>
*/ | The default implementation returns the result of calling <code>#visitChildren</code> on ctx | visitValues | {
"repo_name": "wfcreations/ANNMS",
"path": "src/br/com/wfcreations/annms/core/sqlann/SQLANNBaseVisitor.java",
"license": "bsd-3-clause",
"size": 10911
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,330,740 |
private static Bitmap createScaledBitmap(Bitmap source, int width, int height)
{
int sourceWidth = source.getWidth();
int sourceHeight = source.getHeight();
float scale = Math.min((float)width / sourceWidth, (float)height / sourceHeight);
sourceWidth *= scale;
sourceHeight *= scale;
return Bitmap.createScaledBitmap(source, sourceWidth, sourceHeight, true);
} | static Bitmap function(Bitmap source, int width, int height) { int sourceWidth = source.getWidth(); int sourceHeight = source.getHeight(); float scale = Math.min((float)width / sourceWidth, (float)height / sourceHeight); sourceWidth *= scale; sourceHeight *= scale; return Bitmap.createScaledBitmap(source, sourceWidth, sourceHeight, true); } | /**
* Scales a bitmap to fit in a rectangle of the given size. Aspect ratio is
* preserved. At least one dimension of the result will match the provided
* dimension exactly.
*
* @param source The bitmap to be scaled
* @param width Maximum width of image
* @param height Maximum height of image
* @return The scaled bitmap.
*/ | Scales a bitmap to fit in a rectangle of the given size. Aspect ratio is preserved. At least one dimension of the result will match the provided dimension exactly | createScaledBitmap | {
"repo_name": "alex73/vanilla",
"path": "src/ch/blinkenlights/android/vanilla/CoverBitmap.java",
"license": "gpl-3.0",
"size": 12703
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,441,566 |
public void testPutRmvFindSizeMultithreaded() throws Exception {
MAX_PER_PAGE = 5;
CNT = 60_000;
final int SLIDING_WINDOW_SIZE = 100;
final TestTree tree = createTestTree(false);
final AtomicLong curPutKey = new AtomicLong(0);
final BlockingQueue<Long> rowsToRemove = new ArrayBlockingQueue<>(SLIDING_WINDOW_SIZE);
final int hwThreadCnt = Runtime.getRuntime().availableProcessors();
final int putThreadCnt = Math.max(1, hwThreadCnt / 4);
final int rmvThreadCnt = Math.max(1, hwThreadCnt / 4);
final int findThreadCnt = Math.max(1, hwThreadCnt / 4);
final int sizeThreadCnt = Math.max(1, hwThreadCnt - putThreadCnt - rmvThreadCnt - findThreadCnt);
final AtomicInteger sizeInvokeCnt = new AtomicInteger(0);
final int loopCnt = CNT; | void function() throws Exception { MAX_PER_PAGE = 5; CNT = 60_000; final int SLIDING_WINDOW_SIZE = 100; final TestTree tree = createTestTree(false); final AtomicLong curPutKey = new AtomicLong(0); final BlockingQueue<Long> rowsToRemove = new ArrayBlockingQueue<>(SLIDING_WINDOW_SIZE); final int hwThreadCnt = Runtime.getRuntime().availableProcessors(); final int putThreadCnt = Math.max(1, hwThreadCnt / 4); final int rmvThreadCnt = Math.max(1, hwThreadCnt / 4); final int findThreadCnt = Math.max(1, hwThreadCnt / 4); final int sizeThreadCnt = Math.max(1, hwThreadCnt - putThreadCnt - rmvThreadCnt - findThreadCnt); final AtomicInteger sizeInvokeCnt = new AtomicInteger(0); final int loopCnt = CNT; | /**
* The test verifies that {@link BPlusTree#put}, {@link BPlusTree#remove}, {@link BPlusTree#find}, and
* {@link BPlusTree#size} run concurrently, perform correctly and report correct values.
*
* A sliding window of numbers is maintainted in the tests.
*
* NB: This test has to be changed with the integration of IGNITE-3478.
*
* @throws Exception If failed.
*/ | The test verifies that <code>BPlusTree#put</code>, <code>BPlusTree#remove</code>, <code>BPlusTree#find</code>, and <code>BPlusTree#size</code> run concurrently, perform correctly and report correct values. A sliding window of numbers is maintainted in the tests | testPutRmvFindSizeMultithreaded | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/database/BPlusTreeSelfTest.java",
"license": "apache-2.0",
"size": 81175
} | [
"java.util.concurrent.ArrayBlockingQueue",
"java.util.concurrent.BlockingQueue",
"java.util.concurrent.atomic.AtomicInteger",
"java.util.concurrent.atomic.AtomicLong"
] | import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; | import java.util.concurrent.*; import java.util.concurrent.atomic.*; | [
"java.util"
] | java.util; | 1,648,592 |
public CcLibraryHelper addDynamicLibraries(Iterable<LibraryToLink> libraries) {
Iterables.addAll(dynamicLibraries, libraries);
return this;
} | CcLibraryHelper function(Iterable<LibraryToLink> libraries) { Iterables.addAll(dynamicLibraries, libraries); return this; } | /**
* Add the corresponding files as dynamic libraries into the linker outputs (i.e., after the
* linker action) - this makes them available for linking to binary rules that depend on this
* rule.
*/ | Add the corresponding files as dynamic libraries into the linker outputs (i.e., after the linker action) - this makes them available for linking to binary rules that depend on this rule | addDynamicLibraries | {
"repo_name": "dinowernli/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java",
"license": "apache-2.0",
"size": 41137
} | [
"com.google.common.collect.Iterables",
"com.google.devtools.build.lib.rules.cpp.LinkerInputs"
] | import com.google.common.collect.Iterables; import com.google.devtools.build.lib.rules.cpp.LinkerInputs; | import com.google.common.collect.*; import com.google.devtools.build.lib.rules.cpp.*; | [
"com.google.common",
"com.google.devtools"
] | com.google.common; com.google.devtools; | 1,678,029 |
@Override
public StorageAccountGetResponse get(String accountName) throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException {
// Validate
if (accountName == null) {
throw new NullPointerException("accountName");
}
// Tracing
boolean shouldTrace = CloudTracing.getIsEnabled();
String invocationId = null;
if (shouldTrace) {
invocationId = Long.toString(CloudTracing.getNextInvocationId());
HashMap<String, Object> tracingParameters = new HashMap<String, Object>();
tracingParameters.put("accountName", accountName);
CloudTracing.enter(invocationId, this, "getAsync", tracingParameters);
}
// Construct URL
String url = "";
url = url + "/";
if (this.getClient().getCredentials().getSubscriptionId() != null) {
url = url + URLEncoder.encode(this.getClient().getCredentials().getSubscriptionId(), "UTF-8");
}
url = url + "/services/storageservices/";
url = url + URLEncoder.encode(accountName, "UTF-8");
String baseUrl = this.getClient().getBaseUri().toString();
// Trim '/' character from the end of baseUrl and beginning of url.
if (baseUrl.charAt(baseUrl.length() - 1) == '/') {
baseUrl = baseUrl.substring(0, (baseUrl.length() - 1) + 0);
}
if (url.charAt(0) == '/') {
url = url.substring(1);
}
url = baseUrl + "/" + url;
url = url.replace(" ", "%20");
// Create HTTP transport objects
HttpGet httpRequest = new HttpGet(url);
// Set Headers
httpRequest.setHeader("x-ms-version", "2014-10-01");
// Send Request
HttpResponse httpResponse = null;
try {
if (shouldTrace) {
CloudTracing.sendRequest(invocationId, httpRequest);
}
httpResponse = this.getClient().getHttpClient().execute(httpRequest);
if (shouldTrace) {
CloudTracing.receiveResponse(invocationId, httpResponse);
}
int statusCode = httpResponse.getStatusLine().getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
ServiceException ex = ServiceException.createFromXml(httpRequest, null, httpResponse, httpResponse.getEntity());
if (shouldTrace) {
CloudTracing.error(invocationId, ex);
}
throw ex;
}
// Create Result
StorageAccountGetResponse result = null;
// Deserialize Response
if (statusCode == HttpStatus.SC_OK) {
InputStream responseContent = httpResponse.getEntity().getContent();
result = new StorageAccountGetResponse();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
Document responseDoc = documentBuilder.parse(new BOMInputStream(responseContent));
Element storageServiceElement = XmlUtility.getElementByTagNameNS(responseDoc, "http://schemas.microsoft.com/windowsazure", "StorageService");
if (storageServiceElement != null) {
StorageAccount storageServiceInstance = new StorageAccount();
result.setStorageAccount(storageServiceInstance);
Element urlElement = XmlUtility.getElementByTagNameNS(storageServiceElement, "http://schemas.microsoft.com/windowsazure", "Url");
if (urlElement != null) {
URI urlInstance;
urlInstance = new URI(urlElement.getTextContent());
storageServiceInstance.setUri(urlInstance);
}
Element serviceNameElement = XmlUtility.getElementByTagNameNS(storageServiceElement, "http://schemas.microsoft.com/windowsazure", "ServiceName");
if (serviceNameElement != null) {
String serviceNameInstance;
serviceNameInstance = serviceNameElement.getTextContent();
storageServiceInstance.setName(serviceNameInstance);
}
Element storageServicePropertiesElement = XmlUtility.getElementByTagNameNS(storageServiceElement, "http://schemas.microsoft.com/windowsazure", "StorageServiceProperties");
if (storageServicePropertiesElement != null) {
StorageAccountProperties storageServicePropertiesInstance = new StorageAccountProperties();
storageServiceInstance.setProperties(storageServicePropertiesInstance);
Element descriptionElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "Description");
if (descriptionElement != null) {
boolean isNil = false;
Attr nilAttribute = descriptionElement.getAttributeNodeNS("http://www.w3.org/2001/XMLSchema-instance", "nil");
if (nilAttribute != null) {
isNil = "true".equals(nilAttribute.getValue());
}
if (isNil == false) {
String descriptionInstance;
descriptionInstance = descriptionElement.getTextContent();
storageServicePropertiesInstance.setDescription(descriptionInstance);
}
}
Element affinityGroupElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "AffinityGroup");
if (affinityGroupElement != null) {
String affinityGroupInstance;
affinityGroupInstance = affinityGroupElement.getTextContent();
storageServicePropertiesInstance.setAffinityGroup(affinityGroupInstance);
}
Element locationElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "Location");
if (locationElement != null) {
String locationInstance;
locationInstance = locationElement.getTextContent();
storageServicePropertiesInstance.setLocation(locationInstance);
}
Element labelElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "Label");
if (labelElement != null) {
String labelInstance;
labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null;
storageServicePropertiesInstance.setLabel(labelInstance);
}
Element statusElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "Status");
if (statusElement != null && statusElement.getTextContent() != null && !statusElement.getTextContent().isEmpty()) {
StorageAccountStatus statusInstance;
statusInstance = StorageAccountStatus.valueOf(statusElement.getTextContent());
storageServicePropertiesInstance.setStatus(statusInstance);
}
Element endpointsSequenceElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "Endpoints");
if (endpointsSequenceElement != null) {
for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(endpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Endpoint").size(); i1 = i1 + 1) {
org.w3c.dom.Element endpointsElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(endpointsSequenceElement, "http://schemas.microsoft.com/windowsazure", "Endpoint").get(i1));
storageServicePropertiesInstance.getEndpoints().add(new URI(endpointsElement.getTextContent()));
}
}
Element geoPrimaryRegionElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "GeoPrimaryRegion");
if (geoPrimaryRegionElement != null) {
String geoPrimaryRegionInstance;
geoPrimaryRegionInstance = geoPrimaryRegionElement.getTextContent();
storageServicePropertiesInstance.setGeoPrimaryRegion(geoPrimaryRegionInstance);
}
Element statusOfPrimaryElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "StatusOfPrimary");
if (statusOfPrimaryElement != null && statusOfPrimaryElement.getTextContent() != null && !statusOfPrimaryElement.getTextContent().isEmpty()) {
GeoRegionStatus statusOfPrimaryInstance;
statusOfPrimaryInstance = GeoRegionStatus.valueOf(statusOfPrimaryElement.getTextContent());
storageServicePropertiesInstance.setStatusOfGeoPrimaryRegion(statusOfPrimaryInstance);
}
Element lastGeoFailoverTimeElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "LastGeoFailoverTime");
if (lastGeoFailoverTimeElement != null && lastGeoFailoverTimeElement.getTextContent() != null && !lastGeoFailoverTimeElement.getTextContent().isEmpty()) {
Calendar lastGeoFailoverTimeInstance;
lastGeoFailoverTimeInstance = DatatypeConverter.parseDateTime(lastGeoFailoverTimeElement.getTextContent());
storageServicePropertiesInstance.setLastGeoFailoverTime(lastGeoFailoverTimeInstance);
}
Element geoSecondaryRegionElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "GeoSecondaryRegion");
if (geoSecondaryRegionElement != null) {
String geoSecondaryRegionInstance;
geoSecondaryRegionInstance = geoSecondaryRegionElement.getTextContent();
storageServicePropertiesInstance.setGeoSecondaryRegion(geoSecondaryRegionInstance);
}
Element statusOfSecondaryElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "StatusOfSecondary");
if (statusOfSecondaryElement != null && statusOfSecondaryElement.getTextContent() != null && !statusOfSecondaryElement.getTextContent().isEmpty()) {
GeoRegionStatus statusOfSecondaryInstance;
statusOfSecondaryInstance = GeoRegionStatus.valueOf(statusOfSecondaryElement.getTextContent());
storageServicePropertiesInstance.setStatusOfGeoSecondaryRegion(statusOfSecondaryInstance);
}
Element accountTypeElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, "http://schemas.microsoft.com/windowsazure", "AccountType");
if (accountTypeElement != null) {
String accountTypeInstance;
accountTypeInstance = accountTypeElement.getTextContent();
storageServicePropertiesInstance.setAccountType(accountTypeInstance);
}
}
Element extendedPropertiesSequenceElement = XmlUtility.getElementByTagNameNS(storageServiceElement, "http://schemas.microsoft.com/windowsazure", "ExtendedProperties");
if (extendedPropertiesSequenceElement != null) {
for (int i2 = 0; i2 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(extendedPropertiesSequenceElement, "http://schemas.microsoft.com/windowsazure", "ExtendedProperty").size(); i2 = i2 + 1) {
org.w3c.dom.Element extendedPropertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(extendedPropertiesSequenceElement, "http://schemas.microsoft.com/windowsazure", "ExtendedProperty").get(i2));
String extendedPropertiesKey = XmlUtility.getElementByTagNameNS(extendedPropertiesElement, "http://schemas.microsoft.com/windowsazure", "Name").getTextContent();
String extendedPropertiesValue = XmlUtility.getElementByTagNameNS(extendedPropertiesElement, "http://schemas.microsoft.com/windowsazure", "Value").getTextContent();
storageServiceInstance.getExtendedProperties().put(extendedPropertiesKey, extendedPropertiesValue);
}
}
}
}
result.setStatusCode(statusCode);
if (httpResponse.getHeaders("x-ms-request-id").length > 0) {
result.setRequestId(httpResponse.getFirstHeader("x-ms-request-id").getValue());
}
if (shouldTrace) {
CloudTracing.exit(invocationId, result);
}
return result;
} finally {
if (httpResponse != null && httpResponse.getEntity() != null) {
httpResponse.getEntity().getContent().close();
}
}
} | StorageAccountGetResponse function(String accountName) throws IOException, ServiceException, ParserConfigurationException, SAXException, URISyntaxException { if (accountName == null) { throw new NullPointerException(STR); } boolean shouldTrace = CloudTracing.getIsEnabled(); String invocationId = null; if (shouldTrace) { invocationId = Long.toString(CloudTracing.getNextInvocationId()); HashMap<String, Object> tracingParameters = new HashMap<String, Object>(); tracingParameters.put(STR, accountName); CloudTracing.enter(invocationId, this, STR, tracingParameters); } String url = STR/STRUTF-8STR/services/storageservices/STRUTF-8STR/STR STR%20STRx-ms-versionSTR2014-10-01STRhttp: if (storageServiceElement != null) { StorageAccount storageServiceInstance = new StorageAccount(); result.setStorageAccount(storageServiceInstance); Element urlElement = XmlUtility.getElementByTagNameNS(storageServiceElement, STRhttp: if (serviceNameElement != null) { String serviceNameInstance; serviceNameInstance = serviceNameElement.getTextContent(); storageServiceInstance.setName(serviceNameInstance); } Element storageServicePropertiesElement = XmlUtility.getElementByTagNameNS(storageServiceElement, STRhttp: if (descriptionElement != null) { boolean isNil = false; Attr nilAttribute = descriptionElement.getAttributeNodeNS(STRtrueSTRhttp: if (affinityGroupElement != null) { String affinityGroupInstance; affinityGroupInstance = affinityGroupElement.getTextContent(); storageServicePropertiesInstance.setAffinityGroup(affinityGroupInstance); } Element locationElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, STRhttp: if (labelElement != null) { String labelInstance; labelInstance = labelElement.getTextContent() != null ? new String(Base64.decode(labelElement.getTextContent())) : null; storageServicePropertiesInstance.setLabel(labelInstance); } Element statusElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, STRhttp: if (endpointsSequenceElement != null) { for (int i1 = 0; i1 < com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(endpointsSequenceElement, STRhttp: storageServicePropertiesInstance.getEndpoints().add(new URI(endpointsElement.getTextContent())); } } Element geoPrimaryRegionElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, STRhttp: if (statusOfPrimaryElement != null && statusOfPrimaryElement.getTextContent() != null && !statusOfPrimaryElement.getTextContent().isEmpty()) { GeoRegionStatus statusOfPrimaryInstance; statusOfPrimaryInstance = GeoRegionStatus.valueOf(statusOfPrimaryElement.getTextContent()); storageServicePropertiesInstance.setStatusOfGeoPrimaryRegion(statusOfPrimaryInstance); } Element lastGeoFailoverTimeElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, STRhttp: if (geoSecondaryRegionElement != null) { String geoSecondaryRegionInstance; geoSecondaryRegionInstance = geoSecondaryRegionElement.getTextContent(); storageServicePropertiesInstance.setGeoSecondaryRegion(geoSecondaryRegionInstance); } Element statusOfSecondaryElement = XmlUtility.getElementByTagNameNS(storageServicePropertiesElement, STRhttp: if (accountTypeElement != null) { String accountTypeInstance; accountTypeInstance = accountTypeElement.getTextContent(); storageServicePropertiesInstance.setAccountType(accountTypeInstance); } } Element extendedPropertiesSequenceElement = XmlUtility.getElementByTagNameNS(storageServiceElement, STRhttp: org.w3c.dom.Element extendedPropertiesElement = ((org.w3c.dom.Element) com.microsoft.windowsazure.core.utils.XmlUtility.getElementsByTagNameNS(extendedPropertiesSequenceElement, STRhttp: String extendedPropertiesValue = XmlUtility.getElementByTagNameNS(extendedPropertiesElement, STRx-ms-request-idSTRx-ms-request-id").getValue()); } if (shouldTrace) { CloudTracing.exit(invocationId, result); } return result; } finally { if (httpResponse != null && httpResponse.getEntity() != null) { httpResponse.getEntity().getContent().close(); } } } | /**
* The Get Storage Account Properties operation returns system properties
* for the specified storage account. (see
* http://msdn.microsoft.com/en-us/library/windowsazure/ee460802.aspx for
* more information)
*
* @param accountName Required. Name of the storage account to get
* properties for.
* @throws IOException Signals that an I/O exception of some sort has
* occurred. This class is the general class of exceptions produced by
* failed or interrupted I/O operations.
* @throws ServiceException Thrown if an unexpected response is found.
* @throws ParserConfigurationException Thrown if there was a serious
* configuration error with the document parser.
* @throws SAXException Thrown if there was an error parsing the XML
* response.
* @throws URISyntaxException Thrown if there was an error parsing a URI in
* the response.
* @return The Get Storage Account Properties operation response.
*/ | The Get Storage Account Properties operation returns system properties for the specified storage account. (see HREF for more information) | get | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "service-management/azure-svc-mgmt-storage/src/main/java/com/microsoft/windowsazure/management/storage/StorageAccountOperationsImpl.java",
"license": "apache-2.0",
"size": 97233
} | [
"com.microsoft.windowsazure.core.utils.Base64",
"com.microsoft.windowsazure.core.utils.XmlUtility",
"com.microsoft.windowsazure.exception.ServiceException",
"com.microsoft.windowsazure.management.storage.models.GeoRegionStatus",
"com.microsoft.windowsazure.management.storage.models.StorageAccount",
"com.microsoft.windowsazure.management.storage.models.StorageAccountGetResponse",
"com.microsoft.windowsazure.tracing.CloudTracing",
"java.io.IOException",
"java.net.URISyntaxException",
"java.util.HashMap",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Attr",
"org.w3c.dom.Element",
"org.xml.sax.SAXException"
] | import com.microsoft.windowsazure.core.utils.Base64; import com.microsoft.windowsazure.core.utils.XmlUtility; import com.microsoft.windowsazure.exception.ServiceException; import com.microsoft.windowsazure.management.storage.models.GeoRegionStatus; import com.microsoft.windowsazure.management.storage.models.StorageAccount; import com.microsoft.windowsazure.management.storage.models.StorageAccountGetResponse; import com.microsoft.windowsazure.tracing.CloudTracing; import java.io.IOException; import java.net.URISyntaxException; import java.util.HashMap; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Attr; import org.w3c.dom.Element; import org.xml.sax.SAXException; | import com.microsoft.windowsazure.core.utils.*; import com.microsoft.windowsazure.exception.*; import com.microsoft.windowsazure.management.storage.models.*; import com.microsoft.windowsazure.tracing.*; import java.io.*; import java.net.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"com.microsoft.windowsazure",
"java.io",
"java.net",
"java.util",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | com.microsoft.windowsazure; java.io; java.net; java.util; javax.xml; org.w3c.dom; org.xml.sax; | 850,166 |
MockitoAnnotations.initMocks(this);
} | MockitoAnnotations.initMocks(this); } | /**
* Init the annotations before each test.
*/ | Init the annotations before each test | init | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/extensions/emf-solr-parent/emf-solr-impl/src/test/java/com/sirma/itt/emf/label/retrieve/HeaderFieldValueRetrieverTest.java",
"license": "lgpl-3.0",
"size": 9138
} | [
"org.mockito.MockitoAnnotations"
] | import org.mockito.MockitoAnnotations; | import org.mockito.*; | [
"org.mockito"
] | org.mockito; | 666,199 |
public ServiceFuture<StorageBundle> getStorageAccountAsync(String vaultBaseUrl, String storageAccountName, final ServiceCallback<StorageBundle> serviceCallback) {
return ServiceFuture.fromResponse(getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback);
} | ServiceFuture<StorageBundle> function(String vaultBaseUrl, String storageAccountName, final ServiceCallback<StorageBundle> serviceCallback) { return ServiceFuture.fromResponse(getStorageAccountWithServiceResponseAsync(vaultBaseUrl, storageAccountName), serviceCallback); } | /**
* Gets information about a specified storage account. This operation requires the storage/get permission.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param storageAccountName The name of the storage account.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Gets information about a specified storage account. This operation requires the storage/get permission | getStorageAccountAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/keyvault/microsoft-azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java",
"license": "mit",
"size": 884227
} | [
"com.microsoft.azure.keyvault.models.StorageBundle",
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.azure.keyvault.models.StorageBundle; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.azure.keyvault.models.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,553,180 |
@Test
public final void whenBishopCorrectWayDownThenResultIs() {
final int localStartCol = 3;
final int localStartRow = 1;
final int colEnd = 2;
final int rowEnd = 0;
Cell startCell = new Cell(localStartCol, localStartRow);
Cell endCell = new Cell(colEnd, rowEnd);
Bishop bishop = new Bishop(startCell);
Cell[] arr = bishop.way(endCell);
int resCol = arr[0].getCol();
int resRow = arr[0].getRow();
assertThat(resCol, is(colEnd));
assertThat(resRow, is(rowEnd));
} | final void function() { final int localStartCol = 3; final int localStartRow = 1; final int colEnd = 2; final int rowEnd = 0; Cell startCell = new Cell(localStartCol, localStartRow); Cell endCell = new Cell(colEnd, rowEnd); Bishop bishop = new Bishop(startCell); Cell[] arr = bishop.way(endCell); int resCol = arr[0].getCol(); int resRow = arr[0].getRow(); assertThat(resCol, is(colEnd)); assertThat(resRow, is(rowEnd)); } | /**
* Test correct move Bishop figure.
*/ | Test correct move Bishop figure | whenBishopCorrectWayDownThenResultIs | {
"repo_name": "MorpG/Java-course",
"path": "package_1/chapter_002/Chess/src/test/java/ru/agolovin/models/BishopTest.java",
"license": "apache-2.0",
"size": 2128
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 2,763,042 |
public static String getServerURL(HttpServletRequest request) {
StringBuffer url = new StringBuffer();
String scheme = request.getScheme();
url.append(scheme);
url.append("://");
url.append(request.getServerName());
if ((scheme.equals("http") &&
request.getServerPort() != 80
)
||
(scheme.equals("https") &&
request.getServerPort() != 443)) {
url.append(':');
url.append(request.getServerPort());
}
return url.toString();
} | static String function(HttpServletRequest request) { StringBuffer url = new StringBuffer(); String scheme = request.getScheme(); url.append(scheme); url.append(STRhttpSTRhttps") && request.getServerPort() != 443)) { url.append(':'); url.append(request.getServerPort()); } return url.toString(); } | /**
* Return the server URL.
*
* @param request the request to interrogate
*/ | Return the server URL | getServerURL | {
"repo_name": "timp21337/melati-old",
"path": "melati/src/main/java/org/melati/util/HttpUtil.java",
"license": "gpl-2.0",
"size": 5776
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 934,742 |
public void removeSizeListener(final SizeListener listener) {
checkWidget();
if (listener == null) {
SWT.error(SWT.ERROR_NULL_ARGUMENT);
}
sizeListeners.remove(listener);
} | void function(final SizeListener listener) { checkWidget(); if (listener == null) { SWT.error(SWT.ERROR_NULL_ARGUMENT); } sizeListeners.remove(listener); } | /**
* Removes the listener from the collection of listeners who will be notified when the embedded swing control has
* changed its size preferences.
*
* @param listener
* the listener which should no longer be notified
*
* @exception IllegalArgumentException
* <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException
* <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SizeListener
* @see #addSizeListener(SizeListener)
*/ | Removes the listener from the collection of listeners who will be notified when the embedded swing control has changed its size preferences | removeSizeListener | {
"repo_name": "gama-platform/gama.cloud",
"path": "ummisco.gama.java2d_web/internal_src/ummisco/gama/java2d/swing/SwingControl.java",
"license": "agpl-3.0",
"size": 63023
} | [
"org.eclipse.swt.SWT"
] | import org.eclipse.swt.SWT; | import org.eclipse.swt.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 2,455,180 |
public static boolean setPrefs(Context ctx, ArrayList<String> argv
, int... numArgv) {
SharedPreferences prefs
= ctx.getSharedPreferences("pwgen", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
for (char option : pwOptions.toCharArray()) {
if (argv.contains(String.valueOf(option))) {
editor.putBoolean(String.valueOf(option), true);
argv.remove(String.valueOf(option));
} else {
editor.putBoolean(String.valueOf(option), false);
}
}
for (int i = 0; i < numArgv.length && i < 2; i++) {
if (numArgv[i] <= 0) {
// Invalid password length or number of passwords
return false;
}
String name = i == 0 ? "length" : "num";
editor.putInt(name, numArgv[i]);
}
editor.apply();
return true;
} | static boolean function(Context ctx, ArrayList<String> argv , int... numArgv) { SharedPreferences prefs = ctx.getSharedPreferences("pwgen", Context.MODE_PRIVATE); SharedPreferences.Editor editor = prefs.edit(); for (char option : pwOptions.toCharArray()) { if (argv.contains(String.valueOf(option))) { editor.putBoolean(String.valueOf(option), true); argv.remove(String.valueOf(option)); } else { editor.putBoolean(String.valueOf(option), false); } } for (int i = 0; i < numArgv.length && i < 2; i++) { if (numArgv[i] <= 0) { return false; } String name = i == 0 ? STR : "num"; editor.putInt(name, numArgv[i]); } editor.apply(); return true; } | /**
* Sets password generation preferences.
*
* @param ctx context from which to retrieve SharedPreferences from
* preferences file 'pwgen'
* @param argv options for password generation
* <table summary="options for password generation">
* <tr><td>Option</td><td>Description</td></tr>
* <tr><td>0</td><td>don't include numbers</td></tr>
* <tr><td>A</td><td>don't include uppercase letters</td></tr>
* <tr><td>B</td><td>don't include ambiguous charactersl</td></tr>
* <tr><td>s</td><td>generate completely random passwords</td></tr>
* <tr><td>v</td><td>don't include vowels</td></tr>
* <tr><td>y</td><td>include at least one symbol</td></tr>
* </table>
* @param numArgv numerical options for password generation: length of
* generated passwords followed by number of passwords to
* generate
* @return <code>false</code> if a numerical options is invalid,
* <code>true</code> otherwise
*/ | Sets password generation preferences | setPrefs | {
"repo_name": "svetlemodry/Android-Password-Store",
"path": "app/src/main/java/com/zeapo/pwdstore/pwgen/pwgen.java",
"license": "gpl-3.0",
"size": 5130
} | [
"android.content.Context",
"android.content.SharedPreferences",
"java.util.ArrayList"
] | import android.content.Context; import android.content.SharedPreferences; import java.util.ArrayList; | import android.content.*; import java.util.*; | [
"android.content",
"java.util"
] | android.content; java.util; | 2,458,411 |
public Importer getPmi() {
return pmi;
} | Importer function() { return pmi; } | /**
* <p>Getter for the field <code>pmi</code>.</p>
*
* @return a {@link net.sourceforge.seqware.queryengine.tools.importers.Importer} object.
*/ | Getter for the field <code>pmi</code> | getPmi | {
"repo_name": "SeqWare/queryengine",
"path": "seqware-queryengine-legacy/src/main/java/net/sourceforge/seqware/queryengine/tools/importers/workers/ImportWorker.java",
"license": "gpl-3.0",
"size": 7506
} | [
"net.sourceforge.seqware.queryengine.tools.importers.Importer"
] | import net.sourceforge.seqware.queryengine.tools.importers.Importer; | import net.sourceforge.seqware.queryengine.tools.importers.*; | [
"net.sourceforge.seqware"
] | net.sourceforge.seqware; | 478,250 |
private ArrayList<HashMap<String, String>> createTestList(int colCount, int rowCount,
String prefix) {
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
String[] columns = new String[colCount];
for (int i = 0; i < colCount; i++) {
columns[i] = "column" + i;
}
for (int i = 0; i < rowCount; i++) {
HashMap<String, String> row = new HashMap<String, String>();
for (int j = 0; j < colCount; j++) {
row.put(columns[j], prefix + i + "" + j);
}
list.add(row);
}
return list;
} | ArrayList<HashMap<String, String>> function(int colCount, int rowCount, String prefix) { ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(); String[] columns = new String[colCount]; for (int i = 0; i < colCount; i++) { columns[i] = STR + i; } for (int i = 0; i < rowCount; i++) { HashMap<String, String> row = new HashMap<String, String>(); for (int j = 0; j < colCount; j++) { row.put(columns[j], prefix + i + "" + j); } list.add(row); } return list; } | /**
* Creates the test list.
*
* @param colCount the column count
* @param rowCount the row count
* @param prefix the prefix
* @return the array list< hash map< string, string>>
*/ | Creates the test list | createTestList | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "cts/tests/tests/widget/src/android/widget/cts/SimpleExpandableListAdapterTest.java",
"license": "gpl-3.0",
"size": 18123
} | [
"java.util.ArrayList",
"java.util.HashMap"
] | import java.util.ArrayList; import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,146,827 |
@Override
public void Close()
throws IOException {
try {
// set any possible bias to zero
setSpotBias(0.0);
} catch (DataFormatException ex) {
;
}
} | void function() throws IOException { try { setSpotBias(0.0); } catch (DataFormatException ex) { ; } } | /**
* "Cleans-up" the Instrument after processing the script has been finished.
* It sets the Spot-Bias to 0.
*
* @throws IOException
*/ | "Cleans-up" the Instrument after processing the script has been finished. It sets the Spot-Bias to 0 | Close | {
"repo_name": "amadeobellotti/Microwave-Analyzer",
"path": "Microwave Analyzer/icontrol~subversion/Icontrol_PrologixEthernetBranch/Icontrol/src/icontrol/instruments/HP4192.java",
"license": "gpl-2.0",
"size": 30078
} | [
"java.io.IOException",
"java.util.zip.DataFormatException"
] | import java.io.IOException; import java.util.zip.DataFormatException; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,259,201 |
public List<MountTargetProperties> mountTargets() {
return this.mountTargets;
} | List<MountTargetProperties> function() { return this.mountTargets; } | /**
* Get list of mount targets.
*
* @return the mountTargets value
*/ | Get list of mount targets | mountTargets | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/netapp/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/netapp/v2019_11_01/implementation/VolumeInner.java",
"license": "mit",
"size": 10435
} | [
"com.microsoft.azure.management.netapp.v2019_11_01.MountTargetProperties",
"java.util.List"
] | import com.microsoft.azure.management.netapp.v2019_11_01.MountTargetProperties; import java.util.List; | import com.microsoft.azure.management.netapp.v2019_11_01.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 1,782,675 |
if (rand == null) {
rand = new Random();
}
return rand.nextInt(n) + 1;
}
| if (rand == null) { rand = new Random(); } return rand.nextInt(n) + 1; } | /**
* Returns a random number between 1 and the number of sides
* of the dice n
*
* @param n The number of sides of the dice
* @return The randomly rolled value
*/ | Returns a random number between 1 and the number of sides of the dice n | roll | {
"repo_name": "chock-mostlyharmless/mostlyharmless",
"path": "eclipse/Bravery Run/src/de/badlegrunners/braveryrun/util/Dice.java",
"license": "bsd-3-clause",
"size": 694
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 1,707,170 |
public long getOptionLongValue(CommandLine cmd) {
return Long.parseLong(getOptionValue(cmd));
} | long function(CommandLine cmd) { return Long.parseLong(getOptionValue(cmd)); } | /**
* Retrieve the argument of this option as long value
*
* @param cmd CommandLine
* @return Value of the argument as long value
*/ | Retrieve the argument of this option as long value | getOptionLongValue | {
"repo_name": "basio/graph",
"path": "giraph-core/src/main/java/org/apache/giraph/benchmark/BenchmarkOption.java",
"license": "apache-2.0",
"size": 7455
} | [
"org.apache.commons.cli.CommandLine"
] | import org.apache.commons.cli.CommandLine; | import org.apache.commons.cli.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,237,588 |
@Deprecated
List<User> getDirectAdmins(PerunSession perunSession, Vo vo); | List<User> getDirectAdmins(PerunSession perunSession, Vo vo); | /**
* Gets list of direct user administrators of the VO.
* 'Direct' means, there aren't included users, who are members of group administrators, in the returned list.
*
* @param perunSession
* @param vo
*
* @throws InternalErrorException
*/ | Gets list of direct user administrators of the VO. 'Direct' means, there aren't included users, who are members of group administrators, in the returned list | getDirectAdmins | {
"repo_name": "balcirakpeter/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/VosManagerImplApi.java",
"license": "bsd-2-clause",
"size": 8479
} | [
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.User",
"cz.metacentrum.perun.core.api.Vo",
"java.util.List"
] | import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.Vo; import java.util.List; | import cz.metacentrum.perun.core.api.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 1,625,666 |
public void setImageResize(boolean val) {
Element el = settingsFile.getRootElement().getChild(SETTING_IMGRESIZE);
if (null == el) {
el = new Element(SETTING_IMGRESIZE);
settingsFile.getRootElement().addContent(el);
}
el.setText((val) ? "1" : "0");
} | void function(boolean val) { Element el = settingsFile.getRootElement().getChild(SETTING_IMGRESIZE); if (null == el) { el = new Element(SETTING_IMGRESIZE); settingsFile.getRootElement().addContent(el); } el.setText((val) ? "1" : "0"); } | /**
* Sets the setting for the thumbnail activation. This value indicates whether iamges should
* always be display in original size, or whether large images should be resized
*
* @param val whether thumbnail-display is enabled or not
*/ | Sets the setting for the thumbnail activation. This value indicates whether iamges should always be display in original size, or whether large images should be resized | setImageResize | {
"repo_name": "sjPlot/Zettelkasten",
"path": "src/main/java/de/danielluedecke/zettelkasten/database/Settings.java",
"license": "gpl-3.0",
"size": 218287
} | [
"org.jdom2.Element"
] | import org.jdom2.Element; | import org.jdom2.*; | [
"org.jdom2"
] | org.jdom2; | 1,759,795 |
public void removeSensor(String name) {
Sensor sensor = sensors.get(name);
if (sensor != null) {
List<Sensor> childSensors = null;
synchronized (sensor) {
synchronized (this) {
if (sensors.remove(name, sensor)) {
for (KafkaMetric metric : sensor.metrics())
removeMetric(metric.metricName());
log.debug("Removed sensor with name {}", name);
childSensors = childrenSensors.remove(sensor);
}
}
}
if (childSensors != null) {
for (Sensor childSensor : childSensors)
removeSensor(childSensor.name());
}
}
} | void function(String name) { Sensor sensor = sensors.get(name); if (sensor != null) { List<Sensor> childSensors = null; synchronized (sensor) { synchronized (this) { if (sensors.remove(name, sensor)) { for (KafkaMetric metric : sensor.metrics()) removeMetric(metric.metricName()); log.debug(STR, name); childSensors = childrenSensors.remove(sensor); } } } if (childSensors != null) { for (Sensor childSensor : childSensors) removeSensor(childSensor.name()); } } } | /**
* Remove a sensor (if it exists), associated metrics and its children.
*
* @param name The name of the sensor to be removed
*/ | Remove a sensor (if it exists), associated metrics and its children | removeSensor | {
"repo_name": "lemonJun/Jkafka",
"path": "jkafka-core/src/main/java/kafka/metrics/Metrics.java",
"license": "apache-2.0",
"size": 18614
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,501,984 |
@Override
public int compareTo(AbstractPageTranscript<T> pt){
return this.getMd().compareTo(pt.getMd());
}
public void build() throws IOException {} | int function(AbstractPageTranscript<T> pt){ return this.getMd().compareTo(pt.getMd()); } public void build() throws IOException {} | /**
* Uses the timestamp in the metadata object for comparison
* @see java.lang.Comparable#compareTo(java.lang.Object)
*/ | Uses the timestamp in the metadata object for comparison | compareTo | {
"repo_name": "Transkribus/TranskribusCore",
"path": "src/main/java/eu/transkribus/core/model/beans/AbstractPageTranscript.java",
"license": "gpl-3.0",
"size": 861
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,134,054 |
private static int countTextPatterns(String text) {
StringTokenizer stok = new StringTokenizer(text, "\n \t[]");
return stok.countTokens();
}
| static int function(String text) { StringTokenizer stok = new StringTokenizer(text, STR); return stok.countTokens(); } | /**
* Method countTextPatterns.
*
* @param text
* String
*
* @return int
*/ | Method countTextPatterns | countTextPatterns | {
"repo_name": "laynos/GLPOO_ESIEA_1415_Eternity_Souhel",
"path": "eternity/src/main/java/fr/esiea/glpoo/création_pièces_terrain/Terrain.java",
"license": "apache-2.0",
"size": 18602
} | [
"java.util.StringTokenizer"
] | import java.util.StringTokenizer; | import java.util.*; | [
"java.util"
] | java.util; | 1,600,191 |
@Override
public Response readContact(String parentcsid,
String itemcsid, String csid) {
return getProxy().readContact(parentcsid, itemcsid, csid);
} | Response function(String parentcsid, String itemcsid, String csid) { return getProxy().readContact(parentcsid, itemcsid, csid); } | /**
* Read contact.
*
* @param parentcsid the parentcsid
* @param itemcsid the itemcsid
* @param csid the csid
* @return the client response
*/ | Read contact | readContact | {
"repo_name": "cherryhill/collectionspace-services",
"path": "services/contact/client/src/main/java/org/collectionspace/services/client/AuthorityWithContactsClientImpl.java",
"license": "apache-2.0",
"size": 8924
} | [
"javax.ws.rs.core.Response"
] | import javax.ws.rs.core.Response; | import javax.ws.rs.core.*; | [
"javax.ws"
] | javax.ws; | 2,432,894 |
void addToClasspath(IJavaProject javaProject,
boolean autobuild,
Iterable<IClasspathEntry> newClassPathEntry) throws JavaModelException;
} | void addToClasspath(IJavaProject javaProject, boolean autobuild, Iterable<IClasspathEntry> newClassPathEntry) throws JavaModelException; } | /** Add libraries to the class path.
*
* @param javaProject the proejct to update.
* @param autobuild indicates if the function should wait for end of autobuild.
* @param newClassPathEntry the entry to add.
* @throws JavaModelException
*/ | Add libraries to the class path | addToClasspath | {
"repo_name": "jgfoster/sarl",
"path": "tests/io.sarl.tests.api.ui/src/io/sarl/tests/api/WorkbenchTestHelper.java",
"license": "apache-2.0",
"size": 41142
} | [
"org.eclipse.jdt.core.IClasspathEntry",
"org.eclipse.jdt.core.IJavaProject",
"org.eclipse.jdt.core.JavaModelException"
] | import org.eclipse.jdt.core.IClasspathEntry; import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.core.JavaModelException; | import org.eclipse.jdt.core.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 329,598 |
public Enumeration listOptions() {
Vector newVector = new Vector(3);
newVector.addElement(new Option(
"\tFull class name of attribute evaluator, followed\n"
+ "\tby its options.\n"
+ "\teg: \"weka.attributeSelection.CfsSubsetEval -L\"\n"
+ "\t(default weka.attributeSelection.CfsSubsetEval)",
"E", 1, "-E <attribute evaluator specification>"));
newVector.addElement(new Option(
"\tFull class name of search method, followed\n"
+ "\tby its options.\n"
+ "\teg: \"weka.attributeSelection.BestFirst -D 1\"\n"
+ "\t(default weka.attributeSelection.BestFirst)",
"S", 1, "-S <search method specification>"));
Enumeration enu = super.listOptions();
while (enu.hasMoreElements()) {
newVector.addElement(enu.nextElement());
}
return newVector.elements();
} | Enumeration function() { Vector newVector = new Vector(3); newVector.addElement(new Option( STR + STR + STRweka.attributeSelection.CfsSubsetEval -L\"\n" + STR, "E", 1, STR)); newVector.addElement(new Option( STR + STR + STRweka.attributeSelection.BestFirst -D 1\"\n" + STR, "S", 1, STR)); Enumeration enu = super.listOptions(); while (enu.hasMoreElements()) { newVector.addElement(enu.nextElement()); } return newVector.elements(); } | /**
* Returns an enumeration describing the available options.
*
* @return an enumeration of all the available options.
*/ | Returns an enumeration describing the available options | listOptions | {
"repo_name": "williamClanton/jbossBA",
"path": "weka/src/main/java/weka/classifiers/meta/AttributeSelectedClassifier.java",
"license": "gpl-2.0",
"size": 20441
} | [
"java.util.Enumeration",
"java.util.Vector"
] | import java.util.Enumeration; import java.util.Vector; | import java.util.*; | [
"java.util"
] | java.util; | 2,220,583 |
@Beta
ServiceFuture<Void> activateAsync(String format, ServiceCallback<Void> callback); | ServiceFuture<Void> activateAsync(String format, ServiceCallback<Void> callback); | /**
* Activates the application package asynchronously.
*
* @param format the format of the uploaded Batch application package, either "zip" or "tar"
* @param callback the callback to call on success or failure
* @return a handle to cancel the request
*/ | Activates the application package asynchronously | activateAsync | {
"repo_name": "martinsawicki/azure-sdk-for-java",
"path": "azure-mgmt-batch/src/main/java/com/microsoft/azure/management/batch/ApplicationPackage.java",
"license": "mit",
"size": 2666
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,300,720 |
public static String getHostPortString(InetSocketAddress addr) {
return addr.getHostName() + ":" + addr.getPort();
} | static String function(InetSocketAddress addr) { return addr.getHostName() + ":" + addr.getPort(); } | /**
* Compose a "host:port" string from the address.
*/ | Compose a "host:port" string from the address | getHostPortString | {
"repo_name": "gabrielborgesmagalhaes/hadoop-hdfs",
"path": "src/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java",
"license": "apache-2.0",
"size": 42484
} | [
"java.net.InetSocketAddress"
] | import java.net.InetSocketAddress; | import java.net.*; | [
"java.net"
] | java.net; | 1,279,421 |
@Test
public void test19GivenNByUserDate() throws LibrecException {
conf.set("data.model.splitter", "net.librec.data.splitter.GivenNDataSplitter");
conf.set("data.splitter.givenn", "userdate");
conf.set("data.splitter.givenn.n", "1");
conf.set(Configured.CONF_DATA_COLUMN_FORMAT, "UIRT");
conf.set(Configured.CONF_DATA_INPUT_PATH, "test/datamodeltest/matrix4by4-date.txt");
TextDataModel dataModel = new TextDataModel(conf);
dataModel.buildDataModel();
assertEquals(getTrainSize(dataModel), 4);
assertEquals(getTestSize(dataModel), 9);
}
| void function() throws LibrecException { conf.set(STR, STR); conf.set(STR, STR); conf.set(STR, "1"); conf.set(Configured.CONF_DATA_COLUMN_FORMAT, "UIRT"); conf.set(Configured.CONF_DATA_INPUT_PATH, STR); TextDataModel dataModel = new TextDataModel(conf); dataModel.buildDataModel(); assertEquals(getTrainSize(dataModel), 4); assertEquals(getTestSize(dataModel), 9); } | /**
* Test the function of splitter part.
* {@link net.librec.data.splitter.GivenNDataSplitter} each user split out N
* ratings with biggest value of date for test set,the rest for training
* set.
*
* @throws LibrecException
*/ | Test the function of splitter part. <code>net.librec.data.splitter.GivenNDataSplitter</code> each user split out N ratings with biggest value of date for test set,the rest for training set | test19GivenNByUserDate | {
"repo_name": "SunYatong/librec",
"path": "core/src/test/java/net/librec/data/model/TextDataModelTestCase.java",
"license": "gpl-3.0",
"size": 17733
} | [
"net.librec.common.LibrecException",
"net.librec.conf.Configured",
"org.junit.Assert"
] | import net.librec.common.LibrecException; import net.librec.conf.Configured; import org.junit.Assert; | import net.librec.common.*; import net.librec.conf.*; import org.junit.*; | [
"net.librec.common",
"net.librec.conf",
"org.junit"
] | net.librec.common; net.librec.conf; org.junit; | 1,971,931 |
public @Nonnull Iterable<InternetGateway> listInternetGateways(@Nullable String vlanId) throws CloudException, InternalException; | @Nonnull Iterable<InternetGateway> function(@Nullable String vlanId) throws CloudException, InternalException; | /**
* Lists all Internet Gateways for an account or optionally all Internet Gateways for a VLAN.
* @param vlanId the VLAN ID to search for internet gateways
* @return a list of internet gateways
* @throws CloudException an error occurred fetching the internet gatewayss from the cloud provider
* @throws InternalException a local error occurred processing the internet gateways
*/ | Lists all Internet Gateways for an account or optionally all Internet Gateways for a VLAN | listInternetGateways | {
"repo_name": "maksimov/dasein-cloud-core",
"path": "src/main/java/org/dasein/cloud/network/VLANSupport.java",
"license": "apache-2.0",
"size": 44522
} | [
"javax.annotation.Nonnull",
"javax.annotation.Nullable",
"org.dasein.cloud.CloudException",
"org.dasein.cloud.InternalException"
] | import javax.annotation.Nonnull; import javax.annotation.Nullable; import org.dasein.cloud.CloudException; import org.dasein.cloud.InternalException; | import javax.annotation.*; import org.dasein.cloud.*; | [
"javax.annotation",
"org.dasein.cloud"
] | javax.annotation; org.dasein.cloud; | 1,575,149 |
private void initCollapsedLayout(final String trackName, final String artistName,
final Bitmap albumArt) {
// Track name (line one)
mNotificationTemplate.setTextViewText(R.id.notification_base_line_one, trackName);
// Artist name (line two)
mNotificationTemplate.setTextViewText(R.id.notification_base_line_two, artistName);
// Album art
mNotificationTemplate.setImageViewBitmap(R.id.notification_base_image, albumArt);
} | void function(final String trackName, final String artistName, final Bitmap albumArt) { mNotificationTemplate.setTextViewText(R.id.notification_base_line_one, trackName); mNotificationTemplate.setTextViewText(R.id.notification_base_line_two, artistName); mNotificationTemplate.setImageViewBitmap(R.id.notification_base_image, albumArt); } | /**
* Sets the track name, artist name, and album art in the normal layout
*/ | Sets the track name, artist name, and album art in the normal layout | initCollapsedLayout | {
"repo_name": "OpenSilk/Orpheus",
"path": "app/src/main/java/com/andrew/apollo/NotificationHelper.java",
"license": "gpl-3.0",
"size": 10584
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 459,783 |
public Object sendEvent(EventRef event, Object [] args)
throws IllegalAccessException,IllegalArgumentException,InvocationTargetException; | Object function(EventRef event, Object [] args) throws IllegalAccessException,IllegalArgumentException,InvocationTargetException; | /**
* Delivers the specified event to the target control referenced by this handle.
*/ | Delivers the specified event to the target control referenced by this handle | sendEvent | {
"repo_name": "moparisthebest/beehive",
"path": "beehive-controls/src/main/java/org/apache/beehive/controls/api/context/ControlHandle.java",
"license": "apache-2.0",
"size": 1982
} | [
"java.lang.reflect.InvocationTargetException",
"org.apache.beehive.controls.api.events.EventRef"
] | import java.lang.reflect.InvocationTargetException; import org.apache.beehive.controls.api.events.EventRef; | import java.lang.reflect.*; import org.apache.beehive.controls.api.events.*; | [
"java.lang",
"org.apache.beehive"
] | java.lang; org.apache.beehive; | 716,320 |
@Test
public void testDuplicateShapeProperties() throws Exception {
newUserAndGroup("rwra--");
Image originalImage = mmFactory.simpleImage();
Roi originalRoi = new RoiI();
Rectangle originalRectangle = new RectangleI();
originalRoi.addShape(originalRectangle);
Ellipse originalEllipse = new EllipseI();
originalRoi.addShape(originalEllipse);
Line originalLine = new LineI();
originalRoi.addShape(originalLine);
Point originalPoint = new PointI();
originalRoi.addShape(originalPoint);
int propertyValue = 1;
originalRectangle.setTheZ(omero.rtypes.rint(propertyValue++));
originalRectangle.setTheT(omero.rtypes.rint(propertyValue++));
originalRectangle.setTheC(omero.rtypes.rint(propertyValue++));
originalRectangle.setX(omero.rtypes.rdouble(propertyValue++));
originalRectangle.setY(omero.rtypes.rdouble(propertyValue++));
originalRectangle.setWidth(omero.rtypes.rdouble(propertyValue++));
originalRectangle.setHeight(omero.rtypes.rdouble(propertyValue++));
originalEllipse.setTheZ(omero.rtypes.rint(propertyValue++));
originalEllipse.setTheT(omero.rtypes.rint(propertyValue++));
originalEllipse.setTheC(omero.rtypes.rint(propertyValue++));
originalEllipse.setCx(omero.rtypes.rdouble(propertyValue++));
originalEllipse.setCy(omero.rtypes.rdouble(propertyValue++));
originalEllipse.setRx(omero.rtypes.rdouble(propertyValue++));
originalEllipse.setRy(omero.rtypes.rdouble(propertyValue++));
originalLine.setTheZ(omero.rtypes.rint(propertyValue++));
originalLine.setTheT(omero.rtypes.rint(propertyValue++));
originalLine.setTheC(omero.rtypes.rint(propertyValue++));
originalLine.setX1(omero.rtypes.rdouble(propertyValue++));
originalLine.setY1(omero.rtypes.rdouble(propertyValue++));
originalLine.setX2(omero.rtypes.rdouble(propertyValue++));
originalLine.setY2(omero.rtypes.rdouble(propertyValue++));
originalPoint.setTheZ(omero.rtypes.rint(propertyValue++));
originalPoint.setTheT(omero.rtypes.rint(propertyValue++));
originalPoint.setTheC(omero.rtypes.rint(propertyValue++));
originalPoint.setCx(omero.rtypes.rdouble(propertyValue++));
originalPoint.setCy(omero.rtypes.rdouble(propertyValue++));
originalRoi = (Roi) iUpdate.saveAndReturnObject(originalRoi);
final Iterator<Shape> originalShapes = originalRoi.copyShapes().iterator();
originalRectangle = (Rectangle) originalShapes.next();
originalEllipse = (Ellipse) originalShapes.next();
originalLine = (Line) originalShapes.next();
originalPoint = (Point) originalShapes.next();
Assert.assertFalse(originalShapes.hasNext());
originalImage.addRoi(originalRoi);
originalImage = (Image) iUpdate.saveAndReturnObject(originalImage);
final long originalImageId = originalImage.getId().getValue();
final long originalRoiId = originalRoi.getId().getValue();
final long originalRectangleId = originalRectangle.getId().getValue();
final long originalEllipseId = originalEllipse.getId().getValue();
final long originalLineId = originalLine.getId().getValue();
final long originalPointId = originalPoint.getId().getValue();
testImages.add(originalImageId);
final Duplicate dup = new Duplicate();
dup.targetObjects = ImmutableMap.of("Image", Arrays.asList(originalImageId));
final DuplicateResponse response = (DuplicateResponse) doChange(dup);
final Set<Long> reportedImageIds = new HashSet<Long>(response.duplicates.get("ome.model.core.Image"));
final Set<Long> reportedRoiIds = new HashSet<Long>(response.duplicates.get("ome.model.roi.Roi"));
final Set<Long> reportedRectangleIds = new HashSet<Long>(response.duplicates.get("ome.model.roi.Rectangle"));
final Set<Long> reportedEllipseIds = new HashSet<Long>(response.duplicates.get("ome.model.roi.Ellipse"));
final Set<Long> reportedLineIds = new HashSet<Long>(response.duplicates.get("ome.model.roi.Line"));
final Set<Long> reportedPointIds = new HashSet<Long>(response.duplicates.get("ome.model.roi.Point"));
Assert.assertEquals(reportedImageIds.size(), 1);
Assert.assertEquals(reportedRoiIds.size(), 1);
Assert.assertEquals(reportedRectangleIds.size(), 1);
Assert.assertEquals(reportedEllipseIds.size(), 1);
Assert.assertEquals(reportedLineIds.size(), 1);
Assert.assertEquals(reportedPointIds.size(), 1);
final long reportedImageId = reportedImageIds.iterator().next();
final long reportedRoiId = reportedRoiIds.iterator().next();
final long reportedRectangleId = reportedRectangleIds.iterator().next();
final long reportedEllipseId = reportedEllipseIds.iterator().next();
final long reportedLineId = reportedLineIds.iterator().next();
final long reportedPointId = reportedPointIds.iterator().next();
testImages.add(reportedImageId);
Assert.assertNotEquals(originalImageId, reportedImageId);
Assert.assertNotEquals(originalRoiId, reportedRoiId);
Assert.assertNotEquals(originalRectangleId, reportedRectangleId);
Assert.assertNotEquals(originalEllipseId, reportedEllipseId);
Assert.assertNotEquals(originalLineId, reportedLineId);
Assert.assertNotEquals(originalPointId, reportedPointId);
final Parameters parameters = new ParametersI().addId(reportedImageId);
final Image duplicateImage = (Image) iQuery.findByQuery(
"SELECT i FROM Image i " +
"JOIN FETCH i.rois AS r " +
"JOIN FETCH r.shapes " +
"WHERE i.id = :id", parameters);
final Iterator<Shape> duplicateShapes = duplicateImage.copyRois().get(0).copyShapes().iterator();
final Rectangle duplicateRectangle = (Rectangle) duplicateShapes.next();
final Ellipse duplicateEllipse = (Ellipse) duplicateShapes.next();
final Line duplicateLine = (Line) duplicateShapes.next();
final Point duplicatePoint = (Point) duplicateShapes.next();
Assert.assertFalse(duplicateShapes.hasNext());
Assert.assertEquals(duplicateRectangle.getId().getValue(), reportedRectangleId);
Assert.assertEquals(duplicateEllipse.getId().getValue(), reportedEllipseId);
Assert.assertEquals(duplicateLine.getId().getValue(), reportedLineId);
Assert.assertEquals(duplicatePoint.getId().getValue(), reportedPointId);
assertSameProperties(originalRectangle, duplicateRectangle);
assertSameProperties(originalEllipse, duplicateEllipse);
assertSameProperties(originalLine, duplicateLine);
assertSameProperties(originalPoint, duplicatePoint);
} | void function() throws Exception { newUserAndGroup(STR); Image originalImage = mmFactory.simpleImage(); Roi originalRoi = new RoiI(); Rectangle originalRectangle = new RectangleI(); originalRoi.addShape(originalRectangle); Ellipse originalEllipse = new EllipseI(); originalRoi.addShape(originalEllipse); Line originalLine = new LineI(); originalRoi.addShape(originalLine); Point originalPoint = new PointI(); originalRoi.addShape(originalPoint); int propertyValue = 1; originalRectangle.setTheZ(omero.rtypes.rint(propertyValue++)); originalRectangle.setTheT(omero.rtypes.rint(propertyValue++)); originalRectangle.setTheC(omero.rtypes.rint(propertyValue++)); originalRectangle.setX(omero.rtypes.rdouble(propertyValue++)); originalRectangle.setY(omero.rtypes.rdouble(propertyValue++)); originalRectangle.setWidth(omero.rtypes.rdouble(propertyValue++)); originalRectangle.setHeight(omero.rtypes.rdouble(propertyValue++)); originalEllipse.setTheZ(omero.rtypes.rint(propertyValue++)); originalEllipse.setTheT(omero.rtypes.rint(propertyValue++)); originalEllipse.setTheC(omero.rtypes.rint(propertyValue++)); originalEllipse.setCx(omero.rtypes.rdouble(propertyValue++)); originalEllipse.setCy(omero.rtypes.rdouble(propertyValue++)); originalEllipse.setRx(omero.rtypes.rdouble(propertyValue++)); originalEllipse.setRy(omero.rtypes.rdouble(propertyValue++)); originalLine.setTheZ(omero.rtypes.rint(propertyValue++)); originalLine.setTheT(omero.rtypes.rint(propertyValue++)); originalLine.setTheC(omero.rtypes.rint(propertyValue++)); originalLine.setX1(omero.rtypes.rdouble(propertyValue++)); originalLine.setY1(omero.rtypes.rdouble(propertyValue++)); originalLine.setX2(omero.rtypes.rdouble(propertyValue++)); originalLine.setY2(omero.rtypes.rdouble(propertyValue++)); originalPoint.setTheZ(omero.rtypes.rint(propertyValue++)); originalPoint.setTheT(omero.rtypes.rint(propertyValue++)); originalPoint.setTheC(omero.rtypes.rint(propertyValue++)); originalPoint.setCx(omero.rtypes.rdouble(propertyValue++)); originalPoint.setCy(omero.rtypes.rdouble(propertyValue++)); originalRoi = (Roi) iUpdate.saveAndReturnObject(originalRoi); final Iterator<Shape> originalShapes = originalRoi.copyShapes().iterator(); originalRectangle = (Rectangle) originalShapes.next(); originalEllipse = (Ellipse) originalShapes.next(); originalLine = (Line) originalShapes.next(); originalPoint = (Point) originalShapes.next(); Assert.assertFalse(originalShapes.hasNext()); originalImage.addRoi(originalRoi); originalImage = (Image) iUpdate.saveAndReturnObject(originalImage); final long originalImageId = originalImage.getId().getValue(); final long originalRoiId = originalRoi.getId().getValue(); final long originalRectangleId = originalRectangle.getId().getValue(); final long originalEllipseId = originalEllipse.getId().getValue(); final long originalLineId = originalLine.getId().getValue(); final long originalPointId = originalPoint.getId().getValue(); testImages.add(originalImageId); final Duplicate dup = new Duplicate(); dup.targetObjects = ImmutableMap.of("Image", Arrays.asList(originalImageId)); final DuplicateResponse response = (DuplicateResponse) doChange(dup); final Set<Long> reportedImageIds = new HashSet<Long>(response.duplicates.get(STR)); final Set<Long> reportedRoiIds = new HashSet<Long>(response.duplicates.get(STR)); final Set<Long> reportedRectangleIds = new HashSet<Long>(response.duplicates.get(STR)); final Set<Long> reportedEllipseIds = new HashSet<Long>(response.duplicates.get(STR)); final Set<Long> reportedLineIds = new HashSet<Long>(response.duplicates.get(STR)); final Set<Long> reportedPointIds = new HashSet<Long>(response.duplicates.get(STR)); Assert.assertEquals(reportedImageIds.size(), 1); Assert.assertEquals(reportedRoiIds.size(), 1); Assert.assertEquals(reportedRectangleIds.size(), 1); Assert.assertEquals(reportedEllipseIds.size(), 1); Assert.assertEquals(reportedLineIds.size(), 1); Assert.assertEquals(reportedPointIds.size(), 1); final long reportedImageId = reportedImageIds.iterator().next(); final long reportedRoiId = reportedRoiIds.iterator().next(); final long reportedRectangleId = reportedRectangleIds.iterator().next(); final long reportedEllipseId = reportedEllipseIds.iterator().next(); final long reportedLineId = reportedLineIds.iterator().next(); final long reportedPointId = reportedPointIds.iterator().next(); testImages.add(reportedImageId); Assert.assertNotEquals(originalImageId, reportedImageId); Assert.assertNotEquals(originalRoiId, reportedRoiId); Assert.assertNotEquals(originalRectangleId, reportedRectangleId); Assert.assertNotEquals(originalEllipseId, reportedEllipseId); Assert.assertNotEquals(originalLineId, reportedLineId); Assert.assertNotEquals(originalPointId, reportedPointId); final Parameters parameters = new ParametersI().addId(reportedImageId); final Image duplicateImage = (Image) iQuery.findByQuery( STR + STR + STR + STR, parameters); final Iterator<Shape> duplicateShapes = duplicateImage.copyRois().get(0).copyShapes().iterator(); final Rectangle duplicateRectangle = (Rectangle) duplicateShapes.next(); final Ellipse duplicateEllipse = (Ellipse) duplicateShapes.next(); final Line duplicateLine = (Line) duplicateShapes.next(); final Point duplicatePoint = (Point) duplicateShapes.next(); Assert.assertFalse(duplicateShapes.hasNext()); Assert.assertEquals(duplicateRectangle.getId().getValue(), reportedRectangleId); Assert.assertEquals(duplicateEllipse.getId().getValue(), reportedEllipseId); Assert.assertEquals(duplicateLine.getId().getValue(), reportedLineId); Assert.assertEquals(duplicatePoint.getId().getValue(), reportedPointId); assertSameProperties(originalRectangle, duplicateRectangle); assertSameProperties(originalEllipse, duplicateEllipse); assertSameProperties(originalLine, duplicateLine); assertSameProperties(originalPoint, duplicatePoint); } | /**
* Test preservation of shapes and their properties when duplicating an image with an ROI.
* @throws Exception unexpected
*/ | Test preservation of shapes and their properties when duplicating an image with an ROI | testDuplicateShapeProperties | {
"repo_name": "joansmith/openmicroscopy",
"path": "components/tools/OmeroJava/test/integration/DuplicationTest.java",
"license": "gpl-2.0",
"size": 63822
} | [
"com.google.common.collect.ImmutableMap",
"java.util.Arrays",
"java.util.HashSet",
"java.util.Iterator",
"java.util.Set",
"org.testng.Assert"
] | import com.google.common.collect.ImmutableMap; import java.util.Arrays; import java.util.HashSet; import java.util.Iterator; import java.util.Set; import org.testng.Assert; | import com.google.common.collect.*; import java.util.*; import org.testng.*; | [
"com.google.common",
"java.util",
"org.testng"
] | com.google.common; java.util; org.testng; | 1,171,172 |
private void cacheExpandedObjects(PlatformIdent platformIdent, RepositoryDefinition repositoryDefinition) {
Object[] allExpanded = treeViewer.getExpandedElements();
if (allExpanded.length > 0) {
Set<Object> parents = new HashSet<Object>();
for (Object expanded : allExpanded) {
Object parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(expanded);
while (parent != null) {
parents.add(parent);
parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(parent);
}
}
List<Object> expandedList = new ArrayList<Object>(Arrays.asList(allExpanded));
expandedList.removeAll(parents);
expandedElementsPerAgent.put(getHashCodeForAgentRepository(platformIdent, repositoryDefinition), expandedList);
} else {
expandedElementsPerAgent.put(getHashCodeForAgentRepository(platformIdent, repositoryDefinition), Collections.emptyList());
}
}
/**
* Returns the hash code combination for {@link PlatformIdent} and {@link RepositoryDefinition}.
*
* @param platformIdent
* {@link PlatformIdent}
* @param repositoryDefinition
* {@link RepositoryDefinition} | void function(PlatformIdent platformIdent, RepositoryDefinition repositoryDefinition) { Object[] allExpanded = treeViewer.getExpandedElements(); if (allExpanded.length > 0) { Set<Object> parents = new HashSet<Object>(); for (Object expanded : allExpanded) { Object parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(expanded); while (parent != null) { parents.add(parent); parent = ((ITreeContentProvider) treeViewer.getContentProvider()).getParent(parent); } } List<Object> expandedList = new ArrayList<Object>(Arrays.asList(allExpanded)); expandedList.removeAll(parents); expandedElementsPerAgent.put(getHashCodeForAgentRepository(platformIdent, repositoryDefinition), expandedList); } else { expandedElementsPerAgent.put(getHashCodeForAgentRepository(platformIdent, repositoryDefinition), Collections.emptyList()); } } /** * Returns the hash code combination for {@link PlatformIdent} and {@link RepositoryDefinition}. * * @param platformIdent * {@link PlatformIdent} * @param repositoryDefinition * {@link RepositoryDefinition} | /**
* Caches the current expanded objects in the tree viewer with the given platform
* ident/repository combination. Note that this method will filter out the elements given by
* {@link org.eclipse.jface.viewers.TreeViewer#getExpandedElements()}, so that only the last
* expanded element in the tree is saved.
*
* @param platformIdent
* {@link PlatformIdent} to cache elements for.
* @param repositoryDefinition
* Repository that platform is belonging to.
*/ | Caches the current expanded objects in the tree viewer with the given platform ident/repository combination. Note that this method will filter out the elements given by <code>org.eclipse.jface.viewers.TreeViewer#getExpandedElements()</code>, so that only the last expanded element in the tree is saved | cacheExpandedObjects | {
"repo_name": "kugelr/inspectIT",
"path": "inspectIT/src/info/novatec/inspectit/rcp/view/impl/DataExplorerView.java",
"license": "agpl-3.0",
"size": 32788
} | [
"info.novatec.inspectit.cmr.model.PlatformIdent",
"info.novatec.inspectit.rcp.repository.RepositoryDefinition",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collections",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"org.eclipse.jface.viewers.ITreeContentProvider"
] | import info.novatec.inspectit.cmr.model.PlatformIdent; import info.novatec.inspectit.rcp.repository.RepositoryDefinition; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Set; import org.eclipse.jface.viewers.ITreeContentProvider; | import info.novatec.inspectit.cmr.model.*; import info.novatec.inspectit.rcp.repository.*; import java.util.*; import org.eclipse.jface.viewers.*; | [
"info.novatec.inspectit",
"java.util",
"org.eclipse.jface"
] | info.novatec.inspectit; java.util; org.eclipse.jface; | 1,159,057 |
@Override
public Request<CreateRouteTableRequest> getDryRunRequest() {
Request<CreateRouteTableRequest> request = new CreateRouteTableRequestMarshaller().marshall(this);
request.addParameter("DryRun", Boolean.toString(true));
return request;
} | Request<CreateRouteTableRequest> function() { Request<CreateRouteTableRequest> request = new CreateRouteTableRequestMarshaller().marshall(this); request.addParameter(STR, Boolean.toString(true)); return request; } | /**
* This method is intended for internal use only. Returns the marshaled request configured with additional
* parameters to enable operation dry-run.
*/ | This method is intended for internal use only. Returns the marshaled request configured with additional parameters to enable operation dry-run | getDryRunRequest | {
"repo_name": "dagnir/aws-sdk-java",
"path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/CreateRouteTableRequest.java",
"license": "apache-2.0",
"size": 3765
} | [
"com.amazonaws.Request",
"com.amazonaws.services.ec2.model.transform.CreateRouteTableRequestMarshaller"
] | import com.amazonaws.Request; import com.amazonaws.services.ec2.model.transform.CreateRouteTableRequestMarshaller; | import com.amazonaws.*; import com.amazonaws.services.ec2.model.transform.*; | [
"com.amazonaws",
"com.amazonaws.services"
] | com.amazonaws; com.amazonaws.services; | 262,137 |
@Override
public void sampleOccurred(SampleEvent e) {
processSample(e.getResult(), new Counter());
} | void function(SampleEvent e) { processSample(e.getResult(), new Counter()); } | /**
* Saves the sample result (and any sub results) in files
*
* @see org.apache.jmeter.samplers.SampleListener#sampleOccurred(org.apache.jmeter.samplers.SampleEvent)
*/ | Saves the sample result (and any sub results) in files | sampleOccurred | {
"repo_name": "johrstrom/cloud-meter",
"path": "cloud-meter-core/src/main/java/org/apache/jmeter/reporters/ResultSaver.java",
"license": "apache-2.0",
"size": 9261
} | [
"org.apache.jmeter.samplers.SampleEvent"
] | import org.apache.jmeter.samplers.SampleEvent; | import org.apache.jmeter.samplers.*; | [
"org.apache.jmeter"
] | org.apache.jmeter; | 613,949 |
public static <T> boolean filter(final Iterable<T> collection, final Predicate<? super T> predicate) {
boolean result = false;
if (collection != null && predicate != null) {
for (final Iterator<T> it = collection.iterator(); it.hasNext();) {
if (!predicate.evaluate(it.next())) {
it.remove();
result = true;
}
}
}
return result;
} | static <T> boolean function(final Iterable<T> collection, final Predicate<? super T> predicate) { boolean result = false; if (collection != null && predicate != null) { for (final Iterator<T> it = collection.iterator(); it.hasNext();) { if (!predicate.evaluate(it.next())) { it.remove(); result = true; } } } return result; } | /**
* Filter the collection by applying a Predicate to each element. If the
* predicate returns false, remove the element.
* <p>
* If the input collection or predicate is null, there is no change made.
*
* @param <T> the type of object the {@link Iterable} contains
* @param collection the collection to get the input from, may be null
* @param predicate the predicate to use as a filter, may be null
* @return true if the collection is modified by this call, false otherwise.
*/ | Filter the collection by applying a Predicate to each element. If the predicate returns false, remove the element. If the input collection or predicate is null, there is no change made | filter | {
"repo_name": "gonmarques/commons-collections",
"path": "src/main/java/org/apache/commons/collections4/CollectionUtils.java",
"license": "apache-2.0",
"size": 92921
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,546,386 |
public void finishRequest()
throws IOException
{
try {
HttpServletRequestImpl requestFacade = _requestFacade;
_requestFacade = null;
_responseFacade = null;
if (requestFacade != null)
requestFacade.finishRequest();
// server/0219, but must be freed for GC
_response.finishRequest();
cleanup();
} catch (Exception e) {
log.log(Level.WARNING, e.toString(), e);
} finally {
_requestFacade = null;
_responseFacade = null;
}
} | void function() throws IOException { try { HttpServletRequestImpl requestFacade = _requestFacade; _requestFacade = null; _responseFacade = null; if (requestFacade != null) requestFacade.finishRequest(); _response.finishRequest(); cleanup(); } catch (Exception e) { log.log(Level.WARNING, e.toString(), e); } finally { _requestFacade = null; _responseFacade = null; } } | /**
* Cleans up at the end of the request
*/ | Cleans up at the end of the request | finishRequest | {
"repo_name": "gruppo4/quercus-upstream",
"path": "modules/resin/src/com/caucho/server/http/AbstractHttpRequest.java",
"license": "gpl-2.0",
"size": 43371
} | [
"java.io.IOException",
"java.util.logging.Level"
] | import java.io.IOException; import java.util.logging.Level; | import java.io.*; import java.util.logging.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 400,655 |
public Scan getScan() {
return serializableScan.scan;
} | Scan function() { return serializableScan.scan; } | /**
* Gets the {@link Scan} used to filter the table.
* @return The {@link Scan}.
*/ | Gets the <code>Scan</code> used to filter the table | getScan | {
"repo_name": "waprin/cloud-bigtable-client",
"path": "bigtable-hbase-dataflow/src/main/java/com/google/cloud/bigtable/dataflow/CloudBigtableScanConfiguration.java",
"license": "apache-2.0",
"size": 6804
} | [
"org.apache.hadoop.hbase.client.Scan"
] | import org.apache.hadoop.hbase.client.Scan; | import org.apache.hadoop.hbase.client.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,254,689 |
public final BulkRequest timeout(TimeValue timeout) {
this.timeout = timeout;
return this;
}
/**
* Note for internal callers (NOT high level rest client),
* the global parameter setting is ignored when used with:
*
* - {@link BulkRequest#add(IndexRequest)}
* - {@link BulkRequest#add(UpdateRequest)}
* - {@link BulkRequest#add(DocWriteRequest)}
* - {@link BulkRequest#add(DocWriteRequest[])} )}
* - {@link BulkRequest#add(Iterable)} | final BulkRequest function(TimeValue timeout) { this.timeout = timeout; return this; } /** * Note for internal callers (NOT high level rest client), * the global parameter setting is ignored when used with: * * - {@link BulkRequest#add(IndexRequest)} * - {@link BulkRequest#add(UpdateRequest)} * - {@link BulkRequest#add(DocWriteRequest)} * - {@link BulkRequest#add(DocWriteRequest[])} )} * - {@link BulkRequest#add(Iterable)} | /**
* A timeout to wait if the index operation can't be performed immediately. Defaults to {@code 1m}.
*/ | A timeout to wait if the index operation can't be performed immediately. Defaults to 1m | timeout | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/bulk/BulkRequest.java",
"license": "apache-2.0",
"size": 16310
} | [
"org.elasticsearch.action.DocWriteRequest",
"org.elasticsearch.action.index.IndexRequest",
"org.elasticsearch.action.update.UpdateRequest",
"org.elasticsearch.core.TimeValue"
] | import org.elasticsearch.action.DocWriteRequest; import org.elasticsearch.action.index.IndexRequest; import org.elasticsearch.action.update.UpdateRequest; import org.elasticsearch.core.TimeValue; | import org.elasticsearch.action.*; import org.elasticsearch.action.index.*; import org.elasticsearch.action.update.*; import org.elasticsearch.core.*; | [
"org.elasticsearch.action",
"org.elasticsearch.core"
] | org.elasticsearch.action; org.elasticsearch.core; | 2,839,744 |
if (index < sensors.size()) {
ExtSensor sensor = sensors.get(index);
// prepare request properties
final UrlBuilder urlBuilder = new UrlBuilder().setProtocol(
CommonSenseClient.Urls.PROTOCOL).setHost(CommonSenseClient.Urls.HOST);
urlBuilder.setPath(Urls.PATH_SENSORS + "/" + sensor.getId() + ".json");
final String url = urlBuilder.buildString();
final Method method = RequestBuilder.DELETE;
final String sessionId = SessionManager.getSessionId();
// prepare request callback
RequestCallback reqCallback = new RequestCallback() { | if (index < sensors.size()) { ExtSensor sensor = sensors.get(index); final UrlBuilder urlBuilder = new UrlBuilder().setProtocol( CommonSenseClient.Urls.PROTOCOL).setHost(CommonSenseClient.Urls.HOST); urlBuilder.setPath(Urls.PATH_SENSORS + "/" + sensor.getId() + ".json"); final String url = urlBuilder.buildString(); final Method method = RequestBuilder.DELETE; final String sessionId = SessionManager.getSessionId(); RequestCallback reqCallback = new RequestCallback() { | /**
* Deletes a list of sensors, using Ajax requests to CommonSense.
*
* @param sensors
* The list of sensors that have to be deleted.
* @param index
* List index of the current sensor to be deleted.
* @param retryCount
* Counter for failed requests that were retried.
*/ | Deletes a list of sensors, using Ajax requests to CommonSense | delete | {
"repo_name": "senseobservationsystems/commonsense-frontend",
"path": "src/nl/sense_os/commonsense/main/client/sensors/delete/SensorDeleteController.java",
"license": "apache-2.0",
"size": 5278
} | [
"com.google.gwt.http.client.RequestBuilder",
"com.google.gwt.http.client.RequestCallback",
"com.google.gwt.http.client.UrlBuilder",
"nl.sense_os.commonsense.common.client.communication.SessionManager",
"nl.sense_os.commonsense.lib.client.communication.CommonSenseClient",
"nl.sense_os.commonsense.main.client.ext.model.ExtSensor"
] | import com.google.gwt.http.client.RequestBuilder; import com.google.gwt.http.client.RequestCallback; import com.google.gwt.http.client.UrlBuilder; import nl.sense_os.commonsense.common.client.communication.SessionManager; import nl.sense_os.commonsense.lib.client.communication.CommonSenseClient; import nl.sense_os.commonsense.main.client.ext.model.ExtSensor; | import com.google.gwt.http.client.*; import nl.sense_os.commonsense.common.client.communication.*; import nl.sense_os.commonsense.lib.client.communication.*; import nl.sense_os.commonsense.main.client.ext.model.*; | [
"com.google.gwt",
"nl.sense_os.commonsense"
] | com.google.gwt; nl.sense_os.commonsense; | 476,645 |
static void checkMethodIdentifier(int version, final String name,
final String msg) {
if (name == null || name.length() == 0) {
throw new IllegalArgumentException("Invalid " + msg
+ " (must not be null or empty)");
}
if ((version & 0xFFFF) >= Opcodes.V1_5) {
for (int i = 0; i < name.length(); ++i) {
if (".;[/<>".indexOf(name.charAt(i)) != -1) {
throw new IllegalArgumentException("Invalid " + msg
+ " (must be a valid unqualified name): " + name);
}
}
return;
}
if (!Character.isJavaIdentifierStart(name.charAt(0))) {
throw new IllegalArgumentException(
"Invalid "
+ msg
+ " (must be a '<init>', '<clinit>' or a valid Java identifier): "
+ name);
}
for (int i = 1; i < name.length(); ++i) {
if (!Character.isJavaIdentifierPart(name.charAt(i))) {
throw new IllegalArgumentException(
"Invalid "
+ msg
+ " (must be '<init>' or '<clinit>' or a valid Java identifier): "
+ name);
}
}
} | static void checkMethodIdentifier(int version, final String name, final String msg) { if (name == null name.length() == 0) { throw new IllegalArgumentException(STR + msg + STR); } if ((version & 0xFFFF) >= Opcodes.V1_5) { for (int i = 0; i < name.length(); ++i) { if (STR.indexOf(name.charAt(i)) != -1) { throw new IllegalArgumentException(STR + msg + STR + name); } } return; } if (!Character.isJavaIdentifierStart(name.charAt(0))) { throw new IllegalArgumentException( STR + msg + STR + name); } for (int i = 1; i < name.length(); ++i) { if (!Character.isJavaIdentifierPart(name.charAt(i))) { throw new IllegalArgumentException( STR + msg + STR + name); } } } | /**
* Checks that the given string is a valid Java identifier.
*
* @param version
* the class version.
* @param name
* the string to be checked.
* @param msg
* a message to be used in case of error.
*/ | Checks that the given string is a valid Java identifier | checkMethodIdentifier | {
"repo_name": "FFY00/deobfuscator",
"path": "src/main/java/com/javadeobfuscator/deobfuscator/org/objectweb/asm/util/CheckMethodAdapter.java",
"license": "apache-2.0",
"size": 53196
} | [
"com.javadeobfuscator.deobfuscator.org.objectweb.asm.Opcodes"
] | import com.javadeobfuscator.deobfuscator.org.objectweb.asm.Opcodes; | import com.javadeobfuscator.deobfuscator.org.objectweb.asm.*; | [
"com.javadeobfuscator.deobfuscator"
] | com.javadeobfuscator.deobfuscator; | 743,364 |
public void closeRegionByRow(byte[] row, RegionLocator table) throws IOException {
HRegionLocation hrl = table.getRegionLocation(row);
closeRegion(hrl.getRegionInfo().getRegionName());
} | void function(byte[] row, RegionLocator table) throws IOException { HRegionLocation hrl = table.getRegionLocation(row); closeRegion(hrl.getRegionInfo().getRegionName()); } | /**
* Closes the region containing the given row.
*
* @param row The row to find the containing region.
* @param table The table to find the region.
* @throws IOException
*/ | Closes the region containing the given row | closeRegionByRow | {
"repo_name": "joshelser/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 143118
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.client.RegionLocator"
] | import java.io.IOException; import org.apache.hadoop.hbase.client.RegionLocator; | import java.io.*; import org.apache.hadoop.hbase.client.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,915,597 |
public static ImageReader getImageReader (ImageWriter writer)
{
if (writer == null)
throw new IllegalArgumentException ("null argument");
ImageWriterSpi spi = writer.getOriginatingProvider();
String[] readerSpiNames = spi.getImageReaderSpiNames();
ImageReader r = null;
if (readerSpiNames != null)
{
try
{
Class readerClass = Class.forName (readerSpiNames[0]);
r = (ImageReader) readerClass.newInstance ();
}
catch (Exception e)
{
return null;
}
}
return r;
} | static ImageReader function (ImageWriter writer) { if (writer == null) throw new IllegalArgumentException (STR); ImageWriterSpi spi = writer.getOriginatingProvider(); String[] readerSpiNames = spi.getImageReaderSpiNames(); ImageReader r = null; if (readerSpiNames != null) { try { Class readerClass = Class.forName (readerSpiNames[0]); r = (ImageReader) readerClass.newInstance (); } catch (Exception e) { return null; } } return r; } | /**
* Retrieve an image reader corresponding to an image writer, or
* null if writer is not registered or if no corresponding reader is
* registered.
*
* @param writer a registered image writer
*
* @return an image reader corresponding to writer, or null
*
* @exception IllegalArgumentException if writer is null
*/ | Retrieve an image reader corresponding to an image writer, or null if writer is not registered or if no corresponding reader is registered | getImageReader | {
"repo_name": "nmacs/lm3s-uclinux",
"path": "lib/classpath/javax/imageio/ImageIO.java",
"license": "gpl-2.0",
"size": 36051
} | [
"javax.imageio.spi.ImageWriterSpi"
] | import javax.imageio.spi.ImageWriterSpi; | import javax.imageio.spi.*; | [
"javax.imageio"
] | javax.imageio; | 1,939,016 |
CommandLineConfig setWarningGuardSpec(WarningGuardSpec spec) {
this.warningGuards = spec;
return this;
}
private final List<String> define = Lists.newArrayList(); | CommandLineConfig setWarningGuardSpec(WarningGuardSpec spec) { this.warningGuards = spec; return this; } private final List<String> define = Lists.newArrayList(); | /**
* Add warning guards.
*/ | Add warning guards | setWarningGuardSpec | {
"repo_name": "h4ck3rm1k3/javascript-closure-compiler-git",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 67882
} | [
"com.google.common.collect.Lists",
"java.util.List"
] | import com.google.common.collect.Lists; import java.util.List; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,564,653 |
public ServerInner withIdentity(ResourceIdentity identity) {
this.identity = identity;
return this;
} | ServerInner function(ResourceIdentity identity) { this.identity = identity; return this; } | /**
* Set the identity property: The Azure Active Directory identity of the server.
*
* @param identity the identity value to set.
* @return the ServerInner object itself.
*/ | Set the identity property: The Azure Active Directory identity of the server | withIdentity | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerInner.java",
"license": "mit",
"size": 15590
} | [
"com.azure.resourcemanager.postgresql.models.ResourceIdentity"
] | import com.azure.resourcemanager.postgresql.models.ResourceIdentity; | import com.azure.resourcemanager.postgresql.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 1,301,447 |
public synchronized void remove(int index) {
List<T> copy = new ArrayList<T>(list);
copy.remove(index);
list = copy;
} | synchronized void function(int index) { List<T> copy = new ArrayList<T>(list); copy.remove(index); list = copy; } | /**
* Removes from the list by making a copy of every element except the one with the given index.
* @param index - index of the element to remove.
*/ | Removes from the list by making a copy of every element except the one with the given index | remove | {
"repo_name": "aadnk/ProtocolLib",
"path": "src/main/java/com/comphenix/protocol/concurrency/SortedCopyOnWriteArray.java",
"license": "gpl-2.0",
"size": 6439
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 289,775 |
@Test
public void testGetNullCacheValue() throws IOException {
Path targetDirectory = scratch.dir("/external");
Path targetPath = targetDirectory.getChild(downloadedFile.getBaseName());
Path actualTargetPath = repositoryCache.get(downloadedFileSha256, targetPath, KeyType.SHA256);
assertThat(actualTargetPath).isNull();
} | void function() throws IOException { Path targetDirectory = scratch.dir(STR); Path targetPath = targetDirectory.getChild(downloadedFile.getBaseName()); Path actualTargetPath = repositoryCache.get(downloadedFileSha256, targetPath, KeyType.SHA256); assertThat(actualTargetPath).isNull(); } | /**
* Test that the get method retrieves a null if the value is not cached.
*/ | Test that the get method retrieves a null if the value is not cached | testGetNullCacheValue | {
"repo_name": "damienmg/bazel",
"path": "src/test/java/com/google/devtools/build/lib/bazel/repository/cache/RepositoryCacheTest.java",
"license": "apache-2.0",
"size": 6881
} | [
"com.google.common.truth.Truth",
"com.google.devtools.build.lib.bazel.repository.cache.RepositoryCache",
"com.google.devtools.build.lib.vfs.Path",
"java.io.IOException"
] | import com.google.common.truth.Truth; import com.google.devtools.build.lib.bazel.repository.cache.RepositoryCache; import com.google.devtools.build.lib.vfs.Path; import java.io.IOException; | import com.google.common.truth.*; import com.google.devtools.build.lib.bazel.repository.cache.*; import com.google.devtools.build.lib.vfs.*; import java.io.*; | [
"com.google.common",
"com.google.devtools",
"java.io"
] | com.google.common; com.google.devtools; java.io; | 1,171,447 |
Call call = new Call();
call.request = request;
call.method = request.getMethod();
call.authorization = request.getAuthorization();
call.uri = request.getRequestURI();
call.contentType = request.getContentType();
call.url = request.getRequestURL().toString();
for (String headerName : request.getHeaderNames()) {
List<String> headers = new ArrayList<>();
request.getHeaders(headerName).forEach(headers::add);
call.headers.put(headerName, headers);
}
call.parameters = new HashMap<>(request.getParameterMap());
try {
call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset());
} catch (IOException e) {
throw new RuntimeException("Problem reading Post Body of HTTP call");
}
return call;
} | Call call = new Call(); call.request = request; call.method = request.getMethod(); call.authorization = request.getAuthorization(); call.uri = request.getRequestURI(); call.contentType = request.getContentType(); call.url = request.getRequestURL().toString(); for (String headerName : request.getHeaderNames()) { List<String> headers = new ArrayList<>(); request.getHeaders(headerName).forEach(headers::add); call.headers.put(headerName, headers); } call.parameters = new HashMap<>(request.getParameterMap()); try { call.postBody = request.getPostBody(999999).toStringContent(Charset.defaultCharset()); } catch (IOException e) { throw new RuntimeException(STR); } return call; } | /**
* Factory method
*/ | Factory method | fromRequest | {
"repo_name": "mkotsur/restito",
"path": "src/main/java/com/xebialabs/restito/semantics/Call.java",
"license": "mit",
"size": 2829
} | [
"java.io.IOException",
"java.nio.charset.Charset",
"java.util.ArrayList",
"java.util.HashMap",
"java.util.List"
] | import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; import java.util.List; | import java.io.*; import java.nio.charset.*; import java.util.*; | [
"java.io",
"java.nio",
"java.util"
] | java.io; java.nio; java.util; | 319,268 |
public static void generateCustomPlots(ArrayList<PlotConfig> plotConfigs,
ArrayList<Plot> customPlots, String dstDir,
SeriesData[] seriesData, int[] indizes, IBatch[] initBatches,
PlotStyle style, PlotType type, ValueSortMode valueSortMode,
String[] valueSortList, HashMap<Long, Long> timestampMap)
throws IOException {
// check if aggregated batches
boolean aggregatedBatches = false;
if (initBatches instanceof AggregatedBatch[])
aggregatedBatches = true;
for (int i = 0; i < plotConfigs.size(); i++) {
Log.info("\tplotting '" + plotConfigs.get(i).getFilename() + "'");
PlotConfig config = plotConfigs.get(i);
String[] values = config.getValues();
String[] domains = config.getDomains();
// set flags for what to plot
boolean plotNormal = false;
boolean plotAsCdf = false;
switch (config.getPlotAsCdf()) {
case "true":
plotAsCdf = true;
break;
case "false":
plotNormal = true;
break;
case "both":
plotNormal = true;
plotAsCdf = true;
break;
}
// series data quantities array
int[] seriesDataQuantities = new int[seriesData.length];
// plot data list, will contain "lines" of the plot
ArrayList<PlotData> dataList = new ArrayList<PlotData>();
// iterate over values
for (int j = 0; j < seriesData.length; j++) {
for (int k = 0; k < values.length; k++) {
String value = values[k];
String domain = domains[k];
String title = getValuePlotLineTitle(seriesData, indizes,
j, domain, value, aggregatedBatches);
// iterate over values to be plotted
if (domain.equals(PlotConfig.customPlotDomainExpression)) {
// if expression
String[] expressionSplit = value.split(":");
if (expressionSplit.length != 2) {
Log.warn("wrong expression syntax for '" + value
+ "'");
continue;
}
// parse name
String exprName;
if (expressionSplit[0].equals(""))
exprName = expressionSplit[1];
else
exprName = expressionSplit[0];
if (initBatches[j].contains(PlottingUtils
.getDomainFromExpression(value,
config.getGeneralDomain()),
PlottingUtils.getValueFromExpression(value))) {
dataList.add(new ExpressionData(exprName,
expressionSplit[1], style,
getValuePlotLineTitle(seriesData, indizes,
j, "", exprName.replace("$", ""),
aggregatedBatches), config
.getGeneralDomain(), seriesData[j]
.getDir()));
seriesDataQuantities[j]++;
}
} else {
// check if series contains value
if (initBatches[j].contains(domain, value)) {
dataList.add(PlotData.get(value, domain, style,
title, type, seriesData[j].getDir()));
seriesDataQuantities[j]++;
}
}
}
}
// transform datalist to array
PlotData[] data = dataList.toArray(new PlotData[0]);
String filename = config.getFilename();
if (plotNormal) {
// create plot
Plot p = new Plot(dstDir, filename,
PlotFilenames.getValuesGnuplotScript(filename),
config.getTitle(), config, data);
// set timestamp mapping
p.setTimestampMap(timestampMap);
// set series data quantities
p.setSeriesDataQuantities(seriesDataQuantities);
// sort
p.sortData(config);
// add to plot list
customPlots.add(p);
}
if (plotAsCdf) {
// create plot
Plot p = new Plot(dstDir,
PlotFilenames.getValuesPlotCDF(filename),
PlotFilenames.getValuesGnuplotScriptCDF(filename),
"CDF of " + config.getTitle(), config, data);
// set timestamp mapping
p.setTimestampMap(timestampMap);
// set as cdf plot
p.setCdfPlot(true);
// set series data quantities
p.setSeriesDataQuantities(seriesDataQuantities);
// sort
p.sortData(config);
// add to plot list
customPlots.add(p);
}
}
} | static void function(ArrayList<PlotConfig> plotConfigs, ArrayList<Plot> customPlots, String dstDir, SeriesData[] seriesData, int[] indizes, IBatch[] initBatches, PlotStyle style, PlotType type, ValueSortMode valueSortMode, String[] valueSortList, HashMap<Long, Long> timestampMap) throws IOException { boolean aggregatedBatches = false; if (initBatches instanceof AggregatedBatch[]) aggregatedBatches = true; for (int i = 0; i < plotConfigs.size(); i++) { Log.info(STR + plotConfigs.get(i).getFilename() + "'"); PlotConfig config = plotConfigs.get(i); String[] values = config.getValues(); String[] domains = config.getDomains(); boolean plotNormal = false; boolean plotAsCdf = false; switch (config.getPlotAsCdf()) { case "true": plotAsCdf = true; break; case "false": plotNormal = true; break; case "both": plotNormal = true; plotAsCdf = true; break; } int[] seriesDataQuantities = new int[seriesData.length]; ArrayList<PlotData> dataList = new ArrayList<PlotData>(); for (int j = 0; j < seriesData.length; j++) { for (int k = 0; k < values.length; k++) { String value = values[k]; String domain = domains[k]; String title = getValuePlotLineTitle(seriesData, indizes, j, domain, value, aggregatedBatches); if (domain.equals(PlotConfig.customPlotDomainExpression)) { String[] expressionSplit = value.split(":"); if (expressionSplit.length != 2) { Log.warn(STR + value + "'"); continue; } String exprName; if (expressionSplit[0].equals(STRSTR$STRSTRCDF of " + config.getTitle(), config, data); p.setTimestampMap(timestampMap); p.setCdfPlot(true); p.setSeriesDataQuantities(seriesDataQuantities); p.sortData(config); customPlots.add(p); } } } | /**
* Generates custom plots from the given PlotConfig list and adds them to
* the Plot list.
*
* @param plotConfigs
* Input plot config list from which the plots will be created.
* @param customPlots
* List of Plot-Objects to which the new generated plots will be
* added.
* @param dstDir
* Destination directory for the plots.
* @param seriesData
* Array of SeriesData objects that will be plotted.
* @param indizes
* Indizes of the runs, used for line naming.
* @param initBatches
* Array of init batches, one for each series data object.
* @param style
* PlotStyle of the resulting plots.
* @param type
* PlotType of the resulting plots.
* @throws IOException
* Thrown by the writer created in the plots.
*/ | Generates custom plots from the given PlotConfig list and adds them to the Plot list | generateCustomPlots | {
"repo_name": "BenjaminSchiller/DNA",
"path": "src/dna/plot/PlottingUtils.java",
"license": "gpl-3.0",
"size": 117803
} | [
"dna.plot.PlottingConfig",
"dna.plot.data.PlotData",
"dna.series.aggdata.AggregatedBatch",
"dna.series.data.IBatch",
"dna.series.data.SeriesData",
"dna.util.Log",
"java.io.IOException",
"java.util.ArrayList",
"java.util.HashMap"
] | import dna.plot.PlottingConfig; import dna.plot.data.PlotData; import dna.series.aggdata.AggregatedBatch; import dna.series.data.IBatch; import dna.series.data.SeriesData; import dna.util.Log; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; | import dna.plot.*; import dna.plot.data.*; import dna.series.aggdata.*; import dna.series.data.*; import dna.util.*; import java.io.*; import java.util.*; | [
"dna.plot",
"dna.plot.data",
"dna.series.aggdata",
"dna.series.data",
"dna.util",
"java.io",
"java.util"
] | dna.plot; dna.plot.data; dna.series.aggdata; dna.series.data; dna.util; java.io; java.util; | 1,052,516 |
public static Interface createInterface(JavaPackage javaPackage, String interfaceName, VisibilityKind visibility,
boolean isAbstract, InheritanceKind inheritance, boolean proxyState, String... interfacesNames) {
return InterfaceHelper.builder(javaPackage, interfaceName).setVisibility(visibility).setAbstract(isAbstract)
.setProxy(proxyState).setInheritance(inheritance).addInterfaces(interfacesNames).build();
} | static Interface function(JavaPackage javaPackage, String interfaceName, VisibilityKind visibility, boolean isAbstract, InheritanceKind inheritance, boolean proxyState, String... interfacesNames) { return InterfaceHelper.builder(javaPackage, interfaceName).setVisibility(visibility).setAbstract(isAbstract) .setProxy(proxyState).setInheritance(inheritance).addInterfaces(interfacesNames).build(); } | /**
* Create an interface in a stand alone compilation unit
*
* @param javaPackage
* the package of the created interface.
* @param interfaceName
* the name of the created interface without .java extension.
* @param visibility
* the visibility of the created interface.
* @param isAbstract
* the abstract state of the created interface.
* @param proxyState
* the proxy state of of the created interface.
* @param interfacesNames
* the interfaces names list to add to the created interface
* declaration.
* @return the created interface accordingly to the specified parameters.
*/ | Create an interface in a stand alone compilation unit | createInterface | {
"repo_name": "awltech/eclipse-optimus",
"path": "net.atos.optimus.m2m.javaxmi.parent/net.atos.optimus.m2m.javaxmi.operation/src/main/java/net/atos/optimus/m2m/javaxmi/operation/interfaces/InterfaceHelper.java",
"license": "lgpl-3.0",
"size": 8159
} | [
"net.atos.optimus.m2m.javaxmi.operation.packages.JavaPackage",
"org.eclipse.gmt.modisco.java.InheritanceKind",
"org.eclipse.gmt.modisco.java.VisibilityKind"
] | import net.atos.optimus.m2m.javaxmi.operation.packages.JavaPackage; import org.eclipse.gmt.modisco.java.InheritanceKind; import org.eclipse.gmt.modisco.java.VisibilityKind; | import net.atos.optimus.m2m.javaxmi.operation.packages.*; import org.eclipse.gmt.modisco.java.*; | [
"net.atos.optimus",
"org.eclipse.gmt"
] | net.atos.optimus; org.eclipse.gmt; | 2,392,525 |
public void onActivatorRailPass(int x, int y, int z, boolean receivingPower)
{
if (receivingPower)
{
if (this.riddenByEntity != null)
{
this.riddenByEntity.mountEntity((Entity)null);
}
if (this.getRollingAmplitude() == 0)
{
this.setRollingDirection(-this.getRollingDirection());
this.setRollingAmplitude(10);
this.setDamage(50.0F);
this.setBeenAttacked();
}
}
} | void function(int x, int y, int z, boolean receivingPower) { if (receivingPower) { if (this.riddenByEntity != null) { this.riddenByEntity.mountEntity((Entity)null); } if (this.getRollingAmplitude() == 0) { this.setRollingDirection(-this.getRollingDirection()); this.setRollingAmplitude(10); this.setDamage(50.0F); this.setBeenAttacked(); } } } | /**
* Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power
*/ | Called every tick the minecart is on an activator rail. Args: x, y, z, is the rail receiving power | onActivatorRailPass | {
"repo_name": "TorchPowered/Thallium",
"path": "src/main/java/net/minecraft/entity/item/EntityMinecartEmpty.java",
"license": "mit",
"size": 1854
} | [
"net.minecraft.entity.Entity"
] | import net.minecraft.entity.Entity; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 675,050 |
private void checkJournal(String[] allowed, String[] denied) throws RepositoryException {
Set<String> allowedSet = new HashSet<String>(Arrays.asList(allowed));
Set<String> deniedSet = new HashSet<String>(Arrays.asList(denied));
while (journal.hasNext()) {
String path = journal.nextEvent().getPath();
allowedSet.remove(path);
if (deniedSet.contains(path)) {
fail(path + " must not be present in journal");
}
}
assertTrue("Missing paths in journal: " + allowedSet, allowedSet.isEmpty());
} | void function(String[] allowed, String[] denied) throws RepositoryException { Set<String> allowedSet = new HashSet<String>(Arrays.asList(allowed)); Set<String> deniedSet = new HashSet<String>(Arrays.asList(denied)); while (journal.hasNext()) { String path = journal.nextEvent().getPath(); allowedSet.remove(path); if (deniedSet.contains(path)) { fail(path + STR); } } assertTrue(STR + allowedSet, allowedSet.isEmpty()); } | /**
* Checks the journal for events.
*
* @param allowed allowed paths for the returned events.
* @param denied denied paths for the returned events.
* @throws RepositoryException if an error occurs while reading the event
* journal.
*/ | Checks the journal for events | checkJournal | {
"repo_name": "tripodsan/jackrabbit",
"path": "jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/observation/EventJournalTest.java",
"license": "apache-2.0",
"size": 8746
} | [
"java.util.Arrays",
"java.util.HashSet",
"java.util.Set",
"javax.jcr.RepositoryException"
] | import java.util.Arrays; import java.util.HashSet; import java.util.Set; import javax.jcr.RepositoryException; | import java.util.*; import javax.jcr.*; | [
"java.util",
"javax.jcr"
] | java.util; javax.jcr; | 927,394 |
public void testTempFileWithDir() throws Exception
{
File tempDir = TempFileProvider.getTempDir();
File tempFile = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir);
File tempFileParent = tempFile.getParentFile();
assertEquals("Temp file not located in our temp directory",
tempDir, tempFileParent);
File tempFile2 = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir);
tempFile2.delete();
}
| void function() throws Exception { File tempDir = TempFileProvider.getTempDir(); File tempFile = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir); File tempFileParent = tempFile.getParentFile(); assertEquals(STR, tempDir, tempFileParent); File tempFile2 = TempFileProvider.createTempFile("AAAA", ".tmp", tempDir); tempFile2.delete(); } | /**
* test create a temporary file with a directory
*
* create another file with the same prefix and suffix.
* @throws Exception
*/ | test create a temporary file with a directory create another file with the same prefix and suffix | testTempFileWithDir | {
"repo_name": "Alfresco/gytheio",
"path": "gytheio-commons/src/test/java/org/gytheio/content/file/TempFileProviderTest.java",
"license": "lgpl-3.0",
"size": 3172
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 930,386 |
private static String flowModActionsToString(List<OFAction> fmActions) {
StringBuilder sb = new StringBuilder();
for (OFAction a : fmActions) {
if (sb.length() > 0) {
sb.append(',');
}
switch(a.getType()) {
case OUTPUT:
sb.append("output=" + Short.toString(((OFActionOutput)a).getPort()));
break;
case OPAQUE_ENQUEUE:
int queue = ((OFActionEnqueue)a).getQueueId();
short port = ((OFActionEnqueue)a).getPort();
sb.append("enqueue=" + Short.toString(port) + ":0x" + String.format("%02x", queue));
break;
case STRIP_VLAN:
sb.append("strip-vlan");
break;
case SET_VLAN_ID:
sb.append("set-vlan-id=" +
Short.toString(((OFActionVirtualLanIdentifier)a).getVirtualLanIdentifier()));
break;
case SET_VLAN_PCP:
sb.append("set-vlan-priority=" +
Byte.toString(((OFActionVirtualLanPriorityCodePoint)a).getVirtualLanPriorityCodePoint()));
break;
case SET_DL_SRC:
sb.append("set-src-mac=" +
HexString.toHexString(((OFActionDataLayerSource)a).getDataLayerAddress()));
break;
case SET_DL_DST:
sb.append("set-dst-mac=" +
HexString.toHexString(((OFActionDataLayerDestination)a).getDataLayerAddress()));
break;
case SET_NW_TOS:
sb.append("set-tos-bits=" +
Byte.toString(((OFActionNetworkTypeOfService)a).getNetworkTypeOfService()));
break;
case SET_NW_SRC:
sb.append("set-src-ip=" +
IPv4.fromIPv4Address(((OFActionNetworkLayerSource)a).getNetworkAddress()));
break;
case SET_NW_DST:
sb.append("set-dst-ip=" +
IPv4.fromIPv4Address(((OFActionNetworkLayerDestination)a).getNetworkAddress()));
break;
case SET_TP_SRC:
sb.append("set-src-port=" +
Short.toString(((OFActionTransportLayerSource)a).getTransportPort()));
break;
case SET_TP_DST:
sb.append("set-dst-port=" +
Short.toString(((OFActionTransportLayerDestination)a).getTransportPort()));
break;
default:
log.error("Could not decode action " + a);
break;
}
}
return sb.toString();
}
/**
* Turns a JSON formatted Static Flow Pusher string into a storage entry
* Expects a string in JSON along the lines of:
* {
* "switch": "AA:BB:CC:DD:EE:FF:00:11",
* "name": "flow-mod-1",
* "cookie": "0",
* "priority": "32768",
* "ingress-port": "1",
* "actions": "output=2",
* } | static String function(List<OFAction> fmActions) { StringBuilder sb = new StringBuilder(); for (OFAction a : fmActions) { if (sb.length() > 0) { sb.append(','); } switch(a.getType()) { case OUTPUT: sb.append(STR + Short.toString(((OFActionOutput)a).getPort())); break; case OPAQUE_ENQUEUE: int queue = ((OFActionEnqueue)a).getQueueId(); short port = ((OFActionEnqueue)a).getPort(); sb.append(STR + Short.toString(port) + ":0x" + String.format("%02x", queue)); break; case STRIP_VLAN: sb.append(STR); break; case SET_VLAN_ID: sb.append(STR + Short.toString(((OFActionVirtualLanIdentifier)a).getVirtualLanIdentifier())); break; case SET_VLAN_PCP: sb.append(STR + Byte.toString(((OFActionVirtualLanPriorityCodePoint)a).getVirtualLanPriorityCodePoint())); break; case SET_DL_SRC: sb.append(STR + HexString.toHexString(((OFActionDataLayerSource)a).getDataLayerAddress())); break; case SET_DL_DST: sb.append(STR + HexString.toHexString(((OFActionDataLayerDestination)a).getDataLayerAddress())); break; case SET_NW_TOS: sb.append(STR + Byte.toString(((OFActionNetworkTypeOfService)a).getNetworkTypeOfService())); break; case SET_NW_SRC: sb.append(STR + IPv4.fromIPv4Address(((OFActionNetworkLayerSource)a).getNetworkAddress())); break; case SET_NW_DST: sb.append(STR + IPv4.fromIPv4Address(((OFActionNetworkLayerDestination)a).getNetworkAddress())); break; case SET_TP_SRC: sb.append(STR + Short.toString(((OFActionTransportLayerSource)a).getTransportPort())); break; case SET_TP_DST: sb.append(STR + Short.toString(((OFActionTransportLayerDestination)a).getTransportPort())); break; default: log.error(STR + a); break; } } return sb.toString(); } /** * Turns a JSON formatted Static Flow Pusher string into a storage entry * Expects a string in JSON along the lines of: * { * STR: STR, * "name": STR, * STR: "0", * STR: "32768", * STR: "1", * STR: STR, * } | /**
* Returns a String representation of all the openflow actions.
* @param fmActions A list of OFActions to encode into one string
* @return A string of the actions encoded for our database
*/ | Returns a String representation of all the openflow actions | flowModActionsToString | {
"repo_name": "schuza/odin-master",
"path": "src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java",
"license": "apache-2.0",
"size": 32405
} | [
"java.util.List",
"net.floodlightcontroller.packet.IPv4",
"org.openflow.protocol.action.OFAction",
"org.openflow.protocol.action.OFActionDataLayerDestination",
"org.openflow.protocol.action.OFActionDataLayerSource",
"org.openflow.protocol.action.OFActionEnqueue",
"org.openflow.protocol.action.OFActionNetworkLayerDestination",
"org.openflow.protocol.action.OFActionNetworkLayerSource",
"org.openflow.protocol.action.OFActionNetworkTypeOfService",
"org.openflow.protocol.action.OFActionOutput",
"org.openflow.protocol.action.OFActionTransportLayerDestination",
"org.openflow.protocol.action.OFActionTransportLayerSource",
"org.openflow.protocol.action.OFActionVirtualLanIdentifier",
"org.openflow.protocol.action.OFActionVirtualLanPriorityCodePoint",
"org.openflow.util.HexString"
] | import java.util.List; import net.floodlightcontroller.packet.IPv4; import org.openflow.protocol.action.OFAction; import org.openflow.protocol.action.OFActionDataLayerDestination; import org.openflow.protocol.action.OFActionDataLayerSource; import org.openflow.protocol.action.OFActionEnqueue; import org.openflow.protocol.action.OFActionNetworkLayerDestination; import org.openflow.protocol.action.OFActionNetworkLayerSource; import org.openflow.protocol.action.OFActionNetworkTypeOfService; import org.openflow.protocol.action.OFActionOutput; import org.openflow.protocol.action.OFActionTransportLayerDestination; import org.openflow.protocol.action.OFActionTransportLayerSource; import org.openflow.protocol.action.OFActionVirtualLanIdentifier; import org.openflow.protocol.action.OFActionVirtualLanPriorityCodePoint; import org.openflow.util.HexString; | import java.util.*; import net.floodlightcontroller.packet.*; import org.openflow.protocol.action.*; import org.openflow.util.*; | [
"java.util",
"net.floodlightcontroller.packet",
"org.openflow.protocol",
"org.openflow.util"
] | java.util; net.floodlightcontroller.packet; org.openflow.protocol; org.openflow.util; | 125,793 |
public void checkTotals(Document document) {
boolean proceed = true;
KualiDecimal total = newPerDiem.getBreakfast();
total = total.add(newPerDiem.getLunch());
total = total.add(newPerDiem.getDinner());
total = total.add(newPerDiem.getIncidentals());
if(!total.equals(newPerDiem.getMealsAndIncidentals()))
{
proceed = askOrAnalyzeYesNoQuestion("mealsAndIncidentals", "Warning: Breakfast, Lunch, Dinner, and Incidentals total do not match Meals and Incidentals. Would you like to proceed anyway?");
if (!proceed) {
abortRulesCheck();
}
}
} | void function(Document document) { boolean proceed = true; KualiDecimal total = newPerDiem.getBreakfast(); total = total.add(newPerDiem.getLunch()); total = total.add(newPerDiem.getDinner()); total = total.add(newPerDiem.getIncidentals()); if(!total.equals(newPerDiem.getMealsAndIncidentals())) { proceed = askOrAnalyzeYesNoQuestion(STR, STR); if (!proceed) { abortRulesCheck(); } } } | /**
* Checks if the B+L+D+IE total does not match Meal+Incidentals total
*
* @param document - per diem document
*/ | Checks if the B+L+D+IE total does not match Meal+Incidentals total | checkTotals | {
"repo_name": "ua-eas/kfs-devops-automation-fork",
"path": "kfs-tem/src/main/java/org/kuali/kfs/module/tem/document/validation/impl/PerDiemDocumentPreRules.java",
"license": "agpl-3.0",
"size": 3426
} | [
"org.kuali.rice.core.api.util.type.KualiDecimal",
"org.kuali.rice.krad.document.Document"
] | import org.kuali.rice.core.api.util.type.KualiDecimal; import org.kuali.rice.krad.document.Document; | import org.kuali.rice.core.api.util.type.*; import org.kuali.rice.krad.document.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 1,903,122 |
public boolean arrowScroll(int direction, boolean horizontal) {
View currentFocused = findFocus();
if (currentFocused == this) currentFocused = null;
View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction);
final int maxJump = horizontal ? getMaxScrollAmountHorizontal() : getMaxScrollAmountVertical();
if (!horizontal) {
if (nextFocused != null) {
nextFocused.getDrawingRect(mTempRect);
offsetDescendantRectToMyCoords(nextFocused, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
doScroll(0, scrollDelta);
nextFocused.requestFocus(direction);
} else {
// no new focus
int scrollDelta = maxJump;
if (direction == View.FOCUS_UP && getScrollY() < scrollDelta) {
scrollDelta = getScrollY();
} else if (direction == View.FOCUS_DOWN) {
if (getChildCount() > 0) {
int daBottom = getChildAt(0).getBottom();
int screenBottom = getScrollY() + getHeight();
if (daBottom - screenBottom < maxJump) {
scrollDelta = daBottom - screenBottom;
}
}
}
if (scrollDelta == 0) {
return false;
}
doScroll(0, direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta);
}
} else {
if (nextFocused != null) {
nextFocused.getDrawingRect(mTempRect);
offsetDescendantRectToMyCoords(nextFocused, mTempRect);
int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect);
doScroll(scrollDelta, 0);
nextFocused.requestFocus(direction);
} else {
// no new focus
int scrollDelta = maxJump;
if (direction == View.FOCUS_UP && getScrollY() < scrollDelta) {
scrollDelta = getScrollY();
} else if (direction == View.FOCUS_DOWN) {
if (getChildCount() > 0) {
int daBottom = getChildAt(0).getBottom();
int screenBottom = getScrollY() + getHeight();
if (daBottom - screenBottom < maxJump) {
scrollDelta = daBottom - screenBottom;
}
}
}
if (scrollDelta == 0) {
return false;
}
doScroll(direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta, 0);
}
}
return true;
} | boolean function(int direction, boolean horizontal) { View currentFocused = findFocus(); if (currentFocused == this) currentFocused = null; View nextFocused = FocusFinder.getInstance().findNextFocus(this, currentFocused, direction); final int maxJump = horizontal ? getMaxScrollAmountHorizontal() : getMaxScrollAmountVertical(); if (!horizontal) { if (nextFocused != null) { nextFocused.getDrawingRect(mTempRect); offsetDescendantRectToMyCoords(nextFocused, mTempRect); int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect); doScroll(0, scrollDelta); nextFocused.requestFocus(direction); } else { int scrollDelta = maxJump; if (direction == View.FOCUS_UP && getScrollY() < scrollDelta) { scrollDelta = getScrollY(); } else if (direction == View.FOCUS_DOWN) { if (getChildCount() > 0) { int daBottom = getChildAt(0).getBottom(); int screenBottom = getScrollY() + getHeight(); if (daBottom - screenBottom < maxJump) { scrollDelta = daBottom - screenBottom; } } } if (scrollDelta == 0) { return false; } doScroll(0, direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta); } } else { if (nextFocused != null) { nextFocused.getDrawingRect(mTempRect); offsetDescendantRectToMyCoords(nextFocused, mTempRect); int scrollDelta = computeScrollDeltaToGetChildRectOnScreen(mTempRect); doScroll(scrollDelta, 0); nextFocused.requestFocus(direction); } else { int scrollDelta = maxJump; if (direction == View.FOCUS_UP && getScrollY() < scrollDelta) { scrollDelta = getScrollY(); } else if (direction == View.FOCUS_DOWN) { if (getChildCount() > 0) { int daBottom = getChildAt(0).getBottom(); int screenBottom = getScrollY() + getHeight(); if (daBottom - screenBottom < maxJump) { scrollDelta = daBottom - screenBottom; } } } if (scrollDelta == 0) { return false; } doScroll(direction == View.FOCUS_DOWN ? scrollDelta : -scrollDelta, 0); } } return true; } | /**
* Handle scrolling in response to an up or down arrow click.
*
* @param direction The direction corresponding to the arrow key that was
* pressed
* @return True if we consumed the event, false otherwise
*/ | Handle scrolling in response to an up or down arrow click | arrowScroll | {
"repo_name": "yehe01/AndroidTreeView",
"path": "library/src/main/java/com/unnamed/b/atv/view/TwoDScrollView.java",
"license": "apache-2.0",
"size": 45405
} | [
"android.view.FocusFinder",
"android.view.View"
] | import android.view.FocusFinder; import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,863,094 |
@Override
public Doi getEntityDoi(String entityId) throws SynapseException {
return getEntityDoi(entityId, null);
} | Doi function(String entityId) throws SynapseException { return getEntityDoi(entityId, null); } | /**
* Gets the DOI for the specified entity version. The DOI is for the current
* version of the entity.
*/ | Gets the DOI for the specified entity version. The DOI is for the current version of the entity | getEntityDoi | {
"repo_name": "hhu94/Synapse-Repository-Services",
"path": "client/synapseJavaClient/src/main/java/org/sagebionetworks/client/SynapseClientImpl.java",
"license": "apache-2.0",
"size": 187988
} | [
"org.sagebionetworks.client.exceptions.SynapseException",
"org.sagebionetworks.repo.model.doi.Doi"
] | import org.sagebionetworks.client.exceptions.SynapseException; import org.sagebionetworks.repo.model.doi.Doi; | import org.sagebionetworks.client.exceptions.*; import org.sagebionetworks.repo.model.doi.*; | [
"org.sagebionetworks.client",
"org.sagebionetworks.repo"
] | org.sagebionetworks.client; org.sagebionetworks.repo; | 2,608,191 |
private byte[] getMultipartDivider() throws IOException {
return (DASH_DASH + getBoundary()).getBytes(ENCODING);
} | byte[] function() throws IOException { return (DASH_DASH + getBoundary()).getBytes(ENCODING); } | /**
* Get the bytes used to separate multiparts
* Encoded using ENCODING
*
* @return the bytes used to separate multiparts
* @throws IOException
*/ | Get the bytes used to separate multiparts Encoded using ENCODING | getMultipartDivider | {
"repo_name": "d0k1/jmeter",
"path": "src/protocol/http/org/apache/jmeter/protocol/http/sampler/PostWriter.java",
"license": "apache-2.0",
"size": 19818
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 113,355 |
void patchGlobalScope(Scope globalScope, Node scriptRoot) {
// Preconditions: This is supposed to be called only on (named) SCRIPT nodes
// and a global typed scope should have been generated already.
Preconditions.checkState(scriptRoot.isScript());
Preconditions.checkNotNull(globalScope);
Preconditions.checkState(globalScope.isGlobal());
String scriptName = NodeUtil.getSourceName(scriptRoot);
Preconditions.checkNotNull(scriptName);
for (Node node : ImmutableList.copyOf(functionAnalysisResults.keySet())) {
if (scriptName.equals(NodeUtil.getSourceName(node))) {
functionAnalysisResults.remove(node);
}
}
(new FirstOrderFunctionAnalyzer(
compiler, functionAnalysisResults)).process(null, scriptRoot);
// TODO(bashir): Variable declaration is not the only side effect of last
// global scope generation but here we only wipe that part off!
// Remove all variables that were previously declared in this scripts.
// First find all vars to remove then remove them because of iterator!
Iterator<Var> varIter = globalScope.getVars();
List<Var> varsToRemove = Lists.newArrayList();
while (varIter.hasNext()) {
Var oldVar = varIter.next();
if (scriptName.equals(oldVar.getInputName())) {
varsToRemove.add(oldVar);
}
}
for (Var var : varsToRemove) {
globalScope.undeclare(var);
globalScope.getTypeOfThis().toObjectType().removeProperty(var.getName());
}
// Now re-traverse the given script.
GlobalScopeBuilder scopeBuilder = new GlobalScopeBuilder(globalScope);
NodeTraversal.traverse(compiler, scriptRoot, scopeBuilder);
} | void patchGlobalScope(Scope globalScope, Node scriptRoot) { Preconditions.checkState(scriptRoot.isScript()); Preconditions.checkNotNull(globalScope); Preconditions.checkState(globalScope.isGlobal()); String scriptName = NodeUtil.getSourceName(scriptRoot); Preconditions.checkNotNull(scriptName); for (Node node : ImmutableList.copyOf(functionAnalysisResults.keySet())) { if (scriptName.equals(NodeUtil.getSourceName(node))) { functionAnalysisResults.remove(node); } } (new FirstOrderFunctionAnalyzer( compiler, functionAnalysisResults)).process(null, scriptRoot); Iterator<Var> varIter = globalScope.getVars(); List<Var> varsToRemove = Lists.newArrayList(); while (varIter.hasNext()) { Var oldVar = varIter.next(); if (scriptName.equals(oldVar.getInputName())) { varsToRemove.add(oldVar); } } for (Var var : varsToRemove) { globalScope.undeclare(var); globalScope.getTypeOfThis().toObjectType().removeProperty(var.getName()); } GlobalScopeBuilder scopeBuilder = new GlobalScopeBuilder(globalScope); NodeTraversal.traverse(compiler, scriptRoot, scopeBuilder); } | /**
* Patches a given global scope by removing variables previously declared in
* a script and re-traversing a new version of that script.
*
* @param globalScope The global scope generated by {@code createScope}.
* @param scriptRoot The script that is modified.
*/ | Patches a given global scope by removing variables previously declared in a script and re-traversing a new version of that script | patchGlobalScope | {
"repo_name": "robbert/closure-compiler",
"path": "src/com/google/javascript/jscomp/TypedScopeCreator.java",
"license": "apache-2.0",
"size": 81522
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.ImmutableList",
"com.google.common.collect.Lists",
"com.google.javascript.jscomp.Scope",
"com.google.javascript.rhino.Node",
"java.util.Iterator",
"java.util.List"
] | import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import com.google.javascript.jscomp.Scope; import com.google.javascript.rhino.Node; import java.util.Iterator; import java.util.List; | import com.google.common.base.*; import com.google.common.collect.*; import com.google.javascript.jscomp.*; import com.google.javascript.rhino.*; import java.util.*; | [
"com.google.common",
"com.google.javascript",
"java.util"
] | com.google.common; com.google.javascript; java.util; | 2,795,666 |
public void testIgnoreMalformedParsing() throws IOException {
DocumentMapper mapper = createDocumentMapper(fieldMapping(b -> b.field("type", "geo_shape").field("ignore_malformed", true)));
Mapper fieldMapper = mapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
Explicit<Boolean> ignoreMalformed = ((GeoShapeFieldMapper)fieldMapper).ignoreMalformed();
assertThat(ignoreMalformed.value(), equalTo(true));
// explicit false ignore_malformed test
mapper = createDocumentMapper(fieldMapping(b -> b.field("type", "geo_shape").field("ignore_malformed", false)));
fieldMapper = mapper.mappers().getMapper("field");
assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class));
ignoreMalformed = ((GeoShapeFieldMapper)fieldMapper).ignoreMalformed();
assertThat(ignoreMalformed.explicit(), equalTo(true));
assertThat(ignoreMalformed.value(), equalTo(false));
} | void function() throws IOException { DocumentMapper mapper = createDocumentMapper(fieldMapping(b -> b.field("type", STR).field(STR, true))); Mapper fieldMapper = mapper.mappers().getMapper("field"); assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class)); Explicit<Boolean> ignoreMalformed = ((GeoShapeFieldMapper)fieldMapper).ignoreMalformed(); assertThat(ignoreMalformed.value(), equalTo(true)); mapper = createDocumentMapper(fieldMapping(b -> b.field("type", STR).field(STR, false))); fieldMapper = mapper.mappers().getMapper("field"); assertThat(fieldMapper, instanceOf(GeoShapeFieldMapper.class)); ignoreMalformed = ((GeoShapeFieldMapper)fieldMapper).ignoreMalformed(); assertThat(ignoreMalformed.explicit(), equalTo(true)); assertThat(ignoreMalformed.value(), equalTo(false)); } | /**
* Test that ignore_malformed parameter correctly parses
*/ | Test that ignore_malformed parameter correctly parses | testIgnoreMalformedParsing | {
"repo_name": "scorpionvicky/elasticsearch",
"path": "server/src/test/java/org/elasticsearch/index/mapper/GeoShapeFieldMapperTests.java",
"license": "apache-2.0",
"size": 13244
} | [
"java.io.IOException",
"org.elasticsearch.common.Explicit",
"org.hamcrest.Matchers"
] | import java.io.IOException; import org.elasticsearch.common.Explicit; import org.hamcrest.Matchers; | import java.io.*; import org.elasticsearch.common.*; import org.hamcrest.*; | [
"java.io",
"org.elasticsearch.common",
"org.hamcrest"
] | java.io; org.elasticsearch.common; org.hamcrest; | 1,238,493 |
@AtMostOnce
void removeCachePool(String pool) throws IOException; | void removeCachePool(String pool) throws IOException; | /**
* Remove a cache pool.
*
* @param pool name of the cache pool to remove.
* @throws IOException if the cache pool did not exist, or could not be
* removed.
*/ | Remove a cache pool | removeCachePool | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 68207
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 597,861 |
private void updateList(int id, Set<String> filters, Consumer<String> filtersRemove) {
((LinearLayout) findViewById(id)).removeAllViews();
for (String s : filters) {
final View t = getLayoutInflater().inflate(R.layout.account_textview, (LinearLayout) findViewById(id), false);
((TextView) t.findViewById(R.id.name)).setText(s);
t.findViewById(R.id.remove).setOnClickListener(v -> {
filtersRemove.accept(s);
updateFilters();
});
((LinearLayout) findViewById(id)).addView(t);
}
} | void function(int id, Set<String> filters, Consumer<String> filtersRemove) { ((LinearLayout) findViewById(id)).removeAllViews(); for (String s : filters) { final View t = getLayoutInflater().inflate(R.layout.account_textview, (LinearLayout) findViewById(id), false); ((TextView) t.findViewById(R.id.name)).setText(s); t.findViewById(R.id.remove).setOnClickListener(v -> { filtersRemove.accept(s); updateFilters(); }); ((LinearLayout) findViewById(id)).addView(t); } } | /**
* Iterate through filters and add an item for each to the layout with id, with a remove button calling filtersRemoved
*
* @param id ID of linearlayout containing items
* @param filters Set of filters to iterate through
* @param filtersRemove Method to call on remove button press
*/ | Iterate through filters and add an item for each to the layout with id, with a remove button calling filtersRemoved | updateList | {
"repo_name": "ccrama/Slide",
"path": "app/src/main/java/me/ccrama/redditslide/ui/settings/SettingsFilter.java",
"license": "gpl-3.0",
"size": 6972
} | [
"android.view.View",
"android.widget.LinearLayout",
"android.widget.TextView",
"androidx.core.util.Consumer",
"java.util.Set"
] | import android.view.View; import android.widget.LinearLayout; import android.widget.TextView; import androidx.core.util.Consumer; import java.util.Set; | import android.view.*; import android.widget.*; import androidx.core.util.*; import java.util.*; | [
"android.view",
"android.widget",
"androidx.core",
"java.util"
] | android.view; android.widget; androidx.core; java.util; | 2,261,473 |
void named(String name, Action<? super T> configAction); | void named(String name, Action<? super T> configAction); | /**
* Applies the given action to the given item, when the item is required.
*
* <p>The given action is invoked to configure the item when the item is required. It is called after any actions provided to {@link #beforeEach(org.gradle.api.Action)} and {@link #create(String,
* org.gradle.api.Action)}.
*
* @param name The name.
* @param configAction An action that configures the item. The action is executed when the item is required.
*/ | Applies the given action to the given item, when the item is required. The given action is invoked to configure the item when the item is required. It is called after any actions provided to <code>#beforeEach(org.gradle.api.Action)</code> and <code>#create(String, org.gradle.api.Action)</code> | named | {
"repo_name": "cams7/gradle-samples",
"path": "plugin/model-core/src/main/java/org/gradle/model/collection/CollectionBuilder.java",
"license": "gpl-2.0",
"size": 9013
} | [
"org.gradle.api.Action"
] | import org.gradle.api.Action; | import org.gradle.api.*; | [
"org.gradle.api"
] | org.gradle.api; | 558,992 |
EList<MLanguage> getLanguages(); | EList<MLanguage> getLanguages(); | /**
* Returns the list of languages supported by the domain. The different
* components defined within the domain can be implemented in one of this
* programming languages.
* @return the list of supported languages.
* @see es.uah.aut.srg.micobs.mclev.mclevdom.mclevdomPackage#getMIODomain_Languages()
* @model
* @generated
*/ | Returns the list of languages supported by the domain. The different components defined within the domain can be implemented in one of this programming languages | getLanguages | {
"repo_name": "parraman/micobs",
"path": "mclev/es.uah.aut.srg.micobs.mclev/src/es/uah/aut/srg/micobs/mclev/mclevdom/MIODomain.java",
"license": "epl-1.0",
"size": 4270
} | [
"es.uah.aut.srg.micobs.system.MLanguage",
"org.eclipse.emf.common.util.EList"
] | import es.uah.aut.srg.micobs.system.MLanguage; import org.eclipse.emf.common.util.EList; | import es.uah.aut.srg.micobs.system.*; import org.eclipse.emf.common.util.*; | [
"es.uah.aut",
"org.eclipse.emf"
] | es.uah.aut; org.eclipse.emf; | 1,041,985 |
public void loadLights(List<Light> lights) {
for (int i = 0; i < MAX_LIGHT_SOURCES; i++) {
if (i < lights.size()) {
super.loadVector(locationLightPosition[i], lights.get(i).getPosition());
super.loadVector(locationLightColour[i], lights.get(i).getColour());
super.loadVector(locationAttenuation[i], lights.get(i).getAttenuation());
}
// still renders empty lights
else {
super.loadVector(locationLightPosition[i], new Vector3f(0, 0, 0));
super.loadVector(locationLightColour[i], new Vector3f(0, 0, 0));
super.loadVector(locationAttenuation[i], new Vector3f(1, 0.01f, 0.002f));
}
}
}
| void function(List<Light> lights) { for (int i = 0; i < MAX_LIGHT_SOURCES; i++) { if (i < lights.size()) { super.loadVector(locationLightPosition[i], lights.get(i).getPosition()); super.loadVector(locationLightColour[i], lights.get(i).getColour()); super.loadVector(locationAttenuation[i], lights.get(i).getAttenuation()); } else { super.loadVector(locationLightPosition[i], new Vector3f(0, 0, 0)); super.loadVector(locationLightColour[i], new Vector3f(0, 0, 0)); super.loadVector(locationAttenuation[i], new Vector3f(1, 0.01f, 0.002f)); } } } | /**
* Load lights.
*
* @param lights the lights
*/ | Load lights | loadLights | {
"repo_name": "Recursively/redmf",
"path": "src/model/shaders/entity/EntityShader.java",
"license": "mit",
"size": 5953
} | [
"java.util.List",
"org.lwjgl.util.vector.Vector3f"
] | import java.util.List; import org.lwjgl.util.vector.Vector3f; | import java.util.*; import org.lwjgl.util.vector.*; | [
"java.util",
"org.lwjgl.util"
] | java.util; org.lwjgl.util; | 2,438,558 |
public void lshr() throws IOException
{
l.tshr();
} | void function() throws IOException { l.tshr(); } | /**
* Arithmetic shift right long
* <p>Stack: ..., value1, value2=>..., result
* @throws IOException
*/ | Arithmetic shift right long Stack: ..., value1, value2=>..., result | lshr | {
"repo_name": "tvesalainen/bcc",
"path": "src/main/java/org/vesalainen/bcc/Assembler.java",
"license": "gpl-3.0",
"size": 53751
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 713,280 |
Rectangle one = new Rectangle(0, 0, 4, 4);
Rectangle two = new Rectangle(2, 2, 4, 4);
assertThat(one.intersects(two)).isEqualTo(true);
assertThat(two.intersects(one)).isEqualTo(true);
} | Rectangle one = new Rectangle(0, 0, 4, 4); Rectangle two = new Rectangle(2, 2, 4, 4); assertThat(one.intersects(two)).isEqualTo(true); assertThat(two.intersects(one)).isEqualTo(true); } | /**
* <pre>
* ____
* |1 |
* | __|__
* |_|__| |
* | 2 |
* |_____|
*
* </pre>
*/ | <code> ____ |1 | | __|__ |_|__| | | 2 | |_____| </code> | intersects_topLeft$bottomRight_true | {
"repo_name": "TickleThePanda/location-history",
"path": "core/mapper/src/test/java/uk/co/ticklethepanda/carto/core/RectangleTest.java",
"license": "mit",
"size": 6750
} | [
"org.assertj.core.api.Assertions",
"uk.co.ticklethepanda.carto.core.model.Rectangle"
] | import org.assertj.core.api.Assertions; import uk.co.ticklethepanda.carto.core.model.Rectangle; | import org.assertj.core.api.*; import uk.co.ticklethepanda.carto.core.model.*; | [
"org.assertj.core",
"uk.co.ticklethepanda"
] | org.assertj.core; uk.co.ticklethepanda; | 1,829,240 |
@Nullable
public static Rational valueOf(@Nullable String value, @Nullable Locale locale) {
return valueOf(value, locale == null ? null : NumberFormat.getInstance(locale));
} | static Rational function(@Nullable String value, @Nullable Locale locale) { return valueOf(value, locale == null ? null : NumberFormat.getInstance(locale)); } | /**
* Returns an instance by parsing the specified {@link String}. The format
* must be either {@code number/number}, {@code number:number} or
* {@code number}. Signs are understood for both numerator and denominator.
* If {@code value} is blank or {@code null}, {@code null} is returned. If
* {@code value} can't be parsed, a {@link NumberFormatException} is thrown.
*
* @param value the {@link String} value to parse.
* @param locale the {@link Locale} to use when parsing numbers. If
* {@code null}, "standard formatted" numbers are expected (no
* grouping, {@code .} as decimal separator etc.).
* @return An instance that represents the value of {@code value}.
* @throws NumberFormatException If {@code value} cannot be parsed.
*/ | Returns an instance by parsing the specified <code>String</code>. The format must be either number/number, number:number or number. Signs are understood for both numerator and denominator. If value is blank or null, null is returned. If value can't be parsed, a <code>NumberFormatException</code> is thrown | valueOf | {
"repo_name": "UniversalMediaServer/UniversalMediaServer",
"path": "src/main/java/net/pms/util/Rational.java",
"license": "gpl-2.0",
"size": 72265
} | [
"java.text.NumberFormat",
"java.util.Locale",
"javax.annotation.Nullable"
] | import java.text.NumberFormat; import java.util.Locale; import javax.annotation.Nullable; | import java.text.*; import java.util.*; import javax.annotation.*; | [
"java.text",
"java.util",
"javax.annotation"
] | java.text; java.util; javax.annotation; | 1,369,408 |
private static Set<String> getRoles(User user) {
Set<String> allRoles = Sets.newHashSet();
String[] userRoles = user.getRoles();
Set<String> groupRoles = user.getGroupRoles();
if (userRoles != null && userRoles.length > 0) {
allRoles.addAll(Sets.newHashSet(userRoles));
}
if (groupRoles != null && !groupRoles.isEmpty()) {
allRoles.addAll(groupRoles);
}
return allRoles;
} | static Set<String> function(User user) { Set<String> allRoles = Sets.newHashSet(); String[] userRoles = user.getRoles(); Set<String> groupRoles = user.getGroupRoles(); if (userRoles != null && userRoles.length > 0) { allRoles.addAll(Sets.newHashSet(userRoles)); } if (groupRoles != null && !groupRoles.isEmpty()) { allRoles.addAll(groupRoles); } return allRoles; } | /**
* Return all the roles of an user (Alien 4 Cloud's roles)
*
* @param user
* @return all user's A4C roles
*/ | Return all the roles of an user (Alien 4 Cloud's roles) | getRoles | {
"repo_name": "alien4cloud/alien4cloud",
"path": "alien4cloud-security/src/main/java/alien4cloud/security/AuthorizationUtil.java",
"license": "apache-2.0",
"size": 19983
} | [
"com.google.common.collect.Sets",
"java.util.Set"
] | import com.google.common.collect.Sets; import java.util.Set; | import com.google.common.collect.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,434,515 |
protected static ArrayList<BigInteger> genC()
{
BigInteger biaa = BigInteger.valueOf( 3225 );
BigInteger biab = BigInteger.valueOf( 3237 );
BigInteger biac = BigInteger.valueOf( 3264 );
ArrayList<BigInteger> ret = new ArrayList<BigInteger>();
ret.add( biaa );
ret.add( biab );
ret.add( biac );
return( ret );
}
| static ArrayList<BigInteger> function() { BigInteger biaa = BigInteger.valueOf( 3225 ); BigInteger biab = BigInteger.valueOf( 3237 ); BigInteger biac = BigInteger.valueOf( 3264 ); ArrayList<BigInteger> ret = new ArrayList<BigInteger>(); ret.add( biaa ); ret.add( biab ); ret.add( biac ); return( ret ); } | /**
* Generates a 3-D index for use with the test.
*
* @return The 3-D index.
*/ | Generates a 3-D index for use with the test | genC | {
"repo_name": "viridian1138/SimpleAlgebra_V2",
"path": "src/test_simplealgebra/TestBaseDbArrayBasics.java",
"license": "gpl-3.0",
"size": 10314
} | [
"java.math.BigInteger",
"java.util.ArrayList"
] | import java.math.BigInteger; import java.util.ArrayList; | import java.math.*; import java.util.*; | [
"java.math",
"java.util"
] | java.math; java.util; | 2,521,065 |
public void startFlow(Flow fl) {
} | void function(Flow fl) { } | /**
* This method is called to indicate the start of a new fo:flow
* or fo:static-content.
* This method also handles fo:static-content tags, because the
* StaticContent class is derived from the Flow class.
*
* @param fl Flow that is starting.
*/ | This method is called to indicate the start of a new fo:flow or fo:static-content. This method also handles fo:static-content tags, because the StaticContent class is derived from the Flow class | startFlow | {
"repo_name": "pellcorp/fop",
"path": "src/java/org/apache/fop/fo/FOEventHandler.java",
"license": "apache-2.0",
"size": 13537
} | [
"org.apache.fop.fo.pagination.Flow"
] | import org.apache.fop.fo.pagination.Flow; | import org.apache.fop.fo.pagination.*; | [
"org.apache.fop"
] | org.apache.fop; | 1,659,955 |
@ThreadConfined(type = ThreadConfined.ThreadType.JFX)
private void promptForRebuild(AbstractFile file, BlackboardArtifact artifact) {
//if there is an existing prompt or progressdialog, just show that
if (promptDialogManager.bringCurrentDialogToFront()) {
return;
}
//if the repo is empty just (re)build it with out asking, the user can always cancel part way through
if (eventsRepository.countAllEvents() == 0) {
rebuildRepo(file, artifact);
return;
}
//if necessary prompt user with reasons to rebuild
List<String> rebuildReasons = getRebuildReasons();
if (false == rebuildReasons.isEmpty()) {
if (promptDialogManager.confirmRebuild(rebuildReasons)) {
rebuildRepo(file, artifact);
return;
}
}
rebuildTagsTable(file, artifact);
} | @ThreadConfined(type = ThreadConfined.ThreadType.JFX) void function(AbstractFile file, BlackboardArtifact artifact) { if (promptDialogManager.bringCurrentDialogToFront()) { return; } if (eventsRepository.countAllEvents() == 0) { rebuildRepo(file, artifact); return; } List<String> rebuildReasons = getRebuildReasons(); if (false == rebuildReasons.isEmpty()) { if (promptDialogManager.confirmRebuild(rebuildReasons)) { rebuildRepo(file, artifact); return; } } rebuildTagsTable(file, artifact); } | /**
* Prompt the user to confirm rebuilding the db. Checks if a database
* rebuild is necessary and includes the reasons in the prompt. If the user
* confirms, rebuilds the database. Shows the timeline window when the
* rebuild is done, or immediately if the rebuild is not confirmed.
*
* @param file The AbstractFile from which to choose an event to show in
* the List View.
* @param artifact The BlackboardArtifact to show in the List View.
*/ | Prompt the user to confirm rebuilding the db. Checks if a database rebuild is necessary and includes the reasons in the prompt. If the user confirms, rebuilds the database. Shows the timeline window when the rebuild is done, or immediately if the rebuild is not confirmed | promptForRebuild | {
"repo_name": "millmanorama/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/timeline/TimeLineController.java",
"license": "apache-2.0",
"size": 43142
} | [
"java.util.List",
"org.sleuthkit.autopsy.coreutils.ThreadConfined",
"org.sleuthkit.datamodel.AbstractFile",
"org.sleuthkit.datamodel.BlackboardArtifact"
] | import java.util.List; import org.sleuthkit.autopsy.coreutils.ThreadConfined; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.BlackboardArtifact; | import java.util.*; import org.sleuthkit.autopsy.coreutils.*; import org.sleuthkit.datamodel.*; | [
"java.util",
"org.sleuthkit.autopsy",
"org.sleuthkit.datamodel"
] | java.util; org.sleuthkit.autopsy; org.sleuthkit.datamodel; | 562,634 |
ReadRequest directCounterCells(Iterable<PiTableId> tableIds); | ReadRequest directCounterCells(Iterable<PiTableId> tableIds); | /**
* Requests to read all direct counter cells from the given tables.
*
* @param tableIds table IDs
* @return this
*/ | Requests to read all direct counter cells from the given tables | directCounterCells | {
"repo_name": "oplinkoms/onos",
"path": "protocols/p4runtime/api/src/main/java/org/onosproject/p4runtime/api/P4RuntimeReadClient.java",
"license": "apache-2.0",
"size": 8962
} | [
"org.onosproject.net.pi.model.PiTableId"
] | import org.onosproject.net.pi.model.PiTableId; | import org.onosproject.net.pi.model.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 1,269,717 |
public Observable<ServiceResponse<Page<ProfileInner>>> listByResourceGroupNextSinglePageAsync(final String nextPageLink) {
if (nextPageLink == null) {
throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null.");
} | Observable<ServiceResponse<Page<ProfileInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); } | /**
* Lists all of the CDN profiles within a resource group.
*
ServiceResponse<PageImpl<ProfileInner>> * @param nextPageLink The NextLink from the previous successful call to List operation.
* @return the PagedList<ProfileInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Lists all of the CDN profiles within a resource group | listByResourceGroupNextSinglePageAsync | {
"repo_name": "pomortaz/azure-sdk-for-java",
"path": "azure-mgmt-cdn/src/main/java/com/microsoft/azure/management/cdn/implementation/ProfilesInner.java",
"license": "mit",
"size": 82272
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 969,273 |
return AutoStartViewDefinition.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(AutoStartViewDefinition.Meta.INSTANCE);
} | return AutoStartViewDefinition.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(AutoStartViewDefinition.Meta.INSTANCE); } | /**
* The meta-bean for {@code AutoStartViewDefinition}.
* @return the meta-bean, not null
*/ | The meta-bean for AutoStartViewDefinition | meta | {
"repo_name": "ChinaQuants/OG-Platform",
"path": "projects/OG-Engine/src/main/java/com/opengamma/engine/view/impl/AutoStartViewDefinition.java",
"license": "apache-2.0",
"size": 11869
} | [
"org.joda.beans.JodaBeanUtils"
] | import org.joda.beans.JodaBeanUtils; | import org.joda.beans.*; | [
"org.joda.beans"
] | org.joda.beans; | 346,773 |
ProjectNativeComponent getComponent(); | ProjectNativeComponent getComponent(); | /**
* The component that this project represents.
*/ | The component that this project represents | getComponent | {
"repo_name": "VolitionEos/DungFactory",
"path": ".gradlew/wrapper/dists/gradle-2.0-all/7rd4e4rcg4riqi0j6j508m2lbk/gradle-2.0/src/cpp/org/gradle/ide/visualstudio/VisualStudioProject.java",
"license": "gpl-3.0",
"size": 1925
} | [
"org.gradle.nativebinaries.ProjectNativeComponent"
] | import org.gradle.nativebinaries.ProjectNativeComponent; | import org.gradle.nativebinaries.*; | [
"org.gradle.nativebinaries"
] | org.gradle.nativebinaries; | 1,209,246 |
public void setVar(String var) {
this.var = Static.trim3(getProject(), var, this.var);
} | void function(String var) { this.var = Static.trim3(getProject(), var, this.var); } | /**
* Set the var attribute. This is the name of the macrodef attribute that gets
* set for each iterator of the sequential element.
*/ | Set the var attribute. This is the name of the macrodef attribute that gets set for each iterator of the sequential element | setVar | {
"repo_name": "greg2001/ant-flaka",
"path": "src/it/haefelinger/flaka/For.java",
"license": "apache-2.0",
"size": 4262
} | [
"it.haefelinger.flaka.util.Static"
] | import it.haefelinger.flaka.util.Static; | import it.haefelinger.flaka.util.*; | [
"it.haefelinger.flaka"
] | it.haefelinger.flaka; | 2,896,333 |
@Override
public AuthenticationManager getAuthenticationManager(String connectorName)
throws ConnectorNotFoundException, InstantiatorException {
return getConnectorCoordinator(connectorName).getAuthenticationManager();
} | AuthenticationManager function(String connectorName) throws ConnectorNotFoundException, InstantiatorException { return getConnectorCoordinator(connectorName).getAuthenticationManager(); } | /**
* Returns an {@Link AuthenticationManager}.
*/ | Returns an AuthenticationManager | getAuthenticationManager | {
"repo_name": "googlegsa/manager.v3",
"path": "projects/connector-manager/source/javatests/com/google/enterprise/connector/instantiator/MockInstantiator.java",
"license": "apache-2.0",
"size": 13790
} | [
"com.google.enterprise.connector.persist.ConnectorNotFoundException",
"com.google.enterprise.connector.spi.AuthenticationManager"
] | import com.google.enterprise.connector.persist.ConnectorNotFoundException; import com.google.enterprise.connector.spi.AuthenticationManager; | import com.google.enterprise.connector.persist.*; import com.google.enterprise.connector.spi.*; | [
"com.google.enterprise"
] | com.google.enterprise; | 289,071 |
public static void generateStatementBody
(PrintWriter pw, SimpleFlowStatement stmt, TaskDeclaration task)
{
pw.println("private SinkIF nextSink;");
Vector<String> args = stmt.getArguments();
pw.println("public void init(ConfigDataIF config) throws Exception {"+
"mgr = config.getManager();"+
"nextSink = mgr.getStage(\""+args.get(0)+"\").getSink();"+
"mysink = config.getStage().getSink();"+
"}");
pw.println("public void handleEvent(QueueElementIF item) {"+
"if (item instanceof SedaWrapper) {"+
//"System.out.println(\""+task.getName()+"\");"+
"SedaWrapper sw = (SedaWrapper)item;"+
"Event e = sw.getEvent();"+
task.getName()+
"Impl in = ("+task.getName()+"Impl)e.getData();");
generateHandlerBody(pw, stmt, task);
pw.println("}");
pw.println("else { System.err.println(\"Unknown Event: \"+item); }");
pw.println("}");
pw.println("public void handleEvents(QueueElementIF items[]) {"+
"for(int i=0; i<items.length; i++) {"+
"handleEvent(items[i]);"+
"}"+
"}");
pw.println("public void destroy() {}");
} | static void function (PrintWriter pw, SimpleFlowStatement stmt, TaskDeclaration task) { pw.println(STR); Vector<String> args = stmt.getArguments(); pw.println(STR+ STR+ STRSTR\STR+ STR+ "}"); pw.println(STR+ STR+ STR+ STR+ task.getName()+ STR+task.getName()+STR); generateHandlerBody(pw, stmt, task); pw.println("}"); pw.println(STRUnknown Event: \STR); pw.println("}"); pw.println(STR+ STR+ STR+ "}"+ "}"); pw.println(STR); } | /**
* Generate a simple flow statement body
* @param pw Where to write
* @param stmt The statement to translate
* @param task The parent task definition for this statement (left-side)
**/ | Generate a simple flow statement body | generateStatementBody | {
"repo_name": "emeryberger/flux",
"path": "src/edu/umass/cs/flux/JavaSedaGenerator.java",
"license": "gpl-2.0",
"size": 15283
} | [
"java.io.PrintWriter",
"java.util.Vector"
] | import java.io.PrintWriter; import java.util.Vector; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,434,620 |
public void setForeground(Drawable drawable) {
if (mForeground != drawable) {
if (mForeground != null) {
mForeground.setCallback(null);
unscheduleDrawable(mForeground);
}
mForeground = drawable;
if (drawable != null) {
setWillNotDraw(false);
drawable.setCallback(this);
if (drawable.isStateful()) {
drawable.setState(getDrawableState());
}
if (mForegroundGravity == Gravity.FILL) {
Rect padding = new Rect();
drawable.getPadding(padding);
}
} else {
setWillNotDraw(true);
}
requestLayout();
invalidate();
}
} | void function(Drawable drawable) { if (mForeground != drawable) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = drawable; if (drawable != null) { setWillNotDraw(false); drawable.setCallback(this); if (drawable.isStateful()) { drawable.setState(getDrawableState()); } if (mForegroundGravity == Gravity.FILL) { Rect padding = new Rect(); drawable.getPadding(padding); } } else { setWillNotDraw(true); } requestLayout(); invalidate(); } } | /**
* Supply a Drawable that is to be rendered on top of all of the child
* views in the frame layout. Any padding in the Drawable will be taken
* into account by ensuring that the children are inset to be placed
* inside of the padding area.
*
* @param drawable The Drawable to be drawn on top of the children.
*/ | Supply a Drawable that is to be rendered on top of all of the child views in the frame layout. Any padding in the Drawable will be taken into account by ensuring that the children are inset to be placed inside of the padding area | setForeground | {
"repo_name": "xunboo/JJCamera",
"path": "android/src/main/java/com/jjcamera/apps/iosched/ui/widget/ForegroundLinearLayout.java",
"license": "apache-2.0",
"size": 7231
} | [
"android.graphics.Rect",
"android.graphics.drawable.Drawable",
"android.view.Gravity"
] | import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.view.Gravity; | import android.graphics.*; import android.graphics.drawable.*; import android.view.*; | [
"android.graphics",
"android.view"
] | android.graphics; android.view; | 2,847,642 |
TestCaseExecutionInQueue findByKey(long id) throws CerberusException; | TestCaseExecutionInQueue findByKey(long id) throws CerberusException; | /**
* Fing a {@link TestCaseExecutionInQueue} record from the database knowing the key
* @param id
* @return
* @throws CerberusException
*/ | Fing a <code>TestCaseExecutionInQueue</code> record from the database knowing the key | findByKey | {
"repo_name": "afnogueira/Cerberus",
"path": "source/src/main/java/org/cerberus/dao/ITestCaseExecutionInQueueDAO.java",
"license": "gpl-3.0",
"size": 3870
} | [
"org.cerberus.entity.TestCaseExecutionInQueue",
"org.cerberus.exception.CerberusException"
] | import org.cerberus.entity.TestCaseExecutionInQueue; import org.cerberus.exception.CerberusException; | import org.cerberus.entity.*; import org.cerberus.exception.*; | [
"org.cerberus.entity",
"org.cerberus.exception"
] | org.cerberus.entity; org.cerberus.exception; | 14,030 |
public double getDomainUpperBound(boolean includeInterval) {
double result = Double.NaN;
Range r = getDomainBounds(includeInterval);
if (r != null) {
result = r.getUpperBound();
}
return result;
}
| double function(boolean includeInterval) { double result = Double.NaN; Range r = getDomainBounds(includeInterval); if (r != null) { result = r.getUpperBound(); } return result; } | /**
* Returns the maximum x-value in the dataset.
*
* @param includeInterval a flag that determines whether or not the
* x-interval is taken into account.
*
* @return The maximum value.
*/ | Returns the maximum x-value in the dataset | getDomainUpperBound | {
"repo_name": "Mr-Steve/LTSpice_Library_Manager",
"path": "libs/jfreechart-1.0.16/source/org/jfree/data/time/TimePeriodValuesCollection.java",
"license": "gpl-2.0",
"size": 16612
} | [
"org.jfree.data.Range"
] | import org.jfree.data.Range; | import org.jfree.data.*; | [
"org.jfree.data"
] | org.jfree.data; | 1,775,116 |
public void onCombineSetup() throws IOException, InterruptedException {
// no-op
} | void function() throws IOException, InterruptedException { } | /**
* Invoked on the named stage.
*/ | Invoked on the named stage | onCombineSetup | {
"repo_name": "tkpanther/ignite",
"path": "modules/hadoop/src/test/java/org/apache/ignite/internal/processors/hadoop/HadoopErrorSimulator.java",
"license": "apache-2.0",
"size": 8627
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,635,015 |
public static boolean arraySearch(Object[] search, String methodName, Object key) {
boolean found = false;
for (int i = 0; i < search.length; i++) {
Object value = MethodUtil.callMethod(search[i], methodName, new Object[0]);
if (value.equals(key)) {
found = true;
}
}
return found;
} | static boolean function(Object[] search, String methodName, Object key) { boolean found = false; for (int i = 0; i < search.length; i++) { Object value = MethodUtil.callMethod(search[i], methodName, new Object[0]); if (value.equals(key)) { found = true; } } return found; } | /**
* Search an array by calling the passsed in method name with the key as the checker
* @param search array
* @param methodName to call on each object in the array (can be toString())
* @param key to compare to
* @return boolean if found or not
*/ | Search an array by calling the passsed in method name with the key as the checker | arraySearch | {
"repo_name": "colloquium/spacewalk",
"path": "java/code/src/com/redhat/rhn/testing/TestUtils.java",
"license": "gpl-2.0",
"size": 17925
} | [
"com.redhat.rhn.common.util.MethodUtil"
] | import com.redhat.rhn.common.util.MethodUtil; | import com.redhat.rhn.common.util.*; | [
"com.redhat.rhn"
] | com.redhat.rhn; | 201,483 |
public static BundleContext getContext() {
return context;
} | static BundleContext function() { return context; } | /**
* Returns the bundle context of this bundle
*
* @return the bundle context
*/ | Returns the bundle context of this bundle | getContext | {
"repo_name": "openhab/openhab",
"path": "bundles/action/org.openhab.action.astro/src/main/java/org/openhab/action/astro/internal/AstroActivator.java",
"license": "epl-1.0",
"size": 1515
} | [
"org.osgi.framework.BundleContext"
] | import org.osgi.framework.BundleContext; | import org.osgi.framework.*; | [
"org.osgi.framework"
] | org.osgi.framework; | 2,229,363 |
private void parseMessage(ModuleDescriptionMessage descriptionMsg) {
// get descriptions from ModuleDescriptionMessage
List<Category> categories = descriptionMsg.getCategories();
logger.debug("generating operations from " + categories.size() + " categories");
ToolModule module = new ToolModule(descriptionMsg.getModuleName());
// create categories
for (Category category : categories) {
ToolCategory toolCategory = new ToolCategory(category.getName());
toolCategory.setColor(category.getColor());
toolCategory.setModule(module);
if (category.isHidden()) {
module.addHiddenToolCategory(toolCategory);
} else {
module.addVisibleToolCategory(toolCategory);
}
logger.debug("added category " + toolCategory.getName());
// create operation definitions for tools in this category
for (Tool tool : category.getTools()) {
try {
// parse
SADLDescription sadl = new ChipsterSADLParser().parse(tool.getDescription());
// create definition (also has the side effect of adding the new tool to the category, argh..)
OperationDefinition newDefinition = new OperationDefinition(sadl.getName().getID(),
sadl.getName().getDisplayName(), toolCategory,
sadl.getDescription(), true,
tool.getHelpURL());
for (Input input : sadl.getInputs()) {
if (input.getName().isNameSet()) {
newDefinition.addInput(input.getName().getPrefix(), input.getName().getPostfix(), input.getName().getDisplayName(), input.getDescription(), input.getType(), input.isOptional());
} else {
newDefinition.addInput(input.getName(), input.getDescription(), input.getType(), input.isOptional());
}
}
newDefinition.setOutputCount(sadl.getOutputs().size());
for (Parameter parameter : sadl.getParameters()) {
newDefinition.addParameter(fi.csc.microarray.client.
operation.parameter.Parameter.createInstance(
parameter.getName(), parameter.getType(), parameter.getSelectionOptions(),
parameter.getDescription(), parameter.getFrom(), parameter.getTo(),
parameter.getDefaultValues(), parameter.isOptional()));
}
} catch (Exception e) {
logger.warn("parsing tool failed", e);
this.parseErrors += "\n" + Exceptions.getStackTrace(e);
}
}
}
modules.put(module.getModuleName(), module);
} | void function(ModuleDescriptionMessage descriptionMsg) { List<Category> categories = descriptionMsg.getCategories(); logger.debug(STR + categories.size() + STR); ToolModule module = new ToolModule(descriptionMsg.getModuleName()); for (Category category : categories) { ToolCategory toolCategory = new ToolCategory(category.getName()); toolCategory.setColor(category.getColor()); toolCategory.setModule(module); if (category.isHidden()) { module.addHiddenToolCategory(toolCategory); } else { module.addVisibleToolCategory(toolCategory); } logger.debug(STR + toolCategory.getName()); for (Tool tool : category.getTools()) { try { SADLDescription sadl = new ChipsterSADLParser().parse(tool.getDescription()); OperationDefinition newDefinition = new OperationDefinition(sadl.getName().getID(), sadl.getName().getDisplayName(), toolCategory, sadl.getDescription(), true, tool.getHelpURL()); for (Input input : sadl.getInputs()) { if (input.getName().isNameSet()) { newDefinition.addInput(input.getName().getPrefix(), input.getName().getPostfix(), input.getName().getDisplayName(), input.getDescription(), input.getType(), input.isOptional()); } else { newDefinition.addInput(input.getName(), input.getDescription(), input.getType(), input.isOptional()); } } newDefinition.setOutputCount(sadl.getOutputs().size()); for (Parameter parameter : sadl.getParameters()) { newDefinition.addParameter(fi.csc.microarray.client. operation.parameter.Parameter.createInstance( parameter.getName(), parameter.getType(), parameter.getSelectionOptions(), parameter.getDescription(), parameter.getFrom(), parameter.getTo(), parameter.getDefaultValues(), parameter.isOptional())); } } catch (Exception e) { logger.warn(STR, e); this.parseErrors += "\n" + Exceptions.getStackTrace(e); } } } modules.put(module.getModuleName(), module); } | /**
* Prepare operation category lists.
*
* @param descriptionMsg
* @throws ParseException
*/ | Prepare operation category lists | parseMessage | {
"repo_name": "ilarischeinin/chipster",
"path": "src/main/java/fi/csc/microarray/messaging/DescriptionMessageListener.java",
"license": "gpl-3.0",
"size": 6380
} | [
"fi.csc.microarray.client.operation.OperationDefinition",
"fi.csc.microarray.client.operation.ToolCategory",
"fi.csc.microarray.client.operation.ToolModule",
"fi.csc.microarray.description.SADLDescription",
"fi.csc.microarray.messaging.message.ModuleDescriptionMessage",
"fi.csc.microarray.module.chipster.ChipsterSADLParser",
"fi.csc.microarray.util.Exceptions",
"java.util.List"
] | import fi.csc.microarray.client.operation.OperationDefinition; import fi.csc.microarray.client.operation.ToolCategory; import fi.csc.microarray.client.operation.ToolModule; import fi.csc.microarray.description.SADLDescription; import fi.csc.microarray.messaging.message.ModuleDescriptionMessage; import fi.csc.microarray.module.chipster.ChipsterSADLParser; import fi.csc.microarray.util.Exceptions; import java.util.List; | import fi.csc.microarray.client.operation.*; import fi.csc.microarray.description.*; import fi.csc.microarray.messaging.message.*; import fi.csc.microarray.module.chipster.*; import fi.csc.microarray.util.*; import java.util.*; | [
"fi.csc.microarray",
"java.util"
] | fi.csc.microarray; java.util; | 599,065 |
assert action >= 0;
assert action < NUM_ACTIONS;
String histogramName;
if (params.isVideo()) {
histogramName = "ContextMenu.SelectedOption.Video";
} else if (params.isImage()) {
histogramName = params.isAnchor()
? "ContextMenu.SelectedOption.ImageLink"
: "ContextMenu.SelectedOption.Image";
} else {
assert params.isAnchor();
histogramName = "ContextMenu.SelectedOption.Link";
}
RecordHistogram.recordEnumeratedHistogram(histogramName, action, NUM_ACTIONS);
} | assert action >= 0; assert action < NUM_ACTIONS; String histogramName; if (params.isVideo()) { histogramName = STR; } else if (params.isImage()) { histogramName = params.isAnchor() ? STR : STR; } else { assert params.isAnchor(); histogramName = STR; } RecordHistogram.recordEnumeratedHistogram(histogramName, action, NUM_ACTIONS); } | /**
* Records a histogram entry when the user selects an item from a context menu.
* @param params The ContextMenuParams describing the current context menu.
* @param action The action that the user selected (e.g. ACTION_SAVE_IMAGE).
*/ | Records a histogram entry when the user selects an item from a context menu | record | {
"repo_name": "was4444/chromium.src",
"path": "chrome/android/java/src/org/chromium/chrome/browser/contextmenu/ChromeContextMenuPopulator.java",
"license": "bsd-3-clause",
"size": 19571
} | [
"org.chromium.base.metrics.RecordHistogram"
] | import org.chromium.base.metrics.RecordHistogram; | import org.chromium.base.metrics.*; | [
"org.chromium.base"
] | org.chromium.base; | 93,278 |
public void finalizeCreation(Product oldProduct) {
if (oldProduct != null) {
finalizeCreationWithOldProduct(oldProduct);
} else {
if (getProductMetaData() != null && getProductMetaData().getTimeCoverage() != null) {
Interval timeCoverage = getProductMetaData().getTimeCoverage();
ReadableInstant today = DateTime.now(DateTimeZone.UTC).withTimeAtStartOfDay();
if (timeCoverage.getEnd().isBefore(today)) {
getProductMetaData().setLastUpdate(DateUtils.dateTimeToString(timeCoverage.getEnd(), DateUtils.DATETIME_T_PATTERN));
} else if (getProductMetaData().getLastUpdateTds() != null) {
DateTime dateTime = DateUtils.parseDateTime(getProductMetaData().getLastUpdateTds());
if (dateTime != null && dateTime.isBefore(today)) {
// Display TDS last update value
getProductMetaData().setLastUpdate(getProductMetaData().getLastUpdateTds());
}
} // else keep default at "Not Available"
}
}
} | void function(Product oldProduct) { if (oldProduct != null) { finalizeCreationWithOldProduct(oldProduct); } else { if (getProductMetaData() != null && getProductMetaData().getTimeCoverage() != null) { Interval timeCoverage = getProductMetaData().getTimeCoverage(); ReadableInstant today = DateTime.now(DateTimeZone.UTC).withTimeAtStartOfDay(); if (timeCoverage.getEnd().isBefore(today)) { getProductMetaData().setLastUpdate(DateUtils.dateTimeToString(timeCoverage.getEnd(), DateUtils.DATETIME_T_PATTERN)); } else if (getProductMetaData().getLastUpdateTds() != null) { DateTime dateTime = DateUtils.parseDateTime(getProductMetaData().getLastUpdateTds()); if (dateTime != null && dateTime.isBefore(today)) { getProductMetaData().setLastUpdate(getProductMetaData().getLastUpdateTds()); } } } } } | /**
* Some post computing on the fields once fully created for the first time, or with previous Product
* version.
*/ | Some post computing on the fields once fully created for the first time, or with previous Product version | finalizeCreation | {
"repo_name": "clstoulouse/motu",
"path": "motu-web/src/main/java/fr/cls/atoll/motu/web/dal/request/netcdf/data/Product.java",
"license": "lgpl-3.0",
"size": 46814
} | [
"fr.cls.atoll.motu.web.common.utils.DateUtils",
"org.joda.time.DateTime",
"org.joda.time.DateTimeZone",
"org.joda.time.Interval",
"org.joda.time.ReadableInstant"
] | import fr.cls.atoll.motu.web.common.utils.DateUtils; import org.joda.time.DateTime; import org.joda.time.DateTimeZone; import org.joda.time.Interval; import org.joda.time.ReadableInstant; | import fr.cls.atoll.motu.web.common.utils.*; import org.joda.time.*; | [
"fr.cls.atoll",
"org.joda.time"
] | fr.cls.atoll; org.joda.time; | 2,178,176 |
@Override
public boolean handle(@NotNull final QueryJCommand parameters)
throws QueryJBuildException
{
final boolean result;
@NotNull final MetadataManager t_MetadataManager =
retrieveMetadataManager(parameters);
buildTemplates(
parameters,
t_MetadataManager,
retrieveTemplateFactory());
result = false;
return result;
} | boolean function(@NotNull final QueryJCommand parameters) throws QueryJBuildException { final boolean result; @NotNull final MetadataManager t_MetadataManager = retrieveMetadataManager(parameters); buildTemplates( parameters, t_MetadataManager, retrieveTemplateFactory()); result = false; return result; } | /**
* Handles given information.
* @param parameters the parameters.
* @return {@code true} if the chain should be stopped.
*/ | Handles given information | handle | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-core/src/main/java/org/acmsl/queryj/api/handlers/BasePerForeignKeyTemplateBuildHandler.java",
"license": "gpl-2.0",
"size": 9737
} | [
"org.acmsl.queryj.QueryJCommand",
"org.acmsl.queryj.api.exceptions.QueryJBuildException",
"org.acmsl.queryj.metadata.MetadataManager",
"org.jetbrains.annotations.NotNull"
] | import org.acmsl.queryj.QueryJCommand; import org.acmsl.queryj.api.exceptions.QueryJBuildException; import org.acmsl.queryj.metadata.MetadataManager; import org.jetbrains.annotations.NotNull; | import org.acmsl.queryj.*; import org.acmsl.queryj.api.exceptions.*; import org.acmsl.queryj.metadata.*; import org.jetbrains.annotations.*; | [
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | org.acmsl.queryj; org.jetbrains.annotations; | 1,391,244 |
protected CommandProcessor createCommandProcessor(OctetString engineID) {
CommandProcessor cp = new KaazingCommandProcessor(engineID);
return cp;
} | CommandProcessor function(OctetString engineID) { CommandProcessor cp = new KaazingCommandProcessor(engineID); return cp; } | /**
* Creates the command processor. We implement our own so that we can provide new PDUs and still invoke some of the
* default CommandProcessor methods.
*
* @param engineID the engine ID of the agent.
* @return a new CommandProcessor instance.
*/ | Creates the command processor. We implement our own so that we can provide new PDUs and still invoke some of the default CommandProcessor methods | createCommandProcessor | {
"repo_name": "EArdeleanu/gateway",
"path": "management/src/main/java/org/kaazing/gateway/management/snmp/SnmpManagementServiceHandler.java",
"license": "apache-2.0",
"size": 128455
} | [
"org.snmp4j.agent.CommandProcessor",
"org.snmp4j.smi.OctetString"
] | import org.snmp4j.agent.CommandProcessor; import org.snmp4j.smi.OctetString; | import org.snmp4j.agent.*; import org.snmp4j.smi.*; | [
"org.snmp4j.agent",
"org.snmp4j.smi"
] | org.snmp4j.agent; org.snmp4j.smi; | 2,094,227 |
protected final void visitTokenHook(DetailAST ast) {
if (switchBlockAsSingleDecisionPoint) {
if (ast.getType() != TokenTypes.LITERAL_CASE) {
incrementCurrentValue(BigInteger.ONE);
}
}
else if (ast.getType() != TokenTypes.LITERAL_SWITCH) {
incrementCurrentValue(BigInteger.ONE);
}
} | final void function(DetailAST ast) { if (switchBlockAsSingleDecisionPoint) { if (ast.getType() != TokenTypes.LITERAL_CASE) { incrementCurrentValue(BigInteger.ONE); } } else if (ast.getType() != TokenTypes.LITERAL_SWITCH) { incrementCurrentValue(BigInteger.ONE); } } | /**
* Hook called when visiting a token. Will not be called the method
* definition tokens.
*
* @param ast the token being visited
*/ | Hook called when visiting a token. Will not be called the method definition tokens | visitTokenHook | {
"repo_name": "Bhavik3/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/metrics/CyclomaticComplexityCheck.java",
"license": "lgpl-2.1",
"size": 7614
} | [
"com.puppycrawl.tools.checkstyle.api.DetailAST",
"com.puppycrawl.tools.checkstyle.api.TokenTypes",
"java.math.BigInteger"
] | import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.math.BigInteger; | import com.puppycrawl.tools.checkstyle.api.*; import java.math.*; | [
"com.puppycrawl.tools",
"java.math"
] | com.puppycrawl.tools; java.math; | 1,956,098 |
private void updateAppLinkData(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) // F743-26072
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "updateAppLinkData: " + j2eeName + ", add=" + add);
int numBeans;
synchronized (linkData)
{
linkData.ivNumBeans += add ? 1 : -1;
numBeans = linkData.ivNumBeans;
// Update the table of bean names for this application, in support
// of ejb-link. d429866.1
updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, "ivBeansByName");
// Update the table of bean interfaces for this application, in support
// of auto-link. d429866.2
updateAutoLink(linkData, add, j2eeName, bmd);
// F743-25385CodRv d648723
// Update the table of logical-to-physical module names, in support of
// ejb-link.
// F743-26072 - This will redundantly add the same entry for every
// bean in the module, but it will remove the entry for the first bean
// to be removed. In other words, we do not support removing a single
// bean from a module.
updateAppLinkDataTable(linkData.ivModulesByLogicalName, add,
bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), "ivModulesByLogicalName");
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "updateAppLinkData: " + j2eeName + ", add=" + add + ", numBeans=" + numBeans);
} | void function(AppLinkData linkData, boolean add, J2EEName j2eeName, BeanMetaData bmd) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); if (isTraceOn && tc.isEntryEnabled()) Tr.entry(tc, STR + j2eeName + STR + add); int numBeans; synchronized (linkData) { linkData.ivNumBeans += add ? 1 : -1; numBeans = linkData.ivNumBeans; updateAppLinkDataTable(linkData.ivBeansByName, add, j2eeName.getComponent(), j2eeName, STR); updateAutoLink(linkData, add, j2eeName, bmd); updateAppLinkDataTable(linkData.ivModulesByLogicalName, add, bmd._moduleMetaData.ivLogicalName, j2eeName.getModule(), STR); } if (isTraceOn && tc.isEntryEnabled()) Tr.exit(tc, STR + j2eeName + STR + add + STR + numBeans); } | /**
* Updates the EJB-link and auto-link data for a bean.
*
* @param linkData
* @param add <tt>true</tt> if data for the bean should be added, or
* <tt>false</tt> if data should be removed
* @param bmd
*/ | Updates the EJB-link and auto-link data for a bean | updateAppLinkData | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.core/src/com/ibm/ejs/container/HomeOfHomes.java",
"license": "epl-1.0",
"size": 66288
} | [
"com.ibm.websphere.csi.J2EEName",
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent"
] | import com.ibm.websphere.csi.J2EEName; import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; | import com.ibm.websphere.csi.*; import com.ibm.websphere.ras.*; | [
"com.ibm.websphere"
] | com.ibm.websphere; | 1,732,645 |
public void updateTask()
{
--this.playTime;
if (this.targetVillager != null)
{
if (this.villagerObj.getDistanceSqToEntity(this.targetVillager) > 4.0D)
{
this.villagerObj.getNavigator().tryMoveToEntityLiving(this.targetVillager, this.field_75261_c);
}
}
else if (this.villagerObj.getNavigator().noPath())
{
Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3);
if (var1 == null)
{
return;
}
this.villagerObj.getNavigator().tryMoveToXYZ(var1.xCoord, var1.yCoord, var1.zCoord, this.field_75261_c);
}
} | void function() { --this.playTime; if (this.targetVillager != null) { if (this.villagerObj.getDistanceSqToEntity(this.targetVillager) > 4.0D) { this.villagerObj.getNavigator().tryMoveToEntityLiving(this.targetVillager, this.field_75261_c); } } else if (this.villagerObj.getNavigator().noPath()) { Vec3 var1 = RandomPositionGenerator.findRandomTarget(this.villagerObj, 16, 3); if (var1 == null) { return; } this.villagerObj.getNavigator().tryMoveToXYZ(var1.xCoord, var1.yCoord, var1.zCoord, this.field_75261_c); } } | /**
* Updates the task
*/ | Updates the task | updateTask | {
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/entity/ai/EntityAIPlay.java",
"license": "gpl-3.0",
"size": 3506
} | [
"net.minecraft.Server1_7_10"
] | import net.minecraft.Server1_7_10; | import net.minecraft.*; | [
"net.minecraft"
] | net.minecraft; | 726,980 |
public final String dumpConfiguration() {
if (this.properties.isEmpty())
return "No configuration settings stored";
StringBuilder response = new StringBuilder("TSD Configuration:\n");
response.append("File [" + this.config_location + "]\n");
int line = 0;
for (Map.Entry<String, String> entry : this.properties.entrySet()) {
if (line > 0) {
response.append("\n");
}
response.append("Key [" + entry.getKey() + "] Value [");
if (entry.getKey().toUpperCase().contains("PASS")) {
response.append("********");
} else {
response.append(entry.getValue());
}
response.append("]");
line++;
}
return response.toString();
} | final String function() { if (this.properties.isEmpty()) return STR; StringBuilder response = new StringBuilder(STR); response.append(STR + this.config_location + "]\n"); int line = 0; for (Map.Entry<String, String> entry : this.properties.entrySet()) { if (line > 0) { response.append("\n"); } response.append(STR + entry.getKey() + STR); if (entry.getKey().toUpperCase().contains("PASS")) { response.append(STR); } else { response.append(entry.getValue()); } response.append("]"); line++; } return response.toString(); } | /**
* Returns a simple string with the configured properties for debugging
* @return A string with information about the config
*/ | Returns a simple string with the configured properties for debugging | dumpConfiguration | {
"repo_name": "pepperdata/opentsdb-deprecated",
"path": "src/utils/Config.java",
"license": "gpl-3.0",
"size": 20577
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,672,618 |
public void addUserToServer(User user) throws Exception {
boolean isNew = true;
Index.Builder builder = new Index.Builder(user).index(ServerCommandManager.INDEX).type(ServerCommandManager.USER_TYPE);
if (user.getUserID() != null && !user.getUserID().isEmpty()){
builder.id(user.getUserID());
isNew = false;
}
Index index = builder.build();
DocumentResult result = ServerCommandManager.getClient().execute(index);
if (result.isSucceeded() && isNew) {
user.setUserID(result.getId());
saveLocal();
} else if (result.isSucceeded()) {
saveLocal();
} else {
Exception e = new Exception("Failed to add User to ES");
Log.d("---- USER ----"," Failed to add user with name " + user.getName() + " to server. Caught " + e);
throw e;
}
} | void function(User user) throws Exception { boolean isNew = true; Index.Builder builder = new Index.Builder(user).index(ServerCommandManager.INDEX).type(ServerCommandManager.USER_TYPE); if (user.getUserID() != null && !user.getUserID().isEmpty()){ builder.id(user.getUserID()); isNew = false; } Index index = builder.build(); DocumentResult result = ServerCommandManager.getClient().execute(index); if (result.isSucceeded() && isNew) { user.setUserID(result.getId()); saveLocal(); } else if (result.isSucceeded()) { saveLocal(); } else { Exception e = new Exception(STR); Log.d(STR,STR + user.getName() + STR + e); throw e; } } | /**
* Add the user to the server for the first time when they install the application
*
* @param user the user to be added to storage
* @see User
* @see ServerCommandManager
*/ | Add the user to the server for the first time when they install the application | addUserToServer | {
"repo_name": "CMPUT301F17T07/inGroove",
"path": "inGroove/app/src/main/java/com/cmput301f17t07/ingroove/DataManagers/DataManager.java",
"license": "mit",
"size": 23858
} | [
"android.util.Log",
"com.cmput301f17t07.ingroove.DataManagers",
"com.cmput301f17t07.ingroove.Model",
"io.searchbox.core.DocumentResult",
"io.searchbox.core.Index"
] | import android.util.Log; import com.cmput301f17t07.ingroove.DataManagers; import com.cmput301f17t07.ingroove.Model; import io.searchbox.core.DocumentResult; import io.searchbox.core.Index; | import android.util.*; import com.cmput301f17t07.ingroove.*; import io.searchbox.core.*; | [
"android.util",
"com.cmput301f17t07.ingroove",
"io.searchbox.core"
] | android.util; com.cmput301f17t07.ingroove; io.searchbox.core; | 1,578,183 |
HibernateServiceRegistryFactory factory = new
HibernateServiceRegistryFactory();
ServiceRegistry serviceRegistry = factory.provide();
Dialect d = new MetadataSources(serviceRegistry)
.buildMetadata().getDatabase().getDialect();
Assert.assertTrue(d instanceof H2Dialect);
// This shouldn't actually do anything, but is included here for
// coverage.
factory.dispose(serviceRegistry);
} | HibernateServiceRegistryFactory factory = new HibernateServiceRegistryFactory(); ServiceRegistry serviceRegistry = factory.provide(); Dialect d = new MetadataSources(serviceRegistry) .buildMetadata().getDatabase().getDialect(); Assert.assertTrue(d instanceof H2Dialect); factory.dispose(serviceRegistry); } | /**
* Test provide and dispose.
*/ | Test provide and dispose | testProvideDispose | {
"repo_name": "krotscheck/jersey2-toolkit",
"path": "jersey2-hibernate/src/test/java/net/krotscheck/jersey2/hibernate/factory/HibernateServiceRegistryFactoryTest.java",
"license": "apache-2.0",
"size": 3271
} | [
"org.hibernate.boot.MetadataSources",
"org.hibernate.dialect.Dialect",
"org.hibernate.dialect.H2Dialect",
"org.hibernate.service.ServiceRegistry",
"org.junit.Assert"
] | import org.hibernate.boot.MetadataSources; import org.hibernate.dialect.Dialect; import org.hibernate.dialect.H2Dialect; import org.hibernate.service.ServiceRegistry; import org.junit.Assert; | import org.hibernate.boot.*; import org.hibernate.dialect.*; import org.hibernate.service.*; import org.junit.*; | [
"org.hibernate.boot",
"org.hibernate.dialect",
"org.hibernate.service",
"org.junit"
] | org.hibernate.boot; org.hibernate.dialect; org.hibernate.service; org.junit; | 1,158,294 |
public Date getModifiedAt() {
return getPropertyAsDate(FIELD_MODIFIED_AT);
} | Date function() { return getPropertyAsDate(FIELD_MODIFIED_AT); } | /**
* Gets the date that the collaborator was modified.
*
* @return the date that the collaborator was modified.
*/ | Gets the date that the collaborator was modified | getModifiedAt | {
"repo_name": "seema-at-box/box-android-sdk",
"path": "box-content-sdk/src/main/java/com/box/androidsdk/content/models/BoxCollaborator.java",
"license": "apache-2.0",
"size": 1639
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 448,009 |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.