method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public String archive(String siteId, Document doc, Stack stack,
String archivePath, List attachments)
{
// TODO Permissions ?
// prepare the buffer for the results log
StringBuffer results = new StringBuffer();
results.append(Messages.getString("RWikiObjectServiceImpl.32")).append(siteId).append("\n"); //$NON-NLS-1$ //$NON-NLS-2$
log.debug("archiving Wiki Pages for " + siteId); //$NON-NLS-1$
int npages = 0;
int nversions = 0;
try
{
String defaultRealm = siteService.getSite(siteId).getReference();
wikiSecurityService
.checkAdminPermission(RWikiObjectService.REFERENCE_ROOT
+ defaultRealm);
// start with an element with our very own name
Element element = doc.createElement(APPLICATION_ID);
((Element) stack.peek()).appendChild(element);
stack.push(element);
try
{
List l = cdao.findRWikiSubPages("/site/" + siteId); //$NON-NLS-1$
for (Iterator i = l.iterator(); i.hasNext();)
{
RWikiObject rwo = (RWikiObject) i.next();
RWikiEntity rwe = (RWikiEntity) getEntity(rwo);
log.debug("Archiving " + rwo.getName()); //$NON-NLS-1$
rwe.toXml(doc, stack);
npages++;
List lh = this.findRWikiHistoryObjects(rwo);
if (lh != null)
{
for (Iterator ih = lh.iterator(); ih.hasNext();)
{
RWikiObject rwoh = (RWikiObject) ih.next();
RWikiEntity rwoeh = (RWikiEntity) getEntity(rwoh);
log.debug("Archiving " + rwoh.getName() //$NON-NLS-1$
+ " version " + rwoh.getVersion()); //$NON-NLS-1$
rwoeh.toXml(doc, stack);
nversions++;
}
}
}
}
catch (Exception any)
{
any.printStackTrace();
results.append(Messages.getString("RWikiObjectServiceImpl.31") + siteId //$NON-NLS-1$
+ " " + any.toString() + "\n"); //$NON-NLS-1$ //$NON-NLS-2$
}
results.append(Messages.getString("RWikiObjectServiceImpl.30")).append(npages).append( //$NON-NLS-1$
Messages.getString("RWikiObjectServiceImpl.43")).append(nversions).append(Messages.getString("RWikiObjectServiceImpl.44")); //$NON-NLS-1$ //$NON-NLS-2$
stack.pop();
}
catch (IdUnusedException ex)
{
}
return results.toString();
} | String function(String siteId, Document doc, Stack stack, String archivePath, List attachments) { StringBuffer results = new StringBuffer(); results.append(Messages.getString(STR)).append(siteId).append("\n"); log.debug(STR + siteId); int npages = 0; int nversions = 0; try { String defaultRealm = siteService.getSite(siteId).getReference(); wikiSecurityService .checkAdminPermission(RWikiObjectService.REFERENCE_ROOT + defaultRealm); Element element = doc.createElement(APPLICATION_ID); ((Element) stack.peek()).appendChild(element); stack.push(element); try { List l = cdao.findRWikiSubPages(STR + siteId); for (Iterator i = l.iterator(); i.hasNext();) { RWikiObject rwo = (RWikiObject) i.next(); RWikiEntity rwe = (RWikiEntity) getEntity(rwo); log.debug(STR + rwo.getName()); rwe.toXml(doc, stack); npages++; List lh = this.findRWikiHistoryObjects(rwo); if (lh != null) { for (Iterator ih = lh.iterator(); ih.hasNext();) { RWikiObject rwoh = (RWikiObject) ih.next(); RWikiEntity rwoeh = (RWikiEntity) getEntity(rwoh); log.debug(STR + rwoh.getName() + STR + rwoh.getVersion()); rwoeh.toXml(doc, stack); nversions++; } } } } catch (Exception any) { any.printStackTrace(); results.append(Messages.getString(STR) + siteId + " " + any.toString() + "\n"); } results.append(Messages.getString(STR)).append(npages).append( Messages.getString(STR)).append(nversions).append(Messages.getString(STR)); stack.pop(); } catch (IdUnusedException ex) { } return results.toString(); } | /**
* {@inheritDoc} Archive all the wiki pages in the site as a single
* collection
*/ | Archive all the wiki pages in the site as a single collection | archive | {
"repo_name": "harfalm/Sakai-10.1",
"path": "rwiki/rwiki-impl/impl/src/java/uk/ac/cam/caret/sakai/rwiki/component/service/impl/RWikiObjectServiceImpl.java",
"license": "apache-2.0",
"size": 51860
} | [
"java.util.Iterator",
"java.util.List",
"java.util.Stack",
"org.sakaiproject.exception.IdUnusedException",
"org.w3c.dom.Document",
"org.w3c.dom.Element",
"uk.ac.cam.caret.sakai.rwiki.component.Messages",
"uk.ac.cam.caret.sakai.rwiki.service.api.RWikiObjectService",
"uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiEntity",
"uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject"
] | import java.util.Iterator; import java.util.List; import java.util.Stack; import org.sakaiproject.exception.IdUnusedException; import org.w3c.dom.Document; import org.w3c.dom.Element; import uk.ac.cam.caret.sakai.rwiki.component.Messages; import uk.ac.cam.caret.sakai.rwiki.service.api.RWikiObjectService; import uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiEntity; import uk.ac.cam.caret.sakai.rwiki.service.api.model.RWikiObject; | import java.util.*; import org.sakaiproject.exception.*; import org.w3c.dom.*; import uk.ac.cam.caret.sakai.rwiki.component.*; import uk.ac.cam.caret.sakai.rwiki.service.api.*; import uk.ac.cam.caret.sakai.rwiki.service.api.model.*; | [
"java.util",
"org.sakaiproject.exception",
"org.w3c.dom",
"uk.ac.cam"
] | java.util; org.sakaiproject.exception; org.w3c.dom; uk.ac.cam; | 499,029 |
public List<CarbonJobInfo> getJobList()
{
Element statusList = element.getChild("JobStatusList");
if (statusList != null)
{
List<CarbonJobInfo> jobs = new ArrayList<CarbonJobInfo>();
for (Element job : statusList.getChildren())
{
jobs.add(new CarbonJobInfo(job));
}
return jobs;
}
else if (getJobInfo() != null)
{
return Collections.singletonList(getJobInfo());
}
else
{
return Collections.emptyList();
}
} | List<CarbonJobInfo> function() { Element statusList = element.getChild(STR); if (statusList != null) { List<CarbonJobInfo> jobs = new ArrayList<CarbonJobInfo>(); for (Element job : statusList.getChildren()) { jobs.add(new CarbonJobInfo(job)); } return jobs; } else if (getJobInfo() != null) { return Collections.singletonList(getJobInfo()); } else { return Collections.emptyList(); } } | /**
* Return the jobs listed by this response<br />
* N.B. this handles "JobStatusList" and "JobInfo" elements within the Reply
*
* @return
*/ | Return the jobs listed by this response N.B. this handles "JobStatusList" and "JobInfo" elements within the Reply | getJobList | {
"repo_name": "petergeneric/stdlib",
"path": "util/carbon-client/src/main/java/com/peterphi/carbon/type/immutable/CarbonReply.java",
"license": "mit",
"size": 3160
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.jdom2.Element"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.jdom2.Element; | import java.util.*; import org.jdom2.*; | [
"java.util",
"org.jdom2"
] | java.util; org.jdom2; | 1,787,190 |
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// Forward to add category form
request.getRequestDispatcher(ADD_CATEGORY_VIEW).forward(request, response);
}
| void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.getRequestDispatcher(ADD_CATEGORY_VIEW).forward(request, response); } | /**
* Handles <code>GET</code> HTTP method Forward to appropriate view
*
* @param request
* servlet request
* @param response
* servlet response
* @throws ServletException
* if a servlet-specific error occurs
* @throws IOException
* if an I/O error occurs
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/ | Handles <code>GET</code> HTTP method Forward to appropriate view | doGet | {
"repo_name": "MrLowkos/3JVA-SupCommerce-4-4",
"path": "src/com/supinfo/supcommerce/servlet/AddCategoryServlet.java",
"license": "mit",
"size": 3328
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 1,003,539 |
public static byte[] toMACAddress(String macAddress) {
return MacAddress.of(macAddress).getBytes();
} | static byte[] function(String macAddress) { return MacAddress.of(macAddress).getBytes(); } | /**
* Accepts a MAC address of the form 00:aa:11:bb:22:cc, case does not
* matter, and returns a corresponding byte[].
* @param macAddress The MAC address to convert into a bye array
* @return The macAddress as a byte array
*/ | Accepts a MAC address of the form 00:aa:11:bb:22:cc, case does not matter, and returns a corresponding byte[] | toMACAddress | {
"repo_name": "rizard/SOSForFloodlight",
"path": "src/main/java/net/floodlightcontroller/packet/Ethernet.java",
"license": "apache-2.0",
"size": 16935
} | [
"org.projectfloodlight.openflow.types.MacAddress"
] | import org.projectfloodlight.openflow.types.MacAddress; | import org.projectfloodlight.openflow.types.*; | [
"org.projectfloodlight.openflow"
] | org.projectfloodlight.openflow; | 948,221 |
public void addNewsFeedLabel(String label) {
newsFeedLabels.add(label);
adapter.notifyDataSetChanged();
NewsFeedActivity.refresh();
} | void function(String label) { newsFeedLabels.add(label); adapter.notifyDataSetChanged(); NewsFeedActivity.refresh(); } | /**
* Method to add feed in the list
* @param label the label of the feed
*/ | Method to add feed in the list | addNewsFeedLabel | {
"repo_name": "mdamis/journal",
"path": "app/src/main/java/fr/upem/journal/fragment/EditNewsFeedsFragment.java",
"license": "mit",
"size": 3231
} | [
"fr.upem.journal.activity.NewsFeedActivity"
] | import fr.upem.journal.activity.NewsFeedActivity; | import fr.upem.journal.activity.*; | [
"fr.upem.journal"
] | fr.upem.journal; | 1,013,245 |
public static void updateJsonNoteFromMultimediaNote(final IMultimediaEditableNote noteSrc, final Note editorNoteDst) {
if (noteSrc instanceof MultimediaEditableNote) {
MultimediaEditableNote mmNote = (MultimediaEditableNote) noteSrc;
if (mmNote.getModelId() != editorNoteDst.getMid()) {
throw new RuntimeException("Source and Destination Note ID do not match.");
}
int totalFields = mmNote.getNumberOfFields();
for (int i = 0; i < totalFields; i++) {
editorNoteDst.values()[i] = mmNote.getField(i).getFormattedValue();
}
}
} | static void function(final IMultimediaEditableNote noteSrc, final Note editorNoteDst) { if (noteSrc instanceof MultimediaEditableNote) { MultimediaEditableNote mmNote = (MultimediaEditableNote) noteSrc; if (mmNote.getModelId() != editorNoteDst.getMid()) { throw new RuntimeException(STR); } int totalFields = mmNote.getNumberOfFields(); for (int i = 0; i < totalFields; i++) { editorNoteDst.values()[i] = mmNote.getField(i).getFormattedValue(); } } } | /**
* Updates the JsonNote field values from MultimediaEditableNote When both notes are using the same Model, it updaes
* the destination field values with source values. If models are different it throws an Exception
*
* @param noteSrc
* @param editorNoteDst
*/ | Updates the JsonNote field values from MultimediaEditableNote When both notes are using the same Model, it updaes the destination field values with source values. If models are different it throws an Exception | updateJsonNoteFromMultimediaNote | {
"repo_name": "peervalhoegen/Anki-Android",
"path": "AnkiDroid/src/main/java/com/ichi2/anki/servicelayer/NoteService.java",
"license": "gpl-3.0",
"size": 8341
} | [
"com.ichi2.anki.multimediacard.IMultimediaEditableNote",
"com.ichi2.anki.multimediacard.impl.MultimediaEditableNote",
"com.ichi2.libanki.Note"
] | import com.ichi2.anki.multimediacard.IMultimediaEditableNote; import com.ichi2.anki.multimediacard.impl.MultimediaEditableNote; import com.ichi2.libanki.Note; | import com.ichi2.anki.multimediacard.*; import com.ichi2.anki.multimediacard.impl.*; import com.ichi2.libanki.*; | [
"com.ichi2.anki",
"com.ichi2.libanki"
] | com.ichi2.anki; com.ichi2.libanki; | 2,206,669 |
public void assertDoesNotContain(AssertionInfo info, byte[] actual, byte[] values) {
arrays.assertDoesNotContain(info, failures, actual, values);
} | void function(AssertionInfo info, byte[] actual, byte[] values) { arrays.assertDoesNotContain(info, failures, actual, values); } | /**
* Asserts that the given array does not contain the given values.
* @param info contains information about the assertion.
* @param actual the given array.
* @param values the values that are expected not to be in the given array.
* @throws NullPointerException if the array of values is {@code null}.
* @throws IllegalArgumentException if the array of values is empty.
* @throws AssertionError if the given array is {@code null}.
* @throws AssertionError if the given array contains any of given values.
*/ | Asserts that the given array does not contain the given values | assertDoesNotContain | {
"repo_name": "bric3/assertj-core",
"path": "src/main/java/org/assertj/core/internal/ByteArrays.java",
"license": "apache-2.0",
"size": 22435
} | [
"org.assertj.core.api.AssertionInfo"
] | import org.assertj.core.api.AssertionInfo; | import org.assertj.core.api.*; | [
"org.assertj.core"
] | org.assertj.core; | 2,295,056 |
@Override
public boolean finishConnect() throws IOException {
boolean connected = socketChannel.finishConnect();
if (connected)
key.interestOps(key.interestOps() & ~SelectionKey.OP_CONNECT | SelectionKey.OP_READ);
return connected;
} | boolean function() throws IOException { boolean connected = socketChannel.finishConnect(); if (connected) key.interestOps(key.interestOps() & ~SelectionKey.OP_CONNECT SelectionKey.OP_READ); return connected; } | /**
* does socketChannel.finishConnect()
*/ | does socketChannel.finishConnect() | finishConnect | {
"repo_name": "ollie314/kafka",
"path": "clients/src/main/java/org/apache/kafka/common/network/SslTransportLayer.java",
"license": "apache-2.0",
"size": 38657
} | [
"java.io.IOException",
"java.nio.channels.SelectionKey"
] | import java.io.IOException; import java.nio.channels.SelectionKey; | import java.io.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,768,484 |
public static void deviceUnbinding(Context context, String accessToken, String identifier, AsyncHttpResponseHandler responseHandler) {
List<Header> headerList = new ArrayList<Header>();
headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN, accessToken));
try {
post(context, String.format(getApiServerUrl() + DEVICE_UNBINDING, identifier), headerList, null, responseHandler);
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
responseHandler.onFailure(INNER_ERROR_CODE, null, null, e);
}
} | static void function(Context context, String accessToken, String identifier, AsyncHttpResponseHandler responseHandler) { List<Header> headerList = new ArrayList<Header>(); headerList.add(new BasicHeader(ApiKey.HeadKey.ACCESS_TOKEN, accessToken)); try { post(context, String.format(getApiServerUrl() + DEVICE_UNBINDING, identifier), headerList, null, responseHandler); } catch (UnsupportedEncodingException e) { e.printStackTrace(); responseHandler.onFailure(INNER_ERROR_CODE, null, null, e); } } | /**
* device unbinding (/v1/devices/{identifier}/unbinding)
* @param context
* @param accessToken
* @param responseHandler
*/ | device unbinding (/v1/devices/{identifier}/unbinding) | deviceUnbinding | {
"repo_name": "free-iot/freeiot-android",
"path": "app/src/main/java/com/pandocloud/freeiot/api/DevicesApi.java",
"license": "mit",
"size": 13486
} | [
"android.content.Context",
"com.loopj.android.http.AsyncHttpResponseHandler",
"java.io.UnsupportedEncodingException",
"java.util.ArrayList",
"java.util.List",
"org.apache.http.Header",
"org.apache.http.message.BasicHeader"
] | import android.content.Context; import com.loopj.android.http.AsyncHttpResponseHandler; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import org.apache.http.Header; import org.apache.http.message.BasicHeader; | import android.content.*; import com.loopj.android.http.*; import java.io.*; import java.util.*; import org.apache.http.*; import org.apache.http.message.*; | [
"android.content",
"com.loopj.android",
"java.io",
"java.util",
"org.apache.http"
] | android.content; com.loopj.android; java.io; java.util; org.apache.http; | 1,979,530 |
void setJSONString(String jsonString) throws JSONException; | void setJSONString(String jsonString) throws JSONException; | /**
* From the json format String parsing out the {@code Map<String, List<String>>} data.
*
* @param jsonString json string.
* @throws JSONException thrown it when format error.
*/ | From the json format String parsing out the Map> data | setJSONString | {
"repo_name": "zqh110110/base_http_rxjava_databing_commonutil",
"path": "nohttp/src/main/java/com/yanzhenjie/nohttp/Headers.java",
"license": "apache-2.0",
"size": 7201
} | [
"org.json.JSONException"
] | import org.json.JSONException; | import org.json.*; | [
"org.json"
] | org.json; | 1,089,746 |
final Random r = new Random();
{
final CounterSet cset = root.makePath("localhost");
final String localIpAddr = NicUtil.getIpAddress("default.nic",
"default", true);
cset.addCounter("hostname", new OneShotInstrument<String>(
localIpAddr));
cset.addCounter("ipaddr",
new OneShotInstrument<String>(localIpAddr));
// 60 minutes of data : @todo replace with CounterSetBTree (no fixed limit).
final HistoryInstrument<Double> history1 = new HistoryInstrument<Double>(
new History<Double>(new Double[60], PeriodEnum.Minutes
.getPeriodMillis(), true));
cset.addCounter("random", new Instrument<Integer>() { | final Random r = new Random(); { final CounterSet cset = root.makePath(STR); final String localIpAddr = NicUtil.getIpAddress(STR, STR, true); cset.addCounter(STR, new OneShotInstrument<String>( localIpAddr)); cset.addCounter(STR, new OneShotInstrument<String>(localIpAddr)); final HistoryInstrument<Double> history1 = new HistoryInstrument<Double>( new History<Double>(new Double[60], PeriodEnum.Minutes .getPeriodMillis(), true)); cset.addCounter(STR, new Instrument<Integer>() { | /**
* Invoked during server startup to allow customization of the
* {@link CounterSet} exposed by the httpd server.
*
* @param root
*/ | Invoked during server startup to allow customization of the <code>CounterSet</code> exposed by the httpd server | setUp | {
"repo_name": "rac021/blazegraph_1_5_3_cluster_2_nodes",
"path": "bigdata/src/test/com/bigdata/counters/httpd/TestCounterSetHTTPDServer.java",
"license": "gpl-2.0",
"size": 4719
} | [
"com.bigdata.counters.CounterSet",
"com.bigdata.counters.History",
"com.bigdata.counters.HistoryInstrument",
"com.bigdata.counters.Instrument",
"com.bigdata.counters.OneShotInstrument",
"com.bigdata.counters.PeriodEnum",
"com.bigdata.util.config.NicUtil",
"java.util.Random"
] | import com.bigdata.counters.CounterSet; import com.bigdata.counters.History; import com.bigdata.counters.HistoryInstrument; import com.bigdata.counters.Instrument; import com.bigdata.counters.OneShotInstrument; import com.bigdata.counters.PeriodEnum; import com.bigdata.util.config.NicUtil; import java.util.Random; | import com.bigdata.counters.*; import com.bigdata.util.config.*; import java.util.*; | [
"com.bigdata.counters",
"com.bigdata.util",
"java.util"
] | com.bigdata.counters; com.bigdata.util; java.util; | 2,257,774 |
public void loadAsArrayOffsetLength(ClassGenerator classGen,
MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final XSLTC xsltc = classGen.getParser().getXSLTC();
// The XSLTC object keeps track of character data
// that is to be stored in char arrays.
final int offset = xsltc.addCharacterData(_text);
final int length = _text.length();
String charDataFieldName =
STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1);
il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(),
charDataFieldName,
STATIC_CHAR_DATA_FIELD_SIG)));
il.append(new PUSH(cpg, offset));
il.append(new PUSH(cpg, _text.length()));
} | void function(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final XSLTC xsltc = classGen.getParser().getXSLTC(); final int offset = xsltc.addCharacterData(_text); final int length = _text.length(); String charDataFieldName = STATIC_CHAR_DATA_FIELD + (xsltc.getCharacterDataCount()-1); il.append(new GETSTATIC(cpg.addFieldref(xsltc.getClassName(), charDataFieldName, STATIC_CHAR_DATA_FIELD_SIG))); il.append(new PUSH(cpg, offset)); il.append(new PUSH(cpg, _text.length())); } | /**
* Generates code that loads the array that will contain the character
* data represented by this Text node, followed by the offset of the
* data from the start of the array, and then the length of the data.
*
* The pre-condition to calling this method is that
* canLoadAsArrayOffsetLength() returns true.
* @see #canLoadArrayOffsetLength()
*/ | Generates code that loads the array that will contain the character data represented by this Text node, followed by the offset of the data from the start of the array, and then the length of the data. The pre-condition to calling this method is that canLoadAsArrayOffsetLength() returns true | loadAsArrayOffsetLength | {
"repo_name": "itgeeker/jdk",
"path": "src/com/sun/org/apache/xalan/internal/xsltc/compiler/Text.java",
"license": "apache-2.0",
"size": 8714
} | [
"com.sun.org.apache.bcel.internal.generic.ConstantPoolGen",
"com.sun.org.apache.bcel.internal.generic.InstructionList",
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator",
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator"
] | import com.sun.org.apache.bcel.internal.generic.ConstantPoolGen; import com.sun.org.apache.bcel.internal.generic.InstructionList; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ClassGenerator; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator; | import com.sun.org.apache.bcel.internal.generic.*; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; | [
"com.sun.org"
] | com.sun.org; | 583,764 |
public static List<String> getLocaleFallbacks( Locale locale )
{
List<String> locales = new ArrayList<>();
locales.add( locale.getLanguage() );
if ( !locale.getCountry().isEmpty() )
{
locales.add( locale.getLanguage() + SEP + locale.getCountry() );
}
if ( !locale.getVariant().isEmpty() )
{
locales.add( locale.toString() );
}
return locales;
} | static List<String> function( Locale locale ) { List<String> locales = new ArrayList<>(); locales.add( locale.getLanguage() ); if ( !locale.getCountry().isEmpty() ) { locales.add( locale.getLanguage() + SEP + locale.getCountry() ); } if ( !locale.getVariant().isEmpty() ) { locales.add( locale.toString() ); } return locales; } | /**
* Creates a list of locales of all possible specifities based on the given
* Locale. As an example, for the given locale "en_UK", the locales "en" and
* "en_UK" are returned.
*
* @param locale the Locale.
* @return a list of locale strings.
*/ | Creates a list of locales of all possible specifities based on the given Locale. As an example, for the given locale "en_UK", the locales "en" and "en_UK" are returned | getLocaleFallbacks | {
"repo_name": "vietnguyen/dhis2-core",
"path": "dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/LocaleUtils.java",
"license": "bsd-3-clause",
"size": 3763
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Locale"
] | import java.util.ArrayList; import java.util.List; import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,905,044 |
public static Map<String, String> commitItemAsParameterMap(CommitItem commitItem) {
Map<String, String> returnedForJenkins = new HashMap<>();
for(String key : jenkinsParams.keySet())
{
if(key.contains("commitid")){
if (jenkinsParams.get(key).equals("true")){
returnedForJenkins.put("commitid",commitItem.getBranchDescriptor().getNewBranch());
}
else if (!jenkinsParams.get(key).equals("false")){
returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getNewBranch());
}
}
else if(key.contains("committer")){
if (jenkinsParams.get(key).equals("true")){
returnedForJenkins.put("committer",commitItem.getBranchDescriptor().getCommitter());
}
else if (!jenkinsParams.get(key).equals("false")){
returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getCommitter());
}
}
else if(key.contains("longid")){
if (jenkinsParams.get(key).equals("true")){
returnedForJenkins.put("longid",commitItem.getBranchDescriptor().getCommitId());
}
else if (!jenkinsParams.get(key).equals("false")){
returnedForJenkins.put(jenkinsParams.get(key),commitItem.getBranchDescriptor().getCommitId());
}
}
else if(key.contains("jenkinsparam.protected")){
if(jenkinsParams.get(key).equals("true")){
returnedForJenkins.put("protected",commitItem.getBranchDescriptor().getProtectedBranch());
}
else if (!jenkinsParams.get(key).equals("false")){
returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getProtectedBranch());
}
}
else if(key.contains("parent")){
String paraent = commitItem.getParent() == null?commitItem.getBranchDescriptor().getProtectedBranch():commitItem.getParent().getBranchDescriptor().getNewBranch();
if(jenkinsParams.get(key).equals("true")){
returnedForJenkins.put("parent",paraent);
}
else if (!jenkinsParams.get(key).equals("false")){
returnedForJenkins.put(jenkinsParams.get(key), paraent);
}
}
}
return returnedForJenkins;
} | static Map<String, String> function(CommitItem commitItem) { Map<String, String> returnedForJenkins = new HashMap<>(); for(String key : jenkinsParams.keySet()) { if(key.contains(STR)){ if (jenkinsParams.get(key).equals("true")){ returnedForJenkins.put(STR,commitItem.getBranchDescriptor().getNewBranch()); } else if (!jenkinsParams.get(key).equals("false")){ returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getNewBranch()); } } else if(key.contains(STR)){ if (jenkinsParams.get(key).equals("true")){ returnedForJenkins.put(STR,commitItem.getBranchDescriptor().getCommitter()); } else if (!jenkinsParams.get(key).equals("false")){ returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getCommitter()); } } else if(key.contains(STR)){ if (jenkinsParams.get(key).equals("true")){ returnedForJenkins.put(STR,commitItem.getBranchDescriptor().getCommitId()); } else if (!jenkinsParams.get(key).equals("false")){ returnedForJenkins.put(jenkinsParams.get(key),commitItem.getBranchDescriptor().getCommitId()); } } else if(key.contains(STR)){ if(jenkinsParams.get(key).equals("true")){ returnedForJenkins.put(STR,commitItem.getBranchDescriptor().getProtectedBranch()); } else if (!jenkinsParams.get(key).equals("false")){ returnedForJenkins.put(jenkinsParams.get(key), commitItem.getBranchDescriptor().getProtectedBranch()); } } else if(key.contains(STR)){ String paraent = commitItem.getParent() == null?commitItem.getBranchDescriptor().getProtectedBranch():commitItem.getParent().getBranchDescriptor().getNewBranch(); if(jenkinsParams.get(key).equals("true")){ returnedForJenkins.put(STR,paraent); } else if (!jenkinsParams.get(key).equals("false")){ returnedForJenkins.put(jenkinsParams.get(key), paraent); } } } return returnedForJenkins; } | /**
* This method return all relevant fields from CommitItem to an HashMap
* @param commitItem
* @return
* @throws JSONException
*/ | This method return all relevant fields from CommitItem to an HashMap | commitItemAsParameterMap | {
"repo_name": "edagan/verigreen",
"path": "verigreen-collector-impl/src/main/java/com/verigreen/collector/common/VerigreenNeededLogic.java",
"license": "apache-2.0",
"size": 15049
} | [
"com.verigreen.collector.model.CommitItem",
"java.util.HashMap",
"java.util.Map"
] | import com.verigreen.collector.model.CommitItem; import java.util.HashMap; import java.util.Map; | import com.verigreen.collector.model.*; import java.util.*; | [
"com.verigreen.collector",
"java.util"
] | com.verigreen.collector; java.util; | 817,088 |
public List<ItemData> getParentList( ItemData child );
| List<ItemData> function( ItemData child ); | /**
* Selects a list of all parent item data, where the given ItemData is a child item data
* @param child
* @return
*/ | Selects a list of all parent item data, where the given ItemData is a child item data | getParentList | {
"repo_name": "tedvals/mywms",
"path": "server.app/los.inventory-ejb/src/de/linogistix/los/inventory/service/LOSBomService.java",
"license": "gpl-3.0",
"size": 1759
} | [
"java.util.List",
"org.mywms.model.ItemData"
] | import java.util.List; import org.mywms.model.ItemData; | import java.util.*; import org.mywms.model.*; | [
"java.util",
"org.mywms.model"
] | java.util; org.mywms.model; | 404,114 |
public SearchUserResult searchUser(final String queryWords, final int pageId) throws YfyException {
Map<String, String> params = new HashMap<String, String>() {{
put(YfySdkConstant.QUERY_WORDS, queryWords);
put(YfySdkConstant.PAGE_ID, String.valueOf(pageId));
}};
return searchUser(params);
} | SearchUserResult function(final String queryWords, final int pageId) throws YfyException { Map<String, String> params = new HashMap<String, String>() {{ put(YfySdkConstant.QUERY_WORDS, queryWords); put(YfySdkConstant.PAGE_ID, String.valueOf(pageId)); }}; return searchUser(params); } | /**
* Search user in the same enterprise with query key word
*
* @param queryWords Query words about user info
* @param pageId Page id begin with 0
* @return Detailed user information
* @throws YfyException
*/ | Search user in the same enterprise with query key word | searchUser | {
"repo_name": "yifangyun/fangcloud-java-sdk",
"path": "src/main/java/com/fangcloud/sdk/api/user/YfyUserRequest.java",
"license": "mit",
"size": 4381
} | [
"com.fangcloud.sdk.YfySdkConstant",
"com.fangcloud.sdk.exception.YfyException",
"java.util.HashMap",
"java.util.Map"
] | import com.fangcloud.sdk.YfySdkConstant; import com.fangcloud.sdk.exception.YfyException; import java.util.HashMap; import java.util.Map; | import com.fangcloud.sdk.*; import com.fangcloud.sdk.exception.*; import java.util.*; | [
"com.fangcloud.sdk",
"java.util"
] | com.fangcloud.sdk; java.util; | 2,413,715 |
protected void assertHasMessage(String errorMessage, ReportDto report, String attribute, String message) {
Assert.assertTrue(errorMessage, report.hasErrorMessage(attribute, message));
}
| void function(String errorMessage, ReportDto report, String attribute, String message) { Assert.assertTrue(errorMessage, report.hasErrorMessage(attribute, message)); } | /**
* Test if the given attribute has the given message into report.
* @param errorMessage the error message
* @param report the report to test
* @param attribute the atrtibute to test
* @param message the message to find.
*/ | Test if the given attribute has the given message into report | assertHasMessage | {
"repo_name": "aguillem/festival-manager",
"path": "festival-manager-core/src/test/java/com/aguillem/festival/manager/core/test/util/BaseTestCase.java",
"license": "gpl-3.0",
"size": 5403
} | [
"org.junit.Assert",
"org.scub.foundation.framework.base.dto.report.ReportDto"
] | import org.junit.Assert; import org.scub.foundation.framework.base.dto.report.ReportDto; | import org.junit.*; import org.scub.foundation.framework.base.dto.report.*; | [
"org.junit",
"org.scub.foundation"
] | org.junit; org.scub.foundation; | 2,508,587 |
private double getClosestValidTime(double time) {
double possibleTime = 0;
for (int i=0; i<actualTimeRanges.size(); i++) {
TimeRange tr = actualTimeRanges.get(i);
if (i == 0 && time < tr.start) {
return tr.start;
} else if (i == actualTimeRanges.size()-1 && time > tr.end) {
return tr.end;
} else if (tr.contains(time)) {
return time;
} else if (time > tr.end) {
possibleTime = tr.end;
} else if (time-possibleTime < tr.start-time) {
return possibleTime;
} else {
return tr.start;
}
}
// this shouldn't be possible
return time;
}
| double function(double time) { double possibleTime = 0; for (int i=0; i<actualTimeRanges.size(); i++) { TimeRange tr = actualTimeRanges.get(i); if (i == 0 && time < tr.start) { return tr.start; } else if (i == actualTimeRanges.size()-1 && time > tr.end) { return tr.end; } else if (tr.contains(time)) { return time; } else if (time > tr.end) { possibleTime = tr.end; } else if (time-possibleTime < tr.start-time) { return possibleTime; } else { return tr.start; } } return time; } | /**
* Return a time that is valid and the closest possible to the given time. If
* the provided time is valid, then the same time will be returned. If the
* time is invalid, the nearest valid time will be returned.
*
* @param time the time to use
* @return the closest valid time to the given time
*/ | Return a time that is valid and the closest possible to the given time. If the provided time is valid, then the same time will be returned. If the time is invalid, the nearest valid time will be returned | getClosestValidTime | {
"repo_name": "tectronics/rdv",
"path": "src/org/rdv/ui/TimeSlider.java",
"license": "mit",
"size": 34064
} | [
"org.rdv.rbnb.TimeRange"
] | import org.rdv.rbnb.TimeRange; | import org.rdv.rbnb.*; | [
"org.rdv.rbnb"
] | org.rdv.rbnb; | 2,190,518 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
switch (notification.getFeatureID(DocumentRoot.class)) {
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_AUXILIARY_TRAFFIC_AREA:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_RAILWAY:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_ROAD:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_SQUARE:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRACK:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRAFFIC_AREA:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRANSPORTATION_COMPLEX:
case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRANSPORTATION_OBJECT:
case TransportationPackage.DOCUMENT_ROOT__TRANSPORTATION_OBJECT:
case TransportationPackage.DOCUMENT_ROOT__AUXILIARY_TRAFFIC_AREA:
case TransportationPackage.DOCUMENT_ROOT__RAILWAY:
case TransportationPackage.DOCUMENT_ROOT__TRANSPORTATION_COMPLEX:
case TransportationPackage.DOCUMENT_ROOT__ROAD:
case TransportationPackage.DOCUMENT_ROOT__SQUARE:
case TransportationPackage.DOCUMENT_ROOT__TRACK:
case TransportationPackage.DOCUMENT_ROOT__TRAFFIC_AREA:
fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false));
return;
}
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); switch (notification.getFeatureID(DocumentRoot.class)) { case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_AUXILIARY_TRAFFIC_AREA: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_RAILWAY: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_ROAD: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_SQUARE: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRACK: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRAFFIC_AREA: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRANSPORTATION_COMPLEX: case TransportationPackage.DOCUMENT_ROOT__GENERIC_APPLICATION_PROPERTY_OF_TRANSPORTATION_OBJECT: case TransportationPackage.DOCUMENT_ROOT__TRANSPORTATION_OBJECT: case TransportationPackage.DOCUMENT_ROOT__AUXILIARY_TRAFFIC_AREA: case TransportationPackage.DOCUMENT_ROOT__RAILWAY: case TransportationPackage.DOCUMENT_ROOT__TRANSPORTATION_COMPLEX: case TransportationPackage.DOCUMENT_ROOT__ROAD: case TransportationPackage.DOCUMENT_ROOT__SQUARE: case TransportationPackage.DOCUMENT_ROOT__TRACK: case TransportationPackage.DOCUMENT_ROOT__TRAFFIC_AREA: fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), true, false)); return; } super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "markus1978/citygml4emf",
"path": "de.hub.citygml.emf.ecore.edit/src/net/opengis/citygml/transportation/provider/DocumentRootItemProvider.java",
"license": "apache-2.0",
"size": 12187
} | [
"net.opengis.citygml.transportation.DocumentRoot",
"net.opengis.citygml.transportation.TransportationPackage",
"org.eclipse.emf.common.notify.Notification",
"org.eclipse.emf.edit.provider.ViewerNotification"
] | import net.opengis.citygml.transportation.DocumentRoot; import net.opengis.citygml.transportation.TransportationPackage; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.edit.provider.ViewerNotification; | import net.opengis.citygml.transportation.*; import org.eclipse.emf.common.notify.*; import org.eclipse.emf.edit.provider.*; | [
"net.opengis.citygml",
"org.eclipse.emf"
] | net.opengis.citygml; org.eclipse.emf; | 2,395,947 |
private void loadLdifEntries() throws LdapException
{
if ( inputStream != null )
{
// Initializing the reader and the entry iterator
try ( LdifReader reader = new LdifReader( inputStream ) )
{
Iterator<LdifEntry> itr = reader.iterator();
// Exiting if there's no entry
if ( !itr.hasNext() )
{
return;
}
// Getting the context entry
LdifEntry ldifEntry = itr.next();
Entry contextEntry = new DefaultEntry( schemaManager, ldifEntry.getEntry() );
// Checking the context entry
if ( suffixDn.equals( contextEntry.getDn() ) )
{
addMandatoryOpAt( contextEntry );
super.add( new AddOperationContext( null, contextEntry ) );
}
else
{
throw new LdapException( "The given LDIF file doesn't contain the context entry" );
}
// Iterating on all entries
while ( itr.hasNext() )
{
Entry entry = new DefaultEntry( schemaManager, itr.next().getEntry() );
addMandatoryOpAt( entry );
super.add( new AddOperationContext( null, entry ) );
}
}
catch ( IOException ioe )
{
throw new LdapOtherException( ioe.getMessage(), ioe );
}
}
} | void function() throws LdapException { if ( inputStream != null ) { try ( LdifReader reader = new LdifReader( inputStream ) ) { Iterator<LdifEntry> itr = reader.iterator(); if ( !itr.hasNext() ) { return; } LdifEntry ldifEntry = itr.next(); Entry contextEntry = new DefaultEntry( schemaManager, ldifEntry.getEntry() ); if ( suffixDn.equals( contextEntry.getDn() ) ) { addMandatoryOpAt( contextEntry ); super.add( new AddOperationContext( null, contextEntry ) ); } else { throw new LdapException( STR ); } while ( itr.hasNext() ) { Entry entry = new DefaultEntry( schemaManager, itr.next().getEntry() ); addMandatoryOpAt( entry ); super.add( new AddOperationContext( null, entry ) ); } } catch ( IOException ioe ) { throw new LdapOtherException( ioe.getMessage(), ioe ); } } } | /**
* Loads the LDIF entries from the input stream.
*
* @throws Exception
*/ | Loads the LDIF entries from the input stream | loadLdifEntries | {
"repo_name": "apache/directory-server",
"path": "server-config/src/main/java/org/apache/directory/server/config/ReadOnlyConfigurationPartition.java",
"license": "apache-2.0",
"size": 7356
} | [
"java.io.IOException",
"java.util.Iterator",
"org.apache.directory.api.ldap.model.entry.DefaultEntry",
"org.apache.directory.api.ldap.model.entry.Entry",
"org.apache.directory.api.ldap.model.exception.LdapException",
"org.apache.directory.api.ldap.model.exception.LdapOtherException",
"org.apache.directory.api.ldap.model.ldif.LdifEntry",
"org.apache.directory.api.ldap.model.ldif.LdifReader",
"org.apache.directory.server.core.api.interceptor.context.AddOperationContext"
] | import java.io.IOException; import java.util.Iterator; import org.apache.directory.api.ldap.model.entry.DefaultEntry; import org.apache.directory.api.ldap.model.entry.Entry; import org.apache.directory.api.ldap.model.exception.LdapException; import org.apache.directory.api.ldap.model.exception.LdapOtherException; import org.apache.directory.api.ldap.model.ldif.LdifEntry; import org.apache.directory.api.ldap.model.ldif.LdifReader; import org.apache.directory.server.core.api.interceptor.context.AddOperationContext; | import java.io.*; import java.util.*; import org.apache.directory.api.ldap.model.entry.*; import org.apache.directory.api.ldap.model.exception.*; import org.apache.directory.api.ldap.model.ldif.*; import org.apache.directory.server.core.api.interceptor.context.*; | [
"java.io",
"java.util",
"org.apache.directory"
] | java.io; java.util; org.apache.directory; | 499,333 |
@Test
public void test224GetPillagingPirateWill() throws Exception {
final String TEST_NAME = "test224GetPillagingPirateWill";
displayTestTile(TEST_NAME);
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();
rememberDummyResourceGroupMembersReadCount(null);
syncServiceMock.reset();
// WHEN
PrismObject<ShadowType> account = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result);
// THEN
result.computeStatus();
display("Account", account);
display(result);
TestUtil.assertSuccess(result);
assertEntitlementGroup(account, GROUP_PIRATES_OID);
assertEntitlementPriv(account, PRIVILEGE_PILLAGE_OID);
assertEntitlementPriv(account, PRIVILEGE_BARGAIN_OID);
assertDummyResourceGroupMembersReadCountIncrement(null, 0);
// Just make sure nothing has changed
DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertNotNull("Account will is gone!", dummyAccount);
Set<String> accountProvileges = dummyAccount.getAttributeValues(DummyAccount.ATTR_PRIVILEGES_NAME, String.class);
PrismAsserts.assertSets("Wrong account privileges", accountProvileges, PRIVILEGE_PILLAGE_NAME, PRIVILEGE_BARGAIN_NAME);
assertDummyResourceGroupMembersReadCountIncrement(null, 0);
// Make sure that privilege object is still there
DummyPrivilege priv = getDummyPrivilegeAssert(PRIVILEGE_PILLAGE_NAME, pillageIcfUid);
assertNotNull("Privilege object is gone!", priv);
DummyPrivilege priv2 = getDummyPrivilegeAssert(PRIVILEGE_BARGAIN_NAME, bargainIcfUid);
assertNotNull("Privilege object (bargain) is gone!", priv2);
DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid);
assertMember(group, transformNameToResource(ACCOUNT_WILL_USERNAME));
assertDummyResourceGroupMembersReadCountIncrement(null, 0);
assertSteadyResource();
}
| void function() throws Exception { final String TEST_NAME = STR; displayTestTile(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); rememberDummyResourceGroupMembersReadCount(null); syncServiceMock.reset(); PrismObject<ShadowType> account = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result); result.computeStatus(); display(STR, account); display(result); TestUtil.assertSuccess(result); assertEntitlementGroup(account, GROUP_PIRATES_OID); assertEntitlementPriv(account, PRIVILEGE_PILLAGE_OID); assertEntitlementPriv(account, PRIVILEGE_BARGAIN_OID); assertDummyResourceGroupMembersReadCountIncrement(null, 0); DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid); assertNotNull(STR, dummyAccount); Set<String> accountProvileges = dummyAccount.getAttributeValues(DummyAccount.ATTR_PRIVILEGES_NAME, String.class); PrismAsserts.assertSets(STR, accountProvileges, PRIVILEGE_PILLAGE_NAME, PRIVILEGE_BARGAIN_NAME); assertDummyResourceGroupMembersReadCountIncrement(null, 0); DummyPrivilege priv = getDummyPrivilegeAssert(PRIVILEGE_PILLAGE_NAME, pillageIcfUid); assertNotNull(STR, priv); DummyPrivilege priv2 = getDummyPrivilegeAssert(PRIVILEGE_BARGAIN_NAME, bargainIcfUid); assertNotNull(STR, priv2); DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid); assertMember(group, transformNameToResource(ACCOUNT_WILL_USERNAME)); assertDummyResourceGroupMembersReadCountIncrement(null, 0); assertSteadyResource(); } | /**
* Reads the will accounts, checks that both entitlements are there.
*/ | Reads the will accounts, checks that both entitlements are there | test224GetPillagingPirateWill | {
"repo_name": "Pardus-Engerek/engerek",
"path": "provisioning/provisioning-impl/src/test/java/com/evolveum/midpoint/provisioning/impl/dummy/TestDummy.java",
"license": "apache-2.0",
"size": 172177
} | [
"com.evolveum.icf.dummy.resource.DummyAccount",
"com.evolveum.icf.dummy.resource.DummyGroup",
"com.evolveum.icf.dummy.resource.DummyPrivilege",
"com.evolveum.midpoint.prism.PrismObject",
"com.evolveum.midpoint.prism.util.PrismAsserts",
"com.evolveum.midpoint.schema.result.OperationResult",
"com.evolveum.midpoint.task.api.Task",
"com.evolveum.midpoint.test.IntegrationTestTools",
"com.evolveum.midpoint.test.util.TestUtil",
"com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType",
"java.util.Set",
"org.testng.AssertJUnit"
] | import com.evolveum.icf.dummy.resource.DummyAccount; import com.evolveum.icf.dummy.resource.DummyGroup; import com.evolveum.icf.dummy.resource.DummyPrivilege; import com.evolveum.midpoint.prism.PrismObject; import com.evolveum.midpoint.prism.util.PrismAsserts; import com.evolveum.midpoint.schema.result.OperationResult; import com.evolveum.midpoint.task.api.Task; import com.evolveum.midpoint.test.IntegrationTestTools; import com.evolveum.midpoint.test.util.TestUtil; import com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType; import java.util.Set; import org.testng.AssertJUnit; | import com.evolveum.icf.dummy.resource.*; import com.evolveum.midpoint.prism.*; import com.evolveum.midpoint.prism.util.*; import com.evolveum.midpoint.schema.result.*; import com.evolveum.midpoint.task.api.*; import com.evolveum.midpoint.test.*; import com.evolveum.midpoint.test.util.*; import com.evolveum.midpoint.xml.ns._public.common.common_3.*; import java.util.*; import org.testng.*; | [
"com.evolveum.icf",
"com.evolveum.midpoint",
"java.util",
"org.testng"
] | com.evolveum.icf; com.evolveum.midpoint; java.util; org.testng; | 2,231,340 |
@SuppressLint("NewApi")
public void stopScan() {
mHandler.removeCallbacksAndMessages(null);
scanning = false;
mBluetoothAdapter.stopLeScan(scanCallback);
//notify end of scan
broadcastUpdate(BluetoothEvents.BT_EVENT_SCAN_END);
} | @SuppressLint(STR) void function() { mHandler.removeCallbacksAndMessages(null); scanning = false; mBluetoothAdapter.stopLeScan(scanCallback); broadcastUpdate(BluetoothEvents.BT_EVENT_SCAN_END); } | /**
* Stop Bluetooth LE scanning
*/ | Stop Bluetooth LE scanning | stopScan | {
"repo_name": "akinaru/RFdroid",
"path": "bleanalyzer/app/src/main/java/com/github/akinaru/bleanalyzer/bluetooth/BluetoothCustomManager.java",
"license": "gpl-3.0",
"size": 19510
} | [
"android.annotation.SuppressLint",
"com.github.akinaru.bleanalyzer.bluetooth.events.BluetoothEvents"
] | import android.annotation.SuppressLint; import com.github.akinaru.bleanalyzer.bluetooth.events.BluetoothEvents; | import android.annotation.*; import com.github.akinaru.bleanalyzer.bluetooth.events.*; | [
"android.annotation",
"com.github.akinaru"
] | android.annotation; com.github.akinaru; | 1,153,133 |
public int getMaxUserNameLength() throws SQLException {
// hard limit is Integer.MAX_VALUE
return 0;
}
//---------------------------------------------------------------------- | int function() throws SQLException { return 0; } | /**
* Retrieves the maximum number of characters this database allows in
* a user name. <p>
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB does not impose a "known" limit. The hard limit is the maximum
* length of a java.lang.String (java.lang.Integer.MAX_VALUE);
* this method always returns <code>0</code>.
* </div>
* <!-- end release-specific documentation -->
*
* @return the maximum number of characters allowed for a user name;
* a result of zero means that there is no limit or the limit
* is not known
* @exception SQLException if a database access error occurs
*/ | Retrieves the maximum number of characters this database allows in a user name. HSQLDB-Specific Information: HSQLDB does not impose a "known" limit. The hard limit is the maximum length of a java.lang.String (java.lang.Integer.MAX_VALUE); this method always returns <code>0</code>. | getMaxUserNameLength | {
"repo_name": "minghao7896321/canyin",
"path": "hsqldb/src/org/hsqldb/jdbc/jdbcDatabaseMetaData.java",
"license": "apache-2.0",
"size": 237705
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,608,203 |
public void start(@NonNull Activity activity, int requestCode) {
if (PermissionsUtils.checkReadStoragePermission(activity)) {
activity.startActivityForResult(getIntent(activity), requestCode);
}
} | void function(@NonNull Activity activity, int requestCode) { if (PermissionsUtils.checkReadStoragePermission(activity)) { activity.startActivityForResult(getIntent(activity), requestCode); } } | /**
* Send the Intent from an Activity with a custom request code
*
* @param activity Activity to receive result
* @param requestCode requestCode for result
*/ | Send the Intent from an Activity with a custom request code | start | {
"repo_name": "donglua/PhotoPicker",
"path": "PhotoPicker/src/main/java/me/iwf/photopicker/PhotoPicker.java",
"license": "apache-2.0",
"size": 4176
} | [
"android.app.Activity",
"android.support.annotation.NonNull",
"me.iwf.photopicker.utils.PermissionsUtils"
] | import android.app.Activity; import android.support.annotation.NonNull; import me.iwf.photopicker.utils.PermissionsUtils; | import android.app.*; import android.support.annotation.*; import me.iwf.photopicker.utils.*; | [
"android.app",
"android.support",
"me.iwf.photopicker"
] | android.app; android.support; me.iwf.photopicker; | 916,125 |
@Metadata(description = "A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors.")
public void setSocketConnectors(Map<Integer, Connector> socketConnectors) {
this.socketConnectors = socketConnectors;
} | @Metadata(description = STR) void function(Map<Integer, Connector> socketConnectors) { this.socketConnectors = socketConnectors; } | /**
* A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors.
*/ | A map which contains per port number specific HTTP connectors. Uses the same principle as sslSocketConnectors | setSocketConnectors | {
"repo_name": "NetNow/camel",
"path": "components/camel-jetty-common/src/main/java/org/apache/camel/component/jetty/JettyHttpComponent.java",
"license": "apache-2.0",
"size": 56873
} | [
"java.util.Map",
"org.apache.camel.spi.Metadata",
"org.eclipse.jetty.server.Connector"
] | import java.util.Map; import org.apache.camel.spi.Metadata; import org.eclipse.jetty.server.Connector; | import java.util.*; import org.apache.camel.spi.*; import org.eclipse.jetty.server.*; | [
"java.util",
"org.apache.camel",
"org.eclipse.jetty"
] | java.util; org.apache.camel; org.eclipse.jetty; | 335,513 |
public void setTimeZone(TimeZone timeZone) {
this.timeZone = timeZone;
} | void function(TimeZone timeZone) { this.timeZone = timeZone; } | /**
* Sets the time zone for which this <code>CronExpression</code>
* will be resolved.
*/ | Sets the time zone for which this <code>CronExpression</code> will be resolved | setTimeZone | {
"repo_name": "michelegonella/zen-project",
"path": "zen-core/src/main/java/com/nominanuda/zen/time/CronExpression.java",
"license": "apache-2.0",
"size": 61199
} | [
"java.util.TimeZone"
] | import java.util.TimeZone; | import java.util.*; | [
"java.util"
] | java.util; | 2,684,125 |
public final ConstraintVariable2 createReturnTypeVariable(final IMethodBinding method) {
if (!method.isConstructor()) {
ITypeBinding binding= method.getReturnType();
if (binding != null && binding.isArray())
binding= binding.getElementType();
if (binding != null && isConstrainedType(binding)) {
ConstraintVariable2 variable= null;
final TType type= createTType(binding);
if (method.getDeclaringClass().isFromSource())
variable= new ReturnTypeVariable2(type, method);
else
variable= new ImmutableTypeVariable2(type);
return fConstraintVariables.addExisting(variable);
}
}
return null;
} | final ConstraintVariable2 function(final IMethodBinding method) { if (!method.isConstructor()) { ITypeBinding binding= method.getReturnType(); if (binding != null && binding.isArray()) binding= binding.getElementType(); if (binding != null && isConstrainedType(binding)) { ConstraintVariable2 variable= null; final TType type= createTType(binding); if (method.getDeclaringClass().isFromSource()) variable= new ReturnTypeVariable2(type, method); else variable= new ImmutableTypeVariable2(type); return fConstraintVariables.addExisting(variable); } } return null; } | /**
* Creates a new return type variable.
*
* @param method the method binding
* @return the created return type variable, or <code>null</code>
*/ | Creates a new return type variable | createReturnTypeVariable | {
"repo_name": "kumattau/JDTPatch",
"path": "org.eclipse.jdt.ui/src/org/eclipse/jdt/internal/corext/refactoring/structure/constraints/SuperTypeConstraintsModel.java",
"license": "epl-1.0",
"size": 19988
} | [
"org.eclipse.jdt.core.dom.IMethodBinding",
"org.eclipse.jdt.core.dom.ITypeBinding",
"org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType",
"org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2",
"org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ImmutableTypeVariable2",
"org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ReturnTypeVariable2"
] | import org.eclipse.jdt.core.dom.IMethodBinding; import org.eclipse.jdt.core.dom.ITypeBinding; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.TType; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ConstraintVariable2; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ImmutableTypeVariable2; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.ReturnTypeVariable2; | import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints.types.*; import org.eclipse.jdt.internal.corext.refactoring.typeconstraints2.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 1,314,626 |
public void setGetMethod(Method getMethod)
{
this.getMethod = getMethod;
} | void function(Method getMethod) { this.getMethod = getMethod; } | /**
* Sets the method to get the value of the field
*
* @param getMethod
* Method reference
*/ | Sets the method to get the value of the field | setGetMethod | {
"repo_name": "Kimhuang/APICore",
"path": "commonlibs/MVC-Android/src/main/java/com/mastergaurav/android/common/xml/FieldInfo.java",
"license": "apache-2.0",
"size": 3257
} | [
"java.lang.reflect.Method"
] | import java.lang.reflect.Method; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,892,874 |
@Override
public MetricsAdvisorAdministrationClientBuilder credential(TokenCredential tokenCredential) {
this.tokenCredential = Objects.requireNonNull(tokenCredential, "'tokenCredential' cannot be null.");
return this;
} | MetricsAdvisorAdministrationClientBuilder function(TokenCredential tokenCredential) { this.tokenCredential = Objects.requireNonNull(tokenCredential, STR); return this; } | /**
* Sets the {@link TokenCredential} used to authorize requests sent to the service. Refer to the Azure SDK for Java
* <a href="https://aka.ms/azsdk/java/docs/identity">identity and authentication</a>
* documentation for more details on proper usage of the {@link TokenCredential} type.
*
* @param tokenCredential {@link TokenCredential} used to authorize requests sent to the service.
* @return The updated {@link MetricsAdvisorAdministrationClientBuilder} object.
* @throws NullPointerException If {@code tokenCredential} is null.
*/ | Sets the <code>TokenCredential</code> used to authorize requests sent to the service. Refer to the Azure SDK for Java identity and authentication documentation for more details on proper usage of the <code>TokenCredential</code> type | credential | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/metricsadvisor/azure-ai-metricsadvisor/src/main/java/com/azure/ai/metricsadvisor/administration/MetricsAdvisorAdministrationClientBuilder.java",
"license": "mit",
"size": 27121
} | [
"com.azure.core.credential.TokenCredential",
"java.util.Objects"
] | import com.azure.core.credential.TokenCredential; import java.util.Objects; | import com.azure.core.credential.*; import java.util.*; | [
"com.azure.core",
"java.util"
] | com.azure.core; java.util; | 1,719,458 |
@Test
public void testGetRangeBounds() {
DefaultBoxAndWhiskerXYDataset d1
= new DefaultBoxAndWhiskerXYDataset("S");
d1.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0,
6.0, 7.0, 8.0, new ArrayList()));
assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(false));
assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(true));
d1.add(new Date(1L), new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5,
6.5, 7.5, 8.5, new ArrayList()));
assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(false));
assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(true));
d1.add(new Date(2L), new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5,
7.5, 8.5, 9.5, new ArrayList()));
assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(false));
assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(true));
} | void function() { DefaultBoxAndWhiskerXYDataset d1 = new DefaultBoxAndWhiskerXYDataset("S"); d1.add(new Date(1L), new BoxAndWhiskerItem(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, new ArrayList())); assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 6.0), d1.getRangeBounds(true)); d1.add(new Date(1L), new BoxAndWhiskerItem(1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, new ArrayList())); assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 6.5), d1.getRangeBounds(true)); d1.add(new Date(2L), new BoxAndWhiskerItem(2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, new ArrayList())); assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(false)); assertEquals(new Range(5.0, 7.5), d1.getRangeBounds(true)); } | /**
* Some checks for the getRangeBounds() method.
*/ | Some checks for the getRangeBounds() method | testGetRangeBounds | {
"repo_name": "raincs13/phd",
"path": "tests/org/jfree/data/statistics/DefaultBoxAndWhiskerXYDatasetTest.java",
"license": "lgpl-2.1",
"size": 6943
} | [
"java.util.ArrayList",
"java.util.Date",
"org.jfree.data.Range",
"org.junit.Assert"
] | import java.util.ArrayList; import java.util.Date; import org.jfree.data.Range; import org.junit.Assert; | import java.util.*; import org.jfree.data.*; import org.junit.*; | [
"java.util",
"org.jfree.data",
"org.junit"
] | java.util; org.jfree.data; org.junit; | 1,164,339 |
private void preProcessForRecord() throws ComponentNotReadyException {
ignoredFieldsSet = extractIgnoredFields(ignoredFieldsToUse);
// if (inputFieldNameToUse != null) {
// inField = (StringDataField) getFieldSafe(inputRecord, inputFieldNameToUse);
// if (inField == null) {
// throw new ComponentNotReadyException("Unknown input field name '" + inputFieldNameToUse + "'.");
// }
// }
//
// // BACKWARD COMPATIBILITY: get the output field, where the content should be sent.
// if (standardOutputRecord != null) {
// if (outputFieldNameToUse == null) {
// outField = (StringDataField) standardOutputRecord.getField(0);
// } else {
// outField = (StringDataField) getFieldSafe(standardOutputRecord, outputFieldNameToUse);
// if (outField == null) {
// throw new ComponentNotReadyException("Unknown output field name '" + outputFieldNameToUse + "'.");
// }
// }
// }
// create response writer based on the configuration
if (outputFileUrlToUse != null) {
responseWriter = new ResponseFileWriter(resultRecord != null ? resultRecord.getField(RP_OUTPUTFILE_INDEX) : null, outputFileUrlToUse);
} else if (storeResponseToTempFileToUse) {
responseWriter = new ResponseTempFileWriter(resultRecord != null ? resultRecord.getField(RP_OUTPUTFILE_INDEX) : null, temporaryFilePrefixToUse);
} else {
responseWriter = new ResponseByValueWriter(resultRecord != null ? resultRecord.getField(RP_CONTENT_INDEX) : null, resultRecord != null ? resultRecord.getField(RP_CONTENT_BYTE_INDEX) : null);
}
// filter multipart entities (ignored fields are removed from multipart entities record)
if (!ignoredFieldsSet.isEmpty() && !StringUtils.isEmpty(multipartEntities)) {
List<String> multipartEntitiesList = new ArrayList<String>();
StringTokenizer tokenizer = new StringTokenizer(multipartEntities, ";");
while (tokenizer.hasMoreElements()) {
multipartEntitiesList.add(tokenizer.nextToken());
}
// remove ignored fields
multipartEntitiesList.removeAll(ignoredFieldsSet);
if (!multipartEntitiesList.isEmpty()) {
multipartEntities = "";
for (String entity : multipartEntitiesList) {
multipartEntities += entity + ";";
}
multipartEntities = multipartEntities.substring(0, multipartEntities.length() - 1);
} else {
multipartEntities = null;
}
}
}
| void function() throws ComponentNotReadyException { ignoredFieldsSet = extractIgnoredFields(ignoredFieldsToUse); if (outputFileUrlToUse != null) { responseWriter = new ResponseFileWriter(resultRecord != null ? resultRecord.getField(RP_OUTPUTFILE_INDEX) : null, outputFileUrlToUse); } else if (storeResponseToTempFileToUse) { responseWriter = new ResponseTempFileWriter(resultRecord != null ? resultRecord.getField(RP_OUTPUTFILE_INDEX) : null, temporaryFilePrefixToUse); } else { responseWriter = new ResponseByValueWriter(resultRecord != null ? resultRecord.getField(RP_CONTENT_INDEX) : null, resultRecord != null ? resultRecord.getField(RP_CONTENT_BYTE_INDEX) : null); } if (!ignoredFieldsSet.isEmpty() && !StringUtils.isEmpty(multipartEntities)) { List<String> multipartEntitiesList = new ArrayList<String>(); StringTokenizer tokenizer = new StringTokenizer(multipartEntities, ";"); while (tokenizer.hasMoreElements()) { multipartEntitiesList.add(tokenizer.nextToken()); } multipartEntitiesList.removeAll(ignoredFieldsSet); if (!multipartEntitiesList.isEmpty()) { multipartEntities = STR;"; } multipartEntities = multipartEntities.substring(0, multipartEntities.length() - 1); } else { multipartEntities = null; } } } | /**
* Pre-process the record.
*
* @throws ComponentNotReadyException
*/ | Pre-process the record | preProcessForRecord | {
"repo_name": "CloverETL/CloverETL-Engine",
"path": "cloveretl.component/src/org/jetel/component/HttpConnector.java",
"license": "lgpl-2.1",
"size": 154063
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.StringTokenizer",
"org.jetel.exception.ComponentNotReadyException",
"org.jetel.util.string.StringUtils"
] | import java.util.ArrayList; import java.util.List; import java.util.StringTokenizer; import org.jetel.exception.ComponentNotReadyException; import org.jetel.util.string.StringUtils; | import java.util.*; import org.jetel.exception.*; import org.jetel.util.string.*; | [
"java.util",
"org.jetel.exception",
"org.jetel.util"
] | java.util; org.jetel.exception; org.jetel.util; | 319,843 |
private static Connection getConnection (Hashtable connectionProperties) throws CSInternalConfigurationException
{
if (connectionProperties == null)
return null;
String driver = (String)connectionProperties.get("driver");
String url = (String)connectionProperties.get("url");
String user = (String)connectionProperties.get("user");
String passwd = (String)connectionProperties.get("passwd");
Connection connection = null;
// load the driver, if it is not loaded
try
{
Class.forName(driver);
}
catch (ClassNotFoundException e)
{
if (log.isDebugEnabled())
log.debug("Authentication|||getConnection|Failure| Error Loading Driver for Authentication Database|"+ e.getMessage());
throw new CSInternalConfigurationException ("Unable to Load Driver for Authentication Database");
}
// Get the connection to the database
try
{
connection = DriverManager.getConnection(url, user, passwd);
}
catch (SQLException e)
{
if (log.isDebugEnabled())
log.debug("Authentication|||getConnection|Failure| Error Obtaining Connection for Authentication Database|"+ e.getMessage());
throw new CSInternalConfigurationException ("Unable to obtain connection for Authentication Database");
}
if (log.isDebugEnabled())
log.debug("Authentication|||getConnection|Success| Success in Obtaining Connection for Authentication Database|");
return connection;
} | static Connection function (Hashtable connectionProperties) throws CSInternalConfigurationException { if (connectionProperties == null) return null; String driver = (String)connectionProperties.get(STR); String url = (String)connectionProperties.get("url"); String user = (String)connectionProperties.get("user"); String passwd = (String)connectionProperties.get(STR); Connection connection = null; try { Class.forName(driver); } catch (ClassNotFoundException e) { if (log.isDebugEnabled()) log.debug(STR+ e.getMessage()); throw new CSInternalConfigurationException (STR); } try { connection = DriverManager.getConnection(url, user, passwd); } catch (SQLException e) { if (log.isDebugEnabled()) log.debug(STR+ e.getMessage()); throw new CSInternalConfigurationException (STR); } if (log.isDebugEnabled()) log.debug(STR); return connection; } | /**
* Accepts the connection properties which are used to connect to the
* database. The established connection is then returned to the calling
* function. The properties should have the following items - "driver",
* "url", "user" and "passwd".
* @param connectionProperties contains the properties needed to connect to
* the database. It contains the values for the following items
* the driver class to be used, the url of the database to connect
* the user name and the password to be used to connect to the
* database
* @return a connection to the database obtained using the properties
* provided
* @throws CSInternalConfigurationException
*
*/ | Accepts the connection properties which are used to connect to the database. The established connection is then returned to the calling function. The properties should have the following items - "driver", "url", "user" and "passwd" | getConnection | {
"repo_name": "NCIP/cagrid-general",
"path": "external/csmapi-42/api/src/gov/nih/nci/security/authentication/helper/RDBMSHelper.java",
"license": "bsd-3-clause",
"size": 16953
} | [
"gov.nih.nci.security.exceptions.internal.CSInternalConfigurationException",
"java.sql.Connection",
"java.sql.DriverManager",
"java.sql.SQLException",
"java.util.Hashtable"
] | import gov.nih.nci.security.exceptions.internal.CSInternalConfigurationException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Hashtable; | import gov.nih.nci.security.exceptions.internal.*; import java.sql.*; import java.util.*; | [
"gov.nih.nci",
"java.sql",
"java.util"
] | gov.nih.nci; java.sql; java.util; | 1,494,470 |
public void plotStackedBarGraph(List<Graph> graphs) {
// Make all graphs equal sized by adding zeros
int maxSize = 0;
for (Graph g : graphs) {
maxSize = maxSize < g.getPoints().size() ? g.getPoints().size()
: maxSize;
}
// Render graphs (Iterates through every point)
final int max = maxSize;
for (int i = 0; i < maxSize; i++) {
// Create rendering order map
final List<Point> points = new LinkedList<Point>();
for (Graph g : graphs) {
if (g.getPoints().size() > i) {
points.add(g.getPoints().get(i));
}
}
final int index = i;
RepeatingCommand rc = new RepeatingCommand() {
private int counter;
private float x = points.get(0).x;
float localZero = zero; | void function(List<Graph> graphs) { int maxSize = 0; for (Graph g : graphs) { maxSize = maxSize < g.getPoints().size() ? g.getPoints().size() : maxSize; } final int max = maxSize; for (int i = 0; i < maxSize; i++) { final List<Point> points = new LinkedList<Point>(); for (Graph g : graphs) { if (g.getPoints().size() > i) { points.add(g.getPoints().get(i)); } } final int index = i; RepeatingCommand rc = new RepeatingCommand() { private int counter; private float x = points.get(0).x; float localZero = zero; | /**
* Plots a graph with stacked graphs
*
* @param graphs
*/ | Plots a graph with stacked graphs | plotStackedBarGraph | {
"repo_name": "bpupadhyaya/dashboard-demo-1",
"path": "src/main/java/com/vaadin/addon/timeline/gwt/client/VCanvasPlotter.java",
"license": "apache-2.0",
"size": 29427
} | [
"com.google.gwt.core.client.Scheduler",
"java.util.LinkedList",
"java.util.List"
] | import com.google.gwt.core.client.Scheduler; import java.util.LinkedList; import java.util.List; | import com.google.gwt.core.client.*; import java.util.*; | [
"com.google.gwt",
"java.util"
] | com.google.gwt; java.util; | 2,695,952 |
LinkedService delete(String resourceGroupName, String workspaceName, String linkedServiceName, Context context); | LinkedService delete(String resourceGroupName, String workspaceName, String linkedServiceName, Context context); | /**
* Deletes a linked service instance.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param linkedServiceName Name of the linked service.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the top level Linked service resource container.
*/ | Deletes a linked service instance | delete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/loganalytics/azure-resourcemanager-loganalytics/src/main/java/com/azure/resourcemanager/loganalytics/models/LinkedServices.java",
"license": "mit",
"size": 7405
} | [
"com.azure.core.util.Context"
] | import com.azure.core.util.Context; | import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 2,823,988 |
private void drawItems(Canvas canvas) {
canvas.save();
int top = (currentItem - firstItem) * getItemHeight()
+ (getItemHeight() - getHeight()) / 2;
canvas.translate(PADDING, -top + scrollingOffset);
itemsLayout.draw(canvas);
canvas.restore();
} | void function(Canvas canvas) { canvas.save(); int top = (currentItem - firstItem) * getItemHeight() + (getItemHeight() - getHeight()) / 2; canvas.translate(PADDING, -top + scrollingOffset); itemsLayout.draw(canvas); canvas.restore(); } | /**
* Draws items
*
* @param canvas
* the canvas for drawing
*/ | Draws items | drawItems | {
"repo_name": "yndongyong/fast-dev-library",
"path": "fastdev-library/src/main/java/org/yndongyong/fastandroid/view/wheel/city/WheelView.java",
"license": "mit",
"size": 21135
} | [
"android.graphics.Canvas"
] | import android.graphics.Canvas; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 2,895,466 |
return new SubClassOf();
}
/**
* Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} | return new SubClassOf(); } /** * Create an instance of {@link JAXBElement }{@code <}{@link String }{@code >}} | /**
* Create an instance of {@link SubClassOf }
*
*/ | Create an instance of <code>SubClassOf </code> | createSubClassOf | {
"repo_name": "ArtificerRepo/artificer",
"path": "api/src/main/java/org/w3/_2000/_01/rdf_schema_/ObjectFactory.java",
"license": "apache-2.0",
"size": 3037
} | [
"javax.xml.bind.JAXBElement"
] | import javax.xml.bind.JAXBElement; | import javax.xml.bind.*; | [
"javax.xml"
] | javax.xml; | 455,336 |
private Map<String, Attribute> buildHierarchicalAttributeMapForStandardSchema(Map<String, Attribute>
filteredFlatAttributeMap)
throws CharonException {
return buildHierarchicalAttributeMap(filteredFlatAttributeMap, false);
} | Map<String, Attribute> function(Map<String, Attribute> filteredFlatAttributeMap) throws CharonException { return buildHierarchicalAttributeMap(filteredFlatAttributeMap, false); } | /**
* Builds complex attribute schema for enterprise user schema with correct sub attributes using the flat attribute
* map.
*
* @param filteredFlatAttributeMap
* @return
*/ | Builds complex attribute schema for enterprise user schema with correct sub attributes using the flat attribute map | buildHierarchicalAttributeMapForStandardSchema | {
"repo_name": "wso2-extensions/identity-inbound-provisioning-scim2",
"path": "components/org.wso2.carbon.identity.scim2.common/src/main/java/org/wso2/carbon/identity/scim2/common/impl/SCIMUserManager.java",
"license": "apache-2.0",
"size": 296414
} | [
"java.util.Map",
"org.wso2.charon3.core.attributes.Attribute",
"org.wso2.charon3.core.exceptions.CharonException"
] | import java.util.Map; import org.wso2.charon3.core.attributes.Attribute; import org.wso2.charon3.core.exceptions.CharonException; | import java.util.*; import org.wso2.charon3.core.attributes.*; import org.wso2.charon3.core.exceptions.*; | [
"java.util",
"org.wso2.charon3"
] | java.util; org.wso2.charon3; | 1,068,258 |
public Command addCommandToOverflowMenu(String name, Image icon, final ActionListener ev) {
Command cmd = Command.create(name, icon, ev);
addCommandToOverflowMenu(cmd);
return cmd;
}
public static enum BackCommandPolicy {
ALWAYS,
AS_REGULAR_COMMAND,
AS_ARROW,
ONLY_WHEN_USES_TITLE,
WHEN_USES_TITLE_OTHERWISE_ARROW,
NEVER
}
/**
* Sets the back command in the title bar to an arrow type and maps the back
* command hardware key if applicable. This is functionally identical to {@code setBackCommand(title, Toolbar.BackCommandPolicy.AS_ARROW, listener);
* }
| Command function(String name, Image icon, final ActionListener ev) { Command cmd = Command.create(name, icon, ev); addCommandToOverflowMenu(cmd); return cmd; } public static enum BackCommandPolicy { ALWAYS, AS_REGULAR_COMMAND, AS_ARROW, ONLY_WHEN_USES_TITLE, WHEN_USES_TITLE_OTHERWISE_ARROW, NEVER } /** * Sets the back command in the title bar to an arrow type and maps the back * command hardware key if applicable. This is functionally identical to {@code setBackCommand(title, Toolbar.BackCommandPolicy.AS_ARROW, listener); * } | /**
* Adds a Command to the overflow menu
*
* @param name the name/title of the command
* @param icon the icon for the command
* @param ev the even handler
* @return a newly created Command instance
*/ | Adds a Command to the overflow menu | addCommandToOverflowMenu | {
"repo_name": "diamonddevgroup/CodenameOne",
"path": "CodenameOne/src/com/codename1/ui/Toolbar.java",
"license": "gpl-2.0",
"size": 113924
} | [
"com.codename1.ui.events.ActionListener"
] | import com.codename1.ui.events.ActionListener; | import com.codename1.ui.events.*; | [
"com.codename1.ui"
] | com.codename1.ui; | 2,489,354 |
@Nullable
public static Class <?> getImplementationClassOfLocalName (@Nullable final String sLocalName)
{
final EUBL20DocumentType eDocType = getDocumentTypeOfLocalName (sLocalName);
return eDocType == null ? null : eDocType.getImplementationClass ();
} | static Class <?> function (@Nullable final String sLocalName) { final EUBL20DocumentType eDocType = getDocumentTypeOfLocalName (sLocalName); return eDocType == null ? null : eDocType.getImplementationClass (); } | /**
* Get the domain object class of the passed document element local name.
*
* @param sLocalName
* The document element local name of any UBL 2.0 document type. May be
* <code>null</code>.
* @return <code>null</code> if no such implementation class exists.
*/ | Get the domain object class of the passed document element local name | getImplementationClassOfLocalName | {
"repo_name": "phax/ph-ubl",
"path": "ph-ubl20/src/main/java/com/helger/ubl20/UBL20DocumentTypes.java",
"license": "apache-2.0",
"size": 7591
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,903,075 |
public int getNullCount() {
return BitVectorHelper.getNullCount(validityBuffer, valueCount);
} | int function() { return BitVectorHelper.getNullCount(validityBuffer, valueCount); } | /**
* Return the number of null values in the vector.
*/ | Return the number of null values in the vector | getNullCount | {
"repo_name": "xhochy/arrow",
"path": "java/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java",
"license": "apache-2.0",
"size": 19591
} | [
"org.apache.arrow.vector.BitVectorHelper"
] | import org.apache.arrow.vector.BitVectorHelper; | import org.apache.arrow.vector.*; | [
"org.apache.arrow"
] | org.apache.arrow; | 893,744 |
public CertStore getCertificatesAndCRLs(
String type,
Provider provider)
throws NoSuchAlgorithmException, NoSuchProviderException, CMSException
{
populateCertCrlSets();
return HELPER.createCertStore(type, provider, _certSet, _crlSet);
} | CertStore function( String type, Provider provider) throws NoSuchAlgorithmException, NoSuchProviderException, CMSException { populateCertCrlSets(); return HELPER.createCertStore(type, provider, _certSet, _crlSet); } | /**
* return a CertStore containing the certificates and CRLs associated with
* this message.
*
* @exception NoSuchProviderException if the provider requested isn't available.
* @exception NoSuchAlgorithmException if the cert store isn't available.
* @exception CMSException if a general exception prevents creation of the CertStore
* @deprecated use getCertificates()
*/ | return a CertStore containing the certificates and CRLs associated with this message | getCertificatesAndCRLs | {
"repo_name": "bullda/DroidText",
"path": "src/bouncycastle/repack/org/bouncycastle/cms/CMSSignedDataParser.java",
"license": "lgpl-3.0",
"size": 32350
} | [
"java.security.NoSuchAlgorithmException",
"java.security.NoSuchProviderException",
"java.security.Provider",
"java.security.cert.CertStore"
] | import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.security.Provider; import java.security.cert.CertStore; | import java.security.*; import java.security.cert.*; | [
"java.security"
] | java.security; | 2,118,053 |
@Override
public void visitCatch(SCatch userCatchNode, SemanticScope semanticScope) {
ScriptScope scriptScope = semanticScope.getScriptScope();
String symbol = userCatchNode.getSymbol();
if (scriptScope.getPainlessLookup().isValidCanonicalClassName(symbol)) {
throw userCatchNode.createError(new IllegalArgumentException(
"invalid catch declaration: type [" + symbol + "] cannot be a name"));
}
String canonicalTypeName = userCatchNode.getCanonicalTypeName();
Class<?> type = scriptScope.getPainlessLookup().canonicalTypeNameToType(canonicalTypeName);
if (type == null) {
throw userCatchNode.createError(new IllegalArgumentException(
"invalid catch declaration: cannot resolve type [" + canonicalTypeName + "]"));
}
Location location = userCatchNode.getLocation();
Variable variable = semanticScope.defineVariable(location, type, symbol, false);
semanticScope.putDecoration(userCatchNode, new SemanticVariable(variable));
Class<?> baseException = userCatchNode.getBaseException();
if (userCatchNode.getBaseException().isAssignableFrom(type) == false) {
throw userCatchNode.createError(new ClassCastException(
"cannot cast from [" + PainlessLookupUtility.typeToCanonicalTypeName(type) + "] " +
"to [" + PainlessLookupUtility.typeToCanonicalTypeName(baseException) + "]"));
}
SBlock userBlockNode = userCatchNode.getBlockNode();
if (userBlockNode != null) {
semanticScope.replicateCondition(userCatchNode, userBlockNode, LastSource.class);
semanticScope.replicateCondition(userCatchNode, userBlockNode, InLoop.class);
semanticScope.replicateCondition(userCatchNode, userBlockNode, LastLoop.class);
visit(userBlockNode, semanticScope);
semanticScope.replicateCondition(userBlockNode, userCatchNode, MethodEscape.class);
semanticScope.replicateCondition(userBlockNode, userCatchNode, LoopEscape.class);
semanticScope.replicateCondition(userBlockNode, userCatchNode, AllEscape.class);
semanticScope.replicateCondition(userBlockNode, userCatchNode, AnyContinue.class);
semanticScope.replicateCondition(userBlockNode, userCatchNode, AnyBreak.class);
}
} | void function(SCatch userCatchNode, SemanticScope semanticScope) { ScriptScope scriptScope = semanticScope.getScriptScope(); String symbol = userCatchNode.getSymbol(); if (scriptScope.getPainlessLookup().isValidCanonicalClassName(symbol)) { throw userCatchNode.createError(new IllegalArgumentException( STR + symbol + STR)); } String canonicalTypeName = userCatchNode.getCanonicalTypeName(); Class<?> type = scriptScope.getPainlessLookup().canonicalTypeNameToType(canonicalTypeName); if (type == null) { throw userCatchNode.createError(new IllegalArgumentException( STR + canonicalTypeName + "]")); } Location location = userCatchNode.getLocation(); Variable variable = semanticScope.defineVariable(location, type, symbol, false); semanticScope.putDecoration(userCatchNode, new SemanticVariable(variable)); Class<?> baseException = userCatchNode.getBaseException(); if (userCatchNode.getBaseException().isAssignableFrom(type) == false) { throw userCatchNode.createError(new ClassCastException( STR + PainlessLookupUtility.typeToCanonicalTypeName(type) + STR + STR + PainlessLookupUtility.typeToCanonicalTypeName(baseException) + "]")); } SBlock userBlockNode = userCatchNode.getBlockNode(); if (userBlockNode != null) { semanticScope.replicateCondition(userCatchNode, userBlockNode, LastSource.class); semanticScope.replicateCondition(userCatchNode, userBlockNode, InLoop.class); semanticScope.replicateCondition(userCatchNode, userBlockNode, LastLoop.class); visit(userBlockNode, semanticScope); semanticScope.replicateCondition(userBlockNode, userCatchNode, MethodEscape.class); semanticScope.replicateCondition(userBlockNode, userCatchNode, LoopEscape.class); semanticScope.replicateCondition(userBlockNode, userCatchNode, AllEscape.class); semanticScope.replicateCondition(userBlockNode, userCatchNode, AnyContinue.class); semanticScope.replicateCondition(userBlockNode, userCatchNode, AnyBreak.class); } } | /**
* Visits a catch statement and defines a variable for the caught exception.
* Checks: control flow, type validation
*/ | Visits a catch statement and defines a variable for the caught exception. Checks: control flow, type validation | visitCatch | {
"repo_name": "nknize/elasticsearch",
"path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/phase/DefaultSemanticAnalysisPhase.java",
"license": "apache-2.0",
"size": 149793
} | [
"org.elasticsearch.painless.Location",
"org.elasticsearch.painless.lookup.PainlessLookupUtility",
"org.elasticsearch.painless.node.SBlock",
"org.elasticsearch.painless.node.SCatch",
"org.elasticsearch.painless.symbol.Decorations",
"org.elasticsearch.painless.symbol.ScriptScope",
"org.elasticsearch.painless.symbol.SemanticScope"
] | import org.elasticsearch.painless.Location; import org.elasticsearch.painless.lookup.PainlessLookupUtility; import org.elasticsearch.painless.node.SBlock; import org.elasticsearch.painless.node.SCatch; import org.elasticsearch.painless.symbol.Decorations; import org.elasticsearch.painless.symbol.ScriptScope; import org.elasticsearch.painless.symbol.SemanticScope; | import org.elasticsearch.painless.*; import org.elasticsearch.painless.lookup.*; import org.elasticsearch.painless.node.*; import org.elasticsearch.painless.symbol.*; | [
"org.elasticsearch.painless"
] | org.elasticsearch.painless; | 470,050 |
public static void warn(String format, Object... data) {
log(Level.WARN, format, data);
} | static void function(String format, Object... data) { log(Level.WARN, format, data); } | /**
* Tells there is an event that might possible lead to an error.
*/ | Tells there is an event that might possible lead to an error | warn | {
"repo_name": "NovaViper/ZeroQuest",
"path": "src/main/java/net/novaviper/zeroquest/common/helper/LogHelper.java",
"license": "apache-2.0",
"size": 1648
} | [
"org.apache.logging.log4j.Level"
] | import org.apache.logging.log4j.Level; | import org.apache.logging.log4j.*; | [
"org.apache.logging"
] | org.apache.logging; | 2,686,122 |
String hashPassword(char [] password, String salt, String hashAlgo) throws NoSuchAlgorithmException; | String hashPassword(char [] password, String salt, String hashAlgo) throws NoSuchAlgorithmException; | /**
* Hash the given password using given algorithm.
* @param password Password to be hashed.
* @param salt Salt to be used to hash the password.
* @param hashAlgo Hashing algorithm to be used. (SHA1, SHA256, SHA512, etc..)
* @return Hash as a <code>String</code>
* @throws NoSuchAlgorithmException No such algorithm exception.
*/ | Hash the given password using given algorithm | hashPassword | {
"repo_name": "thanujalk/carbon-security",
"path": "components/org.wso2.carbon.security.caas/src/main/java/org/wso2/carbon/security/caas/user/core/util/PasswordHandler.java",
"license": "apache-2.0",
"size": 1567
} | [
"java.security.NoSuchAlgorithmException"
] | import java.security.NoSuchAlgorithmException; | import java.security.*; | [
"java.security"
] | java.security; | 2,732,187 |
public UserFull getUserFull(String sUserId) {
SilverTrace.info("admin", "AdminController.getUserFull",
"root.MSG_GEN_ENTER_METHOD");
try {
return getAdminService().getUserFull(sUserId);
} catch (Exception e) {
SilverTrace.error("admin", "AdminController.getUserFull",
"admin.EX_ERR_GET_USER_DETAIL", "user Id : '" + sUserId + "'", e);
return null;
}
} | UserFull function(String sUserId) { SilverTrace.info("admin", STR, STR); try { return getAdminService().getUserFull(sUserId); } catch (Exception e) { SilverTrace.error("admin", STR, STR, STR + sUserId + "'", e); return null; } } | /**
* Return the UserFull of the user with the given Id
*/ | Return the UserFull of the user with the given Id | getUserFull | {
"repo_name": "stephaneperry/Silverpeas-Core",
"path": "lib-core/src/main/java/com/stratelia/webactiv/beans/admin/AdminController.java",
"license": "agpl-3.0",
"size": 59352
} | [
"com.stratelia.silverpeas.silvertrace.SilverTrace",
"com.stratelia.webactiv.beans.admin.AdminReference"
] | import com.stratelia.silverpeas.silvertrace.SilverTrace; import com.stratelia.webactiv.beans.admin.AdminReference; | import com.stratelia.silverpeas.silvertrace.*; import com.stratelia.webactiv.beans.admin.*; | [
"com.stratelia.silverpeas",
"com.stratelia.webactiv"
] | com.stratelia.silverpeas; com.stratelia.webactiv; | 437,352 |
public ActionForward unspecified(ActionMapping mapping,
ActionForm formIn,
HttpServletRequest request,
HttpServletResponse response) {
Map params = makeParamMap(request);
return getStrutsDelegate().forwardParams(
mapping.findForward(RhnHelper.DEFAULT_FORWARD), params);
} | ActionForward function(ActionMapping mapping, ActionForm formIn, HttpServletRequest request, HttpServletResponse response) { Map params = makeParamMap(request); return getStrutsDelegate().forwardParams( mapping.findForward(RhnHelper.DEFAULT_FORWARD), params); } | /**
* Default action to execute if dispatch parameter is missing
* or isn't in map
* @param mapping ActionMapping
* @param formIn ActionForm
* @param request ServletRequest
* @param response ServletResponse
* @return The ActionForward to go to next.
*/ | Default action to execute if dispatch parameter is missing or isn't in map | unspecified | {
"repo_name": "dmacvicar/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/action/rhnpackage/InstallPatchSetAction.java",
"license": "gpl-2.0",
"size": 6054
} | [
"com.redhat.rhn.frontend.struts.RhnHelper",
"java.util.Map",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"org.apache.struts.action.ActionForm",
"org.apache.struts.action.ActionForward",
"org.apache.struts.action.ActionMapping"
] | import com.redhat.rhn.frontend.struts.RhnHelper; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; | import com.redhat.rhn.frontend.struts.*; import java.util.*; import javax.servlet.http.*; import org.apache.struts.action.*; | [
"com.redhat.rhn",
"java.util",
"javax.servlet",
"org.apache.struts"
] | com.redhat.rhn; java.util; javax.servlet; org.apache.struts; | 2,274,345 |
public int getSharpness() throws SonyProjectorException {
return convertDataToInt(getSetting(SonyProjectorItem.SHARPNESS));
} | int function() throws SonyProjectorException { return convertDataToInt(getSetting(SonyProjectorItem.SHARPNESS)); } | /**
* Request the projector to get the current sharpness setting
*
* @return the current sharpness value
*
* @throws SonyProjectorException - In case of any problem
*/ | Request the projector to get the current sharpness setting | getSharpness | {
"repo_name": "openhab/openhab2",
"path": "bundles/org.openhab.binding.sonyprojector/src/main/java/org/openhab/binding/sonyprojector/internal/communication/SonyProjectorConnector.java",
"license": "epl-1.0",
"size": 43215
} | [
"org.openhab.binding.sonyprojector.internal.SonyProjectorException"
] | import org.openhab.binding.sonyprojector.internal.SonyProjectorException; | import org.openhab.binding.sonyprojector.internal.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 93,686 |
private Parameter getParameters(ExampleSet exampleSet) throws OperatorException {
SolverType solverType = null;
int solverTypeParameter = getParameterAsInt(PARAMETER_SOLVER);
switch (solverTypeParameter) {
case SOLVER_L2_SVM_DUAL:
solverType = SolverType.L2LOSS_SVM_DUAL;
break;
case SOLVER_L2_SVM_PRIMAL:
solverType = SolverType.L2LOSS_SVM;
break;
case SOLVER_L2_LR:
solverType = SolverType.L2_LR;
break;
case SOLVER_L1_SVM_DUAL:
solverType = SolverType.L1LOSS_SVM_DUAL;
break;
default:
solverType = SolverType.L2LOSS_SVM_DUAL;
break;
}
double c = getParameterAsDouble(PARAMETER_C);
double epsilon = getParameterAsDouble(PARAMETER_EPSILON);
Parameter parameter = new Parameter(solverType, c, epsilon);
// class weights (if set)
if (isParameterSet(PARAMETER_CLASS_WEIGHTS)) {
double[] weights = new double[2];
int[] weightLabelIndices = new int[2];
for (int i = 0; i < weights.length; i++) {
weights[i] = 1.0d;
weightLabelIndices[i] = i;
}
List<String[]> classWeights = getParameterList(PARAMETER_CLASS_WEIGHTS);
Iterator<String[]> i = classWeights.iterator();
Attribute label = exampleSet.getAttributes().getLabel();
while (i.hasNext()) {
String[] classWeightArray = i.next();
String className = classWeightArray[0];
double classWeight = Double.valueOf(classWeightArray[1]);
int index = label.getMapping().getIndex(className);
if ((index >= 0) && (index < weights.length))
weights[index] = classWeight;
}
// logging
List<Double> weightList = new LinkedList<Double>();
for (double d : weights)
weightList.add(d);
log(getName() + ": used class weights --> " + weightList);
parameter.setWeights(weights, weightLabelIndices);
}
return parameter;
} | Parameter function(ExampleSet exampleSet) throws OperatorException { SolverType solverType = null; int solverTypeParameter = getParameterAsInt(PARAMETER_SOLVER); switch (solverTypeParameter) { case SOLVER_L2_SVM_DUAL: solverType = SolverType.L2LOSS_SVM_DUAL; break; case SOLVER_L2_SVM_PRIMAL: solverType = SolverType.L2LOSS_SVM; break; case SOLVER_L2_LR: solverType = SolverType.L2_LR; break; case SOLVER_L1_SVM_DUAL: solverType = SolverType.L1LOSS_SVM_DUAL; break; default: solverType = SolverType.L2LOSS_SVM_DUAL; break; } double c = getParameterAsDouble(PARAMETER_C); double epsilon = getParameterAsDouble(PARAMETER_EPSILON); Parameter parameter = new Parameter(solverType, c, epsilon); if (isParameterSet(PARAMETER_CLASS_WEIGHTS)) { double[] weights = new double[2]; int[] weightLabelIndices = new int[2]; for (int i = 0; i < weights.length; i++) { weights[i] = 1.0d; weightLabelIndices[i] = i; } List<String[]> classWeights = getParameterList(PARAMETER_CLASS_WEIGHTS); Iterator<String[]> i = classWeights.iterator(); Attribute label = exampleSet.getAttributes().getLabel(); while (i.hasNext()) { String[] classWeightArray = i.next(); String className = classWeightArray[0]; double classWeight = Double.valueOf(classWeightArray[1]); int index = label.getMapping().getIndex(className); if ((index >= 0) && (index < weights.length)) weights[index] = classWeight; } List<Double> weightList = new LinkedList<Double>(); for (double d : weights) weightList.add(d); log(getName() + STR + weightList); parameter.setWeights(weights, weightLabelIndices); } return parameter; } | /**
* Creates a LibSVM parameter object based on the user defined parameters. If gamma is set to zero, it will be
* overwritten by 1 divided by the number of attributes.
*/ | Creates a LibSVM parameter object based on the user defined parameters. If gamma is set to zero, it will be overwritten by 1 divided by the number of attributes | getParameters | {
"repo_name": "rapidminer/rapidminer",
"path": "src/com/rapidminer/operator/learner/functions/FastLargeMargin.java",
"license": "agpl-3.0",
"size": 9885
} | [
"com.rapidminer.example.Attribute",
"com.rapidminer.example.ExampleSet",
"com.rapidminer.operator.OperatorException",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List"
] | import com.rapidminer.example.Attribute; import com.rapidminer.example.ExampleSet; import com.rapidminer.operator.OperatorException; import java.util.Iterator; import java.util.LinkedList; import java.util.List; | import com.rapidminer.example.*; import com.rapidminer.operator.*; import java.util.*; | [
"com.rapidminer.example",
"com.rapidminer.operator",
"java.util"
] | com.rapidminer.example; com.rapidminer.operator; java.util; | 1,255,610 |
public byte[] signWireFormatMessageBinary(net.jxta.impl.endpoint.WireFormatMessageBinary.WireFormatMessageBinarySignatureBridge bridge) throws InvalidKeyException, SignatureException, IOException, SecurityException {
if (!this.getClass().getClassLoader().equals(bridge.getClass().getClassLoader()))
throw new SecurityException("Illegal attempt to signWireFormatMessageBinary - wrong classloader");
if (peerSecurityEngine == null)
return null;
return peerSecurityEngine.sign(bridge.getSignatureAlgorithm(), defaultCredential, bridge.getInputStream());
} | byte[] function(net.jxta.impl.endpoint.WireFormatMessageBinary.WireFormatMessageBinarySignatureBridge bridge) throws InvalidKeyException, SignatureException, IOException, SecurityException { if (!this.getClass().getClassLoader().equals(bridge.getClass().getClassLoader())) throw new SecurityException(STR); if (peerSecurityEngine == null) return null; return peerSecurityEngine.sign(bridge.getSignatureAlgorithm(), defaultCredential, bridge.getInputStream()); } | /**
* Support for WireFormatMessageBinary message signing
* @param bridge
* @return
* @throws InvalidKeyException
* @throws SignatureException
* @throws IOException
*/ | Support for WireFormatMessageBinary message signing | signWireFormatMessageBinary | {
"repo_name": "johnjianfang/jxse",
"path": "src/main/java/net/jxta/impl/membership/pse/PSEMembershipService.java",
"license": "apache-2.0",
"size": 59057
} | [
"java.io.IOException",
"java.security.InvalidKeyException",
"java.security.SignatureException"
] | import java.io.IOException; import java.security.InvalidKeyException; import java.security.SignatureException; | import java.io.*; import java.security.*; | [
"java.io",
"java.security"
] | java.io; java.security; | 1,908,683 |
public int getMsgId(SnmpMsg msg);
public int getMsgMaxSize(SnmpMsg msg);
public byte getMsgFlags(SnmpMsg msg);
public int getMsgSecurityModel(SnmpMsg msg);
public int getSecurityLevel(SnmpMsg msg);
public byte[] getFlatSecurityParameters(SnmpMsg msg);
public SnmpSecurityParameters getSecurityParameters(SnmpMsg msg);
public byte[] getContextEngineId(SnmpMsg msg);
public byte[] getContextName(SnmpMsg msg);
public byte[] getRawContextName(SnmpMsg msg);
public byte[] getAccessContext(SnmpMsg msg);
public byte[] getEncryptedPdu(SnmpMsg msg);
public void setContextName(SnmpMsg req, byte[] contextName);
public void setContextEngineId(SnmpMsg req, byte[] contextEngineId); | int getMsgId(SnmpMsg msg); public int getMsgMaxSize(SnmpMsg msg); public byte getMsgFlags(SnmpMsg msg); public int getMsgSecurityModel(SnmpMsg msg); public int getSecurityLevel(SnmpMsg msg); public byte[] getFlatSecurityParameters(SnmpMsg msg); public SnmpSecurityParameters getSecurityParameters(SnmpMsg msg); public byte[] getContextEngineId(SnmpMsg msg); public byte[] getContextName(SnmpMsg msg); public byte[] getRawContextName(SnmpMsg msg); public byte[] getAccessContext(SnmpMsg msg); public byte[] getEncryptedPdu(SnmpMsg msg); public void setContextName(SnmpMsg req, byte[] contextName); public void function(SnmpMsg req, byte[] contextEngineId); | /**
* Set the context engine Id of the passed message.
*/ | Set the context engine Id of the passed message | setContextEngineId | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/com/sun/jmx/snmp/mpm/SnmpMsgTranslator.java",
"license": "mit",
"size": 4686
} | [
"com.sun.jmx.snmp.SnmpMsg",
"com.sun.jmx.snmp.SnmpSecurityParameters"
] | import com.sun.jmx.snmp.SnmpMsg; import com.sun.jmx.snmp.SnmpSecurityParameters; | import com.sun.jmx.snmp.*; | [
"com.sun.jmx"
] | com.sun.jmx; | 2,495,821 |
boolean containsValue(@Nullable Object value); | boolean containsValue(@Nullable Object value); | /**
* Returns {@code true} if the table contains a mapping with the specified
* value.
*
* @param value value to search for
*/ | Returns true if the table contains a mapping with the specified value | containsValue | {
"repo_name": "mike10004/appengine-imaging",
"path": "gaecompat-awt-imaging/src/common/com/gaecompat/repackaged/com/google/common/collect/Table.java",
"license": "apache-2.0",
"size": 9909
} | [
"javax.annotation.Nullable"
] | import javax.annotation.Nullable; | import javax.annotation.*; | [
"javax.annotation"
] | javax.annotation; | 2,176,112 |
Overlay createNewOverlay(); | Overlay createNewOverlay(); | /**
* Creates a new overlay.
*
* @return an Overlay of the associated type in the default initial state
*/ | Creates a new overlay | createNewOverlay | {
"repo_name": "imagej/imagej-ui-swing",
"path": "src/main/java/net/imagej/ui/swing/overlay/JHotDrawAdapter.java",
"license": "bsd-2-clause",
"size": 4257
} | [
"net.imagej.overlay.Overlay"
] | import net.imagej.overlay.Overlay; | import net.imagej.overlay.*; | [
"net.imagej.overlay"
] | net.imagej.overlay; | 2,767,578 |
// Add LDAP variables to bootstrap properties file
LDAPUtils.addLDAPVariables(server);
Log.info(c, "setUp", "Starting the server... (will wait for userRegistry servlet to start)");
server.copyFileToLibertyInstallRoot("lib/features", "internalfeatures/securitylibertyinternals-1.0.mf");
server.addInstalledAppForValidation("userRegistry");
server.startServer(c.getName() + ".log");
//Make sure the application has come up before proceeding
assertNotNull("Application userRegistry does not appear to have started.",
server.waitForStringInLog("CWWKZ0001I:.*userRegistry"));
assertNotNull("Security service did not report it was ready",
server.waitForStringInLog("CWWKS0008I"));
assertNotNull("Server did not came up",
server.waitForStringInLog("CWWKF0011I"));
assertNotNull("Server did not catch misconfiguration",
server.waitForStringInLog("CWWKG0033W"));
Log.info(c, "setUp", "Creating servlet connection the server");
servlet = new UserRegistryServletConnection(server.getHostname(), server.getHttpDefaultPort());
servlet.getRealm();
Thread.sleep(5000);
servlet.getRealm();
} | LDAPUtils.addLDAPVariables(server); Log.info(c, "setUp", STR); server.copyFileToLibertyInstallRoot(STR, STR); server.addInstalledAppForValidation(STR); server.startServer(c.getName() + ".log"); assertNotNull(STR, server.waitForStringInLog(STR)); assertNotNull(STR, server.waitForStringInLog(STR)); assertNotNull(STR, server.waitForStringInLog(STR)); assertNotNull(STR, server.waitForStringInLog(STR)); Log.info(c, "setUp", STR); servlet = new UserRegistryServletConnection(server.getHostname(), server.getHttpDefaultPort()); servlet.getRealm(); Thread.sleep(5000); servlet.getRealm(); } | /**
* Updates the sample, which is expected to be at the hard-coded path.
* If this test is failing, check this path is correct.
*/ | Updates the sample, which is expected to be at the hard-coded path. If this test is failing, check this path is correct | setUp | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.security.wim.adapter.ldap_fat/fat/src/com/ibm/ws/security/wim/adapter/ldap/fat/TDSLDAP_SSLRef_NoSSLTest.java",
"license": "epl-1.0",
"size": 4463
} | [
"com.ibm.websphere.simplicity.log.Log",
"com.ibm.ws.security.registry.test.UserRegistryServletConnection",
"org.junit.Assert"
] | import com.ibm.websphere.simplicity.log.Log; import com.ibm.ws.security.registry.test.UserRegistryServletConnection; import org.junit.Assert; | import com.ibm.websphere.simplicity.log.*; import com.ibm.ws.security.registry.test.*; import org.junit.*; | [
"com.ibm.websphere",
"com.ibm.ws",
"org.junit"
] | com.ibm.websphere; com.ibm.ws; org.junit; | 2,763,270 |
public CharSequence[][] getAllTimezones() {
Resources resources = this.getResources();
String[] ids = resources.getStringArray(R.array.timezone_values);
String[] labels = resources.getStringArray(R.array.timezone_labels);
int minLength = ids.length;
if (ids.length != labels.length) {
minLength = Math.min(minLength, labels.length);
Log.e("Timezone ids and labels have different length!");
}
List<TimeZoneRow> timezones = new ArrayList<TimeZoneRow>();
for (int i = 0; i < minLength; i++) {
timezones.add(new TimeZoneRow(ids[i], labels[i]));
}
Collections.sort(timezones);
CharSequence[][] timeZones = new CharSequence[2][timezones.size()];
int i = 0;
for (TimeZoneRow row : timezones) {
timeZones[0][i] = row.mId;
timeZones[1][i++] = row.mDisplayName;
}
return timeZones;
} | CharSequence[][] function() { Resources resources = this.getResources(); String[] ids = resources.getStringArray(R.array.timezone_values); String[] labels = resources.getStringArray(R.array.timezone_labels); int minLength = ids.length; if (ids.length != labels.length) { minLength = Math.min(minLength, labels.length); Log.e(STR); } List<TimeZoneRow> timezones = new ArrayList<TimeZoneRow>(); for (int i = 0; i < minLength; i++) { timezones.add(new TimeZoneRow(ids[i], labels[i])); } Collections.sort(timezones); CharSequence[][] timeZones = new CharSequence[2][timezones.size()]; int i = 0; for (TimeZoneRow row : timezones) { timeZones[0][i] = row.mId; timeZones[1][i++] = row.mDisplayName; } return timeZones; } | /**
* Returns an array of ids/time zones. This returns a double indexed array
* of ids and time zones for Calendar. It is an inefficient method and
* shouldn't be called often, but can be used for one time generation of
* this list.
*
* @return double array of tz ids and tz names
*/ | Returns an array of ids/time zones. This returns a double indexed array of ids and time zones for Calendar. It is an inefficient method and shouldn't be called often, but can be used for one time generation of this list | getAllTimezones | {
"repo_name": "miswenwen/My_bird_work",
"path": "Bird_work/我的项目/AliDeskClock/AliDeskClock_liuqipeng_11_11_drawaniamtion/src/com/android/deskclock/SettingsActivity.java",
"license": "apache-2.0",
"size": 11732
} | [
"android.content.res.Resources",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] | import android.content.res.Resources; import java.util.ArrayList; import java.util.Collections; import java.util.List; | import android.content.res.*; import java.util.*; | [
"android.content",
"java.util"
] | android.content; java.util; | 1,386,550 |
@Override
public Playable getPlayable() {
return media;
} | Playable function() { return media; } | /**
* Returns the current media, if you need the media and the player status together, you should
* use getPSMPInfo() to make sure they're properly synchronized. Otherwise a race condition
* could result in nonsensical results (like a status of PLAYING, but a null playable)
* @return the current media. May be null
*/ | Returns the current media, if you need the media and the player status together, you should use getPSMPInfo() to make sure they're properly synchronized. Otherwise a race condition could result in nonsensical results (like a status of PLAYING, but a null playable) | getPlayable | {
"repo_name": "AntennaPod/AntennaPod",
"path": "core/src/main/java/de/danoeh/antennapod/core/service/playback/LocalPSMP.java",
"license": "gpl-3.0",
"size": 44501
} | [
"de.danoeh.antennapod.model.playback.Playable"
] | import de.danoeh.antennapod.model.playback.Playable; | import de.danoeh.antennapod.model.playback.*; | [
"de.danoeh.antennapod"
] | de.danoeh.antennapod; | 2,165,095 |
protected void onImpact(MovingObjectPosition pos)
{
if (pos.entityHit != null)
{
pos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F);
}
if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0)
{
byte b0 = 1;
if (this.rand.nextInt(32) == 0)
{
b0 = 4;
}
for (int i = 0; i < b0; ++i)
{
EntityDodo entitydodo = new EntityDodo(this.worldObj);
entitydodo.setGrowingAge(-24000);
entitydodo.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
this.worldObj.spawnEntityInWorld(entitydodo);
}
}
@SuppressWarnings("unused")
double d0 = 0.08D;
for (int j = 0; j < 8; ++j)
{
// worldObj.spawnParticle(EnumParticleTypes.SNOWBALL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(GlobalAdditions.dodo_egg)});
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
} | void function(MovingObjectPosition pos) { if (pos.entityHit != null) { pos.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 0.0F); } if (!this.worldObj.isRemote && this.rand.nextInt(8) == 0) { byte b0 = 1; if (this.rand.nextInt(32) == 0) { b0 = 4; } for (int i = 0; i < b0; ++i) { EntityDodo entitydodo = new EntityDodo(this.worldObj); entitydodo.setGrowingAge(-24000); entitydodo.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F); this.worldObj.spawnEntityInWorld(entitydodo); } } @SuppressWarnings(STR) double d0 = 0.08D; for (int j = 0; j < 8; ++j) { this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, ((double)this.rand.nextFloat() - 0.5D) * 0.08D, new int[] {Item.getIdFromItem(GlobalAdditions.dodo_egg)}); } if (!this.worldObj.isRemote) { this.setDead(); } } | /**
* Called when this EntityThrowable hits a block or entity.
*/ | Called when this EntityThrowable hits a block or entity | onImpact | {
"repo_name": "tterrag1098/ARKCraft-Code",
"path": "src/main/java/com/arkcraft/mod/core/entity/EntityDodoEgg.java",
"license": "mit",
"size": 2261
} | [
"com.arkcraft.mod.core.GlobalAdditions",
"com.arkcraft.mod.core.entity.passive.EntityDodo",
"net.minecraft.item.Item",
"net.minecraft.util.DamageSource",
"net.minecraft.util.EnumParticleTypes",
"net.minecraft.util.MovingObjectPosition"
] | import com.arkcraft.mod.core.GlobalAdditions; import com.arkcraft.mod.core.entity.passive.EntityDodo; import net.minecraft.item.Item; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.MovingObjectPosition; | import com.arkcraft.mod.core.*; import com.arkcraft.mod.core.entity.passive.*; import net.minecraft.item.*; import net.minecraft.util.*; | [
"com.arkcraft.mod",
"net.minecraft.item",
"net.minecraft.util"
] | com.arkcraft.mod; net.minecraft.item; net.minecraft.util; | 1,294,449 |
String getTrustedSigningKeysJson() throws IOException {
return this.downloader.download();
} | String getTrustedSigningKeysJson() throws IOException { return this.downloader.download(); } | /**
* Returns a string containing a JSON with the Google public signing keys.
*
* <p>Meant to be called by {@link PaymentMethodTokenRecipient}.
*/ | Returns a string containing a JSON with the Google public signing keys. Meant to be called by <code>PaymentMethodTokenRecipient</code> | getTrustedSigningKeysJson | {
"repo_name": "google/tink",
"path": "apps/paymentmethodtoken/src/main/java/com/google/crypto/tink/apps/paymentmethodtoken/GooglePaymentsPublicKeysManager.java",
"license": "apache-2.0",
"size": 5334
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,765,021 |
public Observable<List<Office>> getOffices() {
return mBaseApiManager.getOfficeApi().getAllOffices();
} | Observable<List<Office>> function() { return mBaseApiManager.getOfficeApi().getAllOffices(); } | /**
* Offices API
*/ | Offices API | getOffices | {
"repo_name": "ishan1604/android-client",
"path": "mifosng-android/src/main/java/com/mifos/api/DataManager.java",
"license": "mpl-2.0",
"size": 14811
} | [
"com.mifos.objects.organisation.Office",
"java.util.List"
] | import com.mifos.objects.organisation.Office; import java.util.List; | import com.mifos.objects.organisation.*; import java.util.*; | [
"com.mifos.objects",
"java.util"
] | com.mifos.objects; java.util; | 831,292 |
public static @CheckForNull DockerTraceabilityRootAction getInstance() {
Jenkins j = Jenkins.getInstance();
if (j == null) {
return null;
}
@CheckForNull DockerTraceabilityRootAction action = null;
for (Action rootAction : j.getActions()) {
if (rootAction instanceof DockerTraceabilityRootAction) {
action = (DockerTraceabilityRootAction) rootAction;
break;
}
}
return action;
} | static @CheckForNull DockerTraceabilityRootAction function() { Jenkins j = Jenkins.getInstance(); if (j == null) { return null; } @CheckForNull DockerTraceabilityRootAction action = null; for (Action rootAction : j.getActions()) { if (rootAction instanceof DockerTraceabilityRootAction) { action = (DockerTraceabilityRootAction) rootAction; break; } } return action; } | /**
* Gets the {@link DockerTraceabilityRootAction} of Jenkins instance.
* @return Instance or null if it is not available
*/ | Gets the <code>DockerTraceabilityRootAction</code> of Jenkins instance | getInstance | {
"repo_name": "jenkinsci/docker-traceability-plugin",
"path": "docker-traceability-plugin/src/main/java/org/jenkinsci/plugins/docker/traceability/core/DockerTraceabilityRootAction.java",
"license": "mit",
"size": 25211
} | [
"hudson.model.Action",
"javax.annotation.CheckForNull"
] | import hudson.model.Action; import javax.annotation.CheckForNull; | import hudson.model.*; import javax.annotation.*; | [
"hudson.model",
"javax.annotation"
] | hudson.model; javax.annotation; | 2,225,392 |
protected void destroyPoller() {
synchronized (pollers) {
pollers.remove(this);
}
log.info("Poller stopped after cnt=" +
pollCount.get() +
" sockets=" + channels.size() +
" lastPoll=" + lastPoll);
// Close all sockets
synchronized (this) {
if (serverPollset == 0) {
return;
}
// for (AprSocket ch: channels.values()) {
// ch.poller = null;
// ch.reset();
// }
keepAliveCount.set(0);
log.warning("Destroy pollset");
//serverPollset = 0;
}
Pool.destroy(pool);
pool = 0;
synchronized (pollers) {
// Now we can destroy the root pool
if (pollers.size() == 0 && !running) {
log.info("Destroy server context");
// AprSocketContext.this.destroy();
}
}
}
| void function() { synchronized (pollers) { pollers.remove(this); } log.info(STR + pollCount.get() + STR + channels.size() + STR + lastPoll); synchronized (this) { if (serverPollset == 0) { return; } keepAliveCount.set(0); log.warning(STR); } Pool.destroy(pool); pool = 0; synchronized (pollers) { if (pollers.size() == 0 && !running) { log.info(STR); } } } | /**
* Destroy the poller.
*/ | Destroy the poller | destroyPoller | {
"repo_name": "wenzhucjy/tomcat_source",
"path": "tomcat-8.0.9-sourcecode/java/org/apache/tomcat/jni/socket/AprSocketContext.java",
"license": "apache-2.0",
"size": 47294
} | [
"org.apache.tomcat.jni.Pool"
] | import org.apache.tomcat.jni.Pool; | import org.apache.tomcat.jni.*; | [
"org.apache.tomcat"
] | org.apache.tomcat; | 720,590 |
@Override
public FontMapping<TrueTypeFont> getTrueTypeFont(String baseFont,
PDFontDescriptor fontDescriptor)
{
TrueTypeFont ttf = (TrueTypeFont)findFont(FontFormat.TTF, baseFont);
if (ttf != null)
{
return new FontMapping<>(ttf, false);
}
else
{
// fallback - todo: i.e. fuzzy match
String fontName = getFallbackFontName(fontDescriptor);
ttf = (TrueTypeFont) findFont(FontFormat.TTF, fontName);
if (ttf == null)
{
// we have to return something here as TTFs aren't strictly required on the system
ttf = lastResortFont;
}
return new FontMapping<>(ttf, true);
}
} | FontMapping<TrueTypeFont> function(String baseFont, PDFontDescriptor fontDescriptor) { TrueTypeFont ttf = (TrueTypeFont)findFont(FontFormat.TTF, baseFont); if (ttf != null) { return new FontMapping<>(ttf, false); } else { String fontName = getFallbackFontName(fontDescriptor); ttf = (TrueTypeFont) findFont(FontFormat.TTF, fontName); if (ttf == null) { ttf = lastResortFont; } return new FontMapping<>(ttf, true); } } | /**
* Finds a TrueType font with the given PostScript name, or a suitable substitute, or null.
*
* @param fontDescriptor FontDescriptor
*/ | Finds a TrueType font with the given PostScript name, or a suitable substitute, or null | getTrueTypeFont | {
"repo_name": "kalaspuffar/pdfbox",
"path": "pdfbox/src/main/java/org/apache/pdfbox/pdmodel/font/FontMapperImpl.java",
"license": "apache-2.0",
"size": 27339
} | [
"org.apache.fontbox.ttf.TrueTypeFont"
] | import org.apache.fontbox.ttf.TrueTypeFont; | import org.apache.fontbox.ttf.*; | [
"org.apache.fontbox"
] | org.apache.fontbox; | 1,198,598 |
//-------------------------------------------------------------------------
public double parSpread(ResolvedFxSingleTrade trade, RatesProvider provider) {
return productPricer.parSpread(trade.getProduct(), provider);
} | double function(ResolvedFxSingleTrade trade, RatesProvider provider) { return productPricer.parSpread(trade.getProduct(), provider); } | /**
* Calculates the par spread.
* <p>
* This is the spread that should be added to the FX points to have a zero value.
*
* @param trade the trade
* @param provider the rates provider
* @return the spread
*/ | Calculates the par spread. This is the spread that should be added to the FX points to have a zero value | parSpread | {
"repo_name": "ChinaQuants/Strata",
"path": "modules/pricer/src/main/java/com/opengamma/strata/pricer/fx/DiscountingFxSingleTradePricer.java",
"license": "apache-2.0",
"size": 5174
} | [
"com.opengamma.strata.pricer.rate.RatesProvider",
"com.opengamma.strata.product.fx.ResolvedFxSingleTrade"
] | import com.opengamma.strata.pricer.rate.RatesProvider; import com.opengamma.strata.product.fx.ResolvedFxSingleTrade; | import com.opengamma.strata.pricer.rate.*; import com.opengamma.strata.product.fx.*; | [
"com.opengamma.strata"
] | com.opengamma.strata; | 2,835,098 |
@Override
public CurrencyDto toDto(Currency object) {
Validate.notNull(object);
return CurrencyDto.builder()
.id(object.getId())
.iso(object.getIso())
.name(object.getName())
.exchange(object.getExchange())
.build();
} | CurrencyDto function(Currency object) { Validate.notNull(object); return CurrencyDto.builder() .id(object.getId()) .iso(object.getIso()) .name(object.getName()) .exchange(object.getExchange()) .build(); } | /**
* JPA to DTO Mapper
*
* @param object JPA Object
* @return DTO Object
*/ | JPA to DTO Mapper | toDto | {
"repo_name": "bindstone/portfolio",
"path": "poly-portfolio-core/src/main/java/com/bindstone/portfolio/mapper/CurrencyMapper.java",
"license": "mit",
"size": 1250
} | [
"com.bindstone.portfolio.entity.Currency",
"com.bindstone.portfolio.mapper.dto.CurrencyDto",
"org.apache.commons.lang3.Validate"
] | import com.bindstone.portfolio.entity.Currency; import com.bindstone.portfolio.mapper.dto.CurrencyDto; import org.apache.commons.lang3.Validate; | import com.bindstone.portfolio.entity.*; import com.bindstone.portfolio.mapper.dto.*; import org.apache.commons.lang3.*; | [
"com.bindstone.portfolio",
"org.apache.commons"
] | com.bindstone.portfolio; org.apache.commons; | 851,670 |
public int depth() {
if (isLeaf()) {
return 0;
}
int maxDepth = 0;
List<Tree> kids = children();
for (Tree kid : kids) {
int curDepth = kid.depth();
if (curDepth > maxDepth) {
maxDepth = curDepth;
}
}
return maxDepth + 1;
} | int function() { if (isLeaf()) { return 0; } int maxDepth = 0; List<Tree> kids = children(); for (Tree kid : kids) { int curDepth = kid.depth(); if (curDepth > maxDepth) { maxDepth = curDepth; } } return maxDepth + 1; } | /**
* Finds the channels of the tree. The channels is defined as the length
* of the longest path from this node to a leaf node. Leaf nodes
* have channels zero. POS tags have channels 1. Phrasal nodes have
* channels >= 2.
*
* @return the channels
*/ | Finds the channels of the tree. The channels is defined as the length of the longest path from this node to a leaf node. Leaf nodes have channels zero. POS tags have channels 1. Phrasal nodes have channels >= 2 | depth | {
"repo_name": "RobAltena/deeplearning4j",
"path": "deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/feedforward/autoencoder/recursive/Tree.java",
"license": "apache-2.0",
"size": 13236
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,295,462 |
public void endCDATA(Augmentations augs) throws XNIException {
} | void function(Augmentations augs) throws XNIException { } | /**
* The end of a CDATA section.
*
* @param augs Additional information that may include infoset augmentations
*
* @exception XNIException
* Thrown by handler to signal an error.
*/ | The end of a CDATA section | endCDATA | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/com/sun/org/apache/xerces/internal/impl/xs/opti/DefaultXMLDocumentHandler.java",
"license": "apache-2.0",
"size": 32090
} | [
"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; | 1,806,726 |
@ServiceMethod(returns = ReturnType.SINGLE)
public Response<ValidateAddressResponseInner> validateWithResponse(AddressDetails address, Context context) {
return validateWithResponseAsync(address, context).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) Response<ValidateAddressResponseInner> function(AddressDetails address, Context context) { return validateWithResponseAsync(address, context).block(); } | /**
* Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address.
*
* @param address Address details.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return result of the address validation.
*/ | Validates an address. Use the operation to validate an address before using it as soldTo or a billTo address | validateWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/billing/azure-resourcemanager-billing/src/main/java/com/azure/resourcemanager/billing/implementation/AddressClientImpl.java",
"license": "mit",
"size": 8349
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner",
"com.azure.resourcemanager.billing.models.AddressDetails"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.billing.fluent.models.ValidateAddressResponseInner; import com.azure.resourcemanager.billing.models.AddressDetails; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.billing.fluent.models.*; import com.azure.resourcemanager.billing.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,877,913 |
try {
return valueOf(s.toUpperCase(Locale.ENGLISH));
} catch (Exception e) {
return null;
}
}
}
public enum CursorStrategy {
CUT,
COPY
}
public enum ConditionType {
NONE,
STRING,
REGEX
}
protected final AtomicLong exceptions;
protected final AtomicLong converterExceptions;
protected final String id;
protected final String title;
protected final Type superType;
protected final CursorStrategy cursorStrategy;
protected final String targetField;
protected final String sourceField;
protected final String creatorUserId;
protected final Map<String, Object> extractorConfig;
protected final List<Converter> converters;
protected final ConditionType conditionType;
protected final String conditionValue;
protected long order;
protected Pattern regexConditionPattern;
private final Counter conditionHitsCounter;
private final Counter conditionMissesCounter;
private final Timer conditionTimer;
private final Timer executionTimer;
private final Timer converterTimer;
private final Timer completeTimer;
private final String conditionHitsCounterName;
private final String conditionMissesCounterName;
private final String conditionTimerName;
private final String executionTimerName;
private final String converterTimerName;
private final String completeTimerName; | try { return valueOf(s.toUpperCase(Locale.ENGLISH)); } catch (Exception e) { return null; } } } public enum CursorStrategy { CUT, COPY } public enum ConditionType { NONE, STRING, REGEX } protected final AtomicLong exceptions; protected final AtomicLong converterExceptions; protected final String id; protected final String title; protected final Type superType; protected final CursorStrategy cursorStrategy; protected final String targetField; protected final String sourceField; protected final String creatorUserId; protected final Map<String, Object> extractorConfig; protected final List<Converter> converters; protected final ConditionType conditionType; protected final String conditionValue; protected long order; protected Pattern regexConditionPattern; private final Counter conditionHitsCounter; private final Counter conditionMissesCounter; private final Timer conditionTimer; private final Timer executionTimer; private final Timer converterTimer; private final Timer completeTimer; private final String conditionHitsCounterName; private final String conditionMissesCounterName; private final String conditionTimerName; private final String executionTimerName; private final String converterTimerName; private final String completeTimerName; | /**
* Just like {@link #valueOf(String)} but uses the upper case string and doesn't throw exceptions.
*
* @param s the string representation of the extractor type.
* @return the actual {@link Type} or {@code null}.
*/ | Just like <code>#valueOf(String)</code> but uses the upper case string and doesn't throw exceptions | fuzzyValueOf | {
"repo_name": "edmundoa/graylog2-server",
"path": "graylog2-server/src/main/java/org/graylog2/plugin/inputs/Extractor.java",
"license": "gpl-3.0",
"size": 17637
} | [
"com.codahale.metrics.Counter",
"com.codahale.metrics.Timer",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"java.util.concurrent.atomic.AtomicLong",
"java.util.regex.Pattern"
] | import com.codahale.metrics.Counter; import com.codahale.metrics.Timer; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.concurrent.atomic.AtomicLong; import java.util.regex.Pattern; | import com.codahale.metrics.*; import java.util.*; import java.util.concurrent.atomic.*; import java.util.regex.*; | [
"com.codahale.metrics",
"java.util"
] | com.codahale.metrics; java.util; | 1,943,394 |
final Map<AssociationRule<I>, AssociationRule<I>> associationRules = new LinkedHashMap<>();
transactions.stream()
.forEach(t -> {
t.extractNavigationAssociationRules().stream().forEach(ar -> {
ar.setAntecedentTransactions(countTransactionsOf(ar.getAntecedentItem()));
if (associationRules.containsKey(ar)) {
associationRules.get(ar).addTransaction(t);
} else {
ar.addTransaction(t);
associationRules.put(ar, ar);
}
});
});
return associationRules.keySet();
}
| final Map<AssociationRule<I>, AssociationRule<I>> associationRules = new LinkedHashMap<>(); transactions.stream() .forEach(t -> { t.extractNavigationAssociationRules().stream().forEach(ar -> { ar.setAntecedentTransactions(countTransactionsOf(ar.getAntecedentItem())); if (associationRules.containsKey(ar)) { associationRules.get(ar).addTransaction(t); } else { ar.addTransaction(t); associationRules.put(ar, ar); } }); }); return associationRules.keySet(); } | /**
* For a transaction with items ABCD, extract the rules A -> BCD, B -> ACD,
* C -> ABD and D -> ABC.
*
* @return
*/ | For a transaction with items ABCD, extract the rules A -> BCD, B -> ACD, C -> ABD and D -> ABC | extractNavigationRules | {
"repo_name": "rodrigokuroda/recominer",
"path": "recominer-extractor/src/main/java/br/edu/utfpr/recominer/metric/associationrule/AssociationRuleExtractor.java",
"license": "apache-2.0",
"size": 7067
} | [
"br.edu.utfpr.recominer.core.model.AssociationRule",
"java.util.LinkedHashMap",
"java.util.Map"
] | import br.edu.utfpr.recominer.core.model.AssociationRule; import java.util.LinkedHashMap; import java.util.Map; | import br.edu.utfpr.recominer.core.model.*; import java.util.*; | [
"br.edu.utfpr",
"java.util"
] | br.edu.utfpr; java.util; | 2,489,963 |
public void joinGroup() throws ClusteringFault {
// Have multiple RPC channels with multiple RPC request handlers for each localDomain
// This is needed only when this member is running as a load balancer
for (MembershipManager appDomainMembershipManager : applicationDomainMembershipManagers) {
appDomainMembershipManager.setupStaticMembershipManagement(staticMembershipInterceptor);
// Create an RpcChannel for each localDomain
String domain = new String(appDomainMembershipManager.getDomain());
RpcChannel rpcMembershipChannel =
new RpcChannel(TribesUtil.getRpcMembershipChannelId(appDomainMembershipManager.getDomain()),
channel,
new RpcMembershipRequestHandler(appDomainMembershipManager,
this));
appDomainMembershipManager.setRpcMembershipChannel(rpcMembershipChannel);
if (log.isDebugEnabled()) {
log.debug("Created RPC Membership Channel for application domain " + domain);
}
}
// Create a Membership channel for handling membership requests
RpcChannel rpcMembershipChannel =
new RpcChannel(TribesUtil.getRpcMembershipChannelId(localDomain),
channel, new RpcMembershipRequestHandler(primaryMembershipManager,
this));
if (log.isDebugEnabled()) {
log.debug("Created primary membership channel " + new String(localDomain));
}
primaryMembershipManager.setRpcMembershipChannel(rpcMembershipChannel);
// Send JOIN message to a WKA member
if (primaryMembershipManager.getMembers().length > 0) {
org.apache.catalina.tribes.Member[] wkaMembers = primaryMembershipManager.getMembers(); // The well-known members
//TODO: #### Need to double check whether this sleep is necessary
Response[] responses = null;
do {
try {
log.info("Sending JOIN message to WKA members...");
responses = rpcMembershipChannel.send(wkaMembers,
new JoinGroupCommand(),
RpcChannel.ALL_REPLY,
Channel.SEND_OPTIONS_ASYNCHRONOUS |
TribesConstants.MEMBERSHIP_MSG_OPTION,
10000);
if (responses.length == 0) {
try {
log.info("No responses received from WKA members");
Thread.sleep(5000);
} catch (InterruptedException ignored) {
}
}
} catch (Exception e) {
String msg = "Error occurred while trying to send JOIN request to WKA members";
log.error(msg, e);
wkaMembers = primaryMembershipManager.getMembers();
if (wkaMembers.length == 0) {
log.warn("There are no well-known members");
break;
}
}
// TODO: If we do not get a response within some time, try to recover from this fault
}
while (responses == null || responses.length == 0); // Wait until we've received at least one response
for (Response response : responses) {
MemberListCommand command = (MemberListCommand) response.getMessage();
command.setMembershipManager(primaryMembershipManager);
command.execute(null); // Set the list of current members
// If the WKA member is not part of this group, remove it
if (!TribesUtil.areInSameDomain(response.getSource(),
primaryMembershipManager.getLocalMember())) {
primaryMembershipManager.memberDisappeared(response.getSource());
if (log.isDebugEnabled()) {
log.debug("Removed member " + TribesUtil.getName(response.getSource()) +
" since it does not belong to the local domain " +
new String(primaryMembershipManager.getLocalMember().getDomain()));
}
}
}
}
} | void function() throws ClusteringFault { for (MembershipManager appDomainMembershipManager : applicationDomainMembershipManagers) { appDomainMembershipManager.setupStaticMembershipManagement(staticMembershipInterceptor); String domain = new String(appDomainMembershipManager.getDomain()); RpcChannel rpcMembershipChannel = new RpcChannel(TribesUtil.getRpcMembershipChannelId(appDomainMembershipManager.getDomain()), channel, new RpcMembershipRequestHandler(appDomainMembershipManager, this)); appDomainMembershipManager.setRpcMembershipChannel(rpcMembershipChannel); if (log.isDebugEnabled()) { log.debug(STR + domain); } } RpcChannel rpcMembershipChannel = new RpcChannel(TribesUtil.getRpcMembershipChannelId(localDomain), channel, new RpcMembershipRequestHandler(primaryMembershipManager, this)); if (log.isDebugEnabled()) { log.debug(STR + new String(localDomain)); } primaryMembershipManager.setRpcMembershipChannel(rpcMembershipChannel); if (primaryMembershipManager.getMembers().length > 0) { org.apache.catalina.tribes.Member[] wkaMembers = primaryMembershipManager.getMembers(); Response[] responses = null; do { try { log.info(STR); responses = rpcMembershipChannel.send(wkaMembers, new JoinGroupCommand(), RpcChannel.ALL_REPLY, Channel.SEND_OPTIONS_ASYNCHRONOUS TribesConstants.MEMBERSHIP_MSG_OPTION, 10000); if (responses.length == 0) { try { log.info(STR); Thread.sleep(5000); } catch (InterruptedException ignored) { } } } catch (Exception e) { String msg = STR; log.error(msg, e); wkaMembers = primaryMembershipManager.getMembers(); if (wkaMembers.length == 0) { log.warn(STR); break; } } } while (responses == null responses.length == 0); for (Response response : responses) { MemberListCommand command = (MemberListCommand) response.getMessage(); command.setMembershipManager(primaryMembershipManager); command.execute(null); if (!TribesUtil.areInSameDomain(response.getSource(), primaryMembershipManager.getLocalMember())) { primaryMembershipManager.memberDisappeared(response.getSource()); if (log.isDebugEnabled()) { log.debug(STR + TribesUtil.getName(response.getSource()) + STR + new String(primaryMembershipManager.getLocalMember().getDomain())); } } } } } | /**
* JOIN the group and get the member list
*
* @throws ClusteringFault If an error occurs while joining the group
*/ | JOIN the group and get the member list | joinGroup | {
"repo_name": "apache/axis2-java",
"path": "modules/clustering/src/org/apache/axis2/clustering/tribes/WkaBasedMembershipScheme.java",
"license": "apache-2.0",
"size": 20121
} | [
"org.apache.axis2.clustering.ClusteringFault",
"org.apache.axis2.clustering.Member",
"org.apache.axis2.clustering.control.wka.JoinGroupCommand",
"org.apache.axis2.clustering.control.wka.MemberListCommand",
"org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler",
"org.apache.catalina.tribes.Channel",
"org.apache.catalina.tribes.group.Response",
"org.apache.catalina.tribes.group.RpcChannel"
] | import org.apache.axis2.clustering.ClusteringFault; import org.apache.axis2.clustering.Member; import org.apache.axis2.clustering.control.wka.JoinGroupCommand; import org.apache.axis2.clustering.control.wka.MemberListCommand; import org.apache.axis2.clustering.control.wka.RpcMembershipRequestHandler; import org.apache.catalina.tribes.Channel; import org.apache.catalina.tribes.group.Response; import org.apache.catalina.tribes.group.RpcChannel; | import org.apache.axis2.clustering.*; import org.apache.axis2.clustering.control.wka.*; import org.apache.catalina.tribes.*; import org.apache.catalina.tribes.group.*; | [
"org.apache.axis2",
"org.apache.catalina"
] | org.apache.axis2; org.apache.catalina; | 73,146 |
@RequirePOST
public void doSafeRestart(StaplerRequest request, StaplerResponse response) throws IOException, ServletException {
Jenkins.get().checkPermission(Jenkins.ADMINISTER);
synchronized (jobs) {
if (!isRestartScheduled()) {
addJob(new RestartJenkinsJob(getCoreSource()));
LOGGER.info("Scheduling Jenkins reboot");
}
}
response.sendRedirect2(".");
} | void function(StaplerRequest request, StaplerResponse response) throws IOException, ServletException { Jenkins.get().checkPermission(Jenkins.ADMINISTER); synchronized (jobs) { if (!isRestartScheduled()) { addJob(new RestartJenkinsJob(getCoreSource())); LOGGER.info(STR); } } response.sendRedirect2("."); } | /**
* Schedules a Jenkins restart.
*/ | Schedules a Jenkins restart | doSafeRestart | {
"repo_name": "damianszczepanik/jenkins",
"path": "core/src/main/java/hudson/model/UpdateCenter.java",
"license": "mit",
"size": 97521
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"org.kohsuke.stapler.StaplerRequest",
"org.kohsuke.stapler.StaplerResponse"
] | import java.io.IOException; import javax.servlet.ServletException; import org.kohsuke.stapler.StaplerRequest; import org.kohsuke.stapler.StaplerResponse; | import java.io.*; import javax.servlet.*; import org.kohsuke.stapler.*; | [
"java.io",
"javax.servlet",
"org.kohsuke.stapler"
] | java.io; javax.servlet; org.kohsuke.stapler; | 1,112,617 |
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EnvelopeTemplateResults envelopeTemplateResults = (EnvelopeTemplateResults) o;
return Objects.equals(this.endPosition, envelopeTemplateResults.endPosition) &&
Objects.equals(this.envelopeTemplates, envelopeTemplateResults.envelopeTemplates) &&
Objects.equals(this.folders, envelopeTemplateResults.folders) &&
Objects.equals(this.nextUri, envelopeTemplateResults.nextUri) &&
Objects.equals(this.previousUri, envelopeTemplateResults.previousUri) &&
Objects.equals(this.resultSetSize, envelopeTemplateResults.resultSetSize) &&
Objects.equals(this.startPosition, envelopeTemplateResults.startPosition) &&
Objects.equals(this.totalSetSize, envelopeTemplateResults.totalSetSize);
} | boolean function(java.lang.Object o) { if (this == o) { return true; } if (o == null getClass() != o.getClass()) { return false; } EnvelopeTemplateResults envelopeTemplateResults = (EnvelopeTemplateResults) o; return Objects.equals(this.endPosition, envelopeTemplateResults.endPosition) && Objects.equals(this.envelopeTemplates, envelopeTemplateResults.envelopeTemplates) && Objects.equals(this.folders, envelopeTemplateResults.folders) && Objects.equals(this.nextUri, envelopeTemplateResults.nextUri) && Objects.equals(this.previousUri, envelopeTemplateResults.previousUri) && Objects.equals(this.resultSetSize, envelopeTemplateResults.resultSetSize) && Objects.equals(this.startPosition, envelopeTemplateResults.startPosition) && Objects.equals(this.totalSetSize, envelopeTemplateResults.totalSetSize); } | /**
* Compares objects.
*
* @return true or false depending on comparison result.
*/ | Compares objects | equals | {
"repo_name": "docusign/docusign-java-client",
"path": "src/main/java/com/docusign/esign/model/EnvelopeTemplateResults.java",
"license": "mit",
"size": 9168
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 208,146 |
public Member getLocalPlayer() {
if (localPlayerCache == null) {
for (Member member : getMembersByController(PlayerController.class)) {
if ( ((PlayerController) member.getAiController()).isLocal()) {
localPlayerCache = member;
break;
}
}
}
return localPlayerCache;
} | Member function() { if (localPlayerCache == null) { for (Member member : getMembersByController(PlayerController.class)) { if ( ((PlayerController) member.getAiController()).isLocal()) { localPlayerCache = member; break; } } } return localPlayerCache; } | /**
* Returns the player who is interacting with the computer this program runs on.
*
* @return the player on the real local computer.
*/ | Returns the player who is interacting with the computer this program runs on | getLocalPlayer | {
"repo_name": "QuarterCode/Disconnected",
"path": "src/main/java/com/quartercode/disconnected/sim/Simulation.java",
"license": "gpl-3.0",
"size": 8450
} | [
"com.quartercode.disconnected.sim.member.Member",
"com.quartercode.disconnected.sim.member.ai.PlayerController"
] | import com.quartercode.disconnected.sim.member.Member; import com.quartercode.disconnected.sim.member.ai.PlayerController; | import com.quartercode.disconnected.sim.member.*; import com.quartercode.disconnected.sim.member.ai.*; | [
"com.quartercode.disconnected"
] | com.quartercode.disconnected; | 446,213 |
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int parentWidth = MeasureSpec.getSize(widthMeasureSpec);
int parentHeight = MeasureSpec.getSize(heightMeasureSpec);
final Resources resources = getContext().getResources();
float titleHeight = resources.getFraction(R.dimen.setup_title_height, 1, 1);
float sideMargin = resources.getFraction(R.dimen.setup_border_width, 1, 1);
int bottom = resources.getDimensionPixelSize(R.dimen.setup_margin_bottom);
setPaddingRelative(
(int) (parentWidth * sideMargin),
0,
(int) (parentWidth * sideMargin),
bottom);
View title = findViewById(R.id.title_area);
if (title != null) {
title.setMinimumHeight((int) (parentHeight * titleHeight));
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
} | void function(int widthMeasureSpec, int heightMeasureSpec) { int parentWidth = MeasureSpec.getSize(widthMeasureSpec); int parentHeight = MeasureSpec.getSize(heightMeasureSpec); final Resources resources = getContext().getResources(); float titleHeight = resources.getFraction(R.dimen.setup_title_height, 1, 1); float sideMargin = resources.getFraction(R.dimen.setup_border_width, 1, 1); int bottom = resources.getDimensionPixelSize(R.dimen.setup_margin_bottom); setPaddingRelative( (int) (parentWidth * sideMargin), 0, (int) (parentWidth * sideMargin), bottom); View title = findViewById(R.id.title_area); if (title != null) { title.setMinimumHeight((int) (parentHeight * titleHeight)); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); } } | /**
* Set our margins and title area height proportionally to the available display size
*/ | Set our margins and title area height proportionally to the available display size | onMeasure | {
"repo_name": "craigacgomez/flaming_monkey_packages_apps_Settings",
"path": "src/com/android/settings/wifi/WifiSettings.java",
"license": "apache-2.0",
"size": 46198
} | [
"android.content.res.Resources",
"android.view.View"
] | import android.content.res.Resources; import android.view.View; | import android.content.res.*; import android.view.*; | [
"android.content",
"android.view"
] | android.content; android.view; | 1,295,218 |
@Nonnull
public java.util.concurrent.CompletableFuture<GroupSetting> postAsync(@Nonnull final GroupSetting newGroupSetting) {
return sendAsync(HttpMethod.POST, newGroupSetting);
} | java.util.concurrent.CompletableFuture<GroupSetting> function(@Nonnull final GroupSetting newGroupSetting) { return sendAsync(HttpMethod.POST, newGroupSetting); } | /**
* Creates a GroupSetting with a new object
*
* @param newGroupSetting the new object to create
* @return a future with the result
*/ | Creates a GroupSetting with a new object | postAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/GroupSettingRequest.java",
"license": "mit",
"size": 5772
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.GroupSetting",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.GroupSetting; import javax.annotation.Nonnull; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 238,450 |
private static Execution privilegedExecution() {
return WildFlySecurityManager.isChecking() ? Execution.PRIVILEGED : Execution.NON_PRIVILEGED;
} | static Execution function() { return WildFlySecurityManager.isChecking() ? Execution.PRIVILEGED : Execution.NON_PRIVILEGED; } | /**
* Provides a Supplier execution in a doPrivileged block if a security manager is checking privileges
*/ | Provides a Supplier execution in a doPrivileged block if a security manager is checking privileges | privilegedExecution | {
"repo_name": "jamezp/wildfly-core",
"path": "controller/src/main/java/org/jboss/as/controller/remote/TransactionalProtocolOperationHandler.java",
"license": "lgpl-2.1",
"size": 36166
} | [
"org.wildfly.security.manager.WildFlySecurityManager"
] | import org.wildfly.security.manager.WildFlySecurityManager; | import org.wildfly.security.manager.*; | [
"org.wildfly.security"
] | org.wildfly.security; | 823,564 |
public Email bytes(String contentId, byte[] bytes) {
return bytes(contentId, bytes, null);
} | Email function(String contentId, byte[] bytes) { return bytes(contentId, bytes, null); } | /**
* Embed a resource to the email directly using the bytes. The embedded
* resource must be referenced in the email body using a
* <a href="https://tools.ietf.org/html/rfc4021#section-2.2.2">Content-ID
* (or CID)</a>.
*
* <p>
* The disposition of the attachment is set to
* {@link ContentDisposition#INLINE}.
*
* <p>
* The Content-Type of the attachment is automatically determined.
*
* @param contentId
* the Content-ID used to reference the embedded attachment in
* the email body
* @param bytes
* the content of the attachment
* @return the email instance for fluent chaining
*/ | Embed a resource to the email directly using the bytes. The embedded resource must be referenced in the email body using a Content-ID (or CID). The disposition of the attachment is set to <code>ContentDisposition#INLINE</code>. The Content-Type of the attachment is automatically determined | bytes | {
"repo_name": "groupe-sii/ogham",
"path": "ogham-core/src/main/java/fr/sii/ogham/email/message/fluent/EmbedBuilder.java",
"license": "apache-2.0",
"size": 13935
} | [
"fr.sii.ogham.email.message.Email"
] | import fr.sii.ogham.email.message.Email; | import fr.sii.ogham.email.message.*; | [
"fr.sii.ogham"
] | fr.sii.ogham; | 2,847,781 |
public Class<? extends Filter> getFilterClass(); | Class<? extends Filter> function(); | /**
* Get the class of the Filter object that should be added to the servlet.
*
* This method is considered "mutually exclusive" from the getFilter method.
* That is, one of them should return null and the other should return an actual value.
*
* @return The class of the Filter object to be added to the servlet
*/ | Get the class of the Filter object that should be added to the servlet. This method is considered "mutually exclusive" from the getFilter method. That is, one of them should return null and the other should return an actual value | getFilterClass | {
"repo_name": "tubemogul/druid",
"path": "server/src/main/java/io/druid/server/initialization/jetty/ServletFilterHolder.java",
"license": "apache-2.0",
"size": 2731
} | [
"javax.servlet.Filter"
] | import javax.servlet.Filter; | import javax.servlet.*; | [
"javax.servlet"
] | javax.servlet; | 2,721,565 |
@GET
@Produces({ MediaType.APPLICATION_JSON })
@AuthorizationBinding
@Operation(tags= {"downloads"}, summary="Return information all download jobs")
public List<DownloadJob> getAllDownloadJobs() throws DAOException, ContentLibException {
List<DownloadJob> downloadJobs = DataManager.getInstance()
.getDao()
.getAllDownloadJobs()
.stream()
.collect(Collectors.toList());
return downloadJobs;
} | @Produces({ MediaType.APPLICATION_JSON }) @Operation(tags= {STR}, summary=STR) List<DownloadJob> function() throws DAOException, ContentLibException { List<DownloadJob> downloadJobs = DataManager.getInstance() .getDao() .getAllDownloadJobs() .stream() .collect(Collectors.toList()); return downloadJobs; } | /**
* Get information about all download jobs of a type
*
* @param type The jobtype, either pdf or epub
* @return An array of json representations of all {@link io.goobi.viewer.model.download.DownloadJob}s of the given type
* @throws io.goobi.viewer.exceptions.DAOException if any.
* @throws de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException if any.
*/ | Get information about all download jobs of a type | getAllDownloadJobs | {
"repo_name": "intranda/goobi-viewer-core",
"path": "goobi-viewer-core/src/main/java/io/goobi/viewer/api/rest/v1/downloads/DownloadResource.java",
"license": "gpl-2.0",
"size": 28838
} | [
"de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException",
"io.goobi.viewer.controller.DataManager",
"io.goobi.viewer.exceptions.DAOException",
"io.goobi.viewer.model.download.DownloadJob",
"io.swagger.v3.oas.annotations.Operation",
"java.util.List",
"java.util.stream.Collectors",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType"
] | import de.unigoettingen.sub.commons.contentlib.exceptions.ContentLibException; import io.goobi.viewer.controller.DataManager; import io.goobi.viewer.exceptions.DAOException; import io.goobi.viewer.model.download.DownloadJob; import io.swagger.v3.oas.annotations.Operation; import java.util.List; import java.util.stream.Collectors; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; | import de.unigoettingen.sub.commons.contentlib.exceptions.*; import io.goobi.viewer.controller.*; import io.goobi.viewer.exceptions.*; import io.goobi.viewer.model.download.*; import io.swagger.v3.oas.annotations.*; import java.util.*; import java.util.stream.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"de.unigoettingen.sub",
"io.goobi.viewer",
"io.swagger.v3",
"java.util",
"javax.ws"
] | de.unigoettingen.sub; io.goobi.viewer; io.swagger.v3; java.util; javax.ws; | 1,540,361 |
public static boolean verifyPermissions(int[] grantResults) {
// At least one result must be checked.
if(grantResults.length < 1){
return false;
}
// Verify that each required permission has been granted, otherwise return false.
for (int result : grantResults) {
if (result != PackageManager.PERMISSION_GRANTED) {
return false;
}
}
return true;
} | static boolean function(int[] grantResults) { if(grantResults.length < 1){ return false; } for (int result : grantResults) { if (result != PackageManager.PERMISSION_GRANTED) { return false; } } return true; } | /**
* Check that all given permissions have been granted by verifying that each entry in the
* given array is of the value {@link PackageManager#PERMISSION_GRANTED}.
*
* @see Activity#onRequestPermissionsResult(int, String[], int[])
*/ | Check that all given permissions have been granted by verifying that each entry in the given array is of the value <code>PackageManager#PERMISSION_GRANTED</code> | verifyPermissions | {
"repo_name": "cowthan/AyoCompoment",
"path": "app/src/main/java/org/ayo/component/sample/permission/system/PermissionUtil.java",
"license": "apache-2.0",
"size": 1616
} | [
"android.content.pm.PackageManager"
] | import android.content.pm.PackageManager; | import android.content.pm.*; | [
"android.content"
] | android.content; | 239,059 |
public LogicalExpression getRhs() throws FrontendException {
return (LogicalExpression)plan.getSuccessors(this).get(2);
} | LogicalExpression function() throws FrontendException { return (LogicalExpression)plan.getSuccessors(this).get(2); } | /**
* Get the right hand side of this expression.
* @return expression on the right hand side
* @throws FrontendException
*/ | Get the right hand side of this expression | getRhs | {
"repo_name": "hxquangnhat/PIG-ROLLUP-MRCUBE",
"path": "src/org/apache/pig/newplan/logical/expression/BinCondExpression.java",
"license": "apache-2.0",
"size": 4589
} | [
"org.apache.pig.impl.logicalLayer.FrontendException"
] | import org.apache.pig.impl.logicalLayer.FrontendException; | import org.apache.pig.impl.*; | [
"org.apache.pig"
] | org.apache.pig; | 1,775,799 |
public StringBuffer generateTree(List<Date> list)
{
StringBuffer strbuff = new StringBuffer();
LinkedHashMap<String, LinkedHashMap<String, HashSet<String>>> resultMap = prepareDataStructure(list);
if (resultMap != null)
{
Set<String> yearSet = resultMap.keySet();
for (String year : yearSet)
{
strbuff.append("<ul class='ul1'>");
strbuff.append("<li>");
strbuff.append("<a href='#'>");
strbuff.append(year);
strbuff.append("</a>");
LinkedHashMap<String, HashSet<String>> monthMap = resultMap.get(year);
if (monthMap != null)
{
Set<String> monthSet = monthMap.keySet();
for (String month : monthSet)
{
strbuff.append("<ul>");
strbuff.append("<li>");
strbuff.append("<a href='#'>");
strbuff.append(month);
strbuff.append("</a>");
strbuff.append("<ul>");
Set<String> daySet = monthMap.get(month);
for (String day : daySet)
{
strbuff.append("<li>");
strbuff.append("<a href='#' onclick='onclick_tree_item(this);'>");
strbuff.append(year + "-" + month + "-" + day);
strbuff.append("</a>");
strbuff.append("</li>");
}
strbuff.append("</ul>");
strbuff.append("</li>");
strbuff.append("</ul>");
}
}
strbuff.append("</li>");
strbuff.append("</ul>");
}
}
return strbuff;
} | StringBuffer function(List<Date> list) { StringBuffer strbuff = new StringBuffer(); LinkedHashMap<String, LinkedHashMap<String, HashSet<String>>> resultMap = prepareDataStructure(list); if (resultMap != null) { Set<String> yearSet = resultMap.keySet(); for (String year : yearSet) { strbuff.append(STR); strbuff.append("<li>"); strbuff.append(STR); strbuff.append(year); strbuff.append("</a>"); LinkedHashMap<String, HashSet<String>> monthMap = resultMap.get(year); if (monthMap != null) { Set<String> monthSet = monthMap.keySet(); for (String month : monthSet) { strbuff.append("<ul>"); strbuff.append("<li>"); strbuff.append(STR); strbuff.append(month); strbuff.append("</a>"); strbuff.append("<ul>"); Set<String> daySet = monthMap.get(month); for (String day : daySet) { strbuff.append("<li>"); strbuff.append(STR); strbuff.append(year + "-" + month + "-" + day); strbuff.append("</a>"); strbuff.append("</li>"); } strbuff.append("</ul>"); strbuff.append("</li>"); strbuff.append("</ul>"); } } strbuff.append("</li>"); strbuff.append("</ul>"); } } return strbuff; } | /**
* generate tree structure to be display in admin screen
*
* @param list
* @return
*/ | generate tree structure to be display in admin screen | generateTree | {
"repo_name": "hexbinary/landing",
"path": "src/main/java/oscar/util/CBIUtil.java",
"license": "gpl-2.0",
"size": 19442
} | [
"java.util.Date",
"java.util.HashSet",
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Set"
] | import java.util.Date; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.List; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 190,380 |
public QueryOptionsHandle withSortOrders(QuerySortOrder... sortOrders) {
optionsHolder.setSortOrders(Arrays.asList(sortOrders));
return this;
} | QueryOptionsHandle function(QuerySortOrder... sortOrders) { optionsHolder.setSortOrders(Arrays.asList(sortOrders)); return this; } | /**
* Set a List of sort orders in the query options.
* @param sortOrders The list of sort orders.
* @return this QueryOptionsHandle, for fluent setting.
*/ | Set a List of sort orders in the query options | withSortOrders | {
"repo_name": "omkarudipi/java-client-api",
"path": "src/main/java/com/marklogic/client/io/QueryOptionsHandle.java",
"license": "apache-2.0",
"size": 37180
} | [
"com.marklogic.client.admin.config.QueryOptions",
"java.util.Arrays"
] | import com.marklogic.client.admin.config.QueryOptions; import java.util.Arrays; | import com.marklogic.client.admin.config.*; import java.util.*; | [
"com.marklogic.client",
"java.util"
] | com.marklogic.client; java.util; | 1,621,930 |
private void maybeReportBepTransports(PositionAwareAnsiTerminalWriter terminalWriter)
throws IOException {
if (!buildComplete || bepOpenTransports.isEmpty()) {
return;
}
long sinceSeconds =
MILLISECONDS.toSeconds(clock.currentTimeMillis() - bepTransportClosingStartTimeMillis);
if (sinceSeconds == 0) {
// Special case for when bazel was interrupted, in which case we don't want to have
// a BEP upload message.
return;
}
int count = bepOpenTransports.size();
// Can just use targetWidth, because we always write to a new line
int maxWidth = targetWidth;
String waitMessage = "Waiting for build events upload: ";
String name = bepOpenTransports.iterator().next().name();
String line = waitMessage + name + " " + sinceSeconds + "s";
if (count == 1 && line.length() <= maxWidth) {
terminalWriter.newline().append(line);
} else if (count == 1) {
waitMessage = "Waiting for: ";
String waitSecs = " " + sinceSeconds + "s";
int maxNameWidth = maxWidth - waitMessage.length() - waitSecs.length();
terminalWriter.newline().append(waitMessage + shortenedString(name, maxNameWidth) + waitSecs);
} else {
terminalWriter.newline().append(waitMessage + sinceSeconds + "s");
for (BuildEventTransport transport : bepOpenTransports) {
name = " " + transport.name();
terminalWriter.newline().append(shortenedString(name, maxWidth));
}
}
} | void function(PositionAwareAnsiTerminalWriter terminalWriter) throws IOException { if (!buildComplete bepOpenTransports.isEmpty()) { return; } long sinceSeconds = MILLISECONDS.toSeconds(clock.currentTimeMillis() - bepTransportClosingStartTimeMillis); if (sinceSeconds == 0) { return; } int count = bepOpenTransports.size(); int maxWidth = targetWidth; String waitMessage = STR; String name = bepOpenTransports.iterator().next().name(); String line = waitMessage + name + " " + sinceSeconds + "s"; if (count == 1 && line.length() <= maxWidth) { terminalWriter.newline().append(line); } else if (count == 1) { waitMessage = STR; String waitSecs = " " + sinceSeconds + "s"; int maxNameWidth = maxWidth - waitMessage.length() - waitSecs.length(); terminalWriter.newline().append(waitMessage + shortenedString(name, maxNameWidth) + waitSecs); } else { terminalWriter.newline().append(waitMessage + sinceSeconds + "s"); for (BuildEventTransport transport : bepOpenTransports) { name = " " + transport.name(); terminalWriter.newline().append(shortenedString(name, maxWidth)); } } } | /**
* Display any BEP transports that are still open after the build. Most likely, because
* uploading build events takes longer than the build itself.
*/ | Display any BEP transports that are still open after the build. Most likely, because uploading build events takes longer than the build itself | maybeReportBepTransports | {
"repo_name": "juhalindfors/bazel-patches",
"path": "src/main/java/com/google/devtools/build/lib/runtime/ExperimentalStateTracker.java",
"license": "apache-2.0",
"size": 29135
} | [
"com.google.devtools.build.lib.buildeventstream.BuildEventTransport",
"com.google.devtools.build.lib.util.io.PositionAwareAnsiTerminalWriter",
"java.io.IOException",
"java.util.concurrent.TimeUnit"
] | import com.google.devtools.build.lib.buildeventstream.BuildEventTransport; import com.google.devtools.build.lib.util.io.PositionAwareAnsiTerminalWriter; import java.io.IOException; import java.util.concurrent.TimeUnit; | import com.google.devtools.build.lib.buildeventstream.*; import com.google.devtools.build.lib.util.io.*; import java.io.*; import java.util.concurrent.*; | [
"com.google.devtools",
"java.io",
"java.util"
] | com.google.devtools; java.io; java.util; | 2,765,329 |
public void handleRequest(Exchange exchange);
| void function(Exchange exchange); | /**
* Handles the request from the specified exchange.
*
* @param exchange the exchange with the request
*/ | Handles the request from the specified exchange | handleRequest | {
"repo_name": "mkovatsc/Californium",
"path": "californium/src/main/java/ch/ethz/inf/vs/californium/server/resources/Resource.java",
"license": "bsd-3-clause",
"size": 10205
} | [
"ch.ethz.inf.vs.californium.network.Exchange"
] | import ch.ethz.inf.vs.californium.network.Exchange; | import ch.ethz.inf.vs.californium.network.*; | [
"ch.ethz.inf"
] | ch.ethz.inf; | 431,741 |
OptionalLong findFirst(); | OptionalLong findFirst(); | /**
* Returns an {@link OptionalLong} describing the first element of this
* stream, or an empty {@code OptionalLong} if the stream is empty. If the
* stream has no encounter order, then any element may be returned.
*
* <p>This is a <a href="package-summary.html#StreamOps">short-circuiting
* terminal operation</a>.
*
* @return an {@code OptionalLong} describing the first element of this
* stream, or an empty {@code OptionalLong} if the stream is empty
*/ | Returns an <code>OptionalLong</code> describing the first element of this stream, or an empty OptionalLong if the stream is empty. If the stream has no encounter order, then any element may be returned. This is a short-circuiting terminal operation | findFirst | {
"repo_name": "YouDiSN/OpenJDK-Research",
"path": "jdk9/jdk/src/java.base/share/classes/java/util/stream/LongStream.java",
"license": "gpl-2.0",
"size": 50832
} | [
"java.util.OptionalLong"
] | import java.util.OptionalLong; | import java.util.*; | [
"java.util"
] | java.util; | 337,965 |
public void moveSheep(Sheep sheep) {
// The area of the sheed den.
int x = Rand.randUniform(SHEEP_PEN_X, SHEEP_PEN_X + SHEEP_PEN_WIDTH - 1);
int y = Rand.randUniform(SHEEP_PEN_Y, SHEEP_PEN_Y + SHEEP_PEN_HEIGHT - 1);
StendhalRPZone zone = sheep.getZone();
List<Sheep> oldSheep = sheepInPen(zone);
killWolves(zone);
if (oldSheep.size() >= MAX_SHEEP_IN_PEN) {
// Sato sells the oldest sheep
zone.remove(oldSheep.get(0));
}
if (!StendhalRPAction.placeat(zone, sheep, x, y)) {
// there was no room for the sheep. Simply eat it
sheep.getZone().remove(sheep);
}
}
} | void function(Sheep sheep) { int x = Rand.randUniform(SHEEP_PEN_X, SHEEP_PEN_X + SHEEP_PEN_WIDTH - 1); int y = Rand.randUniform(SHEEP_PEN_Y, SHEEP_PEN_Y + SHEEP_PEN_HEIGHT - 1); StendhalRPZone zone = sheep.getZone(); List<Sheep> oldSheep = sheepInPen(zone); killWolves(zone); if (oldSheep.size() >= MAX_SHEEP_IN_PEN) { zone.remove(oldSheep.get(0)); } if (!StendhalRPAction.placeat(zone, sheep, x, y)) { sheep.getZone().remove(sheep); } } } | /**
* Move a bought sheep to the den if there's space, or remove it
* from the zone otherwise. Remove old sheep if there'd be more
* than <code>MAX_SHEEP_IN_PEN</code> after the addition.
*
* @param sheep the sheep to be moved
*/ | Move a bought sheep to the den if there's space, or remove it from the zone otherwise. Remove old sheep if there'd be more than <code>MAX_SHEEP_IN_PEN</code> after the addition | moveSheep | {
"repo_name": "nhnb/stendhal",
"path": "src/games/stendhal/server/maps/semos/city/SheepBuyerNPC.java",
"license": "gpl-2.0",
"size": 7797
} | [
"games.stendhal.common.Rand",
"games.stendhal.server.core.engine.StendhalRPZone",
"games.stendhal.server.core.rp.StendhalRPAction",
"games.stendhal.server.entity.creature.Sheep",
"java.util.List"
] | import games.stendhal.common.Rand; import games.stendhal.server.core.engine.StendhalRPZone; import games.stendhal.server.core.rp.StendhalRPAction; import games.stendhal.server.entity.creature.Sheep; import java.util.List; | import games.stendhal.common.*; import games.stendhal.server.core.engine.*; import games.stendhal.server.core.rp.*; import games.stendhal.server.entity.creature.*; import java.util.*; | [
"games.stendhal.common",
"games.stendhal.server",
"java.util"
] | games.stendhal.common; games.stendhal.server; java.util; | 814,011 |
long getWriteBytes(WritableByteChannel channel); | long getWriteBytes(WritableByteChannel channel); | /**
* Given a manager-specific output stream, return the current write position.
* Used to report total write bytes.
*
* @param channel created by the file manager
* @return
*/ | Given a manager-specific output stream, return the current write position. Used to report total write bytes | getWriteBytes | {
"repo_name": "parthchandra/drill",
"path": "exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/spill/SpillSet.java",
"license": "apache-2.0",
"size": 16912
} | [
"java.nio.channels.WritableByteChannel"
] | import java.nio.channels.WritableByteChannel; | import java.nio.channels.*; | [
"java.nio"
] | java.nio; | 251,642 |
public int createNewPage(String parentId, String name, String type, String templateId, Map tree, IWUserContext creatorContext) {
return createNewPage(parentId, name, type, templateId, tree, creatorContext, null);
} | int function(String parentId, String name, String type, String templateId, Map tree, IWUserContext creatorContext) { return createNewPage(parentId, name, type, templateId, tree, creatorContext, null); } | /**
* Creates a new IBPage. Sets its name and type and stores it to the database.
* If the parentId and the tree parameter are valid it also stores the page in
* the cached IWContext tree.
*
* @param parentId The id of the parent of this page
* @param name The name this page is to be given
* @param type The type of the page, ie. PAGE, TEMPLATE, DRAFT, ...
* @param templateId The id of the page this page is extending, if any
* @param tree A map of PageTreeNode objects representing the whole page tree
* @param creatorContext the context of the User that created the page
*
* @return The id of the new IBPage
*/ | Creates a new IBPage. Sets its name and type and stores it to the database. If the parentId and the tree parameter are valid it also stores the page in the cached IWContext tree | createNewPage | {
"repo_name": "idega/com.idega.builder",
"path": "src/java/com/idega/builder/business/IBPageHelper.java",
"license": "gpl-3.0",
"size": 43533
} | [
"com.idega.idegaweb.IWUserContext",
"java.util.Map"
] | import com.idega.idegaweb.IWUserContext; import java.util.Map; | import com.idega.idegaweb.*; import java.util.*; | [
"com.idega.idegaweb",
"java.util"
] | com.idega.idegaweb; java.util; | 2,622,602 |
public final int id(int n) throws IOException {
return hitDoc(n).id;
}
// public Iterator iterator() {
// return new HitIterator(this);
// } | final int function(int n) throws IOException { return hitDoc(n).id; } | /** Returns the id for the n<sup>th</sup> document in this set.
* Note that ids may change when the index changes, so you cannot
* rely on the id to be stable.
*/ | Returns the id for the nth document in this set. Note that ids may change when the index changes, so you cannot rely on the id to be stable | id | {
"repo_name": "apatry/neo4j-lucene4-index",
"path": "src/main/java/org/neo4j/index/impl/lucene/Hits.java",
"license": "gpl-3.0",
"size": 10011
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,294,275 |
protected final CstType getDefiner() {
return definer;
} | final CstType function() { return definer; } | /**
* Gets the class file being defined.
*
* @return {@code non-null;} the class
*/ | Gets the class file being defined | getDefiner | {
"repo_name": "raviagarwal7/buck",
"path": "third-party/java/dx/src/com/android/dx/cf/direct/MemberListParser.java",
"license": "apache-2.0",
"size": 8192
} | [
"com.android.dx.rop.cst.CstType"
] | import com.android.dx.rop.cst.CstType; | import com.android.dx.rop.cst.*; | [
"com.android.dx"
] | com.android.dx; | 2,265,552 |
public Class<? extends BusinessObject> getOverrideLookupClass() {
return overrideLookupClass;
} | Class<? extends BusinessObject> function() { return overrideLookupClass; } | /**
* Gets the overrideLookupClass attribute.
* @return Returns the overrideLookupClass.
*/ | Gets the overrideLookupClass attribute | getOverrideLookupClass | {
"repo_name": "bhutchinson/rice",
"path": "rice-middleware/kns/src/main/java/org/kuali/rice/kns/datadictionary/MaintainableFieldDefinition.java",
"license": "apache-2.0",
"size": 14833
} | [
"org.kuali.rice.krad.bo.BusinessObject"
] | import org.kuali.rice.krad.bo.BusinessObject; | import org.kuali.rice.krad.bo.*; | [
"org.kuali.rice"
] | org.kuali.rice; | 1,932,661 |
public Cookie[] getCookiesForUrl(HttpUrl url) {
return _frameworkModel.getCookiesForUrl(url);
}
| Cookie[] function(HttpUrl url) { return _frameworkModel.getCookiesForUrl(url); } | /**
* returns an array of cookies that would be applicable to a request sent to the url.
* @param url the url
* @return an array of cookies, or a zero length array if there are none applicable.
*/ | returns an array of cookies that would be applicable to a request sent to the url | getCookiesForUrl | {
"repo_name": "kattakum/OWASP-WebScarab",
"path": "src/org/owasp/webscarab/plugin/FrameworkModelWrapper.java",
"license": "gpl-2.0",
"size": 8066
} | [
"org.owasp.webscarab.model.Cookie",
"org.owasp.webscarab.model.HttpUrl"
] | import org.owasp.webscarab.model.Cookie; import org.owasp.webscarab.model.HttpUrl; | import org.owasp.webscarab.model.*; | [
"org.owasp.webscarab"
] | org.owasp.webscarab; | 2,515,470 |
public Collection<UnmarkedDestructorMatch> getAllMatches(final Operation pOp) {
return rawGetAllMatches(new Object[]{pOp});
}
| Collection<UnmarkedDestructorMatch> function(final Operation pOp) { return rawGetAllMatches(new Object[]{pOp}); } | /**
* Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
* @param pOp the fixed value of pattern parameter op, or null if not bound.
* @return matches represented as a UnmarkedDestructorMatch object.
*
*/ | Returns the set of all matches of the pattern that conform to the given fixed values of some parameters | getAllMatches | {
"repo_name": "ELTE-Soft/xUML-RT-Executor",
"path": "plugins/hu.eltesoft.modelexecution.validation/src-gen/hu/eltesoft/modelexecution/validation/UnmarkedDestructorMatcher.java",
"license": "epl-1.0",
"size": 10286
} | [
"hu.eltesoft.modelexecution.validation.UnmarkedDestructorMatch",
"java.util.Collection",
"org.eclipse.uml2.uml.Operation"
] | import hu.eltesoft.modelexecution.validation.UnmarkedDestructorMatch; import java.util.Collection; import org.eclipse.uml2.uml.Operation; | import hu.eltesoft.modelexecution.validation.*; import java.util.*; import org.eclipse.uml2.uml.*; | [
"hu.eltesoft.modelexecution",
"java.util",
"org.eclipse.uml2"
] | hu.eltesoft.modelexecution; java.util; org.eclipse.uml2; | 1,958,023 |
@Test
public void testGetFieldType () {
assertEquals(short.class, parser.getFieldType());
}
| void function () { assertEquals(short.class, parser.getFieldType()); } | /**
* Test method for {@link ShortParser#getFieldType()}.
*/ | Test method for <code>ShortParser#getFieldType()</code> | testGetFieldType | {
"repo_name": "AlexRNL/Commons",
"path": "src/test/java/com/alexrnl/commons/arguments/parsers/ShortParserTest.java",
"license": "bsd-3-clause",
"size": 1458
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,359,205 |
return Container.getComp(GenKnowledgeEditUsersEntity.class);
}
public GenKnowledgeEditUsersEntity() {
super();
}
public GenKnowledgeEditUsersEntity(Long knowledgeId, Integer userId) {
super();
this.knowledgeId = knowledgeId;
this.userId = userId;
}
private Long knowledgeId;
private Integer userId;
private Integer insertUser;
private Timestamp insertDatetime;
private Integer updateUser;
private Timestamp updateDatetime;
private Integer deleteFlag; | return Container.getComp(GenKnowledgeEditUsersEntity.class); } public GenKnowledgeEditUsersEntity() { super(); } public GenKnowledgeEditUsersEntity(Long knowledgeId, Integer userId) { super(); this.knowledgeId = knowledgeId; this.userId = userId; } private Long knowledgeId; private Integer userId; private Integer insertUser; private Timestamp insertDatetime; private Integer updateUser; private Timestamp updateDatetime; private Integer deleteFlag; | /**
* Get instance from DI container.
* @return instance
*/ | Get instance from DI container | get | {
"repo_name": "support-project/knowledge",
"path": "src/main/java/org/support/project/knowledge/entity/gen/GenKnowledgeEditUsersEntity.java",
"license": "apache-2.0",
"size": 9909
} | [
"java.sql.Timestamp",
"org.support.project.di.Container"
] | import java.sql.Timestamp; import org.support.project.di.Container; | import java.sql.*; import org.support.project.di.*; | [
"java.sql",
"org.support.project"
] | java.sql; org.support.project; | 67,429 |
Color color = CSSUtilities.convertLightingColor(filterElement, ctx);
for (Node n = filterElement.getFirstChild();
n != null;
n = n.getNextSibling()) {
if (n.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
Element e = (Element)n;
Bridge bridge = ctx.getBridge(e);
if (bridge == null ||
!(bridge instanceof AbstractSVGLightElementBridge)) {
continue;
}
return ((AbstractSVGLightElementBridge)bridge).createLight
(ctx, filterElement, e, color);
}
return null;
} | Color color = CSSUtilities.convertLightingColor(filterElement, ctx); for (Node n = filterElement.getFirstChild(); n != null; n = n.getNextSibling()) { if (n.getNodeType() != Node.ELEMENT_NODE) { continue; } Element e = (Element)n; Bridge bridge = ctx.getBridge(e); if (bridge == null !(bridge instanceof AbstractSVGLightElementBridge)) { continue; } return ((AbstractSVGLightElementBridge)bridge).createLight (ctx, filterElement, e, color); } return null; } | /**
* Returns the light from the specified lighting filter primitive
* element or null if any
*
* @param filterElement the lighting filter primitive element
* @param ctx the bridge context
*/ | Returns the light from the specified lighting filter primitive element or null if any | extractLight | {
"repo_name": "sflyphotobooks/crp-batik",
"path": "sources/org/apache/batik/bridge/AbstractSVGLightingElementBridge.java",
"license": "apache-2.0",
"size": 10270
} | [
"java.awt.Color",
"org.w3c.dom.Element",
"org.w3c.dom.Node"
] | import java.awt.Color; import org.w3c.dom.Element; import org.w3c.dom.Node; | import java.awt.*; import org.w3c.dom.*; | [
"java.awt",
"org.w3c.dom"
] | java.awt; org.w3c.dom; | 2,039,222 |
public void setRequiredRoots(IVersionedId[] value); | void function(IVersionedId[] value); | /**
* Set the list of roots to install
*
* @param value the set of roots to install
*/ | Set the list of roots to install | setRequiredRoots | {
"repo_name": "MentorEmbedded/p2-installer",
"path": "plugins/com.codesourcery.installer/src/com/codesourcery/installer/IInstallDescription.java",
"license": "epl-1.0",
"size": 26818
} | [
"org.eclipse.equinox.p2.metadata.IVersionedId"
] | import org.eclipse.equinox.p2.metadata.IVersionedId; | import org.eclipse.equinox.p2.metadata.*; | [
"org.eclipse.equinox"
] | org.eclipse.equinox; | 942,059 |
public static TaxaList getAllIds(TaxaList[] groups) {
if ((groups == null) || (groups.length == 0)) {
return null;
}
TreeSet<Taxon> allIds = new TreeSet<Taxon>();
for (int i = 0; i < groups.length; i++) {
int n = groups[i].numberOfTaxa();
for (int j = 0; j < n; j++) {
allIds.add(groups[i].get(j));
}
}
return new TaxaListBuilder().addAll(allIds).build();
}
| static TaxaList function(TaxaList[] groups) { if ((groups == null) (groups.length == 0)) { return null; } TreeSet<Taxon> allIds = new TreeSet<Taxon>(); for (int i = 0; i < groups.length; i++) { int n = groups[i].numberOfTaxa(); for (int j = 0; j < n; j++) { allIds.add(groups[i].get(j)); } } return new TaxaListBuilder().addAll(allIds).build(); } | /**
* Union joins the specified groups.
*
* @param groups groups to join.
* @return The ids from the union join, sorted in ascending order
* TODO move to Taxalist builder
*/ | Union joins the specified groups | getAllIds | {
"repo_name": "yzhnasa/TASSEL-iRods",
"path": "src/net/maizegenetics/taxa/IdGroupUtils.java",
"license": "mit",
"size": 7971
} | [
"java.util.TreeSet"
] | import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,831,309 |
public ProcessingStudiesService getProcessingStudiesService() {
return processingStudiesService;
} | ProcessingStudiesService function() { return processingStudiesService; } | /**
* <p>
* Getter for the field <code>processingStudiesService</code>.
* </p>
*
* @return a {@link net.sourceforge.seqware.common.business.ProcessingStudiesService} object.
*/ | Getter for the field <code>processingStudiesService</code>. | getProcessingStudiesService | {
"repo_name": "SeqWare/seqware",
"path": "seqware-common/src/main/java/net/sourceforge/seqware/common/ContextImpl.java",
"license": "gpl-3.0",
"size": 25262
} | [
"net.sourceforge.seqware.common.business.ProcessingStudiesService"
] | import net.sourceforge.seqware.common.business.ProcessingStudiesService; | import net.sourceforge.seqware.common.business.*; | [
"net.sourceforge.seqware"
] | net.sourceforge.seqware; | 604,915 |
public void writeHeader(List<String> comments) {
print("!gaf-version: 2.0\n");
if (comments != null && !comments.isEmpty()) {
for (String comment : comments) {
print("! "+comment+"\n");
}
}
} | void function(List<String> comments) { print(STR); if (comments != null && !comments.isEmpty()) { for (String comment : comments) { print(STR+comment+"\n"); } } } | /**
* Write a header for a GAF, header comments are optional.
*
* @param comments
*/ | Write a header for a GAF, header comments are optional | writeHeader | {
"repo_name": "fbastian/owltools",
"path": "OWLTools-Annotation/src/main/java/owltools/gaf/io/AbstractGafWriter.java",
"license": "bsd-3-clause",
"size": 3952
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,008,004 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.