method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Test
public final void testParsePacketFrameShorterThanExpectedApiEscapeMode2() throws InvalidPacketException {
// Setup the resources for the test.
byte notEscapedByte = 0x7E;
// Real package: {0x7E, 0x00, 0x09, (byte)0x88, 0x07, 0x53, 0x48, 0x00, 0x00, 0x7D, 0x33, (byte)0xA2, 0x00, 0x20}
byte[] byteArray = {0x7E, 0x00, 0x0B, (byte)0x88, 0x07, 0x53, 0x48, 0x00, 0x00, 0x7D, 0x33, (byte)0xA2, 0x00, 0x20, notEscapedByte, (byte)0x00};
exception.expect(InvalidPacketException.class);
exception.expectMessage(is(equalTo("Special byte not escaped: 0x"
+ HexUtils.byteToHexString((byte)(notEscapedByte & 0xFF)) + ".")));
// Call the method under test that should throw a InvalidPacketException.
packetParser.parsePacket(byteArray, OperatingMode.API_ESCAPE);
}
| final void function() throws InvalidPacketException { byte notEscapedByte = 0x7E; byte[] byteArray = {0x7E, 0x00, 0x0B, (byte)0x88, 0x07, 0x53, 0x48, 0x00, 0x00, 0x7D, 0x33, (byte)0xA2, 0x00, 0x20, notEscapedByte, (byte)0x00}; exception.expect(InvalidPacketException.class); exception.expectMessage(is(equalTo(STR + HexUtils.byteToHexString((byte)(notEscapedByte & 0xFF)) + "."))); packetParser.parsePacket(byteArray, OperatingMode.API_ESCAPE); } | /**
* Test method for {@link com.digi.xbee.api.packet.XBeePacketParser#parsePacket(byte[], OperatingMode)}.
*
* <p>An {@code InvalidPacketException} exception must be thrown when the
* length in the frame does not match with the payload length.</p>
*
* @throws InvalidPacketException
*/ | Test method for <code>com.digi.xbee.api.packet.XBeePacketParser#parsePacket(byte[], OperatingMode)</code>. An InvalidPacketException exception must be thrown when the length in the frame does not match with the payload length | testParsePacketFrameShorterThanExpectedApiEscapeMode2 | {
"repo_name": "digidotcom/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/packet/XBeePacketParserFromByteArrayTest.java",
"license": "mpl-2.0",
"size": 90611
} | [
"com.digi.xbee.api.exceptions.InvalidPacketException",
"com.digi.xbee.api.models.OperatingMode",
"com.digi.xbee.api.utils.HexUtils"
] | import com.digi.xbee.api.exceptions.InvalidPacketException; import com.digi.xbee.api.models.OperatingMode; import com.digi.xbee.api.utils.HexUtils; | import com.digi.xbee.api.exceptions.*; import com.digi.xbee.api.models.*; import com.digi.xbee.api.utils.*; | [
"com.digi.xbee"
] | com.digi.xbee; | 2,596,189 |
public void setIcon(Icon icon, int horizontalAlignement) {
_icon = icon;
_label.setIcon(_icon);
_label.setHorizontalAlignment(horizontalAlignement);
} | void function(Icon icon, int horizontalAlignement) { _icon = icon; _label.setIcon(_icon); _label.setHorizontalAlignment(horizontalAlignement); } | /**
* Set the icon to use
*
* @param icon
* The icon to use.
* @param horizontalAlignement
* The type of horizontal alignement.
*/ | Set the icon to use | setIcon | {
"repo_name": "paissad/waqtsalat",
"path": "src/main/java/net/paissad/waqtsalat/gui/addons/NotificationWindow.java",
"license": "gpl-3.0",
"size": 20767
} | [
"javax.swing.Icon"
] | import javax.swing.Icon; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 2,010,072 |
@BeforeClass
public static void beforeClassSetUp()
{
listIdentifiables = configureListOfIdentifiables(100);
} | static void function() { listIdentifiables = configureListOfIdentifiables(100); } | /**
* Setup for the test.
*/ | Setup for the test | beforeClassSetUp | {
"repo_name": "dbgroup-at-ucsc/dbtune",
"path": "tests/edu/ucsc/dbtune/util/BitArraySetTest.java",
"license": "bsd-3-clause",
"size": 3309
} | [
"edu.ucsc.dbtune.DBTuneInstances"
] | import edu.ucsc.dbtune.DBTuneInstances; | import edu.ucsc.dbtune.*; | [
"edu.ucsc.dbtune"
] | edu.ucsc.dbtune; | 1,786,244 |
public void storeCustomEntryType(CustomEntryType tp, int number) {
String nr = String.valueOf(number);
put(JabRefPreferences.CUSTOM_TYPE_NAME + nr, tp.getName());
put(JabRefPreferences.CUSTOM_TYPE_REQ + nr, tp.getRequiredFieldsString());
List<String> optionalFields = tp.getOptionalFields();
putStringList(JabRefPreferences.CUSTOM_TYPE_OPT + nr, optionalFields);
List<String> primaryOptionalFields = tp.getPrimaryOptionalFields();
putStringList(JabRefPreferences.CUSTOM_TYPE_PRIOPT + nr, primaryOptionalFields);
} | void function(CustomEntryType tp, int number) { String nr = String.valueOf(number); put(JabRefPreferences.CUSTOM_TYPE_NAME + nr, tp.getName()); put(JabRefPreferences.CUSTOM_TYPE_REQ + nr, tp.getRequiredFieldsString()); List<String> optionalFields = tp.getOptionalFields(); putStringList(JabRefPreferences.CUSTOM_TYPE_OPT + nr, optionalFields); List<String> primaryOptionalFields = tp.getPrimaryOptionalFields(); putStringList(JabRefPreferences.CUSTOM_TYPE_PRIOPT + nr, primaryOptionalFields); } | /**
* Stores all information about the entry type in preferences, with the tag given by number.
*/ | Stores all information about the entry type in preferences, with the tag given by number | storeCustomEntryType | {
"repo_name": "RodrigoRubino/DC-UFSCar-ES2-201601-Grupo-Brainstorm",
"path": "src/main/java/net/sf/jabref/JabRefPreferences.java",
"license": "gpl-2.0",
"size": 68637
} | [
"java.util.List",
"net.sf.jabref.model.entry.CustomEntryType"
] | import java.util.List; import net.sf.jabref.model.entry.CustomEntryType; | import java.util.*; import net.sf.jabref.model.entry.*; | [
"java.util",
"net.sf.jabref"
] | java.util; net.sf.jabref; | 2,851,810 |
EClass getAuxEllipse();
| EClass getAuxEllipse(); | /**
* Returns the meta object for class '{@link io.github.abelgomez.cpntools.AuxEllipse <em>Aux Ellipse</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Aux Ellipse</em>'.
* @see io.github.abelgomez.cpntools.AuxEllipse
* @generated
*/ | Returns the meta object for class '<code>io.github.abelgomez.cpntools.AuxEllipse Aux Ellipse</code>'. | getAuxEllipse | {
"repo_name": "abelgomez/cpntools.toolkit",
"path": "plugins/io.github.abelgomez.cpntools/src/io/github/abelgomez/cpntools/CpntoolsPackage.java",
"license": "epl-1.0",
"size": 204644
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 188,115 |
public static String extractName(Packet name)
{
return extractName(name, "chars");
} | static String function(Packet name) { return extractName(name, "chars"); } | /**
* Extracts a string from the specified packet. The packet
* must contain the variable list 'chars'
* @param name the source packet
* @return the extracted string
*/ | Extracts a string from the specified packet. The packet must contain the variable list 'chars' | extractName | {
"repo_name": "wesen/nmedit",
"path": "libs/jnmprotocol/src/net/sf/nmedit/jnmprotocol/utils/NmCharacter.java",
"license": "gpl-2.0",
"size": 5238
} | [
"net.sf.nmedit.jpdl.Packet"
] | import net.sf.nmedit.jpdl.Packet; | import net.sf.nmedit.jpdl.*; | [
"net.sf.nmedit"
] | net.sf.nmedit; | 2,036,306 |
public SystemOptions getUniversityFiscal() {
return universityFiscal;
}
| SystemOptions function() { return universityFiscal; } | /**
* Gets the universityFiscal attribute.
*
* @return Returns the universityFiscal.
*/ | Gets the universityFiscal attribute | getUniversityFiscal | {
"repo_name": "ua-eas/ua-kfs-5.3",
"path": "work/src/org/kuali/kfs/module/bc/businessobject/CalculatedSalaryFoundationTrackerOverride.java",
"license": "agpl-3.0",
"size": 14378
} | [
"org.kuali.kfs.sys.businessobject.SystemOptions"
] | import org.kuali.kfs.sys.businessobject.SystemOptions; | import org.kuali.kfs.sys.businessobject.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 59,973 |
public void setDefaultFonts(CTFonts fonts) {
ensureDocDefaults();
CTRPr runProps = defaultRunStyle.getRPr();
runProps.setRFonts(fonts);
} | void function(CTFonts fonts) { ensureDocDefaults(); CTRPr runProps = defaultRunStyle.getRPr(); runProps.setRFonts(fonts); } | /**
* Sets the default font on ctStyles DocDefaults parameter
* TODO Replace this with specific setters for each type, possibly
* on XWPFDefaultRunStyle
*/ | Sets the default font on ctStyles DocDefaults parameter TODO Replace this with specific setters for each type, possibly on XWPFDefaultRunStyle | setDefaultFonts | {
"repo_name": "lvweiwolf/poi-3.16",
"path": "src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFStyles.java",
"license": "apache-2.0",
"size": 10990
} | [
"org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts",
"org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr"
] | import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTFonts; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRPr; | import org.openxmlformats.schemas.wordprocessingml.x2006.main.*; | [
"org.openxmlformats.schemas"
] | org.openxmlformats.schemas; | 1,011,838 |
protected Config config() {
return smallInstanceConfig()
.setProperty(GroupProperty.MERGE_FIRST_RUN_DELAY_SECONDS.getName(), "5")
.setProperty(GroupProperty.MERGE_NEXT_RUN_DELAY_SECONDS.getName(), "5");
} | Config function() { return smallInstanceConfig() .setProperty(GroupProperty.MERGE_FIRST_RUN_DELAY_SECONDS.getName(), "5") .setProperty(GroupProperty.MERGE_NEXT_RUN_DELAY_SECONDS.getName(), "5"); } | /**
* Override this method to create a custom Hazelcast configuration.
*
* @return the default Hazelcast configuration
*/ | Override this method to create a custom Hazelcast configuration | config | {
"repo_name": "tufangorel/hazelcast",
"path": "hazelcast/src/test/java/com/hazelcast/test/SplitBrainTestSupport.java",
"license": "apache-2.0",
"size": 23132
} | [
"com.hazelcast.config.Config",
"com.hazelcast.spi.properties.GroupProperty"
] | import com.hazelcast.config.Config; import com.hazelcast.spi.properties.GroupProperty; | import com.hazelcast.config.*; import com.hazelcast.spi.properties.*; | [
"com.hazelcast.config",
"com.hazelcast.spi"
] | com.hazelcast.config; com.hazelcast.spi; | 2,785,639 |
public static Music PlayMusic(String name, boolean looping)
{
Music m = Manager.get("data/musics/" + name + ".mp3");
m.setLooping(looping);
m.setVolume(_musicVolume);
m.play();
if (!_musics.containsKey(name)) _musics.put(name, m);
return m;
} | static Music function(String name, boolean looping) { Music m = Manager.get(STR + name + ".mp3"); m.setLooping(looping); m.setVolume(_musicVolume); m.play(); if (!_musics.containsKey(name)) _musics.put(name, m); return m; } | /**
* Play music (.mp3)
*
* @param name the name
* @param looping the looping
* @return the music
*/ | Play music (.mp3) | PlayMusic | {
"repo_name": "DDuarte/feup-lpoo-maze_and_bombermen",
"path": "bombermen2/bombermen/src/pt/up/fe/lpoo/bombermen/Assets.java",
"license": "mit",
"size": 2766
} | [
"com.badlogic.gdx.audio.Music"
] | import com.badlogic.gdx.audio.Music; | import com.badlogic.gdx.audio.*; | [
"com.badlogic.gdx"
] | com.badlogic.gdx; | 2,803,077 |
public static ByteBuffer byteBufferDefaultValue(String bytes) {
return ByteBuffer.wrap(byteArrayDefaultValue(bytes));
}
/**
* Create a new ByteBuffer and copy all the content of {@code source} | static ByteBuffer function(String bytes) { return ByteBuffer.wrap(byteArrayDefaultValue(bytes)); } /** * Create a new ByteBuffer and copy all the content of {@code source} | /**
* Helper called by generated code to construct default values for bytes
* fields.
* <p>
* This is like {@link #bytesDefaultValue}, but returns a ByteBuffer.
*/ | Helper called by generated code to construct default values for bytes fields. This is like <code>#bytesDefaultValue</code>, but returns a ByteBuffer | byteBufferDefaultValue | {
"repo_name": "os72/protobuf-java-shaded-261",
"path": "java/src/main/java/com/github/os72/protobuf261/Internal.java",
"license": "bsd-3-clause",
"size": 14277
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 65,645 |
public void setVehicleState(VehicleState.OP_MODE vehicleState) {
this.vehicleState = vehicleState;
} | void function(VehicleState.OP_MODE vehicleState) { this.vehicleState = vehicleState; } | /**
* Set vehicle State, also refered to as operating mode
* @param vehicleState The new Vehicle State
*
* @see pt.lsts.imc.VehicleState
*/ | Set vehicle State, also refered to as operating mode | setVehicleState | {
"repo_name": "pmfg/ALVIi",
"path": "app/src/main/java/pt/lsts/accl/sys/VehicleUUV.java",
"license": "mit",
"size": 1557
} | [
"pt.lsts.imc.VehicleState"
] | import pt.lsts.imc.VehicleState; | import pt.lsts.imc.*; | [
"pt.lsts.imc"
] | pt.lsts.imc; | 390,194 |
int idx = 0;
if (obtained.size() != expected.length) {
fail("Obtained lists doesn't match on size.");
}
PriorityQueue<AllocatableAction> obtainedCopy = new PriorityQueue<>();
while (obtainedCopy.size() > 0) {
AllocatableAction action = obtainedCopy.poll();
AllocatableAction expectedAction = expected[idx];
if (!expectedAction.equals(action)) {
fail(expectedAction + " expected to be the most prioritary action and " + action + " was.");
}
idx++;
}
} | int idx = 0; if (obtained.size() != expected.length) { fail(STR); } PriorityQueue<AllocatableAction> obtainedCopy = new PriorityQueue<>(); while (obtainedCopy.size() > 0) { AllocatableAction action = obtainedCopy.poll(); AllocatableAction expectedAction = expected[idx]; if (!expectedAction.equals(action)) { fail(expectedAction + STR + action + STR); } idx++; } } | /**
* Verifies priority actions.
*
* @param obtained Obtained actions.
* @param expected Expected actions.
*/ | Verifies priority actions | verifyPriorityActions | {
"repo_name": "mF2C/COMPSs",
"path": "compss/runtime/scheduler/fullGraphScheduler/src/test/java/es/bsc/compss/scheduler/fullgraph/utils/Verifiers.java",
"license": "apache-2.0",
"size": 12902
} | [
"es.bsc.compss.scheduler.types.AllocatableAction",
"java.util.PriorityQueue",
"org.junit.Assert"
] | import es.bsc.compss.scheduler.types.AllocatableAction; import java.util.PriorityQueue; import org.junit.Assert; | import es.bsc.compss.scheduler.types.*; import java.util.*; import org.junit.*; | [
"es.bsc.compss",
"java.util",
"org.junit"
] | es.bsc.compss; java.util; org.junit; | 1,593,495 |
public Result testGetDefaultEventIndex() {
try {
if (beanInfo.getDefaultEventIndex() != 0) {
throw new LocationException("mistake DefaultEventIndex");
}
Bean1BeanInfo.verifyException();
return passed();
} catch (Exception e) {
e.printStackTrace();
return failed(e.getMessage());
}
} | Result function() { try { if (beanInfo.getDefaultEventIndex() != 0) { throw new LocationException(STR); } Bean1BeanInfo.verifyException(); return passed(); } catch (Exception e) { e.printStackTrace(); return failed(e.getMessage()); } } | /**
* Verify getDefaultEventIndex() method
*/ | Verify getDefaultEventIndex() method | testGetDefaultEventIndex | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/buildtest/tests/functional/src/test/functional/org/apache/harmony/test/func/api/java/beans/introspector/useallmethods/ReturnTheSameAsInRealBeanInfoTest.java",
"license": "apache-2.0",
"size": 5234
} | [
"java.beans.BeanInfo",
"org.apache.harmony.share.Result",
"org.apache.harmony.test.func.api.java.beans.introspector.LocationException"
] | import java.beans.BeanInfo; import org.apache.harmony.share.Result; import org.apache.harmony.test.func.api.java.beans.introspector.LocationException; | import java.beans.*; import org.apache.harmony.share.*; import org.apache.harmony.test.func.api.java.beans.introspector.*; | [
"java.beans",
"org.apache.harmony"
] | java.beans; org.apache.harmony; | 1,297,845 |
public TagCompound getCompound(String name) throws UnexpectedTagTypeException, TagNotFoundException {
return getTag(name, TagCompound.class);
}
| TagCompound function(String name) throws UnexpectedTagTypeException, TagNotFoundException { return getTag(name, TagCompound.class); } | /**
* Gets the tag of the given name and verifies that it is a compound tag
* @param name the tag's name
* @return the compound tag
* @throws UnexpectedTagTypeException the tag exists, but is not a compound tag
* @throws TagNotFoundException the tag does not exist
*/ | Gets the tag of the given name and verifies that it is a compound tag | getCompound | {
"repo_name": "Evil-Co/NBT-Lib",
"path": "src/main/java/com/evilco/mc/nbt/tag/TagCompound.java",
"license": "apache-2.0",
"size": 11261
} | [
"com.evilco.mc.nbt.error.TagNotFoundException",
"com.evilco.mc.nbt.error.UnexpectedTagTypeException"
] | import com.evilco.mc.nbt.error.TagNotFoundException; import com.evilco.mc.nbt.error.UnexpectedTagTypeException; | import com.evilco.mc.nbt.error.*; | [
"com.evilco.mc"
] | com.evilco.mc; | 2,804,376 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<ResourceNavigationLinksListResultInner>> listWithResponseAsync(
String resourceGroupName, String virtualNetworkName, String subnetName) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (virtualNetworkName == null) {
return Mono
.error(new IllegalArgumentException("Parameter virtualNetworkName is required and cannot be null."));
}
if (subnetName == null) {
return Mono.error(new IllegalArgumentException("Parameter subnetName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
final String apiVersion = "2021-05-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.list(
this.client.getEndpoint(),
resourceGroupName,
virtualNetworkName,
subnetName,
apiVersion,
this.client.getSubscriptionId(),
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<ResourceNavigationLinksListResultInner>> function( String resourceGroupName, String virtualNetworkName, String subnetName) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (virtualNetworkName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (subnetName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .list( this.client.getEndpoint(), resourceGroupName, virtualNetworkName, subnetName, apiVersion, this.client.getSubscriptionId(), accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Gets a list of resource navigation links for a subnet.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkName The name of the virtual network.
* @param subnetName The name of the subnet.
* @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 a list of resource navigation links for a subnet along with {@link Response} on successful completion of
* {@link Mono}.
*/ | Gets a list of resource navigation links for a subnet | listWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ResourceNavigationLinksClientImpl.java",
"license": "mit",
"size": 11816
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.network.fluent.models.ResourceNavigationLinksListResultInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.network.fluent.models.ResourceNavigationLinksListResultInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.network.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 486,877 |
public static PendingIntent addActionButtonToIntent(
Intent intent, Bitmap icon, String description, int id) {
PendingIntent pi = PendingIntent.getBroadcast(
InstrumentationRegistry.getTargetContext(), 0, new Intent(), 0);
intent.putExtra(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE,
makeToolbarItemBundle(icon, description, pi, id));
return pi;
} | static PendingIntent function( Intent intent, Bitmap icon, String description, int id) { PendingIntent pi = PendingIntent.getBroadcast( InstrumentationRegistry.getTargetContext(), 0, new Intent(), 0); intent.putExtra(CustomTabsIntent.EXTRA_ACTION_BUTTON_BUNDLE, makeToolbarItemBundle(icon, description, pi, id)); return pi; } | /**
* Adds an action button to the custom tab toolbar.
*
* @param intent The intent where the action button would be added.
* @param icon The icon representing the action button.
* @param description The description associated with the action button.
* @param id The unique id that would be used for this new Action button.
*
* @return The {@link PendingIntent} that will be triggered when the action button is clicked.
*/ | Adds an action button to the custom tab toolbar | addActionButtonToIntent | {
"repo_name": "ric2b/Vivaldi-browser",
"path": "chromium/chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/CustomTabsTestUtils.java",
"license": "bsd-3-clause",
"size": 14752
} | [
"android.app.PendingIntent",
"android.content.Intent",
"android.graphics.Bitmap",
"android.support.test.InstrumentationRegistry",
"androidx.browser.customtabs.CustomTabsIntent"
] | import android.app.PendingIntent; import android.content.Intent; import android.graphics.Bitmap; import android.support.test.InstrumentationRegistry; import androidx.browser.customtabs.CustomTabsIntent; | import android.app.*; import android.content.*; import android.graphics.*; import android.support.test.*; import androidx.browser.customtabs.*; | [
"android.app",
"android.content",
"android.graphics",
"android.support",
"androidx.browser"
] | android.app; android.content; android.graphics; android.support; androidx.browser; | 1,156,879 |
public void setCommittedQty (BigDecimal CommittedQty)
{
set_Value (COLUMNNAME_CommittedQty, CommittedQty);
} | void function (BigDecimal CommittedQty) { set_Value (COLUMNNAME_CommittedQty, CommittedQty); } | /** Set Committed Quantity.
@param CommittedQty
The (legal) commitment Quantity
*/ | Set Committed Quantity | setCommittedQty | {
"repo_name": "pplatek/adempiere",
"path": "base/src/org/compiere/model/X_C_ProjectLine.java",
"license": "gpl-2.0",
"size": 15521
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 36,744 |
@Test void testGroupByDaySortDescLimit() {
final String sql = "select \"brand_name\","
+ " floor(\"timestamp\" to DAY) as d,"
+ " sum(\"unit_sales\") as s\n"
+ "from \"foodmart\"\n"
+ "group by \"brand_name\", floor(\"timestamp\" to DAY)\n"
+ "order by s desc limit 30";
final String explain =
"PLAN=EnumerableInterpreter\n"
+ " DruidQuery(table=[[foodmart, foodmart]], intervals=[[1900-01-09T00:00:00.000Z/"
+ "2992-01-10T00:00:00.000Z]], projects=[[$2, FLOOR($0, FLAG(DAY)), $89]], "
+ "groups=[{0, 1}], aggs=[[SUM($2)]], sort0=[2], dir0=[DESC], fetch=[30])";
sql(sql)
.runs()
.returnsStartingWith("brand_name=Ebony; D=1997-07-27 00:00:00; S=135",
"brand_name=Tri-State; D=1997-05-09 00:00:00; S=120",
"brand_name=Hermanos; D=1997-05-09 00:00:00; S=115")
.explainContains(explain)
.queryContains(
new DruidChecker("'queryType':'groupBy'", "'granularity':'all'", "'limitSpec"
+ "':{'type':'default','limit':30,'columns':[{'dimension':'S',"
+ "'direction':'descending','dimensionOrder':'numeric'}]}"));
} | @Test void testGroupByDaySortDescLimit() { final String sql = STRbrand_name\"," + STRtimestamp\STR + STRunit_sales\STR + STRfoodmart\"\n" + STRbrand_name\STRtimestamp\STR + STR; final String explain = STR + STR + STR + STR; sql(sql) .runs() .returnsStartingWith(STR, STR, STR) .explainContains(explain) .queryContains( new DruidChecker(STR, STR, STR + STR + STR)); } | /** Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-1578">[CALCITE-1578]
* Druid adapter: wrong semantics of groupBy query limit with granularity</a>.
*
* <p>Before CALCITE-1578 was fixed, this would use a "topN" query but return
* the wrong results. */ | Test case for [CALCITE-1578] Druid adapter: wrong semantics of groupBy query limit with granularity. Before CALCITE-1578 was fixed, this would use a "topN" query but return | testGroupByDaySortDescLimit | {
"repo_name": "jcamachor/calcite",
"path": "druid/src/test/java/org/apache/calcite/test/DruidAdapter2IT.java",
"license": "apache-2.0",
"size": 201537
} | [
"org.junit.jupiter.api.Test"
] | import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 2,228,619 |
void build() {
NodeTraversal.traverse(compiler, scope.getRootNode(), this);
AstFunctionContents contents =
getFunctionAnalysisResults(scope.getRootNode());
if (contents != null) {
for (String varName : contents.getEscapedVarNames()) {
Var v = scope.getVar(varName);
Preconditions.checkState(v.getScope() == scope);
v.markEscaped();
}
for (Multiset.Entry<String> entry :
contents.getAssignedNameCounts().entrySet()) {
Var v = scope.getVar(entry.getElement());
Preconditions.checkState(v.getScope() == scope);
if (entry.getCount() == 1) {
v.markAssignedExactlyOnce();
}
}
}
} | void build() { NodeTraversal.traverse(compiler, scope.getRootNode(), this); AstFunctionContents contents = getFunctionAnalysisResults(scope.getRootNode()); if (contents != null) { for (String varName : contents.getEscapedVarNames()) { Var v = scope.getVar(varName); Preconditions.checkState(v.getScope() == scope); v.markEscaped(); } for (Multiset.Entry<String> entry : contents.getAssignedNameCounts().entrySet()) { Var v = scope.getVar(entry.getElement()); Preconditions.checkState(v.getScope() == scope); if (entry.getCount() == 1) { v.markAssignedExactlyOnce(); } } } } | /**
* Traverse the scope root and build it.
*/ | Traverse the scope root and build it | build | {
"repo_name": "abdullah38rcc/closure-compiler",
"path": "src/com/google/javascript/jscomp/TypedScopeCreator.java",
"license": "apache-2.0",
"size": 77579
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Multiset",
"com.google.javascript.jscomp.FunctionTypeBuilder",
"com.google.javascript.jscomp.Scope"
] | import com.google.common.base.Preconditions; import com.google.common.collect.Multiset; import com.google.javascript.jscomp.FunctionTypeBuilder; import com.google.javascript.jscomp.Scope; | import com.google.common.base.*; import com.google.common.collect.*; import com.google.javascript.jscomp.*; | [
"com.google.common",
"com.google.javascript"
] | com.google.common; com.google.javascript; | 739,566 |
private void loadDictionaryResource(String resourceName) throws IOException {
InputStream is = SpellDictionary.class.getResourceAsStream(resourceName);
if (is == null) {
throw new FileNotFoundException("Spell dictionary resource '" + resourceName + "' couldn't be found!");
} else {
dictionary.addDictionary(new InputStreamReader(is));
}
} | void function(String resourceName) throws IOException { InputStream is = SpellDictionary.class.getResourceAsStream(resourceName); if (is == null) { throw new FileNotFoundException(STR + resourceName + STR); } else { dictionary.addDictionary(new InputStreamReader(is)); } } | /**
* Loads the dictionary from a resource.
*
* @param resourceName the dictionary file resource
* @throws - FileNotFoundException if the dictionary file doesn't exist -
* IOException if the dictionary file couldn't be read
*/ | Loads the dictionary from a resource | loadDictionaryResource | {
"repo_name": "ckristo/AIC-WS2014-G4-T1-Sentimental-Analysis",
"path": "src/main/java/at/ac/tuwien/infosys/dsg/aic/ws2014/g4/t1/classifier/SpellDictionary.java",
"license": "mit",
"size": 3532
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader"
] | import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
] | java.io; | 907,574 |
public static void setup() throws SVNClientException {
if (!CmdLineClientAdapter12.isAvailable()) {
throw new SVNClientException("Command line client adapter is not available");
}
is13ClientAvailable = CmdLineClientAdapter.isAvailable();
SVNClientAdapterFactory.registerAdapterFactory(new CmdLineClientAdapterFactory());
} | static void function() throws SVNClientException { if (!CmdLineClientAdapter12.isAvailable()) { throw new SVNClientException(STR); } is13ClientAvailable = CmdLineClientAdapter.isAvailable(); SVNClientAdapterFactory.registerAdapterFactory(new CmdLineClientAdapterFactory()); } | /**
* Setup the client adapter implementation and register it in the adapters factory
* @throws SVNClientException
*/ | Setup the client adapter implementation and register it in the adapters factory | setup | {
"repo_name": "subclipse/svnclientadapter",
"path": "cmdline/src/main/java/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapterFactory.java",
"license": "apache-2.0",
"size": 2894
} | [
"org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory",
"org.tigris.subversion.svnclientadapter.SVNClientException"
] | import org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory; import org.tigris.subversion.svnclientadapter.SVNClientException; | import org.tigris.subversion.svnclientadapter.*; | [
"org.tigris.subversion"
] | org.tigris.subversion; | 2,352,278 |
public RawData getRawData(int id)
throws DatabaseException {
// Connect to the database:
try {
Statement statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT * FROM Raw WHERE Structured <> 1 AND ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData;
}
rs = statement.executeQuery("SELECT * FROM Raw NATURAL JOIN RawBook WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new Book(rs));
}
rs = statement.executeQuery("SELECT * FROM Raw NATURAL JOIN RawArticle WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new Article(rs));
}
rs = statement.executeQuery("SELECT * FROM Raw NATURAL JOIN RawReport WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new Report(rs));
}
rs = statement
.executeQuery("SELECT * FROM Raw NATURAL JOIN RawConference WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new Conference(rs));
}
rs = statement
.executeQuery("SELECT * FROM Raw NATURAL JOIN RawSoftwareRepository WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new SoftwareRepository(rs));
}
rs = statement
.executeQuery("SELECT * FROM Raw NATURAL JOIN RawInterestingWebsite WHERE Raw.ID = " + id + ";");
if (rs.first()) {
RawData rawData
= new RawData( rs.getInt("ID"),
rs.getString("Source"));
return rawData.setStructure(new InterestingWebsite(rs));
}
throw new DatabaseException("The raw data object with ID " + id + " was not found in the database.");
}
// Exception handling:
catch (SQLException e) {
throw new DatabaseException(
"SQL Exception: " + e.getMessage());
}
catch (DatabaseException e) {
throw e;
}
catch (Exception e) {
throw new DatabaseException(
"The raw database has caught an unexpected " +
"exception: " + e.getMessage());
}
} | RawData function(int id) throws DatabaseException { try { Statement statement = getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE); ResultSet rs = statement.executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData; } rs = statement.executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new Book(rs)); } rs = statement.executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new Article(rs)); } rs = statement.executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new Report(rs)); } rs = statement .executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new Conference(rs)); } rs = statement .executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new SoftwareRepository(rs)); } rs = statement .executeQuery(STR + id + ";"); if (rs.first()) { RawData rawData = new RawData( rs.getInt("ID"), rs.getString(STR)); return rawData.setStructure(new InterestingWebsite(rs)); } throw new DatabaseException(STR + id + STR); } catch (SQLException e) { throw new DatabaseException( STR + e.getMessage()); } catch (DatabaseException e) { throw e; } catch (Exception e) { throw new DatabaseException( STR + STR + e.getMessage()); } } | /**
* Returns a specific raw data object.
*/ | Returns a specific raw data object | getRawData | {
"repo_name": "mathieu-reymond/software-architectures",
"path": "src/softarch/portal/db/sql/RawDatabase.java",
"license": "mit",
"size": 8399
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,842,304 |
public void onTradesClick() {
Intent intent = new Intent(this.activity, TradesActivity.class);
activity.startActivity(intent);
} | void function() { Intent intent = new Intent(this.activity, TradesActivity.class); activity.startActivity(intent); } | /**
* Directs to TradesActivity.
*/ | Directs to TradesActivity | onTradesClick | {
"repo_name": "CMPUT301F15T01/YesWeCandroid",
"path": "app/src/main/java/ca/ualberta/trinkettrader/HomePageController.java",
"license": "apache-2.0",
"size": 2055
} | [
"android.content.Intent",
"ca.ualberta.trinkettrader.Trades"
] | import android.content.Intent; import ca.ualberta.trinkettrader.Trades; | import android.content.*; import ca.ualberta.trinkettrader.*; | [
"android.content",
"ca.ualberta.trinkettrader"
] | android.content; ca.ualberta.trinkettrader; | 243,796 |
public int peek() {
if (size == 0)
throw new EmptyStackException();
return list[size - 1];
}
| int function() { if (size == 0) throw new EmptyStackException(); return list[size - 1]; } | /**
* Returns the int at the top of the stack without removing it
*
* @return int at the top of this stack.
* @exception EmptyStackException
* when empty.
*/ | Returns the int at the top of the stack without removing it | peek | {
"repo_name": "paulvi/angularjs-eclipse",
"path": "org.eclipse.angularjs.core/src/org/eclipse/angularjs/internal/core/documentModel/parser/IntStack.java",
"license": "epl-1.0",
"size": 2538
} | [
"java.util.EmptyStackException"
] | import java.util.EmptyStackException; | import java.util.*; | [
"java.util"
] | java.util; | 729,123 |
public static final void addAlliance(League league, PlayerAlliance alliance) {
Preconditions.checkNotNull(league, "League should not be null");
league.onEvent(new LeagueEnteredEvent(league, alliance));
}
| static final void function(League league, PlayerAlliance alliance) { Preconditions.checkNotNull(league, STR); league.onEvent(new LeagueEnteredEvent(league, alliance)); } | /**
* Add alliance to league
*/ | Add alliance to league | addAlliance | {
"repo_name": "GiGatR00n/Aion-Core-v4.7.5",
"path": "AC-Game/src/com/aionemu/gameserver/model/team2/league/LeagueService.java",
"license": "gpl-2.0",
"size": 7054
} | [
"com.aionemu.gameserver.model.team2.alliance.PlayerAlliance",
"com.aionemu.gameserver.model.team2.league.events.LeagueEnteredEvent",
"com.google.common.base.Preconditions"
] | import com.aionemu.gameserver.model.team2.alliance.PlayerAlliance; import com.aionemu.gameserver.model.team2.league.events.LeagueEnteredEvent; import com.google.common.base.Preconditions; | import com.aionemu.gameserver.model.team2.alliance.*; import com.aionemu.gameserver.model.team2.league.events.*; import com.google.common.base.*; | [
"com.aionemu.gameserver",
"com.google.common"
] | com.aionemu.gameserver; com.google.common; | 8,847 |
String stripPermissionless(String permissionPrefixColour, String permissionPrefixStyle, Subject source, String text); | String stripPermissionless(String permissionPrefixColour, String permissionPrefixStyle, Subject source, String text); | /**
* Removes formating codes based on permission.
*
* @param permissionPrefixColour The prefix of the permission to check for text colours
* @param permissionPrefixStyle The prefix of the permission to check for text styles
* @param text The text to strip
* @return The text with the formatting stripped.
*/ | Removes formating codes based on permission | stripPermissionless | {
"repo_name": "NucleusPowered/Nucleus",
"path": "nucleus-core/src/main/java/io/github/nucleuspowered/nucleus/core/services/interfaces/ITextStyleService.java",
"license": "mit",
"size": 3794
} | [
"org.spongepowered.api.service.permission.Subject"
] | import org.spongepowered.api.service.permission.Subject; | import org.spongepowered.api.service.permission.*; | [
"org.spongepowered.api"
] | org.spongepowered.api; | 2,162,379 |
public LineMessagingService build() {
if (okHttpClientBuilder == null) {
okHttpClientBuilder = new OkHttpClient.Builder();
interceptors.forEach(okHttpClientBuilder::addInterceptor);
}
okHttpClientBuilder
.connectTimeout(connectTimeout, TimeUnit.MILLISECONDS)
.readTimeout(readTimeout, TimeUnit.MILLISECONDS)
.writeTimeout(writeTimeout, TimeUnit.MILLISECONDS);
final OkHttpClient okHttpClient = okHttpClientBuilder.build();
if (retrofitBuilder == null) {
retrofitBuilder = createDefaultRetrofitBuilder();
}
retrofitBuilder.client(okHttpClient);
retrofitBuilder.baseUrl(apiEndPoint);
final Retrofit retrofit = retrofitBuilder.build();
return retrofit.create(LineMessagingService.class);
} | LineMessagingService function() { if (okHttpClientBuilder == null) { okHttpClientBuilder = new OkHttpClient.Builder(); interceptors.forEach(okHttpClientBuilder::addInterceptor); } okHttpClientBuilder .connectTimeout(connectTimeout, TimeUnit.MILLISECONDS) .readTimeout(readTimeout, TimeUnit.MILLISECONDS) .writeTimeout(writeTimeout, TimeUnit.MILLISECONDS); final OkHttpClient okHttpClient = okHttpClientBuilder.build(); if (retrofitBuilder == null) { retrofitBuilder = createDefaultRetrofitBuilder(); } retrofitBuilder.client(okHttpClient); retrofitBuilder.baseUrl(apiEndPoint); final Retrofit retrofit = retrofitBuilder.build(); return retrofit.create(LineMessagingService.class); } | /**
* Creates a new {@link LineMessagingService}.
*/ | Creates a new <code>LineMessagingService</code> | build | {
"repo_name": "xinmi/line-bot",
"path": "line-bot-api-client/src/main/java/com/linecorp/bot/client/LineMessagingServiceBuilder.java",
"license": "apache-2.0",
"size": 5655
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,245,500 |
public static UUID UUIDFromString(final String input) {
// TODO: Add unit tests.
final int len = input.length();
if (len == 36) {
return UUID.fromString(input);
} else if (len == 32) {
// TODO: Might better translate to longs right away !?
// Fill in '-'
char[] chars = input.toCharArray();
char[] newChars = new char[36];
int index = 0;
int targetIndex = 0;
while (targetIndex < 36) {
newChars[targetIndex] = chars[index];
index ++;
targetIndex ++;
switch (index) {
case 8:
case 12:
case 16:
case 20:
newChars[targetIndex] = '-';
targetIndex ++;
break;
default:
break;
}
}
return UUID.fromString(new String(newChars));
} else {
throw new IllegalArgumentException("Unexpected length (" + len + ") for uuid: " + input);
}
}
| static UUID function(final String input) { final int len = input.length(); if (len == 36) { return UUID.fromString(input); } else if (len == 32) { char[] chars = input.toCharArray(); char[] newChars = new char[36]; int index = 0; int targetIndex = 0; while (targetIndex < 36) { newChars[targetIndex] = chars[index]; index ++; targetIndex ++; switch (index) { case 8: case 12: case 16: case 20: newChars[targetIndex] = '-'; targetIndex ++; break; default: break; } } return UUID.fromString(new String(newChars)); } else { throw new IllegalArgumentException(STR + len + STR + input); } } | /**
* More flexible UUID parsing.<br>
* (Taken from TrustCore.)
*
* @param input
* the input
* @return the uuid
*/ | More flexible UUID parsing. (Taken from TrustCore.) | UUIDFromString | {
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCommons/src/main/java/fr/neatmonster/nocheatplus/utilities/IdUtil.java",
"license": "gpl-3.0",
"size": 2693
} | [
"java.util.UUID"
] | import java.util.UUID; | import java.util.*; | [
"java.util"
] | java.util; | 2,860,698 |
//TODO we dont know this is correct because need an independent way of checking our figures with an ASF file,
//the previous calculation appeard incorrect.
public void testDateHeaderConversion()
{
Calendar cal = org.jaudiotagger.audio.asf.util.Utils.getDateOf(BigInteger.valueOf(1964448000));
System.out.println(cal.getTime());
assertEquals(-11644273555200l,cal.getTimeInMillis());
} | void function() { Calendar cal = org.jaudiotagger.audio.asf.util.Utils.getDateOf(BigInteger.valueOf(1964448000)); System.out.println(cal.getTime()); assertEquals(-11644273555200l,cal.getTimeInMillis()); } | /**
* Test date conversion
*/ | Test date conversion | testDateHeaderConversion | {
"repo_name": "ConatyConsulting/jaudiotagger",
"path": "srctest/org/jaudiotagger/audio/asf/io/AsfHeaderUtils.java",
"license": "lgpl-2.1",
"size": 3860
} | [
"java.math.BigInteger",
"java.util.Calendar",
"org.jaudiotagger.audio.asf.util.Utils"
] | import java.math.BigInteger; import java.util.Calendar; import org.jaudiotagger.audio.asf.util.Utils; | import java.math.*; import java.util.*; import org.jaudiotagger.audio.asf.util.*; | [
"java.math",
"java.util",
"org.jaudiotagger.audio"
] | java.math; java.util; org.jaudiotagger.audio; | 1,038,869 |
@Test
public final void testTimeStamp() {
final TimeStamp testTimeStamp1 = new TimeStamp();
assertNotNull("Value cannot be null", testTimeStamp1);
LOG.debug("TimeStamp = {}", testTimeStamp1);
final TimeStamp testTimeStamp2 = new TimeStamp();
assertNotNull("Value cannot be null", testTimeStamp2);
LOG.debug("TimeStamp = {}", testTimeStamp2);
assertNotSame("Not same", testTimeStamp1, testTimeStamp2);
LOG.trace("{}", testTimeStamp1);
LOG.trace("{}", testTimeStamp1.time);
LOG.trace("{}", testTimeStamp1.toString());
LOG.trace("{}", testTimeStamp2);
LOG.trace("{}", testTimeStamp2.time);
LOG.trace(testTimeStamp2.toString());
LOG.trace(TimeStamp.TIMESTAMP_FORMAT);
}
| final void function() { final TimeStamp testTimeStamp1 = new TimeStamp(); assertNotNull(STR, testTimeStamp1); LOG.debug(STR, testTimeStamp1); final TimeStamp testTimeStamp2 = new TimeStamp(); assertNotNull(STR, testTimeStamp2); LOG.debug(STR, testTimeStamp2); assertNotSame(STR, testTimeStamp1, testTimeStamp2); LOG.trace("{}", testTimeStamp1); LOG.trace("{}", testTimeStamp1.time); LOG.trace("{}", testTimeStamp1.toString()); LOG.trace("{}", testTimeStamp2); LOG.trace("{}", testTimeStamp2.time); LOG.trace(testTimeStamp2.toString()); LOG.trace(TimeStamp.TIMESTAMP_FORMAT); } | /**
* Unit test case for the TimeStamp class.
*/ | Unit test case for the TimeStamp class | testTimeStamp | {
"repo_name": "Martin-Spamer/WiCast",
"path": "wicast-heartbeat/src/test/java/net/wicast/heartbeat/TimeStampTest.java",
"license": "gpl-3.0",
"size": 1558
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,404,539 |
public GridStaticCellType getCellType() {
return cellState.type;
} | GridStaticCellType function() { return cellState.type; } | /**
* Returns the type of content stored in this cell.
*
* @return cell content type
*/ | Returns the type of content stored in this cell | getCellType | {
"repo_name": "Darsstar/framework",
"path": "server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java",
"license": "apache-2.0",
"size": 27228
} | [
"com.vaadin.shared.ui.grid.GridStaticCellType"
] | import com.vaadin.shared.ui.grid.GridStaticCellType; | import com.vaadin.shared.ui.grid.*; | [
"com.vaadin.shared"
] | com.vaadin.shared; | 45,222 |
public void tileFrames() {
manager.setNormalSize();
Component allFrames[] = getAllFrames();
int frameHeight = getBounds().height/allFrames.length;
int y = 0;
for(int i = 0; i < allFrames.length; i++) {
allFrames[i].setSize(getBounds().width,frameHeight);
allFrames[i].setLocation(0,y);
y = y + frameHeight;
}
}
| void function() { manager.setNormalSize(); Component allFrames[] = getAllFrames(); int frameHeight = getBounds().height/allFrames.length; int y = 0; for(int i = 0; i < allFrames.length; i++) { allFrames[i].setSize(getBounds().width,frameHeight); allFrames[i].setLocation(0,y); y = y + frameHeight; } } | /**
* Tile all internal frames
*/ | Tile all internal frames | tileFrames | {
"repo_name": "shvets/cafebabe",
"path": "mdi/src/main/java/org/sf/mdi/MDIDesktopPane.java",
"license": "mit",
"size": 3617
} | [
"java.awt.Component"
] | import java.awt.Component; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,583,939 |
void createGroup(String groupName, List<GrantedAuthority> authorities); | void createGroup(String groupName, List<GrantedAuthority> authorities); | /**
* Creates a new group with the specified list of authorities.
*
* @param groupName the name for the new group
* @param authorities the authorities which are to be allocated to this group.
*/ | Creates a new group with the specified list of authorities | createGroup | {
"repo_name": "zshift/spring-security",
"path": "core/src/main/java/org/springframework/security/provisioning/GroupManager.java",
"license": "apache-2.0",
"size": 2458
} | [
"java.util.List",
"org.springframework.security.core.GrantedAuthority"
] | import java.util.List; import org.springframework.security.core.GrantedAuthority; | import java.util.*; import org.springframework.security.core.*; | [
"java.util",
"org.springframework.security"
] | java.util; org.springframework.security; | 2,209,620 |
public BigDecimal getTargetQty ()
{
BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TargetQty);
if (bd == null)
return Env.ZERO;
return bd;
} | BigDecimal function () { BigDecimal bd = (BigDecimal)get_Value(COLUMNNAME_TargetQty); if (bd == null) return Env.ZERO; return bd; } | /** Get Target Quantity.
@return Target Movement Quantity
*/ | Get Target Quantity | getTargetQty | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/model/X_M_MovementLineConfirm.java",
"license": "gpl-2.0",
"size": 8788
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 2,396,376 |
@Nullable
protected ClusterBlockLevel globalBlockLevel() {
return null;
} | ClusterBlockLevel function() { return null; } | /**
* Cluster level block to check before request execution. Returning null means that no blocks need to be checked.
*/ | Cluster level block to check before request execution. Returning null means that no blocks need to be checked | globalBlockLevel | {
"repo_name": "Stacey-Gammon/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/action/support/replication/TransportReplicationAction.java",
"license": "apache-2.0",
"size": 57090
} | [
"org.elasticsearch.cluster.block.ClusterBlockLevel"
] | import org.elasticsearch.cluster.block.ClusterBlockLevel; | import org.elasticsearch.cluster.block.*; | [
"org.elasticsearch.cluster"
] | org.elasticsearch.cluster; | 2,026,194 |
private void loadAttributes(AttributeSet attrs) {
if (attrs != null) {
TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.Picker);
if (typedArray != null) {
textColor = typedArray.getColor(R.styleable.Picker_textColor, textColor);
dialColor = typedArray.getColor(R.styleable.Picker_dialColor, dialColor);
clockColor = typedArray.getColor(R.styleable.Picker_clockColor, clockColor);
canvasColor = typedArray.getColor(R.styleable.Picker_canvasColor, canvasColor);
hourFormat = typedArray.getBoolean(R.styleable.Picker_hourFormat, hourFormat);
trackSize = typedArray.getDimensionPixelSize(R.styleable.Picker_trackSize, trackSize);
dialRadiusDP = typedArray.getDimensionPixelSize(R.styleable.Picker_dialRadius, dialRadiusDP);
typedArray.recycle();
}
}
} | void function(AttributeSet attrs) { if (attrs != null) { TypedArray typedArray = getContext().obtainStyledAttributes(attrs, R.styleable.Picker); if (typedArray != null) { textColor = typedArray.getColor(R.styleable.Picker_textColor, textColor); dialColor = typedArray.getColor(R.styleable.Picker_dialColor, dialColor); clockColor = typedArray.getColor(R.styleable.Picker_clockColor, clockColor); canvasColor = typedArray.getColor(R.styleable.Picker_canvasColor, canvasColor); hourFormat = typedArray.getBoolean(R.styleable.Picker_hourFormat, hourFormat); trackSize = typedArray.getDimensionPixelSize(R.styleable.Picker_trackSize, trackSize); dialRadiusDP = typedArray.getDimensionPixelSize(R.styleable.Picker_dialRadius, dialRadiusDP); typedArray.recycle(); } } } | /**
* Set picker's attrinbutes from xml file
* @param attrs
*/ | Set picker's attrinbutes from xml file | loadAttributes | {
"repo_name": "SeanCherngTW/CIN-NoBile",
"path": "appGO2/TimePickerLib/src/main/java/picker/ugurtekbas/com/Picker/Picker.java",
"license": "mit",
"size": 12286
} | [
"android.content.res.TypedArray",
"android.util.AttributeSet"
] | import android.content.res.TypedArray; import android.util.AttributeSet; | import android.content.res.*; import android.util.*; | [
"android.content",
"android.util"
] | android.content; android.util; | 2,277,730 |
public void setActivateBearerRetryN3485Value(short activateBearerRetryN3485Value)
throws JNCException {
setActivateBearerRetryN3485Value(new YangUInt8(activateBearerRetryN3485Value));
} | void function(short activateBearerRetryN3485Value) throws JNCException { setActivateBearerRetryN3485Value(new YangUInt8(activateBearerRetryN3485Value)); } | /**
* Sets the value for child leaf "activate-bearer-retry-n3485",
* using Java primitive values.
* @param activateBearerRetryN3485Value used during instantiation.
*/ | Sets the value for child leaf "activate-bearer-retry-n3485", using Java primitive values | setActivateBearerRetryN3485Value | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/interface_/nas/MmeNasSm.java",
"license": "apache-2.0",
"size": 46144
} | [
"com.tailf.jnc.YangUInt8"
] | import com.tailf.jnc.YangUInt8; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 1,014,219 |
public SDBResult batchDeleteAttributes(List<Item> items) throws SDBException {
Map<String, String> params = new HashMap<String, String>();
params.put("DomainName", domainName);
int k=1;
for (Item item : items) {
params.put("Item."+k+".ItemName", item.getIdentifier());
int i=1;
for (String attr : item.getAttributes().keySet()) {
Set<String> vals = item.getAttributeValues(attr);
if (vals != null && vals.size() > 0) {
for (String val : vals) {
params.put("Item."+k+".Attribute."+i+".Name", attr);
params.put("Item."+k+".Attribute."+i+".Value", val);
i++;
// if (attr.isReplace()) {
// params.put("Item."+k+".Attribute."+i+".Replace", "true");
// }
}
}
}
k++;
}
HttpGet method = new HttpGet();
BatchDeleteAttributesResponse response =
makeRequestInt(method, "BatchDeleteAttributes", params, BatchDeleteAttributesResponse.class);
return new SDBResult(response.getResponseMetadata().getRequestId(),
response.getResponseMetadata().getBoxUsage());
}
| SDBResult function(List<Item> items) throws SDBException { Map<String, String> params = new HashMap<String, String>(); params.put(STR, domainName); int k=1; for (Item item : items) { params.put("Item."+k+STR, item.getIdentifier()); int i=1; for (String attr : item.getAttributes().keySet()) { Set<String> vals = item.getAttributeValues(attr); if (vals != null && vals.size() > 0) { for (String val : vals) { params.put("Item."+k+STR+i+".Name", attr); params.put("Item."+k+STR+i+STR, val); i++; } } } k++; } HttpGet method = new HttpGet(); BatchDeleteAttributesResponse response = makeRequestInt(method, STR, params, BatchDeleteAttributesResponse.class); return new SDBResult(response.getResponseMetadata().getRequestId(), response.getResponseMetadata().getBoxUsage()); } | /**
* Batch deletes multiple items w/ attributes
*
* @param attributes list of attributes to delete
* @throws SDBException wraps checked exceptions
*/ | Batch deletes multiple items w/ attributes | batchDeleteAttributes | {
"repo_name": "jonnyzzz/maragogype",
"path": "trunk/java/com/xerox/amazonws/simpledb/Domain.java",
"license": "apache-2.0",
"size": 19228
} | [
"com.xerox.amazonws.typica.sdb.jaxb.BatchDeleteAttributesResponse",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.apache.http.client.methods.HttpGet"
] | import com.xerox.amazonws.typica.sdb.jaxb.BatchDeleteAttributesResponse; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.http.client.methods.HttpGet; | import com.xerox.amazonws.typica.sdb.jaxb.*; import java.util.*; import org.apache.http.client.methods.*; | [
"com.xerox.amazonws",
"java.util",
"org.apache.http"
] | com.xerox.amazonws; java.util; org.apache.http; | 1,800,443 |
static int[] getArgTypes(Method method) {
Class<?>[] paramClasses = method.getParameterTypes();
int[] paramTypes = new int[paramClasses.length];
for (int i = 0; i < paramTypes.length; i++) {
paramTypes[i] = Primitives.getNativeType(paramClasses[i]);
}
return paramTypes;
} | static int[] getArgTypes(Method method) { Class<?>[] paramClasses = method.getParameterTypes(); int[] paramTypes = new int[paramClasses.length]; for (int i = 0; i < paramTypes.length; i++) { paramTypes[i] = Primitives.getNativeType(paramClasses[i]); } return paramTypes; } | /**
* Gets an internal representation of the argument types used by the native interface
*
* @param method The Method object used to retrieve the argument types
* @return The internal representation of the argument types
*/ | Gets an internal representation of the argument types used by the native interface | getArgTypes | {
"repo_name": "apperian/JavaAccessor",
"path": "src/com/apperian/javautil/Methods.java",
"license": "mit",
"size": 4540
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,272,704 |
TraversalRequest forChangedRootPath(Path newRoot) {
return duplicate(RootedPath.toRootedPath(newRoot, path.getRelativePath()),
skipTestingForSubpackage);
} | TraversalRequest forChangedRootPath(Path newRoot) { return duplicate(RootedPath.toRootedPath(newRoot, path.getRelativePath()), skipTestingForSubpackage); } | /**
* Creates a new request for a changed root.
*
* <p>This method can be used when a package is found out to be under a different root path than
* originally assumed.
*/ | Creates a new request for a changed root. This method can be used when a package is found out to be under a different root path than originally assumed | forChangedRootPath | {
"repo_name": "mikelikespie/bazel",
"path": "src/main/java/com/google/devtools/build/lib/skyframe/RecursiveFilesystemTraversalValue.java",
"license": "apache-2.0",
"size": 23779
} | [
"com.google.devtools.build.lib.vfs.Path",
"com.google.devtools.build.lib.vfs.RootedPath"
] | import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.RootedPath; | import com.google.devtools.build.lib.vfs.*; | [
"com.google.devtools"
] | com.google.devtools; | 39,159 |
@SuppressWarnings("unchecked")
public List<String> getActionIDs() {
return (List<String>) getValue(LIST_IDS);
} | @SuppressWarnings(STR) List<String> function() { return (List<String>) getValue(LIST_IDS); } | /**
* Returns a list of action ids which indicates that this is a composite
* action.
* @return a valid list of action ids or null
*/ | Returns a list of action ids which indicates that this is a composite action | getActionIDs | {
"repo_name": "syncer/swingx",
"path": "swingx-action/src/main/java/org/jdesktop/swingx/action/CompositeAction.java",
"license": "lgpl-2.1",
"size": 4479
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 232,289 |
public void update(LimitOrder limitOrder) {
update(getOrders(limitOrder.getType()), limitOrder);
updateDate(limitOrder.getTimestamp());
}
| void function(LimitOrder limitOrder) { update(getOrders(limitOrder.getType()), limitOrder); updateDate(limitOrder.getTimestamp()); } | /**
* Given a new LimitOrder, it will replace a matching limit order in the orderbook if one is found, or add the new LimitOrder if one is not.
* timeStamp will be updated if the new timestamp is non-null and in the future.
*
* @param limitOrder the new LimitOrder
*/ | Given a new LimitOrder, it will replace a matching limit order in the orderbook if one is found, or add the new LimitOrder if one is not. timeStamp will be updated if the new timestamp is non-null and in the future | update | {
"repo_name": "gaborkolozsy/XChange",
"path": "xchange-core/src/main/java/org/knowm/xchange/dto/marketdata/OrderBook.java",
"license": "mit",
"size": 6053
} | [
"org.knowm.xchange.dto.trade.LimitOrder"
] | import org.knowm.xchange.dto.trade.LimitOrder; | import org.knowm.xchange.dto.trade.*; | [
"org.knowm.xchange"
] | org.knowm.xchange; | 50,505 |
public static String toString(final Object... array) {
final StringBuilder buffer = new StringBuilder("[");
int count = 0;
if (array != null) {
for (final Object element : array) {
buffer.append(count++ > 0 ? ", " : StringUtils.EMPTY).append(element);
}
}
buffer.append("]");
return buffer.toString();
} | static String function(final Object... array) { final StringBuilder buffer = new StringBuilder("["); int count = 0; if (array != null) { for (final Object element : array) { buffer.append(count++ > 0 ? STR : StringUtils.EMPTY).append(element); } } buffer.append("]"); return buffer.toString(); } | /**
* Converts the specified Object array into a String representation.
* <p/>
*
* @param array the Object array of elements to convert to a String.
* @return a String representation of the Object array.
* @see java.lang.StringBuilder
*/ | Converts the specified Object array into a String representation. | toString | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/util/ArrayUtils.java",
"license": "apache-2.0",
"size": 13183
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,959,764 |
protected List<Map<String,String>> querySource(String query, String base, int maxResults) throws InternalErrorException {
NamingEnumeration<SearchResult> results = null;
List<Map<String, String>> subjects = new ArrayList<Map<String, String>>();
try {
// If query is null, then we are finding object by the base
if (query == null) {
log.trace("search base [{}]", base);
// TODO jmena atributu spise prijimiat pres vstupni parametr metody
Attributes ldapAttributes = getContext().getAttributes(base);
if (ldapAttributes.size() > 0) {
Map<String, String> attributes = this.getSubjectAttributes(ldapAttributes);
if (!attributes.isEmpty()) {
subjects.add(attributes);
}
}
} else {
log.trace("search string [{}]", query);
SearchControls controls = new SearchControls();
controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
// Set timeout to 5s
controls.setTimeLimit(5000);
if (maxResults > 0) {
controls.setCountLimit(maxResults);
}
if (base == null) base = "";
results = getContext().search(base, query, controls);
while (results.hasMore()) {
SearchResult searchResult = (SearchResult) results.next();
Attributes attributes = searchResult.getAttributes();
Map<String,String> subjectAttributes = this.getSubjectAttributes(attributes);
if (!subjectAttributes.isEmpty()) {
subjects.add(subjectAttributes);
}
}
}
log.trace("Returning [{}] subjects", subjects.size());
return subjects;
} catch (NamingException e) {
log.error("LDAP exception during running query '{}'", query);
throw new InternalErrorException("LDAP exception during running query: "+query+".", e);
} finally {
try {
if (results != null) { results.close(); }
} catch (Exception e) {
log.error("LDAP exception during closing result, while running query '{}'", query);
throw new InternalErrorException(e);
}
}
} | List<Map<String,String>> function(String query, String base, int maxResults) throws InternalErrorException { NamingEnumeration<SearchResult> results = null; List<Map<String, String>> subjects = new ArrayList<Map<String, String>>(); try { if (query == null) { log.trace(STR, base); Attributes ldapAttributes = getContext().getAttributes(base); if (ldapAttributes.size() > 0) { Map<String, String> attributes = this.getSubjectAttributes(ldapAttributes); if (!attributes.isEmpty()) { subjects.add(attributes); } } } else { log.trace(STR, query); SearchControls controls = new SearchControls(); controls.setSearchScope(SearchControls.SUBTREE_SCOPE); controls.setTimeLimit(5000); if (maxResults > 0) { controls.setCountLimit(maxResults); } if (base == null) base = STRReturning [{}] subjectsSTRLDAP exception during running query '{}'STRLDAP exception during running query: STR.STRLDAP exception during closing result, while running query '{}'", query); throw new InternalErrorException(e); } } } | /**
* Query LDAP using query in defined base. Results can be limited to the maxResults.
*
* @param query
* @param base
* @param maxResults
* @return List of Map of the LDAP attribute names and theirs values
* @throws InternalErrorException
*/ | Query LDAP using query in defined base. Results can be limited to the maxResults | querySource | {
"repo_name": "jirmauritz/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/impl/ExtSourceLdap.java",
"license": "bsd-2-clause",
"size": 14831
} | [
"cz.metacentrum.perun.core.api.exceptions.InternalErrorException",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"javax.naming.NamingEnumeration",
"javax.naming.directory.Attributes",
"javax.naming.directory.SearchControls",
"javax.naming.directory.SearchResult"
] | import cz.metacentrum.perun.core.api.exceptions.InternalErrorException; import java.util.ArrayList; import java.util.List; import java.util.Map; import javax.naming.NamingEnumeration; import javax.naming.directory.Attributes; import javax.naming.directory.SearchControls; import javax.naming.directory.SearchResult; | import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*; import javax.naming.*; import javax.naming.directory.*; | [
"cz.metacentrum.perun",
"java.util",
"javax.naming"
] | cz.metacentrum.perun; java.util; javax.naming; | 1,455,369 |
public void render(BufferBuilder renderer, float scale) {
for (TexturedQuad texturedquad : this.quadList)
texturedquad.draw(renderer, scale);
} | void function(BufferBuilder renderer, float scale) { for (TexturedQuad texturedquad : this.quadList) texturedquad.draw(renderer, scale); } | /**
* Function used to prepare the rendering of the bloc.
*
* @param renderer
* VertexBuffer from the Tesselator.
* @param scale
* Scale factor.
*/ | Function used to prepare the rendering of the bloc | render | {
"repo_name": "Leviathan-Studio/CraftStudioAPI",
"path": "src/main/java/com/leviathanstudio/craftstudio/client/model/CSModelBox.java",
"license": "apache-2.0",
"size": 13540
} | [
"net.minecraft.client.model.TexturedQuad",
"net.minecraft.client.renderer.BufferBuilder"
] | import net.minecraft.client.model.TexturedQuad; import net.minecraft.client.renderer.BufferBuilder; | import net.minecraft.client.model.*; import net.minecraft.client.renderer.*; | [
"net.minecraft.client"
] | net.minecraft.client; | 694,187 |
public AbstractPDFStream makeFontFile(FontDescriptor desc) {
if (desc.getFontType() == FontType.OTHER) {
throw new IllegalArgumentException("Trying to embed unsupported font type: "
+ desc.getFontType());
}
CustomFont font = getCustomFont(desc);
InputStream in = null;
try {
Source source = font.getEmbedFileSource();
if (source == null && font.getEmbedResourceName() != null) {
source = new StreamSource(this.getClass()
.getResourceAsStream(font.getEmbedResourceName()));
}
if (source == null) {
return null;
}
if (source instanceof StreamSource) {
in = ((StreamSource) source).getInputStream();
}
if (in == null && source.getSystemId() != null) {
try {
in = new java.net.URL(source.getSystemId()).openStream();
} catch (MalformedURLException e) {
//TODO: Why construct a new exception here, when it is not thrown?
new FileNotFoundException(
"File not found. URL could not be resolved: "
+ e.getMessage());
}
}
if (in == null) {
return null;
}
//Make sure the InputStream is decorated with a BufferedInputStream
if (!(in instanceof java.io.BufferedInputStream)) {
in = new java.io.BufferedInputStream(in);
}
if (in == null) {
return null;
} else {
try {
AbstractPDFStream embeddedFont;
if (desc.getFontType() == FontType.TYPE0) {
MultiByteFont mbfont = (MultiByteFont)font;
FontFileReader reader = new FontFileReader(in);
TTFSubSetFile subset = new TTFSubSetFile();
byte[] subsetFont = subset.readFont(reader,
mbfont.getTTCName(), mbfont.getUsedGlyphs());
// Only TrueType CID fonts are supported now
embeddedFont = new PDFTTFStream(subsetFont.length);
((PDFTTFStream)embeddedFont).setData(subsetFont, subsetFont.length);
} else if (desc.getFontType() == FontType.TYPE1) {
PFBParser parser = new PFBParser();
PFBData pfb = parser.parsePFB(in);
embeddedFont = new PDFT1Stream();
((PDFT1Stream)embeddedFont).setData(pfb);
} else {
byte[] file = IOUtils.toByteArray(in);
embeddedFont = new PDFTTFStream(file.length);
((PDFTTFStream)embeddedFont).setData(file, file.length);
}
return embeddedFont;
} finally {
in.close();
}
}
} catch (IOException ioe) {
log.error(
"Failed to embed font [" + desc + "] "
+ desc.getEmbedFontName(), ioe);
return null;
}
} | AbstractPDFStream function(FontDescriptor desc) { if (desc.getFontType() == FontType.OTHER) { throw new IllegalArgumentException(STR + desc.getFontType()); } CustomFont font = getCustomFont(desc); InputStream in = null; try { Source source = font.getEmbedFileSource(); if (source == null && font.getEmbedResourceName() != null) { source = new StreamSource(this.getClass() .getResourceAsStream(font.getEmbedResourceName())); } if (source == null) { return null; } if (source instanceof StreamSource) { in = ((StreamSource) source).getInputStream(); } if (in == null && source.getSystemId() != null) { try { in = new java.net.URL(source.getSystemId()).openStream(); } catch (MalformedURLException e) { new FileNotFoundException( STR + e.getMessage()); } } if (in == null) { return null; } if (!(in instanceof java.io.BufferedInputStream)) { in = new java.io.BufferedInputStream(in); } if (in == null) { return null; } else { try { AbstractPDFStream embeddedFont; if (desc.getFontType() == FontType.TYPE0) { MultiByteFont mbfont = (MultiByteFont)font; FontFileReader reader = new FontFileReader(in); TTFSubSetFile subset = new TTFSubSetFile(); byte[] subsetFont = subset.readFont(reader, mbfont.getTTCName(), mbfont.getUsedGlyphs()); embeddedFont = new PDFTTFStream(subsetFont.length); ((PDFTTFStream)embeddedFont).setData(subsetFont, subsetFont.length); } else if (desc.getFontType() == FontType.TYPE1) { PFBParser parser = new PFBParser(); PFBData pfb = parser.parsePFB(in); embeddedFont = new PDFT1Stream(); ((PDFT1Stream)embeddedFont).setData(pfb); } else { byte[] file = IOUtils.toByteArray(in); embeddedFont = new PDFTTFStream(file.length); ((PDFTTFStream)embeddedFont).setData(file, file.length); } return embeddedFont; } finally { in.close(); } } } catch (IOException ioe) { log.error( STR + desc + STR + desc.getEmbedFontName(), ioe); return null; } } | /**
* Embeds a font.
* @param desc FontDescriptor of the font.
* @return PDFStream The embedded font file
*/ | Embeds a font | makeFontFile | {
"repo_name": "spepping/fop-cs",
"path": "src/java/org/apache/fop/pdf/PDFFactory.java",
"license": "apache-2.0",
"size": 76535
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream",
"java.net.MalformedURLException",
"javax.xml.transform.Source",
"javax.xml.transform.stream.StreamSource",
"org.apache.commons.io.IOUtils",
"org.apache.fop.fonts.CustomFont",
"org.apache.fop.fonts.FontDescriptor",
"org.... | import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.net.MalformedURLException; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import org.apache.commons.io.IOUtils; import org.apache.fop.fonts.CustomFont; import org.apache.fop.fonts.FontDescriptor; import org.apache.fop.fonts.FontType; import org.apache.fop.fonts.MultiByteFont; import org.apache.fop.fonts.truetype.FontFileReader; import org.apache.fop.fonts.truetype.TTFSubSetFile; import org.apache.fop.fonts.type1.PFBData; import org.apache.fop.fonts.type1.PFBParser; | import java.io.*; import java.net.*; import javax.xml.transform.*; import javax.xml.transform.stream.*; import org.apache.commons.io.*; import org.apache.fop.fonts.*; import org.apache.fop.fonts.truetype.*; import org.apache.fop.fonts.type1.*; | [
"java.io",
"java.net",
"javax.xml",
"org.apache.commons",
"org.apache.fop"
] | java.io; java.net; javax.xml; org.apache.commons; org.apache.fop; | 1,412,602 |
@ApiMethod(name = "registerForConference", path = "conference/{websafeConferenceKey}/registration", httpMethod = HttpMethod.POST)
public WrappedBoolean registerForConference(final User user,
@Named("websafeConferenceKey") final String websafeConferenceKey)
throws UnauthorizedException, NotFoundException, ForbiddenException, ConflictException {
// If not signed in, throw a 401 error.
if (user == null) {
throw new UnauthorizedException("Authorization required");
}
// Start transaction
WrappedBoolean result = ofy().transact(new Work<WrappedBoolean>() { | @ApiMethod(name = STR, path = STR, httpMethod = HttpMethod.POST) WrappedBoolean function(final User user, @Named(STR) final String websafeConferenceKey) throws UnauthorizedException, NotFoundException, ForbiddenException, ConflictException { if (user == null) { throw new UnauthorizedException(STR); } WrappedBoolean result = ofy().transact(new Work<WrappedBoolean>() { | /**
* Register to attend the specified Conference.
*
* @param user
* An user who invokes this method, null when the user is not
* signed in.
* @param websafeConferenceKey
* The String representation of the Conference Key.
* @return Boolean true when success, otherwise false
* @throws UnauthorizedException
* when the user is not signed in.
* @throws NotFoundException
* when there is no Conference with the given conferenceId.
*/ | Register to attend the specified Conference | registerForConference | {
"repo_name": "valllllll2000/udacity_course_gae",
"path": "Lesson_2/00_Conference_Central/src/main/java/com/google/devrel/training/conference/spi/ConferenceApi.java",
"license": "gpl-3.0",
"size": 17396
} | [
"com.google.api.server.spi.config.ApiMethod",
"com.google.api.server.spi.config.Named",
"com.google.api.server.spi.response.ConflictException",
"com.google.api.server.spi.response.ForbiddenException",
"com.google.api.server.spi.response.NotFoundException",
"com.google.api.server.spi.response.UnauthorizedE... | import com.google.api.server.spi.config.ApiMethod; import com.google.api.server.spi.config.Named; import com.google.api.server.spi.response.ConflictException; import com.google.api.server.spi.response.ForbiddenException; import com.google.api.server.spi.response.NotFoundException; import com.google.api.server.spi.response.UnauthorizedException; import com.google.appengine.api.users.User; import com.google.devrel.training.conference.service.OfyService; import com.googlecode.objectify.Work; | import com.google.api.server.spi.config.*; import com.google.api.server.spi.response.*; import com.google.appengine.api.users.*; import com.google.devrel.training.conference.service.*; import com.googlecode.objectify.*; | [
"com.google.api",
"com.google.appengine",
"com.google.devrel",
"com.googlecode.objectify"
] | com.google.api; com.google.appengine; com.google.devrel; com.googlecode.objectify; | 434,756 |
public Path findPath(Location location, int radius, TileMap map, int srcX,
int srcY, int dstX, int dstY); | Path function(Location location, int radius, TileMap map, int srcX, int srcY, int dstX, int dstY); | /**
* Finds a path between two points.
*
* @param location
* The central point of the tile map.
* @param radius
* The radius of the tile map.
* @param map
* The map the points are on.
* @param srcX
* Source point, x coordinate.
* @param srcY
* Source point, y coordinate.
* @param dstX
* Destination point, x coordinate.
* @param dstY
* Destination point, y coordinate.
* @return A path between two points if such a path exists, or
* <code>null</code> if no path exists.
*/ | Finds a path between two points | findPath | {
"repo_name": "lightstorm/lightstorm-server",
"path": "src/org/hyperion/rs2/pf/PathFinder.java",
"license": "mit",
"size": 917
} | [
"org.hyperion.rs2.model.Location"
] | import org.hyperion.rs2.model.Location; | import org.hyperion.rs2.model.*; | [
"org.hyperion.rs2"
] | org.hyperion.rs2; | 1,805,674 |
void rewind(int bytes) throws IOException; | void rewind(int bytes) throws IOException; | /**
* Seek backwards the given number of bytes.
*
* @param bytes the number of bytes to be seeked backwards
* @throws IOException If there is an error while seeking
*/ | Seek backwards the given number of bytes | rewind | {
"repo_name": "ZhenyaM/veraPDF-pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/io/RandomAccessRead.java",
"license": "apache-2.0",
"size": 3227
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,331,199 |
public void test_write$BII() throws IOException {
ZipEntry ze = new ZipEntry("test");
zos.putNextEntry(ze);
zos.write(data.getBytes());
zos.closeEntry();
zos.close();
zos = null;
zis = new ZipInputStream(new ByteArrayInputStream(bos.toByteArray()));
zis.getNextEntry();
byte[] b = new byte[data.length()];
int r = 0;
int count = 0;
while (count != b.length && (r = zis.read(b, count, b.length)) != -1) {
count += r;
}
zis.closeEntry();
assertEquals("Write failed to write correct bytes", new String(b), data);
File f = File.createTempFile("testZip", "tst");
f.deleteOnExit();
FileOutputStream stream = new FileOutputStream(f);
ZipOutputStream zip = new ZipOutputStream(stream);
zip.setMethod(ZipEntry.STORED);
try {
zip.putNextEntry(new ZipEntry("Second"));
fail("Not set an entry. Should have thrown ZipException.");
} catch (ZipException e) {
// expected -- We have not set an entry
}
try {
// We try to write data without entry
zip.write(new byte[2]);
fail("Writing data without an entry. Should have thrown IOException");
} catch (IOException e) {
// expected
}
try {
// Try to write without an entry and with nonsense offset and
// length
zip.write(new byte[2], 0, 12);
fail("Writing data without an entry. Should have thrown IndexOutOfBoundsException");
} catch (IndexOutOfBoundsException e) {
// expected
}
// Regression for HARMONY-4405
try {
zip.write(null, 0, -2);
fail();
} catch (NullPointerException expected) {
} catch (IndexOutOfBoundsException expected) {
}
try {
zip.write(null, 0, 2);
fail();
} catch (NullPointerException expected) {
}
try {
zip.write(new byte[2], 0, -2);
fail();
} catch (IndexOutOfBoundsException expected) {
}
// Close stream because ZIP is invalid
stream.close();
} | public void test_write$BII() throws IOException { ZipEntry ze = new ZipEntry("test"); zos.putNextEntry(ze); zos.write(data.getBytes()); zos.closeEntry(); zos.close(); zos = null; zis = new ZipInputStream(new ByteArrayInputStream(bos.toByteArray())); zis.getNextEntry(); byte[] b = new byte[data.length()]; int r = 0; int count = 0; while (count != b.length && (r = zis.read(b, count, b.length)) != -1) { count += r; } zis.closeEntry(); assertEquals(STR, new String(b), data); File f = File.createTempFile(STR, "tst"); f.deleteOnExit(); FileOutputStream stream = new FileOutputStream(f); ZipOutputStream zip = new ZipOutputStream(stream); zip.setMethod(ZipEntry.STORED); try { zip.putNextEntry(new ZipEntry(STR)); fail(STR); } catch (ZipException e) { } try { zip.write(new byte[2]); fail(STR); } catch (IOException e) { } try { zip.write(new byte[2], 0, 12); fail(STR); } catch (IndexOutOfBoundsException e) { } try { zip.write(null, 0, -2); fail(); } catch (NullPointerException expected) { } catch (IndexOutOfBoundsException expected) { } try { zip.write(null, 0, 2); fail(); } catch (NullPointerException expected) { } try { zip.write(new byte[2], 0, -2); fail(); } catch (IndexOutOfBoundsException expected) { } stream.close(); } | /**
* java.util.zip.ZipOutputStream#write(byte[], int, int)
*/ | java.util.zip.ZipOutputStream#write(byte[], int, int) | test_write$BII | {
"repo_name": "mirego/j2objc",
"path": "jre_emul/android/platform/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/zip/ZipOutputStreamTest.java",
"license": "apache-2.0",
"size": 16732
} | [
"java.io.ByteArrayInputStream",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.util.zip.ZipEntry",
"java.util.zip.ZipException",
"java.util.zip.ZipInputStream",
"java.util.zip.ZipOutputStream"
] | import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,770,284 |
public static int findSettlementID(String name) {
if (unitManager == null)
unitManager = Simulation.instance().getUnitManager();
Collection<Settlement> ss = unitManager.getSettlements();
for (Settlement s : ss) {
if (s.getName().equals(name))
return s.getIdentifier();
}
return -1;
}
| static int function(String name) { if (unitManager == null) unitManager = Simulation.instance().getUnitManager(); Collection<Settlement> ss = unitManager.getSettlements(); for (Settlement s : ss) { if (s.getName().equals(name)) return s.getIdentifier(); } return -1; } | /**
* Finds the settlement's unique id based on its name
*
* @param name
* @return
*/ | Finds the settlement's unique id based on its name | findSettlementID | {
"repo_name": "mars-sim/mars-sim",
"path": "mars-sim-core/src/main/java/org/mars_sim/msp/core/CollectionUtils.java",
"license": "gpl-3.0",
"size": 4593
} | [
"java.util.Collection",
"org.mars_sim.msp.core.structure.Settlement"
] | import java.util.Collection; import org.mars_sim.msp.core.structure.Settlement; | import java.util.*; import org.mars_sim.msp.core.structure.*; | [
"java.util",
"org.mars_sim.msp"
] | java.util; org.mars_sim.msp; | 1,963,257 |
@GET
@Path("/topology/{id}/visualization")
@AuthNimbusOp(value = "getTopology", needsTopoId = true)
@Produces("application/json")
public Response getTopologyVisualization(@PathParam("id") String id,
@QueryParam("sys") boolean sys,
@QueryParam(callbackParameterName) String callback,
@DefaultValue(":all-time") @QueryParam("window") String window
) throws TException {
buildVisualizationRequestMeter.mark();
try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) {
return UIHelpers.makeStandardResponse(
UIHelpers.getVisualizationData(nimbusClient.getClient(), window, id, sys),
callback
);
} catch (RuntimeException e) {
LOG.error("Failure getting topology visualization", e);
throw e;
}
} | @Path(STR) @AuthNimbusOp(value = STR, needsTopoId = true) @Produces(STR) Response function(@PathParam("id") String id, @QueryParam("sys") boolean sys, @QueryParam(callbackParameterName) String callback, @DefaultValue(STR) @QueryParam(STR) String window ) throws TException { buildVisualizationRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getVisualizationData(nimbusClient.getClient(), window, id, sys), callback ); } catch (RuntimeException e) { LOG.error(STR, e); throw e; } } | /**
* /api/v1/topology/:id/visualization -> visualization.
*/ | api/v1/topology/:id/visualization -> visualization | getTopologyVisualization | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "storm-webapp/src/main/java/org/apache/storm/daemon/ui/resources/StormApiResource.java",
"license": "apache-2.0",
"size": 30891
} | [
"javax.ws.rs.DefaultValue",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.QueryParam",
"javax.ws.rs.core.Response",
"org.apache.storm.daemon.ui.UIHelpers",
"org.apache.storm.thrift.TException",
"org.apache.storm.utils.NimbusClient"
] | import javax.ws.rs.DefaultValue; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.QueryParam; import javax.ws.rs.core.Response; import org.apache.storm.daemon.ui.UIHelpers; import org.apache.storm.thrift.TException; import org.apache.storm.utils.NimbusClient; | import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.storm.daemon.ui.*; import org.apache.storm.thrift.*; import org.apache.storm.utils.*; | [
"javax.ws",
"org.apache.storm"
] | javax.ws; org.apache.storm; | 2,365,184 |
@POST
@Consumes({ MediaType.APPLICATION_FORM_URLENCODED })
public void createInPortResourceFromHtml(@PathParam("serviceProviderId") final String serviceProviderId) {
try {
InPortResource aInPortResource = new InPortResource();
String[] paramValues;
paramValues = httpServletRequest.getParameterValues("connections");
if (paramValues != null) {
for (int i = 0; i < paramValues.length; i++) {
aInPortResource.addConnections(new Link(new URI(paramValues[i])));
}
}
paramValues = httpServletRequest.getParameterValues("container");
if (paramValues != null) {
if (paramValues.length == 1) {
if (paramValues[0].length() != 0)
aInPortResource.setContainer(new Link(new URI(paramValues[0])));
// else, there is an empty value for that parameter, and
// hence ignore since the parameter is not actually set.
}
}
paramValues = httpServletRequest.getParameterValues("portBlock");
if (paramValues != null) {
if (paramValues.length == 1) {
if (paramValues[0].length() != 0)
aInPortResource.setPortBlock(new Link(new URI(paramValues[0])));
// else, there is an empty value for that parameter, and
// hence ignore since the parameter is not actually set.
}
}
paramValues = httpServletRequest.getParameterValues("name");
if (paramValues != null) {
if (paramValues.length == 1) {
if (paramValues[0].length() != 0)
aInPortResource.setName(paramValues[0]);
// else, there is an empty value for that parameter, and
// hence ignore since the parameter is not actually set.
}
}
paramValues = httpServletRequest.getParameterValues("simulinkRef");
if (paramValues != null) {
if (paramValues.length == 1) {
if (paramValues[0].length() != 0)
aInPortResource.setSimulinkRef(paramValues[0]);
// else, there is an empty value for that parameter, and
// hence ignore since the parameter is not actually set.
}
}
final InPortResource newInPortResource = SimulinkAdaptorManager.createInPortResource(httpServletRequest,
aInPortResource, serviceProviderId);
httpServletRequest.setAttribute("newResource", newInPortResource);
httpServletRequest.setAttribute("newResourceUri", newInPortResource.getAbout().toString());
// Send back to the form a small JSON response
httpServletResponse.setContentType("application/json");
httpServletResponse.setStatus(Status.CREATED.getStatusCode());
httpServletResponse.addHeader("Location", newInPortResource.getAbout().toString());
PrintWriter out = httpServletResponse.getWriter();
out.print("{" + "\"resource\" : \"" + newInPortResource.getAbout().toString() + "\"}");
out.close();
} catch (Exception e) {
e.printStackTrace();
throw new WebApplicationException(e);
}
} | @Consumes({ MediaType.APPLICATION_FORM_URLENCODED }) void function(@PathParam(STR) final String serviceProviderId) { try { InPortResource aInPortResource = new InPortResource(); String[] paramValues; paramValues = httpServletRequest.getParameterValues(STR); if (paramValues != null) { for (int i = 0; i < paramValues.length; i++) { aInPortResource.addConnections(new Link(new URI(paramValues[i]))); } } paramValues = httpServletRequest.getParameterValues(STR); if (paramValues != null) { if (paramValues.length == 1) { if (paramValues[0].length() != 0) aInPortResource.setContainer(new Link(new URI(paramValues[0]))); } } paramValues = httpServletRequest.getParameterValues(STR); if (paramValues != null) { if (paramValues.length == 1) { if (paramValues[0].length() != 0) aInPortResource.setPortBlock(new Link(new URI(paramValues[0]))); } } paramValues = httpServletRequest.getParameterValues("name"); if (paramValues != null) { if (paramValues.length == 1) { if (paramValues[0].length() != 0) aInPortResource.setName(paramValues[0]); } } paramValues = httpServletRequest.getParameterValues(STR); if (paramValues != null) { if (paramValues.length == 1) { if (paramValues[0].length() != 0) aInPortResource.setSimulinkRef(paramValues[0]); } } final InPortResource newInPortResource = SimulinkAdaptorManager.createInPortResource(httpServletRequest, aInPortResource, serviceProviderId); httpServletRequest.setAttribute(STR, newInPortResource); httpServletRequest.setAttribute(STR, newInPortResource.getAbout().toString()); httpServletResponse.setContentType(STR); httpServletResponse.setStatus(Status.CREATED.getStatusCode()); httpServletResponse.addHeader(STR, newInPortResource.getAbout().toString()); PrintWriter out = httpServletResponse.getWriter(); out.print("{" + "\"resource\STRSTR\"}"); out.close(); } catch (Exception e) { e.printStackTrace(); throw new WebApplicationException(e); } } | /**
* Backend creator for the OSLC delegated creation dialog.
* <p>
* Accepts the input in FormParams and returns a small JSON response
*
* @param productId
* @param component
* @param version
* @param summary
* @param op_sys
* @param platform
* @param description
*/ | Backend creator for the OSLC delegated creation dialog. Accepts the input in FormParams and returns a small JSON response | createInPortResourceFromHtml | {
"repo_name": "FTSRG/massif",
"path": "maven/hu.bme.mit.massif.oslc.adaptor/src/main/java/hu/bme/mit/massif/oslc/adaptor/services/InPortResourceService.java",
"license": "epl-1.0",
"size": 17724
} | [
"hu.bme.mit.massif.oslc.adaptor.SimulinkAdaptorManager",
"hu.bme.mit.massif.oslc.adaptor.resources.InPortResource",
"java.io.PrintWriter",
"javax.ws.rs.Consumes",
"javax.ws.rs.PathParam",
"javax.ws.rs.WebApplicationException",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response",
"org.eclipse.l... | import hu.bme.mit.massif.oslc.adaptor.SimulinkAdaptorManager; import hu.bme.mit.massif.oslc.adaptor.resources.InPortResource; import java.io.PrintWriter; import javax.ws.rs.Consumes; import javax.ws.rs.PathParam; import javax.ws.rs.WebApplicationException; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import org.eclipse.lyo.oslc4j.core.model.Link; | import hu.bme.mit.massif.oslc.adaptor.*; import hu.bme.mit.massif.oslc.adaptor.resources.*; import java.io.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.eclipse.lyo.oslc4j.core.model.*; | [
"hu.bme.mit",
"java.io",
"javax.ws",
"org.eclipse.lyo"
] | hu.bme.mit; java.io; javax.ws; org.eclipse.lyo; | 703,724 |
private Path resolveCustomLocation(IndexSettings indexSettings) {
String customDataDir = indexSettings.customDataPath();
if (customDataDir != null) {
// This assert is because this should be caught by MetaDataCreateIndexService
assert sharedDataPath != null;
if (addNodeId) {
return sharedDataPath.resolve(customDataDir).resolve(Integer.toString(this.localNodeId));
} else {
return sharedDataPath.resolve(customDataDir);
}
} else {
throw new IllegalArgumentException("no custom " + IndexMetaData.SETTING_DATA_PATH + " setting available");
}
} | Path function(IndexSettings indexSettings) { String customDataDir = indexSettings.customDataPath(); if (customDataDir != null) { assert sharedDataPath != null; if (addNodeId) { return sharedDataPath.resolve(customDataDir).resolve(Integer.toString(this.localNodeId)); } else { return sharedDataPath.resolve(customDataDir); } } else { throw new IllegalArgumentException(STR + IndexMetaData.SETTING_DATA_PATH + STR); } } | /**
* Resolve the custom path for a index's shard.
* Uses the {@code IndexMetaData.SETTING_DATA_PATH} setting to determine
* the root path for the index.
*
* @param indexSettings settings for the index
*/ | Resolve the custom path for a index's shard. Uses the IndexMetaData.SETTING_DATA_PATH setting to determine the root path for the index | resolveCustomLocation | {
"repo_name": "polyfractal/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/env/NodeEnvironment.java",
"license": "apache-2.0",
"size": 34942
} | [
"java.nio.file.Path",
"org.elasticsearch.cluster.metadata.IndexMetaData",
"org.elasticsearch.index.IndexSettings"
] | import java.nio.file.Path; import org.elasticsearch.cluster.metadata.IndexMetaData; import org.elasticsearch.index.IndexSettings; | import java.nio.file.*; import org.elasticsearch.cluster.metadata.*; import org.elasticsearch.index.*; | [
"java.nio",
"org.elasticsearch.cluster",
"org.elasticsearch.index"
] | java.nio; org.elasticsearch.cluster; org.elasticsearch.index; | 1,117,877 |
public ApplicationGatewayBackendHealthInner withBackendAddressPools(List<ApplicationGatewayBackendHealthPool> backendAddressPools) {
this.backendAddressPools = backendAddressPools;
return this;
} | ApplicationGatewayBackendHealthInner function(List<ApplicationGatewayBackendHealthPool> backendAddressPools) { this.backendAddressPools = backendAddressPools; return this; } | /**
* Set the backendAddressPools value.
*
* @param backendAddressPools the backendAddressPools value to set
* @return the ApplicationGatewayBackendHealthInner object itself.
*/ | Set the backendAddressPools value | withBackendAddressPools | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ApplicationGatewayBackendHealthInner.java",
"license": "mit",
"size": 1446
} | [
"com.microsoft.azure.management.network.v2018_07_01.ApplicationGatewayBackendHealthPool",
"java.util.List"
] | import com.microsoft.azure.management.network.v2018_07_01.ApplicationGatewayBackendHealthPool; import java.util.List; | import com.microsoft.azure.management.network.v2018_07_01.*; import java.util.*; | [
"com.microsoft.azure",
"java.util"
] | com.microsoft.azure; java.util; | 2,621,261 |
public static void forceRipple(View view, int x, int y) {
Drawable background = view.getBackground();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && background instanceof RippleDrawable) {
background.setHotspot(x, y);
}
view.setPressed(true);
// For a quick ripple, you can immediately set false.
view.setPressed(false);
} | static void function(View view, int x, int y) { Drawable background = view.getBackground(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && background instanceof RippleDrawable) { background.setHotspot(x, y); } view.setPressed(true); view.setPressed(false); } | /**
* see <a href="http://stackoverflow.com/a/38242102">how-to-trigger-ripple-effect-on-android-lollipop-in-specific-location</a>
*/ | see how-to-trigger-ripple-effect-on-android-lollipop-in-specific-location | forceRipple | {
"repo_name": "kibotu/common.android.utils",
"path": "common-android-utils/src/main/java/com/common/android/utils/extensions/ViewExtensions.java",
"license": "apache-2.0",
"size": 32937
} | [
"android.graphics.drawable.Drawable",
"android.graphics.drawable.RippleDrawable",
"android.os.Build",
"android.view.View"
] | import android.graphics.drawable.Drawable; import android.graphics.drawable.RippleDrawable; import android.os.Build; import android.view.View; | import android.graphics.drawable.*; import android.os.*; import android.view.*; | [
"android.graphics",
"android.os",
"android.view"
] | android.graphics; android.os; android.view; | 1,105,993 |
public static ProjectConfig loadFromUrl(URL url) {
InputStream input = null;
try {
input = url.openStream();
} catch (FileNotFoundException e) {
LOG.info("No fabric8.yml at URL: " + url);
} catch (IOException e) {
LOG.warn("Failed to open fabric8.yml file at URL: " + url + ". " + e, e);
}
if (input != null) {
try {
LOG.info("Parsing " + ProjectConfigs.FILE_NAME + " from " + url);
return ProjectConfigs.parseProjectConfig(input);
} catch (IOException e) {
LOG.warn("Failed to parse " + ProjectConfigs.FILE_NAME + " from " + url + ". " + e, e);
}
}
return null;
}
/**
* Returns true if the given folder has a configuration file called {@link #FILE_NAME} | static ProjectConfig function(URL url) { InputStream input = null; try { input = url.openStream(); } catch (FileNotFoundException e) { LOG.info(STR + url); } catch (IOException e) { LOG.warn(STR + url + STR + e, e); } if (input != null) { try { LOG.info(STR + ProjectConfigs.FILE_NAME + STR + url); return ProjectConfigs.parseProjectConfig(input); } catch (IOException e) { LOG.warn(STR + ProjectConfigs.FILE_NAME + STR + url + STR + e, e); } } return null; } /** * Returns true if the given folder has a configuration file called {@link #FILE_NAME} | /**
* Returns the project config from the given url if it exists or null
*/ | Returns the project config from the given url if it exists or null | loadFromUrl | {
"repo_name": "EricWittmann/fabric8",
"path": "components/fabric8-devops/src/main/java/io/fabric8/devops/ProjectConfigs.java",
"license": "apache-2.0",
"size": 10532
} | [
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 510,854 |
public WriteBuffer writeBits(int amount, int value) {
if (getAccessType() != AccessType.BIT_ACCESS) {
throw new IllegalStateException("Illegal access type.");
}
if (amount < 0 || amount > 32) {
throw new IllegalArgumentException("Number of bits must be between 1 and 32 inclusive.");
}
int bytePos = getBitPosition() >> 3;
int bitOffset = 8 - (getBitPosition() & 7);
setBitPosition(getBitPosition() + amount);
// Re-size the buffer if need be.
int requiredSpace = bytePos - buffer.position() + 1;
requiredSpace += (amount + 7) / 8;
if (buffer.remaining() < requiredSpace) {
ByteBuffer old = buffer;
buffer = ByteBuffer.allocate(old.capacity() + requiredSpace);
old.flip();
buffer.put(old);
}
for (; amount > bitOffset; bitOffset = 8) {
byte tmp = buffer.get(bytePos);
tmp &= ~BIT_MASK[bitOffset];
tmp |= (value >> (amount - bitOffset)) & BIT_MASK[bitOffset];
buffer.put(bytePos++, tmp);
amount -= bitOffset;
}
if (amount == bitOffset) {
byte tmp = buffer.get(bytePos);
tmp &= ~BIT_MASK[bitOffset];
tmp |= value & BIT_MASK[bitOffset];
buffer.put(bytePos, tmp);
} else {
byte tmp = buffer.get(bytePos);
tmp &= ~(BIT_MASK[amount] << (bitOffset - amount));
tmp |= (value & BIT_MASK[amount]) << (bitOffset - amount);
buffer.put(bytePos, tmp);
}
return this;
} | WriteBuffer function(int amount, int value) { if (getAccessType() != AccessType.BIT_ACCESS) { throw new IllegalStateException(STR); } if (amount < 0 amount > 32) { throw new IllegalArgumentException(STR); } int bytePos = getBitPosition() >> 3; int bitOffset = 8 - (getBitPosition() & 7); setBitPosition(getBitPosition() + amount); int requiredSpace = bytePos - buffer.position() + 1; requiredSpace += (amount + 7) / 8; if (buffer.remaining() < requiredSpace) { ByteBuffer old = buffer; buffer = ByteBuffer.allocate(old.capacity() + requiredSpace); old.flip(); buffer.put(old); } for (; amount > bitOffset; bitOffset = 8) { byte tmp = buffer.get(bytePos); tmp &= ~BIT_MASK[bitOffset]; tmp = (value >> (amount - bitOffset)) & BIT_MASK[bitOffset]; buffer.put(bytePos++, tmp); amount -= bitOffset; } if (amount == bitOffset) { byte tmp = buffer.get(bytePos); tmp &= ~BIT_MASK[bitOffset]; tmp = value & BIT_MASK[bitOffset]; buffer.put(bytePos, tmp); } else { byte tmp = buffer.get(bytePos); tmp &= ~(BIT_MASK[amount] << (bitOffset - amount)); tmp = (value & BIT_MASK[amount]) << (bitOffset - amount); buffer.put(bytePos, tmp); } return this; } | /**
* Writes the value as a variable amount of bits.
*
* @param amount
* the amount of bits
* @param value
* the value
*/ | Writes the value as a variable amount of bits | writeBits | {
"repo_name": "flimsy/asteria-2.0",
"path": "src/server/core/net/buffer/PacketBuffer.java",
"license": "gpl-3.0",
"size": 32701
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 2,853,009 |
public Application getApplication(String uuid, String userId) throws APIManagementException {
Application application = null;
try {
application = getApplicationDAO().getApplication(uuid);
} catch (APIMgtDAOException e) {
String errorMsg = "Error occurred while retrieving application - ";
log.error(errorMsg, e);
throw new APIManagementException(errorMsg, e, e.getErrorHandler());
}
return application;
} | Application function(String uuid, String userId) throws APIManagementException { Application application = null; try { application = getApplicationDAO().getApplication(uuid); } catch (APIMgtDAOException e) { String errorMsg = STR; log.error(errorMsg, e); throw new APIManagementException(errorMsg, e, e.getErrorHandler()); } return application; } | /**
* Returns the corresponding application given the uuid
* @param uuid uuid of the Application
* @param userId Name of the User.
* @return it will return Application corresponds to the uuid provided.
* @throws APIManagementException If failed to retrieve application.
*/ | Returns the corresponding application given the uuid | getApplication | {
"repo_name": "ChamNDeSilva/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/impl/AbstractAPIManager.java",
"license": "apache-2.0",
"size": 27587
} | [
"org.wso2.carbon.apimgt.core.exception.APIManagementException",
"org.wso2.carbon.apimgt.core.exception.APIMgtDAOException",
"org.wso2.carbon.apimgt.core.models.Application"
] | import org.wso2.carbon.apimgt.core.exception.APIManagementException; import org.wso2.carbon.apimgt.core.exception.APIMgtDAOException; import org.wso2.carbon.apimgt.core.models.Application; | import org.wso2.carbon.apimgt.core.exception.*; import org.wso2.carbon.apimgt.core.models.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 748,237 |
public final void setNewAssignment(LocalAssignment newAssignment) {
this.newAssignment.set(newAssignment == null
? null
: new TimerDecoratedAssignment(newAssignment, staticState.slotMetrics.workerLaunchDuration));
} | final void function(LocalAssignment newAssignment) { this.newAssignment.set(newAssignment == null ? null : new TimerDecoratedAssignment(newAssignment, staticState.slotMetrics.workerLaunchDuration)); } | /**
* Set a new assignment asynchronously.
* @param newAssignment the new assignment for this slot to run, null to run nothing
*/ | Set a new assignment asynchronously | setNewAssignment | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "storm-server/src/main/java/org/apache/storm/daemon/supervisor/Slot.java",
"license": "apache-2.0",
"size": 68658
} | [
"org.apache.storm.generated.LocalAssignment"
] | import org.apache.storm.generated.LocalAssignment; | import org.apache.storm.generated.*; | [
"org.apache.storm"
] | org.apache.storm; | 2,132,982 |
private void recordUsage(ContainerId containerId, String pId,
ResourceCalculatorProcessTree pTree,
ProcessTreeInfo ptInfo,
long currentVmemUsage, long currentPmemUsage,
ResourceUtilization trackedContainersUtilization) {
// if machine has 6 cores and 3 are used,
// cpuUsagePercentPerCore should be 300% and
// cpuUsageTotalCoresPercentage should be 50%
float cpuUsagePercentPerCore = pTree.getCpuUsagePercent();
float cpuUsageTotalCoresPercentage = cpuUsagePercentPerCore /
resourceCalculatorPlugin.getNumProcessors();
// Multiply by 1000 to avoid losing data when converting to int
int milliVcoresUsed = (int) (cpuUsageTotalCoresPercentage * 1000
* maxVCoresAllottedForContainers /nodeCpuPercentageForYARN);
long vmemLimit = ptInfo.getVmemLimit();
long pmemLimit = ptInfo.getPmemLimit();
if (AUDITLOG.isDebugEnabled()) {
int vcoreLimit = ptInfo.getCpuVcores();
long cumulativeCpuTime = pTree.getCumulativeCpuTime();
AUDITLOG.debug(
"Resource usage of ProcessTree {} for container-id {}:" +
" {} %CPU: {} %CPU-cores: {}" +
" vCores-used: {} of {} Cumulative-CPU-ms: {}",
pId, containerId,
formatUsageString(
currentVmemUsage, vmemLimit,
currentPmemUsage, pmemLimit),
cpuUsagePercentPerCore,
cpuUsageTotalCoresPercentage,
milliVcoresUsed / 1000, vcoreLimit,
cumulativeCpuTime);
}
// Add resource utilization for this container
trackedContainersUtilization.addTo(
(int) (currentPmemUsage >> 20),
(int) (currentVmemUsage >> 20),
milliVcoresUsed / 1000.0f);
// Add usage to container metrics
if (containerMetricsEnabled) {
ContainerMetrics.forContainer(
containerId, containerMetricsPeriodMs,
containerMetricsUnregisterDelayMs).recordMemoryUsage(
(int) (currentPmemUsage >> 20));
ContainerMetrics.forContainer(
containerId, containerMetricsPeriodMs,
containerMetricsUnregisterDelayMs).recordCpuUsage((int)
cpuUsagePercentPerCore, milliVcoresUsed);
}
} | void function(ContainerId containerId, String pId, ResourceCalculatorProcessTree pTree, ProcessTreeInfo ptInfo, long currentVmemUsage, long currentPmemUsage, ResourceUtilization trackedContainersUtilization) { float cpuUsagePercentPerCore = pTree.getCpuUsagePercent(); float cpuUsageTotalCoresPercentage = cpuUsagePercentPerCore / resourceCalculatorPlugin.getNumProcessors(); int milliVcoresUsed = (int) (cpuUsageTotalCoresPercentage * 1000 * maxVCoresAllottedForContainers /nodeCpuPercentageForYARN); long vmemLimit = ptInfo.getVmemLimit(); long pmemLimit = ptInfo.getPmemLimit(); if (AUDITLOG.isDebugEnabled()) { int vcoreLimit = ptInfo.getCpuVcores(); long cumulativeCpuTime = pTree.getCumulativeCpuTime(); AUDITLOG.debug( STR + STR + STR, pId, containerId, formatUsageString( currentVmemUsage, vmemLimit, currentPmemUsage, pmemLimit), cpuUsagePercentPerCore, cpuUsageTotalCoresPercentage, milliVcoresUsed / 1000, vcoreLimit, cumulativeCpuTime); } trackedContainersUtilization.addTo( (int) (currentPmemUsage >> 20), (int) (currentVmemUsage >> 20), milliVcoresUsed / 1000.0f); if (containerMetricsEnabled) { ContainerMetrics.forContainer( containerId, containerMetricsPeriodMs, containerMetricsUnregisterDelayMs).recordMemoryUsage( (int) (currentPmemUsage >> 20)); ContainerMetrics.forContainer( containerId, containerMetricsPeriodMs, containerMetricsUnregisterDelayMs).recordCpuUsage((int) cpuUsagePercentPerCore, milliVcoresUsed); } } | /**
* Record usage metrics.
* @param containerId container id
* @param pId process id
* @param pTree valid process tree entry with CPU measurement
* @param ptInfo process tree info with limit information
* @param currentVmemUsage virtual memory measurement
* @param currentPmemUsage physical memory measurement
* @param trackedContainersUtilization utilization tracker to update
*/ | Record usage metrics | recordUsage | {
"repo_name": "JingchengDu/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/monitor/ContainersMonitorImpl.java",
"license": "apache-2.0",
"size": 45242
} | [
"org.apache.hadoop.yarn.api.records.ContainerId",
"org.apache.hadoop.yarn.api.records.ResourceUtilization",
"org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree"
] | import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ResourceUtilization; import org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree; | import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.util.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 931,682 |
public void setMinimalWidth() {
int nrNonEmptyFields = wFields.nrNonEmpty();
for ( int i = 0; i < nrNonEmptyFields; i++ ) {
TableItem item = wFields.getNonEmpty( i );
item.setText( 4, "" );
item.setText( 5, "" );
item.setText( 9, ValueMeta.getTrimTypeDesc( ValueMetaInterface.TRIM_TYPE_BOTH ) );
int type = ValueMeta.getType( item.getText( 2 ) );
switch ( type ) {
case ValueMetaInterface.TYPE_STRING:
item.setText( 3, "" );
break;
case ValueMetaInterface.TYPE_INTEGER:
item.setText( 3, "0" );
break;
case ValueMetaInterface.TYPE_NUMBER:
item.setText( 3, "0.#####" );
break;
case ValueMetaInterface.TYPE_DATE:
break;
default:
break;
}
}
for ( int i = 0; i < input.getOutputFields().length; i++ ) {
input.getOutputFields()[i].setTrimType( ValueMetaInterface.TRIM_TYPE_BOTH );
}
wFields.optWidth( true );
} | void function() { int nrNonEmptyFields = wFields.nrNonEmpty(); for ( int i = 0; i < nrNonEmptyFields; i++ ) { TableItem item = wFields.getNonEmpty( i ); item.setText( 4, STRSTRSTR0STR0.#####" ); break; case ValueMetaInterface.TYPE_DATE: break; default: break; } } for ( int i = 0; i < input.getOutputFields().length; i++ ) { input.getOutputFields()[i].setTrimType( ValueMetaInterface.TRIM_TYPE_BOTH ); } wFields.optWidth( true ); } | /**
* Sets the output width to minimal width...
*
*/ | Sets the output width to minimal width.. | setMinimalWidth | {
"repo_name": "brosander/big-data-plugin",
"path": "kettle-plugins/hdfs/src/main/java/org/pentaho/big/data/kettle/plugins/hdfs/trans/HadoopFileOutputDialog.java",
"license": "apache-2.0",
"size": 70323
} | [
"org.eclipse.swt.widgets.TableItem",
"org.pentaho.di.core.row.ValueMetaInterface"
] | import org.eclipse.swt.widgets.TableItem; import org.pentaho.di.core.row.ValueMetaInterface; | import org.eclipse.swt.widgets.*; import org.pentaho.di.core.row.*; | [
"org.eclipse.swt",
"org.pentaho.di"
] | org.eclipse.swt; org.pentaho.di; | 521,186 |
@Test
public void testFixedWithParentSize() {
final Context context = Robolectric.application;
final int width = 480;
final int height = 800;
final int stateViewWidth = 240;
final int stateViewHeight = 320;
final FrameLayout parent = new FrameLayout(context);
measureAndLayout(parent, width, height); | void function() { final Context context = Robolectric.application; final int width = 480; final int height = 800; final int stateViewWidth = 240; final int stateViewHeight = 320; final FrameLayout parent = new FrameLayout(context); measureAndLayout(parent, width, height); | /**
* Test case 4.
* State view provides fixed size or WRAP_CONTENT.
* Expecting that state view layout params will not be changed.
*/ | Test case 4. State view provides fixed size or WRAP_CONTENT. Expecting that state view layout params will not be changed | testFixedWithParentSize | {
"repo_name": "stanfy/enroscar",
"path": "ui/src/test/java/com/stanfy/enroscar/views/test/StateHelperTest.java",
"license": "apache-2.0",
"size": 6365
} | [
"android.content.Context",
"android.widget.FrameLayout",
"org.robolectric.Robolectric"
] | import android.content.Context; import android.widget.FrameLayout; import org.robolectric.Robolectric; | import android.content.*; import android.widget.*; import org.robolectric.*; | [
"android.content",
"android.widget",
"org.robolectric"
] | android.content; android.widget; org.robolectric; | 1,855,891 |
protected void validateMergedContextConfiguration(WebMergedContextConfiguration mergedConfig) {
// no-op
}
/**
* Configures web resources for the supplied web application context (WAC).
* <h4>Implementation Details</h4>
* <p>If the supplied WAC has no parent or its parent is not a WAC, the
* supplied WAC will be configured as the Root WAC (see "<em>Root WAC
* Configuration</em>" below).
* <p>Otherwise the context hierarchy of the supplied WAC will be traversed
* to find the top-most WAC (i.e., the root); and the {@link ServletContext} | void function(WebMergedContextConfiguration mergedConfig) { } /** * Configures web resources for the supplied web application context (WAC). * <h4>Implementation Details</h4> * <p>If the supplied WAC has no parent or its parent is not a WAC, the * supplied WAC will be configured as the Root WAC (see STR below). * <p>Otherwise the context hierarchy of the supplied WAC will be traversed * to find the top-most WAC (i.e., the root); and the {@link ServletContext} | /**
* Validate the supplied {@link WebMergedContextConfiguration} with respect to
* what this context loader supports.
* <p>The default implementation is a <em>no-op</em> but can be overridden by
* subclasses as appropriate.
* @param mergedConfig the merged configuration to validate
* @throws IllegalStateException if the supplied configuration is not valid
* for this context loader
* @since 4.0.4
*/ | Validate the supplied <code>WebMergedContextConfiguration</code> with respect to what this context loader supports. The default implementation is a no-op but can be overridden by subclasses as appropriate | validateMergedContextConfiguration | {
"repo_name": "spring-projects/spring-framework",
"path": "spring-test/src/main/java/org/springframework/test/context/web/AbstractGenericWebContextLoader.java",
"license": "apache-2.0",
"size": 12834
} | [
"jakarta.servlet.ServletContext"
] | import jakarta.servlet.ServletContext; | import jakarta.servlet.*; | [
"jakarta.servlet"
] | jakarta.servlet; | 2,738,882 |
public GregorianCalendar getLastCutDate()
{
GregorianCalendar result = null;
//Transactions are sorted chronologically, so loop through all the transactions
//associated with getting grass cut, then returned one will be the last one
for(Transaction t : transactions)
{
if(t.getType() == TType.GRASS_CUT)
{
result = t.getDate();
}
}
return result;
}
| GregorianCalendar function() { GregorianCalendar result = null; for(Transaction t : transactions) { if(t.getType() == TType.GRASS_CUT) { result = t.getDate(); } } return result; } | /**
* Returns the last time this customer had its grass cut. Returns null if no grass
* has ever been cut
*
* @return a GregorianCalendar object that represents the date of the last grass cutting
*/ | Returns the last time this customer had its grass cut. Returns null if no grass has ever been cut | getLastCutDate | {
"repo_name": "jez/JBooks",
"path": "zimmerman/jacob/moneybookv10/Customer.java",
"license": "gpl-2.0",
"size": 9742
} | [
"java.util.GregorianCalendar"
] | import java.util.GregorianCalendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,254,190 |
private NamesType createName(String shortLabel, String fullName) {
NamesType names = new NamesType();
names.setShortLabel(shortLabel);
if (fullName != null) {
names.setFullName(fullName);
}
return names;
} | NamesType function(String shortLabel, String fullName) { NamesType names = new NamesType(); names.setShortLabel(shortLabel); if (fullName != null) { names.setFullName(fullName); } return names; } | /**
* Creates a new Names Object.
*
* @param shortLabel Short Name Label.
* @param fullName Full Name/Description.
* @return Castor Names Object.
*/ | Creates a new Names Object | createName | {
"repo_name": "cytoscape/psi-mi",
"path": "impl/src/main/java/org/cytoscape/psi_mi/internal/data_mapper/MapInteractionsToPsiOne.java",
"license": "lgpl-2.1",
"size": 15359
} | [
"org.cytoscape.psi_mi.internal.schema.mi1.NamesType"
] | import org.cytoscape.psi_mi.internal.schema.mi1.NamesType; | import org.cytoscape.psi_mi.internal.schema.mi1.*; | [
"org.cytoscape.psi_mi"
] | org.cytoscape.psi_mi; | 2,218,872 |
void initCachingTier(CachingTier<?, ?> resource);
/**
* Gets the internal ranking for the {@link CachingTier} instances provided by this {@code Provider} of the
* caching tier's ability to handle the specified resources.
* <p>
* A higher rank value indicates a more capable {@code CachingTier}.
*
* @param resourceTypes the set of {@code ResourceType}s for the store to handle
* @param serviceConfigs the collection of {@code ServiceConfiguration} instances that may contribute
* to the ranking
*
* @return a non-negative rank indicating the ability of a {@code CachingTier} created by this {@code Provider}
* to handle the resource types specified by {@code resourceTypes}; a rank of 0 indicates the caching tier
* can not handle the type specified in {@code resourceTypes} | void initCachingTier(CachingTier<?, ?> resource); /** * Gets the internal ranking for the {@link CachingTier} instances provided by this {@code Provider} of the * caching tier's ability to handle the specified resources. * <p> * A higher rank value indicates a more capable {@code CachingTier}. * * @param resourceTypes the set of {@code ResourceType}s for the store to handle * @param serviceConfigs the collection of {@code ServiceConfiguration} instances that may contribute * to the ranking * * @return a non-negative rank indicating the ability of a {@code CachingTier} created by this {@code Provider} * to handle the resource types specified by {@code resourceTypes}; a rank of 0 indicates the caching tier * can not handle the type specified in {@code resourceTypes} | /**
* Initialises a {@link CachingTier}.
*
* @param resource the caching tier to initialise
*/ | Initialises a <code>CachingTier</code> | initCachingTier | {
"repo_name": "aurbroszniowski/ehcache3",
"path": "core/src/main/java/org/ehcache/core/spi/store/tiering/CachingTier.java",
"license": "apache-2.0",
"size": 6577
} | [
"org.ehcache.config.ResourceType",
"org.ehcache.spi.service.ServiceConfiguration"
] | import org.ehcache.config.ResourceType; import org.ehcache.spi.service.ServiceConfiguration; | import org.ehcache.config.*; import org.ehcache.spi.service.*; | [
"org.ehcache.config",
"org.ehcache.spi"
] | org.ehcache.config; org.ehcache.spi; | 239,245 |
public byte[] read(String objectName) {
S3Service s3 = createS3Service();
S3Bucket bucket;
try {
bucket = s3.getBucket(bucketName);
System.out.println(bucket.getName());
S3Object objectComplete = s3.getObject(bucket, objectName);
return IOUtils.toByteArray(objectComplete.getDataInputStream());
} catch (S3ServiceException e) {
throw new IllegalStateException("Unable to retrieve S3 Bucket", e);
} catch (ServiceException e) {
throw new IllegalStateException("Unable to read data from S3 Bucket", e);
} catch (IOException e) {
throw new IllegalStateException("Unable to read data", e);
}
}
// internal helpers
| byte[] function(String objectName) { S3Service s3 = createS3Service(); S3Bucket bucket; try { bucket = s3.getBucket(bucketName); System.out.println(bucket.getName()); S3Object objectComplete = s3.getObject(bucket, objectName); return IOUtils.toByteArray(objectComplete.getDataInputStream()); } catch (S3ServiceException e) { throw new IllegalStateException(STR, e); } catch (ServiceException e) { throw new IllegalStateException(STR, e); } catch (IOException e) { throw new IllegalStateException(STR, e); } } | /**
* Read from S3-based file storage.
*
* @param objectName
*/ | Read from S3-based file storage | read | {
"repo_name": "raphaelutfpr/helianto-seed",
"path": "src/main/java/org/helianto/home/storage/S3FileReader.java",
"license": "apache-2.0",
"size": 2615
} | [
"java.io.IOException",
"org.apache.commons.io.IOUtils",
"org.jets3t.service.S3Service",
"org.jets3t.service.S3ServiceException",
"org.jets3t.service.ServiceException",
"org.jets3t.service.model.S3Bucket",
"org.jets3t.service.model.S3Object"
] | import java.io.IOException; import org.apache.commons.io.IOUtils; import org.jets3t.service.S3Service; import org.jets3t.service.S3ServiceException; import org.jets3t.service.ServiceException; import org.jets3t.service.model.S3Bucket; import org.jets3t.service.model.S3Object; | import java.io.*; import org.apache.commons.io.*; import org.jets3t.service.*; import org.jets3t.service.model.*; | [
"java.io",
"org.apache.commons",
"org.jets3t.service"
] | java.io; org.apache.commons; org.jets3t.service; | 2,044,388 |
public Observable<ServiceResponse<JobAgentInner>> beginUpdateWithServiceResponseAsync(String resourceGroupName, String serverName, String jobAgentName) {
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (serverName == null) {
throw new IllegalArgumentException("Parameter serverName is required and cannot be null.");
}
if (jobAgentName == null) {
throw new IllegalArgumentException("Parameter jobAgentName is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<JobAgentInner>> function(String resourceGroupName, String serverName, String jobAgentName) { if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (serverName == null) { throw new IllegalArgumentException(STR); } if (jobAgentName == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Updates a job agent.
*
* @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
* @param serverName The name of the server.
* @param jobAgentName The name of the job agent to be updated.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the JobAgentInner object
*/ | Updates a job agent | beginUpdateWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/sql/mgmt-v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/JobAgentsInner.java",
"license": "mit",
"size": 68620
} | [
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.rest.ServiceResponse; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 362,967 |
@Nullable
public XValueMarkerProvider<?,?> createValueMarkerProvider() {
return null;
} | XValueMarkerProvider<?,?> function() { return null; } | /**
* Override this method to enable 'Mark Object' action
* @return new instance of {@link XValueMarkerProvider}'s implementation or {@code null} if 'Mark Object' feature isn't supported
*/ | Override this method to enable 'Mark Object' action | createValueMarkerProvider | {
"repo_name": "ahb0327/intellij-community",
"path": "platform/xdebugger-api/src/com/intellij/xdebugger/XDebugProcess.java",
"license": "apache-2.0",
"size": 8035
} | [
"com.intellij.xdebugger.frame.XValueMarkerProvider"
] | import com.intellij.xdebugger.frame.XValueMarkerProvider; | import com.intellij.xdebugger.frame.*; | [
"com.intellij.xdebugger"
] | com.intellij.xdebugger; | 2,472,344 |
private void addArguments(final Node node, final List list) {
final NamedNodeMap map= node.getAttributes();
if (map != null) {
Collections.sort(list, new AttributeComparator());
for (final Iterator iterator= list.iterator(); iterator.hasNext();) {
final Attr attribute= (Attr) iterator.next();
map.setNamedItem(attribute);
}
}
}
/**
* Begins the transformation of a refactoring specified by the given
* arguments.
* <p>
* Calls to
* {@link RefactoringSessionTransformer#beginRefactoring(String, long, String, String, String, int)} | void function(final Node node, final List list) { final NamedNodeMap map= node.getAttributes(); if (map != null) { Collections.sort(list, new AttributeComparator()); for (final Iterator iterator= list.iterator(); iterator.hasNext();) { final Attr attribute= (Attr) iterator.next(); map.setNamedItem(attribute); } } } /** * Begins the transformation of a refactoring specified by the given * arguments. * <p> * Calls to * {@link RefactoringSessionTransformer#beginRefactoring(String, long, String, String, String, int)} | /**
* Adds the attributes specified in the list to the node, in ascending order
* of their names.
*
* @param node
* the node
* @param list
* the list of attributes
*/ | Adds the attributes specified in the list to the node, in ascending order of their names | addArguments | {
"repo_name": "dhuebner/che",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-ltk-core-refactoring/src/main/java/org/eclipse/ltk/internal/core/refactoring/RefactoringSessionTransformer.java",
"license": "epl-1.0",
"size": 11095
} | [
"java.util.Collections",
"java.util.Iterator",
"java.util.List",
"org.w3c.dom.Attr",
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node"
] | import java.util.Collections; import java.util.Iterator; import java.util.List; import org.w3c.dom.Attr; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; | import java.util.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 1,145,159 |
public Parameter createEntryPoint() {
Parameter param = new Parameter();
entryPointParams.add(param);
return param;
}
/**
* Converts {@code <define/>} nested elements into Compiler {@code @define} | Parameter function() { Parameter param = new Parameter(); entryPointParams.add(param); return param; } /** * Converts {@code <define/>} nested elements into Compiler {@code @define} | /**
* Creates a new {@code <entrypoint/>} nested element. Supports name
* attribute.
*/ | Creates a new nested element. Supports name attribute | createEntryPoint | {
"repo_name": "anomaly/closure-compiler",
"path": "src/com/google/javascript/jscomp/ant/CompileTask.java",
"license": "apache-2.0",
"size": 23931
} | [
"com.google.javascript.jscomp.Compiler",
"org.apache.tools.ant.types.Parameter"
] | import com.google.javascript.jscomp.Compiler; import org.apache.tools.ant.types.Parameter; | import com.google.javascript.jscomp.*; import org.apache.tools.ant.types.*; | [
"com.google.javascript",
"org.apache.tools"
] | com.google.javascript; org.apache.tools; | 2,107,035 |
public Client getClientToHostId(int hostId, long timeout) throws IOException {
final String listener = m_config.getListenerAddress(hostId);
ClientConfig config = new ClientConfigForTest(m_username, m_password);
config.setConnectionResponseTimeout(timeout);
config.setProcedureCallTimeout(timeout);
final Client client = ClientFactory.createClient(config);
try {
client.createConnection(listener);
}
// retry once
catch (ConnectException e) {
client.createConnection(listener);
}
m_clients.add(client);
return client;
} | Client function(int hostId, long timeout) throws IOException { final String listener = m_config.getListenerAddress(hostId); ClientConfig config = new ClientConfigForTest(m_username, m_password); config.setConnectionResponseTimeout(timeout); config.setProcedureCallTimeout(timeout); final Client client = ClientFactory.createClient(config); try { client.createConnection(listener); } catch (ConnectException e) { client.createConnection(listener); } m_clients.add(client); return client; } | /**
* Get a VoltClient instance connected to a specific server driven by the
* VoltServerConfig instance. Find the server by the config's HostId.
*
* @return A VoltClient instance connected to the server driven by the
* VoltServerConfig instance.
*/ | Get a VoltClient instance connected to a specific server driven by the VoltServerConfig instance. Find the server by the config's HostId | getClientToHostId | {
"repo_name": "ingted/voltdb",
"path": "tests/frontend/org/voltdb/regressionsuites/RegressionSuite.java",
"license": "agpl-3.0",
"size": 35139
} | [
"java.io.IOException",
"java.net.ConnectException",
"org.voltdb.client.Client",
"org.voltdb.client.ClientConfig",
"org.voltdb.client.ClientConfigForTest",
"org.voltdb.client.ClientFactory"
] | import java.io.IOException; import java.net.ConnectException; import org.voltdb.client.Client; import org.voltdb.client.ClientConfig; import org.voltdb.client.ClientConfigForTest; import org.voltdb.client.ClientFactory; | import java.io.*; import java.net.*; import org.voltdb.client.*; | [
"java.io",
"java.net",
"org.voltdb.client"
] | java.io; java.net; org.voltdb.client; | 119,778 |
@Test
public void authenticateWhenLoginPageIsSlashLoginAndAuthenticationFailsThenRedirectContainsErrorParameter()
throws Exception {
this.spring.configLocations(this.xml("ForSec3147")).autowire();
// @formatter:off
MockHttpServletRequestBuilder loginRequest = post("/login")
.param("username", "user")
.param("password", "wrong")
.with(csrf());
this.mvc.perform(loginRequest)
.andExpect(redirectedUrl("/login?error"));
// @formatter:on
} | void function() throws Exception { this.spring.configLocations(this.xml(STR)).autowire(); MockHttpServletRequestBuilder loginRequest = post(STR) .param(STR, "user") .param(STR, "wrong") .with(csrf()); this.mvc.perform(loginRequest) .andExpect(redirectedUrl(STR)); } | /**
* SEC-3147: authentication-failure-url should be contained "error" parameter if
* login-page="/login"
*/ | SEC-3147: authentication-failure-url should be contained "error" parameter if login-page="/login" | authenticateWhenLoginPageIsSlashLoginAndAuthenticationFailsThenRedirectContainsErrorParameter | {
"repo_name": "jgrandja/spring-security",
"path": "config/src/test/java/org/springframework/security/config/http/FormLoginConfigTests.java",
"license": "apache-2.0",
"size": 9203
} | [
"org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder",
"org.springframework.test.web.servlet.request.MockMvcRequestBuilders"
] | import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; | import org.springframework.test.web.servlet.request.*; | [
"org.springframework.test"
] | org.springframework.test; | 24,766 |
public static void readFully(InputStream in, byte[] bytes, int offset,
int length) throws IOException {
if (length < 0) {
throw new IndexOutOfBoundsException();
}
int n = 0;
while (n < length) {
int count = in.read(bytes, offset + n, length - n);
if (count < 0) {
throw new EOFException();
}
n += count;
}
}
| static void function(InputStream in, byte[] bytes, int offset, int length) throws IOException { if (length < 0) { throw new IndexOutOfBoundsException(); } int n = 0; while (n < length) { int count = in.read(bytes, offset + n, length - n); if (count < 0) { throw new EOFException(); } n += count; } } | /**
* block until exactly <code>length</code> bytes read into
* <code>bytes</code>
*
* @param in
* @param bytes
* @param offset
* @param length
* @throws java.io.IOException
*/ | block until exactly <code>length</code> bytes read into <code>bytes</code> | readFully | {
"repo_name": "zhaoshiling1017/voyage",
"path": "src/main/java/com/lenzhao/framework/util/IOUtil.java",
"license": "apache-2.0",
"size": 2183
} | [
"java.io.EOFException",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.EOFException; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 744,859 |
private void addDependency(String qname, DependencyTypeSet types)
{
DependencyTypeSet typeSet = dependencies.get(qname);
if(typeSet != null)
{
DependencyTypeSet newTypeSet = DependencyTypeSet.copyOf(typeSet);
newTypeSet.addAll(types);
this.dependencies.put(qname, newTypeSet);
}
else
{
this.dependencies.put(qname, DependencyTypeSet.copyOf(types));
}
dependencySet.addAll(types);
} | void function(String qname, DependencyTypeSet types) { DependencyTypeSet typeSet = dependencies.get(qname); if(typeSet != null) { DependencyTypeSet newTypeSet = DependencyTypeSet.copyOf(typeSet); newTypeSet.addAll(types); this.dependencies.put(qname, newTypeSet); } else { this.dependencies.put(qname, DependencyTypeSet.copyOf(types)); } dependencySet.addAll(types); } | /**
* Adds a dependency of a {@link DependencyType} on a definition
* with qname to this Edge.
*
* @param qname The definition qualified name that is depended on
* @param types {@link DependencyType}'s to add to this edge.
*/ | Adds a dependency of a <code>DependencyType</code> on a definition with qname to this Edge | addDependency | {
"repo_name": "adufilie/flex-falcon",
"path": "compiler/src/org/apache/flex/compiler/internal/projects/DependencyGraph.java",
"license": "apache-2.0",
"size": 29162
} | [
"org.apache.flex.compiler.common.DependencyTypeSet"
] | import org.apache.flex.compiler.common.DependencyTypeSet; | import org.apache.flex.compiler.common.*; | [
"org.apache.flex"
] | org.apache.flex; | 2,234,535 |
public void runStateChanged(boolean isRunning) throws TimeServiceException {
if ( baseTimerBusObj == null ) {
Log.w(TAG, "This Timer hasn't been created yet");
return;
}
baseTimerBusObj.sendRunStateChanged(isRunning);
}
| void function(boolean isRunning) throws TimeServiceException { if ( baseTimerBusObj == null ) { Log.w(TAG, STR); return; } baseTimerBusObj.sendRunStateChanged(isRunning); } | /**
* Emit the signal when the {@link Timer} changes its running state as a result of
* {@link Timer#start()} or {@link Timer#pause()}.
* @param isRunning TRUE if the {@link Timer} is running
* @throws TimeServiceException Is thrown if failed to emit the RunStateChanged signal
*/ | Emit the signal when the <code>Timer</code> changes its running state as a result of <code>Timer#start()</code> or <code>Timer#pause()</code> | runStateChanged | {
"repo_name": "gcampax/alljoyn",
"path": "alljoyn/services/time/java/TimeService/src/org/allseen/timeservice/server/Timer.java",
"license": "isc",
"size": 6255
} | [
"android.util.Log",
"org.allseen.timeservice.TimeServiceException"
] | import android.util.Log; import org.allseen.timeservice.TimeServiceException; | import android.util.*; import org.allseen.timeservice.*; | [
"android.util",
"org.allseen.timeservice"
] | android.util; org.allseen.timeservice; | 450,441 |
public String[] involvedFields() {
return Arrays.copyOf(involvedFields, involvedFields.length);
} | String[] function() { return Arrays.copyOf(involvedFields, involvedFields.length); } | /**
* Returns the involved fields of the join function
*
* @return the involved fields for this join
*/ | Returns the involved fields of the join function | involvedFields | {
"repo_name": "phxql/chronix.server",
"path": "chronix-server-query-handler/src/main/java/de/qaware/chronix/solr/query/analysis/JoinFunction.java",
"license": "apache-2.0",
"size": 3395
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 619,767 |
@NbBundle.Messages({"EamDbSettingsDialog.okButton.corruptDatabaseExists.title=Error Loading Central Repository Database",
"EamDbSettingsDialog.okButton.corruptDatabaseExists.message=Central Repository Database exists but is not the right format. Manually delete it or choose a different path (if applicable).",
"EamDbSettingsDialog.okButton.createDbDialog.title=Central Repository Database Does Not Exist",
"EamDbSettingsDialog.okButton.createDbDialog.message=Central Repository Database does not exist, would you like to create it?",
"EamDbSettingsDialog.okButton.databaseConnectionFailed.title=Central Repository Database Connection Failed",
"EamDbSettingsDialog.okButton.databaseConnectionFailed.message=Unable to connect to Central Repository Database. Please check your settings and try again.",
"EamDbSettingsDialog.okButton.createSQLiteDbError.message=Unable to create SQLite Central Repository Database, please ensure location exists and you have write permissions and try again.",
"EamDbSettingsDialog.okButton.createPostgresDbError.message=Unable to create Postgres Central Repository Database, please ensure address, port, and login credentials are correct for Postgres server and try again.",
"EamDbSettingsDialog.okButton.createDbError.title=Unable to Create Central Repository Database"})
private static boolean promptTestStatusWarnings(CentralRepoDbManager manager, EamDbSettingsDialog dialog) {
if (manager.getStatus() == DatabaseTestResult.CONNECTION_FAILED) {
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_message(),
Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_title(),
JOptionPane.WARNING_MESSAGE);
} else if (manager.getStatus() == DatabaseTestResult.SCHEMA_INVALID) {
// There's an existing database or file, but it's not in our format.
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(),
Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_message(),
Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_title(),
JOptionPane.WARNING_MESSAGE);
} else if (manager.getStatus() == DatabaseTestResult.DB_DOES_NOT_EXIST) {
promptCreateDatabase(manager, dialog);
}
return (manager.getStatus() == DatabaseTestResult.TESTED_OK);
} | @NbBundle.Messages({STR, STR, STR, STR, STR, STR, STR, STR, STR}) static boolean function(CentralRepoDbManager manager, EamDbSettingsDialog dialog) { if (manager.getStatus() == DatabaseTestResult.CONNECTION_FAILED) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_message(), Bundle.EamDbSettingsDialog_okButton_databaseConnectionFailed_title(), JOptionPane.WARNING_MESSAGE); } else if (manager.getStatus() == DatabaseTestResult.SCHEMA_INVALID) { JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_message(), Bundle.EamDbSettingsDialog_okButton_corruptDatabaseExists_title(), JOptionPane.WARNING_MESSAGE); } else if (manager.getStatus() == DatabaseTestResult.DB_DOES_NOT_EXIST) { promptCreateDatabase(manager, dialog); } return (manager.getStatus() == DatabaseTestResult.TESTED_OK); } | /**
* This method prompts user based on testing status (i.e. failure to
* connect, invalid schema, db does not exist, etc.).
*
* @param manager The manager to use when setting up the database.
* @param dialog If non-null value, validates settings and updates 'okay'
* button enabled state.
*
* @return Whether or not the ultimate status after prompts is okay to
* continue.
*/ | This method prompts user based on testing status (i.e. failure to connect, invalid schema, db does not exist, etc.) | promptTestStatusWarnings | {
"repo_name": "esaunders/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/EamDbSettingsDialog.java",
"license": "apache-2.0",
"size": 46565
} | [
"javax.swing.JOptionPane",
"org.openide.util.NbBundle",
"org.openide.windows.WindowManager",
"org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager",
"org.sleuthkit.autopsy.centralrepository.datamodel.DatabaseTestResult"
] | import javax.swing.JOptionPane; import org.openide.util.NbBundle; import org.openide.windows.WindowManager; import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepoDbManager; import org.sleuthkit.autopsy.centralrepository.datamodel.DatabaseTestResult; | import javax.swing.*; import org.openide.util.*; import org.openide.windows.*; import org.sleuthkit.autopsy.centralrepository.datamodel.*; | [
"javax.swing",
"org.openide.util",
"org.openide.windows",
"org.sleuthkit.autopsy"
] | javax.swing; org.openide.util; org.openide.windows; org.sleuthkit.autopsy; | 2,078,739 |
public static Range iterateRangeBounds(XYDataset dataset) {
return iterateRangeBounds(dataset, true);
} | static Range function(XYDataset dataset) { return iterateRangeBounds(dataset, true); } | /**
* Iterates over the data item of the xy dataset to find the range bounds.
*
* @param dataset
* the dataset (<code>null</code> not permitted).
*
* @return The range (possibly <code>null</code>).
*
* @since JFreeChart 1.0.10
*/ | Iterates over the data item of the xy dataset to find the range bounds | iterateRangeBounds | {
"repo_name": "djun100/afreechart",
"path": "src/org/afree/data/general/DatasetUtilities.java",
"license": "lgpl-3.0",
"size": 51000
} | [
"org.afree.data.Range",
"org.afree.data.xy.XYDataset"
] | import org.afree.data.Range; import org.afree.data.xy.XYDataset; | import org.afree.data.*; import org.afree.data.xy.*; | [
"org.afree.data"
] | org.afree.data; | 1,335,741 |
public boolean acknowledgeAlert(AuthzSubject subject, EscalationAlertType type, Integer alertId, String moreInfo,
long pause) throws PermissionException; | boolean function(AuthzSubject subject, EscalationAlertType type, Integer alertId, String moreInfo, long pause) throws PermissionException; | /**
* Acknowledge an alert, potentially sending out notifications.
*
* @param subject Person who acknowledged the alert
* @param pause TODO
*/ | Acknowledge an alert, potentially sending out notifications | acknowledgeAlert | {
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/escalation/shared/EscalationManager.java",
"license": "unlicense",
"size": 8013
} | [
"org.hyperic.hq.authz.server.session.AuthzSubject",
"org.hyperic.hq.authz.shared.PermissionException",
"org.hyperic.hq.escalation.server.session.EscalationAlertType"
] | import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.escalation.server.session.EscalationAlertType; | import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; import org.hyperic.hq.escalation.server.session.*; | [
"org.hyperic.hq"
] | org.hyperic.hq; | 2,733,872 |
@Override
public void writeSigned32bitLE(final int b) throws EOFException {
write32bitLE(b);
} | void function(final int b) throws EOFException { write32bitLE(b); } | /**
* Write 32 bits Little Endian.
*
* @param b data
*
* @throws EOFException if end of file
*/ | Write 32 bits Little Endian | writeSigned32bitLE | {
"repo_name": "tectronics/openjill",
"path": "abstractfile/src/main/java/org/jill/file/FileAbstractByteImpl.java",
"license": "mpl-2.0",
"size": 10497
} | [
"java.io.EOFException"
] | import java.io.EOFException; | import java.io.*; | [
"java.io"
] | java.io; | 2,907,492 |
protected void sequence_AtomicExpression(EObject context, Expression semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(EObject context, Expression semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Constraint:
* (true='true' | false='false' | variable=[Variable|QualifiedName] | valueString=STRING | valueRealNumber=RealNumber)
*/ | Constraint: (true='true' | false='false' | variable=[Variable|QualifiedName] | valueString=STRING | valueRealNumber=RealNumber) | sequence_AtomicExpression | {
"repo_name": "niksavis/mm-dsl",
"path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java",
"license": "epl-1.0",
"size": 190481
} | [
"org.eclipse.emf.ecore.EObject",
"org.xtext.nv.dsl.mMDSL.Expression"
] | import org.eclipse.emf.ecore.EObject; import org.xtext.nv.dsl.mMDSL.Expression; | import org.eclipse.emf.ecore.*; import org.xtext.nv.dsl.*; | [
"org.eclipse.emf",
"org.xtext.nv"
] | org.eclipse.emf; org.xtext.nv; | 1,125,815 |
void putArtifact(String name, String version, File content) throws RepositoryException; | void putArtifact(String name, String version, File content) throws RepositoryException; | /**
* Publishes an artifact by name/version as a File
*
* @param name the artifact name
* @param version the artifact version
* @param content the artifact content as a File
*
* @throws RepositoryException if anything went wrong
*/ | Publishes an artifact by name/version as a File | putArtifact | {
"repo_name": "jvasileff/ceylon-module-resolver",
"path": "api/src/main/java/com/redhat/ceylon/cmr/api/RepositoryManager.java",
"license": "apache-2.0",
"size": 7198
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,603,652 |
@Test(expected = InvalidStateException.class)
public void dataTooLong() {
// assume there is enough memory for this test
assumeTrue(Runtime.getRuntime().freeMemory() > 17 * 1000 * 1000);
entity.setName("name");
entity.setType(FileType.SOURCE);
entity.setData(RandomStringUtils.randomAlphabetic(16000001));
dao.persist(entity);
} | @Test(expected = InvalidStateException.class) void function() { assumeTrue(Runtime.getRuntime().freeMemory() > 17 * 1000 * 1000); entity.setName("name"); entity.setType(FileType.SOURCE); entity.setData(RandomStringUtils.randomAlphabetic(16000001)); dao.persist(entity); } | /**
* Data is too long.
*/ | Data is too long | dataTooLong | {
"repo_name": "mbezjak/vhdllab",
"path": "vhdllab-server/src/test/java/hr/fer/zemris/vhdllab/dao/impl/FileInfoDaoTest.java",
"license": "apache-2.0",
"size": 3289
} | [
"hr.fer.zemris.vhdllab.entity.FileType",
"org.apache.commons.lang.RandomStringUtils",
"org.hibernate.validator.InvalidStateException",
"org.junit.Assume",
"org.junit.Test"
] | import hr.fer.zemris.vhdllab.entity.FileType; import org.apache.commons.lang.RandomStringUtils; import org.hibernate.validator.InvalidStateException; import org.junit.Assume; import org.junit.Test; | import hr.fer.zemris.vhdllab.entity.*; import org.apache.commons.lang.*; import org.hibernate.validator.*; import org.junit.*; | [
"hr.fer.zemris",
"org.apache.commons",
"org.hibernate.validator",
"org.junit"
] | hr.fer.zemris; org.apache.commons; org.hibernate.validator; org.junit; | 1,174,686 |
public void testGetRenderDefault() throws QuickFixException {
RenderType defaultRender = define(baseTag, "", "").getRender();
assertEquals("By default, rendering detection logic should be on.", RenderType.AUTO, defaultRender);
} | void function() throws QuickFixException { RenderType defaultRender = define(baseTag, STRSTRBy default, rendering detection logic should be on.", RenderType.AUTO, defaultRender); } | /**
* Verify the render attribute specified on a component tag. By default the rendering logic is turned on. Test
* method for {@link BaseComponentDef#getRender()}.
*/ | Verify the render attribute specified on a component tag. By default the rendering logic is turned on. Test method for <code>BaseComponentDef#getRender()</code> | testGetRenderDefault | {
"repo_name": "igor-sfdc/aura",
"path": "aura-impl/src/test/java/org/auraframework/def/BaseComponentDefTest.java",
"license": "apache-2.0",
"size": 93773
} | [
"org.auraframework.def.BaseComponentDef",
"org.auraframework.throwable.quickfix.QuickFixException"
] | import org.auraframework.def.BaseComponentDef; import org.auraframework.throwable.quickfix.QuickFixException; | import org.auraframework.def.*; import org.auraframework.throwable.quickfix.*; | [
"org.auraframework.def",
"org.auraframework.throwable"
] | org.auraframework.def; org.auraframework.throwable; | 2,024,213 |
public int putAndMoveToFirst( final K k, final int v ) {
final K key[] = this.key;
final boolean used[] = this.used;
final int mask = this.mask;
// The starting point.
int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask;
// There's always an unused entry.
while( used[ pos ] ) {
if ( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) {
final int oldValue = value[ pos ];
value[ pos ] = v;
moveIndexToFirst( pos );
return oldValue;
}
pos = ( pos + 1 ) & mask;
}
used[ pos ] = true;
key[ pos ] = k;
value[ pos ] = v;
if ( size == 0 ) {
first = last = pos;
// Special case of SET_UPPER_LOWER( link[ pos ], -1, -1 );
link[ pos ] = -1L;
}
else {
link[ first ] ^= ( ( link[ first ] ^ ( ( pos & 0xFFFFFFFFL ) << 32 ) ) & 0xFFFFFFFF00000000L );
link[ pos ] = ( ( -1 & 0xFFFFFFFFL ) << 32 ) | ( first & 0xFFFFFFFFL );
first = pos;
}
if ( ++size >= maxFill ) rehash( arraySize( size, f ) );
if ( ASSERTS ) checkTable();
return defRetValue;
} | int function( final K k, final int v ) { final K key[] = this.key; final boolean used[] = this.used; final int mask = this.mask; int pos = ( it.unimi.dsi.fastutil.HashCommon.murmurHash3( strategy.hashCode( (K) (k)) ) ) & mask; while( used[ pos ] ) { if ( ( strategy.equals( (k), (K) (key[ pos ]) ) ) ) { final int oldValue = value[ pos ]; value[ pos ] = v; moveIndexToFirst( pos ); return oldValue; } pos = ( pos + 1 ) & mask; } used[ pos ] = true; key[ pos ] = k; value[ pos ] = v; if ( size == 0 ) { first = last = pos; link[ pos ] = -1L; } else { link[ first ] ^= ( ( link[ first ] ^ ( ( pos & 0xFFFFFFFFL ) << 32 ) ) & 0xFFFFFFFF00000000L ); link[ pos ] = ( ( -1 & 0xFFFFFFFFL ) << 32 ) ( first & 0xFFFFFFFFL ); first = pos; } if ( ++size >= maxFill ) rehash( arraySize( size, f ) ); if ( ASSERTS ) checkTable(); return defRetValue; } | /** Adds a pair to the map; if the key is already present, it is moved to the first position of the iteration order.
*
* @param k the key.
* @param v the value.
* @return the old value, or the {@linkplain #defaultReturnValue() default return value} if no value was present for the given key.
*/ | Adds a pair to the map; if the key is already present, it is moved to the first position of the iteration order | putAndMoveToFirst | {
"repo_name": "karussell/fastutil",
"path": "src/it/unimi/dsi/fastutil/objects/Object2IntLinkedOpenCustomHashMap.java",
"license": "apache-2.0",
"size": 49557
} | [
"it.unimi.dsi.fastutil.HashCommon"
] | import it.unimi.dsi.fastutil.HashCommon; | import it.unimi.dsi.fastutil.*; | [
"it.unimi.dsi"
] | it.unimi.dsi; | 620,001 |
Single<String> scriptLoad(String luaScript); | Single<String> scriptLoad(String luaScript); | /**
* Loads Lua script into Redis scripts cache and returns its SHA-1 digest
*
* @param luaScript - lua script
* @return SHA-1 digest
*/ | Loads Lua script into Redis scripts cache and returns its SHA-1 digest | scriptLoad | {
"repo_name": "mrniko/redisson",
"path": "redisson/src/main/java/org/redisson/api/RScriptRx.java",
"license": "apache-2.0",
"size": 4604
} | [
"io.reactivex.rxjava3.core.Single"
] | import io.reactivex.rxjava3.core.Single; | import io.reactivex.rxjava3.core.*; | [
"io.reactivex.rxjava3"
] | io.reactivex.rxjava3; | 202,433 |
AssignExpr withOp(Mutation<AssignOp> mutation); | AssignExpr withOp(Mutation<AssignOp> mutation); | /**
* Mutates the op of this assignment expression.
*
* @param mutation the mutation to apply to the op of this assignment expression.
* @return the resulting mutated assignment expression.
*/ | Mutates the op of this assignment expression | withOp | {
"repo_name": "ptitjes/jlato",
"path": "src/main/java/org/jlato/tree/expr/AssignExpr.java",
"license": "lgpl-3.0",
"size": 2843
} | [
"org.jlato.util.Mutation"
] | import org.jlato.util.Mutation; | import org.jlato.util.*; | [
"org.jlato.util"
] | org.jlato.util; | 670,918 |
public Observable<ServiceResponse<Page<USqlTablePartition>>> listTablePartitionsSinglePageAsync(final String accountName, final String databaseName, final String schemaName, final String tableName) {
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (this.client.adlaCatalogDnsSuffix() == null) {
throw new IllegalArgumentException("Parameter this.client.adlaCatalogDnsSuffix() is required and cannot be null.");
}
if (databaseName == null) {
throw new IllegalArgumentException("Parameter databaseName is required and cannot be null.");
}
if (schemaName == null) {
throw new IllegalArgumentException("Parameter schemaName is required and cannot be null.");
}
if (tableName == null) {
throw new IllegalArgumentException("Parameter tableName is required and cannot be null.");
}
if (this.client.apiVersion() == null) {
throw new IllegalArgumentException("Parameter this.client.apiVersion() is required and cannot be null.");
} | Observable<ServiceResponse<Page<USqlTablePartition>>> function(final String accountName, final String databaseName, final String schemaName, final String tableName) { if (accountName == null) { throw new IllegalArgumentException(STR); } if (this.client.adlaCatalogDnsSuffix() == null) { throw new IllegalArgumentException(STR); } if (databaseName == null) { throw new IllegalArgumentException(STR); } if (schemaName == null) { throw new IllegalArgumentException(STR); } if (tableName == null) { throw new IllegalArgumentException(STR); } if (this.client.apiVersion() == null) { throw new IllegalArgumentException(STR); } | /**
* Retrieves the list of table partitions from the Data Lake Analytics catalog.
*
* @param accountName The Azure Data Lake Analytics account upon which to execute catalog operations.
* @param databaseName The name of the database containing the partitions.
* @param schemaName The name of the schema containing the partitions.
* @param tableName The name of the table containing the partitions.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<USqlTablePartition> object wrapped in {@link ServiceResponse} if successful.
*/ | Retrieves the list of table partitions from the Data Lake Analytics catalog | listTablePartitionsSinglePageAsync | {
"repo_name": "jianghaolu/azure-sdk-for-java",
"path": "azure-mgmt-datalake-analytics/src/main/java/com/microsoft/azure/management/datalake/analytics/implementation/CatalogsImpl.java",
"license": "mit",
"size": 683869
} | [
"com.microsoft.azure.Page",
"com.microsoft.azure.management.datalake.analytics.models.USqlTablePartition",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.azure.management.datalake.analytics.models.USqlTablePartition; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.azure.management.datalake.analytics.models.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 2,801,260 |
public static File getFile(long id) {
return getCachedThumbnailLocation(id);
} | static File function(long id) { return getCachedThumbnailLocation(id); } | /**
* Get a file object for where the cached icon should exist. The returned
* file may not exist.
*
* @param id
*
* @return
*
*
* @deprecated use {@link #getCachedThumbnailLocation(long) } instead
*/ | Get a file object for where the cached icon should exist. The returned file may not exist | getFile | {
"repo_name": "maxrp/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java",
"license": "apache-2.0",
"size": 19104
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 187,347 |
public boolean maybeRefreshManifestOnLoadingError(Chunk chunk) {
return PlayerEmsgHandler.this.maybeRefreshManifestOnLoadingError(chunk);
} | boolean function(Chunk chunk) { return PlayerEmsgHandler.this.maybeRefreshManifestOnLoadingError(chunk); } | /**
* For live streaming with emsg event stream, forward seeking can seek pass the emsg messages
* that signals end-of-stream or Manifest expiry, which results in load error. In this case, we
* should notify the Dash media source to refresh its manifest.
*
* @param chunk The chunk whose load encountered the error.
* @return True if manifest refresh has been requested, false otherwise.
*/ | For live streaming with emsg event stream, forward seeking can seek pass the emsg messages that signals end-of-stream or Manifest expiry, which results in load error. In this case, we should notify the Dash media source to refresh its manifest | maybeRefreshManifestOnLoadingError | {
"repo_name": "superbderrick/ExoPlayer",
"path": "library/dash/src/main/java/com/google/android/exoplayer2/source/dash/PlayerEmsgHandler.java",
"license": "apache-2.0",
"size": 15620
} | [
"com.google.android.exoplayer2.source.chunk.Chunk"
] | import com.google.android.exoplayer2.source.chunk.Chunk; | import com.google.android.exoplayer2.source.chunk.*; | [
"com.google.android"
] | com.google.android; | 2,287,416 |
private TransformedWaveletDelta readTransformedDeltaFromRecord() throws IOException {
DeltaHeader header = readDeltaHeader();
file.skipBytes(header.appliedDeltaLength);
TransformedWaveletDelta transformedDelta = readTransformedWaveletDelta(
header.transformedDeltaLength);
return transformedDelta;
}
// *** Low level data reading methods | TransformedWaveletDelta function() throws IOException { DeltaHeader header = readDeltaHeader(); file.skipBytes(header.appliedDeltaLength); TransformedWaveletDelta transformedDelta = readTransformedWaveletDelta( header.transformedDeltaLength); return transformedDelta; } | /**
* Reads a record, and only parses & returns the transformed data field.
*/ | Reads a record, and only parses & returns the transformed data field | readTransformedDeltaFromRecord | {
"repo_name": "JaredMiller/Wave",
"path": "src/org/waveprotocol/box/server/persistence/file/FileDeltaCollection.java",
"license": "apache-2.0",
"size": 19423
} | [
"java.io.IOException",
"org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta"
] | import java.io.IOException; import org.waveprotocol.wave.model.operation.wave.TransformedWaveletDelta; | import java.io.*; import org.waveprotocol.wave.model.operation.wave.*; | [
"java.io",
"org.waveprotocol.wave"
] | java.io; org.waveprotocol.wave; | 2,471,889 |
private void updateTitle() {
Utility.localizeBorder(this, (carrier == null)
? StringTemplate.key("cargoOnCarrier")
: StringTemplate.template("cargoPanel.cargoAndSpace")
.addStringTemplate("%name%",
carrier.getLabel(Unit.UnitLabelType.NATIONAL))
.addAmount("%space%", carrier.getSpaceLeft()));
}
// Interface DropTarget
/**
* {@inheritDoc} | void function() { Utility.localizeBorder(this, (carrier == null) ? StringTemplate.key(STR) : StringTemplate.template(STR) .addStringTemplate(STR, carrier.getLabel(Unit.UnitLabelType.NATIONAL)) .addAmount(STR, carrier.getSpaceLeft())); } /** * {@inheritDoc} | /**
* Update the title of this CargoPanel.
*/ | Update the title of this CargoPanel | updateTitle | {
"repo_name": "FreeCol/freecol",
"path": "src/net/sf/freecol/client/gui/panel/CargoPanel.java",
"license": "gpl-2.0",
"size": 6796
} | [
"net.sf.freecol.common.model.StringTemplate",
"net.sf.freecol.common.model.Unit"
] | import net.sf.freecol.common.model.StringTemplate; import net.sf.freecol.common.model.Unit; | import net.sf.freecol.common.model.*; | [
"net.sf.freecol"
] | net.sf.freecol; | 1,329,895 |
@Deprecated
public void clearInsertBatch() throws KettleDatabaseException {
clearBatch( prepStatementInsert );
} | void function() throws KettleDatabaseException { clearBatch( prepStatementInsert ); } | /**
* Clears batch of insert prepared statement
*
* @deprecated
* @throws KettleDatabaseException
*/ | Clears batch of insert prepared statement | clearInsertBatch | {
"repo_name": "andrei-viaryshka/pentaho-kettle",
"path": "core/src/org/pentaho/di/core/database/Database.java",
"license": "apache-2.0",
"size": 162372
} | [
"org.pentaho.di.core.exception.KettleDatabaseException"
] | import org.pentaho.di.core.exception.KettleDatabaseException; | import org.pentaho.di.core.exception.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 95,219 |
//----------------//
// inferSlotTimes //
//----------------//
private TreeMap<Rational, List<AbstractChordInter>> inferSlotTimes (MeasureSlot narrowSlot)
{
final TreeMap<Rational, List<AbstractChordInter>> times = new TreeMap<>();
for (AbstractChordInter chord : narrowSlot.getChords()) {
AbstractChordInter act = mapping.ref(chord);
if (act != null) {
if (act.getTimeOffset() != null) {
Rational end = act.getEndTime();
List<AbstractChordInter> list = times.get(end);
if (list == null) {
times.put(end, list = new ArrayList<>());
}
list.add(chord);
} else {
measure.setAbnormal(true);
}
}
}
return times;
}
| TreeMap<Rational, List<AbstractChordInter>> function (MeasureSlot narrowSlot) { final TreeMap<Rational, List<AbstractChordInter>> times = new TreeMap<>(); for (AbstractChordInter chord : narrowSlot.getChords()) { AbstractChordInter act = mapping.ref(chord); if (act != null) { if (act.getTimeOffset() != null) { Rational end = act.getEndTime(); List<AbstractChordInter> list = times.get(end); if (list == null) { times.put(end, list = new ArrayList<>()); } list.add(chord); } else { measure.setAbnormal(true); } } } return times; } | /**
* Based on the current mapping proposal, infer the possible slot time(s) for
* the provided narrow slot.
*
* @param narrowSlot the narrow slot to inspect
* @return map of time values inferred
*/ | Based on the current mapping proposal, infer the possible slot time(s) for the provided narrow slot | inferSlotTimes | {
"repo_name": "Audiveris/audiveris",
"path": "src/main/org/audiveris/omr/sheet/rhythm/MeasureRhythm.java",
"license": "agpl-3.0",
"size": 54144
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.TreeMap",
"org.audiveris.omr.math.Rational",
"org.audiveris.omr.sheet.rhythm.Slot",
"org.audiveris.omr.sig.inter.AbstractChordInter"
] | import java.util.ArrayList; import java.util.List; import java.util.TreeMap; import org.audiveris.omr.math.Rational; import org.audiveris.omr.sheet.rhythm.Slot; import org.audiveris.omr.sig.inter.AbstractChordInter; | import java.util.*; import org.audiveris.omr.math.*; import org.audiveris.omr.sheet.rhythm.*; import org.audiveris.omr.sig.inter.*; | [
"java.util",
"org.audiveris.omr"
] | java.util; org.audiveris.omr; | 1,686,754 |
public static MD5Hash computeMd5ForFile(File dataFile) throws IOException {
InputStream in = new FileInputStream(dataFile);
try {
MessageDigest digester = MD5Hash.getDigester();
DigestInputStream dis = new DigestInputStream(in, digester);
IOUtils.copyBytes(dis, new IOUtils.NullOutputStream(), 128*1024);
return new MD5Hash(digester.digest());
} finally {
IOUtils.closeStream(in);
}
} | static MD5Hash function(File dataFile) throws IOException { InputStream in = new FileInputStream(dataFile); try { MessageDigest digester = MD5Hash.getDigester(); DigestInputStream dis = new DigestInputStream(in, digester); IOUtils.copyBytes(dis, new IOUtils.NullOutputStream(), 128*1024); return new MD5Hash(digester.digest()); } finally { IOUtils.closeStream(in); } } | /**
* Read dataFile and compute its MD5 checksum.
*/ | Read dataFile and compute its MD5 checksum | computeMd5ForFile | {
"repo_name": "tseen/Federated-HDFS",
"path": "tseenliu/FedHDFS-hadoop-src/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/util/MD5FileUtils.java",
"license": "apache-2.0",
"size": 6502
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.security.DigestInputStream",
"java.security.MessageDigest",
"org.apache.hadoop.io.IOUtils",
"org.apache.hadoop.io.MD5Hash"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.security.DigestInputStream; import java.security.MessageDigest; import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.io.MD5Hash; | import java.io.*; import java.security.*; import org.apache.hadoop.io.*; | [
"java.io",
"java.security",
"org.apache.hadoop"
] | java.io; java.security; org.apache.hadoop; | 856,163 |
public final Ty getTy() {
return myTy;
}
// ===========================================================
// Protected Methods
// ===========================================================
/**
* <p>
* A helper method to generate the special text formatted strings for classes that inherit from
* {@code AbstractVarDec} | final Ty function() { return myTy; } /** * <p> * A helper method to generate the special text formatted strings for classes that inherit from * {@code AbstractVarDec} | /**
* <p>
* Returns the raw type representation of this class.
* </p>
*
* @return The raw type in {@link Ty} format.
*/ | Returns the raw type representation of this class. | getTy | {
"repo_name": "ClemsonRSRG/RESOLVE",
"path": "src/java/edu/clemson/rsrg/absyn/declarations/variabledecl/AbstractVarDec.java",
"license": "bsd-3-clause",
"size": 4074
} | [
"edu.clemson.rsrg.absyn.rawtypes.Ty"
] | import edu.clemson.rsrg.absyn.rawtypes.Ty; | import edu.clemson.rsrg.absyn.rawtypes.*; | [
"edu.clemson.rsrg"
] | edu.clemson.rsrg; | 650,844 |
public boolean isMatch(String url)
{
if (_urlPatternList.size() == 0)
return true;
for (int i = 0; i < _urlPatternList.size(); i++) {
Pattern pattern = _urlPatternList.get(i);
if (pattern.matcher(url).find())
return true;
}
return false;
}
static {
HttpMethod []methods = HttpMethod.values();
for (int i = 0; i < methods.length; i++) {
HttpMethod method = methods[i];
_methods[i] = method.toString();
}
} | boolean function(String url) { if (_urlPatternList.size() == 0) return true; for (int i = 0; i < _urlPatternList.size(); i++) { Pattern pattern = _urlPatternList.get(i); if (pattern.matcher(url).find()) return true; } return false; } static { HttpMethod []methods = HttpMethod.values(); for (int i = 0; i < methods.length; i++) { HttpMethod method = methods[i]; _methods[i] = method.toString(); } } | /**
* Returns true if there's a pattern match.
*/ | Returns true if there's a pattern match | isMatch | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/server/security/WebResourceCollection.java",
"license": "gpl-2.0",
"size": 5086
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,418,509 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.