method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
@Override
protected void setUpView(View rootView) {
} | void function(View rootView) { } | /**
* Maps all the view elements from the xml declaration to members of this renderer.
*/ | Maps all the view elements from the xml declaration to members of this renderer | setUpView | {
"repo_name": "0359xiaodong/Renderers",
"path": "sample/src/main/java/com/pedrogomez/renderers/ui/renderers/VideoRenderer.java",
"license": "apache-2.0",
"size": 4791
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 2,266,918 |
protected void createContents() {
Display display = Display.getDefault();
shell = new Shell(display, SWT.SHELL_TRIM | SWT.CENTER);
shell.setLayout(new GridLayout(1, false));
Image icon = new Image(display, App.class.getResourceAsStream("icons/icon.png"));
shell.setImage(icon);
createActions();
createMenu(display);
createToolbar();
SashForm sashForm = new SashForm(shell, SWT.VERTICAL);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
// Upper part of toplevel sash
SashForm sashForm2 = new SashForm(sashForm, SWT.HORIZONTAL);
sashForm2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
SashForm sashForm3 = new SashForm(sashForm2, SWT.VERTICAL);
sashForm3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
sourceCodeComposite = new SourceCodeComposite(sashForm3, SWT.NONE, codeRepository);
sourceCodeComposite.setStylesheet(stylesheetRepository.get(settings.getSelectedStylesheet()));
callStackComposite = new CallStackComposite(sashForm3, SWT.NONE);
sashForm3.setWeights(new int[]{18,2});
canvas = new Canvas(sashForm2, SWT.NONE);
sashForm2.setWeights(new int[]{10,10});
// Lower part of toplevel sash
consoleComposite = new ConsoleComposite(sashForm, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
List<Object> nativeCodeWrappers = Lists.newArrayList(
new CanvasWrapper(canvas),
new TurtleWrapper(canvas),
new MathWrapper(),
new UtilsWrapper(consoleComposite)
);
wellKnownWords = Sets.newHashSet();
for (Object wrapper : nativeCodeWrappers) {
Export export = wrapper.getClass().getAnnotation(Export.class);
if (export != null) {
String name = export.name();
if (Strings.isNullOrEmpty(name)) {
name = wrapper.getClass().getName();
}
wellKnownWords.add(name);
}
for (Method m : wrapper.getClass().getMethods()) {
export = m.getAnnotation(Export.class);
if (export != null) {
String name = export.name();
if (Strings.isNullOrEmpty(name)) {
name = m.getName();
}
wellKnownWords.add(name);
}
}
}
sourceCodeComposite.setWellKnownWords(wellKnownWords);
sashForm.setWeights(new int[]{3, 1});
shell.setText(APP_NAME);
shell.setMaximized(true);
shell.layout();
shell.open();
consoleOut = new PrintWriter(consoleComposite.getOutputStream(), true);
virtualMachine = new VirtualMachine(consoleComposite.getOutputStream(), consoleComposite.getInputStream(), nativeCodeWrappers);
callStackComposite.setVirtualMachine(virtualMachine);
updateVmButtons(); | void function() { Display display = Display.getDefault(); shell = new Shell(display, SWT.SHELL_TRIM SWT.CENTER); shell.setLayout(new GridLayout(1, false)); Image icon = new Image(display, App.class.getResourceAsStream(STR)); shell.setImage(icon); createActions(); createMenu(display); createToolbar(); SashForm sashForm = new SashForm(shell, SWT.VERTICAL); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); SashForm sashForm2 = new SashForm(sashForm, SWT.HORIZONTAL); sashForm2.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); SashForm sashForm3 = new SashForm(sashForm2, SWT.VERTICAL); sashForm3.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); sourceCodeComposite = new SourceCodeComposite(sashForm3, SWT.NONE, codeRepository); sourceCodeComposite.setStylesheet(stylesheetRepository.get(settings.getSelectedStylesheet())); callStackComposite = new CallStackComposite(sashForm3, SWT.NONE); sashForm3.setWeights(new int[]{18,2}); canvas = new Canvas(sashForm2, SWT.NONE); sashForm2.setWeights(new int[]{10,10}); consoleComposite = new ConsoleComposite(sashForm, SWT.BORDER SWT.H_SCROLL SWT.V_SCROLL); List<Object> nativeCodeWrappers = Lists.newArrayList( new CanvasWrapper(canvas), new TurtleWrapper(canvas), new MathWrapper(), new UtilsWrapper(consoleComposite) ); wellKnownWords = Sets.newHashSet(); for (Object wrapper : nativeCodeWrappers) { Export export = wrapper.getClass().getAnnotation(Export.class); if (export != null) { String name = export.name(); if (Strings.isNullOrEmpty(name)) { name = wrapper.getClass().getName(); } wellKnownWords.add(name); } for (Method m : wrapper.getClass().getMethods()) { export = m.getAnnotation(Export.class); if (export != null) { String name = export.name(); if (Strings.isNullOrEmpty(name)) { name = m.getName(); } wellKnownWords.add(name); } } } sourceCodeComposite.setWellKnownWords(wellKnownWords); sashForm.setWeights(new int[]{3, 1}); shell.setText(APP_NAME); shell.setMaximized(true); shell.layout(); shell.open(); consoleOut = new PrintWriter(consoleComposite.getOutputStream(), true); virtualMachine = new VirtualMachine(consoleComposite.getOutputStream(), consoleComposite.getInputStream(), nativeCodeWrappers); callStackComposite.setVirtualMachine(virtualMachine); updateVmButtons(); | /**
* Create contents of the window.
*/ | Create contents of the window | createContents | {
"repo_name": "asig/programmablefun",
"path": "src/main/java/com/programmablefun/ide/App.java",
"license": "gpl-3.0",
"size": 22621
} | [
"com.google.common.base.Strings",
"com.google.common.collect.Lists",
"com.google.common.collect.Sets",
"com.programmablefun.ide.console.ConsoleComposite",
"com.programmablefun.ide.turtle.Canvas",
"com.programmablefun.runtime.VirtualMachine",
"com.programmablefun.runtime.nativecode.CanvasWrapper",
"com.programmablefun.runtime.nativecode.Export",
"com.programmablefun.runtime.nativecode.MathWrapper",
"com.programmablefun.runtime.nativecode.TurtleWrapper",
"com.programmablefun.runtime.nativecode.UtilsWrapper",
"java.io.PrintWriter",
"java.lang.reflect.Method",
"java.util.List",
"org.eclipse.swt.custom.SashForm",
"org.eclipse.swt.graphics.Image",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Display",
"org.eclipse.swt.widgets.Shell"
] | import com.google.common.base.Strings; import com.google.common.collect.Lists; import com.google.common.collect.Sets; import com.programmablefun.ide.console.ConsoleComposite; import com.programmablefun.ide.turtle.Canvas; import com.programmablefun.runtime.VirtualMachine; import com.programmablefun.runtime.nativecode.CanvasWrapper; import com.programmablefun.runtime.nativecode.Export; import com.programmablefun.runtime.nativecode.MathWrapper; import com.programmablefun.runtime.nativecode.TurtleWrapper; import com.programmablefun.runtime.nativecode.UtilsWrapper; import java.io.PrintWriter; import java.lang.reflect.Method; import java.util.List; import org.eclipse.swt.custom.SashForm; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; | import com.google.common.base.*; import com.google.common.collect.*; import com.programmablefun.ide.console.*; import com.programmablefun.ide.turtle.*; import com.programmablefun.runtime.*; import com.programmablefun.runtime.nativecode.*; import java.io.*; import java.lang.reflect.*; import java.util.*; import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"com.google.common",
"com.programmablefun.ide",
"com.programmablefun.runtime",
"java.io",
"java.lang",
"java.util",
"org.eclipse.swt"
] | com.google.common; com.programmablefun.ide; com.programmablefun.runtime; java.io; java.lang; java.util; org.eclipse.swt; | 665,984 |
public Raster getData() {
// REMIND : this allocates a whole new tile if raster is a
// subtile. (It only copies in the requested area)
// We should do something smarter.
int width = raster.getWidth();
int height = raster.getHeight();
int startX = raster.getMinX();
int startY = raster.getMinY();
WritableRaster wr =
Raster.createWritableRaster(raster.getSampleModel(),
new Point(raster.getSampleModelTranslateX(),
raster.getSampleModelTranslateY()));
Object tdata = null;
for (int i = startY; i < startY+height; i++) {
tdata = raster.getDataElements(startX,i,width,1,tdata);
wr.setDataElements(startX,i,width,1, tdata);
}
return wr;
} | Raster function() { int width = raster.getWidth(); int height = raster.getHeight(); int startX = raster.getMinX(); int startY = raster.getMinY(); WritableRaster wr = Raster.createWritableRaster(raster.getSampleModel(), new Point(raster.getSampleModelTranslateX(), raster.getSampleModelTranslateY())); Object tdata = null; for (int i = startY; i < startY+height; i++) { tdata = raster.getDataElements(startX,i,width,1,tdata); wr.setDataElements(startX,i,width,1, tdata); } return wr; } | /**
* Returns the image as one large tile. The <code>Raster</code>
* returned is a copy of the image data is not updated if the
* image is changed.
* @return a <code>Raster</code> that is a copy of the image data.
* @see #setData(Raster)
*/ | Returns the image as one large tile. The <code>Raster</code> returned is a copy of the image data is not updated if the image is changed | getData | {
"repo_name": "openjdk/jdk7u",
"path": "jdk/src/share/classes/java/awt/image/BufferedImage.java",
"license": "gpl-2.0",
"size": 65010
} | [
"java.awt.Point"
] | import java.awt.Point; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,026,899 |
public void write(byte[] buf, int off, int len) throws IOException {
// This could of course be optimized
for (int i = 0; i < len; i++) {
write(buf[off + i]);
}
} | void function(byte[] buf, int off, int len) throws IOException { for (int i = 0; i < len; i++) { write(buf[off + i]); } } | /**
* Writes the given byte array to the output stream in an encoded form.
*
* @param buf
* the data to be written
* @param off
* the start offset of the data
* @param len
* the length of the data
* @exception IOException
* if an I/O error occurs
*/ | Writes the given byte array to the output stream in an encoded form | write | {
"repo_name": "zhengjiabin/domeke",
"path": "core/src/main/java/com/domeke/app/cos/Base64Encoder.java",
"license": "apache-2.0",
"size": 6111
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 657,237 |
public void testGetSelect1() throws Exception {
BitMap B = new BitMap(2048);
ArrayList<Long> test = new ArrayList<Long>();
for (int i = 0; i < 2048; i++) {
if ((int) (Math.random() * 2) == 1) {
B.setBit(i);
test.add((long) i);
}
}
Dictionary D = new Dictionary(B);
ByteBuffer dBuf = D.getByteBuffer();
FSDataInputStream is = TestUtils.getStream(dBuf);
RandomAccessByteStream bs = new RandomAccessByteStream(is, 0, dBuf.limit());
for (int i = 0; i < test.size(); i++) {
assertEquals(DictionaryOps.getSelect1(bs, 0, i), (long) test.get(i));
}
is.close();
} | void function() throws Exception { BitMap B = new BitMap(2048); ArrayList<Long> test = new ArrayList<Long>(); for (int i = 0; i < 2048; i++) { if ((int) (Math.random() * 2) == 1) { B.setBit(i); test.add((long) i); } } Dictionary D = new Dictionary(B); ByteBuffer dBuf = D.getByteBuffer(); FSDataInputStream is = TestUtils.getStream(dBuf); RandomAccessByteStream bs = new RandomAccessByteStream(is, 0, dBuf.limit()); for (int i = 0; i < test.size(); i++) { assertEquals(DictionaryOps.getSelect1(bs, 0, i), (long) test.get(i)); } is.close(); } | /**
* Test method: getSelect1(ByteBuffer buf, int startPos, int i)
*
* @throws Exception
*/ | Test method: getSelect1(ByteBuffer buf, int startPos, int i) | testGetSelect1 | {
"repo_name": "amplab/succinct",
"path": "spark/src/test/java/edu/berkeley/cs/succinct/util/stream/serops/DictionaryOpsTest.java",
"license": "apache-2.0",
"size": 3409
} | [
"edu.berkeley.cs.succinct.util.bitmap.BitMap",
"edu.berkeley.cs.succinct.util.dictionary.Dictionary",
"edu.berkeley.cs.succinct.util.stream.RandomAccessByteStream",
"edu.berkeley.cs.succinct.util.stream.TestUtils",
"java.nio.ByteBuffer",
"java.util.ArrayList",
"org.apache.hadoop.fs.FSDataInputStream"
] | import edu.berkeley.cs.succinct.util.bitmap.BitMap; import edu.berkeley.cs.succinct.util.dictionary.Dictionary; import edu.berkeley.cs.succinct.util.stream.RandomAccessByteStream; import edu.berkeley.cs.succinct.util.stream.TestUtils; import java.nio.ByteBuffer; import java.util.ArrayList; import org.apache.hadoop.fs.FSDataInputStream; | import edu.berkeley.cs.succinct.util.bitmap.*; import edu.berkeley.cs.succinct.util.dictionary.*; import edu.berkeley.cs.succinct.util.stream.*; import java.nio.*; import java.util.*; import org.apache.hadoop.fs.*; | [
"edu.berkeley.cs",
"java.nio",
"java.util",
"org.apache.hadoop"
] | edu.berkeley.cs; java.nio; java.util; org.apache.hadoop; | 2,396,062 |
private static void initMapAminoAcid() throws FastaFormatException, ChemistryException {
try {
aminoacids = MonomerFactory.getInstance().getMonomerDB().get("PEPTIDE");
} catch (IOException e) {
e.printStackTrace();
LOG.error("AminoAcids can not be initialized");
throw new FastaFormatException(e.getMessage());
}
}
| static void function() throws FastaFormatException, ChemistryException { try { aminoacids = MonomerFactory.getInstance().getMonomerDB().get(STR); } catch (IOException e) { e.printStackTrace(); LOG.error(STR); throw new FastaFormatException(e.getMessage()); } } | /**
* method to initialize map of existing amino acids in the database
*
* @throws FastaFormatException
* AminoAcids can not be initialized
* @throws ChemistryException
* if chemistry engine can not be initialized
* @throws CTKException
* general ChemToolKit exception passed to HELMToolKit
*/ | method to initialize map of existing amino acids in the database | initMapAminoAcid | {
"repo_name": "PistoiaHELM/HELM2NotationToolkit",
"path": "src/main/java/org/helm/notation2/tools/FastaFormat.java",
"license": "mit",
"size": 29777
} | [
"java.io.IOException",
"org.helm.notation2.MonomerFactory",
"org.helm.notation2.exception.ChemistryException",
"org.helm.notation2.exception.FastaFormatException"
] | import java.io.IOException; import org.helm.notation2.MonomerFactory; import org.helm.notation2.exception.ChemistryException; import org.helm.notation2.exception.FastaFormatException; | import java.io.*; import org.helm.notation2.*; import org.helm.notation2.exception.*; | [
"java.io",
"org.helm.notation2"
] | java.io; org.helm.notation2; | 2,450,355 |
void onPlaybackStateChanged(PlayerState oldState, PlayerState newState); | void onPlaybackStateChanged(PlayerState oldState, PlayerState newState); | /**
* Called when the Playback state has changed (e.g. from playing to paused)
* @param oldState the old state
* @param newState the new state
*/ | Called when the Playback state has changed (e.g. from playing to paused) | onPlaybackStateChanged | {
"repo_name": "js0701/chromium-crosswalk",
"path": "chrome/android/java/src/org/chromium/chrome/browser/media/remote/MediaRouteController.java",
"license": "bsd-3-clause",
"size": 10589
} | [
"org.chromium.chrome.browser.media.remote.RemoteVideoInfo"
] | import org.chromium.chrome.browser.media.remote.RemoteVideoInfo; | import org.chromium.chrome.browser.media.remote.*; | [
"org.chromium.chrome"
] | org.chromium.chrome; | 2,609,067 |
@Path("{id}/consents")
@GET
@NoCache
@Produces(MediaType.APPLICATION_JSON)
public List<Map<String, Object>> getConsents(final @PathParam("id") String id) {
auth.requireView();
UserModel user = session.users().getUserById(id, realm);
if (user == null) {
throw new NotFoundException("User not found");
}
List<Map<String, Object>> result = new LinkedList<>();
Set<ClientModel> offlineClients = new UserSessionManager(session).findClientsWithOfflineToken(realm, user);
for (ClientModel client : realm.getClients()) {
UserConsentModel consent = user.getConsentByClient(client.getId());
boolean hasOfflineToken = offlineClients.contains(client);
if (consent == null && !hasOfflineToken) {
continue;
}
UserConsentRepresentation rep = (consent == null) ? null : ModelToRepresentation.toRepresentation(consent);
Map<String, Object> currentRep = new HashMap<>();
currentRep.put("clientId", client.getClientId());
currentRep.put("grantedProtocolMappers", (rep==null ? Collections.emptyMap() : rep.getGrantedProtocolMappers()));
currentRep.put("grantedRealmRoles", (rep==null ? Collections.emptyList() : rep.getGrantedRealmRoles()));
currentRep.put("grantedClientRoles", (rep==null ? Collections.emptyMap() : rep.getGrantedClientRoles()));
List<Map<String, String>> additionalGrants = new LinkedList<>();
if (hasOfflineToken) {
Map<String, String> offlineTokens = new HashMap<>();
offlineTokens.put("client", client.getId());
// TODO: translate
offlineTokens.put("key", "Offline Token");
additionalGrants.add(offlineTokens);
}
currentRep.put("additionalGrants", additionalGrants);
result.add(currentRep);
}
return result;
} | @Path(STR) @Produces(MediaType.APPLICATION_JSON) List<Map<String, Object>> function(final @PathParam("id") String id) { auth.requireView(); UserModel user = session.users().getUserById(id, realm); if (user == null) { throw new NotFoundException(STR); } List<Map<String, Object>> result = new LinkedList<>(); Set<ClientModel> offlineClients = new UserSessionManager(session).findClientsWithOfflineToken(realm, user); for (ClientModel client : realm.getClients()) { UserConsentModel consent = user.getConsentByClient(client.getId()); boolean hasOfflineToken = offlineClients.contains(client); if (consent == null && !hasOfflineToken) { continue; } UserConsentRepresentation rep = (consent == null) ? null : ModelToRepresentation.toRepresentation(consent); Map<String, Object> currentRep = new HashMap<>(); currentRep.put(STR, client.getClientId()); currentRep.put(STR, (rep==null ? Collections.emptyMap() : rep.getGrantedProtocolMappers())); currentRep.put(STR, (rep==null ? Collections.emptyList() : rep.getGrantedRealmRoles())); currentRep.put(STR, (rep==null ? Collections.emptyMap() : rep.getGrantedClientRoles())); List<Map<String, String>> additionalGrants = new LinkedList<>(); if (hasOfflineToken) { Map<String, String> offlineTokens = new HashMap<>(); offlineTokens.put(STR, client.getId()); offlineTokens.put("key", STR); additionalGrants.add(offlineTokens); } currentRep.put(STR, additionalGrants); result.add(currentRep); } return result; } | /**
* Get consents granted by the user
*
* @param id User id
* @return
*/ | Get consents granted by the user | getConsents | {
"repo_name": "gregjones60/keycloak",
"path": "services/src/main/java/org/keycloak/services/resources/admin/UsersResource.java",
"license": "apache-2.0",
"size": 35766
} | [
"java.util.Collections",
"java.util.HashMap",
"java.util.LinkedList",
"java.util.List",
"java.util.Map",
"java.util.Set",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType",
"org.jboss.resteasy.spi.NotFoundException",
"org.keycloak.models.ClientModel",
"org.keycloak.models.UserConsentModel",
"org.keycloak.models.UserModel",
"org.keycloak.models.utils.ModelToRepresentation",
"org.keycloak.representations.idm.UserConsentRepresentation",
"org.keycloak.services.managers.UserSessionManager"
] | import java.util.Collections; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import org.jboss.resteasy.spi.NotFoundException; import org.keycloak.models.ClientModel; import org.keycloak.models.UserConsentModel; import org.keycloak.models.UserModel; import org.keycloak.models.utils.ModelToRepresentation; import org.keycloak.representations.idm.UserConsentRepresentation; import org.keycloak.services.managers.UserSessionManager; | import java.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.jboss.resteasy.spi.*; import org.keycloak.models.*; import org.keycloak.models.utils.*; import org.keycloak.representations.idm.*; import org.keycloak.services.managers.*; | [
"java.util",
"javax.ws",
"org.jboss.resteasy",
"org.keycloak.models",
"org.keycloak.representations",
"org.keycloak.services"
] | java.util; javax.ws; org.jboss.resteasy; org.keycloak.models; org.keycloak.representations; org.keycloak.services; | 1,257,232 |
private void registerCommandsInScheduler(Map<Integer, HashSet<String>> scheduledCommands) {
if(scheduledCommands != null) {
for(Entry<Integer, HashSet<String>> scheduledCommandsStack : scheduledCommands.entrySet()) {
p.getServer().getScheduler().runTaskLater(
p,
new ScheduledCommandsExecutorTask(p, scheduledCommandsStack.getValue()),
scheduledCommandsStack.getKey() * 20l
);
}
}
}
| void function(Map<Integer, HashSet<String>> scheduledCommands) { if(scheduledCommands != null) { for(Entry<Integer, HashSet<String>> scheduledCommandsStack : scheduledCommands.entrySet()) { p.getServer().getScheduler().runTaskLater( p, new ScheduledCommandsExecutorTask(p, scheduledCommandsStack.getValue()), scheduledCommandsStack.getKey() * 20l ); } } } | /**
* Register the given commands in the Bukkit' scheduler.
*
* Delays are from the execution of this method.
* @param scheduledCommands
*/ | Register the given commands in the Bukkit' scheduler. Delays are from the execution of this method | registerCommandsInScheduler | {
"repo_name": "kyriog/UHPlugin",
"path": "src/main/java/me/azenet/UHPlugin/UHRuntimeCommandsExecutor.java",
"license": "gpl-3.0",
"size": 7515
} | [
"java.util.HashSet",
"java.util.Map",
"me.azenet.UHPlugin"
] | import java.util.HashSet; import java.util.Map; import me.azenet.UHPlugin; | import java.util.*; import me.azenet.*; | [
"java.util",
"me.azenet"
] | java.util; me.azenet; | 1,613,717 |
private void fromStream(int size) throws IOException {
if (in == null)
return;
maxOff = Math.max(maxOff, size);
long now = U.currentTimeMillis();
// Increase size of buffer if needed.
if (size > inBuf.length)
buf = inBuf = new byte[Math.max(inBuf.length << 1, size)]; // Grow.
else if (now - lastCheck > CHECK_FREQ) {
int halfSize = inBuf.length >> 1;
if (maxOff < halfSize) {
byte[] newInBuf = new byte[halfSize]; // Shrink.
System.arraycopy(inBuf, 0, newInBuf, 0, off);
buf = inBuf = newInBuf;
}
maxOff = 0;
lastCheck = now;
}
off = 0;
max = 0;
while (max != size) {
int read = in.read(inBuf, max, size - max);
if (read == -1)
throw new EOFException("End of stream reached: " + in);
max += read;
}
} | void function(int size) throws IOException { if (in == null) return; maxOff = Math.max(maxOff, size); long now = U.currentTimeMillis(); if (size > inBuf.length) buf = inBuf = new byte[Math.max(inBuf.length << 1, size)]; else if (now - lastCheck > CHECK_FREQ) { int halfSize = inBuf.length >> 1; if (maxOff < halfSize) { byte[] newInBuf = new byte[halfSize]; System.arraycopy(inBuf, 0, newInBuf, 0, off); buf = inBuf = newInBuf; } maxOff = 0; lastCheck = now; } off = 0; max = 0; while (max != size) { int read = in.read(inBuf, max, size - max); if (read == -1) throw new EOFException(STR + in); max += read; } } | /**
* Reads from stream to buffer. If stream is {@code null}, this method is no-op.
*
* @param size Number of bytes to read.
* @throws IOException In case of error.
*/ | Reads from stream to buffer. If stream is null, this method is no-op | fromStream | {
"repo_name": "ilantukh/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/io/GridUnsafeDataInput.java",
"license": "apache-2.0",
"size": 17806
} | [
"java.io.EOFException",
"java.io.IOException",
"org.apache.ignite.internal.util.typedef.internal.U"
] | import java.io.EOFException; import java.io.IOException; import org.apache.ignite.internal.util.typedef.internal.U; | import java.io.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"java.io",
"org.apache.ignite"
] | java.io; org.apache.ignite; | 2,162,031 |
public static void setState(TEBase TE, int state)
{
int temp = BlockProperties.getMetadata(TE) & 0xfffb;
temp |= state << 2;
World world = TE.getWorldObj();
if (!world.isRemote) {
world.playAuxSFXAtEntity((EntityPlayer)null, 1003, TE.xCoord, TE.yCoord, TE.zCoord, 0);
}
BlockProperties.setMetadata(TE, temp);
} | static void function(TEBase TE, int state) { int temp = BlockProperties.getMetadata(TE) & 0xfffb; temp = state << 2; World world = TE.getWorldObj(); if (!world.isRemote) { world.playAuxSFXAtEntity((EntityPlayer)null, 1003, TE.xCoord, TE.yCoord, TE.zCoord, 0); } BlockProperties.setMetadata(TE, temp); } | /**
* Sets state.
*/ | Sets state | setState | {
"repo_name": "LorenzoDCC/carpentersblocks",
"path": "carpentersblocks/data/Safe.java",
"license": "lgpl-2.1",
"size": 3603
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.world.World"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.world.World; | import net.minecraft.entity.player.*; import net.minecraft.world.*; | [
"net.minecraft.entity",
"net.minecraft.world"
] | net.minecraft.entity; net.minecraft.world; | 159,795 |
private static <T> T getMergeFuture(Future<T> mergeFuture) throws InterruptedException, DeltaFailureException {
try {
return mergeFuture.get();
} catch (ExecutionException e) {
Throwable cause = e.getCause();
if (cause instanceof DeltaFailureException) {
throw (DeltaFailureException) cause;
}
if (cause instanceof InterruptedException) {
throw (InterruptedException) cause;
}
// should not happen unless mergeTables is changed without changing this.
throw new RuntimeException(cause.getMessage(), cause);
}
} | static <T> T function(Future<T> mergeFuture) throws InterruptedException, DeltaFailureException { try { return mergeFuture.get(); } catch (ExecutionException e) { Throwable cause = e.getCause(); if (cause instanceof DeltaFailureException) { throw (DeltaFailureException) cause; } if (cause instanceof InterruptedException) { throw (InterruptedException) cause; } throw new RuntimeException(cause.getMessage(), cause); } } | /**
* Utility method that unwraps ExecutionExceptions and propagates their cause as-is when possible.
* Expects to be given a Future for a call to mergeTableChanges.
*/ | Utility method that unwraps ExecutionExceptions and propagates their cause as-is when possible. Expects to be given a Future for a call to mergeTableChanges | getMergeFuture | {
"repo_name": "data-integrations/bigquery-delta-plugins",
"path": "src/main/java/io/cdap/delta/bigquery/BigQueryEventConsumer.java",
"license": "apache-2.0",
"size": 66047
} | [
"io.cdap.delta.api.DeltaFailureException",
"java.util.concurrent.ExecutionException",
"java.util.concurrent.Future"
] | import io.cdap.delta.api.DeltaFailureException; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; | import io.cdap.delta.api.*; import java.util.concurrent.*; | [
"io.cdap.delta",
"java.util"
] | io.cdap.delta; java.util; | 2,608,263 |
public void testCloning() {
BoxAndWhiskerXYToolTipGenerator g1
= new BoxAndWhiskerXYToolTipGenerator();
BoxAndWhiskerXYToolTipGenerator g2 = null;
try {
g2 = (BoxAndWhiskerXYToolTipGenerator) g1.clone();
}
catch (CloneNotSupportedException e) {
e.printStackTrace();
}
assertTrue(g1 != g2);
assertTrue(g1.getClass() == g2.getClass());
assertTrue(g1.equals(g2));
} | void function() { BoxAndWhiskerXYToolTipGenerator g1 = new BoxAndWhiskerXYToolTipGenerator(); BoxAndWhiskerXYToolTipGenerator g2 = null; try { g2 = (BoxAndWhiskerXYToolTipGenerator) g1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(g1 != g2); assertTrue(g1.getClass() == g2.getClass()); assertTrue(g1.equals(g2)); } | /**
* Confirm that cloning works.
*/ | Confirm that cloning works | testCloning | {
"repo_name": "linuxuser586/jfreechart",
"path": "tests/org/jfree/chart/labels/junit/BoxAndWhiskerXYToolTipGeneratorTests.java",
"license": "lgpl-2.1",
"size": 6776
} | [
"org.jfree.chart.labels.BoxAndWhiskerXYToolTipGenerator"
] | import org.jfree.chart.labels.BoxAndWhiskerXYToolTipGenerator; | import org.jfree.chart.labels.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 54,988 |
private boolean createLocationForAddedPartition(
final Table tbl, final Partition part) throws MetaException {
Path partLocation = null;
String partLocationStr = null;
if (part.getSd() != null) {
partLocationStr = part.getSd().getLocation();
}
if (partLocationStr == null || partLocationStr.isEmpty()) {
// set default location if not specified and this is
// a physical table partition (not a view)
if (tbl.getSd().getLocation() != null) {
partLocation = new Path(tbl.getSd().getLocation(), Warehouse
.makePartName(tbl.getPartitionKeys(), part.getValues()));
}
} else {
if (tbl.getSd().getLocation() == null) {
throw new MetaException("Cannot specify location for a view partition");
}
partLocation = wh.getDnsPath(new Path(partLocationStr));
}
boolean result = false;
if (partLocation != null) {
part.getSd().setLocation(partLocation.toString());
// Check to see if the directory already exists before calling
// mkdirs() because if the file system is read-only, mkdirs will
// throw an exception even if the directory already exists.
if (!wh.isDir(partLocation)) {
if (!wh.mkdirs(partLocation, true)) {
throw new MetaException(partLocation
+ " is not a directory or unable to create one");
}
result = true;
}
}
return result;
} | boolean function( final Table tbl, final Partition part) throws MetaException { Path partLocation = null; String partLocationStr = null; if (part.getSd() != null) { partLocationStr = part.getSd().getLocation(); } if (partLocationStr == null partLocationStr.isEmpty()) { if (tbl.getSd().getLocation() != null) { partLocation = new Path(tbl.getSd().getLocation(), Warehouse .makePartName(tbl.getPartitionKeys(), part.getValues())); } } else { if (tbl.getSd().getLocation() == null) { throw new MetaException(STR); } partLocation = wh.getDnsPath(new Path(partLocationStr)); } boolean result = false; if (partLocation != null) { part.getSd().setLocation(partLocation.toString()); if (!wh.isDir(partLocation)) { if (!wh.mkdirs(partLocation, true)) { throw new MetaException(partLocation + STR); } result = true; } } return result; } | /**
* Handles the location for a partition being created.
* @param tbl Table.
* @param part Partition.
* @return Whether the partition SD location is set to a newly created directory.
*/ | Handles the location for a partition being created | createLocationForAddedPartition | {
"repo_name": "grundprinzip/Impala",
"path": "thirdparty/hive-0.13.1-cdh5.4.0-SNAPSHOT/src/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java",
"license": "apache-2.0",
"size": 197415
} | [
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hive.metastore.api.MetaException",
"org.apache.hadoop.hive.metastore.api.Partition",
"org.apache.hadoop.hive.metastore.api.Table"
] | import org.apache.hadoop.fs.Path; import org.apache.hadoop.hive.metastore.api.MetaException; import org.apache.hadoop.hive.metastore.api.Partition; import org.apache.hadoop.hive.metastore.api.Table; | import org.apache.hadoop.fs.*; import org.apache.hadoop.hive.metastore.api.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 54,499 |
public String getMessageById(int id, String dbName) {
System.out.println("Getting message for id= " + id);
Connection connection = connectDb(dbName);
Statement statement;
String msg = null;
try {
statement = connection.createStatement();
statement.setQueryTimeout(30); // set timeout to 30 sec
ResultSet rs = statement.executeQuery(AttributeManager.SELECT_FROM + DB_MESSAGE_TABLE
+ AttributeManager.WHERE + DB_MESSAGE_ID + AttributeManager.ATTR_VAL_SEPARATOR + id);
rs.next();
if (rs.isAfterLast())
return id + AttributeManager.NOT_FOUND;
msg = DB_MESSAGE_ID + AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_ID)
+ AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_SENDER + AttributeManager.ATTR_VAL_SEPARATOR
+ rs.getString(DB_MESSAGE_SENDER) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_STATUS
+ AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_STATUS)
+ AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_TYPE + AttributeManager.ATTR_VAL_SEPARATOR
+ rs.getString(DB_MESSAGE_TYPE) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_CREATED_ON
+ AttributeManager.DATE_SEPARATOR + rs.getString(DB_MESSAGE_CREATED_ON)
+ AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_MODIFIED_ON + AttributeManager.DATE_SEPARATOR
+ rs.getString(DB_MESSAGE_MODIFIED_ON) + AttributeManager.PAIRS_SEPARATOR
+ rs.getString(DB_MESSAGE_COLUMN);
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return msg;
} | String function(int id, String dbName) { System.out.println(STR + id); Connection connection = connectDb(dbName); Statement statement; String msg = null; try { statement = connection.createStatement(); statement.setQueryTimeout(30); ResultSet rs = statement.executeQuery(AttributeManager.SELECT_FROM + DB_MESSAGE_TABLE + AttributeManager.WHERE + DB_MESSAGE_ID + AttributeManager.ATTR_VAL_SEPARATOR + id); rs.next(); if (rs.isAfterLast()) return id + AttributeManager.NOT_FOUND; msg = DB_MESSAGE_ID + AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_ID) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_SENDER + AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_SENDER) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_STATUS + AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_STATUS) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_TYPE + AttributeManager.ATTR_VAL_SEPARATOR + rs.getString(DB_MESSAGE_TYPE) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_CREATED_ON + AttributeManager.DATE_SEPARATOR + rs.getString(DB_MESSAGE_CREATED_ON) + AttributeManager.PAIRS_SEPARATOR + DB_MESSAGE_MODIFIED_ON + AttributeManager.DATE_SEPARATOR + rs.getString(DB_MESSAGE_MODIFIED_ON) + AttributeManager.PAIRS_SEPARATOR + rs.getString(DB_MESSAGE_COLUMN); } catch (SQLException e) { e.printStackTrace(); } return msg; } | /**
* Reads an SMS message from the Db for the given id.
*
* @param id
* , is the row-id of the message
* @param dbName
* is the full path name to the .db file.
* @return a String representing the message or "id NOT FOUND"
*/ | Reads an SMS message from the Db for the given id | getMessageById | {
"repo_name": "trishan/posit-mobile.haiti-server",
"path": "src/haiti/server/datamodel/DAO.java",
"license": "gpl-3.0",
"size": 28234
} | [
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 712,405 |
public static Criterion overlaps(String begin, String end, Time value) throws UnsupportedTimeException {
return filter(new OverlapsRestriction(), begin, end, value);
} | static Criterion function(String begin, String end, Time value) throws UnsupportedTimeException { return filter(new OverlapsRestriction(), begin, end, value); } | /**
* Creates a temporal restriction for the specified time and property.
*
* @param begin
* the begin property name
* @param end
* the end property name
* @param value
* the value
*
* @return the <tt>Criterion</tt>
*
* @see OverlapsRestriction
* @throws UnsupportedTimeException
* if the value and property combination is not applicable for
* this restriction
*/ | Creates a temporal restriction for the specified time and property | overlaps | {
"repo_name": "impulze/SOS",
"path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/util/TemporalRestrictions.java",
"license": "gpl-2.0",
"size": 39623
} | [
"org.hibernate.criterion.Criterion",
"org.n52.sos.ds.hibernate.util.TemporalRestriction",
"org.n52.sos.exception.ows.concrete.UnsupportedTimeException",
"org.n52.sos.ogc.gml.time.Time"
] | import org.hibernate.criterion.Criterion; import org.n52.sos.ds.hibernate.util.TemporalRestriction; import org.n52.sos.exception.ows.concrete.UnsupportedTimeException; import org.n52.sos.ogc.gml.time.Time; | import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.util.*; import org.n52.sos.exception.ows.concrete.*; import org.n52.sos.ogc.gml.time.*; | [
"org.hibernate.criterion",
"org.n52.sos"
] | org.hibernate.criterion; org.n52.sos; | 2,497,855 |
public void run(ImportTask task) {
try {
if (task.readers.isEmpty()) {
task.configure();
}
for (CSVInput input : config.getInputs()) {
for (Reader reader : task.readers.get(input.getFileName())) {
try {
this.process(input, reader);
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error("I/O error while accessing {}.", input.getFileName());
}
if (!task.handle(e)) {
break;
}
} catch (ClassNotFoundException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Error while importing {}.", input.getFileName());
LOG.error("No such class found {}.", input.getTypeName());
}
if (!task.handle(e)) {
break;
}
} catch (Exception e) {
if (!task.handle(new ImportException(e))) {
break;
}
}
}
}
} catch (IOException e) {
throw new IllegalArgumentException(e);
} finally {
task.readers.clear();
}
} | void function(ImportTask task) { try { if (task.readers.isEmpty()) { task.configure(); } for (CSVInput input : config.getInputs()) { for (Reader reader : task.readers.get(input.getFileName())) { try { this.process(input, reader); } catch (IOException e) { if (LOG.isErrorEnabled()) { LOG.error(STR, input.getFileName()); } if (!task.handle(e)) { break; } } catch (ClassNotFoundException e) { if (LOG.isErrorEnabled()) { LOG.error(STR, input.getFileName()); LOG.error(STR, input.getTypeName()); } if (!task.handle(e)) { break; } } catch (Exception e) { if (!task.handle(new ImportException(e))) { break; } } } } } catch (IOException e) { throw new IllegalArgumentException(e); } finally { task.readers.clear(); } } | /**
* Run the task from the configured readers
*
* @param task the task to run
*/ | Run the task from the configured readers | run | {
"repo_name": "axelor/axelor-development-kit",
"path": "axelor-core/src/main/java/com/axelor/data/csv/CSVImporter.java",
"license": "agpl-3.0",
"size": 12626
} | [
"com.axelor.data.ImportException",
"com.axelor.data.ImportTask",
"java.io.IOException",
"java.io.Reader"
] | import com.axelor.data.ImportException; import com.axelor.data.ImportTask; import java.io.IOException; import java.io.Reader; | import com.axelor.data.*; import java.io.*; | [
"com.axelor.data",
"java.io"
] | com.axelor.data; java.io; | 362,050 |
public void testGetElements008() {
cm = new ContentModel(null);
Vector v = new Vector();
cm.getElements(v);
assertEquals(1, v.size());
assertEquals("[null]", v.toString());
}
| void function() { cm = new ContentModel(null); Vector v = new Vector(); cm.getElements(v); assertEquals(1, v.size()); assertEquals(STR, v.toString()); } | /**
* Test method for
* 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)'
* ContentModel(null).getElements(new Vector()) Expected: "[null]"
*/ | Test method for 'org.apache.harmony.swing.tests.javax.swing.text.parser.ContentModel.getElements(Vector)' ContentModel(null).getElements(new Vector()) Expected: "[null]" | testGetElements008 | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/swing/src/test/api/java.injected/org/apache/harmony/swing/tests/javax/swing/text/parser/ContentModelCompatilityTest.java",
"license": "gpl-2.0",
"size": 153261
} | [
"java.util.Vector",
"javax.swing.text.html.parser.ContentModel"
] | import java.util.Vector; import javax.swing.text.html.parser.ContentModel; | import java.util.*; import javax.swing.text.html.parser.*; | [
"java.util",
"javax.swing"
] | java.util; javax.swing; | 2,387,154 |
public DataBeadReceiver sendData(DataBead db) {
setParams(db);
return this;
} | DataBeadReceiver function(DataBead db) { setParams(db); return this; } | /**
* Sets the pan position with a DataBead.
* @see #setParams(DataBead)
*/ | Sets the pan position with a DataBead | sendData | {
"repo_name": "occloxium/Monoid",
"path": "beads/src/beads_main/net/beadsproject/beads/ugens/Panner.java",
"license": "mit",
"size": 5762
} | [
"net.beadsproject.beads.data.DataBead",
"net.beadsproject.beads.data.DataBeadReceiver"
] | import net.beadsproject.beads.data.DataBead; import net.beadsproject.beads.data.DataBeadReceiver; | import net.beadsproject.beads.data.*; | [
"net.beadsproject.beads"
] | net.beadsproject.beads; | 2,719,510 |
final Repo repo = new MkGithub().randomRepo();
final String name = "bug";
repo.labels().create(name, "c0c0c0");
final Issue issue = repo.issues().create("title", "body");
issue.labels().add(Collections.singletonList(name));
MatcherAssert.assertThat(
issue.labels().iterate(),
Matchers.<Label>iterableWithSize(1)
);
} | final Repo repo = new MkGithub().randomRepo(); final String name = "bug"; repo.labels().create(name, STR); final Issue issue = repo.issues().create("title", "body"); issue.labels().add(Collections.singletonList(name)); MatcherAssert.assertThat( issue.labels().iterate(), Matchers.<Label>iterableWithSize(1) ); } | /**
* MkIssueLabels can list labels.
* @throws Exception If some problem inside
*/ | MkIssueLabels can list labels | iteratesIssues | {
"repo_name": "prondzyn/jcabi-github",
"path": "src/test/java/com/jcabi/github/mock/MkIssueLabelsTest.java",
"license": "bsd-3-clause",
"size": 5757
} | [
"com.jcabi.github.Issue",
"com.jcabi.github.Label",
"com.jcabi.github.Repo",
"java.util.Collections",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import com.jcabi.github.Issue; import com.jcabi.github.Label; import com.jcabi.github.Repo; import java.util.Collections; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import com.jcabi.github.*; import java.util.*; import org.hamcrest.*; | [
"com.jcabi.github",
"java.util",
"org.hamcrest"
] | com.jcabi.github; java.util; org.hamcrest; | 760,683 |
public static Log replay(Log source, Log destination) {
if (source instanceof DeferredLog) {
((DeferredLog) source).replayTo(destination);
}
return destination;
} | static Log function(Log source, Log destination) { if (source instanceof DeferredLog) { ((DeferredLog) source).replayTo(destination); } return destination; } | /**
* Replay from a source log to a destination log when the source is deferred.
* @param source the source logger
* @param destination the destination logger
* @return the destination
*/ | Replay from a source log to a destination log when the source is deferred | replay | {
"repo_name": "lburgazzoli/spring-boot",
"path": "spring-boot-project/spring-boot/src/main/java/org/springframework/boot/logging/DeferredLog.java",
"license": "apache-2.0",
"size": 6288
} | [
"org.apache.commons.logging.Log"
] | import org.apache.commons.logging.Log; | import org.apache.commons.logging.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,601,664 |
@IgniteSpiConfiguration(optional = true)
@Deprecated
public TcpDiscoverySpi setForceServerMode(boolean forceSrvMode) {
this.forceSrvMode = forceSrvMode;
return this;
} | @IgniteSpiConfiguration(optional = true) TcpDiscoverySpi function(boolean forceSrvMode) { this.forceSrvMode = forceSrvMode; return this; } | /**
* Sets force server mode flag.
* <p>
* If {@code true} TcpDiscoverySpi is started in server mode regardless
* of {@link IgniteConfiguration#isClientMode()}.
*
* @param forceSrvMode forceServerMode flag.
* @return {@code this} for chaining.
* @deprecated Will be removed at 3.0.
*/ | Sets force server mode flag. If true TcpDiscoverySpi is started in server mode regardless of <code>IgniteConfiguration#isClientMode()</code> | setForceServerMode | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySpi.java",
"license": "apache-2.0",
"size": 94998
} | [
"org.apache.ignite.spi.IgniteSpiConfiguration"
] | import org.apache.ignite.spi.IgniteSpiConfiguration; | import org.apache.ignite.spi.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 558,308 |
public void setBusinessObjectService(BusinessObjectService businessObjectService) {
this.businessObjectService = businessObjectService;
} | void function(BusinessObjectService businessObjectService) { this.businessObjectService = businessObjectService; } | /**
*
* Convenience method to set the business object service.
* @param businessObjectService The reference to the business object service
*/ | Convenience method to set the business object service | setBusinessObjectService | {
"repo_name": "sanjupolus/kc-coeus-1508.3",
"path": "coeus-impl/src/main/java/org/kuali/coeus/common/notification/impl/service/impl/KcNotificationModuleRoleServiceImpl.java",
"license": "agpl-3.0",
"size": 3377
} | [
"org.kuali.rice.krad.service.BusinessObjectService"
] | import org.kuali.rice.krad.service.BusinessObjectService; | import org.kuali.rice.krad.service.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 2,367,916 |
public void store() throws IOException {
if (file != null) {
store(file);
} else {
throw new IOException("no configuration file known, use store(File file)");
}
} | void function() throws IOException { if (file != null) { store(file); } else { throw new IOException(STR); } } | /**
* Store configuration in the file it was loaded from.
* @throws IOException
*/ | Store configuration in the file it was loaded from | store | {
"repo_name": "mikegr/snipsnap",
"path": "src/org/snipsnap/config/ServerConfiguration.java",
"license": "gpl-2.0",
"size": 5627
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 172,714 |
public static HttpResponse readFrom(InputStream in) {
InputStreamReader inputStreamReader;
try {
inputStreamReader = new InputStreamReader(in, StringPool.ISO_8859_1);
} catch (UnsupportedEncodingException ignore) {
return null;
}
BufferedReader reader = new BufferedReader(inputStreamReader);
HttpResponse httpResponse = new HttpResponse();
// the first line
String line;
try {
line = reader.readLine();
} catch (IOException ioex) {
throw new HttpException(ioex);
}
if (line != null) {
line = line.trim();
int ndx = line.indexOf(' ');
int ndx2;
if (ndx > -1) {
httpResponse.httpVersion(line.substring(0, ndx));
ndx2 = line.indexOf(' ', ndx + 1);
}
else {
httpResponse.httpVersion(HTTP_1_1);
ndx2 = -1;
ndx = 0;
}
if (ndx2 == -1) {
ndx2 = line.length();
}
try {
httpResponse.statusCode(Integer.parseInt(line.substring(ndx, ndx2).trim()));
}
catch (NumberFormatException nfex) {
httpResponse.statusCode(-1);
}
httpResponse.statusPhrase(line.substring(ndx2).trim());
}
httpResponse.readHeaders(reader);
httpResponse.readBody(reader);
return httpResponse;
}
// ---------------------------------------------------------------- request
protected HttpRequest httpRequest; | static HttpResponse function(InputStream in) { InputStreamReader inputStreamReader; try { inputStreamReader = new InputStreamReader(in, StringPool.ISO_8859_1); } catch (UnsupportedEncodingException ignore) { return null; } BufferedReader reader = new BufferedReader(inputStreamReader); HttpResponse httpResponse = new HttpResponse(); String line; try { line = reader.readLine(); } catch (IOException ioex) { throw new HttpException(ioex); } if (line != null) { line = line.trim(); int ndx = line.indexOf(' '); int ndx2; if (ndx > -1) { httpResponse.httpVersion(line.substring(0, ndx)); ndx2 = line.indexOf(' ', ndx + 1); } else { httpResponse.httpVersion(HTTP_1_1); ndx2 = -1; ndx = 0; } if (ndx2 == -1) { ndx2 = line.length(); } try { httpResponse.statusCode(Integer.parseInt(line.substring(ndx, ndx2).trim())); } catch (NumberFormatException nfex) { httpResponse.statusCode(-1); } httpResponse.statusPhrase(line.substring(ndx2).trim()); } httpResponse.readHeaders(reader); httpResponse.readBody(reader); return httpResponse; } protected HttpRequest httpRequest; | /**
* Reads response input stream and returns {@link HttpResponse response}.
* Supports both streamed and chunked response.
*/ | Reads response input stream and returns <code>HttpResponse response</code>. Supports both streamed and chunked response | readFrom | {
"repo_name": "wjw465150/jodd",
"path": "jodd-http/src/main/java/jodd/http/HttpResponse.java",
"license": "bsd-2-clause",
"size": 6605
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.io.UnsupportedEncodingException"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 14,946 |
public String getMergedCountsString(final boolean details) {
final StringBuilder builder = new StringBuilder(1024);
final Map<String, Integer> syCounts = getSynchronizedCounts();
final Map<String, Integer> ptCounts = getPrimaryThreadCounts();
builder.append('|');
for (final Entry<String, Integer> entry : ptCounts.entrySet()) {
final String key = entry.getKey();
builder.append(' ');
builder.append(key);
builder.append(' ');
final int pt = entry.getValue();
final int sy = syCounts.get(key);
final int sum = pt + sy;
builder.append(Integer.toString(sum));
if (details && sum > 0) {
builder.append(" (");
builder.append(Integer.toString(pt));
builder.append('/');
builder.append(Integer.toString(sy));
builder.append(')');
}
builder.append(" |");
}
return builder.toString();
} | String function(final boolean details) { final StringBuilder builder = new StringBuilder(1024); final Map<String, Integer> syCounts = getSynchronizedCounts(); final Map<String, Integer> ptCounts = getPrimaryThreadCounts(); builder.append(' '); for (final Entry<String, Integer> entry : ptCounts.entrySet()) { final String key = entry.getKey(); builder.append(' '); builder.append(key); builder.append(' '); final int pt = entry.getValue(); final int sy = syCounts.get(key); final int sum = pt + sy; builder.append(Integer.toString(sum)); if (details && sum > 0) { builder.append(STR); builder.append(Integer.toString(pt)); builder.append('/'); builder.append(Integer.toString(sy)); builder.append(')'); } builder.append(" "); } return builder.toString(); } | /**
* Return a String (one line), which summarizes the contents: key
* merged-count (pt count / sy count).<br>
* Does not acquire any locks.
*
* @param details
* If to show difference of primary thread vs. other threads.
* @return
*/ | Return a String (one line), which summarizes the contents: key merged-count (pt count / sy count). Does not acquire any locks | getMergedCountsString | {
"repo_name": "NoCheatPlus/NoCheatPlus",
"path": "NCPCore/src/main/java/fr/neatmonster/nocheatplus/stats/Counters.java",
"license": "gpl-3.0",
"size": 9064
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 121,276 |
Account followed = accountRepository.findOne(target);
Account follower = accountService.getAuthenticatedAccount();
Relationship relationship = relationshipRepository.findTopByFollowerAndFollowed(follower, followed);
if (relationship == null) {
relationship = new Relationship();
relationship.setFollower(follower);
relationship.setFollowed(followed);
relationshipRepository.save(relationship);
follower.getFollowings().add(relationship);
accountRepository.save(follower);
} else {
follower.getFollowings().remove(relationship);
relationshipRepository.delete(relationship);
}
} | Account followed = accountRepository.findOne(target); Account follower = accountService.getAuthenticatedAccount(); Relationship relationship = relationshipRepository.findTopByFollowerAndFollowed(follower, followed); if (relationship == null) { relationship = new Relationship(); relationship.setFollower(follower); relationship.setFollowed(followed); relationshipRepository.save(relationship); follower.getFollowings().add(relationship); accountRepository.save(follower); } else { follower.getFollowings().remove(relationship); relationshipRepository.delete(relationship); } } | /**
* Toggles relationship (if user is following the target, then unfollows or opposite)
*
* @param target id of the target account
*/ | Toggles relationship (if user is following the target, then unfollows or opposite) | toggleRelationship | {
"repo_name": "leevilehtonen/cook-a-gram",
"path": "src/main/java/com/leevilehtonen/cookagram/service/RelationshipService.java",
"license": "mit",
"size": 1732
} | [
"com.leevilehtonen.cookagram.domain.Account",
"com.leevilehtonen.cookagram.domain.Relationship"
] | import com.leevilehtonen.cookagram.domain.Account; import com.leevilehtonen.cookagram.domain.Relationship; | import com.leevilehtonen.cookagram.domain.*; | [
"com.leevilehtonen.cookagram"
] | com.leevilehtonen.cookagram; | 724,130 |
public static int pickOne(Random r, int[] counts) {
int index = r.nextInt(sum(counts));
for (int i = 0; i < counts.length; i++) {
if (counts[i] > index) return i;
index -= counts[i];
}
return -1;
} | static int function(Random r, int[] counts) { int index = r.nextInt(sum(counts)); for (int i = 0; i < counts.length; i++) { if (counts[i] > index) return i; index -= counts[i]; } return -1; } | /**
* Given `counts` full of nonnegative index counts, returns a random index.
* (Like drawing from a bag, with replacement.)
* I might want to do something aside from Random....
* @param r
* @param array
* @return
*/ | Given `counts` full of nonnegative index counts, returns a random index. (Like drawing from a bag, with replacement.) I might want to do something aside from Random... | pickOne | {
"repo_name": "Erhannis/MathNStuff",
"path": "src/main/java/com/erhannis/mathnstuff/MeMath.java",
"license": "apache-2.0",
"size": 40517
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,668,690 |
public List<Criteria> getOredCriteria() {
return oredCriteria;
} | List<Criteria> function() { return oredCriteria; } | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table EPSS.ES_INIT_POWER_HIS
*
* @mbggenerated Fri Apr 25 17:26:31 CST 2014
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table EPSS.ES_INIT_POWER_HIS | getOredCriteria | {
"repo_name": "zhanrui/ky-epss",
"path": "src/main/java/epss/repository/model/EsInitPowerHisExample.java",
"license": "gpl-2.0",
"size": 33323
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,622,797 |
Assert.notNull(m_configDao);
Assert.notNull(m_serviceRegistry);
// Registering itself as a northbounder
m_registrations.put(getName(), m_serviceRegistry.register(this, Northbounder.class));
// Registering each destination as a northbounder
registerNorthbounders();
} | Assert.notNull(m_configDao); Assert.notNull(m_serviceRegistry); m_registrations.put(getName(), m_serviceRegistry.register(this, Northbounder.class)); registerNorthbounders(); } | /**
* After properties set.
*
* @throws Exception the exception
*/ | After properties set | afterPropertiesSet | {
"repo_name": "jeffgdotorg/opennms",
"path": "opennms-alarms/syslog-northbounder/src/main/java/org/opennms/netmgt/alarmd/northbounder/syslog/SyslogNorthbounderManager.java",
"license": "gpl-2.0",
"size": 6134
} | [
"org.opennms.netmgt.alarmd.api.Northbounder",
"org.springframework.util.Assert"
] | import org.opennms.netmgt.alarmd.api.Northbounder; import org.springframework.util.Assert; | import org.opennms.netmgt.alarmd.api.*; import org.springframework.util.*; | [
"org.opennms.netmgt",
"org.springframework.util"
] | org.opennms.netmgt; org.springframework.util; | 586,502 |
@Override
public MetalyzerTime getMetalyzerTime() {
time = new MetalyzerTimeImpl(this);
return time;
} | MetalyzerTime function() { time = new MetalyzerTimeImpl(this); return time; } | /**
* Returns a new MetalyzerTime object to set the time for this filter.
*/ | Returns a new MetalyzerTime object to set the time for this filter | getMetalyzerTime | {
"repo_name": "trustathsh/metalyzer",
"path": "dataservice-module/src/main/java/de/hshannover/f4/trust/metalyzer/api/impl/MetalyzerFilterImpl.java",
"license": "apache-2.0",
"size": 6731
} | [
"de.hshannover.f4.trust.metalyzer.api.MetalyzerTime"
] | import de.hshannover.f4.trust.metalyzer.api.MetalyzerTime; | import de.hshannover.f4.trust.metalyzer.api.*; | [
"de.hshannover.f4"
] | de.hshannover.f4; | 1,379,678 |
void registerInterceptor(IClientInterceptor theInterceptor);
| void registerInterceptor(IClientInterceptor theInterceptor); | /**
* Register a new interceptor for this client. An interceptor can be used to add additional
* logging, or add security headers, or pre-process responses, etc.
*/ | Register a new interceptor for this client. An interceptor can be used to add additional logging, or add security headers, or pre-process responses, etc | registerInterceptor | {
"repo_name": "cementsuf/hapi-fhir",
"path": "hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/client/api/IRestfulClient.java",
"license": "apache-2.0",
"size": 2778
} | [
"ca.uhn.fhir.rest.client.IClientInterceptor"
] | import ca.uhn.fhir.rest.client.IClientInterceptor; | import ca.uhn.fhir.rest.client.*; | [
"ca.uhn.fhir"
] | ca.uhn.fhir; | 2,362,702 |
protected static File getObjectFile( File sourceFile, File outputDirectory, String objectFileExtension )
throws NativeBuildException
{
String objectFileName;
try
{
objectFileExtension = AbstractCompiler.getObjectFileExtension( objectFileExtension );
//plexus-util requires that we remove all ".." in the the file source, so getCanonicalPath is required
// other filename with .. and no extension will throw StringIndexOutOfBoundsException
objectFileName = FileUtils.basename( sourceFile.getCanonicalPath() );
if ( objectFileName.charAt( objectFileName.length() - 1 ) != '.' )
{
objectFileName += "." + objectFileExtension;
}
else
{
objectFileName += objectFileExtension;
}
}
catch ( IOException e )
{
throw new NativeBuildException( e.getMessage() );
}
File objectFile = new File( outputDirectory, objectFileName );
return objectFile;
}
private class CompilerThreadPoolExecutor
extends ThreadPoolExecutor
{
private boolean errorFound = false; | static File function( File sourceFile, File outputDirectory, String objectFileExtension ) throws NativeBuildException { String objectFileName; try { objectFileExtension = AbstractCompiler.getObjectFileExtension( objectFileExtension ); objectFileName = FileUtils.basename( sourceFile.getCanonicalPath() ); if ( objectFileName.charAt( objectFileName.length() - 1 ) != '.' ) { objectFileName += "." + objectFileExtension; } else { objectFileName += objectFileExtension; } } catch ( IOException e ) { throw new NativeBuildException( e.getMessage() ); } File objectFile = new File( outputDirectory, objectFileName ); return objectFile; } private class CompilerThreadPoolExecutor extends ThreadPoolExecutor { private boolean errorFound = false; | /**
* Figure out the object file relative path from a given source file
* @param sourceFile
* @param workingDirectory
* @param outputDirectory
* @param config
* @return
*/ | Figure out the object file relative path from a given source file | getObjectFile | {
"repo_name": "dukeboard/maven-native-plugin",
"path": "maven-native-api/src/main/java/org/codehaus/mojo/natives/compiler/AbstractCompiler.java",
"license": "mit",
"size": 8305
} | [
"edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor",
"java.io.File",
"java.io.IOException",
"org.codehaus.mojo.natives.NativeBuildException",
"org.codehaus.plexus.util.FileUtils"
] | import edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor; import java.io.File; import java.io.IOException; import org.codehaus.mojo.natives.NativeBuildException; import org.codehaus.plexus.util.FileUtils; | import edu.emory.mathcs.backport.java.util.concurrent.*; import java.io.*; import org.codehaus.mojo.natives.*; import org.codehaus.plexus.util.*; | [
"edu.emory.mathcs",
"java.io",
"org.codehaus.mojo",
"org.codehaus.plexus"
] | edu.emory.mathcs; java.io; org.codehaus.mojo; org.codehaus.plexus; | 774,867 |
@NonNull
protected KeyStoreCryptoOperationStreamer createMainDataStreamer(
KeyStore keyStore, IBinder operationToken) {
return new KeyStoreCryptoOperationChunkedStreamer(
new KeyStoreCryptoOperationChunkedStreamer.MainDataStream(
keyStore, operationToken));
} | KeyStoreCryptoOperationStreamer function( KeyStore keyStore, IBinder operationToken) { return new KeyStoreCryptoOperationChunkedStreamer( new KeyStoreCryptoOperationChunkedStreamer.MainDataStream( keyStore, operationToken)); } | /**
* Creates a streamer which sends plaintext/ciphertext into the provided KeyStore and receives
* the corresponding ciphertext/plaintext from the KeyStore.
*
* <p>This implementation returns a working streamer.
*/ | Creates a streamer which sends plaintext/ciphertext into the provided KeyStore and receives the corresponding ciphertext/plaintext from the KeyStore. This implementation returns a working streamer | createMainDataStreamer | {
"repo_name": "xorware/android_frameworks_base",
"path": "keystore/java/android/security/keystore/AndroidKeyStoreCipherSpiBase.java",
"license": "apache-2.0",
"size": 35193
} | [
"android.os.IBinder",
"android.security.KeyStore"
] | import android.os.IBinder; import android.security.KeyStore; | import android.os.*; import android.security.*; | [
"android.os",
"android.security"
] | android.os; android.security; | 2,755,953 |
public void encode(OutputStream output, String charsetName,
Indenter indenter)
throws UnsupportedEncodingException; | void function(OutputStream output, String charsetName, Indenter indenter) throws UnsupportedEncodingException; | /**
* Encodes this element into its XML representation and writes
* this encoding to the given <code>OutputStream</code> with
* indentation.
*
* @param output a stream into which the XML-encoded data is written
* @param charsetName the character set to use in encoding of strings.
* This may be null in which case the platform default character set
* will be used.
* @param indenter an object that creates indentation strings
*/ | Encodes this element into its XML representation and writes this encoding to the given <code>OutputStream</code> with indentation | encode | {
"repo_name": "GenericBreakGlass/GenericBreakGlass-XACML",
"path": "src/com.sun.xacml/src/main/java/com/sun/xacml/PolicyTreeElement.java",
"license": "apache-2.0",
"size": 5563
} | [
"java.io.OutputStream",
"java.io.UnsupportedEncodingException"
] | import java.io.OutputStream; import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 307,955 |
@Test
public void testExcludesAllPositive02() throws Exception {
TestPerformer testPerformer;
String modelFileName;
String oclFileName;
oclFileName = "standardlibrary/collection/excludesAllPositive02.ocl";
modelFileName = "testmodel.uml";
testPerformer =
TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID,
AllStandardLibraryTests.MODEL_BUNDLE,
AllStandardLibraryTests.MODEL_DIRECTORY);
testPerformer.setModel(modelFileName);
testPerformer.parseFile(oclFileName);
} | void function() throws Exception { TestPerformer testPerformer; String modelFileName; String oclFileName; oclFileName = STR; modelFileName = STR; testPerformer = TestPerformer.getInstance(AllStandardLibraryTests.META_MODEL_ID, AllStandardLibraryTests.MODEL_BUNDLE, AllStandardLibraryTests.MODEL_DIRECTORY); testPerformer.setModel(modelFileName); testPerformer.parseFile(oclFileName); } | /**
* <p>
* A test case testing the method
* <code>Collection->excludesAll(Collection(T))</code>.
* </p>
*/ | A test case testing the method <code>Collection->excludesAll(Collection(T))</code>. | testExcludesAllPositive02 | {
"repo_name": "dresden-ocl/dresdenocl",
"path": "tests/org.dresdenocl.ocl2parser.test/src/org/dresdenocl/ocl2parser/test/standardlibrary/TestCollection.java",
"license": "lgpl-3.0",
"size": 77031
} | [
"org.dresdenocl.ocl2parser.test.TestPerformer"
] | import org.dresdenocl.ocl2parser.test.TestPerformer; | import org.dresdenocl.ocl2parser.test.*; | [
"org.dresdenocl.ocl2parser"
] | org.dresdenocl.ocl2parser; | 2,058,306 |
public void writeUTF8(ByteBuffer bb, String value)
{
bb.clear();
for (int i = 0; i < value.length(); i++) {
int ch = value.charAt(i);
if (ch > 0 && ch < 0x80)
bb.append(ch);
else if (ch < 0x800) {
bb.append(0xc0 + (ch >> 6));
bb.append(0x80 + (ch & 0x3f));
}
else {
bb.append(0xe0 + (ch >> 12));
bb.append(0x80 + ((ch >> 6) & 0x3f));
bb.append(0x80 + ((ch) & 0x3f));
}
}
} | void function(ByteBuffer bb, String value) { bb.clear(); for (int i = 0; i < value.length(); i++) { int ch = value.charAt(i); if (ch > 0 && ch < 0x80) bb.append(ch); else if (ch < 0x800) { bb.append(0xc0 + (ch >> 6)); bb.append(0x80 + (ch & 0x3f)); } else { bb.append(0xe0 + (ch >> 12)); bb.append(0x80 + ((ch >> 6) & 0x3f)); bb.append(0x80 + ((ch) & 0x3f)); } } } | /**
* Writes UTF-8
*/ | Writes UTF-8 | writeUTF8 | {
"repo_name": "dwango/quercus",
"path": "src/main/java/com/caucho/bytecode/ByteCodeWriter.java",
"license": "gpl-2.0",
"size": 4886
} | [
"com.caucho.util.ByteBuffer"
] | import com.caucho.util.ByteBuffer; | import com.caucho.util.*; | [
"com.caucho.util"
] | com.caucho.util; | 899,752 |
@Test
public void testGetEncodedUrlByArrayMapNullUri(){
Map<String, String[]> keyAndArrayMap = newLinkedHashMap();
keyAndArrayMap.put("province", new String[] { "江苏省" });
keyAndArrayMap.put("city", new String[] { "南通市" });
assertEquals(EMPTY, addParameterArrayValueMap(null, keyAndArrayMap, UTF8));
} | void function(){ Map<String, String[]> keyAndArrayMap = newLinkedHashMap(); keyAndArrayMap.put(STR, new String[] { "江苏省" }); keyAndArrayMap.put("city", new String[] { "南通市" }); assertEquals(EMPTY, addParameterArrayValueMap(null, keyAndArrayMap, UTF8)); } | /**
* Test get encoded url by array map null uri.
*/ | Test get encoded url by array map null uri | testGetEncodedUrlByArrayMapNullUri | {
"repo_name": "venusdrogon/feilong-core",
"path": "src/test/java/com/feilong/core/net/paramutiltest/AddParameterArrayValueMapTest.java",
"license": "apache-2.0",
"size": 5699
} | [
"com.feilong.core.net.ParamUtil",
"com.feilong.core.util.MapUtil",
"java.util.Map",
"org.junit.Assert"
] | import com.feilong.core.net.ParamUtil; import com.feilong.core.util.MapUtil; import java.util.Map; import org.junit.Assert; | import com.feilong.core.net.*; import com.feilong.core.util.*; import java.util.*; import org.junit.*; | [
"com.feilong.core",
"java.util",
"org.junit"
] | com.feilong.core; java.util; org.junit; | 868,876 |
public boolean handleFault(SOAPMessageContext context) {
log.warn("SoapHeaderHandler.handleFault");
return true;
} | boolean function(SOAPMessageContext context) { log.warn(STR); return true; } | /**
* Method handles a fault if one occurs
* @param context
* @return
*/ | Method handles a fault if one occurs | handleFault | {
"repo_name": "alameluchidambaram/CONNECT",
"path": "Product/Production/Common/CONNECTCoreLib/src/main/java/gov/hhs/fha/nhinc/callback/SOAPHeaderHandler.java",
"license": "bsd-3-clause",
"size": 6913
} | [
"javax.xml.ws.handler.soap.SOAPMessageContext"
] | import javax.xml.ws.handler.soap.SOAPMessageContext; | import javax.xml.ws.handler.soap.*; | [
"javax.xml"
] | javax.xml; | 2,583,257 |
Map<String, List<NodeId>> getCandidates(); | Map<String, List<NodeId>> getCandidates(); | /**
* Returns the candidates for all known topics.
*
* @return A mapping from topics to corresponding list of candidates.
*/ | Returns the candidates for all known topics | getCandidates | {
"repo_name": "packet-tracker/onos",
"path": "core/api/src/main/java/org/onosproject/cluster/LeadershipService.java",
"license": "apache-2.0",
"size": 4036
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,452,405 |
private void addToOrders (final Order newOrder, Map<Double, Order> orders) {
if (orders.containsKey(newOrder.getPrice())) {
int newVolume = orders.get(newOrder.getPrice()).getVolume() + newOrder.getVolume();
orders.remove(newOrder.getPrice());
orders.put(newOrder.getPrice(), new Order(newOrder.getBookName(), newOrder.getOperation(), newOrder.getPrice(),
newVolume, newOrder.getOrderId()));
} else {
orders.put(newOrder.getPrice(), newOrder);
}
} | void function (final Order newOrder, Map<Double, Order> orders) { if (orders.containsKey(newOrder.getPrice())) { int newVolume = orders.get(newOrder.getPrice()).getVolume() + newOrder.getVolume(); orders.remove(newOrder.getPrice()); orders.put(newOrder.getPrice(), new Order(newOrder.getBookName(), newOrder.getOperation(), newOrder.getPrice(), newVolume, newOrder.getOrderId())); } else { orders.put(newOrder.getPrice(), newOrder); } } | /**
* Adds specified new order to specified orders map.
* @param newOrder specified new order.
* @param orders specified orders map.
*/ | Adds specified new order to specified orders map | addToOrders | {
"repo_name": "dionisius1976/java-a-to-z",
"path": "chapter_005/7_Additional_XML_Parsing/src/main/java/ru/dionisius/Book.java",
"license": "apache-2.0",
"size": 5059
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,072,020 |
public synchronized static SimpleNodeList getElements(String expression, Node node) throws XPathExpressionException {
SimpleNodeList nodes = new SimpleNodeList((NodeList)xpath.evaluate(expression, node, XPathConstants.NODESET));
return nodes;
} | synchronized static SimpleNodeList function(String expression, Node node) throws XPathExpressionException { SimpleNodeList nodes = new SimpleNodeList((NodeList)xpath.evaluate(expression, node, XPathConstants.NODESET)); return nodes; } | /**
* Returns a {@link SimpleNodeList} containing all the nodes that match the given expression
* when executed on the given node (as opposed to the dom as a whole).
*
* @param expression an XPath expression
* @param node the contextual node
* @return SimpleNodeList containing the results from the expression. This will
* never be null, but may contain no results.
* @throws IllegalArgumentException if the expression does not parse
*/ | Returns a <code>SimpleNodeList</code> containing all the nodes that match the given expression when executed on the given node (as opposed to the dom as a whole) | getElements | {
"repo_name": "sabren/java-XmlHttpRequest",
"path": "src/org/jdesktop/xpath/XPathUtils.java",
"license": "lgpl-2.1",
"size": 7947
} | [
"javax.xml.xpath.XPathConstants",
"javax.xml.xpath.XPathExpressionException",
"org.jdesktop.dom.SimpleNodeList",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import org.jdesktop.dom.SimpleNodeList; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import javax.xml.xpath.*; import org.jdesktop.dom.*; import org.w3c.dom.*; | [
"javax.xml",
"org.jdesktop.dom",
"org.w3c.dom"
] | javax.xml; org.jdesktop.dom; org.w3c.dom; | 908,169 |
public DcmElement putDA(int tag, String[] values) {
return put(
values != null
? StringElement.createDA(tag, values)
: StringElement.createDA(tag));
} | DcmElement function(int tag, String[] values) { return put( values != null ? StringElement.createDA(tag, values) : StringElement.createDA(tag)); } | /**
* Description of the Method
*
* @param tag Description of the Parameter
* @param values Description of the Parameter
* @return Description of the Return Value
*/ | Description of the Method | putDA | {
"repo_name": "medicayun/medicayundicom",
"path": "dcm4che14/tags/DCM4CHE_1_4_14/src/java/org/dcm4cheri/data/DcmObjectImpl.java",
"license": "apache-2.0",
"size": 84001
} | [
"org.dcm4che.data.DcmElement"
] | import org.dcm4che.data.DcmElement; | import org.dcm4che.data.*; | [
"org.dcm4che.data"
] | org.dcm4che.data; | 1,078,879 |
public ContainerSettings containerSettings() {
return this.containerSettings;
} | ContainerSettings function() { return this.containerSettings; } | /**
* Get if the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM.
*
* @return the containerSettings value
*/ | Get if the container was downloaded as part of cluster setup then the same container image will be used. If not provided, the job will run on the VM | containerSettings | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/batchai/mgmt-v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/implementation/JobInner.java",
"license": "mit",
"size": 26475
} | [
"com.microsoft.azure.management.batchai.v2018_03_01.ContainerSettings"
] | import com.microsoft.azure.management.batchai.v2018_03_01.ContainerSettings; | import com.microsoft.azure.management.batchai.v2018_03_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,377,076 |
List<ConversationLink> getOutgoingConversationLinks(); | List<ConversationLink> getOutgoingConversationLinks(); | /**
* Returns the value of the '<em><b>Outgoing Conversation Links</b></em>' reference list.
* The list contents are of type {@link org.eclipse.bpmn2.ConversationLink}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Outgoing Conversation Links</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Outgoing Conversation Links</em>' reference list.
* @see org.eclipse.bpmn2.Bpmn2Package#getInteractionNode_OutgoingConversationLinks()
* @model transient="true" changeable="false" volatile="true" derived="true" ordered="false"
* @generated
*/ | Returns the value of the 'Outgoing Conversation Links' reference list. The list contents are of type <code>org.eclipse.bpmn2.ConversationLink</code>. If the meaning of the 'Outgoing Conversation Links' reference list isn't clear, there really should be more of a description here... | getOutgoingConversationLinks | {
"repo_name": "lqjack/fixflow",
"path": "modules/fixflow-core/src/main/java/org/eclipse/bpmn2/InteractionNode.java",
"license": "apache-2.0",
"size": 2770
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,269,848 |
// ------------------------------------------------------------------
static public String encode(String s)
{
try
{
return encode(s,null);
}
catch (UnsupportedEncodingException e)
{
throw new IllegalArgumentException(e.toString());
}
} | static String function(String s) { try { return encode(s,null); } catch (UnsupportedEncodingException e) { throw new IllegalArgumentException(e.toString()); } } | /**
* Base 64 encode as described in RFC 1421.
* <p>Does not insert whitespace as described in RFC 1521.
* @param s String to encode.
* @return String containing the encoded form of the input.
*/ | Base 64 encode as described in RFC 1421. Does not insert whitespace as described in RFC 1521 | encode | {
"repo_name": "xmpace/jetty-read",
"path": "jetty-util/src/main/java/org/eclipse/jetty/util/B64Code.java",
"license": "apache-2.0",
"size": 15320
} | [
"java.io.UnsupportedEncodingException"
] | import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
] | java.io; | 850,367 |
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (!(obj instanceof StandardPieURLGenerator)) {
return false;
}
StandardPieURLGenerator that = (StandardPieURLGenerator) obj;
if (!this.prefix.equals(that.prefix)) {
return false;
}
if (!this.categoryParamName.equals(that.categoryParamName)) {
return false;
}
if (!Objects.equals(this.indexParamName, that.indexParamName)) {
return false;
}
return true;
}
| boolean function(Object obj) { if (obj == this) { return true; } if (!(obj instanceof StandardPieURLGenerator)) { return false; } StandardPieURLGenerator that = (StandardPieURLGenerator) obj; if (!this.prefix.equals(that.prefix)) { return false; } if (!this.categoryParamName.equals(that.categoryParamName)) { return false; } if (!Objects.equals(this.indexParamName, that.indexParamName)) { return false; } return true; } | /**
* Tests if this object is equal to another.
*
* @param obj the object ({@code null} permitted).
*
* @return A boolean.
*/ | Tests if this object is equal to another | equals | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/urls/StandardPieURLGenerator.java",
"license": "lgpl-2.1",
"size": 5547
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 2,863,015 |
protected void applyMergedBeanDefinitionPostProcessors(RootBeanDefinition mbd, Class<?> beanType, String beanName)
throws BeansException {
try {
for (BeanPostProcessor bp : getBeanPostProcessors()) {
if (bp instanceof MergedBeanDefinitionPostProcessor) {
MergedBeanDefinitionPostProcessor bdp = (MergedBeanDefinitionPostProcessor) bp;
bdp.postProcessMergedBeanDefinition(mbd, beanType, beanName);
}
}
}
catch (Exception ex) {
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
"Post-processing failed of bean type [" + beanType + "] failed", ex);
}
} | void function(RootBeanDefinition mbd, Class<?> beanType, String beanName) throws BeansException { try { for (BeanPostProcessor bp : getBeanPostProcessors()) { if (bp instanceof MergedBeanDefinitionPostProcessor) { MergedBeanDefinitionPostProcessor bdp = (MergedBeanDefinitionPostProcessor) bp; bdp.postProcessMergedBeanDefinition(mbd, beanType, beanName); } } } catch (Exception ex) { throw new BeanCreationException(mbd.getResourceDescription(), beanName, STR + beanType + STR, ex); } } | /**
* Apply MergedBeanDefinitionPostProcessors to the specified bean definition,
* invoking their {@code postProcessMergedBeanDefinition} methods.
* @param mbd the merged bean definition for the bean
* @param beanType the actual type of the managed bean instance
* @param beanName the name of the bean
* @throws BeansException if any post-processing failed
* @see MergedBeanDefinitionPostProcessor#postProcessMergedBeanDefinition
*/ | Apply MergedBeanDefinitionPostProcessors to the specified bean definition, invoking their postProcessMergedBeanDefinition methods | applyMergedBeanDefinitionPostProcessors | {
"repo_name": "kingtang/spring-learn",
"path": "spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractAutowireCapableBeanFactory.java",
"license": "gpl-3.0",
"size": 70458
} | [
"org.springframework.beans.BeansException",
"org.springframework.beans.factory.BeanCreationException",
"org.springframework.beans.factory.config.BeanPostProcessor"
] | import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanCreationException; import org.springframework.beans.factory.config.BeanPostProcessor; | import org.springframework.beans.*; import org.springframework.beans.factory.*; import org.springframework.beans.factory.config.*; | [
"org.springframework.beans"
] | org.springframework.beans; | 679,928 |
private boolean advanceToNextRow(
TreeReaderFactory.TreeReader reader, long nextRow, boolean canAdvanceStripe)
throws IOException {
long nextRowInStripe = nextRow - rowBaseInStripe;
// check for row skipping
if (rowIndexStride != 0 &&
includedRowGroups != null &&
nextRowInStripe < rowCountInStripe) {
int rowGroup = (int) (nextRowInStripe / rowIndexStride);
if (!includedRowGroups[rowGroup]) {
while (rowGroup < includedRowGroups.length && !includedRowGroups[rowGroup]) {
rowGroup += 1;
}
if (rowGroup >= includedRowGroups.length) {
if (canAdvanceStripe) {
advanceStripe();
}
return canAdvanceStripe;
}
nextRowInStripe = Math.min(rowCountInStripe, rowGroup * rowIndexStride);
}
}
if (nextRowInStripe >= rowCountInStripe) {
if (canAdvanceStripe) {
advanceStripe();
}
return canAdvanceStripe;
}
if (nextRowInStripe != rowInStripe) {
if (rowIndexStride != 0) {
int rowGroup = (int) (nextRowInStripe / rowIndexStride);
seekToRowEntry(reader, rowGroup);
reader.skipRows(nextRowInStripe - rowGroup * rowIndexStride);
} else {
reader.skipRows(nextRowInStripe - rowInStripe);
}
rowInStripe = nextRowInStripe;
}
return true;
} | boolean function( TreeReaderFactory.TreeReader reader, long nextRow, boolean canAdvanceStripe) throws IOException { long nextRowInStripe = nextRow - rowBaseInStripe; if (rowIndexStride != 0 && includedRowGroups != null && nextRowInStripe < rowCountInStripe) { int rowGroup = (int) (nextRowInStripe / rowIndexStride); if (!includedRowGroups[rowGroup]) { while (rowGroup < includedRowGroups.length && !includedRowGroups[rowGroup]) { rowGroup += 1; } if (rowGroup >= includedRowGroups.length) { if (canAdvanceStripe) { advanceStripe(); } return canAdvanceStripe; } nextRowInStripe = Math.min(rowCountInStripe, rowGroup * rowIndexStride); } } if (nextRowInStripe >= rowCountInStripe) { if (canAdvanceStripe) { advanceStripe(); } return canAdvanceStripe; } if (nextRowInStripe != rowInStripe) { if (rowIndexStride != 0) { int rowGroup = (int) (nextRowInStripe / rowIndexStride); seekToRowEntry(reader, rowGroup); reader.skipRows(nextRowInStripe - rowGroup * rowIndexStride); } else { reader.skipRows(nextRowInStripe - rowInStripe); } rowInStripe = nextRowInStripe; } return true; } | /**
* Skip over rows that we aren't selecting, so that the next row is
* one that we will read.
*
* @param nextRow the row we want to go to
* @throws IOException
*/ | Skip over rows that we aren't selecting, so that the next row is one that we will read | advanceToNextRow | {
"repo_name": "majetideepak/orc",
"path": "java/core/src/java/org/apache/orc/impl/RecordReaderImpl.java",
"license": "apache-2.0",
"size": 58099
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 373,244 |
@RequestMapping(value = "/viewplannedcharges", method = RequestMethod.GET)
public String viewPlannedCharges(ModelMap map) {
logger.debug("### viewPlannedCharges method starting...");
Revision futureRevision = channelService.getFutureRevision(null);
Map<Product, List<ProductCharge>> plannedCharges = new HashMap<Product, List<ProductCharge>>();
for (ProductRevision productRevision : channelService.getFutureChannelRevision(null, false).getProductRevisions()) {
// Ignore removed products in the future revision
if (productRevision.getProduct().getRemoved() == null) {
plannedCharges.put(productRevision.getProduct(), productRevision.getProductCharges());
}
}
List<CurrencyValue> activeCurrencies = currencyValueService.listActiveCurrencies();
map.addAttribute("currencieslist", activeCurrencies);
map.addAttribute("currencieslistsize", activeCurrencies.size());
map.addAttribute("plannedCharges", plannedCharges);
map.addAttribute("date", futureRevision.getStartDate());
logger.debug("### viewPlannedCharges method ending...");
return "view.planned.charges";
} | @RequestMapping(value = STR, method = RequestMethod.GET) String function(ModelMap map) { logger.debug(STR); Revision futureRevision = channelService.getFutureRevision(null); Map<Product, List<ProductCharge>> plannedCharges = new HashMap<Product, List<ProductCharge>>(); for (ProductRevision productRevision : channelService.getFutureChannelRevision(null, false).getProductRevisions()) { if (productRevision.getProduct().getRemoved() == null) { plannedCharges.put(productRevision.getProduct(), productRevision.getProductCharges()); } } List<CurrencyValue> activeCurrencies = currencyValueService.listActiveCurrencies(); map.addAttribute(STR, activeCurrencies); map.addAttribute(STR, activeCurrencies.size()); map.addAttribute(STR, plannedCharges); map.addAttribute("date", futureRevision.getStartDate()); logger.debug(STR); return STR; } | /**
* View charges for all products.
*
* @param map
* @return String
*/ | View charges for all products | viewPlannedCharges | {
"repo_name": "backbrainer/cpbm-customization",
"path": "citrix.cpbm.custom.portal/src/main/java/com/citrix/cpbm/portal/fragment/controllers/AbstractProductsController.java",
"license": "bsd-2-clause",
"size": 67633
} | [
"com.vmops.model.CurrencyValue",
"com.vmops.model.Product",
"com.vmops.model.ProductCharge",
"com.vmops.model.ProductRevision",
"com.vmops.model.Revision",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.springframework.ui.ModelMap",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import com.vmops.model.CurrencyValue; import com.vmops.model.Product; import com.vmops.model.ProductCharge; import com.vmops.model.ProductRevision; import com.vmops.model.Revision; import java.util.HashMap; import java.util.List; import java.util.Map; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import com.vmops.model.*; import java.util.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; | [
"com.vmops.model",
"java.util",
"org.springframework.ui",
"org.springframework.web"
] | com.vmops.model; java.util; org.springframework.ui; org.springframework.web; | 1,770,327 |
public List<Accessor> getConnectionsForQuery(AbstractSession session, DatabaseQuery query, AbstractRecord arguments) {
Object value = arguments.get(this.partitionField);
List<Accessor> accessors = null;
if (value == null) {
if (this.unionUnpartitionableQueries) {
accessors = new ArrayList<Accessor>(this.partitions.size());
} else {
return null;
}
} else {
accessors = new ArrayList<Accessor>(1);
}
int size = this.partitions.size();
for (int index = 0; index < size; index++) {
RangePartition partition = this.partitions.get(index);
if ((value == null) || partition.isInRange(value)) {
if (session.getPlatform().hasPartitioningCallback()) {
// UCP support.
session.getPlatform().getPartitioningCallback().setPartitionId(index);
return null;
}
accessors.add(getAccessor(partition.getConnectionPool(), session, query, false));
if (value != null) {
break;
}
}
}
if (accessors.isEmpty()) {
return null;
}
return accessors;
} | List<Accessor> function(AbstractSession session, DatabaseQuery query, AbstractRecord arguments) { Object value = arguments.get(this.partitionField); List<Accessor> accessors = null; if (value == null) { if (this.unionUnpartitionableQueries) { accessors = new ArrayList<Accessor>(this.partitions.size()); } else { return null; } } else { accessors = new ArrayList<Accessor>(1); } int size = this.partitions.size(); for (int index = 0; index < size; index++) { RangePartition partition = this.partitions.get(index); if ((value == null) partition.isInRange(value)) { if (session.getPlatform().hasPartitioningCallback()) { session.getPlatform().getPartitioningCallback().setPartitionId(index); return null; } accessors.add(getAccessor(partition.getConnectionPool(), session, query, false)); if (value != null) { break; } } } if (accessors.isEmpty()) { return null; } return accessors; } | /**
* INTERNAL:
* Get a connection from one of the pools in a round robin rotation fashion.
*/ | Get a connection from one of the pools in a round robin rotation fashion | getConnectionsForQuery | {
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/descriptors/partitioning/RangePartitioningPolicy.java",
"license": "epl-1.0",
"size": 6297
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.persistence.internal.databaseaccess.Accessor",
"org.eclipse.persistence.internal.sessions.AbstractRecord",
"org.eclipse.persistence.internal.sessions.AbstractSession",
"org.eclipse.persistence.queries.DatabaseQuery"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.persistence.internal.databaseaccess.Accessor; import org.eclipse.persistence.internal.sessions.AbstractRecord; import org.eclipse.persistence.internal.sessions.AbstractSession; import org.eclipse.persistence.queries.DatabaseQuery; | import java.util.*; import org.eclipse.persistence.internal.databaseaccess.*; import org.eclipse.persistence.internal.sessions.*; import org.eclipse.persistence.queries.*; | [
"java.util",
"org.eclipse.persistence"
] | java.util; org.eclipse.persistence; | 2,225,026 |
Map<DeployedMtaMetadata, Set<String>> servicesMap = new HashMap<>();
Map<DeployedMtaMetadata, List<DeployedMtaModule>> modulesMap = new HashMap<>();
List<String> standaloneApps = new ArrayList<>();
for (CloudApplication app : apps) {
String appName = app.getName();
ApplicationMtaMetadata appMetadata = ApplicationMtaMetadataParser.parseAppMetadata(app);
if (appMetadata != null) {
// This application is an MTA module.
String moduleName = (appMetadata.getModuleName() != null) ? appMetadata.getModuleName() : appName;
List<String> providedDependencies = (appMetadata.getProvidedDependencyNames() != null)
? appMetadata.getProvidedDependencyNames()
: new ArrayList<>();
List<String> appServices = (appMetadata.getServices() != null) ? appMetadata.getServices() : new ArrayList<>();
DeployedMtaMetadata mtaMetadata = appMetadata.getMtaMetadata();
List<DeployedMtaModule> modules = modulesMap.getOrDefault(mtaMetadata, new ArrayList<>());
Date createdOn = app.getMeta()
.getCreated();
Date updatedOn = app.getMeta()
.getUpdated();
DeployedMtaModule module = new DeployedMtaModule(moduleName, appName, createdOn, updatedOn, appServices,
providedDependencies, app.getUris());
modules.add(module);
modulesMap.put(mtaMetadata, modules);
Set<String> services = servicesMap.getOrDefault(mtaMetadata, new HashSet<>());
services.addAll(appServices);
servicesMap.put(mtaMetadata, services);
} else {
// This is a standalone application.
standaloneApps.add(appName);
}
}
return createComponents(modulesMap, servicesMap, standaloneApps);
}
| Map<DeployedMtaMetadata, Set<String>> servicesMap = new HashMap<>(); Map<DeployedMtaMetadata, List<DeployedMtaModule>> modulesMap = new HashMap<>(); List<String> standaloneApps = new ArrayList<>(); for (CloudApplication app : apps) { String appName = app.getName(); ApplicationMtaMetadata appMetadata = ApplicationMtaMetadataParser.parseAppMetadata(app); if (appMetadata != null) { String moduleName = (appMetadata.getModuleName() != null) ? appMetadata.getModuleName() : appName; List<String> providedDependencies = (appMetadata.getProvidedDependencyNames() != null) ? appMetadata.getProvidedDependencyNames() : new ArrayList<>(); List<String> appServices = (appMetadata.getServices() != null) ? appMetadata.getServices() : new ArrayList<>(); DeployedMtaMetadata mtaMetadata = appMetadata.getMtaMetadata(); List<DeployedMtaModule> modules = modulesMap.getOrDefault(mtaMetadata, new ArrayList<>()); Date createdOn = app.getMeta() .getCreated(); Date updatedOn = app.getMeta() .getUpdated(); DeployedMtaModule module = new DeployedMtaModule(moduleName, appName, createdOn, updatedOn, appServices, providedDependencies, app.getUris()); modules.add(module); modulesMap.put(mtaMetadata, modules); Set<String> services = servicesMap.getOrDefault(mtaMetadata, new HashSet<>()); services.addAll(appServices); servicesMap.put(mtaMetadata, services); } else { standaloneApps.add(appName); } } return createComponents(modulesMap, servicesMap, standaloneApps); } | /**
* Detects all deployed components on this platform.
*
*/ | Detects all deployed components on this platform | detectAllDeployedComponents | {
"repo_name": "boyan-velinov/cf-mta-deploy-service",
"path": "com.sap.cloud.lm.sl.cf.core/src/main/java/com/sap/cloud/lm/sl/cf/core/cf/detect/DeployedComponentsDetector.java",
"license": "apache-2.0",
"size": 5117
} | [
"com.sap.cloud.lm.sl.cf.core.model.ApplicationMtaMetadata",
"com.sap.cloud.lm.sl.cf.core.model.DeployedMtaMetadata",
"com.sap.cloud.lm.sl.cf.core.model.DeployedMtaModule",
"java.util.ArrayList",
"java.util.Date",
"java.util.HashMap",
"java.util.HashSet",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.cloudfoundry.client.lib.domain.CloudApplication"
] | import com.sap.cloud.lm.sl.cf.core.model.ApplicationMtaMetadata; import com.sap.cloud.lm.sl.cf.core.model.DeployedMtaMetadata; import com.sap.cloud.lm.sl.cf.core.model.DeployedMtaModule; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.cloudfoundry.client.lib.domain.CloudApplication; | import com.sap.cloud.lm.sl.cf.core.model.*; import java.util.*; import org.cloudfoundry.client.lib.domain.*; | [
"com.sap.cloud",
"java.util",
"org.cloudfoundry.client"
] | com.sap.cloud; java.util; org.cloudfoundry.client; | 1,018,740 |
List<AnswerHeader> getPrintAnswerHeadersForProtocol(ModuleQuestionnaireBean moduleQuestionnaireBean, String protocolNumber, QuestionnaireHelperBase questionnaireHelper); | List<AnswerHeader> getPrintAnswerHeadersForProtocol(ModuleQuestionnaireBean moduleQuestionnaireBean, String protocolNumber, QuestionnaireHelperBase questionnaireHelper); | /**
*
* This method is to get all the questionnaire answers to print for the protocol.
* This method is intended to obtain the data that will ultimately be used by the protocol actions, print, questionnaire sub-tab.
*
* @param moduleQuestionnaireBean
* @param protocolNumber
* @param questionnaireHelper
* @return
*/ | This method is to get all the questionnaire answers to print for the protocol. This method is intended to obtain the data that will ultimately be used by the protocol actions, print, questionnaire sub-tab | getPrintAnswerHeadersForProtocol | {
"repo_name": "vivantech/kc_fixes",
"path": "src/main/java/org/kuali/kra/questionnaire/answer/QuestionnaireAnswerService.java",
"license": "apache-2.0",
"size": 7893
} | [
"java.util.List",
"org.kuali.kra.protocol.questionnaire.QuestionnaireHelperBase"
] | import java.util.List; import org.kuali.kra.protocol.questionnaire.QuestionnaireHelperBase; | import java.util.*; import org.kuali.kra.protocol.questionnaire.*; | [
"java.util",
"org.kuali.kra"
] | java.util; org.kuali.kra; | 606,472 |
public MetaProperty<DayCount> dayCount() {
return dayCount;
} | MetaProperty<DayCount> function() { return dayCount; } | /**
* The meta-property for the {@code dayCount} property.
* @return the meta-property, not null
*/ | The meta-property for the dayCount property | dayCount | {
"repo_name": "OpenGamma/OG-Commons",
"path": "modules/basics/src/main/java/com/opengamma/basics/index/ImmutableOvernightIndex.java",
"license": "apache-2.0",
"size": 24238
} | [
"com.opengamma.basics.date.DayCount",
"org.joda.beans.MetaProperty"
] | import com.opengamma.basics.date.DayCount; import org.joda.beans.MetaProperty; | import com.opengamma.basics.date.*; import org.joda.beans.*; | [
"com.opengamma.basics",
"org.joda.beans"
] | com.opengamma.basics; org.joda.beans; | 193,272 |
private Point2D convertPointToPixel(final JXMapViewer map, final Point2D point) {
final GeoPosition geoPosition = new GeoPosition(point.getX(), point.getY());
return map.getTileFactory().geoToPixel(geoPosition, map.getZoom());
} | Point2D function(final JXMapViewer map, final Point2D point) { final GeoPosition geoPosition = new GeoPosition(point.getX(), point.getY()); return map.getTileFactory().geoToPixel(geoPosition, map.getZoom()); } | /**
* Convert a given point to pixel pos
* @param map
* @param point
* @return
*/ | Convert a given point to pixel pos | convertPointToPixel | {
"repo_name": "jnidzwetzki/bboxdb",
"path": "bboxdb-tools/src/main/java/org/bboxdb/tools/gui/views/query/OverlayElement.java",
"license": "apache-2.0",
"size": 11704
} | [
"java.awt.geom.Point2D",
"org.jxmapviewer.JXMapViewer",
"org.jxmapviewer.viewer.GeoPosition"
] | import java.awt.geom.Point2D; import org.jxmapviewer.JXMapViewer; import org.jxmapviewer.viewer.GeoPosition; | import java.awt.geom.*; import org.jxmapviewer.*; import org.jxmapviewer.viewer.*; | [
"java.awt",
"org.jxmapviewer",
"org.jxmapviewer.viewer"
] | java.awt; org.jxmapviewer; org.jxmapviewer.viewer; | 2,334,834 |
@Element( name = "DTMAT", order = 130)
public Date getDebtMaturityDate() {
return debtMaturityDate;
} | @Element( name = "DTMAT", order = 130) Date function() { return debtMaturityDate; } | /**
* Gets the date when the debt matures. This is an optional field according to the OFX spec.
*
* @return the date when the debt matures
*/ | Gets the date when the debt matures. This is an optional field according to the OFX spec | getDebtMaturityDate | {
"repo_name": "stoicflame/ofx4j",
"path": "src/main/java/com/webcohesion/ofx4j/domain/data/seclist/DebtSecurityInfo.java",
"license": "apache-2.0",
"size": 9958
} | [
"com.webcohesion.ofx4j.meta.Element",
"java.util.Date"
] | import com.webcohesion.ofx4j.meta.Element; import java.util.Date; | import com.webcohesion.ofx4j.meta.*; import java.util.*; | [
"com.webcohesion.ofx4j",
"java.util"
] | com.webcohesion.ofx4j; java.util; | 2,675,562 |
public java.security.PrivateKey getPrivKey()
{
return privKey;
} | java.security.PrivateKey function() { return privKey; } | /**
* Gets the private key.
*
* @return the private key
*/ | Gets the private key | getPrivKey | {
"repo_name": "SafetyCulture/DroidText",
"path": "app/src/main/java/com/lowagie/text/pdf/PdfSignatureAppearance.java",
"license": "lgpl-3.0",
"size": 47358
} | [
"java.security.PrivateKey"
] | import java.security.PrivateKey; | import java.security.*; | [
"java.security"
] | java.security; | 2,724,375 |
public void refreshNodeAttributesToScheduler(NodeId nodeId) {
String hostName = nodeId.getHost();
Map<String, Set<NodeAttribute>> newNodeToAttributesMap =
new HashMap<>();
Host host = nodeCollections.get(hostName);
if (host == null || host.attributes == null) {
return;
}
newNodeToAttributesMap.put(hostName, host.attributes.keySet());
// Notify RM
if (rmContext != null && rmContext.getDispatcher() != null) {
LOG.info("Updated NodeAttribute event to RM:" + newNodeToAttributesMap);
rmContext.getDispatcher().getEventHandler().handle(
new NodeAttributesUpdateSchedulerEvent(newNodeToAttributesMap));
}
} | void function(NodeId nodeId) { String hostName = nodeId.getHost(); Map<String, Set<NodeAttribute>> newNodeToAttributesMap = new HashMap<>(); Host host = nodeCollections.get(hostName); if (host == null host.attributes == null) { return; } newNodeToAttributesMap.put(hostName, host.attributes.keySet()); if (rmContext != null && rmContext.getDispatcher() != null) { LOG.info(STR + newNodeToAttributesMap); rmContext.getDispatcher().getEventHandler().handle( new NodeAttributesUpdateSchedulerEvent(newNodeToAttributesMap)); } } | /**
* Refresh node attributes on a given node during RM recovery.
* @param nodeId Node Id
*/ | Refresh node attributes on a given node during RM recovery | refreshNodeAttributesToScheduler | {
"repo_name": "nandakumar131/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/nodelabels/NodeAttributesManagerImpl.java",
"license": "apache-2.0",
"size": 26453
} | [
"java.util.HashMap",
"java.util.Map",
"java.util.Set",
"org.apache.hadoop.yarn.api.records.NodeAttribute",
"org.apache.hadoop.yarn.api.records.NodeId",
"org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAttributesUpdateSchedulerEvent"
] | import java.util.HashMap; import java.util.Map; import java.util.Set; import org.apache.hadoop.yarn.api.records.NodeAttribute; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.NodeAttributesUpdateSchedulerEvent; | import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 160,630 |
public void retryCommit(final CoordinationContextType coordinationContext, final MAP map)
throws SoapFault11
{
try
{
InteropUtil.registerDurable2PC(coordinationContext, new CommitFailureDurable2PCParticipant(), new Uid().toString()) ;
}
catch (final Throwable th)
{
throw new SoapFault11(th) ;
}
} | void function(final CoordinationContextType coordinationContext, final MAP map) throws SoapFault11 { try { InteropUtil.registerDurable2PC(coordinationContext, new CommitFailureDurable2PCParticipant(), new Uid().toString()) ; } catch (final Throwable th) { throw new SoapFault11(th) ; } } | /**
* Execute the RetryCommit
* @param map The current addressing context.
* @throws SoapFault11 for errors during processing
*/ | Execute the RetryCommit | retryCommit | {
"repo_name": "nmcl/wfswarm-example-arjuna-old",
"path": "graalvm/transactions/fork/narayana/XTS/localjunit/WSTFSC07-interop/src/main/java/com/jboss/transaction/wstf/webservices/sc007/processors/ParticipantProcessor.java",
"license": "apache-2.0",
"size": 12252
} | [
"com.arjuna.ats.arjuna.common.Uid",
"com.arjuna.webservices11.SoapFault11",
"com.jboss.transaction.wstf.webservices.sc007.InteropUtil",
"com.jboss.transaction.wstf.webservices.sc007.participant.CommitFailureDurable2PCParticipant",
"org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType"
] | import com.arjuna.ats.arjuna.common.Uid; import com.arjuna.webservices11.SoapFault11; import com.jboss.transaction.wstf.webservices.sc007.InteropUtil; import com.jboss.transaction.wstf.webservices.sc007.participant.CommitFailureDurable2PCParticipant; import org.oasis_open.docs.ws_tx.wscoor._2006._06.CoordinationContextType; | import com.arjuna.ats.arjuna.common.*; import com.arjuna.webservices11.*; import com.jboss.transaction.wstf.webservices.sc007.*; import com.jboss.transaction.wstf.webservices.sc007.participant.*; import org.oasis_open.docs.ws_tx.wscoor.*; | [
"com.arjuna.ats",
"com.arjuna.webservices11",
"com.jboss.transaction",
"org.oasis_open.docs"
] | com.arjuna.ats; com.arjuna.webservices11; com.jboss.transaction; org.oasis_open.docs; | 89,186 |
final ByteArrayOutputStream bs = new ByteArrayOutputStream((s.length() / 4) * 3);
final char[] c = new char[s.length()];
s.getChars(0, s.length(), c, 0);
int endchar = -1;
for (int j = 0; j < c.length && endchar == -1; j++) {
if (c[j] >= 'A' && c[j] <= 'Z') {
c[j] -= 'A';
}
else if (c[j] >= 'a' && c[j] <= 'z') {
c[j] = (char) (c[j] + 26 - 'a');
}
else if (c[j] >= '0' && c[j] <= '9') {
c[j] = (char) (c[j] + 52 - '0');
}
else if (c[j] == '+') {
c[j] = 62;
}
else if (c[j] == '/') {
c[j] = 63;
}
else if (c[j] == '=') {
endchar = j;
}
else {
return null;
}
}
int remaining = endchar == -1 ? c.length : endchar;
int i = 0;
while (remaining > 0) {
byte b0 = (byte) (c[i] << 2);
if (remaining >= 2) {
b0 += (c[i + 1] & 0x30) >> 4;
}
bs.write(b0);
if (remaining >= 3) {
byte b1 = (byte) ((c[i + 1] & 0x0F) << 4);
b1 += (byte) ((c[i + 2] & 0x3C) >> 2);
bs.write(b1);
}
if (remaining >= 4) {
byte b2 = (byte) ((c[i + 2] & 0x03) << 6);
b2 += c[i + 3];
bs.write(b2);
}
i += 4;
remaining -= 4;
}
return bs.toByteArray();
}
| final ByteArrayOutputStream bs = new ByteArrayOutputStream((s.length() / 4) * 3); final char[] c = new char[s.length()]; s.getChars(0, s.length(), c, 0); int endchar = -1; for (int j = 0; j < c.length && endchar == -1; j++) { if (c[j] >= 'A' && c[j] <= 'Z') { c[j] -= 'A'; } else if (c[j] >= 'a' && c[j] <= 'z') { c[j] = (char) (c[j] + 26 - 'a'); } else if (c[j] >= '0' && c[j] <= '9') { c[j] = (char) (c[j] + 52 - '0'); } else if (c[j] == '+') { c[j] = 62; } else if (c[j] == '/') { c[j] = 63; } else if (c[j] == '=') { endchar = j; } else { return null; } } int remaining = endchar == -1 ? c.length : endchar; int i = 0; while (remaining > 0) { byte b0 = (byte) (c[i] << 2); if (remaining >= 2) { b0 += (c[i + 1] & 0x30) >> 4; } bs.write(b0); if (remaining >= 3) { byte b1 = (byte) ((c[i + 1] & 0x0F) << 4); b1 += (byte) ((c[i + 2] & 0x3C) >> 2); bs.write(b1); } if (remaining >= 4) { byte b2 = (byte) ((c[i + 2] & 0x03) << 6); b2 += c[i + 3]; bs.write(b2); } i += 4; remaining -= 4; } return bs.toByteArray(); } | /**
* Helper method for decoding a Base64 string as an byte array. Returns null
* on encoding error. This method does not allow any other characters
* present in the string then the 65 special base64 chars.
*/ | Helper method for decoding a Base64 string as an byte array. Returns null on encoding error. This method does not allow any other characters present in the string then the 65 special base64 chars | decode64 | {
"repo_name": "SDX2000/freeplane",
"path": "freeplane/src/org/freeplane/features/encrypt/Base64Coding.java",
"license": "gpl-2.0",
"size": 4901
} | [
"java.io.ByteArrayOutputStream"
] | import java.io.ByteArrayOutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 12,868 |
private void processLogEntryResponse(LogEntry[] entries, String type, String processPath, JSONArray result)
throws JSONException {
for (LogEntry logEntry : entries) {
try {
switch (logEntry.getAction()) {
case LogEntry.UPDATE:
if (ProcessCenterConstants.AUDIT.PROCESS.equals(type))
filterProcessUpdateLogs(logEntry);
getLogEntryJson(logEntry, "update", type, processPath, result);
break;
case LogEntry.ADD:
getLogEntryJson(logEntry, "add", type, processPath, result);
break;
case LogEntry.DELETE_RESOURCE:
getLogEntryJson(logEntry, "delete", type, processPath, result);
break;
case LogEntry.TAG:
getLogEntryJson(logEntry, "tag", type, processPath, result);
break;
}
} catch (JSONException e) {
String msg = "Error processing log entries for process in " + processPath;
log.error(msg, e);
throw new JSONException(msg);
}
}
} | void function(LogEntry[] entries, String type, String processPath, JSONArray result) throws JSONException { for (LogEntry logEntry : entries) { try { switch (logEntry.getAction()) { case LogEntry.UPDATE: if (ProcessCenterConstants.AUDIT.PROCESS.equals(type)) filterProcessUpdateLogs(logEntry); getLogEntryJson(logEntry, STR, type, processPath, result); break; case LogEntry.ADD: getLogEntryJson(logEntry, "add", type, processPath, result); break; case LogEntry.DELETE_RESOURCE: getLogEntryJson(logEntry, STR, type, processPath, result); break; case LogEntry.TAG: getLogEntryJson(logEntry, "tag", type, processPath, result); break; } } catch (JSONException e) { String msg = STR + processPath; log.error(msg, e); throw new JSONException(msg); } } } | /**
* processes log entry response to a json array
*
* @param entries log entries taken from the registry logs
* @param type log entry type
* @param processPath the path to the process asset
* @param result resultant json of the log entries
* @throws JSONException
*/ | processes log entry response to a json array | processLogEntryResponse | {
"repo_name": "dimuthnc/product-pc",
"path": "modules/components/core/org.wso2.carbon.pc.core/src/main/java/org/wso2/carbon/pc/core/audit/util/LogEntryProcessUtils.java",
"license": "apache-2.0",
"size": 7350
} | [
"org.json.JSONArray",
"org.json.JSONException",
"org.wso2.carbon.pc.core.ProcessCenterConstants",
"org.wso2.carbon.registry.core.LogEntry"
] | import org.json.JSONArray; import org.json.JSONException; import org.wso2.carbon.pc.core.ProcessCenterConstants; import org.wso2.carbon.registry.core.LogEntry; | import org.json.*; import org.wso2.carbon.pc.core.*; import org.wso2.carbon.registry.core.*; | [
"org.json",
"org.wso2.carbon"
] | org.json; org.wso2.carbon; | 1,577,558 |
//-----------------------------------------------------------------------
public Object[] toArray() {
Object[] result = new Object[size()];
int i = 0;
Iterator it = map.keySet().iterator();
while (it.hasNext()) {
Object current = it.next();
for (int index = getCount(current); index > 0; index--) {
result[i++] = current;
}
}
return result;
}
| Object[] function() { Object[] result = new Object[size()]; int i = 0; Iterator it = map.keySet().iterator(); while (it.hasNext()) { Object current = it.next(); for (int index = getCount(current); index > 0; index--) { result[i++] = current; } } return result; } | /**
* Returns an array of all of this bag's elements.
*
* @return an array of all of this bag's elements
*/ | Returns an array of all of this bag's elements | toArray | {
"repo_name": "ProfilingLabs/Usemon2",
"path": "usemon-agent-commons-java/src/main/java/com/usemon/lib/org/apache/commons/collections/bag/AbstractMapBag.java",
"license": "mpl-2.0",
"size": 18655
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 2,129,803 |
//---------------------------------------------------------------------
private void appendModel(Result result, long model_id) throws Exception
{
boolean exception = false;
int batch[] = { result.getBatch() }, run[] = { 0 };
Statement st = getConnection().createStatement();
// !!!MODOSITAS!!!
if (result.getRun() == -1)
throw new Exception("Missing run#");
run[0] = result.getRun();
ResultSet rs = null;
try {
// rs = st.executeQuery("SELECT Run FROM RESULTS_INPUT_" + model_id +
// " WHERE Batch=" + batch[0] +
// " ORDER BY Run DESC LIMIT 1");
rs = st.executeQuery("SELECT Run FROM RESULTS_INPUT_" + model_id +
" WHERE Batch=" + batch[0] +
" AND Run=" + run[0]);
if (rs.next()) {
// run[0] = rs.getInt(1) + 1; // Columns are numbered from 1
throw new Exception("Invalid run#");
}
rs.close();
st.close(); st = null;
} finally {
release(st);
}
Transaction t = new Transaction(getConnection());
t.start();
// Meg kell nezni hogy van-e olyan oszlop result-ban ami icols-ban nincs
// illetoleg ocols-ban nincs. Ha van, akkor ezekkel boviteni kell az icols/ocols-ban
// levo Columns-t, tovabba ALTER TABLE-t kell vegrehajtani.
// Ha sikerult, akkor utana ezeket az oszlopokat hozza kell adni
// a columnmap tablakhoz is.
//
AlterColumns in = null, out = null;
try { // finally commit or rollback
st = getConnection().createStatement();
in = new AlterColumns("RESULTS_I_COLUMNS", "RESULTS_INPUT_" + model_id, model_id,
result.getParameterComb().getNames(), st);
out= new AlterColumns("RESULTS_O_COLUMNS", "RESULTS_OUTPUT_" + model_id, model_id,
result.getOutputColumns(), st);
st.close(); st = null;
t.commit();
} finally {
release(st);
t.rollback();
}
t.start();
PreparedStatement ps = null;
try { // finally commit or rollback
in.updateColMapping(getConnection());
out.updateColMapping(getConnection());
ps = getConnection().prepareStatement(
"INSERT INTO RESULTS_INPUT_" + model_id +
" (Batch, Run, " + quote("Timestamp") + in.order + ")" +
" VALUES (?,?,?" + in.orderQ + ")");
ps.setInt(1, batch[0]);
ps.setInt(2, run[0]);
ps.setTimestamp(3, new java.sql.Timestamp(result.getStartTime()));
try {
result.getParameterComb().getValues().writeValues(ps, 4);
} catch (final ValueNotSupportedException e) {
exception = true;
}
ps.executeUpdate();
ps.close(); ps = null;
ps = getConnection().prepareStatement(
"INSERT INTO RESULTS_OUTPUT_" + model_id +
" (Batch, Run, Tick" + out.order + ")" + // ID erteke automatikusan generalodik
" VALUES (?,?,?" + out.orderQ + ")");
ps.setInt(1, batch[0]);
ps.setInt(2, run[0]);
for (Result.Row row : result.getAllRows()) {
ps.setInt(3, row.getTick());
try {
row.writeValues(ps, 4);
} catch (final ValueNotSupportedException e) {
exception = true;
}
ps.executeUpdate();
}
ps.close(); ps = null;
writeDescription(result.getModel(), model_id);
result.updateModelAndRun(model_id, run[0]);
t.commit();
if (exception)
throw new ValueNotSupportedException();
} finally {
if (ps != null) ps.close();
t.rollback();
result.close();
}
}
//---------------------------------------------------------------------
// Note: this class is used by ViewsDb, too
static class AlterColumns {
String mapTable, order, orderQ;
Columns cols = new Columns();
boolean changed = false;
long id;
AlterColumns(String mapTable, String valuesTable, long id, Columns names, Statement st) throws SQLException
{
this.mapTable = mapTable;
this.id = id;
cols.read(id, mapTable, st);
ArrayList<String> orderTmp = new ArrayList<String>(names.size());
int missing[] = cols.merge(names, orderTmp);
order = (orderTmp.isEmpty() ? "" : ",") + join(orderTmp, ",");
orderQ= repeat(",?", orderTmp.size(), null);
changed = (0 < missing.length);
if (changed) {
SQLDialect dialect = MEMEApp.getDatabase().getSQLDialect();
for (int i = 0; i < missing.length; ++i) {
int idx = missing[i];
if (idx > 0)
st.execute(dialect.alterTableAddColumn (valuesTable, cols.compose(idx-1))); // ???
else
st.execute(dialect.alterTableSetColumnType(valuesTable, cols.compose(-idx-1))); // ???
}
}
} | void function(Result result, long model_id) throws Exception { boolean exception = false; int batch[] = { result.getBatch() }, run[] = { 0 }; Statement st = getConnection().createStatement(); if (result.getRun() == -1) throw new Exception(STR); run[0] = result.getRun(); ResultSet rs = null; try { rs = st.executeQuery(STR + model_id + STR + batch[0] + STR + run[0]); if (rs.next()) { throw new Exception(STR); } rs.close(); st.close(); st = null; } finally { release(st); } Transaction t = new Transaction(getConnection()); t.start(); try { st = getConnection().createStatement(); in = new AlterColumns(STR, STR + model_id, model_id, result.getParameterComb().getNames(), st); out= new AlterColumns(STR, STR + model_id, model_id, result.getOutputColumns(), st); st.close(); st = null; t.commit(); } finally { release(st); t.rollback(); } t.start(); PreparedStatement ps = null; try { in.updateColMapping(getConnection()); out.updateColMapping(getConnection()); ps = getConnection().prepareStatement( STR + model_id + STR + quote(STR) + in.order + ")" + STR + in.orderQ + ")"); ps.setInt(1, batch[0]); ps.setInt(2, run[0]); ps.setTimestamp(3, new java.sql.Timestamp(result.getStartTime())); try { result.getParameterComb().getValues().writeValues(ps, 4); } catch (final ValueNotSupportedException e) { exception = true; } ps.executeUpdate(); ps.close(); ps = null; ps = getConnection().prepareStatement( STR + model_id + STR + out.order + ")" + STR + out.orderQ + ")"); ps.setInt(1, batch[0]); ps.setInt(2, run[0]); for (Result.Row row : result.getAllRows()) { ps.setInt(3, row.getTick()); try { row.writeValues(ps, 4); } catch (final ValueNotSupportedException e) { exception = true; } ps.executeUpdate(); } ps.close(); ps = null; writeDescription(result.getModel(), model_id); result.updateModelAndRun(model_id, run[0]); t.commit(); if (exception) throw new ValueNotSupportedException(); } finally { if (ps != null) ps.close(); t.rollback(); result.close(); } } static class AlterColumns { String mapTable, order, orderQ; Columns cols = new Columns(); boolean changed = false; long id; AlterColumns(String mapTable, String valuesTable, long id, Columns names, Statement st) throws SQLException { this.mapTable = mapTable; this.id = id; cols.read(id, mapTable, st); ArrayList<String> orderTmp = new ArrayList<String>(names.size()); int missing[] = cols.merge(names, orderTmp); order = (orderTmp.isEmpty() ? STR,STR,STR,?", orderTmp.size(), null); changed = (0 < missing.length); if (changed) { SQLDialect dialect = MEMEApp.getDatabase().getSQLDialect(); for (int i = 0; i < missing.length; ++i) { int idx = missing[i]; if (idx > 0) st.execute(dialect.alterTableAddColumn (valuesTable, cols.compose(idx-1))); else st.execute(dialect.alterTableSetColumnType(valuesTable, cols.compose(-idx-1))); } } } | /**
* This method is part of addResult(result).
* @pre <code>result</code> specifies an existing model, which is
* found by {name,version} at the specified model_id.
*/ | This method is part of addResult(result) | appendModel | {
"repo_name": "lgulyas/MEME",
"path": "src/ai/aitia/meme/database/LocalAPI.java",
"license": "gpl-3.0",
"size": 43503
} | [
"ai.aitia.meme.MEMEApp",
"ai.aitia.meme.database.ColumnType",
"ai.aitia.meme.database.Columns",
"ai.aitia.meme.database.SQLDialect",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement",
"java.util.ArrayList"
] | import ai.aitia.meme.MEMEApp; import ai.aitia.meme.database.ColumnType; import ai.aitia.meme.database.Columns; import ai.aitia.meme.database.SQLDialect; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; | import ai.aitia.meme.*; import ai.aitia.meme.database.*; import java.sql.*; import java.util.*; | [
"ai.aitia.meme",
"java.sql",
"java.util"
] | ai.aitia.meme; java.sql; java.util; | 2,472,862 |
public int getGeneralIndex(Test o, boolean filterFixtures) {
Vector<RunnerTest> testsToCount = new Vector<RunnerTest>();
for (int i = 0; i < allTests.size(); i++) {
if (!(allTests.elementAt(i) instanceof RunnerFixture) || !filterFixtures) {
testsToCount.add((RunnerTest) allTests.elementAt(i));
}
}
for (int i = 0; i < testsToCount.size(); i++) {
if (o == testsToCount.elementAt(i).getTest()) {
return i;
}
}
return -1;
} | int function(Test o, boolean filterFixtures) { Vector<RunnerTest> testsToCount = new Vector<RunnerTest>(); for (int i = 0; i < allTests.size(); i++) { if (!(allTests.elementAt(i) instanceof RunnerFixture) !filterFixtures) { testsToCount.add((RunnerTest) allTests.elementAt(i)); } } for (int i = 0; i < testsToCount.size(); i++) { if (o == testsToCount.elementAt(i).getTest()) { return i; } } return -1; } | /**
* Gets the index of the test in all scenario's offsprings. If
* filterFixtures is set to true, fixtures are filtered from general tests
* list.<br>
* -1 if test is not found.<br>
* Test is identified according to it's handler in the jvm's memory.<br>
*
*/ | Gets the index of the test in all scenario's offsprings. If filterFixtures is set to true, fixtures are filtered from general tests list. -1 if test is not found. Test is identified according to it's handler in the jvm's memory | getGeneralIndex | {
"repo_name": "Top-Q/jsystem",
"path": "jsystem-core-projects/jsystemCore/src/main/java/jsystem/framework/scenario/JTestContainer.java",
"license": "apache-2.0",
"size": 39931
} | [
"java.util.Vector",
"junit.framework.Test"
] | import java.util.Vector; import junit.framework.Test; | import java.util.*; import junit.framework.*; | [
"java.util",
"junit.framework"
] | java.util; junit.framework; | 571,709 |
public static void outputLog(Writer writer) {
if (loggingEnabled()) {
try {
synchronized(times) {
for (int i = 0; i < times.size(); ++i) {
TimeData td = times.get(i);
if (td != null) {
writer.write(i + " " + td.getMessage() + ": " +
(td.getTime() - baseTime) + "\n");
}
}
}
writer.flush();
} catch (Exception e) {
System.out.println(e + ": Writing performance log to " +
writer);
}
}
} | static void function(Writer writer) { if (loggingEnabled()) { try { synchronized(times) { for (int i = 0; i < times.size(); ++i) { TimeData td = times.get(i); if (td != null) { writer.write(i + " " + td.getMessage() + STR + (td.getTime() - baseTime) + "\n"); } } } writer.flush(); } catch (Exception e) { System.out.println(e + STR + writer); } } } | /**
* Outputs all data to parameter-specified Writer object
*/ | Outputs all data to parameter-specified Writer object | outputLog | {
"repo_name": "universsky/openjdk",
"path": "jdk/src/java.base/share/classes/sun/misc/PerformanceLogger.java",
"license": "gpl-2.0",
"size": 10824
} | [
"java.io.Writer"
] | import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 975,519 |
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException
{
XObject expr1 = m_left.execute(xctxt);
if (expr1.bool())
{
XObject expr2 = m_right.execute(xctxt);
return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
}
else
return XBoolean.S_FALSE;
} | XObject function(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject expr1 = m_left.execute(xctxt); if (expr1.bool()) { XObject expr2 = m_right.execute(xctxt); return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE; } else return XBoolean.S_FALSE; } | /**
* AND two expressions and return the boolean result. Override
* superclass method for optimization purposes.
*
* @param xctxt The runtime execution context.
*
* @return {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_TRUE} or
* {@link com.sun.org.apache.xpath.internal.objects.XBoolean#S_FALSE}.
*
* @throws javax.xml.transform.TransformerException
*/ | AND two expressions and return the boolean result. Override superclass method for optimization purposes | execute | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xpath/internal/operations/And.java",
"license": "apache-2.0",
"size": 2363
} | [
"com.sun.org.apache.xpath.internal.XPathContext",
"com.sun.org.apache.xpath.internal.objects.XBoolean",
"com.sun.org.apache.xpath.internal.objects.XObject"
] | import com.sun.org.apache.xpath.internal.XPathContext; import com.sun.org.apache.xpath.internal.objects.XBoolean; import com.sun.org.apache.xpath.internal.objects.XObject; | import com.sun.org.apache.xpath.internal.*; import com.sun.org.apache.xpath.internal.objects.*; | [
"com.sun.org"
] | com.sun.org; | 2,002,646 |
@Test
public void test_getReversedPayment() {
Boolean value = true;
instance.setReversedPayment(value);
assertEquals("'getReversedPayment' should be correct.",
value, instance.getReversedPayment());
} | void function() { Boolean value = true; instance.setReversedPayment(value); assertEquals(STR, value, instance.getReversedPayment()); } | /**
* <p>
* Accuracy test for the method <code>getReversedPayment()</code>.<br>
* The value should be properly retrieved.
* </p>
*/ | Accuracy test for the method <code>getReversedPayment()</code>. The value should be properly retrieved. | test_getReversedPayment | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/Data_Migration/src/java/tests/gov/opm/scrd/entities/application/BatchDailyPaymentsUnitTests.java",
"license": "apache-2.0",
"size": 19516
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,694,535 |
public String getKickstartHost() {
log.debug("KickstartHelper.getKickstartHost()");
// Example proxy header:
// X-RHN-Proxy-Auth : 1006681409::1151513167.96:21600.0:VV/xF
// NEmCYOuHxEBAs7BEw==:fjs-0-08.rhndev.redhat.com,1006681408
// ::1151513034.3:21600.0:w2lm+XWSFJMVCGBK1dZXXQ==:fjs-0-11.
// rhndev.redhat.com,1006678487::1152567362.02:21600.0:t15l
// gsaTRKpX6AxkUFQ11A==:fjs-0-12.rhndev.redhat.com
String proxyHeader = request.getHeader(XRHNPROXYAUTH);
log.debug("X-RHN-Proxy-Auth : " + proxyHeader);
if (!StringUtils.isEmpty(proxyHeader)) {
String[] proxies = StringUtils.split(proxyHeader, ",");
String firstProxy = proxies[0];
// Now we have: 1006681409::1151513167.96:21600.0:VV/xF
// NEmCYOuHxEBAs7BEw==:fjs-0-08.rhndev.redhat.com
log.debug("first1: " + firstProxy);
String[] chunks = StringUtils.split(firstProxy, ":");
firstProxy = chunks[chunks.length - 1];
log.debug("first2: " + firstProxy);
log.debug("Kickstart host from proxy header: " + firstProxy);
return firstProxy;
}
return ConfigDefaults.get().getCobblerHost();
} | String function() { log.debug(STR); String proxyHeader = request.getHeader(XRHNPROXYAUTH); log.debug(STR + proxyHeader); if (!StringUtils.isEmpty(proxyHeader)) { String[] proxies = StringUtils.split(proxyHeader, ","); String firstProxy = proxies[0]; log.debug(STR + firstProxy); String[] chunks = StringUtils.split(firstProxy, ":"); firstProxy = chunks[chunks.length - 1]; log.debug(STR + firstProxy); log.debug(STR + firstProxy); return firstProxy; } return ConfigDefaults.get().getCobblerHost(); } | /**
* Get the kickstart host to use. Will use the host of the proxy if the header is
* present. If not the code then resorts to getting the cobbler hostname from our
* rhn.conf Config.
*
* @return String representing the Kickstart Host
*/ | Get the kickstart host to use. Will use the host of the proxy if the header is present. If not the code then resorts to getting the cobbler hostname from our rhn.conf Config | getKickstartHost | {
"repo_name": "dmacvicar/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/action/kickstart/KickstartHelper.java",
"license": "gpl-2.0",
"size": 18328
} | [
"com.redhat.rhn.common.conf.ConfigDefaults",
"org.apache.commons.lang.StringUtils"
] | import com.redhat.rhn.common.conf.ConfigDefaults; import org.apache.commons.lang.StringUtils; | import com.redhat.rhn.common.conf.*; import org.apache.commons.lang.*; | [
"com.redhat.rhn",
"org.apache.commons"
] | com.redhat.rhn; org.apache.commons; | 67,980 |
protected BatchDailyPayments getBatchDailyPayments() {
BatchDailyPayments entity = new BatchDailyPayments();
entity.setAuditBatchId(1L);
entity.setPayTransactionKey(1);
entity.setNumberPaymentToday(1);
entity.setBatchTime(new Date());
entity.setAccountStatus(getAccountStatus());
create(entity.getAccountStatus());
entity.setPayTransStatusCode(1);
entity.setClaimNumber("claimNumber1");
entity.setAccountBalance(BigDecimal.ONE);
entity.setOverPaymentAmount(BigDecimal.ONE);
entity.setAchPayment(true);
entity.setAchStopLetter(true);
entity.setPrintInvoice(true);
entity.setRefundRequired(true);
entity.setReversedPayment(true);
entity.setUpdateToCompleted(true);
entity.setPrintInitialBill(true);
entity.setLatestBatch(true);
entity.setErrorProcessing(true);
return entity;
} | BatchDailyPayments function() { BatchDailyPayments entity = new BatchDailyPayments(); entity.setAuditBatchId(1L); entity.setPayTransactionKey(1); entity.setNumberPaymentToday(1); entity.setBatchTime(new Date()); entity.setAccountStatus(getAccountStatus()); create(entity.getAccountStatus()); entity.setPayTransStatusCode(1); entity.setClaimNumber(STR); entity.setAccountBalance(BigDecimal.ONE); entity.setOverPaymentAmount(BigDecimal.ONE); entity.setAchPayment(true); entity.setAchStopLetter(true); entity.setPrintInvoice(true); entity.setRefundRequired(true); entity.setReversedPayment(true); entity.setUpdateToCompleted(true); entity.setPrintInitialBill(true); entity.setLatestBatch(true); entity.setErrorProcessing(true); return entity; } | /**
* Creates an instance of BatchDailyPayments.
*
* @return the BatchDailyPayments instance.
*
* @since 1.1 (OPM - Data Migration - Entities Update Module Assembly 1.0)
*/ | Creates an instance of BatchDailyPayments | getBatchDailyPayments | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/BasePersistenceTests.java",
"license": "apache-2.0",
"size": 58033
} | [
"gov.opm.scrd.entities.application.BatchDailyPayments",
"java.math.BigDecimal",
"java.util.Date"
] | import gov.opm.scrd.entities.application.BatchDailyPayments; import java.math.BigDecimal; import java.util.Date; | import gov.opm.scrd.entities.application.*; import java.math.*; import java.util.*; | [
"gov.opm.scrd",
"java.math",
"java.util"
] | gov.opm.scrd; java.math; java.util; | 801,020 |
@Override
public Uri insert(Uri uri, ContentValues initialValues) {
if( ! initializeDB() ) {
Log.w(AUTHORITY,"Database unavailable...");
return null;
}
ContentValues values = (initialValues != null) ? new ContentValues(
initialValues) : new ContentValues();
switch (sUriMatcher.match(uri)) {
case CALLS:
database.beginTransaction();
long call_id = database.insertWithOnConflict(DATABASE_TABLES[0],
Calls_Data.DEVICE_ID, values, SQLiteDatabase.CONFLICT_IGNORE);
database.setTransactionSuccessful();
database.endTransaction();
if (call_id > 0) {
Uri callsUri = ContentUris.withAppendedId(
Calls_Data.CONTENT_URI, call_id);
getContext().getContentResolver().notifyChange(callsUri, null);
return callsUri;
}
throw new SQLException("Failed to insert row into " + uri);
case MESSAGES:
database.beginTransaction();
long message_id = database.insertWithOnConflict(DATABASE_TABLES[1],
Messages_Data.DEVICE_ID, values, SQLiteDatabase.CONFLICT_IGNORE);
database.setTransactionSuccessful();
database.endTransaction();
if (message_id > 0) {
Uri messagesUri = ContentUris.withAppendedId(
Messages_Data.CONTENT_URI, message_id);
getContext().getContentResolver().notifyChange(messagesUri,
null);
return messagesUri;
}
throw new SQLException("Failed to insert row into " + uri);
default:
throw new IllegalArgumentException("Unknown URI " + uri);
}
} | Uri function(Uri uri, ContentValues initialValues) { if( ! initializeDB() ) { Log.w(AUTHORITY,STR); return null; } ContentValues values = (initialValues != null) ? new ContentValues( initialValues) : new ContentValues(); switch (sUriMatcher.match(uri)) { case CALLS: database.beginTransaction(); long call_id = database.insertWithOnConflict(DATABASE_TABLES[0], Calls_Data.DEVICE_ID, values, SQLiteDatabase.CONFLICT_IGNORE); database.setTransactionSuccessful(); database.endTransaction(); if (call_id > 0) { Uri callsUri = ContentUris.withAppendedId( Calls_Data.CONTENT_URI, call_id); getContext().getContentResolver().notifyChange(callsUri, null); return callsUri; } throw new SQLException(STR + uri); case MESSAGES: database.beginTransaction(); long message_id = database.insertWithOnConflict(DATABASE_TABLES[1], Messages_Data.DEVICE_ID, values, SQLiteDatabase.CONFLICT_IGNORE); database.setTransactionSuccessful(); database.endTransaction(); if (message_id > 0) { Uri messagesUri = ContentUris.withAppendedId( Messages_Data.CONTENT_URI, message_id); getContext().getContentResolver().notifyChange(messagesUri, null); return messagesUri; } throw new SQLException(STR + uri); default: throw new IllegalArgumentException(STR + uri); } } | /**
* Insert entry to the database
*/ | Insert entry to the database | insert | {
"repo_name": "cluo29/com.aware.plugin.trying",
"path": "aware-core/src/main/java/com/aware/providers/Communication_Provider.java",
"license": "apache-2.0",
"size": 11399
} | [
"android.content.ContentUris",
"android.content.ContentValues",
"android.database.SQLException",
"android.database.sqlite.SQLiteDatabase",
"android.net.Uri",
"android.util.Log"
] | import android.content.ContentUris; import android.content.ContentValues; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.util.Log; | import android.content.*; import android.database.*; import android.database.sqlite.*; import android.net.*; import android.util.*; | [
"android.content",
"android.database",
"android.net",
"android.util"
] | android.content; android.database; android.net; android.util; | 2,905,392 |
public void write(byte[] buffer) {
try {
mmOutStream.write(buffer);
} catch (IOException e) {
Log.e(TAG, "Exception during write", e);
}
}
} | void function(byte[] buffer) { try { mmOutStream.write(buffer); } catch (IOException e) { Log.e(TAG, STR, e); } } } | /**
* Write to the connected OutStream.
* @param buffer The bytes to write
*/ | Write to the connected OutStream | write | {
"repo_name": "myHealthAssistant-tudarmstadt/myHealthHub",
"path": "src/de/tudarmstadt/dvs/myhealthassistant/myhealthhub/sensormodules/AbstractBluetoothSensorModule.java",
"license": "gpl-3.0",
"size": 19791
} | [
"android.util.Log",
"java.io.IOException"
] | import android.util.Log; import java.io.IOException; | import android.util.*; import java.io.*; | [
"android.util",
"java.io"
] | android.util; java.io; | 1,871,322 |
public Operator getOperator(); | Operator function(); | /**
* Get the expression operator.
*
* @return the logical operator for the expression
*/ | Get the expression operator | getOperator | {
"repo_name": "zouzhberk/ambaridemo",
"path": "demo-server/src/main/java/org/apache/ambari/server/api/predicate/expressions/Expression.java",
"license": "apache-2.0",
"size": 2775
} | [
"org.apache.ambari.server.api.predicate.operators.Operator"
] | import org.apache.ambari.server.api.predicate.operators.Operator; | import org.apache.ambari.server.api.predicate.operators.*; | [
"org.apache.ambari"
] | org.apache.ambari; | 2,190,922 |
public Bitmap getScaleBitmap(int w, int h) {
this.setDrawingCacheEnabled(false);
this.setDrawingCacheEnabled(true);
return Bitmap.createScaledBitmap(this.getDrawingCache(), w, h, true);
} | Bitmap function(int w, int h) { this.setDrawingCacheEnabled(false); this.setDrawingCacheEnabled(true); return Bitmap.createScaledBitmap(this.getDrawingCache(), w, h, true); } | /**
* This method gets current canvas as scaled bitmap.
*
* @return This is returned as scaled bitmap.
*/ | This method gets current canvas as scaled bitmap | getScaleBitmap | {
"repo_name": "Alexendoo/Slide",
"path": "app/src/main/java/me/ccrama/redditslide/Views/CanvasView.java",
"license": "gpl-3.0",
"size": 23453
} | [
"android.graphics.Bitmap"
] | import android.graphics.Bitmap; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,128,488 |
public RequestCreator placeholder(@DrawableRes int placeholderResId) {
if (!setPlaceholder) {
throw new IllegalStateException("Already explicitly declared as no placeholder.");
}
if (placeholderResId == 0) {
throw new IllegalArgumentException("Placeholder image resource invalid.");
}
if (placeholderDrawable != null) {
throw new IllegalStateException("Placeholder image already set.");
}
this.placeholderResId = placeholderResId;
return this;
} | RequestCreator function(@DrawableRes int placeholderResId) { if (!setPlaceholder) { throw new IllegalStateException(STR); } if (placeholderResId == 0) { throw new IllegalArgumentException(STR); } if (placeholderDrawable != null) { throw new IllegalStateException(STR); } this.placeholderResId = placeholderResId; return this; } | /**
* A placeholder drawable to be used while the image is being loaded. If the requested image is
* not immediately available in the memory cache then this resource will be set on the target
* {@link ImageView}.
*/ | A placeholder drawable to be used while the image is being loaded. If the requested image is not immediately available in the memory cache then this resource will be set on the target <code>ImageView</code> | placeholder | {
"repo_name": "MaTriXy/picasso",
"path": "picasso/src/main/java/com/squareup/picasso/RequestCreator.java",
"license": "apache-2.0",
"size": 28386
} | [
"android.support.annotation.DrawableRes"
] | import android.support.annotation.DrawableRes; | import android.support.annotation.*; | [
"android.support"
] | android.support; | 2,040,816 |
public static Player loadGame(String file) throws ClassNotFoundException,
IOException, InterruptedException {
File check = new File(System.getProperty("user.dir")+"/door_saves/" + file
+ ".ser");
if(!check.exists()) {
System.out.println("No game file found or game is corrupted.");
main(argsInternal);
}
FileInputStream fileIn = new FileInputStream(System.getProperty("user.dir")+"/door_saves/" + file
+ ".ser");
ObjectInputStream input = new ObjectInputStream(fileIn);
player = (Player) input.readObject();
player.setScanner(in);
setPlayer(player);
player.resetRandom();
input.close();
fileIn.close();
return player;
}
| static Player function(String file) throws ClassNotFoundException, IOException, InterruptedException { File check = new File(System.getProperty(STR)+STR + file + ".ser"); if(!check.exists()) { System.out.println(STR); main(argsInternal); } FileInputStream fileIn = new FileInputStream(System.getProperty(STR)+STR + file + ".ser"); ObjectInputStream input = new ObjectInputStream(fileIn); player = (Player) input.readObject(); player.setScanner(in); setPlayer(player); player.resetRandom(); input.close(); fileIn.close(); return player; } | /**
* Loads the player in from a saved .ser file
*
* @param name
* @param command
* @throws IOException
* @throws ClassNotFoundException
* @throws InterruptedException
*/ | Loads the player in from a saved .ser file | loadGame | {
"repo_name": "incomingstick/Doors",
"path": "src/Game.java",
"license": "mit",
"size": 5736
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.ObjectInputStream"
] | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.ObjectInputStream; | import java.io.*; | [
"java.io"
] | java.io; | 797,644 |
log.info("BaseShortenedUrlService init()");
String implementingClass = serverConfigurationService.getString(ShortenedUrlService.IMPLEMENTATION_PROP_NAME, ShortenedUrlService.DEFAULT_IMPLEMENTATION);
service = (ShortenedUrlService) ComponentManager.get(implementingClass);
log.info("BaseShortenedUrlService init(): Registered implementation: " + implementingClass);
}
/**
* @{inheritDoc} | log.info(STR); String implementingClass = serverConfigurationService.getString(ShortenedUrlService.IMPLEMENTATION_PROP_NAME, ShortenedUrlService.DEFAULT_IMPLEMENTATION); service = (ShortenedUrlService) ComponentManager.get(implementingClass); log.info(STR + implementingClass); } /** * @{inheritDoc} | /**
* This init method sets up the implementing class that will be used.
*/ | This init method sets up the implementing class that will be used | init | {
"repo_name": "OpenCollabZA/sakai",
"path": "shortenedurl/impl/src/java/org/sakaiproject/shortenedurl/impl/BaseShortenedUrlService.java",
"license": "apache-2.0",
"size": 2334
} | [
"org.sakaiproject.component.cover.ComponentManager",
"org.sakaiproject.shortenedurl.api.ShortenedUrlService"
] | import org.sakaiproject.component.cover.ComponentManager; import org.sakaiproject.shortenedurl.api.ShortenedUrlService; | import org.sakaiproject.component.cover.*; import org.sakaiproject.shortenedurl.api.*; | [
"org.sakaiproject.component",
"org.sakaiproject.shortenedurl"
] | org.sakaiproject.component; org.sakaiproject.shortenedurl; | 2,501,085 |
public void addOnFocusChangeListener(View.OnFocusChangeListener focusChangeListener){
if(onFocusChangeListeners == null){
onFocusChangeListeners = new LinkedList<View.OnFocusChangeListener>();
}
onFocusChangeListeners.add(focusChangeListener);
} | void function(View.OnFocusChangeListener focusChangeListener){ if(onFocusChangeListeners == null){ onFocusChangeListeners = new LinkedList<View.OnFocusChangeListener>(); } onFocusChangeListeners.add(focusChangeListener); } | /**
* Add a listener that will be called upon when the focus of this binding changes
* @param focusChangeListener The listener object that will be notified of the change
*/ | Add a listener that will be called upon when the focus of this binding changes | addOnFocusChangeListener | {
"repo_name": "ProjectGroep1/Joetz-Android-V2",
"path": "Joetz_Android_V2/app/src/main/java/com/example/jens/myapplication/domain/binding/ValidatorBinding.java",
"license": "gpl-2.0",
"size": 5958
} | [
"android.view.View",
"java.util.LinkedList"
] | import android.view.View; import java.util.LinkedList; | import android.view.*; import java.util.*; | [
"android.view",
"java.util"
] | android.view; java.util; | 1,387,801 |
public Editor edit() throws IOException {
return DiskLruCache.this.edit(key, sequenceNumber);
} | Editor function() throws IOException { return DiskLruCache.this.edit(key, sequenceNumber); } | /**
* Returns an editor for this snapshot's entry, or null if either the
* entry has changed since this snapshot was created or if another edit
* is in progress.
*/ | Returns an editor for this snapshot's entry, or null if either the entry has changed since this snapshot was created or if another edit is in progress | edit | {
"repo_name": "IsaacRF/EpicBitmapRenderer",
"path": "epicbitmaprenderer/src/main/java/com/isaacrf/epicbitmaprenderer/utils/DiskLruCache.java",
"license": "apache-2.0",
"size": 41221
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,215,430 |
public void releaseLock() {
mLockGUI.release();
}
///////////////////////////////////////////////
//Constructors
///////////////////////////////////////////////
public InfoTab( FLAMEClient client,
int analysis_id,
String analysis_type,
String value_type,
Display display,
final Shell shell,
int mag,
TabFolder tabFolder,
boolean xteamGUISwitch,
boolean twoColumnMode,
ScreenLogger screenLogger) {
String font_face = "Courier New";
int font_size = 9;
mLockGUI = new Semaphore (1, true);
c = client;
sl = screenLogger;
this.display = display;
this.analysis_id = analysis_id;
this.analysis_type = analysis_type;
this.xteamGUISwitch = xteamGUISwitch;
this.twoColumnMode = twoColumnMode;
int x_size = 235; // horizontal size
int x_gap = 10; // horizontal gap
int y_size = 16;
String tabName = analysis_type;
String groupName = analysis_type + " Analysis";
// Initialize the tab
tabItem = new TabItem (tabFolder, SWT.NULL);
tabItem.setText(tabName);
// create a group that covers the entire tab
group = new Group(tabFolder, SWT.NONE);
group.setText(groupName);
// XTEAM GUI switched off message
String switchedOffMsg = "DISABLED BY CONFIGURATION";
// last versions
Label labelLVTitle = new Label(group, SWT.NONE);
labelLVTitle.setText("Commit counts:");
labelLVTitle.setSize(x_size * mag, 20 * mag);
labelLVTitle.setLocation(x_gap * mag, 35 * mag);
listLV = new List(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
listLV.setFont(new Font(display, font_face, font_size, SWT.NONE));
listLV.setSize(x_size * mag, 60 * mag);
listLV.setLocation(x_gap * mag, 55 * mag);
// Snapshot history
Label labelSHTitle = new Label(group, SWT.NONE);
labelSHTitle.setText("Commit history:");
labelSHTitle.setSize(x_size * mag, 20 * mag);
labelSHTitle.setLocation(x_gap * mag, 120 * mag);
listSH = new List(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
listSH.setFont(new Font(display, font_face, font_size, SWT.NONE));
listSH.setSize(x_size * mag, 150 * mag);
listSH.setLocation(x_gap * mag, 140 * mag);
/////////////////////////////////////////////////////////////////////
// MRSV Fields
/////////////////////////////////////////////////////////////////////
// MRSV overall
Label labelMRSVTitle = new Label(group, SWT.NONE);
labelMRSVTitle.setText("Most recent version:");
labelMRSVTitle.setSize(x_size * mag, 20 * mag);
labelMRSVTitle.setLocation((x_gap * 2 + x_size) * mag, 35 * mag);
labelMRSVOverall = new Label(group, SWT.BORDER);
labelMRSVOverall.setBackground(new Color(display, new RGB(230,230,230)));
labelMRSVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE));
labelMRSVOverall.setSize(x_size * mag, 60 * mag);
labelMRSVOverall.setLocation((x_gap * 2 + x_size) * mag, 55 * mag);
if(!xteamGUISwitch) {
labelMRSVOverall.setText(switchedOffMsg);
labelMRSVOverall.setEnabled(false);
}
// MRSV element list
Label labelMRSVelement = new Label(group, SWT.NONE);
labelMRSVelement.setText(value_type + " " + analysis_type.toLowerCase() + " values:");
labelMRSVelement.setSize(x_size * mag, 20 * mag);
labelMRSVelement.setLocation((x_gap * 2 + x_size) * mag, 120 * mag);
listMRSV = new List(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
listMRSV.setFont(new Font(display, font_face, font_size, SWT.NONE));
listMRSV.setSize(x_size * mag, (150-y_size) * mag);
listMRSV.setLocation((x_gap * 2 + x_size) * mag, 140 * mag);
if(!xteamGUISwitch) {
listMRSV.add(switchedOffMsg);
listMRSV.setEnabled(false);
}
// MRSV simulation status
labelMRSVSimStatus = new Label(group, SWT.BORDER_SOLID);
labelMRSVSimStatus.setText("MRSV Sim Stat");
labelMRSVSimStatus.setSize(x_size * mag, y_size * mag);
labelMRSVSimStatus.setLocation((x_gap * 2 + x_size) * mag, (290-y_size) * mag);
labelMRSVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
/////////////////////////////////////////////////////////////////////
// LSV Fields
/////////////////////////////////////////////////////////////////////
// LSV overall
Label labelLSVTitle = new Label(group, SWT.NONE);
labelLSVTitle.setText("Last committed version:");
labelLSVTitle.setSize(x_size * mag, 20 * mag);
labelLSVTitle.setLocation((x_size * 2 + x_gap * 3) * mag, 35 * mag);
labelLSVOverall = new Label(group, SWT.BORDER);
labelLSVOverall.setBackground(new Color(display, new RGB(230,230,230)));
labelLSVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE));
labelLSVOverall.setSize(x_size * mag, 60 * mag);
labelLSVOverall.setLocation((x_size * 2 + x_gap * 3) * mag, 55 * mag);
if(!xteamGUISwitch) {
labelLSVOverall.setText(switchedOffMsg);
labelLSVOverall.setEnabled(false);
}
// LSV element list
Label labelLSVelement = new Label(group, SWT.NONE);
labelLSVelement.setText(value_type + " " + analysis_type.toLowerCase() + " values:");
labelLSVelement.setSize(x_size * mag, 20 * mag);
labelLSVelement.setLocation((x_size * 2 + x_gap * 3) * mag, 120 * mag);
listLSV = new List(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
listLSV.setFont(new Font(display, font_face, font_size, SWT.NONE));
listLSV.setSize(x_size * mag, (150-y_size) * mag);
listLSV.setLocation((x_size * 2 + x_gap * 3) * mag, 140 * mag);
if(!xteamGUISwitch) {
listLSV.add(switchedOffMsg);
listLSV.setEnabled(false);
}
// LSV simulation status
labelLSVSimStatus = new Label(group, SWT.BORDER_SOLID);
labelLSVSimStatus.setText("LSV Sim Stat");
labelLSVSimStatus.setSize(x_size * mag, y_size * mag);
labelLSVSimStatus.setLocation((x_size * 2 + x_gap * 3) * mag, (290-y_size) * mag);
labelLSVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
/////////////////////////////////////////////////////////////////////
// LocalV Fields
/////////////////////////////////////////////////////////////////////
// LocalV overall
Label labelLocalVTitle = new Label(group, SWT.NONE);
labelLocalVTitle.setText("Local version:");
labelLocalVTitle.setSize(x_size * mag, 20 * mag);
labelLocalVTitle.setLocation((x_size * 3 + x_gap * 4) * mag, 35 * mag);
labelLocalVOverall = new Label(group, SWT.BORDER);
labelLocalVOverall.setBackground(new Color(display, new RGB(230,230,230)));
labelLocalVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE));
labelLocalVOverall.setSize(x_size * mag, 60 * mag);
labelLocalVOverall.setLocation((x_size * 3 + x_gap * 4) * mag, 55 * mag);
// LocalV element list
Label labelLocalVelement = new Label(group, SWT.NONE);
labelLocalVelement.setText(value_type + " " + analysis_type.toLowerCase() + " values:");
labelLocalVelement.setSize(x_size * mag, 20 * mag);
labelLocalVelement.setLocation((x_size * 3 + x_gap * 4) * mag, 120 * mag);
listLocalV = new List(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
listLocalV.setFont(new Font(display, font_face, font_size, SWT.NONE));
listLocalV.setSize(x_size * mag, (150-y_size) * mag);
listLocalV.setLocation((x_size * 3 + x_gap * 4) * mag, 140 * mag);
// LocalV simulation status
labelLocalVSimStatus = new Label(group, SWT.BORDER_SOLID);
labelLocalVSimStatus.setText("LocalV Sim Stat");
labelLocalVSimStatus.setSize(x_size * mag, y_size * mag);
labelLocalVSimStatus.setLocation((x_size * 3 + x_gap * 4) * mag, (290-y_size) * mag);
labelLocalVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY));
/////////////////////////////////////////////////////////////////////
// Syntactic Conflict Fields
/////////////////////////////////////////////////////////////////////
// Global syntactic conflict list
labelGlobalSCLTitle = new Label(group, SWT.NONE);
labelGlobalSCLTitle.setText("Global syntax errors (from MRV)");
labelGlobalSCLTitle.setSize((x_size*4 + x_gap*3) * mag, 20 * mag);
labelGlobalSCLTitle.setLocation(x_gap * mag, 295 * mag);
tableGlobalSCL = new Table(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tableGlobalSCL.setFont(new Font(display, font_face, font_size, SWT.NONE));
tableGlobalSCL.setSize((x_size*4 + x_gap*3) * mag, 100 * mag);
tableGlobalSCL.setLocation(x_gap * mag, 315 * mag);
if(!xteamGUISwitch) {
TableItem item = new TableItem(tableGlobalSCL, SWT.None);
item.setText(switchedOffMsg);
tableGlobalSCL.setEnabled(false);
}
// Local syntactic conflict list
labelLocalSCLTitle = new Label(group, SWT.NONE);
labelLocalSCLTitle.setText("Local syntax errors (from LocalV)");
labelLocalSCLTitle.setSize((x_size*4 + x_gap*3) * mag, 20 * mag);
labelLocalSCLTitle.setLocation(x_gap * mag, 425 * mag);
tableLocalSCL = new Table(group, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
tableLocalSCL.setFont(new Font(display, font_face, font_size, SWT.NONE));
tableLocalSCL.setSize((x_size*4 + x_gap*3) * mag, 100 * mag);
tableLocalSCL.setLocation(x_gap * mag, 445 * mag);
// commit button
buttonSnapshot = new Button(group, SWT.PUSH);
buttonSnapshot.setLocation(x_gap * mag, 560 * mag);
buttonSnapshot.setSize(130 * mag, 23 * mag);
buttonSnapshot.setText("Commit");
| void function() { mLockGUI.release(); } public InfoTab( FLAMEClient client, int analysis_id, String analysis_type, String value_type, Display display, final Shell shell, int mag, TabFolder tabFolder, boolean xteamGUISwitch, boolean twoColumnMode, ScreenLogger screenLogger) { String font_face = STR; int font_size = 9; mLockGUI = new Semaphore (1, true); c = client; sl = screenLogger; this.display = display; this.analysis_id = analysis_id; this.analysis_type = analysis_type; this.xteamGUISwitch = xteamGUISwitch; this.twoColumnMode = twoColumnMode; int x_size = 235; int x_gap = 10; int y_size = 16; String tabName = analysis_type; String groupName = analysis_type + STR; tabItem = new TabItem (tabFolder, SWT.NULL); tabItem.setText(tabName); group = new Group(tabFolder, SWT.NONE); group.setText(groupName); String switchedOffMsg = STR; Label labelLVTitle = new Label(group, SWT.NONE); labelLVTitle.setText(STR); labelLVTitle.setSize(x_size * mag, 20 * mag); labelLVTitle.setLocation(x_gap * mag, 35 * mag); listLV = new List(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); listLV.setFont(new Font(display, font_face, font_size, SWT.NONE)); listLV.setSize(x_size * mag, 60 * mag); listLV.setLocation(x_gap * mag, 55 * mag); Label labelSHTitle = new Label(group, SWT.NONE); labelSHTitle.setText(STR); labelSHTitle.setSize(x_size * mag, 20 * mag); labelSHTitle.setLocation(x_gap * mag, 120 * mag); listSH = new List(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); listSH.setFont(new Font(display, font_face, font_size, SWT.NONE)); listSH.setSize(x_size * mag, 150 * mag); listSH.setLocation(x_gap * mag, 140 * mag); Label labelMRSVTitle = new Label(group, SWT.NONE); labelMRSVTitle.setText(STR); labelMRSVTitle.setSize(x_size * mag, 20 * mag); labelMRSVTitle.setLocation((x_gap * 2 + x_size) * mag, 35 * mag); labelMRSVOverall = new Label(group, SWT.BORDER); labelMRSVOverall.setBackground(new Color(display, new RGB(230,230,230))); labelMRSVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE)); labelMRSVOverall.setSize(x_size * mag, 60 * mag); labelMRSVOverall.setLocation((x_gap * 2 + x_size) * mag, 55 * mag); if(!xteamGUISwitch) { labelMRSVOverall.setText(switchedOffMsg); labelMRSVOverall.setEnabled(false); } Label labelMRSVelement = new Label(group, SWT.NONE); labelMRSVelement.setText(value_type + " " + analysis_type.toLowerCase() + STR); labelMRSVelement.setSize(x_size * mag, 20 * mag); labelMRSVelement.setLocation((x_gap * 2 + x_size) * mag, 120 * mag); listMRSV = new List(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); listMRSV.setFont(new Font(display, font_face, font_size, SWT.NONE)); listMRSV.setSize(x_size * mag, (150-y_size) * mag); listMRSV.setLocation((x_gap * 2 + x_size) * mag, 140 * mag); if(!xteamGUISwitch) { listMRSV.add(switchedOffMsg); listMRSV.setEnabled(false); } labelMRSVSimStatus = new Label(group, SWT.BORDER_SOLID); labelMRSVSimStatus.setText(STR); labelMRSVSimStatus.setSize(x_size * mag, y_size * mag); labelMRSVSimStatus.setLocation((x_gap * 2 + x_size) * mag, (290-y_size) * mag); labelMRSVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY)); Label labelLSVTitle = new Label(group, SWT.NONE); labelLSVTitle.setText(STR); labelLSVTitle.setSize(x_size * mag, 20 * mag); labelLSVTitle.setLocation((x_size * 2 + x_gap * 3) * mag, 35 * mag); labelLSVOverall = new Label(group, SWT.BORDER); labelLSVOverall.setBackground(new Color(display, new RGB(230,230,230))); labelLSVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE)); labelLSVOverall.setSize(x_size * mag, 60 * mag); labelLSVOverall.setLocation((x_size * 2 + x_gap * 3) * mag, 55 * mag); if(!xteamGUISwitch) { labelLSVOverall.setText(switchedOffMsg); labelLSVOverall.setEnabled(false); } Label labelLSVelement = new Label(group, SWT.NONE); labelLSVelement.setText(value_type + " " + analysis_type.toLowerCase() + STR); labelLSVelement.setSize(x_size * mag, 20 * mag); labelLSVelement.setLocation((x_size * 2 + x_gap * 3) * mag, 120 * mag); listLSV = new List(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); listLSV.setFont(new Font(display, font_face, font_size, SWT.NONE)); listLSV.setSize(x_size * mag, (150-y_size) * mag); listLSV.setLocation((x_size * 2 + x_gap * 3) * mag, 140 * mag); if(!xteamGUISwitch) { listLSV.add(switchedOffMsg); listLSV.setEnabled(false); } labelLSVSimStatus = new Label(group, SWT.BORDER_SOLID); labelLSVSimStatus.setText(STR); labelLSVSimStatus.setSize(x_size * mag, y_size * mag); labelLSVSimStatus.setLocation((x_size * 2 + x_gap * 3) * mag, (290-y_size) * mag); labelLSVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY)); Label labelLocalVTitle = new Label(group, SWT.NONE); labelLocalVTitle.setText(STR); labelLocalVTitle.setSize(x_size * mag, 20 * mag); labelLocalVTitle.setLocation((x_size * 3 + x_gap * 4) * mag, 35 * mag); labelLocalVOverall = new Label(group, SWT.BORDER); labelLocalVOverall.setBackground(new Color(display, new RGB(230,230,230))); labelLocalVOverall.setFont(new Font(display, font_face, font_size, SWT.NONE)); labelLocalVOverall.setSize(x_size * mag, 60 * mag); labelLocalVOverall.setLocation((x_size * 3 + x_gap * 4) * mag, 55 * mag); Label labelLocalVelement = new Label(group, SWT.NONE); labelLocalVelement.setText(value_type + " " + analysis_type.toLowerCase() + STR); labelLocalVelement.setSize(x_size * mag, 20 * mag); labelLocalVelement.setLocation((x_size * 3 + x_gap * 4) * mag, 120 * mag); listLocalV = new List(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); listLocalV.setFont(new Font(display, font_face, font_size, SWT.NONE)); listLocalV.setSize(x_size * mag, (150-y_size) * mag); listLocalV.setLocation((x_size * 3 + x_gap * 4) * mag, 140 * mag); labelLocalVSimStatus = new Label(group, SWT.BORDER_SOLID); labelLocalVSimStatus.setText(STR); labelLocalVSimStatus.setSize(x_size * mag, y_size * mag); labelLocalVSimStatus.setLocation((x_size * 3 + x_gap * 4) * mag, (290-y_size) * mag); labelLocalVSimStatus.setBackground(display.getSystemColor(SWT.COLOR_GRAY)); labelGlobalSCLTitle = new Label(group, SWT.NONE); labelGlobalSCLTitle.setText(STR); labelGlobalSCLTitle.setSize((x_size*4 + x_gap*3) * mag, 20 * mag); labelGlobalSCLTitle.setLocation(x_gap * mag, 295 * mag); tableGlobalSCL = new Table(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); tableGlobalSCL.setFont(new Font(display, font_face, font_size, SWT.NONE)); tableGlobalSCL.setSize((x_size*4 + x_gap*3) * mag, 100 * mag); tableGlobalSCL.setLocation(x_gap * mag, 315 * mag); if(!xteamGUISwitch) { TableItem item = new TableItem(tableGlobalSCL, SWT.None); item.setText(switchedOffMsg); tableGlobalSCL.setEnabled(false); } labelLocalSCLTitle = new Label(group, SWT.NONE); labelLocalSCLTitle.setText(STR); labelLocalSCLTitle.setSize((x_size*4 + x_gap*3) * mag, 20 * mag); labelLocalSCLTitle.setLocation(x_gap * mag, 425 * mag); tableLocalSCL = new Table(group, SWT.H_SCROLL SWT.V_SCROLL SWT.BORDER); tableLocalSCL.setFont(new Font(display, font_face, font_size, SWT.NONE)); tableLocalSCL.setSize((x_size*4 + x_gap*3) * mag, 100 * mag); tableLocalSCL.setLocation(x_gap * mag, 445 * mag); buttonSnapshot = new Button(group, SWT.PUSH); buttonSnapshot.setLocation(x_gap * mag, 560 * mag); buttonSnapshot.setSize(130 * mag, 23 * mag); buttonSnapshot.setText(STR); | /**
* Releases the outgoing Event semaphore
*/ | Releases the outgoing Event semaphore | releaseLock | {
"repo_name": "ronia/flame",
"path": "src/flame/client/xteam/InfoTab.java",
"license": "mit",
"size": 30289
} | [
"java.util.concurrent.Semaphore",
"org.eclipse.swt.graphics.Color",
"org.eclipse.swt.graphics.Font",
"org.eclipse.swt.widgets.Button",
"org.eclipse.swt.widgets.Display",
"org.eclipse.swt.widgets.Group",
"org.eclipse.swt.widgets.Label",
"org.eclipse.swt.widgets.List",
"org.eclipse.swt.widgets.Shell",
"org.eclipse.swt.widgets.TabFolder",
"org.eclipse.swt.widgets.TabItem",
"org.eclipse.swt.widgets.Table",
"org.eclipse.swt.widgets.TableItem"
] | import java.util.concurrent.Semaphore; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.eclipse.swt.widgets.Table; import org.eclipse.swt.widgets.TableItem; | import java.util.concurrent.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.widgets.*; | [
"java.util",
"org.eclipse.swt"
] | java.util; org.eclipse.swt; | 1,294,532 |
boolean supersedes(final long primaryTerm, final long version) {
return this.primaryTerm > primaryTerm || this.primaryTerm == primaryTerm && this.version > version;
}
private final Map<String, RetentionLease> leases; | boolean supersedes(final long primaryTerm, final long version) { return this.primaryTerm > primaryTerm this.primaryTerm == primaryTerm && this.version > version; } private final Map<String, RetentionLease> leases; | /**
* Checks if this retention leases collection would supersede a retention leases collection with the specified primary term and version.
* A retention leases collection supersedes another retention leases collection if its primary term is higher, or if for equal primary
* terms its version is higher.
*
* @param primaryTerm the primary term
* @param version the version
* @return true if this retention leases collection would supercedes a retention lease collection with the specified primary term and
* version
*/ | Checks if this retention leases collection would supersede a retention leases collection with the specified primary term and version. A retention leases collection supersedes another retention leases collection if its primary term is higher, or if for equal primary terms its version is higher | supersedes | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/seqno/RetentionLeases.java",
"license": "apache-2.0",
"size": 10595
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,905,522 |
public Ipv4[] getIpv4InterfaceProperties(Ipv4 inet) {
Ipv4[] res = new Ipv4[3];
try {
// We launch the ifconfig each time.
launch_ifconfig();
// We get the data from the ifconfig.
BufferedReader b = new BufferedReader(new InputStreamReader(datas));
// We iterate over the datas.
String line = "";
String inter[];
while ((line = b.readLine()) != null) {
// The line we want contains "inet adr:".
if (line.contains("inet adr:" + inet.toString())) {
// We remove the bad informations from the line to only let
// the wanted remains.
line = line.replace("inet adr:", "").replace("Bcast:", "")
.replace("Masque:", "");
inter = line.split(" ");
res[0] = new Ipv4(inter[inter.length - 5]);
res[1] = new Ipv4(inter[inter.length - 3]);
res[2] = new Ipv4(inter[inter.length - 1]);
return res;
}
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return null;
} | Ipv4[] function(Ipv4 inet) { Ipv4[] res = new Ipv4[3]; try { launch_ifconfig(); BufferedReader b = new BufferedReader(new InputStreamReader(datas)); String line = STRinet adr:STRinet adr:STRSTRBcast:STRSTRMasque:STRSTR "); res[0] = new Ipv4(inter[inter.length - 5]); res[1] = new Ipv4(inter[inter.length - 3]); res[2] = new Ipv4(inter[inter.length - 1]); return res; } } } catch (IllegalArgumentException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } | /**
* The detail of the ipv4 interface with the address inet given in String.
* Don't work for the loopback address inet.
*
* @return A list of the ipv4 interface and her three parameters in an array
* of three strings with the address inet, the address broadcast and
* the address mask. Null if no inet corresponding.
*/ | The detail of the ipv4 interface with the address inet given in String. Don't work for the loopback address inet | getIpv4InterfaceProperties | {
"repo_name": "prometheus45/Alien_in_town",
"path": "trunk/jimmy/Aliens_in_town/src/com/ludosimp/aliens_in_town/models/InterfacesProperties.java",
"license": "mit",
"size": 3887
} | [
"java.io.BufferedReader",
"java.io.IOException",
"java.io.InputStreamReader"
] | import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
] | java.io; | 2,339,662 |
public void addTracks(List<Track> tracks, PanelName panelName) {
TrackPanel panel = getTrackPanel(panelName.getName());
panel.addTracks(tracks);
doRefresh();
} | void function(List<Track> tracks, PanelName panelName) { TrackPanel panel = getTrackPanel(panelName.getName()); panel.addTracks(tracks); doRefresh(); } | /**
* Add tracks to the specified panel
*
* @param tracks
* @param panelName
* @api
*/ | Add tracks to the specified panel | addTracks | {
"repo_name": "popitsch/varan-gie",
"path": "src/org/broad/igv/ui/IGV.java",
"license": "mit",
"size": 83654
} | [
"java.util.List",
"org.broad.igv.track.Track",
"org.broad.igv.ui.panel.TrackPanel"
] | import java.util.List; import org.broad.igv.track.Track; import org.broad.igv.ui.panel.TrackPanel; | import java.util.*; import org.broad.igv.track.*; import org.broad.igv.ui.panel.*; | [
"java.util",
"org.broad.igv"
] | java.util; org.broad.igv; | 61,659 |
private static Instances getMultiDimContinuousDiv(ArrayList<Attribute> atts, int sampleSetSize, boolean useMid){
int L = Math.min(7, Math.max(sampleSetSize, atts.size()));//7 is chosen for no special reason
double maxMinDist = 0, crntMinDist;//work as the threshold to select the sample set
ArrayList<Integer>[] setWithMaxMinDist=null;
//generate L sets of sampleSetSize points
for(int i=0; i<L; i++){
ArrayList<Integer>[] setPerm = generateOneSampleSet(sampleSetSize, atts.size());
//compute the minimum distance minDist between any sample pair for each set
crntMinDist = minDistForSet(setPerm);
//select the set with the maximum minDist
if(crntMinDist>maxMinDist){
setWithMaxMinDist = setPerm;
maxMinDist = crntMinDist;
}
}
//generate and output the set with the maximum minDist as the result
//first, divide the domain of each attribute into sampleSetSize equal subdomain
double[][] bounds = new double[atts.size()][sampleSetSize+1];//sampleSetSize+1 to include the lower and upper bounds
Iterator<Attribute> itr = atts.iterator();
Attribute crntAttr;
double pace;
for(int i=0;i<bounds.length;i++){
crntAttr = itr.next();
bounds[i][0] = crntAttr.getLowerNumericBound();
bounds[i][sampleSetSize] = crntAttr.getUpperNumericBound();
pace = (bounds[i][sampleSetSize] - bounds[i][0])/sampleSetSize;
for(int j=1;j<sampleSetSize;j++){
bounds[i][j] = bounds[i][j-1] + pace;
}
}
//second, generate the set according to setWithMaxMinDist
Instances data = new Instances("InitialSetByLHS", atts, sampleSetSize);
for(int i=0;i<sampleSetSize;i++){
double[] vals = new double[atts.size()];
for(int j=0;j<vals.length;j++){
vals[j] = useMid?
(bounds[j][setWithMaxMinDist[j].get(i)]+bounds[j][setWithMaxMinDist[j].get(i)+1])/2:
bounds[j][setWithMaxMinDist[j].get(i)]+
(
(bounds[j][setWithMaxMinDist[j].get(i)+1]-bounds[j][setWithMaxMinDist[j].get(i)])*uniRand.nextDouble()
);
}
data.add(new DenseInstance(1.0, vals));
}
//third, return the generated points
return data;
}
| static Instances function(ArrayList<Attribute> atts, int sampleSetSize, boolean useMid){ int L = Math.min(7, Math.max(sampleSetSize, atts.size())); double maxMinDist = 0, crntMinDist; ArrayList<Integer>[] setWithMaxMinDist=null; for(int i=0; i<L; i++){ ArrayList<Integer>[] setPerm = generateOneSampleSet(sampleSetSize, atts.size()); crntMinDist = minDistForSet(setPerm); if(crntMinDist>maxMinDist){ setWithMaxMinDist = setPerm; maxMinDist = crntMinDist; } } double[][] bounds = new double[atts.size()][sampleSetSize+1]; Iterator<Attribute> itr = atts.iterator(); Attribute crntAttr; double pace; for(int i=0;i<bounds.length;i++){ crntAttr = itr.next(); bounds[i][0] = crntAttr.getLowerNumericBound(); bounds[i][sampleSetSize] = crntAttr.getUpperNumericBound(); pace = (bounds[i][sampleSetSize] - bounds[i][0])/sampleSetSize; for(int j=1;j<sampleSetSize;j++){ bounds[i][j] = bounds[i][j-1] + pace; } } Instances data = new Instances(STR, atts, sampleSetSize); for(int i=0;i<sampleSetSize;i++){ double[] vals = new double[atts.size()]; for(int j=0;j<vals.length;j++){ vals[j] = useMid? (bounds[j][setWithMaxMinDist[j].get(i)]+bounds[j][setWithMaxMinDist[j].get(i)+1])/2: bounds[j][setWithMaxMinDist[j].get(i)]+ ( (bounds[j][setWithMaxMinDist[j].get(i)+1]-bounds[j][setWithMaxMinDist[j].get(i)])*uniRand.nextDouble() ); } data.add(new DenseInstance(1.0, vals)); } return data; } | /**
* At current version, we assume all attributes are numeric attributes with bounds
*
* Let PACE be upper-lower DIVided by the sampleSetSize
*
* @param useMid true if to use the middle point of a subdomain, false if to use a random point within a subdomain
*/ | At current version, we assume all attributes are numeric attributes with bounds Let PACE be upper-lower DIVided by the sampleSetSize | getMultiDimContinuousDiv | {
"repo_name": "zhuyuqing/bestconf",
"path": "src/main/cn/ict/zyq/bestConf/bestConf/sampler/LHSSampler.java",
"license": "apache-2.0",
"size": 17002
} | [
"java.util.ArrayList",
"java.util.Iterator"
] | import java.util.ArrayList; import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 564,654 |
protected NotificationWidgetEvent getEvent() {
Cursor cursor = null;
NotificationWidgetEvent event = null;
try {
cursor = getEventCursor();
if (cursor == null) {
return null;
}
event = new NotificationWidgetEvent(mContext);
// Get the contact Uri
event.setContactReference(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.CONTACTS_REFERENCE)));
// Display name
event.setName(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.DISPLAY_NAME)));
// Contact picture
event.setProfileImageUri(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.PROFILE_IMAGE_URI)));
// Title
event.setTitle(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.TITLE)));
// Message
event.setMessage(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.MESSAGE)));
// Time
event.setTime(cursor.getLong(cursor
.getColumnIndexOrThrow(Notification.EventColumns.PUBLISHED_TIME)));
// Count
event.setCount(getCount());
// Source id
event.setSourceId(cursor.getLong(cursor
.getColumnIndexOrThrow(Notification.EventColumns.SOURCE_ID)));
// Friend key
event.setFriendKey(cursor.getString(cursor
.getColumnIndexOrThrow(Notification.EventColumns.FRIEND_KEY)));
} catch (SQLException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query events", e);
}
} catch (SecurityException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query events", e);
}
} catch (IllegalArgumentException e) {
if (Dbg.DEBUG) {
Dbg.w("Failed to query events", e);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
return event;
}
| NotificationWidgetEvent function() { Cursor cursor = null; NotificationWidgetEvent event = null; try { cursor = getEventCursor(); if (cursor == null) { return null; } event = new NotificationWidgetEvent(mContext); event.setContactReference(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.CONTACTS_REFERENCE))); event.setName(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.DISPLAY_NAME))); event.setProfileImageUri(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.PROFILE_IMAGE_URI))); event.setTitle(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.TITLE))); event.setMessage(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.MESSAGE))); event.setTime(cursor.getLong(cursor .getColumnIndexOrThrow(Notification.EventColumns.PUBLISHED_TIME))); event.setCount(getCount()); event.setSourceId(cursor.getLong(cursor .getColumnIndexOrThrow(Notification.EventColumns.SOURCE_ID))); event.setFriendKey(cursor.getString(cursor .getColumnIndexOrThrow(Notification.EventColumns.FRIEND_KEY))); } catch (SQLException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (SecurityException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } catch (IllegalArgumentException e) { if (Dbg.DEBUG) { Dbg.w(STR, e); } } finally { if (cursor != null) { cursor.close(); } } return event; } | /**
* Get the widget event to show.
*
* @return The widget event to show.
*/ | Get the widget event to show | getEvent | {
"repo_name": "BAILOOL/Assistant-for-People-with-Low-Vision",
"path": "GlassApp/smartExtensionUtils/src/main/java/com/sonyericsson/extras/liveware/extension/util/widget/NotificationWidgetExtension.java",
"license": "mit",
"size": 16258
} | [
"android.database.Cursor",
"android.database.SQLException",
"com.sonyericsson.extras.liveware.aef.notification.Notification",
"com.sonyericsson.extras.liveware.extension.util.Dbg"
] | import android.database.Cursor; import android.database.SQLException; import com.sonyericsson.extras.liveware.aef.notification.Notification; import com.sonyericsson.extras.liveware.extension.util.Dbg; | import android.database.*; import com.sonyericsson.extras.liveware.aef.notification.*; import com.sonyericsson.extras.liveware.extension.util.*; | [
"android.database",
"com.sonyericsson.extras"
] | android.database; com.sonyericsson.extras; | 463,414 |
public void setOnBindSuggestionCallback(SearchSuggestionsAdapter.OnBindSuggestionCallback callback) {
this.mOnBindSuggestionCallback = callback;
if (mSuggestionsAdapter != null) {
mSuggestionsAdapter.setOnBindSuggestionCallback(mOnBindSuggestionCallback);
}
} | void function(SearchSuggestionsAdapter.OnBindSuggestionCallback callback) { this.mOnBindSuggestionCallback = callback; if (mSuggestionsAdapter != null) { mSuggestionsAdapter.setOnBindSuggestionCallback(mOnBindSuggestionCallback); } } | /**
* Set a callback that will be called after each suggestion view in the suggestions recycler
* list is bound. This allows for customized binding for specific items in the list.
*
* @param callback A callback to be called after a suggestion is bound by the suggestions list's
* adapter.
*/ | Set a callback that will be called after each suggestion view in the suggestions recycler list is bound. This allows for customized binding for specific items in the list | setOnBindSuggestionCallback | {
"repo_name": "maxee/floatingsearchview",
"path": "library/src/main/java/com/arlib/floatingsearchview/FloatingSearchView.java",
"license": "apache-2.0",
"size": 81317
} | [
"com.arlib.floatingsearchview.suggestions.SearchSuggestionsAdapter"
] | import com.arlib.floatingsearchview.suggestions.SearchSuggestionsAdapter; | import com.arlib.floatingsearchview.suggestions.*; | [
"com.arlib.floatingsearchview"
] | com.arlib.floatingsearchview; | 787,391 |
@NonNull
public synchronized Credentials getCredentials() {
Credentials credentials;
if (mUserCredentials != null) {
credentials = mUserCredentials;
} else {
credentials = mClientCredentials;
}
return credentials;
} | synchronized Credentials function() { Credentials credentials; if (mUserCredentials != null) { credentials = mUserCredentials; } else { credentials = mClientCredentials; } return credentials; } | /**
* Provides the credentials.
*
* @return The credentials.
*/ | Provides the credentials | getCredentials | {
"repo_name": "mobgen/halo-android",
"path": "sdk/halo-sdk/src/main/java/com/mobgen/halo/android/sdk/core/management/authentication/HaloAuthenticator.java",
"license": "apache-2.0",
"size": 9885
} | [
"com.mobgen.halo.android.sdk.core.management.models.Credentials"
] | import com.mobgen.halo.android.sdk.core.management.models.Credentials; | import com.mobgen.halo.android.sdk.core.management.models.*; | [
"com.mobgen.halo"
] | com.mobgen.halo; | 718,606 |
@Idempotent
public void reportBadBlocks(LocatedBlock[] blocks) throws IOException; | void function(LocatedBlock[] blocks) throws IOException; | /**
* The client wants to report corrupted blocks (blocks with specified
* locations on datanodes).
* @param blocks Array of located blocks to report
*/ | The client wants to report corrupted blocks (blocks with specified locations on datanodes) | reportBadBlocks | {
"repo_name": "iostackproject/FairIO",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 54643
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,080,722 |
protected void parseSessionSslId(Request request) {
if (request.getRequestedSessionId() == null &&
SSL_ONLY.equals(request.getServletContext()
.getEffectiveSessionTrackingModes()) &&
request.connector.secure) {
// TODO Is there a better way to map SSL sessions to our sesison ID?
// TODO The request.getAttribute() will cause a number of other SSL
// attribute to be populated. Is this a performance concern?
request.setRequestedSessionId(
request.getAttribute(SSLSupport.SESSION_ID_KEY).toString());
request.setRequestedSessionSSL(true);
}
} | void function(Request request) { if (request.getRequestedSessionId() == null && SSL_ONLY.equals(request.getServletContext() .getEffectiveSessionTrackingModes()) && request.connector.secure) { request.setRequestedSessionId( request.getAttribute(SSLSupport.SESSION_ID_KEY).toString()); request.setRequestedSessionSSL(true); } } | /**
* Look for SSL session ID if required. Only look for SSL Session ID if it
* is the only tracking method enabled.
*/ | Look for SSL session ID if required. Only look for SSL Session ID if it is the only tracking method enabled | parseSessionSslId | {
"repo_name": "thanple/tomcatsrc",
"path": "java/org/apache/catalina/connector/CoyoteAdapter.java",
"license": "apache-2.0",
"size": 55447
} | [
"org.apache.tomcat.util.net.SSLSupport"
] | import org.apache.tomcat.util.net.SSLSupport; | import org.apache.tomcat.util.net.*; | [
"org.apache.tomcat"
] | org.apache.tomcat; | 1,509,838 |
public void caretUpdate (CaretEvent event) {
JComponent comp = (JComponent)event.getSource();
String name = comp.getName();
// Minimum players
if ("minPlayersTextField".equals (name)) {
try {
String minPlayersStr = minPlayersTextField.getText().trim();
if (minPlayersStr.length() != 0 && minPlayersTextField.isEnabled()) { // only try and save is something is typed in.
int minPlayers = Integer.parseInt (minPlayersStr);
serverProperties.setMinPlayers (getCurGame(), minPlayers);
validationLabel.setText ("");
}
}
catch (NumberFormatException nfe) {
validationLabel.setText ("Invalid minimum number of players");
}
}
else if ("maxPlayersTextField".equals (name)) {
try {
String maxPlayersStr = maxPlayersTextField.getText().trim();
if (maxPlayersStr.length() != 0 && maxPlayersTextField.isEnabled()) { // only try and save is something is typed in.
int maxPlayers = Integer.parseInt (maxPlayersStr);
serverProperties.setMaxPlayers (getCurGame(), maxPlayers);
validationLabel.setText ("");
}
}
catch (NumberFormatException nfe) {
validationLabel.setText ("Invalid maximum number of players");
}
}
else if ("startRatingTextField".equals (name)) {
try {
String startRatingStr = startRatingTextField.getText().trim();
if (startRatingStr.length() != 0 && startRatingTextField.isEnabled()) { // only try and save is something is typed in.
int startRating = Integer.parseInt (startRatingStr);
serverProperties.setStartRating (getCurGame(), startRating);
validationLabel.setText ("");
}
}
catch (NumberFormatException nfe) {
validationLabel.setText ("Invalid maximum number of players");
}
}
else if ("kFactorTextField".equals (name)) {
try {
String kFactorStr = kFactorTextField.getText().trim();
if (kFactorStr.length() != 0 && kFactorTextField.isEnabled()) { // only try and save is something is typed in.
serverProperties.setKFactor (getCurGame(), kFactorStr);
validationLabel.setText ("");
}
}
catch (NumberFormatException nfe) {
validationLabel.setText ("Invalid maximum number of players");
}
}
}
}
private static class DataPanel extends JPanel
implements ActionListener, CaretListener
{
private static final List DATA_TYPES = Arrays.asList (new String []{"xml", "database"});
private ServerProperties serverProperties; // link to server properties
private JLabel validationLabel;
private AdminClientConnectionThread conn;
// Gui items
private ConnectionListPanel connectionListPanel;
private JList connectionList;
private JComboBox currentDatabaseComboBox, currentDataTypeComboBox;
private JButton testDatabaseButton;
private JLabel driverIDLabelValue;
private JTextField locationTextField, driverTextField, urlTextField, usernameTextField;
private JPasswordField passwordField;
public DataPanel (ServerProperties serverProperties,
JLabel validationLabel,
AdminClientConnectionThread conn)
{
this.serverProperties = serverProperties;
this.validationLabel = validationLabel;
this.conn = conn;
// Create GUI items
createGUI ();
// Add listeners
addListeners ();
}
| void function (CaretEvent event) { JComponent comp = (JComponent)event.getSource(); String name = comp.getName(); if (STR.equals (name)) { try { String minPlayersStr = minPlayersTextField.getText().trim(); if (minPlayersStr.length() != 0 && minPlayersTextField.isEnabled()) { int minPlayers = Integer.parseInt (minPlayersStr); serverProperties.setMinPlayers (getCurGame(), minPlayers); validationLabel.setText (STRInvalid minimum number of playersSTRmaxPlayersTextField".equals (name)) { try { String maxPlayersStr = maxPlayersTextField.getText().trim(); if (maxPlayersStr.length() != 0 && maxPlayersTextField.isEnabled()) { int maxPlayers = Integer.parseInt (maxPlayersStr); serverProperties.setMaxPlayers (getCurGame(), maxPlayers); validationLabel.setText (STRInvalid maximum number of playersSTRstartRatingTextField".equals (name)) { try { String startRatingStr = startRatingTextField.getText().trim(); if (startRatingStr.length() != 0 && startRatingTextField.isEnabled()) { int startRating = Integer.parseInt (startRatingStr); serverProperties.setStartRating (getCurGame(), startRating); validationLabel.setText (STRInvalid maximum number of playersSTRkFactorTextField".equals (name)) { try { String kFactorStr = kFactorTextField.getText().trim(); if (kFactorStr.length() != 0 && kFactorTextField.isEnabled()) { serverProperties.setKFactor (getCurGame(), kFactorStr); validationLabel.setText (STRInvalid maximum number of playersSTRxmlSTRdatabase"}); private ServerProperties serverProperties; private JLabel validationLabel; private AdminClientConnectionThread conn; private ConnectionListPanel connectionListPanel; private JList connectionList; private JComboBox currentDatabaseComboBox, currentDataTypeComboBox; private JButton testDatabaseButton; private JLabel driverIDLabelValue; private JTextField locationTextField, driverTextField, urlTextField, usernameTextField; private JPasswordField passwordField; public DataPanel (ServerProperties serverProperties, JLabel validationLabel, AdminClientConnectionThread conn) { this.serverProperties = serverProperties; this.validationLabel = validationLabel; this.conn = conn; createGUI (); addListeners (); } | /**
* Update server properties based on key stroke changes.
*/ | Update server properties based on key stroke changes | caretUpdate | {
"repo_name": "lsilvestre/Jogre",
"path": "server/src/org/jogre/server/administrator/AdminServerPropertiesDialog.java",
"license": "gpl-2.0",
"size": 50813
} | [
"javax.swing.JButton",
"javax.swing.JComboBox",
"javax.swing.JComponent",
"javax.swing.JLabel",
"javax.swing.JList",
"javax.swing.JPasswordField",
"javax.swing.JTextField",
"javax.swing.event.CaretEvent",
"org.jogre.server.ServerProperties"
] | import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JList; import javax.swing.JPasswordField; import javax.swing.JTextField; import javax.swing.event.CaretEvent; import org.jogre.server.ServerProperties; | import javax.swing.*; import javax.swing.event.*; import org.jogre.server.*; | [
"javax.swing",
"org.jogre.server"
] | javax.swing; org.jogre.server; | 157,043 |
Method setValueMethod() {
StringBuilder setter = new StringBuilder();
final Class<?>[] args;
if (isMapField()) {
setter.append("put");
args = new Class<?>[] {mapKeyField.javaClass(), javaClass()};
} else {
args = new Class<?>[] {javaClass()};
if (field.isRepeated()) {
setter.append("add");
} else {
setter.append("set");
}
}
setter.append(camelCaseName);
if (valueType() == Type.ENUM) {
setter.append("Value");
}
try {
return builderClass.getDeclaredMethod(setter.toString(), args);
} catch (NoSuchMethodException e) {
throw new IllegalStateException("Could not find setter.", e);
}
} | Method setValueMethod() { StringBuilder setter = new StringBuilder(); final Class<?>[] args; if (isMapField()) { setter.append("put"); args = new Class<?>[] {mapKeyField.javaClass(), javaClass()}; } else { args = new Class<?>[] {javaClass()}; if (field.isRepeated()) { setter.append("add"); } else { setter.append("set"); } } setter.append(camelCaseName); if (valueType() == Type.ENUM) { setter.append("Value"); } try { return builderClass.getDeclaredMethod(setter.toString(), args); } catch (NoSuchMethodException e) { throw new IllegalStateException(STR, e); } } | /**
* Returns the {@link Method} that sets a single value of the field. For repeated and map fields,
* this is the add or put method that only take an individual element;
*/ | Returns the <code>Method</code> that sets a single value of the field. For repeated and map fields, this is the add or put method that only take an individual element | setValueMethod | {
"repo_name": "curioswitch/curiostack",
"path": "common/grpc/protobuf-jackson/src/main/java/org/curioswitch/common/protobuf/json/ProtoFieldInfo.java",
"license": "mit",
"size": 14773
} | [
"com.google.protobuf.Descriptors",
"java.lang.reflect.Method"
] | import com.google.protobuf.Descriptors; import java.lang.reflect.Method; | import com.google.protobuf.*; import java.lang.reflect.*; | [
"com.google.protobuf",
"java.lang"
] | com.google.protobuf; java.lang; | 1,551,354 |
private File getStatFolder() {
// Try to create the file in $ACS_TMP
String acstmp = System.getProperty("ACS.tmp",".");
if (!acstmp.endsWith(""+File.separator)) {
acstmp=acstmp+File.separator;
}
String acsbaseport = System.getProperty("ACS.baseport","0");
String folderName=acstmp+File.separator+"ACS_INSTANCE."+acsbaseport;
logger.log(AcsLogLevel.DEBUG,"Alarm systems statisticss will be recorded in "+folderName);
return new File(folderName);
} | File function() { String acstmp = System.getProperty(STR,"."); if (!acstmp.endsWith(STRACS.baseport","0STRACS_INSTANCE.STRAlarm systems statisticss will be recorded in "+folderName); return new File(folderName); } | /**
* Get the folder where the files with the statistics will be written
* that normally is <code>ACS_TMP/ACS_INSTANCE.n</code> (the fallback is the current folder).
*
* @return The folder to host file of statistics.
*/ | Get the folder where the files with the statistics will be written that normally is <code>ACS_TMP/ACS_INSTANCE.n</code> (the fallback is the current folder) | getStatFolder | {
"repo_name": "ACS-Community/ACS",
"path": "LGPL/CommonSoftware/ACSLaser/laser-core/src/alma/alarmsystem/statistics/StatsCalculator.java",
"license": "lgpl-2.1",
"size": 10984
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,359,645 |
public static void showInfo(Activity activity, String message) {
SimpleToast.info(activity, message);
}
| static void function(Activity activity, String message) { SimpleToast.info(activity, message); } | /**
* Show info message
*
* @param activity context of activity
* @param message message to be displayed
*/ | Show info message | showInfo | {
"repo_name": "benchakalaka/DrawingMagic",
"path": "app/src/main/java/com/drawingmagic/utils/Notification.java",
"license": "mit",
"size": 4490
} | [
"android.app.Activity",
"com.github.pierry.simpletoast.SimpleToast"
] | import android.app.Activity; import com.github.pierry.simpletoast.SimpleToast; | import android.app.*; import com.github.pierry.simpletoast.*; | [
"android.app",
"com.github.pierry"
] | android.app; com.github.pierry; | 2,054,378 |
public void testClientMsgsRegionSize() throws Exception {
// slow start for dispatcher
serverVM0.invoke(ConflationDUnitTest.class, "setIsSlowStart",
new Object[] { "30000" });
serverVM1.invoke(ConflationDUnitTest.class, "setIsSlowStart",
new Object[] { "30000" });
createClientCache(getServerHostName(Host.getHost(0)), new Integer(PORT1), new Integer(PORT2), "1");
final String client1Host = getServerHostName(clientVM1.getHost());
clientVM1.invoke(HARQueueNewImplDUnitTest.class, "createClientCache",
new Object[] { client1Host, new Integer(PORT1), new Integer(PORT2), "1" });
final String client2Host = getServerHostName(clientVM2.getHost());
clientVM2.invoke(HARQueueNewImplDUnitTest.class, "createClientCache",
new Object[] { client2Host, new Integer(PORT1), new Integer(PORT2), "1" });
registerInterestListAll();
clientVM1.invoke(HARQueueNewImplDUnitTest.class, "registerInterestList");
clientVM2.invoke(HARQueueNewImplDUnitTest.class, "registerInterestList");
serverVM1.invoke(HARQueueNewImplDUnitTest.class, "stopServer");
serverVM0.invoke(HARQueueNewImplDUnitTest.class, "createEntries");
serverVM1.invoke(HARQueueNewImplDUnitTest.class, "startServer");
serverVM0.invoke(HARQueueNewImplDUnitTest.class, "verifyRegionSize",
new Object[] { new Integer(5), new Integer(5), new Integer(PORT1) });
serverVM1.invoke(HARQueueNewImplDUnitTest.class, "verifyRegionSize",
new Object[] { new Integer(5), new Integer(5), new Integer(PORT2) });
} | void function() throws Exception { serverVM0.invoke(ConflationDUnitTest.class, STR, new Object[] { "30000" }); serverVM1.invoke(ConflationDUnitTest.class, STR, new Object[] { "30000" }); createClientCache(getServerHostName(Host.getHost(0)), new Integer(PORT1), new Integer(PORT2), "1"); final String client1Host = getServerHostName(clientVM1.getHost()); clientVM1.invoke(HARQueueNewImplDUnitTest.class, STR, new Object[] { client1Host, new Integer(PORT1), new Integer(PORT2), "1" }); final String client2Host = getServerHostName(clientVM2.getHost()); clientVM2.invoke(HARQueueNewImplDUnitTest.class, STR, new Object[] { client2Host, new Integer(PORT1), new Integer(PORT2), "1" }); registerInterestListAll(); clientVM1.invoke(HARQueueNewImplDUnitTest.class, STR); clientVM2.invoke(HARQueueNewImplDUnitTest.class, STR); serverVM1.invoke(HARQueueNewImplDUnitTest.class, STR); serverVM0.invoke(HARQueueNewImplDUnitTest.class, STR); serverVM1.invoke(HARQueueNewImplDUnitTest.class, STR); serverVM0.invoke(HARQueueNewImplDUnitTest.class, STR, new Object[] { new Integer(5), new Integer(5), new Integer(PORT1) }); serverVM1.invoke(HARQueueNewImplDUnitTest.class, STR, new Object[] { new Integer(5), new Integer(5), new Integer(PORT2) }); } | /**
* This test verifies that the client-messages-region does not store duplicate
* ClientUpdateMessageImpl instances, during a normal put path as well as the
* GII path.
*
* @throws Exception
*/ | This test verifies that the client-messages-region does not store duplicate ClientUpdateMessageImpl instances, during a normal put path as well as the GII path | testClientMsgsRegionSize | {
"repo_name": "ysung-pivotal/incubator-geode",
"path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARQueueNewImplDUnitTest.java",
"license": "apache-2.0",
"size": 52392
} | [
"com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest"
] | import com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest; | import com.gemstone.gemfire.internal.cache.tier.sockets.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 400,059 |
@Override
public Value evalArray(Env env)
{
Value array = _expr.evalArray(env);
Value index = _index.eval(env);
return array.getArray(index);
} | Value function(Env env) { Value array = _expr.evalArray(env); Value index = _index.eval(env); return array.getArray(index); } | /**
* Evaluates the expression, creating an array if the value is unset.
*
* @param env the calling environment.
*
* @return the expression value.
*/ | Evaluates the expression, creating an array if the value is unset | evalArray | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/quercus/src/com/caucho/quercus/expr/ArrayGetExpr.java",
"license": "gpl-2.0",
"size": 5594
} | [
"com.caucho.quercus.env.Env",
"com.caucho.quercus.env.Value"
] | import com.caucho.quercus.env.Env; import com.caucho.quercus.env.Value; | import com.caucho.quercus.env.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 477,398 |
private static GenericValue createContentWithTemplateBody(Delegator delegator, String templateBody,
Map<String, ?> contentFields, Map<String, ?> dataResourceFields) throws CmsException {
try {
GenericValue dataResource = delegator.makeValue("DataResource",
UtilMisc.toMap("dataResourceTypeId", "ELECTRONIC_TEXT", "mimeTypeId", "text/plain",
"dataTemplateTypeId", "NONE"));
if (dataResourceFields != null) {
dataResource.setNonPKFields(dataResourceFields);
}
dataResource = delegator.createSetNextSeqId(dataResource);
GenericValue electronicText = delegator.makeValue("ElectronicText",
UtilMisc.toMap("dataResourceId", dataResource.getString("dataResourceId"),
"textData", templateBody));
electronicText = delegator.create(electronicText);
GenericValue content = delegator.makeValue("Content", UtilMisc.toMap("dataResourceId", dataResource.getString("dataResourceId"),
"contentTypeId", "DOCUMENT"));
if (contentFields != null) {
content.setNonPKFields(contentFields);
}
content = delegator.createSetNextSeqId(content);
return content;
} catch (GenericEntityException e) {
throw new CmsException("Could not create template content", e);
}
} | static GenericValue function(Delegator delegator, String templateBody, Map<String, ?> contentFields, Map<String, ?> dataResourceFields) throws CmsException { try { GenericValue dataResource = delegator.makeValue(STR, UtilMisc.toMap(STR, STR, STR, STR, STR, "NONE")); if (dataResourceFields != null) { dataResource.setNonPKFields(dataResourceFields); } dataResource = delegator.createSetNextSeqId(dataResource); GenericValue electronicText = delegator.makeValue(STR, UtilMisc.toMap(STR, dataResource.getString(STR), STR, templateBody)); electronicText = delegator.create(electronicText); GenericValue content = delegator.makeValue(STR, UtilMisc.toMap(STR, dataResource.getString(STR), STR, STR)); if (contentFields != null) { content.setNonPKFields(contentFields); } content = delegator.createSetNextSeqId(content); return content; } catch (GenericEntityException e) { throw new CmsException(STR, e); } } | /**
* Creates an ElectronicText DataResource and Content and returns the new Content for it.
* optional extra manual fields.
*/ | Creates an ElectronicText DataResource and Content and returns the new Content for it. optional extra manual fields | createContentWithTemplateBody | {
"repo_name": "ilscipio/scipio-erp",
"path": "applications/cms/src/com/ilscipio/scipio/cms/template/CmsTemplate.java",
"license": "apache-2.0",
"size": 35510
} | [
"com.ilscipio.scipio.cms.CmsException",
"java.util.Map",
"org.ofbiz.base.util.UtilMisc",
"org.ofbiz.entity.Delegator",
"org.ofbiz.entity.GenericEntityException",
"org.ofbiz.entity.GenericValue"
] | import com.ilscipio.scipio.cms.CmsException; import java.util.Map; import org.ofbiz.base.util.UtilMisc; import org.ofbiz.entity.Delegator; import org.ofbiz.entity.GenericEntityException; import org.ofbiz.entity.GenericValue; | import com.ilscipio.scipio.cms.*; import java.util.*; import org.ofbiz.base.util.*; import org.ofbiz.entity.*; | [
"com.ilscipio.scipio",
"java.util",
"org.ofbiz.base",
"org.ofbiz.entity"
] | com.ilscipio.scipio; java.util; org.ofbiz.base; org.ofbiz.entity; | 2,084,517 |
@Override
public int read(ByteBuffer dst) throws IOException {
//if we want to take advantage of the expand function, make sure we only use the ApplicationBufferHandler's buffers
if ( dst != bufHandler.getReadBuffer() ) throw new IllegalArgumentException("You can only read using the application read buffer provided by the handler.");
//are we in the middle of closing or closed?
if ( closing || closed) return -1;
//did we finish our handshake?
if (!handshakeComplete) throw new IllegalStateException("Handshake incomplete, you must complete handshake before reading data.");
//read from the network
int netread = sc.read(netInBuffer);
//did we reach EOF? if so send EOF up one layer.
if (netread == -1) return -1;
//the data read
int read = 0;
//the SSL engine result
SSLEngineResult unwrap;
do {
//prepare the buffer
netInBuffer.flip();
//unwrap the data
unwrap = sslEngine.unwrap(netInBuffer, dst);
//compact the buffer
netInBuffer.compact();
if ( unwrap.getStatus()==Status.OK || unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) {
//we did receive some data, add it to our total
read += unwrap.bytesProduced();
//perform any tasks if needed
if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks();
//if we need more network data, then bail out for now.
if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break;
}else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) {
//buffer overflow can happen, if we have read data, then
//empty out the dst buffer before we do another read
break;
}else {
//here we should trap BUFFER_OVERFLOW and call expand on the buffer
//for now, throw an exception, as we initialized the buffers
//in the constructor
throw new IOException("Unable to unwrap data, invalid status: " + unwrap.getStatus());
}
} while ( (netInBuffer.position() != 0)); //continue to unwrapping as long as the input buffer has stuff
return (read);
} | int function(ByteBuffer dst) throws IOException { if ( dst != bufHandler.getReadBuffer() ) throw new IllegalArgumentException(STR); if ( closing closed) return -1; if (!handshakeComplete) throw new IllegalStateException(STR); int netread = sc.read(netInBuffer); if (netread == -1) return -1; int read = 0; SSLEngineResult unwrap; do { netInBuffer.flip(); unwrap = sslEngine.unwrap(netInBuffer, dst); netInBuffer.compact(); if ( unwrap.getStatus()==Status.OK unwrap.getStatus()==Status.BUFFER_UNDERFLOW ) { read += unwrap.bytesProduced(); if (unwrap.getHandshakeStatus() == HandshakeStatus.NEED_TASK) tasks(); if ( unwrap.getStatus() == Status.BUFFER_UNDERFLOW ) break; }else if ( unwrap.getStatus()==Status.BUFFER_OVERFLOW && read>0 ) { break; }else { throw new IOException(STR + unwrap.getStatus()); } } while ( (netInBuffer.position() != 0)); return (read); } | /**
* Reads a sequence of bytes from this channel into the given buffer.
*
* @param dst The buffer into which bytes are to be transferred
* @return The number of bytes read, possibly zero, or <tt>-1</tt> if the channel has reached end-of-stream
* @throws IOException If some other I/O error occurs
* @throws IllegalArgumentException if the destination buffer is different than bufHandler.getReadBuffer()
* TODO Implement this java.nio.channels.ReadableByteChannel method
*/ | Reads a sequence of bytes from this channel into the given buffer | read | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.0/SecureNioChannel.java",
"license": "mit",
"size": 23243
} | [
"java.io.IOException",
"java.nio.ByteBuffer",
"javax.net.ssl.SSLEngineResult"
] | import java.io.IOException; import java.nio.ByteBuffer; import javax.net.ssl.SSLEngineResult; | import java.io.*; import java.nio.*; import javax.net.ssl.*; | [
"java.io",
"java.nio",
"javax.net"
] | java.io; java.nio; javax.net; | 2,385,318 |
private static List<CompositeAPIInfoDTO> toCompositeAPIInfo(List<CompositeAPI> apiSummaryList) {
List<CompositeAPIInfoDTO> apiInfoList = new ArrayList<>();
for (CompositeAPI apiSummary : apiSummaryList) {
CompositeAPIInfoDTO apiInfo = new CompositeAPIInfoDTO();
apiInfo.setId(apiSummary.getId());
apiInfo.setContext(apiSummary.getContext());
apiInfo.setDescription(apiSummary.getDescription());
apiInfo.setName(apiSummary.getName());
apiInfo.setProvider(apiSummary.getProvider());
apiInfo.setVersion(apiSummary.getVersion());
apiInfo.setApplicationId(apiSummary.getApplicationId());
apiInfoList.add(apiInfo);
}
return apiInfoList;
} | static List<CompositeAPIInfoDTO> function(List<CompositeAPI> apiSummaryList) { List<CompositeAPIInfoDTO> apiInfoList = new ArrayList<>(); for (CompositeAPI apiSummary : apiSummaryList) { CompositeAPIInfoDTO apiInfo = new CompositeAPIInfoDTO(); apiInfo.setId(apiSummary.getId()); apiInfo.setContext(apiSummary.getContext()); apiInfo.setDescription(apiSummary.getDescription()); apiInfo.setName(apiSummary.getName()); apiInfo.setProvider(apiSummary.getProvider()); apiInfo.setVersion(apiSummary.getVersion()); apiInfo.setApplicationId(apiSummary.getApplicationId()); apiInfoList.add(apiInfo); } return apiInfoList; } | /**
* Converts {@link CompositeAPI} List to an {@link CompositeAPIInfoDTO} List.
*
* @param apiSummaryList
* @return
*/ | Converts <code>CompositeAPI</code> List to an <code>CompositeAPIInfoDTO</code> List | toCompositeAPIInfo | {
"repo_name": "Minoli/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.store/src/main/java/org/wso2/carbon/apimgt/rest/api/store/mappings/CompositeAPIMappingUtil.java",
"license": "apache-2.0",
"size": 3632
} | [
"java.util.ArrayList",
"java.util.List",
"org.wso2.carbon.apimgt.core.models.CompositeAPI",
"org.wso2.carbon.apimgt.rest.api.store.dto.CompositeAPIInfoDTO"
] | import java.util.ArrayList; import java.util.List; import org.wso2.carbon.apimgt.core.models.CompositeAPI; import org.wso2.carbon.apimgt.rest.api.store.dto.CompositeAPIInfoDTO; | import java.util.*; import org.wso2.carbon.apimgt.core.models.*; import org.wso2.carbon.apimgt.rest.api.store.dto.*; | [
"java.util",
"org.wso2.carbon"
] | java.util; org.wso2.carbon; | 1,604,862 |
public void buildDeckList(List<Sched.DeckDueTreeNode> nodes) {
mDeckList.clear();
mNew = mLrn = mRev = 0;
processNodes(nodes);
notifyDataSetChanged();
} | void function(List<Sched.DeckDueTreeNode> nodes) { mDeckList.clear(); mNew = mLrn = mRev = 0; processNodes(nodes); notifyDataSetChanged(); } | /**
* Consume a list of {@link Sched.DeckDueTreeNode}s to render a new deck list.
*/ | Consume a list of <code>Sched.DeckDueTreeNode</code>s to render a new deck list | buildDeckList | {
"repo_name": "PLoginoff/Anki-Android",
"path": "AnkiDroid/src/main/java/com/ichi2/anki/widgets/DeckAdapter.java",
"license": "gpl-3.0",
"size": 11387
} | [
"com.ichi2.libanki.Sched",
"java.util.List"
] | import com.ichi2.libanki.Sched; import java.util.List; | import com.ichi2.libanki.*; import java.util.*; | [
"com.ichi2.libanki",
"java.util"
] | com.ichi2.libanki; java.util; | 51,125 |
public ServiceResponseWithHeaders<Void, LROSADsDeleteAsyncRelativeRetryNoStatusHeaders> deleteAsyncRelativeRetryNoStatus() throws CloudException, IOException, InterruptedException {
Response<ResponseBody> result = service.deleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()).execute();
return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.class);
} | ServiceResponseWithHeaders<Void, LROSADsDeleteAsyncRelativeRetryNoStatusHeaders> function() throws CloudException, IOException, InterruptedException { Response<ResponseBody> result = service.deleteAsyncRelativeRetryNoStatus(this.client.getAcceptLanguage()).execute(); return client.getAzureClient().getPostOrDeleteResultWithHeaders(result, new TypeToken<Void>() { }.getType(), LROSADsDeleteAsyncRelativeRetryNoStatusHeaders.class); } | /**
* Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status.
*
* @throws CloudException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @throws InterruptedException exception thrown when long running operation is interrupted
* @return the ServiceResponseWithHeaders object if successful.
*/ | Long running delete request, service returns a 202 to the initial request. Poll the endpoint indicated in the Azure-AsyncOperation header for operation status | deleteAsyncRelativeRetryNoStatus | {
"repo_name": "xingwu1/autorest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java",
"license": "mit",
"size": 236888
} | [
"com.google.common.reflect.TypeToken",
"com.microsoft.azure.CloudException",
"com.microsoft.rest.ServiceResponseWithHeaders",
"java.io.IOException"
] | import com.google.common.reflect.TypeToken; import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException; | import com.google.common.reflect.*; import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*; | [
"com.google.common",
"com.microsoft.azure",
"com.microsoft.rest",
"java.io"
] | com.google.common; com.microsoft.azure; com.microsoft.rest; java.io; | 374,050 |
public static <T> Iterable<T> randomIterable(Collection<T> col) {
List<T> list = new ArrayList<>(col);
Collections.shuffle(list);
return list;
} | static <T> Iterable<T> function(Collection<T> col) { List<T> list = new ArrayList<>(col); Collections.shuffle(list); return list; } | /**
* Takes given collection, shuffles it and returns iterable instance.
*
* @param <T> Type of elements to create iterator for.
* @param col Collection to shuffle.
* @return Iterable instance over randomly shuffled collection.
*/ | Takes given collection, shuffles it and returns iterable instance | randomIterable | {
"repo_name": "shurun19851206/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 289056
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.Collections",
"java.util.List"
] | import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,742,957 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.