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 static Point getCenteringOrigin(Dimension size, Dimension containerSize) throws NullPointerException {
Objects.requireNonNull(size, "Dimension cannot be null.");
Objects.requireNonNull(containerSize, "Dimension cannot be null.");
int w = containerSize.width - size.width;
int h = containerSize.height - size.height;
if (w < 0) {
w = 0;
}
if (h < 0) {
h = 0;
}
return new Point(w/2, h/2);
}
/**
* Get the origin for centering a window, frame, or dialog within
* the default screen device (default monitor).
* <p>It is assumed that the referenced size if for a top-most
* window, such as a JFrame.
*
* @param size the component size
*
* @return the point required to center the component in the
* container. This value can be passed to the
* {@link java.awt.Component#setLocation(java.awt.Point)
* setLocation()} method of the component.
*
* @throws NullPointerException thrown if {@code size} is null
* @see #getCenteringOrigin(java.awt.Dimension, java.awt.Dimension) getOrigin(Dimension, Dimension}
|
static Point function(Dimension size, Dimension containerSize) throws NullPointerException { Objects.requireNonNull(size, STR); Objects.requireNonNull(containerSize, STR); int w = containerSize.width - size.width; int h = containerSize.height - size.height; if (w < 0) { w = 0; } if (h < 0) { h = 0; } return new Point(w/2, h/2); } /** * Get the origin for centering a window, frame, or dialog within * the default screen device (default monitor). * <p>It is assumed that the referenced size if for a top-most * window, such as a JFrame. * * @param size the component size * * @return the point required to center the component in the * container. This value can be passed to the * {@link java.awt.Component#setLocation(java.awt.Point) * setLocation()} method of the component. * * @throws NullPointerException thrown if {@code size} is null * @see #getCenteringOrigin(java.awt.Dimension, java.awt.Dimension) getOrigin(Dimension, Dimension}
|
/**
* Get the origin for centering a window, frame, or dialog.
*<p>If the component's width and/or height is greater than than
* of the container's, then the x-coordinate and/or y-coordinate will be set to zero.
*
* @param size the size of the component to center
* @param containerSize the size of the component's container
*
* @return the point required to center the component in the
* container. This value can be passed to the
* {@link java.awt.Component#setLocation(java.awt.Point)
* setLocation()} method of the component.
*
* @throws IllegalArgumentException thrown if {@code size} or {@code containerSize} are null
* @since 1.0
*/
|
Get the origin for centering a window, frame, or dialog. If the component's width and/or height is greater than than of the container's, then the x-coordinate and/or y-coordinate will be set to zero
|
getCenteringOrigin
|
{
"repo_name": "paulmjarosch/pj_jcommon",
"path": "src/pj/common/tools/UITools.java",
"license": "mit",
"size": 8731
}
|
[
"java.awt.Dimension",
"java.awt.Point",
"java.util.Objects"
] |
import java.awt.Dimension; import java.awt.Point; import java.util.Objects;
|
import java.awt.*; import java.util.*;
|
[
"java.awt",
"java.util"
] |
java.awt; java.util;
| 2,862,400
|
@Override
public void setup(final StendhalRPZone zone) {
String className = getImplementation();
if (className == null) {
className = Portal.class.getName();
}
try {
final Portal portal = (Portal) EntityFactoryHelper.create(className,
getParameters(), getAttributes());
if (portal == null) {
logger.warn("Unable to create portal: " + className);
return;
}
portal.setPosition(getX(), getY());
portal.setIdentifier(getIdentifier());
final Object destIdentifier = getDestinationIdentifier();
if (destIdentifier != null) {
portal.setDestination(getDestinationZone(), destIdentifier);
}
if (portal instanceof HousePortal && associatedZones != null) {
((HousePortal) portal).setAssociatedZones(associatedZones);
}
// Set facing direction for portal used as destination.
if (portal.has("face")) {
portal.setFaceDirection(portal.get("face"));
}
// Check for an existing portal at the location
final Portal oportal = zone.getPortal(getX(), getY());
if (oportal != null) {
if (isReplacing()) {
// copy owner attributes from old portal
if (oportal instanceof HousePortal) {
for (final String attr: Arrays.asList(
"owner", "lock_number", "expires")) {
final String atocopy = ((HousePortal) oportal).get(attr);
if (atocopy != null) {
((HousePortal) portal).put(attr, atocopy);
}
}
}
logger.debug("Replacing portal: " + oportal);
zone.remove(oportal);
} else {
// reserved, and told not to replace it. just discard the portal
return;
}
}
zone.add(portal);
} catch (final IllegalArgumentException ex) {
logger.error("Error with portal factory", ex);
}
}
|
void function(final StendhalRPZone zone) { String className = getImplementation(); if (className == null) { className = Portal.class.getName(); } try { final Portal portal = (Portal) EntityFactoryHelper.create(className, getParameters(), getAttributes()); if (portal == null) { logger.warn(STR + className); return; } portal.setPosition(getX(), getY()); portal.setIdentifier(getIdentifier()); final Object destIdentifier = getDestinationIdentifier(); if (destIdentifier != null) { portal.setDestination(getDestinationZone(), destIdentifier); } if (portal instanceof HousePortal && associatedZones != null) { ((HousePortal) portal).setAssociatedZones(associatedZones); } if (portal.has("face")) { portal.setFaceDirection(portal.get("face")); } final Portal oportal = zone.getPortal(getX(), getY()); if (oportal != null) { if (isReplacing()) { if (oportal instanceof HousePortal) { for (final String attr: Arrays.asList( "owner", STR, STR)) { final String atocopy = ((HousePortal) oportal).get(attr); if (atocopy != null) { ((HousePortal) portal).put(attr, atocopy); } } } logger.debug(STR + oportal); zone.remove(oportal); } else { return; } } zone.add(portal); } catch (final IllegalArgumentException ex) { logger.error(STR, ex); } }
|
/**
* Do appropriate zone setup.
*
* @param zone
* The zone.
*/
|
Do appropriate zone setup
|
setup
|
{
"repo_name": "AntumDeluge/arianne-stendhal",
"path": "src/games/stendhal/server/core/config/zone/PortalSetupDescriptor.java",
"license": "gpl-2.0",
"size": 4723
}
|
[
"games.stendhal.server.core.engine.StendhalRPZone",
"games.stendhal.server.entity.EntityFactoryHelper",
"games.stendhal.server.entity.mapstuff.portal.HousePortal",
"games.stendhal.server.entity.mapstuff.portal.Portal",
"java.util.Arrays"
] |
import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.entity.EntityFactoryHelper; import games.stendhal.server.entity.mapstuff.portal.HousePortal; import games.stendhal.server.entity.mapstuff.portal.Portal; import java.util.Arrays;
|
import games.stendhal.server.core.engine.*; import games.stendhal.server.entity.*; import games.stendhal.server.entity.mapstuff.portal.*; import java.util.*;
|
[
"games.stendhal.server",
"java.util"
] |
games.stendhal.server; java.util;
| 417,611
|
private void initGame() {
stateMachine = new StateMachine();
controlsManager = new ControlsManager(stateMachine);
addKeyListener(controlsManager);
if (!running || thread == null) {
running = true;
thread = new Thread(this);
thread.start();
}
}
|
void function() { stateMachine = new StateMachine(); controlsManager = new ControlsManager(stateMachine); addKeyListener(controlsManager); if (!running thread == null) { running = true; thread = new Thread(this); thread.start(); } }
|
/**
* Initiates and sets up the game objects.
*/
|
Initiates and sets up the game objects
|
initGame
|
{
"repo_name": "mzinelli/space-Lamsa",
"path": "src/com/mpu/spinv/Core.java",
"license": "mit",
"size": 1732
}
|
[
"com.mpu.spinv.engine.ControlsManager",
"com.mpu.spinv.engine.StateMachine"
] |
import com.mpu.spinv.engine.ControlsManager; import com.mpu.spinv.engine.StateMachine;
|
import com.mpu.spinv.engine.*;
|
[
"com.mpu.spinv"
] |
com.mpu.spinv;
| 2,518,384
|
public static TaskActivation parseJSON(JsonNode node) {
try {
List<JsonNode> hotkeysNode = node.getArrayNode("hotkey");
List<JsonNode> keySequenceNodes = node.isArrayNode("key_sequence") ? node.getArrayNode("key_sequence") : new ArrayList<>();
List<JsonNode> mouseGestureNode = node.getArrayNode("mouse_gesture");
List<JsonNode> phrasesNodes = node.isArrayNode("phrases") ? node.getArrayNode("phrases") : new ArrayList<>();
List<JsonNode> variablesNodes = node.getArrayNode("variables");
Set<KeyChain> keyChains = new HashSet<>();
for (JsonNode hotkeyNode : hotkeysNode) {
KeyChain newKeyChain = KeyChain.parseJSON(hotkeyNode.getArrayNode());
if (newKeyChain == null) {
LOGGER.log(Level.WARNING, "Cannot parse key chain " + hotkeyNode);
} else {
keyChains.add(newKeyChain);
}
}
Set<KeySequence> keySequences = new HashSet<>();
for (JsonNode keySequenceNode : keySequenceNodes) {
KeySequence newkeySequence = KeySequence.parseJSON(keySequenceNode.getArrayNode());
if (newkeySequence == null) {
LOGGER.log(Level.WARNING, "Cannot parse key chain " + keySequenceNode);
} else {
keySequences.add(newkeySequence);
}
}
Set<MouseGesture> gestures = MouseGesture.parseJSON(mouseGestureNode);
Set<ActivationPhrase> phrases = new HashSet<>();
for (JsonNode phraseNode : phrasesNodes) {
ActivationPhrase phrase = ActivationPhrase.parseJSON(phraseNode);
if (phrase == null) {
LOGGER.log(Level.WARNING, "Cannot parse phrase " + phraseNode);
} else {
phrases.add(phrase);
}
}
Set<SharedVariablesActivation> variables = new HashSet<>();
for (JsonNode variableNode : variablesNodes) {
SharedVariablesActivation variable = SharedVariablesActivation.parseJSON(variableNode);
if (variable == null) {
LOGGER.log(Level.WARNING, "Cannot parse variable node " + variableNode);
} else {
variables.add(variable);
}
}
GlobalActivation globalActivation = node.isNode("global_activation")
? GlobalActivation.parseJSON(node.getNode("global_activation"))
: GlobalActivation.newBuilder().build();
if (globalActivation == null) {
globalActivation = GlobalActivation.newBuilder().build();
}
TaskActivation output = TaskActivation.newBuilder()
.withHotKeys(keyChains)
.withKeySequence(keySequences)
.withMouseGestures(gestures)
.withPhrases(phrases)
.withVariables(variables)
.withGlobalActivation(globalActivation)
.build();
return output;
} catch (Exception e) {
LOGGER.log(Level.WARNING, "Exception while parsing task activation.", e);
return null;
}
}
|
static TaskActivation function(JsonNode node) { try { List<JsonNode> hotkeysNode = node.getArrayNode(STR); List<JsonNode> keySequenceNodes = node.isArrayNode(STR) ? node.getArrayNode(STR) : new ArrayList<>(); List<JsonNode> mouseGestureNode = node.getArrayNode(STR); List<JsonNode> phrasesNodes = node.isArrayNode(STR) ? node.getArrayNode(STR) : new ArrayList<>(); List<JsonNode> variablesNodes = node.getArrayNode(STR); Set<KeyChain> keyChains = new HashSet<>(); for (JsonNode hotkeyNode : hotkeysNode) { KeyChain newKeyChain = KeyChain.parseJSON(hotkeyNode.getArrayNode()); if (newKeyChain == null) { LOGGER.log(Level.WARNING, STR + hotkeyNode); } else { keyChains.add(newKeyChain); } } Set<KeySequence> keySequences = new HashSet<>(); for (JsonNode keySequenceNode : keySequenceNodes) { KeySequence newkeySequence = KeySequence.parseJSON(keySequenceNode.getArrayNode()); if (newkeySequence == null) { LOGGER.log(Level.WARNING, STR + keySequenceNode); } else { keySequences.add(newkeySequence); } } Set<MouseGesture> gestures = MouseGesture.parseJSON(mouseGestureNode); Set<ActivationPhrase> phrases = new HashSet<>(); for (JsonNode phraseNode : phrasesNodes) { ActivationPhrase phrase = ActivationPhrase.parseJSON(phraseNode); if (phrase == null) { LOGGER.log(Level.WARNING, STR + phraseNode); } else { phrases.add(phrase); } } Set<SharedVariablesActivation> variables = new HashSet<>(); for (JsonNode variableNode : variablesNodes) { SharedVariablesActivation variable = SharedVariablesActivation.parseJSON(variableNode); if (variable == null) { LOGGER.log(Level.WARNING, STR + variableNode); } else { variables.add(variable); } } GlobalActivation globalActivation = node.isNode(STR) ? GlobalActivation.parseJSON(node.getNode(STR)) : GlobalActivation.newBuilder().build(); if (globalActivation == null) { globalActivation = GlobalActivation.newBuilder().build(); } TaskActivation output = TaskActivation.newBuilder() .withHotKeys(keyChains) .withKeySequence(keySequences) .withMouseGestures(gestures) .withPhrases(phrases) .withVariables(variables) .withGlobalActivation(globalActivation) .build(); return output; } catch (Exception e) { LOGGER.log(Level.WARNING, STR, e); return null; } }
|
/**
* Construct a new object from a json node.
*
* @param node json node to parse
* @return the new object with content parsed, or null if cannot parse.
*/
|
Construct a new object from a json node
|
parseJSON
|
{
"repo_name": "repeats/Repeat",
"path": "src/core/keyChain/TaskActivation.java",
"license": "apache-2.0",
"size": 14334
}
|
[
"java.util.ArrayList",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"java.util.logging.Level"
] |
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.logging.Level;
|
import java.util.*; import java.util.logging.*;
|
[
"java.util"
] |
java.util;
| 2,531,915
|
public Map<PathFragment, Artifact> build() {
if (!sawWorkspaceName) {
// If we haven't seen it and we have seen other files, add the workspace name directory.
// It might not be there if all of the runfiles are from other repos (and then running from
// x.runfiles/ws will fail, because ws won't exist). We can't tell Runfiles to create a
// directory, so instead this creates a hidden file inside the desired directory.
manifest.put(workspaceName.getRelative(".runfile"), null);
}
return manifest;
}
|
Map<PathFragment, Artifact> function() { if (!sawWorkspaceName) { manifest.put(workspaceName.getRelative(STR), null); } return manifest; }
|
/**
* Returns the manifest, adding the workspaceName directory if it is not already present.
*/
|
Returns the manifest, adding the workspaceName directory if it is not already present
|
build
|
{
"repo_name": "twitter-forks/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java",
"license": "apache-2.0",
"size": 45422
}
|
[
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.vfs.PathFragment",
"java.util.Map"
] |
import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.vfs.PathFragment; import java.util.Map;
|
import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.vfs.*; import java.util.*;
|
[
"com.google.devtools",
"java.util"
] |
com.google.devtools; java.util;
| 595,763
|
public void testTrackPointsTableUpdate_resampling() {
Capture<ContentObserver> observerCapture = new Capture<ContentObserver>();
dataSource.registerContentObserver(
eq(TrackPointsColumns.CONTENT_URI), capture(observerCapture));
// Deliver 30 points (no sampling happens)
FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 30, 5);
expect(myTracksProviderUtils.getTrackPointLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator);
expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(30L);
trackDataListener1.clearTrackPoints();
locationIterator.expectLocationsDelivered(trackDataListener1);
trackDataListener1.onNewTrackPointsDone();
replay();
trackDataHub.start();
trackDataHub.loadTrack(TRACK_ID);
trackDataHub.registerTrackDataListener(
trackDataListener1, EnumSet.of(TrackDataType.SAMPLED_IN_TRACK_POINTS_TABLE));
verifyAndReset();
// Now deliver 30 more (incrementally sampled)
ContentObserver observer = observerCapture.getValue();
locationIterator = new FixedSizeLocationIterator(31, 30);
expect(myTracksProviderUtils.getTrackPointLocationIterator(
eq(TRACK_ID), eq(31L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator);
expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(60L);
locationIterator.expectSampledLocationsDelivered(trackDataListener1, 2, false);
trackDataListener1.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
// Now another 30 (triggers resampling)
locationIterator = new FixedSizeLocationIterator(1, 90);
expect(myTracksProviderUtils.getTrackPointLocationIterator(
eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator);
expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(90L);
trackDataListener1.clearTrackPoints();
locationIterator.expectSampledLocationsDelivered(trackDataListener1, 2, false);
trackDataListener1.onNewTrackPointsDone();
replay();
observer.onChange(false);
verifyAndReset();
}
|
void function() { Capture<ContentObserver> observerCapture = new Capture<ContentObserver>(); dataSource.registerContentObserver( eq(TrackPointsColumns.CONTENT_URI), capture(observerCapture)); FixedSizeLocationIterator locationIterator = new FixedSizeLocationIterator(1, 30, 5); expect(myTracksProviderUtils.getTrackPointLocationIterator( eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator); expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(30L); trackDataListener1.clearTrackPoints(); locationIterator.expectLocationsDelivered(trackDataListener1); trackDataListener1.onNewTrackPointsDone(); replay(); trackDataHub.start(); trackDataHub.loadTrack(TRACK_ID); trackDataHub.registerTrackDataListener( trackDataListener1, EnumSet.of(TrackDataType.SAMPLED_IN_TRACK_POINTS_TABLE)); verifyAndReset(); ContentObserver observer = observerCapture.getValue(); locationIterator = new FixedSizeLocationIterator(31, 30); expect(myTracksProviderUtils.getTrackPointLocationIterator( eq(TRACK_ID), eq(31L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator); expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(60L); locationIterator.expectSampledLocationsDelivered(trackDataListener1, 2, false); trackDataListener1.onNewTrackPointsDone(); replay(); observer.onChange(false); verifyAndReset(); locationIterator = new FixedSizeLocationIterator(1, 90); expect(myTracksProviderUtils.getTrackPointLocationIterator( eq(TRACK_ID), eq(0L), eq(false), isA(LocationFactory.class))).andReturn(locationIterator); expect(myTracksProviderUtils.getLastTrackPointId(TRACK_ID)).andReturn(90L); trackDataListener1.clearTrackPoints(); locationIterator.expectSampledLocationsDelivered(trackDataListener1, 2, false); trackDataListener1.onNewTrackPointsDone(); replay(); observer.onChange(false); verifyAndReset(); }
|
/**
* Tests track points table update with resampling.
*/
|
Tests track points table update with resampling
|
testTrackPointsTableUpdate_resampling
|
{
"repo_name": "Plonk42/mytracks",
"path": "myTracks/src/androidTest/java/com/google/android/apps/mytracks/content/TrackDataHubTest.java",
"license": "apache-2.0",
"size": 32375
}
|
[
"android.database.ContentObserver",
"com.google.android.apps.mytracks.content.MyTracksProviderUtils",
"com.google.android.testing.mocking.AndroidMock",
"java.util.EnumSet",
"org.easymock.Capture"
] |
import android.database.ContentObserver; import com.google.android.apps.mytracks.content.MyTracksProviderUtils; import com.google.android.testing.mocking.AndroidMock; import java.util.EnumSet; import org.easymock.Capture;
|
import android.database.*; import com.google.android.apps.mytracks.content.*; import com.google.android.testing.mocking.*; import java.util.*; import org.easymock.*;
|
[
"android.database",
"com.google.android",
"java.util",
"org.easymock"
] |
android.database; com.google.android; java.util; org.easymock;
| 2,186,309
|
@Test
public void testLong()
throws IOException {
for (int i = 0; i < NUM_ITERATIONS; i++) {
Long expected = RANDOM.nextLong();
byte[] bytes = ObjectCustomSerDe.serialize(expected);
Long actual = ObjectCustomSerDe.deserialize(bytes, ObjectType.Long);
Assert.assertEquals(actual, expected, ERROR_MESSAGE);
}
}
|
void function() throws IOException { for (int i = 0; i < NUM_ITERATIONS; i++) { Long expected = RANDOM.nextLong(); byte[] bytes = ObjectCustomSerDe.serialize(expected); Long actual = ObjectCustomSerDe.deserialize(bytes, ObjectType.Long); Assert.assertEquals(actual, expected, ERROR_MESSAGE); } }
|
/**
* Test for ser/de of {@link Long}.
*/
|
Test for ser/de of <code>Long</code>
|
testLong
|
{
"repo_name": "sajavadi/pinot",
"path": "pinot-core/src/test/java/com/linkedin/pinot/core/common/datatable/ObjectCustomSerDeTest.java",
"license": "apache-2.0",
"size": 5475
}
|
[
"java.io.IOException",
"org.testng.Assert"
] |
import java.io.IOException; import org.testng.Assert;
|
import java.io.*; import org.testng.*;
|
[
"java.io",
"org.testng"
] |
java.io; org.testng;
| 891,108
|
private static ActionEnvironment create(
EnvironmentVariables fixedEnv, ImmutableSet<String> inheritedEnv) {
if (fixedEnv.isEmpty() && inheritedEnv.isEmpty()) {
return EMPTY;
}
return new ActionEnvironment(fixedEnv, inheritedEnv);
}
|
static ActionEnvironment function( EnvironmentVariables fixedEnv, ImmutableSet<String> inheritedEnv) { if (fixedEnv.isEmpty() && inheritedEnv.isEmpty()) { return EMPTY; } return new ActionEnvironment(fixedEnv, inheritedEnv); }
|
/**
* Creates a new action environment. The order in which the environments are combined is
* undefined, so callers need to take care that the key set of the {@code fixedEnv} map and the
* set of {@code inheritedEnv} elements are disjoint.
*/
|
Creates a new action environment. The order in which the environments are combined is undefined, so callers need to take care that the key set of the fixedEnv map and the set of inheritedEnv elements are disjoint
|
create
|
{
"repo_name": "katre/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/ActionEnvironment.java",
"license": "apache-2.0",
"size": 8619
}
|
[
"com.google.common.collect.ImmutableSet"
] |
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.*;
|
[
"com.google.common"
] |
com.google.common;
| 2,279,193
|
public synchronized void bind(final ServiceReference<HttpClient> clientRef) {
LOG.info("Got new HttpClient service.");
if (serviceClient.get() == null || clientRef.compareTo(serviceClient.get()) > 0) {
serviceClient.set(clientRef);
client.set((CloseableHttpClient) bundleContext.getService(clientRef));
LOG.info("Using new HttpClient service " + client.get());
} else {
LOG.info("HttpClient service is lower priority. Ignoring.");
}
}
|
synchronized void function(final ServiceReference<HttpClient> clientRef) { LOG.info(STR); if (serviceClient.get() == null clientRef.compareTo(serviceClient.get()) > 0) { serviceClient.set(clientRef); client.set((CloseableHttpClient) bundleContext.getService(clientRef)); LOG.info(STR + client.get()); } else { LOG.info(STR); } }
|
/**
* React to a newly bound service reference.
*
* @param clientRef
*/
|
React to a newly bound service reference
|
bind
|
{
"repo_name": "birkland/fcrepo-api-x",
"path": "fcrepo-api-x-registry/src/main/java/org/fcrepo/apix/registry/HttpClientFetcher.java",
"license": "apache-2.0",
"size": 5140
}
|
[
"org.apache.http.client.HttpClient",
"org.apache.http.impl.client.CloseableHttpClient",
"org.osgi.framework.ServiceReference"
] |
import org.apache.http.client.HttpClient; import org.apache.http.impl.client.CloseableHttpClient; import org.osgi.framework.ServiceReference;
|
import org.apache.http.client.*; import org.apache.http.impl.client.*; import org.osgi.framework.*;
|
[
"org.apache.http",
"org.osgi.framework"
] |
org.apache.http; org.osgi.framework;
| 2,449,233
|
@Test(expected = NullPointerException.class)
public void setNullTarget() {
MouseJoint mj = new MouseJoint(b, new Vector2(), 4.0, 0.4, 10.0);
mj.setTarget(null);
}
|
@Test(expected = NullPointerException.class) void function() { MouseJoint mj = new MouseJoint(b, new Vector2(), 4.0, 0.4, 10.0); mj.setTarget(null); }
|
/**
* Tests setting a null target.
*/
|
Tests setting a null target
|
setNullTarget
|
{
"repo_name": "satishbabusee/dyn4j",
"path": "junit/org/dyn4j/dynamics/MouseJointTest.java",
"license": "bsd-3-clause",
"size": 7434
}
|
[
"org.dyn4j.dynamics.joint.MouseJoint",
"org.dyn4j.geometry.Vector2",
"org.junit.Test"
] |
import org.dyn4j.dynamics.joint.MouseJoint; import org.dyn4j.geometry.Vector2; import org.junit.Test;
|
import org.dyn4j.dynamics.joint.*; import org.dyn4j.geometry.*; import org.junit.*;
|
[
"org.dyn4j.dynamics",
"org.dyn4j.geometry",
"org.junit"
] |
org.dyn4j.dynamics; org.dyn4j.geometry; org.junit;
| 233,481
|
public static final Parcelable.Creator<AudioPolicyConfig> CREATOR
= new Parcelable.Creator<AudioPolicyConfig>() {
public AudioPolicyConfig createFromParcel(Parcel p) {
return new AudioPolicyConfig(p);
}
|
static final Parcelable.Creator<AudioPolicyConfig> CREATOR = new Parcelable.Creator<AudioPolicyConfig>() { public AudioPolicyConfig function(Parcel p) { return new AudioPolicyConfig(p); }
|
/**
* Rebuilds an AudioPolicyConfig previously stored with writeToParcel().
* @param p Parcel object to read the AudioPolicyConfig from
* @return a new AudioPolicyConfig created from the data in the parcel
*/
|
Rebuilds an AudioPolicyConfig previously stored with writeToParcel()
|
createFromParcel
|
{
"repo_name": "xorware/android_frameworks_base",
"path": "media/java/android/media/audiopolicy/AudioPolicyConfig.java",
"license": "apache-2.0",
"size": 9088
}
|
[
"android.os.Parcel",
"android.os.Parcelable"
] |
import android.os.Parcel; import android.os.Parcelable;
|
import android.os.*;
|
[
"android.os"
] |
android.os;
| 754,432
|
public static void createClientCache1CommonWriter(String host, Integer port) throws Exception {
ConflationDUnitTest test = new ConflationDUnitTest();
cache = test.createCache(createProperties1());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setPoolName(createPool(host, "p1", port, true).getName());
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME1, attrs);
cache.createRegion(REGION_NAME2, attrs);
}
|
static void function(String host, Integer port) throws Exception { ConflationDUnitTest test = new ConflationDUnitTest(); cache = test.createCache(createProperties1()); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setPoolName(createPool(host, "p1", port, true).getName()); RegionAttributes attrs = factory.create(); cache.createRegion(REGION_NAME1, attrs); cache.createRegion(REGION_NAME2, attrs); }
|
/**
* create a client with 2 regions sharing a common writer
*
*/
|
create a client with 2 regions sharing a common writer
|
createClientCache1CommonWriter
|
{
"repo_name": "masaki-yamakawa/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/ConflationDUnitTest.java",
"license": "apache-2.0",
"size": 24631
}
|
[
"org.apache.geode.cache.AttributesFactory",
"org.apache.geode.cache.RegionAttributes",
"org.apache.geode.cache.Scope"
] |
import org.apache.geode.cache.AttributesFactory; import org.apache.geode.cache.RegionAttributes; import org.apache.geode.cache.Scope;
|
import org.apache.geode.cache.*;
|
[
"org.apache.geode"
] |
org.apache.geode;
| 692,680
|
public synchronized PaquetUDP read() {
PaquetUDP p =null;
try{
p = fifo.getFirst();
}catch(NoSuchElementException e){}
while(p == null){
try {
this.wait();
} catch (InterruptedException e) {
e.printStackTrace();
}
p = fifo.getFirst();
fifo.removeFirst();
}
return p;
}
|
synchronized PaquetUDP function() { PaquetUDP p =null; try{ p = fifo.getFirst(); }catch(NoSuchElementException e){} while(p == null){ try { this.wait(); } catch (InterruptedException e) { e.printStackTrace(); } p = fifo.getFirst(); fifo.removeFirst(); } return p; }
|
/**Attend un paquet depuis le socket. Si diponible dans le fifo, retour direct.
* Sinon, mise en attente du thread.
*
* @return Le paquet reçu.
*/
|
Attend un paquet depuis le socket. Si diponible dans le fifo, retour direct. Sinon, mise en attente du thread
|
read
|
{
"repo_name": "lamatypus/Simulateur",
"path": "src/sockets/SocketUDP.java",
"license": "mit",
"size": 2486
}
|
[
"java.util.NoSuchElementException"
] |
import java.util.NoSuchElementException;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,142,931
|
public static PropertyEditor findEditor(Class<?> editedClass)
{
try
{
Class found = (Class)editors.get(editedClass);
if(found != null)
{
return (PropertyEditor)found.newInstance();
}
ClassLoader contextClassLoader
= Thread.currentThread().getContextClassLoader();
try
{
found = Class.forName(editedClass.getName()+"Editor", true,
contextClassLoader);
registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance();
}
catch(ClassNotFoundException E)
{
}
String appendName
= "."
+ ClassHelper.getTruncatedClassName(editedClass)
+ "Editor";
synchronized(editorSearchPath)
{
for(int i=0;i<editorSearchPath.length;i++)
{
try
{
found = Class.forName(editorSearchPath[i] + appendName,
true, contextClassLoader);
registerEditor(editedClass,found);
return (PropertyEditor)found.newInstance();
}
catch(ClassNotFoundException E)
{
}
}
}
}
catch(InstantiationException E)
{
}
catch(IllegalAccessException E)
{
}
return null;
}
|
static PropertyEditor function(Class<?> editedClass) { try { Class found = (Class)editors.get(editedClass); if(found != null) { return (PropertyEditor)found.newInstance(); } ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); try { found = Class.forName(editedClass.getName()+STR, true, contextClassLoader); registerEditor(editedClass,found); return (PropertyEditor)found.newInstance(); } catch(ClassNotFoundException E) { } String appendName = "." + ClassHelper.getTruncatedClassName(editedClass) + STR; synchronized(editorSearchPath) { for(int i=0;i<editorSearchPath.length;i++) { try { found = Class.forName(editorSearchPath[i] + appendName, true, contextClassLoader); registerEditor(editedClass,found); return (PropertyEditor)found.newInstance(); } catch(ClassNotFoundException E) { } } } } catch(InstantiationException E) { } catch(IllegalAccessException E) { } return null; }
|
/**
* Returns a new instance of the property editor for the
* specified class.
*
* @param editedClass the class that the property editor
* will edit.
* @return a PropertyEditor instance that can edit the
* specified class.
*/
|
Returns a new instance of the property editor for the specified class
|
findEditor
|
{
"repo_name": "SanDisk-Open-Source/SSD_Dashboard",
"path": "uefi/gcc/gcc-4.6.3/libjava/classpath/java/beans/PropertyEditorManager.java",
"license": "gpl-2.0",
"size": 6993
}
|
[
"gnu.java.lang.ClassHelper"
] |
import gnu.java.lang.ClassHelper;
|
import gnu.java.lang.*;
|
[
"gnu.java.lang"
] |
gnu.java.lang;
| 2,051,958
|
public Rectangle2D getBounds();
|
Rectangle2D function();
|
/**
* Returns the current bounds of the block.
*
* @return The bounds.
*/
|
Returns the current bounds of the block
|
getBounds
|
{
"repo_name": "akardapolov/ASH-Viewer",
"path": "jfreechart-fse/src/main/java/org/jfree/chart/block/Block.java",
"license": "gpl-3.0",
"size": 3735
}
|
[
"java.awt.geom.Rectangle2D"
] |
import java.awt.geom.Rectangle2D;
|
import java.awt.geom.*;
|
[
"java.awt"
] |
java.awt;
| 2,647,968
|
private Optional<Integer> getPokemonHPFromImg(Bitmap pokemonImage) {
Bitmap hp = getImageCrop(pokemonImage, 0.357, 0.52, 0.285, 0.0293);
String hash = "hp" + hashBitmap(hp);
String pokemonHPStr = ocrCache.get(hash);
if (pokemonHPStr == null) {
hp = replaceColors(hp, true, 55, 66, 61, Color.WHITE, 200, true);
tesseract.setImage(hp);
pokemonHPStr = tesseract.getUTF8Text();
ocrCache.put(hash, pokemonHPStr);
}
hp.recycle();
if (pokemonHPStr.contains("/")) {
try {
//If "/" comes at the end we'll get an array with only one component.
String[] hpParts = pokemonHPStr.split("/");
String hpStr;
if (hpParts.length >= 2) { //example read "30 / 55 hp"
//Cant read part 0 because that changes if poke has low hp
hpStr = hpParts[1];
hpStr = hpStr.substring(0, hpStr.length() - 2); //Removes the two last chars, like "hp" or "ps"
} else if (hpParts.length == 1) { //Failed to read "/", example "30 7 55 hp"
hpStr = hpParts[0];
hpStr = hpStr.substring(0, hpStr.length() - 2); //Removes the two last chars, like "hp" or "ps"
} else {
return Optional.absent();
}
return Optional.of(Integer.parseInt(fixOcrLettersToNums(hpStr)));
} catch (NumberFormatException e) {
//Fall-through to default.
}
}
return Optional.absent();
}
|
Optional<Integer> function(Bitmap pokemonImage) { Bitmap hp = getImageCrop(pokemonImage, 0.357, 0.52, 0.285, 0.0293); String hash = "hp" + hashBitmap(hp); String pokemonHPStr = ocrCache.get(hash); if (pokemonHPStr == null) { hp = replaceColors(hp, true, 55, 66, 61, Color.WHITE, 200, true); tesseract.setImage(hp); pokemonHPStr = tesseract.getUTF8Text(); ocrCache.put(hash, pokemonHPStr); } hp.recycle(); if (pokemonHPStr.contains("/")) { try { String[] hpParts = pokemonHPStr.split("/"); String hpStr; if (hpParts.length >= 2) { hpStr = hpParts[1]; hpStr = hpStr.substring(0, hpStr.length() - 2); } else if (hpParts.length == 1) { hpStr = hpParts[0]; hpStr = hpStr.substring(0, hpStr.length() - 2); } else { return Optional.absent(); } return Optional.of(Integer.parseInt(fixOcrLettersToNums(hpStr))); } catch (NumberFormatException e) { } } return Optional.absent(); }
|
/**
* Get the pokemon hp from a picture.
*
* @param pokemonImage the image of the whole screen
* @return an integer of the interpreted pokemon name, 10 if scan failed
*/
|
Get the pokemon hp from a picture
|
getPokemonHPFromImg
|
{
"repo_name": "NightMadness/GoIV",
"path": "app/src/main/java/com/kamron/pogoiv/OcrHelper.java",
"license": "gpl-3.0",
"size": 25441
}
|
[
"android.graphics.Bitmap",
"android.graphics.Color",
"com.google.common.base.Optional"
] |
import android.graphics.Bitmap; import android.graphics.Color; import com.google.common.base.Optional;
|
import android.graphics.*; import com.google.common.base.*;
|
[
"android.graphics",
"com.google.common"
] |
android.graphics; com.google.common;
| 1,708,535
|
private MetricValues memoryMetricValues(Set<MachineMetric> customSet,
List<Long> values) {
return metricValues(customSet, MachineMetricFactory.memoryMetrics,
values);
}
|
MetricValues function(Set<MachineMetric> customSet, List<Long> values) { return metricValues(customSet, MachineMetricFactory.memoryMetrics, values); }
|
/**
* Returns the set of memory metrics and the corresponding values based on
* the default and the customized set of metrics, if any.
*
* @param customSet
* a non-null customized set of metrics
* @param values
* a non-null list of values corresponding to the list of default
* memory metrics
*/
|
Returns the set of memory metrics and the corresponding values based on the default and the customized set of metrics, if any
|
memoryMetricValues
|
{
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-cloudwatchmetrics/src/main/java/com/amazonaws/metrics/internal/cloudwatch/MachineMetricFactory.java",
"license": "apache-2.0",
"size": 11365
}
|
[
"java.util.List",
"java.util.Set"
] |
import java.util.List; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,771,419
|
public final MapperService getMapperService() {
return mapperService;
}
|
final MapperService function() { return mapperService; }
|
/**
* Return the MapperService.
*/
|
Return the MapperService
|
getMapperService
|
{
"repo_name": "JervyShi/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/index/query/QueryRewriteContext.java",
"license": "apache-2.0",
"size": 5336
}
|
[
"org.elasticsearch.index.mapper.MapperService"
] |
import org.elasticsearch.index.mapper.MapperService;
|
import org.elasticsearch.index.mapper.*;
|
[
"org.elasticsearch.index"
] |
org.elasticsearch.index;
| 176,775
|
screenFrame = new Quad(name + "screenFrame", width + 60, width + 30);
screenFrame.setModelBound(new OrthogonalBoundingBox());
screenFrame.updateModelBound();
this.attachChild(screenFrame);
screenQuad.setLocalTranslation(0, -10, 0);
TextureState ts;
Texture texture;
ts = DisplaySystem.getDisplaySystem().getRenderer()
.createTextureState();
ts.setCorrectionType(TextureState.CorrectionType.Perspective);
texture = TextureManager.loadTexture(
ThreeDManipulation.class.getResource("touchpadbg.png"),
Texture.MinificationFilter.Trilinear,
Texture.MagnificationFilter.Bilinear);
texture.setWrap(WrapMode.Repeat);
texture.setApply(ApplyMode.Replace);
ts.setTexture(texture);
ts.apply();
screenFrame.setRenderState(ts);
screenFrame.updateRenderState();
BlendState alpha = DisplaySystem.getDisplaySystem().getRenderer()
.createBlendState();
alpha.setEnabled(true);
alpha.setBlendEnabled(true);
alpha.setSourceFunction(BlendState.SourceFunction.SourceAlpha);
alpha.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha);
alpha.setTestEnabled(true);
alpha.setTestFunction(BlendState.TestFunction.GreaterThan);
screenFrame.setRenderState(alpha);
screenFrame.updateRenderState();
ControlPanelMoveRotateScale monitorScreenMoveRotateScale = new ControlPanelMoveRotateScale(
screenFrame, this, null, telescopeManipulateOjbect, null);
monitorScreenMoveRotateScale.setPickMeOnly(true);
@SuppressWarnings("unused")
OrthoBringToTop bringToTop = new OrthoBringToTop(screenFrame, this);
}
|
screenFrame = new Quad(name + STR, width + 60, width + 30); screenFrame.setModelBound(new OrthogonalBoundingBox()); screenFrame.updateModelBound(); this.attachChild(screenFrame); screenQuad.setLocalTranslation(0, -10, 0); TextureState ts; Texture texture; ts = DisplaySystem.getDisplaySystem().getRenderer() .createTextureState(); ts.setCorrectionType(TextureState.CorrectionType.Perspective); texture = TextureManager.loadTexture( ThreeDManipulation.class.getResource(STR), Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear); texture.setWrap(WrapMode.Repeat); texture.setApply(ApplyMode.Replace); ts.setTexture(texture); ts.apply(); screenFrame.setRenderState(ts); screenFrame.updateRenderState(); BlendState alpha = DisplaySystem.getDisplaySystem().getRenderer() .createBlendState(); alpha.setEnabled(true); alpha.setBlendEnabled(true); alpha.setSourceFunction(BlendState.SourceFunction.SourceAlpha); alpha.setDestinationFunction(BlendState.DestinationFunction.OneMinusSourceAlpha); alpha.setTestEnabled(true); alpha.setTestFunction(BlendState.TestFunction.GreaterThan); screenFrame.setRenderState(alpha); screenFrame.updateRenderState(); ControlPanelMoveRotateScale monitorScreenMoveRotateScale = new ControlPanelMoveRotateScale( screenFrame, this, null, telescopeManipulateOjbect, null); monitorScreenMoveRotateScale.setPickMeOnly(true); @SuppressWarnings(STR) OrthoBringToTop bringToTop = new OrthoBringToTop(screenFrame, this); }
|
/**
* Builds the screen frame.
*/
|
Builds the screen frame
|
buildScreenFrame
|
{
"repo_name": "synergynet/synergynet2.5",
"path": "synergynet2.5/src/main/java/apps/threedmanipulationexperiment/tools/TouchPadScreen.java",
"license": "bsd-3-clause",
"size": 5983
}
|
[
"com.jme.bounding.OrthogonalBoundingBox",
"com.jme.image.Texture",
"com.jme.scene.shape.Quad",
"com.jme.scene.state.BlendState",
"com.jme.scene.state.TextureState",
"com.jme.system.DisplaySystem",
"com.jme.util.TextureManager"
] |
import com.jme.bounding.OrthogonalBoundingBox; import com.jme.image.Texture; import com.jme.scene.shape.Quad; import com.jme.scene.state.BlendState; import com.jme.scene.state.TextureState; import com.jme.system.DisplaySystem; import com.jme.util.TextureManager;
|
import com.jme.bounding.*; import com.jme.image.*; import com.jme.scene.shape.*; import com.jme.scene.state.*; import com.jme.system.*; import com.jme.util.*;
|
[
"com.jme.bounding",
"com.jme.image",
"com.jme.scene",
"com.jme.system",
"com.jme.util"
] |
com.jme.bounding; com.jme.image; com.jme.scene; com.jme.system; com.jme.util;
| 2,139,535
|
public static ITroveboxApi getApi() {
return getApi(TroveboxApplication.getContext());
}
|
static ITroveboxApi function() { return getApi(TroveboxApplication.getContext()); }
|
/**
* Get the ITroveboxApi implementation
* @return
*/
|
Get the ITroveboxApi implementation
|
getApi
|
{
"repo_name": "photo/mobile-android",
"path": "app/src/com/trovebox/android/app/Preferences.java",
"license": "apache-2.0",
"size": 17549
}
|
[
"com.trovebox.android.common.net.ITroveboxApi"
] |
import com.trovebox.android.common.net.ITroveboxApi;
|
import com.trovebox.android.common.net.*;
|
[
"com.trovebox.android"
] |
com.trovebox.android;
| 528,318
|
private void testConstraints(
int nameType,
String testName,
String[] testNameIsConstraint,
String[] testNameIsNotConstraint,
String[] testNames1,
String[] testNames2,
String[][] testUnion,
String[] testInterSection) throws Exception
{
for (int i = 0; i < testNameIsConstraint.length; i++)
{
PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.intersectPermittedSubtree(new GeneralSubtree(
new GeneralName(nameType, testNameIsConstraint[i])));
constraintValidator.checkPermitted(new GeneralName(nameType, testName));
}
for (int i = 0; i < testNameIsNotConstraint.length; i++)
{
PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.intersectPermittedSubtree(new GeneralSubtree(
new GeneralName(nameType, testNameIsNotConstraint[i])));
try
{
constraintValidator.checkPermitted(new GeneralName(nameType, testName));
fail("not permitted name allowed: " + nameType);
}
catch (PKIXNameConstraintValidatorException e)
{
// expected
}
}
for (int i = 0; i < testNameIsConstraint.length; i++)
{
PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName(
nameType, testNameIsConstraint[i])));
try
{
constraintValidator.checkExcluded(new GeneralName(nameType, testName));
fail("excluded name missed: " + nameType);
}
catch (PKIXNameConstraintValidatorException e)
{
// expected
}
}
for (int i = 0; i < testNameIsNotConstraint.length; i++)
{
PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName(
nameType, testNameIsNotConstraint[i])));
constraintValidator.checkExcluded(new GeneralName(nameType, testName));
}
for (int i = 0; i < testNames1.length; i++)
{
PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName(
nameType, testNames1[i])));
constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName(
nameType, testNames2[i])));
PKIXNameConstraintValidator constraints2 = new PKIXNameConstraintValidator();
for (int j = 0; j < testUnion[i].length; j++)
{
constraints2.addExcludedSubtree(new GeneralSubtree(
new GeneralName(nameType, testUnion[i][j])));
}
if (!constraints2.equals(constraintValidator))
{
fail("union wrong: " + nameType);
}
constraintValidator = new PKIXNameConstraintValidator();
constraintValidator.intersectPermittedSubtree(new GeneralSubtree(
new GeneralName(nameType, testNames1[i])));
constraintValidator.intersectPermittedSubtree(new GeneralSubtree(
new GeneralName(nameType, testNames2[i])));
constraints2 = new PKIXNameConstraintValidator();
if (testInterSection[i] != null)
{
constraints2.intersectPermittedSubtree(new GeneralSubtree(
new GeneralName(nameType, testInterSection[i])));
}
else
{
constraints2.intersectEmptyPermittedSubtree(nameType);
}
if (!constraints2.equals(constraintValidator))
{
fail("intersection wrong: " + nameType);
}
}
}
|
void function( int nameType, String testName, String[] testNameIsConstraint, String[] testNameIsNotConstraint, String[] testNames1, String[] testNames2, String[][] testUnion, String[] testInterSection) throws Exception { for (int i = 0; i < testNameIsConstraint.length; i++) { PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.intersectPermittedSubtree(new GeneralSubtree( new GeneralName(nameType, testNameIsConstraint[i]))); constraintValidator.checkPermitted(new GeneralName(nameType, testName)); } for (int i = 0; i < testNameIsNotConstraint.length; i++) { PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.intersectPermittedSubtree(new GeneralSubtree( new GeneralName(nameType, testNameIsNotConstraint[i]))); try { constraintValidator.checkPermitted(new GeneralName(nameType, testName)); fail(STR + nameType); } catch (PKIXNameConstraintValidatorException e) { } } for (int i = 0; i < testNameIsConstraint.length; i++) { PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName( nameType, testNameIsConstraint[i]))); try { constraintValidator.checkExcluded(new GeneralName(nameType, testName)); fail(STR + nameType); } catch (PKIXNameConstraintValidatorException e) { } } for (int i = 0; i < testNameIsNotConstraint.length; i++) { PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName( nameType, testNameIsNotConstraint[i]))); constraintValidator.checkExcluded(new GeneralName(nameType, testName)); } for (int i = 0; i < testNames1.length; i++) { PKIXNameConstraintValidator constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName( nameType, testNames1[i]))); constraintValidator.addExcludedSubtree(new GeneralSubtree(new GeneralName( nameType, testNames2[i]))); PKIXNameConstraintValidator constraints2 = new PKIXNameConstraintValidator(); for (int j = 0; j < testUnion[i].length; j++) { constraints2.addExcludedSubtree(new GeneralSubtree( new GeneralName(nameType, testUnion[i][j]))); } if (!constraints2.equals(constraintValidator)) { fail(STR + nameType); } constraintValidator = new PKIXNameConstraintValidator(); constraintValidator.intersectPermittedSubtree(new GeneralSubtree( new GeneralName(nameType, testNames1[i]))); constraintValidator.intersectPermittedSubtree(new GeneralSubtree( new GeneralName(nameType, testNames2[i]))); constraints2 = new PKIXNameConstraintValidator(); if (testInterSection[i] != null) { constraints2.intersectPermittedSubtree(new GeneralSubtree( new GeneralName(nameType, testInterSection[i]))); } else { constraints2.intersectEmptyPermittedSubtree(nameType); } if (!constraints2.equals(constraintValidator)) { fail(STR + nameType); } } }
|
/**
* Tests string based GeneralNames for inclusion or exclusion.
*
* @param nameType The {@link GeneralName} type to test.
* @param testName The name to test.
* @param testNameIsConstraint The names where <code>testName</code> must
* be included and excluded.
* @param testNameIsNotConstraint The names where <code>testName</code>
* must not be excluded and included.
* @param testNames1 Operand 1 of test names to use for union and
* intersection testing.
* @param testNames2 Operand 2 of test names to use for union and
* intersection testing.
* @param testUnion The union results.
* @param testInterSection The intersection results.
* @throws Exception If an unexpected exception occurs.
*/
|
Tests string based GeneralNames for inclusion or exclusion
|
testConstraints
|
{
"repo_name": "sake/bouncycastle-java",
"path": "test/src/org/bouncycastle/jce/provider/test/PKIXNameConstraintsTest.java",
"license": "mit",
"size": 18752
}
|
[
"org.bouncycastle.asn1.x509.GeneralName",
"org.bouncycastle.asn1.x509.GeneralSubtree",
"org.bouncycastle.jce.provider.PKIXNameConstraintValidator",
"org.bouncycastle.jce.provider.PKIXNameConstraintValidatorException"
] |
import org.bouncycastle.asn1.x509.GeneralName; import org.bouncycastle.asn1.x509.GeneralSubtree; import org.bouncycastle.jce.provider.PKIXNameConstraintValidator; import org.bouncycastle.jce.provider.PKIXNameConstraintValidatorException;
|
import org.bouncycastle.asn1.x509.*; import org.bouncycastle.jce.provider.*;
|
[
"org.bouncycastle.asn1",
"org.bouncycastle.jce"
] |
org.bouncycastle.asn1; org.bouncycastle.jce;
| 2,602,045
|
private String readRawTextFile(int resId) {
InputStream inputStream = resources.openRawResource(resId);
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
StringBuilder sb = new StringBuilder();
String line;
while ((line = reader.readLine()) != null) {
sb.append(line).append("\n");
}
reader.close();
return sb.toString();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
|
String function(int resId) { InputStream inputStream = resources.openRawResource(resId); try { BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream)); StringBuilder sb = new StringBuilder(); String line; while ((line = reader.readLine()) != null) { sb.append(line).append("\n"); } reader.close(); return sb.toString(); } catch (IOException e) { e.printStackTrace(); } return null; }
|
/**
* Converts a raw text file into a string.
*
* @param resId The resource ID of the raw text file about to be turned into a shader.
* @return The context of the text file, or null in case of error.
*/
|
Converts a raw text file into a string
|
readRawTextFile
|
{
"repo_name": "TheMBc/sampleVRapp",
"path": "app/src/main/java/be/thmbc/samplevrapp/util/ProgramHelper.java",
"license": "apache-2.0",
"size": 2365
}
|
[
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader"
] |
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 241,593
|
private RelNode projectJoinOutputWithNullability(
LogicalJoin join,
LogicalProject project,
int nullIndicatorPos) {
final RelDataTypeFactory typeFactory = join.getCluster().getTypeFactory();
final RelNode left = join.getLeft();
final JoinRelType joinType = join.getJoinType();
RexInputRef nullIndicator =
new RexInputRef(
nullIndicatorPos,
typeFactory.createTypeWithNullability(
join.getRowType().getFieldList().get(nullIndicatorPos)
.getType(),
true));
// now create the new project
List<Pair<RexNode, String>> newProjExprs = new ArrayList<>();
// project everything from the LHS and then those from the original
// projRel
List<RelDataTypeField> leftInputFields =
left.getRowType().getFieldList();
for (int i = 0; i < leftInputFields.size(); i++) {
newProjExprs.add(RexInputRef.of2(i, leftInputFields));
}
// Marked where the projected expr is coming from so that the types will
// become nullable for the original projections which are now coming out
// of the nullable side of the OJ.
boolean projectPulledAboveLeftCorrelator =
joinType.generatesNullsOnRight();
for (Pair<RexNode, String> pair : project.getNamedProjects()) {
RexNode newProjExpr =
removeCorrelationExpr(
pair.left,
projectPulledAboveLeftCorrelator,
nullIndicator);
newProjExprs.add(Pair.of(newProjExpr, pair.right));
}
return relBuilder.push(join)
.projectNamed(Pair.left(newProjExprs), Pair.right(newProjExprs), true)
.build();
}
|
RelNode function( LogicalJoin join, LogicalProject project, int nullIndicatorPos) { final RelDataTypeFactory typeFactory = join.getCluster().getTypeFactory(); final RelNode left = join.getLeft(); final JoinRelType joinType = join.getJoinType(); RexInputRef nullIndicator = new RexInputRef( nullIndicatorPos, typeFactory.createTypeWithNullability( join.getRowType().getFieldList().get(nullIndicatorPos) .getType(), true)); List<Pair<RexNode, String>> newProjExprs = new ArrayList<>(); List<RelDataTypeField> leftInputFields = left.getRowType().getFieldList(); for (int i = 0; i < leftInputFields.size(); i++) { newProjExprs.add(RexInputRef.of2(i, leftInputFields)); } boolean projectPulledAboveLeftCorrelator = joinType.generatesNullsOnRight(); for (Pair<RexNode, String> pair : project.getNamedProjects()) { RexNode newProjExpr = removeCorrelationExpr( pair.left, projectPulledAboveLeftCorrelator, nullIndicator); newProjExprs.add(Pair.of(newProjExpr, pair.right)); } return relBuilder.push(join) .projectNamed(Pair.left(newProjExprs), Pair.right(newProjExprs), true) .build(); }
|
/**
* Pulls project above the join from its RHS input. Enforces nullability
* for join output.
*
* @param join Join
* @param project Original project as the right-hand input of the join
* @param nullIndicatorPos Position of null indicator
* @return the subtree with the new Project at the root
*/
|
Pulls project above the join from its RHS input. Enforces nullability for join output
|
projectJoinOutputWithNullability
|
{
"repo_name": "dindin5258/calcite",
"path": "core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java",
"license": "apache-2.0",
"size": 99072
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.apache.calcite.rel.RelNode",
"org.apache.calcite.rel.core.JoinRelType",
"org.apache.calcite.rel.logical.LogicalJoin",
"org.apache.calcite.rel.logical.LogicalProject",
"org.apache.calcite.rel.type.RelDataTypeFactory",
"org.apache.calcite.rel.type.RelDataTypeField",
"org.apache.calcite.rex.RexInputRef",
"org.apache.calcite.rex.RexNode",
"org.apache.calcite.util.Pair"
] |
import java.util.ArrayList; import java.util.List; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.JoinRelType; import org.apache.calcite.rel.logical.LogicalJoin; import org.apache.calcite.rel.logical.LogicalProject; import org.apache.calcite.rel.type.RelDataTypeFactory; import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.rex.RexInputRef; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.Pair;
|
import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.rel.core.*; import org.apache.calcite.rel.logical.*; import org.apache.calcite.rel.type.*; import org.apache.calcite.rex.*; import org.apache.calcite.util.*;
|
[
"java.util",
"org.apache.calcite"
] |
java.util; org.apache.calcite;
| 1,051,529
|
@Override
protected String doExecute() {
String result;
result = null;
if (m_Headless) {
System.out.println("\n--> " + DateUtils.getTimestampFormatterMsecs().format(new Date()) + "\n");
System.out.println(m_InputToken.getPayload());
}
else {
result = super.doExecute();
}
return result;
}
|
String function() { String result; result = null; if (m_Headless) { System.out.println(STR + DateUtils.getTimestampFormatterMsecs().format(new Date()) + "\n"); System.out.println(m_InputToken.getPayload()); } else { result = super.doExecute(); } return result; }
|
/**
* Executes the flow item.
* <p/>
* Outputs the token on the command-line in headless mode.
*
* @return null if everything is fine, otherwise error message
*/
|
Executes the flow item. Outputs the token on the command-line in headless mode
|
doExecute
|
{
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/flow/sink/ContainerDisplay.java",
"license": "gpl-3.0",
"size": 9576
}
|
[
"java.util.Date"
] |
import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 673,088
|
@Test
public void whenSortNameLength() {
User user1 = new User("111", 50);
User user2 = new User("2", 20);
User user3 = new User("33", 30);
List<User> userList = new ArrayList<>();
userList.add(user1);
userList.add(user2);
userList.add(user3);
User[] expectedResult = new SortUser().sortNameLength(userList).toArray(new User[userList.size()]);
User[] trueResult = {user2, user3, user1};
assertThat(trueResult, is(expectedResult));
}
|
void function() { User user1 = new User("111", 50); User user2 = new User("2", 20); User user3 = new User("33", 30); List<User> userList = new ArrayList<>(); userList.add(user1); userList.add(user2); userList.add(user3); User[] expectedResult = new SortUser().sortNameLength(userList).toArray(new User[userList.size()]); User[] trueResult = {user2, user3, user1}; assertThat(trueResult, is(expectedResult)); }
|
/**
* check work sortNameLength.
*/
|
check work sortNameLength
|
whenSortNameLength
|
{
"repo_name": "wolfdog007/aruzhev",
"path": "chapter_003/src/test/java/ru/job4j/sorting/SortUserTest.java",
"license": "apache-2.0",
"size": 2077
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.hamcrest.core.Is",
"org.junit.Assert"
] |
import java.util.ArrayList; import java.util.List; import org.hamcrest.core.Is; import org.junit.Assert;
|
import java.util.*; import org.hamcrest.core.*; import org.junit.*;
|
[
"java.util",
"org.hamcrest.core",
"org.junit"
] |
java.util; org.hamcrest.core; org.junit;
| 189,091
|
public PathFragment getCppLinkExecutable() {
return getToolPathFragment(CppConfiguration.Tool.GCC);
}
|
PathFragment function() { return getToolPathFragment(CppConfiguration.Tool.GCC); }
|
/**
* Returns the path to the GNU binutils 'g++' binary that should be used
* by this build. This binary should support linking of both C (*.c)
* and C++ (*.cc) files. Relative paths are relative to the execution root.
*/
|
Returns the path to the GNU binutils 'g++' binary that should be used by this build. This binary should support linking of both C (*.c) and C++ (*.cc) files. Relative paths are relative to the execution root
|
getCppLinkExecutable
|
{
"repo_name": "mikelikespie/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CppConfiguration.java",
"license": "apache-2.0",
"size": 77508
}
|
[
"com.google.devtools.build.lib.vfs.PathFragment"
] |
import com.google.devtools.build.lib.vfs.PathFragment;
|
import com.google.devtools.build.lib.vfs.*;
|
[
"com.google.devtools"
] |
com.google.devtools;
| 498,615
|
public int read(char []cbuf, int off, int len)
throws IOException
{
int i = 0;
for (i = 0; i < len; i++) {
int ch1 = is.read();
int ch2 = is.read();
if (ch1 < 0)
return i == 0 ? -1 : i;
cbuf[off + i] = (char) ((ch2 << 8) + ch1);
}
return i;
}
|
int function(char []cbuf, int off, int len) throws IOException { int i = 0; for (i = 0; i < len; i++) { int ch1 = is.read(); int ch2 = is.read(); if (ch1 < 0) return i == 0 ? -1 : i; cbuf[off + i] = (char) ((ch2 << 8) + ch1); } return i; }
|
/**
* Reads into a character buffer using the correct encoding.
*/
|
Reads into a character buffer using the correct encoding
|
read
|
{
"repo_name": "dlitz/resin",
"path": "modules/kernel/src/com/caucho/vfs/Utf16RevReader.java",
"license": "gpl-2.0",
"size": 2022
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,693,744
|
public List<KeyedFilter> filters() {
return Collections.unmodifiableList(this.filters);
}
|
List<KeyedFilter> function() { return Collections.unmodifiableList(this.filters); }
|
/**
* Get the filters. This will be an unmodifiable list
*/
|
Get the filters. This will be an unmodifiable list
|
filters
|
{
"repo_name": "artnowo/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/search/aggregations/bucket/filters/FiltersAggregationBuilder.java",
"license": "apache-2.0",
"size": 12379
}
|
[
"java.util.Collections",
"java.util.List",
"org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator"
] |
import java.util.Collections; import java.util.List; import org.elasticsearch.search.aggregations.bucket.filters.FiltersAggregator;
|
import java.util.*; import org.elasticsearch.search.aggregations.bucket.filters.*;
|
[
"java.util",
"org.elasticsearch.search"
] |
java.util; org.elasticsearch.search;
| 106,846
|
@Test
public void testConstructorNull()
{
// Setup.
final ReversiActionGenerator actionGenerator = new ReversiActionGenerator();
final ReversiEnvironmentEvaluator environmentEvaluator = new ReversiEnvironmentEvaluator();
try
{
new AlphaBetaSearch(null, environmentEvaluator);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("actionGenerator is null"));
}
try
{
new AlphaBetaSearch(actionGenerator, null);
fail("Should have thrown an exception");
}
catch (final IllegalArgumentException e)
{
assertThat(e.getMessage(), is("environmentEvaluator is null"));
}
}
|
void function() { final ReversiActionGenerator actionGenerator = new ReversiActionGenerator(); final ReversiEnvironmentEvaluator environmentEvaluator = new ReversiEnvironmentEvaluator(); try { new AlphaBetaSearch(null, environmentEvaluator); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } try { new AlphaBetaSearch(actionGenerator, null); fail(STR); } catch (final IllegalArgumentException e) { assertThat(e.getMessage(), is(STR)); } }
|
/**
* Test the <code>AlphaBetaSearch()</code> method.
*/
|
Test the <code>AlphaBetaSearch()</code> method
|
testConstructorNull
|
{
"repo_name": "jmthompson2015/vizzini",
"path": "example/src/test/java/org/vizzini/example/boardgame/reversi/AlphaBetaSearchTest.java",
"license": "mit",
"size": 1825
}
|
[
"org.hamcrest.CoreMatchers",
"org.junit.Assert",
"org.vizzini.core.game.boardgame.AlphaBetaSearch"
] |
import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.vizzini.core.game.boardgame.AlphaBetaSearch;
|
import org.hamcrest.*; import org.junit.*; import org.vizzini.core.game.boardgame.*;
|
[
"org.hamcrest",
"org.junit",
"org.vizzini.core"
] |
org.hamcrest; org.junit; org.vizzini.core;
| 1,053,232
|
@Override
public StoragePolicyTransitionParamsDto initiateStoragePolicyTransition(StoragePolicySelection storagePolicySelection)
{
return initiateStoragePolicyTransitionImpl(storagePolicySelection);
}
|
StoragePolicyTransitionParamsDto function(StoragePolicySelection storagePolicySelection) { return initiateStoragePolicyTransitionImpl(storagePolicySelection); }
|
/**
* Overwrites the base class method to change transactional attributes.
*/
|
Overwrites the base class method to change transactional attributes
|
initiateStoragePolicyTransition
|
{
"repo_name": "seoj/herd",
"path": "herd-code/herd-service/src/test/java/org/finra/herd/service/impl/TestStoragePolicyProcessorHelperServiceImpl.java",
"license": "apache-2.0",
"size": 2596
}
|
[
"org.finra.herd.model.dto.StoragePolicySelection",
"org.finra.herd.model.dto.StoragePolicyTransitionParamsDto"
] |
import org.finra.herd.model.dto.StoragePolicySelection; import org.finra.herd.model.dto.StoragePolicyTransitionParamsDto;
|
import org.finra.herd.model.dto.*;
|
[
"org.finra.herd"
] |
org.finra.herd;
| 1,711,816
|
@Test public void testOleDbExamples() throws Throwable {
// test the parser with examples from OLE DB documentation
Quad[] quads = {
// {reason for test, key, val, string to parse},
new Quad(
"printable chars",
"Jet OLE DB:System Database", "c:\\system.mda",
"Jet OLE DB:System Database=c:\\system.mda"),
new Quad(
"key embedded semi",
"Authentication;Info", "Column 5",
"Authentication;Info=Column 5"),
new Quad(
"key embedded equal",
"Verification=Security", "True",
"Verification==Security=True"),
new Quad(
"key many equals",
"Many==One", "Valid",
"Many====One=Valid"),
new Quad(
"key too many equal",
"TooMany=", "False",
"TooMany===False"),
new Quad(
"value embedded quote and semi",
"ExtProps", "Data Source='localhost';Key Two='value 2'",
"ExtProps=\"Data Source='localhost';Key Two='value 2'\""),
new Quad(
"value embedded double quote and semi",
"ExtProps", "Integrated Security=\"SSPI\";Key Two=\"value 2\"",
"ExtProps='Integrated Security=\"SSPI\";Key Two=\"value 2\"'"),
new Quad(
"value double quoted",
"DataSchema", "\"MyCustTable\"",
"DataSchema='\"MyCustTable\"'"),
new Quad(
"value single quoted",
"DataSchema", "'MyCustTable'",
"DataSchema=\"'MyCustTable'\""),
new Quad(
"value double quoted double trouble",
"Caption", "\"Company's \"new\" customer\"",
"Caption=\"\"\"Company's \"\"new\"\" customer\"\"\""),
new Quad(
"value single quoted double trouble",
"Caption", "\"Company's \"new\" customer\"",
"Caption='\"Company''s \"new\" customer\"'"),
new Quad(
"embedded blanks and trim",
"My Keyword", "My Value",
" My Keyword = My Value ;MyNextValue=Value"),
new Quad(
"value single quotes preserve blanks",
"My Keyword", " My Value ",
" My Keyword =' My Value ';MyNextValue=Value"),
new Quad(
"value double quotes preserve blanks",
"My Keyword", " My Value ",
" My Keyword =\" My Value \";MyNextValue=Value"),
new Quad(
"last redundant key wins",
"SomeKey", "NextValue",
"SomeKey=FirstValue;SomeKey=NextValue"),
};
for (Quad quad : quads) {
Properties props = ConnectStringParser.parse(quad.str);
assertEquals(quad.why, quad.val, props.get(quad.key));
String synth = ConnectStringParser.getParamString(props);
try {
assertEquals("reversible " + quad.why, quad.str, synth);
} catch (Throwable e) {
// it's OK that the strings don't match as long as the
// two strings parse out the same way and are thus
// "semantically reversible"
Properties synthProps = ConnectStringParser.parse(synth);
assertEquals("equivalent " + quad.why, props, synthProps);
}
}
}
|
@Test void function() throws Throwable { Quad[] quads = { new Quad( STR, STR, STR, STR), new Quad( STR, STR, STR, STR), new Quad( STR, STR, "True", STR), new Quad( STR, STR, "Valid", STR), new Quad( STR, STR, "False", STR), new Quad( STR, STR, STR, STRData Source='localhost';Key Two='value 2'\STRvalue embedded double quote and semi", STR, "Integrated Security=\"SSPI\";Key Two=\STRSTRExtProps='Integrated Security=\"SSPI\";Key Two=\STR'STRvalue double quotedSTRDataSchemaSTR\STRSTRDataSchema='\STR'STRvalue single quotedSTRDataSchemaSTR'MyCustTable'STRDataSchema=\"'MyCustTable'\STRvalue double quoted double troubleSTRCaptionSTR\STRnew\STRSTRCaption=\"\"\STR\"new\"\STR\"\STRvalue single quoted double troubleSTRCaptionSTR\STRnew\STRSTRCaption='\STRnew\STR'STRembedded blanks and trimSTRMy KeywordSTRMy ValueSTR My Keyword = My Value ;MyNextValue=ValueSTRvalue single quotes preserve blanksSTRMy KeywordSTR My Value STR My Keyword =' My Value ';MyNextValue=ValueSTRvalue double quotes preserve blanksSTRMy KeywordSTR My Value STR My Keyword =\STR;MyNextValue=ValueSTRlast redundant key winsSTRSomeKeySTRNextValueSTRSomeKey=FirstValue;SomeKey=NextValueSTRreversible STRequivalent " + quad.why, props, synthProps); } } }
|
/**
* Tests most of the examples from the <a
* href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/oledb/htm/oledbconnectionstringsyntax.asp">
* OLE DB spec</a>. Omitted are cases for Window handles, returning multiple
* values, and special handling of "Provider" keyword.
*/
|
Tests most of the examples from the OLE DB spec. Omitted are cases for Window handles, returning multiple values, and special handling of "Provider" keyword
|
testOleDbExamples
|
{
"repo_name": "joshelser/calcite-avatica",
"path": "core/src/test/java/org/apache/calcite/avatica/test/ConnectStringParserTest.java",
"license": "apache-2.0",
"size": 8994
}
|
[
"org.junit.Test"
] |
import org.junit.Test;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 1,870,859
|
@CalledByNative
public static void notifyDownloadProgress(
String guid, String url, long startTime, long bytesReceived, String displayName) {
DownloadNotifier notifier = getDownloadNotifier();
if (notifier == null) return;
DownloadInfo downloadInfo = new DownloadInfo.Builder()
.setIsOfflinePage(true)
.setDownloadGuid(guid)
.setFileName(displayName)
.setFilePath(url)
.setBytesReceived(bytesReceived)
.setOTRProfileId(null)
.setIsResumable(true)
.setTimeRemainingInMillis(0)
.build();
notifier.notifyDownloadProgress(downloadInfo, startTime, false);
}
|
static void function( String guid, String url, long startTime, long bytesReceived, String displayName) { DownloadNotifier notifier = getDownloadNotifier(); if (notifier == null) return; DownloadInfo downloadInfo = new DownloadInfo.Builder() .setIsOfflinePage(true) .setDownloadGuid(guid) .setFileName(displayName) .setFilePath(url) .setBytesReceived(bytesReceived) .setOTRProfileId(null) .setIsResumable(true) .setTimeRemainingInMillis(0) .build(); notifier.notifyDownloadProgress(downloadInfo, startTime, false); }
|
/**
* Called by offline page backend to notify the user of download progress.
*
* @param guid GUID of a request to download a page related to the notification.
* @param url URL of the page to download.
* @param startTime Time of the request.
* @param displayName Name to be displayed on notification.
*/
|
Called by offline page backend to notify the user of download progress
|
notifyDownloadProgress
|
{
"repo_name": "chromium/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/offlinepages/downloads/OfflinePageNotificationBridge.java",
"license": "bsd-3-clause",
"size": 7375
}
|
[
"org.chromium.chrome.browser.download.DownloadInfo",
"org.chromium.chrome.browser.download.DownloadNotifier"
] |
import org.chromium.chrome.browser.download.DownloadInfo; import org.chromium.chrome.browser.download.DownloadNotifier;
|
import org.chromium.chrome.browser.download.*;
|
[
"org.chromium.chrome"
] |
org.chromium.chrome;
| 191,822
|
public static List<Object> filterMapToList(final Map<String, ?> map, final String[] nameMapping) {
if( map == null ) {
throw new NullPointerException("map should not be null");
} else if( nameMapping == null ) {
throw new NullPointerException("nameMapping should not be null");
}
final List<Object> result = new ArrayList<Object>(nameMapping.length);
for( final String key : nameMapping ) {
result.add(map.get(key));
}
return result;
}
|
static List<Object> function(final Map<String, ?> map, final String[] nameMapping) { if( map == null ) { throw new NullPointerException(STR); } else if( nameMapping == null ) { throw new NullPointerException(STR); } final List<Object> result = new ArrayList<Object>(nameMapping.length); for( final String key : nameMapping ) { result.add(map.get(key)); } return result; }
|
/**
* Returns a List of all of the values in the Map whose key matches an entry in the nameMapping array.
*
* @param map
* the map
* @param nameMapping
* the keys of the Map values to add to the List
* @return a List of all of the values in the Map whose key matches an entry in the nameMapping array
* @throws NullPointerException
* if map or nameMapping is null
*/
|
Returns a List of all of the values in the Map whose key matches an entry in the nameMapping array
|
filterMapToList
|
{
"repo_name": "ZioberMichal/super-csv",
"path": "super-csv/src/main/java/org/supercsv/util/Util.java",
"license": "apache-2.0",
"size": 8886
}
|
[
"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;
| 2,539,928
|
public static void updateDirectories() {
templateDirectory = new File(baseDirectory, DEFAULT_TEMPLATE_DIRECTORY_NAME);
staticContentDirectory = new File(baseDirectory, DEFAULT_STATIC_CONTENT_DIRECTORY_NAME);
changelogMappingDirectory = new File(baseDirectory, DEFAULT_MAPPING_DIRECTORY_NAME);
outputDirectory = new File(baseDirectory, DEFAULT_OUTPUT_DIRECTORY_NAME);
}
|
static void function() { templateDirectory = new File(baseDirectory, DEFAULT_TEMPLATE_DIRECTORY_NAME); staticContentDirectory = new File(baseDirectory, DEFAULT_STATIC_CONTENT_DIRECTORY_NAME); changelogMappingDirectory = new File(baseDirectory, DEFAULT_MAPPING_DIRECTORY_NAME); outputDirectory = new File(baseDirectory, DEFAULT_OUTPUT_DIRECTORY_NAME); }
|
/**
* Sets the other directories (templates, static..) relative to the base directory
*/
|
Sets the other directories (templates, static..) relative to the base directory
|
updateDirectories
|
{
"repo_name": "gentics/maven-changelog-plugin",
"path": "src/main/java/com/gentics/changelogmanager/ChangelogConfiguration.java",
"license": "apache-2.0",
"size": 9224
}
|
[
"java.io.File"
] |
import java.io.File;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,755,322
|
public VirtualMachineScaleSetVMInstanceViewInner withBootDiagnostics(BootDiagnosticsInstanceView bootDiagnostics) {
this.bootDiagnostics = bootDiagnostics;
return this;
}
|
VirtualMachineScaleSetVMInstanceViewInner function(BootDiagnosticsInstanceView bootDiagnostics) { this.bootDiagnostics = bootDiagnostics; return this; }
|
/**
* Set the bootDiagnostics value.
*
* @param bootDiagnostics the bootDiagnostics value to set
* @return the VirtualMachineScaleSetVMInstanceViewInner object itself.
*/
|
Set the bootDiagnostics value
|
withBootDiagnostics
|
{
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-compute/src/main/java/com/microsoft/azure/management/compute/implementation/VirtualMachineScaleSetVMInstanceViewInner.java",
"license": "mit",
"size": 7265
}
|
[
"com.microsoft.azure.management.compute.BootDiagnosticsInstanceView"
] |
import com.microsoft.azure.management.compute.BootDiagnosticsInstanceView;
|
import com.microsoft.azure.management.compute.*;
|
[
"com.microsoft.azure"
] |
com.microsoft.azure;
| 677,016
|
public static void copy(final InputStream input, final OutputStream output) throws IOException
{
final byte[] buffer = new byte[8192];
int read;
while ((read = input.read(buffer)) > 0)
{
output.write(buffer, 0, read);
}
}
|
static void function(final InputStream input, final OutputStream output) throws IOException { final byte[] buffer = new byte[8192]; int read; while ((read = input.read(buffer)) > 0) { output.write(buffer, 0, read); } }
|
/**
* Copies data from the input stream to the output stream.
*
* @param input
* The input stream.
* @param output
* The output stream
* @throws IOException
* When copying failed.
*/
|
Copies data from the input stream to the output stream
|
copy
|
{
"repo_name": "microblinks/ltray",
"path": "src/main/java/de/ailis/microblinks/l/ltray/utils/StreamUtils.java",
"license": "gpl-3.0",
"size": 2375
}
|
[
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
] |
import java.io.IOException; import java.io.InputStream; import java.io.OutputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 518,339
|
Typeface tf = fontCache.get(name);
if (tf == null) {
try {
tf = Typeface.createFromAsset(context.getAssets(), name);
} catch (Exception e) {
return null;
}
fontCache.put(name, tf);
}
return tf;
}
|
Typeface tf = fontCache.get(name); if (tf == null) { try { tf = Typeface.createFromAsset(context.getAssets(), name); } catch (Exception e) { return null; } fontCache.put(name, tf); } return tf; }
|
/**
* Gets the typeface from Asset folder
* @param name path to the font within asset folder
* @param context context of the view
* @return
*/
|
Gets the typeface from Asset folder
|
get
|
{
"repo_name": "jimitpatel/MVP_List",
"path": "app/src/main/java/com/wellthy/www/custom_views/font/FontCache.java",
"license": "gpl-3.0",
"size": 841
}
|
[
"android.graphics.Typeface"
] |
import android.graphics.Typeface;
|
import android.graphics.*;
|
[
"android.graphics"
] |
android.graphics;
| 99,151
|
public void draw(Graphics2D g) {
draw(g, 0f, 0f);
}
|
void function(Graphics2D g) { draw(g, 0f, 0f); }
|
/**
* A convenience method that renders the label at 0, 0.
*/
|
A convenience method that renders the label at 0, 0
|
draw
|
{
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/sun/font/TextLabel.java",
"license": "gpl-2.0",
"size": 4010
}
|
[
"java.awt.Graphics2D"
] |
import java.awt.Graphics2D;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 2,661,854
|
public HasClickHandlers getSubmit();
|
HasClickHandlers function();
|
/**
* Gets the submit.
*
* @return the submit
*/
|
Gets the submit
|
getSubmit
|
{
"repo_name": "JaLandry/MeasureAuthoringTool_LatestSprint",
"path": "mat/src/mat/client/myAccount/ChangePasswordPresenter.java",
"license": "apache-2.0",
"size": 10343
}
|
[
"com.google.gwt.event.dom.client.HasClickHandlers"
] |
import com.google.gwt.event.dom.client.HasClickHandlers;
|
import com.google.gwt.event.dom.client.*;
|
[
"com.google.gwt"
] |
com.google.gwt;
| 1,148,698
|
protected final CacheObject saveValueForIndexUnlocked() throws IgniteCheckedException {
return saveOldValueUnlocked(true);
}
|
final CacheObject function() throws IgniteCheckedException { return saveOldValueUnlocked(true); }
|
/**
* This method will return current value only if clearIndex(V) will require previous value.
* If previous value is not required, this method will return {@code null}.
*
* @return Previous value or {@code null}.
* @throws IgniteCheckedException If failed to retrieve previous value.
*/
|
This method will return current value only if clearIndex(V) will require previous value. If previous value is not required, this method will return null
|
saveValueForIndexUnlocked
|
{
"repo_name": "afinka77/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java",
"license": "apache-2.0",
"size": 164065
}
|
[
"org.apache.ignite.IgniteCheckedException"
] |
import org.apache.ignite.IgniteCheckedException;
|
import org.apache.ignite.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 389,041
|
System.out.println("=================================================================");
System.out.printf("Listing all ad units for ad client %s\n", adClientId);
System.out.println("=================================================================");
// Retrieve ad unit list in pages and display data as we receive it.
String pageToken = null;
AdUnits adUnits = null;
do {
adUnits = adsense.adunits().list(adClientId)
.setMaxResults(maxPageSize)
.setPageToken(pageToken)
.execute();
if (adUnits.getItems() != null && !adUnits.getItems().isEmpty()) {
for (AdUnit unit : adUnits.getItems()) {
System.out.printf("Ad unit with code \"%s\", name \"%s\" and status \"%s\" was found.\n",
unit.getCode(), unit.getName(), unit.getStatus());
}
} else {
System.out.println("No ad units found.");
}
pageToken = adUnits.getNextPageToken();
} while (pageToken != null);
System.out.println();
// Return the last page of ad units, so that the main sample has something to run.
return adUnits;
}
|
System.out.println(STR); System.out.printf(STR, adClientId); System.out.println(STR); String pageToken = null; AdUnits adUnits = null; do { adUnits = adsense.adunits().list(adClientId) .setMaxResults(maxPageSize) .setPageToken(pageToken) .execute(); if (adUnits.getItems() != null && !adUnits.getItems().isEmpty()) { for (AdUnit unit : adUnits.getItems()) { System.out.printf(STR%s\STR%s\STR%s\STR, unit.getCode(), unit.getName(), unit.getStatus()); } } else { System.out.println(STR); } pageToken = adUnits.getNextPageToken(); } while (pageToken != null); System.out.println(); return adUnits; }
|
/**
* Runs this sample.
*
* @param adsense AdSense service object on which to run the requests.
* @param adClientId the ID for the ad client to be used.
* @param maxPageSize the maximum page size to retrieve.
* @return the last page of ad units.
* @throws Exception
*/
|
Runs this sample
|
run
|
{
"repo_name": "madhur/DashAnalytics",
"path": "src/in/co/madhur/dashclock/dashadsense/google/GetAllAdUnits.java",
"license": "apache-2.0",
"size": 1810
}
|
[
"com.google.api.services.adsense.model.AdUnit",
"com.google.api.services.adsense.model.AdUnits"
] |
import com.google.api.services.adsense.model.AdUnit; import com.google.api.services.adsense.model.AdUnits;
|
import com.google.api.services.adsense.model.*;
|
[
"com.google.api"
] |
com.google.api;
| 2,566,823
|
private void sortFolder(final DBFolder folder) throws Exception {
DBEntryComparator comparator = null;
try {
comparator = new DBEntryComparator(conn, folder.getName());
Collections.sort(folder.getChildren(), comparator);
for (final DBEntry entry : folder.getChildren()) {
if (entry instanceof DBFolder) {
sortFolder((DBFolder)entry);
}
}
} finally {
if (comparator != null) {
comparator.cleanup();
}
}
}
|
void function(final DBFolder folder) throws Exception { DBEntryComparator comparator = null; try { comparator = new DBEntryComparator(conn, folder.getName()); Collections.sort(folder.getChildren(), comparator); for (final DBEntry entry : folder.getChildren()) { if (entry instanceof DBFolder) { sortFolder((DBFolder)entry); } } } finally { if (comparator != null) { comparator.cleanup(); } } }
|
/**
* DOCUMENT ME!
*
* @param folder DOCUMENT ME!
*
* @throws Exception DOCUMENT ME!
*/
|
DOCUMENT ME
|
sortFolder
|
{
"repo_name": "cismet/cismap-commons",
"path": "src/main/java/de/cismet/cismap/commons/internaldb/InternalDbTree.java",
"license": "lgpl-3.0",
"size": 73686
}
|
[
"java.util.Collections"
] |
import java.util.Collections;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,013,900
|
public LegalHoldInner setLegalHold(String resourceGroupName, String accountName, String containerName, List<String> tags) {
return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body();
}
|
LegalHoldInner function(String resourceGroupName, String accountName, String containerName, List<String> tags) { return setLegalHoldWithServiceResponseAsync(resourceGroupName, accountName, containerName, tags).toBlocking().single().body(); }
|
/**
* Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number.
* @param tags Each tag should be 3 to 23 alphanumeric characters and is normalized to lower case at SRP.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws CloudException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the LegalHoldInner object if successful.
*/
|
Sets legal hold tags. Setting the same tag results in an idempotent operation. SetLegalHold follows an append pattern and does not clear out the existing tags that are not specified in the request
|
setLegalHold
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/storage/v2018_07_01/implementation/BlobContainersInner.java",
"license": "mit",
"size": 147639
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 873,171
|
public void setBusListAdapter(BusListAdapter busListAdapter)
{
// If there are favorite busses
if(busListAdapter != null && busListAdapter.getCount() > 0)
{
if(BuildConfig.DEBUG) Log.d(LOG_TAG, "Setting favorite bus list adapter...");
this.busListAdapter = busListAdapter;
listView.setAdapter(busListAdapter);
// Hide info text
info.setVisibility(View.GONE);
listView.setVisibility(View.VISIBLE);
}
else
{
this.busListAdapter = null;
listView.setAdapter(null);
// Show info text
info.setVisibility(View.VISIBLE);
listView.setVisibility(View.GONE);
}
}
|
void function(BusListAdapter busListAdapter) { if(busListAdapter != null && busListAdapter.getCount() > 0) { if(BuildConfig.DEBUG) Log.d(LOG_TAG, STR); this.busListAdapter = busListAdapter; listView.setAdapter(busListAdapter); info.setVisibility(View.GONE); listView.setVisibility(View.VISIBLE); } else { this.busListAdapter = null; listView.setAdapter(null); info.setVisibility(View.VISIBLE); listView.setVisibility(View.GONE); } }
|
/** Sets the adapter of this fragment
*
* @param busListAdapter New adapter */
|
Sets the adapter of this fragment
|
setBusListAdapter
|
{
"repo_name": "mehmetakiftutuncu/eshotroid-legacy",
"path": "Eshotroid/src/com/mehmetakiftutuncu/eshotroid/fragment/FavoriteBussesFragment.java",
"license": "gpl-3.0",
"size": 3751
}
|
[
"android.util.Log",
"android.view.View",
"com.mehmetakiftutuncu.eshotroid.BuildConfig",
"com.mehmetakiftutuncu.eshotroid.adapter.BusListAdapter"
] |
import android.util.Log; import android.view.View; import com.mehmetakiftutuncu.eshotroid.BuildConfig; import com.mehmetakiftutuncu.eshotroid.adapter.BusListAdapter;
|
import android.util.*; import android.view.*; import com.mehmetakiftutuncu.eshotroid.*; import com.mehmetakiftutuncu.eshotroid.adapter.*;
|
[
"android.util",
"android.view",
"com.mehmetakiftutuncu.eshotroid"
] |
android.util; android.view; com.mehmetakiftutuncu.eshotroid;
| 1,862,270
|
protected DocumentAttributeInteger buildSearchableFixnumAttribute(String attributeKey, Object value) {
BigInteger integerValue = null;
if (value instanceof BigInteger) {
integerValue = (BigInteger)value;
} else {
integerValue = BigInteger.valueOf(((Number)value).longValue());
}
return DocumentAttributeFactory.createIntegerAttribute(attributeKey, integerValue);
}
|
DocumentAttributeInteger function(String attributeKey, Object value) { BigInteger integerValue = null; if (value instanceof BigInteger) { integerValue = (BigInteger)value; } else { integerValue = BigInteger.valueOf(((Number)value).longValue()); } return DocumentAttributeFactory.createIntegerAttribute(attributeKey, integerValue); }
|
/**
* Builds a "integer" SearchableAttributeValue for the given key and value
* @param attributeKey the key for the searchable attribute
* @param value the value that will be coerced to "integer" type data
* @return the generated SearchableAttributeLongValue
*/
|
Builds a "integer" SearchableAttributeValue for the given key and value
|
buildSearchableFixnumAttribute
|
{
"repo_name": "geothomasp/kualico-rice-kc",
"path": "rice-middleware/impl/src/main/java/org/kuali/rice/kns/workflow/service/impl/WorkflowAttributePropertyResolutionServiceImpl.java",
"license": "apache-2.0",
"size": 26507
}
|
[
"java.math.BigInteger",
"org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory",
"org.kuali.rice.kew.api.document.attribute.DocumentAttributeInteger"
] |
import java.math.BigInteger; import org.kuali.rice.kew.api.document.attribute.DocumentAttributeFactory; import org.kuali.rice.kew.api.document.attribute.DocumentAttributeInteger;
|
import java.math.*; import org.kuali.rice.kew.api.document.attribute.*;
|
[
"java.math",
"org.kuali.rice"
] |
java.math; org.kuali.rice;
| 2,645,111
|
public TradeConfig.ModeType getMode() {
return TradeConfig.ModeType.JPA_AM;
}
|
TradeConfig.ModeType function() { return TradeConfig.ModeType.JPA_AM; }
|
/**
* Get mode - returns the persistence mode (TradeConfig.JPA)
*
* @return TradeConfig.ModeType
*/
|
Get mode - returns the persistence mode (TradeConfig.JPA)
|
getMode
|
{
"repo_name": "WouterBanckenACA/aries",
"path": "samples/ariestrader/modules/ariestrader-persist-jpa-am/src/main/java/org/apache/aries/samples/ariestrader/persist/jpa/am/TradeJpaAm.java",
"license": "apache-2.0",
"size": 37615
}
|
[
"org.apache.aries.samples.ariestrader.util.TradeConfig"
] |
import org.apache.aries.samples.ariestrader.util.TradeConfig;
|
import org.apache.aries.samples.ariestrader.util.*;
|
[
"org.apache.aries"
] |
org.apache.aries;
| 2,399,371
|
@Override
public I_CmsReportThread initializeThread() {
List resources = new ArrayList();
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamResources())) {
resources = CmsStringUtil.splitAsList(getParamResources(), ",");
}
resources = CmsFileUtil.removeRedundancies(resources);
CmsRemovePubLocksThread thread = new CmsRemovePubLocksThread(getCms(), resources);
return thread;
}
|
I_CmsReportThread function() { List resources = new ArrayList(); if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamResources())) { resources = CmsStringUtil.splitAsList(getParamResources(), ","); } resources = CmsFileUtil.removeRedundancies(resources); CmsRemovePubLocksThread thread = new CmsRemovePubLocksThread(getCms(), resources); return thread; }
|
/**
* Returns the <b>unstarted</b> <code>Thread</code> that will do the work.<p>
*
* @return the <b>unstarted</b> <code>Thread</code> that will do the work
*
* @see org.opencms.workplace.list.A_CmsListReport#initializeThread()
*/
|
Returns the unstarted <code>Thread</code> that will do the work
|
initializeThread
|
{
"repo_name": "mediaworx/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/database/CmsRemovePubLocksReport.java",
"license": "lgpl-2.1",
"size": 3711
}
|
[
"java.util.ArrayList",
"java.util.List",
"org.opencms.util.CmsFileUtil",
"org.opencms.util.CmsStringUtil"
] |
import java.util.ArrayList; import java.util.List; import org.opencms.util.CmsFileUtil; import org.opencms.util.CmsStringUtil;
|
import java.util.*; import org.opencms.util.*;
|
[
"java.util",
"org.opencms.util"
] |
java.util; org.opencms.util;
| 1,270,552
|
@Override
protected boolean onAccessDenied(ServletRequest request, ServletResponse response) throws Exception {
log.debug("Entering onAccessDenied...");
boolean isPassed = false;
log.debug("Leaving onAccessDenied...");
return isPassed;
}
|
boolean function(ServletRequest request, ServletResponse response) throws Exception { log.debug(STR); boolean isPassed = false; log.debug(STR); return isPassed; }
|
/**
* The super.onAccessDenied(ServletRequest, ServletResponse) would redirect to loginUrl
* if isAccessAllowed returns false
*/
|
The super.onAccessDenied(ServletRequest, ServletResponse) would redirect to loginUrl if isAccessAllowed returns false
|
onAccessDenied
|
{
"repo_name": "alphatan/workspace_java",
"path": "spring-boot-web-shiro-jwt-demo/src/main/java/com/at/springboot/shiro/shiro/filter/JwtFilter.java",
"license": "apache-2.0",
"size": 6898
}
|
[
"javax.servlet.ServletRequest",
"javax.servlet.ServletResponse"
] |
import javax.servlet.ServletRequest; import javax.servlet.ServletResponse;
|
import javax.servlet.*;
|
[
"javax.servlet"
] |
javax.servlet;
| 2,539,227
|
public Rectangle ObjectPlanRectangle()
{
if(XYZbox == null)
Debug.e("AllSTLsToBuild.ObjectPlanRectangle(): null XYZbox!");
return XYZbox.XYbox;
}
|
Rectangle function() { if(XYZbox == null) Debug.e(STR); return XYZbox.XYbox; }
|
/**
* Return the XY box round everything
* @return
*/
|
Return the XY box round everything
|
ObjectPlanRectangle
|
{
"repo_name": "reprappro/host",
"path": "src/org/reprap/geometry/polyhedra/AllSTLsToBuild.java",
"license": "lgpl-2.1",
"size": 44341
}
|
[
"org.reprap.geometry.polygons.Rectangle",
"org.reprap.utilities.Debug"
] |
import org.reprap.geometry.polygons.Rectangle; import org.reprap.utilities.Debug;
|
import org.reprap.geometry.polygons.*; import org.reprap.utilities.*;
|
[
"org.reprap.geometry",
"org.reprap.utilities"
] |
org.reprap.geometry; org.reprap.utilities;
| 252,787
|
public static MatrixBlock randOperations(RandomMatrixGenerator rgen, long seed)
throws DMLRuntimeException
{
return randOperations(rgen, seed, 1);
}
|
static MatrixBlock function(RandomMatrixGenerator rgen, long seed) throws DMLRuntimeException { return randOperations(rgen, seed, 1); }
|
/**
* Function to generate the random matrix with specified dimensions and block dimensions.
* @param rgen
* @param seed
* @return
* @throws DMLRuntimeException
*/
|
Function to generate the random matrix with specified dimensions and block dimensions
|
randOperations
|
{
"repo_name": "aloknsingh/systemml",
"path": "system-ml/src/main/java/com/ibm/bi/dml/runtime/matrix/data/MatrixBlock.java",
"license": "apache-2.0",
"size": 173645
}
|
[
"com.ibm.bi.dml.runtime.DMLRuntimeException"
] |
import com.ibm.bi.dml.runtime.DMLRuntimeException;
|
import com.ibm.bi.dml.runtime.*;
|
[
"com.ibm.bi"
] |
com.ibm.bi;
| 1,532,178
|
Friend findOne(Long id);
|
Friend findOne(Long id);
|
/**
* Get the "id" friend.
*
* @param id the id of the entity
* @return the entity
*/
|
Get the "id" friend
|
findOne
|
{
"repo_name": "gcorreageek/dhl",
"path": "backend/ProyService1/src/main/java/com/dhl/serv/service/FriendService.java",
"license": "apache-2.0",
"size": 719
}
|
[
"com.dhl.serv.domain.Friend"
] |
import com.dhl.serv.domain.Friend;
|
import com.dhl.serv.domain.*;
|
[
"com.dhl.serv"
] |
com.dhl.serv;
| 2,332,225
|
public void colorsInitialized(float f) throws DOMException {
switch (getPaintType()) {
case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR:
StringBuffer sb =
new StringBuffer(getValue().item(0).getCssText());
sb.append(" icc-color(");
ICCColor iccc = (ICCColor)getValue().item(1);
sb.append(iccc.getColorProfile());
sb.append( ',' );
sb.append(f);
sb.append( ')' );
textChanged(sb.toString());
break;
case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR:
sb = new StringBuffer(getValue().item(0).getCssText());
sb.append( ' ' );
sb.append(getValue().item(1).getCssText());
sb.append(" icc-color(");
iccc = (ICCColor)getValue().item(1);
sb.append(iccc.getColorProfile());
sb.append( ',' );
sb.append(f);
sb.append( ')' );
textChanged(sb.toString());
break;
default:
throw new DOMException
(DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
}
}
|
void function(float f) throws DOMException { switch (getPaintType()) { case SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR: StringBuffer sb = new StringBuffer(getValue().item(0).getCssText()); sb.append(STR); ICCColor iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; case SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR: sb = new StringBuffer(getValue().item(0).getCssText()); sb.append( ' ' ); sb.append(getValue().item(1).getCssText()); sb.append(STR); iccc = (ICCColor)getValue().item(1); sb.append(iccc.getColorProfile()); sb.append( ',' ); sb.append(f); sb.append( ')' ); textChanged(sb.toString()); break; default: throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } }
|
/**
* Called when the ICC colors has been initialized.
*/
|
Called when the ICC colors has been initialized
|
colorsInitialized
|
{
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/css/dom/CSSOMSVGPaint.java",
"license": "apache-2.0",
"size": 32481
}
|
[
"org.apache.batik.css.engine.value.svg.ICCColor",
"org.w3c.dom.DOMException"
] |
import org.apache.batik.css.engine.value.svg.ICCColor; import org.w3c.dom.DOMException;
|
import org.apache.batik.css.engine.value.svg.*; import org.w3c.dom.*;
|
[
"org.apache.batik",
"org.w3c.dom"
] |
org.apache.batik; org.w3c.dom;
| 183,012
|
public Package get(int p_package_no)
{
Package result = package_arr.elementAt(p_package_no - 1);
if (result != null && result.no != p_package_no)
{
FRLogger.warn("Padstacks.get: inconsistent padstack number");
}
return result;
}
|
Package function(int p_package_no) { Package result = package_arr.elementAt(p_package_no - 1); if (result != null && result.no != p_package_no) { FRLogger.warn(STR); } return result; }
|
/**
* Returns the package with index p_package_no.
* Packages numbers are from 1 to package count.
*/
|
Returns the package with index p_package_no. Packages numbers are from 1 to package count
|
get
|
{
"repo_name": "freerouting/freerouting",
"path": "src/main/java/app/freerouting/library/Packages.java",
"license": "gpl-3.0",
"size": 3056
}
|
[
"app.freerouting.logger.FRLogger"
] |
import app.freerouting.logger.FRLogger;
|
import app.freerouting.logger.*;
|
[
"app.freerouting.logger"
] |
app.freerouting.logger;
| 2,768,928
|
public void startLocalForwarding(String addressToBind, int portToBind,
String hostToConnect, int portToConnect) throws SshException {
String key = generateKey(addressToBind, portToBind);
SocketListener listener = new SocketListener(addressToBind, portToBind,
hostToConnect, portToConnect);
listener.start();
socketlisteners.put(key, listener);
if (!outgoingtunnels.containsKey(key)) {
outgoingtunnels.put(key, new Vector<ActiveTunnel>());
}
for (int i = 0; i < clientlisteners.size(); i++) {
((ForwardingClientListener) clientlisteners.elementAt(i))
.forwardingStarted(
ForwardingClientListener.LOCAL_FORWARDING, key,
hostToConnect, portToConnect);
}
EventServiceImplementation
.getInstance()
.fireEvent(
(new Event(this,
J2SSHEventCodes.EVENT_FORWARDING_LOCAL_STARTED,
true))
.addAttribute(
J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_ENTRANCE,
key)
.addAttribute(
J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_EXIT,
hostToConnect + ":" + portToConnect));
}
|
void function(String addressToBind, int portToBind, String hostToConnect, int portToConnect) throws SshException { String key = generateKey(addressToBind, portToBind); SocketListener listener = new SocketListener(addressToBind, portToBind, hostToConnect, portToConnect); listener.start(); socketlisteners.put(key, listener); if (!outgoingtunnels.containsKey(key)) { outgoingtunnels.put(key, new Vector<ActiveTunnel>()); } for (int i = 0; i < clientlisteners.size(); i++) { ((ForwardingClientListener) clientlisteners.elementAt(i)) .forwardingStarted( ForwardingClientListener.LOCAL_FORWARDING, key, hostToConnect, portToConnect); } EventServiceImplementation .getInstance() .fireEvent( (new Event(this, J2SSHEventCodes.EVENT_FORWARDING_LOCAL_STARTED, true)) .addAttribute( J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_ENTRANCE, key) .addAttribute( J2SSHEventCodes.ATTRIBUTE_FORWARDING_TUNNEL_EXIT, hostToConnect + ":" + portToConnect)); }
|
/**
* Start's a local listening socket and forwards any connections made to the
* to the remote side.
*
* @param addressToBind
* the listening address
* @param portToBind
* the listening port
* @param hostToConnect
* the host to connect on the remote side
* @param portToConnect
* the port to connect on the remote side
* @throws IOException
*/
|
Start's a local listening socket and forwards any connections made to the to the remote side
|
startLocalForwarding
|
{
"repo_name": "sshtools/j2ssh-maverick",
"path": "j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java",
"license": "lgpl-3.0",
"size": 43859
}
|
[
"com.sshtools.events.Event",
"com.sshtools.events.EventServiceImplementation",
"com.sshtools.events.J2SSHEventCodes",
"com.sshtools.ssh.SshException",
"java.util.Vector"
] |
import com.sshtools.events.Event; import com.sshtools.events.EventServiceImplementation; import com.sshtools.events.J2SSHEventCodes; import com.sshtools.ssh.SshException; import java.util.Vector;
|
import com.sshtools.events.*; import com.sshtools.ssh.*; import java.util.*;
|
[
"com.sshtools.events",
"com.sshtools.ssh",
"java.util"
] |
com.sshtools.events; com.sshtools.ssh; java.util;
| 1,047,066
|
public String getValue(Filter filter);
|
String function(Filter filter);
|
/**
* Get the value and filter it using the given filter.
*
* @param filter
* @return
*/
|
Get the value and filter it using the given filter
|
getValue
|
{
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/core/gui/components/form/flexible/elements/TextElement.java",
"license": "apache-2.0",
"size": 4049
}
|
[
"org.olat.core.util.filter.Filter"
] |
import org.olat.core.util.filter.Filter;
|
import org.olat.core.util.filter.*;
|
[
"org.olat.core"
] |
org.olat.core;
| 1,973,885
|
public Map<String, Object> getCellStyle(Object cell)
{
Map<String, Object> style = (model.isEdge(cell)) ? stylesheet
.getDefaultEdgeStyle() : stylesheet.getDefaultVertexStyle();
String name = model.getStyle(cell);
if (name != null)
{
style = postProcessCellStyle(stylesheet.getCellStyle(name, style));
}
if (style == null)
{
style = mxStylesheet.EMPTY_STYLE;
}
return style;
}
|
Map<String, Object> function(Object cell) { Map<String, Object> style = (model.isEdge(cell)) ? stylesheet .getDefaultEdgeStyle() : stylesheet.getDefaultVertexStyle(); String name = model.getStyle(cell); if (name != null) { style = postProcessCellStyle(stylesheet.getCellStyle(name, style)); } if (style == null) { style = mxStylesheet.EMPTY_STYLE; } return style; }
|
/**
* Returns an array of key, value pairs representing the cell style for the
* given cell. If no string is defined in the model that specifies the
* style, then the default style for the cell is returned or <EMPTY_ARRAY>,
* if not style can be found.
*
* @param cell Cell whose style should be returned.
* @return Returns the style of the cell.
*/
|
Returns an array of key, value pairs representing the cell style for the given cell. If no string is defined in the model that specifies the style, then the default style for the cell is returned or , if not style can be found
|
getCellStyle
|
{
"repo_name": "tsxuehu/jgraphlearn",
"path": "java/src/com/mxgraph/view/mxGraph.java",
"license": "apache-2.0",
"size": 205407
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,018,584
|
@ApiModelProperty(example = "A calculator API that supports basic operations", value = "")
public String getDescription() {
return description;
}
|
@ApiModelProperty(example = STR, value = "") String function() { return description; }
|
/**
* Get description
* @return description
**/
|
Get description
|
getDescription
|
{
"repo_name": "tharindu1st/product-apim",
"path": "integration-tests/src/main/java/org/wso2/carbon/apimgt/rest/integration/tests/model/APIInfo.java",
"license": "apache-2.0",
"size": 6402
}
|
[
"io.swagger.annotations.ApiModelProperty"
] |
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.*;
|
[
"io.swagger.annotations"
] |
io.swagger.annotations;
| 764,476
|
public void testListMonth() {
String[] dtStrs = {
"2002-04-01T10:00:00",
"2002-01-01T10:00:00",
"2002-12-01T10:00:00",
"2002-09-01T10:00:00",
"2002-09-01T10:00:00",
"2002-02-01T10:00:00",
"2002-10-01T10:00:00"
};
//
List sl = loadAList( dtStrs );
boolean isSorted1 = isListSorted( sl );
Collections.sort( sl, cMonth );
boolean isSorted2 = isListSorted( sl );
assertEquals("ListMonth", !isSorted1, isSorted2);
} // end of testListMonth
|
void function() { String[] dtStrs = { STR, STR, STR, STR, STR, STR, STR }; boolean isSorted1 = isListSorted( sl ); Collections.sort( sl, cMonth ); boolean isSorted2 = isListSorted( sl ); assertEquals(STR, !isSorted1, isSorted2); }
|
/**
* Test sorting with month comparator.
*/
|
Test sorting with month comparator
|
testListMonth
|
{
"repo_name": "SpoonLabs/astor",
"path": "examples/time_2/src/test/java/org/joda/time/TestDateTimeComparator.java",
"license": "gpl-2.0",
"size": 37715
}
|
[
"java.util.Collections"
] |
import java.util.Collections;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 350,360
|
List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType);
|
List<MeasurementsChartConfiguration> loadConfigurationsForMeasurementType(String measurementType);
|
/**
* Load and return the list of chart configurations for a measurement type.
*
* @param measurementType the measurement type to configure
* @return a list of chart configurations, or an empty list if no configurations are registered
*/
|
Load and return the list of chart configurations for a measurement type
|
loadConfigurationsForMeasurementType
|
{
"repo_name": "phenotips/phenotips",
"path": "components/patient-measurements/api/src/main/java/org/phenotips/measurements/MeasurementsChartConfigurationsFactory.java",
"license": "agpl-3.0",
"size": 1466
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 961,854
|
@Override
public List<E> asList() {
return toList(iterable.iterator());
}
|
List<E> function() { return toList(iterable.iterator()); }
|
/**
* Collects all remaining objects of this Iterable into a list.
*
* @return a list with all remaining objects of this Iterable
*/
|
Collects all remaining objects of this Iterable into a list
|
asList
|
{
"repo_name": "italoag/java-design-patterns",
"path": "fluentinterface/src/main/java/com/iluwatar/fluentinterface/fluentiterable/simple/SimpleFluentIterable.java",
"license": "mit",
"size": 6893
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,360,314
|
void exitTypeArguments(@NotNull Java8Parser.TypeArgumentsContext ctx);
|
void exitTypeArguments(@NotNull Java8Parser.TypeArgumentsContext ctx);
|
/**
* Exit a parse tree produced by {@link Java8Parser#typeArguments}.
*
* @param ctx the parse tree
*/
|
Exit a parse tree produced by <code>Java8Parser#typeArguments</code>
|
exitTypeArguments
|
{
"repo_name": "BigDaddy-Germany/WHOAMI",
"path": "WHOAMI/src/de/aima13/whoami/modules/syntaxcheck/languages/antlrgen/Java8Listener.java",
"license": "mit",
"size": 97945
}
|
[
"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;
| 100,303
|
@SuppressWarnings("UnusedDeclaration")
public Enumerable<Object> query(
List<Map.Entry<String, Class>> fields,
List<Map.Entry<String, String>> selectFields,
List<Map.Entry<String, String>> aggregateFunctions,
List<String> groupByFields,
List<String> predicates,
List<String> order,
Long limit) {
return getTable().query(getClientCache(), fields, selectFields,
aggregateFunctions, groupByFields, predicates, order, limit);
}
}
}
|
@SuppressWarnings(STR) Enumerable<Object> function( List<Map.Entry<String, Class>> fields, List<Map.Entry<String, String>> selectFields, List<Map.Entry<String, String>> aggregateFunctions, List<String> groupByFields, List<String> predicates, List<String> order, Long limit) { return getTable().query(getClientCache(), fields, selectFields, aggregateFunctions, groupByFields, predicates, order, limit); } } }
|
/**
* Called via code-generation.
*/
|
Called via code-generation
|
query
|
{
"repo_name": "xhoong/incubator-calcite",
"path": "geode/src/main/java/org/apache/calcite/adapter/geode/rel/GeodeTable.java",
"license": "apache-2.0",
"size": 9655
}
|
[
"java.util.List",
"java.util.Map",
"org.apache.calcite.linq4j.Enumerable"
] |
import java.util.List; import java.util.Map; import org.apache.calcite.linq4j.Enumerable;
|
import java.util.*; import org.apache.calcite.linq4j.*;
|
[
"java.util",
"org.apache.calcite"
] |
java.util; org.apache.calcite;
| 452,064
|
public void finishReporting() {
Date now = new Date();
incrementalRecordStats.setLastDataTimeStamp(now);
totalRecordStats.setLastDataTimeStamp(now);
diagnostics.flush();
retrieveDiagnosticsIntermediateResults();
dataCountsPersister.persistDataCounts(job.getId(), runningTotalStats());
}
|
void function() { Date now = new Date(); incrementalRecordStats.setLastDataTimeStamp(now); totalRecordStats.setLastDataTimeStamp(now); diagnostics.flush(); retrieveDiagnosticsIntermediateResults(); dataCountsPersister.persistDataCounts(job.getId(), runningTotalStats()); }
|
/**
* Report the counts now regardless of whether or not we are at a reporting boundary.
*/
|
Report the counts now regardless of whether or not we are at a reporting boundary
|
finishReporting
|
{
"repo_name": "gingerwizard/elasticsearch",
"path": "x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/job/process/DataCountsReporter.java",
"license": "apache-2.0",
"size": 11653
}
|
[
"java.util.Date"
] |
import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 145,177
|
public void render(TileEntityTowerConsole entity, double x, double y, double z, float scale)
{
this.bindTexture(texture);
GL11.glPushMatrix();
{
RenderUtil.alphaOn();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glTranslatef(0.5F, 0.5F, 0.5F);
short rotate = 0;
int metadata = entity.getBlockMetadata();
switch (metadata) {
case 0:
rotate = 180;
break;
case 1:
rotate = 90;
break;
case 2:
rotate = 0;
break;
case 3:
rotate = -90;
break;
}
GL11.glRotatef(rotate, 0F, 1F, 0F);
this.model.render(entity, (float) x, (float) y, (float) z, 0.0F, 0.0F, 0.0625F);
RenderUtil.alphaOff();
}
GL11.glPopMatrix();
}
|
void function(TileEntityTowerConsole entity, double x, double y, double z, float scale) { this.bindTexture(texture); GL11.glPushMatrix(); { RenderUtil.alphaOn(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F); GL11.glTranslatef((float) x, (float) y, (float) z); GL11.glTranslatef(0.5F, 0.5F, 0.5F); short rotate = 0; int metadata = entity.getBlockMetadata(); switch (metadata) { case 0: rotate = 180; break; case 1: rotate = 90; break; case 2: rotate = 0; break; case 3: rotate = -90; break; } GL11.glRotatef(rotate, 0F, 1F, 0F); this.model.render(entity, (float) x, (float) y, (float) z, 0.0F, 0.0F, 0.0625F); RenderUtil.alphaOff(); } GL11.glPopMatrix(); }
|
/**
* Renders the TileEntity for the chest at a position.
*/
|
Renders the TileEntity for the chest at a position
|
render
|
{
"repo_name": "Cortex-Modders/CodeLyokoMod",
"path": "src/main/java/net/cortexmodders/lyoko/client/render/tileentity/RenderTowerConsole.java",
"license": "mit",
"size": 2401
}
|
[
"net.cortexmodders.lyoko.client.render.RenderUtil",
"net.cortexmodders.lyoko.tileentity.TileEntityTowerConsole"
] |
import net.cortexmodders.lyoko.client.render.RenderUtil; import net.cortexmodders.lyoko.tileentity.TileEntityTowerConsole;
|
import net.cortexmodders.lyoko.client.render.*; import net.cortexmodders.lyoko.tileentity.*;
|
[
"net.cortexmodders.lyoko"
] |
net.cortexmodders.lyoko;
| 1,751,868
|
public void doSortbygrouptitle(RunData data)
{
setupSort(data, SORTED_BY_GROUP_TITLE);
} // doSortbygrouptitle
|
void function(RunData data) { setupSort(data, SORTED_BY_GROUP_TITLE); }
|
/**
* Do sort by group title
*/
|
Do sort by group title
|
doSortbygrouptitle
|
{
"repo_name": "tl-its-umich-edu/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 671846
}
|
[
"org.sakaiproject.cheftool.RunData"
] |
import org.sakaiproject.cheftool.RunData;
|
import org.sakaiproject.cheftool.*;
|
[
"org.sakaiproject.cheftool"
] |
org.sakaiproject.cheftool;
| 909,108
|
public static DynArray read(InputStream input)
{
throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id()));
}
|
static DynArray function(InputStream input) { throw new MARSHAL(DynAnyFactoryHelper.not_applicable(id())); }
|
/**
* This should read DynArray from the CDR input stream, but (following the JDK
* 1.5 API) it does not.
*
* @param input a org.omg.CORBA.portable stream to read from.
*
* @specenote Sun throws the same exception.
*
* @throws MARSHAL always.
*/
|
This should read DynArray from the CDR input stream, but (following the JDK 1.5 API) it does not
|
read
|
{
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/org/omg/DynamicAny/DynArrayHelper.java",
"license": "bsd-3-clause",
"size": 5202
}
|
[
"org.omg.CORBA"
] |
import org.omg.CORBA;
|
import org.omg.*;
|
[
"org.omg"
] |
org.omg;
| 1,949,024
|
@Override
public void load(final RandomAccessFile raFile)
throws IOException {
content = new byte[(int) raFile.length()];
raFile.readFully(content);
}
|
void function(final RandomAccessFile raFile) throws IOException { content = new byte[(int) raFile.length()]; raFile.readFully(content); }
|
/**
* Load from file.
*
* @param raFile file to read
*
* @throws IOException file cannont be read
*/
|
Load from file
|
load
|
{
"repo_name": "tectronics/openjill",
"path": "abstractfile/src/main/java/org/jill/file/FileAbstractByteImpl.java",
"license": "mpl-2.0",
"size": 10497
}
|
[
"java.io.IOException",
"java.io.RandomAccessFile"
] |
import java.io.IOException; import java.io.RandomAccessFile;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 2,907,475
|
public boolean compareAmounts(Balance balance) {
if (!(balance instanceof LedgerBalance)) {
throw new IllegalArgumentException("balance needs to be of type LedgerBalance");
}
LedgerBalance ledgerBalance = (LedgerBalance) balance;
if (ObjectUtils.isNotNull(ledgerBalance)
&& ledgerBalance.getAccountLineAnnualBalanceAmount().equals(this.getAccountLineAnnualBalanceAmount())
&& ledgerBalance.getFinancialBeginningBalanceLineAmount().equals(this.getFinancialBeginningBalanceLineAmount())
&& ledgerBalance.getContractsGrantsBeginningBalanceAmount().equals(this.getContractsGrantsBeginningBalanceAmount())
&& ledgerBalance.getMonth1Amount().equals(this.getMonth1Amount())
&& ledgerBalance.getMonth2Amount().equals(this.getMonth2Amount())
&& ledgerBalance.getMonth3Amount().equals(this.getMonth3Amount())
&& ledgerBalance.getMonth4Amount().equals(this.getMonth4Amount())
&& ledgerBalance.getMonth5Amount().equals(this.getMonth5Amount())
&& ledgerBalance.getMonth6Amount().equals(this.getMonth6Amount())
&& ledgerBalance.getMonth7Amount().equals(this.getMonth7Amount())
&& ledgerBalance.getMonth8Amount().equals(this.getMonth8Amount())
&& ledgerBalance.getMonth9Amount().equals(this.getMonth9Amount())
&& ledgerBalance.getMonth10Amount().equals(this.getMonth10Amount())
&& ledgerBalance.getMonth11Amount().equals(this.getMonth11Amount())
&& ledgerBalance.getMonth12Amount().equals(this.getMonth12Amount())
&& ledgerBalance.getMonth13Amount().equals(this.getMonth13Amount())) {
return true;
}
return false;
}
|
boolean function(Balance balance) { if (!(balance instanceof LedgerBalance)) { throw new IllegalArgumentException(STR); } LedgerBalance ledgerBalance = (LedgerBalance) balance; if (ObjectUtils.isNotNull(ledgerBalance) && ledgerBalance.getAccountLineAnnualBalanceAmount().equals(this.getAccountLineAnnualBalanceAmount()) && ledgerBalance.getFinancialBeginningBalanceLineAmount().equals(this.getFinancialBeginningBalanceLineAmount()) && ledgerBalance.getContractsGrantsBeginningBalanceAmount().equals(this.getContractsGrantsBeginningBalanceAmount()) && ledgerBalance.getMonth1Amount().equals(this.getMonth1Amount()) && ledgerBalance.getMonth2Amount().equals(this.getMonth2Amount()) && ledgerBalance.getMonth3Amount().equals(this.getMonth3Amount()) && ledgerBalance.getMonth4Amount().equals(this.getMonth4Amount()) && ledgerBalance.getMonth5Amount().equals(this.getMonth5Amount()) && ledgerBalance.getMonth6Amount().equals(this.getMonth6Amount()) && ledgerBalance.getMonth7Amount().equals(this.getMonth7Amount()) && ledgerBalance.getMonth8Amount().equals(this.getMonth8Amount()) && ledgerBalance.getMonth9Amount().equals(this.getMonth9Amount()) && ledgerBalance.getMonth10Amount().equals(this.getMonth10Amount()) && ledgerBalance.getMonth11Amount().equals(this.getMonth11Amount()) && ledgerBalance.getMonth12Amount().equals(this.getMonth12Amount()) && ledgerBalance.getMonth13Amount().equals(this.getMonth13Amount())) { return true; } return false; }
|
/**
* Compare amounts
*
* @param balance
* @see org.kuali.kfs.gl.businessobject.Balance#addAmount(java.lang.String, org.kuali.rice.core.api.util.type.KualiDecimal)
*/
|
Compare amounts
|
compareAmounts
|
{
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/ld/businessobject/LaborBalanceHistory.java",
"license": "agpl-3.0",
"size": 7765
}
|
[
"org.kuali.kfs.gl.businessobject.Balance",
"org.kuali.rice.krad.util.ObjectUtils"
] |
import org.kuali.kfs.gl.businessobject.Balance; import org.kuali.rice.krad.util.ObjectUtils;
|
import org.kuali.kfs.gl.businessobject.*; import org.kuali.rice.krad.util.*;
|
[
"org.kuali.kfs",
"org.kuali.rice"
] |
org.kuali.kfs; org.kuali.rice;
| 1,463,162
|
public static TypeElement getSuperClassElement(Element element) {
if (element.getKind() != ElementKind.CLASS) {
return null;
}
TypeMirror superclass = ((TypeElement) element).getSuperclass();
if (superclass.getKind() == TypeKind.NONE) {
return null;
}
DeclaredType kind = (DeclaredType) superclass;
return (TypeElement) kind.asElement();
}
|
static TypeElement function(Element element) { if (element.getKind() != ElementKind.CLASS) { return null; } TypeMirror superclass = ((TypeElement) element).getSuperclass(); if (superclass.getKind() == TypeKind.NONE) { return null; } DeclaredType kind = (DeclaredType) superclass; return (TypeElement) kind.asElement(); }
|
/**
* Retrieves the super class of the given {@link Element}.
* Returns null if {@link Element} represents {@link Object}, or something other than {@link ElementKind#CLASS}.
* @param element target {@link Element}.
* @return {@link Element} of its super class.
* @author vvakame
*/
|
Retrieves the super class of the given <code>Element</code>. Returns null if <code>Element</code> represents <code>Object</code>, or something other than <code>ElementKind#CLASS</code>
|
getSuperClassElement
|
{
"repo_name": "vvakame/JsonPullParser",
"path": "jsonpullparser-apt/src/main/java/net/vvakame/apt/AptUtil.java",
"license": "apache-2.0",
"size": 14808
}
|
[
"javax.lang.model.element.Element",
"javax.lang.model.element.ElementKind",
"javax.lang.model.element.TypeElement",
"javax.lang.model.type.DeclaredType",
"javax.lang.model.type.TypeKind",
"javax.lang.model.type.TypeMirror"
] |
import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.TypeElement; import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeKind; import javax.lang.model.type.TypeMirror;
|
import javax.lang.model.element.*; import javax.lang.model.type.*;
|
[
"javax.lang"
] |
javax.lang;
| 1,337,291
|
private void getRandomDocsFromTrain(int num, List<String> fillNames, List<List<TextEntity>> fillEntities) {
// Asked for more docs than we have, so just return them all.
if( num >= _trainDocsNames.size() ) {
for( int ii = 0; ii < _trainDocsNames.size(); ii++ ) {
fillNames.add(_trainDocsNames.get(ii));
fillEntities.add(_trainDocsEntities.get(ii));
}
return;
}
// Asked for less docs than we have, so randomly sample.
Random rand = new Random();
Set<Integer> docids = new HashSet<Integer>();
while( docids.size() < num ) {
int draw = rand.nextInt(_trainDocsNames.size());
while( docids.contains(draw) )
draw = rand.nextInt(_trainDocsNames.size());
docids.add(draw);
}
System.out.println("Wanted " + num + " random docs, drew " + docids.size() + " docs.");
for( int ii = 0; ii < _trainDocsNames.size(); ii++ ) {
if( docids.contains(ii) ) {
fillNames.add(_trainDocsNames.get(ii));
fillEntities.add(_trainDocsEntities.get(ii));
}
}
}
|
void function(int num, List<String> fillNames, List<List<TextEntity>> fillEntities) { if( num >= _trainDocsNames.size() ) { for( int ii = 0; ii < _trainDocsNames.size(); ii++ ) { fillNames.add(_trainDocsNames.get(ii)); fillEntities.add(_trainDocsEntities.get(ii)); } return; } Random rand = new Random(); Set<Integer> docids = new HashSet<Integer>(); while( docids.size() < num ) { int draw = rand.nextInt(_trainDocsNames.size()); while( docids.contains(draw) ) draw = rand.nextInt(_trainDocsNames.size()); docids.add(draw); } System.out.println(STR + num + STR + docids.size() + STR); for( int ii = 0; ii < _trainDocsNames.size(); ii++ ) { if( docids.contains(ii) ) { fillNames.add(_trainDocsNames.get(ii)); fillEntities.add(_trainDocsEntities.get(ii)); } } }
|
/**
* Use the global entity list per doc, and pull out a random number of documents (num docs)
* that will be used for learning. Put those num documents into the given fillEntities list.
* @param num The number of random documents to select.
* @param fillNames The list of document names selected.
* @param fillEntities The entity lists for each document selected.
*/
|
Use the global entity list per doc, and pull out a random number of documents (num docs) that will be used for learning. Put those num documents into the given fillEntities list
|
getRandomDocsFromTrain
|
{
"repo_name": "nchambers/probschemas",
"path": "src/main/java/nate/probschemas/Learner.java",
"license": "gpl-2.0",
"size": 43382
}
|
[
"java.util.HashSet",
"java.util.List",
"java.util.Random",
"java.util.Set"
] |
import java.util.HashSet; import java.util.List; import java.util.Random; import java.util.Set;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,358,166
|
public int addLike(String username, String idDocument) throws Exception {
try {
String query = "insert into " + LIKECOLLECTION + " ("
+ USERNAMECOLUMN + "," + DOCUMENTIDCOLUMN + ")"
+ " values ('" + username + "','" + idDocument + "')";
session.execute(query);
// TODO change exception
} catch (Exception e) {
logger.warn(e.getMessage());
return CodesReturned.ALREADYPERFORMED;
}
return CodesReturned.ALLOK;
}
|
int function(String username, String idDocument) throws Exception { try { String query = STR + LIKECOLLECTION + STR + USERNAMECOLUMN + "," + DOCUMENTIDCOLUMN + ")" + STR + username + "','" + idDocument + "')"; session.execute(query); } catch (Exception e) { logger.warn(e.getMessage()); return CodesReturned.ALREADYPERFORMED; } return CodesReturned.ALLOK; }
|
/**
* Add a document to the list of documents liked by the user
*
* @param username
* of the user
* @param idDocument
* the id that should be liked
* @return Like.ALREADYPERFORMED if the like was already done,
* CodesUser.ALLOK if all was ok
*/
|
Add a document to the list of documents liked by the user
|
addLike
|
{
"repo_name": "svanschalkwyk/datafari",
"path": "src/com/francelabs/datafari/service/db/DocumentDataService.java",
"license": "apache-2.0",
"size": 6724
}
|
[
"com.francelabs.datafari.constants.CodesReturned"
] |
import com.francelabs.datafari.constants.CodesReturned;
|
import com.francelabs.datafari.constants.*;
|
[
"com.francelabs.datafari"
] |
com.francelabs.datafari;
| 2,163,543
|
public void setItensCashFlowCategory(List<SelectItem> itensCashFlowCategory) {
this.itensCashFlowCategory = itensCashFlowCategory;
}
|
void function(List<SelectItem> itensCashFlowCategory) { this.itensCashFlowCategory = itensCashFlowCategory; }
|
/**
* Sets the itens cash flow category.
*
* @param itensCashFlowCategory the new itens cash flow category
*/
|
Sets the itens cash flow category
|
setItensCashFlowCategory
|
{
"repo_name": "uaijug/chronos",
"path": "src/main/java/br/com/uaijug/chronos/institution/cashFlow/controller/CashFlowController.java",
"license": "gpl-3.0",
"size": 10488
}
|
[
"java.util.List",
"javax.faces.model.SelectItem"
] |
import java.util.List; import javax.faces.model.SelectItem;
|
import java.util.*; import javax.faces.model.*;
|
[
"java.util",
"javax.faces"
] |
java.util; javax.faces;
| 1,691,460
|
public PacketWriter startObject(ArtemisObject object, ObjectType type, Enum<?>[] bits) {
return startObject(object, type, bits.length);
}
|
PacketWriter function(ArtemisObject object, ObjectType type, Enum<?>[] bits) { return startObject(object, type, bits.length); }
|
/**
* Convenience method for startObject(object, type, bits.length).
*/
|
Convenience method for startObject(object, type, bits.length)
|
startObject
|
{
"repo_name": "JordanLongstaff/Artemis-Messenger",
"path": "src/com/walkertribe/ian/iface/PacketWriter.java",
"license": "mit",
"size": 16045
}
|
[
"com.walkertribe.ian.enums.ObjectType",
"com.walkertribe.ian.world.ArtemisObject"
] |
import com.walkertribe.ian.enums.ObjectType; import com.walkertribe.ian.world.ArtemisObject;
|
import com.walkertribe.ian.enums.*; import com.walkertribe.ian.world.*;
|
[
"com.walkertribe.ian"
] |
com.walkertribe.ian;
| 1,161,927
|
public CodecProfileLevel[] getProfileLevels() {
return capabilities == null || capabilities.profileLevels == null ? new CodecProfileLevel[0]
: capabilities.profileLevels;
}
|
CodecProfileLevel[] function() { return capabilities == null capabilities.profileLevels == null ? new CodecProfileLevel[0] : capabilities.profileLevels; }
|
/**
* The profile levels supported by the decoder.
*
* @return The profile levels supported by the decoder.
*/
|
The profile levels supported by the decoder
|
getProfileLevels
|
{
"repo_name": "slp/Telegram-FOSS",
"path": "TMessagesProj/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecInfo.java",
"license": "gpl-2.0",
"size": 19968
}
|
[
"android.media.MediaCodecInfo"
] |
import android.media.MediaCodecInfo;
|
import android.media.*;
|
[
"android.media"
] |
android.media;
| 2,362,431
|
public static Evaluator newEvaluator(File file) throws IOException, JAXBException, SAXException {
Objects.requireNonNull(file);
return newEvaluator(newPmml(file));
}
|
static Evaluator function(File file) throws IOException, JAXBException, SAXException { Objects.requireNonNull(file); return newEvaluator(newPmml(file)); }
|
/**
* Creates a new {@link Evaluator} object representing the PMML model defined in the XML {@link File} specified as
* argument.
*/
|
Creates a new <code>Evaluator</code> object representing the PMML model defined in the XML <code>File</code> specified as argument
|
newEvaluator
|
{
"repo_name": "kishorvpatil/incubator-storm",
"path": "external/storm-pmml/src/main/java/org/apache/storm/pmml/runner/jpmml/JpmmlFactory.java",
"license": "apache-2.0",
"size": 9084
}
|
[
"java.io.File",
"java.io.IOException",
"java.util.Objects",
"javax.xml.bind.JAXBException",
"org.jpmml.evaluator.Evaluator",
"org.xml.sax.SAXException"
] |
import java.io.File; import java.io.IOException; import java.util.Objects; import javax.xml.bind.JAXBException; import org.jpmml.evaluator.Evaluator; import org.xml.sax.SAXException;
|
import java.io.*; import java.util.*; import javax.xml.bind.*; import org.jpmml.evaluator.*; import org.xml.sax.*;
|
[
"java.io",
"java.util",
"javax.xml",
"org.jpmml.evaluator",
"org.xml.sax"
] |
java.io; java.util; javax.xml; org.jpmml.evaluator; org.xml.sax;
| 1,199,412
|
@Test(expected = IllegalArgumentException.class)
public void testSetPropertiesDisjointCheck() {
NewTableConfiguration ntc = new NewTableConfiguration();
Map<String,Set<Text>> lgroups = new HashMap<>();
lgroups.put("lg1", Set.of(new Text("dog")));
ntc.setLocalityGroups(lgroups);
Map<String,String> props = new HashMap<>();
props.put("table.key1", "val1");
props.put("table.group.lg1", "cat");
ntc.setProperties(props);
}
|
@Test(expected = IllegalArgumentException.class) void function() { NewTableConfiguration ntc = new NewTableConfiguration(); Map<String,Set<Text>> lgroups = new HashMap<>(); lgroups.put("lg1", Set.of(new Text("dog"))); ntc.setLocalityGroups(lgroups); Map<String,String> props = new HashMap<>(); props.put(STR, "val1"); props.put(STR, "cat"); ntc.setProperties(props); }
|
/**
* Verify that disjoint check works as expected with setProperties
*/
|
Verify that disjoint check works as expected with setProperties
|
testSetPropertiesDisjointCheck
|
{
"repo_name": "keith-turner/accumulo",
"path": "test/src/main/java/org/apache/accumulo/test/NewTableConfigurationIT.java",
"license": "apache-2.0",
"size": 29651
}
|
[
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"org.apache.accumulo.core.client.admin.NewTableConfiguration",
"org.apache.hadoop.io.Text",
"org.junit.Test"
] |
import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.hadoop.io.Text; import org.junit.Test;
|
import java.util.*; import org.apache.accumulo.core.client.admin.*; import org.apache.hadoop.io.*; import org.junit.*;
|
[
"java.util",
"org.apache.accumulo",
"org.apache.hadoop",
"org.junit"
] |
java.util; org.apache.accumulo; org.apache.hadoop; org.junit;
| 2,098,048
|
public static void addErrorMessage(String clientId, String msg) {
FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg));
}
|
static void function(String clientId, String msg) { FacesContext.getCurrentInstance().addMessage(clientId, new FacesMessage(FacesMessage.SEVERITY_ERROR, msg, msg)); }
|
/**
* Add error message to a specific client.
*
* @param clientId the client id
* @param msg the error message
*/
|
Add error message to a specific client
|
addErrorMessage
|
{
"repo_name": "mgerlich/MetFusion",
"path": "src/main/java/de/ipbhalle/metfusion/utilities/icefaces/FacesUtils.java",
"license": "gpl-3.0",
"size": 4266
}
|
[
"javax.faces.application.FacesMessage",
"javax.faces.context.FacesContext"
] |
import javax.faces.application.FacesMessage; import javax.faces.context.FacesContext;
|
import javax.faces.application.*; import javax.faces.context.*;
|
[
"javax.faces"
] |
javax.faces;
| 1,599,749
|
static BodyHandler create(String uploadDirectory) {
return new BodyHandlerImpl(uploadDirectory);
}
|
static BodyHandler create(String uploadDirectory) { return new BodyHandlerImpl(uploadDirectory); }
|
/**
* Create a body handler and use the given upload directory.
*
* @param uploadDirectory the uploads directory
* @return the body handler
*/
|
Create a body handler and use the given upload directory
|
create
|
{
"repo_name": "vert-x3/vertx-web",
"path": "vertx-web/src/main/java/io/vertx/ext/web/handler/BodyHandler.java",
"license": "apache-2.0",
"size": 4383
}
|
[
"io.vertx.ext.web.handler.impl.BodyHandlerImpl"
] |
import io.vertx.ext.web.handler.impl.BodyHandlerImpl;
|
import io.vertx.ext.web.handler.impl.*;
|
[
"io.vertx.ext"
] |
io.vertx.ext;
| 365,488
|
@Override
public long getUsedIops(StoragePool storagePool) {
long usedIops = 0;
return usedIops;
}
|
long function(StoragePool storagePool) { long usedIops = 0; return usedIops; }
|
/**
* Get total IOPS used by the storage array. Since Datera doesn't support min
* IOPS, return zero for now
* @param storagePool primary storage
* @return total IOPS used
*/
|
Get total IOPS used by the storage array. Since Datera doesn't support min IOPS, return zero for now
|
getUsedIops
|
{
"repo_name": "Datera/cloudstack-driver",
"path": "src/org/apache/cloudstack/storage/datastore/driver/DateraPrimaryDataStoreDriver.java",
"license": "apache-2.0",
"size": 77359
}
|
[
"com.cloud.storage.StoragePool"
] |
import com.cloud.storage.StoragePool;
|
import com.cloud.storage.*;
|
[
"com.cloud.storage"
] |
com.cloud.storage;
| 2,894,203
|
private final static ArrayList<String> createDefaultStates(int cardinality) {
assert cardinality > 0;
ArrayList<String> states = new ArrayList<String>();
for (int i = 0; i < cardinality; i++) {
states.add(STATE_PREFIX + i);
}
return states;
}
private List<String> _states;
public DiscreteVariable(String name, List<String> states) {
super(name);
// states cannot be empty
assert !states.isEmpty();
_states = states;
}
public DiscreteVariable(int cardinality) {
_states = createDefaultStates(cardinality);
}
|
final static ArrayList<String> function(int cardinality) { assert cardinality > 0; ArrayList<String> states = new ArrayList<String>(); for (int i = 0; i < cardinality; i++) { states.add(STATE_PREFIX + i); } return states; } List<String> _states; public DiscreteVariable(String name, List<String> states) { super(name); assert !states.isEmpty(); _states = states; } public DiscreteVariable(int cardinality) { _states = function(cardinality); }
|
/**
* Returns the list of default names of states for the specified
* cardinality. If you have no preference on names of states of the next
* variable instance, use this method to obtain the list of default names.
*
* @param cardinality
* number of states.
* @return the list of default names of states for the specified
* cardinality.
*/
|
Returns the list of default names of states for the specified cardinality. If you have no preference on names of states of the next variable instance, use this method to obtain the list of default names
|
createDefaultStates
|
{
"repo_name": "fernandoj92/mvca-parkinson",
"path": "pltm-analysis/src/main/java/org/latlab/util/DiscreteVariable.java",
"license": "apache-2.0",
"size": 7264
}
|
[
"java.util.ArrayList",
"java.util.List"
] |
import java.util.ArrayList; import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,813,007
|
final void launchIntent(Intent intent) {
try {
rawLaunchIntent(intent);
} catch (ActivityNotFoundException ignored) {
AlertDialog.Builder builder = new AlertDialog.Builder(activity);
builder.setTitle(R.string.app_name);
builder.setMessage(R.string.msg_intent_failed);
builder.setPositiveButton(R.string.button_ok, null);
builder.show();
}
}
|
final void launchIntent(Intent intent) { try { rawLaunchIntent(intent); } catch (ActivityNotFoundException ignored) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.app_name); builder.setMessage(R.string.msg_intent_failed); builder.setPositiveButton(R.string.button_ok, null); builder.show(); } }
|
/**
* Like {@link #rawLaunchIntent(Intent)} but will show a user dialog if nothing is available to handle.
*/
|
Like <code>#rawLaunchIntent(Intent)</code> but will show a user dialog if nothing is available to handle
|
launchIntent
|
{
"repo_name": "samuel1114/ZXingLibs",
"path": "src/com/google/zxing/client/android/result/ResultHandler.java",
"license": "apache-2.0",
"size": 17031
}
|
[
"android.app.AlertDialog",
"android.content.ActivityNotFoundException",
"android.content.Intent"
] |
import android.app.AlertDialog; import android.content.ActivityNotFoundException; import android.content.Intent;
|
import android.app.*; import android.content.*;
|
[
"android.app",
"android.content"
] |
android.app; android.content;
| 400,118
|
UnitDTO getUnit( @WebParam(name="unitNumber") String unitNumber);
|
UnitDTO getUnit( @WebParam(name=STR) String unitNumber);
|
/**
* Get the Unit record corresponding to the given unit number.
*
* @param unitNumber
* @return UnitDTO
*/
|
Get the Unit record corresponding to the given unit number
|
getUnit
|
{
"repo_name": "jwillia/kc-old1",
"path": "coeus-impl/src/main/java/org/kuali/kra/external/unit/service/InstitutionalUnitService.java",
"license": "agpl-3.0",
"size": 2424
}
|
[
"javax.jws.WebParam",
"org.kuali.kra.external.unit.UnitDTO"
] |
import javax.jws.WebParam; import org.kuali.kra.external.unit.UnitDTO;
|
import javax.jws.*; import org.kuali.kra.external.unit.*;
|
[
"javax.jws",
"org.kuali.kra"
] |
javax.jws; org.kuali.kra;
| 157,296
|
public void retain(Context context, int pos, Card card) {
card.setRestoring(true);
getCards().add(pos < getCards().size() ? pos : 0, card);
getCardsDiscarded().remove(card);
changeCardStateNormal(context, card);
}
|
void function(Context context, int pos, Card card) { card.setRestoring(true); getCards().add(pos < getCards().size() ? pos : 0, card); getCardsDiscarded().remove(card); changeCardStateNormal(context, card); }
|
/**
* Retains a card that has been removed
*
* @param pos position where the card will be retained
* @param card card
*/
|
Retains a card that has been removed
|
retain
|
{
"repo_name": "interoberlin/lymbo",
"path": "app/src/main/java/de/interoberlin/lymbo/controller/CardsController.java",
"license": "gpl-3.0",
"size": 22250
}
|
[
"android.content.Context",
"de.interoberlin.lymbo.core.model.v1.impl.Card"
] |
import android.content.Context; import de.interoberlin.lymbo.core.model.v1.impl.Card;
|
import android.content.*; import de.interoberlin.lymbo.core.model.v1.impl.*;
|
[
"android.content",
"de.interoberlin.lymbo"
] |
android.content; de.interoberlin.lymbo;
| 361,940
|
protected void killContainer(String pid, Signal signal) throws IOException {
new ShellCommandExecutor(Shell.getSignalKillCommand(signal.getValue(), pid))
.execute();
}
|
void function(String pid, Signal signal) throws IOException { new ShellCommandExecutor(Shell.getSignalKillCommand(signal.getValue(), pid)) .execute(); }
|
/**
* Send a specified signal to the specified pid
*
* @param pid the pid of the process [group] to signal.
* @param signal signal to send
* (for logging).
*/
|
Send a specified signal to the specified pid
|
killContainer
|
{
"repo_name": "bysslord/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DockerContainerExecutor.java",
"license": "apache-2.0",
"size": 30543
}
|
[
"java.io.IOException",
"org.apache.hadoop.util.Shell"
] |
import java.io.IOException; import org.apache.hadoop.util.Shell;
|
import java.io.*; import org.apache.hadoop.util.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 2,679,007
|
private boolean checkValidNewName() {
if (toName.length() == 0) {
statusLabel.setText(GemCutter.getResourceString("RNRD_SpecifyNewName"));
statusLabel.setIcon(ERROR_ICON);
okButton.setEnabled(false);
}
ModuleTypeInfo typeInfo = null;
if (category != SourceIdentifier.Category.MODULE_NAME) {
typeInfo = perspective.getMetaModule((ModuleName)sourceModuleList.getSelectedItem()).getTypeInfo();
}
boolean entityExists;
IdentifierUtils.ValidatedIdentifier validatedIdentifier;
if (category == SourceIdentifier.Category.TYPE_CONSTRUCTOR) {
validatedIdentifier = IdentifierUtils.makeValidTypeConstructorName(toName);
entityExists = typeInfo.getTypeConstructor(toName) != null;
} else if (category == SourceIdentifier.Category.TYPE_CLASS) {
validatedIdentifier = IdentifierUtils.makeValidTypeClassName(toName);
entityExists = typeInfo.getTypeClass(toName) != null;
} else if (category == SourceIdentifier.Category.DATA_CONSTRUCTOR) {
validatedIdentifier = IdentifierUtils.makeValidDataConstructorName(toName);
entityExists = typeInfo.getDataConstructor(toName) != null;
} else if (category == SourceIdentifier.Category.TOP_LEVEL_FUNCTION_OR_CLASS_METHOD) {
validatedIdentifier = IdentifierUtils.makeValidFunctionName(toName);
entityExists = typeInfo.getFunctionOrClassMethod(toName) != null;
} else if (category == SourceIdentifier.Category.MODULE_NAME) {
validatedIdentifier = IdentifierUtils.makeValidModuleName(toName);
ModuleName maybeModuleName = ModuleName.maybeMake(toName);
entityExists = maybeModuleName != null && perspective.getMetaModule(maybeModuleName) != null;
} else {
throw new IllegalStateException("Illegal gem type");
}
if (!validatedIdentifier.isValid()) {
IdentifierUtils.ValidationStatus error = validatedIdentifier.getNthError(0);
String errorKey;
if (error == IdentifierUtils.ValidationStatus.INVALID_CONTENT) {
errorKey = "RNRD_InvalidName_InvalidContent";
} else if (error == IdentifierUtils.ValidationStatus.INVALID_START) {
errorKey = "RNRD_InvalidName_InvalidStart";
} else if (error == IdentifierUtils.ValidationStatus.NEED_UPPER) {
errorKey = "RNRD_InvalidName_NeedUpper";
} else if (error == IdentifierUtils.ValidationStatus.NEED_LOWER) {
errorKey = "RNRD_InvalidName_NeedLower";
} else if (error == IdentifierUtils.ValidationStatus.EXISTING_KEYWORD) {
errorKey = "RNRD_InvalidName_ExistingKeyword";
} else if (error == IdentifierUtils.ValidationStatus.WAS_EMPTY) {
errorKey = "RNRD_InvalidName_WasEmpty";
} else {
errorKey = "RNRD_InvalidName_Unknown";
}
statusLabel.setText(GemCutter.getResourceString(errorKey));
statusLabel.setIcon(ERROR_ICON);
okButton.setEnabled(false);
return false;
}
if(entityExists && !fromName.equals(toName)) {
if (allowDuplicateRenaming) {
proposedFactoringUnsafe = true;
statusLabel.setText(GemCutter.getResourceString("RNRD_EntityExistsWarning"));
statusLabel.setIcon(WARNING_ICON);
} else {
statusLabel.setText(GemCutter.getResourceString("RNRD_EntityExists"));
statusLabel.setIcon(ERROR_ICON);
okButton.setEnabled(false);
return false;
}
}
okButton.setEnabled(true);
return true;
}
|
boolean function() { if (toName.length() == 0) { statusLabel.setText(GemCutter.getResourceString(STR)); statusLabel.setIcon(ERROR_ICON); okButton.setEnabled(false); } ModuleTypeInfo typeInfo = null; if (category != SourceIdentifier.Category.MODULE_NAME) { typeInfo = perspective.getMetaModule((ModuleName)sourceModuleList.getSelectedItem()).getTypeInfo(); } boolean entityExists; IdentifierUtils.ValidatedIdentifier validatedIdentifier; if (category == SourceIdentifier.Category.TYPE_CONSTRUCTOR) { validatedIdentifier = IdentifierUtils.makeValidTypeConstructorName(toName); entityExists = typeInfo.getTypeConstructor(toName) != null; } else if (category == SourceIdentifier.Category.TYPE_CLASS) { validatedIdentifier = IdentifierUtils.makeValidTypeClassName(toName); entityExists = typeInfo.getTypeClass(toName) != null; } else if (category == SourceIdentifier.Category.DATA_CONSTRUCTOR) { validatedIdentifier = IdentifierUtils.makeValidDataConstructorName(toName); entityExists = typeInfo.getDataConstructor(toName) != null; } else if (category == SourceIdentifier.Category.TOP_LEVEL_FUNCTION_OR_CLASS_METHOD) { validatedIdentifier = IdentifierUtils.makeValidFunctionName(toName); entityExists = typeInfo.getFunctionOrClassMethod(toName) != null; } else if (category == SourceIdentifier.Category.MODULE_NAME) { validatedIdentifier = IdentifierUtils.makeValidModuleName(toName); ModuleName maybeModuleName = ModuleName.maybeMake(toName); entityExists = maybeModuleName != null && perspective.getMetaModule(maybeModuleName) != null; } else { throw new IllegalStateException(STR); } if (!validatedIdentifier.isValid()) { IdentifierUtils.ValidationStatus error = validatedIdentifier.getNthError(0); String errorKey; if (error == IdentifierUtils.ValidationStatus.INVALID_CONTENT) { errorKey = STR; } else if (error == IdentifierUtils.ValidationStatus.INVALID_START) { errorKey = STR; } else if (error == IdentifierUtils.ValidationStatus.NEED_UPPER) { errorKey = STR; } else if (error == IdentifierUtils.ValidationStatus.NEED_LOWER) { errorKey = STR; } else if (error == IdentifierUtils.ValidationStatus.EXISTING_KEYWORD) { errorKey = STR; } else if (error == IdentifierUtils.ValidationStatus.WAS_EMPTY) { errorKey = STR; } else { errorKey = STR; } statusLabel.setText(GemCutter.getResourceString(errorKey)); statusLabel.setIcon(ERROR_ICON); okButton.setEnabled(false); return false; } if(entityExists && !fromName.equals(toName)) { if (allowDuplicateRenaming) { proposedFactoringUnsafe = true; statusLabel.setText(GemCutter.getResourceString(STR)); statusLabel.setIcon(WARNING_ICON); } else { statusLabel.setText(GemCutter.getResourceString(STR)); statusLabel.setIcon(ERROR_ICON); okButton.setEnabled(false); return false; } } okButton.setEnabled(true); return true; }
|
/**
* Checks if the user-entered new name is valid, and if not, disables the OK button and displays an error message.
* @return True if the user-entered new name is valid, false otherwise.
*/
|
Checks if the user-entered new name is valid, and if not, disables the OK button and displays an error message
|
checkValidNewName
|
{
"repo_name": "levans/Open-Quark",
"path": "src/Quark_Gems/src/org/openquark/gems/client/RenameRefactoringDialog.java",
"license": "bsd-3-clause",
"size": 87937
}
|
[
"org.openquark.cal.compiler.ModuleName",
"org.openquark.cal.compiler.ModuleTypeInfo",
"org.openquark.cal.compiler.SourceIdentifier",
"org.openquark.cal.services.IdentifierUtils"
] |
import org.openquark.cal.compiler.ModuleName; import org.openquark.cal.compiler.ModuleTypeInfo; import org.openquark.cal.compiler.SourceIdentifier; import org.openquark.cal.services.IdentifierUtils;
|
import org.openquark.cal.compiler.*; import org.openquark.cal.services.*;
|
[
"org.openquark.cal"
] |
org.openquark.cal;
| 2,738,946
|
public List<ComponentName> getActiveAdmins() {
return getActiveAdminsAsUser(UserHandle.myUserId());
}
|
List<ComponentName> function() { return getActiveAdminsAsUser(UserHandle.myUserId()); }
|
/**
* Return a list of all currently active device administrators' component
* names. If there are no administrators {@code null} may be
* returned.
*/
|
Return a list of all currently active device administrators' component names. If there are no administrators null may be returned
|
getActiveAdmins
|
{
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/app/admin/DevicePolicyManager.java",
"license": "gpl-3.0",
"size": 196508
}
|
[
"android.content.ComponentName",
"android.os.UserHandle",
"java.util.List"
] |
import android.content.ComponentName; import android.os.UserHandle; import java.util.List;
|
import android.content.*; import android.os.*; import java.util.*;
|
[
"android.content",
"android.os",
"java.util"
] |
android.content; android.os; java.util;
| 137,103
|
public Color getBoxColor()
{
return boxColor;
}
|
Color function() { return boxColor; }
|
/**
* Get the value of boxColor
*
* @return the value of boxColor
*/
|
Get the value of boxColor
|
getBoxColor
|
{
"repo_name": "IcmVis/VisNow-Pro",
"path": "src/pl/edu/icm/visnow/geometries/parameters/RegularField3dParams.java",
"license": "gpl-3.0",
"size": 8001
}
|
[
"java.awt.Color"
] |
import java.awt.Color;
|
import java.awt.*;
|
[
"java.awt"
] |
java.awt;
| 437,205
|
private String getGradient()
{
String gradient = "";
String fillPattern = this.getValue(this.getCellElement(mxVsdxConstants.FILL_PATTERN), "0");
// if (fillPattern.equals("25") || fillPattern.equals("27") || fillPattern.equals("28") || fillPattern.equals("30"))
//approximate all gradients of vsdx with mxGraph one
if (Integer.parseInt(fillPattern) >= 25)
{
gradient = this.getColor(this.getCellElement(mxVsdxConstants.FILL_BKGND));
}
else
{
mxVsdxTheme theme = getTheme();
if (theme != null)
{
Color gradColor = theme.getFillGraientColor(getQuickStyleVals());
if (gradColor != null) gradient = gradColor.toHexStr();
}
}
return gradient;
}
|
String function() { String gradient = STR0"); if (Integer.parseInt(fillPattern) >= 25) { gradient = this.getColor(this.getCellElement(mxVsdxConstants.FILL_BKGND)); } else { mxVsdxTheme theme = getTheme(); if (theme != null) { Color gradColor = theme.getFillGraientColor(getQuickStyleVals()); if (gradColor != null) gradient = gradColor.toHexStr(); } } return gradient; }
|
/**
* Returns the background color for apply in the gradient.<br/>
* If no gradient must be applicated, returns an empty string.
* @return hexadecimal representation of the color.
*/
|
Returns the background color for apply in the gradient. If no gradient must be applicated, returns an empty string
|
getGradient
|
{
"repo_name": "Wangyi08/draw.io",
"path": "src/com/mxgraph/io/vsdx/VsdxShape.java",
"license": "apache-2.0",
"size": 62585
}
|
[
"com.mxgraph.io.vsdx.theme.Color"
] |
import com.mxgraph.io.vsdx.theme.Color;
|
import com.mxgraph.io.vsdx.theme.*;
|
[
"com.mxgraph.io"
] |
com.mxgraph.io;
| 1,694,306
|
@Plug
public void plug() {
toBuyFeature = Managers.getManager(IFeatureManager.class).addSubFeature(
Managers.getManager(IFeatureManager.class).getFeature(CoreFeature.ADVANCED),
"displayFilmsToBuyViewAction", FeatureType.ACTION, 1
);
Managers.getManager(IFileManager.class).registerBackupWriter(FileType.XML, xmlWriter);
Managers.getManager(IFileManager.class).registerBackupWriter(FileType.JTD, jtdWriter);
Managers.getManager(IFileManager.class).registerBackupReader(FileType.XML, xmlReader);
Managers.getManager(IFileManager.class).registerBackupReader(FileType.JTD, jtdReader);
Managers.getManager(IFileManager.class).registerBackupReader(FileType.V4, dbV4Reader);
}
|
void function() { toBuyFeature = Managers.getManager(IFeatureManager.class).addSubFeature( Managers.getManager(IFeatureManager.class).getFeature(CoreFeature.ADVANCED), STR, FeatureType.ACTION, 1 ); Managers.getManager(IFileManager.class).registerBackupWriter(FileType.XML, xmlWriter); Managers.getManager(IFileManager.class).registerBackupWriter(FileType.JTD, jtdWriter); Managers.getManager(IFileManager.class).registerBackupReader(FileType.XML, xmlReader); Managers.getManager(IFileManager.class).registerBackupReader(FileType.JTD, jtdReader); Managers.getManager(IFileManager.class).registerBackupReader(FileType.V4, dbV4Reader); }
|
/**
* Plug the module.
*/
|
Plug the module
|
plug
|
{
"repo_name": "wichtounet/jtheque-films-to-buy-module",
"path": "src/main/java/org/jtheque/filmstobuy/FilmsToBuyModule.java",
"license": "apache-2.0",
"size": 4734
}
|
[
"org.jtheque.core.managers.Managers",
"org.jtheque.core.managers.feature.Feature",
"org.jtheque.core.managers.feature.IFeatureManager",
"org.jtheque.core.managers.file.IFileManager",
"org.jtheque.core.managers.file.able.FileType"
] |
import org.jtheque.core.managers.Managers; import org.jtheque.core.managers.feature.Feature; import org.jtheque.core.managers.feature.IFeatureManager; import org.jtheque.core.managers.file.IFileManager; import org.jtheque.core.managers.file.able.FileType;
|
import org.jtheque.core.managers.*; import org.jtheque.core.managers.feature.*; import org.jtheque.core.managers.file.*; import org.jtheque.core.managers.file.able.*;
|
[
"org.jtheque.core"
] |
org.jtheque.core;
| 1,591,268
|
public void addURIEntry(String uri,
String altURI,
URL base) {
ResourceLocation entity = new ResourceLocation();
entity.setBase(base);
entity.setPublicId(uri);
entity.setLocation(altURI);
xmlCatalog.addEntity(entity);
}
|
void function(String uri, String altURI, URL base) { ResourceLocation entity = new ResourceLocation(); entity.setBase(base); entity.setPublicId(uri); entity.setLocation(altURI); xmlCatalog.addEntity(entity); }
|
/**
* <p>Add a URI catalog entry to the controlling XMLCatalog instance.
* ApacheCatalog calls this for each URI entry found in an external
* catalog file.</p>
*
* @param uri The URI of the resource
* @param altURI The URI to which the resource should be mapped
* (aka the location)
* @param base The base URL of the resource. If the altURI
* specifies a relative URL/pathname, it is resolved using the
* base. The default base for an external catalog file is the
* directory in which the catalog is located.
*
*/
|
Add a URI catalog entry to the controlling XMLCatalog instance. ApacheCatalog calls this for each URI entry found in an external catalog file
|
addURIEntry
|
{
"repo_name": "Mayo-WE01051879/mayosapp",
"path": "Build/src/main/org/apache/tools/ant/types/resolver/ApacheCatalogResolver.java",
"license": "mit",
"size": 6434
}
|
[
"org.apache.tools.ant.types.ResourceLocation"
] |
import org.apache.tools.ant.types.ResourceLocation;
|
import org.apache.tools.ant.types.*;
|
[
"org.apache.tools"
] |
org.apache.tools;
| 286,955
|
interface WithSourceIpRanges {
WithCreate withSourceIpRanges(List<QosIpRange> sourceIpRanges);
}
|
interface WithSourceIpRanges { WithCreate withSourceIpRanges(List<QosIpRange> sourceIpRanges); }
|
/**
* Specifies sourceIpRanges.
* @param sourceIpRanges Source IP ranges
* @return the next definition stage
*/
|
Specifies sourceIpRanges
|
withSourceIpRanges
|
{
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/DscpConfiguration.java",
"license": "mit",
"size": 9511
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 670,240
|
private static int getMethodModifiers(IMethodBinding type) {
int modifiers = type.getModifiers();
if (type.isVarargs()) {
modifiers |= BindingUtil.ACC_VARARGS;
}
if (type.isSynthetic()) {
modifiers |= BindingUtil.ACC_SYNTHETIC;
}
return modifiers;
}
|
static int function(IMethodBinding type) { int modifiers = type.getModifiers(); if (type.isVarargs()) { modifiers = BindingUtil.ACC_VARARGS; } if (type.isSynthetic()) { modifiers = BindingUtil.ACC_SYNTHETIC; } return modifiers; }
|
/**
* Returns the modifiers for a specified method, including internal ones.
* All method modifiers are defined in the JVM specification, table 4.5.
*/
|
Returns the modifiers for a specified method, including internal ones. All method modifiers are defined in the JVM specification, table 4.5
|
getMethodModifiers
|
{
"repo_name": "csripada/j2objc",
"path": "translator/src/main/java/com/google/devtools/j2objc/gen/MetadataGenerator.java",
"license": "apache-2.0",
"size": 10766
}
|
[
"com.google.devtools.j2objc.util.BindingUtil",
"org.eclipse.jdt.core.dom.IMethodBinding"
] |
import com.google.devtools.j2objc.util.BindingUtil; import org.eclipse.jdt.core.dom.IMethodBinding;
|
import com.google.devtools.j2objc.util.*; import org.eclipse.jdt.core.dom.*;
|
[
"com.google.devtools",
"org.eclipse.jdt"
] |
com.google.devtools; org.eclipse.jdt;
| 493,040
|
@NonNull
@CheckResult
public static <P, X extends Column<?, ?, ?, P, ?>> NumericColumn<Long, Long, Number, P, NotNullable> countDistinct(@NonNull X column) {
return new FunctionColumn<>(column.table.internalAlias(""), column, "count(DISTINCT ", ")", LONG_PARSER, false, null);
}
|
static <P, X extends Column<?, ?, ?, P, ?>> NumericColumn<Long, Long, Number, P, NotNullable> function(@NonNull X column) { return new FunctionColumn<>(column.table.internalAlias(STRcount(DISTINCT STR)", LONG_PARSER, false, null); }
|
/**
* The count(DISTINCT X) function returns the number of distinct values of column X.
*
* @param column Input of this aggregate function
* @return Column representing the result of this function
* @see <a href="http://www.sqlite.org/lang_aggfunc.html">SQLite documentation: Aggregate Functions</a>
*/
|
The count(DISTINCT X) function returns the number of distinct values of column X
|
countDistinct
|
{
"repo_name": "SiimKinks/sqlitemagic",
"path": "runtime/src/main/java/com/siimkinks/sqlitemagic/Select.java",
"license": "apache-2.0",
"size": 61233
}
|
[
"androidx.annotation.NonNull"
] |
import androidx.annotation.NonNull;
|
import androidx.annotation.*;
|
[
"androidx.annotation"
] |
androidx.annotation;
| 756,124
|
@GuardedBy("Segment.this")
<K, V> ReferenceEntry<K, V> copyEntry(
Segment<K, V> segment, ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext) {
return newEntry(segment, original.getKey(), original.getHash(), newNext);
}
|
@GuardedBy(STR) <K, V> ReferenceEntry<K, V> copyEntry( Segment<K, V> segment, ReferenceEntry<K, V> original, ReferenceEntry<K, V> newNext) { return newEntry(segment, original.getKey(), original.getHash(), newNext); }
|
/**
* Copies an entry, assigning it a new {@code next} entry.
*
* @param original the entry to copy
* @param newNext entry in the same bucket
*/
|
Copies an entry, assigning it a new next entry
|
copyEntry
|
{
"repo_name": "sensui/guava-libraries",
"path": "guava/src/com/google/common/cache/LocalCache.java",
"license": "apache-2.0",
"size": 145799
}
|
[
"javax.annotation.concurrent.GuardedBy"
] |
import javax.annotation.concurrent.GuardedBy;
|
import javax.annotation.concurrent.*;
|
[
"javax.annotation"
] |
javax.annotation;
| 990,714
|
public AnnotatedTypeBuilder<X> addToMethod(Method method, Annotation annotation)
{
if (methods.get(method) == null)
{
methods.put(method, new AnnotationBuilder());
}
methods.get(method).add(annotation);
return this;
}
|
AnnotatedTypeBuilder<X> function(Method method, Annotation annotation) { if (methods.get(method) == null) { methods.put(method, new AnnotationBuilder()); } methods.get(method).add(annotation); return this; }
|
/**
* Add an annotation to the specified method. If the method is not already
* present, it will be added.
*
* @param method the method to add the annotation to
* @param annotation the annotation to add
* @throws IllegalArgumentException if the annotation is null
*/
|
Add an annotation to the specified method. If the method is not already present, it will be added
|
addToMethod
|
{
"repo_name": "os890/DS_Discuss_old",
"path": "deltaspike/core/api/src/main/java/org/apache/deltaspike/core/api/metadata/builder/AnnotatedTypeBuilder.java",
"license": "apache-2.0",
"size": 39708
}
|
[
"java.lang.annotation.Annotation",
"java.lang.reflect.Method"
] |
import java.lang.annotation.Annotation; import java.lang.reflect.Method;
|
import java.lang.annotation.*; import java.lang.reflect.*;
|
[
"java.lang"
] |
java.lang;
| 447,111
|
public void setNullTimestamp(Timestamp nullTimestamp) {
this.nullTimestamp = nullTimestamp != null ? new Timestamp(nullTimestamp.getTime()) : null;
}
|
void function(Timestamp nullTimestamp) { this.nullTimestamp = nullTimestamp != null ? new Timestamp(nullTimestamp.getTime()) : null; }
|
/**
* Sets the value to return when a SQL null is encountered as the result of
* invoking a <code>getTimestamp</code> method.
*
* @param nullTimestamp the value
*/
|
Sets the value to return when a SQL null is encountered as the result of invoking a <code>getTimestamp</code> method
|
setNullTimestamp
|
{
"repo_name": "mohanaraosv/commons-dbutils",
"path": "src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java",
"license": "apache-2.0",
"size": 17901
}
|
[
"java.sql.Timestamp"
] |
import java.sql.Timestamp;
|
import java.sql.*;
|
[
"java.sql"
] |
java.sql;
| 258,492
|
@Test
public void testSerialization2() {
DefaultStatisticalCategoryDataset d1
= new DefaultStatisticalCategoryDataset();
d1.add(1.2, 3.4, "Row 1", "Column 1");
DefaultStatisticalCategoryDataset d2 =
(DefaultStatisticalCategoryDataset) TestUtilities.serialised(d1);
assertEquals(d1, d2);
}
private static final double EPSILON = 0.0000000001;
|
void function() { DefaultStatisticalCategoryDataset d1 = new DefaultStatisticalCategoryDataset(); d1.add(1.2, 3.4, STR, STR); DefaultStatisticalCategoryDataset d2 = (DefaultStatisticalCategoryDataset) TestUtilities.serialised(d1); assertEquals(d1, d2); } private static final double EPSILON = 0.0000000001;
|
/**
* Check serialization of a more complex instance.
*/
|
Check serialization of a more complex instance
|
testSerialization2
|
{
"repo_name": "raincs13/phd",
"path": "tests/org/jfree/data/statistics/DefaultStatisticalCategoryDatasetTest.java",
"license": "lgpl-2.1",
"size": 10005
}
|
[
"org.jfree.chart.TestUtilities",
"org.junit.Assert"
] |
import org.jfree.chart.TestUtilities; import org.junit.Assert;
|
import org.jfree.chart.*; import org.junit.*;
|
[
"org.jfree.chart",
"org.junit"
] |
org.jfree.chart; org.junit;
| 2,209,589
|
public static Matcher<EnhancedForLoopTree> enhancedForLoop(
Matcher<VariableTree> variableMatcher,
Matcher<ExpressionTree> expressionMatcher,
Matcher<StatementTree> statementMatcher) {
return (t, state) ->
variableMatcher.matches(t.getVariable(), state)
&& expressionMatcher.matches(t.getExpression(), state)
&& statementMatcher.matches(t.getStatement(), state);
}
|
static Matcher<EnhancedForLoopTree> function( Matcher<VariableTree> variableMatcher, Matcher<ExpressionTree> expressionMatcher, Matcher<StatementTree> statementMatcher) { return (t, state) -> variableMatcher.matches(t.getVariable(), state) && expressionMatcher.matches(t.getExpression(), state) && statementMatcher.matches(t.getStatement(), state); }
|
/**
* Matches an enhanced for loop if all the given matchers match.
*
* @param variableMatcher The matcher to apply to the variable.
* @param expressionMatcher The matcher to apply to the expression.
* @param statementMatcher The matcher to apply to the statement.
*/
|
Matches an enhanced for loop if all the given matchers match
|
enhancedForLoop
|
{
"repo_name": "google/error-prone",
"path": "check_api/src/main/java/com/google/errorprone/matchers/Matchers.java",
"license": "apache-2.0",
"size": 62161
}
|
[
"com.sun.source.tree.EnhancedForLoopTree",
"com.sun.source.tree.ExpressionTree",
"com.sun.source.tree.StatementTree",
"com.sun.source.tree.VariableTree"
] |
import com.sun.source.tree.EnhancedForLoopTree; import com.sun.source.tree.ExpressionTree; import com.sun.source.tree.StatementTree; import com.sun.source.tree.VariableTree;
|
import com.sun.source.tree.*;
|
[
"com.sun.source"
] |
com.sun.source;
| 56,943
|
@Override
public synchronized void afterCreateConsumer(ServerConsumer consumer) {
conditionalCreateRemoteConsumer(consumer);
}
|
synchronized void function(ServerConsumer consumer) { conditionalCreateRemoteConsumer(consumer); }
|
/**
* After a consumer has been created
*
* @param consumer the created consumer
*/
|
After a consumer has been created
|
afterCreateConsumer
|
{
"repo_name": "kjniemi/activemq-artemis",
"path": "artemis-server/src/main/java/org/apache/activemq/artemis/core/server/federation/queue/FederatedQueue.java",
"license": "apache-2.0",
"size": 9246
}
|
[
"org.apache.activemq.artemis.core.server.ServerConsumer"
] |
import org.apache.activemq.artemis.core.server.ServerConsumer;
|
import org.apache.activemq.artemis.core.server.*;
|
[
"org.apache.activemq"
] |
org.apache.activemq;
| 265,627
|
void tearDown(RtChecker checker);
|
void tearDown(RtChecker checker);
|
/**
* Finally method for every checker class
*
* @param checker Checker configuration
*/
|
Finally method for every checker class
|
tearDown
|
{
"repo_name": "vaimr/rt-checks",
"path": "src/main/java/org/rt/checks/RtCheckRunListener.java",
"license": "mit",
"size": 2269
}
|
[
"org.rt.checks.annotation.RtChecker"
] |
import org.rt.checks.annotation.RtChecker;
|
import org.rt.checks.annotation.*;
|
[
"org.rt.checks"
] |
org.rt.checks;
| 1,660,896
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.