method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public void setError403View(String error403View) {
errorViewMapping.put(403, error403View);
}
private Map<Integer, String> errorViewMapping = new HashMap<Integer, String>();
| void function(String error403View) { errorViewMapping.put(403, error403View); } private Map<Integer, String> errorViewMapping = new HashMap<Integer, String>(); | /**
* Set error 403 view.
* @param error403View the error 403 view
*/ | Set error 403 view | setError403View | {
"repo_name": "zhengjiabin/domeke",
"path": "core/src/main/java/com/jfinal/config/Constants.java",
"license": "apache-2.0",
"size": 9963
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 891,350 |
private Map<String, TestCase> getTestCases(String fileName, String[] classPath) {
// JUnitTestReader parser = new JUnitTestReader(classPath, new String[0]);
Map<String, TestCase> tests = new HashMap<String, TestCase>();
// TODO:
// tests.putAll(parser.readTests(fileName));
if (tests.isEmpty()) {
System.err.println("Found no parsable test cases in file " + fileName);
System.exit(1);
}
return tests;
} | Map<String, TestCase> function(String fileName, String[] classPath) { Map<String, TestCase> tests = new HashMap<String, TestCase>(); if (tests.isEmpty()) { System.err.println(STR + fileName); System.exit(1); } return tests; } | /**
* Parse all the tests in the given file
*
* @param fileName
* @return
*/ | Parse all the tests in the given file | getTestCases | {
"repo_name": "sefaakca/EvoSuite-Sefa",
"path": "removed/replace/TestCaseReplacer.java",
"license": "lgpl-3.0",
"size": 5854
} | [
"java.util.HashMap",
"java.util.Map",
"org.evosuite.testcase.TestCase"
] | import java.util.HashMap; import java.util.Map; import org.evosuite.testcase.TestCase; | import java.util.*; import org.evosuite.testcase.*; | [
"java.util",
"org.evosuite.testcase"
] | java.util; org.evosuite.testcase; | 1,549,176 |
public static Filter in(String field, Object... values) {
return new InFilter(field, values);
} | static Filter function(String field, Object... values) { return new InFilter(field, values); } | /**
* Creates an in filter which matches the documents where
* the value of a field equals any value in the specified array.
*
* [[app-listing]]
* [source,java]
* .Example
* --
* // matches all documents where 'age' field has value in [20, 30, 40]
* collection.find(in("age", 20, 30, 40));
* --
*
* @param field the value
* @param values the range values
* @return the in filter
*/ | Creates an in filter which matches the documents where the value of a field equals any value in the specified array. [[app-listing]] [source,java] .Example -- matches all documents where 'age' field has value in [20, 30, 40] collection.find(in("age", 20, 30, 40)); -- | in | {
"repo_name": "dizitart/nitrite-database",
"path": "nitrite/src/main/java/org/dizitart/no2/filters/Filters.java",
"license": "apache-2.0",
"size": 8875
} | [
"org.dizitart.no2.Filter"
] | import org.dizitart.no2.Filter; | import org.dizitart.no2.*; | [
"org.dizitart.no2"
] | org.dizitart.no2; | 926,025 |
private void serializeMessages(ObjectOutputStream out)
throws IOException {
// Step 1.
final int len = msgPatterns.size();
out.writeInt(len);
// Step 2.
for (int i = 0; i < len; i++) {
final Localizable pat = msgPatterns.get(i);
// Step 3.
out.writeObject(pat);
final Object[] args = msgArguments.get(i);
final int aLen = args.length;
// Step 4.
out.writeInt(aLen);
for (int j = 0; j < aLen; j++) {
if (args[j] instanceof Serializable) {
// Step 5a.
out.writeObject(args[j]);
} else {
// Step 5b.
out.writeObject(nonSerializableReplacement(args[j]));
}
}
}
} | void function(ObjectOutputStream out) throws IOException { final int len = msgPatterns.size(); out.writeInt(len); for (int i = 0; i < len; i++) { final Localizable pat = msgPatterns.get(i); out.writeObject(pat); final Object[] args = msgArguments.get(i); final int aLen = args.length; out.writeInt(aLen); for (int j = 0; j < aLen; j++) { if (args[j] instanceof Serializable) { out.writeObject(args[j]); } else { out.writeObject(nonSerializableReplacement(args[j])); } } } } | /**
* Serialize {@link #msgPatterns} and {@link #msgArguments}.
*
* @param out Stream.
* @throws IOException This should never happen.
*/ | Serialize <code>#msgPatterns</code> and <code>#msgArguments</code> | serializeMessages | {
"repo_name": "venkateshamurthy/java-quantiles",
"path": "src/main/java/org/apache/commons/math3/exception/util/ExceptionContext.java",
"license": "apache-2.0",
"size": 10569
} | [
"java.io.IOException",
"java.io.ObjectOutputStream",
"java.io.Serializable"
] | import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; | import java.io.*; | [
"java.io"
] | java.io; | 621,170 |
public DsAPI getDigitalSTROMAPI(); | DsAPI function(); | /**
* Returns the {@link DsAPI} to execute commands on the digitalSTROM-Server.
*
* @return the DsAPI
*/ | Returns the <code>DsAPI</code> to execute commands on the digitalSTROM-Server | getDigitalSTROMAPI | {
"repo_name": "chaton78/smarthome",
"path": "extensions/binding/org.eclipse.smarthome.binding.digitalstrom/src/main/java/org/eclipse/smarthome/binding/digitalstrom/internal/lib/manager/ConnectionManager.java",
"license": "epl-1.0",
"size": 3664
} | [
"org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.DsAPI"
] | import org.eclipse.smarthome.binding.digitalstrom.internal.lib.serverConnection.DsAPI; | import org.eclipse.smarthome.binding.digitalstrom.internal.lib.*; | [
"org.eclipse.smarthome"
] | org.eclipse.smarthome; | 754,821 |
public void copyFrom(InputStream in) throws IOException, InterruptedException {
OutputStream os = write();
try {
IOUtils.copy(in, os);
} finally {
os.close();
}
} | void function(InputStream in) throws IOException, InterruptedException { OutputStream os = write(); try { IOUtils.copy(in, os); } finally { os.close(); } } | /**
* Replaces the content of this file by the data from the given {@link InputStream}.
*
* @since 1.293
*/ | Replaces the content of this file by the data from the given <code>InputStream</code> | copyFrom | {
"repo_name": "sumitk1/jenkins",
"path": "core/src/main/java/hudson/FilePath.java",
"license": "mit",
"size": 75848
} | [
"hudson.util.IOUtils",
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
] | import hudson.util.IOUtils; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; | import hudson.util.*; import java.io.*; | [
"hudson.util",
"java.io"
] | hudson.util; java.io; | 104,098 |
private void setParameters(Long[] parameters) {
if ( parameters == null || parameters.length == 0 ) {
// open bounded range
this.startMinDev = 1;
this.startMaxDev = Long.MAX_VALUE;
this.endMinDev = 1;
this.endMaxDev = Long.MAX_VALUE;
} else if ( parameters.length == 1 ) {
// open bounded ranges
this.startMinDev = 1;
this.startMaxDev = parameters[0].longValue();
this.endMinDev = 1;
this.endMaxDev = parameters[0].longValue();
} else if ( parameters.length == 2 ) {
// open bounded ranges
this.startMinDev = parameters[0].longValue();
this.startMaxDev = parameters[1].longValue();
this.endMinDev = parameters[0].longValue();
this.endMaxDev = parameters[1].longValue();
} else if ( parameters.length == 4 ) {
// open bounded ranges
this.startMinDev = parameters[0].longValue();
this.startMaxDev = parameters[1].longValue();
this.endMinDev = parameters[2].longValue();
this.endMaxDev = parameters[3].longValue();
} else {
throw new RuntimeDroolsException( "[During Evaluator]: Not possible to use " + parameters.length + " parameters: '" + paramText + "'" );
}
}
} | void function(Long[] parameters) { if ( parameters == null parameters.length == 0 ) { this.startMinDev = 1; this.startMaxDev = Long.MAX_VALUE; this.endMinDev = 1; this.endMaxDev = Long.MAX_VALUE; } else if ( parameters.length == 1 ) { this.startMinDev = 1; this.startMaxDev = parameters[0].longValue(); this.endMinDev = 1; this.endMaxDev = parameters[0].longValue(); } else if ( parameters.length == 2 ) { this.startMinDev = parameters[0].longValue(); this.startMaxDev = parameters[1].longValue(); this.endMinDev = parameters[0].longValue(); this.endMaxDev = parameters[1].longValue(); } else if ( parameters.length == 4 ) { this.startMinDev = parameters[0].longValue(); this.startMaxDev = parameters[1].longValue(); this.endMinDev = parameters[2].longValue(); this.endMaxDev = parameters[3].longValue(); } else { throw new RuntimeDroolsException( STR + parameters.length + STR + paramText + "'" ); } } } | /**
* This methods sets the parameters appropriately.
*
* @param parameters
*/ | This methods sets the parameters appropriately | setParameters | {
"repo_name": "mswiderski/drools",
"path": "drools-core/src/main/java/org/drools/base/evaluators/IncludesEvaluatorDefinition.java",
"license": "apache-2.0",
"size": 15631
} | [
"org.drools.RuntimeDroolsException"
] | import org.drools.RuntimeDroolsException; | import org.drools.*; | [
"org.drools"
] | org.drools; | 555,837 |
private void restoreSizeOfDialog() {
String store = Globals.prefs.get(FindUnlinkedFilesDialog.GLOBAL_PREFS_DIALOG_SIZE_KEY);
Dimension dimension = null;
if (store != null) {
try {
String[] dim = store.split(";");
dimension = new Dimension(Integer.valueOf(dim[0]), Integer.valueOf(dim[1]));
} catch (NumberFormatException ignoredEx) {
LOGGER.debug("RestoreSizeDialog Exception ", ignoredEx);
}
}
if (dimension != null) {
setPreferredSize(dimension);
}
} | void function() { String store = Globals.prefs.get(FindUnlinkedFilesDialog.GLOBAL_PREFS_DIALOG_SIZE_KEY); Dimension dimension = null; if (store != null) { try { String[] dim = store.split(";"); dimension = new Dimension(Integer.valueOf(dim[0]), Integer.valueOf(dim[1])); } catch (NumberFormatException ignoredEx) { LOGGER.debug(STR, ignoredEx); } } if (dimension != null) { setPreferredSize(dimension); } } | /**
* Restores the location and size of this dialog from the persistent storage.
*/ | Restores the location and size of this dialog from the persistent storage | restoreSizeOfDialog | {
"repo_name": "motokito/jabref",
"path": "src/main/java/net/sf/jabref/gui/FindUnlinkedFilesDialog.java",
"license": "mit",
"size": 47869
} | [
"java.awt.Dimension",
"net.sf.jabref.Globals"
] | import java.awt.Dimension; import net.sf.jabref.Globals; | import java.awt.*; import net.sf.jabref.*; | [
"java.awt",
"net.sf.jabref"
] | java.awt; net.sf.jabref; | 925,371 |
public static RangeSet fromString(String list, boolean skipError) {
RangeSet rs = new RangeSet();
// Reject malformed ranges like "1---10", "1,,,,3" etc.
if (list.contains("--") || list.contains(",,")) {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected correct notation M,N or M-N", list));
}
// ignore malformed notation
return rs;
}
String[] items = Util.tokenize(list, ",");
if (items.length > 1 && items.length <= StringUtils.countMatches(list, ",")) {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected correct notation M,N or M-N", list));
}
// ignore malformed notation like ",1,2" or "1,2,"
return rs;
}
for (String s : items) {
s = s.trim();
// s is either single number or range "x-y".
// note that the end range is inclusive in this notation, but not in the Range class
try {
if (s.isEmpty()) {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected number", list)); }
// ignore "" element
continue;
}
if (s.contains("-")) {
if (StringUtils.countMatches(s, "-") > 1) {
if (!skipError) {
throw new IllegalArgumentException(String.format(
"Unable to parse '%s', expected correct notation M,N or M-N", list));
}
// ignore malformed ranges like "-5-2" or "2-5-"
continue;
}
String[] tokens = Util.tokenize(s, "-");
if (tokens.length == 2) {
int left = Integer.parseInt(tokens[0]);
int right = Integer.parseInt(tokens[1]);
if (left < 0 || right < 0) {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected number above zero", list));
}
// ignore a range which starts or ends under zero like "-5-3"
continue;
}
if (left > right) {
if (!skipError) {
throw new IllegalArgumentException(String.format(
"Unable to parse '%s', expected string with a range M-N where M<N", list));
}
// ignore inverse range like "10-5"
continue;
}
rs.ranges.add(new Range(left, right + 1));
} else {
if (!skipError) {
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected string with a range M-N", list));
}
// ignore malformed text like "1-10-50"
continue;
}
} else {
int n = Integer.parseInt(s);
rs.ranges.add(new Range(n, n + 1));
}
} catch (NumberFormatException e) {
if (!skipError)
throw new IllegalArgumentException(
String.format("Unable to parse '%s', expected number", list), e);
// ignore malformed text
}
}
return rs;
}
public static final class ConverterImpl implements Converter {
private final Converter collectionConv; // used to convert ArrayList in it
public ConverterImpl(Converter collectionConv) {
this.collectionConv = collectionConv;
} | static RangeSet function(String list, boolean skipError) { RangeSet rs = new RangeSet(); if (list.contains("--") list.contains(",,")) { if (!skipError) { throw new IllegalArgumentException( String.format(STR, list)); } return rs; } String[] items = Util.tokenize(list, ","); if (items.length > 1 && items.length <= StringUtils.countMatches(list, ",")) { if (!skipError) { throw new IllegalArgumentException( String.format(STR, list)); } return rs; } for (String s : items) { s = s.trim(); try { if (s.isEmpty()) { if (!skipError) { throw new IllegalArgumentException( String.format(STR, list)); } continue; } if (s.contains("-")) { if (StringUtils.countMatches(s, "-") > 1) { if (!skipError) { throw new IllegalArgumentException(String.format( STR, list)); } continue; } String[] tokens = Util.tokenize(s, "-"); if (tokens.length == 2) { int left = Integer.parseInt(tokens[0]); int right = Integer.parseInt(tokens[1]); if (left < 0 right < 0) { if (!skipError) { throw new IllegalArgumentException( String.format(STR, list)); } continue; } if (left > right) { if (!skipError) { throw new IllegalArgumentException(String.format( STR, list)); } continue; } rs.ranges.add(new Range(left, right + 1)); } else { if (!skipError) { throw new IllegalArgumentException( String.format(STR, list)); } continue; } } else { int n = Integer.parseInt(s); rs.ranges.add(new Range(n, n + 1)); } } catch (NumberFormatException e) { if (!skipError) throw new IllegalArgumentException( String.format(STR, list), e); } } return rs; } public static final class ConverterImpl implements Converter { private final Converter collectionConv; public ConverterImpl(Converter collectionConv) { this.collectionConv = collectionConv; } | /**
* Parses a {@link RangeSet} from a string like "1-3,5,7-9"
*/ | Parses a <code>RangeSet</code> from a string like "1-3,5,7-9" | fromString | {
"repo_name": "jenkinsci/jenkins",
"path": "core/src/main/java/hudson/model/Fingerprint.java",
"license": "mit",
"size": 52212
} | [
"com.thoughtworks.xstream.converters.Converter",
"org.apache.commons.lang.StringUtils"
] | import com.thoughtworks.xstream.converters.Converter; import org.apache.commons.lang.StringUtils; | import com.thoughtworks.xstream.converters.*; import org.apache.commons.lang.*; | [
"com.thoughtworks.xstream",
"org.apache.commons"
] | com.thoughtworks.xstream; org.apache.commons; | 1,186,309 |
void updateGroup(Context context, String site, String groupName) throws StudioException; | void updateGroup(Context context, String site, String groupName) throws StudioException; | /**
* Create or update group.
*
* @param context context
* @param site site
* @param groupName groupName
*/ | Create or update group | updateGroup | {
"repo_name": "craftercms/studio3",
"path": "api/src/main/java/org/craftercms/studio/api/security/SecurityService.java",
"license": "gpl-3.0",
"size": 5260
} | [
"org.craftercms.studio.commons.dto.Context",
"org.craftercms.studio.commons.exception.StudioException"
] | import org.craftercms.studio.commons.dto.Context; import org.craftercms.studio.commons.exception.StudioException; | import org.craftercms.studio.commons.dto.*; import org.craftercms.studio.commons.exception.*; | [
"org.craftercms.studio"
] | org.craftercms.studio; | 1,301,803 |
public ServiceFuture<VirtualNetworkGatewayInner> beginResetAsync(String resourceGroupName, String virtualNetworkGatewayName, String gatewayVip, final ServiceCallback<VirtualNetworkGatewayInner> serviceCallback) {
return ServiceFuture.fromResponse(beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, gatewayVip), serviceCallback);
} | ServiceFuture<VirtualNetworkGatewayInner> function(String resourceGroupName, String virtualNetworkGatewayName, String gatewayVip, final ServiceCallback<VirtualNetworkGatewayInner> serviceCallback) { return ServiceFuture.fromResponse(beginResetWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName, gatewayVip), serviceCallback); } | /**
* Resets the primary of the virtual network gateway in the specified resource group.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param gatewayVip Virtual network gateway vip address supplied to the begin reset of the active-active feature enabled gateway.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Resets the primary of the virtual network gateway in the specified resource group | beginResetAsync | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 283551
} | [
"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; | 1,139,970 |
@ServiceMethod(returns = ReturnType.SINGLE)
VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); | @ServiceMethod(returns = ReturnType.SINGLE) VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); | /**
* Get virtual network subnet usage for a given vNet resource id.
*
* @param locationName The name of the location.
* @param parameters The required parameters for creating or updating a server.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return virtual network subnet usage for a given vNet resource id.
*/ | Get virtual network subnet usage for a given vNet resource id | execute | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java",
"license": "mit",
"size": 2435
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner",
"com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; | import com.azure.core.annotation.*; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.*; import com.azure.resourcemanager.postgresqlflexibleserver.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,388,027 |
private void trimEmptyRows(List<List<GXMoreThanNode>> rows) {
List<List<GXMoreThanNode>> rowsCopy = new ArrayList<List<GXMoreThanNode>>(rows);
for (List<GXMoreThanNode> row : rowsCopy) {
if (row.isEmpty()) {
rows.remove(row);
}
}
} | void function(List<List<GXMoreThanNode>> rows) { List<List<GXMoreThanNode>> rowsCopy = new ArrayList<List<GXMoreThanNode>>(rows); for (List<GXMoreThanNode> row : rowsCopy) { if (row.isEmpty()) { rows.remove(row); } } } | /**
* Remove rows that are empty. This should only be the last row but since
* it's not too expensive better safe than sorry.
*
* @param rows
* - to trim
*/ | Remove rows that are empty. This should only be the last row but since it's not too expensive better safe than sorry | trimEmptyRows | {
"repo_name": "s-case/web-service-composition",
"path": "eu.scasefp7.eclipse.servicecomposition/src/eu/scasefp7/eclipse/servicecomposition/views/MyCustomLayout.java",
"license": "apache-2.0",
"size": 15489
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 509,936 |
@Nonnull
public EducationSubmissionRequestBuilder submissions(@Nonnull final String id) {
return new EducationSubmissionRequestBuilder(getRequestUrlWithAdditionalSegment("submissions") + "/" + id, getClient(), null);
} | EducationSubmissionRequestBuilder function(@Nonnull final String id) { return new EducationSubmissionRequestBuilder(getRequestUrlWithAdditionalSegment(STR) + "/" + id, getClient(), null); } | /**
* Gets a request builder for the EducationSubmission item
*
* @return the request builder
* @param id the item identifier
*/ | Gets a request builder for the EducationSubmission item | submissions | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/EducationAssignmentRequestBuilder.java",
"license": "mit",
"size": 6269
} | [
"com.microsoft.graph.requests.EducationSubmissionRequestBuilder",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.requests.EducationSubmissionRequestBuilder; import javax.annotation.Nonnull; | import com.microsoft.graph.requests.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 1,905,688 |
public void setExceptionListener(ExceptionListener exceptionListener) {
this.exceptionListener = exceptionListener;
} | void function(ExceptionListener exceptionListener) { this.exceptionListener = exceptionListener; } | /**
* Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions.
*/ | Specifies the JMS Exception Listener that is to be notified of any underlying JMS exceptions | setExceptionListener | {
"repo_name": "Fabryprog/camel",
"path": "components/camel-jms/src/main/java/org/apache/camel/component/jms/JmsConfiguration.java",
"license": "apache-2.0",
"size": 107870
} | [
"javax.jms.ExceptionListener"
] | import javax.jms.ExceptionListener; | import javax.jms.*; | [
"javax.jms"
] | javax.jms; | 891,052 |
IProject[] projects = WorkspaceHandlingLibrary.getProjectsInWorkspace();
ProjectHandlingLibrary projectLibrary;
for (IProject project : projects) {
projectLibrary = new ProjectHandlingLibrary(project);
projectLibrary.analyzeProject();
HashMap<IResource, ArrayList<Map<?, ?>>> semanticMarkers1 = MarkerHandlingLibrary.transformMarkers(projectLibrary.getMarkers(CodeSmellType.MARKER_ID));
projectLibrary.analyzeProject();
HashMap<IResource, ArrayList<Map<?, ?>>> semanticMarkers2 = MarkerHandlingLibrary.transformMarkers(projectLibrary.getMarkers(CodeSmellType.MARKER_ID));
if (semanticMarkers1.size() != semanticMarkers2.size()) {
HashSet<IResource> all = new HashSet<IResource>();
all.addAll(semanticMarkers1.keySet());
all.addAll(semanticMarkers2.keySet());
for (IResource resource : all) {
if (!semanticMarkers1.containsKey(resource)) {
System.err.println("The second check found semantic markers on the file '" + resource.getName() + "' but the first did not.");
} else if (!semanticMarkers2.containsKey(resource)) {
System.err.println("The first check semantic markers on the file '" + resource.getName() + "' but the second did not.");
}
}
}
assertEquals(semanticMarkers1.size(), semanticMarkers2.size());
ArrayList<Map<?, ?>> markerlist1, markerlist2;
for (IResource resource : semanticMarkers1.keySet()) {
markerlist1 = semanticMarkers1.get(resource);
if (!semanticMarkers2.containsKey(resource)) {
assertTrue(false);
}
markerlist2 = semanticMarkers2.get(resource);
assertEquals(markerlist1.size(), markerlist2.size());
for (int i = 0; i < markerlist1.size(); i++) {
MarkerHandlingLibrary.blindMarkerEquivencyCheck(markerlist1.get(i), markerlist2.get(i));
}
}
}
} | IProject[] projects = WorkspaceHandlingLibrary.getProjectsInWorkspace(); ProjectHandlingLibrary projectLibrary; for (IProject project : projects) { projectLibrary = new ProjectHandlingLibrary(project); projectLibrary.analyzeProject(); HashMap<IResource, ArrayList<Map<?, ?>>> semanticMarkers1 = MarkerHandlingLibrary.transformMarkers(projectLibrary.getMarkers(CodeSmellType.MARKER_ID)); projectLibrary.analyzeProject(); HashMap<IResource, ArrayList<Map<?, ?>>> semanticMarkers2 = MarkerHandlingLibrary.transformMarkers(projectLibrary.getMarkers(CodeSmellType.MARKER_ID)); if (semanticMarkers1.size() != semanticMarkers2.size()) { HashSet<IResource> all = new HashSet<IResource>(); all.addAll(semanticMarkers1.keySet()); all.addAll(semanticMarkers2.keySet()); for (IResource resource : all) { if (!semanticMarkers1.containsKey(resource)) { System.err.println(STR + resource.getName() + STR); } else if (!semanticMarkers2.containsKey(resource)) { System.err.println(STR + resource.getName() + STR); } } } assertEquals(semanticMarkers1.size(), semanticMarkers2.size()); ArrayList<Map<?, ?>> markerlist1, markerlist2; for (IResource resource : semanticMarkers1.keySet()) { markerlist1 = semanticMarkers1.get(resource); if (!semanticMarkers2.containsKey(resource)) { assertTrue(false); } markerlist2 = semanticMarkers2.get(resource); assertEquals(markerlist1.size(), markerlist2.size()); for (int i = 0; i < markerlist1.size(); i++) { MarkerHandlingLibrary.blindMarkerEquivencyCheck(markerlist1.get(i), markerlist2.get(i)); } } } } | /**
* This general test checking the markers consistency between 2 code analization without any code change between them.
*/ | This general test checking the markers consistency between 2 code analization without any code change between them | noChangeConsistency | {
"repo_name": "eroslevi/titan.EclipsePlug-ins",
"path": "org.eclipse.titanium.regressiontests/src/org/eclipse/titanium/regressiontests/GeneralTests.java",
"license": "epl-1.0",
"size": 5069
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.IResource",
"org.eclipse.titanium.markers.types.CodeSmellType",
"org.eclipse.titanium.regressiontests.library.MarkerHandlingLibrary",
"org.eclipse.titanium.regressiontests.library.ProjectHandlingLibrary",
"org.eclipse.titanium.regressiontests.library.WorkspaceHandlingLibrary",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.titanium.markers.types.CodeSmellType; import org.eclipse.titanium.regressiontests.library.MarkerHandlingLibrary; import org.eclipse.titanium.regressiontests.library.ProjectHandlingLibrary; import org.eclipse.titanium.regressiontests.library.WorkspaceHandlingLibrary; import org.junit.Assert; | import java.util.*; import org.eclipse.core.resources.*; import org.eclipse.titanium.markers.types.*; import org.eclipse.titanium.regressiontests.library.*; import org.junit.*; | [
"java.util",
"org.eclipse.core",
"org.eclipse.titanium",
"org.junit"
] | java.util; org.eclipse.core; org.eclipse.titanium; org.junit; | 283,717 |
public Map<String, CollisionGroup> getGroups()
{
return Collections.unmodifiableMap(groups);
}
| Map<String, CollisionGroup> function() { return Collections.unmodifiableMap(groups); } | /**
* Get all groups as read only.
*
* @return The groups map, where key is the group name.
*/ | Get all groups as read only | getGroups | {
"repo_name": "b3dgs/lionengine",
"path": "lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/collision/CollisionGroupConfig.java",
"license": "gpl-3.0",
"size": 8487
} | [
"java.util.Collections",
"java.util.Map"
] | import java.util.Collections; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 996,187 |
@Test
public void testClientNonDetachedListeningBehaviour() throws Exception {
Configuration config = ZooKeeperTestUtils.createZooKeeperHAConfig(
ZooKeeper.getConnectString(), FileStateBackendBasePath.getPath());
// Test actor system
ActorSystem testSystem = null;
// JobManager setup. Start the job managers as separate processes in order to not run the
// actors postStop, which cleans up all running jobs.
JobManagerProcess[] jobManagerProcess = new JobManagerProcess[2];
LeaderRetrievalService leaderRetrievalService = null;
ActorSystem taskManagerSystem = null;
final HighAvailabilityServices highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices(
config,
TestingUtils.defaultExecutor(),
HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
try {
final Deadline deadline = TestTimeOut.fromNow();
// Test actor system
testSystem = AkkaUtils.createActorSystem(new Configuration(),
new Some<>(new Tuple2<String, Object>("localhost", 0)));
// The job managers
jobManagerProcess[0] = new JobManagerProcess(0, config);
jobManagerProcess[1] = new JobManagerProcess(1, config);
jobManagerProcess[0].startProcess();
jobManagerProcess[1].startProcess();
// Leader listener
TestingListener leaderListener = new TestingListener();
leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID);
leaderRetrievalService.start(leaderListener);
// The task manager
taskManagerSystem = AkkaUtils.createActorSystem(AkkaUtils.getDefaultAkkaConfig());
TaskManager.startTaskManagerComponentsAndActor(
config,
ResourceID.generate(),
taskManagerSystem,
highAvailabilityServices,
"localhost",
Option.<String>empty(),
false,
TaskManager.class);
// Client test actor
TestActorRef<RecordingTestClient> clientRef = TestActorRef.create(
testSystem, Props.create(RecordingTestClient.class));
JobGraph jobGraph = createBlockingJobGraph();
{
// Initial submission
leaderListener.waitForNewLeader(deadline.timeLeft().toMillis());
String leaderAddress = leaderListener.getAddress();
UUID leaderId = leaderListener.getLeaderSessionID();
// The client
AkkaActorGateway client = new AkkaActorGateway(clientRef, leaderId);
// Get the leader ref
ActorRef leaderRef = AkkaUtils.getActorRef(
leaderAddress, testSystem, deadline.timeLeft());
ActorGateway leader = new AkkaActorGateway(leaderRef, leaderId);
int numSlots = 0;
while (numSlots == 0) {
Future<?> slotsFuture = leader.ask(JobManagerMessages
.getRequestTotalNumberOfSlots(), deadline.timeLeft());
numSlots = (Integer) Await.result(slotsFuture, deadline.timeLeft());
}
// Submit the job in non-detached mode
leader.tell(new SubmitJob(jobGraph,
ListeningBehaviour.EXECUTION_RESULT_AND_STATE_CHANGES), client);
JobManagerActorTestUtils.waitForJobStatus(
jobGraph.getJobID(), JobStatus.RUNNING, leader, deadline.timeLeft());
}
// Who's the boss?
JobManagerProcess leadingJobManagerProcess;
if (jobManagerProcess[0].getJobManagerAkkaURL(deadline.timeLeft()).equals(leaderListener.getAddress())) {
leadingJobManagerProcess = jobManagerProcess[0];
}
else {
leadingJobManagerProcess = jobManagerProcess[1];
}
// Kill the leading job manager process
leadingJobManagerProcess.destroy();
{
// Recovery by the standby JobManager
leaderListener.waitForNewLeader(deadline.timeLeft().toMillis());
String leaderAddress = leaderListener.getAddress();
UUID leaderId = leaderListener.getLeaderSessionID();
ActorRef leaderRef = AkkaUtils.getActorRef(
leaderAddress, testSystem, deadline.timeLeft());
ActorGateway leader = new AkkaActorGateway(leaderRef, leaderId);
JobManagerActorTestUtils.waitForJobStatus(
jobGraph.getJobID(), JobStatus.RUNNING, leader, deadline.timeLeft());
// Cancel the job
leader.tell(new JobManagerMessages.CancelJob(jobGraph.getJobID()));
}
// Wait for the execution result
clientRef.underlyingActor().awaitJobResult(deadline.timeLeft().toMillis());
int jobSubmitSuccessMessages = 0;
for (Object msg : clientRef.underlyingActor().getMessages()) {
if (msg instanceof JobManagerMessages.JobSubmitSuccess) {
jobSubmitSuccessMessages++;
}
}
// At least two submissions should be ack-ed (initial and recovery). This is quite
// conservative, but it is still possible that these messages are overtaken by the
// final message.
assertEquals(2, jobSubmitSuccessMessages);
}
catch (Throwable t) {
// Print early (in some situations the process logs get too big
// for Travis and the root problem is not shown)
t.printStackTrace();
// In case of an error, print the job manager process logs.
if (jobManagerProcess[0] != null) {
jobManagerProcess[0].printProcessLog();
}
if (jobManagerProcess[1] != null) {
jobManagerProcess[1].printProcessLog();
}
throw t;
}
finally {
if (jobManagerProcess[0] != null) {
jobManagerProcess[0].destroy();
}
if (jobManagerProcess[1] != null) {
jobManagerProcess[1].destroy();
}
if (leaderRetrievalService != null) {
leaderRetrievalService.stop();
}
if (taskManagerSystem != null) {
taskManagerSystem.shutdown();
}
if (testSystem != null) {
testSystem.shutdown();
}
highAvailabilityServices.closeAndCleanupAllData();
}
}
private static class RecordingTestClient extends UntypedActor {
private final Queue<Object> messages = new ConcurrentLinkedQueue<>();
private CountDownLatch jobResultLatch = new CountDownLatch(1); | void function() throws Exception { Configuration config = ZooKeeperTestUtils.createZooKeeperHAConfig( ZooKeeper.getConnectString(), FileStateBackendBasePath.getPath()); ActorSystem testSystem = null; JobManagerProcess[] jobManagerProcess = new JobManagerProcess[2]; LeaderRetrievalService leaderRetrievalService = null; ActorSystem taskManagerSystem = null; final HighAvailabilityServices highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices( config, TestingUtils.defaultExecutor(), HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION); try { final Deadline deadline = TestTimeOut.fromNow(); testSystem = AkkaUtils.createActorSystem(new Configuration(), new Some<>(new Tuple2<String, Object>(STR, 0))); jobManagerProcess[0] = new JobManagerProcess(0, config); jobManagerProcess[1] = new JobManagerProcess(1, config); jobManagerProcess[0].startProcess(); jobManagerProcess[1].startProcess(); TestingListener leaderListener = new TestingListener(); leaderRetrievalService = highAvailabilityServices.getJobManagerLeaderRetriever(HighAvailabilityServices.DEFAULT_JOB_ID); leaderRetrievalService.start(leaderListener); taskManagerSystem = AkkaUtils.createActorSystem(AkkaUtils.getDefaultAkkaConfig()); TaskManager.startTaskManagerComponentsAndActor( config, ResourceID.generate(), taskManagerSystem, highAvailabilityServices, STR, Option.<String>empty(), false, TaskManager.class); TestActorRef<RecordingTestClient> clientRef = TestActorRef.create( testSystem, Props.create(RecordingTestClient.class)); JobGraph jobGraph = createBlockingJobGraph(); { leaderListener.waitForNewLeader(deadline.timeLeft().toMillis()); String leaderAddress = leaderListener.getAddress(); UUID leaderId = leaderListener.getLeaderSessionID(); AkkaActorGateway client = new AkkaActorGateway(clientRef, leaderId); ActorRef leaderRef = AkkaUtils.getActorRef( leaderAddress, testSystem, deadline.timeLeft()); ActorGateway leader = new AkkaActorGateway(leaderRef, leaderId); int numSlots = 0; while (numSlots == 0) { Future<?> slotsFuture = leader.ask(JobManagerMessages .getRequestTotalNumberOfSlots(), deadline.timeLeft()); numSlots = (Integer) Await.result(slotsFuture, deadline.timeLeft()); } leader.tell(new SubmitJob(jobGraph, ListeningBehaviour.EXECUTION_RESULT_AND_STATE_CHANGES), client); JobManagerActorTestUtils.waitForJobStatus( jobGraph.getJobID(), JobStatus.RUNNING, leader, deadline.timeLeft()); } JobManagerProcess leadingJobManagerProcess; if (jobManagerProcess[0].getJobManagerAkkaURL(deadline.timeLeft()).equals(leaderListener.getAddress())) { leadingJobManagerProcess = jobManagerProcess[0]; } else { leadingJobManagerProcess = jobManagerProcess[1]; } leadingJobManagerProcess.destroy(); { leaderListener.waitForNewLeader(deadline.timeLeft().toMillis()); String leaderAddress = leaderListener.getAddress(); UUID leaderId = leaderListener.getLeaderSessionID(); ActorRef leaderRef = AkkaUtils.getActorRef( leaderAddress, testSystem, deadline.timeLeft()); ActorGateway leader = new AkkaActorGateway(leaderRef, leaderId); JobManagerActorTestUtils.waitForJobStatus( jobGraph.getJobID(), JobStatus.RUNNING, leader, deadline.timeLeft()); leader.tell(new JobManagerMessages.CancelJob(jobGraph.getJobID())); } clientRef.underlyingActor().awaitJobResult(deadline.timeLeft().toMillis()); int jobSubmitSuccessMessages = 0; for (Object msg : clientRef.underlyingActor().getMessages()) { if (msg instanceof JobManagerMessages.JobSubmitSuccess) { jobSubmitSuccessMessages++; } } assertEquals(2, jobSubmitSuccessMessages); } catch (Throwable t) { t.printStackTrace(); if (jobManagerProcess[0] != null) { jobManagerProcess[0].printProcessLog(); } if (jobManagerProcess[1] != null) { jobManagerProcess[1].printProcessLog(); } throw t; } finally { if (jobManagerProcess[0] != null) { jobManagerProcess[0].destroy(); } if (jobManagerProcess[1] != null) { jobManagerProcess[1].destroy(); } if (leaderRetrievalService != null) { leaderRetrievalService.stop(); } if (taskManagerSystem != null) { taskManagerSystem.shutdown(); } if (testSystem != null) { testSystem.shutdown(); } highAvailabilityServices.closeAndCleanupAllData(); } } private static class RecordingTestClient extends UntypedActor { private final Queue<Object> messages = new ConcurrentLinkedQueue<>(); private CountDownLatch jobResultLatch = new CountDownLatch(1); | /**
* Tests that clients receive updates after recovery by a new leader.
*/ | Tests that clients receive updates after recovery by a new leader | testClientNonDetachedListeningBehaviour | {
"repo_name": "fanyon/flink",
"path": "flink-tests/src/test/java/org/apache/flink/test/recovery/JobManagerHAJobGraphRecoveryITCase.java",
"license": "apache-2.0",
"size": 15478
} | [
"java.util.Queue",
"java.util.concurrent.ConcurrentLinkedQueue",
"java.util.concurrent.CountDownLatch",
"org.apache.flink.configuration.Configuration",
"org.apache.flink.runtime.akka.AkkaUtils",
"org.apache.flink.runtime.akka.ListeningBehaviour",
"org.apache.flink.runtime.clusterframework.types.ResourceID",
"org.apache.flink.runtime.highavailability.HighAvailabilityServices",
"org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils",
"org.apache.flink.runtime.instance.ActorGateway",
"org.apache.flink.runtime.instance.AkkaActorGateway",
"org.apache.flink.runtime.jobgraph.JobGraph",
"org.apache.flink.runtime.jobgraph.JobStatus",
"org.apache.flink.runtime.leaderelection.TestingListener",
"org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService",
"org.apache.flink.runtime.messages.JobManagerMessages",
"org.apache.flink.runtime.taskmanager.TaskManager",
"org.apache.flink.runtime.testingUtils.TestingUtils",
"org.apache.flink.runtime.testutils.JobManagerActorTestUtils",
"org.apache.flink.runtime.testutils.JobManagerProcess",
"org.apache.flink.runtime.testutils.ZooKeeperTestUtils",
"org.junit.Assert"
] | import java.util.Queue; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.CountDownLatch; import org.apache.flink.configuration.Configuration; import org.apache.flink.runtime.akka.AkkaUtils; import org.apache.flink.runtime.akka.ListeningBehaviour; import org.apache.flink.runtime.clusterframework.types.ResourceID; import org.apache.flink.runtime.highavailability.HighAvailabilityServices; import org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils; import org.apache.flink.runtime.instance.ActorGateway; import org.apache.flink.runtime.instance.AkkaActorGateway; import org.apache.flink.runtime.jobgraph.JobGraph; import org.apache.flink.runtime.jobgraph.JobStatus; import org.apache.flink.runtime.leaderelection.TestingListener; import org.apache.flink.runtime.leaderretrieval.LeaderRetrievalService; import org.apache.flink.runtime.messages.JobManagerMessages; import org.apache.flink.runtime.taskmanager.TaskManager; import org.apache.flink.runtime.testingUtils.TestingUtils; import org.apache.flink.runtime.testutils.JobManagerActorTestUtils; import org.apache.flink.runtime.testutils.JobManagerProcess; import org.apache.flink.runtime.testutils.ZooKeeperTestUtils; import org.junit.Assert; | import java.util.*; import java.util.concurrent.*; import org.apache.flink.configuration.*; import org.apache.flink.runtime.*; import org.apache.flink.runtime.akka.*; import org.apache.flink.runtime.clusterframework.types.*; import org.apache.flink.runtime.highavailability.*; import org.apache.flink.runtime.instance.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.runtime.leaderelection.*; import org.apache.flink.runtime.leaderretrieval.*; import org.apache.flink.runtime.messages.*; import org.apache.flink.runtime.taskmanager.*; import org.apache.flink.runtime.testutils.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.junit"
] | java.util; org.apache.flink; org.junit; | 624,256 |
@ApiModelProperty(example = "false", value = "Whether the currency is active. Default true")
public Boolean isActive() {
return active;
} | @ApiModelProperty(example = "false", value = STR) Boolean function() { return active; } | /**
* Whether the currency is active. Default true
* @return active
**/ | Whether the currency is active. Default true | isActive | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/model/CurrencyResource.java",
"license": "apache-2.0",
"size": 8330
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 1,919,954 |
private static List<String> getPhysicalTablesWithDescRowKey(String query, PhoenixConnection conn) throws SQLException {
// First query finds column rows of tables that need to be upgraded.
// We cannot tell if the column is from a table, view, or index however.
ResultSet rs = conn.createStatement().executeQuery(query);
Set<String> physicalTables = Sets.newHashSetWithExpectedSize(1024);
List<String> remainingTableNames = addPhysicalTables(conn, rs, PTableType.INDEX, physicalTables);
if (!remainingTableNames.isEmpty()) {
// Find tables/views for index
String indexLinkQuery = "SELECT TENANT_ID,TABLE_SCHEM,TABLE_NAME\n" +
"FROM SYSTEM.CATALOG\n" +
"WHERE COLUMN_NAME IS NULL\n" +
"AND (TENANT_ID, TABLE_SCHEM, COLUMN_FAMILY) IN " + getTableRVC(remainingTableNames) + "\n" +
"AND LINK_TYPE = " + LinkType.INDEX_TABLE.getSerializedValue();
rs = conn.createStatement().executeQuery(indexLinkQuery);
remainingTableNames = addPhysicalTables(conn, rs, PTableType.VIEW, physicalTables);
if (!remainingTableNames.isEmpty()) {
// Find physical table name from views, splitting on '.' to get schema name and table name
String physicalLinkQuery = "SELECT null, " +
" CASE WHEN INSTR(COLUMN_FAMILY,'.') = 0 THEN NULL ELSE SUBSTR(COLUMN_FAMILY,1,INSTR(COLUMN_FAMILY,'.')) END,\n" +
" CASE WHEN INSTR(COLUMN_FAMILY,'.') = 0 THEN COLUMN_FAMILY ELSE SUBSTR(COLUMN_FAMILY,INSTR(COLUMN_FAMILY,'.')+1) END\n" +
"FROM SYSTEM.CATALOG\n" +
"WHERE COLUMN_NAME IS NULL\n" +
"AND COLUMN_FAMILY IS NOT NULL\n" +
"AND (TENANT_ID, TABLE_SCHEM, TABLE_NAME) IN " + getTableRVC(remainingTableNames) + "\n" +
"AND LINK_TYPE = " + LinkType.PHYSICAL_TABLE.getSerializedValue();
rs = conn.createStatement().executeQuery(physicalLinkQuery);
// Add any tables (which will all be physical tables) which have not already been upgraded.
addPhysicalTables(conn, rs, PTableType.TABLE, physicalTables);
}
}
List<String> sortedPhysicalTables = new ArrayList<String>(physicalTables);
Collections.sort(sortedPhysicalTables);
return sortedPhysicalTables;
} | static List<String> function(String query, PhoenixConnection conn) throws SQLException { ResultSet rs = conn.createStatement().executeQuery(query); Set<String> physicalTables = Sets.newHashSetWithExpectedSize(1024); List<String> remainingTableNames = addPhysicalTables(conn, rs, PTableType.INDEX, physicalTables); if (!remainingTableNames.isEmpty()) { String indexLinkQuery = STR + STR + STR + STR + getTableRVC(remainingTableNames) + "\n" + STR + LinkType.INDEX_TABLE.getSerializedValue(); rs = conn.createStatement().executeQuery(indexLinkQuery); remainingTableNames = addPhysicalTables(conn, rs, PTableType.VIEW, physicalTables); if (!remainingTableNames.isEmpty()) { String physicalLinkQuery = STR + STR + STR + STR + STR + STR + STR + getTableRVC(remainingTableNames) + "\n" + STR + LinkType.PHYSICAL_TABLE.getSerializedValue(); rs = conn.createStatement().executeQuery(physicalLinkQuery); addPhysicalTables(conn, rs, PTableType.TABLE, physicalTables); } } List<String> sortedPhysicalTables = new ArrayList<String>(physicalTables); Collections.sort(sortedPhysicalTables); return sortedPhysicalTables; } | /**
* Identify the tables that need to be upgraded due to PHOENIX-2067
*/ | Identify the tables that need to be upgraded due to PHOENIX-2067 | getPhysicalTablesWithDescRowKey | {
"repo_name": "nickman/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/UpgradeUtil.java",
"license": "apache-2.0",
"size": 63154
} | [
"com.google.common.collect.Sets",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"java.util.Set",
"org.apache.phoenix.jdbc.PhoenixConnection",
"org.apache.phoenix.schema.PTable",
"org.apache.phoenix.schema.PTableType"
] | import com.google.common.collect.Sets; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.schema.PTable; import org.apache.phoenix.schema.PTableType; | import com.google.common.collect.*; import java.sql.*; import java.util.*; import org.apache.phoenix.jdbc.*; import org.apache.phoenix.schema.*; | [
"com.google.common",
"java.sql",
"java.util",
"org.apache.phoenix"
] | com.google.common; java.sql; java.util; org.apache.phoenix; | 2,844,130 |
private void createLoggedInEventHandler() {
Htp.EVENT_BUS.addHandler(LoggedInEvent.TYPE, new LoggedInEventHandler() { | void function() { Htp.EVENT_BUS.addHandler(LoggedInEvent.TYPE, new LoggedInEventHandler() { | /**
* Create a handler to change Logged in/out button based on the log in state
*/ | Create a handler to change Logged in/out button based on the log in state | createLoggedInEventHandler | {
"repo_name": "SHARP-HTP/phenotype-portal",
"path": "src/edu/mayo/phenoportal/client/navigation/AlgorithmPanel.java",
"license": "apache-2.0",
"size": 4822
} | [
"edu.mayo.phenoportal.client.Htp",
"edu.mayo.phenoportal.client.events.LoggedInEvent",
"edu.mayo.phenoportal.client.events.LoggedInEventHandler"
] | import edu.mayo.phenoportal.client.Htp; import edu.mayo.phenoportal.client.events.LoggedInEvent; import edu.mayo.phenoportal.client.events.LoggedInEventHandler; | import edu.mayo.phenoportal.client.*; import edu.mayo.phenoportal.client.events.*; | [
"edu.mayo.phenoportal"
] | edu.mayo.phenoportal; | 1,101,358 |
Match namespaces(Map<String, String> map);
| Match namespaces(Map<String, String> map); | /**
* Get a new Match with added namespace configuration for subsequent XPath
* calls
*
* @param map A mapping between prefix and namespace URI
* @return A modified <code>Match</code>
*/ | Get a new Match with added namespace configuration for subsequent XPath calls | namespaces | {
"repo_name": "jOOQ/jOOX",
"path": "jOOX/src/main/java/org/joox/Match.java",
"license": "apache-2.0",
"size": 83723
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,181,822 |
public String forCssUrl( String input )
{
if( isEmpty( input ) )
{
return EMPTY;
}
try
{
return Encode.forCssUrl( input );
}
catch( Exception ex )
{
LOG.error( "Encoding for CSS URL error, will return empty string: {}", ex.getMessage(), ex );
return EMPTY;
}
} | String function( String input ) { if( isEmpty( input ) ) { return EMPTY; } try { return Encode.forCssUrl( input ); } catch( Exception ex ) { LOG.error( STR, ex.getMessage(), ex ); return EMPTY; } } | /**
* Encodes for CSS URLs.
*
* @param input CSS input, may be null
*
* @return Encoded CSS, empty string if anything goes wrong
*/ | Encodes for CSS URLs | forCssUrl | {
"repo_name": "werval/werval",
"path": "io.werval.modules/io.werval.modules.sanitize/src/main/java/io/werval/modules/sanitize/Sanitize.java",
"license": "apache-2.0",
"size": 11301
} | [
"io.werval.util.Strings",
"org.owasp.encoder.Encode"
] | import io.werval.util.Strings; import org.owasp.encoder.Encode; | import io.werval.util.*; import org.owasp.encoder.*; | [
"io.werval.util",
"org.owasp.encoder"
] | io.werval.util; org.owasp.encoder; | 1,087,481 |
ConfigurationBuilder<? extends Configuration> getBuilder(); | ConfigurationBuilder<? extends Configuration> getBuilder(); | /**
* Retrieves the ConfigurationBuilder.
* @return The ConfigurationBuilder.
*/ | Retrieves the ConfigurationBuilder | getBuilder | {
"repo_name": "GFriedrich/logging-log4j2",
"path": "log4j-core/src/main/java/org/apache/logging/log4j/core/config/builder/api/ComponentBuilder.java",
"license": "apache-2.0",
"size": 3137
} | [
"org.apache.logging.log4j.core.config.Configuration"
] | import org.apache.logging.log4j.core.config.Configuration; | import org.apache.logging.log4j.core.config.*; | [
"org.apache.logging"
] | org.apache.logging; | 1,535,299 |
public static void fillRegularPolygon(int x, int y, int r, int vertexCount, double startAngle) {
RegularPolygon polygon = new RegularPolygon(x, y, r, vertexCount, startAngle);
g.fillPolygon(polygon);
}
| static void function(int x, int y, int r, int vertexCount, double startAngle) { RegularPolygon polygon = new RegularPolygon(x, y, r, vertexCount, startAngle); g.fillPolygon(polygon); } | /**
* Fills in a regular polygon
* @param x The x coordinate of the polygon
* @param y The y coordinate of the polygon
* @param r The radius of the polygon
* @param vertexCount The number of vertices the polygon has
* @param startAngle The angle the polygon will be drawn at
*/ | Fills in a regular polygon | fillRegularPolygon | {
"repo_name": "BossLetsPlays/GfxLib-2D",
"path": "source/com/blp/gfxlib/gfx/Gfx.java",
"license": "apache-2.0",
"size": 25020
} | [
"com.blp.gfxlib.gfx.geometry.RegularPolygon"
] | import com.blp.gfxlib.gfx.geometry.RegularPolygon; | import com.blp.gfxlib.gfx.geometry.*; | [
"com.blp.gfxlib"
] | com.blp.gfxlib; | 2,628,204 |
public static List<Attribute> filterNotAllowedAttributes(PerunSession sess, PerunBean bean, List<Attribute> attributes) {
List<Attribute> allowedAttributes = new ArrayList<>();
for(Attribute attribute: attributes) {
try {
if(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attribute, bean)) {
attribute.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, bean));
allowedAttributes.add(attribute);
}
} catch (InternalErrorException e) {
throw new RuntimeException(e);
}
}
return allowedAttributes;
} | static List<Attribute> function(PerunSession sess, PerunBean bean, List<Attribute> attributes) { List<Attribute> allowedAttributes = new ArrayList<>(); for(Attribute attribute: attributes) { try { if(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attribute, bean)) { attribute.setWritable(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.WRITE, attribute, bean)); allowedAttributes.add(attribute); } } catch (InternalErrorException e) { throw new RuntimeException(e); } } return allowedAttributes; } | /**
* From given attributes filter out the ones which are not allowed for the current principal.
*
* @param sess session
* @param bean perun bean
* @param attributes attributes
* @return list of attributes which can be accessed by current principal.
*/ | From given attributes filter out the ones which are not allowed for the current principal | filterNotAllowedAttributes | {
"repo_name": "zoraseb/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/blImpl/AuthzResolverBlImpl.java",
"license": "bsd-2-clause",
"size": 97601
} | [
"cz.metacentrum.perun.core.api.ActionType",
"cz.metacentrum.perun.core.api.Attribute",
"cz.metacentrum.perun.core.api.AuthzResolver",
"cz.metacentrum.perun.core.api.PerunBean",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"java.util.ArrayList",
"java.util.List"
] | import cz.metacentrum.perun.core.api.ActionType; import cz.metacentrum.perun.core.api.Attribute; import cz.metacentrum.perun.core.api.AuthzResolver; import cz.metacentrum.perun.core.api.PerunBean; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.ArrayList; import java.util.List; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; | [
"cz.metacentrum.perun",
"java.util"
] | cz.metacentrum.perun; java.util; | 2,626,342 |
public void click(String fileName) throws QTasteException
{
try {
new Region(this.rect).click(fileName);
}
catch(Exception ex)
{
throw new QTasteException(ex.getMessage(), ex);
}
}
| void function(String fileName) throws QTasteException { try { new Region(this.rect).click(fileName); } catch(Exception ex) { throw new QTasteException(ex.getMessage(), ex); } } | /**
* Simulates a click on the specified image of the area.
* @param fileName The image to find.
* @throws QTasteException if the file doesn't exist or if no occurrence is found.
*/ | Simulates a click on the specified image of the area | click | {
"repo_name": "qspin/qtaste",
"path": "plugins_src/sikuli/src/main/java/com/qspin/qtaste/sikuli/Area.java",
"license": "lgpl-3.0",
"size": 4674
} | [
"com.qspin.qtaste.testsuite.QTasteException",
"org.sikuli.script.Region"
] | import com.qspin.qtaste.testsuite.QTasteException; import org.sikuli.script.Region; | import com.qspin.qtaste.testsuite.*; import org.sikuli.script.*; | [
"com.qspin.qtaste",
"org.sikuli.script"
] | com.qspin.qtaste; org.sikuli.script; | 494,042 |
private void assignPort(String portString, String listenPortString) throws ChannelFrameworkException, NumberFormatException {
if (portString != null) {
// Found a port string. Convert it to an int.
port = Integer.parseInt(portString);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Port set from regular tcp port: " + port);
}
} else {
// Port String not found so try the backup listening port.
if (listenPortString != null) {
// Found a listening port string. Convert it to an int.
port = Integer.parseInt(listenPortString);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Port set from tcp listening port: " + port);
}
} else {
// Listening port not found either.
throw new ChannelFrameworkException("Port not available in TCP channel properties.");
}
}
} | void function(String portString, String listenPortString) throws ChannelFrameworkException, NumberFormatException { if (portString != null) { port = Integer.parseInt(portString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR + port); } } else { if (listenPortString != null) { port = Integer.parseInt(listenPortString); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) { Tr.debug(tc, STR + port); } } else { throw new ChannelFrameworkException(STR); } } } | /**
* Assign the value of port based on the parameters. If the first parameter is
* null, the second/backup
* will be used.
*
* @param portString
* @param listenPortString
* @throws ChannelFrameworkException
* @throws NumberFormatException
* - format of port string is not valid
*/ | Assign the value of port based on the parameters. If the first parameter is null, the second/backup will be used | assignPort | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.channelfw/src/com/ibm/ws/channelfw/internal/CFEndPointImpl.java",
"license": "epl-1.0",
"size": 21925
} | [
"com.ibm.websphere.ras.Tr",
"com.ibm.websphere.ras.TraceComponent",
"com.ibm.wsspi.channelfw.exception.ChannelFrameworkException"
] | import com.ibm.websphere.ras.Tr; import com.ibm.websphere.ras.TraceComponent; import com.ibm.wsspi.channelfw.exception.ChannelFrameworkException; | import com.ibm.websphere.ras.*; import com.ibm.wsspi.channelfw.exception.*; | [
"com.ibm.websphere",
"com.ibm.wsspi"
] | com.ibm.websphere; com.ibm.wsspi; | 664,671 |
@Test
public void testRemoveResponseTag12() throws UnsupportedEncodingException {
String source = new String("<response><wrapper><param1>value1</param1><param2>ÄÖÅäöå</param2></wrapper></response>".getBytes(), "ISO-8859-1");
String result = new String("<wrapper><param1>value1</param1><param2>ÄÖÅäöå</param2></wrapper>".getBytes(), "ISO-8859-1");
assertEquals(result, ConsumerGatewayUtil.removeResponseTag(source));
if (SOAPHelper.xmlStrToSOAPElement(result) == null) {
fail("Response can't be null");
}
} | void function() throws UnsupportedEncodingException { String source = new String(STR.getBytes(), STR); String result = new String(STR.getBytes(), STR); assertEquals(result, ConsumerGatewayUtil.removeResponseTag(source)); if (SOAPHelper.xmlStrToSOAPElement(result) == null) { fail(STR); } } | /**
* Remove response tag and namespace prefix. No namespace. XML uses
* ISO-8859-1 character set.
*/ | Remove response tag and namespace prefix. No namespace. XML uses ISO-8859-1 character set | testRemoveResponseTag12 | {
"repo_name": "vrk-kpa/REST-adapter-service",
"path": "src/src/test/java/fi/vrk/xroad/restadapterservice/util/ConsumerGatewayUtilTest.java",
"license": "mit",
"size": 45630
} | [
"fi.vrk.xrd4j.common.util.SOAPHelper",
"java.io.UnsupportedEncodingException",
"junit.framework.TestCase",
"org.junit.Assert"
] | import fi.vrk.xrd4j.common.util.SOAPHelper; import java.io.UnsupportedEncodingException; import junit.framework.TestCase; import org.junit.Assert; | import fi.vrk.xrd4j.common.util.*; import java.io.*; import junit.framework.*; import org.junit.*; | [
"fi.vrk.xrd4j",
"java.io",
"junit.framework",
"org.junit"
] | fi.vrk.xrd4j; java.io; junit.framework; org.junit; | 1,055,480 |
public ReplicaRecoveryInfo initReplicaRecovery(RecoveringBlock rBlock
) throws IOException; | ReplicaRecoveryInfo function(RecoveringBlock rBlock ) throws IOException; | /**
* Initialize a replica recovery.
* @return actual state of the replica on this data-node or
* null if data-node does not have the replica.
*/ | Initialize a replica recovery | initReplicaRecovery | {
"repo_name": "busbey/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/FsDatasetSpi.java",
"license": "apache-2.0",
"size": 21928
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand",
"org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo"
] | import java.io.IOException; import org.apache.hadoop.hdfs.server.protocol.BlockRecoveryCommand; import org.apache.hadoop.hdfs.server.protocol.ReplicaRecoveryInfo; | import java.io.*; import org.apache.hadoop.hdfs.server.protocol.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,964,499 |
private void flushBlock()
throws IOException
{
int length = _offset;
_offset = 0;
Inode.append(_inodeBuffer, _inodeOffset, _store, _xa, _buffer, 0, length);
} | void function() throws IOException { int length = _offset; _offset = 0; Inode.append(_inodeBuffer, _inodeOffset, _store, _xa, _buffer, 0, length); } | /**
* Updates the buffer.
*/ | Updates the buffer | flushBlock | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/db/blob/ClobWriter.java",
"license": "gpl-2.0",
"size": 5328
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,698,486 |
@WebMethod(operationName = "isDirectMemberOfGroup")
@WebResult(name = "isDirectMember")
@Cacheable(value= GroupMember.Cache.NAME, key="'{isDirectMemberOfGroup}' + 'principalId=' + #p0 + '|' + 'groupId=' + #p1")
boolean isDirectMemberOfGroup(@WebParam(name="principalId") String principalId, @WebParam(name="groupId") String groupId) throws RiceIllegalArgumentException; | @WebMethod(operationName = STR) @WebResult(name = STR) @Cacheable(value= GroupMember.Cache.NAME, key=STR) boolean isDirectMemberOfGroup(@WebParam(name=STR) String principalId, @WebParam(name=STR) String groupId) throws RiceIllegalArgumentException; | /**
* Check whether the give principal is a member of the group.
*
* <p>This method does not recurse into contained groups.</p>
*
* @param principalId Id of the principal
* @param groupId Id string of group
* @return true if principal is a direct member of the group.
* @throws RiceIllegalArgumentException if the principalId, groupId is null or blank
*/ | Check whether the give principal is a member of the group. This method does not recurse into contained groups | isDirectMemberOfGroup | {
"repo_name": "ricepanda/rice-git2",
"path": "rice-middleware/kim/kim-api/src/main/java/org/kuali/rice/kim/api/group/GroupService.java",
"license": "apache-2.0",
"size": 32747
} | [
"javax.jws.WebMethod",
"javax.jws.WebParam",
"javax.jws.WebResult",
"org.kuali.rice.core.api.exception.RiceIllegalArgumentException",
"org.springframework.cache.annotation.Cacheable"
] | import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import org.kuali.rice.core.api.exception.RiceIllegalArgumentException; import org.springframework.cache.annotation.Cacheable; | import javax.jws.*; import org.kuali.rice.core.api.exception.*; import org.springframework.cache.annotation.*; | [
"javax.jws",
"org.kuali.rice",
"org.springframework.cache"
] | javax.jws; org.kuali.rice; org.springframework.cache; | 726,061 |
@Test
public void testSkipExcluded() throws IOException {
byte[] bytes = new byte[100];
InputStream is = new LengthCheckInputStream(
new ByteArrayInputStream(bytes), 90, EXCLUDE_SKIPPED_BYTES);
assertTrue(10 == is.skip(10));
StreamUtils.consumeInputStream(is);
is.close();
} | void function() throws IOException { byte[] bytes = new byte[100]; InputStream is = new LengthCheckInputStream( new ByteArrayInputStream(bytes), 90, EXCLUDE_SKIPPED_BYTES); assertTrue(10 == is.skip(10)); StreamUtils.consumeInputStream(is); is.close(); } | /**
* Actual number of bytes consumed is exactly what's expected, when skipped
* bytes are excluded.
*/ | Actual number of bytes consumed is exactly what's expected, when skipped bytes are excluded | testSkipExcluded | {
"repo_name": "aws/aws-sdk-java",
"path": "aws-java-sdk-core/src/test/java/com/amazonaws/util/LengthCheckInputStreamTest.java",
"license": "apache-2.0",
"size": 7178
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.io.InputStream",
"org.junit.Assert"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 317,545 |
public AnomalyDetectorClientBuilder apiVersion(String apiVersion) {
this.apiVersion = apiVersion;
return this;
}
private HttpPipeline pipeline; | AnomalyDetectorClientBuilder function(String apiVersion) { this.apiVersion = apiVersion; return this; } private HttpPipeline pipeline; | /**
* Sets Anomaly Detector API version (for example, v1.0).
*
* @param apiVersion the apiVersion value.
* @return the AnomalyDetectorClientBuilder.
*/ | Sets Anomaly Detector API version (for example, v1.0) | apiVersion | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/anomalydetector/azure-ai-anomalydetector/src/main/java/com/azure/ai/anomalydetector/AnomalyDetectorClientBuilder.java",
"license": "mit",
"size": 8480
} | [
"com.azure.core.http.HttpPipeline"
] | import com.azure.core.http.HttpPipeline; | import com.azure.core.http.*; | [
"com.azure.core"
] | com.azure.core; | 2,019,002 |
public static void show(FragmentManager fragmentManager)
{
new AttachmentAppsDialog().show(fragmentManager, AttachmentAppsDialog.class.getSimpleName());
} | static void function(FragmentManager fragmentManager) { new AttachmentAppsDialog().show(fragmentManager, AttachmentAppsDialog.class.getSimpleName()); } | /**
* Show the dialog.
*
* @param fragmentManager
* A {@link FragmentManager}.
*/ | Show the dialog | show | {
"repo_name": "dmfs/CloudAttachSDK",
"path": "src/org/dmfs/android/cloudattach/sdk/ui/AttachmentAppsDialog.java",
"license": "apache-2.0",
"size": 4063
} | [
"android.app.FragmentManager"
] | import android.app.FragmentManager; | import android.app.*; | [
"android.app"
] | android.app; | 759,241 |
void update(Breakpoint breakpoint); | void update(Breakpoint breakpoint); | /**
* Updates breakpoint.
*
* @param breakpoint
*/ | Updates breakpoint | update | {
"repo_name": "sleshchenko/che",
"path": "ide/che-core-ide-api/src/main/java/org/eclipse/che/ide/api/debug/BreakpointStorage.java",
"license": "epl-1.0",
"size": 1788
} | [
"org.eclipse.che.api.debug.shared.model.Breakpoint"
] | import org.eclipse.che.api.debug.shared.model.Breakpoint; | import org.eclipse.che.api.debug.shared.model.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 679,776 |
private void cleanup() {
if (request.getDestination() != null) {
File dest = new File(request.getDestination());
if (dest.exists()) {
boolean rc = dest.delete();
Log.d(TAG, "Deleted file " + dest.getName() + "; Result: "
+ rc);
} else {
Log.d(TAG, "cleanup() didn't delete file: does not exist.");
}
}
} | void function() { if (request.getDestination() != null) { File dest = new File(request.getDestination()); if (dest.exists()) { boolean rc = dest.delete(); Log.d(TAG, STR + dest.getName() + STR + rc); } else { Log.d(TAG, STR); } } } | /**
* Deletes unfinished downloads.
*/ | Deletes unfinished downloads | cleanup | {
"repo_name": "narakai/DemoApp2",
"path": "core/src/main/java/com/clem/ipoca1/core/service/download/HttpDownloader.java",
"license": "mit",
"size": 15580
} | [
"android.util.Log",
"java.io.File"
] | import android.util.Log; import java.io.File; | import android.util.*; import java.io.*; | [
"android.util",
"java.io"
] | android.util; java.io; | 2,360,889 |
//----------------------------------------------------------------------------
public String getName(String documentType) {
if(documentType.equals(IDocument.WRITER)) {
return "StarWriter 4.0 Template";
}
else if(documentType.equals(IDocument.WEB)) {
return "StarWriter 4.0 Template (StarWriter/Web)";
}
else if(documentType.equals(IDocument.CALC)) {
return "StarCalc 4.0 Template";
}
else if(documentType.equals(IDocument.IMPRESS)) {
return "StarImpress 4.0 Template";
}
else {
return null;
}
}
//----------------------------------------------------------------------------
| String function(String documentType) { if(documentType.equals(IDocument.WRITER)) { return STR; } else if(documentType.equals(IDocument.WEB)) { return STR; } else if(documentType.equals(IDocument.CALC)) { return STR; } else if(documentType.equals(IDocument.IMPRESS)) { return STR; } else { return null; } } | /**
* Returns name of the filter. Returns null
* if the submitted document type is not supported by the filter.
*
* @param documentType document type to be used
*
* @return name of the filter
*
* @author Markus Krüger
* @date 13.03.2008
*/ | Returns name of the filter. Returns null if the submitted document type is not supported by the filter | getName | {
"repo_name": "LibreOffice/noa-libre",
"path": "src/ag/ion/noa/filter/StarOffice40TemplateFilter.java",
"license": "lgpl-2.1",
"size": 5846
} | [
"ag.ion.bion.officelayer.document.IDocument"
] | import ag.ion.bion.officelayer.document.IDocument; | import ag.ion.bion.officelayer.document.*; | [
"ag.ion.bion"
] | ag.ion.bion; | 99,265 |
private Map<String, Object> executeJob(String namespace, String businessObjectDefinitionName, String businessObjectFormatUsage, String fileTypeCode,
String partitionKey, String partitionValue, String subPartitionValues, String businessObjectFormatVersion, String businessObjectDataVersion)
throws Exception
{
// Prepare input data
List<FieldExtension> fieldExtensionList = new ArrayList<>();
if (namespace != null)
{
fieldExtensionList.add(buildFieldExtension("namespace", "${businessObjectDefinitionNamespace}"));
}
fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}"));
fieldExtensionList.add(buildFieldExtension("partitionKey", "${partitionKey}"));
fieldExtensionList.add(buildFieldExtension("partitionValue", "${partitionValue}"));
fieldExtensionList.add(buildFieldExtension("subPartitionValues", "${subPartitionValues}"));
fieldExtensionList.add(buildFieldExtension("businessObjectFormatVersion", "${businessObjectFormatVersion}"));
fieldExtensionList.add(buildFieldExtension("businessObjectDataVersion", "${businessObjectDataVersion}"));
List<Parameter> parameters = new ArrayList<>();
if (namespace != null)
{
parameters.add(buildParameter("businessObjectDefinitionNamespace", namespace));
}
parameters.add(buildParameter("businessObjectDefinitionName", businessObjectDefinitionName));
parameters.add(buildParameter("businessObjectFormatUsage", businessObjectFormatUsage));
parameters.add(buildParameter("businessObjectFormatFileType", fileTypeCode));
parameters.add(buildParameter("partitionKey", partitionKey));
parameters.add(buildParameter("partitionValue", partitionValue));
parameters.add(buildParameter("subPartitionValues", subPartitionValues));
parameters.add(buildParameter("businessObjectFormatVersion", businessObjectFormatVersion));
parameters.add(buildParameter("businessObjectDataVersion", businessObjectDataVersion));
String activitiXml = buildActivitiXml(IMPLEMENTATION, fieldExtensionList);
// Execute job
Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters);
assertNotNull(job);
HistoricProcessInstance hisInstance =
activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult();
return hisInstance.getProcessVariables();
} | Map<String, Object> function(String namespace, String businessObjectDefinitionName, String businessObjectFormatUsage, String fileTypeCode, String partitionKey, String partitionValue, String subPartitionValues, String businessObjectFormatVersion, String businessObjectDataVersion) throws Exception { List<FieldExtension> fieldExtensionList = new ArrayList<>(); if (namespace != null) { fieldExtensionList.add(buildFieldExtension(STR, STR)); } fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); fieldExtensionList.add(buildFieldExtension(STR, STR)); List<Parameter> parameters = new ArrayList<>(); if (namespace != null) { parameters.add(buildParameter(STR, namespace)); } parameters.add(buildParameter(STR, businessObjectDefinitionName)); parameters.add(buildParameter(STR, businessObjectFormatUsage)); parameters.add(buildParameter(STR, fileTypeCode)); parameters.add(buildParameter(STR, partitionKey)); parameters.add(buildParameter(STR, partitionValue)); parameters.add(buildParameter(STR, subPartitionValues)); parameters.add(buildParameter(STR, businessObjectFormatVersion)); parameters.add(buildParameter(STR, businessObjectDataVersion)); String activitiXml = buildActivitiXml(IMPLEMENTATION, fieldExtensionList); Job job = jobServiceTestHelper.createJobForCreateClusterForActivitiXml(activitiXml, parameters); assertNotNull(job); HistoricProcessInstance hisInstance = activitiHistoryService.createHistoricProcessInstanceQuery().processInstanceId(job.getId()).includeProcessVariables().singleResult(); return hisInstance.getProcessVariables(); } | /**
* Executes the Activiti job with the given parameters and returns variables. The parameters are as defined in the documentation.
*
* @param businessObjectDefinitionName the business object definition name.
* @param businessObjectFormatUsage the business object format usage.
* @param fileTypeCode the file type code.
* @param partitionKey the partition key.
* @param partitionValue the partition value.
* @param subPartitionValues the sub-partition values.
* @param businessObjectFormatVersion the business object format version (optional).
* @param businessObjectDataVersion the business object data version (optional).
*
* @return map of variable name to variable value
* @throws Exception
*/ | Executes the Activiti job with the given parameters and returns variables. The parameters are as defined in the documentation | executeJob | {
"repo_name": "FINRAOS/herd",
"path": "herd-code/herd-service/src/test/java/org/finra/herd/service/activiti/task/GetBusinessObjectDataTest.java",
"license": "apache-2.0",
"size": 55269
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"org.activiti.bpmn.model.FieldExtension",
"org.activiti.engine.history.HistoricProcessInstance",
"org.finra.herd.model.api.xml.Job",
"org.finra.herd.model.api.xml.Parameter",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; import org.activiti.bpmn.model.FieldExtension; import org.activiti.engine.history.HistoricProcessInstance; import org.finra.herd.model.api.xml.Job; import org.finra.herd.model.api.xml.Parameter; import org.junit.Assert; | import java.util.*; import org.activiti.bpmn.model.*; import org.activiti.engine.history.*; import org.finra.herd.model.api.xml.*; import org.junit.*; | [
"java.util",
"org.activiti.bpmn",
"org.activiti.engine",
"org.finra.herd",
"org.junit"
] | java.util; org.activiti.bpmn; org.activiti.engine; org.finra.herd; org.junit; | 1,689,309 |
public Locale getLocale(); | Locale function(); | /**
* Returns the locale of this object.
*
* @return The locale of this object.
*/ | Returns the locale of this object | getLocale | {
"repo_name": "srnsw/xena",
"path": "xena/ext/src/javahelp/jhMaster/JavaHelp/src/new/javax/help/HelpBroker.java",
"license": "gpl-3.0",
"size": 13348
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 505,901 |
public void end() throws SessionException; | void function() throws SessionException; | /**
* Ends this session.
*
* @throws SessionException
* thrown when the session is required to be stopped before its
* start
*/ | Ends this session | end | {
"repo_name": "d3scomp/JDEECo-old",
"path": "src/cz/cuni/mff/d3s/deeco/knowledge/ISession.java",
"license": "apache-2.0",
"size": 2009
} | [
"cz.cuni.mff.d3s.deeco.exceptions.SessionException"
] | import cz.cuni.mff.d3s.deeco.exceptions.SessionException; | import cz.cuni.mff.d3s.deeco.exceptions.*; | [
"cz.cuni.mff"
] | cz.cuni.mff; | 1,878,991 |
public void setRelations(List<RelationBean> relations, boolean activeOnly) {
this.relations = relations;
} | void function(List<RelationBean> relations, boolean activeOnly) { this.relations = relations; } | /**
* We add only active relations
*
* @param relations
* @param activeOnly
*/ | We add only active relations | setRelations | {
"repo_name": "jimmytheneutrino/petit",
"path": "modules/orm/src/test/java/com/nortal/petit/orm/relation/model/InvalidTargetBean.java",
"license": "apache-2.0",
"size": 1464
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,770,564 |
public String readHeaders()
throws MalformedStreamException {
int i = 0;
byte[] b = new byte[1];
// to support multi-byte characters
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int sizeMax = HEADER_PART_SIZE_MAX;
int size = 0;
while (i < HEADER_SEPARATOR.length) {
try {
b[0] = readByte();
} catch (IOException e) {
throw new MalformedStreamException("Stream ended unexpectedly");
}
size++;
if (b[0] == HEADER_SEPARATOR[i]) {
i++;
} else {
i = 0;
}
if (size <= sizeMax) {
baos.write(b[0]);
}
}
String headers = null;
if (headerEncoding != null) {
try {
headers = baos.toString(headerEncoding);
} catch (UnsupportedEncodingException e) {
// Fall back to platform default if specified encoding is not
// supported.
headers = baos.toString();
}
} else {
headers = baos.toString();
}
return headers;
} | String function() throws MalformedStreamException { int i = 0; byte[] b = new byte[1]; ByteArrayOutputStream baos = new ByteArrayOutputStream(); int sizeMax = HEADER_PART_SIZE_MAX; int size = 0; while (i < HEADER_SEPARATOR.length) { try { b[0] = readByte(); } catch (IOException e) { throw new MalformedStreamException(STR); } size++; if (b[0] == HEADER_SEPARATOR[i]) { i++; } else { i = 0; } if (size <= sizeMax) { baos.write(b[0]); } } String headers = null; if (headerEncoding != null) { try { headers = baos.toString(headerEncoding); } catch (UnsupportedEncodingException e) { headers = baos.toString(); } } else { headers = baos.toString(); } return headers; } | /**
* <p>Reads the <code>header-part</code> of the current
* <code>encapsulation</code>.
*
* <p>Headers are returned verbatim to the input stream, including the
* trailing <code>CRLF</code> marker. Parsing is left to the
* application.
*
* <p><strong>TODO</strong> allow limiting maximum header size to
* protect against abuse.
*
* @return The <code>header-part</code> of the current encapsulation.
*
* @throws MalformedStreamException if the stream ends unexpecetedly.
*/ | Reads the <code>header-part</code> of the current <code>encapsulation</code>. Headers are returned verbatim to the input stream, including the trailing <code>CRLF</code> marker. Parsing is left to the application. TODO allow limiting maximum header size to protect against abuse | readHeaders | {
"repo_name": "vvdeng/vportal",
"path": "src/org/apache/commons/fileupload/MultipartStream.java",
"license": "gpl-2.0",
"size": 33276
} | [
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.UnsupportedEncodingException"
] | import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 1,581,715 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(InboundEndpointOnErrorSequenceContainer.class)) {
case EsbPackage.INBOUND_ENDPOINT_ON_ERROR_SEQUENCE_CONTAINER__MEDIATOR_FLOW:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(InboundEndpointOnErrorSequenceContainer.class)) { case EsbPackage.INBOUND_ENDPOINT_ON_ERROR_SEQUENCE_CONTAINER__MEDIATOR_FLOW: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "nwnpallewela/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.eclipse.gmf.esb.edit/src/org/wso2/developerstudio/eclipse/gmf/esb/provider/InboundEndpointOnErrorSequenceContainerItemProvider.java",
"license": "apache-2.0",
"size": 5362
} | [
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification",
"org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage",
"org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointOnErrorSequenceContainer"
] | import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; import org.wso2.developerstudio.eclipse.gmf.esb.EsbPackage; import org.wso2.developerstudio.eclipse.gmf.esb.InboundEndpointOnErrorSequenceContainer; | import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; import org.wso2.developerstudio.eclipse.gmf.esb.*; | [
"org.eclipse.emf",
"org.wso2.developerstudio"
] | org.eclipse.emf; org.wso2.developerstudio; | 2,823,893 |
public BidiRun getLogicalRun(int logicalPosition)
{
verifyValidParaOrLine();
verifyRange(logicalPosition, 0, length);
return BidiLine.getLogicalRun(this, logicalPosition);
} | BidiRun function(int logicalPosition) { verifyValidParaOrLine(); verifyRange(logicalPosition, 0, length); return BidiLine.getLogicalRun(this, logicalPosition); } | /**
* Get a logical run.
* This method returns information about a run and is used
* to retrieve runs in logical order.<p>
* This is especially useful for line-breaking on a paragraph.
*
* @param logicalPosition is a logical position within the source text.
*
* @return a BidiRun object filled with <code>start</code> containing
* the first character of the run, <code>limit</code> containing
* the limit of the run, and <code>embeddingLevel</code> containing
* the level of the run.
*
* @throws IllegalStateException if this call is not preceded by a successful
* call to <code>setPara</code> or <code>setLine</code>
* @throws IllegalArgumentException if logicalPosition is not in the range
* <code>0<=logicalPosition<getProcessedLength()</code>
*
* @see android.icu.text.BidiRun
* @see android.icu.text.BidiRun#getStart()
* @see android.icu.text.BidiRun#getLimit()
* @see android.icu.text.BidiRun#getEmbeddingLevel()
*/ | Get a logical run. This method returns information about a run and is used to retrieve runs in logical order. This is especially useful for line-breaking on a paragraph | getLogicalRun | {
"repo_name": "life-beam/j2objc",
"path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java",
"license": "apache-2.0",
"size": 248592
} | [
"android.icu.text.BidiRun"
] | import android.icu.text.BidiRun; | import android.icu.text.*; | [
"android.icu"
] | android.icu; | 2,656,032 |
public String getNString(int columnIndex) throws SQLException {
checkColumnBounds(columnIndex);
String fieldEncoding = this.fields[columnIndex - 1].getCharacterSet();
if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) {
throw new SQLException(
"Can not call getNString() when field's charset isn't UTF-8");
}
return getString(columnIndex);
}
| String function(int columnIndex) throws SQLException { checkColumnBounds(columnIndex); String fieldEncoding = this.fields[columnIndex - 1].getCharacterSet(); if (fieldEncoding == null !fieldEncoding.equals("UTF-8")) { throw new SQLException( STR); } return getString(columnIndex); } | /**
* JDBC 4.0
*
* Get the value of a column in the current row as a Java String
*
* @param columnIndex
* the first column is 1, the second is 2...
*
* @return the column value, null for SQL NULL
*
* @exception SQLException
* if a database access error occurs
*/ | JDBC 4.0 Get the value of a column in the current row as a Java String | getNString | {
"repo_name": "google-code/blufeedme",
"path": "material/BDs/mysql-connector-java-5.1.13/src/com/mysql/jdbc/JDBC4ResultSet.java",
"license": "gpl-3.0",
"size": 17141
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,810,200 |
public BulkRequestBuilder add(DeleteRequestBuilder request) {
super.request.add(request.request());
return this;
} | BulkRequestBuilder function(DeleteRequestBuilder request) { super.request.add(request.request()); return this; } | /**
* Adds an {@link DeleteRequest} to the list of actions to execute.
*/ | Adds an <code>DeleteRequest</code> to the list of actions to execute | add | {
"repo_name": "strapdata/elassandra5-rc",
"path": "core/src/main/java/org/elasticsearch/action/bulk/BulkRequestBuilder.java",
"license": "apache-2.0",
"size": 6480
} | [
"org.elasticsearch.action.delete.DeleteRequestBuilder"
] | import org.elasticsearch.action.delete.DeleteRequestBuilder; | import org.elasticsearch.action.delete.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 880,000 |
@Override
public Stream<Element> dependencies ()
{
return ActivitySource.METADATA.properties ()
.filter (p -> p.hasFlags (Property.Flags.RELATIONSHIP))
.filter (p -> p.hasFlags (Property.Flags.REQUIRED) || p.hasFlags (Property.Flags.MUTABLE))
.flatMap (p -> p.stream (this))
.map (e -> (Element) e);
} | Stream<Element> function () { return ActivitySource.METADATA.properties () .filter (p -> p.hasFlags (Property.Flags.RELATIONSHIP)) .filter (p -> p.hasFlags (Property.Flags.REQUIRED) p.hasFlags (Property.Flags.MUTABLE)) .flatMap (p -> p.stream (this)) .map (e -> (Element) e); } | /**
* Get a <code>Stream</code> containing all of the dependencies for this
* <code>Element</code> instance.
*
* @return The <code>Stream</code>
*/ | Get a <code>Stream</code> containing all of the dependencies for this <code>Element</code> instance | dependencies | {
"repo_name": "jestark/LMSDataHarvester",
"path": "src/main/java/ca/uoguelph/socs/icc/edm/domain/ActivitySource.java",
"license": "gpl-3.0",
"size": 21442
} | [
"ca.uoguelph.socs.icc.edm.domain.metadata.Property",
"java.util.stream.Stream"
] | import ca.uoguelph.socs.icc.edm.domain.metadata.Property; import java.util.stream.Stream; | import ca.uoguelph.socs.icc.edm.domain.metadata.*; import java.util.stream.*; | [
"ca.uoguelph.socs",
"java.util"
] | ca.uoguelph.socs; java.util; | 2,329,802 |
public void openGenome( PersistentReference genome ) {
currentRefGen = genome;
boundsManager = this.boundsInfoManagerFactory.get( currentRefGen );
basePanelFac = new BasePanelFactory( boundsManager, this );
genomeViewer = basePanelFac.getRefViewerBasePanel( currentRefGen );
getApp().showRefGenPanel( genomeViewer );
} | void function( PersistentReference genome ) { currentRefGen = genome; boundsManager = this.boundsInfoManagerFactory.get( currentRefGen ); basePanelFac = new BasePanelFactory( boundsManager, this ); genomeViewer = basePanelFac.getRefViewerBasePanel( currentRefGen ); getApp().showRefGenPanel( genomeViewer ); } | /**
* Opens a reference viewer for the given reference genome.
* <p>
* @param genome the genome for which a viewer shall be opened.
*/ | Opens a reference viewer for the given reference genome. | openGenome | {
"repo_name": "rhilker/ReadXplorer",
"path": "readxplorer-ui/src/main/java/de/cebitec/readxplorer/ui/controller/ViewController.java",
"license": "gpl-3.0",
"size": 14486
} | [
"de.cebitec.readxplorer.databackend.dataobjects.PersistentReference",
"de.cebitec.readxplorer.ui.datavisualisation.basepanel.BasePanelFactory"
] | import de.cebitec.readxplorer.databackend.dataobjects.PersistentReference; import de.cebitec.readxplorer.ui.datavisualisation.basepanel.BasePanelFactory; | import de.cebitec.readxplorer.databackend.dataobjects.*; import de.cebitec.readxplorer.ui.datavisualisation.basepanel.*; | [
"de.cebitec.readxplorer"
] | de.cebitec.readxplorer; | 746,820 |
public Logger createLog(WorkDirectory wd, String b, String key) throws DuplicateLogNameFault {
if (key == null || "".equals(key)) {
throw new IllegalArgumentException("Log name can not be empty");
}
String logName = wd.getLogFileName();
if (gpls == null)
gpls = new Vector<GeneralPurposeLogger>();
for (int i = 0; i < gpls.size(); i++) {
GeneralPurposeLogger gpl = gpls.get(i);
if (gpl.getName().equals(key) && gpl.getLogFileName().equals(logName))
throw new DuplicateLogNameFault(i18n, "ts.logger.duplicatelognamefault", key);
}
GeneralPurposeLogger gpl = new GeneralPurposeLogger( key, wd, b, this);
gpls.add(gpl);
return gpl;
} | Logger function(WorkDirectory wd, String b, String key) throws DuplicateLogNameFault { if (key == null STRLog name can not be emptySTRts.logger.duplicatelognamefault", key); } GeneralPurposeLogger gpl = new GeneralPurposeLogger( key, wd, b, this); gpls.add(gpl); return gpl; } | /**
* Creates general purpose logger with given key and ResourceBundleName registered for given WorkDirectory.
* @param wd WorkDirectory logger should be registered for; may be <code>null</code> if no WorkDirectory
* currently available (the log will be registered for the furst WD created for this TestSuite
* @param b name of ResorceBundle used for this logger; may be <code>null</code> if not required
* @param key key for this log
* @return general purpose logger with given key registered for given WorkDirectory or TestSuite (if WD is null)
* @throws TestSuite.DuplicateLogNameFault if log with this key has been registered in the system already
* @see #getLog
*/ | Creates general purpose logger with given key and ResourceBundleName registered for given WorkDirectory | createLog | {
"repo_name": "Distrotech/icedtea7",
"path": "test/jtreg/com/sun/javatest/TestSuite.java",
"license": "gpl-2.0",
"size": 52273
} | [
"java.util.logging.Logger"
] | import java.util.logging.Logger; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,244,400 |
public void putExtras(String callId, Bundle extras) {
try {
mAdapter.putExtras(callId, extras);
} catch (RemoteException ignored) {
}
} | void function(String callId, Bundle extras) { try { mAdapter.putExtras(callId, extras); } catch (RemoteException ignored) { } } | /**
* Intructs Telecom to add extras to a call.
*
* @param callId The callId to add the extras to.
* @param extras The extras.
*/ | Intructs Telecom to add extras to a call | putExtras | {
"repo_name": "daiqiquan/framework-base",
"path": "telecomm/java/android/telecom/InCallAdapter.java",
"license": "apache-2.0",
"size": 12119
} | [
"android.os.Bundle",
"android.os.RemoteException"
] | import android.os.Bundle; import android.os.RemoteException; | import android.os.*; | [
"android.os"
] | android.os; | 1,083,192 |
TokenValueProvider getTokenValueProvider(DefDescriptor<? extends BaseStyleDef> style, ResolveStrategy strategy); | TokenValueProvider getTokenValueProvider(DefDescriptor<? extends BaseStyleDef> style, ResolveStrategy strategy); | /**
* Gets a {@link TokenValueProvider}.
* <p>
* The given {@link ResolveStrategy} determines which overrides are automatically included. If
* {@link ResolveStrategy#RESOLVE_NORMAL} then this will use whatever overrides are set on the current
* {@link AuraContext}. Otherwise, no overrides will be automatically included.
*
* @param style The {@link StyleDef} descriptor of the CSS file being parsed. This is used to determine which
* namespace-default {@link TokensDef} to use.
* @param strategy An indication of how this provider is going to be used.
*/ | Gets a <code>TokenValueProvider</code>. The given <code>ResolveStrategy</code> determines which overrides are automatically included. If <code>ResolveStrategy#RESOLVE_NORMAL</code> then this will use whatever overrides are set on the current <code>AuraContext</code>. Otherwise, no overrides will be automatically included | getTokenValueProvider | {
"repo_name": "forcedotcom/aura",
"path": "aura/src/main/java/org/auraframework/adapter/StyleAdapter.java",
"license": "apache-2.0",
"size": 10855
} | [
"org.auraframework.css.ResolveStrategy",
"org.auraframework.css.TokenValueProvider",
"org.auraframework.def.BaseStyleDef",
"org.auraframework.def.DefDescriptor"
] | import org.auraframework.css.ResolveStrategy; import org.auraframework.css.TokenValueProvider; import org.auraframework.def.BaseStyleDef; import org.auraframework.def.DefDescriptor; | import org.auraframework.css.*; import org.auraframework.def.*; | [
"org.auraframework.css",
"org.auraframework.def"
] | org.auraframework.css; org.auraframework.def; | 1,243,114 |
public void close() throws IOException {
if (null != s) {
s.close();
s = null;
}
if (null != i) {
i.close();
i = null;
}
if (null != o) {
o.close();
o = null;
}
} | void function() throws IOException { if (null != s) { s.close(); s = null; } if (null != i) { i.close(); i = null; } if (null != o) { o.close(); o = null; } } | /**
* Closes the current connection to the remote process.
*
* @throws IOException if an I/O error occurs when closing this socket.
*/ | Closes the current connection to the remote process | close | {
"repo_name": "a2ndrade/k-intellij-plugin",
"path": "src/main/java/kx/c.java",
"license": "mit",
"size": 53259
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,406,051 |
public final Vec2 getVertex (int index) {
assert (0 <= index && index < m_count);
return m_vertices[index];
}
}
private Simplex simplex = new Simplex();
private int[] saveA = new int[3];
private int[] saveB = new int[3];
private Vec2 closestPoint = new Vec2();
private Vec2 d = new Vec2();
private Vec2 temp = new Vec2();
private Vec2 normal = new Vec2(); | final Vec2 function (int index) { assert (0 <= index && index < m_count); return m_vertices[index]; } } private Simplex simplex = new Simplex(); private int[] saveA = new int[3]; private int[] saveB = new int[3]; private Vec2 closestPoint = new Vec2(); private Vec2 d = new Vec2(); private Vec2 temp = new Vec2(); private Vec2 normal = new Vec2(); | /** Get a vertex by index. Used by Distance.
*
* @param index
* @return */ | Get a vertex by index. Used by Distance | getVertex | {
"repo_name": "MathieuDuponchelle/gdx",
"path": "backends/gdx-backends-gwt/src/com/badlogic/gdx/backends/gwt/emu/org/jbox2d/collision/Distance.java",
"license": "apache-2.0",
"size": 20372
} | [
"org.jbox2d.common.Vec2"
] | import org.jbox2d.common.Vec2; | import org.jbox2d.common.*; | [
"org.jbox2d.common"
] | org.jbox2d.common; | 2,424,528 |
protected int processData(SimpleBinaryByteBuffer inBuffer, SimpleBinaryItemData lastSentData, Byte forcedDeviceId) {
int receivedID = 0;
try {
// flip buffer
inBuffer.flip();
if (logger.isDebugEnabled()) {
logger.debug("{} - Reading input buffer, lenght={} bytes. Thread={}", toString(), inBuffer.limit(),
Thread.currentThread().getId());
}
if (inBuffer.limit() == 0) {
return ProcessDataResult.DATA_NOT_COMPLETED;
}
receivedID = inBuffer.get();
inBuffer.rewind();
// decompile income message
SimpleBinaryMessage itemData = SimpleBinaryProtocol.decompileData(inBuffer, itemsConfig, deviceName,
forcedDeviceId);
// is decompiled
if (itemData != null) {
// process data
processDecompiledData(itemData, lastSentData);
// compact buffer
inBuffer.compact();
return receivedID;
} else {
logger.warn("{} - Cannot decompile incoming data", toString());
// rewind at start position (wait for next bytes)
inBuffer.rewind();
// compact buffer
inBuffer.compact();
return ProcessDataResult.DATA_NOT_COMPLETED;
}
} catch (BufferUnderflowException ex) {
logger.warn("{} - Buffer underflow while reading", toString());
// print details
printCommunicationInfo(inBuffer, lastSentData);
StringWriter sw = new StringWriter();
PrintWriter pw = new PrintWriter(sw);
ex.printStackTrace(pw);
logger.warn("Underflow stacktrace: {}", sw.toString());
logger.warn("Buffer mode {}, remaining={} bytes, limit={} bytes", inBuffer.getMode().toString(),
inBuffer.remaining(), inBuffer.limit());
try {
// rewind buffer
inBuffer.rewind();
logger.warn("Buffer mode {}, remaining after rewind {} bytes", inBuffer.getMode().toString(),
inBuffer.remaining());
// compact buffer
inBuffer.compact();
} catch (ModeChangeException exep) {
logger.error(exep.getMessage());
}
return ProcessDataResult.PROCESSING_ERROR;
} catch (NoValidCRCException ex) {
logger.error("{} - Invalid CRC while reading: {}", this.toString(), ex.getMessage());
// print details
printCommunicationInfo(inBuffer, lastSentData);
// compact buffer
try {
inBuffer.compact();
} catch (ModeChangeException e) {
logger.error(e.getMessage());
}
try {
resendData(lastSentData);
} catch (InterruptedException e) {
logger.error(e.getMessage());
}
return ProcessDataResult.INVALID_CRC;
} catch (NoValidItemInConfig ex) {
logger.error("{} - Item not found in items config: {}", this.toString(), ex.getMessage());
// print details
printCommunicationInfo(inBuffer, lastSentData);
// compact buffer
try {
inBuffer.compact();
} catch (ModeChangeException e) {
logger.error(e.getMessage());
}
// set state
devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR);
return ProcessDataResult.BAD_CONFIG;
} catch (UnknownMessageException ex) {
logger.error("{} - Income unknown message: {}", this.toString(), ex.getMessage());
// print details
printCommunicationInfo(inBuffer, lastSentData);
// only 4 bytes (minus 1 after delete first byte) is not enough to have complete message
if (inBuffer.limit() < 5) {
// clear buffer
inBuffer.clear();
logger.warn("{} - Income unknown message: input buffer cleared", this.toString());
// set state
devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR);
return ProcessDataResult.UNKNOWN_MESSAGE;
} else {
logger.warn("{} - Income unknown message : {} bytes in buffer. Triyng to find correct message. ",
this.toString(), inBuffer.limit());
try {
// delete first byte
inBuffer.rewind();
inBuffer.get();
inBuffer.compact();
} catch (ModeChangeException e) {
logger.error(e.getMessage());
}
return ProcessDataResult.UNKNOWN_MESSAGE_REWIND;
}
} catch (ModeChangeException ex) {
logger.error("{} - Bad operation: {}. Thread={}", this.toString(), ex.getMessage(),
Thread.currentThread().getId());
inBuffer.initialize();
// set state
devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR);
return ProcessDataResult.PROCESSING_ERROR;
} catch (Exception ex) {
logger.error("{} - Reading incoming data error: {}", this.toString(), ex.getMessage());
// print details
printCommunicationInfo(inBuffer, lastSentData);
inBuffer.clear();
// set state
devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR);
return ProcessDataResult.PROCESSING_ERROR;
}
} | int function(SimpleBinaryByteBuffer inBuffer, SimpleBinaryItemData lastSentData, Byte forcedDeviceId) { int receivedID = 0; try { inBuffer.flip(); if (logger.isDebugEnabled()) { logger.debug(STR, toString(), inBuffer.limit(), Thread.currentThread().getId()); } if (inBuffer.limit() == 0) { return ProcessDataResult.DATA_NOT_COMPLETED; } receivedID = inBuffer.get(); inBuffer.rewind(); SimpleBinaryMessage itemData = SimpleBinaryProtocol.decompileData(inBuffer, itemsConfig, deviceName, forcedDeviceId); if (itemData != null) { processDecompiledData(itemData, lastSentData); inBuffer.compact(); return receivedID; } else { logger.warn(STR, toString()); inBuffer.rewind(); inBuffer.compact(); return ProcessDataResult.DATA_NOT_COMPLETED; } } catch (BufferUnderflowException ex) { logger.warn(STR, toString()); printCommunicationInfo(inBuffer, lastSentData); StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); ex.printStackTrace(pw); logger.warn(STR, sw.toString()); logger.warn(STR, inBuffer.getMode().toString(), inBuffer.remaining(), inBuffer.limit()); try { inBuffer.rewind(); logger.warn(STR, inBuffer.getMode().toString(), inBuffer.remaining()); inBuffer.compact(); } catch (ModeChangeException exep) { logger.error(exep.getMessage()); } return ProcessDataResult.PROCESSING_ERROR; } catch (NoValidCRCException ex) { logger.error(STR, this.toString(), ex.getMessage()); printCommunicationInfo(inBuffer, lastSentData); try { inBuffer.compact(); } catch (ModeChangeException e) { logger.error(e.getMessage()); } try { resendData(lastSentData); } catch (InterruptedException e) { logger.error(e.getMessage()); } return ProcessDataResult.INVALID_CRC; } catch (NoValidItemInConfig ex) { logger.error(STR, this.toString(), ex.getMessage()); printCommunicationInfo(inBuffer, lastSentData); try { inBuffer.compact(); } catch (ModeChangeException e) { logger.error(e.getMessage()); } devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR); return ProcessDataResult.BAD_CONFIG; } catch (UnknownMessageException ex) { logger.error(STR, this.toString(), ex.getMessage()); printCommunicationInfo(inBuffer, lastSentData); if (inBuffer.limit() < 5) { inBuffer.clear(); logger.warn(STR, this.toString()); devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR); return ProcessDataResult.UNKNOWN_MESSAGE; } else { logger.warn(STR, this.toString(), inBuffer.limit()); try { inBuffer.rewind(); inBuffer.get(); inBuffer.compact(); } catch (ModeChangeException e) { logger.error(e.getMessage()); } return ProcessDataResult.UNKNOWN_MESSAGE_REWIND; } } catch (ModeChangeException ex) { logger.error(STR, this.toString(), ex.getMessage(), Thread.currentThread().getId()); inBuffer.initialize(); devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR); return ProcessDataResult.PROCESSING_ERROR; } catch (Exception ex) { logger.error(STR, this.toString(), ex.getMessage()); printCommunicationInfo(inBuffer, lastSentData); inBuffer.clear(); devicesStates.setDeviceState(this.deviceName, receivedID, DeviceStates.DATA_ERROR); return ProcessDataResult.PROCESSING_ERROR; } } | /**
* Process incoming data
*
* @param inBuffer Buffer with receiver data
* @param lastSentData Last data sent to device
* @param forcedDeviceId Id that replace received one
*
* @return Return device ID or error code when lower than 0
*/ | Process incoming data | processData | {
"repo_name": "docbender/openhab",
"path": "bundles/binding/org.openhab.binding.simplebinary/src/main/java/org/openhab/binding/simplebinary/internal/SimpleBinaryGenericDevice.java",
"license": "epl-1.0",
"size": 50475
} | [
"java.io.PrintWriter",
"java.io.StringWriter",
"java.nio.BufferUnderflowException",
"org.openhab.binding.simplebinary.internal.SimpleBinaryDeviceState"
] | import java.io.PrintWriter; import java.io.StringWriter; import java.nio.BufferUnderflowException; import org.openhab.binding.simplebinary.internal.SimpleBinaryDeviceState; | import java.io.*; import java.nio.*; import org.openhab.binding.simplebinary.internal.*; | [
"java.io",
"java.nio",
"org.openhab.binding"
] | java.io; java.nio; org.openhab.binding; | 719,938 |
@Override
public boolean equals(Object aScanFile) {
if (this == aScanFile) return true;
if (!(aScanFile instanceof ScanContainer)) return false;
ScanContainer scanContainer = (ScanContainer) aScanFile;
// check data container meta information
if (this.getId().equals(scanContainer.getId())) {
if (this.getScanInfo().equals(scanContainer.getScanInfo())) {
int i = 0;
for (ScanLevel scanLevel : scanLevels) {
if (!scanLevel.equals(scanContainer.getScanLevels().get(i))) return false;
i++;
}
}
} else {
return false;
}
// check data container data
Scan scan;
for (ScanLevel level : this.getScanLevels()) {
for (int scanIndex : this.getScanNumbers(level.getMsn()).keySet()) {
scan = this.getScan(scanIndex);
if (!scan.equals(scanContainer.getScan(scanIndex))) return false;
}
}
return true;
} | boolean function(Object aScanFile) { if (this == aScanFile) return true; if (!(aScanFile instanceof ScanContainer)) return false; ScanContainer scanContainer = (ScanContainer) aScanFile; if (this.getId().equals(scanContainer.getId())) { if (this.getScanInfo().equals(scanContainer.getScanInfo())) { int i = 0; for (ScanLevel scanLevel : scanLevels) { if (!scanLevel.equals(scanContainer.getScanLevels().get(i))) return false; i++; } } } else { return false; } Scan scan; for (ScanLevel level : this.getScanLevels()) { for (int scanIndex : this.getScanNumbers(level.getMsn()).keySet()) { scan = this.getScan(scanIndex); if (!scan.equals(scanContainer.getScan(scanIndex))) return false; } } return true; } | /**
* Checks if two mass spec data container are identical.
*
* @param aScanFile the mass spec data container to be compared to
* @return boolean if the container is identical
*/ | Checks if two mass spec data container are identical | equals | {
"repo_name": "tomas-pluskal/masscascade",
"path": "MassCascadeCore/src/main/java/uk/ac/ebi/masscascade/core/container/file/scan/FileScanContainer.java",
"license": "gpl-3.0",
"size": 15650
} | [
"uk.ac.ebi.masscascade.core.scan.ScanLevel",
"uk.ac.ebi.masscascade.interfaces.Scan",
"uk.ac.ebi.masscascade.interfaces.container.ScanContainer"
] | import uk.ac.ebi.masscascade.core.scan.ScanLevel; import uk.ac.ebi.masscascade.interfaces.Scan; import uk.ac.ebi.masscascade.interfaces.container.ScanContainer; | import uk.ac.ebi.masscascade.core.scan.*; import uk.ac.ebi.masscascade.interfaces.*; import uk.ac.ebi.masscascade.interfaces.container.*; | [
"uk.ac.ebi"
] | uk.ac.ebi; | 2,724,257 |
public void testAddNull() {
ArrayDeque q = new ArrayDeque();
try {
q.add(null);
shouldThrow();
} catch (NullPointerException success) {}
} | void function() { ArrayDeque q = new ArrayDeque(); try { q.add(null); shouldThrow(); } catch (NullPointerException success) {} } | /**
* add(null) throws NPE
*/ | add(null) throws NPE | testAddNull | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "test/java/util/concurrent/tck/ArrayDequeTest.java",
"license": "gpl-2.0",
"size": 27210
} | [
"java.util.ArrayDeque"
] | import java.util.ArrayDeque; | import java.util.*; | [
"java.util"
] | java.util; | 1,693,678 |
public static StackId fromNameString(final String nameString,
final String defaultOwner,
final String defaultProject)
throws IllegalArgumentException {
final String[] names = nameString.split("::");
String owner = defaultOwner;
String project = defaultProject;
String stack = null;
if (names.length == 1) {
stack = names[0];
} else if (names.length == 2) {
project = names[0];
stack = names[1];
} else if (names.length == 3) {
owner = names[0];
project = names[1];
stack = names[2];
}
return new StackId(owner, project, stack);
}
private static final JsonUtils.Helper<StackId> JSON_HELPER =
new JsonUtils.Helper<>(StackId.class);
private static final CollectionNameUtil COLLECTION_NAME_UTIL = new CollectionNameUtil("render"); | static StackId function(final String nameString, final String defaultOwner, final String defaultProject) throws IllegalArgumentException { final String[] names = nameString.split("::"); String owner = defaultOwner; String project = defaultProject; String stack = null; if (names.length == 1) { stack = names[0]; } else if (names.length == 2) { project = names[0]; stack = names[1]; } else if (names.length == 3) { owner = names[0]; project = names[1]; stack = names[2]; } return new StackId(owner, project, stack); } private static final JsonUtils.Helper<StackId> JSON_HELPER = new JsonUtils.Helper<>(StackId.class); private static final CollectionNameUtil COLLECTION_NAME_UTIL = new CollectionNameUtil(STR); | /**
* Converts a name string with format <pre> owner::project::stack </pre> to a stack ID.
*
* @param nameString string with format owner::project::stack where owner and project components are optional.
* @param defaultOwner owner to use if not specified in name string.
* @param defaultProject project to use if not specified in name string.
*
* @return stack ID with components parsed from the specified name string.
*
* @throws IllegalArgumentException
* if the parsed stack ID is missing components or is otherwise invalid.
*/ | Converts a name string with format <code> owner::project::stack </code> to a stack ID | fromNameString | {
"repo_name": "fcollman/render",
"path": "render-app/src/main/java/org/janelia/alignment/spec/stack/StackId.java",
"license": "gpl-2.0",
"size": 4897
} | [
"org.janelia.alignment.json.JsonUtils",
"org.janelia.alignment.util.CollectionNameUtil"
] | import org.janelia.alignment.json.JsonUtils; import org.janelia.alignment.util.CollectionNameUtil; | import org.janelia.alignment.json.*; import org.janelia.alignment.util.*; | [
"org.janelia.alignment"
] | org.janelia.alignment; | 1,560,253 |
public long getNumMetrics() {
return this.doubleMetrics.size() + this.longMetrics.size()
+ this.stringMetrics.size();
}
public ReportEvent(ReportEvent e) {
super(new byte[0]);
Preconditions.checkNotNull(e);
this.merge(e);
}
public ReportEvent(String src) {
super(new byte[0]); // empty body
this.setStringMetric(R_NAME, src);
}
public ReportEvent(FlumeReport r) {
super(new byte[0]);
Preconditions.checkNotNull(r);
this.longMetrics.putAll(r.getLongMetrics());
this.stringMetrics.putAll(r.getStringMetrics());
this.doubleMetrics.putAll(r.getDoubleMetrics());
} | long function() { return this.doubleMetrics.size() + this.longMetrics.size() + this.stringMetrics.size(); } public ReportEvent(ReportEvent e) { super(new byte[0]); Preconditions.checkNotNull(e); this.merge(e); } public ReportEvent(String src) { super(new byte[0]); this.setStringMetric(R_NAME, src); } public ReportEvent(FlumeReport r) { super(new byte[0]); Preconditions.checkNotNull(r); this.longMetrics.putAll(r.getLongMetrics()); this.stringMetrics.putAll(r.getStringMetrics()); this.doubleMetrics.putAll(r.getDoubleMetrics()); } | /**
* Returns the total number of metrics. NOT THREAD SAFE.
*/ | Returns the total number of metrics. NOT THREAD SAFE | getNumMetrics | {
"repo_name": "hammer/flume",
"path": "src/java/com/cloudera/flume/reporter/ReportEvent.java",
"license": "apache-2.0",
"size": 14548
} | [
"com.cloudera.flume.reporter.server.FlumeReport",
"com.google.common.base.Preconditions"
] | import com.cloudera.flume.reporter.server.FlumeReport; import com.google.common.base.Preconditions; | import com.cloudera.flume.reporter.server.*; import com.google.common.base.*; | [
"com.cloudera.flume",
"com.google.common"
] | com.cloudera.flume; com.google.common; | 2,699,879 |
interface WithIpConfigurations {
Update withIpConfigurations(List<BastionHostIPConfiguration> ipConfigurations);
}
} | interface WithIpConfigurations { Update withIpConfigurations(List<BastionHostIPConfiguration> ipConfigurations); } } | /**
* Specifies ipConfigurations.
* @param ipConfigurations IP configuration of the Bastion Host resource
* @return the next update stage
*/ | Specifies ipConfigurations | withIpConfigurations | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_09_01/src/main/java/com/microsoft/azure/management/network/v2019_09_01/BastionHost.java",
"license": "mit",
"size": 4871
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,066,499 |
//-------------------------------------------------------------------------
public static String matches(Pattern pattern, String parameter, String name) {
notNull(pattern, "pattern");
notNull(parameter, name);
if (pattern.matcher(parameter).matches() == false) {
throw new IllegalArgumentException("Argument '" + name + "' must match pattern: " + pattern);
}
return parameter;
} | static String function(Pattern pattern, String parameter, String name) { notNull(pattern, STR); notNull(parameter, name); if (pattern.matcher(parameter).matches() == false) { throw new IllegalArgumentException(STR + name + STR + pattern); } return parameter; } | /**
* Checks that the specified parameter is non-null and matches the specified pattern.
* <p>
* Given the input parameter, this returns only if it is non-null and matches
* the regular expression pattern specified.
* For example, in a constructor:
* <pre>
* this.name = ArgChecker.matches(REGEX_NAME, name, "name");
* </pre>
*
* @param pattern the pattern to check against, not null
* @param parameter the parameter to check, null throws an exception
* @param name the name of the parameter to use in the error message, not null
* @return the input {@code parameter}, not null
* @throws IllegalArgumentException if the input is null or empty
*/ | Checks that the specified parameter is non-null and matches the specified pattern. Given the input parameter, this returns only if it is non-null and matches the regular expression pattern specified. For example, in a constructor: <code> this.name = ArgChecker.matches(REGEX_NAME, name, "name"); </code> | matches | {
"repo_name": "RobertoMalatesta/OpenSIMM",
"path": "src/main/java/com/opengamma/opensimm/util/ArgChecker.java",
"license": "apache-2.0",
"size": 31280
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,025,061 |
public static ReferenceType findPaymentMethodReference(DataService dataService, String paymentMethodName) {
PaymentMethod paymentMethod = findPaymentMethod(dataService, paymentMethodName);
ReferenceType referenceType = new ReferenceType();
referenceType.setValue(paymentMethod.getId());
return referenceType;
} | static ReferenceType function(DataService dataService, String paymentMethodName) { PaymentMethod paymentMethod = findPaymentMethod(dataService, paymentMethodName); ReferenceType referenceType = new ReferenceType(); referenceType.setValue(paymentMethod.getId()); return referenceType; } | /**
* Finds a QBO PaymentMethodReference by name
*
* @param dataService
* @param paymentMethodName
* @return
*/ | Finds a QBO PaymentMethodReference by name | findPaymentMethodReference | {
"repo_name": "linyumai/icon",
"path": "src/main/java/Account/QBOPurchaseHelper.java",
"license": "mit",
"size": 33090
} | [
"com.intuit.ipp.data.PaymentMethod",
"com.intuit.ipp.data.ReferenceType",
"com.intuit.ipp.services.DataService"
] | import com.intuit.ipp.data.PaymentMethod; import com.intuit.ipp.data.ReferenceType; import com.intuit.ipp.services.DataService; | import com.intuit.ipp.data.*; import com.intuit.ipp.services.*; | [
"com.intuit.ipp"
] | com.intuit.ipp; | 1,261,353 |
public int getM_Locator_ID()
{
if (m_M_Locator_ID != 0)
return m_M_Locator_ID;
//
String sql = "SELECT M_Locator_ID FROM M_Locator "
+ "WHERE M_Warehouse_ID=? AND IsActive='Y' ORDER BY IsDefault DESC, Created";
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, getM_Warehouse_ID());
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
m_M_Locator_ID = rs.getInt(1);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (SQLException ex)
{
log.error("getM_Locator_ID", ex);
}
try
{
if (pstmt != null)
pstmt.close ();
}
catch (SQLException ex1)
{
}
pstmt = null;
//
return m_M_Locator_ID;
} // getM_Locator_ID | int function() { if (m_M_Locator_ID != 0) return m_M_Locator_ID; + STR; PreparedStatement pstmt = null; try { pstmt = DB.prepareStatement (sql, null); pstmt.setInt (1, getM_Warehouse_ID()); ResultSet rs = pstmt.executeQuery (); if (rs.next ()) m_M_Locator_ID = rs.getInt(1); rs.close (); pstmt.close (); pstmt = null; } catch (SQLException ex) { log.error(STR, ex); } try { if (pstmt != null) pstmt.close (); } catch (SQLException ex1) { } pstmt = null; } | /**
* Get Default Locator (from Warehouse)
* @return locator
*/ | Get Default Locator (from Warehouse) | getM_Locator_ID | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.business/src/main/java-legacy/org/compiere/model/MTimeExpense.java",
"license": "gpl-2.0",
"size": 15337
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 902,958 |
TransactionDefinition td = new DefaultTransactionDefinition(
TransactionDefinition.PROPAGATION_REQUIRED);
public void insertRecordTest()
{
// start a new transaction
TransactionStatus ts = tm.getTransaction(td);
IndexProcessingType updateProcessingType = new IndexProcessingType(IndexProcessingTypeService.UPDATE);
indexProcessingTypeService.save(updateProcessingType);
IndexProcessingType deleteProcessingType = new IndexProcessingType(IndexProcessingTypeService.DELETE);
indexProcessingTypeService.save(deleteProcessingType);
IndexProcessingType insertProcessingType = new IndexProcessingType(IndexProcessingTypeService.INSERT);
indexProcessingTypeService.save(insertProcessingType);
tm.commit(ts);
ts = tm.getTransaction(td);
InstitutionalItemIndexProcessingRecord insertProcessingRecord = recordProcessingService.save(1l, insertProcessingType);
tm.commit(ts);
ts = tm.getTransaction(td);
assert recordProcessingService.get(1l, insertProcessingType) != null : "Should find record " + insertProcessingRecord;
InstitutionalItemIndexProcessingRecord update= recordProcessingService.save(1l, updateProcessingType);
tm.commit(ts);
ts = tm.getTransaction(td);
assert recordProcessingService.get(1l, insertProcessingType) != null : "Should find inser record after tyring update " + insertProcessingRecord;
assert recordProcessingService.get(1l, updateProcessingType) == null : "Should not find update record " + update;
tm.commit(ts);
ts = tm.getTransaction(td);
assert recordProcessingService.get(1l, insertProcessingType) != null : "Should find record after tyring no file change " + insertProcessingRecord;
InstitutionalItemIndexProcessingRecord deleteProcessingRecord = recordProcessingService.save(1l, deleteProcessingType);
tm.commit(ts);
ts = tm.getTransaction(td);
assert recordProcessingService.get(1l, insertProcessingType) == null : " Should not be able to find record " + insertProcessingRecord;
assert recordProcessingService.get(1l, deleteProcessingType) != null : "Should find record " + deleteProcessingRecord;
recordProcessingService.delete(recordProcessingService.get(deleteProcessingRecord.getId(), false));
indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.UPDATE));
indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.DELETE));
indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.INSERT));
tm.commit(ts);
}
| TransactionDefinition td = new DefaultTransactionDefinition( TransactionDefinition.PROPAGATION_REQUIRED); void function() { TransactionStatus ts = tm.getTransaction(td); IndexProcessingType updateProcessingType = new IndexProcessingType(IndexProcessingTypeService.UPDATE); indexProcessingTypeService.save(updateProcessingType); IndexProcessingType deleteProcessingType = new IndexProcessingType(IndexProcessingTypeService.DELETE); indexProcessingTypeService.save(deleteProcessingType); IndexProcessingType insertProcessingType = new IndexProcessingType(IndexProcessingTypeService.INSERT); indexProcessingTypeService.save(insertProcessingType); tm.commit(ts); ts = tm.getTransaction(td); InstitutionalItemIndexProcessingRecord insertProcessingRecord = recordProcessingService.save(1l, insertProcessingType); tm.commit(ts); ts = tm.getTransaction(td); assert recordProcessingService.get(1l, insertProcessingType) != null : STR + insertProcessingRecord; InstitutionalItemIndexProcessingRecord update= recordProcessingService.save(1l, updateProcessingType); tm.commit(ts); ts = tm.getTransaction(td); assert recordProcessingService.get(1l, insertProcessingType) != null : STR + insertProcessingRecord; assert recordProcessingService.get(1l, updateProcessingType) == null : STR + update; tm.commit(ts); ts = tm.getTransaction(td); assert recordProcessingService.get(1l, insertProcessingType) != null : STR + insertProcessingRecord; InstitutionalItemIndexProcessingRecord deleteProcessingRecord = recordProcessingService.save(1l, deleteProcessingType); tm.commit(ts); ts = tm.getTransaction(td); assert recordProcessingService.get(1l, insertProcessingType) == null : STR + insertProcessingRecord; assert recordProcessingService.get(1l, deleteProcessingType) != null : STR + deleteProcessingRecord; recordProcessingService.delete(recordProcessingService.get(deleteProcessingRecord.getId(), false)); indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.UPDATE)); indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.DELETE)); indexProcessingTypeService.delete(indexProcessingTypeService.get(IndexProcessingTypeService.INSERT)); tm.commit(ts); } | /**
* Test setting records
*
*/ | Test setting records | insertRecordTest | {
"repo_name": "nate-rcl/irplus",
"path": "ir_service/test/edu/ur/ir/institution/service/DefaultInstitutionalItemIndexProcessingRecordServiceTest.java",
"license": "apache-2.0",
"size": 6551
} | [
"edu.ur.ir.index.IndexProcessingType",
"edu.ur.ir.index.IndexProcessingTypeService",
"edu.ur.ir.institution.InstitutionalItemIndexProcessingRecord",
"org.springframework.transaction.TransactionDefinition",
"org.springframework.transaction.TransactionStatus",
"org.springframework.transaction.support.DefaultTransactionDefinition"
] | import edu.ur.ir.index.IndexProcessingType; import edu.ur.ir.index.IndexProcessingTypeService; import edu.ur.ir.institution.InstitutionalItemIndexProcessingRecord; import org.springframework.transaction.TransactionDefinition; import org.springframework.transaction.TransactionStatus; import org.springframework.transaction.support.DefaultTransactionDefinition; | import edu.ur.ir.index.*; import edu.ur.ir.institution.*; import org.springframework.transaction.*; import org.springframework.transaction.support.*; | [
"edu.ur.ir",
"org.springframework.transaction"
] | edu.ur.ir; org.springframework.transaction; | 2,224,067 |
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedIterable<OperationInner> list() {
return new PagedIterable<>(listAsync());
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<OperationInner> function() { return new PagedIterable<>(listAsync()); } | /**
* Lists all of the available Event Hub REST API operations.
*
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the request to list Event Hub operations.
*/ | Lists all of the available Event Hub REST API operations | list | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-eventhubs/src/main/java/com/azure/resourcemanager/eventhubs/implementation/OperationsClientImpl.java",
"license": "mit",
"size": 12182
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.resourcemanager.eventhubs.fluent.models.OperationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.resourcemanager.eventhubs.fluent.models.OperationInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.eventhubs.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,569,204 |
public List<DisplayConstraintOption> getBagOps() {
List<DisplayConstraintOption> bagOps = new ArrayList<DisplayConstraintOption>();
for (ConstraintOp op : BagConstraint.VALID_OPS) {
bagOps.add(new DisplayConstraintOption(op.toString(), op.getIndex()));
}
return bagOps;
} | List<DisplayConstraintOption> function() { List<DisplayConstraintOption> bagOps = new ArrayList<DisplayConstraintOption>(); for (ConstraintOp op : BagConstraint.VALID_OPS) { bagOps.add(new DisplayConstraintOption(op.toString(), op.getIndex())); } return bagOps; } | /**
* Return the valid constraint ops when constraining on a bag.
* @return the possible bag constraint operations
*/ | Return the valid constraint ops when constraining on a bag | getBagOps | {
"repo_name": "drhee/toxoMine",
"path": "intermine/web/main/src/org/intermine/web/logic/query/DisplayConstraint.java",
"license": "lgpl-2.1",
"size": 33874
} | [
"java.util.ArrayList",
"java.util.List",
"org.intermine.objectstore.query.BagConstraint",
"org.intermine.objectstore.query.ConstraintOp"
] | import java.util.ArrayList; import java.util.List; import org.intermine.objectstore.query.BagConstraint; import org.intermine.objectstore.query.ConstraintOp; | import java.util.*; import org.intermine.objectstore.query.*; | [
"java.util",
"org.intermine.objectstore"
] | java.util; org.intermine.objectstore; | 1,143,492 |
private void initView()
{
view = new JPanel();
view.setBorder(new EmptyBorder(5, 5, 5, 5));
JLabel lblAddPreviouslySelected = new JLabel("Add Previously Selected Food");
lblAddPreviouslySelected.setFont(new Font("Maiandra GD", Font.BOLD, 17));
JLabel lblSelectFood = new JLabel("Select Food: ");
foodController = new FoodController(null);
String[] myStringArray = foodController.getListOfFoods();
listOfFoods = new JComboBox(myStringArray);
JLabel lblNumberOfServings = new JLabel("Number of Servings: ");
numberOfServings = new JTextField();
numberOfServings.setColumns(10);
JButton btnAddFood = new JButton("Add Food");
GroupLayout gl_contentPane = new GroupLayout(view);
gl_contentPane.setHorizontalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(103)
.addComponent(lblAddPreviouslySelected))
.addGroup(gl_contentPane.createSequentialGroup()
.addGap(78)
.addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(lblSelectFood)
.addGap(18)
.addComponent(listOfFoods, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE))
.addGroup(gl_contentPane.createSequentialGroup()
.addComponent(lblNumberOfServings)
.addPreferredGap(ComponentPlacement.UNRELATED)
.addComponent(numberOfServings, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE))
.addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup()
.addComponent(btnAddFood, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE)
.addGap(74)))))
.addContainerGap(88, Short.MAX_VALUE))
);
gl_contentPane.setVerticalGroup(
gl_contentPane.createParallelGroup(Alignment.LEADING)
.addGroup(gl_contentPane.createSequentialGroup()
.addContainerGap()
.addComponent(lblAddPreviouslySelected)
.addGap(70)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblSelectFood)
.addComponent(listOfFoods, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(78)
.addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
.addComponent(lblNumberOfServings)
.addComponent(numberOfServings, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
.addGap(94)
.addComponent(btnAddFood, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)
.addContainerGap(123, Short.MAX_VALUE))
);
view.setLayout(gl_contentPane);
btnAddFood.addActionListener(this);
btnAddFood.setActionCommand("add");
} | void function() { view = new JPanel(); view.setBorder(new EmptyBorder(5, 5, 5, 5)); JLabel lblAddPreviouslySelected = new JLabel(STR); lblAddPreviouslySelected.setFont(new Font(STR, Font.BOLD, 17)); JLabel lblSelectFood = new JLabel(STR); foodController = new FoodController(null); String[] myStringArray = foodController.getListOfFoods(); listOfFoods = new JComboBox(myStringArray); JLabel lblNumberOfServings = new JLabel(STR); numberOfServings = new JTextField(); numberOfServings.setColumns(10); JButton btnAddFood = new JButton(STR); GroupLayout gl_contentPane = new GroupLayout(view); gl_contentPane.setHorizontalGroup( gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addGap(103) .addComponent(lblAddPreviouslySelected)) .addGroup(gl_contentPane.createSequentialGroup() .addGap(78) .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addComponent(lblSelectFood) .addGap(18) .addComponent(listOfFoods, GroupLayout.PREFERRED_SIZE, 177, GroupLayout.PREFERRED_SIZE)) .addGroup(gl_contentPane.createSequentialGroup() .addComponent(lblNumberOfServings) .addPreferredGap(ComponentPlacement.UNRELATED) .addComponent(numberOfServings, GroupLayout.PREFERRED_SIZE, 63, GroupLayout.PREFERRED_SIZE)) .addGroup(Alignment.TRAILING, gl_contentPane.createSequentialGroup() .addComponent(btnAddFood, GroupLayout.PREFERRED_SIZE, 97, GroupLayout.PREFERRED_SIZE) .addGap(74))))) .addContainerGap(88, Short.MAX_VALUE)) ); gl_contentPane.setVerticalGroup( gl_contentPane.createParallelGroup(Alignment.LEADING) .addGroup(gl_contentPane.createSequentialGroup() .addContainerGap() .addComponent(lblAddPreviouslySelected) .addGap(70) .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) .addComponent(lblSelectFood) .addComponent(listOfFoods, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(78) .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE) .addComponent(lblNumberOfServings) .addComponent(numberOfServings, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(94) .addComponent(btnAddFood, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE) .addContainerGap(123, Short.MAX_VALUE)) ); view.setLayout(gl_contentPane); btnAddFood.addActionListener(this); btnAddFood.setActionCommand("add"); } | /**
* Initializes the view by declaring necessary components for the window and placing them correctly in the window boundaries.
*/ | Initializes the view by declaring necessary components for the window and placing them correctly in the window boundaries | initView | {
"repo_name": "rick4470/jCounter",
"path": "jCounter/src/view/ExistingFoodView.java",
"license": "mit",
"size": 6189
} | [
"java.awt.Font",
"javax.swing.GroupLayout",
"javax.swing.JButton",
"javax.swing.JComboBox",
"javax.swing.JLabel",
"javax.swing.JPanel",
"javax.swing.JTextField",
"javax.swing.LayoutStyle",
"javax.swing.border.EmptyBorder"
] | import java.awt.Font; import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.LayoutStyle; import javax.swing.border.EmptyBorder; | import java.awt.*; import javax.swing.*; import javax.swing.border.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 741,992 |
@Override
public void headAction(Node[] args, int length, RuleContext context) {
if (context.getGraph() instanceof FBRuleInfGraph) {
Triple t = new Triple(args[0], args[1], args[2]);
((FBRuleInfGraph)context.getGraph()).addDeduction(t);
} else {
throw new BuiltinException(this, context, "Only usable in FBrule graphs");
}
}
} | void function(Node[] args, int length, RuleContext context) { if (context.getGraph() instanceof FBRuleInfGraph) { Triple t = new Triple(args[0], args[1], args[2]); ((FBRuleInfGraph)context.getGraph()).addDeduction(t); } else { throw new BuiltinException(this, context, STR); } } } | /**
* This method is invoked when the builtin is called in a rule head.
* Such a use is only valid in a forward rule.
* @param args the array of argument values for the builtin, this is an array
* of Nodes.
* @param length the length of the argument list, may be less than the length of the args array
* for some rule engines
* @param context an execution context giving access to other relevant data
*/ | This method is invoked when the builtin is called in a rule head. Such a use is only valid in a forward rule | headAction | {
"repo_name": "apache/jena",
"path": "jena-cmds/src/main/java/jena/RuleMap.java",
"license": "apache-2.0",
"size": 7838
} | [
"org.apache.jena.graph.Node",
"org.apache.jena.graph.Triple"
] | import org.apache.jena.graph.Node; import org.apache.jena.graph.Triple; | import org.apache.jena.graph.*; | [
"org.apache.jena"
] | org.apache.jena; | 1,932,205 |
public String getBizContent() {
return this.bizContent;
}
private String terminalType;
private String terminalInfo;
private String prodCode;
private String notifyUrl;
private String returnUrl;
private boolean needEncrypt=false;
private AlipayObject bizModel=null; | String function() { return this.bizContent; } private String terminalType; private String terminalInfo; private String prodCode; private String notifyUrl; private String returnUrl; private boolean needEncrypt=false; private AlipayObject bizModel=null; | /**
* <p>Getter for the field <code>bizContent</code>.</p>
*
* @return a {@link java.lang.String} object.
*/ | Getter for the field <code>bizContent</code> | getBizContent | {
"repo_name": "NotFound403/WePay",
"path": "src/main/java/cn/felord/wepay/ali/sdk/api/request/AlipayMarketingCashlessvoucherTemplateModifyRequest.java",
"license": "apache-2.0",
"size": 4902
} | [
"cn.felord.wepay.ali.sdk.api.AlipayObject"
] | import cn.felord.wepay.ali.sdk.api.AlipayObject; | import cn.felord.wepay.ali.sdk.api.*; | [
"cn.felord.wepay"
] | cn.felord.wepay; | 1,293,317 |
public String getAllStateCodes() {
if(StringUtils.isEmpty(allStateCodes)) {
final List<State> codes = getStateService().findAllStatesInCountry(KFSConstants.COUNTRY_CODE_UNITED_STATES);
final StringBuffer sb = new StringBuffer();
sb.append(";").append(KFSConstants.COUNTRY_CODE_UNITED_STATES.toUpperCase()).append(";");
for (final State state : codes) {
if(state.isActive()) {
sb.append(state.getCode().toUpperCase()).append( ";");
}
}
allStateCodes = sb.toString();
}
return allStateCodes;
}
| String function() { if(StringUtils.isEmpty(allStateCodes)) { final List<State> codes = getStateService().findAllStatesInCountry(KFSConstants.COUNTRY_CODE_UNITED_STATES); final StringBuffer sb = new StringBuffer(); sb.append(";").append(KFSConstants.COUNTRY_CODE_UNITED_STATES.toUpperCase()).append(";"); for (final State state : codes) { if(state.isActive()) { sb.append(state.getCode().toUpperCase()).append( ";"); } } allStateCodes = sb.toString(); } return allStateCodes; } | /**
* Gets the allStateCodes attribute.
* @return Returns the allStateCodes.
*/ | Gets the allStateCodes attribute | getAllStateCodes | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/tem/service/impl/PerDiemServiceImpl.java",
"license": "agpl-3.0",
"size": 36338
} | [
"java.util.List",
"org.apache.commons.lang.StringUtils",
"org.kuali.kfs.sys.KFSConstants",
"org.kuali.rice.location.api.state.State"
] | import java.util.List; import org.apache.commons.lang.StringUtils; import org.kuali.kfs.sys.KFSConstants; import org.kuali.rice.location.api.state.State; | import java.util.*; import org.apache.commons.lang.*; import org.kuali.kfs.sys.*; import org.kuali.rice.location.api.state.*; | [
"java.util",
"org.apache.commons",
"org.kuali.kfs",
"org.kuali.rice"
] | java.util; org.apache.commons; org.kuali.kfs; org.kuali.rice; | 37,625 |
@Override
protected boolean validatePage() {
if (super.validatePage()) {
String extension = new Path(getFileName()).getFileExtension();
if (extension == null || !FILE_EXTENSIONS.contains(extension)) {
String key = FILE_EXTENSIONS.size() > 1 ? "_WARN_FilenameExtensions" : "_WARN_FilenameExtension";
setErrorMessage(SELEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS }));
return false;
}
return true;
}
return false;
} | boolean function() { if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); if (extension == null !FILE_EXTENSIONS.contains(extension)) { String key = FILE_EXTENSIONS.size() > 1 ? STR : STR; setErrorMessage(SELEditorPlugin.INSTANCE.getString(key, new Object [] { FORMATTED_FILE_EXTENSIONS })); return false; } return true; } return false; } | /**
* The framework calls this to see if the file is correct.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | The framework calls this to see if the file is correct. | validatePage | {
"repo_name": "afraisse/BrowserAutomationDSL",
"path": "Selenium.editor/src/org/xtext/emn/selenium/sel/presentation/SelModelWizard.java",
"license": "gpl-3.0",
"size": 17543
} | [
"org.eclipse.core.runtime.Path"
] | import org.eclipse.core.runtime.Path; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 2,356,401 |
@Override
protected AxisSpace calculateAxisSpace(Graphics2D g2,
Rectangle2D plotArea) {
AxisSpace space = new AxisSpace();
PlotOrientation orientation = getOrientation();
// work out the space required by the domain axis...
AxisSpace fixed = getFixedDomainAxisSpace();
if (fixed != null) {
if (orientation == PlotOrientation.HORIZONTAL) {
space.setLeft(fixed.getLeft());
space.setRight(fixed.getRight());
}
else if (orientation == PlotOrientation.VERTICAL) {
space.setTop(fixed.getTop());
space.setBottom(fixed.getBottom());
}
}
else {
CategoryAxis categoryAxis = getDomainAxis();
RectangleEdge categoryEdge = Plot.resolveDomainAxisLocation(
getDomainAxisLocation(), orientation);
if (categoryAxis != null) {
space = categoryAxis.reserveSpace(g2, this, plotArea,
categoryEdge, space);
}
else {
if (getDrawSharedDomainAxis()) {
space = getDomainAxis().reserveSpace(g2, this, plotArea,
categoryEdge, space);
}
}
}
Rectangle2D adjustedPlotArea = space.shrink(plotArea, null);
// work out the maximum height or width of the non-shared axes...
int n = this.subplots.size();
int totalWeight = 0;
for (int i = 0; i < n; i++) {
CategoryPlot sub = (CategoryPlot) this.subplots.get(i);
totalWeight += sub.getWeight();
}
this.subplotAreas = new Rectangle2D[n];
double x = adjustedPlotArea.getX();
double y = adjustedPlotArea.getY();
double usableSize = 0.0;
if (orientation == PlotOrientation.HORIZONTAL) {
usableSize = adjustedPlotArea.getWidth() - this.gap * (n - 1);
}
else if (orientation == PlotOrientation.VERTICAL) {
usableSize = adjustedPlotArea.getHeight() - this.gap * (n - 1);
}
for (int i = 0; i < n; i++) {
CategoryPlot plot = (CategoryPlot) this.subplots.get(i);
// calculate sub-plot area
if (orientation == PlotOrientation.HORIZONTAL) {
double w = usableSize * plot.getWeight() / totalWeight;
this.subplotAreas[i] = new Rectangle2D.Double(x, y, w,
adjustedPlotArea.getHeight());
x = x + w + this.gap;
}
else if (orientation == PlotOrientation.VERTICAL) {
double h = usableSize * plot.getWeight() / totalWeight;
this.subplotAreas[i] = new Rectangle2D.Double(x, y,
adjustedPlotArea.getWidth(), h);
y = y + h + this.gap;
}
AxisSpace subSpace = plot.calculateRangeAxisSpace(g2,
this.subplotAreas[i], null);
space.ensureAtLeast(subSpace);
}
return space;
}
| AxisSpace function(Graphics2D g2, Rectangle2D plotArea) { AxisSpace space = new AxisSpace(); PlotOrientation orientation = getOrientation(); AxisSpace fixed = getFixedDomainAxisSpace(); if (fixed != null) { if (orientation == PlotOrientation.HORIZONTAL) { space.setLeft(fixed.getLeft()); space.setRight(fixed.getRight()); } else if (orientation == PlotOrientation.VERTICAL) { space.setTop(fixed.getTop()); space.setBottom(fixed.getBottom()); } } else { CategoryAxis categoryAxis = getDomainAxis(); RectangleEdge categoryEdge = Plot.resolveDomainAxisLocation( getDomainAxisLocation(), orientation); if (categoryAxis != null) { space = categoryAxis.reserveSpace(g2, this, plotArea, categoryEdge, space); } else { if (getDrawSharedDomainAxis()) { space = getDomainAxis().reserveSpace(g2, this, plotArea, categoryEdge, space); } } } Rectangle2D adjustedPlotArea = space.shrink(plotArea, null); int n = this.subplots.size(); int totalWeight = 0; for (int i = 0; i < n; i++) { CategoryPlot sub = (CategoryPlot) this.subplots.get(i); totalWeight += sub.getWeight(); } this.subplotAreas = new Rectangle2D[n]; double x = adjustedPlotArea.getX(); double y = adjustedPlotArea.getY(); double usableSize = 0.0; if (orientation == PlotOrientation.HORIZONTAL) { usableSize = adjustedPlotArea.getWidth() - this.gap * (n - 1); } else if (orientation == PlotOrientation.VERTICAL) { usableSize = adjustedPlotArea.getHeight() - this.gap * (n - 1); } for (int i = 0; i < n; i++) { CategoryPlot plot = (CategoryPlot) this.subplots.get(i); if (orientation == PlotOrientation.HORIZONTAL) { double w = usableSize * plot.getWeight() / totalWeight; this.subplotAreas[i] = new Rectangle2D.Double(x, y, w, adjustedPlotArea.getHeight()); x = x + w + this.gap; } else if (orientation == PlotOrientation.VERTICAL) { double h = usableSize * plot.getWeight() / totalWeight; this.subplotAreas[i] = new Rectangle2D.Double(x, y, adjustedPlotArea.getWidth(), h); y = y + h + this.gap; } AxisSpace subSpace = plot.calculateRangeAxisSpace(g2, this.subplotAreas[i], null); space.ensureAtLeast(subSpace); } return space; } | /**
* Calculates the space required for the axes.
*
* @param g2 the graphics device.
* @param plotArea the plot area.
*
* @return The space required for the axes.
*/ | Calculates the space required for the axes | calculateAxisSpace | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/plot/CombinedDomainCategoryPlot.java",
"license": "lgpl-2.1",
"size": 23480
} | [
"java.awt.Graphics2D",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.api.RectangleEdge",
"org.jfree.chart.axis.AxisSpace",
"org.jfree.chart.axis.CategoryAxis"
] | import java.awt.Graphics2D; import java.awt.geom.Rectangle2D; import org.jfree.chart.api.RectangleEdge; import org.jfree.chart.axis.AxisSpace; import org.jfree.chart.axis.CategoryAxis; | import java.awt.*; import java.awt.geom.*; import org.jfree.chart.api.*; import org.jfree.chart.axis.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 1,535,980 |
public static int nextBiomeID()
{
for (int id = nextBiomeID; id < 256; id++)
{
if (BiomeGenBase.getBiomeGenArray()[id] == null)
{
nextBiomeID = id;
System.out.println("Found next Biome ID: " + nextBiomeID);
return nextBiomeID;
}
}
return -1;
} | static int function() { for (int id = nextBiomeID; id < 256; id++) { if (BiomeGenBase.getBiomeGenArray()[id] == null) { nextBiomeID = id; System.out.println(STR + nextBiomeID); return nextBiomeID; } } return -1; } | /**
* Gets the next free biome ID
*/ | Gets the next free biome ID | nextBiomeID | {
"repo_name": "MinestrapTeam/Minestrappolation-4",
"path": "src/main/java/minestrapteam/mods/minestrappolation/world/MBiomeManager.java",
"license": "gpl-3.0",
"size": 1837
} | [
"net.minecraft.world.biome.BiomeGenBase"
] | import net.minecraft.world.biome.BiomeGenBase; | import net.minecraft.world.biome.*; | [
"net.minecraft.world"
] | net.minecraft.world; | 2,167,349 |
public static void clearPlan(Category cat) {
TheBootPlans.remove(cat);
} | static void function(Category cat) { TheBootPlans.remove(cat); } | /**
* Throw out any plan associated with cat.
*/ | Throw out any plan associated with cat | clearPlan | {
"repo_name": "jonesd/udanax-gold2java",
"path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/cobbler/Connection.java",
"license": "mit",
"size": 4666
} | [
"info.dgjones.abora.gold.xpp.basic.Category"
] | import info.dgjones.abora.gold.xpp.basic.Category; | import info.dgjones.abora.gold.xpp.basic.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 1,807,770 |
protected static EncodedStringValue parseEncodedStringValue(ByteArrayInputStream pduDataStream){
assert(null != pduDataStream);
pduDataStream.mark(1);
EncodedStringValue returnValue = null;
int charset = 0;
int temp = pduDataStream.read();
assert(-1 != temp);
int first = temp & 0xFF;
pduDataStream.reset();
if (first < TEXT_MIN) {
parseValueLength(pduDataStream);
charset = parseShortInteger(pduDataStream); //get the "Charset"
}
byte[] textString = parseWapString(pduDataStream, TYPE_TEXT_STRING);
try {
if (0 != charset) {
returnValue = new EncodedStringValue(charset, textString);
} else {
returnValue = new EncodedStringValue(textString);
}
} catch(Exception e) {
return null;
}
return returnValue;
} | static EncodedStringValue function(ByteArrayInputStream pduDataStream){ assert(null != pduDataStream); pduDataStream.mark(1); EncodedStringValue returnValue = null; int charset = 0; int temp = pduDataStream.read(); assert(-1 != temp); int first = temp & 0xFF; pduDataStream.reset(); if (first < TEXT_MIN) { parseValueLength(pduDataStream); charset = parseShortInteger(pduDataStream); } byte[] textString = parseWapString(pduDataStream, TYPE_TEXT_STRING); try { if (0 != charset) { returnValue = new EncodedStringValue(charset, textString); } else { returnValue = new EncodedStringValue(textString); } } catch(Exception e) { return null; } return returnValue; } | /**
* Parse encoded string value.
*
* @param pduDataStream pdu data input stream
* @return the EncodedStringValue
*/ | Parse encoded string value | parseEncodedStringValue | {
"repo_name": "mateor/pdroid",
"path": "android-4.0.3_r1/trunk/frameworks/base/core/java/com/google/android/mms/pdu/PduParser.java",
"license": "gpl-3.0",
"size": 75489
} | [
"java.io.ByteArrayInputStream"
] | import java.io.ByteArrayInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,554,376 |
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mNum = getArguments() != null ? getArguments().getInt("num") : 1;
} | void function(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mNum = getArguments() != null ? getArguments().getInt("num") : 1; } | /**
* When creating, retrieve this instance's number from its arguments.
*/ | When creating, retrieve this instance's number from its arguments | onCreate | {
"repo_name": "aosp-mirror/platform_frameworks_support",
"path": "samples/Support4Demos/src/main/java/com/example/android/supportv4/app/FragmentStackSupport.java",
"license": "apache-2.0",
"size": 4944
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 2,537,823 |
@Override
public int update(Uri uri, ContentValues values, String selection,
String[] selectionArgs) {
if( ! initializeDB() ) {
Log.w(AUTHORITY,"Database unavailable...");
return 0;
}
int count = 0;
switch (sUriMatcher.match(uri)) {
case BT_DEV:
count = database.update(DATABASE_TABLES[0], values, selection,
selectionArgs);
break;
case BT_DATA:
count = database.update(DATABASE_TABLES[1], values, selection,
selectionArgs);
break;
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
getContext().getContentResolver().notifyChange(uri, null);
return count;
} | int function(Uri uri, ContentValues values, String selection, String[] selectionArgs) { if( ! initializeDB() ) { Log.w(AUTHORITY,STR); return 0; } int count = 0; switch (sUriMatcher.match(uri)) { case BT_DEV: count = database.update(DATABASE_TABLES[0], values, selection, selectionArgs); break; case BT_DATA: count = database.update(DATABASE_TABLES[1], values, selection, selectionArgs); break; default: throw new IllegalArgumentException(STR + uri); } getContext().getContentResolver().notifyChange(uri, null); return count; } | /**
* Update bluetooth on the database
*/ | Update bluetooth on the database | update | {
"repo_name": "cluo29/com.aware.plugin.motionacceleration-",
"path": "aware-core/src/main/java/com/aware/providers/Bluetooth_Provider.java",
"license": "apache-2.0",
"size": 11203
} | [
"android.content.ContentValues",
"android.net.Uri",
"android.util.Log"
] | import android.content.ContentValues; import android.net.Uri; import android.util.Log; | import android.content.*; import android.net.*; import android.util.*; | [
"android.content",
"android.net",
"android.util"
] | android.content; android.net; android.util; | 2,243,170 |
@Override
public Response applicationsPost(ApplicationDTO body, String contentType) {
String username = RestApiUtil.getLoggedInUsername();
try {
APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username);
//subscriber field of the body is not honored. It is taken from the context
Application application = ApplicationMappingUtil.fromDTOtoApplication(body, username);
//setting the proper groupId. This is not honored for now.
// Later we can honor it by checking admin privileges of the user.
String groupId = RestAPIStoreUtils.getLoggedInUserGroupIds();
application.setGroupId(groupId);
int applicationId = apiConsumer.addApplication(application, username);
//retrieves the created application and send as the response
Application createdApplication = apiConsumer.getApplicationById(applicationId);
ApplicationDTO createdApplicationDTO = ApplicationMappingUtil.fromApplicationtoDTO(createdApplication);
//to be set as the Location header
URI location = new URI(RestApiConstants.RESOURCE_PATH_APPLICATIONS + "/" +
createdApplicationDTO.getApplicationId());
return Response.created(location).entity(createdApplicationDTO).build();
} catch (APIManagementException | URISyntaxException e) {
if (RestApiUtil.isDueToResourceAlreadyExists(e)) {
//todo: should we add debug/info logs
throw RestApiUtil.buildConflictException("An application already exists with name " + body.getName());
} else {
handleException("Error while adding a new application for the user " + username, e);
return null;
}
}
} | Response function(ApplicationDTO body, String contentType) { String username = RestApiUtil.getLoggedInUsername(); try { APIConsumer apiConsumer = APIManagerFactory.getInstance().getAPIConsumer(username); Application application = ApplicationMappingUtil.fromDTOtoApplication(body, username); String groupId = RestAPIStoreUtils.getLoggedInUserGroupIds(); application.setGroupId(groupId); int applicationId = apiConsumer.addApplication(application, username); Application createdApplication = apiConsumer.getApplicationById(applicationId); ApplicationDTO createdApplicationDTO = ApplicationMappingUtil.fromApplicationtoDTO(createdApplication); URI location = new URI(RestApiConstants.RESOURCE_PATH_APPLICATIONS + "/" + createdApplicationDTO.getApplicationId()); return Response.created(location).entity(createdApplicationDTO).build(); } catch (APIManagementException URISyntaxException e) { if (RestApiUtil.isDueToResourceAlreadyExists(e)) { throw RestApiUtil.buildConflictException(STR + body.getName()); } else { handleException(STR + username, e); return null; } } } | /**
* Creates a new application
*
* @param body request body containing application details
* @param contentType Content-Type header value
* @return 201 response if successful
*/ | Creates a new application | applicationsPost | {
"repo_name": "madusankapremaratne/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store/src/main/java/org/wso2/carbon/apimgt/rest/api/store/impl/ApplicationsApiServiceImpl.java",
"license": "apache-2.0",
"size": 14809
} | [
"java.net.URISyntaxException",
"javax.ws.rs.core.Response",
"org.wso2.carbon.apimgt.api.APIConsumer",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.Application",
"org.wso2.carbon.apimgt.impl.APIManagerFactory",
"org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationDTO",
"org.wso2.carbon.apimgt.rest.api.store.utils.RestAPIStoreUtils",
"org.wso2.carbon.apimgt.rest.api.store.utils.mappings.ApplicationMappingUtil",
"org.wso2.carbon.apimgt.rest.api.util.RestApiConstants",
"org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil"
] | import java.net.URISyntaxException; import javax.ws.rs.core.Response; import org.wso2.carbon.apimgt.api.APIConsumer; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.Application; import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.rest.api.store.dto.ApplicationDTO; import org.wso2.carbon.apimgt.rest.api.store.utils.RestAPIStoreUtils; import org.wso2.carbon.apimgt.rest.api.store.utils.mappings.ApplicationMappingUtil; import org.wso2.carbon.apimgt.rest.api.util.RestApiConstants; import org.wso2.carbon.apimgt.rest.api.util.utils.RestApiUtil; | import java.net.*; import javax.ws.rs.core.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.*; import org.wso2.carbon.apimgt.rest.api.store.dto.*; import org.wso2.carbon.apimgt.rest.api.store.utils.*; import org.wso2.carbon.apimgt.rest.api.store.utils.mappings.*; import org.wso2.carbon.apimgt.rest.api.util.*; import org.wso2.carbon.apimgt.rest.api.util.utils.*; | [
"java.net",
"javax.ws",
"org.wso2.carbon"
] | java.net; javax.ws; org.wso2.carbon; | 2,046,195 |
public boolean invokeContextMenuAction(Activity targetActivity, int id, int flag) {
validateNotAppThread();
// Bring up context menu for current focus.
// It'd be nice to do this through code, but currently ListView depends on
// long press to set metadata for its selected child
final KeyEvent downEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_CENTER);
sendKeySync(downEvent);
// Need to wait for long press
waitForIdleSync();
try {
Thread.sleep(ViewConfiguration.getLongPressTimeout());
} catch (InterruptedException e) {
Log.e(TAG, "Could not sleep for long press timeout", e);
return false;
}
final KeyEvent upEvent = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_CENTER);
sendKeySync(upEvent);
// Wait for context menu to appear
waitForIdleSync();
class ContextMenuRunnable implements Runnable {
private final Activity activity;
private final int identifier;
private final int flags;
boolean returnValue;
public ContextMenuRunnable(Activity _activity, int _identifier,
int _flags) {
activity = _activity;
identifier = _identifier;
flags = _flags;
} | boolean function(Activity targetActivity, int id, int flag) { validateNotAppThread(); final KeyEvent downEvent = new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_DPAD_CENTER); sendKeySync(downEvent); waitForIdleSync(); try { Thread.sleep(ViewConfiguration.getLongPressTimeout()); } catch (InterruptedException e) { Log.e(TAG, STR, e); return false; } final KeyEvent upEvent = new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_DPAD_CENTER); sendKeySync(upEvent); waitForIdleSync(); class ContextMenuRunnable implements Runnable { private final Activity activity; private final int identifier; private final int flags; boolean returnValue; public ContextMenuRunnable(Activity _activity, int _identifier, int _flags) { activity = _activity; identifier = _identifier; flags = _flags; } | /**
* Show the context menu for the currently focused view and executes a
* particular context menu item.
*
* @param targetActivity The activity in question.
* @param id The identifier associated with the context menu item.
* @param flag Additional flags, if any.
* @return Whether the invocation was successful (for example, it could be
* false if item is disabled).
*/ | Show the context menu for the currently focused view and executes a particular context menu item | invokeContextMenuAction | {
"repo_name": "ketanbj/eapps",
"path": "android/frameworks/base/core/java/android/app/Instrumentation.java",
"license": "mit",
"size": 77837
} | [
"android.util.Log",
"android.view.KeyEvent",
"android.view.ViewConfiguration"
] | import android.util.Log; import android.view.KeyEvent; import android.view.ViewConfiguration; | import android.util.*; import android.view.*; | [
"android.util",
"android.view"
] | android.util; android.view; | 2,363,319 |
@Override
public void lookupRepositoryReferences( Repository repository ) throws KettleException {
// The correct reference is stored in the trans name and directory attributes...
//
RepositoryDirectoryInterface repositoryDirectoryInterface =
RepositoryImportLocation.getRepositoryImportLocation().findDirectory( directory );
transObjectId = repository.getTransformationID( transname, repositoryDirectoryInterface );
} | void function( Repository repository ) throws KettleException { RepositoryImportLocation.getRepositoryImportLocation().findDirectory( directory ); transObjectId = repository.getTransformationID( transname, repositoryDirectoryInterface ); } | /**
* Look up the references after import
*
* @param repository the repository to reference.
*/ | Look up the references after import | lookupRepositoryReferences | {
"repo_name": "emartin-pentaho/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/job/entries/trans/JobEntryTrans.java",
"license": "apache-2.0",
"size": 69447
} | [
"org.pentaho.di.core.exception.KettleException",
"org.pentaho.di.repository.Repository",
"org.pentaho.di.repository.RepositoryImportLocation"
] | import org.pentaho.di.core.exception.KettleException; import org.pentaho.di.repository.Repository; import org.pentaho.di.repository.RepositoryImportLocation; | import org.pentaho.di.core.exception.*; import org.pentaho.di.repository.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 1,141,611 |
@Override
public JComponent getOptionsComponent(int index) {
return null;
}
| JComponent function(int index) { return null; } | /**
* Returns null. Subclasses might override this method in order to provide additional option
* components.
*/ | Returns null. Subclasses might override this method in order to provide additional option components | getOptionsComponent | {
"repo_name": "transwarpio/rapidminer",
"path": "rapidMiner/rapidminer-studio-core/src/main/java/com/rapidminer/gui/plotter/PlotterAdapter.java",
"license": "gpl-3.0",
"size": 48348
} | [
"javax.swing.JComponent"
] | import javax.swing.JComponent; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 175,690 |
public static java.util.List extractElectronicPrescribingConfigList(ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.ElectronicPrescribingConfigVoCollection voCollection)
{
return extractElectronicPrescribingConfigList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.admin.vo.ElectronicPrescribingConfigVoCollection voCollection) { return extractElectronicPrescribingConfigList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.admin.domain.objects.ElectronicPrescribingConfig list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.admin.domain.objects.ElectronicPrescribingConfig list from the value object collection | extractElectronicPrescribingConfigList | {
"repo_name": "FreudianNM/openMAXIMS",
"path": "Source Library/openmaxims_workspace/ValueObjects/src/ims/admin/vo/domain/ElectronicPrescribingConfigVoAssembler.java",
"license": "agpl-3.0",
"size": 23892
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,121,326 |
@NonNull
Set<String> getIdeSetupTaskNames(); | Set<String> getIdeSetupTaskNames(); | /**
* Returns names of tasks that need to be run when setting up the IDE project. After these
* tasks have run, all the generated source files etc. that the IDE needs to know about should
* be in place.
*/ | Returns names of tasks that need to be run when setting up the IDE project. After these tasks have run, all the generated source files etc. that the IDE needs to know about should be in place | getIdeSetupTaskNames | {
"repo_name": "consulo/consulo-android",
"path": "tools-base/build-system/builder-model/src/main/java/com/android/builder/model/BaseArtifact.java",
"license": "apache-2.0",
"size": 3310
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,212,921 |
public int getTotalBitsWritten() throws IOException {
return totalBitsWritten;
} | int function() throws IOException { return totalBitsWritten; } | /**
* Gets total bits written.
*
* @return the total bits written
* @throws IOException the io exception
*/ | Gets total bits written | getTotalBitsWritten | {
"repo_name": "SimiaCryptus/utilities",
"path": "java-util/src/main/java/com/simiacryptus/util/binary/BitOutputStream.java",
"license": "apache-2.0",
"size": 6098
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 60,502 |
@Override
public String getCreateChildText(Object owner, Object feature,
Object child, Collection<?> selection) {
Object childFeature = feature;
Object childObject = child;
boolean qualify = childFeature == Bpmn2Package.Literals.CALL_ACTIVITY__IN_PARAMETERS
|| childFeature == Bpmn2Package.Literals.CALL_ACTIVITY__OUT_PARAMETERS;
if (qualify) {
return getString("_UI_CreateChild_text2", new Object[] {
getTypeText(childObject), getFeatureText(childFeature),
getTypeText(owner) });
}
return super.getCreateChildText(owner, feature, child, selection);
} | String function(Object owner, Object feature, Object child, Collection<?> selection) { Object childFeature = feature; Object childObject = child; boolean qualify = childFeature == Bpmn2Package.Literals.CALL_ACTIVITY__IN_PARAMETERS childFeature == Bpmn2Package.Literals.CALL_ACTIVITY__OUT_PARAMETERS; if (qualify) { return getString(STR, new Object[] { getTypeText(childObject), getFeatureText(childFeature), getTypeText(owner) }); } return super.getCreateChildText(owner, feature, child, selection); } | /**
* This returns the label text for {@link org.eclipse.emf.edit.command.CreateChildCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for <code>org.eclipse.emf.edit.command.CreateChildCommand</code>. | getCreateChildText | {
"repo_name": "adbrucker/SecureBPMN",
"path": "designer/src/org.activiti.designer.model.edit/src/org/eclipse/bpmn2/provider/CallActivityItemProvider.java",
"license": "apache-2.0",
"size": 8087
} | [
"java.util.Collection",
"org.eclipse.bpmn2.Bpmn2Package"
] | import java.util.Collection; import org.eclipse.bpmn2.Bpmn2Package; | import java.util.*; import org.eclipse.bpmn2.*; | [
"java.util",
"org.eclipse.bpmn2"
] | java.util; org.eclipse.bpmn2; | 2,260,103 |
public Object get(Object member) throws IllegalArgumentException, IllegalAccessException {
if (!isReadable())
throw new IllegalStateException("Property " + propertyName + " of " + memberClass
+ " not readable");
try {
return getter.invoke(member, EMPTY_ARGS);
} catch (InvocationTargetException e) {
throw new UndeclaredThrowableException(e.getTargetException());
}
} | Object function(Object member) throws IllegalArgumentException, IllegalAccessException { if (!isReadable()) throw new IllegalStateException(STR + propertyName + STR + memberClass + STR); try { return getter.invoke(member, EMPTY_ARGS); } catch (InvocationTargetException e) { throw new UndeclaredThrowableException(e.getTargetException()); } } | /**
* Gets the value of this property for the specified Object.
* @throws IllegalAccessException
* @throws IllegalArgumentException
*/ | Gets the value of this property for the specified Object | get | {
"repo_name": "fukata/xstream-for-android",
"path": "xstream/src/java/com/thoughtworks/xstream/converters/javabean/BeanProperty.java",
"license": "bsd-3-clause",
"size": 3604
} | [
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.UndeclaredThrowableException"
] | import java.lang.reflect.InvocationTargetException; import java.lang.reflect.UndeclaredThrowableException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,170,192 |
public EchonetQuery makeQuery(AbstractEchonetObject sender, AbstractEchonetObject target, ServiceCode service,
List<EchonetProperty> properties, List<EchonetProperty> secondary, EchoEventListener listener) {
Logging.getLogger().log(Level.FINE, "xxx makeQuery target1: {0}", target.getQueryIp());
EchonetQuery query = new EchonetQuery(service, sender, listener);
synchronized (pcreate) {
this.craftEchonetQuery(service, sender, target);
//write the first set of properties
switch (service) {
case Get:
case INF_REQ:
writeOperandsNull(properties);
break;
default:
writeOperands(properties);
}
//write the second set
if (secondary != null && secondary.size() > 0) {
//we have a setget
pcreate.startOPC2();
writeOperandsNull(secondary);
}
openqueries.put((int) pcreate.getCurrentTID(), query);
Logging.getLogger().log(Level.FINE, "xxx makeQuery target2: {0}", target.getQueryIp());
sendQuery(target.getQueryIp());
}
return query;
} | EchonetQuery function(AbstractEchonetObject sender, AbstractEchonetObject target, ServiceCode service, List<EchonetProperty> properties, List<EchonetProperty> secondary, EchoEventListener listener) { Logging.getLogger().log(Level.FINE, STR, target.getQueryIp()); EchonetQuery query = new EchonetQuery(service, sender, listener); synchronized (pcreate) { this.craftEchonetQuery(service, sender, target); switch (service) { case Get: case INF_REQ: writeOperandsNull(properties); break; default: writeOperands(properties); } if (secondary != null && secondary.size() > 0) { pcreate.startOPC2(); writeOperandsNull(secondary); } openqueries.put((int) pcreate.getCurrentTID(), query); Logging.getLogger().log(Level.FINE, STR, target.getQueryIp()); sendQuery(target.getQueryIp()); } return query; } | /**
* Makes and sends an echonet query to the network. All types of services
* are implemented using this method.
*
*
* @param sender the originator of this query
* @param target the destination of this query
* @param service the desired echonet service
* @param properties the main property list. For example, in the case of a
* GET request, a list of {@link EchonetDummyProperty} objects can be used
* to express the properties whose values to get
* @param secondary the secondary property list (in case of SETGET requests,
* can be null)
* @param listener an <code>EchoEventListener</code> that will be executed
* asynchronously as soon as an answer is received (can be null)
* @return a query object used for synchronization and synchronous
* processing of the answers
* @see EchonetAnswer
* @see EchoEventListener
*/ | Makes and sends an echonet query to the network. All types of services are implemented using this method | makeQuery | {
"repo_name": "s-marios/ProtoLite",
"path": "src/jaist/echonet/EchonetNode.java",
"license": "bsd-2-clause",
"size": 27120
} | [
"java.util.List",
"java.util.logging.Level"
] | import java.util.List; import java.util.logging.Level; | import java.util.*; import java.util.logging.*; | [
"java.util"
] | java.util; | 855,288 |
public String check(String rawNumber) {
String result = null;
StringBuffer buffer = new StringBuffer(64);
String iban = trim(rawNumber).toUpperCase();
int ipos = 4; // start behind the check digits
if (iban.length() >= ipos) {
while (ipos < iban.length()) {
char ch = iban.charAt(ipos);
int imap = BaseChecker.LETTER_MAP.indexOf(ch);
if (imap < 0) { // not found
imap = BaseChecker.letter_MAP.indexOf(ch);
if (imap < 0) {
return BaseChecker.WRONG_CHAR;
} else { // lowercase letter
buffer.append(Integer.toString(imap)); // 2 digits >= 10
}
} else if (imap < 10) { // digit
buffer.append(ch);
} else { // uppercase letter
buffer.append(Integer.toString(imap)); // 2 digits >= 10
}
ipos ++;
} // while ipos
// now append the mapping of the ISO country code
ipos = 0;
int itar = 0;
while (ipos < iban.length() && itar < 2) { // append the ISO country code
char ch = iban.charAt(ipos);
int imap = BaseChecker.LETTER_MAP.indexOf(ch);
if (imap < 0) {
return BaseChecker.WRONG_CHAR;
} else if (imap < 10) { // digit
buffer.append(ch);
itar ++;
} else { // letter
buffer.append(Integer.toString(imap)); // 2 digits >= 10
itar ++;
}
ipos ++;
} // while ipos
buffer.append("00"); // append 2 fictional check digits
String newCheck = Integer.toString(98 - (new BigInteger(buffer.toString()).mod(new BigInteger("97"))).intValue());
if (newCheck.length() <= 1) {
newCheck = "0" + newCheck;
}
result = checkResponse(rawNumber, format(iban), 2, 2, newCheck);
} else {
result = checkResponse(rawNumber, BaseChecker.TOO_SHORT);
}
return result;
} // check | String function(String rawNumber) { String result = null; StringBuffer buffer = new StringBuffer(64); String iban = trim(rawNumber).toUpperCase(); int ipos = 4; if (iban.length() >= ipos) { while (ipos < iban.length()) { char ch = iban.charAt(ipos); int imap = BaseChecker.LETTER_MAP.indexOf(ch); if (imap < 0) { imap = BaseChecker.letter_MAP.indexOf(ch); if (imap < 0) { return BaseChecker.WRONG_CHAR; } else { buffer.append(Integer.toString(imap)); } } else if (imap < 10) { buffer.append(ch); } else { buffer.append(Integer.toString(imap)); } ipos ++; } ipos = 0; int itar = 0; while (ipos < iban.length() && itar < 2) { char ch = iban.charAt(ipos); int imap = BaseChecker.LETTER_MAP.indexOf(ch); if (imap < 0) { return BaseChecker.WRONG_CHAR; } else if (imap < 10) { buffer.append(ch); itar ++; } else { buffer.append(Integer.toString(imap)); itar ++; } ipos ++; } buffer.append("00"); String newCheck = Integer.toString(98 - (new BigInteger(buffer.toString()).mod(new BigInteger("97"))).intValue()); if (newCheck.length() <= 1) { newCheck = "0" + newCheck; } result = checkResponse(rawNumber, format(iban), 2, 2, newCheck); } else { result = checkResponse(rawNumber, BaseChecker.TOO_SHORT); } return result; } | /** Computes the check digits of an IBAN.
* @param rawNumber IBAN to be tested
* @return recomputed IBAN with proper check digits,
* or "too short" if length(IBAN) < 4
*/ | Computes the check digits of an IBAN | check | {
"repo_name": "gfis/checkdig",
"path": "src/main/java/org/teherba/checkdig/account/IBANChecker.java",
"license": "apache-2.0",
"size": 17420
} | [
"java.math.BigInteger",
"org.teherba.checkdig.BaseChecker"
] | import java.math.BigInteger; import org.teherba.checkdig.BaseChecker; | import java.math.*; import org.teherba.checkdig.*; | [
"java.math",
"org.teherba.checkdig"
] | java.math; org.teherba.checkdig; | 105,165 |
@Test
public void testMostSpecificCM() throws Exception {
//Call method
DigitalObject object = factory.getDigitalObject("uuid:68081375-cc57-4e8c-a6b2-25dad34f4ad4");
//Verify calls
verify(centralWebservice).getObjectProfile("uuid:68081375-cc57-4e8c-a6b2-25dad34f4ad4");
verify(centralWebservice).getObjectProfile("doms:ContentModel_Program");
verify(centralWebservice).getObjectProfile("doms:ContentModel_DOMS");
verifyNoMoreInteractions(centralWebservice);
//Check result
assertTrue(object instanceof DataObject);
DataObject dataObject = (DataObject) object;
//Call method
String objectTitle = dataObject.getContentmodelTitle();
//Verify calls
verify(centralWebservice).getInverseRelationsWithPredicate("doms:ContentModel_Program",
DOMS_RELATIONS_NAMESPACE + "extendsModel");
verify(centralWebservice).getInverseRelationsWithPredicate("doms:ContentModel_DOMS",
DOMS_RELATIONS_NAMESPACE + "extendsModel");
verifyNoMoreInteractions(centralWebservice);
//Check result
assertEquals(objectTitle, "Program");
} | void function() throws Exception { DigitalObject object = factory.getDigitalObject(STR); verify(centralWebservice).getObjectProfile(STR); verify(centralWebservice).getObjectProfile(STR); verify(centralWebservice).getObjectProfile(STR); verifyNoMoreInteractions(centralWebservice); assertTrue(object instanceof DataObject); DataObject dataObject = (DataObject) object; String objectTitle = dataObject.getContentmodelTitle(); verify(centralWebservice).getInverseRelationsWithPredicate(STR, DOMS_RELATIONS_NAMESPACE + STR); verify(centralWebservice).getInverseRelationsWithPredicate(STR, DOMS_RELATIONS_NAMESPACE + STR); verifyNoMoreInteractions(centralWebservice); assertEquals(objectTitle, STR); } | /**
* Check that when we ask for a content model, we get the most specific one.
*/ | Check that when we ask for a content model, we get the most specific one | testMostSpecificCM | {
"repo_name": "statsbiblioteket/doms-client",
"path": "domsClient-common-impl/src/test/java/dk/statsbiblioteket/doms/client/objects/DigitalObjectFactoryTest.java",
"license": "apache-2.0",
"size": 8775
} | [
"junit.framework.Assert",
"org.mockito.Mockito"
] | import junit.framework.Assert; import org.mockito.Mockito; | import junit.framework.*; import org.mockito.*; | [
"junit.framework",
"org.mockito"
] | junit.framework; org.mockito; | 1,141,447 |
public void buildComponent(StructureComponent par1StructureComponent, List par2List, Random par3Random)
{
getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true);
} | void function(StructureComponent par1StructureComponent, List par2List, Random par3Random) { getNextComponentZ((ComponentNetherBridgeStartPiece)par1StructureComponent, par2List, par3Random, 0, 1, true); } | /**
* Initiates construction of the Structure Component picked, at the current Location of StructGen
*/ | Initiates construction of the Structure Component picked, at the current Location of StructGen | buildComponent | {
"repo_name": "sethten/MoDesserts",
"path": "mcp50/src/minecraft_server/net/minecraft/src/ComponentNetherBridgeCorridor2.java",
"license": "gpl-3.0",
"size": 3429
} | [
"java.util.List",
"java.util.Random"
] | import java.util.List; import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,693,365 |
@SuppressWarnings("unchecked")
public final RequestBuilder setTimeout(TimeValue timeout) {
request.timeout(timeout);
return (RequestBuilder) this;
} | @SuppressWarnings(STR) final RequestBuilder function(TimeValue timeout) { request.timeout(timeout); return (RequestBuilder) this; } | /**
* 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 | setTimeout | {
"repo_name": "robin13/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/support/single/instance/InstanceShardOperationRequestBuilder.java",
"license": "apache-2.0",
"size": 1908
} | [
"org.elasticsearch.common.unit.TimeValue"
] | import org.elasticsearch.common.unit.TimeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,289,890 |
public void assertEmailHasBeenReceived(Email expectedEmail) throws InterruptedException {
boolean isFound = hasEmailBeenReceived(expectedEmail);
if (!isFound) {
Assert.fail("A message " + expectedEmail + " not found in \n" + getAllEmailsReceived());
}
} | void function(Email expectedEmail) throws InterruptedException { boolean isFound = hasEmailBeenReceived(expectedEmail); if (!isFound) { Assert.fail(STR + expectedEmail + STR + getAllEmailsReceived()); } } | /** Assert email has been received.
*
* @param expectedEmail
* the expected email
* @throws InterruptedException
* the interrupted exception
*/ | Assert email has been received | assertEmailHasBeenReceived | {
"repo_name": "alarulrajan/CodeFest",
"path": "test/com/technoetic/xplanner/acceptance/web/MailTester.java",
"license": "gpl-2.0",
"size": 11332
} | [
"junit.framework.Assert"
] | import junit.framework.Assert; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 1,485,498 |
public static final synchronized ResourceManager getManager(
String packageName) {
return getManager(packageName, Locale.getDefault());
} | static final synchronized ResourceManager function( String packageName) { return getManager(packageName, Locale.getDefault()); } | /**
* Get the ResourceManager for a particular package. If a manager for a
* package already exists, it will be reused, else a new ResourceManager
* will be created and returned.
*
* @param packageName
* The package name
*/ | Get the ResourceManager for a particular package. If a manager for a package already exists, it will be reused, else a new ResourceManager will be created and returned | getManager | {
"repo_name": "jior/glaf",
"path": "workspace/glaf-core/src/main/java/com/glaf/core/res/ResourceManager.java",
"license": "apache-2.0",
"size": 6689
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,628,166 |
public float[] getScaleMatrix() {
Matrix.setIdentityM(scaleMatrix, 0);
Matrix.scaleM(
scaleMatrix,
0,
(this.bitmapChar.getWidth() * this.getScaleX()),
(this.bitmapChar.getHeight() * this.getScaleY()),
this.getScaleZ()
);
return this.scaleMatrix;
} | float[] function() { Matrix.setIdentityM(scaleMatrix, 0); Matrix.scaleM( scaleMatrix, 0, (this.bitmapChar.getWidth() * this.getScaleX()), (this.bitmapChar.getHeight() * this.getScaleY()), this.getScaleZ() ); return this.scaleMatrix; } | /**
* Gets the matrix that will be used to scale this 3D char
* @return float[] object
*/ | Gets the matrix that will be used to scale this 3D char | getScaleMatrix | {
"repo_name": "snada/BitmapFontLoader",
"path": "bitmapfontloader/src/main/java/it/snada/bitmap3dstring/Bitmap3DChar.java",
"license": "mit",
"size": 6810
} | [
"android.opengl.Matrix"
] | import android.opengl.Matrix; | import android.opengl.*; | [
"android.opengl"
] | android.opengl; | 955,468 |
public void setVisible(boolean b)
{
if (b) {
// Set the system property required by Mac OS X
String prop = null;
if (MacUtils.isMac())
prop = "apple.awt.fileDialogForDirectories";
Properties props = System.getProperties();
Object oldValue = null;
if (prop != null)
{
oldValue = props.get(prop);
props.put(prop, "true");
}
// Do the usual thing
super.setVisible(true);
// Reset the system property
if (prop != null)
{
if (oldValue == null)
props.remove(prop);
else
props.put(prop, oldValue);
}
} else {
super.setVisible(false);
}
} | void function(boolean b) { if (b) { String prop = null; if (MacUtils.isMac()) prop = STR; Properties props = System.getProperties(); Object oldValue = null; if (prop != null) { oldValue = props.get(prop); props.put(prop, "true"); } super.setVisible(true); if (prop != null) { if (oldValue == null) props.remove(prop); else props.put(prop, oldValue); } } else { super.setVisible(false); } } | /**
* Make the dialog visible. Since the dialog is modal, this method
* will not return until either the user dismisses the dialog or
* you make it invisible yourself via <code>setVisible(false)</code>
* or <code>dispose</code>.
*/ | Make the dialog visible. Since the dialog is modal, this method will not return until either the user dismisses the dialog or you make it invisible yourself via <code>setVisible(false)</code> or <code>dispose</code> | setVisible | {
"repo_name": "jpcaruana/jsynthlib",
"path": "src/main/java/org/jsynthlib/core/FolderDialog.java",
"license": "gpl-2.0",
"size": 4791
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 628,562 |
// private static final Logger log =
// Logger.getLogger(ApplicationContext.class);
protected void initMessageSource() {
// if (this.containsBean(MESSAGE_SOURCE_BEAN_NAME)) {
// this.messageSource = (MessageSource) this
// .getBeanObject(MESSAGE_SOURCE_BEAN_NAME);
//
// if (log.isDebugEnabled()) {
// log.debug("Using MessageSource [" + this.messageSource + "]");
// }
// }
// else {
// // Use empty MessageSource to be able to accept getMessage calls.
// DelegatingMessageSource dms = new DelegatingMessageSource();
// dms.setParentMessageSource(getInternalParentMessageSource());
// this.messageSource = dms;
// // beanFactory.registerSingleton(MESSAGE_SOURCE_BEAN_NAME,
// // this.messageSource);
// if (log.isDebugEnabled()) {
// log.debug("Unable to locate MessageSource with name '"
// + MESSAGE_SOURCE_BEAN_NAME + "': using default ["
// + this.messageSource + "]");
// }
// }
// Use empty MessageSource to be able to accept getMessage calls.
DelegatingMessageSource dms = new DelegatingMessageSource();
dms.setParentMessageSource(getInternalParentMessageSource());
this.messageSource = dms;
// beanFactory.registerSingleton(MESSAGE_SOURCE_BEAN_NAME,
// this.messageSource);
if (log.isDebugEnabled()) {
log.debug("Unable to locate MessageSource with name '"
+ MESSAGE_SOURCE_BEAN_NAME + "': using default ["
+ this.messageSource.getClass().getCanonicalName() + "]");
}
}
public static final String DEFAULT_MESSAGE_BASENAME = "messages";
// protected MessageSource getInternalParentMessageSource() {
// ResourceBundleMessageSource messagesource = new ResourceBundleMessageSource();
// if(this.configfile != null && !configfile.equals(""))
// {
// int index = configfile.lastIndexOf("/");
// if(index > 0)
// {
// String parent = configfile.substring(0,index);
// messagesource.setBasename(getRealPath(parent, DEFAULT_MESSAGE_BASENAME));
//
// }
// else
// {
// messagesource.setBasename(DEFAULT_MESSAGE_BASENAME);
// }
// }
// else
// {
// messagesource.setBasename(DEFAULT_MESSAGE_BASENAME);
// }
// messagesource.setBundleClassLoader(getClassLoader());
// messagesource.setUseCodeAsDefaultMessage(true);
// return messagesource;
// }
| void function() { DelegatingMessageSource dms = new DelegatingMessageSource(); dms.setParentMessageSource(getInternalParentMessageSource()); this.messageSource = dms; if (log.isDebugEnabled()) { log.debug(STR + MESSAGE_SOURCE_BEAN_NAME + STR + this.messageSource.getClass().getCanonicalName() + "]"); } } public static final String DEFAULT_MESSAGE_BASENAME = STR; | /**
* Initialize the MessageSource. Use parent's if none defined in this
* context.
*/ | Initialize the MessageSource. Use parent's if none defined in this context | initMessageSource | {
"repo_name": "WilliamRen/bbossgroups-3.5",
"path": "bboss-core/src/org/frameworkset/spi/BaseApplicationContext.java",
"license": "apache-2.0",
"size": 73535
} | [
"org.frameworkset.spi.support.DelegatingMessageSource"
] | import org.frameworkset.spi.support.DelegatingMessageSource; | import org.frameworkset.spi.support.*; | [
"org.frameworkset.spi"
] | org.frameworkset.spi; | 1,378,347 |
public void testRunWithScenarioAndUUID() throws Exception {
JSystemProperties.getInstance().setPreference(FrameworkOptions.TESTS_CLASS_FOLDER, agentDir + "/projects/jsystemAgentProject/classes");
ScenariosManager.init();
Scenario s = ScenariosManager.getInstance().getScenario("scenarios/agentScenarioDefault3");
String uuid = s.getTest(1).getFullUUID();
agentSysObj.client.run("scenarios/agentScenarioDefault3", uuid);
AnalyzerFileFinder ff = new AnalyzerFileFinder("MyFile2.txt","Agent Perform the 3rd test in agentScenarioDefault3.xml scenario");
agentSysObj.analyze(ff, false, false, false);
} | void function() throws Exception { JSystemProperties.getInstance().setPreference(FrameworkOptions.TESTS_CLASS_FOLDER, agentDir + STR); ScenariosManager.init(); Scenario s = ScenariosManager.getInstance().getScenario(STR); String uuid = s.getTest(1).getFullUUID(); agentSysObj.client.run(STR, uuid); AnalyzerFileFinder ff = new AnalyzerFileFinder(STR,STR); agentSysObj.analyze(ff, false, false, false); } | /**
* Testing the .run() method with scenario name and the UUID parameters
* The UUID is the specific test from the requested scenario
*
* This operation performing scenario switching and then running the test
* from the scenario by UUID
*
* @throws Exception
*/ | Testing the .run() method with scenario name and the UUID parameters The UUID is the specific test from the requested scenario This operation performing scenario switching and then running the test from the scenario by UUID | testRunWithScenarioAndUUID | {
"repo_name": "Top-Q/jsystem",
"path": "jsystem-core-projects/jsystemAgent/src/test/java/jsystem/agent/client/LocalAgentTest.java",
"license": "apache-2.0",
"size": 29304
} | [
"com.aqua.services.analyzers.AnalyzerFileFinder"
] | import com.aqua.services.analyzers.AnalyzerFileFinder; | import com.aqua.services.analyzers.*; | [
"com.aqua.services"
] | com.aqua.services; | 2,381,472 |
public static Enumeration getNames()
{
return objIds.keys();
} | static Enumeration function() { return objIds.keys(); } | /**
* returns an enumeration containing the name strings for curves
* contained in this structure.
*/ | returns an enumeration containing the name strings for curves contained in this structure | getNames | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "external/bouncycastle/bcprov/src/main/java/org/bouncycastle/asn1/x9/X962NamedCurves.java",
"license": "gpl-2.0",
"size": 25647
} | [
"java.util.Enumeration"
] | import java.util.Enumeration; | import java.util.*; | [
"java.util"
] | java.util; | 842,883 |
@NonNull
private ArrayList<Uri> convertFilePathsToUris(List<String> paths) {
ArrayList<Uri> exportFiles = new ArrayList<>();
for (String path : paths) {
File file = new File(path);
file.setReadable(true, false);
exportFiles.add(Uri.fromFile(file));
// exportFiles.add(Uri.parse("file://" + file));
}
return exportFiles;
} | ArrayList<Uri> function(List<String> paths) { ArrayList<Uri> exportFiles = new ArrayList<>(); for (String path : paths) { File file = new File(path); file.setReadable(true, false); exportFiles.add(Uri.fromFile(file)); } return exportFiles; } | /**
* Convert file paths to URIs by adding the file// prefix
* <p>e.g. /some/path/file.ext --> file:///some/path/file.ext</p>
* @param paths List of file paths to convert
* @return List of file URIs
*/ | Convert file paths to URIs by adding the file// prefix e.g. /some/path/file.ext --> file:///some/path/file.ext | convertFilePathsToUris | {
"repo_name": "rivaldi8/gnucash-android",
"path": "app/src/main/java/org/gnucash/android/export/ExportAsyncTask.java",
"license": "apache-2.0",
"size": 18832
} | [
"android.net.Uri",
"java.io.File",
"java.util.ArrayList",
"java.util.List"
] | import android.net.Uri; import java.io.File; import java.util.ArrayList; import java.util.List; | import android.net.*; import java.io.*; import java.util.*; | [
"android.net",
"java.io",
"java.util"
] | android.net; java.io; java.util; | 431,692 |
public static IgniteCallable<AtomicInteger> newAtomicInt() {
return ATOMIC_INT_FACTORY;
} | static IgniteCallable<AtomicInteger> function() { return ATOMIC_INT_FACTORY; } | /**
* Returns a factory closure that creates new {@link AtomicInteger} instance
* initialized to {@code zero}. Note that this method does not create a new
* closure but returns a static one.
*
* @return Factory closure that creates new {@link AtomicInteger} instance
* initialized to {@code zero} every time its {@link org.apache.ignite.lang.IgniteOutClosure#apply()} method is called.
*/ | Returns a factory closure that creates new <code>AtomicInteger</code> instance initialized to zero. Note that this method does not create a new closure but returns a static one | newAtomicInt | {
"repo_name": "dlnufox/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java",
"license": "apache-2.0",
"size": 157742
} | [
"java.util.concurrent.atomic.AtomicInteger",
"org.apache.ignite.lang.IgniteCallable"
] | import java.util.concurrent.atomic.AtomicInteger; import org.apache.ignite.lang.IgniteCallable; | import java.util.concurrent.atomic.*; import org.apache.ignite.lang.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 1,670,014 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.