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 List<String> getUpgradeScripts(String fromVersion)
throws HiveMetaException {
List <String> upgradeScriptList = new ArrayList<String>();
// check if we are already at current schema level
if (getHiveSchemaVersion().equals(fromVersion)) {
return upgradeScriptList;
}
// Find the list of scripts to execute for this upgrade
int firstScript = hiveSchemaVersions.length;
for (int i=0; i < hiveSchemaVersions.length; i++) {
if (hiveSchemaVersions[i].startsWith(fromVersion)) {
firstScript = i;
}
}
if (firstScript == hiveSchemaVersions.length) {
throw new HiveMetaException("Unknown version specified for upgrade " +
fromVersion + " Metastore schema may be too old or newer");
}
for (int i=firstScript; i < hiveSchemaVersions.length; i++) {
String scriptFile = generateUpgradeFileName(hiveSchemaVersions[i]);
upgradeScriptList.add(scriptFile);
}
return upgradeScriptList;
} | List<String> function(String fromVersion) throws HiveMetaException { List <String> upgradeScriptList = new ArrayList<String>(); if (getHiveSchemaVersion().equals(fromVersion)) { return upgradeScriptList; } int firstScript = hiveSchemaVersions.length; for (int i=0; i < hiveSchemaVersions.length; i++) { if (hiveSchemaVersions[i].startsWith(fromVersion)) { firstScript = i; } } if (firstScript == hiveSchemaVersions.length) { throw new HiveMetaException(STR + fromVersion + STR); } for (int i=firstScript; i < hiveSchemaVersions.length; i++) { String scriptFile = generateUpgradeFileName(hiveSchemaVersions[i]); upgradeScriptList.add(scriptFile); } return upgradeScriptList; } | /***
* Get the list of sql scripts required to upgrade from the give version to current
* @param fromVersion
* @return
* @throws HiveMetaException
*/ | Get the list of sql scripts required to upgrade from the give version to current | getUpgradeScripts | {
"repo_name": "vergilchiu/hive",
"path": "metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreSchemaInfo.java",
"license": "apache-2.0",
"size": 7648
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 924,031 |
public String nextString() throws ParsingException {
char c = nextUsefulChar();
switch (c) {
case '"':
case '\'':
return nextString(c);
}
throw error("Expecting a field name at line " + lineNumber + ", column " + columnNumber
+ ". Check for a missing comma.");
} | String function() throws ParsingException { char c = nextUsefulChar(); switch (c) { case 'STRExpecting a field name at line STR, column STR. Check for a missing comma."); } | /**
* Read the next quoted string from the stream, where stream begins with the a single-quote or double-quote character and
* the string ends with the same quote character.
*
* @return the next string; never null
* @throws ParsingException
*/ | Read the next quoted string from the stream, where stream begins with the a single-quote or double-quote character and the string ends with the same quote character | nextString | {
"repo_name": "phantomjinx/modeshape",
"path": "modeshape-schematic/src/main/java/org/infinispan/schematic/internal/document/JsonReader.java",
"license": "apache-2.0",
"size": 60038
} | [
"org.infinispan.schematic.document.ParsingException"
] | import org.infinispan.schematic.document.ParsingException; | import org.infinispan.schematic.document.*; | [
"org.infinispan.schematic"
] | org.infinispan.schematic; | 1,296,363 |
public IExpr allTrue(IAST list, IExpr head, EvalEngine engine) {
IASTAppendable logicalAnd = F.And();
if (!list.forAll(x -> {
IExpr temp = engine.evaluate(F.unaryAST1(head, x));
if (temp.isTrue()) {
return true;
} else if (temp.isFalse()) {
return false;
}
logicalAnd.append(temp);
return true;
})) {
return S.False;
}
if (logicalAnd.size() > 1) {
return logicalAnd;
}
return S.True;
}
@Override
public void setUp(final ISymbol newSymbol) {} | IExpr function(IAST list, IExpr head, EvalEngine engine) { IASTAppendable logicalAnd = F.And(); if (!list.forAll(x -> { IExpr temp = engine.evaluate(F.unaryAST1(head, x)); if (temp.isTrue()) { return true; } else if (temp.isFalse()) { return false; } logicalAnd.append(temp); return true; })) { return S.False; } if (logicalAnd.size() > 1) { return logicalAnd; } return S.True; } public void setUp(final ISymbol newSymbol) {} | /**
* If all expressions evaluates to <code>true</code> for a given unary predicate function return
* <code>True</code>, if any expression evaluates to <code>false</code> return <code>False
* </code>, else return an <code>And(...)</code> expression of the result expressions.
*
* @param list list of expressions
* @param head the head of a unary predicate function
* @param engine
* @return
*/ | If all expressions evaluates to <code>true</code> for a given unary predicate function return <code>True</code>, if any expression evaluates to <code>false</code> return <code>False </code>, else return an <code>And(...)</code> expression of the result expressions | allTrue | {
"repo_name": "axkr/symja_android_library",
"path": "symja_android_library/matheclipse-core/src/main/java/org/matheclipse/core/builtin/BooleanFunctions.java",
"license": "gpl-3.0",
"size": 131754
} | [
"org.matheclipse.core.eval.EvalEngine",
"org.matheclipse.core.expression.F",
"org.matheclipse.core.interfaces.IASTAppendable",
"org.matheclipse.core.interfaces.IExpr",
"org.matheclipse.core.interfaces.ISymbol"
] | import org.matheclipse.core.eval.EvalEngine; import org.matheclipse.core.expression.F; import org.matheclipse.core.interfaces.IASTAppendable; import org.matheclipse.core.interfaces.IExpr; import org.matheclipse.core.interfaces.ISymbol; | import org.matheclipse.core.eval.*; import org.matheclipse.core.expression.*; import org.matheclipse.core.interfaces.*; | [
"org.matheclipse.core"
] | org.matheclipse.core; | 1,419,952 |
void beforeChildAddition(@NotNull PsiTreeChangeEvent event); | void beforeChildAddition(@NotNull PsiTreeChangeEvent event); | /**
* Invoked just before adding a child to the tree.<br>
* Parent element is returned by {@code event.getParent()}.<br>
* Added child is returned by {@code event.getChild}.
*
* @param event the event object describing the change.
*/ | Invoked just before adding a child to the tree. Parent element is returned by event.getParent(). Added child is returned by event.getChild | beforeChildAddition | {
"repo_name": "asedunov/intellij-community",
"path": "platform/core-api/src/com/intellij/psi/PsiTreeChangeListener.java",
"license": "apache-2.0",
"size": 5900
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 187,808 |
@Override
public void fetchNewData(Ref ref, Optional<Integer> fetchLimit) {
CommitTraverser traverser = getFetchTraverser(fetchLimit);
try {
traverser.traverse(ref.getObjectId());
List<ObjectId> want = new LinkedList<ObjectId>();
want.addAll(traverser.commits);
Collections.reverse(want);
Set<ObjectId> have = new HashSet<ObjectId>();
have.addAll(traverser.have);
while (!want.isEmpty()) {
fetchMoreData(want, have);
}
} catch (Exception e) {
Throwables.propagate(e);
}
} | void function(Ref ref, Optional<Integer> fetchLimit) { CommitTraverser traverser = getFetchTraverser(fetchLimit); try { traverser.traverse(ref.getObjectId()); List<ObjectId> want = new LinkedList<ObjectId>(); want.addAll(traverser.commits); Collections.reverse(want); Set<ObjectId> have = new HashSet<ObjectId>(); have.addAll(traverser.have); while (!want.isEmpty()) { fetchMoreData(want, have); } } catch (Exception e) { Throwables.propagate(e); } } | /**
* Fetch all new objects from the specified {@link Ref} from the remote.
*
* @param ref the remote ref that points to new commit data
* @param fetchLimit the maximum depth to fetch
*/ | Fetch all new objects from the specified <code>Ref</code> from the remote | fetchNewData | {
"repo_name": "markles/GeoGit",
"path": "src/core/src/main/java/org/geogit/remote/HttpRemoteRepo.java",
"license": "bsd-3-clause",
"size": 14716
} | [
"com.google.common.base.Optional",
"com.google.common.base.Throwables",
"java.util.Collections",
"java.util.HashSet",
"java.util.LinkedList",
"java.util.List",
"java.util.Set",
"org.geogit.api.ObjectId",
"org.geogit.api.Ref"
] | import com.google.common.base.Optional; import com.google.common.base.Throwables; import java.util.Collections; import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Set; import org.geogit.api.ObjectId; import org.geogit.api.Ref; | import com.google.common.base.*; import java.util.*; import org.geogit.api.*; | [
"com.google.common",
"java.util",
"org.geogit.api"
] | com.google.common; java.util; org.geogit.api; | 853,264 |
boolean isLockFile(File file); | boolean isLockFile(File file); | /**
* Returns true if the given file is used by this lock.
*/ | Returns true if the given file is used by this lock | isLockFile | {
"repo_name": "gradle/gradle",
"path": "subprojects/persistent-cache/src/main/java/org/gradle/cache/FileLock.java",
"license": "apache-2.0",
"size": 1819
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,267,554 |
@Test
public void testT1RV6D1_T1LV2D6() {
test_id = getTestId("T1RV6D1", "T1LV2D6", "12");
String src = selectTRVD("T1RV6D1");
String dest = selectTLVD("T1LV2D6");
String result = ".";
try {
result = TRVD_TLVD_Action(src, dest);
} catch (RecognitionException e) {
e.printStackTrace();
} catch (TokenStreamException e) {
e.printStackTrace();
}
assertTrue(Failure2, checkResult_Failure2(src, dest, result));
GraphicalEditor editor = getActiveEditor();
if (editor != null) {
validateOrGenerateResults(editor, generateResults);
}
}
| void function() { test_id = getTestId(STR, STR, "12"); String src = selectTRVD(STR); String dest = selectTLVD(STR); String result = "."; try { result = TRVD_TLVD_Action(src, dest); } catch (RecognitionException e) { e.printStackTrace(); } catch (TokenStreamException e) { e.printStackTrace(); } assertTrue(Failure2, checkResult_Failure2(src, dest, result)); GraphicalEditor editor = getActiveEditor(); if (editor != null) { validateOrGenerateResults(editor, generateResults); } } | /**
* Perform the test for the given matrix column (T1RV6D1) and row (T1LV2D6).
*
*/ | Perform the test for the given matrix column (T1RV6D1) and row (T1LV2D6) | testT1RV6D1_T1LV2D6 | {
"repo_name": "jason-rhodes/bridgepoint",
"path": "src/org.xtuml.bp.als.oal.test/src/org/xtuml/bp/als/oal/test/SingleDimensionFixedArrayAssigmentTest_12_Generics.java",
"license": "apache-2.0",
"size": 155634
} | [
"org.xtuml.bp.ui.graphics.editor.GraphicalEditor"
] | import org.xtuml.bp.ui.graphics.editor.GraphicalEditor; | import org.xtuml.bp.ui.graphics.editor.*; | [
"org.xtuml.bp"
] | org.xtuml.bp; | 1,489,380 |
public static <K, V> V getOrElse(Map<K, V> map, K key, V ifNull) {
assert map != null;
V res = map.get(key);
return res != null ? res : ifNull;
} | static <K, V> V function(Map<K, V> map, K key, V ifNull) { assert map != null; V res = map.get(key); return res != null ? res : ifNull; } | /**
* Helper function to get value from map.
*
* @param map Map to take value from.
* @param key Key to search in map.
* @param ifNull Default value if {@code null} was returned by map.
* @param <K> Key type.
* @param <V> Value type.
* @return Value from map or default value if map return {@code null}.
*/ | Helper function to get value from map | getOrElse | {
"repo_name": "mcherkasov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/visor/util/VisorTaskUtils.java",
"license": "apache-2.0",
"size": 35693
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,099,604 |
public static boolean isSimpleVersionKeyword( String identifier )
{
Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier );
return mat.matches();
} | static boolean function( String identifier ) { Matcher mat = VERSION_MEGA_PATTERN.matcher( identifier ); return mat.matches(); } | /**
* <p>
* Tests if the identifier is a known simple version keyword.
* </p>
*
* <p>
* This method is different from {@link #isVersion(String)} in that it tests the whole input string in
* one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...)
* </p>
*
* @param identifier the identifier to test.
* @return true if the unknown string is likely a version string.
*/ | Tests if the identifier is a known simple version keyword. This method is different from <code>#isVersion(String)</code> in that it tests the whole input string in one go as a simple identifier. (eg "alpha", "1.0", "beta", "debug", "latest", "rc#", etc...) | isSimpleVersionKeyword | {
"repo_name": "apache/archiva",
"path": "archiva-modules/archiva-base/archiva-common/src/main/java/org/apache/archiva/common/utils/VersionUtil.java",
"license": "apache-2.0",
"size": 6343
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,844,014 |
//EXCHANGE-REMOVE-SECTION-START
@Override
protected void setUp() throws Exception {
super.setUp();
// This sets up a default URI which can be used by any of the test methods below.
// Individual test methods can replace this with a custom URI if they wish
// (except those that run on the UI thread - for them, it's too late to change it.)
Intent i = getTestIntent("eas://user:password@server.com");
setActivityIntent(i);
} | void function() throws Exception { super.setUp(); Intent i = getTestIntent("eas: setActivityIntent(i); } | /**
* Common setup code for all tests. Sets up a default launch intent, which some tests
* will use (others will override).
*/ | Common setup code for all tests. Sets up a default launch intent, which some tests will use (others will override) | setUp | {
"repo_name": "craigacgomez/flaming_monkey_packages_apps_Email",
"path": "tests/src/com/android/email/activity/setup/AccountSetupExchangeTests.java",
"license": "apache-2.0",
"size": 8900
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 284,925 |
PagedIterable<Setting> list(); | PagedIterable<Setting> list(); | /**
* Lists all of the settings that have been customized.
*
* @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 result of listing settings.
*/ | Lists all of the settings that have been customized | list | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/costmanagement/azure-resourcemanager-costmanagement/src/main/java/com/azure/resourcemanager/costmanagement/models/Settings.java",
"license": "mit",
"size": 5207
} | [
"com.azure.core.http.rest.PagedIterable"
] | import com.azure.core.http.rest.PagedIterable; | import com.azure.core.http.rest.*; | [
"com.azure.core"
] | com.azure.core; | 1,573,637 |
private void finishWidgetInitialization(Element container, Widget w) {
UIObject.setVisible(container, false);
DOM.setStyleAttribute(container, "height", "100%");
// Set 100% by default.
Element element = w.getElement();
if("".equals(DOM.getStyleAttribute(element, "width"))) {
w.setWidth("100%");
}
if("".equals(DOM.getStyleAttribute(element, "height"))) {
w.setHeight("100%");
}
// Issue 2510: Hiding the widget isn't necessary because we hide its
// wrapper, but it's in here for legacy support.
w.setVisible(false);
} | void function(Element container, Widget w) { UIObject.setVisible(container, false); DOM.setStyleAttribute(container, STR, "100%"); Element element = w.getElement(); if(STRwidthSTR100%STR".equals(DOM.getStyleAttribute(element, STR))) { w.setHeight("100%"); } w.setVisible(false); } | /**
* Setup the container around the widget.
*/ | Setup the container around the widget | finishWidgetInitialization | {
"repo_name": "apruden/opal",
"path": "opal-gwt-client/src/main/java/org/obiba/opal/web/gwt/app/client/ui/TabDeckPanel.java",
"license": "gpl-3.0",
"size": 12569
} | [
"com.google.gwt.user.client.DOM",
"com.google.gwt.user.client.Element",
"com.google.gwt.user.client.ui.UIObject",
"com.google.gwt.user.client.ui.Widget"
] | import com.google.gwt.user.client.DOM; import com.google.gwt.user.client.Element; import com.google.gwt.user.client.ui.UIObject; import com.google.gwt.user.client.ui.Widget; | import com.google.gwt.user.client.*; import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 2,463,985 |
@Nonnull
public TargetedManagedAppConfigurationCollectionRequest skipToken(@Nonnull final String skipToken) {
addSkipTokenOption(skipToken);
return this;
} | TargetedManagedAppConfigurationCollectionRequest function(@Nonnull final String skipToken) { addSkipTokenOption(skipToken); return this; } | /**
* Add Skip token for pagination
* @param skipToken - Token for pagination
* @return the updated request
*/ | Add Skip token for pagination | skipToken | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/TargetedManagedAppConfigurationCollectionRequest.java",
"license": "mit",
"size": 6690
} | [
"com.microsoft.graph.requests.TargetedManagedAppConfigurationCollectionRequest",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.requests.TargetedManagedAppConfigurationCollectionRequest; import javax.annotation.Nonnull; | import com.microsoft.graph.requests.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 1,905,606 |
public String copy(String id, String new_id) throws PermissionException, IdUnusedException, TypeException, InUseException,
OverQuotaException, IdUsedException, ServerOverloadException; | String function(String id, String new_id) throws PermissionException, IdUnusedException, TypeException, InUseException, OverQuotaException, IdUsedException, ServerOverloadException; | /**
* Copy a resource.
*
* @param id
* The id of the resource.
* @param new_id
* The desired id of the new resource.
* @return The full id of the new copy of the resource.
* @exception PermissionException
* if the user does not have permissions to read a containing collection, or to remove this resource.
* @exception IdUnusedException
* if the resource id is not found.
* @exception TypeException
* if the resource is a collection.
* @exception InUseException
* if the resource is locked by someone else.
* @exception IdUsedException
* if copied item is a collection and the new id is already in use or if the copied item is not a collection and a unique id cannot be found in some arbitrary number of attempts (@see MAXIMUM_ATTEMPTS_FOR_UNIQUENESS).
* @exception ServerOverloadException
* if the server is configured to write the resource body to the filesystem and the save fails.
*/ | Copy a resource | copy | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "kernel/api/src/main/java/org/sakaiproject/content/api/ContentHostingService.java",
"license": "apache-2.0",
"size": 93228
} | [
"org.sakaiproject.exception.IdUnusedException",
"org.sakaiproject.exception.IdUsedException",
"org.sakaiproject.exception.InUseException",
"org.sakaiproject.exception.OverQuotaException",
"org.sakaiproject.exception.PermissionException",
"org.sakaiproject.exception.ServerOverloadException",
"org.sakaipr... | import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.IdUsedException; import org.sakaiproject.exception.InUseException; import org.sakaiproject.exception.OverQuotaException; import org.sakaiproject.exception.PermissionException; import org.sakaiproject.exception.ServerOverloadException; import org.sakaiproject.exception.TypeException; | import org.sakaiproject.exception.*; | [
"org.sakaiproject.exception"
] | org.sakaiproject.exception; | 1,461,702 |
@SuppressWarnings("WeakerAccess")
public void addChangeListener(@NonNull ControllerChangeListener changeListener) {
if (!changeListeners.contains(changeListener)) {
changeListeners.add(changeListener);
}
} | @SuppressWarnings(STR) void function(@NonNull ControllerChangeListener changeListener) { if (!changeListeners.contains(changeListener)) { changeListeners.add(changeListener); } } | /**
* Adds a listener for all of this Router's {@link Controller} change events
*
* @param changeListener The listener
*/ | Adds a listener for all of this Router's <code>Controller</code> change events | addChangeListener | {
"repo_name": "bluelinelabs/Conductor",
"path": "conductor/src/main/java/com/bluelinelabs/conductor/Router.java",
"license": "apache-2.0",
"size": 43569
} | [
"androidx.annotation.NonNull",
"com.bluelinelabs.conductor.ControllerChangeHandler"
] | import androidx.annotation.NonNull; import com.bluelinelabs.conductor.ControllerChangeHandler; | import androidx.annotation.*; import com.bluelinelabs.conductor.*; | [
"androidx.annotation",
"com.bluelinelabs.conductor"
] | androidx.annotation; com.bluelinelabs.conductor; | 611,281 |
private void waitOnLock(final SqlJetLockType lockType) throws SqlJetException {
assert (SqlJetPagerState.SHARED.compareTo(state) <= 0 || !dbSizeValid);
if (state.getLockType().compareTo(lockType) < 0) {
boolean lock = false;
int n = 0;
do {
lock = fd.lock(lockType);
if (!lock && null != busyHandler) {
boolean wait = busyHandler.call(n++);
if (!wait) {
break;
}
}
} while (lock != true);
if (lock) {
state = SqlJetPagerState.getPagerState(lockType);
} else {
throw new SqlJetException(SqlJetErrorCode.BUSY);
}
}
} | void function(final SqlJetLockType lockType) throws SqlJetException { assert (SqlJetPagerState.SHARED.compareTo(state) <= 0 !dbSizeValid); if (state.getLockType().compareTo(lockType) < 0) { boolean lock = false; int n = 0; do { lock = fd.lock(lockType); if (!lock && null != busyHandler) { boolean wait = busyHandler.call(n++); if (!wait) { break; } } } while (lock != true); if (lock) { state = SqlJetPagerState.getPagerState(lockType); } else { throw new SqlJetException(SqlJetErrorCode.BUSY); } } } | /**
* Try to obtain a lock on a file. Invoke the busy callback if the lock is
* currently not available. Repeat until the busy callback returns false or
* until the lock succeeds.
*
* Return SQLITE_OK on success and an error code if we cannot obtain the
* lock.
*
* @param lockType
* @throws SqlJetIOException
*/ | Try to obtain a lock on a file. Invoke the busy callback if the lock is currently not available. Repeat until the busy callback returns false or until the lock succeeds. Return SQLITE_OK on success and an error code if we cannot obtain the lock | waitOnLock | {
"repo_name": "SenshiSentou/SourceFight",
"path": "sqljet-1.1.7/src/org/tmatesoft/sqljet/core/internal/pager/SqlJetPager.java",
"license": "bsd-2-clause",
"size": 133695
} | [
"org.tmatesoft.sqljet.core.SqlJetErrorCode",
"org.tmatesoft.sqljet.core.SqlJetException",
"org.tmatesoft.sqljet.core.internal.SqlJetLockType"
] | import org.tmatesoft.sqljet.core.SqlJetErrorCode; import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.sqljet.core.internal.SqlJetLockType; | import org.tmatesoft.sqljet.core.*; import org.tmatesoft.sqljet.core.internal.*; | [
"org.tmatesoft.sqljet"
] | org.tmatesoft.sqljet; | 990,395 |
@InterfaceStability.Unstable
public synchronized String[] getPropertySources(String name) {
if (properties == null) {
// If properties is null, it means a resource was newly added
// but the props were cleared so as to load it upon future
// requests. So lets force a load by asking a properties list.
getProps();
}
// Return a null right away if our properties still
// haven't loaded or the resource mapping isn't defined
if (properties == null || updatingResource == null) {
return null;
} else {
String[] source = updatingResource.get(name);
if(source == null) {
return null;
} else {
return Arrays.copyOf(source, source.length);
}
}
}
public static class IntegerRanges implements Iterable<Integer>{
private static class Range {
int start;
int end;
}
private static class RangeNumberIterator implements Iterator<Integer> {
Iterator<Range> internal;
int at;
int end;
public RangeNumberIterator(List<Range> ranges) {
if (ranges != null) {
internal = ranges.iterator();
}
at = -1;
end = -2;
} | @InterfaceStability.Unstable synchronized String[] function(String name) { if (properties == null) { getProps(); } if (properties == null updatingResource == null) { return null; } else { String[] source = updatingResource.get(name); if(source == null) { return null; } else { return Arrays.copyOf(source, source.length); } } } public static class IntegerRanges implements Iterable<Integer>{ private static class Range { int start; int end; } private static class RangeNumberIterator implements Iterator<Integer> { Iterator<Range> internal; int at; int end; public RangeNumberIterator(List<Range> ranges) { if (ranges != null) { internal = ranges.iterator(); } at = -1; end = -2; } | /**
* Gets information about why a property was set. Typically this is the
* path to the resource objects (file, URL, etc.) the property came from, but
* it can also indicate that it was set programmatically, or because of the
* command line.
*
* @param name - The property name to get the source of.
* @return null - If the property or its source wasn't found. Otherwise,
* returns a list of the sources of the resource. The older sources are
* the first ones in the list. So for example if a configuration is set from
* the command line, and then written out to a file that is read back in the
* first entry would indicate that it was set from the command line, while
* the second one would indicate the file that the new configuration was read
* in from.
*/ | Gets information about why a property was set. Typically this is the path to the resource objects (file, URL, etc.) the property came from, but it can also indicate that it was set programmatically, or because of the command line | getPropertySources | {
"repo_name": "huafengw/hadoop",
"path": "hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/conf/Configuration.java",
"license": "apache-2.0",
"size": 121356
} | [
"java.util.Arrays",
"java.util.Iterator",
"java.util.List",
"org.apache.hadoop.classification.InterfaceStability"
] | import java.util.Arrays; import java.util.Iterator; import java.util.List; import org.apache.hadoop.classification.InterfaceStability; | import java.util.*; import org.apache.hadoop.classification.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 878,119 |
public static Type canonicalize(Type type) {
if (type instanceof Class) {
Class<?> c = (Class<?>) type;
return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c;
} else if (type instanceof CompositeType) {
return type;
} else if (type instanceof ParameterizedType) {
ParameterizedType p = (ParameterizedType) type;
return new ParameterizedTypeImpl(p.getOwnerType(),
p.getRawType(), p.getActualTypeArguments());
} else if (type instanceof GenericArrayType) {
GenericArrayType g = (GenericArrayType) type;
return new GenericArrayTypeImpl(g.getGenericComponentType());
} else if (type instanceof WildcardType) {
WildcardType w = (WildcardType) type;
return new WildcardTypeImpl(w.getUpperBounds(), w.getLowerBounds());
} else {
// type is either serializable as-is or unsupported
return type;
}
} | static Type function(Type type) { if (type instanceof Class) { Class<?> c = (Class<?>) type; return c.isArray() ? new GenericArrayTypeImpl(canonicalize(c.getComponentType())) : c; } else if (type instanceof CompositeType) { return type; } else if (type instanceof ParameterizedType) { ParameterizedType p = (ParameterizedType) type; return new ParameterizedTypeImpl(p.getOwnerType(), p.getRawType(), p.getActualTypeArguments()); } else if (type instanceof GenericArrayType) { GenericArrayType g = (GenericArrayType) type; return new GenericArrayTypeImpl(g.getGenericComponentType()); } else if (type instanceof WildcardType) { WildcardType w = (WildcardType) type; return new WildcardTypeImpl(w.getUpperBounds(), w.getLowerBounds()); } else { return type; } } | /**
* Returns a type that is functionally equal but not necessarily equal
* according to {@link Object#equals(Object) Object.equals()}. The returned
* type is {@link Serializable}.
*/ | Returns a type that is functionally equal but not necessarily equal according to <code>Object#equals(Object) Object.equals()</code>. The returned type is <code>Serializable</code> | canonicalize | {
"repo_name": "SpiralsSeminaire/guice",
"path": "core/src/com/google/inject/internal/MoreTypes.java",
"license": "apache-2.0",
"size": 17933
} | [
"java.lang.reflect.GenericArrayType",
"java.lang.reflect.ParameterizedType",
"java.lang.reflect.Type",
"java.lang.reflect.WildcardType"
] | import java.lang.reflect.GenericArrayType; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.lang.reflect.WildcardType; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 181,637 |
public OperationStatus getFirstDuplicate(DatabaseEntry foundKey,
DatabaseEntry foundData,
LockType lockType)
throws DatabaseException {
assert assertCursorState(true) : dumpToString(true);
if (dupBin != null) {
removeCursorDBIN();
dupBin = null;
dupIndex = -1;
}
return getCurrent(foundKey, foundData, lockType);
} | OperationStatus function(DatabaseEntry foundKey, DatabaseEntry foundData, LockType lockType) throws DatabaseException { assert assertCursorState(true) : dumpToString(true); if (dupBin != null) { removeCursorDBIN(); dupBin = null; dupIndex = -1; } return getCurrent(foundKey, foundData, lockType); } | /**
* Retrieve the first duplicate at the current cursor position.
*/ | Retrieve the first duplicate at the current cursor position | getFirstDuplicate | {
"repo_name": "nologic/nabs",
"path": "client/trunk/shared/libraries/je-3.2.74/src/com/sleepycat/je/dbi/CursorImpl.java",
"license": "gpl-2.0",
"size": 87984
} | [
"com.sleepycat.je.DatabaseEntry",
"com.sleepycat.je.DatabaseException",
"com.sleepycat.je.OperationStatus",
"com.sleepycat.je.txn.LockType"
] | import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; import com.sleepycat.je.OperationStatus; import com.sleepycat.je.txn.LockType; | import com.sleepycat.je.*; import com.sleepycat.je.txn.*; | [
"com.sleepycat.je"
] | com.sleepycat.je; | 2,054,588 |
Member getMemberByUser(PerunSession sess, Vo vo, User user) throws InternalErrorException, MemberNotExistsException; | Member getMemberByUser(PerunSession sess, Vo vo, User user) throws InternalErrorException, MemberNotExistsException; | /**
* Returns member by his user and vo.
*
* @param sess
* @param vo
* @param user
* @return member
* @throws InternalErrorException
*/ | Returns member by his user and vo | getMemberByUser | {
"repo_name": "ondrocks/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/bl/MembersManagerBl.java",
"license": "bsd-2-clause",
"size": 49250
} | [
"cz.metacentrum.perun.core.api.Member",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.User",
"cz.metacentrum.perun.core.api.Vo",
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException"
] | import cz.metacentrum.perun.core.api.Member; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.User; import cz.metacentrum.perun.core.api.Vo; import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import cz.metacentrum.perun.core.api.exceptions.MemberNotExistsException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 1,304,752 |
@Test
public void testMultiChannelWithQueuedFutureBarriers() {
try {
BufferOrEvent[] sequence = {
// checkpoint 1 - with blocked data
createBuffer(0), createBuffer(2), createBuffer(0),
createBarrier(1, 1), createBarrier(1, 2),
createBuffer(2), createBuffer(1), createBuffer(0),
createBarrier(1, 0),
createBuffer(1), createBuffer(0),
// checkpoint 2 - where future checkpoint barriers come before
// the current checkpoint is complete
createBarrier(2, 1),
createBuffer(1), createBuffer(2), createBarrier(2, 0),
createBarrier(3, 0), createBuffer(0),
createBarrier(3, 1), createBuffer(0), createBuffer(1), createBuffer(2),
createBarrier(4, 1), createBuffer(1), createBuffer(2),
// complete checkpoint 2, send a barrier for checkpoints 4 and 5
createBarrier(2, 2),
createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0),
createBarrier(4, 0),
createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0),
createBarrier(5, 1),
// complete checkpoint 3
createBarrier(3, 2),
createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0),
createBarrier(6, 1),
// complete checkpoint 4, checkpoint 5 remains not fully triggered
createBarrier(4, 2),
createBuffer(2),
createBuffer(1), createEndOfPartition(1),
createBuffer(2), createEndOfPartition(2),
createBuffer(0), createEndOfPartition(0)
};
MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence));
BarrierBuffer buffer = new BarrierBuffer(gate, ioManager);
ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler();
buffer.registerCheckpointEventHandler(handler);
handler.setNextExpectedCheckpointId(1L);
// around checkpoint 1
check(sequence[0], buffer.getNextNonBlocked());
check(sequence[1], buffer.getNextNonBlocked());
check(sequence[2], buffer.getNextNonBlocked());
check(sequence[7], buffer.getNextNonBlocked());
check(sequence[5], buffer.getNextNonBlocked());
assertEquals(2L, handler.getNextExpectedCheckpointId());
check(sequence[6], buffer.getNextNonBlocked());
check(sequence[9], buffer.getNextNonBlocked());
check(sequence[10], buffer.getNextNonBlocked());
// alignment of checkpoint 2 - buffering also some barriers for
// checkpoints 3 and 4
long startTs = System.nanoTime();
check(sequence[13], buffer.getNextNonBlocked());
check(sequence[20], buffer.getNextNonBlocked());
check(sequence[23], buffer.getNextNonBlocked());
// checkpoint 2 completed
check(sequence[12], buffer.getNextNonBlocked());
validateAlignmentTime(startTs, buffer);
check(sequence[25], buffer.getNextNonBlocked());
check(sequence[27], buffer.getNextNonBlocked());
check(sequence[30], buffer.getNextNonBlocked());
check(sequence[32], buffer.getNextNonBlocked());
// checkpoint 3 completed (emit buffered)
check(sequence[16], buffer.getNextNonBlocked());
check(sequence[18], buffer.getNextNonBlocked());
check(sequence[19], buffer.getNextNonBlocked());
check(sequence[28], buffer.getNextNonBlocked());
// past checkpoint 3
check(sequence[36], buffer.getNextNonBlocked());
check(sequence[38], buffer.getNextNonBlocked());
// checkpoint 4 completed (emit buffered)
check(sequence[22], buffer.getNextNonBlocked());
check(sequence[26], buffer.getNextNonBlocked());
check(sequence[31], buffer.getNextNonBlocked());
check(sequence[33], buffer.getNextNonBlocked());
check(sequence[39], buffer.getNextNonBlocked());
// past checkpoint 4, alignment for checkpoint 5
check(sequence[42], buffer.getNextNonBlocked());
check(sequence[45], buffer.getNextNonBlocked());
check(sequence[46], buffer.getNextNonBlocked());
// abort checkpoint 5 (end of partition)
check(sequence[37], buffer.getNextNonBlocked());
// start checkpoint 6 alignment
check(sequence[47], buffer.getNextNonBlocked());
check(sequence[48], buffer.getNextNonBlocked());
// end of input, emit remainder
check(sequence[43], buffer.getNextNonBlocked());
check(sequence[44], buffer.getNextNonBlocked());
assertNull(buffer.getNextNonBlocked());
assertNull(buffer.getNextNonBlocked());
buffer.cleanup();
checkNoTempFilesRemain();
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
} | void function() { try { BufferOrEvent[] sequence = { createBuffer(0), createBuffer(2), createBuffer(0), createBarrier(1, 1), createBarrier(1, 2), createBuffer(2), createBuffer(1), createBuffer(0), createBarrier(1, 0), createBuffer(1), createBuffer(0), createBarrier(2, 1), createBuffer(1), createBuffer(2), createBarrier(2, 0), createBarrier(3, 0), createBuffer(0), createBarrier(3, 1), createBuffer(0), createBuffer(1), createBuffer(2), createBarrier(4, 1), createBuffer(1), createBuffer(2), createBarrier(2, 2), createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0), createBarrier(4, 0), createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0), createBarrier(5, 1), createBarrier(3, 2), createBuffer(2), createBuffer(1), createBuffer(2), createBuffer(0), createBarrier(6, 1), createBarrier(4, 2), createBuffer(2), createBuffer(1), createEndOfPartition(1), createBuffer(2), createEndOfPartition(2), createBuffer(0), createEndOfPartition(0) }; MockInputGate gate = new MockInputGate(PAGE_SIZE, 3, Arrays.asList(sequence)); BarrierBuffer buffer = new BarrierBuffer(gate, ioManager); ValidatingCheckpointHandler handler = new ValidatingCheckpointHandler(); buffer.registerCheckpointEventHandler(handler); handler.setNextExpectedCheckpointId(1L); check(sequence[0], buffer.getNextNonBlocked()); check(sequence[1], buffer.getNextNonBlocked()); check(sequence[2], buffer.getNextNonBlocked()); check(sequence[7], buffer.getNextNonBlocked()); check(sequence[5], buffer.getNextNonBlocked()); assertEquals(2L, handler.getNextExpectedCheckpointId()); check(sequence[6], buffer.getNextNonBlocked()); check(sequence[9], buffer.getNextNonBlocked()); check(sequence[10], buffer.getNextNonBlocked()); long startTs = System.nanoTime(); check(sequence[13], buffer.getNextNonBlocked()); check(sequence[20], buffer.getNextNonBlocked()); check(sequence[23], buffer.getNextNonBlocked()); check(sequence[12], buffer.getNextNonBlocked()); validateAlignmentTime(startTs, buffer); check(sequence[25], buffer.getNextNonBlocked()); check(sequence[27], buffer.getNextNonBlocked()); check(sequence[30], buffer.getNextNonBlocked()); check(sequence[32], buffer.getNextNonBlocked()); check(sequence[16], buffer.getNextNonBlocked()); check(sequence[18], buffer.getNextNonBlocked()); check(sequence[19], buffer.getNextNonBlocked()); check(sequence[28], buffer.getNextNonBlocked()); check(sequence[36], buffer.getNextNonBlocked()); check(sequence[38], buffer.getNextNonBlocked()); check(sequence[22], buffer.getNextNonBlocked()); check(sequence[26], buffer.getNextNonBlocked()); check(sequence[31], buffer.getNextNonBlocked()); check(sequence[33], buffer.getNextNonBlocked()); check(sequence[39], buffer.getNextNonBlocked()); check(sequence[42], buffer.getNextNonBlocked()); check(sequence[45], buffer.getNextNonBlocked()); check(sequence[46], buffer.getNextNonBlocked()); check(sequence[37], buffer.getNextNonBlocked()); check(sequence[47], buffer.getNextNonBlocked()); check(sequence[48], buffer.getNextNonBlocked()); check(sequence[43], buffer.getNextNonBlocked()); check(sequence[44], buffer.getNextNonBlocked()); assertNull(buffer.getNextNonBlocked()); assertNull(buffer.getNextNonBlocked()); buffer.cleanup(); checkNoTempFilesRemain(); } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } } | /**
* Validates that the buffer correctly aligns the streams in cases
* where some channels receive barriers from multiple successive checkpoints
* before the pending checkpoint is complete.
*/ | Validates that the buffer correctly aligns the streams in cases where some channels receive barriers from multiple successive checkpoints before the pending checkpoint is complete | testMultiChannelWithQueuedFutureBarriers | {
"repo_name": "zimmermatt/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/io/BarrierBufferTest.java",
"license": "apache-2.0",
"size": 54611
} | [
"java.util.Arrays",
"org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent",
"org.junit.Assert"
] | import java.util.Arrays; import org.apache.flink.runtime.io.network.partition.consumer.BufferOrEvent; import org.junit.Assert; | import java.util.*; import org.apache.flink.runtime.io.network.partition.consumer.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.junit"
] | java.util; org.apache.flink; org.junit; | 1,203,286 |
private LocationRequest createSanitizedRequest(LocationRequest request, int resolutionLevel) {
LocationRequest sanitizedRequest = new LocationRequest(request);
if (resolutionLevel < RESOLUTION_LEVEL_FINE) {
switch (sanitizedRequest.getQuality()) {
case LocationRequest.ACCURACY_FINE:
sanitizedRequest.setQuality(LocationRequest.ACCURACY_BLOCK);
break;
case LocationRequest.POWER_HIGH:
sanitizedRequest.setQuality(LocationRequest.POWER_LOW);
break;
}
// throttle
if (sanitizedRequest.getInterval() < LocationFudger.FASTEST_INTERVAL_MS) {
sanitizedRequest.setInterval(LocationFudger.FASTEST_INTERVAL_MS);
}
if (sanitizedRequest.getFastestInterval() < LocationFudger.FASTEST_INTERVAL_MS) {
sanitizedRequest.setFastestInterval(LocationFudger.FASTEST_INTERVAL_MS);
}
}
// make getFastestInterval() the minimum of interval and fastest interval
if (sanitizedRequest.getFastestInterval() > sanitizedRequest.getInterval()) {
request.setFastestInterval(request.getInterval());
}
return sanitizedRequest;
} | LocationRequest function(LocationRequest request, int resolutionLevel) { LocationRequest sanitizedRequest = new LocationRequest(request); if (resolutionLevel < RESOLUTION_LEVEL_FINE) { switch (sanitizedRequest.getQuality()) { case LocationRequest.ACCURACY_FINE: sanitizedRequest.setQuality(LocationRequest.ACCURACY_BLOCK); break; case LocationRequest.POWER_HIGH: sanitizedRequest.setQuality(LocationRequest.POWER_LOW); break; } if (sanitizedRequest.getInterval() < LocationFudger.FASTEST_INTERVAL_MS) { sanitizedRequest.setInterval(LocationFudger.FASTEST_INTERVAL_MS); } if (sanitizedRequest.getFastestInterval() < LocationFudger.FASTEST_INTERVAL_MS) { sanitizedRequest.setFastestInterval(LocationFudger.FASTEST_INTERVAL_MS); } } if (sanitizedRequest.getFastestInterval() > sanitizedRequest.getInterval()) { request.setFastestInterval(request.getInterval()); } return sanitizedRequest; } | /**
* Creates a LocationRequest based upon the supplied LocationRequest that to meets resolution
* and consistency requirements.
*
* @param request the LocationRequest from which to create a sanitized version
* @return a version of request that meets the given resolution and consistency requirements
* @hide
*/ | Creates a LocationRequest based upon the supplied LocationRequest that to meets resolution and consistency requirements | createSanitizedRequest | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/server/LocationManagerService.java",
"license": "apache-2.0",
"size": 99961
} | [
"android.location.LocationRequest",
"com.android.server.location.LocationFudger"
] | import android.location.LocationRequest; import com.android.server.location.LocationFudger; | import android.location.*; import com.android.server.location.*; | [
"android.location",
"com.android.server"
] | android.location; com.android.server; | 2,528,753 |
public synchronized List<ScheduledJob> getSchedule() {
return runner.getSchedule();
} | synchronized List<ScheduledJob> function() { return runner.getSchedule(); } | /**
* Retrieves a copy of the list of schedules.
*
* @return
*/ | Retrieves a copy of the list of schedules | getSchedule | {
"repo_name": "azkaban/azkaban-legacy",
"path": "azkaban/src/java/azkaban/scheduler/ScheduleManager.java",
"license": "apache-2.0",
"size": 9377
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 239,527 |
static MethodReferenceExpr getEvaluateNodeMethodReference(final String fullNodeClassName) {
MethodReferenceExpr toAdd = new MethodReferenceExpr();
toAdd.setScope(new NameExpr(fullNodeClassName));
toAdd.setIdentifier(EVALUATE_NODE);
return toAdd;
} | static MethodReferenceExpr getEvaluateNodeMethodReference(final String fullNodeClassName) { MethodReferenceExpr toAdd = new MethodReferenceExpr(); toAdd.setScope(new NameExpr(fullNodeClassName)); toAdd.setIdentifier(EVALUATE_NODE); return toAdd; } | /**
* Return a <b>evaluateNode</b> <code>MethodReferenceExpr</code>
* <p>
* <code>{_fullNodeClassName_}::evaluateNode</code>
* </p>
*
* @param fullNodeClassName
* @return
*/ | Return a evaluateNode <code>MethodReferenceExpr</code> <code>{_fullNodeClassName_}::evaluateNode</code> | getEvaluateNodeMethodReference | {
"repo_name": "winklerm/drools",
"path": "kie-pmml-trusty/kie-pmml-models/kie-pmml-models-tree/kie-pmml-models-tree-compiler/src/main/java/org/kie/pmml/models/tree/compiler/factories/KiePMMLNodeFactory.java",
"license": "apache-2.0",
"size": 29168
} | [
"com.github.javaparser.ast.expr.MethodReferenceExpr",
"com.github.javaparser.ast.expr.NameExpr"
] | import com.github.javaparser.ast.expr.MethodReferenceExpr; import com.github.javaparser.ast.expr.NameExpr; | import com.github.javaparser.ast.expr.*; | [
"com.github.javaparser"
] | com.github.javaparser; | 2,204,545 |
public SimpleRefSetMember addSimpleRefSetMember(
SimpleRefSetMember simpleRefSetMember) throws Exception; | SimpleRefSetMember function( SimpleRefSetMember simpleRefSetMember) throws Exception; | /**
* Adds the simpleRefSetMember.
*
* @param simpleRefSetMember the simpleRefSetMember
* @return the simpleRefSetMember
* @throws Exception the exception
*/ | Adds the simpleRefSetMember | addSimpleRefSetMember | {
"repo_name": "WestCoastInformatics/ihtsdo-refset-tool",
"path": "services/src/main/java/org/ihtsdo/otf/refset/services/handlers/TerminologyHandler.java",
"license": "apache-2.0",
"size": 9993
} | [
"org.ihtsdo.otf.refset.rf2.SimpleRefSetMember"
] | import org.ihtsdo.otf.refset.rf2.SimpleRefSetMember; | import org.ihtsdo.otf.refset.rf2.*; | [
"org.ihtsdo.otf"
] | org.ihtsdo.otf; | 2,662,537 |
public static String[] sortStringArray(String[] array) {
if (ObjectUtils.isEmpty(array)) {
return new String[0];
}
Arrays.sort(array);
return array;
} | static String[] function(String[] array) { if (ObjectUtils.isEmpty(array)) { return new String[0]; } Arrays.sort(array); return array; } | /**
* Turn given source String array into sorted array.
* @param array the source array
* @return the sorted array (never <code>null</code>)
*/ | Turn given source String array into sorted array | sortStringArray | {
"repo_name": "PiXeL16/Sea-Nec-IO",
"path": "app/src/main/java/com/greenpixels/seanecio/utils/StringUtils.java",
"license": "mit",
"size": 50503
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 220,092 |
EClass getEndEvent(); | EClass getEndEvent(); | /**
* Returns the meta object for class '{@link org.eclipse.bpmn2.EndEvent <em>End Event</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>End Event</em>'.
* @see org.eclipse.bpmn2.EndEvent
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.bpmn2.EndEvent End Event</code>'. | getEndEvent | {
"repo_name": "Rikkola/kie-wb-common",
"path": "kie-wb-common-stunner/kie-wb-common-stunner-sets/kie-wb-common-stunner-bpmn/kie-wb-common-stunner-bpmn-emf/src/main/java/org/eclipse/bpmn2/Bpmn2Package.java",
"license": "apache-2.0",
"size": 929298
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,124,235 |
@Override public void exitDisplayList(@NotNull AQLParser.DisplayListContext ctx) { } | @Override public void exitDisplayList(@NotNull AQLParser.DisplayListContext ctx) { } | /**
* {@inheritDoc}
* <p/>
* The default implementation does nothing.
*/ | The default implementation does nothing | enterDisplayList | {
"repo_name": "chriswhite199/jdbc-driver",
"path": "src/main/java/com/ibm/si/jaql/aql/AQLBaseListener.java",
"license": "apache-2.0",
"size": 13047
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,190,088 |
private void updateOtherLinkerFlagsForOptions(
TargetNode<? extends CommonArg> targetNode,
Optional<TargetNode<AppleBundleDescriptionArg>> bundleLoaderNode,
Builder<String, String> appendConfigsBuilder,
Iterable<String> otherLdFlags,
Iterable<String> swiftLinkerFlags) {
// Local: Local to the current project and built by Xcode.
// Focused: Included in the workspace and built by Xcode but not in current project.
// Other: Not included in the workspace to be built by Xcode.
FluentIterable<TargetNode<?>> depTargetNodes = collectRecursiveLibraryDepTargets(targetNode);
// Don't duplicate linker flags for the bundle loader.
FluentIterable<TargetNode<?>> filteredDeps =
collectRecursiveLibraryDepsMinusBundleLoaderDeps(
targetNode, depTargetNodes, bundleLoaderNode);
ImmutableSet<FrameworkPath> systemFwkOrLibs = getSytemFrameworksLibsForTargetNode(targetNode);
ImmutableList<String> systemFwkOrLibFlags =
collectSystemLibraryAndFrameworkLinkerFlags(systemFwkOrLibs);
if (options.shouldForceLoadLinkWholeLibraries() || options.shouldAddLinkedLibrariesAsFlags()) {
ImmutableList<String> forceLoadLocal =
collectForceLoadLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps, FilterFlags.LIBRARY_CURRENT_PROJECT_WITH_FORCE_LOAD));
ImmutableList<String> forceLoadFocused =
collectForceLoadLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps, FilterFlags.LIBRARY_FOCUSED_WITH_FORCE_LOAD));
ImmutableList<String> forceLoadOther =
collectForceLoadLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps, FilterFlags.LIBRARY_OTHER_WITH_FORCE_LOAD));
appendConfigsBuilder.put(
"BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_LOCAL",
Streams.stream(forceLoadLocal)
.map(Escaper.BASH_ESCAPER)
.collect(Collectors.joining(" ")));
appendConfigsBuilder.put(
"BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_FOCUSED",
Streams.stream(forceLoadFocused)
.map(Escaper.BASH_ESCAPER)
.collect(Collectors.joining(" ")));
appendConfigsBuilder.put(
"BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_OTHER",
Streams.stream(forceLoadOther)
.map(Escaper.BASH_ESCAPER)
.collect(Collectors.joining(" ")));
}
if (options.shouldAddLinkedLibrariesAsFlags()) {
// If force load enabled, then don't duplicate the flags in the OTHER flags, otherwise they
// will just be included like normal dependencies.
boolean shouldLimitByForceLoad = options.shouldForceLoadLinkWholeLibraries();
Iterable<String> localLibraryFlags =
collectLibraryLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps,
shouldLimitByForceLoad
? FilterFlags.LIBRARY_CURRENT_PROJECT_WITHOUT_FORCE_LOAD
: FilterFlags.LIBRARY_CURRENT_PROJECT));
Iterable<String> focusedLibraryFlags =
collectLibraryLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps,
shouldLimitByForceLoad
? FilterFlags.LIBRARY_FOCUSED_WITHOUT_FORCE_LOAD
: FilterFlags.LIBRARY_FOCUSED));
Iterable<String> otherLibraryFlags =
collectLibraryLinkerFlags(
filterRecursiveLibraryDepsIterable(
filteredDeps,
shouldLimitByForceLoad
? FilterFlags.LIBRARY_OTHER_WITHOUT_FORCE_LOAD
: FilterFlags.LIBRARY_OTHER));
Iterable<String> localFrameworkFlags =
collectFrameworkLinkerFlags(
filterRecursiveLibraryDepsIterable(
depTargetNodes, FilterFlags.FRAMEWORK_CURRENT_PROJECT));
Iterable<String> focusedFrameworkFlags =
collectFrameworkLinkerFlags(
filterRecursiveLibraryDepsIterable(depTargetNodes, FilterFlags.FRAMEWORK_FOCUSED));
Iterable<String> otherFrameworkFlags =
collectFrameworkLinkerFlags(
filterRecursiveLibraryDepsIterable(depTargetNodes, FilterFlags.FRAMEWORK_OTHER));
appendConfigsBuilder
.put(
"BUCK_LINKER_FLAGS_LIBRARY_LOCAL",
Streams.stream(localLibraryFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_LIBRARY_FOCUSED",
Streams.stream(focusedLibraryFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_LIBRARY_OTHER",
Streams.stream(otherLibraryFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_FRAMEWORK_LOCAL",
Streams.stream(localFrameworkFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_FRAMEWORK_FOCUSED",
Streams.stream(focusedFrameworkFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_FRAMEWORK_OTHER",
Streams.stream(otherFrameworkFlags).collect(Collectors.joining(" ")))
.put(
"BUCK_LINKER_FLAGS_SYSTEM",
Streams.stream(systemFwkOrLibFlags).collect(Collectors.joining(" ")));
}
Stream<String> allOtherLdFlagsStream =
Streams.stream(Iterables.concat(otherLdFlags, swiftLinkerFlags)).map(Escaper.BASH_ESCAPER);
if (options.shouldForceLoadLinkWholeLibraries() && options.shouldAddLinkedLibrariesAsFlags()) {
appendConfigsBuilder.put(
"OTHER_LDFLAGS",
Streams.concat(
allOtherLdFlagsStream,
Stream.of(
"$BUCK_LINKER_FLAGS_SYSTEM",
"$BUCK_LINKER_FLAGS_FRAMEWORK_LOCAL",
"$BUCK_LINKER_FLAGS_FRAMEWORK_FOCUSED",
"$BUCK_LINKER_FLAGS_FRAMEWORK_OTHER",
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_LOCAL",
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_FOCUSED",
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_OTHER",
"$BUCK_LINKER_FLAGS_LIBRARY_LOCAL",
"$BUCK_LINKER_FLAGS_LIBRARY_FOCUSED",
"$BUCK_LINKER_FLAGS_LIBRARY_OTHER"))
.collect(Collectors.joining(" ")));
} else if (options.shouldForceLoadLinkWholeLibraries()
&& !options.shouldAddLinkedLibrariesAsFlags()) {
appendConfigsBuilder.put(
"OTHER_LDFLAGS",
Streams.concat(
allOtherLdFlagsStream,
Stream.of(
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_LOCAL",
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_FOCUSED",
"$BUCK_LINKER_FLAGS_LIBRARY_FORCE_LOAD_OTHER"))
.collect(Collectors.joining(" ")));
} else if (options.shouldAddLinkedLibrariesAsFlags()) {
appendConfigsBuilder.put(
"OTHER_LDFLAGS",
Streams.concat(
allOtherLdFlagsStream,
Stream.of(
"$BUCK_LINKER_FLAGS_SYSTEM",
"$BUCK_LINKER_FLAGS_FRAMEWORK_LOCAL",
"$BUCK_LINKER_FLAGS_FRAMEWORK_FOCUSED",
"$BUCK_LINKER_FLAGS_FRAMEWORK_OTHER",
"$BUCK_LINKER_FLAGS_LIBRARY_LOCAL",
"$BUCK_LINKER_FLAGS_LIBRARY_FOCUSED",
"$BUCK_LINKER_FLAGS_LIBRARY_OTHER"))
.collect(Collectors.joining(" ")));
} else {
appendConfigsBuilder.put(
"OTHER_LDFLAGS", allOtherLdFlagsStream.collect(Collectors.joining(" ")));
}
} | void function( TargetNode<? extends CommonArg> targetNode, Optional<TargetNode<AppleBundleDescriptionArg>> bundleLoaderNode, Builder<String, String> appendConfigsBuilder, Iterable<String> otherLdFlags, Iterable<String> swiftLinkerFlags) { FluentIterable<TargetNode<?>> depTargetNodes = collectRecursiveLibraryDepTargets(targetNode); FluentIterable<TargetNode<?>> filteredDeps = collectRecursiveLibraryDepsMinusBundleLoaderDeps( targetNode, depTargetNodes, bundleLoaderNode); ImmutableSet<FrameworkPath> systemFwkOrLibs = getSytemFrameworksLibsForTargetNode(targetNode); ImmutableList<String> systemFwkOrLibFlags = collectSystemLibraryAndFrameworkLinkerFlags(systemFwkOrLibs); if (options.shouldForceLoadLinkWholeLibraries() options.shouldAddLinkedLibrariesAsFlags()) { ImmutableList<String> forceLoadLocal = collectForceLoadLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, FilterFlags.LIBRARY_CURRENT_PROJECT_WITH_FORCE_LOAD)); ImmutableList<String> forceLoadFocused = collectForceLoadLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, FilterFlags.LIBRARY_FOCUSED_WITH_FORCE_LOAD)); ImmutableList<String> forceLoadOther = collectForceLoadLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, FilterFlags.LIBRARY_OTHER_WITH_FORCE_LOAD)); appendConfigsBuilder.put( STR, Streams.stream(forceLoadLocal) .map(Escaper.BASH_ESCAPER) .collect(Collectors.joining(" "))); appendConfigsBuilder.put( STR, Streams.stream(forceLoadFocused) .map(Escaper.BASH_ESCAPER) .collect(Collectors.joining(" "))); appendConfigsBuilder.put( STR, Streams.stream(forceLoadOther) .map(Escaper.BASH_ESCAPER) .collect(Collectors.joining(" "))); } if (options.shouldAddLinkedLibrariesAsFlags()) { boolean shouldLimitByForceLoad = options.shouldForceLoadLinkWholeLibraries(); Iterable<String> localLibraryFlags = collectLibraryLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, shouldLimitByForceLoad ? FilterFlags.LIBRARY_CURRENT_PROJECT_WITHOUT_FORCE_LOAD : FilterFlags.LIBRARY_CURRENT_PROJECT)); Iterable<String> focusedLibraryFlags = collectLibraryLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, shouldLimitByForceLoad ? FilterFlags.LIBRARY_FOCUSED_WITHOUT_FORCE_LOAD : FilterFlags.LIBRARY_FOCUSED)); Iterable<String> otherLibraryFlags = collectLibraryLinkerFlags( filterRecursiveLibraryDepsIterable( filteredDeps, shouldLimitByForceLoad ? FilterFlags.LIBRARY_OTHER_WITHOUT_FORCE_LOAD : FilterFlags.LIBRARY_OTHER)); Iterable<String> localFrameworkFlags = collectFrameworkLinkerFlags( filterRecursiveLibraryDepsIterable( depTargetNodes, FilterFlags.FRAMEWORK_CURRENT_PROJECT)); Iterable<String> focusedFrameworkFlags = collectFrameworkLinkerFlags( filterRecursiveLibraryDepsIterable(depTargetNodes, FilterFlags.FRAMEWORK_FOCUSED)); Iterable<String> otherFrameworkFlags = collectFrameworkLinkerFlags( filterRecursiveLibraryDepsIterable(depTargetNodes, FilterFlags.FRAMEWORK_OTHER)); appendConfigsBuilder .put( STR, Streams.stream(localLibraryFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(focusedLibraryFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(otherLibraryFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(localFrameworkFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(focusedFrameworkFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(otherFrameworkFlags).collect(Collectors.joining(" "))) .put( STR, Streams.stream(systemFwkOrLibFlags).collect(Collectors.joining(" "))); } Stream<String> allOtherLdFlagsStream = Streams.stream(Iterables.concat(otherLdFlags, swiftLinkerFlags)).map(Escaper.BASH_ESCAPER); if (options.shouldForceLoadLinkWholeLibraries() && options.shouldAddLinkedLibrariesAsFlags()) { appendConfigsBuilder.put( STR, Streams.concat( allOtherLdFlagsStream, Stream.of( STR, STR, STR, STR, STR, STR, STR, STR, STR, STR)) .collect(Collectors.joining(" "))); } else if (options.shouldForceLoadLinkWholeLibraries() && !options.shouldAddLinkedLibrariesAsFlags()) { appendConfigsBuilder.put( STR, Streams.concat( allOtherLdFlagsStream, Stream.of( STR, STR, STR)) .collect(Collectors.joining(" "))); } else if (options.shouldAddLinkedLibrariesAsFlags()) { appendConfigsBuilder.put( STR, Streams.concat( allOtherLdFlagsStream, Stream.of( STR, STR, STR, STR, STR, STR, STR)) .collect(Collectors.joining(" "))); } else { appendConfigsBuilder.put( STR, allOtherLdFlagsStream.collect(Collectors.joining(" "))); } } | /**
* Subdivide the various deps and write out to the xcconfig file for scripts to post process if
* needed*
*/ | Subdivide the various deps and write out to the xcconfig file for scripts to post process if needed | updateOtherLinkerFlagsForOptions | {
"repo_name": "JoelMarcey/buck",
"path": "src/com/facebook/buck/features/apple/project/ProjectGenerator.java",
"license": "apache-2.0",
"size": 227240
} | [
"com.facebook.buck.apple.AppleBundleDescriptionArg",
"com.facebook.buck.core.model.targetgraph.TargetNode",
"com.facebook.buck.cxx.CxxLibraryDescription",
"com.facebook.buck.rules.coercer.FrameworkPath",
"com.facebook.buck.util.Escaper",
"com.google.common.collect.FluentIterable",
"com.google.common.col... | import com.facebook.buck.apple.AppleBundleDescriptionArg; import com.facebook.buck.core.model.targetgraph.TargetNode; import com.facebook.buck.cxx.CxxLibraryDescription; import com.facebook.buck.rules.coercer.FrameworkPath; import com.facebook.buck.util.Escaper; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Streams; import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; | import com.facebook.buck.apple.*; import com.facebook.buck.core.model.targetgraph.*; import com.facebook.buck.cxx.*; import com.facebook.buck.rules.coercer.*; import com.facebook.buck.util.*; import com.google.common.collect.*; import java.util.*; import java.util.stream.*; | [
"com.facebook.buck",
"com.google.common",
"java.util"
] | com.facebook.buck; com.google.common; java.util; | 2,231,715 |
private String findLatestVersion() throws IOException {
String response = getHttpContents(new URL(IGNITE_LATEST_VERSION_URL));
if (response == null)
throw new RuntimeException("Failed to identify the latest version. Specify it with " + IGNITE_VERSION);
Matcher m = VERSION_PATTERN.matcher(response);
if (m.find())
return m.group();
else
throw new RuntimeException("Failed to retrieve the latest version. Specify it with " + IGNITE_VERSION);
} | String function() throws IOException { String response = getHttpContents(new URL(IGNITE_LATEST_VERSION_URL)); if (response == null) throw new RuntimeException(STR + IGNITE_VERSION); Matcher m = VERSION_PATTERN.matcher(response); if (m.find()) return m.group(); else throw new RuntimeException(STR + IGNITE_VERSION); } | /**
* Attempts to obtain the latest version.
*
* @return Latest version.
* @throws IOException If failed.
*/ | Attempts to obtain the latest version | findLatestVersion | {
"repo_name": "amirakhmedov/ignite",
"path": "modules/mesos/src/main/java/org/apache/ignite/mesos/resource/IgniteProvider.java",
"license": "apache-2.0",
"size": 8430
} | [
"java.io.IOException",
"java.util.regex.Matcher"
] | import java.io.IOException; import java.util.regex.Matcher; | import java.io.*; import java.util.regex.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 481,161 |
public void setInboundHeaderPatterns(String... inboundHeaderPatterns) {
Assert.notNull(inboundHeaderPatterns, "Header patterns can't be null.");
Assert.noNullElements(inboundHeaderPatterns, "No header pattern can be null.");
this.inboundHeaderPatterns = Arrays.copyOf(inboundHeaderPatterns, inboundHeaderPatterns.length);
} | void function(String... inboundHeaderPatterns) { Assert.notNull(inboundHeaderPatterns, STR); Assert.noNullElements(inboundHeaderPatterns, STR); this.inboundHeaderPatterns = Arrays.copyOf(inboundHeaderPatterns, inboundHeaderPatterns.length); } | /**
* Set the patterns of the headers to be mapped in {@link #toHeaders(Map)}. First patterns take
* precedence.
*
* @param inboundHeaderPatterns header patterns to be mapped
*/ | Set the patterns of the headers to be mapped in <code>#toHeaders(Map)</code>. First patterns take precedence | setInboundHeaderPatterns | {
"repo_name": "GoogleCloudPlatform/spring-cloud-gcp",
"path": "spring-cloud-gcp-pubsub/src/main/java/com/google/cloud/spring/pubsub/integration/PubSubHeaderMapper.java",
"license": "apache-2.0",
"size": 4995
} | [
"java.util.Arrays",
"org.springframework.util.Assert"
] | import java.util.Arrays; import org.springframework.util.Assert; | import java.util.*; import org.springframework.util.*; | [
"java.util",
"org.springframework.util"
] | java.util; org.springframework.util; | 1,151,118 |
public void setDsName(final String newDsName) throws RrdException, IOException {
if (newDsName.length() > RrdString.STRING_LENGTH) {
throw new RrdException("Invalid datasource name specified: " + newDsName);
}
if (parentDb.containsDs(newDsName)) {
throw new RrdException("Datasource already defined in this RRD: " + newDsName);
}
dsName.set(newDsName);
m_primitiveDsName = null;
} | void function(final String newDsName) throws RrdException, IOException { if (newDsName.length() > RrdString.STRING_LENGTH) { throw new RrdException(STR + newDsName); } if (parentDb.containsDs(newDsName)) { throw new RrdException(STR + newDsName); } dsName.set(newDsName); m_primitiveDsName = null; } | /**
* Sets datasource name to a new value
*
* @param newDsName New datasource name
* @throws RrdException Thrown if invalid data source name is specified (name too long, or
* name already defined in the RRD
* @throws IOException Thrown in case of I/O error
*/ | Sets datasource name to a new value | setDsName | {
"repo_name": "OpenNMS/jrobin",
"path": "src/main/java/org/jrobin/core/Datasource.java",
"license": "lgpl-2.1",
"size": 17340
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 409,978 |
private static void visitUnboxingMethod(MethodVisitor mv, Class<?> type) {
if (type == boolean.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Boolean");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Boolean", "booleanValue", "()Z", false);
} else if (type == int.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Integer");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Integer", "intValue", "()I", false);
} else if (type == byte.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Byte");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Byte", "byteValue", "()B", false);
} else if (type == short.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Short");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Short", "shortValue", "()S", false);
} else if (type == long.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Long");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Long", "longValue", "()J", false);
} else if (type == float.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Float");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Float", "floatValue", "()F", false);
} else if (type == double.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Double");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Double", "doubleValue", "()D", false);
} else if (type == char.class) {
mv.visitTypeInsn(CHECKCAST, "java/lang/Character");
mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Character", "charValue", "()C", false);
} else {
mv.visitTypeInsn(CHECKCAST, Type.getInternalName(type));
}
} | static void function(MethodVisitor mv, Class<?> type) { if (type == boolean.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()Z", false); } else if (type == int.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()I", false); } else if (type == byte.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()B", false); } else if (type == short.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()S", false); } else if (type == long.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()J", false); } else if (type == float.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()F", false); } else if (type == double.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()D", false); } else if (type == char.class) { mv.visitTypeInsn(CHECKCAST, STR); mv.visitMethodInsn(INVOKEVIRTUAL, STR, STR, "()C", false); } else { mv.visitTypeInsn(CHECKCAST, Type.getInternalName(type)); } } | /**
* Insert the necessary methods to unbox a primitive type (if the given type
* is a primitive).
*
* @param mv The method visitor
* @param type The type to unbox
*/ | Insert the necessary methods to unbox a primitive type (if the given type is a primitive) | visitUnboxingMethod | {
"repo_name": "jonk1993/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/util/event/factory/ClassGenerator.java",
"license": "mit",
"size": 29808
} | [
"org.objectweb.asm.MethodVisitor",
"org.objectweb.asm.Type"
] | import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Type; | import org.objectweb.asm.*; | [
"org.objectweb.asm"
] | org.objectweb.asm; | 1,670,283 |
private void handleActions(String dataToSend, String senderIP, boolean isProfile) {
Iterator<String> iterator = groupManager.iterator();
while (iterator.hasNext()){
String ip = iterator.next();
if(!ip.equals(senderIP)) {
Bundle bundle = prepareBundle(dataToSend, ip, isProfile);
new AsyncClient().execute(bundle);
}
}
}
class AsyncClient extends AsyncTask<Bundle, Void, Boolean> implements CommunicationProtocol.ProtocolListener {
private IProfile profile;
private Socket socket;
//Indicates whether the client is still running
private boolean running;
//Monitor used for the concurrent access to running
private final Object monitor = new Object(); | void function(String dataToSend, String senderIP, boolean isProfile) { Iterator<String> iterator = groupManager.iterator(); while (iterator.hasNext()){ String ip = iterator.next(); if(!ip.equals(senderIP)) { Bundle bundle = prepareBundle(dataToSend, ip, isProfile); new AsyncClient().execute(bundle); } } } class AsyncClient extends AsyncTask<Bundle, Void, Boolean> implements CommunicationProtocol.ProtocolListener { private IProfile profile; private Socket socket; private boolean running; private final Object monitor = new Object(); | /**
* Handle action Foo in the provided background thread with the provided
* parameters.
*/ | Handle action Foo in the provided background thread with the provided parameters | handleActions | {
"repo_name": "mattiadg/neighborhood",
"path": "app/src/main/java/fr/upem/android/communication/BroadcastingService.java",
"license": "gpl-2.0",
"size": 10119
} | [
"android.os.AsyncTask",
"android.os.Bundle",
"fr.upem.android.usersprovider.IProfile",
"java.net.Socket",
"java.util.Iterator"
] | import android.os.AsyncTask; import android.os.Bundle; import fr.upem.android.usersprovider.IProfile; import java.net.Socket; import java.util.Iterator; | import android.os.*; import fr.upem.android.usersprovider.*; import java.net.*; import java.util.*; | [
"android.os",
"fr.upem.android",
"java.net",
"java.util"
] | android.os; fr.upem.android; java.net; java.util; | 1,975,797 |
public static ParcelFileDescriptor[] createSocketPair() throws IOException {
try {
final FileDescriptor fd0 = new FileDescriptor();
final FileDescriptor fd1 = new FileDescriptor();
Libcore.os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1);
return new ParcelFileDescriptor[] {
new ParcelFileDescriptor(fd0),
new ParcelFileDescriptor(fd1) };
} catch (ErrnoException e) {
throw e.rethrowAsIOException();
}
} | static ParcelFileDescriptor[] function() throws IOException { try { final FileDescriptor fd0 = new FileDescriptor(); final FileDescriptor fd1 = new FileDescriptor(); Libcore.os.socketpair(AF_UNIX, SOCK_STREAM, 0, fd0, fd1); return new ParcelFileDescriptor[] { new ParcelFileDescriptor(fd0), new ParcelFileDescriptor(fd1) }; } catch (ErrnoException e) { throw e.rethrowAsIOException(); } } | /**
* Create two ParcelFileDescriptors structured as a pair of sockets
* connected to each other. The two sockets are indistinguishable.
*/ | Create two ParcelFileDescriptors structured as a pair of sockets connected to each other. The two sockets are indistinguishable | createSocketPair | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/android/os/ParcelFileDescriptor.java",
"license": "apache-2.0",
"size": 36600
} | [
"java.io.FileDescriptor",
"java.io.IOException"
] | import java.io.FileDescriptor; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 387,603 |
public static void main(String[] args) {
JFrame vFrame = new JFrame(RoundLabel.class.getName());
vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
vFrame.setSize(300, 100);
vFrame.setLayout(new GridBagLayout());
RoundLabel label = new RoundLabel("Hello", Color.white, new Color(198, 211, 247));
vFrame.add(label, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 10));
vFrame.setTitle("Aqua Button");
vFrame.setVisible(true);
} | static void function(String[] args) { JFrame vFrame = new JFrame(RoundLabel.class.getName()); vFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); vFrame.setSize(300, 100); vFrame.setLayout(new GridBagLayout()); RoundLabel label = new RoundLabel("Hello", Color.white, new Color(198, 211, 247)); vFrame.add(label, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 10)); vFrame.setTitle(STR); vFrame.setVisible(true); } | /**
* A main method to test the panel.
*
* @param args
*/ | A main method to test the panel | main | {
"repo_name": "guusdk/Spark",
"path": "plugins/sip/src/main/java/org/jivesoftware/sparkplugin/ui/components/RoundLabel.java",
"license": "apache-2.0",
"size": 5797
} | [
"java.awt.Color",
"java.awt.GridBagConstraints",
"java.awt.GridBagLayout",
"java.awt.Insets",
"javax.swing.JFrame"
] | import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import javax.swing.JFrame; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 1,728,747 |
public void addTypes2Category(Hashtable<String, String> types,
Category category);
| void function(Hashtable<String, String> types, Category category); | /**
* Add supported types to the category
*
* @param types
* each type name has an optional human readable description
* @param category
*/ | Add supported types to the category | addTypes2Category | {
"repo_name": "iLabrys/iLabrysOSGi",
"path": "es.itecban.deployment.resource.taxonomy/src/es/itecban/deployment/resource/taxonomy/TaxonomyManager.java",
"license": "apache-2.0",
"size": 1452
} | [
"java.util.Hashtable"
] | import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 1,881,076 |
public Map<String, InstanceProperties> getLimiters() {
return instances;
} | Map<String, InstanceProperties> function() { return instances; } | /**
* For backwards compatibility when setting limiters in configuration properties.
*/ | For backwards compatibility when setting limiters in configuration properties | getLimiters | {
"repo_name": "RobWin/javaslang-circuitbreaker",
"path": "resilience4j-framework-common/src/main/java/io/github/resilience4j/common/ratelimiter/configuration/RateLimiterConfigurationProperties.java",
"license": "apache-2.0",
"size": 12227
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,543,161 |
private EdgePoint closestEdge(Point point){
EdgePoint ep = new EdgePoint();
if(npoints == 0){
return null;
}else if(npoints == 1){
ep.point = getPoint(0);
ep.edgeIndex = 0;
return ep;
}else{
int index = 0;
Point closest = getPoint(0);
double shortest = closest.distance(point);
for(int i = 0; i < npoints; i++){
Point p1, p2;
if(i == npoints - 1){
p1 = getPoint(i);
p2 = getPoint(0);
}else{
p1 = getPoint(i);
p2 = getPoint(i+1);
}
Line2D.Double line = new Line2D.Double(p1, p2);
Point current = closestPoint(line, point);
double distance = current.distance(point);
if(distance < shortest){
index = i;
closest = current;
shortest = distance;
}
}
ep.point = closest;
ep.edgeIndex = index;
return ep;
}
} | EdgePoint function(Point point){ EdgePoint ep = new EdgePoint(); if(npoints == 0){ return null; }else if(npoints == 1){ ep.point = getPoint(0); ep.edgeIndex = 0; return ep; }else{ int index = 0; Point closest = getPoint(0); double shortest = closest.distance(point); for(int i = 0; i < npoints; i++){ Point p1, p2; if(i == npoints - 1){ p1 = getPoint(i); p2 = getPoint(0); }else{ p1 = getPoint(i); p2 = getPoint(i+1); } Line2D.Double line = new Line2D.Double(p1, p2); Point current = closestPoint(line, point); double distance = current.distance(point); if(distance < shortest){ index = i; closest = current; shortest = distance; } } ep.point = closest; ep.edgeIndex = index; return ep; } } | /**
* Finds the closest EdgePoint to the argument point.
* @param point The point to which find the closest EdgePoint
* @return The closest EdgePoint to the input arguement.
*/ | Finds the closest EdgePoint to the argument point | closestEdge | {
"repo_name": "ali-185/ComicBookCreator",
"path": "src/comicBookModel/Border.java",
"license": "gpl-2.0",
"size": 18246
} | [
"java.awt.Point",
"java.awt.geom.Line2D"
] | import java.awt.Point; import java.awt.geom.Line2D; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,717,261 |
ResultDataInterface getResult(InputDataInterface inputData) throws BizLogicException,
DAOException;
| ResultDataInterface getResult(InputDataInterface inputData) throws BizLogicException, DAOException; | /**
* Applies business logic on the passed input data and retunrs back the result.
*
* @param inputData Data on which Business Logic will operate.
* @return ResultDataInterface Result data, which can be SuccessResultData or ValidationResultData.
* @throws Exception exception
*/ | Applies business logic on the passed input data and retunrs back the result | getResult | {
"repo_name": "NCIP/geneconnect",
"path": "Coding and Testing/GeneConnectWeb/WEB-INF/src/edu/wustl/geneconnect/bizlogic/BizLogicInterface.java",
"license": "bsd-3-clause",
"size": 1002
} | [
"edu.wustl.common.exception.BizLogicException",
"edu.wustl.common.util.dbManager.DAOException"
] | import edu.wustl.common.exception.BizLogicException; import edu.wustl.common.util.dbManager.DAOException; | import edu.wustl.common.exception.*; import edu.wustl.common.util.*; | [
"edu.wustl.common"
] | edu.wustl.common; | 2,243,705 |
void createPendingConnectionsRequest(@NonNull TGRequestCallback<TGPendingConnections> callback); | void createPendingConnectionsRequest(@NonNull TGRequestCallback<TGPendingConnections> callback); | /**
* Create pending connection with selected type
*
* @param callback return callback
*/ | Create pending connection with selected type | createPendingConnectionsRequest | {
"repo_name": "tapglue/android_sdk",
"path": "v1/tapglue-android-sdk/tapglue-android-sdk/src/main/java/com/tapglue/networking/TGRequests.java",
"license": "apache-2.0",
"size": 12785
} | [
"android.support.annotation.NonNull",
"com.tapglue.model.TGPendingConnections",
"com.tapglue.networking.requests.TGRequestCallback"
] | import android.support.annotation.NonNull; import com.tapglue.model.TGPendingConnections; import com.tapglue.networking.requests.TGRequestCallback; | import android.support.annotation.*; import com.tapglue.model.*; import com.tapglue.networking.requests.*; | [
"android.support",
"com.tapglue.model",
"com.tapglue.networking"
] | android.support; com.tapglue.model; com.tapglue.networking; | 1,005,697 |
@Test
public void testHashCode() {
final TestIpAddress actual1 = new TestIpAddress();
final TestIpAddress actual2 = new TestIpAddress();
actual1.setIpAddress("124");
actual2.setIpAddress("556");
Assert.assertTrue(actual1.hashCode() != actual2.hashCode());
}
} | void function() { final TestIpAddress actual1 = new TestIpAddress(); final TestIpAddress actual2 = new TestIpAddress(); actual1.setIpAddress("124"); actual2.setIpAddress("556"); Assert.assertTrue(actual1.hashCode() != actual2.hashCode()); } } | /**
* Test hashCode
*/ | Test hashCode | testHashCode | {
"repo_name": "eltonnuness/unison",
"path": "src/test/java/uk/co/sleonard/unison/datahandling/DAO/IpAddressTest.java",
"license": "apache-2.0",
"size": 1892
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,262,678 |
if (args.length != 2) {
LOGGER.error("Usage : <propertiesInputFile> <yamlOutputFile>");
return;
}
String propertiesInputFile = args[0];
String yamlOutputFile = args[1];
Map<String, String> flatConf = ConfigurationLoader
.propertiesAsConfiguration(propertiesInputFile);
writeYaml(propertiesInputFile, yamlOutputFile, unflatten(flatConf));
} | if (args.length != 2) { LOGGER.error(STR); return; } String propertiesInputFile = args[0]; String yamlOutputFile = args[1]; Map<String, String> flatConf = ConfigurationLoader .propertiesAsConfiguration(propertiesInputFile); writeYaml(propertiesInputFile, yamlOutputFile, unflatten(flatConf)); } | /**
* Convert a flume-ng configuration from a properties format to a YAML
* format.
*
* @throws IOException
* fail fast, no strategy on error
*/ | Convert a flume-ng configuration from a properties format to a YAML format | main | {
"repo_name": "BertrandDechoux/flume-ng-yaml",
"path": "src/main/java/org/apache/flume/cli/Properties2Yaml.java",
"license": "apache-2.0",
"size": 3814
} | [
"java.util.Map",
"org.apache.flume.node.ConfigurationLoader"
] | import java.util.Map; import org.apache.flume.node.ConfigurationLoader; | import java.util.*; import org.apache.flume.node.*; | [
"java.util",
"org.apache.flume"
] | java.util; org.apache.flume; | 836,359 |
private void writeState(DataOutputStream dos) throws IOException {
// Write the repositories
dos.writeInt(REPOSITORIES_STATE_FILE_VERSION_3);
// Write out the repos
Collection<ISVNRepositoryLocation> repos = repositories.values();
dos.writeInt(repos.size());
for (ISVNRepositoryLocation reposLocation : repos) {
SVNRepositoryLocation root = (SVNRepositoryLocation)reposLocation;
dos.writeUTF(root.getLocation());
if (root.getLabel() == null) {
dos.writeUTF("");
} else {
dos.writeUTF(root.getLabel());
}
if (root.getRepositoryRoot() == null) {
dos.writeUTF("");
} else {
dos.writeUTF(root.getRepositoryRoot().toString());
}
}
dos.flush();
dos.close();
} | void function(DataOutputStream dos) throws IOException { dos.writeInt(REPOSITORIES_STATE_FILE_VERSION_3); Collection<ISVNRepositoryLocation> repos = repositories.values(); dos.writeInt(repos.size()); for (ISVNRepositoryLocation reposLocation : repos) { SVNRepositoryLocation root = (SVNRepositoryLocation)reposLocation; dos.writeUTF(root.getLocation()); if (root.getLabel() == null) { dos.writeUTF(STR"); } else { dos.writeUTF(root.getRepositoryRoot().toString()); } } dos.flush(); dos.close(); } | /**
* write the state of the plugin ie the repositories locations
* @param dos
* @throws IOException
*/ | write the state of the plugin ie the repositories locations | writeState | {
"repo_name": "apicloudcom/APICloud-Studio",
"path": "org.tigris.subversion.subclipse.core/src/org/tigris/subversion/subclipse/core/repo/SVNRepositories.java",
"license": "gpl-3.0",
"size": 14939
} | [
"java.io.DataOutputStream",
"java.io.IOException",
"java.util.Collection",
"org.tigris.subversion.subclipse.core.ISVNRepositoryLocation"
] | import java.io.DataOutputStream; import java.io.IOException; import java.util.Collection; import org.tigris.subversion.subclipse.core.ISVNRepositoryLocation; | import java.io.*; import java.util.*; import org.tigris.subversion.subclipse.core.*; | [
"java.io",
"java.util",
"org.tigris.subversion"
] | java.io; java.util; org.tigris.subversion; | 2,472,901 |
public boolean primitiveMkdir(String src, FsPermission absPermission)
throws IOException {
return primitiveMkdir(src, absPermission, true);
} | boolean function(String src, FsPermission absPermission) throws IOException { return primitiveMkdir(src, absPermission, true); } | /**
* Same {{@link #mkdirs(String, FsPermission, boolean)} except
* that the permissions has already been masked against umask.
*/ | Same {<code>#mkdirs(String, FsPermission, boolean)</code> except that the permissions has already been masked against umask | primitiveMkdir | {
"repo_name": "jonathangizmo/HadoopDistJ",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSClient.java",
"license": "mit",
"size": 117695
} | [
"java.io.IOException",
"org.apache.hadoop.fs.permission.FsPermission"
] | import java.io.IOException; import org.apache.hadoop.fs.permission.FsPermission; | import java.io.*; import org.apache.hadoop.fs.permission.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 586,852 |
public Adapter createMessageComponentAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link iso20022.MessageComponent <em>Message Component</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see iso20022.MessageComponent
* @generated
*/ | Creates a new adapter for an object of class '<code>iso20022.MessageComponent Message Component</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createMessageComponentAdapter | {
"repo_name": "ISO20022ArchitectForum/sample-code-public",
"path": "DLT/Corda/ISO20022Generated/src/iso20022/util/Iso20022AdapterFactory.java",
"license": "apache-2.0",
"size": 55827
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 781,709 |
private void writeData(String matrixName, Matrix m) {
//Throws an exception if there are any errors in the matrixName
Emme2MatrixHelper.checkMatrixName(dataBank, matrixName);
//Check size of matrix against databank dimensions
if ( (m.getColumnCount() > dataBank.getMaxZones()) ||
(m.getRowCount() > dataBank.getMaxZones()) ) {
logger.error("Matrix is too big for databank: " + matrixName);
throw new MatrixException("Matrix is too big for databank: " + matrixName);
}
long byteOffset = Emme2MatrixHelper.calculateByteOffset(dataBank, matrixName);
long startTime = System.currentTimeMillis();
int[] emme2ExternalNumbers = dataBank.getExternalZoneNumbers();
//Emme2 matrices are always square so use same value for rows and columns
int nRows = dataBank.getZonesUsed();
int nCols = nRows;
//Allocate a byte buffer to hold one row, must be maximum size of matrix
ByteBuffer byteBuffer = ByteBuffer.allocate(dataBank.getMaxZones()*4);
byteBuffer.order(ByteOrder.nativeOrder());
try {
RandomAccessFile randFile = dataBank.getRandomAccessFile();
randFile.seek(byteOffset);
//Loop through all the rows in the matrix
for (int row=0; row < nRows; row++) {
//Fill up byte buffer for each row
int[] matrixInternalRowNumbers = m.getInternalRowNumbers();
int[] matrixInternalColumnNumbers = m.getInternalColumnNumbers();
int matrixRow = -1;
if (emme2ExternalNumbers[row+1]<matrixInternalRowNumbers.length) {
matrixRow = m.getInternalRowNumber(emme2ExternalNumbers[row+1]);
}
if (matrixRow == -1) {
if (logger.isDebugEnabled()) logger.debug("Emme2 zone "+emme2ExternalNumbers[row+1]+" at index "+row+" is not represented in matrix "+m);
}
for(int col=0; col < nCols; col++) {
float value = 0;
int matrixColumn = -1;
if (emme2ExternalNumbers[col+1]<matrixInternalColumnNumbers.length) {
matrixColumn = m.getInternalColumnNumber(emme2ExternalNumbers[col+1]);
}
if (matrixColumn !=-1 && matrixRow !=-1) value = m.getValueAt(emme2ExternalNumbers[row+1],emme2ExternalNumbers[col+1]);
byteBuffer.putFloat( value );
}
//Write out bytes for current row
randFile.write( byteBuffer.array() );
byteBuffer.clear();
}
}
catch (Exception e) {
throw new MatrixException(e, MatrixException.ERROR_WRITING_FILE);
}
long finishTime = System.currentTimeMillis();
//System.out.println("readData() time = " + (finishTime-startTime));
}
| void function(String matrixName, Matrix m) { Emme2MatrixHelper.checkMatrixName(dataBank, matrixName); if ( (m.getColumnCount() > dataBank.getMaxZones()) (m.getRowCount() > dataBank.getMaxZones()) ) { logger.error(STR + matrixName); throw new MatrixException(STR + matrixName); } long byteOffset = Emme2MatrixHelper.calculateByteOffset(dataBank, matrixName); long startTime = System.currentTimeMillis(); int[] emme2ExternalNumbers = dataBank.getExternalZoneNumbers(); int nRows = dataBank.getZonesUsed(); int nCols = nRows; ByteBuffer byteBuffer = ByteBuffer.allocate(dataBank.getMaxZones()*4); byteBuffer.order(ByteOrder.nativeOrder()); try { RandomAccessFile randFile = dataBank.getRandomAccessFile(); randFile.seek(byteOffset); for (int row=0; row < nRows; row++) { int[] matrixInternalRowNumbers = m.getInternalRowNumbers(); int[] matrixInternalColumnNumbers = m.getInternalColumnNumbers(); int matrixRow = -1; if (emme2ExternalNumbers[row+1]<matrixInternalRowNumbers.length) { matrixRow = m.getInternalRowNumber(emme2ExternalNumbers[row+1]); } if (matrixRow == -1) { if (logger.isDebugEnabled()) logger.debug(STR+emme2ExternalNumbers[row+1]+STR+row+STR+m); } for(int col=0; col < nCols; col++) { float value = 0; int matrixColumn = -1; if (emme2ExternalNumbers[col+1]<matrixInternalColumnNumbers.length) { matrixColumn = m.getInternalColumnNumber(emme2ExternalNumbers[col+1]); } if (matrixColumn !=-1 && matrixRow !=-1) value = m.getValueAt(emme2ExternalNumbers[row+1],emme2ExternalNumbers[col+1]); byteBuffer.putFloat( value ); } randFile.write( byteBuffer.array() ); byteBuffer.clear(); } } catch (Exception e) { throw new MatrixException(e, MatrixException.ERROR_WRITING_FILE); } long finishTime = System.currentTimeMillis(); } | /**
* Writes a matrix to the underlying file.
*
*@param m the matrix to write
*
*/ | Writes a matrix to the underlying file | writeData | {
"repo_name": "moeckel/silo",
"path": "third-party/common-base/src/java/com/pb/common/matrix/Emme2MatrixWriter.java",
"license": "gpl-2.0",
"size": 7042
} | [
"java.io.RandomAccessFile",
"java.nio.ByteBuffer",
"java.nio.ByteOrder"
] | import java.io.RandomAccessFile; import java.nio.ByteBuffer; import java.nio.ByteOrder; | import java.io.*; import java.nio.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 722,237 |
ContactGroup getFacilityContactGroup(PerunSession sess, Facility facility, String contactGroupName) throws FacilityContactNotExistsException; | ContactGroup getFacilityContactGroup(PerunSession sess, Facility facility, String contactGroupName) throws FacilityContactNotExistsException; | /**
* Get contact group for the facility and the contact group name.
*
* @param sess
* @param facility
* @param contactGroupName
* @return contactGroup
* @throws InternalErrorException
* @throws FacilityContactNotExistsException if there is no such contact
*/ | Get contact group for the facility and the contact group name | getFacilityContactGroup | {
"repo_name": "zoraseb/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/FacilitiesManagerImplApi.java",
"license": "bsd-2-clause",
"size": 24424
} | [
"cz.metacentrum.perun.core.api.ContactGroup",
"cz.metacentrum.perun.core.api.Facility",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.exceptions.FacilityContactNotExistsException"
] | import cz.metacentrum.perun.core.api.ContactGroup; import cz.metacentrum.perun.core.api.Facility; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.exceptions.FacilityContactNotExistsException; | import cz.metacentrum.perun.core.api.*; import cz.metacentrum.perun.core.api.exceptions.*; | [
"cz.metacentrum.perun"
] | cz.metacentrum.perun; | 2,155,525 |
Map<String, String> tags(); | Map<String, String> tags(); | /**
* Gets the tags property: Resource tags.
*
* @return the tags value.
*/ | Gets the tags property: Resource tags | tags | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/devtestlabs/azure-resourcemanager-devtestlabs/src/main/java/com/azure/resourcemanager/devtestlabs/models/LabCost.java",
"license": "mit",
"size": 12546
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,846,251 |
@JsonProperty(PROP_NODES)
@Nonnull
public Set<OspfNeighborConfigId> getNodes() {
return _graph.nodes();
} | @JsonProperty(PROP_NODES) Set<OspfNeighborConfigId> function() { return _graph.nodes(); } | /**
* Returns a {@link Set} of all {@link OspfNeighborConfigId node}s present in the topology. This
* also includes nodes which don't have any neighbors.
*
* @return {@link Set} of {@link OspfNeighborConfigId}s
*/ | Returns a <code>Set</code> of all <code>OspfNeighborConfigId node</code>s present in the topology. This also includes nodes which don't have any neighbors | getNodes | {
"repo_name": "arifogel/batfish",
"path": "projects/batfish-common-protocol/src/main/java/org/batfish/datamodel/ospf/OspfTopology.java",
"license": "apache-2.0",
"size": 7347
} | [
"com.fasterxml.jackson.annotation.JsonProperty",
"java.util.Set"
] | import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Set; | import com.fasterxml.jackson.annotation.*; import java.util.*; | [
"com.fasterxml.jackson",
"java.util"
] | com.fasterxml.jackson; java.util; | 2,087,361 |
private List<Point3d> getPointsToCheck(final String targetFrameId, final UnitConfigOrBuilder unitConfig) throws NotAvailableException, InterruptedException {
try {
final List<Point3d> pointsToCheck = new ArrayList<>();
final Transform3D unitTransformation;
try {
unitTransformation = getUnitToTargetTransform3D(targetFrameId, unitConfig);
} catch (CouldNotPerformException ex) {
throw new CouldNotPerformException("Could not get the unit to target transformation for unit " + unitConfig.getId() + " and target frame id " + targetFrameId, ex);
}
try {
Shape unitShape = getUnitShape(unitConfig);
if (unitShape.hasBoundingBox()) {
AxisAlignedBoundingBox3DFloat boundingBox = unitShape.getBoundingBox();
return getCorners(boundingBox).stream().map(corner -> {
unitTransformation.transform(corner);
return corner;
}).collect(Collectors.toList());
}
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(ex, logger, LogLevel.ERROR);
if (!(ex instanceof NotAvailableException)) {
throw new CouldNotPerformException("Registry not available.", ex);
}
// The other case should lead to the following code aswell.
}
Point3d position = new Point3d(0, 0, 0);
unitTransformation.transform(position);
pointsToCheck.add(position);
return pointsToCheck;
} catch (CouldNotPerformException ex) {
throw new NotAvailableException("Points to check", ex);
}
} | List<Point3d> function(final String targetFrameId, final UnitConfigOrBuilder unitConfig) throws NotAvailableException, InterruptedException { try { final List<Point3d> pointsToCheck = new ArrayList<>(); final Transform3D unitTransformation; try { unitTransformation = getUnitToTargetTransform3D(targetFrameId, unitConfig); } catch (CouldNotPerformException ex) { throw new CouldNotPerformException(STR + unitConfig.getId() + STR + targetFrameId, ex); } try { Shape unitShape = getUnitShape(unitConfig); if (unitShape.hasBoundingBox()) { AxisAlignedBoundingBox3DFloat boundingBox = unitShape.getBoundingBox(); return getCorners(boundingBox).stream().map(corner -> { unitTransformation.transform(corner); return corner; }).collect(Collectors.toList()); } } catch (CouldNotPerformException ex) { ExceptionPrinter.printHistory(ex, logger, LogLevel.ERROR); if (!(ex instanceof NotAvailableException)) { throw new CouldNotPerformException(STR, ex); } } Point3d position = new Point3d(0, 0, 0); unitTransformation.transform(position); pointsToCheck.add(position); return pointsToCheck; } catch (CouldNotPerformException ex) { throw new NotAvailableException(STR, ex); } } | /**
* Returns the points that need to be checked for minima and maxima to
* create the unit group bounding box for a certain member.
*
* @param targetFrameId The frame id of the target location.
* @param unitConfig Config of the member unit.
*
* @return Corner points of the member's bounding box in root coordinates.
*
* @throws NotAvailableException is thrown if the points are not available
* due to a missing unit transformation.
* @throws InterruptedException is thrown in case of an external
* interruption.
*/ | Returns the points that need to be checked for minima and maxima to create the unit group bounding box for a certain member | getPointsToCheck | {
"repo_name": "DivineCooperation/bco.registry",
"path": "unit-registry/core/src/main/java/org/openbase/bco/registry/unit/core/consistency/unitgroupconfig/UnitGroupPlacementConfigConsistencyHandler.java",
"license": "gpl-3.0",
"size": 19216
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.stream.Collectors",
"javax.media.j3d.Transform3D",
"javax.vecmath.Point3d",
"org.openbase.jul.exception.CouldNotPerformException",
"org.openbase.jul.exception.NotAvailableException",
"org.openbase.jul.exception.printer.ExceptionPrinter",
"org.openb... | import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import javax.media.j3d.Transform3D; import javax.vecmath.Point3d; import org.openbase.jul.exception.CouldNotPerformException; import org.openbase.jul.exception.NotAvailableException; import org.openbase.jul.exception.printer.ExceptionPrinter; import org.openbase.jul.exception.printer.LogLevel; import org.openbase.type.domotic.unit.UnitConfigType; import org.openbase.type.geometry.AxisAlignedBoundingBox3DFloatType; import org.openbase.type.spatial.ShapeType; | import java.util.*; import java.util.stream.*; import javax.media.j3d.*; import javax.vecmath.*; import org.openbase.jul.exception.*; import org.openbase.jul.exception.printer.*; import org.openbase.type.domotic.unit.*; import org.openbase.type.geometry.*; import org.openbase.type.spatial.*; | [
"java.util",
"javax.media",
"javax.vecmath",
"org.openbase.jul",
"org.openbase.type"
] | java.util; javax.media; javax.vecmath; org.openbase.jul; org.openbase.type; | 1,223,483 |
protected Map<String, String> getBuildIds() {
List<CmsModule> modules = OpenCms.getModuleManager().getAllInstalledModules();
Map<String, String> result = new HashMap<String, String>();
for (CmsModule module : modules) {
String buildid = module.getParameter(CmsCoreData.KEY_GWT_BUILDID);
if (buildid != null) {
result.put(module.getName(), buildid);
}
}
return result;
} | Map<String, String> function() { List<CmsModule> modules = OpenCms.getModuleManager().getAllInstalledModules(); Map<String, String> result = new HashMap<String, String>(); for (CmsModule module : modules) { String buildid = module.getParameter(CmsCoreData.KEY_GWT_BUILDID); if (buildid != null) { result.put(module.getName(), buildid); } } return result; } | /**
* Collect GWT build ids from the different ADE modules.<p>
*
* @return the map of GWT build ids
*/ | Collect GWT build ids from the different ADE modules | getBuildIds | {
"repo_name": "sbonoc/opencms-core",
"path": "src/org/opencms/gwt/CmsCoreService.java",
"license": "lgpl-2.1",
"size": 63328
} | [
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.opencms.gwt.shared.CmsCoreData",
"org.opencms.main.OpenCms",
"org.opencms.module.CmsModule"
] | import java.util.HashMap; import java.util.List; import java.util.Map; import org.opencms.gwt.shared.CmsCoreData; import org.opencms.main.OpenCms; import org.opencms.module.CmsModule; | import java.util.*; import org.opencms.gwt.shared.*; import org.opencms.main.*; import org.opencms.module.*; | [
"java.util",
"org.opencms.gwt",
"org.opencms.main",
"org.opencms.module"
] | java.util; org.opencms.gwt; org.opencms.main; org.opencms.module; | 1,495,537 |
public static MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection> getAttributesClient(Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception
{
MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.attributedefinition.AttributeUrl.getAttributesUrl(filter, pageSize, responseFields, sortBy, startIndex);
String verb = "GET";
Class<?> clz = com.mozu.api.contracts.productadmin.AttributeCollection.class;
MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection>) MozuClientFactory.getInstance(clz);
mozuClient.setVerb(verb);
mozuClient.setResourceUrl(url);
return mozuClient;
} | static MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection> function(Integer startIndex, Integer pageSize, String sortBy, String filter, String responseFields) throws Exception { MozuUrl url = com.mozu.api.urls.commerce.catalog.admin.attributedefinition.AttributeUrl.getAttributesUrl(filter, pageSize, responseFields, sortBy, startIndex); String verb = "GET"; Class<?> clz = com.mozu.api.contracts.productadmin.AttributeCollection.class; MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection> mozuClient = (MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection>) MozuClientFactory.getInstance(clz); mozuClient.setVerb(verb); mozuClient.setResourceUrl(url); return mozuClient; } | /**
* Retrieves a paged list of attributes according to any specified filter criteria and sort options.
* <p><pre><code>
* MozuClient<com.mozu.api.contracts.productadmin.AttributeCollection> mozuClient=GetAttributesClient( startIndex, pageSize, sortBy, filter, responseFields);
* client.setBaseAddress(url);
* client.executeRequest();
* AttributeCollection attributeCollection = client.Result();
* </code></pre></p>
* @param filter A set of expressions that consist of a field, operator, and value and represent search parameter syntax when filtering results of a query. Valid operators include equals (eq), does not equal (ne), greater than (gt), less than (lt), greater than or equal to (ge), less than or equal to (le), starts with (sw), or contains (cont). For example - "filter=IsDisplayed+eq+true"
* @param pageSize The number of results to display on each page when creating paged results from a query. The maximum value is 200.
* @param responseFields Use this field to include those fields which are not included by default.
* @param sortBy
* @param startIndex
* @param dataViewMode DataViewMode
* @return Mozu.Api.MozuClient <com.mozu.api.contracts.productadmin.AttributeCollection>
* @see com.mozu.api.contracts.productadmin.AttributeCollection
*/ | Retrieves a paged list of attributes according to any specified filter criteria and sort options. <code><code> MozuClient mozuClient=GetAttributesClient( startIndex, pageSize, sortBy, filter, responseFields); client.setBaseAddress(url); client.executeRequest(); AttributeCollection attributeCollection = client.Result(); </code></code> | getAttributesClient | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/clients/commerce/catalog/admin/attributedefinition/AttributeClient.java",
"license": "mit",
"size": 12484
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.MozuClientFactory",
"com.mozu.api.MozuUrl"
] | import com.mozu.api.MozuClient; import com.mozu.api.MozuClientFactory; import com.mozu.api.MozuUrl; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 259,099 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateAtResourceWithResponseAsync(
String resourceId, String attestationName, AttestationInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceId == null) {
return Mono.error(new IllegalArgumentException("Parameter resourceId is required and cannot be null."));
}
if (attestationName == null) {
return Mono
.error(new IllegalArgumentException("Parameter attestationName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2021-01-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdateAtResource(
this.client.getEndpoint(),
resourceId,
attestationName,
apiVersion,
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceId, String attestationName, AttestationInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceId == null) { return Mono.error(new IllegalArgumentException(STR)); } if (attestationName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (parameters == null) { return Mono.error(new IllegalArgumentException(STR)); } else { parameters.validate(); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .createOrUpdateAtResource( this.client.getEndpoint(), resourceId, attestationName, apiVersion, parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Creates or updates an attestation at resource scope.
*
* @param resourceId Resource ID.
* @param attestationName The name of the attestation.
* @param parameters The attestation parameters.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an attestation resource.
*/ | Creates or updates an attestation at resource scope | createOrUpdateAtResourceWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/policyinsights/azure-resourcemanager-policyinsights/src/main/java/com/azure/resourcemanager/policyinsights/implementation/AttestationsClientImpl.java",
"license": "mit",
"size": 124635
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.policyinsights.fluent.models.AttestationInner; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.policyinsights.fluent.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 82,848 |
public void testNewsResourceWithLastModified() throws Exception {
// first create the resource
NewsStory story = new NewsStory();
story.setContent("This is a breaking news story");
story.setTitle("Local Hero Saves Kid");
NewsHttpClient client = new NewsHttpClient(NEWS_BASE_URI, null);
Response response = client.addNewsStory(story);
assertNotNull(response);
String lastModified = (String)response.getMetadata().getFirst("Last-Modified");
Date date = formatter.parse(lastModified);
Map<String, String> reqHdrs = new HashMap<String, String>();
reqHdrs.put("If-Modified-Since", lastModified);
client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
assertNotNull(response);
assertEquals("Expected 304 not returned", 304, response.getStatus());
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.YEAR, 2006);
lastModified = formatter.format(calendar.getTime());
reqHdrs.put("If-Modified-Since", lastModified);
client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs);
response = client.getNewsStory("Local%20Hero%20Saves%20Kid");
assertNotNull(response);
story = (NewsStory)response.getEntity();
assertNotNull(story);
} | void function() throws Exception { NewsStory story = new NewsStory(); story.setContent(STR); story.setTitle(STR); NewsHttpClient client = new NewsHttpClient(NEWS_BASE_URI, null); Response response = client.addNewsStory(story); assertNotNull(response); String lastModified = (String)response.getMetadata().getFirst(STR); Date date = formatter.parse(lastModified); Map<String, String> reqHdrs = new HashMap<String, String>(); reqHdrs.put(STR, lastModified); client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs); response = client.getNewsStory(STR); assertNotNull(response); assertEquals(STR, 304, response.getStatus()); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.set(Calendar.YEAR, 2006); lastModified = formatter.format(calendar.getTime()); reqHdrs.put(STR, lastModified); client = new NewsHttpClient(NEWS_BASE_URI, reqHdrs); response = client.getNewsStory(STR); assertNotNull(response); story = (NewsStory)response.getEntity(); assertNotNull(story); } | /**
* This test will demonstrate various usages of the Last-Modified header. It
* will show how different scenarios result in different HTTP status codes
* and different response entities.
*/ | This test will demonstrate various usages of the Last-Modified header. It will show how different scenarios result in different HTTP status codes and different response entities | testNewsResourceWithLastModified | {
"repo_name": "os890/wink_patches",
"path": "wink-itests/wink-itest/wink-itest-targeting/src/test/java/org/apache/wink/itest/cachetest/ClientTest.java",
"license": "apache-2.0",
"size": 7253
} | [
"java.util.Calendar",
"java.util.Date",
"java.util.HashMap",
"java.util.Map",
"javax.ws.rs.core.Response",
"org.apache.wink.itest.cache.NewsStory"
] | import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.Map; import javax.ws.rs.core.Response; import org.apache.wink.itest.cache.NewsStory; | import java.util.*; import javax.ws.rs.core.*; import org.apache.wink.itest.cache.*; | [
"java.util",
"javax.ws",
"org.apache.wink"
] | java.util; javax.ws; org.apache.wink; | 2,016,443 |
public void addPartition(boolean showIfEmpty, boolean hasHeader, List<T> list, int size) {
addPartition(new Partition<T>(showIfEmpty, hasHeader, list), size);
} | void function(boolean showIfEmpty, boolean hasHeader, List<T> list, int size) { addPartition(new Partition<T>(showIfEmpty, hasHeader, list), size); } | /**
* Registers a partition. The cursor for that partition can be set later.
* Partitions should be added in the order they are supposed to appear in
* the list.
*/ | Registers a partition. The cursor for that partition can be set later. Partitions should be added in the order they are supposed to appear in the list | addPartition | {
"repo_name": "JerryMissTom/sealtalk-android",
"path": "seal/src/main/java/cn/rongcloud/im/ui/adapter/CompositeAdapter.java",
"license": "mit",
"size": 14200
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 205,524 |
long countByExample(BugExample example); | long countByExample(BugExample example); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table m_prj_bug
*
* @mbg.generated Sat Apr 20 17:20:23 CDT 2019
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table m_prj_bug | countByExample | {
"repo_name": "aglne/mycollab",
"path": "mycollab-services/src/main/java/com/mycollab/module/project/dao/BugMapper.java",
"license": "agpl-3.0",
"size": 4000
} | [
"com.mycollab.module.project.domain.BugExample"
] | import com.mycollab.module.project.domain.BugExample; | import com.mycollab.module.project.domain.*; | [
"com.mycollab.module"
] | com.mycollab.module; | 584,420 |
List<SaleProduct> getSaleProducts(); | List<SaleProduct> getSaleProducts(); | /**
* Returns the products that were sold and removed from stock
*
* @return the products sold
*/ | Returns the products that were sold and removed from stock | getSaleProducts | {
"repo_name": "davidafsilva/inventory-manager",
"path": "model/src/main/java/pt/davidafsilva/im/model/Sale.java",
"license": "mit",
"size": 653
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,220,280 |
EClass getProcessType(); | EClass getProcessType(); | /**
* Returns the meta object for class '{@link org.eclipse.bpel.apache.ode.deploy.model.dd.ProcessType <em>Process Type</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Process Type</em>'.
* @see org.eclipse.bpel.apache.ode.deploy.model.dd.ProcessType
* @generated
*/ | Returns the meta object for class '<code>org.eclipse.bpel.apache.ode.deploy.model.dd.ProcessType Process Type</code>'. | getProcessType | {
"repo_name": "chanakaudaya/developer-studio",
"path": "bps/org.eclipse.bpel.apache.ode.deploy.model/src/org/eclipse/bpel/apache/ode/deploy/model/dd/ddPackage.java",
"license": "apache-2.0",
"size": 55505
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,658,220 |
boolean validate(EntryEvent event, int cnt) {
if (this.isSuspendValidation()) {
return true;
}
this.passedValidation = false;
assertEquals("Expected Call Count Assertion!", this.expectedCallCount, cnt);
assertTrue(!event.getOperation().isExpiration());
assertTrue(!event.getOperation().isNetLoad());
assertEquals("isLoad Assertion!", this.isLoad(), event.getOperation().isLoad());
assertEquals("isLocalLoad Assertion!", this.isLoad(), event.getOperation().isLocalLoad());
assertTrue(!event.getOperation().isNetSearch());
assertTrue(!event.isOriginRemote());
assertNotNull(event.getRegion());
assertNotNull(event.getRegion().getCache());
assertNotNull(event.getRegion().getCache().getCacheTransactionManager());
assertEquals(this.getTXId(), event.getTransactionId());
if (!isPR()) {
assertEquals("IsDistributed Assertion!", this.isDistributed(),
event.getOperation().isDistributed());
}
assertEquals(this.getKey(), event.getKey());
assertSame(this.getCallBackArg(), event.getCallbackArgument());
if (newValIdentCheck) {
assertSame(newVal, event.getNewValue());
} else {
assertEquals(newVal, event.getNewValue());
}
if (oldValIdentCheck) {
assertSame(oldVal, event.getOldValue());
} else {
assertEquals(oldVal, event.getOldValue());
}
this.passedValidation = true;
return true;
} | boolean validate(EntryEvent event, int cnt) { if (this.isSuspendValidation()) { return true; } this.passedValidation = false; assertEquals(STR, this.expectedCallCount, cnt); assertTrue(!event.getOperation().isExpiration()); assertTrue(!event.getOperation().isNetLoad()); assertEquals(STR, this.isLoad(), event.getOperation().isLoad()); assertEquals(STR, this.isLoad(), event.getOperation().isLocalLoad()); assertTrue(!event.getOperation().isNetSearch()); assertTrue(!event.isOriginRemote()); assertNotNull(event.getRegion()); assertNotNull(event.getRegion().getCache()); assertNotNull(event.getRegion().getCache().getCacheTransactionManager()); assertEquals(this.getTXId(), event.getTransactionId()); if (!isPR()) { assertEquals(STR, this.isDistributed(), event.getOperation().isDistributed()); } assertEquals(this.getKey(), event.getKey()); assertSame(this.getCallBackArg(), event.getCallbackArgument()); if (newValIdentCheck) { assertSame(newVal, event.getNewValue()); } else { assertEquals(newVal, event.getNewValue()); } if (oldValIdentCheck) { assertSame(oldVal, event.getOldValue()); } else { assertEquals(oldVal, event.getOldValue()); } this.passedValidation = true; return true; } | /**
* EntryEvent, CallCount validator for callbacks (CacheWriter, CacheListener
*/ | EntryEvent, CallCount validator for callbacks (CacheWriter, CacheListener | validate | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/integrationTest/java/org/apache/geode/TXJUnitTest.java",
"license": "apache-2.0",
"size": 264917
} | [
"org.apache.geode.cache.EntryEvent",
"org.junit.Assert"
] | import org.apache.geode.cache.EntryEvent; import org.junit.Assert; | import org.apache.geode.cache.*; import org.junit.*; | [
"org.apache.geode",
"org.junit"
] | org.apache.geode; org.junit; | 296,220 |
public T caseOperatorDecl(OperatorDecl object) {
return null;
} | T function(OperatorDecl object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Operator
* Decl</em>'. <!-- begin-user-doc --> This implementation returns null;
* returning a non-null result will terminate the switch. <!-- end-user-doc -->
*
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Operator
* Decl</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Operator Decl'. This implementation returns null; returning a non-null result will terminate the switch. | caseOperatorDecl | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/terms/util/TermsSwitch.java",
"license": "epl-1.0",
"size": 21460
} | [
"fr.lip6.move.pnml.pthlpng.terms.OperatorDecl"
] | import fr.lip6.move.pnml.pthlpng.terms.OperatorDecl; | import fr.lip6.move.pnml.pthlpng.terms.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 2,750,244 |
public void addExtensions(Collection<ExtensionElement> extensions) {
if (extensions == null) return;
for (ExtensionElement packetExtension : extensions) {
addExtension(packetExtension);
}
} | void function(Collection<ExtensionElement> extensions) { if (extensions == null) return; for (ExtensionElement packetExtension : extensions) { addExtension(packetExtension); } } | /**
* Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null.
*
* @param extensions a collection of stanza(/packet) extensions
*/ | Adds a collection of stanza(/packet) extensions to the packet. Does nothing if extensions is null | addExtensions | {
"repo_name": "ayne/Smack",
"path": "smack-core/src/main/java/org/jivesoftware/smack/packet/Stanza.java",
"license": "apache-2.0",
"size": 16167
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 239,296 |
//-----------------------------------------------------------------------
@Override
public SecurityLink getSecurityLink() {
return _securityLink;
} | SecurityLink function() { return _securityLink; } | /**
* Gets the link referencing the security, not null.
* This may also hold the resolved security.
* @return the value of the property, not null
*/ | Gets the link referencing the security, not null. This may also hold the resolved security | getSecurityLink | {
"repo_name": "McLeodMoores/starling",
"path": "projects/core/src/main/java/com/opengamma/core/position/impl/SimpleTrade.java",
"license": "apache-2.0",
"size": 28757
} | [
"com.opengamma.core.security.SecurityLink"
] | import com.opengamma.core.security.SecurityLink; | import com.opengamma.core.security.*; | [
"com.opengamma.core"
] | com.opengamma.core; | 1,257,364 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<ExperimentInner> getAsync(String resourceGroupName, String workspaceName, String experimentName) {
return getWithResponseAsync(resourceGroupName, workspaceName, experimentName)
.flatMap(
(Response<ExperimentInner> res) -> {
if (res.getValue() != null) {
return Mono.just(res.getValue());
} else {
return Mono.empty();
}
});
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<ExperimentInner> function(String resourceGroupName, String workspaceName, String experimentName) { return getWithResponseAsync(resourceGroupName, workspaceName, experimentName) .flatMap( (Response<ExperimentInner> res) -> { if (res.getValue() != null) { return Mono.just(res.getValue()); } else { return Mono.empty(); } }); } | /**
* Gets information about an Experiment.
*
* @param resourceGroupName Name of the resource group to which the resource belongs.
* @param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric
* characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
* @param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric
* characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return information about an Experiment.
*/ | Gets information about an Experiment | getAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/batchai/azure-resourcemanager-batchai/src/main/java/com/azure/resourcemanager/batchai/implementation/ExperimentsClientImpl.java",
"license": "mit",
"size": 63636
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.resourcemanager.batchai.fluent.models.ExperimentInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.resourcemanager.batchai.fluent.models.ExperimentInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.batchai.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,494,959 |
public synchronized void bake() {
if(handlers != null)
return;
List<RegisteredListener> entries = new ArrayList<RegisteredListener>();
for(Entry<EventPriority, ArrayList<RegisteredListener>> entry : handlerslots.entrySet()) {
entries.addAll(entry.getValue());
}
handlers = entries.toArray(new RegisteredListener[entries.size()]);
}
| synchronized void function() { if(handlers != null) return; List<RegisteredListener> entries = new ArrayList<RegisteredListener>(); for(Entry<EventPriority, ArrayList<RegisteredListener>> entry : handlerslots.entrySet()) { entries.addAll(entry.getValue()); } handlers = entries.toArray(new RegisteredListener[entries.size()]); } | /**
* Bake HashMap
*/ | Bake HashMap | bake | {
"repo_name": "Edwardthedog2/RedstoneLamp",
"path": "src/redstonelamp/event/HandlerList.java",
"license": "gpl-3.0",
"size": 3064
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,167,602 |
byte[] imgData = getByteArrayFromImage(img);
String base64bytes = Base64.encode(imgData);
return "data:image/png;base64," + base64bytes;
} | byte[] imgData = getByteArrayFromImage(img); String base64bytes = Base64.encode(imgData); return STR + base64bytes; } | /**
* Encode a BufferedImage in a Base64 string
* @param img Image to encode
* @return Encoded Base64 image string
*/ | Encode a BufferedImage in a Base64 string | getBase64EncodedStringFromImage | {
"repo_name": "weiss19ja/amos-ss16-proj2",
"path": "backend/src/main/java/de/developgroup/mrf/server/controller/AbstractCameraSnapshotController.java",
"license": "agpl-3.0",
"size": 1239
} | [
"com.sun.org.apache.xerces.internal.impl.dv.util.Base64"
] | import com.sun.org.apache.xerces.internal.impl.dv.util.Base64; | import com.sun.org.apache.xerces.internal.impl.dv.util.*; | [
"com.sun.org"
] | com.sun.org; | 2,817,946 |
@Test
public void postProcessorsAreMergedDuringMockMvcPerform() throws Exception {
RequestPostProcessor postProcessor = mock(RequestPostProcessor.class);
given(postProcessor.postProcessRequest(any())).willAnswer((i) -> i.getArgument(0));
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new Object())
.defaultRequest(MockMvcRequestBuilders.get("/").with(postProcessor)).build();
MvcResult mvcResult = mockMvc.perform(logout()).andReturn();
assertThat(mvcResult.getRequest().getMethod()).isEqualTo(HttpMethod.POST.name());
assertThat(mvcResult.getRequest().getHeader("Accept"))
.isEqualTo(MediaType.toString(Arrays.asList(MediaType.TEXT_HTML, MediaType.ALL)));
assertThat(mvcResult.getRequest().getRequestURI()).isEqualTo("/logout");
assertThat(mvcResult.getRequest().getParameter("_csrf")).isNotEmpty();
verify(postProcessor).postProcessRequest(any());
} | void function() throws Exception { RequestPostProcessor postProcessor = mock(RequestPostProcessor.class); given(postProcessor.postProcessRequest(any())).willAnswer((i) -> i.getArgument(0)); MockMvc mockMvc = MockMvcBuilders.standaloneSetup(new Object()) .defaultRequest(MockMvcRequestBuilders.get("/").with(postProcessor)).build(); MvcResult mvcResult = mockMvc.perform(logout()).andReturn(); assertThat(mvcResult.getRequest().getMethod()).isEqualTo(HttpMethod.POST.name()); assertThat(mvcResult.getRequest().getHeader(STR)) .isEqualTo(MediaType.toString(Arrays.asList(MediaType.TEXT_HTML, MediaType.ALL))); assertThat(mvcResult.getRequest().getRequestURI()).isEqualTo(STR); assertThat(mvcResult.getRequest().getParameter("_csrf")).isNotEmpty(); verify(postProcessor).postProcessRequest(any()); } | /**
* spring-restdocs uses postprocessors to do its trick. It will work only if these are
* merged together with our request builders. (gh-7572)
* @throws Exception
*/ | spring-restdocs uses postprocessors to do its trick. It will work only if these are merged together with our request builders. (gh-7572) | postProcessorsAreMergedDuringMockMvcPerform | {
"repo_name": "djechelon/spring-security",
"path": "test/src/test/java/org/springframework/security/test/web/servlet/request/SecurityMockMvcRequestBuildersFormLogoutTests.java",
"license": "apache-2.0",
"size": 4535
} | [
"java.util.Arrays",
"org.assertj.core.api.Assertions",
"org.mockito.BDDMockito",
"org.mockito.Mockito",
"org.springframework.http.HttpMethod",
"org.springframework.http.MediaType",
"org.springframework.test.web.servlet.MockMvc",
"org.springframework.test.web.servlet.MvcResult",
"org.springframework.... | import java.util.Arrays; import org.assertj.core.api.Assertions; import org.mockito.BDDMockito; import org.mockito.Mockito; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import org.springframework.test.web.servlet.request.RequestPostProcessor; import org.springframework.test.web.servlet.setup.MockMvcBuilders; | import java.util.*; import org.assertj.core.api.*; import org.mockito.*; import org.springframework.http.*; import org.springframework.test.web.servlet.*; import org.springframework.test.web.servlet.request.*; import org.springframework.test.web.servlet.setup.*; | [
"java.util",
"org.assertj.core",
"org.mockito",
"org.springframework.http",
"org.springframework.test"
] | java.util; org.assertj.core; org.mockito; org.springframework.http; org.springframework.test; | 2,707,113 |
final void stateChanged(final MPDStatus mpdStatus) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mSeekBar.updateSeekTime(mpdStatus.getElapsedTime());
}
getRemoteState(mpdStatus.getState());
} | final void stateChanged(final MPDStatus mpdStatus) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { mSeekBar.updateSeekTime(mpdStatus.getElapsedTime()); } getRemoteState(mpdStatus.getState()); } | /**
* Used to keep the state updated.
*
* @param mpdStatus An MPDStatus object.
*/ | Used to keep the state updated | stateChanged | {
"repo_name": "abarisain/dmix",
"path": "MPDroid/src/main/java/com/namelessdev/mpdroid/service/RemoteControlClientHandler.java",
"license": "apache-2.0",
"size": 11324
} | [
"android.os.Build",
"org.a0z.mpd.MPDStatus"
] | import android.os.Build; import org.a0z.mpd.MPDStatus; | import android.os.*; import org.a0z.mpd.*; | [
"android.os",
"org.a0z.mpd"
] | android.os; org.a0z.mpd; | 1,413,512 |
public TypeConverter getTypeConverter() {
return typeConverter;
} | TypeConverter function() { return typeConverter; } | /**
* Obtains the typeConverter.
* @return
*/ | Obtains the typeConverter | getTypeConverter | {
"repo_name": "christophd/citrus",
"path": "core/citrus-base/src/main/java/com/consol/citrus/CitrusContext.java",
"license": "apache-2.0",
"size": 16973
} | [
"com.consol.citrus.util.TypeConverter"
] | import com.consol.citrus.util.TypeConverter; | import com.consol.citrus.util.*; | [
"com.consol.citrus"
] | com.consol.citrus; | 1,860,427 |
List<AnnotationMemberDefinition> getAnnotationMembers(); | List<AnnotationMemberDefinition> getAnnotationMembers(); | /**
* Set of supported parameters by this attribute.
*
* @return
*/ | Set of supported parameters by this attribute | getAnnotationMembers | {
"repo_name": "droolsjbpm/jbpm-data-modeler",
"path": "jbpm-data-modeler-core/src/main/java/org/jbpm/datamodeler/core/AnnotationDefinition.java",
"license": "apache-2.0",
"size": 1290
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,555,082 |
void init(final BrandingManager brandingManager) {
this.brandingManager = brandingManager;
} | void init(final BrandingManager brandingManager) { this.brandingManager = brandingManager; } | /**
* Init with the branding manager as a parameter.
* @param brandingManager The branding manager.
*/ | Init with the branding manager as a parameter | init | {
"repo_name": "jtux270/translate",
"path": "ovirt/backend/manager/modules/welcome/src/main/java/org/ovirt/engine/core/WelcomeServlet.java",
"license": "gpl-3.0",
"size": 3409
} | [
"org.ovirt.engine.core.branding.BrandingManager"
] | import org.ovirt.engine.core.branding.BrandingManager; | import org.ovirt.engine.core.branding.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 911,861 |
AbstractUrlBasedView view = super.buildView(viewName);
// start with / ignore prefix
if (viewName.startsWith("/")) {
view.setUrl(viewName + getSuffix());
}
return view;
}
| AbstractUrlBasedView view = super.buildView(viewName); if (viewName.startsWith("/")) { view.setUrl(viewName + getSuffix()); } return view; } | /**
* if viewName start with / , then ignore prefix.
*/ | if viewName start with / , then ignore prefix | buildView | {
"repo_name": "caipiao/Lottery",
"path": "src/com/jeecms/common/web/springmvc/SimpleFreeMarkerViewResolver.java",
"license": "gpl-2.0",
"size": 880
} | [
"org.springframework.web.servlet.view.AbstractUrlBasedView"
] | import org.springframework.web.servlet.view.AbstractUrlBasedView; | import org.springframework.web.servlet.view.*; | [
"org.springframework.web"
] | org.springframework.web; | 1,180,871 |
public int getNodeNumbers() {
SoulissGenericTypical typ;
int iTmp = 0;
Iterator<Entry<String, SoulissGenericTypical>> iteratorTypicals = getIterator();
while (iteratorTypicals.hasNext()) {
typ = iteratorTypicals.next().getValue();
if (typ.getSoulissNodeID() > iTmp) {
iTmp = typ.getSoulissNodeID();
}
}
return iTmp + 1;
} | int function() { SoulissGenericTypical typ; int iTmp = 0; Iterator<Entry<String, SoulissGenericTypical>> iteratorTypicals = getIterator(); while (iteratorTypicals.hasNext()) { typ = iteratorTypicals.next().getValue(); if (typ.getSoulissNodeID() > iTmp) { iTmp = typ.getSoulissNodeID(); } } return iTmp + 1; } | /**
* Returns the number of nodes parsing the hash table
*
* @return integer
*/ | Returns the number of nodes parsing the hash table | getNodeNumbers | {
"repo_name": "openhab/openhab",
"path": "bundles/binding/org.openhab.binding.souliss/src/main/java/org/openhab/binding/souliss/internal/network/typicals/SoulissTypicals.java",
"license": "epl-1.0",
"size": 4698
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,418,246 |
public User calculateUserDisplayTime(User user); | User function(User user); | /**
* Calculate the proper time to display to the user based on their time zone.
*
* @param user the user
* @return the user
*/ | Calculate the proper time to display to the user based on their time zone | calculateUserDisplayTime | {
"repo_name": "npaulus/Daily-Email-WebApp",
"path": "dailyemail/src/main/java/com/natepaulus/dailyemail/web/service/interfaces/AccountService.java",
"license": "apache-2.0",
"size": 2744
} | [
"com.natepaulus.dailyemail.repository.entity.User"
] | import com.natepaulus.dailyemail.repository.entity.User; | import com.natepaulus.dailyemail.repository.entity.*; | [
"com.natepaulus.dailyemail"
] | com.natepaulus.dailyemail; | 926,223 |
Table findUserTableForIndex(Session session, String name,
String schemaName) {
readLock.lock();
try {
Schema schema = (Schema) schemaMap.get(schemaName);
HsqlName indexName = schema.indexLookup.getName(name);
if (indexName == null) {
return null;
}
return findUserTable(session, indexName.parent.name, schemaName);
} finally {
readLock.unlock();
}
} | Table findUserTableForIndex(Session session, String name, String schemaName) { readLock.lock(); try { Schema schema = (Schema) schemaMap.get(schemaName); HsqlName indexName = schema.indexLookup.getName(name); if (indexName == null) { return null; } return findUserTable(session, indexName.parent.name, schemaName); } finally { readLock.unlock(); } } | /**
* Returns the table that has an index with the given name and schema.
*/ | Returns the table that has an index with the given name and schema | findUserTableForIndex | {
"repo_name": "RabadanLab/Pegasus",
"path": "resources/hsqldb-2.2.7/hsqldb/src/org/hsqldb/SchemaManager.java",
"license": "mit",
"size": 83727
} | [
"org.hsqldb.HsqlNameManager"
] | import org.hsqldb.HsqlNameManager; | import org.hsqldb.*; | [
"org.hsqldb"
] | org.hsqldb; | 1,481,244 |
public Mono<CosmosContainerResponse> replace(
CosmosContainerProperties containerProperties,
CosmosContainerRequestOptions options) {
final CosmosContainerRequestOptions requestOptions = options == null ? new CosmosContainerRequestOptions() : options;
return withContext(context -> replaceInternal(containerProperties, requestOptions, context));
} | Mono<CosmosContainerResponse> function( CosmosContainerProperties containerProperties, CosmosContainerRequestOptions options) { final CosmosContainerRequestOptions requestOptions = options == null ? new CosmosContainerRequestOptions() : options; return withContext(context -> replaceInternal(containerProperties, requestOptions, context)); } | /**
* Replaces the current container properties while using non-default request options.
* <p>
* After subscription the operation will be performed. The {@link Mono} upon
* successful completion will contain a single Cosmos container response with
* the replaced container properties. In case of failure the {@link Mono} will
* error.
*
* @param containerProperties the container properties
* @param options the Cosmos container request options.
* @return an {@link Mono} containing the single Cosmos container response with
* the replaced container properties or an error.
*/ | Replaces the current container properties while using non-default request options. After subscription the operation will be performed. The <code>Mono</code> upon successful completion will contain a single Cosmos container response with the replaced container properties. In case of failure the <code>Mono</code> will error | replace | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosAsyncContainer.java",
"license": "mit",
"size": 47776
} | [
"com.azure.core.util.FluxUtil",
"com.azure.cosmos.models.CosmosContainerProperties",
"com.azure.cosmos.models.CosmosContainerRequestOptions",
"com.azure.cosmos.models.CosmosContainerResponse"
] | import com.azure.core.util.FluxUtil; import com.azure.cosmos.models.CosmosContainerProperties; import com.azure.cosmos.models.CosmosContainerRequestOptions; import com.azure.cosmos.models.CosmosContainerResponse; | import com.azure.core.util.*; import com.azure.cosmos.models.*; | [
"com.azure.core",
"com.azure.cosmos"
] | com.azure.core; com.azure.cosmos; | 1,013,300 |
public Color getFill()
{
Shape shape = (Shape) asIObject();
RInt value = shape.getFillColor();
if (value == null) return DEFAULT_FILL_COLOUR;
return new Color(value.getValue(), true);
}
| Color function() { Shape shape = (Shape) asIObject(); RInt value = shape.getFillColor(); if (value == null) return DEFAULT_FILL_COLOUR; return new Color(value.getValue(), true); } | /**
* Returns the fill color.
*
* @return See above.
*/ | Returns the fill color | getFill | {
"repo_name": "joshmoore/openmicroscopy",
"path": "components/tools/OmeroJava/src/pojos/ShapeSettingsData.java",
"license": "gpl-2.0",
"size": 12195
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,476,597 |
//#ifdef JAVA6
public synchronized void setNClob(int parameterIndex,
NClob value) throws SQLException {
setClob(parameterIndex, value);
}
//#endif JAVA6 | synchronized void function(int parameterIndex, NClob value) throws SQLException { setClob(parameterIndex, value); } | /**
* Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to a
* SQL <code>NCLOB</code> value when it sends it to the database.
* @param parameterIndex of the first parameter is 1, the second is 2, ...
* @param value the parameter value
* @throws SQLException if the driver does not support national
* character sets; if the driver can detect that a data conversion
* error could occur ; if a database access error occurs; or
* this method is called on a closed <code>PreparedStatement</code>
* @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method
* @since JDK 1.6, HSQLDB 2.0
*/ | Sets the designated parameter to a <code>java.sql.NClob</code> object. The driver converts this to a SQL <code>NCLOB</code> value when it sends it to the database | setNClob | {
"repo_name": "ThangBK2009/android-source-browsing.platform--external--hsqldb",
"path": "src/org/hsqldb/jdbc/JDBCPreparedStatement.java",
"license": "bsd-3-clause",
"size": 188229
} | [
"java.sql.NClob",
"java.sql.SQLException"
] | import java.sql.NClob; import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 411,387 |
public void setReceiveBufferSize(int size) throws SocketException {
receiveBufferSize = size;
} | void function(int size) throws SocketException { receiveBufferSize = size; } | /**
* Sets the underlying socket receive buffer size.
* <p>
* @param size The size of the buffer in bytes.
* @throws SocketException never (but subclasses may wish to do so)
* @since 2.0
*/ | Sets the underlying socket receive buffer size. | setReceiveBufferSize | {
"repo_name": "codolutions/commons-net",
"path": "src/main/java/org/apache/commons/net/SocketClient.java",
"license": "apache-2.0",
"size": 29595
} | [
"java.net.SocketException"
] | import java.net.SocketException; | import java.net.*; | [
"java.net"
] | java.net; | 1,204,941 |
public boolean fillInValue(LocalRegion r,
@Retained(ABSTRACT_REGION_ENTRY_FILL_IN_VALUE) InitialImageOperation.Entry entry,
ByteArrayDataInput in, DM mgr, Version targetVersion); | boolean function(LocalRegion r, @Retained(ABSTRACT_REGION_ENTRY_FILL_IN_VALUE) InitialImageOperation.Entry entry, ByteArrayDataInput in, DM mgr, Version targetVersion); | /**
* Fill in value, and isSerialized fields
* in this entry object (used for getInitialImage and sync recovered)
* Also sets the lastModified time in cacheTime.
* Only called for DistributedRegions.<p>
*
* This method returns tombstones so that they can be transferred with
* the initial image.
* @param targetVersion TODO
*
* @see DistributedRegion#chunkEntries
*
* @return false if map entry not found
* @since 3.2.1
*/ | Fill in value, and isSerialized fields in this entry object (used for getInitialImage and sync recovered) Also sets the lastModified time in cacheTime. Only called for DistributedRegions. This method returns tombstones so that they can be transferred with the initial image | fillInValue | {
"repo_name": "papicella/snappy-store",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/RegionEntry.java",
"license": "apache-2.0",
"size": 19823
} | [
"com.gemstone.gemfire.internal.ByteArrayDataInput",
"com.gemstone.gemfire.internal.offheap.annotations.Retained",
"com.gemstone.gemfire.internal.shared.Version"
] | import com.gemstone.gemfire.internal.ByteArrayDataInput; import com.gemstone.gemfire.internal.offheap.annotations.Retained; import com.gemstone.gemfire.internal.shared.Version; | import com.gemstone.gemfire.internal.*; import com.gemstone.gemfire.internal.offheap.annotations.*; import com.gemstone.gemfire.internal.shared.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 2,051,413 |
@Test
public void testCursorTruncate() throws IOException, InterruptedException {
// normal implementation uses synchronous queue, but we use array blocking
// queue for single threaded testing
BlockingQueue<Event> q = new ArrayBlockingQueue<Event>(10);
File f = createDataFile(5);
Cursor c = new Cursor(q, f);
assertTrue(c.tailBody()); // open file the file
assertEquals(0, c.lastChannelPos);
assertTrue(null != c.in);
assertTrue(c.tailBody()); // finish reading the file
assertTrue(0 != c.lastChannelSize);
assertTrue(null != c.in);
assertFalse(c.tailBody()); // attempt to open file again.
assertEquals(5, q.size()); // should be 5 in queue.
// truncate the file -- there will be 1 full event and one unproperly closed
// event.
RandomAccessFile raf = new RandomAccessFile(f, "rw");
raf.setLength(10);
raf.close();
assertFalse(c.tailBody()); // detect file truncation, no data to read
assertEquals(5, q.size()); // should be 5 in queue.
assertEquals(10, c.lastChannelPos);
assertTrue(null != c.in);
assertFalse(c.tailBody()); // no data to read
assertEquals(5, q.size()); // should be 5 in queue.
appendData(f, 5, 5); // appending data after truncation
assertTrue(c.tailBody()); // reading appended data
assertEquals(10, q.size()); // should be 5 + 5 in queue.
assertFalse(c.tailBody()); // no data to read
assertEquals(10, q.size()); // should be 5 + 5 in queue.
} | void function() throws IOException, InterruptedException { BlockingQueue<Event> q = new ArrayBlockingQueue<Event>(10); File f = createDataFile(5); Cursor c = new Cursor(q, f); assertTrue(c.tailBody()); assertEquals(0, c.lastChannelPos); assertTrue(null != c.in); assertTrue(c.tailBody()); assertTrue(0 != c.lastChannelSize); assertTrue(null != c.in); assertFalse(c.tailBody()); assertEquals(5, q.size()); RandomAccessFile raf = new RandomAccessFile(f, "rw"); raf.setLength(10); raf.close(); assertFalse(c.tailBody()); assertEquals(5, q.size()); assertEquals(10, c.lastChannelPos); assertTrue(null != c.in); assertFalse(c.tailBody()); assertEquals(5, q.size()); appendData(f, 5, 5); assertTrue(c.tailBody()); assertEquals(10, q.size()); assertFalse(c.tailBody()); assertEquals(10, q.size()); } | /**
* file truncated. no file, file appears, read
*/ | file truncated. no file, file appears, read | testCursorTruncate | {
"repo_name": "yongkun/flume-0.9.3-cdh3u0-rakuten",
"path": "src/javatest/com/cloudera/flume/handlers/text/TestTailSourceCursor.java",
"license": "apache-2.0",
"size": 23438
} | [
"com.cloudera.flume.core.Event",
"com.cloudera.flume.handlers.text.TailSource",
"java.io.File",
"java.io.IOException",
"java.io.RandomAccessFile",
"java.util.concurrent.ArrayBlockingQueue",
"java.util.concurrent.BlockingQueue",
"org.junit.Assert"
] | import com.cloudera.flume.core.Event; import com.cloudera.flume.handlers.text.TailSource; import java.io.File; import java.io.IOException; import java.io.RandomAccessFile; import java.util.concurrent.ArrayBlockingQueue; import java.util.concurrent.BlockingQueue; import org.junit.Assert; | import com.cloudera.flume.core.*; import com.cloudera.flume.handlers.text.*; import java.io.*; import java.util.concurrent.*; import org.junit.*; | [
"com.cloudera.flume",
"java.io",
"java.util",
"org.junit"
] | com.cloudera.flume; java.io; java.util; org.junit; | 452,544 |
public boolean renameTo(File dest) throws IOException; | boolean function(File dest) throws IOException; | /**
* A convenience method to write an uploaded item to disk.
* If a previous one exists, it will be deleted.
* Once this method is called, if successful, the new file will be out of the cleaner
* of the factory that creates the original InterfaceHttpData object.
* @param dest destination file - must be not null
* @return True if the write is successful
* @exception IOException
*/ | A convenience method to write an uploaded item to disk. If a previous one exists, it will be deleted. Once this method is called, if successful, the new file will be out of the cleaner of the factory that creates the original InterfaceHttpData object | renameTo | {
"repo_name": "scalatra/netty-extension",
"path": "src/main/java/org/jboss/netty/handler/codec/http2/HttpData.java",
"license": "lgpl-3.0",
"size": 5476
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 891,036 |
private List<Intent> filterIntents(Iterable<Intent> intents) {
return Tools.stream(intents)
.filter(i -> contentFilter.filter(i)).collect(Collectors.toList());
}
private class IntentSummary {
private final String intentType;
private int total = 0;
private int installReq = 0;
private int compiling = 0;
private int installing = 0;
private int installed = 0;
private int recompiling = 0;
private int withdrawReq = 0;
private int withdrawing = 0;
private int withdrawn = 0;
private int failed = 0;
private int unknownState = 0;
IntentSummary(String intentType) {
this.intentType = intentType;
}
IntentSummary(Intent intent) {
// remove "Intent" from intentType label
this(intentType(intent));
if (contentFilter.filter(intent)) {
update(service.getIntentState(intent.key()));
}
}
// for identity element, when reducing
IntentSummary() {
this.intentType = null;
} | List<Intent> function(Iterable<Intent> intents) { return Tools.stream(intents) .filter(i -> contentFilter.filter(i)).collect(Collectors.toList()); } private class IntentSummary { private final String intentType; private int total = 0; private int installReq = 0; private int compiling = 0; private int installing = 0; private int installed = 0; private int recompiling = 0; private int withdrawReq = 0; private int withdrawing = 0; private int withdrawn = 0; private int failed = 0; private int unknownState = 0; IntentSummary(String intentType) { this.intentType = intentType; } IntentSummary(Intent intent) { this(intentType(intent)); if (contentFilter.filter(intent)) { update(service.getIntentState(intent.key())); } } IntentSummary() { this.intentType = null; } | /**
* Filter a given list of intents based on the existing content filter.
*
* @param intents Iterable of intents
* @return further filtered list of intents
*/ | Filter a given list of intents based on the existing content filter | filterIntents | {
"repo_name": "sdnwiselab/onos",
"path": "cli/src/main/java/org/onosproject/cli/net/IntentsListCommand.java",
"license": "apache-2.0",
"size": 24759
} | [
"java.util.List",
"java.util.stream.Collectors",
"org.onlab.util.Tools",
"org.onosproject.net.intent.Intent"
] | import java.util.List; import java.util.stream.Collectors; import org.onlab.util.Tools; import org.onosproject.net.intent.Intent; | import java.util.*; import java.util.stream.*; import org.onlab.util.*; import org.onosproject.net.intent.*; | [
"java.util",
"org.onlab.util",
"org.onosproject.net"
] | java.util; org.onlab.util; org.onosproject.net; | 2,269,016 |
public static void main(final String[] args) throws IOException {
// Check parameter
if(args.length != 2) {
System.err.println("Usage: programm <filename> <format>");
System.exit(-1);
}
final String filename = Objects.requireNonNull(args[0]);
final String format = Objects.requireNonNull(args[1]);
final DetermineSamplingSize determineSamplingSize = new DetermineSamplingSize(filename, format);
determineSamplingSize.run();
}
}
class ExperimentSeriesStatistics {
protected long minDiff = Long.MAX_VALUE;
protected long maxDiff = Long.MIN_VALUE;
protected long avgDiffAll = 0;
protected long totalElements = 0;
protected int numberOfExperiments = 0; | static void function(final String[] args) throws IOException { if(args.length != 2) { System.err.println(STR); System.exit(-1); } final String filename = Objects.requireNonNull(args[0]); final String format = Objects.requireNonNull(args[1]); final DetermineSamplingSize determineSamplingSize = new DetermineSamplingSize(filename, format); determineSamplingSize.run(); } } class ExperimentSeriesStatistics { protected long minDiff = Long.MAX_VALUE; protected long maxDiff = Long.MIN_VALUE; protected long avgDiffAll = 0; protected long totalElements = 0; protected int numberOfExperiments = 0; | /**
* Main * Main * Main
*/ | Main * Main * Main | main | {
"repo_name": "jnidzwetzki/bboxdb",
"path": "bboxdb-experiments/src/main/java/org/bboxdb/experiments/misc/DetermineSamplingSize.java",
"license": "apache-2.0",
"size": 9420
} | [
"java.io.IOException",
"java.util.Objects"
] | import java.io.IOException; import java.util.Objects; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 652,186 |
public Date getStartDate() {
return startDate == null ? null : new Date(startDate.getTime());
} | Date function() { return startDate == null ? null : new Date(startDate.getTime()); } | /**
* Returns a defensive copy of startDate if not null.
* @return a defensive copy of startDate if not null.
*/ | Returns a defensive copy of startDate if not null | getStartDate | {
"repo_name": "kaganskaya/Cloud_Practice_4",
"path": "src/main/java/com/google/devrel/training/conference/domain/Conference.java",
"license": "apache-2.0",
"size": 8564
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 530,508 |
@Test
public void testSave_UpsertTrue() throws Exception {
String uid = "john.doe";
String cn = "John Doe";
//Test
String save = AbstractJsonNodeTest.loadResource("./crud/save/person-save-single-template.json")
.replaceFirst("#uid", uid)
.replaceFirst("#givenName", "John")
.replaceFirst("#sn", "Doe")
.replaceFirst("#cn", cn)
.replaceFirst("#upsert", "true")
.replaceFirst("#optional", "");
Response response = getLightblueFactory().getMediator().save(
createRequest_FromJsonString(SaveRequest.class, save));
assertValidResponse(response);
assertEquals(1, response.getModifiedCount());
JsonNode entityData = response.getEntityData();
JSONAssert.assertEquals(
"[{" + generatePersonDnJson(uid) + "}]",
entityData.toString(), false);
//Ensure optional value was changed
assertPersonEntryValues(uid, cn, null);
} | void function() throws Exception { String uid = STR; String cn = STR; String save = AbstractJsonNodeTest.loadResource(STR) .replaceFirst("#uid", uid) .replaceFirst(STR, "John") .replaceFirst("#sn", "Doe") .replaceFirst("#cn", cn) .replaceFirst(STR, "true") .replaceFirst(STR, STR[{STR}]", entityData.toString(), false); assertPersonEntryValues(uid, cn, null); } | /**
* entry is not inserted before upsert, make sure entry is created.
*/ | entry is not inserted before upsert, make sure entry is created | testSave_UpsertTrue | {
"repo_name": "derek63/lightblue-ldap",
"path": "lightblue-ldap-integration-test/src/test/java/com/redhat/lightblue/crud/ldap/ITCaseLdapCRUDControllerTest.java",
"license": "gpl-3.0",
"size": 19240
} | [
"com.redhat.lightblue.util.test.AbstractJsonNodeTest"
] | import com.redhat.lightblue.util.test.AbstractJsonNodeTest; | import com.redhat.lightblue.util.test.*; | [
"com.redhat.lightblue"
] | com.redhat.lightblue; | 2,020,581 |
private String
communicate (String cin)
{
// No server
if (in == null || out == null)
return "NAK";
JopsProtocol jp = new JopsProtocol ();
out.println (cin);
String fromServer = null;
while (fromServer == null)
{
try
{
fromServer = in.readLine ();
}
catch (IOException e)
{
// TODO Auto-generated catch block
e.printStackTrace ();
return null;
}
}
return jp.processOutput (fromServer, this);
}
| String function (String cin) { if (in == null out == null) return "NAK"; JopsProtocol jp = new JopsProtocol (); out.println (cin); String fromServer = null; while (fromServer == null) { try { fromServer = in.readLine (); } catch (IOException e) { e.printStackTrace (); return null; } } return jp.processOutput (fromServer, this); } | /**
* Communicate with the JopsServer.
*
* @param cin The string to send to the server, in protocol format.
*
* @return The output from the protocol. Usually this will be the
* returned result from the server; for certain operations
* this will be different. Some operations incur
* side-effects not evident from the return value.
*/ | Communicate with the JopsServer | communicate | {
"repo_name": "CaptainHayashi/JOPS-old",
"path": "src/jops/client/JopsClient.java",
"license": "gpl-3.0",
"size": 6340
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 41,876 |
public static boolean setOwnerRW(File f) {
return setOwnerPerm(f, true, true, false);
} | static boolean function(File f) { return setOwnerPerm(f, true, true, false); } | /**
** Set owner-only RW on the given file.
*/ | Set owner-only RW on the given file | setOwnerRW | {
"repo_name": "tbaumeist/FreeNet-Source",
"path": "src/freenet/support/io/FileUtil.java",
"license": "gpl-2.0",
"size": 20056
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,310,743 |
public static void createNode(Node node) {
Connection con = null;
PreparedStatement pstmt = null;
boolean abortTransaction = false;
try {
con = DbConnectionManager.getTransactionConnection();
pstmt = con.prepareStatement(ADD_NODE);
pstmt.setString(1, node.getService().getServiceID());
pstmt.setString(2, encodeNodeID(node.getNodeID()));
pstmt.setInt(3, (node.isCollectionNode() ? 0 : 1));
pstmt.setString(4, StringUtils.dateToMillis(node.getCreationDate()));
pstmt.setString(5, StringUtils.dateToMillis(node.getModificationDate()));
pstmt.setString(6, node.getParent() != null ? encodeNodeID(node.getParent().getNodeID()) : null);
pstmt.setInt(7, (node.isPayloadDelivered() ? 1 : 0));
if (!node.isCollectionNode()) {
pstmt.setInt(8, ((LeafNode) node).getMaxPayloadSize());
pstmt.setInt(9, (((LeafNode) node).isPersistPublishedItems() ? 1 : 0));
pstmt.setInt(10, ((LeafNode) node).getMaxPublishedItems());
}
else {
pstmt.setInt(8, 0);
pstmt.setInt(9, 0);
pstmt.setInt(10, 0);
}
pstmt.setInt(11, (node.isNotifiedOfConfigChanges() ? 1 : 0));
pstmt.setInt(12, (node.isNotifiedOfDelete() ? 1 : 0));
pstmt.setInt(13, (node.isNotifiedOfRetract() ? 1 : 0));
pstmt.setInt(14, (node.isPresenceBasedDelivery() ? 1 : 0));
pstmt.setInt(15, (node.isSendItemSubscribe() ? 1 : 0));
pstmt.setString(16, node.getPublisherModel().getName());
pstmt.setInt(17, (node.isSubscriptionEnabled() ? 1 : 0));
pstmt.setInt(18, (node.isSubscriptionConfigurationRequired() ? 1 : 0));
pstmt.setString(19, node.getAccessModel().getName());
pstmt.setString(20, node.getPayloadType());
pstmt.setString(21, node.getBodyXSLT());
pstmt.setString(22, node.getDataformXSLT());
pstmt.setString(23, node.getCreator().toString());
pstmt.setString(24, node.getDescription());
pstmt.setString(25, node.getLanguage());
pstmt.setString(26, node.getName());
if (node.getReplyPolicy() != null) {
pstmt.setString(27, node.getReplyPolicy().name());
}
else {
pstmt.setString(27, null);
}
if (node.isCollectionNode()) {
pstmt.setString(28, ((CollectionNode)node).getAssociationPolicy().name());
pstmt.setInt(29, ((CollectionNode)node).getMaxLeafNodes());
}
else {
pstmt.setString(28, null);
pstmt.setInt(29, 0);
}
pstmt.executeUpdate();
// Save associated JIDs and roster groups
saveAssociatedElements(con, node);
}
catch (SQLException sqle) {
log.error(sqle.getMessage(), sqle);
abortTransaction = true;
}
finally {
DbConnectionManager.closeStatement(pstmt);
DbConnectionManager.closeTransactionConnection(con, abortTransaction);
}
} | static void function(Node node) { Connection con = null; PreparedStatement pstmt = null; boolean abortTransaction = false; try { con = DbConnectionManager.getTransactionConnection(); pstmt = con.prepareStatement(ADD_NODE); pstmt.setString(1, node.getService().getServiceID()); pstmt.setString(2, encodeNodeID(node.getNodeID())); pstmt.setInt(3, (node.isCollectionNode() ? 0 : 1)); pstmt.setString(4, StringUtils.dateToMillis(node.getCreationDate())); pstmt.setString(5, StringUtils.dateToMillis(node.getModificationDate())); pstmt.setString(6, node.getParent() != null ? encodeNodeID(node.getParent().getNodeID()) : null); pstmt.setInt(7, (node.isPayloadDelivered() ? 1 : 0)); if (!node.isCollectionNode()) { pstmt.setInt(8, ((LeafNode) node).getMaxPayloadSize()); pstmt.setInt(9, (((LeafNode) node).isPersistPublishedItems() ? 1 : 0)); pstmt.setInt(10, ((LeafNode) node).getMaxPublishedItems()); } else { pstmt.setInt(8, 0); pstmt.setInt(9, 0); pstmt.setInt(10, 0); } pstmt.setInt(11, (node.isNotifiedOfConfigChanges() ? 1 : 0)); pstmt.setInt(12, (node.isNotifiedOfDelete() ? 1 : 0)); pstmt.setInt(13, (node.isNotifiedOfRetract() ? 1 : 0)); pstmt.setInt(14, (node.isPresenceBasedDelivery() ? 1 : 0)); pstmt.setInt(15, (node.isSendItemSubscribe() ? 1 : 0)); pstmt.setString(16, node.getPublisherModel().getName()); pstmt.setInt(17, (node.isSubscriptionEnabled() ? 1 : 0)); pstmt.setInt(18, (node.isSubscriptionConfigurationRequired() ? 1 : 0)); pstmt.setString(19, node.getAccessModel().getName()); pstmt.setString(20, node.getPayloadType()); pstmt.setString(21, node.getBodyXSLT()); pstmt.setString(22, node.getDataformXSLT()); pstmt.setString(23, node.getCreator().toString()); pstmt.setString(24, node.getDescription()); pstmt.setString(25, node.getLanguage()); pstmt.setString(26, node.getName()); if (node.getReplyPolicy() != null) { pstmt.setString(27, node.getReplyPolicy().name()); } else { pstmt.setString(27, null); } if (node.isCollectionNode()) { pstmt.setString(28, ((CollectionNode)node).getAssociationPolicy().name()); pstmt.setInt(29, ((CollectionNode)node).getMaxLeafNodes()); } else { pstmt.setString(28, null); pstmt.setInt(29, 0); } pstmt.executeUpdate(); saveAssociatedElements(con, node); } catch (SQLException sqle) { log.error(sqle.getMessage(), sqle); abortTransaction = true; } finally { DbConnectionManager.closeStatement(pstmt); DbConnectionManager.closeTransactionConnection(con, abortTransaction); } } | /**
* Creates and stores the node configuration in the database.
*
* @param node The newly created node.
*/ | Creates and stores the node configuration in the database | createNode | {
"repo_name": "GinRyan/OpenFireMODxmppServer",
"path": "src/java/org/jivesoftware/openfire/pubsub/PubSubPersistenceManager.java",
"license": "apache-2.0",
"size": 79843
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"org.jivesoftware.database.DbConnectionManager",
"org.jivesoftware.util.StringUtils"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import org.jivesoftware.database.DbConnectionManager; import org.jivesoftware.util.StringUtils; | import java.sql.*; import org.jivesoftware.database.*; import org.jivesoftware.util.*; | [
"java.sql",
"org.jivesoftware.database",
"org.jivesoftware.util"
] | java.sql; org.jivesoftware.database; org.jivesoftware.util; | 1,533,220 |
@Test
public void deleteCategoryTest() {
CategoryEntity entity = data.get(1);
categoryLogic.deleteCategory(entity.getId());
CategoryEntity deleted = em.find(CategoryEntity.class, entity.getId());
Assert.assertNull(deleted);
} | void function() { CategoryEntity entity = data.get(1); categoryLogic.deleteCategory(entity.getId()); CategoryEntity deleted = em.find(CategoryEntity.class, entity.getId()); Assert.assertNull(deleted); } | /**
* Prueba para eliminar un Category
*
* @generated
*/ | Prueba para eliminar un Category | deleteCategoryTest | {
"repo_name": "Uniandes-MISO4203/artwork-201620-2",
"path": "artwork-logic/src/test/java/co/edu/uniandes/csw/artwork/test/logic/CategoryLogicTest.java",
"license": "mit",
"size": 6897
} | [
"co.edu.uniandes.csw.artwork.entities.CategoryEntity",
"org.junit.Assert"
] | import co.edu.uniandes.csw.artwork.entities.CategoryEntity; import org.junit.Assert; | import co.edu.uniandes.csw.artwork.entities.*; import org.junit.*; | [
"co.edu.uniandes",
"org.junit"
] | co.edu.uniandes; org.junit; | 880,512 |
MachinePool get(FetchOption... options) throws CloudPoolException; | MachinePool get(FetchOption... options) throws CloudPoolException; | /**
* Returns the latest {@link MachinePool} observation.
* <p/>
* Implementations may choose to respond with locally cached observations,
* but must indicate the age of the observation in the timestamp of the
* {@link MachinePool}. {@link FetchOption}s can be used to control this
* behavior to some degree.
*
* @param options
* Options that control how pool members are to be fetched.
* @return A time-stamped {@link MachinePool} observation.
* @throws CloudPoolException
* On failure to supply a (sufficiently up-to-date)
* {@link MachinePool}.
*/ | Returns the latest <code>MachinePool</code> observation. Implementations may choose to respond with locally cached observations, but must indicate the age of the observation in the timestamp of the <code>MachinePool</code>. <code>FetchOption</code>s can be used to control this behavior to some degree | get | {
"repo_name": "elastisys/scale.cloudpool",
"path": "commons/src/main/java/com/elastisys/scale/cloudpool/commons/basepool/poolfetcher/PoolFetcher.java",
"license": "apache-2.0",
"size": 1668
} | [
"com.elastisys.scale.cloudpool.api.CloudPoolException",
"com.elastisys.scale.cloudpool.api.types.MachinePool"
] | import com.elastisys.scale.cloudpool.api.CloudPoolException; import com.elastisys.scale.cloudpool.api.types.MachinePool; | import com.elastisys.scale.cloudpool.api.*; import com.elastisys.scale.cloudpool.api.types.*; | [
"com.elastisys.scale"
] | com.elastisys.scale; | 1,673,860 |
private void initViews() {
ivLogout = (ImageView) findViewById(R.id.ivLogout);
ivAdd = (ImageView) findViewById(R.id.ivAdd);
lvDevices = (RefreshableListView) findViewById(R.id.lvDevices);
// deviceList = new ArrayList<XPGWifiDevice>();
deviceListAdapter = new DeviceListAdapter(this, deviceslist);
lvDevices.setAdapter(deviceListAdapter);
lvDevices.setOnRefreshListener(new OnRefreshListener() { | void function() { ivLogout = (ImageView) findViewById(R.id.ivLogout); ivAdd = (ImageView) findViewById(R.id.ivAdd); lvDevices = (RefreshableListView) findViewById(R.id.lvDevices); deviceListAdapter = new DeviceListAdapter(this, deviceslist); lvDevices.setAdapter(deviceListAdapter); lvDevices.setOnRefreshListener(new OnRefreshListener() { | /**
* Inits the views.
*/ | Inits the views | initViews | {
"repo_name": "gizwits/Gizwits-WaterPurifier_Android",
"path": "src/com/gizwits/framework/activity/device/DeviceListActivity.java",
"license": "mit",
"size": 13000
} | [
"android.widget.ImageView",
"com.gizwits.framework.adapter.DeviceListAdapter",
"com.gizwits.framework.widget.RefreshableListView"
] | import android.widget.ImageView; import com.gizwits.framework.adapter.DeviceListAdapter; import com.gizwits.framework.widget.RefreshableListView; | import android.widget.*; import com.gizwits.framework.adapter.*; import com.gizwits.framework.widget.*; | [
"android.widget",
"com.gizwits.framework"
] | android.widget; com.gizwits.framework; | 1,275,430 |
void preProcess(Dataset ds) throws Exception {
doPreProcess(ds);
} | void preProcess(Dataset ds) throws Exception { doPreProcess(ds); } | /**
* Callback for pre-processing the dataset
* @param ds the original dataset
* @throws Exception
*/ | Callback for pre-processing the dataset | preProcess | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4jboss-all/tags/DCM4CHEE_2_10_12/dcm4jboss-sar/src/java/org/dcm4chex/archive/dcm/storescp/StoreScpService.java",
"license": "apache-2.0",
"size": 25587
} | [
"org.dcm4che.data.Dataset"
] | import org.dcm4che.data.Dataset; | import org.dcm4che.data.*; | [
"org.dcm4che.data"
] | org.dcm4che.data; | 1,628,199 |
return (Timestamp) getContent();
} | return (Timestamp) getContent(); } | /**
* Returns the time value.
*
* @return See above
*/ | Returns the time value | getTime | {
"repo_name": "simleo/openmicroscopy",
"path": "components/blitz/src/omero/gateway/model/TimeAnnotationData.java",
"license": "gpl-2.0",
"size": 3122
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,531,023 |
private boolean putInternal(K key, MapValue<V> newValue) {
checkState(!destroyed, destroyedMessage);
checkNotNull(key, ERROR_NULL_KEY);
checkNotNull(newValue, ERROR_NULL_VALUE);
checkState(newValue.isAlive());
counter.incrementCount();
AtomicBoolean updated = new AtomicBoolean(false);
items.compute(key, (k, existing) -> {
if (existing == null || newValue.isNewerThan(existing)) {
updated.set(true);
return newValue;
}
return existing;
});
if (updated.get() && persistent) {
persistentStore.update(key, newValue);
}
return updated.get();
} | boolean function(K key, MapValue<V> newValue) { checkState(!destroyed, destroyedMessage); checkNotNull(key, ERROR_NULL_KEY); checkNotNull(newValue, ERROR_NULL_VALUE); checkState(newValue.isAlive()); counter.incrementCount(); AtomicBoolean updated = new AtomicBoolean(false); items.compute(key, (k, existing) -> { if (existing == null newValue.isNewerThan(existing)) { updated.set(true); return newValue; } return existing; }); if (updated.get() && persistent) { persistentStore.update(key, newValue); } return updated.get(); } | /**
* Returns true if newValue was accepted i.e. map is updated.
* @param key key
* @param newValue proposed new value
* @return true if update happened; false if map already contains a more recent value for the key
*/ | Returns true if newValue was accepted i.e. map is updated | putInternal | {
"repo_name": "kkkane/ONOS",
"path": "core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java",
"license": "apache-2.0",
"size": 28185
} | [
"com.google.common.base.Preconditions",
"java.util.concurrent.atomic.AtomicBoolean"
] | import com.google.common.base.Preconditions; import java.util.concurrent.atomic.AtomicBoolean; | import com.google.common.base.*; import java.util.concurrent.atomic.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 1,813,748 |
public static ClassLoader getClassLoader(Class<?> clazz) {
Assert.notNull(clazz);
ClassLoader loader = clazz.getClassLoader();
return (loader == null ? ClassLoader.getSystemClassLoader() : loader);
}
| static ClassLoader function(Class<?> clazz) { Assert.notNull(clazz); ClassLoader loader = clazz.getClassLoader(); return (loader == null ? ClassLoader.getSystemClassLoader() : loader); } | /**
* Returns the classloader for the given class. This method deals with JDK classes which return by default, a null
* classloader.
*
* @param clazz
* @return
*/ | Returns the classloader for the given class. This method deals with JDK classes which return by default, a null classloader | getClassLoader | {
"repo_name": "glyn/Gemini-Blueprint",
"path": "core/src/main/java/org/eclipse/gemini/blueprint/util/internal/ClassUtils.java",
"license": "apache-2.0",
"size": 19607
} | [
"org.springframework.util.Assert"
] | import org.springframework.util.Assert; | import org.springframework.util.*; | [
"org.springframework.util"
] | org.springframework.util; | 2,020,065 |
private XMLObject unmarshall(String samlResponse) throws Exception {
BasicParserPool parser = new BasicParserPool();
parser.setNamespaceAware(true);
StringReader reader = new StringReader(samlResponse);
Document doc = parser.parse(reader);
Element samlElement = doc.getDocumentElement();
UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory();
Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(samlElement);
if (unmarshaller == null) {
throw new Exception("Failed to unmarshal");
}
return unmarshaller.unmarshall(samlElement);
} | XMLObject function(String samlResponse) throws Exception { BasicParserPool parser = new BasicParserPool(); parser.setNamespaceAware(true); StringReader reader = new StringReader(samlResponse); Document doc = parser.parse(reader); Element samlElement = doc.getDocumentElement(); UnmarshallerFactory unmarshallerFactory = Configuration.getUnmarshallerFactory(); Unmarshaller unmarshaller = unmarshallerFactory.getUnmarshaller(samlElement); if (unmarshaller == null) { throw new Exception(STR); } return unmarshaller.unmarshall(samlElement); } | /**
* Unmarshall XML to POJOs (These POJOs will be OpenSAML objects.)
*
* @param samlResponse
* @return The root OpenSAML object.
* @throws Exception
*/ | Unmarshall XML to POJOs (These POJOs will be OpenSAML objects.) | unmarshall | {
"repo_name": "oaeproject/SAMLParser",
"path": "src/main/java/org/sakaiproject/SAMLParser/SAMLParser.java",
"license": "apache-2.0",
"size": 5977
} | [
"java.io.StringReader",
"org.opensaml.Configuration",
"org.opensaml.xml.XMLObject",
"org.opensaml.xml.io.Unmarshaller",
"org.opensaml.xml.io.UnmarshallerFactory",
"org.opensaml.xml.parse.BasicParserPool",
"org.w3c.dom.Document",
"org.w3c.dom.Element"
] | import java.io.StringReader; import org.opensaml.Configuration; import org.opensaml.xml.XMLObject; import org.opensaml.xml.io.Unmarshaller; import org.opensaml.xml.io.UnmarshallerFactory; import org.opensaml.xml.parse.BasicParserPool; import org.w3c.dom.Document; import org.w3c.dom.Element; | import java.io.*; import org.opensaml.*; import org.opensaml.xml.*; import org.opensaml.xml.io.*; import org.opensaml.xml.parse.*; import org.w3c.dom.*; | [
"java.io",
"org.opensaml",
"org.opensaml.xml",
"org.w3c.dom"
] | java.io; org.opensaml; org.opensaml.xml; org.w3c.dom; | 2,708,590 |
public GenericResultWaiter runAsyncWait(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; | GenericResultWaiter function(String serviceName, Map<String, ? extends Object> context) throws GenericServiceException, RemoteException; | /**
* Run the service asynchronously. This method WILL persist the job.
* @param serviceName Name of the service to run.
* @param context Map of name, value pairs composing the context.
* @return A new GenericRequester object.
* @throws GenericServiceException
* @throws RemoteException
*/ | Run the service asynchronously. This method WILL persist the job | runAsyncWait | {
"repo_name": "ilscipio/scipio-erp",
"path": "framework/service/src/org/ofbiz/service/rmi/RemoteDispatcher.java",
"license": "apache-2.0",
"size": 10488
} | [
"java.rmi.RemoteException",
"java.util.Map",
"org.ofbiz.service.GenericResultWaiter",
"org.ofbiz.service.GenericServiceException"
] | import java.rmi.RemoteException; import java.util.Map; import org.ofbiz.service.GenericResultWaiter; import org.ofbiz.service.GenericServiceException; | import java.rmi.*; import java.util.*; import org.ofbiz.service.*; | [
"java.rmi",
"java.util",
"org.ofbiz.service"
] | java.rmi; java.util; org.ofbiz.service; | 1,210,141 |
public static RepositoryVersionState getAggregateState(List<RepositoryVersionState> states) {
if (null == states || states.isEmpty()) {
return NOT_REQUIRED;
}
RepositoryVersionState heaviestState = states.get(0);
for (RepositoryVersionState state : states) {
if (state.weight > heaviestState.weight) {
heaviestState = state;
}
}
return heaviestState;
} | static RepositoryVersionState function(List<RepositoryVersionState> states) { if (null == states states.isEmpty()) { return NOT_REQUIRED; } RepositoryVersionState heaviestState = states.get(0); for (RepositoryVersionState state : states) { if (state.weight > heaviestState.weight) { heaviestState = state; } } return heaviestState; } | /**
* Gets a single representation of the repository state based on the supplied
* states.
*
* @param states
* the states to calculate the aggregate for.
* @return the "heaviest" state.
*/ | Gets a single representation of the repository state based on the supplied states | getAggregateState | {
"repo_name": "arenadata/ambari",
"path": "ambari-server/src/main/java/org/apache/ambari/server/state/RepositoryVersionState.java",
"license": "apache-2.0",
"size": 4032
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 116,017 |
private MessageSeqId ensureSeqIdExistsForTopic(ByteString topic) {
MessageSeqId presentSeqIdInMap = currTopicSeqIds.get(topic);
if (presentSeqIdInMap != null) {
return presentSeqIdInMap;
}
presentSeqIdInMap = MessageSeqId.newBuilder().setLocalComponent(0).build();
MessageSeqId oldSeqIdInMap = currTopicSeqIds.putIfAbsent(topic, presentSeqIdInMap);
if (oldSeqIdInMap != null) {
return oldSeqIdInMap;
}
return presentSeqIdInMap;
} | MessageSeqId function(ByteString topic) { MessageSeqId presentSeqIdInMap = currTopicSeqIds.get(topic); if (presentSeqIdInMap != null) { return presentSeqIdInMap; } presentSeqIdInMap = MessageSeqId.newBuilder().setLocalComponent(0).build(); MessageSeqId oldSeqIdInMap = currTopicSeqIds.putIfAbsent(topic, presentSeqIdInMap); if (oldSeqIdInMap != null) { return oldSeqIdInMap; } return presentSeqIdInMap; } | /**
* Ensures that at least the default seq-id exists in the map for the given
* topic. Checks for race conditions (.e.g, another thread inserts the
* default id before us), and returns the latest seq-id value in the map
*
* @param topic
* @return
*/ | Ensures that at least the default seq-id exists in the map for the given topic. Checks for race conditions (.e.g, another thread inserts the default id before us), and returns the latest seq-id value in the map | ensureSeqIdExistsForTopic | {
"repo_name": "mocc/bookkeeper-lab",
"path": "hedwig-server/src/main/java/org/apache/hedwig/server/persistence/LocalDBPersistenceManager.java",
"license": "apache-2.0",
"size": 18033
} | [
"com.google.protobuf.ByteString",
"org.apache.hedwig.protocol.PubSubProtocol"
] | import com.google.protobuf.ByteString; import org.apache.hedwig.protocol.PubSubProtocol; | import com.google.protobuf.*; import org.apache.hedwig.protocol.*; | [
"com.google.protobuf",
"org.apache.hedwig"
] | com.google.protobuf; org.apache.hedwig; | 119,482 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.