method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void setCells(Cell[] cells) {
this.cells = cells;
} | void function(Cell[] cells) { this.cells = cells; } | /**
* Sets the flat array of cells
* @param cells
*/ | Sets the flat array of cells | setCells | {
"repo_name": "hgulcan/badr_htm",
"path": "src/main/java/org/numenta/nupic/Connections.java",
"license": "agpl-3.0",
"size": 51299
} | [
"org.numenta.nupic.model.Cell"
] | import org.numenta.nupic.model.Cell; | import org.numenta.nupic.model.*; | [
"org.numenta.nupic"
] | org.numenta.nupic; | 2,106,843 |
public static <E> ListIterator<E> unmodifiableListIterator(final ListIterator<E> listIterator) {
return UnmodifiableListIterator.umodifiableListIterator(listIterator);
} | static <E> ListIterator<E> function(final ListIterator<E> listIterator) { return UnmodifiableListIterator.umodifiableListIterator(listIterator); } | /**
* Gets an immutable version of a {@link ListIterator}. The returned object
* will always throw an {@link UnsupportedOperationException} for
* the {@link Iterator#remove}, {@link ListIterator#add} and
* {@link ListIterator#set} methods.
*
* @param <E> the element type
* @param listIterator the iterator to make immutable
* @return an immutable version of the iterator
*/ | Gets an immutable version of a <code>ListIterator</code>. The returned object will always throw an <code>UnsupportedOperationException</code> for the <code>Iterator#remove</code>, <code>ListIterator#add</code> and <code>ListIterator#set</code> methods | unmodifiableListIterator | {
"repo_name": "krivachy/compgs03_mutation_testing",
"path": "src/main/java/org/apache/commons/collections4/IteratorUtils.java",
"license": "apache-2.0",
"size": 45184
} | [
"java.util.ListIterator",
"org.apache.commons.collections4.iterators.UnmodifiableListIterator"
] | import java.util.ListIterator; import org.apache.commons.collections4.iterators.UnmodifiableListIterator; | import java.util.*; import org.apache.commons.collections4.iterators.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 1,606,789 |
public ItemStack getCraftingResult(InventoryCrafting p_77572_1_)
{
int var2 = 0;
ItemStack var3 = null;
for (int var4 = 0; var4 < p_77572_1_.getSizeInventory(); ++var4)
{
ItemStack var5 = p_77572_1_.getStackInSlot(var4);
if (var5 != null)
{
if (var5.getItem() == Items.filled_map)
{
if (var3 != null)
{
return null;
}
var3 = var5;
}
else
{
if (var5.getItem() != Items.map)
{
return null;
}
++var2;
}
}
}
if (var3 != null && var2 >= 1)
{
ItemStack var6 = new ItemStack(Items.filled_map, var2 + 1, var3.getMetadata());
if (var3.hasDisplayName())
{
var6.setStackDisplayName(var3.getDisplayName());
}
return var6;
}
else
{
return null;
}
} | ItemStack function(InventoryCrafting p_77572_1_) { int var2 = 0; ItemStack var3 = null; for (int var4 = 0; var4 < p_77572_1_.getSizeInventory(); ++var4) { ItemStack var5 = p_77572_1_.getStackInSlot(var4); if (var5 != null) { if (var5.getItem() == Items.filled_map) { if (var3 != null) { return null; } var3 = var5; } else { if (var5.getItem() != Items.map) { return null; } ++var2; } } } if (var3 != null && var2 >= 1) { ItemStack var6 = new ItemStack(Items.filled_map, var2 + 1, var3.getMetadata()); if (var3.hasDisplayName()) { var6.setStackDisplayName(var3.getDisplayName()); } return var6; } else { return null; } } | /**
* Returns an Item that is the result of this recipe
*/ | Returns an Item that is the result of this recipe | getCraftingResult | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/item/crafting/RecipesMapCloning.java",
"license": "mit",
"size": 3192
} | [
"net.minecraft.init.Items",
"net.minecraft.inventory.InventoryCrafting",
"net.minecraft.item.ItemStack"
] | import net.minecraft.init.Items; import net.minecraft.inventory.InventoryCrafting; import net.minecraft.item.ItemStack; | import net.minecraft.init.*; import net.minecraft.inventory.*; import net.minecraft.item.*; | [
"net.minecraft.init",
"net.minecraft.inventory",
"net.minecraft.item"
] | net.minecraft.init; net.minecraft.inventory; net.minecraft.item; | 1,898,575 |
public static CommonTransitions createTimeline(Image animation) {
CommonTransitions t = new CommonTransitions(TYPE_TIMELINE);
t.timeline = animation;
t.transitionType = TYPE_TIMELINE;
return t;
} | static CommonTransitions function(Image animation) { CommonTransitions t = new CommonTransitions(TYPE_TIMELINE); t.timeline = animation; t.transitionType = TYPE_TIMELINE; return t; } | /**
* Creates a transition using an animated image object (e.g. timeline object) as an
* alpha mask between the source/target
*
* @param animation the image object to execute
* @return a transition object
*/ | Creates a transition using an animated image object (e.g. timeline object) as an alpha mask between the source/target | createTimeline | {
"repo_name": "shannah/cn1",
"path": "CodenameOne/src/com/codename1/ui/animations/CommonTransitions.java",
"license": "gpl-2.0",
"size": 50343
} | [
"com.codename1.ui.Image"
] | import com.codename1.ui.Image; | import com.codename1.ui.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 644,413 |
@Override
public ImageS getNextImage() throws ImageShapeException {
// we calculate emitter count first so it corresponds with the beginning
// of the frame rather than end of the frame
emitterHistory.add(microscope.getOnEmitterCount());
ImageS pixels = microscope.simulateFrame();
stack.concatenate(pixels);
return pixels;
}
| ImageS function() throws ImageShapeException { emitterHistory.add(microscope.getOnEmitterCount()); ImageS pixels = microscope.simulateFrame(); stack.concatenate(pixels); return pixels; } | /**
* Generates a new image and adds it to the internal stack.
* @return newly generated image
*/ | Generates a new image and adds it to the internal stack | getNextImage | {
"repo_name": "MStefko/STEADIER-SAILOR",
"path": "src/main/java/ch/epfl/leb/sass/simulator/internal/DefaultSimulator.java",
"license": "gpl-3.0",
"size": 14153
} | [
"ch.epfl.leb.sass.utils.images.ImageS",
"ch.epfl.leb.sass.utils.images.ImageShapeException"
] | import ch.epfl.leb.sass.utils.images.ImageS; import ch.epfl.leb.sass.utils.images.ImageShapeException; | import ch.epfl.leb.sass.utils.images.*; | [
"ch.epfl.leb"
] | ch.epfl.leb; | 769,552 |
public synchronized @NotNull String getSourceFilePath(int tabIndex) {
// Throws exception if tabIndex is out of valid range
checkRange(tabIndex, 0, tabsData.size());
return tabsData.get(tabIndex).sourceFilePath;
} | synchronized @NotNull String function(int tabIndex) { checkRange(tabIndex, 0, tabsData.size()); return tabsData.get(tabIndex).sourceFilePath; } | /**
* Returns the source file path in the specified tab.
*
* @param tabIndex the index of the tab with source file path to return
*
* @return the source file path in the specified tab
*
* @throws IndexOutOfBoundsException if the index is out of range
* (index < 0 || index >= countTabs())
*/ | Returns the source file path in the specified tab | getSourceFilePath | {
"repo_name": "dmtolpeko/sqlines",
"path": "sqlines-studio-java/src/main/java/com/sqlines/studio/model/tabsdata/ObservableTabsData.java",
"license": "apache-2.0",
"size": 23316
} | [
"org.jetbrains.annotations.NotNull"
] | import org.jetbrains.annotations.NotNull; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 1,432 |
public boolean awaitClose(long timeout, TimeUnit timeUnit) throws InterruptedException {
return indicesService.awaitClose(timeout, timeUnit);
} | boolean function(long timeout, TimeUnit timeUnit) throws InterruptedException { return indicesService.awaitClose(timeout, timeUnit); } | /**
* Wait for the node to be effectively closed.
* @see IndicesService#awaitClose(long, TimeUnit)
*/ | Wait for the node to be effectively closed | awaitClose | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/node/NodeService.java",
"license": "apache-2.0",
"size": 7290
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 2,044,491 |
public Packet createGrayscaleImage(ByteBuffer buffer, int width, int height) {
if (width * height != buffer.capacity()) {
throw new RuntimeException(
"The size of the buffer should be: " + width * height + " but is " + buffer.capacity());
}
return Packet.create(
nativeCreateGrayscaleImage(mediapipeGraph.getNativeHandle(), buffer, width, height));
} | Packet function(ByteBuffer buffer, int width, int height) { if (width * height != buffer.capacity()) { throw new RuntimeException( STR + width * height + STR + buffer.capacity()); } return Packet.create( nativeCreateGrayscaleImage(mediapipeGraph.getNativeHandle(), buffer, width, height)); } | /**
* Creates a 1 channel ImageFrame packet from an U8 buffer.
*
* <p>Use {@link ByteBuffer#allocateDirect} when allocating the buffer.
*/ | Creates a 1 channel ImageFrame packet from an U8 buffer. Use <code>ByteBuffer#allocateDirect</code> when allocating the buffer | createGrayscaleImage | {
"repo_name": "google/mediapipe",
"path": "mediapipe/java/com/google/mediapipe/framework/PacketCreator.java",
"license": "apache-2.0",
"size": 17320
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,245,823 |
protected void onBarrier(int channelIndex) throws IOException {
if (!blockedChannels[channelIndex]) {
blockedChannels[channelIndex] = true;
numBarriersReceived++;
if (LOG.isDebugEnabled()) {
LOG.debug("{}: Received barrier from channel {}.", taskName, channelIndex);
}
}
else {
throw new IOException("Stream corrupt: Repeated barrier for same checkpoint on input " + channelIndex);
}
} | void function(int channelIndex) throws IOException { if (!blockedChannels[channelIndex]) { blockedChannels[channelIndex] = true; numBarriersReceived++; if (LOG.isDebugEnabled()) { LOG.debug(STR, taskName, channelIndex); } } else { throw new IOException(STR + channelIndex); } } | /**
* Blocks the given channel index, from which a barrier has been received.
*
* @param channelIndex The channel index to block.
*/ | Blocks the given channel index, from which a barrier has been received | onBarrier | {
"repo_name": "bowenli86/flink",
"path": "flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/io/CheckpointBarrierAligner.java",
"license": "apache-2.0",
"size": 10739
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 113,275 |
@Override
public MultiLevelImage createImage(final Mask mask) {
return VectorDataMultiLevelImage.createMask(getVectorData(mask), mask);
} | MultiLevelImage function(final Mask mask) { return VectorDataMultiLevelImage.createMask(getVectorData(mask), mask); } | /**
* Creates the image.
*
* @param mask The mask which requests creation of its image.
*
* @return The image.
*/ | Creates the image | createImage | {
"repo_name": "arraydev/snap-engine",
"path": "snap-core/src/main/java/org/esa/snap/framework/datamodel/Mask.java",
"license": "gpl-3.0",
"size": 25078
} | [
"com.bc.ceres.glevel.MultiLevelImage"
] | import com.bc.ceres.glevel.MultiLevelImage; | import com.bc.ceres.glevel.*; | [
"com.bc.ceres"
] | com.bc.ceres; | 2,755,625 |
public static DateTime convertDateToDateTime(Date date) {
// Get year, javaMonth, date
Calendar calendar = Calendar.getInstance();
calendar.clear();
calendar.setTime(date);
int year = calendar.get(Calendar.YEAR);
int javaMonth = calendar.get(Calendar.MONTH);
int day = calendar.get(Calendar.DATE);
// javaMonth start at 0. Need to plus 1 to get datetimeMonth
return new DateTime(year, javaMonth + 1, day, 0, 0, 0, 0);
} | static DateTime function(Date date) { Calendar calendar = Calendar.getInstance(); calendar.clear(); calendar.setTime(date); int year = calendar.get(Calendar.YEAR); int javaMonth = calendar.get(Calendar.MONTH); int day = calendar.get(Calendar.DATE); return new DateTime(year, javaMonth + 1, day, 0, 0, 0, 0); } | /**
* Get the DateTime from Date, with hour and min is 0
*
* @param date
* @return
*/ | Get the DateTime from Date, with hour and min is 0 | convertDateToDateTime | {
"repo_name": "benoitletondor/EasyBudget",
"path": "Android/EasyBudget/caldroid/src/main/java/com/roomorama/caldroid/CalendarHelper.java",
"license": "apache-2.0",
"size": 5856
} | [
"java.util.Calendar",
"java.util.Date"
] | import java.util.Calendar; import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 827,812 |
@Test
@SuppressWarnings("unchecked")
public void testValueStateNullUpdate() throws Exception {
// precondition: LongSerializer must fail on null value. this way the test would fail
// later if null values where actually stored in the state instead of acting as clear()
try {
LongSerializer.INSTANCE.serialize(null,
new DataOutputViewStreamWrapper(new ByteArrayOutputStream()));
fail("Should fail with NullPointerException");
} catch (NullPointerException e) {
// alrighty
}
CheckpointStreamFactory streamFactory = createStreamFactory();
AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE);
ValueStateDescriptor<Long> kvId = new ValueStateDescriptor<>("id", LongSerializer.INSTANCE, 42L);
ValueState<Long> state = backend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, kvId);
// some modifications to the state
backend.setCurrentKey(1);
// verify default value
assertEquals(42L, (long) state.value());
state.update(1L);
assertEquals(1L, (long) state.value());
backend.setCurrentKey(2);
assertEquals(42L, (long) state.value());
backend.setCurrentKey(1);
state.clear();
assertEquals(42L, (long) state.value());
state.update(17L);
assertEquals(17L, (long) state.value());
state.update(null);
assertEquals(42L, (long) state.value());
// draw a snapshot
KeyedStateHandle snapshot1 = FutureUtil.runIfNotDoneAndGet(backend.snapshot(682375462378L, 2, streamFactory, CheckpointOptions.forFullCheckpoint()));
backend.dispose();
backend = restoreKeyedBackend(IntSerializer.INSTANCE, snapshot1);
snapshot1.discardState();
backend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, kvId);
backend.dispose();
} | @SuppressWarnings(STR) void function() throws Exception { try { LongSerializer.INSTANCE.serialize(null, new DataOutputViewStreamWrapper(new ByteArrayOutputStream())); fail(STR); } catch (NullPointerException e) { } CheckpointStreamFactory streamFactory = createStreamFactory(); AbstractKeyedStateBackend<Integer> backend = createKeyedBackend(IntSerializer.INSTANCE); ValueStateDescriptor<Long> kvId = new ValueStateDescriptor<>("id", LongSerializer.INSTANCE, 42L); ValueState<Long> state = backend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, kvId); backend.setCurrentKey(1); assertEquals(42L, (long) state.value()); state.update(1L); assertEquals(1L, (long) state.value()); backend.setCurrentKey(2); assertEquals(42L, (long) state.value()); backend.setCurrentKey(1); state.clear(); assertEquals(42L, (long) state.value()); state.update(17L); assertEquals(17L, (long) state.value()); state.update(null); assertEquals(42L, (long) state.value()); KeyedStateHandle snapshot1 = FutureUtil.runIfNotDoneAndGet(backend.snapshot(682375462378L, 2, streamFactory, CheckpointOptions.forFullCheckpoint())); backend.dispose(); backend = restoreKeyedBackend(IntSerializer.INSTANCE, snapshot1); snapshot1.discardState(); backend.getPartitionedState(VoidNamespace.INSTANCE, VoidNamespaceSerializer.INSTANCE, kvId); backend.dispose(); } | /**
* This test verifies that passing {@code null} to {@link ValueState#update(Object)} acts
* the same as {@link ValueState#clear()}.
*
* @throws Exception
*/ | This test verifies that passing null to <code>ValueState#update(Object)</code> acts the same as <code>ValueState#clear()</code> | testValueStateNullUpdate | {
"repo_name": "zohar-mizrahi/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/state/StateBackendTestBase.java",
"license": "apache-2.0",
"size": 101791
} | [
"org.apache.commons.io.output.ByteArrayOutputStream",
"org.apache.flink.api.common.state.ValueState",
"org.apache.flink.api.common.state.ValueStateDescriptor",
"org.apache.flink.api.common.typeutils.base.IntSerializer",
"org.apache.flink.api.common.typeutils.base.LongSerializer",
"org.apache.flink.core.memory.DataOutputViewStreamWrapper",
"org.apache.flink.runtime.checkpoint.CheckpointOptions",
"org.apache.flink.util.FutureUtil",
"org.junit.Assert"
] | import org.apache.commons.io.output.ByteArrayOutputStream; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeutils.base.IntSerializer; import org.apache.flink.api.common.typeutils.base.LongSerializer; import org.apache.flink.core.memory.DataOutputViewStreamWrapper; import org.apache.flink.runtime.checkpoint.CheckpointOptions; import org.apache.flink.util.FutureUtil; import org.junit.Assert; | import org.apache.commons.io.output.*; import org.apache.flink.api.common.state.*; import org.apache.flink.api.common.typeutils.base.*; import org.apache.flink.core.memory.*; import org.apache.flink.runtime.checkpoint.*; import org.apache.flink.util.*; import org.junit.*; | [
"org.apache.commons",
"org.apache.flink",
"org.junit"
] | org.apache.commons; org.apache.flink; org.junit; | 2,887,727 |
void addAll(Iterator<? extends Statement> statement)
throws ModelRuntimeException;
| void addAll(Iterator<? extends Statement> statement) throws ModelRuntimeException; | /**
* For each statement in the iterator, this method creates a Model named
* statement.getContextURI if needed. Then the statement (s,p,o) is inserted
* into that model.
*
* @param statement
* @throws ModelRuntimeException
* if any internal (I/O related) exception occurs
*/ | For each statement in the iterator, this method creates a Model named statement.getContextURI if needed. Then the statement (s,p,o) is inserted into that model | addAll | {
"repo_name": "semweb4j/semweb4j",
"path": "org.semweb4j.rdf2go.api/src/main/java/org/ontoware/rdf2go/model/ModelSetAddRemove.java",
"license": "bsd-2-clause",
"size": 5676
} | [
"java.util.Iterator",
"org.ontoware.rdf2go.exception.ModelRuntimeException"
] | import java.util.Iterator; import org.ontoware.rdf2go.exception.ModelRuntimeException; | import java.util.*; import org.ontoware.rdf2go.exception.*; | [
"java.util",
"org.ontoware.rdf2go"
] | java.util; org.ontoware.rdf2go; | 732,564 |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
if (choiceLimits.length != choiceFormats.length) {
throw new InvalidObjectException(
"limits and format arrays of different length.");
}
}
// ===============privates===========================
private double[] choiceLimits;
private String[] choiceFormats;
static final long SIGN = 0x8000000000000000L;
static final long EXPONENT = 0x7FF0000000000000L;
static final long POSITIVEINFINITY = 0x7FF0000000000000L; | void function(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); if (choiceLimits.length != choiceFormats.length) { throw new InvalidObjectException( STR); } } private double[] choiceLimits; private String[] choiceFormats; static final long SIGN = 0x8000000000000000L; static final long EXPONENT = 0x7FF0000000000000L; static final long POSITIVEINFINITY = 0x7FF0000000000000L; | /**
* After reading an object from the input stream, do a simple verification
* to maintain class invariants.
* @throws InvalidObjectException if the objects read from the stream is invalid.
*/ | After reading an object from the input stream, do a simple verification to maintain class invariants | readObject | {
"repo_name": "openjdk/jdk7u",
"path": "jdk/src/share/classes/java/text/ChoiceFormat.java",
"license": "gpl-2.0",
"size": 23840
} | [
"java.io.IOException",
"java.io.InvalidObjectException",
"java.io.ObjectInputStream"
] | import java.io.IOException; import java.io.InvalidObjectException; import java.io.ObjectInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,224,387 |
public void writeExternal( ObjectOutput out )
throws IOException
{
out.writeObject( _comparator );
//serializer is not persistent from 2.0
// out.writeObject( _keySerializer );
// out.writeObject( _valueSerializer );
out.writeInt( _height );
out.writeLong( _root );
out.writeInt( _pageSize );
out.writeInt( _entries );
}
static class EmptyBrowser<K,V>
implements TupleBrowser<K,V> {
@SuppressWarnings("unchecked")
static TupleBrowser INSTANCE = new EmptyBrowser();
private EmptyBrowser(){} | void function( ObjectOutput out ) throws IOException { out.writeObject( _comparator ); out.writeInt( _height ); out.writeLong( _root ); out.writeInt( _pageSize ); out.writeInt( _entries ); } static class EmptyBrowser<K,V> implements TupleBrowser<K,V> { @SuppressWarnings(STR) static TupleBrowser INSTANCE = new EmptyBrowser(); private EmptyBrowser(){} | /**
* Implement Externalizable interface.
*/ | Implement Externalizable interface | writeExternal | {
"repo_name": "fusesource/jdbm",
"path": "src/main/jdbm/btree/BTree.java",
"license": "apache-2.0",
"size": 20431
} | [
"java.io.IOException",
"java.io.ObjectOutput",
"jdbm.helper.TupleBrowser"
] | import java.io.IOException; import java.io.ObjectOutput; import jdbm.helper.TupleBrowser; | import java.io.*; import jdbm.helper.*; | [
"java.io",
"jdbm.helper"
] | java.io; jdbm.helper; | 1,255,161 |
private void updateRefPointTimestamp() {
if (!mTriggerTimestampUpdateNow && haveValidRefPoint()
&& elapsedNsec(mLastTimestampUpdateNsec) <= TIMESTAMP_UPDATE_PERIOD) {
// not time for an update yet
return;
}
long newNanoTimeAtFramePos0 = getNewFramePos0Timestamp();
if (newNanoTimeAtFramePos0 == NO_TIMESTAMP) {
return; // no timestamp available
}
long prevRefNanoTimeAtFramePos0 = mRefNanoTimeAtFramePos0;
switch (mReferenceTimestampState) {
case ReferenceTimestampState.STARTING_UP:
// The Audiotrack produces a few timestamps at the beginning of time that are widely
// inaccurate. Hence, we require several stable timestamps before setting a
// reference point.
if (!isTimestampStable(newNanoTimeAtFramePos0)) {
return;
}
// First stable timestamp.
mRefNanoTimeAtFramePos0 = prevRefNanoTimeAtFramePos0 = newNanoTimeAtFramePos0;
mReferenceTimestampState = ReferenceTimestampState.STABLE;
Log.i(mTag,
"First stable timestamp [" + mTimestampStabilityCounter + "/"
+ elapsedNsec(mTimestampStabilityStartTimeNsec) / 1000000 + "ms]");
break;
case ReferenceTimestampState.RESYNCING_AFTER_PAUSE:
// fall-through
case ReferenceTimestampState.RESYNCING_AFTER_EXCESSIVE_TIMESTAMP_DRIFT:
// fall-through
case ReferenceTimestampState.RESYNCING_AFTER_UNDERRUN:
// Resyncing happens after we hit a pause, underrun or excessive drift in the
// AudioTrack. This causes the Android Audio stack to insert additional samples,
// which increases the reference timestamp (at framePosition=0) by thousands of
// usecs. Hence we need to find a new initial reference timestamp. Unfortunately,
// even though the underrun already happened, the timestamps returned by the
// AudioTrack may still be located *before* the underrun, and there is no way to
// query the AudioTrack about at which framePosition the underrun occurred and where
// and how much additional data was inserted.
//
// At this point we just do the same as when in STARTING_UP, but eventually there
// should be a more refined way to figure out when the timestamps returned from the
// AudioTrack are usable again.
if (!isTimestampStable(newNanoTimeAtFramePos0)) {
return;
}
// Found a new stable timestamp.
mRefNanoTimeAtFramePos0 = newNanoTimeAtFramePos0;
mReferenceTimestampState = ReferenceTimestampState.STABLE;
Log.i(mTag,
"New stable timestamp after pause, underrun or excessive drift ["
+ mTimestampStabilityCounter + "/"
+ elapsedNsec(mTimestampStabilityStartTimeNsec) / 1000000 + "ms]");
break;
case ReferenceTimestampState.STABLE:
// Timestamps can be jittery, and on some systems they are occasionally off by
// hundreds of usecs. Filter out timestamps that are too jittery and use a low-pass
// filter on the smaller ones.
// Note that the low-pass filter approach does not work well when the media clock
// rate does not match the system clock rate, and the timestamp drifts as a result.
// Currently none of the devices using this code do this.
long devNsec = mRefNanoTimeAtFramePos0 - newNanoTimeAtFramePos0;
if (Math.abs(devNsec) > TSTAMP_DEV_THRESHOLD_TO_IGNORE_NSEC) {
mTStampJitterWarningLog.log(
mTag, "Too jittery timestamp (" + convertNsecsToUsecs(devNsec) + ")");
long timeSinceLastGoodTstamp = elapsedNsec(mLastTimestampUpdateNsec);
if (timeSinceLastGoodTstamp <= MAX_TIME_IGNORING_TSTAMPS_NSECS) {
return; // Ignore this one.
}
// We ignored jittery timestamps for too long, restart sync logic.
Log.i(mTag, "Too many jittery timestamps ignored!");
mLastTimestampUpdateNsec = NO_TIMESTAMP;
mTimestampStabilityCounter = 0;
mReferenceTimestampState =
ReferenceTimestampState.RESYNCING_AFTER_EXCESSIVE_TIMESTAMP_DRIFT;
}
// Low-pass filter: 0.10*New + 0.90*Ref. Do integer math with proper rounding.
mRefNanoTimeAtFramePos0 =
(10 * newNanoTimeAtFramePos0 + 90 * mRefNanoTimeAtFramePos0 + 50) / 100;
break;
}
// Got a new value.
if (DEBUG_LEVEL >= 1) {
long dev1 = convertNsecsToUsecs(prevRefNanoTimeAtFramePos0 - newNanoTimeAtFramePos0);
long dev2 = convertNsecsToUsecs(prevRefNanoTimeAtFramePos0 - mRefNanoTimeAtFramePos0);
Log.i(mTag,
"Updated mRefNanoTimeAtFramePos0=" + mRefNanoTimeAtFramePos0 / 1000 + " us ("
+ dev1 + "/" + dev2 + ")");
}
mLastTimestampUpdateNsec = System.nanoTime();
mTriggerTimestampUpdateNow = false;
} | void function() { if (!mTriggerTimestampUpdateNow && haveValidRefPoint() && elapsedNsec(mLastTimestampUpdateNsec) <= TIMESTAMP_UPDATE_PERIOD) { return; } long newNanoTimeAtFramePos0 = getNewFramePos0Timestamp(); if (newNanoTimeAtFramePos0 == NO_TIMESTAMP) { return; } long prevRefNanoTimeAtFramePos0 = mRefNanoTimeAtFramePos0; switch (mReferenceTimestampState) { case ReferenceTimestampState.STARTING_UP: if (!isTimestampStable(newNanoTimeAtFramePos0)) { return; } mRefNanoTimeAtFramePos0 = prevRefNanoTimeAtFramePos0 = newNanoTimeAtFramePos0; mReferenceTimestampState = ReferenceTimestampState.STABLE; Log.i(mTag, STR + mTimestampStabilityCounter + "/" + elapsedNsec(mTimestampStabilityStartTimeNsec) / 1000000 + "ms]"); break; case ReferenceTimestampState.RESYNCING_AFTER_PAUSE: case ReferenceTimestampState.RESYNCING_AFTER_EXCESSIVE_TIMESTAMP_DRIFT: case ReferenceTimestampState.RESYNCING_AFTER_UNDERRUN: if (!isTimestampStable(newNanoTimeAtFramePos0)) { return; } mRefNanoTimeAtFramePos0 = newNanoTimeAtFramePos0; mReferenceTimestampState = ReferenceTimestampState.STABLE; Log.i(mTag, STR + mTimestampStabilityCounter + "/" + elapsedNsec(mTimestampStabilityStartTimeNsec) / 1000000 + "ms]"); break; case ReferenceTimestampState.STABLE: long devNsec = mRefNanoTimeAtFramePos0 - newNanoTimeAtFramePos0; if (Math.abs(devNsec) > TSTAMP_DEV_THRESHOLD_TO_IGNORE_NSEC) { mTStampJitterWarningLog.log( mTag, STR + convertNsecsToUsecs(devNsec) + ")"); long timeSinceLastGoodTstamp = elapsedNsec(mLastTimestampUpdateNsec); if (timeSinceLastGoodTstamp <= MAX_TIME_IGNORING_TSTAMPS_NSECS) { return; } Log.i(mTag, STR); mLastTimestampUpdateNsec = NO_TIMESTAMP; mTimestampStabilityCounter = 0; mReferenceTimestampState = ReferenceTimestampState.RESYNCING_AFTER_EXCESSIVE_TIMESTAMP_DRIFT; } mRefNanoTimeAtFramePos0 = (10 * newNanoTimeAtFramePos0 + 90 * mRefNanoTimeAtFramePos0 + 50) / 100; break; } if (DEBUG_LEVEL >= 1) { long dev1 = convertNsecsToUsecs(prevRefNanoTimeAtFramePos0 - newNanoTimeAtFramePos0); long dev2 = convertNsecsToUsecs(prevRefNanoTimeAtFramePos0 - mRefNanoTimeAtFramePos0); Log.i(mTag, STR + mRefNanoTimeAtFramePos0 / 1000 + STR + dev1 + "/" + dev2 + ")"); } mLastTimestampUpdateNsec = System.nanoTime(); mTriggerTimestampUpdateNow = false; } | /**
* Update the reference timestamp used for interpolation.
*/ | Update the reference timestamp used for interpolation | updateRefPointTimestamp | {
"repo_name": "chromium/chromium",
"path": "chromecast/media/cma/backend/android/java/src/org/chromium/chromecast/cma/backend/android/AudioSinkAudioTrackImpl.java",
"license": "bsd-3-clause",
"size": 36295
} | [
"org.chromium.base.Log"
] | import org.chromium.base.Log; | import org.chromium.base.*; | [
"org.chromium.base"
] | org.chromium.base; | 1,681,360 |
public void writePacketData(PacketBuffer data) throws IOException
{
data.writeBlockPos(this.field_179725_b);
data.writeByte(this.placedBlockDirection);
data.writeItemStackToBuffer(this.stack);
data.writeByte((int)(this.facingX * 16.0F));
data.writeByte((int)(this.facingY * 16.0F));
data.writeByte((int)(this.facingZ * 16.0F));
} | void function(PacketBuffer data) throws IOException { data.writeBlockPos(this.field_179725_b); data.writeByte(this.placedBlockDirection); data.writeItemStackToBuffer(this.stack); data.writeByte((int)(this.facingX * 16.0F)); data.writeByte((int)(this.facingY * 16.0F)); data.writeByte((int)(this.facingZ * 16.0F)); } | /**
* Writes the raw packet data to the data stream.
*/ | Writes the raw packet data to the data stream | writePacketData | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java",
"license": "mit",
"size": 3424
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; | import java.io.*; import net.minecraft.network.*; | [
"java.io",
"net.minecraft.network"
] | java.io; net.minecraft.network; | 1,805,684 |
public Context getInitialContext(Hashtable env)
{
Log.debug("InitialContextFactory.getInitialContext()");
Context ctx = new localContextRoot(env);
if(Log.isDebugEnabled())Log.debug("Created initial context delegate for local namespace:"+ctx);
return ctx;
} | Context function(Hashtable env) { Log.debug(STR); Context ctx = new localContextRoot(env); if(Log.isDebugEnabled())Log.debug(STR+ctx); return ctx; } | /**
* Get Context that has access to default Namespace.
* This method won't be called if a name URL beginning
* with java: is passed to an InitialContext.
*
* @see org.mortbay.naming.java.javaURLContextFactory
* @param env a <code>Hashtable</code> value
* @return a <code>Context</code> value
*/ | Get Context that has access to default Namespace. This method won't be called if a name URL beginning with java: is passed to an InitialContext | getInitialContext | {
"repo_name": "napcs/qedserver",
"path": "jetty/modules/naming/src/main/java/org/mortbay/naming/InitialContextFactory.java",
"license": "mit",
"size": 2774
} | [
"java.util.Hashtable",
"javax.naming.Context",
"org.mortbay.log.Log",
"org.mortbay.naming.local.localContextRoot"
] | import java.util.Hashtable; import javax.naming.Context; import org.mortbay.log.Log; import org.mortbay.naming.local.localContextRoot; | import java.util.*; import javax.naming.*; import org.mortbay.log.*; import org.mortbay.naming.local.*; | [
"java.util",
"javax.naming",
"org.mortbay.log",
"org.mortbay.naming"
] | java.util; javax.naming; org.mortbay.log; org.mortbay.naming; | 1,969,284 |
@Override
public float getProgress()
throws IOException, InterruptedException
{
return isFinished ? 1 : 0;
} | float function() throws IOException, InterruptedException { return isFinished ? 1 : 0; } | /**
* Rather than calculating progress, we just keep it simple
*/ | Rather than calculating progress, we just keep it simple | getProgress | {
"repo_name": "cotdp/com-cotdp-hadoop",
"path": "src/main/java/com/cotdp/hadoop/ZipFileRecordReader.java",
"license": "apache-2.0",
"size": 5183
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 727,551 |
public static boolean isTargetRectInFrameRect(@NonNull Rect target, @NonNull Rect frame) {
// parent
float x11 = frame.left;
float y11 = frame.top;
float x12 = frame.left + frame.right;
float y12 = frame.top + frame.bottom;
// child
float x21 = target.left;
float y21 = target.top;
float x22 = target.left + target.right;
float y22 = target.top + target.bottom;
// overlaps
float overlap_x = Math.max(0, Math.min(x12, x22)) - Math.max(x11, x21);
float overlap_y = Math.max(0, Math.min(y12, y22)) - Math.max(y11, y21);
float overlap = overlap_x * overlap_y;
// child area
float barea = target.right * target.bottom;
// threshold
float threshold = barea / 2.0f;
return overlap > threshold;
} | static boolean function(@NonNull Rect target, @NonNull Rect frame) { float x11 = frame.left; float y11 = frame.top; float x12 = frame.left + frame.right; float y12 = frame.top + frame.bottom; float x21 = target.left; float y21 = target.top; float x22 = target.left + target.right; float y22 = target.top + target.bottom; float overlap_x = Math.max(0, Math.min(x12, x22)) - Math.max(x11, x21); float overlap_y = Math.max(0, Math.min(y12, y22)) - Math.max(y11, y21); float overlap = overlap_x * overlap_y; float barea = target.right * target.bottom; float threshold = barea / 2.0f; return overlap > threshold; } | /**
* Function that checks to see if a target rect is inside a frame rect
*
* @param target the child target
* @param frame the parent frame
* @return true or false
*/ | Function that checks to see if a target rect is inside a frame rect | isTargetRectInFrameRect | {
"repo_name": "SuperAwesomeLTD/sa-mobile-sdk-android",
"path": "superawesome-base/src/main/java/tv/superawesome/lib/sautils/SAUtils.java",
"license": "lgpl-3.0",
"size": 18852
} | [
"android.graphics.Rect",
"androidx.annotation.NonNull"
] | import android.graphics.Rect; import androidx.annotation.NonNull; | import android.graphics.*; import androidx.annotation.*; | [
"android.graphics",
"androidx.annotation"
] | android.graphics; androidx.annotation; | 2,905,058 |
@Override
public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs,
String sortOrder) {
// Here's the switch statement that, given a URI, will determine what kind of request it is,
// and query the database accordingly.
Cursor retCursor;
switch (sUriMatcher.match(uri)) {
// "target"
case TARGET: {
retCursor = mOpenHelper.getReadableDatabase().query(
ScoreContract.TargetEntry.TABLE_NAME,
projection, selection, selectionArgs, null, null, sortOrder
);
break;
}
case SCORE: {
retCursor = mOpenHelper.getReadableDatabase().query(
ScoreContract.ScoreEntry.TABLE_NAME,
projection, selection, selectionArgs, null, null, sortOrder
);
break;
}
default:
throw new UnsupportedOperationException("Unknown uri: " + uri);
}
// Register content observer
retCursor.setNotificationUri(getContext().getContentResolver(), uri);
return retCursor;
} | Cursor function(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { Cursor retCursor; switch (sUriMatcher.match(uri)) { case TARGET: { retCursor = mOpenHelper.getReadableDatabase().query( ScoreContract.TargetEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder ); break; } case SCORE: { retCursor = mOpenHelper.getReadableDatabase().query( ScoreContract.ScoreEntry.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder ); break; } default: throw new UnsupportedOperationException(STR + uri); } retCursor.setNotificationUri(getContext().getContentResolver(), uri); return retCursor; } | /**
* Opens a query against the weather or location table using the given selection.
* @param uri uri
* @param projection columns for result
* @param selection columns for where clause
* @param selectionArgs values for where clause
* @param sortOrder order of the result
* @return A cursor to the selected weather or location data.
*/ | Opens a query against the weather or location table using the given selection | query | {
"repo_name": "kherb64/IPSCScorer",
"path": "app/src/main/java/kherb64/android/ipscscorer/data/ScoreProvider.java",
"license": "mit",
"size": 8038
} | [
"android.database.Cursor",
"android.net.Uri"
] | import android.database.Cursor; import android.net.Uri; | import android.database.*; import android.net.*; | [
"android.database",
"android.net"
] | android.database; android.net; | 1,338,720 |
private void verifyFailure(String wsdlLocation, String catalogFile) {
URL url = getURLFromLocation(wsdlLocation);
try{
OASISCatalogManager catalogManager = new OASISCatalogManager();
catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString());
WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false, 0);
w4j.getDefinition();
fail("Should have received a WSDLException due to the invalid WSDL location "
+ "not redirected by the catalog.");
} catch(WSDLException e) {
// do nothing - successful test case
} catch(Exception e){
e.printStackTrace();
fail();
}
}
| void function(String wsdlLocation, String catalogFile) { URL url = getURLFromLocation(wsdlLocation); try{ OASISCatalogManager catalogManager = new OASISCatalogManager(); catalogManager.setCatalogFiles(getURLFromLocation(catalogFile).toString()); WSDL4JWrapper w4j = new WSDL4JWrapper(url, catalogManager, false, 0); w4j.getDefinition(); fail(STR + STR); } catch(WSDLException e) { } catch(Exception e){ e.printStackTrace(); fail(); } } | /**
* Ensure that the test case is valid by failing in the absence of a needed
* catalog entry.
*/ | Ensure that the test case is valid by failing in the absence of a needed catalog entry | verifyFailure | {
"repo_name": "apache/axis2-java",
"path": "modules/jaxws/test/org/apache/axis2/jaxws/catalog/MultiRedirectionCatalogTest.java",
"license": "apache-2.0",
"size": 5110
} | [
"javax.wsdl.WSDLException",
"org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager",
"org.apache.axis2.jaxws.util.WSDL4JWrapper"
] | import javax.wsdl.WSDLException; import org.apache.axis2.jaxws.catalog.impl.OASISCatalogManager; import org.apache.axis2.jaxws.util.WSDL4JWrapper; | import javax.wsdl.*; import org.apache.axis2.jaxws.catalog.impl.*; import org.apache.axis2.jaxws.util.*; | [
"javax.wsdl",
"org.apache.axis2"
] | javax.wsdl; org.apache.axis2; | 151,369 |
void registerVocabulary(Vocabulary vocabulary);
| void registerVocabulary(Vocabulary vocabulary); | /**
* Registers the specified vocabulary with this registry.
*
* @param vocabulary the vocabulary to register.
* @throws IllegalArgumentException if given {@code vocabulary} is {@code null}.
* @throws IllegalStateException if given {@code vocabulary} is already registered.
*/ | Registers the specified vocabulary with this registry | registerVocabulary | {
"repo_name": "i49/pulp",
"path": "pulp-api/src/main/java/com/github/i49/pulp/api/metadata/TermRegistry.java",
"license": "apache-2.0",
"size": 6402
} | [
"com.github.i49.pulp.api.vocabularies.Vocabulary"
] | import com.github.i49.pulp.api.vocabularies.Vocabulary; | import com.github.i49.pulp.api.vocabularies.*; | [
"com.github.i49"
] | com.github.i49; | 490,052 |
public void onRefresh(final PullToRefreshBase<V> refreshView);
}
public static interface OnRefreshListener2<V extends View> {
// TODO These methods need renaming to START/END rather than DOWN/UP | void function(final PullToRefreshBase<V> refreshView); } public static interface OnRefreshListener2<V extends View> { | /**
* onRefresh will be called for both a Pull from start, and Pull from
* end
*/ | onRefresh will be called for both a Pull from start, and Pull from end | onRefresh | {
"repo_name": "BarryLiu/MyAndroid",
"path": "Weather/src/com/juhe/weather/swiperefresh/PullToRefreshBase.java",
"license": "epl-1.0",
"size": 46785
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 54,208 |
public Fact evaluate(Pattern pattern) {
return
preEvaluate(pattern).
evaluating(pattern).
postEvaluate(pattern);
} | Fact function(Pattern pattern) { return preEvaluate(pattern). evaluating(pattern). postEvaluate(pattern); } | /**
* <code>evaluate</code> the pattern and return callee.
* function <code>evaluate</code> will run those functions, <code>preEvaluate</code>,
* <code>evaluating</code> and <code>postEvaluate</code>.
* @param pattern the pattern be evaluated.
* @return the instance of callee.
*/ | <code>evaluate</code> the pattern and return callee. function <code>evaluate</code> will run those functions, <code>preEvaluate</code>, <code>evaluating</code> and <code>postEvaluate</code> | evaluate | {
"repo_name": "yetisno/RuleEngine",
"path": "RuleEngineCore/src/main/java/org/yetiz/service/rulengine/core/fact/Fact.java",
"license": "mit",
"size": 2299
} | [
"org.yetiz.service.rulengine.core.pattern.Pattern"
] | import org.yetiz.service.rulengine.core.pattern.Pattern; | import org.yetiz.service.rulengine.core.pattern.*; | [
"org.yetiz.service"
] | org.yetiz.service; | 2,149,267 |
public YieldAndDiscountCurve getCurve(final String name) {
for (final Entry<String, YieldAndDiscountCurve> entry : _issuerCurvesNames.entrySet()) {
if (entry.getKey().equals(name)) {
return entry.getValue();
}
}
throw new IllegalArgumentException("Could not get curve for " + name);
} | YieldAndDiscountCurve function(final String name) { for (final Entry<String, YieldAndDiscountCurve> entry : _issuerCurvesNames.entrySet()) { if (entry.getKey().equals(name)) { return entry.getValue(); } } throw new IllegalArgumentException(STR + name); } | /**
* Gets the curve(with a name) for an issuer .
* @param name The name
* @return The curve, null if not found
*/ | Gets the curve(with a name) for an issuer | getCurve | {
"repo_name": "jeorme/OG-Platform",
"path": "projects/OG-Analytics/src/main/java/com/opengamma/analytics/financial/provider/description/inflation/InflationIssuerProviderDiscount.java",
"license": "apache-2.0",
"size": 24111
} | [
"com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve",
"java.util.Map"
] | import com.opengamma.analytics.financial.model.interestrate.curve.YieldAndDiscountCurve; import java.util.Map; | import com.opengamma.analytics.financial.model.interestrate.curve.*; import java.util.*; | [
"com.opengamma.analytics",
"java.util"
] | com.opengamma.analytics; java.util; | 149,654 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<IntegrationAccountSchemaInner> getWithResponse(
String resourceGroupName, String integrationAccountName, String schemaName, Context context) {
return getWithResponseAsync(resourceGroupName, integrationAccountName, schemaName, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<IntegrationAccountSchemaInner> function( String resourceGroupName, String integrationAccountName, String schemaName, Context context) { return getWithResponseAsync(resourceGroupName, integrationAccountName, schemaName, context).block(); } | /**
* Gets an integration account schema.
*
* @param resourceGroupName The resource group name.
* @param integrationAccountName The integration account name.
* @param schemaName The integration account schema name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an integration account schema.
*/ | Gets an integration account schema | getWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/logic/azure-resourcemanager-logic/src/main/java/com/azure/resourcemanager/logic/implementation/IntegrationAccountSchemasClientImpl.java",
"license": "mit",
"size": 56746
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.logic.fluent.models.IntegrationAccountSchemaInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.logic.fluent.models.IntegrationAccountSchemaInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.logic.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,444,726 |
public void drawGlyphVector(GlyphVector gv, float x, float y)
{
out.println("% drawGlyphVector");
Shape s = gv.getOutline();
drawStringShape(AffineTransform.getTranslateInstance(x, y)
.createTransformedShape(s));
} | void function(GlyphVector gv, float x, float y) { out.println(STR); Shape s = gv.getOutline(); drawStringShape(AffineTransform.getTranslateInstance(x, y) .createTransformedShape(s)); } | /** Renders the text of the specified GlyphVector using the
Graphics2D context's rendering attributes. */ | Renders the text of the specified GlyphVector using the | drawGlyphVector | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/gnu/java/awt/print/PostScriptGraphics2D.java",
"license": "gpl-2.0",
"size": 37494
} | [
"java.awt.Shape",
"java.awt.font.GlyphVector",
"java.awt.geom.AffineTransform"
] | import java.awt.Shape; import java.awt.font.GlyphVector; import java.awt.geom.AffineTransform; | import java.awt.*; import java.awt.font.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 1,206,258 |
void bind(SocketAddress address, IoHandler handler) throws IOException; | void bind(SocketAddress address, IoHandler handler) throws IOException; | /**
* Binds to the specified <code>address</code> and handles incoming
* connections with the specified <code>handler</code>.
*
* @throws IOException if failed to bind
*/ | Binds to the specified <code>address</code> and handles incoming connections with the specified <code>handler</code> | bind | {
"repo_name": "mksmbrtsh/LLRPexplorer",
"path": "src/org/apache/mina/common/IoAcceptor.java",
"license": "apache-2.0",
"size": 3530
} | [
"java.io.IOException",
"java.net.SocketAddress"
] | import java.io.IOException; import java.net.SocketAddress; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 1,141,777 |
public ImageAgent getImageAgent( Context context )
{
return ( ImageAgent.getInstance( context ) );
} | ImageAgent function( Context context ) { return ( ImageAgent.getInstance( context ) ); } | /*****************************************************
*
* Returns an instance of the image loader.
*
*****************************************************/ | Returns an instance of the image loader | getImageAgent | {
"repo_name": "bearprada/Android-Print-SDK",
"path": "KitePrintSDK/src/main/java/ly/kite/KiteSDK.java",
"license": "mit",
"size": 26068
} | [
"android.content.Context",
"ly.kite.util.ImageAgent"
] | import android.content.Context; import ly.kite.util.ImageAgent; | import android.content.*; import ly.kite.util.*; | [
"android.content",
"ly.kite.util"
] | android.content; ly.kite.util; | 261,306 |
private void findLocation( final Glyph glyph) {
// Compute a rectangle that includes glyph's margin
final int x = 0;
final int y = 0;
final int w = glyph.margin.left + ((int) glyph.width) + glyph.margin.right;
final int h = glyph.margin.top + ((int) glyph.height) + glyph.margin.bottom;
final Rect rect = new Rect(x, y, w, h, new TextData(glyph));
// Pack it into the cache and store its location
packer.add(rect);
glyph.location = rect;
markGlyphLocationUsed(glyph);
} | void function( final Glyph glyph) { final int x = 0; final int y = 0; final int w = glyph.margin.left + ((int) glyph.width) + glyph.margin.right; final int h = glyph.margin.top + ((int) glyph.height) + glyph.margin.bottom; final Rect rect = new Rect(x, y, w, h, new TextData(glyph)); packer.add(rect); glyph.location = rect; markGlyphLocationUsed(glyph); } | /**
* Finds a location in the backing store for a glyph.
*
* @param glyph Glyph being uploaded, assumed not null
*/ | Finds a location in the backing store for a glyph | findLocation | {
"repo_name": "jedwards1211/breakout",
"path": "andork-jogl-gl2es2-swing/src/jogamp/opengl/util/awt/text/GlyphCache.java",
"license": "gpl-2.0",
"size": 23757
} | [
"com.jogamp.opengl.util.packrect.Rect"
] | import com.jogamp.opengl.util.packrect.Rect; | import com.jogamp.opengl.util.packrect.*; | [
"com.jogamp.opengl"
] | com.jogamp.opengl; | 322,070 |
private String buildBellsString(NodeList list, long finishTime) {
StringBuilder bellsList = new StringBuilder();
for (int i = 0; i < list.getLength(); i++) {
Element element = (Element) list.item(i);
String timeStr = xu.findAttributeText(element, R.string.xml2attrName_bell_time);
long time;
if (timeStr == null) continue;
if (timeStr.equals(mContext.getString(R.string.xml2attrValue_bell_time_finish)))
time = finishTime;
else {
try {
time = XmlUtilities.timeStr2Secs(timeStr);
} catch (NumberFormatException e) {
continue; // if we couldn't interpret the time, ignore it
}
}
bellsList.append(XmlUtilities.secsToText(time));
boolean pauseOnBell;
try {
pauseOnBell = xu.isAttributeTrue(element, R.string.xml2attrName_bell_pauseOnBell);
} catch (XmlInvalidValueException e) {
pauseOnBell = false;
}
if (pauseOnBell)
bellsList.append(mContext.getString(R.string.pauseOnBellIndicator));
// If there's one after this, add a comma
if (i < list.getLength() - 1) bellsList.append(", ");
}
String bellsDesc = mContext.getResources().getQuantityString(
R.plurals.viewFormat_timeDescription_bellsList, list.getLength(), bellsList);
return bellsDesc;
} | String function(NodeList list, long finishTime) { StringBuilder bellsList = new StringBuilder(); for (int i = 0; i < list.getLength(); i++) { Element element = (Element) list.item(i); String timeStr = xu.findAttributeText(element, R.string.xml2attrName_bell_time); long time; if (timeStr == null) continue; if (timeStr.equals(mContext.getString(R.string.xml2attrValue_bell_time_finish))) time = finishTime; else { try { time = XmlUtilities.timeStr2Secs(timeStr); } catch (NumberFormatException e) { continue; } } bellsList.append(XmlUtilities.secsToText(time)); boolean pauseOnBell; try { pauseOnBell = xu.isAttributeTrue(element, R.string.xml2attrName_bell_pauseOnBell); } catch (XmlInvalidValueException e) { pauseOnBell = false; } if (pauseOnBell) bellsList.append(mContext.getString(R.string.pauseOnBellIndicator)); if (i < list.getLength() - 1) bellsList.append(STR); } String bellsDesc = mContext.getResources().getQuantityString( R.plurals.viewFormat_timeDescription_bellsList, list.getLength(), bellsList); return bellsDesc; } | /**
* Builds a string describing a list of bells
* @param list a list of <bell> {@link Element}s
* @return the completed string e.g. "bells at 01:00, 06:00, 07:00"
*/ | Builds a string describing a list of bells | buildBellsString | {
"repo_name": "czlee/debatekeeper-old",
"path": "src/net/czlee/debatekeeper/debateformat/DebateFormatInfoForSchema2.java",
"license": "gpl-3.0",
"size": 14107
} | [
"net.czlee.debatekeeper.debateformat.XmlUtilities",
"org.w3c.dom.Element",
"org.w3c.dom.NodeList"
] | import net.czlee.debatekeeper.debateformat.XmlUtilities; import org.w3c.dom.Element; import org.w3c.dom.NodeList; | import net.czlee.debatekeeper.debateformat.*; import org.w3c.dom.*; | [
"net.czlee.debatekeeper",
"org.w3c.dom"
] | net.czlee.debatekeeper; org.w3c.dom; | 7,959 |
public static String getModulePath( HttpServletRequest request )
{
return getModulePathForRelativeURI( InternalUtils.getDecodedServletPath( request ) );
} | static String function( HttpServletRequest request ) { return getModulePathForRelativeURI( InternalUtils.getDecodedServletPath( request ) ); } | /**
* Get the Struts module path for the current request URI. This is the parent directory,
* relative to the web application root, of the file referenced by the request URI.
*
* @param request the current HttpServletRequest.
*/ | Get the Struts module path for the current request URI. This is the parent directory, relative to the web application root, of the file referenced by the request URI | getModulePath | {
"repo_name": "moparisthebest/beehive",
"path": "beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java",
"license": "apache-2.0",
"size": 80113
} | [
"javax.servlet.http.HttpServletRequest",
"org.apache.beehive.netui.pageflow.internal.InternalUtils"
] | import javax.servlet.http.HttpServletRequest; import org.apache.beehive.netui.pageflow.internal.InternalUtils; | import javax.servlet.http.*; import org.apache.beehive.netui.pageflow.internal.*; | [
"javax.servlet",
"org.apache.beehive"
] | javax.servlet; org.apache.beehive; | 1,122,103 |
private static PathFragment trimTail(PathFragment path, PathFragment tail) {
return path.subFragment(0, path.segmentCount() - tail.segmentCount());
} | static PathFragment function(PathFragment path, PathFragment tail) { return path.subFragment(0, path.segmentCount() - tail.segmentCount()); } | /**
* Returns the root-part of a given path by trimming off the end specified by
* a given tail. Assumes that the tail is known to match, and simply relies on
* the segment lengths.
*/ | Returns the root-part of a given path by trimming off the end specified by a given tail. Assumes that the tail is known to match, and simply relies on the segment lengths | trimTail | {
"repo_name": "variac/bazel",
"path": "src/main/java/com/google/devtools/build/lib/actions/Artifact.java",
"license": "apache-2.0",
"size": 34252
} | [
"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; | 2,600,835 |
@SuppressWarnings("unchecked")
public static <E> E[] newArray(Class<E> elementType, int length) {
E[] array = (E[])Array.newInstance(elementType, length);
try {
for (int index = 0; index < length; ++index)
array[index] = elementType.getConstructor().newInstance();
}
catch (RuntimeException e) {throw e;}
catch (Exception e) {throw new RuntimeException(e);}
return array;
} | @SuppressWarnings(STR) static <E> E[] function(Class<E> elementType, int length) { E[] array = (E[])Array.newInstance(elementType, length); try { for (int index = 0; index < length; ++index) array[index] = elementType.getConstructor().newInstance(); } catch (RuntimeException e) {throw e;} catch (Exception e) {throw new RuntimeException(e);} return array; } | /**
* Returns a new array of <b>elementType</b>.<br>
*
* Store a new object of <b>elementType</b> for all of the elements of the array.
*
* @param <E> the type of the element of the array
* @param elementType the type of the element of the array
* @param length the length of the array
* @return elementType a new array of <b>elementType</b>
*
* @throws NullPointerException if <b>elementType</b> is <b>null</b>
* @throws IndexOutOfBoundsException if <b>length </b>< 0
* @throws RuntimeException if <b>InstantiationException</b> or <b>IllegalAccessException</b> has been thrown
*/ | Returns a new array of elementType. Store a new object of elementType for all of the elements of the array | newArray | {
"repo_name": "MasatoKokubo/Lightsleep",
"path": "src/main/java/org/lightsleep/helper/Utils.java",
"license": "mit",
"size": 23971
} | [
"java.lang.reflect.Array"
] | import java.lang.reflect.Array; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,197,996 |
public static WriteOption resource(MonitoredResource resource) {
return new WriteOption(OptionType.RESOURCE, resource);
} | static WriteOption function(MonitoredResource resource) { return new WriteOption(OptionType.RESOURCE, resource); } | /**
* Returns an option to specify a default monitored resource (see {@link
* LogEntry#getResource()}) for those log entries that do not specify their own resource.
*/ | Returns an option to specify a default monitored resource (see <code>LogEntry#getResource()</code>) for those log entries that do not specify their own resource | resource | {
"repo_name": "googleapis/java-logging",
"path": "google-cloud-logging/src/main/java/com/google/cloud/logging/Logging.java",
"license": "apache-2.0",
"size": 44547
} | [
"com.google.cloud.MonitoredResource"
] | import com.google.cloud.MonitoredResource; | import com.google.cloud.*; | [
"com.google.cloud"
] | com.google.cloud; | 2,605,406 |
@WebMethod
@WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v201311")
@RequestWrapper(localName = "updateRateCardCustomizations", targetNamespace = "https://www.google.com/apis/ads/publisher/v201311", className = "com.google.api.ads.dfp.jaxws.v201311.RateCardCustomizationServiceInterfaceupdateRateCardCustomizations")
@ResponseWrapper(localName = "updateRateCardCustomizationsResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v201311", className = "com.google.api.ads.dfp.jaxws.v201311.RateCardCustomizationServiceInterfaceupdateRateCardCustomizationsResponse")
public List<RateCardCustomization> updateRateCardCustomizations(
@WebParam(name = "rateCardCustomizations", targetNamespace = "https://www.google.com/apis/ads/publisher/v201311")
List<RateCardCustomization> rateCardCustomizations)
throws ApiException_Exception
; | @WebResult(name = "rval", targetNamespace = STRupdateRateCardCustomizationsSTRhttps: @ResponseWrapper(localName = "updateRateCardCustomizationsResponseSTRhttps: List<RateCardCustomization> function( @WebParam(name = "rateCardCustomizationsSTRhttps: List<RateCardCustomization> rateCardCustomizations) throws ApiException_Exception ; | /**
*
* Updates the specified {@link RateCardCustomization} objects.
*
* @param rateCardCustomizations the rate card customizations to be updated
* @return the updated rate card customizations
*
*
* @param rateCardCustomizations
* @return
* returns java.util.List<com.google.api.ads.dfp.jaxws.v201311.RateCardCustomization>
* @throws ApiException_Exception
*/ | Updates the specified <code>RateCardCustomization</code> objects | updateRateCardCustomizations | {
"repo_name": "nafae/developer",
"path": "modules/dfp_appengine/src/main/java/com/google/api/ads/dfp/jaxws/v201311/RateCardCustomizationServiceInterface.java",
"license": "apache-2.0",
"size": 12066
} | [
"java.util.List",
"javax.jws.WebParam",
"javax.jws.WebResult",
"javax.xml.ws.ResponseWrapper"
] | import java.util.List; import javax.jws.WebParam; import javax.jws.WebResult; import javax.xml.ws.ResponseWrapper; | import java.util.*; import javax.jws.*; import javax.xml.ws.*; | [
"java.util",
"javax.jws",
"javax.xml"
] | java.util; javax.jws; javax.xml; | 1,207,861 |
List<HistoryDto> makeHistoryDtos(); | List<HistoryDto> makeHistoryDtos(); | /**
* Make history dtos.
*
* @return the list
*/ | Make history dtos | makeHistoryDtos | {
"repo_name": "OBHITA/Consent2Share",
"path": "DS4P/consent2share/service/src/main/java/gov/samhsa/consent2share/service/audit/AuditService.java",
"license": "bsd-3-clause",
"size": 3904
} | [
"gov.samhsa.consent2share.service.dto.HistoryDto",
"java.util.List"
] | import gov.samhsa.consent2share.service.dto.HistoryDto; import java.util.List; | import gov.samhsa.consent2share.service.dto.*; import java.util.*; | [
"gov.samhsa.consent2share",
"java.util"
] | gov.samhsa.consent2share; java.util; | 1,104,272 |
protected void validateCustomPageProperties(Properties customProperties) throws IOException {
// Default validation rules
if (customProperties != null && !customProperties.isEmpty()) {
if (customProperties.size()>MAX_PROPLIMIT) {
throw new IOException("Too many custom properties. You are adding "+customProperties.size()+", but max limit is "+MAX_PROPLIMIT);
}
Enumeration propertyNames = customProperties.propertyNames();
while (propertyNames.hasMoreElements()) {
String key = (String) propertyNames.nextElement();
String value = (String)customProperties.get(key);
if (key != null) {
if (key.length()>MAX_PROPKEYLENGTH) {
throw new IOException("Custom property key "+key+" is too long. Max allowed length is "+MAX_PROPKEYLENGTH);
}
if (!StringUtils.isAsciiPrintable(key)) {
throw new IOException("Custom property key "+key+" is not simple ASCII!");
}
}
if (value != null) {
if (value.length()>MAX_PROPVALUELENGTH) {
throw new IOException("Custom property key "+key+" has value that is too long. Value="+value+". Max allowed length is "+MAX_PROPVALUELENGTH);
}
if (!StringUtils.isAsciiPrintable(value)) {
throw new IOException("Custom property key "+key+" has value that is not simple ASCII! Value="+value);
}
}
}
}
}
public static class WikiFileFilter
implements FilenameFilter
{
/**
* {@inheritDoc} | void function(Properties customProperties) throws IOException { if (customProperties != null && !customProperties.isEmpty()) { if (customProperties.size()>MAX_PROPLIMIT) { throw new IOException(STR+customProperties.size()+STR+MAX_PROPLIMIT); } Enumeration propertyNames = customProperties.propertyNames(); while (propertyNames.hasMoreElements()) { String key = (String) propertyNames.nextElement(); String value = (String)customProperties.get(key); if (key != null) { if (key.length()>MAX_PROPKEYLENGTH) { throw new IOException(STR+key+STR+MAX_PROPKEYLENGTH); } if (!StringUtils.isAsciiPrintable(key)) { throw new IOException(STR+key+STR); } } if (value != null) { if (value.length()>MAX_PROPVALUELENGTH) { throw new IOException(STR+key+STR+value+STR+MAX_PROPVALUELENGTH); } if (!StringUtils.isAsciiPrintable(value)) { throw new IOException(STR+key+STR+value); } } } } } public static class WikiFileFilter implements FilenameFilter { /** * {@inheritDoc} | /**
* Default validation, validates that key and value is ASCII <code>StringUtils.isAsciiPrintable()</code> and within lengths set up in jspwiki-custom.properties.
* This can be overwritten by custom FileSystemProviders to validate additional properties
* See https://issues.apache.org/jira/browse/JSPWIKI-856
* @since 2.10.2
* @param customProperties the custom page properties being added
*/ | Default validation, validates that key and value is ASCII <code>StringUtils.isAsciiPrintable()</code> and within lengths set up in jspwiki-custom.properties. This can be overwritten by custom FileSystemProviders to validate additional properties See HREF | validateCustomPageProperties | {
"repo_name": "tateshitah/jspwiki",
"path": "jspwiki-war/src/main/java/org/apache/wiki/providers/AbstractFileProvider.java",
"license": "apache-2.0",
"size": 20851
} | [
"java.io.FilenameFilter",
"java.io.IOException",
"java.util.Enumeration",
"java.util.Properties",
"org.apache.commons.lang.StringUtils"
] | import java.io.FilenameFilter; import java.io.IOException; import java.util.Enumeration; import java.util.Properties; import org.apache.commons.lang.StringUtils; | import java.io.*; import java.util.*; import org.apache.commons.lang.*; | [
"java.io",
"java.util",
"org.apache.commons"
] | java.io; java.util; org.apache.commons; | 2,788,889 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jScrollPane2 = new javax.swing.JScrollPane();
jTableStorage = new javax.swing.JTable();
jScrollPane1 = new javax.swing.JScrollPane();
jTableQueue = new javax.swing.JTable();
jScrollPane3 = new javax.swing.JScrollPane();
jListLog = new javax.swing.JList();
setTitle("Storeage Overview");
jTableStorage.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"Item", "In Storage"
}
) {
Class[] types = new Class [] {
java.lang.String.class, java.lang.Integer.class
};
boolean[] canEdit = new boolean [] {
false, false
}; | @SuppressWarnings(STR) void function() { jScrollPane2 = new javax.swing.JScrollPane(); jTableStorage = new javax.swing.JTable(); jScrollPane1 = new javax.swing.JScrollPane(); jTableQueue = new javax.swing.JTable(); jScrollPane3 = new javax.swing.JScrollPane(); jListLog = new javax.swing.JList(); setTitle(STR); jTableStorage.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Item", STR } ) { Class[] types = new Class [] { java.lang.String.class, java.lang.Integer.class }; boolean[] canEdit = new boolean [] { false, false }; | /** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. always regenerated by the Form Editor | initComponents | {
"repo_name": "mru00/jade_agents",
"path": "src/coop/StorageAgentGUI.java",
"license": "lgpl-2.1",
"size": 6710
} | [
"javax.swing.table.DefaultTableModel"
] | import javax.swing.table.DefaultTableModel; | import javax.swing.table.*; | [
"javax.swing"
] | javax.swing; | 2,759,799 |
// [TARGET getDataset(String, DatasetOption...)]
// [VARIABLE "my_dataset"]
public Dataset getDataset(String datasetName) {
// [START getDataset]
Dataset dataset = bigquery.getDataset(datasetName);
// [END getDataset]
return dataset;
} | Dataset function(String datasetName) { Dataset dataset = bigquery.getDataset(datasetName); return dataset; } | /**
* Example of getting a dataset.
*/ | Example of getting a dataset | getDataset | {
"repo_name": "mbrukman/gcloud-java",
"path": "google-cloud-examples/src/main/java/com/google/cloud/examples/bigquery/snippets/BigQuerySnippets.java",
"license": "apache-2.0",
"size": 21428
} | [
"com.google.cloud.bigquery.Dataset"
] | import com.google.cloud.bigquery.Dataset; | import com.google.cloud.bigquery.*; | [
"com.google.cloud"
] | com.google.cloud; | 2,204,341 |
boolean checkPermission(Credentials cred); | boolean checkPermission(Credentials cred); | /**
* Checks that client has the specified permission.
* @param cred
*
* @return true if it has, throw {@link SecurityException} otherwise with specified error message
*/ | Checks that client has the specified permission | checkPermission | {
"repo_name": "laurianed/scheduling",
"path": "common/common-client/src/main/java/org/ow2/proactive/jmx/PermissionChecker.java",
"license": "agpl-3.0",
"size": 1405
} | [
"org.ow2.proactive.authentication.crypto.Credentials"
] | import org.ow2.proactive.authentication.crypto.Credentials; | import org.ow2.proactive.authentication.crypto.*; | [
"org.ow2.proactive"
] | org.ow2.proactive; | 2,835,611 |
ApplicationContext context = new ClassPathXmlApplicationContext("classpath:kafka/context-data-producer.xml");
MessageSender messageSender = (MessageSender) context.getBean("messageSender");
ReactorRef ref = ReactorRef.create(Digger.class);
ref.setMessageSender(messageSender);
System.out.println("ref created " + ref.getId() +"," + ref);
for (int i = 0; i < 3 ; i++) {
String msg = "Hello" + i;
System.out.println("send->" + msg);
ref.send("Hello" + i);
}
ReactorRef ref1 = ReactorRef.create(Digger.class);
ref1.setMessageSender(messageSender);
ref1.send("NewYork" );
ReactorRef ref2= ReactorRef.create(Digger.class);
ref2.setMessageSender(messageSender);
ref2.send("SF" );
} | ApplicationContext context = new ClassPathXmlApplicationContext(STR); MessageSender messageSender = (MessageSender) context.getBean(STR); ReactorRef ref = ReactorRef.create(Digger.class); ref.setMessageSender(messageSender); System.out.println(STR + ref.getId() +"," + ref); for (int i = 0; i < 3 ; i++) { String msg = "Hello" + i; System.out.println(STR + msg); ref.send("Hello" + i); } ReactorRef ref1 = ReactorRef.create(Digger.class); ref1.setMessageSender(messageSender); ref1.send(STR ); ReactorRef ref2= ReactorRef.create(Digger.class); ref2.setMessageSender(messageSender); ref2.send("SF" ); } | /**
* Reactor produce demo.
* Create prototype(multiple instances) reactor and send message to them.
* @param args
*/ | Reactor produce demo. Create prototype(multiple instances) reactor and send message to them | main | {
"repo_name": "KoperGroup/koper",
"path": "koper-reactor/src/test/java/koper/reactor/demo/ProducerApp.java",
"license": "apache-2.0",
"size": 2095
} | [
"org.springframework.context.ApplicationContext",
"org.springframework.context.support.ClassPathXmlApplicationContext"
] | import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; | import org.springframework.context.*; import org.springframework.context.support.*; | [
"org.springframework.context"
] | org.springframework.context; | 745,393 |
@MethodSubstitution(value = "decryptBlock", isStatic = false)
static void decryptBlockWithOriginalKey(Object rcvr, byte[] in, int inOffset, byte[] out, int outOffset) {
crypt(rcvr, in, inOffset, out, outOffset, false, true);
} | @MethodSubstitution(value = STR, isStatic = false) static void decryptBlockWithOriginalKey(Object rcvr, byte[] in, int inOffset, byte[] out, int outOffset) { crypt(rcvr, in, inOffset, out, outOffset, false, true); } | /**
* Variation for platforms (e.g. SPARC) that need do key expansion in stubs due to compatibility
* issues between Java key expansion and hardware crypto instructions.
*/ | Variation for platforms (e.g. SPARC) that need do key expansion in stubs due to compatibility issues between Java key expansion and hardware crypto instructions | decryptBlockWithOriginalKey | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/hotspot/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/AESCryptSubstitutions.java",
"license": "gpl-2.0",
"size": 7837
} | [
"org.graalvm.compiler.api.replacements.MethodSubstitution"
] | import org.graalvm.compiler.api.replacements.MethodSubstitution; | import org.graalvm.compiler.api.replacements.*; | [
"org.graalvm.compiler"
] | org.graalvm.compiler; | 2,036,493 |
public MDCAdapter getMDCA() {
// note that this method is invoked only from within the static initializer of
// the org.slf4j.MDC class.
return new BasicMDCAdapter();
} | MDCAdapter function() { return new BasicMDCAdapter(); } | /**
* Currently this method always returns an instance of
* {@link BasicMDCAdapter}.
*/ | Currently this method always returns an instance of <code>BasicMDCAdapter</code> | getMDCA | {
"repo_name": "FranckW/projet1_opl",
"path": "server/lib/slf4j-1.7.21/slf4j-jdk14/src/main/java/org/slf4j/impl/StaticMDCBinder.java",
"license": "mit",
"size": 2245
} | [
"org.slf4j.helpers.BasicMDCAdapter",
"org.slf4j.spi.MDCAdapter"
] | import org.slf4j.helpers.BasicMDCAdapter; import org.slf4j.spi.MDCAdapter; | import org.slf4j.helpers.*; import org.slf4j.spi.*; | [
"org.slf4j.helpers",
"org.slf4j.spi"
] | org.slf4j.helpers; org.slf4j.spi; | 1,739,887 |
public static void join (StringBuilder builder, String sep, Collection<?> values)
{
boolean first = true;
for (Object o : values)
{
if (first)
first = false;
else
builder.append (sep);
builder.append ("" + o);
}
} | static void function (StringBuilder builder, String sep, Collection<?> values) { boolean first = true; for (Object o : values) { if (first) first = false; else builder.append (sep); builder.append ("" + o); } } | /**
* Join collection into and append to a StringBuilder, with a separator between.
* Useful if you want to join strings and append to an existing StringBuilder.
* @param builder StringBuilder you want to append to. This variable will be modified.
* @param sep Separator between strings
* @param values collection of strings to join.
*/ | Join collection into and append to a StringBuilder, with a separator between. Useful if you want to join strings and append to an existing StringBuilder | join | {
"repo_name": "christopher-johnson/cyto-rdf",
"path": "helixsoft-commons/nl.helixsoft.util/src/nl/helixsoft/util/StringUtils.java",
"license": "gpl-2.0",
"size": 17559
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 81,060 |
private static int skipPatternWhiteSpace(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} | static int function(String text, int pos) { while (pos < text.length()) { int c = UTF16.charAt(text, pos); if (!PatternProps.isWhiteSpace(c)) { break; } pos += UTF16.getCharCount(c); } return pos; } | /**
* Skips over a run of zero or more Pattern_White_Space characters at pos in text.
*/ | Skips over a run of zero or more Pattern_White_Space characters at pos in text | skipPatternWhiteSpace | {
"repo_name": "google/j2objc",
"path": "jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java",
"license": "apache-2.0",
"size": 264947
} | [
"android.icu.impl.PatternProps"
] | import android.icu.impl.PatternProps; | import android.icu.impl.*; | [
"android.icu"
] | android.icu; | 977,907 |
public static ObservableList<CssParser.ParseError> getErrors() {
return errors;
}
////////////////////////////////////////////////////////////////////////////
//
// Classes and routines for mapping styles to a Node
//
////////////////////////////////////////////////////////////////////////////
private static List<String> cacheMapKey;
// Each Scene has its own cache
// package for testing
static class CacheContainer { | static ObservableList<CssParser.ParseError> function() { return errors; } private static List<String> cacheMapKey; static class CacheContainer { | /**
* Errors that may have occurred during css processing.
* This list is null until errorsProperty() is called and is used
* internally to figure out whether or not anyone is interested in
* receiving CssError.
* Not meant for general use - call errorsProperty() instead.
* @return
*/ | Errors that may have occurred during css processing. This list is null until errorsProperty() is called and is used internally to figure out whether or not anyone is interested in receiving CssError. Not meant for general use - call errorsProperty() instead | getErrors | {
"repo_name": "teamfx/openjfx-9-dev-rt",
"path": "modules/javafx.graphics/src/main/java/com/sun/javafx/css/StyleManager.java",
"license": "gpl-2.0",
"size": 90363
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,261,924 |
public ResourceMetadataModel loadResourceMetadata(Integer resourceId);
| ResourceMetadataModel function(Integer resourceId); | /**
* Load a ResourceMetadataModel based on the resourceId.
*
* @param resourceId
* @return
*/ | Load a ResourceMetadataModel based on the resourceId | loadResourceMetadata | {
"repo_name": "Canadensys/canadensys-explorer",
"path": "src/main/java/net/canadensys/dataportal/occurrence/OccurrenceService.java",
"license": "mit",
"size": 1890
} | [
"net.canadensys.dataportal.occurrence.model.ResourceMetadataModel"
] | import net.canadensys.dataportal.occurrence.model.ResourceMetadataModel; | import net.canadensys.dataportal.occurrence.model.*; | [
"net.canadensys.dataportal"
] | net.canadensys.dataportal; | 1,109,856 |
@Override
protected void validateAndSet (Options options,
String option, Object value)
throws IllegalConfigOptionException
{
if (option.equals ("router.coalesce-delay"))
{
if (value.equals (0))
value = 1;
else if (value.equals (1))
value = 0;
}
option = legacyToNew (option);
// validate and set, or simply discard value
if (validate (option, value) == null)
set (options, option, value);
}
| void function (Options options, String option, Object value) throws IllegalConfigOptionException { if (option.equals (STR)) { if (value.equals (0)) value = 1; else if (value.equals (1)) value = 0; } option = legacyToNew (option); if (validate (option, value) == null) set (options, option, value); } | /**
* Override validation to add legacy support and to simply not
* include invalid options rather than explode violently. Also
* removes auto value conversion.
*/ | Override validation to add legacy support and to simply not include invalid options rather than explode violently. Also removes auto value conversion | validateAndSet | {
"repo_name": "luv/avis_zmqprx",
"path": "server/src/main/org/avis/router/ClientConnectionOptionSet.java",
"license": "gpl-3.0",
"size": 3711
} | [
"org.avis.config.Options",
"org.avis.util.IllegalConfigOptionException"
] | import org.avis.config.Options; import org.avis.util.IllegalConfigOptionException; | import org.avis.config.*; import org.avis.util.*; | [
"org.avis.config",
"org.avis.util"
] | org.avis.config; org.avis.util; | 2,836,154 |
public Map<String, Object> getSourceAsMap() throws ElasticsearchParseException {
return getResult.sourceAsMap();
} | Map<String, Object> function() throws ElasticsearchParseException { return getResult.sourceAsMap(); } | /**
* The source of the document (As a map).
*/ | The source of the document (As a map) | getSourceAsMap | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/get/GetResponse.java",
"license": "apache-2.0",
"size": 6553
} | [
"java.util.Map",
"org.elasticsearch.ElasticsearchParseException"
] | import java.util.Map; import org.elasticsearch.ElasticsearchParseException; | import java.util.*; import org.elasticsearch.*; | [
"java.util",
"org.elasticsearch"
] | java.util; org.elasticsearch; | 1,686,019 |
try {
transactionRecord.loadTransactions();
transactionRecord.close();
generateInvoice();
System.out.println("INVOICE PRINTED:");
System.out.print(Invoice);
logInvoice();
} catch (IOException e) {
System.err.println("**** " + e);
}
} | try { transactionRecord.loadTransactions(); transactionRecord.close(); generateInvoice(); System.out.println(STR); System.out.print(Invoice); logInvoice(); } catch (IOException e) { System.err.println(STR + e); } } | /**
* Load transactions and print an invoice
*/ | Load transactions and print an invoice | manage | {
"repo_name": "code-potato/POST",
"path": "POST_Beta/src/post/Manager.java",
"license": "gpl-2.0",
"size": 5548
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,479,287 |
public static String toAddressString(InetAddress ip) {
return toAddressString(ip, false);
} | static String function(InetAddress ip) { return toAddressString(ip, false); } | /**
* Returns the {@link String} representation of an {@link InetAddress}.
* <ul>
* <li>Inet4Address results are identical to {@link InetAddress#getHostAddress()}</li>
* <li>Inet6Address results adhere to
* <a href="http://tools.ietf.org/html/rfc5952#section-4">rfc 5952 section 4</a></li>
* </ul>
* <p>
* The output does not include Scope ID.
* @param ip {@link InetAddress} to be converted to an address string
* @return {@code String} containing the text-formatted IP address
*/ | Returns the <code>String</code> representation of an <code>InetAddress</code>. Inet4Address results are identical to <code>InetAddress#getHostAddress()</code> Inet6Address results adhere to rfc 5952 section 4 The output does not include Scope ID | toAddressString | {
"repo_name": "blucas/netty",
"path": "common/src/main/java/io/netty/util/NetUtil.java",
"license": "apache-2.0",
"size": 46158
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 608,817 |
Map<String, Cookie> getResponseCookiesInternal() {
return responseCookies;
} | Map<String, Cookie> getResponseCookiesInternal() { return responseCookies; } | /**
* For internal use only
*
* @return The response cookies, or null if they have not been set yet
*/ | For internal use only | getResponseCookiesInternal | {
"repo_name": "biddyweb/undertow",
"path": "core/src/main/java/io/undertow/server/HttpServerExchange.java",
"license": "apache-2.0",
"size": 81449
} | [
"io.undertow.server.handlers.Cookie",
"java.util.Map"
] | import io.undertow.server.handlers.Cookie; import java.util.Map; | import io.undertow.server.handlers.*; import java.util.*; | [
"io.undertow.server",
"java.util"
] | io.undertow.server; java.util; | 2,726,982 |
public List<Field> getFieldWhere(int tag, char subfield, String equalsThis) {
List<Field> ret = new ArrayList<Field>();
int sz = fields.size() - 1;
for (int idx = 0; idx <= sz; idx++) {
Field f = fields.get(idx);
if (f.getTag() == tag) {
for (String value : f.getSubfieldValues(subfield)) {
if (value.equals(equalsThis)) {
ret.add(f);
break;
}
}
}
}
return ret;
} | List<Field> function(int tag, char subfield, String equalsThis) { List<Field> ret = new ArrayList<Field>(); int sz = fields.size() - 1; for (int idx = 0; idx <= sz; idx++) { Field f = fields.get(idx); if (f.getTag() == tag) { for (String value : f.getSubfieldValues(subfield)) { if (value.equals(equalsThis)) { ret.add(f); break; } } } } return ret; } | /**
* gets all occurrences of a field in the record that has a value in a subfield.
*
* @param tag the field tag
* @param subfield the subfield code
* @param equalsThis the value to compare to
* @return all occurrences of a field in the record, or an empty List
*/ | gets all occurrences of a field in the record that has a value in a subfield | getFieldWhere | {
"repo_name": "repoxIST/repoxLight",
"path": "repox-core/src/main/java/pt/utl/ist/marc/Record.java",
"license": "gpl-3.0",
"size": 25425
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,323,266 |
public final ListTasksResponse updateByQueryRethrottle(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException {
return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottleUpdateByQuery, options,
ListTasksResponse::fromXContent, emptySet());
} | final ListTasksResponse function(RethrottleRequest rethrottleRequest, RequestOptions options) throws IOException { return performRequestAndParseEntity(rethrottleRequest, RequestConverters::rethrottleUpdateByQuery, options, ListTasksResponse::fromXContent, emptySet()); } | /**
* Executes a update by query rethrottle request.
* See <a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/docs-update-by-query.html">
* Update By Query API on elastic.co</a>
* @param rethrottleRequest the request
* @param options the request options (e.g. headers), use {@link RequestOptions#DEFAULT} if nothing needs to be customized
* @return the response
*/ | Executes a update by query rethrottle request. See Update By Query API on elastic.co | updateByQueryRethrottle | {
"repo_name": "robin13/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/RestHighLevelClient.java",
"license": "apache-2.0",
"size": 121051
} | [
"java.io.IOException",
"java.util.Collections",
"org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse"
] | import java.io.IOException; import java.util.Collections; import org.elasticsearch.action.admin.cluster.node.tasks.list.ListTasksResponse; | import java.io.*; import java.util.*; import org.elasticsearch.action.admin.cluster.node.tasks.list.*; | [
"java.io",
"java.util",
"org.elasticsearch.action"
] | java.io; java.util; org.elasticsearch.action; | 80,419 |
public Iterator<ModInteger> iterator() {
return new ModIntegerIterator(this);
}
}
class ModIntegerIterator implements Iterator<ModInteger> {
java.math.BigInteger curr;
final ModIntegerRing ring;
public ModIntegerIterator(ModIntegerRing fac) {
curr = java.math.BigInteger.ZERO;
ring = fac;
} | Iterator<ModInteger> function() { return new ModIntegerIterator(this); } } class ModIntegerIterator implements Iterator<ModInteger> { java.math.BigInteger curr; final ModIntegerRing ring; public ModIntegerIterator(ModIntegerRing fac) { curr = java.math.BigInteger.ZERO; ring = fac; } | /**
* Get a ModInteger iterator.
*
* @return a iterator over all modular integers in this ring.
*/ | Get a ModInteger iterator | iterator | {
"repo_name": "redberry-cas/core",
"path": "src/main/java/cc/redberry/core/transformations/factor/jasfactor/edu/jas/arith/ModIntegerRing.java",
"license": "gpl-2.0",
"size": 9217
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,244,810 |
private TrustManager getVeryTrustingTrustManager() {
return new X509TrustManager() { | TrustManager function() { return new X509TrustManager() { | /**
* Create a trust manager which is not too concerned about validating
* certificates.
*
* @return a trusting trust manager
*/ | Create a trust manager which is not too concerned about validating certificates | getVeryTrustingTrustManager | {
"repo_name": "watou/openhab",
"path": "bundles/io/org.openhab.io.transport.mqtt/src/main/java/org/openhab/io/transport/mqtt/internal/MqttBrokerConnection.java",
"license": "epl-1.0",
"size": 20258
} | [
"javax.net.ssl.TrustManager",
"javax.net.ssl.X509TrustManager"
] | import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; | import javax.net.ssl.*; | [
"javax.net"
] | javax.net; | 2,737,349 |
public static String getFileName(String ID) {
if (File.separatorChar == '/') {
return ID;
}
return ID.replace('/', File.separatorChar);
} | static String function(String ID) { if (File.separatorChar == '/') { return ID; } return ID.replace('/', File.separatorChar); } | /**
* Converts the given time zone ID to a platform dependent path
* name. For example, "America/Los_Angeles" is converted to
* "America\Los_Angeles" on Win32.
* @return a modified ID replacing '/' with {@link
* java.io.File#separatorChar File.separatorChar} if needed.
*/ | Converts the given time zone ID to a platform dependent path name. For example, "America/Los_Angeles" is converted to "America\Los_Angeles" on Win32 | getFileName | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java",
"license": "gpl-2.0",
"size": 35574
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,862,189 |
@Nullable
public static Boolean extractHook(IHopper dest)
{
Pair<IItemHandler, Object> itemHandlerResult = getItemHandler(dest, EnumFacing.UP);
if (itemHandlerResult == null)
return null;
IItemHandler handler = itemHandlerResult.getKey();
for (int i = 0; i < handler.getSlots(); i++)
{
ItemStack extractItem = handler.extractItem(i, 1, true);
if (!extractItem.isEmpty())
{
for (int j = 0; j < dest.getSizeInventory(); j++)
{
ItemStack destStack = dest.getStackInSlot(j);
if (dest.isItemValidForSlot(j, extractItem) && (destStack.isEmpty() || destStack.getCount() < destStack.getMaxStackSize() && destStack.getCount() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack)))
{
extractItem = handler.extractItem(i, 1, false);
if (destStack.isEmpty())
dest.setInventorySlotContents(j, extractItem);
else
{
destStack.grow(1);
dest.setInventorySlotContents(j, destStack);
}
dest.markDirty();
return true;
}
}
}
}
return false;
} | static Boolean function(IHopper dest) { Pair<IItemHandler, Object> itemHandlerResult = getItemHandler(dest, EnumFacing.UP); if (itemHandlerResult == null) return null; IItemHandler handler = itemHandlerResult.getKey(); for (int i = 0; i < handler.getSlots(); i++) { ItemStack extractItem = handler.extractItem(i, 1, true); if (!extractItem.isEmpty()) { for (int j = 0; j < dest.getSizeInventory(); j++) { ItemStack destStack = dest.getStackInSlot(j); if (dest.isItemValidForSlot(j, extractItem) && (destStack.isEmpty() destStack.getCount() < destStack.getMaxStackSize() && destStack.getCount() < dest.getInventoryStackLimit() && ItemHandlerHelper.canItemStacksStack(extractItem, destStack))) { extractItem = handler.extractItem(i, 1, false); if (destStack.isEmpty()) dest.setInventorySlotContents(j, extractItem); else { destStack.grow(1); dest.setInventorySlotContents(j, destStack); } dest.markDirty(); return true; } } } } return false; } | /**
* Copied from TileEntityHopper#captureDroppedItems and added capability support
* @return Null if we did nothing {no IItemHandler}, True if we moved an item, False if we moved no items
*/ | Copied from TileEntityHopper#captureDroppedItems and added capability support | extractHook | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraftforge/items/VanillaInventoryCodeHooks.java",
"license": "gpl-3.0",
"size": 10468
} | [
"net.minecraft.item.ItemStack",
"net.minecraft.tileentity.IHopper",
"net.minecraft.util.EnumFacing",
"org.apache.commons.lang3.tuple.Pair"
] | import net.minecraft.item.ItemStack; import net.minecraft.tileentity.IHopper; import net.minecraft.util.EnumFacing; import org.apache.commons.lang3.tuple.Pair; | import net.minecraft.item.*; import net.minecraft.tileentity.*; import net.minecraft.util.*; import org.apache.commons.lang3.tuple.*; | [
"net.minecraft.item",
"net.minecraft.tileentity",
"net.minecraft.util",
"org.apache.commons"
] | net.minecraft.item; net.minecraft.tileentity; net.minecraft.util; org.apache.commons; | 1,473,656 |
private static Class<?> getRawType(final ParameterizedType parameterizedType) {
final Type rawType = parameterizedType.getRawType();
// check if raw type is a Class object
// not currently necessary, but since the return type is Type instead of
// Class, there's enough reason to believe that future versions of Java
// may return other Type implementations. And type-safety checking is
// rarely a bad idea.
if (!(rawType instanceof Class<?>)) {
throw new IllegalStateException("Wait... What!? Type of rawType: " + rawType);
}
return (Class<?>) rawType;
} | static Class<?> function(final ParameterizedType parameterizedType) { final Type rawType = parameterizedType.getRawType(); if (!(rawType instanceof Class<?>)) { throw new IllegalStateException(STR + rawType); } return (Class<?>) rawType; } | /**
* <p>Transforms the passed in type to a {@link Class} object. Type-checking method of convenience.</p>
*
* @param parameterizedType the type to be converted
* @return the corresponding {@code Class} object
* @throws IllegalStateException if the conversion fails
*/ | Transforms the passed in type to a <code>Class</code> object. Type-checking method of convenience | getRawType | {
"repo_name": "rikles/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java",
"license": "apache-2.0",
"size": 70048
} | [
"java.lang.reflect.ParameterizedType",
"java.lang.reflect.Type"
] | import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,126,470 |
public static Path getTempAppendDir(String tableName) {
String timeId = DATE_FORM.format(new Date(System.currentTimeMillis()));
String tempDir = TEMP_IMPORT_ROOT + Path.SEPARATOR + timeId + tableName;
return new Path(tempDir);
} | static Path function(String tableName) { String timeId = DATE_FORM.format(new Date(System.currentTimeMillis())); String tempDir = TEMP_IMPORT_ROOT + Path.SEPARATOR + timeId + tableName; return new Path(tempDir); } | /**
* Creates a unique path object inside the sqoop temporary directory.
*
* @param tableName
* @return a path pointing to the temporary directory
*/ | Creates a unique path object inside the sqoop temporary directory | getTempAppendDir | {
"repo_name": "cloudbow/sqoop-couchbase-pass-fix",
"path": "src/java/org/apache/sqoop/util/AppendUtils.java",
"license": "apache-2.0",
"size": 9432
} | [
"java.util.Date",
"org.apache.hadoop.fs.Path"
] | import java.util.Date; import org.apache.hadoop.fs.Path; | import java.util.*; import org.apache.hadoop.fs.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,984,862 |
public JSONObject handleListConfigs(MapReduceXml xml) {
JSONObject retValue = new JSONObject();
JSONArray configArray = new JSONArray();
Set<String> names = xml.getConfigurationNames();
for (String name : names) {
String configXml = xml.getTemplateAsXmlString(name);
ConfigurationTemplatePreprocessor preprocessor =
new ConfigurationTemplatePreprocessor(configXml);
configArray.put(preprocessor.toJson(name));
}
try {
retValue.put("configs", configArray);
} catch (JSONException e) {
throw new RuntimeException("Hard coded string is null");
}
return retValue;
} | JSONObject function(MapReduceXml xml) { JSONObject retValue = new JSONObject(); JSONArray configArray = new JSONArray(); Set<String> names = xml.getConfigurationNames(); for (String name : names) { String configXml = xml.getTemplateAsXmlString(name); ConfigurationTemplatePreprocessor preprocessor = new ConfigurationTemplatePreprocessor(configXml); configArray.put(preprocessor.toJson(name)); } try { retValue.put(STR, configArray); } catch (JSONException e) { throw new RuntimeException(STR); } return retValue; } | /**
* Handle the list_configs AJAX command.
*/ | Handle the list_configs AJAX command | handleListConfigs | {
"repo_name": "bradseefeld/AppEngine-MapReduce",
"path": "src/com/google/appengine/tools/mapreduce/MapReduceServlet.java",
"license": "apache-2.0",
"size": 40228
} | [
"java.util.Set",
"org.json.JSONArray",
"org.json.JSONException",
"org.json.JSONObject"
] | import java.util.Set; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; | import java.util.*; import org.json.*; | [
"java.util",
"org.json"
] | java.util; org.json; | 232,848 |
@Exported
public String getUrl() {
// first look for the manifest entry. This is new in maven-hpi-plugin 1.30
String url = manifest.getMainAttributes().getValue("Url");
if(url!=null) return url;
// fallback to update center metadata
UpdateSite.Plugin ui = getInfo();
if(ui!=null) return ui.wiki;
return null;
}
| String function() { String url = manifest.getMainAttributes().getValue("Url"); if(url!=null) return url; UpdateSite.Plugin ui = getInfo(); if(ui!=null) return ui.wiki; return null; } | /**
* Gets the URL that shows more information about this plugin.
* @return
* null if this information is unavailable.
* @since 1.283
*/ | Gets the URL that shows more information about this plugin | getUrl | {
"repo_name": "jpbriend/jenkins",
"path": "core/src/main/java/hudson/PluginWrapper.java",
"license": "mit",
"size": 28184
} | [
"hudson.model.UpdateSite"
] | import hudson.model.UpdateSite; | import hudson.model.*; | [
"hudson.model"
] | hudson.model; | 2,868,668 |
private void toggleBottomSheetVisibility(boolean collapse, boolean animate) {
if (!mediaManager.getQueueReloading() && mediaManager.getQueue().isEmpty()) {
multiSheetView.hide(collapse, false);
} else if (MiniPlayerLockManager.getInstance().canShowMiniPlayer()) {
multiSheetView.unhide(animate);
}
} | void function(boolean collapse, boolean animate) { if (!mediaManager.getQueueReloading() && mediaManager.getQueue().isEmpty()) { multiSheetView.hide(collapse, false); } else if (MiniPlayerLockManager.getInstance().canShowMiniPlayer()) { multiSheetView.unhide(animate); } } | /**
* Hide/show the bottom sheet, depending on whether the queue is empty.
*/ | Hide/show the bottom sheet, depending on whether the queue is empty | toggleBottomSheetVisibility | {
"repo_name": "timusus/Shuttle",
"path": "app/src/main/java/com/simplecity/amp_library/ui/screens/main/MainController.java",
"license": "gpl-3.0",
"size": 14610
} | [
"com.simplecity.amp_library.ui.screens.drawer.MiniPlayerLockManager"
] | import com.simplecity.amp_library.ui.screens.drawer.MiniPlayerLockManager; | import com.simplecity.amp_library.ui.screens.drawer.*; | [
"com.simplecity.amp_library"
] | com.simplecity.amp_library; | 1,698,801 |
@Override
protected TestEnvironment createTestEnvironment
(TestParameters Param, PrintWriter log) {
XInterface oObj = null;
Object oInterface = null ;
//now get the OButtonControl
try {
oInterface = Param.getMSF().createInstance
("com.sun.star.comp.framework.PathSettings") ;
} catch (com.sun.star.uno.Exception e) {
log.println("Couldn't get service");
e.printStackTrace(log);
throw new StatusException("Couldn't get GridControl", e );
}
if (oInterface == null) {
log.println("Service wasn't created") ;
throw new StatusException(Status.failed("Service wasn't created")) ;
}
oObj = (XInterface) oInterface ;
log.println("ImplName: "+utils.getImplName(oObj));
log.println( "creating a new environment for object" );
TestEnvironment tEnv = new TestEnvironment( oObj );
Set<String> exclProps = new HashSet<String>();
exclProps.add("UIConfig");
tEnv.addObjRelation("XFastPropertySet.ExcludeProps", exclProps);
tEnv.addObjRelation("XMultiPropertySet.ExcludeProps", exclProps);
saveAllPropertyValues(oObj);
return tEnv;
} // finish method getTestEnvironment | TestEnvironment function (TestParameters Param, PrintWriter log) { XInterface oObj = null; Object oInterface = null ; try { oInterface = Param.getMSF().createInstance (STR) ; } catch (com.sun.star.uno.Exception e) { log.println(STR); e.printStackTrace(log); throw new StatusException(STR, e ); } if (oInterface == null) { log.println(STR) ; throw new StatusException(Status.failed(STR)) ; } oObj = (XInterface) oInterface ; log.println(STR+utils.getImplName(oObj)); log.println( STR ); TestEnvironment tEnv = new TestEnvironment( oObj ); Set<String> exclProps = new HashSet<String>(); exclProps.add(STR); tEnv.addObjRelation(STR, exclProps); tEnv.addObjRelation(STR, exclProps); saveAllPropertyValues(oObj); return tEnv; } | /**
* Creating a Testenvironment for the interfaces to be tested.
* Creates an instance of the service
* <code>com.sun.star.comp.framework.PathSettings</code>.
*/ | Creating a Testenvironment for the interfaces to be tested. Creates an instance of the service <code>com.sun.star.comp.framework.PathSettings</code> | createTestEnvironment | {
"repo_name": "Limezero/libreoffice",
"path": "qadevOOo/tests/java/mod/_fwl/PathSettings.java",
"license": "gpl-3.0",
"size": 5248
} | [
"com.sun.star.uno.XInterface",
"java.io.PrintWriter",
"java.util.HashSet",
"java.util.Set"
] | import com.sun.star.uno.XInterface; import java.io.PrintWriter; import java.util.HashSet; import java.util.Set; | import com.sun.star.uno.*; import java.io.*; import java.util.*; | [
"com.sun.star",
"java.io",
"java.util"
] | com.sun.star; java.io; java.util; | 2,870,402 |
@ServiceMethod(returns = ReturnType.SINGLE)
EndpointInner update(
String resourceGroupName,
String profileName,
String endpointType,
String endpointName,
EndpointInner parameters); | @ServiceMethod(returns = ReturnType.SINGLE) EndpointInner update( String resourceGroupName, String profileName, String endpointType, String endpointName, EndpointInner parameters); | /**
* Update a Traffic Manager endpoint.
*
* @param resourceGroupName The name of the resource group containing the Traffic Manager endpoint to be updated.
* @param profileName The name of the Traffic Manager profile.
* @param endpointType The type of the Traffic Manager endpoint to be updated.
* @param endpointName The name of the Traffic Manager endpoint to be updated.
* @param parameters Class representing a Traffic Manager endpoint.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return class representing a Traffic Manager endpoint.
*/ | Update a Traffic Manager endpoint | update | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-trafficmanager/src/main/java/com/azure/resourcemanager/trafficmanager/fluent/EndpointsClient.java",
"license": "mit",
"size": 17588
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.trafficmanager.fluent.models.EndpointInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.trafficmanager.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,074,628 |
public static BigDecimal divide(BigDecimal left, Long right, MathContext mathContext) {
return divide(left, right == null ? null : BigDecimal.valueOf(right), mathContext);
} | static BigDecimal function(BigDecimal left, Long right, MathContext mathContext) { return divide(left, right == null ? null : BigDecimal.valueOf(right), mathContext); } | /**
* Calculates the quotient of {@code left} and {@code right}.
* @param left The dividend.
* @param right The divisor.
* @param mathContext The {@link MathContext} for the operation.
* @return The result of {@code left / right}.
*/ | Calculates the quotient of left and right | divide | {
"repo_name": "gmulders/abacus",
"path": "abacus-core/src/main/java/org/gertje/abacus/runtime/expression/ArithmeticOperation.java",
"license": "apache-2.0",
"size": 10892
} | [
"java.math.BigDecimal",
"java.math.MathContext"
] | import java.math.BigDecimal; import java.math.MathContext; | import java.math.*; | [
"java.math"
] | java.math; | 2,703,803 |
void send(PDU pdu)
throws IOException; | void send(PDU pdu) throws IOException; | /**
* Sends a PDU to the client.
* @param pdu the PDU to send
*/ | Sends a PDU to the client | send | {
"repo_name": "eSDK/esdk_sms",
"path": "source/esdk_sms_openapi_smpp_v34/src/main/java/com/huawei/esdk/tcp/base/ISession.java",
"license": "apache-2.0",
"size": 1700
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,133,386 |
@Test
public void testGetAccessTokenExtractor_1() throws Exception {
InstagramApi fixture = new InstagramApi();
AccessTokenExtractor result = fixture.getAccessTokenExtractor();
// add additional test code here
assertNotNull(result);
} | void function() throws Exception { InstagramApi fixture = new InstagramApi(); AccessTokenExtractor result = fixture.getAccessTokenExtractor(); assertNotNull(result); } | /**
* Run the AccessTokenExtractor getAccessTokenExtractor() method test.
*
* @throws Exception
*
*
*/ | Run the AccessTokenExtractor getAccessTokenExtractor() method test | testGetAccessTokenExtractor_1 | {
"repo_name": "zauberlabs/jInstagram",
"path": "src/test/java/org/jinstagram/auth/InstagramApiTest.java",
"license": "mit",
"size": 3505
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 72,991 |
public void registerRecyclerView(final RecyclerView recyclerView, final RecyclerView.OnScrollListener onScrollListener) {
if (recyclerView != null) {
scrollViewList.add(recyclerView); //add to the scrollable list
yOffsets.put(recyclerView, recyclerView.getScrollY()); //save the initial recyclerview's yOffset (0) into hashmap
//only necessary for recyclerview
//listen to scroll
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
boolean firstZeroPassed; | void function(final RecyclerView recyclerView, final RecyclerView.OnScrollListener onScrollListener) { if (recyclerView != null) { scrollViewList.add(recyclerView); yOffsets.put(recyclerView, recyclerView.getScrollY()); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { boolean firstZeroPassed; | /**
* Register a RecyclerView to the current MaterialViewPagerAnimator
* Listen to RecyclerView.OnScrollListener so give to $[onScrollListener] your RecyclerView.OnScrollListener if you already use one
* For loadmore or anything else
*
* @param recyclerView the scrollable
* @param onScrollListener use it if you want to get a callback of the RecyclerView
*/ | Register a RecyclerView to the current MaterialViewPagerAnimator Listen to RecyclerView.OnScrollListener so give to $[onScrollListener] your RecyclerView.OnScrollListener if you already use one For loadmore or anything else | registerRecyclerView | {
"repo_name": "Endika/MaterialViewPager",
"path": "materialviewpager/src/main/java/com/github/florent37/materialviewpager/MaterialViewPagerAnimator.java",
"license": "apache-2.0",
"size": 25708
} | [
"android.support.v7.widget.RecyclerView"
] | import android.support.v7.widget.RecyclerView; | import android.support.v7.widget.*; | [
"android.support"
] | android.support; | 1,853,809 |
public List<GeneralLedgerPendingEntry> getPendingLedgerEntriesForSufficientFundsChecking(); | List<GeneralLedgerPendingEntry> function(); | /**
* This method will return only PLEs that should be checked for SF. Normally this will be all PLEs, but some docs (such as BA)
* have additional requirements.
*
* @return a list of sufficientfundsitems that do not have sufficient funds. It returns an empty list if there is sufficient
* funds for the entire document
*/ | This method will return only PLEs that should be checked for SF. Normally this will be all PLEs, but some docs (such as BA) have additional requirements | getPendingLedgerEntriesForSufficientFundsChecking | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-core/src/main/java/org/kuali/kfs/sys/document/GeneralLedgerPostingDocument.java",
"license": "agpl-3.0",
"size": 3138
} | [
"java.util.List",
"org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry"
] | import java.util.List; import org.kuali.kfs.sys.businessobject.GeneralLedgerPendingEntry; | import java.util.*; import org.kuali.kfs.sys.businessobject.*; | [
"java.util",
"org.kuali.kfs"
] | java.util; org.kuali.kfs; | 1,978,585 |
public void setNotificationBackgroundColor(@ColorInt int color) {
this.notificationBackgroundColor = color;
updateNotifications(true, UPDATE_ALL_NOTIFICATIONS);
} | void function(@ColorInt int color) { this.notificationBackgroundColor = color; updateNotifications(true, UPDATE_ALL_NOTIFICATIONS); } | /**
* Set notification background color
*
* @param color int
*/ | Set notification background color | setNotificationBackgroundColor | {
"repo_name": "xyj222310/smarthome",
"path": "smartsocket2/app/src/main/java/com/xieyingjie/smartsocket/navigation/AHBottomNavigation.java",
"license": "apache-2.0",
"size": 42239
} | [
"android.support.annotation.ColorInt"
] | import android.support.annotation.ColorInt; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,494,398 |
AsyncProcessorAwaitManager getAsyncProcessorAwaitManager(); | AsyncProcessorAwaitManager getAsyncProcessorAwaitManager(); | /**
* Gets the {@link org.apache.camel.AsyncProcessor} await manager.
*
* @return the manager
*/ | Gets the <code>org.apache.camel.AsyncProcessor</code> await manager | getAsyncProcessorAwaitManager | {
"repo_name": "lasombra/camel",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 63018
} | [
"org.apache.camel.spi.AsyncProcessorAwaitManager"
] | import org.apache.camel.spi.AsyncProcessorAwaitManager; | import org.apache.camel.spi.*; | [
"org.apache.camel"
] | org.apache.camel; | 320,049 |
public void reverseContent() {
Collections.reverse(content);
} | void function() { Collections.reverse(content); } | /**
* Reverses the content linked list
*/ | Reverses the content linked list | reverseContent | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/drools-master/drools-compiler/src/main/java/org/drools/compiler/lang/DroolsSentence.java",
"license": "mit",
"size": 3296
} | [
"java.util.Collections"
] | import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 1,270,990 |
public void registerAsHandler() {
MinecraftForge.EVENT_BUS.register(this);
} | void function() { MinecraftForge.EVENT_BUS.register(this); } | /**
* The enchantment should provide its own event handler. This method registers it with Minecraft Forge.
*/ | The enchantment should provide its own event handler. This method registers it with Minecraft Forge | registerAsHandler | {
"repo_name": "ZeroPointMC/GlobalTweaks",
"path": "zeropoint/minecraft/core/ench/BasicEnchantment.java",
"license": "gpl-2.0",
"size": 2560
} | [
"net.minecraftforge.common.MinecraftForge"
] | import net.minecraftforge.common.MinecraftForge; | import net.minecraftforge.common.*; | [
"net.minecraftforge.common"
] | net.minecraftforge.common; | 2,039,876 |
public URL getURL() throws IOException {
URL url = null;
if ( this.clazz != null ) {
url = this.clazz.getResource( this.path );
}
if ( url == null ) {
url = this.classLoader.getResource( this.path );
}
if ( url == null ) {
throw new FileNotFoundException( "'" + this.path + "' cannot be opened because it does not exist" );
}
return url;
} | URL function() throws IOException { URL url = null; if ( this.clazz != null ) { url = this.clazz.getResource( this.path ); } if ( url == null ) { url = this.classLoader.getResource( this.path ); } if ( url == null ) { throw new FileNotFoundException( "'" + this.path + STR ); } return url; } | /**
* This implementation returns a URL for the underlying class path resource.
* @see java.lang.ClassLoader#getResource(String)
* @see java.lang.Class#getResource(String)
*/ | This implementation returns a URL for the underlying class path resource | getURL | {
"repo_name": "psiroky/drools",
"path": "drools-core/src/main/java/org/drools/io/impl/ClassPathResource.java",
"license": "apache-2.0",
"size": 9205
} | [
"java.io.FileNotFoundException",
"java.io.IOException"
] | import java.io.FileNotFoundException; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,388,982 |
@ServiceMethod(returns = ReturnType.COLLECTION)
PagedIterable<ApplicationInner> list(String tenantId, String filter, Context context); | @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable<ApplicationInner> list(String tenantId, String filter, Context context); | /**
* Gets a list of deleted applications in the directory.
*
* @param tenantId The tenant ID.
* @param filter The filter to apply to the operation.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.authorization.models.GraphErrorException thrown if the request is rejected by
* server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a list of deleted applications in the directory.
*/ | Gets a list of deleted applications in the directory | list | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-authorization/src/main/java/com/azure/resourcemanager/authorization/fluent/DeletedApplicationsClient.java",
"license": "mit",
"size": 8842
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedIterable",
"com.azure.core.util.Context",
"com.azure.resourcemanager.authorization.fluent.models.ApplicationInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.authorization.fluent.models.ApplicationInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.authorization.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 892,671 |
public static HRegion createHRegion(final HRegionInfo info, final Path rootDir,
final Configuration conf,
final HTableDescriptor hTableDescriptor,
final HLog hlog)
throws IOException {
LOG.info("creating HRegion " + info.getTableNameAsString()
+ " HTD == " + hTableDescriptor + " RootDir = " + rootDir +
" Table name == " + info.getTableNameAsString());
Path tableDir =
HTableDescriptor.getTableDir(rootDir, info.getTableName());
Path regionDir = HRegion.getRegionDir(tableDir, info.getEncodedName());
FileSystem fs = FileSystem.get(conf);
fs.mkdirs(regionDir);
HLog effectiveHLog = hlog;
if (hlog == null) {
effectiveHLog = new HLog(fs, new Path(regionDir, HConstants.HREGION_LOGDIR_NAME),
new Path(regionDir, HConstants.HREGION_OLDLOGDIR_NAME), conf);
}
HRegion region = HRegion.newHRegion(tableDir,
effectiveHLog, fs, conf, info, hTableDescriptor, null);
region.initialize();
return region;
} | static HRegion function(final HRegionInfo info, final Path rootDir, final Configuration conf, final HTableDescriptor hTableDescriptor, final HLog hlog) throws IOException { LOG.info(STR + info.getTableNameAsString() + STR + hTableDescriptor + STR + rootDir + STR + info.getTableNameAsString()); Path tableDir = HTableDescriptor.getTableDir(rootDir, info.getTableName()); Path regionDir = HRegion.getRegionDir(tableDir, info.getEncodedName()); FileSystem fs = FileSystem.get(conf); fs.mkdirs(regionDir); HLog effectiveHLog = hlog; if (hlog == null) { effectiveHLog = new HLog(fs, new Path(regionDir, HConstants.HREGION_LOGDIR_NAME), new Path(regionDir, HConstants.HREGION_OLDLOGDIR_NAME), conf); } HRegion region = HRegion.newHRegion(tableDir, effectiveHLog, fs, conf, info, hTableDescriptor, null); region.initialize(); return region; } | /**
* Convenience method creating new HRegions. Used by createTable.
* The {@link HLog} for the created region needs to be closed explicitly.
* Use {@link HRegion#getLog()} to get access.
*
* @param info Info for region to create.
* @param rootDir Root directory for HBase instance
* @param conf
* @param hTableDescriptor
* @param hlog shared HLog
* @return new HRegion
*
* @throws IOException
*/ | Convenience method creating new HRegions. Used by createTable. The <code>HLog</code> for the created region needs to be closed explicitly. Use <code>HRegion#getLog()</code> to get access | createHRegion | {
"repo_name": "ay65535/hbase-0.94.0",
"path": "src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java",
"license": "apache-2.0",
"size": 178035
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.FileSystem",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.HConstants",
"org.apache.hadoop.hbase.HRegionInfo",
"org.apache.hadoop.hbase.HTableDescriptor",
"org.apache.hadoop.hbase.regionserver.wal.HLog"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HRegionInfo; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.regionserver.wal.HLog; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.regionserver.wal.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 152,998 |
public static DatabaseEntry copy(DatabaseEntry from) {
return new DatabaseEntry(getByteArray(from));
} | static DatabaseEntry function(DatabaseEntry from) { return new DatabaseEntry(getByteArray(from)); } | /**
* Returns a copy of an entry.
*/ | Returns a copy of an entry | copy | {
"repo_name": "apavlo/h-store",
"path": "third_party/cpp/berkeleydb/lang/java/src/com/sleepycat/util/keyrange/KeyRange.java",
"license": "gpl-3.0",
"size": 9946
} | [
"com.sleepycat.db.DatabaseEntry"
] | import com.sleepycat.db.DatabaseEntry; | import com.sleepycat.db.*; | [
"com.sleepycat.db"
] | com.sleepycat.db; | 2,111,925 |
public long getDefaultLockTimeout() {
return defaultLockTimeout;
}
/**
* Creates and returns the configured workspace locking strategy.
*
* @return the configured {@link ISMLocking} | long function() { return defaultLockTimeout; } /** * Creates and returns the configured workspace locking strategy. * * @return the configured {@link ISMLocking} | /**
* Returns the default lock timeout in number of seconds or
* <code>Long.MAX_VALUE</code> when not specified.
*
* @return default lock timeout in number of seconds or
* <code>Long.MAX_VALUE</code> when not specified
*/ | Returns the default lock timeout in number of seconds or <code>Long.MAX_VALUE</code> when not specified | getDefaultLockTimeout | {
"repo_name": "tripodsan/jackrabbit",
"path": "jackrabbit-core/src/main/java/org/apache/jackrabbit/core/config/WorkspaceConfig.java",
"license": "apache-2.0",
"size": 9349
} | [
"org.apache.jackrabbit.core.state.ISMLocking"
] | import org.apache.jackrabbit.core.state.ISMLocking; | import org.apache.jackrabbit.core.state.*; | [
"org.apache.jackrabbit"
] | org.apache.jackrabbit; | 1,548,580 |
public static String[] getAllPluginNames(String module, Class intfc)
{
try
{
String iname = intfc.getName();
configureNamedPlugin(module, iname);
String prefix = iname + SEP;
ArrayList<String> result = new ArrayList<String>();
for (String key : namedPluginClasses.keySet())
{
if (key.startsWith(prefix))
{
result.add(key.substring(prefix.length()));
}
}
if (result.size() == 0)
{
log.error("Cannot find any names for named plugin, interface=" + iname);
}
return result.toArray(new String[result.size()]);
}
catch (ClassNotFoundException e)
{
return new String[0];
}
} | static String[] function(String module, Class intfc) { try { String iname = intfc.getName(); configureNamedPlugin(module, iname); String prefix = iname + SEP; ArrayList<String> result = new ArrayList<String>(); for (String key : namedPluginClasses.keySet()) { if (key.startsWith(prefix)) { result.add(key.substring(prefix.length())); } } if (result.size() == 0) { log.error(STR + iname); } return result.toArray(new String[result.size()]); } catch (ClassNotFoundException e) { return new String[0]; } } | /**
* Returns all of the names under which a named plugin implementing
* the interface intface can be requested (with getNamedPlugin()).
* The array is empty if there are no matches. Use this to populate
* a menu of plugins for interactive selection, or to document what
* the possible choices are.
* <p>
* NOTE: The names are NOT returned in any deterministic order.
*
* @param module the module name
* @param intfc plugin interface for which to return names.
* @return an array of strings with every name; if none are
* available an empty array is returned.
*/ | Returns all of the names under which a named plugin implementing the interface intface can be requested (with getNamedPlugin()). The array is empty if there are no matches. Use this to populate a menu of plugins for interactive selection, or to document what the possible choices are. | getAllPluginNames | {
"repo_name": "rnathanday/dryad-repo",
"path": "dspace-api/src/main/java/org/dspace/core/PluginManager.java",
"license": "bsd-3-clause",
"size": 37564
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 185,374 |
public byte[] getBytes( String name ) throws BirtException; | byte[] function( String name ) throws BirtException; | /**
* Returns the value of a bound column as the byte[] data type. Currently it
* is only a dummy implementation.
*
* @param name
* of bound column
* @return value of bound column
* @throws BirtException
*/ | Returns the value of a bound column as the byte[] data type. Currently it is only a dummy implementation | getBytes | {
"repo_name": "Charling-Huang/birt",
"path": "engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/extension/IQueryResultSet.java",
"license": "epl-1.0",
"size": 5915
} | [
"org.eclipse.birt.core.exception.BirtException"
] | import org.eclipse.birt.core.exception.BirtException; | import org.eclipse.birt.core.exception.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 2,707,020 |
public SimpleDateFormat getFormatter() {
return formatter;
} | SimpleDateFormat function() { return formatter; } | /**
* Allows us to define a date format for the display of dates/times
* @return the defined formatter
*/ | Allows us to define a date format for the display of dates/times | getFormatter | {
"repo_name": "JrmyDev/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/spinner/Picker.java",
"license": "gpl-2.0",
"size": 19356
} | [
"com.codename1.l10n.SimpleDateFormat"
] | import com.codename1.l10n.SimpleDateFormat; | import com.codename1.l10n.*; | [
"com.codename1.l10n"
] | com.codename1.l10n; | 210,689 |
void validateGetStatusRequest(GetStatusRequest request); | void validateGetStatusRequest(GetStatusRequest request); | /**
* Validates get status request using Java Bean Validation.
*
* @param request get status request
* @throws ConstraintViolationException if request is invalid
*/ | Validates get status request using Java Bean Validation | validateGetStatusRequest | {
"repo_name": "google/framework-for-osdu",
"path": "osdu-r2/os-workflow/workflow-core/src/main/java/org/opengroup/osdu/workflow/provider/interfaces/IValidationService.java",
"license": "apache-2.0",
"size": 1698
} | [
"org.opengroup.osdu.workflow.model.GetStatusRequest"
] | import org.opengroup.osdu.workflow.model.GetStatusRequest; | import org.opengroup.osdu.workflow.model.*; | [
"org.opengroup.osdu"
] | org.opengroup.osdu; | 2,638,942 |
//-----------------------------------------------------------------------
public DoubleArray getShiftAmounts() {
return shiftAmounts;
} | DoubleArray function() { return shiftAmounts; } | /**
* Gets the amount by which the y-values are shifted.
* @return the value of the property, not null
*/ | Gets the amount by which the y-values are shifted | getShiftAmounts | {
"repo_name": "jmptrader/Strata",
"path": "modules/market/src/main/java/com/opengamma/strata/market/curve/CurveParallelShifts.java",
"license": "apache-2.0",
"size": 12193
} | [
"com.opengamma.strata.collect.array.DoubleArray"
] | import com.opengamma.strata.collect.array.DoubleArray; | import com.opengamma.strata.collect.array.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 414,302 |
@Override
public void onBackPressed() {
super.onBackPressed();
Intent intent = new Intent(this, home.class);
startActivity(intent);
finish();
} | void function() { super.onBackPressed(); Intent intent = new Intent(this, home.class); startActivity(intent); finish(); } | /**
* Take care of popping the fragment back stack or finishing the activity
* as appropriate.
*/ | Take care of popping the fragment back stack or finishing the activity as appropriate | onBackPressed | {
"repo_name": "torn2537/AnimationJava",
"path": "app/src/main/java/com/example/john/project1/Quiz_Result.java",
"license": "mit",
"size": 1539
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 1,863,939 |
private static <V> Map<String, V> match(final String regularExpression, final Map<String, V> map,
final FilterType type) {
// if the properties map is empty, no need to invoke filter mechanism
if (map.isEmpty()) {
return map;
}
final Pattern pattern = Pattern.compile(regularExpression);
final Set<Entry<String, V>> entrySet = map.entrySet();
final Supplier<Stream<Entry<String, V>>> streamSupplier = entrySet::stream;
// If the provided regular expression matches all the keys of the provided map,
// there is no need to create a new map instance (in case of RETAIN type)
final boolean allMatch = streamSupplier.get().allMatch(matches(pattern, type));
if (allMatch) {
return type == RETAIN ? map : unmodifiableMap(newHashMap());
}
return streamSupplier.get().filter(matches(pattern, type))
.collect(collectingAndThen(toMap(Entry::getKey, Entry::getValue), Collections::unmodifiableMap));
} | static <V> Map<String, V> function(final String regularExpression, final Map<String, V> map, final FilterType type) { if (map.isEmpty()) { return map; } final Pattern pattern = Pattern.compile(regularExpression); final Set<Entry<String, V>> entrySet = map.entrySet(); final Supplier<Stream<Entry<String, V>>> streamSupplier = entrySet::stream; final boolean allMatch = streamSupplier.get().allMatch(matches(pattern, type)); if (allMatch) { return type == RETAIN ? map : unmodifiableMap(newHashMap()); } return streamSupplier.get().filter(matches(pattern, type)) .collect(collectingAndThen(toMap(Entry::getKey, Entry::getValue), Collections::unmodifiableMap)); } | /**
* Filters out the keys from the provided {@link Map} instance
*
* @param regularExpression
* the regular expression to match
* @param map
* the {@link Map} instance to filter
* @param type
* the associated type that signifies either to retain matched keys or remove
* @return the {@link Map} instance comprising the keys
* that match the provided regular expression
* @throws PatternSyntaxException
* If the regular expression's syntax is invalid
*/ | Filters out the keys from the provided <code>Map</code> instance | match | {
"repo_name": "gavinying/kura",
"path": "kura/org.eclipse.kura.wire.component.provider/src/main/java/org/eclipse/kura/internal/wire/regexfilter/RegexFilter.java",
"license": "epl-1.0",
"size": 12416
} | [
"java.util.Collections",
"java.util.Map",
"java.util.Set",
"java.util.function.Supplier",
"java.util.regex.Pattern",
"java.util.stream.Stream"
] | import java.util.Collections; import java.util.Map; import java.util.Set; import java.util.function.Supplier; import java.util.regex.Pattern; import java.util.stream.Stream; | import java.util.*; import java.util.function.*; import java.util.regex.*; import java.util.stream.*; | [
"java.util"
] | java.util; | 1,078,045 |
@Override
public int hashCode() {
return Objects.hash(this.typeArguments);
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Returns a {@code TypeArguments} instance that excludes all package names that are equal to {@code "java.lang"} from {@code typeArguments}.
* <p>
* If {@code typeArguments} is {@code null}, a {@code NullPointerException} will be thrown.
* <p>
* Calling this method is equivalent to the following:
* <pre>
* {@code
* TypeArguments.excludePackageName(typeArguments, "java.lang");
* }
* </pre>
*
* @param typeArguments a {@code TypeArguments} instance
* @return a {@code TypeArguments} instance that excludes all package names that are equal to {@code "java.lang"} from {@code typeArguments}
* @throws NullPointerException thrown if, and only if, {@code typeArguments} is {@code null} | int function() { return Objects.hash(this.typeArguments); } /** * Returns a {@code TypeArguments} instance that excludes all package names that are equal to {@code STR} from {@code typeArguments}. * <p> * If {@code typeArguments} is {@code null}, a {@code NullPointerException} will be thrown. * <p> * Calling this method is equivalent to the following: * <pre> * { * TypeArguments.excludePackageName(typeArguments, STR); * } * </pre> * * @param typeArguments a {@code TypeArguments} instance * @return a {@code TypeArguments} instance that excludes all package names that are equal to {@code STR} from {@code typeArguments} * @throws NullPointerException thrown if, and only if, {@code typeArguments} is {@code null} | /**
* Returns a hash code for this {@code TypeArguments} instance.
*
* @return a hash code for this {@code TypeArguments} instance
*/ | Returns a hash code for this TypeArguments instance | hashCode | {
"repo_name": "macroing/CEL4J",
"path": "src/main/java/org/macroing/cel4j/java/binary/classfile/signature/TypeArguments.java",
"license": "gpl-3.0",
"size": 10038
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 1,670,585 |
LinkedList<String> copy = new LinkedList<>(nameComponents);
// Don't edit the original object.
copy.removeFirst();
return copy;
} | LinkedList<String> copy = new LinkedList<>(nameComponents); copy.removeFirst(); return copy; } | /**
* Returns the language-formatted method name components.
*
* <p>For example: "myapi.foo.get" to ["Foo", "Get"]
*/ | Returns the language-formatted method name components. For example: "myapi.foo.get" to ["Foo", "Get"] | getMethodNameComponents | {
"repo_name": "saicheems/toolkit",
"path": "src/main/java/com/google/api/codegen/discovery/config/TypeNameGenerator.java",
"license": "apache-2.0",
"size": 4961
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 2,055,832 |
public void setWorker(float requestsPerSecond, @Nullable Integer sliceId) {
if (isWorker()) {
throw new IllegalStateException("This task is already a worker");
}
if (isLeader()) {
throw new IllegalStateException("This task is already a leader for other slice subtasks");
}
workerState = new WorkerBulkByScrollTaskState(this, sliceId, requestsPerSecond);
if (isCancelled()) {
workerState.handleCancel();
}
} | void function(float requestsPerSecond, @Nullable Integer sliceId) { if (isWorker()) { throw new IllegalStateException(STR); } if (isLeader()) { throw new IllegalStateException(STR); } workerState = new WorkerBulkByScrollTaskState(this, sliceId, requestsPerSecond); if (isCancelled()) { workerState.handleCancel(); } } | /**
* Sets this task to be a worker task that performs search requests
* @param requestsPerSecond How many search requests per second this task should make
* @param sliceId If this is is a sliced task, which slice number this task corresponds to. Null if not sliced.
*/ | Sets this task to be a worker task that performs search requests | setWorker | {
"repo_name": "s1monw/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/reindex/BulkByScrollTask.java",
"license": "apache-2.0",
"size": 24016
} | [
"org.elasticsearch.common.Nullable"
] | import org.elasticsearch.common.Nullable; | import org.elasticsearch.common.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 984,668 |
NativeToolChainInternal getForPlatform(NativeLanguage sourceLanguage, NativePlatformInternal targetMachine); | NativeToolChainInternal getForPlatform(NativeLanguage sourceLanguage, NativePlatformInternal targetMachine); | /**
* Selects the tool chain that can build binaries from the given source language that can run on the target machine.
*/ | Selects the tool chain that can build binaries from the given source language that can run on the target machine | getForPlatform | {
"repo_name": "robinverduijn/gradle",
"path": "subprojects/platform-native/src/main/java/org/gradle/nativeplatform/toolchain/internal/NativeToolChainRegistryInternal.java",
"license": "apache-2.0",
"size": 1530
} | [
"org.gradle.nativeplatform.platform.internal.NativePlatformInternal"
] | import org.gradle.nativeplatform.platform.internal.NativePlatformInternal; | import org.gradle.nativeplatform.platform.internal.*; | [
"org.gradle.nativeplatform"
] | org.gradle.nativeplatform; | 1,948,901 |
public Source resolve( String href, String base )
throws TransformerException
{
InputStream in = classLoader.getResourceAsStream(href);
return (Source)(new StreamSource(in));
}
} | Source function( String href, String base ) throws TransformerException { InputStream in = classLoader.getResourceAsStream(href); return (Source)(new StreamSource(in)); } } | /**
** Resolve XSLT pathnames invoked within stylesheet (e.g. xsl:import)
** using ClassLoader.
**
** @param href href attribute of XSLT file
** @param base base URI in affect when href attribute encountered
** @return Source object for requested XSLT file
**/ | Resolve XSLT pathnames invoked within stylesheet (e.g. xsl:import) using ClassLoader. @param href href attribute of XSLT file @param base base URI in affect when href attribute encountered @return Source object for requested XSLT file | resolve | {
"repo_name": "OpenCollabZA/sakai",
"path": "calendar/calendar-impl/impl/src/java/org/sakaiproject/calendar/impl/PDFExportService.java",
"license": "apache-2.0",
"size": 61583
} | [
"java.io.InputStream",
"javax.xml.transform.Source",
"javax.xml.transform.TransformerException",
"javax.xml.transform.stream.StreamSource"
] | import java.io.InputStream; import javax.xml.transform.Source; import javax.xml.transform.TransformerException; import javax.xml.transform.stream.StreamSource; | import java.io.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; | [
"java.io",
"javax.xml"
] | java.io; javax.xml; | 2,053,820 |
public IDataset getCoating_roughness(); | IDataset function(); | /**
* <p>
* <b>Type:</b> NX_FLOAT
* <b>Units:</b> NX_LENGTH
* </p>
*
* @return the value.
*/ | Type: NX_FLOAT Units: NX_LENGTH | getCoating_roughness | {
"repo_name": "willrogers/dawnsci",
"path": "org.eclipse.dawnsci.nexus/src/org/eclipse/dawnsci/nexus/NXgrating.java",
"license": "epl-1.0",
"size": 4507
} | [
"org.eclipse.dawnsci.analysis.api.dataset.IDataset"
] | import org.eclipse.dawnsci.analysis.api.dataset.IDataset; | import org.eclipse.dawnsci.analysis.api.dataset.*; | [
"org.eclipse.dawnsci"
] | org.eclipse.dawnsci; | 2,595,822 |
public double nextDouble() throws IOException {
int p = peeked;
if (p == PEEKED_NONE) {
p = doPeek();
}
if (p == PEEKED_LONG) {
peeked = PEEKED_NONE;
pathIndices[stackSize - 1]++;
return (double) peekedLong;
}
if (p == PEEKED_NUMBER) {
peekedString = new String(buffer, pos, peekedNumberLength);
pos += peekedNumberLength;
} else if (p == PEEKED_SINGLE_QUOTED || p == PEEKED_DOUBLE_QUOTED) {
peekedString = nextQuotedValue(p == PEEKED_SINGLE_QUOTED ? '\'' : '"');
} else if (p == PEEKED_UNQUOTED) {
peekedString = nextUnquotedValue();
} else if (p != PEEKED_BUFFERED) {
throw new IllegalStateException("Expected a double but was " + peek()
+ " at line " + getLineNumber() + " column " + getColumnNumber() + " path " + getPath());
}
peeked = PEEKED_BUFFERED;
double result = Double.parseDouble(peekedString); // don't catch this NumberFormatException.
if (!lenient && (Double.isNaN(result) || Double.isInfinite(result))) {
throw new MalformedJsonException("JSON forbids NaN and infinities: " + result
+ " at line " + getLineNumber() + " column " + getColumnNumber() + " path " + getPath());
}
peekedString = null;
peeked = PEEKED_NONE;
pathIndices[stackSize - 1]++;
return result;
} | double function() throws IOException { int p = peeked; if (p == PEEKED_NONE) { p = doPeek(); } if (p == PEEKED_LONG) { peeked = PEEKED_NONE; pathIndices[stackSize - 1]++; return (double) peekedLong; } if (p == PEEKED_NUMBER) { peekedString = new String(buffer, pos, peekedNumberLength); pos += peekedNumberLength; } else if (p == PEEKED_SINGLE_QUOTED p == PEEKED_DOUBLE_QUOTED) { peekedString = nextQuotedValue(p == PEEKED_SINGLE_QUOTED ? '\'' : 'STRExpected a double but was STR at line STR column STR path STRJSON forbids NaN and infinities: STR at line STR column STR path " + getPath()); } peekedString = null; peeked = PEEKED_NONE; pathIndices[stackSize - 1]++; return result; } | /**
* Returns the {@link com.google.gson.stream.JsonToken#NUMBER double} value of the next token,
* consuming it. If the next token is a string, this method will attempt to
* parse it as a double using {@link Double#parseDouble(String)}.
*
* @throws IllegalStateException if the next token is not a literal value.
* @throws NumberFormatException if the next literal value cannot be parsed
* as a double, or is non-finite.
*/ | Returns the <code>com.google.gson.stream.JsonToken#NUMBER double</code> value of the next token, consuming it. If the next token is a string, this method will attempt to parse it as a double using <code>Double#parseDouble(String)</code> | nextDouble | {
"repo_name": "MyJojoX/MyJojoXUtils",
"path": "MyJojoXUtils/gson/com/google/gson/stream/JsonReader.java",
"license": "mit",
"size": 51192
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,810,274 |
public Reason reason() {
return this.reason;
} | Reason function() { return this.reason; } | /**
* Get gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', 'AlreadyExists'.
*
* @return the reason value
*/ | Get gets the reason that a storage account name could not be used. The Reason element is only returned if NameAvailable is false. Possible values include: 'AccountNameInvalid', 'AlreadyExists' | reason | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/storage/v2019_04_01/implementation/CheckNameAvailabilityResultInner.java",
"license": "mit",
"size": 2272
} | [
"com.microsoft.azure.management.storage.v2019_04_01.Reason"
] | import com.microsoft.azure.management.storage.v2019_04_01.Reason; | import com.microsoft.azure.management.storage.v2019_04_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,818,820 |
public Set<String> getAllSuperAdminRoles() {
String superAdminGroups = null;
Set<String> allSuperAdminRoles = null;
try {
ApplicationConfigProperties applicationConfigProperties = ApplicationConfigProperties.getApplicationConfigProperties();
superAdminGroups = applicationConfigProperties.getProperty(USER_SUPER_ADMIN);
allSuperAdminRoles = getAllSuperAdminRoles(superAdminGroups);
} catch (IOException e) {
LOG.error("Error in fetching roles for super admin");
}
return allSuperAdminRoles;
} | Set<String> function() { String superAdminGroups = null; Set<String> allSuperAdminRoles = null; try { ApplicationConfigProperties applicationConfigProperties = ApplicationConfigProperties.getApplicationConfigProperties(); superAdminGroups = applicationConfigProperties.getProperty(USER_SUPER_ADMIN); allSuperAdminRoles = getAllSuperAdminRoles(superAdminGroups); } catch (IOException e) { LOG.error(STR); } return allSuperAdminRoles; } | /**
* This method is used to return set of string of all super admin roles.
*
* @return Set<{@link String}> if result is found else return null
*/ | This method is used to return set of string of all super admin roles | getAllSuperAdminRoles | {
"repo_name": "kuzavas/ephesoft",
"path": "dcma-user-connectivity/src/main/java/com/ephesoft/dcma/user/service/UserConnectivityServiceImpl.java",
"license": "agpl-3.0",
"size": 12158
} | [
"com.ephesoft.dcma.util.ApplicationConfigProperties",
"java.io.IOException",
"java.util.Set"
] | import com.ephesoft.dcma.util.ApplicationConfigProperties; import java.io.IOException; import java.util.Set; | import com.ephesoft.dcma.util.*; import java.io.*; import java.util.*; | [
"com.ephesoft.dcma",
"java.io",
"java.util"
] | com.ephesoft.dcma; java.io; java.util; | 1,155,597 |
private void validateMinorVersion(Path path, int minorVersion) {
if (minorVersion < MIN_MINOR_VERSION ||
minorVersion > MAX_MINOR_VERSION) {
String msg = "Minor version for path " + path +
" is expected to be between " +
MIN_MINOR_VERSION + " and " + MAX_MINOR_VERSION +
" but is found to be " + minorVersion;
LOG.error(msg);
throw new RuntimeException(msg);
}
} | void function(Path path, int minorVersion) { if (minorVersion < MIN_MINOR_VERSION minorVersion > MAX_MINOR_VERSION) { String msg = STR + path + STR + MIN_MINOR_VERSION + STR + MAX_MINOR_VERSION + STR + minorVersion; LOG.error(msg); throw new RuntimeException(msg); } } | /**
* Validates that the minor version is within acceptable limits.
* Otherwise throws an Runtime exception
*/ | Validates that the minor version is within acceptable limits. Otherwise throws an Runtime exception | validateMinorVersion | {
"repo_name": "matteobertozzi/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileReaderV2.java",
"license": "apache-2.0",
"size": 40242
} | [
"org.apache.hadoop.fs.Path"
] | import org.apache.hadoop.fs.Path; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,266,434 |
public GSSCredential createCredential (GSSName name,
int lifetime,
Oid mech,
int usage)
throws GSSException {
checkMechanism(mech);
if (name != null) {
if (name.isAnonymous()) {
return new GlobusGSSCredentialImpl();
} else {
throw new GSSException(GSSException.UNAVAILABLE);
}
}
GlobusCredential cred = null;
Subject subject = JaasSubject.getCurrentSubject();
if (subject != null) {
logger.debug("Getting credential from context");
Set gssCreds =
subject.getPrivateCredentials(GlobusGSSCredentialImpl.class);
if (gssCreds != null) {
Iterator iter = gssCreds.iterator();
if (iter.hasNext()) {
GlobusGSSCredentialImpl credImpl =
(GlobusGSSCredentialImpl)iter.next();
cred = credImpl.getGlobusCredential();
}
}
}
if (lifetime == GSSCredential.INDEFINITE_LIFETIME ||
lifetime > 0) {
// lifetime not supported
throw new GlobusGSSException(GSSException.FAILURE,
GlobusGSSException.BAD_ARGUMENT,
"badLifetime01");
}
if (cred == null) {
logger.debug("Getting default credential");
try {
cred = GlobusCredential.getDefaultCredential();
} catch(GlobusCredentialException e) {
if (e.getErrorCode() == GlobusCredentialException.EXPIRED) {
throw new GSSException(GSSException.CREDENTIALS_EXPIRED);
} else {
throw new GlobusGSSException(
GSSException.DEFECTIVE_CREDENTIAL, e);
}
} catch(Exception e) {
throw new GlobusGSSException(GSSException.DEFECTIVE_CREDENTIAL,
e);
}
return getDefaultCredential(cred, usage);
} else {
return new GlobusGSSCredentialImpl(cred, usage);
}
} | GSSCredential function (GSSName name, int lifetime, Oid mech, int usage) throws GSSException { checkMechanism(mech); if (name != null) { if (name.isAnonymous()) { return new GlobusGSSCredentialImpl(); } else { throw new GSSException(GSSException.UNAVAILABLE); } } GlobusCredential cred = null; Subject subject = JaasSubject.getCurrentSubject(); if (subject != null) { logger.debug(STR); Set gssCreds = subject.getPrivateCredentials(GlobusGSSCredentialImpl.class); if (gssCreds != null) { Iterator iter = gssCreds.iterator(); if (iter.hasNext()) { GlobusGSSCredentialImpl credImpl = (GlobusGSSCredentialImpl)iter.next(); cred = credImpl.getGlobusCredential(); } } } if (lifetime == GSSCredential.INDEFINITE_LIFETIME lifetime > 0) { throw new GlobusGSSException(GSSException.FAILURE, GlobusGSSException.BAD_ARGUMENT, STR); } if (cred == null) { logger.debug(STR); try { cred = GlobusCredential.getDefaultCredential(); } catch(GlobusCredentialException e) { if (e.getErrorCode() == GlobusCredentialException.EXPIRED) { throw new GSSException(GSSException.CREDENTIALS_EXPIRED); } else { throw new GlobusGSSException( GSSException.DEFECTIVE_CREDENTIAL, e); } } catch(Exception e) { throw new GlobusGSSException(GSSException.DEFECTIVE_CREDENTIAL, e); } return getDefaultCredential(cred, usage); } else { return new GlobusGSSCredentialImpl(cred, usage); } } | /** Acquires GSI GSS credentials. First, it tries to find the credentials
* in the private credential set of the current JAAS Subject. If the
* Subject is not set or credentials are not found in the Subject, it
* tries to get a default user credential (usually an user proxy file)
*
* @param lifetime Only lifetime set to
* {@link GSSCredential#DEFAULT_LIFETIME
* GSSCredential.DEFAULT_LIFETIME} is allowed.
* @see org.globus.gsi.GlobusCredential#getDefaultCredential()
*/ | Acquires GSI GSS credentials. First, it tries to find the credentials in the private credential set of the current JAAS Subject. If the Subject is not set or credentials are not found in the Subject, it tries to get a default user credential (usually an user proxy file) | createCredential | {
"repo_name": "NCIP/cagrid2-wsrf",
"path": "wsrf-jglobus/src/main/java/org/globus/gsi/gssapi/GlobusGSSManagerImpl.java",
"license": "bsd-3-clause",
"size": 11262
} | [
"java.util.Iterator",
"java.util.Set",
"javax.security.auth.Subject",
"org.globus.gsi.GlobusCredential",
"org.globus.gsi.GlobusCredentialException",
"org.globus.gsi.jaas.JaasSubject",
"org.ietf.jgss.GSSCredential",
"org.ietf.jgss.GSSException",
"org.ietf.jgss.GSSName",
"org.ietf.jgss.Oid"
] | import java.util.Iterator; import java.util.Set; import javax.security.auth.Subject; import org.globus.gsi.GlobusCredential; import org.globus.gsi.GlobusCredentialException; import org.globus.gsi.jaas.JaasSubject; import org.ietf.jgss.GSSCredential; import org.ietf.jgss.GSSException; import org.ietf.jgss.GSSName; import org.ietf.jgss.Oid; | import java.util.*; import javax.security.auth.*; import org.globus.gsi.*; import org.globus.gsi.jaas.*; import org.ietf.jgss.*; | [
"java.util",
"javax.security",
"org.globus.gsi",
"org.ietf.jgss"
] | java.util; javax.security; org.globus.gsi; org.ietf.jgss; | 1,171,388 |
RestResult result = RestResultFactory.getJsonRestResult();
CommonReferenceOperator object = commonReferenceOperatorRepository.findByDomain(domain);
if (object != null) {
result.setCode(HttpResponseCodes.SC_OK);
result.setBody(createJsonText(new Participant(object.getId(), object.getDomain())));
} else {
result.setCode(HttpResponseCodes.SC_NOT_FOUND);
result.getErrors().add("Common Reference Operator " + domain + " not found.");
}
return result;
}
/**
* Try and retrieve an {@link SynchronisationCongestionPoint} with the given domain name, returning it in a {@Link RestResult}.
*
* @param entityAddress a {@link String} containing the entity address of the {@link SynchronisationCongestionPoint} to be retrieved.
* @return a {@Link RestResult} | RestResult result = RestResultFactory.getJsonRestResult(); CommonReferenceOperator object = commonReferenceOperatorRepository.findByDomain(domain); if (object != null) { result.setCode(HttpResponseCodes.SC_OK); result.setBody(createJsonText(new Participant(object.getId(), object.getDomain()))); } else { result.setCode(HttpResponseCodes.SC_NOT_FOUND); result.getErrors().add(STR + domain + STR); } return result; } /** * Try and retrieve an {@link SynchronisationCongestionPoint} with the given domain name, returning it in a {@Link RestResult}. * * @param entityAddress a {@link String} containing the entity address of the {@link SynchronisationCongestionPoint} to be retrieved. * @return a {@Link RestResult} | /**
* Try and retrieve an {@link CommonReferenceOperator} with the given domain name, returning it in a {@Link RestResult}.
*
* @param domain a {@link String} containing the domain name of the {@link CommonReferenceOperator} to be retrieved.
* @return a {@Link RestResult}
*/ | Try and retrieve an <code>CommonReferenceOperator</code> with the given domain name, returning it in a RestResult | findCommonReferenceOperator | {
"repo_name": "USEF-Foundation/ri.usef.energy",
"path": "usef-build/usef-workflow/usef-dso/src/main/java/energy/usef/dso/service/business/DistributionSystemOperatorTopologyBusinessService.java",
"license": "apache-2.0",
"size": 21055
} | [
"energy.usef.core.rest.Participant",
"energy.usef.core.rest.RestResult",
"energy.usef.core.rest.RestResultFactory",
"energy.usef.dso.model.CommonReferenceOperator",
"energy.usef.dso.model.SynchronisationCongestionPoint",
"org.jboss.resteasy.util.HttpResponseCodes"
] | import energy.usef.core.rest.Participant; import energy.usef.core.rest.RestResult; import energy.usef.core.rest.RestResultFactory; import energy.usef.dso.model.CommonReferenceOperator; import energy.usef.dso.model.SynchronisationCongestionPoint; import org.jboss.resteasy.util.HttpResponseCodes; | import energy.usef.core.rest.*; import energy.usef.dso.model.*; import org.jboss.resteasy.util.*; | [
"energy.usef.core",
"energy.usef.dso",
"org.jboss.resteasy"
] | energy.usef.core; energy.usef.dso; org.jboss.resteasy; | 2,706,908 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.