method
stringlengths
13
441k
clean_method
stringlengths
7
313k
doc
stringlengths
17
17.3k
comment
stringlengths
3
1.42k
method_name
stringlengths
1
273
extra
dict
imports
list
imports_info
stringlengths
19
34.8k
cluster_imports_info
stringlengths
15
3.66k
libraries
list
libraries_info
stringlengths
6
661
id
int64
0
2.92M
void writeAll(Iterable<GridCacheBatchSwapEntry> swapped) throws IgniteCheckedException { assert offheapEnabled || swapEnabled; checkIteratorQueue(); GridCacheQueryManager qryMgr = cctx.queries(); if (offheapEnabled) { for (GridCacheBatchSwapEntry swapEntry : swapped) { offheap.put(spaceName, swapEntry.partition(), swapEntry.key(), swapEntry.key().valueBytes(cctx.cacheObjectContext()), swapEntry.marshal()); if (cctx.config().isStatisticsEnabled()) cctx.cache().metrics0().onOffHeapWrite(); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_TO_OFFHEAP)) cctx.events().addEvent(swapEntry.partition(), swapEntry.key(), cctx.nodeId(), (IgniteUuid)null, null, EVT_CACHE_OBJECT_TO_OFFHEAP, null, false, null, true, null, null, null, false); if (qryMgr.enabled()) qryMgr.onSwap(swapEntry.key()); } } else { Map<SwapKey, byte[]> batch = new LinkedHashMap<>(); for (GridCacheBatchSwapEntry entry : swapped) { SwapKey swapKey = new SwapKey(entry.key(), entry.partition(), entry.key().valueBytes(cctx.cacheObjectContext())); batch.put(swapKey, entry.marshal()); } swapMgr.writeAll(spaceName, batch, cctx.deploy().globalLoader()); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_SWAPPED)) { for (GridCacheBatchSwapEntry batchSwapEntry : swapped) { cctx.events().addEvent(batchSwapEntry.partition(), batchSwapEntry.key(), cctx.nodeId(), (IgniteUuid)null, null, EVT_CACHE_OBJECT_SWAPPED, null, false, null, true, null, null, null, false); if (qryMgr.enabled()) qryMgr.onSwap(batchSwapEntry.key()); } } if (cctx.config().isStatisticsEnabled()) cctx.cache().metrics0().onSwapWrite(batch.size()); } }
void writeAll(Iterable<GridCacheBatchSwapEntry> swapped) throws IgniteCheckedException { assert offheapEnabled swapEnabled; checkIteratorQueue(); GridCacheQueryManager qryMgr = cctx.queries(); if (offheapEnabled) { for (GridCacheBatchSwapEntry swapEntry : swapped) { offheap.put(spaceName, swapEntry.partition(), swapEntry.key(), swapEntry.key().valueBytes(cctx.cacheObjectContext()), swapEntry.marshal()); if (cctx.config().isStatisticsEnabled()) cctx.cache().metrics0().onOffHeapWrite(); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_TO_OFFHEAP)) cctx.events().addEvent(swapEntry.partition(), swapEntry.key(), cctx.nodeId(), (IgniteUuid)null, null, EVT_CACHE_OBJECT_TO_OFFHEAP, null, false, null, true, null, null, null, false); if (qryMgr.enabled()) qryMgr.onSwap(swapEntry.key()); } } else { Map<SwapKey, byte[]> batch = new LinkedHashMap<>(); for (GridCacheBatchSwapEntry entry : swapped) { SwapKey swapKey = new SwapKey(entry.key(), entry.partition(), entry.key().valueBytes(cctx.cacheObjectContext())); batch.put(swapKey, entry.marshal()); } swapMgr.writeAll(spaceName, batch, cctx.deploy().globalLoader()); if (cctx.events().isRecordable(EVT_CACHE_OBJECT_SWAPPED)) { for (GridCacheBatchSwapEntry batchSwapEntry : swapped) { cctx.events().addEvent(batchSwapEntry.partition(), batchSwapEntry.key(), cctx.nodeId(), (IgniteUuid)null, null, EVT_CACHE_OBJECT_SWAPPED, null, false, null, true, null, null, null, false); if (qryMgr.enabled()) qryMgr.onSwap(batchSwapEntry.key()); } } if (cctx.config().isStatisticsEnabled()) cctx.cache().metrics0().onSwapWrite(batch.size()); } }
/** * Performs batch write of swapped entries. * * @param swapped Collection of swapped entries. * @throws IgniteCheckedException If failed. */
Performs batch write of swapped entries
writeAll
{ "repo_name": "tkpanther/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheSwapManager.java", "license": "apache-2.0", "size": 85120 }
[ "java.util.LinkedHashMap", "java.util.Map", "org.apache.ignite.IgniteCheckedException", "org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager", "org.apache.ignite.lang.IgniteUuid", "org.apache.ignite.spi.swapspace.SwapKey" ]
import java.util.LinkedHashMap; import java.util.Map; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.processors.cache.query.GridCacheQueryManager; import org.apache.ignite.lang.IgniteUuid; import org.apache.ignite.spi.swapspace.SwapKey;
import java.util.*; import org.apache.ignite.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.lang.*; import org.apache.ignite.spi.swapspace.*;
[ "java.util", "org.apache.ignite" ]
java.util; org.apache.ignite;
1,974,371
public void writeTo(Writer writer) throws IOException { writeTo(writer, WriterConfig.MINIMAL); }
void function(Writer writer) throws IOException { writeTo(writer, WriterConfig.MINIMAL); }
/** * Writes the JSON representation of this value to the given writer in its minimal form, without * any additional whitespace. * <p> * Writing performance can be improved by using a {@link java.io.BufferedWriter BufferedWriter}. * </p> * * @param writer * the writer to write this value to * @throws IOException * if an I/O error occurs in the writer */
Writes the JSON representation of this value to the given writer in its minimal form, without any additional whitespace. Writing performance can be improved by using a <code>java.io.BufferedWriter BufferedWriter</code>.
writeTo
{ "repo_name": "TheDudeFromCI/MovieTracker", "path": "MovieTracker/src/com/eclipsesource/json/JsonValue.java", "license": "mit", "size": 16919 }
[ "java.io.IOException", "java.io.Writer" ]
import java.io.IOException; import java.io.Writer;
import java.io.*;
[ "java.io" ]
java.io;
1,442,269
public JSONObject update(String soupName, JSONObject soupElt, long soupEntryId, boolean handleTx) throws JSONException { synchronized(SmartStore.class) { String soupTableName = DBHelper.INSTANCE.getSoupTableName(db, soupName); if (soupTableName == null) throw new SmartStoreException("Soup: " + soupName + " does not exist"); IndexSpec[] indexSpecs = DBHelper.INSTANCE.getIndexSpecs(db, soupName); long now = System.currentTimeMillis(); // In the case of an upsert with external id, _soupEntryId won't be in soupElt soupElt.put(SOUP_ENTRY_ID, soupEntryId); // Updating last modified field in soup element soupElt.put(SOUP_LAST_MODIFIED_DATE, now); // Preparing data for row ContentValues contentValues = new ContentValues(); contentValues.put(SOUP_COL, soupElt.toString()); contentValues.put(LAST_MODIFIED_COL, now); for (IndexSpec indexSpec : indexSpecs) { projectIndexedPaths(soupElt, contentValues, indexSpec); } try { if (handleTx) { db.beginTransaction(); } boolean success = DBHelper.INSTANCE.update(db, soupTableName, contentValues, ID_PREDICATE, soupEntryId + "") == 1; if (success) { if (handleTx) { db.setTransactionSuccessful(); } return soupElt; } else { return null; } } finally { if (handleTx) { db.endTransaction(); } } } }
JSONObject function(String soupName, JSONObject soupElt, long soupEntryId, boolean handleTx) throws JSONException { synchronized(SmartStore.class) { String soupTableName = DBHelper.INSTANCE.getSoupTableName(db, soupName); if (soupTableName == null) throw new SmartStoreException(STR + soupName + STR); IndexSpec[] indexSpecs = DBHelper.INSTANCE.getIndexSpecs(db, soupName); long now = System.currentTimeMillis(); soupElt.put(SOUP_ENTRY_ID, soupEntryId); soupElt.put(SOUP_LAST_MODIFIED_DATE, now); ContentValues contentValues = new ContentValues(); contentValues.put(SOUP_COL, soupElt.toString()); contentValues.put(LAST_MODIFIED_COL, now); for (IndexSpec indexSpec : indexSpecs) { projectIndexedPaths(soupElt, contentValues, indexSpec); } try { if (handleTx) { db.beginTransaction(); } boolean success = DBHelper.INSTANCE.update(db, soupTableName, contentValues, ID_PREDICATE, soupEntryId + "") == 1; if (success) { if (handleTx) { db.setTransactionSuccessful(); } return soupElt; } else { return null; } } finally { if (handleTx) { db.endTransaction(); } } } }
/** * Update * Note: Passed soupElt is modified (last modified date and soup entry id fields) * @param soupName * @param soupElt * @param soupEntryId * @return * @throws JSONException */
Update Note: Passed soupElt is modified (last modified date and soup entry id fields)
update
{ "repo_name": "marcus-bessa/MobileCampaign", "path": "forcedroid/hybrid/SmartStore/src/com/salesforce/androidsdk/smartstore/store/SmartStore.java", "license": "unlicense", "size": 29286 }
[ "android.content.ContentValues", "org.json.JSONException", "org.json.JSONObject" ]
import android.content.ContentValues; import org.json.JSONException; import org.json.JSONObject;
import android.content.*; import org.json.*;
[ "android.content", "org.json" ]
android.content; org.json;
1,271,628
public static boolean checkGooglePlayServicesAvailable(Activity activity) { final int connectionStatusCode = GooglePlayServicesUtil .isGooglePlayServicesAvailable(activity); if (GooglePlayServicesUtil.isUserRecoverableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(activity, connectionStatusCode); return false; } return true; }
static boolean function(Activity activity) { final int connectionStatusCode = GooglePlayServicesUtil .isGooglePlayServicesAvailable(activity); if (GooglePlayServicesUtil.isUserRecoverableError(connectionStatusCode)) { showGooglePlayServicesAvailabilityErrorDialog(activity, connectionStatusCode); return false; } return true; }
/** * Check that Google Play services APK is installed and up to date. */
Check that Google Play services APK is installed and up to date
checkGooglePlayServicesAvailable
{ "repo_name": "udacity/conference-central-android-app", "path": "app/src/main/java/com/udacity/devrel/training/conference/android/utils/Utils.java", "license": "gpl-2.0", "size": 8431 }
[ "android.app.Activity", "com.google.android.gms.common.GooglePlayServicesUtil" ]
import android.app.Activity; import com.google.android.gms.common.GooglePlayServicesUtil;
import android.app.*; import com.google.android.gms.common.*;
[ "android.app", "com.google.android" ]
android.app; com.google.android;
134,328
@After public void unregisterIdlingResource() { Espresso.unregisterIdlingResources( mDashboardActivity.getActivity().getCountingIdlingResource()); }
void function() { Espresso.unregisterIdlingResources( mDashboardActivity.getActivity().getCountingIdlingResource()); }
/** * Unregister your Idling Resource so it can be garbage collected and does not leak any memory. */
Unregister your Idling Resource so it can be garbage collected and does not leak any memory
unregisterIdlingResource
{ "repo_name": "coderaashir/android-client", "path": "mifosng-android/src/instrumentTest/java/com/mifos/mifosxdroid/tests/ClientSearchFragmentTest.java", "license": "mpl-2.0", "size": 2461 }
[ "android.support.test.espresso.Espresso" ]
import android.support.test.espresso.Espresso;
import android.support.test.espresso.*;
[ "android.support" ]
android.support;
1,171,480
protected void writeMeeting(Meeting meeting, boolean attachExtRefs, boolean showSignatureFields) throws ExportException { Protocol protocol = meeting.getProtocol(); if (protocol != null) { try { Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font italicFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldItalicFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldFontTitle = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 17); Font italicFontTitle = new Font( BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 13); PdfPTable tableMeeting = new PdfPTable(2); tableMeeting.setWidthPercentage(100); tableMeeting.setSplitRows(false); tableMeeting.getDefaultCell().setBorderWidth(0); tableMeeting.getDefaultCell().setPadding(0); String meetingDate = sdfDate.format(protocol.getDate().getTime()); String meetingTime = sdfTime.format(protocol.getStart().getTime()) + " - " + sdfTime.format(protocol.getEnd().getTime()) + " [" + protocol.getEnd().getTimeZone().getDisplayName() + "]"; Anchor anchorTitle = new Anchor(translate("Review Meeting on") + " " + meetingDate, boldFontTitle); anchorTitle.setName( Long.toString(protocol.getDate().getTimeInMillis() + protocol.getStart().getTimeInMillis())); PdfPCell cellTitle = new PdfPCell(anchorTitle); cellTitle.setColspan(2); cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitle.setPadding(0); cellTitle.setBorderWidth(0); cellTitle.setPaddingTop(PDFTools.cmToPt(0.6f)); cellTitle.setPaddingBottom(padding * 2); tableMeeting.addCell(cellTitle); PdfPCell cellTime = new PdfPCell(new Phrase(meetingTime, italicFontTitle)); cellTime.setColspan(2); cellTime.setHorizontalAlignment(Element.ALIGN_CENTER); cellTime.setPadding(0); cellTime.setBorderWidth(0); cellTime.setPaddingBottom(padding * 2); tableMeeting.addCell(cellTime); String location = protocol.getLocation(); if (location.trim().equals("")) { location = "--"; } PdfPCell cellLocation = new PdfPCell(new Phrase(translate("Location") + ": " + location, italicFontTitle)); cellLocation.setColspan(2); cellLocation.setHorizontalAlignment(Element.ALIGN_CENTER); cellLocation.setPadding(0); cellLocation.setBorderWidth(0); cellLocation.setPaddingBottom(PDFTools.cmToPt(1.5f)); tableMeeting.addCell(cellLocation); PdfPCell cellPlanned; boolean plannedDateEqualsProtocolDate = meeting.getPlannedDate().get(Calendar.DAY_OF_MONTH) == protocol .getDate().get(Calendar.DAY_OF_MONTH) && meeting.getPlannedDate().get(Calendar.MONTH) == protocol.getDate().get(Calendar.MONTH) && meeting.getPlannedDate().get(Calendar.YEAR) == protocol.getDate().get(Calendar.YEAR); boolean plannedStartEqualsProtocolStart = meeting.getPlannedStart().get(Calendar.HOUR) == protocol .getStart().get(Calendar.HOUR) && meeting.getPlannedStart().get(Calendar.MINUTE) == protocol.getStart().get(Calendar.MINUTE) && meeting.getPlannedStart().get(Calendar.AM_PM) == protocol.getStart().get(Calendar.AM_PM); boolean plannedEndEqualsProtocolEnd = meeting.getPlannedEnd().get(Calendar.HOUR) == protocol.getEnd() .get(Calendar.HOUR) && meeting.getPlannedEnd().get(Calendar.MINUTE) == protocol.getEnd().get(Calendar.MINUTE) && meeting.getPlannedEnd().get(Calendar.AM_PM) == protocol.getEnd().get(Calendar.AM_PM); boolean plannedLocationEqualsProtocolLocation = meeting.getPlannedLocation() .equals(protocol.getLocation()); if (plannedDateEqualsProtocolDate && plannedStartEqualsProtocolStart && plannedEndEqualsProtocolEnd && plannedLocationEqualsProtocolLocation) { cellPlanned = new PdfPCell( new Phrase(translate("The meeting took place as it has been planned."), plainFont)); } else { cellPlanned = new PdfPCell(); cellPlanned.addElement(new Phrase( translate("The meeting didn't take place as it has been planned. The meeting was planned:"), plainFont)); String plannedDate = sdfDate.format(meeting.getPlannedDate().getTime()); String plannedTime = sdfTime.format(meeting.getPlannedStart().getTime()) + " - " + sdfTime.format(meeting.getPlannedEnd().getTime()) + " [" + meeting.getPlannedEnd().getTimeZone().getDisplayName() + "]"; Phrase phrasePlanned = new Phrase(plannedDate + " (" + plannedTime + "); " + translate("Location") + ": " + meeting.getPlannedLocation(), italicFont); cellPlanned.addElement(phrasePlanned); } cellPlanned.setColspan(2); cellPlanned.setBorderWidth(0); cellPlanned.setPadding(padding); cellPlanned.setPaddingBottom(PDFTools.cmToPt(1.5f)); tableMeeting.addCell(cellPlanned); Phrase phraseComments = new Phrase(translate("Comments on the Meeting:"), boldFont); PdfPCell cellComments = new PdfPCell(phraseComments); cellComments.setBorderWidth(0); cellComments.setPadding(padding); cellComments.setBorderColor(verticalBorderColor); cellComments.setBorderWidthLeft(verticalBorderWidth); tableMeeting.addCell(cellComments); phraseComments = new Phrase(translate("Comments on the Findings List:"), boldFont); cellComments = new PdfPCell(phraseComments); cellComments.setBorderWidth(0); cellComments.setPadding(padding); cellComments.setBorderColor(verticalBorderColor); cellComments.setBorderWidthLeft(verticalBorderWidth); tableMeeting.addCell(cellComments); String meetingComments = meeting.getComments(); if (meetingComments.trim().equals("")) { meetingComments = "--"; } phraseComments = new Phrase(meetingComments, italicFont); phraseComments.setLeading(leading); cellComments = new PdfPCell(); cellComments.addElement(phraseComments); cellComments.setBorderWidth(0); cellComments.setPadding(padding); cellComments.setPaddingBottom(padding * 1.8f); cellComments.setBorderColor(verticalBorderColor); cellComments.setBorderWidthLeft(verticalBorderWidth); tableMeeting.addCell(cellComments); String protocolComments = protocol.getComments(); if (protocolComments.trim().equals("")) { protocolComments = "--"; } phraseComments = new Phrase(protocolComments, italicFont); phraseComments.setLeading(leading); cellComments = new PdfPCell(); cellComments.addElement(phraseComments); cellComments.setBorderWidth(0); cellComments.setPadding(padding); cellComments.setPaddingBottom(padding * 1.8f); cellComments.setBorderColor(verticalBorderColor); cellComments.setBorderWidthLeft(verticalBorderWidth); tableMeeting.addCell(cellComments); tableMeeting.addCell(createVerticalStrut(PDFTools.cmToPt(1.3f), 2)); if (protMgmt.getAttendees(protocol).size() > 0) { PdfPCell cellAtt = new PdfPCell(new Phrase(translate("The following attendees participated") + " (" + protMgmt.getAttendees(protocol).size() + " " + translate("attendees") + "):", boldItalicFont)); cellAtt.setColspan(2); cellAtt.setPadding(0); cellAtt.setBorderWidth(0); cellAtt.setPadding(padding); cellAtt.setPaddingBottom(PDFTools.cmToPt(0.8f)); tableMeeting.addCell(cellAtt); } pdfDoc.add(tableMeeting); if (protMgmt.getAttendees(protocol).size() > 0) { writeAttendees(protocol, true, true, showSignatureFields); } if (findMgmt.getNumberOfFindings(protocol) == 0) { return; } else if (findMgmt.getNumberOfFindings(protocol) == 1) { Finding find = findMgmt.getFindings(protocol).get(0); if (find.getDescription().trim().equals("") && find.getExternalReferences().size() == 0 && find.getReferences().size() == 0 && find.getAspects().size() == 0) { return; } } pdfDoc.newPage(); PdfPTable tableFindIntro = new PdfPTable(1); tableFindIntro.setWidthPercentage(100); Phrase phraseFindIntro = new Phrase( translate("The following findings were recorded by the participating reviewers") + " (" + findMgmt.getNumberOfFindings(protocol) + " " + translate("findings") + "): ", boldItalicFont); phraseFindIntro.setLeading(leading); PdfPCell cellFindIntro = new PdfPCell(); cellFindIntro.addElement(phraseFindIntro); cellFindIntro.setBorderWidth(0); cellFindIntro.setPadding(0); cellFindIntro.setPaddingBottom(PDFTools.cmToPt(0.1f)); tableFindIntro.addCell(cellFindIntro); pdfDoc.add(tableFindIntro); writeFindings(protocol, attachExtRefs); } catch (Exception e) { throw new ExportException(translate("Cannot put the selected review meeting in the PDF document.")); } } }
void function(Meeting meeting, boolean attachExtRefs, boolean showSignatureFields) throws ExportException { Protocol protocol = meeting.getProtocol(); if (protocol != null) { try { Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font italicFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldItalicFont = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 10); Font boldFontTitle = new Font( BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252, BaseFont.EMBEDDED), 17); Font italicFontTitle = new Font( BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252, BaseFont.EMBEDDED), 13); PdfPTable tableMeeting = new PdfPTable(2); tableMeeting.setWidthPercentage(100); tableMeeting.setSplitRows(false); tableMeeting.getDefaultCell().setBorderWidth(0); tableMeeting.getDefaultCell().setPadding(0); String meetingDate = sdfDate.format(protocol.getDate().getTime()); String meetingTime = sdfTime.format(protocol.getStart().getTime()) + STR + sdfTime.format(protocol.getEnd().getTime()) + STR + protocol.getEnd().getTimeZone().getDisplayName() + "]"; Anchor anchorTitle = new Anchor(translate(STR) + " " + meetingDate, boldFontTitle); anchorTitle.setName( Long.toString(protocol.getDate().getTimeInMillis() + protocol.getStart().getTimeInMillis())); PdfPCell cellTitle = new PdfPCell(anchorTitle); cellTitle.setColspan(2); cellTitle.setHorizontalAlignment(Element.ALIGN_CENTER); cellTitle.setPadding(0); cellTitle.setBorderWidth(0); cellTitle.setPaddingTop(PDFTools.cmToPt(0.6f)); cellTitle.setPaddingBottom(padding * 2); tableMeeting.addCell(cellTitle); PdfPCell cellTime = new PdfPCell(new Phrase(meetingTime, italicFontTitle)); cellTime.setColspan(2); cellTime.setHorizontalAlignment(Element.ALIGN_CENTER); cellTime.setPadding(0); cellTime.setBorderWidth(0); cellTime.setPaddingBottom(padding * 2); tableMeeting.addCell(cellTime); String location = protocol.getLocation(); if (location.trim().equals(STR--STRLocationSTR: STRThe meeting took place as it has been planned.STRThe meeting didn't take place as it has been planned. The meeting was planned:"), plainFont)); String plannedDate = sdfDate.format(meeting.getPlannedDate().getTime()); String plannedTime = sdfTime.format(meeting.getPlannedStart().getTime()) + STR + sdfTime.format(meeting.getPlannedEnd().getTime()) + STR + meeting.getPlannedEnd().getTimeZone().getDisplayName() + "]STR (STR); STRLocationSTR: STRComments on the Meeting:STRComments on the Findings List:STRSTR--STRSTR--STRThe following attendees participatedSTR (STR STRattendeesSTR):STRSTRThe following findings were recorded by the participating reviewersSTR (STR STRfindingsSTR): STRCannot put the selected review meeting in the PDF document.")); } } }
/** * Writes the given meeting to the protocol. * * @param meeting * the meeting * @param attachExtRefs * true if the external references should be part of the protocol * @param showSignatureFields * true, if the signature fields should be part of the protocol * * @throws ExportException * If an error occurs while writing the meeting */
Writes the given meeting to the protocol
writeMeeting
{ "repo_name": "googol42/revager", "path": "src/org/revager/export/ProtocolPDFExporter.java", "license": "gpl-3.0", "size": 48844 }
[ "com.lowagie.text.Anchor", "com.lowagie.text.Element", "com.lowagie.text.Font", "com.lowagie.text.Phrase", "com.lowagie.text.pdf.BaseFont", "com.lowagie.text.pdf.PdfPCell", "com.lowagie.text.pdf.PdfPTable", "java.util.List", "org.revager.app.model.schema.Meeting", "org.revager.app.model.schema.Pro...
import com.lowagie.text.Anchor; import com.lowagie.text.Element; import com.lowagie.text.Font; import com.lowagie.text.Phrase; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfPCell; import com.lowagie.text.pdf.PdfPTable; import java.util.List; import org.revager.app.model.schema.Meeting; import org.revager.app.model.schema.Protocol; import org.revager.tools.PDFTools;
import com.lowagie.text.*; import com.lowagie.text.pdf.*; import java.util.*; import org.revager.app.model.schema.*; import org.revager.tools.*;
[ "com.lowagie.text", "java.util", "org.revager.app", "org.revager.tools" ]
com.lowagie.text; java.util; org.revager.app; org.revager.tools;
2,596,017
static OtpErlangString otpObjectToOtpString(final OtpErlangObject value) throws ClassCastException { // need special handling if OTP returned an empty list if (value instanceof OtpErlangList) { try { return new OtpErlangString((OtpErlangList) value); } catch (final OtpErlangException e) { throw new ClassCastException("com.ericsson.otp.erlang.OtpErlangList cannot be cast to com.ericsson.otp.erlang.OtpErlangString: " + e.getMessage()); } } else if (value instanceof OtpErlangAtom) { return new OtpErlangString(((OtpErlangAtom) value).atomValue()); } else { return ((OtpErlangString) value); } }
static OtpErlangString otpObjectToOtpString(final OtpErlangObject value) throws ClassCastException { if (value instanceof OtpErlangList) { try { return new OtpErlangString((OtpErlangList) value); } catch (final OtpErlangException e) { throw new ClassCastException(STR + e.getMessage()); } } else if (value instanceof OtpErlangAtom) { return new OtpErlangString(((OtpErlangAtom) value).atomValue()); } else { return ((OtpErlangString) value); } }
/** * Converts an {@link OtpErlangObject} to a {@link OtpErlangString} taking * special care of lists which have not be converted to strings * automatically using the OTP library. * * @param value * the value to convert * * @return the value as a String * * @throws ClassCastException * if the conversion fails */
Converts an <code>OtpErlangObject</code> to a <code>OtpErlangString</code> taking special care of lists which have not be converted to strings automatically using the OTP library
otpObjectToOtpString
{ "repo_name": "tectronics/scalaris", "path": "java-api/src/de/zib/scalaris/ErlangValue.java", "license": "apache-2.0", "size": 23629 }
[ "com.ericsson.otp.erlang.OtpErlangAtom", "com.ericsson.otp.erlang.OtpErlangException", "com.ericsson.otp.erlang.OtpErlangList", "com.ericsson.otp.erlang.OtpErlangObject", "com.ericsson.otp.erlang.OtpErlangString" ]
import com.ericsson.otp.erlang.OtpErlangAtom; import com.ericsson.otp.erlang.OtpErlangException; import com.ericsson.otp.erlang.OtpErlangList; import com.ericsson.otp.erlang.OtpErlangObject; import com.ericsson.otp.erlang.OtpErlangString;
import com.ericsson.otp.erlang.*;
[ "com.ericsson.otp" ]
com.ericsson.otp;
2,348,632
public static final void writeBooleanArrayXml(boolean[] val, String name, XmlSerializer out) throws XmlPullParserException, IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, "boolean-array"); if (name != null) { out.attribute(null, "name", name); } final int N = val.length; out.attribute(null, "num", Integer.toString(N)); for (int i=0; i<N; i++) { out.startTag(null, "item"); out.attribute(null, "value", Boolean.toString(val[i])); out.endTag(null, "item"); } out.endTag(null, "boolean-array"); }
static final void function(boolean[] val, String name, XmlSerializer out) throws XmlPullParserException, IOException { if (val == null) { out.startTag(null, "null"); out.endTag(null, "null"); return; } out.startTag(null, STR); if (name != null) { out.attribute(null, "name", name); } final int N = val.length; out.attribute(null, "num", Integer.toString(N)); for (int i=0; i<N; i++) { out.startTag(null, "item"); out.attribute(null, "value", Boolean.toString(val[i])); out.endTag(null, "item"); } out.endTag(null, STR); }
/** * Flatten a boolean[] into an XmlSerializer. The list can later be read back * with readThisBooleanArrayXml(). * * @param val The boolean array to be flattened. * @param name Name attribute to include with this array's tag, or null for * none. * @param out XmlSerializer to write the array into. * * @see #writeMapXml * @see #writeValueXml * @see #readThisIntArrayXml */
Flatten a boolean[] into an XmlSerializer. The list can later be read back with readThisBooleanArrayXml()
writeBooleanArrayXml
{ "repo_name": "wiki2014/Learning-Summary", "path": "alps/cts/tests/tests/content/src/android/content/cts/util/XmlUtils.java", "license": "gpl-3.0", "size": 62083 }
[ "java.io.IOException", "org.xmlpull.v1.XmlPullParserException", "org.xmlpull.v1.XmlSerializer" ]
import java.io.IOException; import org.xmlpull.v1.XmlPullParserException; import org.xmlpull.v1.XmlSerializer;
import java.io.*; import org.xmlpull.v1.*;
[ "java.io", "org.xmlpull.v1" ]
java.io; org.xmlpull.v1;
12,908
public void restoreLoaderNonConfig(ArrayMap<String, LoaderManager> loaderManagers) { mHost.restoreLoaderNonConfig(loaderManagers); }
void function(ArrayMap<String, LoaderManager> loaderManagers) { mHost.restoreLoaderNonConfig(loaderManagers); }
/** * Restores the saved state for all LoaderManagers. The given LoaderManager list are * LoaderManager instances retained across configuration changes. * * @see #retainLoaderNonConfig() */
Restores the saved state for all LoaderManagers. The given LoaderManager list are LoaderManager instances retained across configuration changes
restoreLoaderNonConfig
{ "repo_name": "xorware/android_frameworks_base", "path": "core/java/android/app/FragmentController.java", "license": "apache-2.0", "size": 14271 }
[ "android.util.ArrayMap" ]
import android.util.ArrayMap;
import android.util.*;
[ "android.util" ]
android.util;
1,432,970
public void autoshrine(final Marker marker, final Message msg) { logger.logIfEnabled(FQCN, AUTOSHRINE, marker, msg, (Throwable) null); }
void function(final Marker marker, final Message msg) { logger.logIfEnabled(FQCN, AUTOSHRINE, marker, msg, (Throwable) null); }
/** * Logs a message with the specific Marker at the {@code AUTOSHRINE} level. * * @param marker the marker data specific to this log statement * @param msg the message string to be logged */
Logs a message with the specific Marker at the AUTOSHRINE level
autoshrine
{ "repo_name": "Betalord/BHBot", "path": "src/main/java/BHBotLogger.java", "license": "gpl-3.0", "size": 177002 }
[ "org.apache.logging.log4j.Marker", "org.apache.logging.log4j.message.Message" ]
import org.apache.logging.log4j.Marker; import org.apache.logging.log4j.message.Message;
import org.apache.logging.log4j.*; import org.apache.logging.log4j.message.*;
[ "org.apache.logging" ]
org.apache.logging;
1,153,310
public List<T> from(Iterable<?> c) { return propertySupport.propertyValues(propertyName, propertyType, c); }
List<T> function(Iterable<?> c) { return propertySupport.propertyValues(propertyName, propertyType, c); }
/** * Extracts the values of the property (specified previously in <code>{@link #extractProperty(String)}</code>) from the elements * of the given <code>{@link Iterable}</code>. * @param c the given {@code Iterable}. * @return the values of the previously specified property extracted from the given {@code Iterable}. * @throws IntrospectionError if an element in the given {@code Iterable} does not have a property with a matching name. */
Extracts the values of the property (specified previously in <code><code>#extractProperty(String)</code></code>) from the elements of the given <code><code>Iterable</code></code>
from
{ "repo_name": "mdecourci/assertj-core", "path": "src/main/java/org/assertj/core/groups/Properties.java", "license": "apache-2.0", "size": 4948 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,493,148
public Boolean organisationHasAuditModule(int organisationId) throws XmlMappingException, IOException, WSClientException{ logger.debug("organisationHasAuditModule START"); Boolean hasAudit; try { //create the bean marshalled into the request OrganisationHasAuditModuleRequest request = new OrganisationHasAuditModuleRequest(); request.setOrganisationId(organisationId); //unmarshall the response to an OrganisationSimple bean OrganisationHasAuditModuleResponse response = (OrganisationHasAuditModuleResponse) getWebServiceTemplate(). marshalSendAndReceive(request); hasAudit = response.getHasAuditModule(); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); //if the soap fault detail field is empty, it means another type of exception than EndpointException has been thrown if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); //soap fault detail field not empty means the Web Service has thrown an EndpointException } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail.getDetailEntries().next(); //unmarshall the soap fault detail element to a WS specific bean named endpointException JAXBElement<OMEndpointExceptionBean> endpointException = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate().getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); //throw a new WSClientException with the code and message of the OMEndpointExceptionBean retrieved previously throw new WSClientException(endpointException.getValue().getCode(),endpointException.getValue().getMessage(), soapFault); } } logger.debug("organisationHasAuditModule END"); return hasAudit; }
Boolean function(int organisationId) throws XmlMappingException, IOException, WSClientException{ logger.debug(STR); Boolean hasAudit; try { OrganisationHasAuditModuleRequest request = new OrganisationHasAuditModuleRequest(); request.setOrganisationId(organisationId); OrganisationHasAuditModuleResponse response = (OrganisationHasAuditModuleResponse) getWebServiceTemplate(). marshalSendAndReceive(request); hasAudit = response.getHasAuditModule(); } catch (SoapFaultClientException soapFault) { SoapFaultDetail soapFaultDetail = soapFault.getSoapFault().getFaultDetail(); if (soapFaultDetail == null) { throw new WSClientException(soapFault.getFaultCode().toString(), soapFault.getFaultStringOrReason(), soapFault); } else { SoapFaultDetailElement soapFaultDetailElement = (SoapFaultDetailElement) soapFaultDetail.getDetailEntries().next(); JAXBElement<OMEndpointExceptionBean> endpointException = (JAXBElement<OMEndpointExceptionBean>) getWebServiceTemplate().getUnmarshaller().unmarshal(soapFaultDetailElement.getSource()); throw new WSClientException(endpointException.getValue().getCode(),endpointException.getValue().getMessage(), soapFault); } } logger.debug(STR); return hasAudit; }
/** * Checks if an organization has the audit module * * @author coni * * @param moduleId * @return * @throws XmlMappingException * @throws IOException * @throws WSClientException */
Checks if an organization has the audit module
organisationHasAuditModule
{ "repo_name": "CodeSphere/termitaria", "path": "TermitariaTS/src/ro/cs/ts/ws/client/om/OMWebServiceClient.java", "license": "agpl-3.0", "size": 21818 }
[ "java.io.IOException", "javax.xml.bind.JAXBElement", "org.springframework.oxm.XmlMappingException", "org.springframework.ws.soap.SoapFaultDetail", "org.springframework.ws.soap.SoapFaultDetailElement", "org.springframework.ws.soap.client.SoapFaultClientException", "ro.cs.ts.exception.WSClientException", ...
import java.io.IOException; import javax.xml.bind.JAXBElement; import org.springframework.oxm.XmlMappingException; import org.springframework.ws.soap.SoapFaultDetail; import org.springframework.ws.soap.SoapFaultDetailElement; import org.springframework.ws.soap.client.SoapFaultClientException; import ro.cs.ts.exception.WSClientException; import ro.cs.ts.ws.client.om.entity.OMEndpointExceptionBean; import ro.cs.ts.ws.client.om.entity.OrganisationHasAuditModuleRequest; import ro.cs.ts.ws.client.om.entity.OrganisationHasAuditModuleResponse;
import java.io.*; import javax.xml.bind.*; import org.springframework.oxm.*; import org.springframework.ws.soap.*; import org.springframework.ws.soap.client.*; import ro.cs.ts.exception.*; import ro.cs.ts.ws.client.om.entity.*;
[ "java.io", "javax.xml", "org.springframework.oxm", "org.springframework.ws", "ro.cs.ts" ]
java.io; javax.xml; org.springframework.oxm; org.springframework.ws; ro.cs.ts;
1,679,874
public static void throwIfUnrecognizedParamName(final Enumeration initParamNames) { val recognizedParameterNames = new HashSet<String>(); recognizedParameterNames.add(ALLOW_MULTI_VALUED_PARAMETERS); recognizedParameterNames.add(PARAMETERS_TO_CHECK); recognizedParameterNames.add(ONLY_POST_PARAMETERS); recognizedParameterNames.add(CHARACTERS_TO_FORBID); recognizedParameterNames.add(THROW_ON_ERROR); recognizedParameterNames.add(PATTERN_TO_BLOCK); while (initParamNames.hasMoreElements()) { val initParamName = (String) initParamNames.nextElement(); if (!recognizedParameterNames.contains(initParamName)) { logException(new ServletException("Unrecognized init parameter [" + initParamName + "].")); } } }
static void function(final Enumeration initParamNames) { val recognizedParameterNames = new HashSet<String>(); recognizedParameterNames.add(ALLOW_MULTI_VALUED_PARAMETERS); recognizedParameterNames.add(PARAMETERS_TO_CHECK); recognizedParameterNames.add(ONLY_POST_PARAMETERS); recognizedParameterNames.add(CHARACTERS_TO_FORBID); recognizedParameterNames.add(THROW_ON_ERROR); recognizedParameterNames.add(PATTERN_TO_BLOCK); while (initParamNames.hasMoreElements()) { val initParamName = (String) initParamNames.nextElement(); if (!recognizedParameterNames.contains(initParamName)) { logException(new ServletException(STR + initParamName + "].")); } } }
/** * Examines the Filter init parameter names and throws ServletException if they contain an unrecognized * init parameter name. * <p> * This is a stateless static method. * <p> * This method is an implementation detail and is not exposed API. * This method is only non-private to allow JUnit testing. * * @param initParamNames init param names, in practice as read from the FilterConfig. */
Examines the Filter init parameter names and throws ServletException if they contain an unrecognized init parameter name. This is a stateless static method. This method is an implementation detail and is not exposed API. This method is only non-private to allow JUnit testing
throwIfUnrecognizedParamName
{ "repo_name": "leleuj/cas", "path": "core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/filters/RequestParameterPolicyEnforcementFilter.java", "license": "apache-2.0", "size": 19859 }
[ "java.util.Enumeration", "java.util.HashSet", "javax.servlet.ServletException" ]
import java.util.Enumeration; import java.util.HashSet; import javax.servlet.ServletException;
import java.util.*; import javax.servlet.*;
[ "java.util", "javax.servlet" ]
java.util; javax.servlet;
1,025,475
protected static boolean isValid(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem) { if (!isValid(player, item)) { return false; } // Item must belong to owner if (refinerItem.getOwnerId() != player.getObjectId()) { return false; } // Lifestone must be located in inventory if (refinerItem.getItemLocation() != ItemLocation.INVENTORY) { return false; } final LifeStone ls = _lifeStones.get(refinerItem.getId()); if (ls == null) { return false; } // weapons can't be augmented with accessory ls if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC)) { return false; } // and accessory can't be augmented with weapon ls if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC)) { return false; } // check for level of the lifestone if (player.getLevel() < ls.getPlayerLevel()) { return false; } return true; }
static boolean function(L2PcInstance player, L2ItemInstance item, L2ItemInstance refinerItem) { if (!isValid(player, item)) { return false; } if (refinerItem.getOwnerId() != player.getObjectId()) { return false; } if (refinerItem.getItemLocation() != ItemLocation.INVENTORY) { return false; } final LifeStone ls = _lifeStones.get(refinerItem.getId()); if (ls == null) { return false; } if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC)) { return false; } if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC)) { return false; } if (player.getLevel() < ls.getPlayerLevel()) { return false; } return true; }
/** * Checks player, source item and lifestone validity for augmentation process * @param player * @param item * @param refinerItem * @return */
Checks player, source item and lifestone validity for augmentation process
isValid
{ "repo_name": "rubenswagner/L2J-Global", "path": "java/com/l2jglobal/gameserver/network/clientpackets/AbstractRefinePacket.java", "license": "gpl-3.0", "size": 16461 }
[ "com.l2jglobal.gameserver.enums.ItemLocation", "com.l2jglobal.gameserver.model.actor.instance.L2PcInstance", "com.l2jglobal.gameserver.model.items.L2Armor", "com.l2jglobal.gameserver.model.items.L2Weapon", "com.l2jglobal.gameserver.model.items.instance.L2ItemInstance" ]
import com.l2jglobal.gameserver.enums.ItemLocation; import com.l2jglobal.gameserver.model.actor.instance.L2PcInstance; import com.l2jglobal.gameserver.model.items.L2Armor; import com.l2jglobal.gameserver.model.items.L2Weapon; import com.l2jglobal.gameserver.model.items.instance.L2ItemInstance;
import com.l2jglobal.gameserver.enums.*; import com.l2jglobal.gameserver.model.actor.instance.*; import com.l2jglobal.gameserver.model.items.*; import com.l2jglobal.gameserver.model.items.instance.*;
[ "com.l2jglobal.gameserver" ]
com.l2jglobal.gameserver;
1,063,383
private double[] removeValues(final double[] input, final Set<Integer> indices) { if (indices.isEmpty()) { return input; } final double[] result = new double[input.length - indices.size()]; for (int i = 0, j = 0; i < input.length; i++) { if (!indices.contains(i)) { result[j++] = input[i]; } } return result; }
double[] function(final double[] input, final Set<Integer> indices) { if (indices.isEmpty()) { return input; } final double[] result = new double[input.length - indices.size()]; for (int i = 0, j = 0; i < input.length; i++) { if (!indices.contains(i)) { result[j++] = input[i]; } } return result; }
/** * Removes all values from the input array at the specified indices. * * @param input the input array * @param indices a set containing the indices to be removed * @return the input array without the values at the specified indices */
Removes all values from the input array at the specified indices
removeValues
{ "repo_name": "tbepler/seq-svm", "path": "src/org/apache/commons/math3/stat/correlation/SpearmansCorrelation.java", "license": "mit", "size": 9945 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
717,263
@RequestMapping("/getWMSCapabilities.do") public ModelAndView getWmsCapabilities(@RequestParam("serviceUrl") String serviceUrl, @RequestParam("version") String version) throws Exception { try { GetCapabilitiesRecord capabilitiesRec = wmsService.getWmsCapabilities(serviceUrl, version); return generateJSONResponseMAV(true, capabilitiesRec, ""); } catch (Exception e) { log.warn(String.format("Unable to retrieve WMS GetCapabilities for '%1$s'", serviceUrl)); log.debug(e); return generateJSONResponseMAV(false, "Unable to process request", null); } }
@RequestMapping(STR) ModelAndView function(@RequestParam(STR) String serviceUrl, @RequestParam(STR) String version) throws Exception { try { GetCapabilitiesRecord capabilitiesRec = wmsService.getWmsCapabilities(serviceUrl, version); return generateJSONResponseMAV(true, capabilitiesRec, STRUnable to retrieve WMS GetCapabilities for '%1$s'STRUnable to process request", null); } }
/** * Gets the GetCapabilities response for the given WMS URL * * @param serviceUrl The WMS URL to query */
Gets the GetCapabilities response for the given WMS URL
getWmsCapabilities
{ "repo_name": "squireg/portal-core", "path": "src/main/java/org/auscope/portal/core/server/controllers/WMSController.java", "license": "lgpl-3.0", "size": 25279 }
[ "org.auscope.portal.core.services.responses.wms.GetCapabilitiesRecord", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestParam", "org.springframework.web.servlet.ModelAndView" ]
import org.auscope.portal.core.services.responses.wms.GetCapabilitiesRecord; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView;
import org.auscope.portal.core.services.responses.wms.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "org.auscope.portal", "org.springframework.web" ]
org.auscope.portal; org.springframework.web;
1,211,793
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long swId, @NotNull Pageable pageable); /** * finds all meta data by the given software module id. * * @param softwareModuleId * the software module id to retrieve the meta data from * @param rsqlParam * filter definition in RSQL syntax * @param pageable * the page request to page the result * @return a paged result of all meta data entries for a given software * module id * * @throws RSQLParameterUnsupportedFieldException * if a field in the RSQL string is used but not provided by the * given {@code fieldNameProvider}
@PreAuthorize(SpringEvalExpressions.HAS_AUTH_READ_REPOSITORY) Page<SoftwareModuleMetadata> findSoftwareModuleMetadataBySoftwareModuleId(@NotNull Long swId, @NotNull Pageable pageable); /** * finds all meta data by the given software module id. * * @param softwareModuleId * the software module id to retrieve the meta data from * @param rsqlParam * filter definition in RSQL syntax * @param pageable * the page request to page the result * @return a paged result of all meta data entries for a given software * module id * * @throws RSQLParameterUnsupportedFieldException * if a field in the RSQL string is used but not provided by the * given {@code fieldNameProvider}
/** * finds all meta data by the given software module id. * * @param swId * the software module id to retrieve the meta data from * @param pageable * the page request to page the result * @return a paged result of all meta data entries for a given software * module id */
finds all meta data by the given software module id
findSoftwareModuleMetadataBySoftwareModuleId
{ "repo_name": "StBurcher/hawkbit", "path": "hawkbit-repository/hawkbit-repository-api/src/main/java/org/eclipse/hawkbit/repository/SoftwareManagement.java", "license": "epl-1.0", "size": 19464 }
[ "javax.validation.constraints.NotNull", "org.eclipse.hawkbit.im.authentication.SpPermission", "org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException", "org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata", "org.springframework.data.domain.Page", "org.springframework.data....
import javax.validation.constraints.NotNull; import org.eclipse.hawkbit.im.authentication.SpPermission; import org.eclipse.hawkbit.repository.exception.RSQLParameterUnsupportedFieldException; import org.eclipse.hawkbit.repository.model.SoftwareModuleMetadata; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.security.access.prepost.PreAuthorize;
import javax.validation.constraints.*; import org.eclipse.hawkbit.im.authentication.*; import org.eclipse.hawkbit.repository.exception.*; import org.eclipse.hawkbit.repository.model.*; import org.springframework.data.domain.*; import org.springframework.security.access.prepost.*;
[ "javax.validation", "org.eclipse.hawkbit", "org.springframework.data", "org.springframework.security" ]
javax.validation; org.eclipse.hawkbit; org.springframework.data; org.springframework.security;
96,717
public String decrypt(String encryptedKey) throws Exception { SecretKeySpec key = new SecretKeySpec(KEY_BYTES, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] decoded = decode(encryptedKey); byte[] plainText = new byte[cipher.getOutputSize(decoded.length)]; int ptLength = cipher.update(decoded, 0, decoded.length, plainText, 0); ptLength += cipher.doFinal(plainText, ptLength); return new String(plainText).substring(0, ptLength); }
String function(String encryptedKey) throws Exception { SecretKeySpec key = new SecretKeySpec(KEY_BYTES, "AES"); Cipher cipher = Cipher.getInstance("AES"); cipher.init(Cipher.DECRYPT_MODE, key); byte[] decoded = decode(encryptedKey); byte[] plainText = new byte[cipher.getOutputSize(decoded.length)]; int ptLength = cipher.update(decoded, 0, decoded.length, plainText, 0); ptLength += cipher.doFinal(plainText, ptLength); return new String(plainText).substring(0, ptLength); }
/** * Decrypts the password. * @param encryptedKey the encrypted password. * @return The plain text password. * @throws Exception If an error occurs. */
Decrypts the password
decrypt
{ "repo_name": "TinyGroup/tiny", "path": "framework/org.tinygroup.commons/src/main/java/org/tinygroup/commons/cryptor/DefaultCryptor.java", "license": "gpl-3.0", "size": 6425 }
[ "javax.crypto.Cipher", "javax.crypto.spec.SecretKeySpec" ]
import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec;
import javax.crypto.*; import javax.crypto.spec.*;
[ "javax.crypto" ]
javax.crypto;
498,218
public Date getUpdated() { return _updated; }
Date function() { return _updated; }
/** * Returns the updated * <p> * @return Returns the updated. * @since Atom 1.0 */
Returns the updated
getUpdated
{ "repo_name": "OpenNTF/collaborationtoday", "path": "DOTSFeedMonster/org.openntf.rome/org.openntf.rome/src/com/sun/syndication/feed/atom/Entry.java", "license": "apache-2.0", "size": 14309 }
[ "java.util.Date" ]
import java.util.Date;
import java.util.*;
[ "java.util" ]
java.util;
65,512
@Test public void testFilterQueryOnFilterView11() { checkNoMaterialize( "select \"name\", \"deptno\" from \"emps\" where " + "(\"salary\" < 1111.9 and \"deptno\" > 10)" + "or (\"empid\" > 400 and \"salary\" > 5000)", "select \"name\" from \"emps\" where \"deptno\" > 30 and \"salary\" > 3000", HR_FKUK_MODEL); }
@Test void function() { checkNoMaterialize( STRname\STRdeptno\STRemps\STR + "(\"salary\STRdeptno\STR + STRempid\STRsalary\STR, STRname\STRemps\STRdeptno\STRsalary\STR, HR_FKUK_MODEL); }
/** As {@link #testFilterQueryOnFilterView()} but condition is weaker in * query and columns selected are subset of columns in materialized view. * Condition here is complex. */
As <code>#testFilterQueryOnFilterView()</code> but condition is weaker in query and columns selected are subset of columns in materialized view
testFilterQueryOnFilterView11
{ "repo_name": "b-slim/calcite", "path": "core/src/test/java/org/apache/calcite/test/MaterializationTest.java", "license": "apache-2.0", "size": 104701 }
[ "org.junit.Test" ]
import org.junit.Test;
import org.junit.*;
[ "org.junit" ]
org.junit;
241,796
@FXML private void check(ActionEvent event) { if (game != null && CheckOperator.getCheckoperator().isApplicable(game) && game.getCurrentplayer().isHuman()) { CheckOperator.getCheckoperator().apply(game); } }
void function(ActionEvent event) { if (game != null && CheckOperator.getCheckoperator().isApplicable(game) && game.getCurrentplayer().isHuman()) { CheckOperator.getCheckoperator().apply(game); } }
/** * Checks if the check operator is applicable. * * @param event an event that occured on the check button */
Checks if the check operator is applicable
check
{ "repo_name": "feco93/Zsir", "path": "src/main/java/hu/zsir/game/MainController.java", "license": "gpl-3.0", "size": 4829 }
[ "hu.zsir.game.operators.CheckOperator" ]
import hu.zsir.game.operators.CheckOperator;
import hu.zsir.game.operators.*;
[ "hu.zsir.game" ]
hu.zsir.game;
1,597,336
@Override public CacheRequest put(URI uri, URLConnection connection) throws IOException { if (!isCacheable(connection)) { return null; } Stack<Frame> stack = mStack.get(); if (stack == null || stack.isEmpty()) { return null; } Frame frame = stack.peek(); // The Android implementation of HttpURLConnection // passes an incorrect URI to this method in some cases, // so let getFile(URLConnection) calculate the // correct value from URLConnection#getURL(). File file = getFile(frame); if (file != null) { File parent = file.getParentFile(); if (parent == null) { logFileError("File has no parent directory", file); return null; } if (!parent.exists() && !parent.mkdirs()) { logFileError("Unable to create parent directory", parent); return null; } if (parent.exists() && !parent.isDirectory()) { logFileError("Parent is not a directory", parent); return null; } if (file.exists() && file.isDirectory()) { logFileError("Destination file is a directory", file); return null; } CacheRequest cacheRequest = createCacheRequest(file, connection); frame.setCacheRequest(cacheRequest); // Disable CacheRequest#abort() because it is called by // the HttpURLConnection implementation when it should not be. // FileResponseCacheContentHandler is responsible for // aborting the CacheRequest instead. return new UnabortableCacheRequest(cacheRequest); } else { return null; } }
CacheRequest function(URI uri, URLConnection connection) throws IOException { if (!isCacheable(connection)) { return null; } Stack<Frame> stack = mStack.get(); if (stack == null stack.isEmpty()) { return null; } Frame frame = stack.peek(); File file = getFile(frame); if (file != null) { File parent = file.getParentFile(); if (parent == null) { logFileError(STR, file); return null; } if (!parent.exists() && !parent.mkdirs()) { logFileError(STR, parent); return null; } if (parent.exists() && !parent.isDirectory()) { logFileError(STR, parent); return null; } if (file.exists() && file.isDirectory()) { logFileError(STR, file); return null; } CacheRequest cacheRequest = createCacheRequest(file, connection); frame.setCacheRequest(cacheRequest); return new UnabortableCacheRequest(cacheRequest); } else { return null; } }
/** * Please see {@link ResponseCache#put(URI, URLConnection)}. */
Please see <code>ResponseCache#put(URI, URLConnection)</code>
put
{ "repo_name": "pierrealexvezinet/excusedemerde", "path": "edm/src/com/google/android/filecache/FileResponseCache.java", "license": "epl-1.0", "size": 27141 }
[ "java.io.File", "java.io.IOException", "java.net.CacheRequest", "java.net.URLConnection", "java.util.Stack" ]
import java.io.File; import java.io.IOException; import java.net.CacheRequest; import java.net.URLConnection; import java.util.Stack;
import java.io.*; import java.net.*; import java.util.*;
[ "java.io", "java.net", "java.util" ]
java.io; java.net; java.util;
2,149,443
public void close() throws IOException { _in.close(); } static class StreamingInputStream extends InputStream { private InputStream _is; private int _length; StreamingInputStream(InputStream is) { _is = is; }
void function() throws IOException { _in.close(); } static class StreamingInputStream extends InputStream { private InputStream _is; private int _length; StreamingInputStream(InputStream is) { _is = is; }
/** * Close the output. */
Close the output
close
{ "repo_name": "pvo99i/hessdroid", "path": "src/com/caucho/hessian/io/Hessian2StreamingInput.java", "license": "apache-2.0", "size": 4363 }
[ "java.io.IOException", "java.io.InputStream" ]
import java.io.IOException; import java.io.InputStream;
import java.io.*;
[ "java.io" ]
java.io;
787,881
@org.junit.Test public void action() throws Exception { RMTHelper helper = RMTHelper.getDefaultInstance(); final ResourceManager r = helper.getResourceManager(); // The username and thr password must be the same a used to connect to the RM final String adminLogin = RMTHelper.defaultUserName; final String adminPassword = RMTHelper.defaultUserPassword; // All accounting values are checked through JMX final RMAuthentication auth = (RMAuthentication) helper.getRMAuth(); final PublicKey pubKey = auth.getPublicKey(); final Credentials adminCreds = Credentials.createCredentials(new CredData(adminLogin, adminPassword), pubKey); final JMXServiceURL jmxRmiServiceURL = new JMXServiceURL(auth .getJMXConnectorURL(JMXTransportProtocol.RMI)); final HashMap<String, Object> env = new HashMap<String, Object>(1); env.put(JMXConnector.CREDENTIALS, new Object[] { adminLogin, adminCreds }); // Connect to the JMX RMI Connector Server final ObjectName myAccountMBeanName = new ObjectName(RMJMXHelper.MYACCOUNT_MBEAN_NAME); final ObjectName managementMBeanName = new ObjectName(RMJMXHelper.MANAGEMENT_MBEAN_NAME); final JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxRmiServiceURL, env); final MBeanServerConnection conn = jmxConnector.getMBeanServerConnection(); long usedNodeTime = (Long) conn.getAttribute(myAccountMBeanName, "UsedNodeTime"); // ADD, GET, RELEASE // 1) ADD Node node = helper.createNode("test").getNode(); final String nodeURL = node.getNodeInformation().getURL(); r.addNode(nodeURL).getBooleanValue(); //we eat the configuring to free helper.waitForAnyNodeEvent(RMEventType.NODE_ADDED); helper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED); // 2) GET final long beforeGetTime = System.currentTimeMillis(); node = r.getAtMostNodes(1, null).get(0); // Sleep a certain amount of time that will be the minimum amount of the GET->RELEASE duration Thread.sleep(GR_DURATION); // 3) REMOVE r.removeNode(nodeURL, true).getBooleanValue(); final long getRemoveMaxDuration = System.currentTimeMillis() - beforeGetTime; // Refresh the account manager conn.invoke(managementMBeanName, "clearAccoutingCache", null, null); // Check account values validity usedNodeTime = (Long) conn.getAttribute(myAccountMBeanName, "UsedNodeTime") - usedNodeTime; Assert.assertTrue("Invalid value of the usedNodeTime attribute", (usedNodeTime >= GR_DURATION) && (usedNodeTime <= getRemoveMaxDuration)); }
@org.junit.Test void function() throws Exception { RMTHelper helper = RMTHelper.getDefaultInstance(); final ResourceManager r = helper.getResourceManager(); final String adminLogin = RMTHelper.defaultUserName; final String adminPassword = RMTHelper.defaultUserPassword; final RMAuthentication auth = (RMAuthentication) helper.getRMAuth(); final PublicKey pubKey = auth.getPublicKey(); final Credentials adminCreds = Credentials.createCredentials(new CredData(adminLogin, adminPassword), pubKey); final JMXServiceURL jmxRmiServiceURL = new JMXServiceURL(auth .getJMXConnectorURL(JMXTransportProtocol.RMI)); final HashMap<String, Object> env = new HashMap<String, Object>(1); env.put(JMXConnector.CREDENTIALS, new Object[] { adminLogin, adminCreds }); final ObjectName myAccountMBeanName = new ObjectName(RMJMXHelper.MYACCOUNT_MBEAN_NAME); final ObjectName managementMBeanName = new ObjectName(RMJMXHelper.MANAGEMENT_MBEAN_NAME); final JMXConnector jmxConnector = JMXConnectorFactory.connect(jmxRmiServiceURL, env); final MBeanServerConnection conn = jmxConnector.getMBeanServerConnection(); long usedNodeTime = (Long) conn.getAttribute(myAccountMBeanName, STR); Node node = helper.createNode("test").getNode(); final String nodeURL = node.getNodeInformation().getURL(); r.addNode(nodeURL).getBooleanValue(); helper.waitForAnyNodeEvent(RMEventType.NODE_ADDED); helper.waitForAnyNodeEvent(RMEventType.NODE_STATE_CHANGED); final long beforeGetTime = System.currentTimeMillis(); node = r.getAtMostNodes(1, null).get(0); Thread.sleep(GR_DURATION); r.removeNode(nodeURL, true).getBooleanValue(); final long getRemoveMaxDuration = System.currentTimeMillis() - beforeGetTime; conn.invoke(managementMBeanName, STR, null, null); usedNodeTime = (Long) conn.getAttribute(myAccountMBeanName, STR) - usedNodeTime; Assert.assertTrue(STR, (usedNodeTime >= GR_DURATION) && (usedNodeTime <= getRemoveMaxDuration)); }
/** * Test function. * @throws Exception */
Test function
action
{ "repo_name": "acontes/scheduling", "path": "src/resource-manager/tests/functionaltests/jmx/account/AddGetRemoveTest.java", "license": "agpl-3.0", "size": 6174 }
[ "java.security.PublicKey", "java.util.HashMap", "javax.management.MBeanServerConnection", "javax.management.ObjectName", "javax.management.remote.JMXConnector", "javax.management.remote.JMXConnectorFactory", "javax.management.remote.JMXServiceURL", "org.junit.Assert", "org.objectweb.proactive.core.n...
import java.security.PublicKey; import java.util.HashMap; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import org.junit.Assert; import org.objectweb.proactive.core.node.Node; import org.ow2.proactive.authentication.crypto.CredData; import org.ow2.proactive.authentication.crypto.Credentials; import org.ow2.proactive.jmx.naming.JMXTransportProtocol; import org.ow2.proactive.resourcemanager.authentication.RMAuthentication; import org.ow2.proactive.resourcemanager.common.event.RMEventType; import org.ow2.proactive.resourcemanager.core.jmx.RMJMXHelper; import org.ow2.proactive.resourcemanager.frontend.ResourceManager;
import java.security.*; import java.util.*; import javax.management.*; import javax.management.remote.*; import org.junit.*; import org.objectweb.proactive.core.node.*; import org.ow2.proactive.authentication.crypto.*; import org.ow2.proactive.jmx.naming.*; import org.ow2.proactive.resourcemanager.authentication.*; import org.ow2.proactive.resourcemanager.common.event.*; import org.ow2.proactive.resourcemanager.core.jmx.*; import org.ow2.proactive.resourcemanager.frontend.*;
[ "java.security", "java.util", "javax.management", "org.junit", "org.objectweb.proactive", "org.ow2.proactive" ]
java.security; java.util; javax.management; org.junit; org.objectweb.proactive; org.ow2.proactive;
1,654,384
private void simpleTest(int datanodeToKill) throws IOException { Configuration conf = new HdfsConfiguration(); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 2000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 2); conf.setInt(DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY, 5000); int myMaxNodes = 5; System.out.println("SimpleTest starting with DataNode to Kill " + datanodeToKill); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(myMaxNodes).build(); cluster.waitActive(); FileSystem fs = cluster.getFileSystem(); short repl = 3; Path filename = new Path("simpletest.dat"); try { // create a file and write one block of data System.out.println("SimpleTest creating file " + filename); FSDataOutputStream stm = createFile(fs, filename, repl); DFSOutputStream dfstream = (DFSOutputStream) (stm.getWrappedStream()); // these are test settings dfstream.setChunksPerPacket(5); dfstream.setArtificialSlowdown(3000); final long myseed = AppendTestUtil.nextLong(); byte[] buffer = AppendTestUtil.randomBytes(myseed, fileSize); int mid = fileSize/4; stm.write(buffer, 0, mid); DatanodeInfo[] targets = dfstream.getPipeline(); int count = 5; while (count-- > 0 && targets == null) { try { System.out.println("SimpleTest: Waiting for pipeline to be created."); Thread.sleep(1000); } catch (InterruptedException e) { } targets = dfstream.getPipeline(); } if (targets == null) { int victim = AppendTestUtil.nextInt(myMaxNodes); System.out.println("SimpleTest stopping datanode random " + victim); cluster.stopDataNode(victim); } else { int victim = datanodeToKill; System.out.println("SimpleTest stopping datanode " + targets[victim]); cluster.stopDataNode(targets[victim].getXferAddr()); } System.out.println("SimpleTest stopping datanode complete"); // write some more data to file, close and verify stm.write(buffer, mid, fileSize - mid); stm.close(); checkFile(fs, filename, repl, numBlocks, fileSize, myseed); } catch (Throwable e) { System.out.println("Simple Workload exception " + e); e.printStackTrace(); assertTrue(e.toString(), false); } finally { fs.close(); cluster.shutdown(); } } @Test public void testSimple0() throws IOException {simpleTest(0);}
void function(int datanodeToKill) throws IOException { Configuration conf = new HdfsConfiguration(); conf.setInt(DFSConfigKeys.DFS_NAMENODE_HEARTBEAT_RECHECK_INTERVAL_KEY, 2000); conf.setInt(DFSConfigKeys.DFS_HEARTBEAT_INTERVAL_KEY, 1); conf.setInt(DFSConfigKeys.DFS_NAMENODE_REPLICATION_PENDING_TIMEOUT_SEC_KEY, 2); conf.setInt(DFSConfigKeys.DFS_CLIENT_SOCKET_TIMEOUT_KEY, 5000); int myMaxNodes = 5; System.out.println(STR + datanodeToKill); MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf).numDataNodes(myMaxNodes).build(); cluster.waitActive(); FileSystem fs = cluster.getFileSystem(); short repl = 3; Path filename = new Path(STR); try { System.out.println(STR + filename); FSDataOutputStream stm = createFile(fs, filename, repl); DFSOutputStream dfstream = (DFSOutputStream) (stm.getWrappedStream()); dfstream.setChunksPerPacket(5); dfstream.setArtificialSlowdown(3000); final long myseed = AppendTestUtil.nextLong(); byte[] buffer = AppendTestUtil.randomBytes(myseed, fileSize); int mid = fileSize/4; stm.write(buffer, 0, mid); DatanodeInfo[] targets = dfstream.getPipeline(); int count = 5; while (count-- > 0 && targets == null) { try { System.out.println(STR); Thread.sleep(1000); } catch (InterruptedException e) { } targets = dfstream.getPipeline(); } if (targets == null) { int victim = AppendTestUtil.nextInt(myMaxNodes); System.out.println(STR + victim); cluster.stopDataNode(victim); } else { int victim = datanodeToKill; System.out.println(STR + targets[victim]); cluster.stopDataNode(targets[victim].getXferAddr()); } System.out.println(STR); stm.write(buffer, mid, fileSize - mid); stm.close(); checkFile(fs, filename, repl, numBlocks, fileSize, myseed); } catch (Throwable e) { System.out.println(STR + e); e.printStackTrace(); assertTrue(e.toString(), false); } finally { fs.close(); cluster.shutdown(); } } public void testSimple0() throws IOException {simpleTest(0);}
/** * Write to one file, then kill one datanode in the pipeline and then * close the file. */
Write to one file, then kill one datanode in the pipeline and then close the file
simpleTest
{ "repo_name": "ZhangXFeng/hadoop", "path": "src/hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestDatanodeDeath.java", "license": "apache-2.0", "size": 14158 }
[ "java.io.IOException", "org.apache.hadoop.conf.Configuration", "org.apache.hadoop.fs.FSDataOutputStream", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path", "org.apache.hadoop.hdfs.protocol.DatanodeInfo", "org.junit.Assert" ]
import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.protocol.DatanodeInfo; import org.junit.Assert;
import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.junit.*;
[ "java.io", "org.apache.hadoop", "org.junit" ]
java.io; org.apache.hadoop; org.junit;
885,133
@Test public void testSubmitEditModifyRevertNotOpenedErrE2E() throws Exception { List<IFileSpec> submittedFiles = null; List<IFileSpec> editedFiles = null; debugPrintTestName("testSubmitEditModifyRevertNotOpenedErrE2E"); String clientRoot = client.getRoot(); assertNotNull("clientRoot should not be Null.", clientRoot); String testText = "This text was added from " + getName(); String newFile = clientRoot + File.separator + testId + File.separator + "testfileNew.txt"; String prepareFile = prepareTestFile(sourceFile, newFile, true); final String[] fileLocalPaths = { clientRoot + File.separator + testId + File.separator + prepareFile }; final String[] filePaths = { createClientPathSyntax(defaultTestClientName, testId + File.separator + prepareFile) }; submittedFiles = taskAddSubmitTestFiles(server, filePaths, P4JTEST_FILETYPE_TEXT, true, true); int validSpecCnt = countValidFileSpecs(submittedFiles); assertTrue("validSpecs should be greater than zero. ", validSpecCnt > 0); verifyTestFileRevision(submittedFiles, filePaths.length, 1); client = server.getClient(getPlatformClientName(defaultTestClientName)); List<IFileSpec> fList = FileSpecBuilder.makeFileSpecList(fileLocalPaths); editedFiles = taskEditModifySubmitTestFiles(server, fList, P4JTEST_RETURNTYPE_ALL, P4JTEST_FILETYPE_TEXT, testText); validSpecCnt = countValidFileSpecs(editedFiles); dumpFileSpecInfo(editedFiles); verifyFilesAdded(submittedFiles, filePaths.length); verifyTestFilesSubmitted(editedFiles, filePaths.length); verifyTestFileRevision(editedFiles, 1, 2); boolean filesMatch = localSystemFileCompare(sourceFile, fileLocalPaths[0]); assertFalse("Source file and submitted file should differ.", filesMatch); List<IFileSpec> revertedFiles = revertTestFiles(client, fList, -999, FileAction.EDIT, 0); // p4ic4idea: this now reports an INFO message. verifyFileSpecInfo(revertedFiles, FileSpecOpStatus.INFO, "file(s) not opened on this client"); }
void function() throws Exception { List<IFileSpec> submittedFiles = null; List<IFileSpec> editedFiles = null; debugPrintTestName(STR); String clientRoot = client.getRoot(); assertNotNull(STR, clientRoot); String testText = STR + getName(); String newFile = clientRoot + File.separator + testId + File.separator + STR; String prepareFile = prepareTestFile(sourceFile, newFile, true); final String[] fileLocalPaths = { clientRoot + File.separator + testId + File.separator + prepareFile }; final String[] filePaths = { createClientPathSyntax(defaultTestClientName, testId + File.separator + prepareFile) }; submittedFiles = taskAddSubmitTestFiles(server, filePaths, P4JTEST_FILETYPE_TEXT, true, true); int validSpecCnt = countValidFileSpecs(submittedFiles); assertTrue(STR, validSpecCnt > 0); verifyTestFileRevision(submittedFiles, filePaths.length, 1); client = server.getClient(getPlatformClientName(defaultTestClientName)); List<IFileSpec> fList = FileSpecBuilder.makeFileSpecList(fileLocalPaths); editedFiles = taskEditModifySubmitTestFiles(server, fList, P4JTEST_RETURNTYPE_ALL, P4JTEST_FILETYPE_TEXT, testText); validSpecCnt = countValidFileSpecs(editedFiles); dumpFileSpecInfo(editedFiles); verifyFilesAdded(submittedFiles, filePaths.length); verifyTestFilesSubmitted(editedFiles, filePaths.length); verifyTestFileRevision(editedFiles, 1, 2); boolean filesMatch = localSystemFileCompare(sourceFile, fileLocalPaths[0]); assertFalse(STR, filesMatch); List<IFileSpec> revertedFiles = revertTestFiles(client, fList, -999, FileAction.EDIT, 0); verifyFileSpecInfo(revertedFiles, FileSpecOpStatus.INFO, STR); }
/** * Create file, Add->Submit(reOpen)->Edit->Modify->Submit->Revert()=Error(files not opened) */
Create file, Add->Submit(reOpen)->Edit->Modify->Submit->Revert()=Error(files not opened)
testSubmitEditModifyRevertNotOpenedErrE2E
{ "repo_name": "groboclown/p4ic4idea", "path": "p4java/src/test/java/com/perforce/p4java/tests/dev/unit/endtoend/ClientEditSubmitE2ETest.java", "license": "apache-2.0", "size": 52979 }
[ "com.perforce.p4java.core.file.FileAction", "com.perforce.p4java.core.file.FileSpecBuilder", "com.perforce.p4java.core.file.FileSpecOpStatus", "com.perforce.p4java.core.file.IFileSpec", "java.io.File", "java.util.List", "org.junit.Assert" ]
import com.perforce.p4java.core.file.FileAction; import com.perforce.p4java.core.file.FileSpecBuilder; import com.perforce.p4java.core.file.FileSpecOpStatus; import com.perforce.p4java.core.file.IFileSpec; import java.io.File; import java.util.List; import org.junit.Assert;
import com.perforce.p4java.core.file.*; import java.io.*; import java.util.*; import org.junit.*;
[ "com.perforce.p4java", "java.io", "java.util", "org.junit" ]
com.perforce.p4java; java.io; java.util; org.junit;
731,689
void assertEquals(String msg, ActionNameMap expected, ActionNameMap actual) { assertEquals("Verify locale", expected.getLocale(), actual.getLocale()); int size = expected.size(); assertEquals(msg + " size ", size, actual.size()); if (size == actual.size()) { for (int i = 0; i < size; i++) { assertEquals(msg + " action ", expected.getAction(i), actual.getAction(i)); assertEquals(msg + " action name", expected.getActionName(i), actual.getActionName(i)); } } }
void assertEquals(String msg, ActionNameMap expected, ActionNameMap actual) { assertEquals(STR, expected.getLocale(), actual.getLocale()); int size = expected.size(); assertEquals(msg + STR, size, actual.size()); if (size == actual.size()) { for (int i = 0; i < size; i++) { assertEquals(msg + STR, expected.getAction(i), actual.getAction(i)); assertEquals(msg + STR, expected.getActionName(i), actual.getActionName(i)); } } }
/** * Verify that two ActionNameMaps are equal. * @param msg the message to print if a compare fails * @param expected the expected map * @param actual the actual map */
Verify that two ActionNameMaps are equal
assertEquals
{ "repo_name": "tommythorn/yari", "path": "shared/cacao-related/phoneme_feature/jsr211/src/i3test/com/sun/midp/content/TestRegReadWrite.java", "license": "gpl-2.0", "size": 11357 }
[ "javax.microedition.content.ActionNameMap" ]
import javax.microedition.content.ActionNameMap;
import javax.microedition.content.*;
[ "javax.microedition" ]
javax.microedition;
2,228,260
@GET @Path("geomz/count") public long getTopicInstancesGeomzCount( @Context UriInfo uriInfo, @Context HttpServletRequest request, @PathParam("projectId") UUID projectId, @PathParam("topicCharacteristicId") UUID topicCharacteristicId) { return new TopicGeomzRbac( projectId, OpenInfraSchemas.PROJECTS, null).getCount( OpenInfraHttpMethod.valueOf(request.getMethod()), uriInfo, topicCharacteristicId); }
@Path(STR) long function( @Context UriInfo uriInfo, @Context HttpServletRequest request, @PathParam(STR) UUID projectId, @PathParam(STR) UUID topicCharacteristicId) { return new TopicGeomzRbac( projectId, OpenInfraSchemas.PROJECTS, null).getCount( OpenInfraHttpMethod.valueOf(request.getMethod()), uriInfo, topicCharacteristicId); }
/** * This is a special representation of the topic object. It delivers always * a list of topic instances with corresponding 3D attribute values as X3D. * <ul> * <li>rest/v1/projects/[uuid]/topiccharacteristics/[topicCharacteristicId]/topicinstances/geomz/count</li> * </ul> * * @param uriInfo * @param request * @param projectId The id of the project where the geom topic * instances are part of. * @param topicCharacteristicId The id of the topic characteristic the * requested geom topic instances count belongs * to. * @return The count of TopicGeomzPojo's. * * @response.representation.200.qname The count of TopicGeomzPojo's as long. * @response.representation.200.doc This is the representation returned by * default. * * @response.representation.403.qname WebApplicationException * @response.representation.403.doc This error occurs if you do not have * the permission to access this * resource. * * @response.representation.500.qname OpenInfraWebException * @response.representation.500.doc An internal error occurs if the * backend runs into an unexpected * exception. */
This is a special representation of the topic object. It delivers always a list of topic instances with corresponding 3D attribute values as X3D. rest/v1/projects/[uuid]/topiccharacteristics/[topicCharacteristicId]/topicinstances/geomz/count
getTopicInstancesGeomzCount
{ "repo_name": "noacktino/core", "path": "openinfra_core/src/main/java/de/btu/openinfra/backend/rest/project/TopicCharacteristicResource.java", "license": "gpl-3.0", "size": 13235 }
[ "de.btu.openinfra.backend.db.OpenInfraSchemas", "de.btu.openinfra.backend.db.rbac.OpenInfraHttpMethod", "de.btu.openinfra.backend.db.rbac.TopicGeomzRbac", "javax.servlet.http.HttpServletRequest", "javax.ws.rs.Path", "javax.ws.rs.PathParam", "javax.ws.rs.core.Context", "javax.ws.rs.core.UriInfo" ]
import de.btu.openinfra.backend.db.OpenInfraSchemas; import de.btu.openinfra.backend.db.rbac.OpenInfraHttpMethod; import de.btu.openinfra.backend.db.rbac.TopicGeomzRbac; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Context; import javax.ws.rs.core.UriInfo;
import de.btu.openinfra.backend.db.*; import de.btu.openinfra.backend.db.rbac.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*;
[ "de.btu.openinfra", "javax.servlet", "javax.ws" ]
de.btu.openinfra; javax.servlet; javax.ws;
2,858,599
public static HistoryStateData getStateData(HistoryState state) { Indicator indicator = null; String indicatorIdent = state.getIndicatorIdent(); if (indicatorIdent != null) { indicator = Indicator.objects .where() .ilike("ident", indicatorIdent) .query() .findUnique(); } List<Country> countries = null; List<String> countryISOList = state.getCountryISOList(); if (countryISOList != null) { countries = Country.objects .where() .in("iso", countryISOList) .findList(); } return new HistoryStateData(indicator, countries); }
static HistoryStateData function(HistoryState state) { Indicator indicator = null; String indicatorIdent = state.getIndicatorIdent(); if (indicatorIdent != null) { indicator = Indicator.objects .where() .ilike("ident", indicatorIdent) .query() .findUnique(); } List<Country> countries = null; List<String> countryISOList = state.getCountryISOList(); if (countryISOList != null) { countries = Country.objects .where() .in("iso", countryISOList) .findList(); } return new HistoryStateData(indicator, countries); }
/** * Exchange a {@link HistoryState} for a {@link HistoryStateData}. * * @param state History state. * @return History state data. */
Exchange a <code>HistoryState</code> for a <code>HistoryStateData</code>
getStateData
{ "repo_name": "snogaraleal/wbi", "path": "app/services/WBIExplorationService.java", "license": "gpl-3.0", "size": 4563 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,824,464
public List<String> getMappedPersistenceUnit(Class<?> clazz) { return this.clazzToPuMap != null ? this.clazzToPuMap.get(clazz.getName()) : null; }
List<String> function(Class<?> clazz) { return this.clazzToPuMap != null ? this.clazzToPuMap.get(clazz.getName()) : null; }
/** * Gets the mapped persistence unit. * * @param clazz * the clazz * * @return the mapped persistence unit */
Gets the mapped persistence unit
getMappedPersistenceUnit
{ "repo_name": "ravisund/Kundera", "path": "src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/ApplicationMetadata.java", "license": "apache-2.0", "size": 13000 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
760,508
public void copyTo(Value target) { if (target == this) { return; } Debug.$assert0.t(!isLongRecordMode()); Debug.$assert0.t(!target.isLongRecordMode()); target.ensureFit(_size); System.arraycopy(_bytes, 0, target._bytes, 0, _size); target._size = _size; target._maximumSize = _maximumSize; target._pointer = _pointer; target._longMode = _longMode; target.reset(); }
void function(Value target) { if (target == this) { return; } Debug.$assert0.t(!isLongRecordMode()); Debug.$assert0.t(!target.isLongRecordMode()); target.ensureFit(_size); System.arraycopy(_bytes, 0, target._bytes, 0, _size); target._size = _size; target._maximumSize = _maximumSize; target._pointer = _pointer; target._longMode = _longMode; target.reset(); }
/** * Copy the state of this <code>Value</code> to another <code>Value</code>. * * @param target * The <code>Value</code> to which state should be copied. */
Copy the state of this <code>Value</code> to another <code>Value</code>
copyTo
{ "repo_name": "jaytaylor/persistit", "path": "src/main/java/com/persistit/Value.java", "license": "epl-1.0", "size": 180447 }
[ "com.persistit.util.Debug" ]
import com.persistit.util.Debug;
import com.persistit.util.*;
[ "com.persistit.util" ]
com.persistit.util;
644,224
public static byte[] transcodeSignatureToDER(byte[] jwsSignature) throws JwtException { int rawLen = jwsSignature.length / 2; int i = rawLen; while((i > 0) && (jwsSignature[rawLen - i] == 0)) i--; int j = i; if (jwsSignature[rawLen - i] < 0) { j += 1; } int k = rawLen; while ((k > 0) && (jwsSignature[2 * rawLen - k] == 0)) k--; int l = k; if (jwsSignature[2 * rawLen - k] < 0) { l += 1; } int len = 2 + j + 2 + l; if (len > 255) { throw new JwtException("Invalid ECDSA signature format"); } int offset; final byte derSignature[]; if (len < 128) { derSignature = new byte[2 + 2 + j + 2 + l]; offset = 1; } else { derSignature = new byte[3 + 2 + j + 2 + l]; derSignature[1] = (byte) 0x81; offset = 2; } derSignature[0] = 48; derSignature[offset++] = (byte) len; derSignature[offset++] = 2; derSignature[offset++] = (byte) j; System.arraycopy(jwsSignature, rawLen - i, derSignature, (offset + j) - i, i); offset += j; derSignature[offset++] = 2; derSignature[offset++] = (byte) l; System.arraycopy(jwsSignature, 2 * rawLen - k, derSignature, (offset + l) - k, k); return derSignature; }
static byte[] function(byte[] jwsSignature) throws JwtException { int rawLen = jwsSignature.length / 2; int i = rawLen; while((i > 0) && (jwsSignature[rawLen - i] == 0)) i--; int j = i; if (jwsSignature[rawLen - i] < 0) { j += 1; } int k = rawLen; while ((k > 0) && (jwsSignature[2 * rawLen - k] == 0)) k--; int l = k; if (jwsSignature[2 * rawLen - k] < 0) { l += 1; } int len = 2 + j + 2 + l; if (len > 255) { throw new JwtException(STR); } int offset; final byte derSignature[]; if (len < 128) { derSignature = new byte[2 + 2 + j + 2 + l]; offset = 1; } else { derSignature = new byte[3 + 2 + j + 2 + l]; derSignature[1] = (byte) 0x81; offset = 2; } derSignature[0] = 48; derSignature[offset++] = (byte) len; derSignature[offset++] = 2; derSignature[offset++] = (byte) j; System.arraycopy(jwsSignature, rawLen - i, derSignature, (offset + j) - i, i); offset += j; derSignature[offset++] = 2; derSignature[offset++] = (byte) l; System.arraycopy(jwsSignature, 2 * rawLen - k, derSignature, (offset + l) - k, k); return derSignature; }
/** * Transcodes the ECDSA JWS signature into ASN.1/DER format for use by * the JCA verifier. * * @param jwsSignature The JWS signature, consisting of the * concatenated R and S values. Must not be * {@code null}. * * @return The ASN.1/DER encoded signature. * * @throws JwtException If the ECDSA JWS signature format is invalid. */
Transcodes the ECDSA JWS signature into ASN.1/DER format for use by the JCA verifier
transcodeSignatureToDER
{ "repo_name": "dogeared/jjwt", "path": "src/main/java/io/jsonwebtoken/impl/crypto/EllipticCurveProvider.java", "license": "apache-2.0", "size": 12298 }
[ "io.jsonwebtoken.JwtException" ]
import io.jsonwebtoken.JwtException;
import io.jsonwebtoken.*;
[ "io.jsonwebtoken" ]
io.jsonwebtoken;
47,723
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) { boolean hasErrors = !resource.getErrors().isEmpty(); if (hasErrors || !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.eclipse.cmf.occi.multicloud.elasticocci.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, "org.eclipse.cmf.occi.multicloud.elasticocci.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } }
Diagnostic function(Resource resource, Exception exception) { boolean hasErrors = !resource.getErrors().isEmpty(); if (hasErrors !resource.getWarnings().isEmpty()) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic (hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, STR, 0, getString(STR, resource.getURI()), new Object [] { exception == null ? (Object)resource : exception }); basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true)); return basicDiagnostic; } else if (exception != null) { return new BasicDiagnostic (Diagnostic.ERROR, STR, 0, getString(STR, resource.getURI()), new Object[] { exception }); } else { return Diagnostic.OK_INSTANCE; } }
/** * Returns a diagnostic describing the errors and warnings listed in the resource * and the specified exception (if any). * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */
Returns a diagnostic describing the errors and warnings listed in the resource and the specified exception (if any).
analyzeResourceProblems
{ "repo_name": "occiware/Multi-Cloud-Studio", "path": "plugins/org.eclipse.cmf.occi.multicloud.elasticocci.editor/src-gen/org/eclipse/cmf/occi/multicloud/elasticocci/presentation/ElasticocciEditor.java", "license": "epl-1.0", "size": 55123 }
[ "org.eclipse.emf.common.util.BasicDiagnostic", "org.eclipse.emf.common.util.Diagnostic", "org.eclipse.emf.ecore.resource.Resource", "org.eclipse.emf.ecore.util.EcoreUtil" ]
import org.eclipse.emf.common.util.BasicDiagnostic; import org.eclipse.emf.common.util.Diagnostic; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.common.util.*; import org.eclipse.emf.ecore.resource.*; import org.eclipse.emf.ecore.util.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,963,042
public static List<UserPermission> getUserPermissions(Connection connection, String tableRegex, byte[] columnFamily, byte[] columnQualifier, String userName) throws Throwable { if (tableRegex == null || tableRegex.isEmpty() || tableRegex.charAt(0) == '@') { throw new IllegalArgumentException("Table name can't be null or empty or a namespace."); } List<UserPermission> permList = new ArrayList<UserPermission>(); try (Admin admin = connection.getAdmin()) { List<TableDescriptor> htds = admin.listTableDescriptors(Pattern.compile(tableRegex), true); // Retrieve table permissions for (TableDescriptor htd : htds) { permList.addAll(admin.getUserPermissions( GetUserPermissionsRequest.newBuilder(htd.getTableName()).withFamily(columnFamily) .withQualifier(columnQualifier).withUserName(userName).build())); } } return permList; }
static List<UserPermission> function(Connection connection, String tableRegex, byte[] columnFamily, byte[] columnQualifier, String userName) throws Throwable { if (tableRegex == null tableRegex.isEmpty() tableRegex.charAt(0) == '@') { throw new IllegalArgumentException(STR); } List<UserPermission> permList = new ArrayList<UserPermission>(); try (Admin admin = connection.getAdmin()) { List<TableDescriptor> htds = admin.listTableDescriptors(Pattern.compile(tableRegex), true); for (TableDescriptor htd : htds) { permList.addAll(admin.getUserPermissions( GetUserPermissionsRequest.newBuilder(htd.getTableName()).withFamily(columnFamily) .withQualifier(columnQualifier).withUserName(userName).build())); } } return permList; }
/** * List all the userPermissions matching the given table pattern, column family and column * qualifier. * @param connection Connection * @param tableRegex The regular expression string to match against. It shouldn't be null, empty * or a namespace regular expression. * @param columnFamily Column family * @param columnQualifier Column qualifier * @param userName User name, if empty then all user permissions will be retrieved. * @return List of UserPermissions * @throws Throwable on failure */
List all the userPermissions matching the given table pattern, column family and column qualifier
getUserPermissions
{ "repo_name": "ultratendency/hbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/AccessControlClient.java", "license": "apache-2.0", "size": 17971 }
[ "java.util.ArrayList", "java.util.List", "java.util.regex.Pattern", "org.apache.hadoop.hbase.client.Admin", "org.apache.hadoop.hbase.client.Connection", "org.apache.hadoop.hbase.client.TableDescriptor" ]
import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.TableDescriptor;
import java.util.*; import java.util.regex.*; import org.apache.hadoop.hbase.client.*;
[ "java.util", "org.apache.hadoop" ]
java.util; org.apache.hadoop;
637,015
public static Long createSessionLog(Connection con, Long userId) { Long sessionId = null; try { //insert PreparedStatement stmt = con.prepareStatement("insert into session_log (user_id) values(?)", Statement.RETURN_GENERATED_KEYS); stmt.setLong(1, userId); stmt.execute(); ResultSet rs = stmt.getGeneratedKeys(); if (rs != null && rs.next()) { sessionId = rs.getLong(1); } DBUtils.closeStmt(stmt); } catch (Exception e) { e.printStackTrace(); } return sessionId; }
static Long function(Connection con, Long userId) { Long sessionId = null; try { PreparedStatement stmt = con.prepareStatement(STR, Statement.RETURN_GENERATED_KEYS); stmt.setLong(1, userId); stmt.execute(); ResultSet rs = stmt.getGeneratedKeys(); if (rs != null && rs.next()) { sessionId = rs.getLong(1); } DBUtils.closeStmt(stmt); } catch (Exception e) { e.printStackTrace(); } return sessionId; }
/** * insert new session record for user * * @param con DB connection * @param userId user id * @return session id */
insert new session record for user
createSessionLog
{ "repo_name": "enascimento/KeyBox", "path": "src/main/java/com/keybox/manage/db/SessionAuditDB.java", "license": "apache-2.0", "size": 12572 }
[ "com.keybox.manage.util.DBUtils", "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.ResultSet", "java.sql.Statement" ]
import com.keybox.manage.util.DBUtils; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.Statement;
import com.keybox.manage.util.*; import java.sql.*;
[ "com.keybox.manage", "java.sql" ]
com.keybox.manage; java.sql;
1,761,552
AuthorizationLevel save(AuthorizationLevel level);
AuthorizationLevel save(AuthorizationLevel level);
/** * Saves the specified authorization level, returning the resulting object */
Saves the specified authorization level, returning the resulting object
save
{ "repo_name": "robertoandrade/cyclos", "path": "src/nl/strohalm/cyclos/services/transfertypes/AuthorizationLevelService.java", "license": "gpl-2.0", "size": 1680 }
[ "nl.strohalm.cyclos.entities.accounts.transactions.AuthorizationLevel" ]
import nl.strohalm.cyclos.entities.accounts.transactions.AuthorizationLevel;
import nl.strohalm.cyclos.entities.accounts.transactions.*;
[ "nl.strohalm.cyclos" ]
nl.strohalm.cyclos;
710,384
public void init(final Vocabulary vocab) { this.namespaceIV = vocab.get(new URIImpl(namespace)); if (namespaceIV == null) log.warn("No vocabulary entry for namespace - URIs with this namespace will not be inlined: namespace=" + namespace); }
void function(final Vocabulary vocab) { this.namespaceIV = vocab.get(new URIImpl(namespace)); if (namespaceIV == null) log.warn(STR + namespace); }
/** * Lookup the namespace IV from the vocabulary. */
Lookup the namespace IV from the vocabulary
init
{ "repo_name": "blazegraph/database", "path": "bigdata-core/bigdata-rdf/src/java/com/bigdata/rdf/internal/InlineURIHandler.java", "license": "gpl-2.0", "size": 4054 }
[ "com.bigdata.rdf.vocab.Vocabulary", "org.openrdf.model.impl.URIImpl" ]
import com.bigdata.rdf.vocab.Vocabulary; import org.openrdf.model.impl.URIImpl;
import com.bigdata.rdf.vocab.*; import org.openrdf.model.impl.*;
[ "com.bigdata.rdf", "org.openrdf.model" ]
com.bigdata.rdf; org.openrdf.model;
1,818,816
static long nextEventNumberFromPath(final Path channelPath) throws IOException { AtomicLong currentlyMostRecent = new AtomicLong(); return Files.list(channelPath) //.filter(f -> Files.isRegularFile(f)) .filter( f -> { // FileName must contain only digits and be written more recently than others if (f.toFile().getName().chars().allMatch(x -> Character.isDigit(x)) && f.toFile().lastModified() >= currentlyMostRecent.get()) { currentlyMostRecent.set(f.toFile().lastModified()); return true; } else { return false; } } ) .mapToLong(f -> Long.parseLong(f.toFile().getName())) .max() .orElse(-1) + 1l; // }
static long nextEventNumberFromPath(final Path channelPath) throws IOException { AtomicLong currentlyMostRecent = new AtomicLong(); return Files.list(channelPath) .filter( f -> { if (f.toFile().getName().chars().allMatch(x -> Character.isDigit(x)) && f.toFile().lastModified() >= currentlyMostRecent.get()) { currentlyMostRecent.set(f.toFile().lastModified()); return true; } else { return false; } } ) .mapToLong(f -> Long.parseLong(f.toFile().getName())) .max() .orElse(-1) + 1l;
/** * Look at all the files in the channel and return the event number of the next one * to be created. * @param channelPath * @return theNextValidEventNumber */
Look at all the files in the channel and return the event number of the next one to be created
nextEventNumberFromPath
{ "repo_name": "Tesco/mewbase", "path": "mewbase-core/src/main/java/io/mewbase/eventsource/impl/file/FileEventUtils.java", "license": "mit", "size": 4836 }
[ "java.io.IOException", "java.nio.file.Files", "java.nio.file.Path", "java.util.concurrent.atomic.AtomicLong" ]
import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.concurrent.atomic.AtomicLong;
import java.io.*; import java.nio.file.*; import java.util.concurrent.atomic.*;
[ "java.io", "java.nio", "java.util" ]
java.io; java.nio; java.util;
1,069,729
public static CommandLineOptions makeOptions(String calExpression, ModuleName moduleName, Level verbosity, Logger logger) { if (calExpression == null) { logger.severe("Error: No cal expression provided."); return null; } if (moduleName == null) { // Attempt to catch invalid expressions early. SourceModel.Expr expr = SourceModelUtilities.TextParsing.parseExprIntoSourceModel(calExpression); if (expr == null) { logger.severe("Error: \"" + calExpression + "\"" + " is not a valid CAL expression."); return null; } // Pick out the module name if the remaining expression is a dc or var expression. if (expr instanceof SourceModel.Expr.DataCons) { SourceModel.Expr.DataCons dataCons = (SourceModel.Expr.DataCons)expr; moduleName = SourceModel.Name.Module.maybeToModuleName(dataCons.getDataConsName().getModuleName()); // may be null } else if (expr instanceof SourceModel.Expr.Var) { SourceModel.Expr.Var var = (SourceModel.Expr.Var)expr; moduleName = SourceModel.Name.Module.maybeToModuleName(var.getVarName().getModuleName()); // may be null. } // if the module name is still null, we can't continue. if (moduleName == null) { logger.severe("Error: No module name provided."); return null; } } return new CommandLineOptions(calExpression, moduleName, verbosity); }
static CommandLineOptions function(String calExpression, ModuleName moduleName, Level verbosity, Logger logger) { if (calExpression == null) { logger.severe(STR); return null; } if (moduleName == null) { SourceModel.Expr expr = SourceModelUtilities.TextParsing.parseExprIntoSourceModel(calExpression); if (expr == null) { logger.severe(STRSTR\STR is not a valid CAL expression.STRError: No module name provided."); return null; } } return new CommandLineOptions(calExpression, moduleName, verbosity); }
/** * Create a command-line options object given the arguments. * * @param calExpression * @param moduleName * @param verbosity * @param logger the logger to which to log any errors. * * @return the options object, or null if there were errors in the provided option arguments. * If null, errors will have been logged to the logger. */
Create a command-line options object given the arguments
makeOptions
{ "repo_name": "levans/Open-Quark", "path": "src/CAL_Platform/src/org/openquark/cal/CAL.java", "license": "bsd-3-clause", "size": 22870 }
[ "java.util.logging.Level", "java.util.logging.Logger", "org.openquark.cal.compiler.ModuleName", "org.openquark.cal.compiler.SourceModel", "org.openquark.cal.compiler.SourceModelUtilities" ]
import java.util.logging.Level; import java.util.logging.Logger; import org.openquark.cal.compiler.ModuleName; import org.openquark.cal.compiler.SourceModel; import org.openquark.cal.compiler.SourceModelUtilities;
import java.util.logging.*; import org.openquark.cal.compiler.*;
[ "java.util", "org.openquark.cal" ]
java.util; org.openquark.cal;
1,648,404
public void doctypeDecl( String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException { // call handlers if (fDocumentHandler != null) { fDocumentHandler.doctypeDecl(rootElement, publicId, systemId, augs); } } // doctypeDecl(String,String,String)
void function( String rootElement, String publicId, String systemId, Augmentations augs) throws XNIException { if (fDocumentHandler != null) { fDocumentHandler.doctypeDecl(rootElement, publicId, systemId, augs); } }
/** * Notifies of the presence of the DOCTYPE line in the document. * * @param rootElement The name of the root element. * @param publicId The public identifier if an external DTD or null * if the external DTD is specified using SYSTEM. * @param systemId The system identifier if an external DTD, null * otherwise. * @param augs Additional information that may include infoset augmentations * * @throws XNIException Thrown by handler to signal an error. */
Notifies of the presence of the DOCTYPE line in the document
doctypeDecl
{ "repo_name": "PrincetonUniversity/NVJVM", "path": "build/linux-amd64/jaxp/drop/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java", "license": "gpl-2.0", "size": 177439 }
[ "com.sun.org.apache.xerces.internal.xni.Augmentations", "com.sun.org.apache.xerces.internal.xni.XNIException" ]
import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XNIException;
import com.sun.org.apache.xerces.internal.xni.*;
[ "com.sun.org" ]
com.sun.org;
2,721,992
@ServiceMethod(returns = ReturnType.SINGLE) public Mono<VirtualMachineInner> updateAsync( String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { return beginUpdateAsync(resourceGroupName, vmName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); }
@ServiceMethod(returns = ReturnType.SINGLE) Mono<VirtualMachineInner> function( String resourceGroupName, String vmName, VirtualMachineUpdateInner parameters) { return beginUpdateAsync(resourceGroupName, vmName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); }
/** * The operation to update a virtual machine. * * @param resourceGroupName The name of the resource group. * @param vmName The name of the virtual machine. * @param parameters Parameters supplied to the Update Virtual Machine operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ApiErrorException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return describes a Virtual Machine on successful completion of {@link Mono}. */
The operation to update a virtual machine
updateAsync
{ "repo_name": "Azure/azure-sdk-for-java", "path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/implementation/VirtualMachinesClientImpl.java", "license": "mit", "size": 333925 }
[ "com.azure.core.annotation.ReturnType", "com.azure.core.annotation.ServiceMethod", "com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner", "com.azure.resourcemanager.compute.fluent.models.VirtualMachineUpdateInner" ]
import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineInner; import com.azure.resourcemanager.compute.fluent.models.VirtualMachineUpdateInner;
import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.fluent.models.*;
[ "com.azure.core", "com.azure.resourcemanager" ]
com.azure.core; com.azure.resourcemanager;
902,587
public void createAuthor(String email, Date dob, String name, String displayName, String bio) { try { Connection connection = dataSource.getConnection(); String sql = "INSERT INTO AUTHOR VALUES (?,?,?,?,?)"; PreparedStatement ppsm = connection.prepareStatement(sql); ppsm.setString(1, email); ppsm.setString(2, bio); ppsm.setString(3, displayName); if (dob != null) ppsm.setDate(4, new java.sql.Date(dob.getTime())); else ppsm.setDate(4, null); ppsm.setString(5, name); int insertRows = ppsm.executeUpdate(); ppsm.close(); connection.close(); if (insertRows != 1) throw new IllegalArgumentException("The Author " + email + " cannot be inserted."); } catch (SQLException e) { e.printStackTrace(); throw new IllegalArgumentException(e.getMessage()); } }
void function(String email, Date dob, String name, String displayName, String bio) { try { Connection connection = dataSource.getConnection(); String sql = STR; PreparedStatement ppsm = connection.prepareStatement(sql); ppsm.setString(1, email); ppsm.setString(2, bio); ppsm.setString(3, displayName); if (dob != null) ppsm.setDate(4, new java.sql.Date(dob.getTime())); else ppsm.setDate(4, null); ppsm.setString(5, name); int insertRows = ppsm.executeUpdate(); ppsm.close(); connection.close(); if (insertRows != 1) throw new IllegalArgumentException(STR + email + STR); } catch (SQLException e) { e.printStackTrace(); throw new IllegalArgumentException(e.getMessage()); } }
/** * Create an author record * * @param a * The author object to be created * @throws ParseException * @throws ParseException */
Create an author record
createAuthor
{ "repo_name": "WouterBanckenACA/aries", "path": "samples/blog/blog-persistence-jdbc/src/main/java/org/apache/aries/samples/blog/persistence/jdbc/BlogPersistenceServiceImpl.java", "license": "apache-2.0", "size": 20662 }
[ "java.sql.Connection", "java.sql.PreparedStatement", "java.sql.SQLException", "java.util.Date" ]
import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.Date;
import java.sql.*; import java.util.*;
[ "java.sql", "java.util" ]
java.sql; java.util;
2,249,034
public IBasicExpression compile(Element expressionElement) throws BadQueryException;
IBasicExpression function(Element expressionElement) throws BadQueryException;
/** * Compiles an IBasicExpression (-tree) from the given <code>expressionElement</code>. * * @param expressionElement the (root) expression Element to compile * into an IBasicExpression. * * @return the compiled IBasicExpression. * * @throws BadQueryException if compiling the expression failed. */
Compiles an IBasicExpression (-tree) from the given <code>expressionElement</code>
compile
{ "repo_name": "integrated/jakarta-slide-server", "path": "src/share/org/apache/slide/search/basic/IBasicExpressionCompiler.java", "license": "apache-2.0", "size": 1768 }
[ "org.apache.slide.search.BadQueryException", "org.jdom.a.Element" ]
import org.apache.slide.search.BadQueryException; import org.jdom.a.Element;
import org.apache.slide.search.*; import org.jdom.a.*;
[ "org.apache.slide", "org.jdom.a" ]
org.apache.slide; org.jdom.a;
928,615
private void testVariance(String testName, Sparsity sparsity, DataType dataType, ExecType platform) { boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG; RUNTIME_PLATFORM platformOld = setRuntimePlatform(platform); if(shouldSkipTest()) return; try { // Create and load test configuration getAndLoadTestConfiguration(testName); String HOME = SCRIPT_DIR + TEST_DIR; fullDMLScriptName = HOME + testName + ".dml"; programArgs = new String[]{"-explain", "-stats", "-args", input(INPUT_NAME), output(OUTPUT_NAME)}; fullRScriptName = HOME + testName + ".R"; rCmd = "Rscript" + " " + fullRScriptName + " " + inputDir() + " " + expectedDir(); // Generate data // - sparsity double sparsityVal; switch (sparsity) { case EMPTY: sparsityVal = 0; break; case SPARSE: sparsityVal = sparsitySparse; break; case DENSE: default: sparsityVal = sparsityDense; } // - size int r; int c; switch (dataType) { case ROWVECTOR: r = 1; c = cols; break; case COLUMNVECTOR: r = rows; c = 1; break; case MATRIX: default: r = rows; c = cols; } // - generation double[][] X = getRandomMatrix(r, c, -1, 1, sparsityVal, 7); writeInputMatrixWithMTD(INPUT_NAME, X, true); // Run DML and R scripts runTest(true, false, null, -1); runRScript(true); // Compare output matrices HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS(OUTPUT_NAME); HashMap<CellIndex, Double> rfile = readRMatrixFromFS(OUTPUT_NAME); TestUtils.compareMatrices(dmlfile, rfile, eps, "Stat-DML", "Stat-R"); } finally { // Reset settings rtplatform = platformOld; DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld; } }
void function(String testName, Sparsity sparsity, DataType dataType, ExecType platform) { boolean sparkConfigOld = DMLScript.USE_LOCAL_SPARK_CONFIG; RUNTIME_PLATFORM platformOld = setRuntimePlatform(platform); if(shouldSkipTest()) return; try { getAndLoadTestConfiguration(testName); String HOME = SCRIPT_DIR + TEST_DIR; fullDMLScriptName = HOME + testName + ".dml"; programArgs = new String[]{STR, STR, "-args", input(INPUT_NAME), output(OUTPUT_NAME)}; fullRScriptName = HOME + testName + ".R"; rCmd = STR + " " + fullRScriptName + " " + inputDir() + " " + expectedDir(); double sparsityVal; switch (sparsity) { case EMPTY: sparsityVal = 0; break; case SPARSE: sparsityVal = sparsitySparse; break; case DENSE: default: sparsityVal = sparsityDense; } int r; int c; switch (dataType) { case ROWVECTOR: r = 1; c = cols; break; case COLUMNVECTOR: r = rows; c = 1; break; case MATRIX: default: r = rows; c = cols; } double[][] X = getRandomMatrix(r, c, -1, 1, sparsityVal, 7); writeInputMatrixWithMTD(INPUT_NAME, X, true); runTest(true, false, null, -1); runRScript(true); HashMap<CellIndex, Double> dmlfile = readDMLMatrixFromHDFS(OUTPUT_NAME); HashMap<CellIndex, Double> rfile = readRMatrixFromFS(OUTPUT_NAME); TestUtils.compareMatrices(dmlfile, rfile, eps, STR, STR); } finally { rtplatform = platformOld; DMLScript.USE_LOCAL_SPARK_CONFIG = sparkConfigOld; } }
/** * Test the variance function, "var(X)", on * dense/sparse matrices/vectors on the CP/Spark/MR platforms. * * @param testName The name of this test case. * @param sparsity Selection between empty, sparse, and dense data. * @param dataType Selection between a matrix, a row vector, and a * column vector. * @param platform Selection between CP/Spark/MR platforms. */
Test the variance function, "var(X)", on dense/sparse matrices/vectors on the CP/Spark/MR platforms
testVariance
{ "repo_name": "deroneriksson/incubator-systemml", "path": "src/test/java/org/apache/sysml/test/integration/functions/aggregate/VarianceTest.java", "license": "apache-2.0", "size": 9491 }
[ "java.util.HashMap", "org.apache.sysml.api.DMLScript", "org.apache.sysml.lops.LopProperties", "org.apache.sysml.runtime.matrix.data.MatrixValue", "org.apache.sysml.test.utils.TestUtils" ]
import java.util.HashMap; import org.apache.sysml.api.DMLScript; import org.apache.sysml.lops.LopProperties; import org.apache.sysml.runtime.matrix.data.MatrixValue; import org.apache.sysml.test.utils.TestUtils;
import java.util.*; import org.apache.sysml.api.*; import org.apache.sysml.lops.*; import org.apache.sysml.runtime.matrix.data.*; import org.apache.sysml.test.utils.*;
[ "java.util", "org.apache.sysml" ]
java.util; org.apache.sysml;
2,331,388
private static SimpleSubmission<?> createSubmission(int[] procTimes, List<Long> times, int index) { List<Command> commands = null; if (procTimes != null) { commands = new ArrayList<>(); for (int procTime : procTimes) { commands.add(new SimpleCommand("process " + procTime, (outputLine, outputStore) -> "ready".equals(outputLine))); } } return new SimpleSubmission<Object>(commands) {
static SimpleSubmission<?> function(int[] procTimes, List<Long> times, int index) { List<Command> commands = null; if (procTimes != null) { commands = new ArrayList<>(); for (int procTime : procTimes) { commands.add(new SimpleCommand(STR + procTime, (outputLine, outputStore) -> "ready".equals(outputLine))); } } return new SimpleSubmission<Object>(commands) {
/** * Creates a submission to submit to a test process. * * @param procTimes An array of the number of processing cycles each command of the submission is to entail. * {@link Command#isCompleted(String, boolean)} method is invoked. * @param times A list of times that the submission is to update upon its completion to calculate the execution duration. * @param index The index of the submission. Only the element at this index is to be updated in <code>times</code>. * @return The submission. */
Creates a submission to submit to a test process
createSubmission
{ "repo_name": "ViktorC/PSPPool", "path": "src/test/java/net/viktorc/pp4j/impl/PPEPerformanceTest.java", "license": "gpl-2.0", "size": 11783 }
[ "java.util.ArrayList", "java.util.List", "net.viktorc.pp4j.api.Command" ]
import java.util.ArrayList; import java.util.List; import net.viktorc.pp4j.api.Command;
import java.util.*; import net.viktorc.pp4j.api.*;
[ "java.util", "net.viktorc.pp4j" ]
java.util; net.viktorc.pp4j;
1,300,982
if (object == null) return "None"; if (object instanceof Class) { return ((Class<?>) object).getName(); } if (object instanceof Collection) { @SuppressWarnings("unchecked") Collection<Object> collection = (Collection<Object>) object; String elements = collection.stream().map(Tracker::display).collect(Collectors.joining(", ")); return String.format(Locale.ENGLISH, "[%s]", elements); } if (object.getClass().isArray()) { if (object.getClass().getComponentType().isPrimitive()) { return getString(object); } Object[] array = (Object[]) object; String elements = Arrays.stream(array).map(Tracker::display).collect(Collectors.joining(", ")); return String.format(Locale.ENGLISH, "%s{%s}", object.getClass().getSimpleName(), elements); } if (String.class.isAssignableFrom(object.getClass())) { return String.format(Locale.ENGLISH, "\"%s\"", object.toString().replace('\u0000', '\ufffd')); } return object.toString().replace('\u0000', '\ufffd'); }
if (object == null) return "None"; if (object instanceof Class) { return ((Class<?>) object).getName(); } if (object instanceof Collection) { @SuppressWarnings(STR) Collection<Object> collection = (Collection<Object>) object; String elements = collection.stream().map(Tracker::display).collect(Collectors.joining(STR)); return String.format(Locale.ENGLISH, "[%s]", elements); } if (object.getClass().isArray()) { if (object.getClass().getComponentType().isPrimitive()) { return getString(object); } Object[] array = (Object[]) object; String elements = Arrays.stream(array).map(Tracker::display).collect(Collectors.joining(STR)); return String.format(Locale.ENGLISH, STR, object.getClass().getSimpleName(), elements); } if (String.class.isAssignableFrom(object.getClass())) { return String.format(Locale.ENGLISH, "\"%s\"", object.toString().replace('\u0000', '\ufffd')); } return object.toString().replace('\u0000', '\ufffd'); }
/** * Display string. * * @param object the object * @return the string */
Display string
display
{ "repo_name": "apache/solr", "path": "solr/benchmark/src/java/org/apache/solr/bench/generators/Tracker.java", "license": "apache-2.0", "size": 4862 }
[ "java.util.Arrays", "java.util.Collection", "java.util.Locale", "java.util.stream.Collectors" ]
import java.util.Arrays; import java.util.Collection; import java.util.Locale; import java.util.stream.Collectors;
import java.util.*; import java.util.stream.*;
[ "java.util" ]
java.util;
952,341
Duration interFrameDelayVariationForwardMin();
Duration interFrameDelayVariationForwardMin();
/** * The minimum one-way inter-frame delay interval in the forward direction. * calculated by this MEP for this Measurement Interval. * @return A java duration */
The minimum one-way inter-frame delay interval in the forward direction. calculated by this MEP for this Measurement Interval
interFrameDelayVariationForwardMin
{ "repo_name": "sdnwiselab/onos", "path": "incubator/api/src/main/java/org/onosproject/incubator/net/l2monitoring/soam/delay/DelayMeasurementStat.java", "license": "apache-2.0", "size": 13086 }
[ "java.time.Duration" ]
import java.time.Duration;
import java.time.*;
[ "java.time" ]
java.time;
1,974,872
public void testExe() throws Exception { String ret = content(F.asMap("cmd", GridRestCommand.EXE.key())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info("Exe command result: " + ret); jsonEquals(ret, pattern("null", false)); // Attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", "UNKNOWN_TASK")); assertNotNull(ret); assertTrue(!ret.isEmpty()); info("Exe command result: " + ret); jsonEquals(ret, pattern("null", false)); grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader()); grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader()); ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info("Exe command result: " + ret); jsonEquals(ret, pattern("\\{.+\\}", true)); ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info("Exe command result: " + ret); jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true)); ret = content(F.asMap("cmd", GridRestCommand.RESULT.key())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info("Exe command result: " + ret); jsonEquals(ret, pattern("null", false)); }
void function() throws Exception { String ret = content(F.asMap("cmd", GridRestCommand.EXE.key())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info(STR + ret); jsonEquals(ret, pattern("null", false)); ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", STR)); assertNotNull(ret); assertTrue(!ret.isEmpty()); info(STR + ret); jsonEquals(ret, pattern("null", false)); grid(0).compute().localDeployTask(TestTask1.class, TestTask1.class.getClassLoader()); grid(0).compute().localDeployTask(TestTask2.class, TestTask2.class.getClassLoader()); ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask1.class.getName())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info(STR + ret); jsonEquals(ret, pattern(STR, true)); ret = content(F.asMap("cmd", GridRestCommand.EXE.key(), "name", TestTask2.class.getName())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info(STR + ret); jsonEquals(ret, pattern("\\{.+" + TestTask2.RES + ".+\\}", true)); ret = content(F.asMap("cmd", GridRestCommand.RESULT.key())); assertNotNull(ret); assertTrue(!ret.isEmpty()); info(STR + ret); jsonEquals(ret, pattern("null", false)); }
/** * Tests {@code exe} command. * <p> * Note that attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server. * * @throws Exception If failed. */
Tests exe command. Note that attempt to execute unknown task (UNKNOWN_TASK) will result in exception on server
testExe
{ "repo_name": "shurun19851206/ignite", "path": "modules/clients/src/test/java/org/apache/ignite/internal/processors/rest/JettyRestProcessorAbstractSelfTest.java", "license": "apache-2.0", "size": 39992 }
[ "org.apache.ignite.internal.util.typedef.F" ]
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.*;
[ "org.apache.ignite" ]
org.apache.ignite;
488,953
public static void timeoutTask(CompletionService completionService) { if (completionService instanceof SubmitOrderedCompletionService) { ((SubmitOrderedCompletionService) completionService).timeoutTask(); } } private static final class CamelThreadFactory implements ThreadFactory { private final String pattern; private final String name; private final boolean daemon; private CamelThreadFactory(String pattern, String name, boolean daemon) { this.pattern = pattern; this.name = name; this.daemon = daemon; }
static void function(CompletionService completionService) { if (completionService instanceof SubmitOrderedCompletionService) { ((SubmitOrderedCompletionService) completionService).timeoutTask(); } } private static final class CamelThreadFactory implements ThreadFactory { private final String pattern; private final String name; private final boolean daemon; private CamelThreadFactory(String pattern, String name, boolean daemon) { this.pattern = pattern; this.name = name; this.daemon = daemon; }
/** * Timeout the completion service. * <p/> * This can be used to mark the completion service as timed out, allowing you to poll any already completed tasks. * This applies when using the {@link SubmitOrderedCompletionService}. * * @param completionService the completion service. */
Timeout the completion service. This can be used to mark the completion service as timed out, allowing you to poll any already completed tasks. This applies when using the <code>SubmitOrderedCompletionService</code>
timeoutTask
{ "repo_name": "everttigchelaar/camel-svn", "path": "camel-core/src/main/java/org/apache/camel/util/concurrent/ExecutorServiceHelper.java", "license": "apache-2.0", "size": 17861 }
[ "java.util.concurrent.CompletionService", "java.util.concurrent.ThreadFactory" ]
import java.util.concurrent.CompletionService; import java.util.concurrent.ThreadFactory;
import java.util.concurrent.*;
[ "java.util" ]
java.util;
1,106,014
protected void sort() { Collections.sort(m_List, m_Comparator); }
void function() { Collections.sort(m_List, m_Comparator); }
/** * Sorts the list. */
Sorts the list
sort
{ "repo_name": "waikato-datamining/adams-base", "path": "adams-core/src/main/java/adams/data/SortedList.java", "license": "gpl-3.0", "size": 11522 }
[ "java.util.Collections", "java.util.Comparator", "java.util.List" ]
import java.util.Collections; import java.util.Comparator; import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,193,934
public static Schema parseSchemaFromFile(Path filePath, FileSystem fs) throws IOException { Closer closer = Closer.create(); try { InputStream in = closer.register(fs.open(filePath)); return new Schema.Parser().parse(in); } finally { closer.close(); } }
static Schema function(Path filePath, FileSystem fs) throws IOException { Closer closer = Closer.create(); try { InputStream in = closer.register(fs.open(filePath)); return new Schema.Parser().parse(in); } finally { closer.close(); } }
/** * Parse Avro schema from a schema file. */
Parse Avro schema from a schema file
parseSchemaFromFile
{ "repo_name": "Hanmourang/Gobblin", "path": "gobblin-utility/src/main/java/gobblin/util/AvroUtils.java", "license": "apache-2.0", "size": 18467 }
[ "com.google.common.io.Closer", "java.io.IOException", "java.io.InputStream", "org.apache.avro.Schema", "org.apache.hadoop.fs.FileSystem", "org.apache.hadoop.fs.Path" ]
import com.google.common.io.Closer; import java.io.IOException; import java.io.InputStream; import org.apache.avro.Schema; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path;
import com.google.common.io.*; import java.io.*; import org.apache.avro.*; import org.apache.hadoop.fs.*;
[ "com.google.common", "java.io", "org.apache.avro", "org.apache.hadoop" ]
com.google.common; java.io; org.apache.avro; org.apache.hadoop;
1,639,250
private Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> getTopicIndicatorMap() { final DataContainer<ViewWorldbankIndicatorDataCountrySummary, WorldbankIndicatorDataCountrySummaryEmbeddedId> indicatorDataCountrSummaryDailyDataContainer = applicationManager .getDataContainer(ViewWorldbankIndicatorDataCountrySummary.class); return indicatorDataCountrSummaryDailyDataContainer .findListByEmbeddedProperty(ViewWorldbankIndicatorDataCountrySummary.class,ViewWorldbankIndicatorDataCountrySummary_.embeddedId,WorldbankIndicatorDataCountrySummaryEmbeddedId.class,WorldbankIndicatorDataCountrySummaryEmbeddedId_.countryId,"SE").parallelStream() .filter(t -> t != null && t.getSourceValue() != null && t.getEndYear() > DATA_POINTS_FOR_YEAR_ABOVE && t.getDataPoint() > MINIMUM_NUMBER_DATA_POINTS) .flatMap(t -> Arrays.asList(t.getTopics().split(";")).stream() .map(topic -> new AbstractMap.SimpleEntry<>(topic, t))) .collect(Collectors.groupingBy(SimpleEntry::getKey, Collectors.mapping(SimpleEntry::getValue, Collectors.toList()))); }
Map<String, List<ViewWorldbankIndicatorDataCountrySummary>> function() { final DataContainer<ViewWorldbankIndicatorDataCountrySummary, WorldbankIndicatorDataCountrySummaryEmbeddedId> indicatorDataCountrSummaryDailyDataContainer = applicationManager .getDataContainer(ViewWorldbankIndicatorDataCountrySummary.class); return indicatorDataCountrSummaryDailyDataContainer .findListByEmbeddedProperty(ViewWorldbankIndicatorDataCountrySummary.class,ViewWorldbankIndicatorDataCountrySummary_.embeddedId,WorldbankIndicatorDataCountrySummaryEmbeddedId.class,WorldbankIndicatorDataCountrySummaryEmbeddedId_.countryId,"SE").parallelStream() .filter(t -> t != null && t.getSourceValue() != null && t.getEndYear() > DATA_POINTS_FOR_YEAR_ABOVE && t.getDataPoint() > MINIMUM_NUMBER_DATA_POINTS) .flatMap(t -> Arrays.asList(t.getTopics().split(";")).stream() .map(topic -> new AbstractMap.SimpleEntry<>(topic, t))) .collect(Collectors.groupingBy(SimpleEntry::getKey, Collectors.mapping(SimpleEntry::getValue, Collectors.toList()))); }
/** * Gets the topic indicator map. * * @return the topic indicator map */
Gets the topic indicator map
getTopicIndicatorMap
{ "repo_name": "Hack23/cia", "path": "citizen-intelligence-agency/src/main/java/com/hack23/cia/web/impl/ui/application/views/common/menufactory/impl/CountryMenuItemFactoryImpl.java", "license": "apache-2.0", "size": 7661 }
[ "com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary", "com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId", "com.hack23.cia.service.api.DataContainer", "java.util.AbstractMap", "java.util.Arrays", "java.util.List", ...
import com.hack23.cia.model.internal.application.data.impl.ViewWorldbankIndicatorDataCountrySummary; import com.hack23.cia.model.internal.application.data.impl.WorldbankIndicatorDataCountrySummaryEmbeddedId; import com.hack23.cia.service.api.DataContainer; import java.util.AbstractMap; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.stream.Collectors;
import com.hack23.cia.model.internal.application.data.impl.*; import com.hack23.cia.service.api.*; import java.util.*; import java.util.stream.*;
[ "com.hack23.cia", "java.util" ]
com.hack23.cia; java.util;
79,750
public static MethodAnnotation fromCalledMethod(DismantleBytecode visitor) { String className = visitor.getDottedClassConstantOperand(); String methodName = visitor.getNameConstantOperand(); String methodSig = visitor.getSigConstantOperand(); return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Constants.INVOKESTATIC); }
static MethodAnnotation function(DismantleBytecode visitor) { String className = visitor.getDottedClassConstantOperand(); String methodName = visitor.getNameConstantOperand(); String methodSig = visitor.getSigConstantOperand(); return fromCalledMethod(className, methodName, methodSig, visitor.getOpcode() == Constants.INVOKESTATIC); }
/** * Factory method to create a MethodAnnotation from a method * called by the instruction the given visitor is currently visiting. * * @param visitor the visitor * @return the MethodAnnotation representing the called method */
Factory method to create a MethodAnnotation from a method called by the instruction the given visitor is currently visiting
fromCalledMethod
{ "repo_name": "optivo-org/fingbugs-1.3.9-optivo", "path": "src/java/edu/umd/cs/findbugs/MethodAnnotation.java", "license": "lgpl-2.1", "size": 16781 }
[ "edu.umd.cs.findbugs.visitclass.DismantleBytecode", "org.apache.bcel.Constants" ]
import edu.umd.cs.findbugs.visitclass.DismantleBytecode; import org.apache.bcel.Constants;
import edu.umd.cs.findbugs.visitclass.*; import org.apache.bcel.*;
[ "edu.umd.cs", "org.apache.bcel" ]
edu.umd.cs; org.apache.bcel;
2,127,419
BigInteger getX();
BigInteger getX();
/** * Returns the private value, <code>x</code>. * * @return the private value, <code>x</code> */
Returns the private value, <code>x</code>
getX
{ "repo_name": "md-5/jdk10", "path": "src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java", "license": "gpl-2.0", "size": 2009 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
276,967
public static DatanodeDescriptor getDatanode(final FSNamesystem ns, DatanodeID id) throws IOException { ns.readLock(); try { return ns.getBlockManager().getDatanodeManager().getDatanode(id); } finally { ns.readUnlock(); } }
static DatanodeDescriptor function(final FSNamesystem ns, DatanodeID id) throws IOException { ns.readLock(); try { return ns.getBlockManager().getDatanodeManager().getDatanode(id); } finally { ns.readUnlock(); } }
/** * Return the datanode descriptor for the given datanode. */
Return the datanode descriptor for the given datanode
getDatanode
{ "repo_name": "NJUJYB/disYarn", "path": "hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/namenode/NameNodeAdapter.java", "license": "apache-2.0", "size": 9394 }
[ "java.io.IOException", "org.apache.hadoop.hdfs.protocol.DatanodeID", "org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor" ]
import java.io.IOException; import org.apache.hadoop.hdfs.protocol.DatanodeID; import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeDescriptor;
import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.blockmanagement.*;
[ "java.io", "org.apache.hadoop" ]
java.io; org.apache.hadoop;
1,697,761
return configuration.isUseDefaultCredentialsProvider() ? new EventbridgeClientIAMOptimizedImpl(configuration) : new EventbridgeClientStandardImpl(configuration); }
return configuration.isUseDefaultCredentialsProvider() ? new EventbridgeClientIAMOptimizedImpl(configuration) : new EventbridgeClientStandardImpl(configuration); }
/** * Return the correct AWS Eventbridge client (based on remote vs local). * * @param configuration configuration * @return EventBridgeClient */
Return the correct AWS Eventbridge client (based on remote vs local)
getEventbridgeClient
{ "repo_name": "pax95/camel", "path": "components/camel-aws/camel-aws2-eventbridge/src/main/java/org/apache/camel/component/aws2/eventbridge/client/EventbridgeClientFactory.java", "license": "apache-2.0", "size": 1800 }
[ "org.apache.camel.component.aws2.eventbridge.client.impl.EventbridgeClientIAMOptimizedImpl", "org.apache.camel.component.aws2.eventbridge.client.impl.EventbridgeClientStandardImpl" ]
import org.apache.camel.component.aws2.eventbridge.client.impl.EventbridgeClientIAMOptimizedImpl; import org.apache.camel.component.aws2.eventbridge.client.impl.EventbridgeClientStandardImpl;
import org.apache.camel.component.aws2.eventbridge.client.impl.*;
[ "org.apache.camel" ]
org.apache.camel;
911,932
public void layout(final int width, final int height, Collection<NodeProxy> lockedNodes);
void function(final int width, final int height, Collection<NodeProxy> lockedNodes);
/** * Perform the graph layout calculation. * Elements of the model are expected to contain proper positions/dimensions after layout is invoked. * * @param width graph canvas width * @param height graph canvas height * @param lockedNodes collection of nodes which should not be moved by layout calculation */
Perform the graph layout calculation. Elements of the model are expected to contain proper positions/dimensions after layout is invoked
layout
{ "repo_name": "quaxquax/Graph-Explorer", "path": "src/main/java/com/vaadin/graph/LayoutEngine.java", "license": "apache-2.0", "size": 701 }
[ "com.vaadin.graph.shared.NodeProxy", "java.util.Collection" ]
import com.vaadin.graph.shared.NodeProxy; import java.util.Collection;
import com.vaadin.graph.shared.*; import java.util.*;
[ "com.vaadin.graph", "java.util" ]
com.vaadin.graph; java.util;
12,292
public Cursor fetchAccountsOrderedByFullName(String where, String[] whereArgs) { Log.v(LOG_TAG, "Fetching all accounts from db where " + where); return mDb.query(AccountEntry.TABLE_NAME, null, where, whereArgs, null, null, AccountEntry.COLUMN_FULL_NAME + " ASC"); }
Cursor function(String where, String[] whereArgs) { Log.v(LOG_TAG, STR + where); return mDb.query(AccountEntry.TABLE_NAME, null, where, whereArgs, null, null, AccountEntry.COLUMN_FULL_NAME + STR); }
/** * Returns a Cursor set of accounts which fulfill <code>where</code> * <p>This method returns the accounts list sorted by the full account name</p> * @param where SQL WHERE statement without the 'WHERE' itself * @param whereArgs where args * @return Cursor set of accounts which fulfill <code>where</code> */
Returns a Cursor set of accounts which fulfill <code>where</code> This method returns the accounts list sorted by the full account name
fetchAccountsOrderedByFullName
{ "repo_name": "leerduo/gnucash-android", "path": "app/src/main/java/org/gnucash/android/db/AccountsDbAdapter.java", "license": "apache-2.0", "size": 54669 }
[ "android.database.Cursor", "android.util.Log", "org.gnucash.android.db.DatabaseSchema" ]
import android.database.Cursor; import android.util.Log; import org.gnucash.android.db.DatabaseSchema;
import android.database.*; import android.util.*; import org.gnucash.android.db.*;
[ "android.database", "android.util", "org.gnucash.android" ]
android.database; android.util; org.gnucash.android;
1,248,061
public static boolean isQuadraticResidueMod2PowN(BigInteger a, int n) { BigInteger m = I_1.shiftLeft(n); if (a.compareTo(m) >= 0) a = a.and(m.subtract(I_1)); // now 0 <= a < m BigInteger lastM = m; for (int i=n; i>=2; i--) { lastM = lastM.shiftRight(1); if ((i & 1) == 1) { // odd i if (a.equals(lastM.add(lastM.shiftRight(2)))) return false; } else { if (a.equals(lastM) || a.equals(lastM.add(lastM.shiftRight(1)))) return false; } if (a.compareTo(lastM) >= 0) a = a.subtract(lastM); } return true; }
static boolean function(BigInteger a, int n) { BigInteger m = I_1.shiftLeft(n); if (a.compareTo(m) >= 0) a = a.and(m.subtract(I_1)); BigInteger lastM = m; for (int i=n; i>=2; i--) { lastM = lastM.shiftRight(1); if ((i & 1) == 1) { if (a.equals(lastM.add(lastM.shiftRight(2)))) return false; } else { if (a.equals(lastM) a.equals(lastM.add(lastM.shiftRight(1)))) return false; } if (a.compareTo(lastM) >= 0) a = a.subtract(lastM); } return true; }
/** * Computes if 'a' is a quadratic residue modulo 2^n. * Iterative implementation for BigIntegers. * * @param a argument * @param n exponent of the modulus m=2^n * @return true if 'a' is a quadratic residue modulo 2^n */
Computes if 'a' is a quadratic residue modulo 2^n. Iterative implementation for BigIntegers
isQuadraticResidueMod2PowN
{ "repo_name": "axkr/symja_android_library", "path": "symja_android_library/matheclipse-gpl/src/main/java/de/tilman_neumann/jml/quadraticResidues/QuadraticResiduesMod2PowN.java", "license": "gpl-3.0", "size": 8184 }
[ "java.math.BigInteger" ]
import java.math.BigInteger;
import java.math.*;
[ "java.math" ]
java.math;
14,031
public void deleteLocalInstructionComment(final INaviInstruction instruction, final IComment comment) throws CouldntDeleteException { CommentManager.get(m_provider).deleteLocalInstructionComment(instruction, m_codeNode, comment); }
void function(final INaviInstruction instruction, final IComment comment) throws CouldntDeleteException { CommentManager.get(m_provider).deleteLocalInstructionComment(instruction, m_codeNode, comment); }
/** * Deletes a local instruction comment from the code node. * * @param instruction The instruction in this code node where to delete the comment. * @param comment The comment to be deleted. * * @throws CouldntDeleteException if the comment could not be deleted from the database. */
Deletes a local instruction comment from the code node
deleteLocalInstructionComment
{ "repo_name": "AmesianX/binnavi", "path": "src/main/java/com/google/security/zynamics/binnavi/disassembly/CCodeNodeComments.java", "license": "apache-2.0", "size": 17598 }
[ "com.google.security.zynamics.binnavi.Database", "com.google.security.zynamics.binnavi.Gui" ]
import com.google.security.zynamics.binnavi.Database; import com.google.security.zynamics.binnavi.Gui;
import com.google.security.zynamics.binnavi.*;
[ "com.google.security" ]
com.google.security;
1,457,737
@Override public String getHexMessage() { return ModbusUtil.toHex(this); }// getHexMessage
String function() { return ModbusUtil.toHex(this); }
/** * Returns the this message as hexadecimal string. * * @return the message as hex encoded string. */
Returns the this message as hexadecimal string
getHexMessage
{ "repo_name": "cdjackson/openhab", "path": "bundles/binding/org.openhab.binding.modbus/src/main/java/net/wimpi/modbus/msg/ModbusMessageImpl.java", "license": "epl-1.0", "size": 7041 }
[ "net.wimpi.modbus.util.ModbusUtil" ]
import net.wimpi.modbus.util.ModbusUtil;
import net.wimpi.modbus.util.*;
[ "net.wimpi.modbus" ]
net.wimpi.modbus;
2,696,406
@SuppressWarnings("UnusedReturnValue") public Step popStep() { if (!params.isEmpty()) { params = Collections.emptyMap(); state = State.HAS_NEXT_STEP; } else if (!history.isEmpty()) { currentStep = history.pop(); } return currentStep; }
@SuppressWarnings(STR) Step function() { if (!params.isEmpty()) { params = Collections.emptyMap(); state = State.HAS_NEXT_STEP; } else if (!history.isEmpty()) { currentStep = history.pop(); } return currentStep; }
/** * Pops previous step from history setting it as a current step. * <p/> * It will remove params if context has state {@code COMPLETED} and the state will be reset to * {@code HAS_NEXT_STEP}. * <p/> * If history is empty nothing will be done. * * @return previous step */
Pops previous step from history setting it as a current step. It will remove params if context has state COMPLETED and the state will be reset to HAS_NEXT_STEP. If history is empty nothing will be done
popStep
{ "repo_name": "RomanPozdeev/yandex-money-sdk-java", "path": "src/main/java/com/yandex/money/api/model/showcase/ShowcaseContext.java", "license": "mit", "size": 13001 }
[ "java.util.Collections" ]
import java.util.Collections;
import java.util.*;
[ "java.util" ]
java.util;
2,837,127
public void setLoadsImagesAutomatically(boolean flag) { if (TRACE) Log.i(LOGTAG, "setLoadsImagesAutomatically=" + flag); synchronized (mAwSettingsLock) { if (mLoadsImagesAutomatically != flag) { mLoadsImagesAutomatically = flag; mEventHandler.updateWebkitPreferencesLocked(); } } }
void function(boolean flag) { if (TRACE) Log.i(LOGTAG, STR + flag); synchronized (mAwSettingsLock) { if (mLoadsImagesAutomatically != flag) { mLoadsImagesAutomatically = flag; mEventHandler.updateWebkitPreferencesLocked(); } } }
/** * See {@link android.webkit.WebSettings#setLoadsImagesAutomatically}. */
See <code>android.webkit.WebSettings#setLoadsImagesAutomatically</code>
setLoadsImagesAutomatically
{ "repo_name": "endlessm/chromium-browser", "path": "android_webview/java/src/org/chromium/android_webview/AwSettings.java", "license": "bsd-3-clause", "size": 65458 }
[ "android.util.Log" ]
import android.util.Log;
import android.util.*;
[ "android.util" ]
android.util;
1,816,066
Response createChange(String projectId, String zoneName, Change change, String... fields) { ZoneContainer zoneContainer = findZone(projectId, zoneName); if (zoneContainer == null) { return Error.NOT_FOUND.response(String.format( "The 'parameters.managedZone' resource named %s does not exist.", zoneName)); } Response response = checkChange(change, zoneContainer); if (response != null) { return response; } Change completeChange = new Change(); if (change.getAdditions() != null) { completeChange.setAdditions(ImmutableList.copyOf(change.getAdditions())); } if (change.getDeletions() != null) { completeChange.setDeletions(ImmutableList.copyOf(change.getDeletions())); } ConcurrentLinkedQueue<Change> changeSequence = zoneContainer.changes(); changeSequence.add(completeChange); int maxId = changeSequence.size(); int index = 0; for (Change c : changeSequence) { if (index == maxId) { break; } c.setId(String.valueOf(index++)); } completeChange.setStatus("pending"); completeChange.setStartTime(ISODateTimeFormat.dateTime().withZoneUTC() .print(System.currentTimeMillis())); invokeChange(projectId, zoneName, completeChange.getId()); Change result = OptionParsers.extractFields(completeChange, fields); try { return new Response(HTTP_OK, jsonFactory.toString(result)); } catch (IOException e) { return Error.INTERNAL_ERROR.response( String.format("Error when serializing change %s in managed zone %s in project %s.", result.getId(), zoneName, projectId)); } }
Response createChange(String projectId, String zoneName, Change change, String... fields) { ZoneContainer zoneContainer = findZone(projectId, zoneName); if (zoneContainer == null) { return Error.NOT_FOUND.response(String.format( STR, zoneName)); } Response response = checkChange(change, zoneContainer); if (response != null) { return response; } Change completeChange = new Change(); if (change.getAdditions() != null) { completeChange.setAdditions(ImmutableList.copyOf(change.getAdditions())); } if (change.getDeletions() != null) { completeChange.setDeletions(ImmutableList.copyOf(change.getDeletions())); } ConcurrentLinkedQueue<Change> changeSequence = zoneContainer.changes(); changeSequence.add(completeChange); int maxId = changeSequence.size(); int index = 0; for (Change c : changeSequence) { if (index == maxId) { break; } c.setId(String.valueOf(index++)); } completeChange.setStatus(STR); completeChange.setStartTime(ISODateTimeFormat.dateTime().withZoneUTC() .print(System.currentTimeMillis())); invokeChange(projectId, zoneName, completeChange.getId()); Change result = OptionParsers.extractFields(completeChange, fields); try { return new Response(HTTP_OK, jsonFactory.toString(result)); } catch (IOException e) { return Error.INTERNAL_ERROR.response( String.format(STR, result.getId(), zoneName, projectId)); } }
/** * Creates a new change, stores it, and if delayChange > 0, invokes processing in a new thread. */
Creates a new change, stores it, and if delayChange > 0, invokes processing in a new thread
createChange
{ "repo_name": "aozarov/gcloud-java", "path": "gcloud-java-dns/src/main/java/com/google/cloud/dns/testing/LocalDnsHelper.java", "license": "apache-2.0", "size": 50076 }
[ "com.google.api.services.dns.model.Change", "com.google.common.collect.ImmutableList", "java.io.IOException", "java.util.concurrent.ConcurrentLinkedQueue", "org.joda.time.format.ISODateTimeFormat" ]
import com.google.api.services.dns.model.Change; import com.google.common.collect.ImmutableList; import java.io.IOException; import java.util.concurrent.ConcurrentLinkedQueue; import org.joda.time.format.ISODateTimeFormat;
import com.google.api.services.dns.model.*; import com.google.common.collect.*; import java.io.*; import java.util.concurrent.*; import org.joda.time.format.*;
[ "com.google.api", "com.google.common", "java.io", "java.util", "org.joda.time" ]
com.google.api; com.google.common; java.io; java.util; org.joda.time;
1,792,769
public Set getNonCriticalExtensionOIDs() { return CertUtils.getNonCriticalExtensionOIDs(entry.getExtensions()); }
Set function() { return CertUtils.getNonCriticalExtensionOIDs(entry.getExtensions()); }
/** * Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the * non-critical extensions contained in this holder's CRL entry. * * @return a set of non-critical extension OIDs. */
Returns a set of ASN1ObjectIdentifier objects representing the OIDs of the non-critical extensions contained in this holder's CRL entry
getNonCriticalExtensionOIDs
{ "repo_name": "rex-xxx/mt6572_x201", "path": "external/bouncycastle/bcpkix/src/main/java/org/bouncycastle/cert/X509CRLEntryHolder.java", "license": "gpl-2.0", "size": 3861 }
[ "java.util.Set" ]
import java.util.Set;
import java.util.*;
[ "java.util" ]
java.util;
2,643,376
public static float[] toFloatArray(final Collection<Float> values) { final float[] items = new float[values.size()]; final Iterator<Float> iterator = values.iterator(); for (int i = 0; i < items.length; i++) { items[i] = iterator.next(); } return items; }
static float[] function(final Collection<Float> values) { final float[] items = new float[values.size()]; final Iterator<Float> iterator = values.iterator(); for (int i = 0; i < items.length; i++) { items[i] = iterator.next(); } return items; }
/** * Converts a list of <code>Float</code> objects into an array of * primitive <code>float</code>s. * * @param values the list of <code>Float</code>s * @return an array of <code>float</code>s */
Converts a list of <code>Float</code> objects into an array of primitive <code>float</code>s
toFloatArray
{ "repo_name": "StrikerX3/java-utils", "path": "src/main/java/com/ivan/utils/collections/CollectionUtils.java", "license": "mit", "size": 11156 }
[ "java.util.Collection", "java.util.Iterator" ]
import java.util.Collection; import java.util.Iterator;
import java.util.*;
[ "java.util" ]
java.util;
1,232,921
ConnectivityManager connectivity = (ConnectivityManager) _context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) for (int i = 0; i < info.length; i++) if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; }
ConnectivityManager connectivity = (ConnectivityManager) _context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connectivity != null) { NetworkInfo[] info = connectivity.getAllNetworkInfo(); if (info != null) for (int i = 0; i < info.length; i++) if (info[i].getState() == NetworkInfo.State.CONNECTED) { return true; } } return false; }
/** * Checking for all possible internet providers * **/
Checking for all possible internet providers
isConnectingToInternet
{ "repo_name": "lawrence615/Kodesearch", "path": "src/com/kodesearch/external/ConnectionDetector.java", "license": "unlicense", "size": 770 }
[ "android.content.Context", "android.net.ConnectivityManager", "android.net.NetworkInfo" ]
import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo;
import android.content.*; import android.net.*;
[ "android.content", "android.net" ]
android.content; android.net;
414,282
@Override public void unregisterUserGroup(final String localServerName, final UserGroup userGroup) throws RemoteException { if (LOG.isDebugEnabled()) { LOG.debug("unregisterUserGroup called :: userGroup = " + userGroup); // NOI18N } try { um.unregisterUserGroup(localServerName, userGroup); status.addMessage( NbBundle.getMessage(Registry.class, "Registry.unregisterUserGroup(UserGroup).title") // NOI18N , NbBundle.getMessage( Registry.class, "Registry.unregisterUserGroup(UserGroup).message" // NOI18N , new Object[] { userGroup.toString() })); } catch (Exception e) { final String message = "could not unregister usergroup :: usergroup = " + userGroup; // NOI18N LOG.error(message, e); throw new RemoteException(message, e); } }
void function(final String localServerName, final UserGroup userGroup) throws RemoteException { if (LOG.isDebugEnabled()) { LOG.debug(STR + userGroup); } try { um.unregisterUserGroup(localServerName, userGroup); status.addMessage( NbBundle.getMessage(Registry.class, STR) , NbBundle.getMessage( Registry.class, STR , new Object[] { userGroup.toString() })); } catch (Exception e) { final String message = STR + userGroup; LOG.error(message, e); throw new RemoteException(message, e); } }
/** * DOCUMENT ME! * * @param localServerName DOCUMENT ME! * @param userGroup DOCUMENT ME! * * @throws RemoteException DOCUMENT ME! */
DOCUMENT ME
unregisterUserGroup
{ "repo_name": "cismet/cids-server", "path": "src/main/java/Sirius/server/registry/Registry.java", "license": "lgpl-3.0", "size": 39621 }
[ "java.rmi.RemoteException", "org.openide.util.NbBundle" ]
import java.rmi.RemoteException; import org.openide.util.NbBundle;
import java.rmi.*; import org.openide.util.*;
[ "java.rmi", "org.openide.util" ]
java.rmi; org.openide.util;
2,356,830
String compactMessage(String msg) { final UPCALogicImpl upcaLogic = new UPCALogicImpl(ChecksumMode.CP_AUTO); upcaLogic.validateMessage(msg); final String upca = upcaLogic.handleChecksum(msg, ChecksumMode.CP_AUTO); final byte numberSystem = extractNumberSystem(upca); if ((numberSystem != 0) && (numberSystem != 1)) { return null; } final byte check = Byte.parseByte(upca.substring(11, 12)); final StringBuilder upce = new StringBuilder(); upce.append(Byte.toString(numberSystem)); try { final String manufacturer = substring(upca, 1, 5); final String product = substring(upca, 6, 5); String mtemp, ptemp; //Rule 1 mtemp = substring(manufacturer, 2, 3); ptemp = substring(product, 0, 2); if ("000|100|200".contains(mtemp) && "00".equals(ptemp)) { upce.append(substring(manufacturer, 0, 2)); upce.append(substring(product, 2, 3)); upce.append(mtemp.charAt(0)); } else { //Rule 2 ptemp = substring(product, 0, 3); if ("300|400|500|600|700|800|900".contains(mtemp) && "000".equals(ptemp)) { upce.append(substring(manufacturer, 0, 3)); upce.append(substring(product, 3, 2)); upce.append("3"); } else { //Rule 3 mtemp = substring(manufacturer, 3, 2); ptemp = substring(product, 0, 4); if ("10|20|30|40|50|60|70|80|90".contains(mtemp) && "0000".equals(ptemp)) { upce.append(substring(manufacturer, 0, 4)); upce.append(substring(product, 4, 1)); upce.append("4"); } else { //Rule 4 mtemp = substring(manufacturer, 4, 1); ptemp = substring(product, 4, 1); if ("5|6|7|8|9".contains(ptemp) && !"0".equals(mtemp)) { upce.append(manufacturer); upce.append(ptemp); } else { return null; } } } } } catch (NumberFormatException nfe) { LOGGER.log(Level.INFO, "Error while converting Number.", nfe); return null; } upce.append(Byte.toString(check)); return upce.toString(); }
String compactMessage(String msg) { final UPCALogicImpl upcaLogic = new UPCALogicImpl(ChecksumMode.CP_AUTO); upcaLogic.validateMessage(msg); final String upca = upcaLogic.handleChecksum(msg, ChecksumMode.CP_AUTO); final byte numberSystem = extractNumberSystem(upca); if ((numberSystem != 0) && (numberSystem != 1)) { return null; } final byte check = Byte.parseByte(upca.substring(11, 12)); final StringBuilder upce = new StringBuilder(); upce.append(Byte.toString(numberSystem)); try { final String manufacturer = substring(upca, 1, 5); final String product = substring(upca, 6, 5); String mtemp, ptemp; mtemp = substring(manufacturer, 2, 3); ptemp = substring(product, 0, 2); if (STR.contains(mtemp) && "00".equals(ptemp)) { upce.append(substring(manufacturer, 0, 2)); upce.append(substring(product, 2, 3)); upce.append(mtemp.charAt(0)); } else { ptemp = substring(product, 0, 3); if (STR.contains(mtemp) && "000".equals(ptemp)) { upce.append(substring(manufacturer, 0, 3)); upce.append(substring(product, 3, 2)); upce.append("3"); } else { mtemp = substring(manufacturer, 3, 2); ptemp = substring(product, 0, 4); if (STR.contains(mtemp) && "0000".equals(ptemp)) { upce.append(substring(manufacturer, 0, 4)); upce.append(substring(product, 4, 1)); upce.append("4"); } else { mtemp = substring(manufacturer, 4, 1); ptemp = substring(product, 4, 1); if (STR.contains(ptemp) && !"0".equals(mtemp)) { upce.append(manufacturer); upce.append(ptemp); } else { return null; } } } } } catch (NumberFormatException nfe) { LOGGER.log(Level.INFO, STR, nfe); return null; } upce.append(Byte.toString(check)); return upce.toString(); }
/** * Compacts an UPC-A message to an UPC-E message if possible. * * @param msg an UPC-A message * @return String the derived UPC-E message (with checksum), null if the * message is a valid UPC-A message but no UPC-E representation is possible */
Compacts an UPC-A message to an UPC-E message if possible
compactMessage
{ "repo_name": "mbhk/barcode4j", "path": "barcode4j-light/src/main/java/org/krysalis/barcode4j/impl/upcean/UPCELogicImpl.java", "license": "apache-2.0", "size": 12411 }
[ "java.util.logging.Level", "org.krysalis.barcode4j.ChecksumMode" ]
import java.util.logging.Level; import org.krysalis.barcode4j.ChecksumMode;
import java.util.logging.*; import org.krysalis.barcode4j.*;
[ "java.util", "org.krysalis.barcode4j" ]
java.util; org.krysalis.barcode4j;
2,881,708
public Paint getPositivePaint() { return this.positivePaint; }
Paint function() { return this.positivePaint; }
/** * Returns the paint used to highlight positive differences. * * @return The paint (never <code>null</code>). * * @see #setPositivePaint(Paint) */
Returns the paint used to highlight positive differences
getPositivePaint
{ "repo_name": "JSansalone/JFreeChart", "path": "source/org/jfree/chart/renderer/xy/XYDifferenceRenderer.java", "license": "lgpl-2.1", "size": 48487 }
[ "java.awt.Paint" ]
import java.awt.Paint;
import java.awt.*;
[ "java.awt" ]
java.awt;
1,637,467
SubscriptionResponse addSubscription(ApiTypeWrapper apiTypeWrapper, String userId, int applicationId, String groupId) throws APIManagementException;
SubscriptionResponse addSubscription(ApiTypeWrapper apiTypeWrapper, String userId, int applicationId, String groupId) throws APIManagementException;
/** * Add new Subscriber with GroupId * * @param apiTypeWrapper APIIdentifier * @param userId id of the user * @param applicationId Application Id * @param groupId GroupId of user * @return SubscriptionResponse subscription response object * @throws APIManagementException if failed to add subscription details to database */
Add new Subscriber with GroupId
addSubscription
{ "repo_name": "jaadds/carbon-apimgt", "path": "components/apimgt/org.wso2.carbon.apimgt.api/src/main/java/org/wso2/carbon/apimgt/api/APIConsumer.java", "license": "apache-2.0", "size": 41368 }
[ "org.wso2.carbon.apimgt.api.model.ApiTypeWrapper", "org.wso2.carbon.apimgt.api.model.SubscriptionResponse" ]
import org.wso2.carbon.apimgt.api.model.ApiTypeWrapper; import org.wso2.carbon.apimgt.api.model.SubscriptionResponse;
import org.wso2.carbon.apimgt.api.model.*;
[ "org.wso2.carbon" ]
org.wso2.carbon;
1,988,287
public static ByteBuffer putModifiedUtf8(ByteBuffer dest, String orig) throws BufferOverflowException { final char[] chars = orig.toCharArray(); for (char c : chars) { if (c > 0 && c <= 0x7f) { dest.put((byte) c); } else if (c <= 0x07ff) { dest.put((byte)(0xc0 | 0x1f & c >> 6)); dest.put((byte)(0x80 | 0x3f & c)); } else { dest.put((byte)(0xe0 | 0x0f & c >> 12)); dest.put((byte)(0x80 | 0x3f & c >> 6)); dest.put((byte)(0x80 | 0x3f & c)); } } return dest; } /** * Get a 0-terminated string from the byte buffer, decoding it using "modified UTF-8" encoding. * * @param src the source buffer * @return the string * @throws BufferUnderflowException if the end of the buffer was reached before encountering a {@code 0}
static ByteBuffer function(ByteBuffer dest, String orig) throws BufferOverflowException { final char[] chars = orig.toCharArray(); for (char c : chars) { if (c > 0 && c <= 0x7f) { dest.put((byte) c); } else if (c <= 0x07ff) { dest.put((byte)(0xc0 0x1f & c >> 6)); dest.put((byte)(0x80 0x3f & c)); } else { dest.put((byte)(0xe0 0x0f & c >> 12)); dest.put((byte)(0x80 0x3f & c >> 6)); dest.put((byte)(0x80 0x3f & c)); } } return dest; } /** * Get a 0-terminated string from the byte buffer, decoding it using STR encoding. * * @param src the source buffer * @return the string * @throws BufferUnderflowException if the end of the buffer was reached before encountering a {@code 0}
/** * Put the string into the byte buffer, encoding it using "modified UTF-8" encoding. * * @param dest the byte buffer * @param orig the source bytes * @return the byte buffer * @throws BufferOverflowException if there is not enough space in the buffer for the complete string * @see DataOutput#writeUTF(String) */
Put the string into the byte buffer, encoding it using "modified UTF-8" encoding
putModifiedUtf8
{ "repo_name": "stuartwdouglas/xnio", "path": "api/src/main/java/org/xnio/Buffers.java", "license": "apache-2.0", "size": 86113 }
[ "java.nio.BufferOverflowException", "java.nio.BufferUnderflowException", "java.nio.ByteBuffer" ]
import java.nio.BufferOverflowException; import java.nio.BufferUnderflowException; import java.nio.ByteBuffer;
import java.nio.*;
[ "java.nio" ]
java.nio;
864,596
public BytesReference source() { return source; }
BytesReference function() { return source; }
/** * The mapping source definition. */
The mapping source definition
source
{ "repo_name": "gingerwizard/elasticsearch", "path": "client/rest-high-level/src/main/java/org/elasticsearch/client/indices/PutMappingRequest.java", "license": "apache-2.0", "size": 4907 }
[ "org.elasticsearch.common.bytes.BytesReference" ]
import org.elasticsearch.common.bytes.BytesReference;
import org.elasticsearch.common.bytes.*;
[ "org.elasticsearch.common" ]
org.elasticsearch.common;
2,436,359
public static <V> ListenableFuture<V> sendMessage(final ZKClient zkClient, String messagePathPrefix, Message message, final V completionResult) { SettableFuture<V> result = SettableFuture.create(); sendMessage(zkClient, messagePathPrefix, message, result, completionResult); return result; }
static <V> ListenableFuture<V> function(final ZKClient zkClient, String messagePathPrefix, Message message, final V completionResult) { SettableFuture<V> result = SettableFuture.create(); sendMessage(zkClient, messagePathPrefix, message, result, completionResult); return result; }
/** * Creates a message node in zookeeper. The message node created is a PERSISTENT_SEQUENTIAL node. * * @param zkClient The ZooKeeper client for interacting with ZooKeeper. * @param messagePathPrefix ZooKeeper path prefix for the message node. * @param message The {@link Message} object for the content of the message node. * @param completionResult Object to set to the result future when the message is processed. * @param <V> Type of the completion result. * @return A {@link ListenableFuture} that will be completed when the message is consumed, which indicated * by deletion of the node. If there is exception during the process, it will be reflected * to the future returned. */
Creates a message node in zookeeper. The message node created is a PERSISTENT_SEQUENTIAL node
sendMessage
{ "repo_name": "cdapio/twill", "path": "twill-core/src/main/java/org/apache/twill/internal/ZKMessages.java", "license": "apache-2.0", "size": 4170 }
[ "com.google.common.util.concurrent.ListenableFuture", "com.google.common.util.concurrent.SettableFuture", "org.apache.twill.internal.state.Message", "org.apache.twill.zookeeper.ZKClient" ]
import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.SettableFuture; import org.apache.twill.internal.state.Message; import org.apache.twill.zookeeper.ZKClient;
import com.google.common.util.concurrent.*; import org.apache.twill.internal.state.*; import org.apache.twill.zookeeper.*;
[ "com.google.common", "org.apache.twill" ]
com.google.common; org.apache.twill;
1,285,908
public Observable<ServiceResponse<Page<P2SVpnGatewayInner>>> listNextSinglePageAsync(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException("Parameter nextPageLink is required and cannot be null."); }
Observable<ServiceResponse<Page<P2SVpnGatewayInner>>> function(final String nextPageLink) { if (nextPageLink == null) { throw new IllegalArgumentException(STR); }
/** * Lists all the P2SVpnGateways in a subscription. * ServiceResponse<PageImpl<P2SVpnGatewayInner>> * @param nextPageLink The NextLink from the previous successful call to List operation. * @throws IllegalArgumentException thrown if parameters fail the validation * @return the PagedList&lt;P2SVpnGatewayInner&gt; object wrapped in {@link ServiceResponse} if successful. */
Lists all the P2SVpnGateways in a subscription
listNextSinglePageAsync
{ "repo_name": "selvasingh/azure-sdk-for-java", "path": "sdk/network/mgmt-v2020_05_01/src/main/java/com/microsoft/azure/management/network/v2020_05_01/implementation/P2sVpnGatewaysInner.java", "license": "mit", "size": 129361 }
[ "com.microsoft.azure.Page", "com.microsoft.rest.ServiceResponse" ]
import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse;
import com.microsoft.azure.*; import com.microsoft.rest.*;
[ "com.microsoft.azure", "com.microsoft.rest" ]
com.microsoft.azure; com.microsoft.rest;
2,888,994
public ItemHelperIfc getItemHelperInstance(int versionCode) { switch (versionCode) { case QTIVersion.VERSION_1_2: return new ItemHelper12Impl();// very specific code for v 1.2 case QTIVersion.VERSION_2_0: return new ItemHelper20Impl();// very specific code for v 2.0 (stubbed) default: throw new IllegalArgumentException( VERSION_SUPPORTED_STRING); } }
ItemHelperIfc function(int versionCode) { switch (versionCode) { case QTIVersion.VERSION_1_2: return new ItemHelper12Impl(); case QTIVersion.VERSION_2_0: return new ItemHelper20Impl(); default: throw new IllegalArgumentException( VERSION_SUPPORTED_STRING); } }
/** * Factory method. ItemHelperIfc. * @param versionCode supported: QTIVersion.VERSION_1_2, QTIVersion.VERSION_2_0 * @return ItemHelperIfc */
Factory method. ItemHelperIfc
getItemHelperInstance
{ "repo_name": "eemirtekin/Sakai-10.6-TR", "path": "samigo/samigo-qti/src/java/org/sakaiproject/tool/assessment/qti/helper/QTIHelperFactory.java", "license": "apache-2.0", "size": 4221 }
[ "org.sakaiproject.tool.assessment.qti.constants.QTIVersion", "org.sakaiproject.tool.assessment.qti.helper.item.ItemHelper12Impl", "org.sakaiproject.tool.assessment.qti.helper.item.ItemHelper20Impl", "org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperIfc" ]
import org.sakaiproject.tool.assessment.qti.constants.QTIVersion; import org.sakaiproject.tool.assessment.qti.helper.item.ItemHelper12Impl; import org.sakaiproject.tool.assessment.qti.helper.item.ItemHelper20Impl; import org.sakaiproject.tool.assessment.qti.helper.item.ItemHelperIfc;
import org.sakaiproject.tool.assessment.qti.constants.*; import org.sakaiproject.tool.assessment.qti.helper.item.*;
[ "org.sakaiproject.tool" ]
org.sakaiproject.tool;
2,169,765
@FIXVersion(introduced="4.2") @TagNumRef(tagNum=TagNum.Currency) public Currency getCurrency() { return currency; }
@FIXVersion(introduced="4.2") @TagNumRef(tagNum=TagNum.Currency) Currency function() { return currency; }
/** * Message field getter. * @return field value */
Message field getter
getCurrency
{ "repo_name": "marvisan/HadesFIX", "path": "Model/src/main/java/net/hades/fix/message/SecurityStatusRequestMsg.java", "license": "gpl-3.0", "size": 43886 }
[ "net.hades.fix.message.anno.FIXVersion", "net.hades.fix.message.anno.TagNumRef", "net.hades.fix.message.type.Currency", "net.hades.fix.message.type.TagNum" ]
import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.Currency; import net.hades.fix.message.type.TagNum;
import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*;
[ "net.hades.fix" ]
net.hades.fix;
166,022
public static MozuClient<com.mozu.api.contracts.location.Location> updateLocationClient(com.mozu.api.contracts.location.Location location, String locationCode) throws Exception { return updateLocationClient( location, locationCode, null); }
static MozuClient<com.mozu.api.contracts.location.Location> function(com.mozu.api.contracts.location.Location location, String locationCode) throws Exception { return updateLocationClient( location, locationCode, null); }
/** * * <p><pre><code> * MozuClient<com.mozu.api.contracts.location.Location> mozuClient=UpdateLocationClient( location, locationCode); * client.setBaseAddress(url); * client.executeRequest(); * Location location = client.Result(); * </code></pre></p> * @param locationCode The unique, user-defined code that identifies a location. * @param location Properties of a physical location a tenant uses to manage inventory and fulfills orders, provide store finder functionality, or both. * @return Mozu.Api.MozuClient <com.mozu.api.contracts.location.Location> * @see com.mozu.api.contracts.location.Location * @see com.mozu.api.contracts.location.Location */
<code><code> MozuClient mozuClient=UpdateLocationClient( location, locationCode); client.setBaseAddress(url); client.executeRequest(); Location location = client.Result(); </code></code>
updateLocationClient
{ "repo_name": "Mozu/mozu-java", "path": "mozu-javaasync-core/src/main/java/com/mozu/api/clients/commerce/admin/LocationClient.java", "license": "mit", "size": 11864 }
[ "com.mozu.api.MozuClient" ]
import com.mozu.api.MozuClient;
import com.mozu.api.*;
[ "com.mozu.api" ]
com.mozu.api;
263,642
void report(Log log, int pos, Type site, Name name, List argtypes) { AmbiguityError pair = this; while (true) { if (pair.sym1.kind == AMBIGUOUS) pair = (AmbiguityError) pair.sym1; else if (pair.sym2.kind == AMBIGUOUS) pair = (AmbiguityError) pair.sym2; else break; } Name sname = pair.sym1.name; if (sname == sname.table.init) sname = pair.sym1.owner.name; log.error(pos, "ref.ambiguous", sname.toJava(), kindName(pair.sym1.kind), pair.sym1.toJava(), pair.sym1 .javaLocation(site), kindName(pair.sym2.kind), pair.sym2.toJava(), pair.sym2.javaLocation(site)); } }
void report(Log log, int pos, Type site, Name name, List argtypes) { AmbiguityError pair = this; while (true) { if (pair.sym1.kind == AMBIGUOUS) pair = (AmbiguityError) pair.sym1; else if (pair.sym2.kind == AMBIGUOUS) pair = (AmbiguityError) pair.sym2; else break; } Name sname = pair.sym1.name; if (sname == sname.table.init) sname = pair.sym1.owner.name; log.error(pos, STR, sname.toJava(), kindName(pair.sym1.kind), pair.sym1.toJava(), pair.sym1 .javaLocation(site), kindName(pair.sym2.kind), pair.sym2.toJava(), pair.sym2.javaLocation(site)); } }
/** * Report error. * * @param log * The error log to be used for error reporting. * @param pos * The position to be used for error reporting. * @param site * The original type from where the selection took place. * @param name * The name of the symbol to be resolved. * @param argtypes * The invocation's value parameters, if we looked for a * method. */
Report error
report
{ "repo_name": "nileshpatelksy/hello-pod-cast", "path": "archive/FILE/Compiler/java_GJC1.42_src/src/com/sun/tools/javac/v8/comp/Resolve.java", "license": "apache-2.0", "size": 42456 }
[ "com.sun.tools.javac.v8.code.Type", "com.sun.tools.javac.v8.util.List", "com.sun.tools.javac.v8.util.Log", "com.sun.tools.javac.v8.util.Name" ]
import com.sun.tools.javac.v8.code.Type; import com.sun.tools.javac.v8.util.List; import com.sun.tools.javac.v8.util.Log; import com.sun.tools.javac.v8.util.Name;
import com.sun.tools.javac.v8.code.*; import com.sun.tools.javac.v8.util.*;
[ "com.sun.tools" ]
com.sun.tools;
2,693,618
private void assignReplicasToPartitions(String topic, int partition) { List<Integer> assignedReplicas = GuiceDI.getInstance(ZkUtils.class).getReplicasForPartition(topic, partition); controllerContext.partitionReplicaAssignment.putAll(new TopicAndPartition(topic, partition), assignedReplicas); }
void function(String topic, int partition) { List<Integer> assignedReplicas = GuiceDI.getInstance(ZkUtils.class).getReplicasForPartition(topic, partition); controllerContext.partitionReplicaAssignment.putAll(new TopicAndPartition(topic, partition), assignedReplicas); }
/** * Invoked on the NonExistentPartition->NewPartition state transition to update the controller's cache with the * partition's replica assignment. * * @param topic The topic of the partition whose replica assignment is to be cached * @param partition The partition whose replica assignment is to be cached */
Invoked on the NonExistentPartition->NewPartition state transition to update the controller's cache with the partition's replica assignment
assignReplicasToPartitions
{ "repo_name": "lemonJun/Jkafka", "path": "jkafka-core/src/main/java/kafka/controller/PartitionStateMachine.java", "license": "apache-2.0", "size": 28881 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
1,390,693
public void deletePbPositioningOtherInfo(Long positioningOtherOid) throws ServiceException; public void deletePbPositioningOtherInfoByIds(List<Long> positioningOtherOids) throws ServiceException; public List<PbPositioningOtherInfoDTO> listPbPositioningOtherInfoByPersonOid(Long personOid) throws ServiceException;
void deletePbPositioningOtherInfo(Long positioningOtherOid) throws ServiceException; public void deletePbPositioningOtherInfoByIds(List<Long> positioningOtherOids) throws ServiceException; public List<PbPositioningOtherInfoDTO> function(Long personOid) throws ServiceException;
/** * list PbPositioningOtherInfo obj * @param personOid * @return * @throws ServiceException */
list PbPositioningOtherInfo obj
listPbPositioningOtherInfoByPersonOid
{ "repo_name": "meijmOrg/Repo-test", "path": "freelance-hr-res/src/java/com/yh/hr/res/pb/service/PbPositioningOtherInfoService.java", "license": "gpl-2.0", "size": 1919 }
[ "com.yh.hr.res.pb.dto.PbPositioningOtherInfoDTO", "com.yh.platform.core.exception.ServiceException", "java.util.List" ]
import com.yh.hr.res.pb.dto.PbPositioningOtherInfoDTO; import com.yh.platform.core.exception.ServiceException; import java.util.List;
import com.yh.hr.res.pb.dto.*; import com.yh.platform.core.exception.*; import java.util.*;
[ "com.yh.hr", "com.yh.platform", "java.util" ]
com.yh.hr; com.yh.platform; java.util;
1,334,547
EReference getNode_OutArcs();
EReference getNode_OutArcs();
/** * Returns the meta object for the reference list '{@link fr.lip6.move.pnml.ptnet.Node#getOutArcs <em>Out Arcs</em>}'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @return the meta object for the reference list '<em>Out Arcs</em>'. * @see fr.lip6.move.pnml.ptnet.Node#getOutArcs() * @see #getNode() * @generated */
Returns the meta object for the reference list '<code>fr.lip6.move.pnml.ptnet.Node#getOutArcs Out Arcs</code>'.
getNode_OutArcs
{ "repo_name": "lhillah/pnmlframework", "path": "pnmlFw-PTNet/src/fr/lip6/move/pnml/ptnet/PtnetPackage.java", "license": "epl-1.0", "size": 146931 }
[ "org.eclipse.emf.ecore.EReference" ]
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.*;
[ "org.eclipse.emf" ]
org.eclipse.emf;
1,556,541
private void readProcCpuInfoFile() { // This directory needs to be read only once if (readCpuInfoFile) { return; } // Read "/proc/cpuinfo" file BufferedReader in = null; FileReader fReader = null; try { fReader = new FileReader(procfsCpuFile); in = new BufferedReader(fReader); } catch (FileNotFoundException f) { // shouldn't happen.... return; } Matcher mat = null; try { numProcessors = 0; String str = in.readLine(); while (str != null) { mat = PROCESSOR_FORMAT.matcher(str); if (mat.find()) { numProcessors++; } mat = FREQUENCY_FORMAT.matcher(str); if (mat.find()) { cpuFrequency = (long)(Double.parseDouble(mat.group(1)) * 1000); // kHz } str = in.readLine(); } } catch (IOException io) { LOG.warn("Error reading the stream " + io); } finally { // Close the streams try { fReader.close(); try { in.close(); } catch (IOException i) { LOG.warn("Error closing the stream " + in); } } catch (IOException i) { LOG.warn("Error closing the stream " + fReader); } } readCpuInfoFile = true; }
void function() { if (readCpuInfoFile) { return; } BufferedReader in = null; FileReader fReader = null; try { fReader = new FileReader(procfsCpuFile); in = new BufferedReader(fReader); } catch (FileNotFoundException f) { return; } Matcher mat = null; try { numProcessors = 0; String str = in.readLine(); while (str != null) { mat = PROCESSOR_FORMAT.matcher(str); if (mat.find()) { numProcessors++; } mat = FREQUENCY_FORMAT.matcher(str); if (mat.find()) { cpuFrequency = (long)(Double.parseDouble(mat.group(1)) * 1000); } str = in.readLine(); } } catch (IOException io) { LOG.warn(STR + io); } finally { try { fReader.close(); try { in.close(); } catch (IOException i) { LOG.warn(STR + in); } } catch (IOException i) { LOG.warn(STR + fReader); } } readCpuInfoFile = true; }
/** * Read /proc/cpuinfo, parse and calculate CPU information */
Read /proc/cpuinfo, parse and calculate CPU information
readProcCpuInfoFile
{ "repo_name": "jayantgolhar/Hadoop-0.21.0", "path": "mapred/src/java/org/apache/hadoop/mapreduce/util/LinuxResourceCalculatorPlugin.java", "license": "apache-2.0", "size": 12695 }
[ "java.io.BufferedReader", "java.io.FileNotFoundException", "java.io.FileReader", "java.io.IOException", "java.util.regex.Matcher" ]
import java.io.BufferedReader; import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.util.regex.Matcher;
import java.io.*; import java.util.regex.*;
[ "java.io", "java.util" ]
java.io; java.util;
2,137,347
private Object logger(final Method method, final String name) { final Object source; if (name.isEmpty()) { source = method.getDeclaringClass(); } else { source = name; } return source; }
Object function(final Method method, final String name) { final Object source; if (name.isEmpty()) { source = method.getDeclaringClass(); } else { source = name; } return source; }
/** * Get the destination logger for this method. * @param method The method * @param name The Loggable annotation * @return The logger that will be used */
Get the destination logger for this method
logger
{ "repo_name": "shelan/jcabi-aspects", "path": "src/main/java/com/jcabi/aspects/aj/MethodLogger.java", "license": "bsd-3-clause", "size": 16706 }
[ "java.lang.reflect.Method" ]
import java.lang.reflect.Method;
import java.lang.reflect.*;
[ "java.lang" ]
java.lang;
1,667,613
public static String generateTag() { return new SB() .a(LEFT_PART[new Random().nextInt(LEFT_PART.length)]) .a('_') .a(RIGHT_PART[new Random().nextInt(RIGHT_PART.length)]).toString(); }
static String function() { return new SB() .a(LEFT_PART[new Random().nextInt(LEFT_PART.length)]) .a('_') .a(RIGHT_PART[new Random().nextInt(RIGHT_PART.length)]).toString(); }
/** * Generates cluster tag. * * @return String to use as default cluster tag. */
Generates cluster tag
generateTag
{ "repo_name": "samaitra/ignite", "path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cluster/ClusterTagGenerator.java", "license": "apache-2.0", "size": 54711 }
[ "java.util.Random" ]
import java.util.Random;
import java.util.*;
[ "java.util" ]
java.util;
1,884,840
public void positioningBackground() { ImageView background = (ImageView) findViewById(R.id.background); RelativeLayout.LayoutParams paramsBackground = (RelativeLayout.LayoutParams) background.getLayoutParams(); if (!modeMiniature) { paramsBackground.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); paramsBackground.setMargins(0, 0, 0, 0); } else { // Position at the bottom paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); // Position at the left paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); if (photoTaken) { Resources res = getResources(); int defaultPadding = (int)res.getDimension(R.dimen.default_padding); BitmapDrawable image = (BitmapDrawable) res.getDrawable(R.drawable.accept); int marginBottom = image.getBitmap().getHeight() + (defaultPadding * 2); paramsBackground.setMargins(0, 0, 0, marginBottom); } else { paramsBackground.setMargins(0, 0, 0, 0); } } background.setLayoutParams(paramsBackground); }
void function() { ImageView background = (ImageView) findViewById(R.id.background); RelativeLayout.LayoutParams paramsBackground = (RelativeLayout.LayoutParams) background.getLayoutParams(); if (!modeMiniature) { paramsBackground.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, 0); paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_LEFT, 0); paramsBackground.setMargins(0, 0, 0, 0); } else { paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); paramsBackground.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); if (photoTaken) { Resources res = getResources(); int defaultPadding = (int)res.getDimension(R.dimen.default_padding); BitmapDrawable image = (BitmapDrawable) res.getDrawable(R.drawable.accept); int marginBottom = image.getBitmap().getHeight() + (defaultPadding * 2); paramsBackground.setMargins(0, 0, 0, marginBottom); } else { paramsBackground.setMargins(0, 0, 0, 0); } } background.setLayoutParams(paramsBackground); }
/** * Handle the position of the background */
Handle the position of the background
positioningBackground
{ "repo_name": "popovicsandras/customCamera", "path": "src/android/customCamera/src/org/geneanet/customcamera/CameraActivity.java", "license": "bsd-3-clause", "size": 38304 }
[ "android.content.res.Resources", "android.graphics.drawable.BitmapDrawable", "android.view.ViewGroup", "android.widget.ImageView", "android.widget.RelativeLayout" ]
import android.content.res.Resources; import android.graphics.drawable.BitmapDrawable; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.RelativeLayout;
import android.content.res.*; import android.graphics.drawable.*; import android.view.*; import android.widget.*;
[ "android.content", "android.graphics", "android.view", "android.widget" ]
android.content; android.graphics; android.view; android.widget;
2,433,677
public void onUpgrade(SQLiteDatabase database, int versaoAntiga, int versaoNova) { // Definicao do comando para destruir a tabela Aluno String sql = "DROP TABLE IF EXISTS " + TABELA; // Execucao do comando de destruicao database.execSQL(sql); Log.i(TAG, "Tabela excluida: " + TABELA); // Chamada ao metodo de contrucao da base de dados onCreate(database); }
void function(SQLiteDatabase database, int versaoAntiga, int versaoNova) { String sql = STR + TABELA; database.execSQL(sql); Log.i(TAG, STR + TABELA); onCreate(database); }
/** * Metodo responsavel pela atualizacao das estrutura das tableas * */
Metodo responsavel pela atualizacao das estrutura das tableas
onUpgrade
{ "repo_name": "marciopalheta/cursosandroid", "path": "CadastroAluno/src/br/com/cursoandroid/cadastroaluno/modelo/dao/AlunoDAO.java", "license": "gpl-2.0", "size": 5333 }
[ "android.database.sqlite.SQLiteDatabase", "android.util.Log" ]
import android.database.sqlite.SQLiteDatabase; import android.util.Log;
import android.database.sqlite.*; import android.util.*;
[ "android.database", "android.util" ]
android.database; android.util;
969,535
@RequestMapping(value = "/published", method = RequestMethod.GET, produces = { "text/html" }) @ResponseBody public ModelAndView listPublishedHtml() throws IOException { final ModelMap model = new ModelMap(); model.addAttribute("result", this.listPublished()); return new ModelAndView("publishedlist", model); }
@RequestMapping(value = STR, method = RequestMethod.GET, produces = { STR }) ModelAndView function() throws IOException { final ModelMap model = new ModelMap(); model.addAttribute(STR, this.listPublished()); return new ModelAndView(STR, model); }
/** * Controller method for a retrieving a HTML view using a HTTP GET containing a list of * {@link net.objecthunter .larch.model.Entity}s * * @return a Spring MVC {@link org.springframework.web.servlet.ModelAndView} for rendering the HTML view */
Controller method for a retrieving a HTML view using a HTTP GET containing a list of <code>net.objecthunter .larch.model.Entity</code>s
listPublishedHtml
{ "repo_name": "fasseg/larch", "path": "larch-server/src/main/java/net/objecthunter/larch/controller/ListController.java", "license": "apache-2.0", "size": 3846 }
[ "java.io.IOException", "org.springframework.ui.ModelMap", "org.springframework.web.bind.annotation.RequestMapping", "org.springframework.web.bind.annotation.RequestMethod", "org.springframework.web.servlet.ModelAndView" ]
import java.io.IOException; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView;
import java.io.*; import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*;
[ "java.io", "org.springframework.ui", "org.springframework.web" ]
java.io; org.springframework.ui; org.springframework.web;
2,658,310
public double getMean() { if (mean == meanImpl) { return new Mean(secondMoment).getResult(); } else { return meanImpl.getResult(); } }
double function() { if (mean == meanImpl) { return new Mean(secondMoment).getResult(); } else { return meanImpl.getResult(); } }
/** * Returns the mean of the values that have been added. * <p> * Double.NaN is returned if no values have been added. * </p> * @return the mean */
Returns the mean of the values that have been added. Double.NaN is returned if no values have been added.
getMean
{ "repo_name": "SpoonLabs/astor", "path": "examples/Math-issue-288/src/main/java/org/apache/commons/math/stat/descriptive/SummaryStatistics.java", "license": "gpl-2.0", "size": 24923 }
[ "org.apache.commons.math.stat.descriptive.moment.Mean" ]
import org.apache.commons.math.stat.descriptive.moment.Mean;
import org.apache.commons.math.stat.descriptive.moment.*;
[ "org.apache.commons" ]
org.apache.commons;
1,199,224
public Optional<LinuxSettings> getLinuxSettings() { return this.linuxSettings; }
Optional<LinuxSettings> function() { return this.linuxSettings; }
/** * Settings for creating a Linux VM. Will only be set if this is a * {@link VmSpec} for a Linux VM. * * @return */
Settings for creating a Linux VM. Will only be set if this is a <code>VmSpec</code> for a Linux VM
getLinuxSettings
{ "repo_name": "elastisys/scale.cloudpool", "path": "azure/src/main/java/com/elastisys/scale/cloudpool/azure/driver/client/VmSpec.java", "license": "apache-2.0", "size": 7963 }
[ "com.elastisys.scale.cloudpool.azure.driver.config.LinuxSettings", "java.util.Optional" ]
import com.elastisys.scale.cloudpool.azure.driver.config.LinuxSettings; import java.util.Optional;
import com.elastisys.scale.cloudpool.azure.driver.config.*; import java.util.*;
[ "com.elastisys.scale", "java.util" ]
com.elastisys.scale; java.util;
1,774,619
@SuppressWarnings("unchecked") public Delete addDeleteMarker(Cell kv) throws IOException { // TODO: Deprecate and rename 'add' so it matches how we add KVs to Puts. if (!CellUtil.isDelete(kv)) { throw new IOException("The recently added KeyValue is not of type " + "delete. Rowkey: " + Bytes.toStringBinary(this.row)); } if (Bytes.compareTo(this.row, 0, row.length, kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()) != 0) { throw new WrongRowIOException("The row in " + kv.toString() + " doesn't match the original one " + Bytes.toStringBinary(this.row)); } byte [] family = CellUtil.cloneFamily(kv); List<Cell> list = familyMap.get(family); if (list == null) { list = new ArrayList<Cell>(); } list.add(kv); familyMap.put(family, list); return this; } /** * Delete all versions of all columns of the specified family. * <p> * Overrides previous calls to deleteColumn and deleteColumns for the * specified family. * @param family family name * @return this for invocation chaining * @deprecated Since 1.0.0. Use {@link #addFamily(byte[])}
@SuppressWarnings(STR) Delete function(Cell kv) throws IOException { if (!CellUtil.isDelete(kv)) { throw new IOException(STR + STR + Bytes.toStringBinary(this.row)); } if (Bytes.compareTo(this.row, 0, row.length, kv.getRowArray(), kv.getRowOffset(), kv.getRowLength()) != 0) { throw new WrongRowIOException(STR + kv.toString() + STR + Bytes.toStringBinary(this.row)); } byte [] family = CellUtil.cloneFamily(kv); List<Cell> list = familyMap.get(family); if (list == null) { list = new ArrayList<Cell>(); } list.add(kv); familyMap.put(family, list); return this; } /** * Delete all versions of all columns of the specified family. * <p> * Overrides previous calls to deleteColumn and deleteColumns for the * specified family. * @param family family name * @return this for invocation chaining * @deprecated Since 1.0.0. Use {@link #addFamily(byte[])}
/** * Advanced use only. * Add an existing delete marker to this Delete object. * @param kv An existing KeyValue of type "delete". * @return this for invocation chaining * @throws IOException */
Advanced use only. Add an existing delete marker to this Delete object
addDeleteMarker
{ "repo_name": "grokcoder/pbase", "path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Delete.java", "license": "apache-2.0", "size": 16427 }
[ "java.io.IOException", "java.util.ArrayList", "java.util.List", "org.apache.hadoop.hbase.Cell", "org.apache.hadoop.hbase.CellUtil", "org.apache.hadoop.hbase.util.Bytes" ]
import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellUtil; import org.apache.hadoop.hbase.util.Bytes;
import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*;
[ "java.io", "java.util", "org.apache.hadoop" ]
java.io; java.util; org.apache.hadoop;
1,007,219
public final WebApplicationContext getWebApplicationContext() { return this.webApplicationContext; }
final WebApplicationContext function() { return this.webApplicationContext; }
/** * Return the current WebApplicationContext. */
Return the current WebApplicationContext
getWebApplicationContext
{ "repo_name": "ZJU-Shaonian-Biancheng-Tuan/bbossgroups-3.5", "path": "bboss-mvc/src/org/frameworkset/web/servlet/support/RequestContext.java", "license": "apache-2.0", "size": 34447 }
[ "org.frameworkset.web.servlet.context.WebApplicationContext" ]
import org.frameworkset.web.servlet.context.WebApplicationContext;
import org.frameworkset.web.servlet.context.*;
[ "org.frameworkset.web" ]
org.frameworkset.web;
1,324,583
protected IQueryComponentDescriptorFactory getQueryComponentDescriptorFactory() { return queryComponentDescriptorFactory; } private static class FilterComponentTracker implements PropertyChangeListener { private final FilterableBeanCollectionModule target; public FilterComponentTracker(FilterableBeanCollectionModule target) { this.target = target; } /** * {@inheritDoc}
IQueryComponentDescriptorFactory function() { return queryComponentDescriptorFactory; } private static class FilterComponentTracker implements PropertyChangeListener { private final FilterableBeanCollectionModule target; public FilterComponentTracker(FilterableBeanCollectionModule target) { this.target = target; } /** * {@inheritDoc}
/** * Gets the query component descriptor factory used to create the filter model * descriptor. * * @return the query component descriptor factory used to create the filter model descriptor. */
Gets the query component descriptor factory used to create the filter model descriptor
getQueryComponentDescriptorFactory
{ "repo_name": "jspresso/jspresso-ce", "path": "application/src/main/java/org/jspresso/framework/application/model/FilterableBeanCollectionModule.java", "license": "lgpl-3.0", "size": 33039 }
[ "java.beans.PropertyChangeListener", "org.jspresso.framework.model.descriptor.IQueryComponentDescriptorFactory" ]
import java.beans.PropertyChangeListener; import org.jspresso.framework.model.descriptor.IQueryComponentDescriptorFactory;
import java.beans.*; import org.jspresso.framework.model.descriptor.*;
[ "java.beans", "org.jspresso.framework" ]
java.beans; org.jspresso.framework;
2,035,258
public InetAddress getDccInetAddress() { return _dccInetAddress; }
InetAddress function() { return _dccInetAddress; }
/** * Returns the InetAddress used when sending DCC chat or file transfers. * If this is null, the default InetAddress will be used. * * @since PircBot 1.4.4 * * @return The current DCC InetAddress, or null if left as default. */
Returns the InetAddress used when sending DCC chat or file transfers. If this is null, the default InetAddress will be used
getDccInetAddress
{ "repo_name": "heriniaina/karajiandroid", "path": "application/src/org/jibble/pircbot/PircBot.java", "license": "gpl-3.0", "size": 123404 }
[ "java.net.InetAddress" ]
import java.net.InetAddress;
import java.net.*;
[ "java.net" ]
java.net;
627,786
parameters = {"contextNodeRef", "xpath", "parameters", "namespacePrefixResolver", "followAllParentLinks"}, recordable = {true, true, true, false, true}) public List<Serializable> selectProperties(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; @Auditable(
parameters = {STR, "xpath", STR, STR, STR}, recordable = {true, true, true, false, true}) List<Serializable> function(NodeRef contextNodeRef, String xpath, QueryParameterDefinition[] parameters, NamespacePrefixResolver namespacePrefixResolver, boolean followAllParentLinks) throws InvalidNodeRefException, XPathException; @Auditable(
/** * Select properties using an xpath expression * * @param contextNodeRef - * the context node for relative expressions etc * @param xpath - * the xpath string to evaluate * @param parameters - * parameters to bind in to the xpath expression * @param namespacePrefixResolver - * prefix to namespace mappings * @param followAllParentLinks - * if false ".." follows only the primary parent links, if true * it follows all * @return a list of property values */
Select properties using an xpath expression
selectProperties
{ "repo_name": "Alfresco/community-edition", "path": "projects/data-model/source/java/org/alfresco/service/cmr/search/SearchService.java", "license": "lgpl-3.0", "size": 11511 }
[ "java.io.Serializable", "java.util.List", "org.alfresco.service.Auditable", "org.alfresco.service.cmr.repository.InvalidNodeRefException", "org.alfresco.service.cmr.repository.NodeRef", "org.alfresco.service.cmr.repository.XPathException", "org.alfresco.service.namespace.NamespacePrefixResolver" ]
import java.io.Serializable; import java.util.List; import org.alfresco.service.Auditable; import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.XPathException; import org.alfresco.service.namespace.NamespacePrefixResolver;
import java.io.*; import java.util.*; import org.alfresco.service.*; import org.alfresco.service.cmr.repository.*; import org.alfresco.service.namespace.*;
[ "java.io", "java.util", "org.alfresco.service" ]
java.io; java.util; org.alfresco.service;
1,692,878
public static void logoutSubjectIdentifier(Connection c, String subjectIdentifier) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = "session.logout_subject_identifier"; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; Map response = c.dispatch(method_call, method_params); return; }
static void function(Connection c, String subjectIdentifier) throws BadServerResponse, XenAPIException, XmlRpcException { String method_call = STR; String session = c.getSessionReference(); Object[] method_params = {Marshalling.toXMLRPC(session), Marshalling.toXMLRPC(subjectIdentifier)}; Map response = c.dispatch(method_call, method_params); return; }
/** * Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function * * @param subjectIdentifier User subject-identifier of the sessions to be destroyed */
Log out all sessions associated to a user subject-identifier, except the session associated with the context calling this function
logoutSubjectIdentifier
{ "repo_name": "guzy/OnceCenter", "path": "src/com/once/xenapi/Session.java", "license": "apache-2.0", "size": 25779 }
[ "com.once.xenapi.Types", "java.util.Map", "org.apache.xmlrpc.XmlRpcException" ]
import com.once.xenapi.Types; import java.util.Map; import org.apache.xmlrpc.XmlRpcException;
import com.once.xenapi.*; import java.util.*; import org.apache.xmlrpc.*;
[ "com.once.xenapi", "java.util", "org.apache.xmlrpc" ]
com.once.xenapi; java.util; org.apache.xmlrpc;
1,890,394
public ArrayList<Long> serviceName_users_login_jobs_GET(String serviceName, String login) throws IOException { String qPath = "/sms/{serviceName}/users/{login}/jobs"; StringBuilder sb = path(qPath, serviceName, login); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
ArrayList<Long> function(String serviceName, String login) throws IOException { String qPath = STR; StringBuilder sb = path(qPath, serviceName, login); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
/** * Sms in pending associated to the sms user * * REST: GET /sms/{serviceName}/users/{login}/jobs * @param serviceName [required] The internal name of your SMS offer * @param login [required] The sms user login */
Sms in pending associated to the sms user
serviceName_users_login_jobs_GET
{ "repo_name": "UrielCh/ovh-java-sdk", "path": "ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java", "license": "bsd-3-clause", "size": 76622 }
[ "java.io.IOException", "java.util.ArrayList" ]
import java.io.IOException; import java.util.ArrayList;
import java.io.*; import java.util.*;
[ "java.io", "java.util" ]
java.io; java.util;
452,792
public List<ValidationMessage> getErrors() { return errors; }
List<ValidationMessage> function() { return errors; }
/** * The errors. * * @return The errors. */
The errors
getErrors
{ "repo_name": "garyhodgson/enunciate", "path": "core/src/main/java/org/codehaus/enunciate/contract/validation/ValidationResult.java", "license": "apache-2.0", "size": 6666 }
[ "java.util.List" ]
import java.util.List;
import java.util.*;
[ "java.util" ]
java.util;
2,476,365
private List<String> getChildren(String path) throws Exception { try { return zkClient.getChildren(path).get(TIMEOUT_SECONDS, TimeUnit.SECONDS).getChildren(); } catch (ExecutionException e) { if (e.getCause() instanceof KeeperException.NoNodeException) { // If the node doesn't exists, return an empty list return Collections.emptyList(); } throw e; } } }
List<String> function(String path) throws Exception { try { return zkClient.getChildren(path).get(TIMEOUT_SECONDS, TimeUnit.SECONDS).getChildren(); } catch (ExecutionException e) { if (e.getCause() instanceof KeeperException.NoNodeException) { return Collections.emptyList(); } throw e; } } }
/** * Returns the list of children node under the given path. * * @param path path to get children * @return the list of children or empty list if the path doesn't exist. * @throws Exception if failed to get children */
Returns the list of children node under the given path
getChildren
{ "repo_name": "serranom/twill", "path": "twill-yarn/src/main/java/org/apache/twill/internal/appmaster/ApplicationMasterMain.java", "license": "apache-2.0", "size": 14120 }
[ "java.util.Collections", "java.util.List", "java.util.concurrent.ExecutionException", "java.util.concurrent.TimeUnit", "org.apache.zookeeper.KeeperException" ]
import java.util.Collections; import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import org.apache.zookeeper.KeeperException;
import java.util.*; import java.util.concurrent.*; import org.apache.zookeeper.*;
[ "java.util", "org.apache.zookeeper" ]
java.util; org.apache.zookeeper;
915,325
@Override public void get(Signal[] output, int outputLength) { Calendar calendar = Calendar.getInstance(); out(0, SignalUtils.getSignal((double)calendar.get(Calendar.SECOND)), output, outputLength); out(1, SignalUtils.getSignal((double)calendar.get(Calendar.MINUTE)), output, outputLength); out(2, SignalUtils.getSignal((double)calendar.get(Calendar.HOUR_OF_DAY)), output, outputLength); out(3, SignalUtils.getSignal((double)calendar.get(Calendar.DATE)), output, outputLength); out(4, SignalUtils.getSignal((double)calendar.get(Calendar.MONTH) + 1), output, outputLength); out(5, SignalUtils.getSignal((double)calendar.get(Calendar.YEAR)), output, outputLength); }
void function(Signal[] output, int outputLength) { Calendar calendar = Calendar.getInstance(); out(0, SignalUtils.getSignal((double)calendar.get(Calendar.SECOND)), output, outputLength); out(1, SignalUtils.getSignal((double)calendar.get(Calendar.MINUTE)), output, outputLength); out(2, SignalUtils.getSignal((double)calendar.get(Calendar.HOUR_OF_DAY)), output, outputLength); out(3, SignalUtils.getSignal((double)calendar.get(Calendar.DATE)), output, outputLength); out(4, SignalUtils.getSignal((double)calendar.get(Calendar.MONTH) + 1), output, outputLength); out(5, SignalUtils.getSignal((double)calendar.get(Calendar.YEAR)), output, outputLength); }
/** * Returns actual local system time. It returns an array of size * six with following meaning: * <ol> * <li value="0"> second * <li> minute * <li> hour * <li> day * <li> month * <li> year * </ol> * */
Returns actual local system time. It returns an array of size six with following meaning: second minute hour day month year
get
{ "repo_name": "jilm/control4j", "path": "src/cz/control4j/modules/auxiliary/OMClock.java", "license": "lgpl-3.0", "size": 2267 }
[ "cz.control4j.Signal", "cz.control4j.SignalUtils", "java.util.Calendar" ]
import cz.control4j.Signal; import cz.control4j.SignalUtils; import java.util.Calendar;
import cz.control4j.*; import java.util.*;
[ "cz.control4j", "java.util" ]
cz.control4j; java.util;
2,659,990