method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
public ExecutorService executorService(ClusterGroup grp); | ExecutorService function(ClusterGroup grp); | /**
* Creates a new {@link ExecutorService} which will execute all submitted
* {@link Callable} and {@link Runnable} jobs on nodes in the specified cluster group.
* This essentially creates a <b><i>Distributed Thread Pool</i></b> that can be used as a
* replacement for local thread pools.
*
* @param grp Cluster group.
* @return {@link ExecutorService} which will execute jobs on nodes in given cluster group.
*/ | Creates a new <code>ExecutorService</code> which will execute all submitted <code>Callable</code> and <code>Runnable</code> jobs on nodes in the specified cluster group. This essentially creates a Distributed Thread Pool that can be used as a replacement for local thread pools | executorService | {
"repo_name": "mcherkasov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/Ignite.java",
"license": "apache-2.0",
"size": 27486
} | [
"java.util.concurrent.ExecutorService",
"org.apache.ignite.cluster.ClusterGroup"
] | import java.util.concurrent.ExecutorService; import org.apache.ignite.cluster.ClusterGroup; | import java.util.concurrent.*; import org.apache.ignite.cluster.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,907,710 |
EAttribute getBilateralTransaction_PurchaseTimeMax(); | EAttribute getBilateralTransaction_PurchaseTimeMax(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61970.Informative.MarketOperations.BilateralTransaction#getPurchaseTimeMax <em>Purchase Time Max</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Purchase Time Max</em>'.
* @see CIM.IEC61970.Informative.MarketOperations.BilateralTransaction#getPurchaseTimeMax()
* @see #getBilateralTransaction()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61970.Informative.MarketOperations.BilateralTransaction#getPurchaseTimeMax Purchase Time Max</code>'. | getBilateralTransaction_PurchaseTimeMax | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Informative/MarketOperations/MarketOperationsPackage.java",
"license": "mit",
"size": 688294
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,432,003 |
public int compareNextTo(Composite composite) throws IOException; | int function(Composite composite) throws IOException; | /**
* Compare the next name to read to the provided Composite.
* This does not consume the next name.
*/ | Compare the next name to read to the provided Composite. This does not consume the next name | compareNextTo | {
"repo_name": "lynchlee/play-jmx",
"path": "src/main/java/org/apache/cassandra/db/composites/CellNameType.java",
"license": "apache-2.0",
"size": 8400
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 654,795 |
@Test
public void readsFromFile() throws IOException {
final File file = new File(this.folder.newFolder(), "readable");
final String content = "read";
Files.write(content.getBytes(StandardCharsets.UTF_8), file);
final ByteArrayOutputStream stream = new ByteArrayOutputStream();
new MkDoc(file, "", "").read(stream);
MatcherAssert.assertThat(
new String(stream.toByteArray(), StandardCharsets.UTF_8),
Matchers.equalTo(content)
);
} | void function() throws IOException { final File file = new File(this.folder.newFolder(), STR); final String content = "read"; Files.write(content.getBytes(StandardCharsets.UTF_8), file); final ByteArrayOutputStream stream = new ByteArrayOutputStream(); new MkDoc(file, STR").read(stream); MatcherAssert.assertThat( new String(stream.toByteArray(), StandardCharsets.UTF_8), Matchers.equalTo(content) ); } | /**
* MkDoc can read from file.
* @throws IOException In case of error
*/ | MkDoc can read from file | readsFromFile | {
"repo_name": "antonini/nerodesk",
"path": "src/test/java/com/nerodesk/om/mock/MkDocTest.java",
"license": "bsd-3-clause",
"size": 6084
} | [
"com.google.common.io.Files",
"java.io.ByteArrayOutputStream",
"java.io.File",
"java.io.IOException",
"java.nio.charset.StandardCharsets",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import com.google.common.io.Files; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.nio.charset.StandardCharsets; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import com.google.common.io.*; import java.io.*; import java.nio.charset.*; import org.hamcrest.*; | [
"com.google.common",
"java.io",
"java.nio",
"org.hamcrest"
] | com.google.common; java.io; java.nio; org.hamcrest; | 2,912,889 |
public void setRefEntityTagValue(String refEntityTagValue)
throws JNCException {
setRefEntityTagValue(new YangString(refEntityTagValue));
} | void function(String refEntityTagValue) throws JNCException { setRefEntityTagValue(new YangString(refEntityTagValue)); } | /**
* Sets the value for child leaf "ref-entity-tag",
* using a String value.
* @param refEntityTagValue used during instantiation.
*/ | Sets the value for child leaf "ref-entity-tag", using a String value | setRefEntityTagValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/statistics/lteSm/SessionAct.java",
"license": "apache-2.0",
"size": 11376
} | [
"com.tailf.jnc.YangString"
] | import com.tailf.jnc.YangString; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 1,781,238 |
protected static XPathExpression evaluatePlaceholders(XPathExpression expression, Context context, EventTracker tracker)
{
if (context == null)
{
return expression;
}
List<Segment> segments = expression.getSegments();
List<Segment> new_segments = new LinkedList<Segment>();
for (Segment seg : segments)
{
if (seg instanceof TextSegment)
{
new_segments.add(seg);
continue;
}
String seg_name = seg.getElementName();
List<Predicate> new_predicates = new LinkedList<Predicate>();
Collection<Predicate> preds = seg.getPredicates();
if (preds != null)
{
for (Predicate pred : seg.getPredicates())
{
if (pred instanceof Equality)
{
Equality eq = (Equality) pred;
String right = eq.getRight();
String new_right = right;
if (right.startsWith("$"))
{
// This is a placeholder
String placeholder_name = right.substring(1);
if (context.containsKey(placeholder_name))
{
Object value = context.get(placeholder_name);
if (value instanceof String)
{
new_right = (String) value;
}
else if (value instanceof TextElement)
{
new_right = ((TextElement) value).getText();
}
else
{
new_right = value.toString();
}
}
}
Equality new_eq = new Equality(eq.getLeft(), new_right);
new_predicates.add(new_eq);
}
else
{
new_predicates.add(pred);
}
}
}
Segment new_seg = new Segment(seg_name, new_predicates);
new_segments.add(new_seg);
}
XPathExpression exp = new XPathExpression(new_segments);
return exp;
} | static XPathExpression function(XPathExpression expression, Context context, EventTracker tracker) { if (context == null) { return expression; } List<Segment> segments = expression.getSegments(); List<Segment> new_segments = new LinkedList<Segment>(); for (Segment seg : segments) { if (seg instanceof TextSegment) { new_segments.add(seg); continue; } String seg_name = seg.getElementName(); List<Predicate> new_predicates = new LinkedList<Predicate>(); Collection<Predicate> preds = seg.getPredicates(); if (preds != null) { for (Predicate pred : seg.getPredicates()) { if (pred instanceof Equality) { Equality eq = (Equality) pred; String right = eq.getRight(); String new_right = right; if (right.startsWith("$")) { String placeholder_name = right.substring(1); if (context.containsKey(placeholder_name)) { Object value = context.get(placeholder_name); if (value instanceof String) { new_right = (String) value; } else if (value instanceof TextElement) { new_right = ((TextElement) value).getText(); } else { new_right = value.toString(); } } } Equality new_eq = new Equality(eq.getLeft(), new_right); new_predicates.add(new_eq); } else { new_predicates.add(pred); } } } Segment new_seg = new Segment(seg_name, new_predicates); new_segments.add(new_seg); } XPathExpression exp = new XPathExpression(new_segments); return exp; } | /**
* Replaces all occurrences of placeholders in an XPath expression by
* concrete values fetched from some context. Placeholders are
* currently only supported in binary predicates, and are identified
* by a "$" symbol followed by some name
* @param expression The original expression
* @param context The context
* @return The new expression where placeholders have been replaced
*/ | Replaces all occurrences of placeholders in an XPath expression by concrete values fetched from some context. Placeholders are currently only supported in binary predicates, and are identified by a "$" symbol followed by some name | evaluatePlaceholders | {
"repo_name": "liflab/beepbeep-3-palettes",
"path": "Xml/src/ca/uqac/lif/cep/xml/XPathFunction.java",
"license": "lgpl-3.0",
"size": 5365
} | [
"ca.uqac.lif.cep.Context",
"ca.uqac.lif.cep.EventTracker",
"ca.uqac.lif.xml.Equality",
"ca.uqac.lif.xml.Predicate",
"ca.uqac.lif.xml.Segment",
"ca.uqac.lif.xml.TextElement",
"ca.uqac.lif.xml.TextSegment",
"ca.uqac.lif.xml.XPathExpression",
"java.util.Collection",
"java.util.LinkedList",
"java.ut... | import ca.uqac.lif.cep.Context; import ca.uqac.lif.cep.EventTracker; import ca.uqac.lif.xml.Equality; import ca.uqac.lif.xml.Predicate; import ca.uqac.lif.xml.Segment; import ca.uqac.lif.xml.TextElement; import ca.uqac.lif.xml.TextSegment; import ca.uqac.lif.xml.XPathExpression; import java.util.Collection; import java.util.LinkedList; import java.util.List; | import ca.uqac.lif.cep.*; import ca.uqac.lif.xml.*; import java.util.*; | [
"ca.uqac.lif",
"java.util"
] | ca.uqac.lif; java.util; | 1,790,025 |
public EntityRole getClosedListEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) {
return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body();
} | EntityRole function(UUID appId, String versionId, UUID entityId, UUID roleId) { return getClosedListEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); } | /**
* Get one role for a given list entity in a version of the application.
*
* @param appId The application ID.
* @param versionId The version ID.
* @param entityId entity ID.
* @param roleId entity role ID.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @throws ErrorResponseException thrown if the request is rejected by server
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the EntityRole object if successful.
*/ | Get one role for a given list entity in a version of the application | getClosedListEntityRole | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/cognitiveservices/ms-azure-cs-luis-authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java",
"license": "mit",
"size": 818917
} | [
"com.microsoft.azure.cognitiveservices.language.luis.authoring.models.EntityRole"
] | import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.EntityRole; | import com.microsoft.azure.cognitiveservices.language.luis.authoring.models.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 2,213,548 |
public void generateOutput() throws Exception {
ImageIO.write(createBufferedImage(), "bmp", getFile().getAbsoluteFile());
} | void function() throws Exception { ImageIO.write(createBufferedImage(), "bmp", getFile().getAbsoluteFile()); } | /**
* generates the actual output.
*
* @throws Exception if something goes wrong
*/ | generates the actual output | generateOutput | {
"repo_name": "automenta/adams-core",
"path": "src/main/java/adams/gui/print/BMPWriter.java",
"license": "gpl-3.0",
"size": 3612
} | [
"javax.imageio.ImageIO"
] | import javax.imageio.ImageIO; | import javax.imageio.*; | [
"javax.imageio"
] | javax.imageio; | 1,275,787 |
void setSchemeData(Scheme s) {
for(Map.Entry<String, String> entry : s.Keywords.entrySet()) {
keywords.add(String.valueOf(entry.getKey()));
keyText.setText(keyText.getText() + entry.getValue() + " ");
}
description = s.Description;
descText.setText(description);
rating = (float) s.Rating;
rateBar.setRating(rating);
ratingAmount = s.RateAmount;
if (userId.equals(s.Author)) {
rateEditButton.setText("Edit");
} else if (!rateEditButton.getText().equals("Rate Again")) {
rateEditButton.setText("Rate");
}
if (s.Users != null) {
for (Map.Entry<String, Double> entry : s.Users.entrySet()) {
if (entry.getKey().equals(userId)) {
currentRating = Float.parseFloat(String.valueOf(entry.getValue()));
rateEditButton.setText("Rate Again");
}
users.put(entry.getKey(), String.valueOf(entry.getValue()));
}
}
} | void setSchemeData(Scheme s) { for(Map.Entry<String, String> entry : s.Keywords.entrySet()) { keywords.add(String.valueOf(entry.getKey())); keyText.setText(keyText.getText() + entry.getValue() + " "); } description = s.Description; descText.setText(description); rating = (float) s.Rating; rateBar.setRating(rating); ratingAmount = s.RateAmount; if (userId.equals(s.Author)) { rateEditButton.setText("Edit"); } else if (!rateEditButton.getText().equals(STR)) { rateEditButton.setText("Rate"); } if (s.Users != null) { for (Map.Entry<String, Double> entry : s.Users.entrySet()) { if (entry.getKey().equals(userId)) { currentRating = Float.parseFloat(String.valueOf(entry.getValue())); rateEditButton.setText(STR); } users.put(entry.getKey(), String.valueOf(entry.getValue())); } } } | /**
* Method that retrieves the data of the scheme object and sets the text accordingly.
*
* @param s Scheme object that contains all the data.
*/ | Method that retrieves the data of the scheme object and sets the text accordingly | setSchemeData | {
"repo_name": "Lumpsum/Programmeerproject",
"path": "app/src/main/java/mprog/nl/programmeerproject/Activities/SpecificSchemeActivity.java",
"license": "mit",
"size": 9872
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,941,918 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
String resourceGroupName,
String serverName,
String virtualNetworkRuleName,
VirtualNetworkRuleInner parameters) {
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
if (resourceGroupName == null) {
return Mono
.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));
}
if (serverName == null) {
return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null."));
}
if (this.client.getSubscriptionId() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getSubscriptionId() is required and cannot be null."));
}
if (virtualNetworkRuleName == null) {
return Mono
.error(
new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null."));
}
if (parameters == null) {
return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));
} else {
parameters.validate();
}
final String apiVersion = "2017-12-01";
final String accept = "application/json";
return FluxUtil
.withContext(
context ->
service
.createOrUpdate(
this.client.getEndpoint(),
resourceGroupName,
serverName,
this.client.getSubscriptionId(),
apiVersion,
virtualNetworkRuleName,
parameters,
accept,
context))
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Response<Flux<ByteBuffer>>> function( String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (resourceGroupName == null) { return Mono .error(new IllegalArgumentException(STR)); } if (serverName == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getSubscriptionId() == null) { return Mono .error( new IllegalArgumentException( STR)); } if (virtualNetworkRuleName == null) { return Mono .error( new IllegalArgumentException(STR)); } if (parameters == null) { return Mono.error(new IllegalArgumentException(STR)); } else { parameters.validate(); } final String apiVersion = STR; final String accept = STR; return FluxUtil .withContext( context -> service .createOrUpdate( this.client.getEndpoint(), resourceGroupName, serverName, this.client.getSubscriptionId(), apiVersion, virtualNetworkRuleName, parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } | /**
* Creates or updates an existing virtual network rule.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param serverName The name of the server.
* @param virtualNetworkRuleName The name of the virtual network rule.
* @param parameters The requested virtual Network Rule Resource state.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}.
*/ | Creates or updates an existing virtual network rule | createOrUpdateWithResponseAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mysql/azure-resourcemanager-mysql/src/main/java/com/azure/resourcemanager/mysql/implementation/VirtualNetworkRulesClientImpl.java",
"license": "mit",
"size": 57505
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.FluxUtil",
"com.azure.resourcemanager.mysql.fluent.models.VirtualNetworkRuleInner",
"java.nio.ByteBuffer"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.FluxUtil; import com.azure.resourcemanager.mysql.fluent.models.VirtualNetworkRuleInner; import java.nio.ByteBuffer; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.mysql.fluent.models.*; import java.nio.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.nio"
] | com.azure.core; com.azure.resourcemanager; java.nio; | 1,809,775 |
public void evaluateEventForSkipTillAny(Event e, Run r) throws CloneNotSupportedException{
boolean checkResult = true;
checkResult = this.checkPredicate(e, r);// check predicate
if(checkResult){ // the predicate if ok.
checkResult = this.checkTimeWindow(e, r); // the time window is ok
if(checkResult){// predicate and time window are ok
this.buffer.bufferEvent(e);// add the event to buffer
int oldState = 0;
int newState = 0;
Run newRun = this.cloneRun(r); // clone this run
oldState = newRun.getCurrentState();
newRun.addEvent(e); // add the event to this run
newState = newRun.getCurrentState();
if(oldState != newState){
this.activeRuns.add(newRun);
}else{//kleene closure
if(newRun.isFull){
//check match and output match
if(newRun.checkMatch()){
this.outputMatch(new Match(newRun, this.nfa, this.buffer));
Profiling.totalRunLifeTime += (System.nanoTime() - r.getLifeTimeBegin());
}
}else{
//check proceed
if(this.checkProceed(newRun)){
Run newerRun = this.cloneRun(newRun);
this.activeRuns.add(newRun);
newerRun.proceed();
if(newerRun.isComplete()){
this.outputMatch(new Match(r, this.nfa, this.buffer));
Profiling.totalRunLifeTime += (System.nanoTime() - r.getLifeTimeBegin());
}else {
this.activeRuns.add(newerRun);
}
}
}
}
}else{
this.toDeleteRuns.add(r);
}
}
}
| void function(Event e, Run r) throws CloneNotSupportedException{ boolean checkResult = true; checkResult = this.checkPredicate(e, r); if(checkResult){ checkResult = this.checkTimeWindow(e, r); if(checkResult){ this.buffer.bufferEvent(e); int oldState = 0; int newState = 0; Run newRun = this.cloneRun(r); oldState = newRun.getCurrentState(); newRun.addEvent(e); newState = newRun.getCurrentState(); if(oldState != newState){ this.activeRuns.add(newRun); }else{ if(newRun.isFull){ if(newRun.checkMatch()){ this.outputMatch(new Match(newRun, this.nfa, this.buffer)); Profiling.totalRunLifeTime += (System.nanoTime() - r.getLifeTimeBegin()); } }else{ if(this.checkProceed(newRun)){ Run newerRun = this.cloneRun(newRun); this.activeRuns.add(newRun); newerRun.proceed(); if(newerRun.isComplete()){ this.outputMatch(new Match(r, this.nfa, this.buffer)); Profiling.totalRunLifeTime += (System.nanoTime() - r.getLifeTimeBegin()); }else { this.activeRuns.add(newerRun); } } } } }else{ this.toDeleteRuns.add(r); } } } | /**
* This method evaluates an event against a run, for skip-till-any-match
* @param e The event which is being evaluated.
* @param r The run which the event is being evaluated against.
* @throws CloneNotSupportedException
*/ | This method evaluates an event against a run, for skip-till-any-match | evaluateEventForSkipTillAny | {
"repo_name": "jonyt/sase",
"path": "src/main/java/edu/umass/cs/sase/engine/Engine.java",
"license": "mit",
"size": 43179
} | [
"edu.umass.cs.sase.stream.Event"
] | import edu.umass.cs.sase.stream.Event; | import edu.umass.cs.sase.stream.*; | [
"edu.umass.cs"
] | edu.umass.cs; | 2,756,401 |
T getDef() throws QuickFixException; | T getDef() throws QuickFixException; | /**
* Gets the actual definition described by this descriptor, compiling it if
* necessary, from Aura's definition service.
*
* @return the definition (compiles it if necessary)
* @throws QuickFixException
* if the definition is not found
*/ | Gets the actual definition described by this descriptor, compiling it if necessary, from Aura's definition service | getDef | {
"repo_name": "lhong375/aura",
"path": "aura/src/main/java/org/auraframework/def/DefDescriptor.java",
"license": "apache-2.0",
"size": 6793
} | [
"org.auraframework.throwable.quickfix.QuickFixException"
] | import org.auraframework.throwable.quickfix.QuickFixException; | import org.auraframework.throwable.quickfix.*; | [
"org.auraframework.throwable"
] | org.auraframework.throwable; | 2,534,560 |
public String fromAnnotatedXHTML(String html, String targetSyntaxId)
{
XWikiDocument originalSecurityDocument = setSecurityDocument(createSecurityDocument());
// Save the value of the "is in rendering engine" context property.
Object isInRenderingEngine = this.xcontextProvider.get().get(IS_IN_RENDERING_ENGINE);
try {
// This tells display() methods that we are inside the rendering engine and thus that they can return wiki
// syntax and not HTML syntax (which is needed when outside the rendering engine, i.e. when we're inside
// templates using only Velocity for example).
this.xcontextProvider.get().put(IS_IN_RENDERING_ENGINE, true);
return this.htmlConverter.fromHTML(html, targetSyntaxId);
} catch (Exception e) {
// Return the HTML input in case of an exception.
return html;
} finally {
// Restore the value of the value of the "is in rendering engine" context property.
if (isInRenderingEngine != null) {
this.xcontextProvider.get().put(IS_IN_RENDERING_ENGINE, isInRenderingEngine);
} else {
this.xcontextProvider.get().remove(IS_IN_RENDERING_ENGINE);
}
setSecurityDocument(originalSecurityDocument);
}
} | String function(String html, String targetSyntaxId) { XWikiDocument originalSecurityDocument = setSecurityDocument(createSecurityDocument()); Object isInRenderingEngine = this.xcontextProvider.get().get(IS_IN_RENDERING_ENGINE); try { this.xcontextProvider.get().put(IS_IN_RENDERING_ENGINE, true); return this.htmlConverter.fromHTML(html, targetSyntaxId); } catch (Exception e) { return html; } finally { if (isInRenderingEngine != null) { this.xcontextProvider.get().put(IS_IN_RENDERING_ENGINE, isInRenderingEngine); } else { this.xcontextProvider.get().remove(IS_IN_RENDERING_ENGINE); } setSecurityDocument(originalSecurityDocument); } } | /**
* Converts the given annotated HTML produced by the WYSIWYG editor to the specified target syntax.
*
* @param html the annotated HTML to be converted
* @param targetSyntaxId the target syntax
* @return the result of converting the given annotated HTML to the specified target syntax
* @since 10.10RC1
*/ | Converts the given annotated HTML produced by the WYSIWYG editor to the specified target syntax | fromAnnotatedXHTML | {
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-wysiwyg/xwiki-platform-wysiwyg-api/src/main/java/org/xwiki/wysiwyg/script/WysiwygEditorScriptService.java",
"license": "lgpl-2.1",
"size": 17938
} | [
"com.xpn.xwiki.doc.XWikiDocument"
] | import com.xpn.xwiki.doc.XWikiDocument; | import com.xpn.xwiki.doc.*; | [
"com.xpn.xwiki"
] | com.xpn.xwiki; | 2,648,216 |
protected void sequence_ForStatement(EObject context, ForStatement semanticObject) {
genericSequencer.createSequence(context, semanticObject);
}
| void function(EObject context, ForStatement semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Constraint:
* (
* stname=ID
* t1=Expression
* by1=Expression?
* (stname2+=ID t2+=Expression by2+=Expression?)*
* t2+=Expression*
* s1=Statement
* )
*/ | Constraint: ( stname=ID t1=Expression by1=Expression? (stname2+=ID t2+=Expression by2+=Expression?) t2+=Expression s1=Statement ) | sequence_ForStatement | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/serializer/EditorSemanticSequencer.java",
"license": "agpl-3.0",
"size": 147119
} | [
"com.euclideanspace.spad.editor.ForStatement",
"org.eclipse.emf.ecore.EObject"
] | import com.euclideanspace.spad.editor.ForStatement; import org.eclipse.emf.ecore.EObject; | import com.euclideanspace.spad.editor.*; import org.eclipse.emf.ecore.*; | [
"com.euclideanspace.spad",
"org.eclipse.emf"
] | com.euclideanspace.spad; org.eclipse.emf; | 465,898 |
protected void writeConfiguration(boolean refresh) {
// update the XML configuration
OpenCms.writeConfiguration(CmsSearchConfiguration.class);
if (refresh) {
refreshList();
}
} | void function(boolean refresh) { OpenCms.writeConfiguration(CmsSearchConfiguration.class); if (refresh) { refreshList(); } } | /**
* Writes the updated search configuration back to the XML
* configuration file and refreshes the complete list.<p>
*
* @param refresh if true, the list items are refreshed
*/ | Writes the updated search configuration back to the XML configuration file and refreshes the complete list | writeConfiguration | {
"repo_name": "serrapos/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/searchindex/CmsSearchIndexList.java",
"license": "lgpl-2.1",
"size": 31718
} | [
"org.opencms.configuration.CmsSearchConfiguration",
"org.opencms.main.OpenCms"
] | import org.opencms.configuration.CmsSearchConfiguration; import org.opencms.main.OpenCms; | import org.opencms.configuration.*; import org.opencms.main.*; | [
"org.opencms.configuration",
"org.opencms.main"
] | org.opencms.configuration; org.opencms.main; | 2,427,926 |
public static String getDayName(Context context, long dateInMillis) {
// If the date is today, return the localized version of "Today" instead of the actual
// day name.
Time t = new Time();
t.setToNow();
int julianDay = Time.getJulianDay(dateInMillis, t.gmtoff);
int currentJulianDay = Time.getJulianDay(System.currentTimeMillis(), t.gmtoff);
if (julianDay == currentJulianDay) {
return context.getString(R.string.today);
} else if ( julianDay == currentJulianDay +1 ) {
return context.getString(R.string.tomorrow);
} else {
Time time = new Time();
time.setToNow();
// Otherwise, the format is just the day of the week (e.g "Wednesday".
SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE");
return dayFormat.format(dateInMillis);
}
} | static String function(Context context, long dateInMillis) { Time t = new Time(); t.setToNow(); int julianDay = Time.getJulianDay(dateInMillis, t.gmtoff); int currentJulianDay = Time.getJulianDay(System.currentTimeMillis(), t.gmtoff); if (julianDay == currentJulianDay) { return context.getString(R.string.today); } else if ( julianDay == currentJulianDay +1 ) { return context.getString(R.string.tomorrow); } else { Time time = new Time(); time.setToNow(); SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE"); return dayFormat.format(dateInMillis); } } | /**
* Given a day, returns just the name to use for that day.
* E.g "today", "tomorrow", "wednesday".
*
* @param context Context to use for resource localization
* @param dateInMillis The date in milliseconds
* @return
*/ | Given a day, returns just the name to use for that day. E.g "today", "tomorrow", "wednesday" | getDayName | {
"repo_name": "yask123/Sunshine-Version-2",
"path": "app/src/main/java/com/example/android/sunshine/app/Utility.java",
"license": "apache-2.0",
"size": 10848
} | [
"android.content.Context",
"android.text.format.Time",
"java.text.SimpleDateFormat"
] | import android.content.Context; import android.text.format.Time; import java.text.SimpleDateFormat; | import android.content.*; import android.text.format.*; import java.text.*; | [
"android.content",
"android.text",
"java.text"
] | android.content; android.text; java.text; | 172,469 |
@Test
public void testGetOptions()
{
assertNotNull(selectableBehavior.getOptions());
} | void function() { assertNotNull(selectableBehavior.getOptions()); } | /**
* Test method for
* {@link org.odlabs.wiquery.ui.selectable.SelectableBehavior#getOptions()}.
*/ | Test method for <code>org.odlabs.wiquery.ui.selectable.SelectableBehavior#getOptions()</code> | testGetOptions | {
"repo_name": "WiQuery/wiquery",
"path": "wiquery-jquery-ui/src/test/java/org/odlabs/wiquery/ui/selectable/SelectableBehaviorTestCase.java",
"license": "mit",
"size": 6051
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,058,129 |
@Override public void enterAlphanumeric(@NotNull ECLParser.AlphanumericContext ctx) { }
| @Override public void enterAlphanumeric(@NotNull ECLParser.AlphanumericContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitUtf8_4 | {
"repo_name": "WestCoastInformatics/UMLS-Terminology-Server",
"path": "jpa-services/src/main/resources/ECLBaseListener.java",
"license": "apache-2.0",
"size": 18157
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,506,545 |
//Setup tabGroup
List<Component> tabItems = new ArrayList<Component>();
tabItems.addAll(tabGroup.getItems());
tabItems.addAll(demoGroups);
tabGroup.setItems(tabItems);
view.assignComponentIds(tabGroup);
//source code viewer setup
if(demoSourceCode != null && !demoSourceCode.isEmpty()){
sourceCodeViewer.setSourceCode(demoSourceCode.get(0));
}
if(additionalDemoSourceCode1 != null && !additionalDemoSourceCode1.isEmpty()
&& additionalDemoSourceCode1.get(0) != null){
additionalSourceCodeViewer1.setSourceCode(additionalDemoSourceCode1.get(0));
}
if(additionalDemoSourceCode2 != null && !additionalDemoSourceCode2.isEmpty()
&& additionalDemoSourceCode2.get(0) != null){
additionalSourceCodeViewer2.setSourceCode(additionalDemoSourceCode2.get(0));
}
}
| List<Component> tabItems = new ArrayList<Component>(); tabItems.addAll(tabGroup.getItems()); tabItems.addAll(demoGroups); tabGroup.setItems(tabItems); view.assignComponentIds(tabGroup); if(demoSourceCode != null && !demoSourceCode.isEmpty()){ sourceCodeViewer.setSourceCode(demoSourceCode.get(0)); } if(additionalDemoSourceCode1 != null && !additionalDemoSourceCode1.isEmpty() && additionalDemoSourceCode1.get(0) != null){ additionalSourceCodeViewer1.setSourceCode(additionalDemoSourceCode1.get(0)); } if(additionalDemoSourceCode2 != null && !additionalDemoSourceCode2.isEmpty() && additionalDemoSourceCode2.get(0) != null){ additionalSourceCodeViewer2.setSourceCode(additionalDemoSourceCode2.get(0)); } } | /**
* Setup the tabGroup with the demoGroups and setup the sourceCodeViewer
*
* @see Component#performInitialization(org.kuali.rice.krad.uif.view.View, Object)
*/ | Setup the tabGroup with the demoGroups and setup the sourceCodeViewer | performInitialization | {
"repo_name": "ua-eas/ksd-kc5.2.1-rice2.3.6-ua",
"path": "rice-framework/krad-sampleapp/src/main/java/org/kuali/rice/krad/demo/uif/components/ComponentExhibit.java",
"license": "apache-2.0",
"size": 8982
} | [
"java.util.ArrayList",
"java.util.List",
"org.kuali.rice.krad.uif.component.Component"
] | import java.util.ArrayList; import java.util.List; import org.kuali.rice.krad.uif.component.Component; | import java.util.*; import org.kuali.rice.krad.uif.component.*; | [
"java.util",
"org.kuali.rice"
] | java.util; org.kuali.rice; | 1,082,196 |
public void addNode(ResourceNode node) throws MonitorException;
/**
* Remove {@link ResourceNode} from this {@link Monitor} | void function(ResourceNode node) throws MonitorException; /** * Remove {@link ResourceNode} from this {@link Monitor} | /**
* Adds a new {@link ResourceNode} for this {@link Monitor} to manage (if
* node already exist, then should perform update)
*
* @param node
* The new {@link ResourceNode} to manage
*/ | Adds a new <code>ResourceNode</code> for this <code>Monitor</code> to manage (if node already exist, then should perform update) | addNode | {
"repo_name": "OSBI/oodt",
"path": "resource/src/main/java/org/apache/oodt/cas/resource/monitor/Monitor.java",
"license": "apache-2.0",
"size": 4012
} | [
"org.apache.oodt.cas.resource.structs.ResourceNode",
"org.apache.oodt.cas.resource.structs.exceptions.MonitorException"
] | import org.apache.oodt.cas.resource.structs.ResourceNode; import org.apache.oodt.cas.resource.structs.exceptions.MonitorException; | import org.apache.oodt.cas.resource.structs.*; import org.apache.oodt.cas.resource.structs.exceptions.*; | [
"org.apache.oodt"
] | org.apache.oodt; | 2,571,914 |
public List<EnvironmentVariableWithSecretValue> secrets() {
return this.secrets;
} | List<EnvironmentVariableWithSecretValue> function() { return this.secrets; } | /**
* Get the secrets value.
*
* @return the secrets value
*/ | Get the secrets value | secrets | {
"repo_name": "hovsepm/azure-sdk-for-java",
"path": "batchai/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/batchai/v2018_03_01/JobCreateParameters.java",
"license": "mit",
"size": 16682
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 995,894 |
public CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other,
Runnable action,
Executor executor);
public <U> CompletionStage<U> applyToEither
(CompletionStage<? extends T> other,
Function<? super T, U> fn); | CompletionStage<Void> runAfterBothAsync(CompletionStage<?> other, Runnable action, Executor executor); public <U> CompletionStage<U> function (CompletionStage<? extends T> other, Function<? super T, U> fn); | /**
* Returns a new CompletionStage that, when either this or the
* other given stage complete normally, is executed with the
* corresponding result as argument to the supplied function.
*
* See the {@link CompletionStage} documentation for rules
* covering exceptional completion.
*
* @param other the other CompletionStage
* @param fn the function to use to compute the value of
* the returned CompletionStage
* @param <U> the function's return type
* @return the new CompletionStage
*/ | Returns a new CompletionStage that, when either this or the other given stage complete normally, is executed with the corresponding result as argument to the supplied function. See the <code>CompletionStage</code> documentation for rules covering exceptional completion | applyToEither | {
"repo_name": "evanman/Java-Source",
"path": "util/concurrent/CompletionStage.java",
"license": "lgpl-2.1",
"size": 31926
} | [
"java.util.concurrent.Executor",
"java.util.function.Function"
] | import java.util.concurrent.Executor; import java.util.function.Function; | import java.util.concurrent.*; import java.util.function.*; | [
"java.util"
] | java.util; | 1,057,852 |
public static IPath handleToResourcePath(final String project, final String handle) {
final IPath path = Path.fromPortableString(handle);
if (project != null && !"".equals(project) && !path.isAbsolute()) //$NON-NLS-1$
return new Path(project).append(path).makeAbsolute();
return path;
} | static IPath function(final String project, final String handle) { final IPath path = Path.fromPortableString(handle); if (project != null && !"".equals(project) && !path.isAbsolute()) return new Path(project).append(path).makeAbsolute(); return path; } | /**
* Converts an input handle with the given prefix back to the corresponding resource path.
*
* @param project the project, or <code>null</code> for the workspace
* @param handle the input handle
* @return the corresponding resource path. Note: if the given handle is absolute, the project is
* not used to resolve.
*/ | Converts an input handle with the given prefix back to the corresponding resource path | handleToResourcePath | {
"repo_name": "jonahkichwacoders/che",
"path": "plugins/plugin-java/che-plugin-java-ext-jdt/org-eclipse-jdt-ui/src/main/java/org/eclipse/jdt/internal/core/refactoring/descriptors/JavaRefactoringDescriptorUtil.java",
"license": "epl-1.0",
"size": 30813
} | [
"org.eclipse.core.runtime.IPath",
"org.eclipse.core.runtime.Path"
] | import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; | import org.eclipse.core.runtime.*; | [
"org.eclipse.core"
] | org.eclipse.core; | 750,138 |
@Test
public void testSetIntGetLegal() throws Exception {
JmsMapMessage mapMessage = factory.createMapMessage();
String name = "myName";
int value = 1;
mapMessage.setInt(name, value);
assertEquals(value, mapMessage.getInt(name));
assertGetMapEntryEquals(mapMessage, name, String.valueOf(value), String.class);
assertGetMapEntryEquals(mapMessage, name, Long.valueOf(value), Long.class);
} | void function() throws Exception { JmsMapMessage mapMessage = factory.createMapMessage(); String name = STR; int value = 1; mapMessage.setInt(name, value); assertEquals(value, mapMessage.getInt(name)); assertGetMapEntryEquals(mapMessage, name, String.valueOf(value), String.class); assertGetMapEntryEquals(mapMessage, name, Long.valueOf(value), Long.class); } | /**
* Set an int, then retrieve it as all of the legal type combinations to verify it is parsed
* correctly
*/ | Set an int, then retrieve it as all of the legal type combinations to verify it is parsed correctly | testSetIntGetLegal | {
"repo_name": "avranju/qpid-jms",
"path": "qpid-jms-client/src/test/java/org/apache/qpid/jms/message/JmsMapMessageTest.java",
"license": "apache-2.0",
"size": 35216
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,482,596 |
public List<Utente> ricercaAiutoVisitatore(List<Abilita> abilita) throws RicercheException;
| List<Utente> function(List<Abilita> abilita) throws RicercheException; | /**
* Metodo per ottenere il risultato della ricerca aiuto per visitatori, in base alle abilita scelte
* @param abilita= lista di abilita che l'utente ricercato deve avere
* @return <b>risultatoRicerca</b> una lista di utenti che possiede tutte le abilita selezionate, <b>null</b> se la ricerca non ha prodotto risultati
* @throws RicercheException con causa ALCUNIPARAMETRINULLIVUOTI
*/ | Metodo per ottenere il risultato della ricerca aiuto per visitatori, in base alle abilita scelte | ricercaAiutoVisitatore | {
"repo_name": "Ks89/SWIMv2",
"path": "SWIMv2_EJB/ejbModule/sessionBeans/interfaces/GestioneRicercheInterface.java",
"license": "apache-2.0",
"size": 3498
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,330,432 |
void runTest(RunnableWithException testMethod) throws Exception {
startResourceManager();
try {
testMethod.run();
} finally {
stopResourceManager();
}
} | void runTest(RunnableWithException testMethod) throws Exception { startResourceManager(); try { testMethod.run(); } finally { stopResourceManager(); } } | /**
* A wrapper function for running test. Deal with setup and teardown logic
* in Context.
* @param testMethod the real test body.
*/ | A wrapper function for running test. Deal with setup and teardown logic in Context | runTest | {
"repo_name": "gyfora/flink",
"path": "flink-yarn/src/test/java/org/apache/flink/yarn/YarnResourceManagerTest.java",
"license": "apache-2.0",
"size": 21225
} | [
"org.apache.flink.util.function.RunnableWithException"
] | import org.apache.flink.util.function.RunnableWithException; | import org.apache.flink.util.function.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,915,668 |
public static TypeCode type()
{
ORB orb = OrbRestricted.Singleton;
StructMember[] members = new StructMember[0];
return orb.create_exception_tc(id(), "NoContext", members);
} | static TypeCode function() { ORB orb = OrbRestricted.Singleton; StructMember[] members = new StructMember[0]; return orb.create_exception_tc(id(), STR, members); } | /**
* Create the NoContext typecode (structure, named "NoContext").
*/ | Create the NoContext typecode (structure, named "NoContext") | type | {
"repo_name": "taciano-perez/JamVM-PH",
"path": "src/classpath/org/omg/PortableServer/CurrentPackage/NoContextHelper.java",
"license": "gpl-2.0",
"size": 4382
} | [
"org.omg.CORBA"
] | import org.omg.CORBA; | import org.omg.*; | [
"org.omg"
] | org.omg; | 1,773,538 |
public static void setAllPercentBar(String message, int percent) {
if ((percent < 0f) || (percent > 100f))
percent = Math.min(100, Math.max(0, percent));
for (Player player : Bukkit.getServer().getOnlinePlayers())
setPercentBar(player, message, percent);
} | static void function(String message, int percent) { if ((percent < 0f) (percent > 100f)) percent = Math.min(100, Math.max(0, percent)); for (Player player : Bukkit.getServer().getOnlinePlayers()) setPercentBar(player, message, percent); } | /**
* Assign a bar to all players, with the specified message and fill percentage. The percentage will not change unless manually updated.
*
* @param message String message to be displayed on the bar.
* @param percent Int 0-100, how full the bar should be.
*/ | Assign a bar to all players, with the specified message and fill percentage. The percentage will not change unless manually updated | setAllPercentBar | {
"repo_name": "ewized/CommonUtils",
"path": "src/main/java/com/archeinteractive/dev/commonutils/bossbar/BossBar.java",
"license": "gpl-3.0",
"size": 18117
} | [
"org.bukkit.Bukkit",
"org.bukkit.entity.Player"
] | import org.bukkit.Bukkit; import org.bukkit.entity.Player; | import org.bukkit.*; import org.bukkit.entity.*; | [
"org.bukkit",
"org.bukkit.entity"
] | org.bukkit; org.bukkit.entity; | 1,465,344 |
public boolean isKyloManaged(String processorId) {
return StringUtils.isNotBlank(getProcessorName(processorId)) || isKyloManagedConnection(processorId);
} | boolean function(String processorId) { return StringUtils.isNotBlank(getProcessorName(processorId)) isKyloManagedConnection(processorId); } | /**
* Check to make sure the processorId is managed by Kylo and in the cache.
*
* @param processorId the processorId to check
* @return true if the processor is mapped to a Kylo managed feed flow, false if not
*/ | Check to make sure the processorId is managed by Kylo and in the cache | isKyloManaged | {
"repo_name": "rashidaligee/kylo",
"path": "integrations/nifi/nifi-nar-bundles/nifi-provenance-repo-bundle/nifi-provenance-repo/src/main/java/com/thinkbiganalytics/nifi/provenance/ProvenanceFeedLookup.java",
"license": "apache-2.0",
"size": 8497
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,025,401 |
public static synchronized void initialize(Context context, String gcmId, InitializeCallback callback) {
initialize(context, gcmId, callback, null);
} | static synchronized void function(Context context, String gcmId, InitializeCallback callback) { initialize(context, gcmId, callback, null); } | /**
* Initializes the push client
*
* @throws RuntimeException if already initialized
*
* @param context the application context
* @param gcmId the Google Cloud Messaging application id
* @param callback the callback to be invoked when initialization is complete
*/ | Initializes the push client | initialize | {
"repo_name": "myriadmobile/shove",
"path": "library/src/main/java/com/myriadmobile/library/shove/ShoveClient.java",
"license": "mit",
"size": 10155
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 128,265 |
// read example files, if no files were specified as command line arguments
if (args.length < 1) {
try {
read(ImmobiliareItReadingExample.class.getResourceAsStream("immobiliare_it.xml"));
} catch (Exception ex) {
LOGGER.error("Can't read example file!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
System.exit(2);
}
}
// read files, that were specified as command line arguments
else {
for (String arg : args) {
try {
read(new File(arg));
} catch (Exception ex) {
LOGGER.error("Can't read file '{}'!", arg);
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
System.exit(2);
}
}
}
} | if (args.length < 1) { try { read(ImmobiliareItReadingExample.class.getResourceAsStream(STR)); } catch (Exception ex) { LOGGER.error(STR); LOGGER.error(STR + ex.getLocalizedMessage(), ex); System.exit(2); } } else { for (String arg : args) { try { read(new File(arg)); } catch (Exception ex) { LOGGER.error(STR, arg); LOGGER.error(STR + ex.getLocalizedMessage(), ex); System.exit(2); } } } } | /**
* Start the example application.
*
* @param args command line arguments
*/ | Start the example application | main | {
"repo_name": "OpenEstate/OpenEstate-IO",
"path": "Examples/src/main/java/org/openestate/io/examples/ImmobiliareItReadingExample.java",
"license": "apache-2.0",
"size": 5981
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,869,835 |
public String getAudioRecordName( ItemStack stack ); | String function( ItemStack stack ); | /**
* If this disk represents an item with audio (like a record), get the resource name of the audio track to play.
* @param stack The itemstack to inspect.
* @return The name, or null if this item does not represent an item with audio.
*/ | If this disk represents an item with audio (like a record), get the resource name of the audio track to play | getAudioRecordName | {
"repo_name": "Lordmau5/FFS",
"path": "unused/api/java/dan200/computercraft/api/media/IMedia.java",
"license": "mit",
"size": 2733
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 2,210,956 |
public double getDistanceSqToEntity(Entity p_70068_1_)
{
double var2 = this.posX - p_70068_1_.posX;
double var4 = this.posY - p_70068_1_.posY;
double var6 = this.posZ - p_70068_1_.posZ;
return var2 * var2 + var4 * var4 + var6 * var6;
}
public void onCollideWithPlayer(EntityPlayer p_70100_1_) {} | double function(Entity p_70068_1_) { double var2 = this.posX - p_70068_1_.posX; double var4 = this.posY - p_70068_1_.posY; double var6 = this.posZ - p_70068_1_.posZ; return var2 * var2 + var4 * var4 + var6 * var6; } public void onCollideWithPlayer(EntityPlayer p_70100_1_) {} | /**
* Returns the squared distance to the entity. Args: entity
*/ | Returns the squared distance to the entity. Args: entity | getDistanceSqToEntity | {
"repo_name": "TheHecticByte/BananaJ1.7.10Beta",
"path": "src/net/minecraft/Server1_7_10/entity/Entity.java",
"license": "gpl-3.0",
"size": 78382
} | [
"net.minecraft.Server1_7_10"
] | import net.minecraft.Server1_7_10; | import net.minecraft.*; | [
"net.minecraft"
] | net.minecraft; | 1,100,706 |
public void setChangeAmount(ScaleTwoDecimal changeAmount) {
this.changeAmount = changeAmount;
} | void function(ScaleTwoDecimal changeAmount) { this.changeAmount = changeAmount; } | /**
* Sets the changeAmount attribute value.
* @param changeAmount The changeAmount to set.
*/ | Sets the changeAmount attribute value | setChangeAmount | {
"repo_name": "sanjupolus/KC6.oLatest",
"path": "coeus-impl/src/main/java/org/kuali/kra/timeandmoney/history/TimeAndMoneyActionSummary.java",
"license": "agpl-3.0",
"size": 3852
} | [
"org.kuali.coeus.sys.api.model.ScaleTwoDecimal"
] | import org.kuali.coeus.sys.api.model.ScaleTwoDecimal; | import org.kuali.coeus.sys.api.model.*; | [
"org.kuali.coeus"
] | org.kuali.coeus; | 2,904,090 |
public void refresh(AjaxRequestTarget ajaxRequestTarget) {
selectableBehavior.refresh();
}
| void function(AjaxRequestTarget ajaxRequestTarget) { selectableBehavior.refresh(); } | /**Method to refresh within the ajax request
* @param ajaxRequestTarget
*/ | Method to refresh within the ajax request | refresh | {
"repo_name": "magomi/wiquery",
"path": "src/main/java/org/odlabs/wiquery/ui/selectable/SelectableAjaxBehavior.java",
"license": "mit",
"size": 12432
} | [
"org.apache.wicket.ajax.AjaxRequestTarget"
] | import org.apache.wicket.ajax.AjaxRequestTarget; | import org.apache.wicket.ajax.*; | [
"org.apache.wicket"
] | org.apache.wicket; | 107,040 |
public @Nullable Uri getIconUri() {
return mIconUri;
} | @Nullable Uri function() { return mIconUri; } | /**
* Returns a Uri for an icon suitable for display or null.
*
* @return An icon uri or null.
*/ | Returns a Uri for an icon suitable for display or null | getIconUri | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/base/media/java/android/media/MediaDescription.java",
"license": "gpl-3.0",
"size": 7501
} | [
"android.annotation.Nullable",
"android.net.Uri"
] | import android.annotation.Nullable; import android.net.Uri; | import android.annotation.*; import android.net.*; | [
"android.annotation",
"android.net"
] | android.annotation; android.net; | 188,393 |
private void startIfNecessary(MessageListenerContainer listenerContainer) {
if (this.contextRefreshed || listenerContainer.isAutoStartup()) {
listenerContainer.start();
}
} | void function(MessageListenerContainer listenerContainer) { if (this.contextRefreshed listenerContainer.isAutoStartup()) { listenerContainer.start(); } } | /**
* Start the specified {@link MessageListenerContainer} if it should be started
* on startup or when start is called explicitly after startup.
*
* @see MessageListenerContainer#isAutoStartup()
*/ | Start the specified <code>MessageListenerContainer</code> if it should be started on startup or when start is called explicitly after startup | startIfNecessary | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/spring/azure-spring-cloud-messaging/src/main/java/com/microsoft/azure/spring/messaging/config/AzureListenerEndpointRegistry.java",
"license": "mit",
"size": 9626
} | [
"com.microsoft.azure.spring.messaging.container.MessageListenerContainer"
] | import com.microsoft.azure.spring.messaging.container.MessageListenerContainer; | import com.microsoft.azure.spring.messaging.container.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 109,478 |
@Test
public void testGetDimension() {
ClusterParticle instance = new ClusterParticle();
CentroidHolder holder = new CentroidHolder();
ClusterCentroid centroid = ClusterCentroid.of(1,2,3,4,5,6);
centroid.setDataItemDistances(new double[]{1,2,3,4});
holder.add(centroid);
holder.add(centroid);
holder.add(centroid);
instance.setCandidateSolution(holder);
Assert.assertEquals(instance.getDimension(), 3);
} | void function() { ClusterParticle instance = new ClusterParticle(); CentroidHolder holder = new CentroidHolder(); ClusterCentroid centroid = ClusterCentroid.of(1,2,3,4,5,6); centroid.setDataItemDistances(new double[]{1,2,3,4}); holder.add(centroid); holder.add(centroid); holder.add(centroid); instance.setCandidateSolution(holder); Assert.assertEquals(instance.getDimension(), 3); } | /**
* Test of getDimension method, of class ClusterParticle.
*/ | Test of getDimension method, of class ClusterParticle | testGetDimension | {
"repo_name": "filinep/cilib",
"path": "library/src/test/java/net/sourceforge/cilib/clustering/entity/ClusterParticleTest.java",
"license": "gpl-3.0",
"size": 15106
} | [
"junit.framework.Assert",
"net.sourceforge.cilib.type.types.container.CentroidHolder",
"net.sourceforge.cilib.type.types.container.ClusterCentroid"
] | import junit.framework.Assert; import net.sourceforge.cilib.type.types.container.CentroidHolder; import net.sourceforge.cilib.type.types.container.ClusterCentroid; | import junit.framework.*; import net.sourceforge.cilib.type.types.container.*; | [
"junit.framework",
"net.sourceforge.cilib"
] | junit.framework; net.sourceforge.cilib; | 1,399,961 |
OutputStream addResourceFile(Location location) throws IOException; | OutputStream addResourceFile(Location location) throws IOException; | /**
* Adds a new resource file and returns its output stream.
* @param location the resource path (relative path from the individual batch application root)
* @return the output stream to set the target file contents
* @throws IOException if failed to create a new file
*/ | Adds a new resource file and returns its output stream | addResourceFile | {
"repo_name": "ashigeru/asakusafw-compiler",
"path": "compiler-project/api/src/main/java/com/asakusafw/lang/compiler/api/BatchProcessor.java",
"license": "apache-2.0",
"size": 2866
} | [
"com.asakusafw.lang.compiler.common.Location",
"java.io.IOException",
"java.io.OutputStream"
] | import com.asakusafw.lang.compiler.common.Location; import java.io.IOException; import java.io.OutputStream; | import com.asakusafw.lang.compiler.common.*; import java.io.*; | [
"com.asakusafw.lang",
"java.io"
] | com.asakusafw.lang; java.io; | 2,008,181 |
private CategorialClass getParticipant() {
return get("edu.wustl.catissuecore.domain.Participant", "Participant_gender");
}
| CategorialClass function() { return get(STR, STR); } | /**
* Mock Method for getting object for <code>edu.wustl.catissuecore.domain.Participant</code> class.
* @return CategorialClass
*/ | Mock Method for getting object for <code>edu.wustl.catissuecore.domain.Participant</code> class | getParticipant | {
"repo_name": "NCIP/cab2b",
"path": "software/cab2bWebApp/test/unit/java/edu/wustl/cab2bwebapp/bizlogic/executequery/CategoryToSpreadsheetTransformerTest.java",
"license": "bsd-3-clause",
"size": 13181
} | [
"edu.wustl.common.querysuite.metadata.category.CategorialClass"
] | import edu.wustl.common.querysuite.metadata.category.CategorialClass; | import edu.wustl.common.querysuite.metadata.category.*; | [
"edu.wustl.common"
] | edu.wustl.common; | 1,137,712 |
public void setOtherProperties(Map<String, Object> otherProperties) {
this.otherProperties = otherProperties;
} | void function(Map<String, Object> otherProperties) { this.otherProperties = otherProperties; } | /**
* Set the additional properties to display for this response
*
* @param otherProperties the additional properties to display for this message.
*/ | Set the additional properties to display for this response | setOtherProperties | {
"repo_name": "phac-nml/irida",
"path": "src/main/java/ca/corefacility/bioinformatics/irida/web/controller/api/exception/ErrorResponse.java",
"license": "apache-2.0",
"size": 1828
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,038,025 |
public void removeRetentionLease(final String id, final ActionListener<ReplicationResponse> listener) {
Objects.requireNonNull(listener);
assert assertPrimaryMode();
verifyNotClosed();
ensureSoftDeletesEnabled("retention leases");
replicationTracker.removeRetentionLease(id, listener);
} | void function(final String id, final ActionListener<ReplicationResponse> listener) { Objects.requireNonNull(listener); assert assertPrimaryMode(); verifyNotClosed(); ensureSoftDeletesEnabled(STR); replicationTracker.removeRetentionLease(id, listener); } | /**
* Removes an existing retention lease.
*
* @param id the identifier of the retention lease
* @param listener the callback when the retention lease is successfully removed and synced to replicas
*/ | Removes an existing retention lease | removeRetentionLease | {
"repo_name": "gingerwizard/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/index/shard/IndexShard.java",
"license": "apache-2.0",
"size": 174872
} | [
"java.util.Objects",
"org.elasticsearch.action.ActionListener",
"org.elasticsearch.action.support.replication.ReplicationResponse"
] | import java.util.Objects; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.support.replication.ReplicationResponse; | import java.util.*; import org.elasticsearch.action.*; import org.elasticsearch.action.support.replication.*; | [
"java.util",
"org.elasticsearch.action"
] | java.util; org.elasticsearch.action; | 1,634,100 |
public static boolean setField(Object bean, String propertyName, String propertyValue)
throws IntrospectionException, IllegalAccessException, InvocationTargetException {
if (propertyValue != null && propertyValue.length() == 0)
propertyValue = null;
return setField(bean, propertyName, (Object) propertyValue);
} | static boolean function(Object bean, String propertyName, String propertyValue) throws IntrospectionException, IllegalAccessException, InvocationTargetException { if (propertyValue != null && propertyValue.length() == 0) propertyValue = null; return setField(bean, propertyName, (Object) propertyValue); } | /** This method will introspect the bean & get the setter method for the input propertyName.
* It will then try & convert the propertyValue to the appropriate datatype.
* Finally it will invoke the setter.
* @return A true indicates, the property was succesfully set to the passed value. A false indicates the property doesn't exist or the propertyValue passed is not compatible with the setter.
* @param bean The bean class to be introspected.
* @param propertyName The Property being searched for.
* @param propertyValue The value to be set.
* @throws IntrospectionException if an exception occurs during introspection.
* @throws IllegalAccessException if the underlying method is inaccessible.
* @throws InvocationTargetException if the underlying method throws an exception.
*/ | This method will introspect the bean & get the setter method for the input propertyName. It will then try & convert the propertyValue to the appropriate datatype. Finally it will invoke the setter | setField | {
"repo_name": "snavaneethan1/jaffa-framework",
"path": "jaffa-core/source/java/org/jaffa/util/BeanHelper.java",
"license": "gpl-3.0",
"size": 23478
} | [
"java.beans.IntrospectionException",
"java.lang.reflect.InvocationTargetException"
] | import java.beans.IntrospectionException; import java.lang.reflect.InvocationTargetException; | import java.beans.*; import java.lang.reflect.*; | [
"java.beans",
"java.lang"
] | java.beans; java.lang; | 387,313 |
public JSONWriter key(String s) throws JSONException {
if (s == null) {
throw new JSONException("Null key.");
}
if (this.mode == 'k') {
try {
if (this.comma) {
this.writer.write(',');
}
this.writer.write(JSONObject.quote(s));
this.writer.write(':');
this.comma = false;
this.mode = 'o';
return this;
} catch (IOException e) {
throw new JSONException(e);
}
}
throw new JSONException("Misplaced key.");
} | JSONWriter function(String s) throws JSONException { if (s == null) { throw new JSONException(STR); } if (this.mode == 'k') { try { if (this.comma) { this.writer.write(','); } this.writer.write(JSONObject.quote(s)); this.writer.write(':'); this.comma = false; this.mode = 'o'; return this; } catch (IOException e) { throw new JSONException(e); } } throw new JSONException(STR); } | /**
* Append a key. The key will be associated with the next value. In an
* object, every value must be preceded by a key.
* @param s A key string.
* @return this
* @throws JSONException If the key is out of place. For example, keys
* do not belong in arrays or if the key is null.
*/ | Append a key. The key will be associated with the next value. In an object, every value must be preceded by a key | key | {
"repo_name": "wordpress-mobile/WordPress-BlackBerry-Legacy",
"path": "src/org/json/me/JSONWriter.java",
"license": "gpl-2.0",
"size": 10023
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 69,355 |
public static int addFollowing(Context context, String word,
String followingWord) {
// do error checking on input params
if (TextUtils.isEmpty(word) || TextUtils.isEmpty(followingWord)) {
//Log.e("ChimeeUserDictionary", "Empty word");
}
// Get following words string
long wordId = -1;
String followingString = "";
final ContentResolver resolver = context.getContentResolver();
String[] projection = new String[] { _ID, FOLLOWING };
String selection = WORD + "=?";
String[] selectionArgs = { word };
Cursor cursor = null;
try {
cursor = resolver.query(CONTENT_URI, projection, selection,
selectionArgs, null);
if (cursor.moveToNext()) {
wordId = cursor.getLong(cursor.getColumnIndex(_ID));
followingString = cursor.getString(cursor
.getColumnIndex(FOLLOWING));
}
} catch (Exception e) {
//Log.e("ChimeeUserDictionary", e.toString());
} finally {
if (cursor != null) {
cursor.close();
}
}
if (wordId == -1) {
return 0;
}
// if followingWord is already first then quit
if (followingString.equals(followingWord)
|| followingString.startsWith(followingWord + ",")) {
return 0;
}
// put followingWord first in the list
followingString = reorderFollowing(followingWord, followingString);
// update word with new following list
Uri uri = ContentUris.withAppendedId(CONTENT_URI, wordId);
ContentValues values = new ContentValues(1);
values.put(FOLLOWING, followingString);
int count = resolver.update(uri, values, null, null);
return count;
} | static int function(Context context, String word, String followingWord) { if (TextUtils.isEmpty(word) TextUtils.isEmpty(followingWord)) { } long wordId = -1; String followingString = STR=?STR,")) { return 0; } followingString = reorderFollowing(followingWord, followingString); Uri uri = ContentUris.withAppendedId(CONTENT_URI, wordId); ContentValues values = new ContentValues(1); values.put(FOLLOWING, followingString); int count = resolver.update(uri, values, null, null); return count; } | /**
* Changes the following suggestions of a word. Adds the following word
* if it doesn't exist or makes sure it is first in the list if it does
* exist.
*
* @param context
* the current application context
* @param word
* the word whose following list needs updating
* @param followingWord
* the following word to add
*
*/ | Changes the following suggestions of a word. Adds the following word if it doesn't exist or makes sure it is first in the list if it does exist | addFollowing | {
"repo_name": "almas/Chimee",
"path": "app/src/main/java/net/studymongolian/chimee/ChimeeUserDictionary.java",
"license": "gpl-2.0",
"size": 12207
} | [
"android.content.ContentUris",
"android.content.ContentValues",
"android.content.Context",
"android.net.Uri",
"android.text.TextUtils"
] | import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import android.text.TextUtils; | import android.content.*; import android.net.*; import android.text.*; | [
"android.content",
"android.net",
"android.text"
] | android.content; android.net; android.text; | 2,869,243 |
public String currentTransactionId() {
try {
javax.transaction.Transaction txn = txnMgr.getTransaction();
return txn != null ? txn.toString() : null;
} catch (SystemException e) {
return null;
}
} | String function() { try { javax.transaction.Transaction txn = txnMgr.getTransaction(); return txn != null ? txn.toString() : null; } catch (SystemException e) { return null; } } | /**
* Get a string representation of the current transaction if there already is an existing transaction.
*
* @return a string representation of the transaction if there is an existing transaction, or null if there is none
*/ | Get a string representation of the current transaction if there already is an existing transaction | currentTransactionId | {
"repo_name": "rhauch/modeshape",
"path": "modeshape-jcr/src/main/java/org/modeshape/jcr/txn/Transactions.java",
"license": "apache-2.0",
"size": 14896
} | [
"javax.transaction.SystemException"
] | import javax.transaction.SystemException; | import javax.transaction.*; | [
"javax.transaction"
] | javax.transaction; | 1,949,642 |
@Test
public void testToString() {
BgpRouteEntry.AsPath asPath = generateAsPath();
String expectedString =
"AsPath{pathSegments=[" +
"PathSegment{type=AS_CONFED_SEQUENCE, segmentAsNumbers=[1, 2, 3]}, " +
"PathSegment{type=AS_CONFED_SET, segmentAsNumbers=[4, 5, 6]}, " +
"PathSegment{type=AS_SEQUENCE, segmentAsNumbers=[7, 8, 9]}, " +
"PathSegment{type=AS_SET, segmentAsNumbers=[10, 11, 12]}]}";
assertThat(asPath.toString(), is(expectedString));
} | void function() { BgpRouteEntry.AsPath asPath = generateAsPath(); String expectedString = STR + STR + STR + STR + STR; assertThat(asPath.toString(), is(expectedString)); } | /**
* Tests object string representation.
*/ | Tests object string representation | testToString | {
"repo_name": "donNewtonAlpha/onos",
"path": "apps/routing/common/src/test/java/org/onosproject/routing/bgp/AsPathTest.java",
"license": "apache-2.0",
"size": 8032
} | [
"org.hamcrest.Matchers",
"org.junit.Assert"
] | import org.hamcrest.Matchers; import org.junit.Assert; | import org.hamcrest.*; import org.junit.*; | [
"org.hamcrest",
"org.junit"
] | org.hamcrest; org.junit; | 411,123 |
protected void addResponseContent (HttpMethod method, CrawlURI curi) {
curi.setFetchStatus(method.getStatusCode());
Header ct = method.getResponseHeader("content-type");
curi.setContentType((ct == null)? null: ct.getValue());
// Save method into curi too. Midfetch filters may want to leverage
// info in here.
curi.putObject(A_HTTP_TRANSACTION, method);
} | void function (HttpMethod method, CrawlURI curi) { curi.setFetchStatus(method.getStatusCode()); Header ct = method.getResponseHeader(STR); curi.setContentType((ct == null)? null: ct.getValue()); curi.putObject(A_HTTP_TRANSACTION, method); } | /**
* This method populates <code>curi</code> with response status and
* content type.
* @param curi CrawlURI to populate.
* @param method Method to get response status and headers from.
*/ | This method populates <code>curi</code> with response status and content type | addResponseContent | {
"repo_name": "gaowangyizu/myHeritrix",
"path": "myHeritrix/src/org/archive/crawler/fetcher/FetchHTTP.java",
"license": "apache-2.0",
"size": 68804
} | [
"org.apache.commons.httpclient.Header",
"org.apache.commons.httpclient.HttpMethod",
"org.archive.crawler.datamodel.CrawlURI"
] | import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; import org.archive.crawler.datamodel.CrawlURI; | import org.apache.commons.httpclient.*; import org.archive.crawler.datamodel.*; | [
"org.apache.commons",
"org.archive.crawler"
] | org.apache.commons; org.archive.crawler; | 2,827,482 |
default TableStatisticsMetadata getStatisticsCollectionMetadataForWrite(ConnectorSession session, ConnectorTableMetadata tableMetadata)
{
return TableStatisticsMetadata.empty();
} | default TableStatisticsMetadata getStatisticsCollectionMetadataForWrite(ConnectorSession session, ConnectorTableMetadata tableMetadata) { return TableStatisticsMetadata.empty(); } | /**
* Describes statistics that must be collected during a write.
*/ | Describes statistics that must be collected during a write | getStatisticsCollectionMetadataForWrite | {
"repo_name": "martint/presto",
"path": "presto-spi/src/main/java/io/prestosql/spi/connector/ConnectorMetadata.java",
"license": "apache-2.0",
"size": 39854
} | [
"io.prestosql.spi.statistics.TableStatisticsMetadata"
] | import io.prestosql.spi.statistics.TableStatisticsMetadata; | import io.prestosql.spi.statistics.*; | [
"io.prestosql.spi"
] | io.prestosql.spi; | 692,016 |
public static Symmetry convertSpaceGroupToSymmetry(SpaceGroup sg) {
Symmetry sym = new Symmetry();
sym.setSpace_group_name_H_M(sg.getShortSymbol());
// TODO do we need to fill any of the other values?
return sym;
} | static Symmetry function(SpaceGroup sg) { Symmetry sym = new Symmetry(); sym.setSpace_group_name_H_M(sg.getShortSymbol()); return sym; } | /**
* Converts a SpaceGroup object to a {@link Symmetry} object.
* @param sg
* @return
*/ | Converts a SpaceGroup object to a <code>Symmetry</code> object | convertSpaceGroupToSymmetry | {
"repo_name": "pwrose/biojava",
"path": "biojava-structure/src/main/java/org/biojava/nbio/structure/io/mmcif/MMCIFFileTools.java",
"license": "lgpl-2.1",
"size": 16560
} | [
"org.biojava.nbio.structure.io.mmcif.model.Symmetry",
"org.biojava.nbio.structure.xtal.SpaceGroup"
] | import org.biojava.nbio.structure.io.mmcif.model.Symmetry; import org.biojava.nbio.structure.xtal.SpaceGroup; | import org.biojava.nbio.structure.io.mmcif.model.*; import org.biojava.nbio.structure.xtal.*; | [
"org.biojava.nbio"
] | org.biojava.nbio; | 1,269,371 |
public void setTop(Object val)
{
try {
m_map[m_firstFree - 1] = val;
}
catch (ArrayIndexOutOfBoundsException e)
{
throw new EmptyStackException();
}
} | void function(Object val) { try { m_map[m_firstFree - 1] = val; } catch (ArrayIndexOutOfBoundsException e) { throw new EmptyStackException(); } } | /**
* Sets an object at a the top of the statck
*
*
* @param val object to set at the top
* @throws EmptyStackException if this stack is empty.
*/ | Sets an object at a the top of the statck | setTop | {
"repo_name": "itgeeker/jdk",
"path": "src/com/sun/org/apache/xml/internal/utils/ObjectStack.java",
"license": "apache-2.0",
"size": 4826
} | [
"java.util.EmptyStackException"
] | import java.util.EmptyStackException; | import java.util.*; | [
"java.util"
] | java.util; | 2,867,829 |
public static JVMId readJvmId(BufferedInput in, ReadContext ctx) throws IOException {
byte[] uid;
if (ctx == null) {
uid = in.readByteArray();
return uid == null ? null : new JVMId(uid);
}
long length = in.readCompactLong();
if (length == 0 || length > MAX_JVM_ID_BYTES)
throw new IOException("Illegal JVMId length: " + length);
if (length == -1)
return null;
if (length < -1)
return ctx.getJVMId(length);
uid = new byte[(int) length];
in.readFully(uid);
JVMId jvmId = new JVMId(uid);
ctx.addJVMId(jvmId);
return jvmId;
} | static JVMId function(BufferedInput in, ReadContext ctx) throws IOException { byte[] uid; if (ctx == null) { uid = in.readByteArray(); return uid == null ? null : new JVMId(uid); } long length = in.readCompactLong(); if (length == 0 length > MAX_JVM_ID_BYTES) throw new IOException(STR + length); if (length == -1) return null; if (length < -1) return ctx.getJVMId(length); uid = new byte[(int) length]; in.readFully(uid); JVMId jvmId = new JVMId(uid); ctx.addJVMId(jvmId); return jvmId; } | /**
* Reads {@link JVMId} from the buffered input.
* @param in the source to read from
* @param ctx the read context
* @return JVMId read
* @throws IOException if an I/O error occurs
*/ | Reads <code>JVMId</code> from the buffered input | readJvmId | {
"repo_name": "Devexperts/QD",
"path": "proto/src/main/java/com/devexperts/connector/proto/JVMId.java",
"license": "mpl-2.0",
"size": 7286
} | [
"com.devexperts.io.BufferedInput",
"java.io.IOException"
] | import com.devexperts.io.BufferedInput; import java.io.IOException; | import com.devexperts.io.*; import java.io.*; | [
"com.devexperts.io",
"java.io"
] | com.devexperts.io; java.io; | 311,353 |
EAttribute getMBrickDC_Acceleration(); | EAttribute getMBrickDC_Acceleration(); | /**
* Returns the meta object for the attribute '{@link org.openhab.binding.tinkerforge.internal.model.MBrickDC#getAcceleration <em>Acceleration</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Acceleration</em>'.
* @see org.openhab.binding.tinkerforge.internal.model.MBrickDC#getAcceleration()
* @see #getMBrickDC()
* @generated
*/ | Returns the meta object for the attribute '<code>org.openhab.binding.tinkerforge.internal.model.MBrickDC#getAcceleration Acceleration</code>'. | getMBrickDC_Acceleration | {
"repo_name": "gregfinley/openhab",
"path": "bundles/binding/org.openhab.binding.tinkerforge/src/main/java/org/openhab/binding/tinkerforge/internal/model/ModelPackage.java",
"license": "epl-1.0",
"size": 665067
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 63,911 |
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addSourcePropertyDescriptor(object);
addTargetPropertyDescriptor(object);
}
return itemPropertyDescriptors;
} | List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addSourcePropertyDescriptor(object); addTargetPropertyDescriptor(object); } return itemPropertyDescriptors; } | /**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the property descriptors for the adapted class. | getPropertyDescriptors | {
"repo_name": "gemoc/activitydiagram",
"path": "dev/gemoc_sequential/language_workbench/org.gemoc.activitydiagram.sequential.xactivitydiagram.edit/src/org/gemoc/activitydiagram/sequential/xactivitydiagram/activitydiagram/provider/ActivityEdgeItemProvider.java",
"license": "epl-1.0",
"size": 5683
} | [
"java.util.List",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor"
] | import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 2,418,998 |
public DefaultMutableTreeNode addNotebookNode(
DefaultMutableTreeNode parent, String uri, String label) {
Object child = label;
DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child);
// store node to map to be able to get URI from node object
treeNodeToResourceUriMap.put(childNode, uri);
if (parent == null) {
parent = rootNode;
}
treeModel.insertNodeInto(childNode, parent, parent.getChildCount());
return childNode;
} | DefaultMutableTreeNode function( DefaultMutableTreeNode parent, String uri, String label) { Object child = label; DefaultMutableTreeNode childNode = new DefaultMutableTreeNode(child); treeNodeToResourceUriMap.put(childNode, uri); if (parent == null) { parent = rootNode; } treeModel.insertNodeInto(childNode, parent, parent.getChildCount()); return childNode; } | /**
* Add notebook node.
*
* @param parent
* folder node.
* @param uri
* notebook URI.
* @param label
* notebook label.
* @return the node.
*/ | Add notebook node | addNotebookNode | {
"repo_name": "dvorka/mindraider",
"path": "mr7/src/main/java/com/mindcognition/mindraider/ui/swing/trash/TrashJPanel.java",
"license": "apache-2.0",
"size": 24481
} | [
"javax.swing.tree.DefaultMutableTreeNode"
] | import javax.swing.tree.DefaultMutableTreeNode; | import javax.swing.tree.*; | [
"javax.swing"
] | javax.swing; | 1,285,007 |
public final SparseBooleanArray readSparseBooleanArray() {
int N = readInt();
if (N < 0) {
return null;
}
SparseBooleanArray sa = new SparseBooleanArray(N);
readSparseBooleanArrayInternal(sa, N);
return sa;
} | final SparseBooleanArray function() { int N = readInt(); if (N < 0) { return null; } SparseBooleanArray sa = new SparseBooleanArray(N); readSparseBooleanArrayInternal(sa, N); return sa; } | /**
* Read and return a new SparseBooleanArray object from the parcel at the current
* dataPosition(). Returns null if the previously written list object was
* null.
*/ | Read and return a new SparseBooleanArray object from the parcel at the current dataPosition(). Returns null if the previously written list object was null | readSparseBooleanArray | {
"repo_name": "mateor/PDroidHistory",
"path": "frameworks/base/core/java/android/os/Parcel.java",
"license": "gpl-3.0",
"size": 72041
} | [
"android.util.SparseBooleanArray"
] | import android.util.SparseBooleanArray; | import android.util.*; | [
"android.util"
] | android.util; | 2,761,271 |
Map<String, Long> getDependenciesKinds(); | Map<String, Long> getDependenciesKinds(); | /**
* Returns the value of the '<em><b>Dependencies Kinds</b></em>' map.
* The key is of type {@link java.lang.String},
* and the value is of type {@link java.lang.Long},
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Dependencies Kinds</em>' map isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Dependencies Kinds</em>' map.
* @see turnus.model.analysis.trace.TracePackage#getTraceSizeReport_DependenciesKinds()
* @model mapType="turnus.model.analysis.map.StringToLongMap<org.eclipse.emf.ecore.EString, org.eclipse.emf.ecore.ELongObject>"
* @generated
*/ | Returns the value of the 'Dependencies Kinds' map. The key is of type <code>java.lang.String</code>, and the value is of type <code>java.lang.Long</code>, If the meaning of the 'Dependencies Kinds' map isn't clear, there really should be more of a description here... | getDependenciesKinds | {
"repo_name": "turnus/turnus",
"path": "turnus.model/src/turnus/model/analysis/trace/TraceSizeReport.java",
"license": "gpl-3.0",
"size": 10557
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,549,050 |
public void setListener(EntityPlayer player, float p_148615_2_)
{
if (this.loaded && player != null)
{
float f = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * p_148615_2_;
float f1 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * p_148615_2_;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)p_148615_2_;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)p_148615_2_ + (double)player.getEyeHeight();
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)p_148615_2_;
float f2 = MathHelper.cos((f1 + 90.0F) * 0.017453292F);
float f3 = MathHelper.sin((f1 + 90.0F) * 0.017453292F);
float f4 = MathHelper.cos(-f * 0.017453292F);
float f5 = MathHelper.sin(-f * 0.017453292F);
float f6 = MathHelper.cos((-f + 90.0F) * 0.017453292F);
float f7 = MathHelper.sin((-f + 90.0F) * 0.017453292F);
float f8 = f2 * f4;
float f9 = f3 * f4;
float f10 = f2 * f6;
float f11 = f3 * f6;
this.sndSystem.setListenerPosition((float)d0, (float)d1, (float)d2);
this.sndSystem.setListenerOrientation(f8, f5, f9, f10, f7, f11);
}
} | void function(EntityPlayer player, float p_148615_2_) { if (this.loaded && player != null) { float f = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * p_148615_2_; float f1 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * p_148615_2_; double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double)p_148615_2_; double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double)p_148615_2_ + (double)player.getEyeHeight(); double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double)p_148615_2_; float f2 = MathHelper.cos((f1 + 90.0F) * 0.017453292F); float f3 = MathHelper.sin((f1 + 90.0F) * 0.017453292F); float f4 = MathHelper.cos(-f * 0.017453292F); float f5 = MathHelper.sin(-f * 0.017453292F); float f6 = MathHelper.cos((-f + 90.0F) * 0.017453292F); float f7 = MathHelper.sin((-f + 90.0F) * 0.017453292F); float f8 = f2 * f4; float f9 = f3 * f4; float f10 = f2 * f6; float f11 = f3 * f6; this.sndSystem.setListenerPosition((float)d0, (float)d1, (float)d2); this.sndSystem.setListenerOrientation(f8, f5, f9, f10, f7, f11); } } | /**
* Sets the listener of sounds
*/ | Sets the listener of sounds | setListener | {
"repo_name": "Im-Jrotica/forge_latest",
"path": "build/tmp/recompileMc/sources/net/minecraft/client/audio/SoundManager.java",
"license": "lgpl-2.1",
"size": 23349
} | [
"net.minecraft.entity.player.EntityPlayer",
"net.minecraft.util.math.MathHelper"
] | import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.MathHelper; | import net.minecraft.entity.player.*; import net.minecraft.util.math.*; | [
"net.minecraft.entity",
"net.minecraft.util"
] | net.minecraft.entity; net.minecraft.util; | 2,701,741 |
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
if (getArguments() != null && getArguments()
.containsKey(TomahawkFragment.TOMAHAWK_PREFERENCEID_KEY)) {
String authenticatorId = getArguments().getString(
TomahawkFragment.TOMAHAWK_PREFERENCEID_KEY);
mAuthenticatorUtils = AuthenticatorManager.getInstance().getAuthenticatorUtils(
authenticatorId);
}
LayoutInflater inflater = getActivity().getLayoutInflater();
boolean isLoggedIn = mAuthenticatorUtils.isLoggedIn();
LinearLayout usernameLayout = (LinearLayout) inflater.inflate(R.layout.config_text, null);
mUsernameEditText = (ConfigEdittext) usernameLayout.findViewById(R.id.config_edittext);
mUsernameEditText.setHint(mAuthenticatorUtils.getUserIdEditTextHintResId());
mUsernameEditText.setText(isLoggedIn ? mAuthenticatorUtils.getUserName() : "");
addViewToFrame(usernameLayout);
LinearLayout passwordLayout = (LinearLayout) inflater.inflate(R.layout.config_text, null);
mPasswordEditText = (ConfigEdittext) passwordLayout.findViewById(R.id.config_edittext);
mPasswordEditText.setHint(R.string.logindialog_password_label_string);
mPasswordEditText.setTypeface(Typeface.DEFAULT);
mPasswordEditText.setTransformationMethod(new PasswordTransformationMethod());
mPasswordEditText.setOnEditorActionListener(mOnKeyboardEnterListener);
addViewToFrame(passwordLayout);
if (mAuthenticatorUtils.doesAllowRegistration() && !mAuthenticatorUtils.isLoggedIn()) {
FrameLayout buttonLayout =
(FrameLayout) inflater.inflate(R.layout.config_register_button, null);
addViewToFrame(buttonLayout);
LinearLayout button =
(LinearLayout) buttonLayout.findViewById(R.id.config_register_button);
button.setOnClickListener(new RegisterButtonListener());
}
showSoftKeyboard(mUsernameEditText);
hideEnabledCheckbox();
setDialogTitle(mAuthenticatorUtils.getPrettyName() + ": " + getString(R.string.login));
setStatusImage(mAuthenticatorUtils.getIconResourceId(), isLoggedIn);
updateButtonTexts(isLoggedIn);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
builder.setView(getDialogView());
return builder.create();
} | Dialog function(Bundle savedInstanceState) { if (getArguments() != null && getArguments() .containsKey(TomahawkFragment.TOMAHAWK_PREFERENCEID_KEY)) { String authenticatorId = getArguments().getString( TomahawkFragment.TOMAHAWK_PREFERENCEID_KEY); mAuthenticatorUtils = AuthenticatorManager.getInstance().getAuthenticatorUtils( authenticatorId); } LayoutInflater inflater = getActivity().getLayoutInflater(); boolean isLoggedIn = mAuthenticatorUtils.isLoggedIn(); LinearLayout usernameLayout = (LinearLayout) inflater.inflate(R.layout.config_text, null); mUsernameEditText = (ConfigEdittext) usernameLayout.findViewById(R.id.config_edittext); mUsernameEditText.setHint(mAuthenticatorUtils.getUserIdEditTextHintResId()); mUsernameEditText.setText(isLoggedIn ? mAuthenticatorUtils.getUserName() : STR: " + getString(R.string.login)); setStatusImage(mAuthenticatorUtils.getIconResourceId(), isLoggedIn); updateButtonTexts(isLoggedIn); AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setView(getDialogView()); return builder.create(); } | /**
* Called when this {@link DialogFragment} is being created
*/ | Called when this <code>DialogFragment</code> is being created | onCreateDialog | {
"repo_name": "0359xiaodong/tomahawk-android",
"path": "src/org/tomahawk/tomahawk_android/dialogs/LoginConfigDialog.java",
"license": "gpl-3.0",
"size": 8427
} | [
"android.app.AlertDialog",
"android.app.Dialog",
"android.os.Bundle",
"android.view.LayoutInflater",
"android.widget.LinearLayout",
"org.tomahawk.libtomahawk.authentication.AuthenticatorManager",
"org.tomahawk.tomahawk_android.fragments.TomahawkFragment",
"org.tomahawk.tomahawk_android.ui.widgets.Conf... | import android.app.AlertDialog; import android.app.Dialog; import android.os.Bundle; import android.view.LayoutInflater; import android.widget.LinearLayout; import org.tomahawk.libtomahawk.authentication.AuthenticatorManager; import org.tomahawk.tomahawk_android.fragments.TomahawkFragment; import org.tomahawk.tomahawk_android.ui.widgets.ConfigEdittext; | import android.app.*; import android.os.*; import android.view.*; import android.widget.*; import org.tomahawk.libtomahawk.authentication.*; import org.tomahawk.tomahawk_android.fragments.*; import org.tomahawk.tomahawk_android.ui.widgets.*; | [
"android.app",
"android.os",
"android.view",
"android.widget",
"org.tomahawk.libtomahawk",
"org.tomahawk.tomahawk_android"
] | android.app; android.os; android.view; android.widget; org.tomahawk.libtomahawk; org.tomahawk.tomahawk_android; | 2,461,985 |
LocalizedResource getBlob(LocalResource localResource, PortAndAssignment pna, BlobChangingCallback cb)
throws AuthorizationException, KeyNotFoundException, IOException {
ArrayList<LocalResource> arr = new ArrayList<>();
arr.add(localResource);
List<LocalizedResource> results = getBlobs(arr, pna, cb);
if (results.isEmpty() || results.size() != 1) {
throw new IOException("Unknown error getting blob: " + localResource + ", for user: " + pna.getOwner() +
", topo: " + pna);
}
return results.get(0);
}
}
class TestInputStreamWithMeta extends InputStreamWithMeta {
private final long version;
private final long fileLength;
private InputStream iostream;
public TestInputStreamWithMeta(long version) {
final String DEFAULT_DATA = "some test data for my input stream";
iostream = IOUtils.toInputStream(DEFAULT_DATA);
this.version = version;
this.fileLength = DEFAULT_DATA.length();
}
public TestInputStreamWithMeta(InputStream istream, long version, long fileLength) {
iostream = istream;
this.version = version;
this.fileLength = fileLength;
} | LocalizedResource getBlob(LocalResource localResource, PortAndAssignment pna, BlobChangingCallback cb) throws AuthorizationException, KeyNotFoundException, IOException { ArrayList<LocalResource> arr = new ArrayList<>(); arr.add(localResource); List<LocalizedResource> results = getBlobs(arr, pna, cb); if (results.isEmpty() results.size() != 1) { throw new IOException(STR + localResource + STR + pna.getOwner() + STR + pna); } return results.get(0); } } class TestInputStreamWithMeta extends InputStreamWithMeta { private final long version; private final long fileLength; private InputStream iostream; public TestInputStreamWithMeta(long version) { final String DEFAULT_DATA = STR; iostream = IOUtils.toInputStream(DEFAULT_DATA); this.version = version; this.fileLength = DEFAULT_DATA.length(); } public TestInputStreamWithMeta(InputStream istream, long version, long fileLength) { iostream = istream; this.version = version; this.fileLength = fileLength; } | /**
* This function either returns the blob in the existing cache or if it doesn't exist in the
* cache, it will download the blob and will block until the download is complete.
*/ | This function either returns the blob in the existing cache or if it doesn't exist in the cache, it will download the blob and will block until the download is complete | getBlob | {
"repo_name": "kishorvpatil/incubator-storm",
"path": "storm-server/src/test/java/org/apache/storm/localizer/AsyncLocalizerTest.java",
"license": "apache-2.0",
"size": 56145
} | [
"java.io.IOException",
"java.io.InputStream",
"java.util.ArrayList",
"java.util.List",
"org.apache.commons.io.IOUtils",
"org.apache.storm.blobstore.InputStreamWithMeta",
"org.apache.storm.generated.AuthorizationException",
"org.apache.storm.generated.KeyNotFoundException"
] | import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; import org.apache.commons.io.IOUtils; import org.apache.storm.blobstore.InputStreamWithMeta; import org.apache.storm.generated.AuthorizationException; import org.apache.storm.generated.KeyNotFoundException; | import java.io.*; import java.util.*; import org.apache.commons.io.*; import org.apache.storm.blobstore.*; import org.apache.storm.generated.*; | [
"java.io",
"java.util",
"org.apache.commons",
"org.apache.storm"
] | java.io; java.util; org.apache.commons; org.apache.storm; | 1,625,944 |
@Override
public void acceptField(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, boolean isDeclaration, char[] uniqueKey, int start, int end) {
if(isDeclaration) {
IType type= resolveTypeByLocation(declaringTypePackageName, declaringTypeName,
NameLookup.ACCEPT_ALL,
start, end);
if(type != null) {
try {
IField[] fields = type.getFields();
for (int i = 0; i < fields.length; i++) {
IField field = fields[i];
ISourceRange range = field.getNameRange();
if(range.getOffset() <= start
&& range.getOffset() + range.getLength() >= end
&& field.getElementName().equals(new String(name))) {
addElement(fields[i]);
if(SelectionEngine.DEBUG){
System.out.print("SELECTION - accept field("); //$NON-NLS-1$
System.out.print(field.toString());
System.out.println(")"); //$NON-NLS-1$
}
return; // only one method is possible
}
}
} catch (JavaModelException e) {
return;
}
}
} else {
IType type= resolveType(declaringTypePackageName, declaringTypeName, NameLookup.ACCEPT_ALL);
if (type != null) {
IField field= type.getField(new String(name));
if (field.exists()) {
if (uniqueKey != null) {
if(field.isBinary()) {
ResolvedBinaryField resolvedField = new ResolvedBinaryField(
(JavaElement)field.getParent(),
field.getElementName(),
new String(uniqueKey));
resolvedField.occurrenceCount = field.getOccurrenceCount();
field = resolvedField;
} else {
ResolvedSourceField resolvedField = new ResolvedSourceField(
(JavaElement)field.getParent(),
field.getElementName(),
new String(uniqueKey));
resolvedField.occurrenceCount = field.getOccurrenceCount();
field = resolvedField;
}
}
addElement(field);
if(SelectionEngine.DEBUG){
System.out.print("SELECTION - accept field("); //$NON-NLS-1$
System.out.print(field.toString());
System.out.println(")"); //$NON-NLS-1$
}
}
}
}
} | void function(char[] declaringTypePackageName, char[] declaringTypeName, char[] name, boolean isDeclaration, char[] uniqueKey, int start, int end) { if(isDeclaration) { IType type= resolveTypeByLocation(declaringTypePackageName, declaringTypeName, NameLookup.ACCEPT_ALL, start, end); if(type != null) { try { IField[] fields = type.getFields(); for (int i = 0; i < fields.length; i++) { IField field = fields[i]; ISourceRange range = field.getNameRange(); if(range.getOffset() <= start && range.getOffset() + range.getLength() >= end && field.getElementName().equals(new String(name))) { addElement(fields[i]); if(SelectionEngine.DEBUG){ System.out.print(STR); System.out.print(field.toString()); System.out.println(")"); } return; } } } catch (JavaModelException e) { return; } } } else { IType type= resolveType(declaringTypePackageName, declaringTypeName, NameLookup.ACCEPT_ALL); if (type != null) { IField field= type.getField(new String(name)); if (field.exists()) { if (uniqueKey != null) { if(field.isBinary()) { ResolvedBinaryField resolvedField = new ResolvedBinaryField( (JavaElement)field.getParent(), field.getElementName(), new String(uniqueKey)); resolvedField.occurrenceCount = field.getOccurrenceCount(); field = resolvedField; } else { ResolvedSourceField resolvedField = new ResolvedSourceField( (JavaElement)field.getParent(), field.getElementName(), new String(uniqueKey)); resolvedField.occurrenceCount = field.getOccurrenceCount(); field = resolvedField; } } addElement(field); if(SelectionEngine.DEBUG){ System.out.print(STR); System.out.print(field.toString()); System.out.println(")"); } } } } } | /**
* Resolve the field.
*/ | Resolve the field | acceptField | {
"repo_name": "Niky4000/UsefulUtils",
"path": "projects/others/eclipse-platform-parent/eclipse.jdt.core-master/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java",
"license": "gpl-3.0",
"size": 37726
} | [
"org.eclipse.jdt.core.IField",
"org.eclipse.jdt.core.ISourceRange",
"org.eclipse.jdt.core.IType",
"org.eclipse.jdt.core.JavaModelException",
"org.eclipse.jdt.internal.codeassist.SelectionEngine"
] | import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.ISourceRange; import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.codeassist.SelectionEngine; | import org.eclipse.jdt.core.*; import org.eclipse.jdt.internal.codeassist.*; | [
"org.eclipse.jdt"
] | org.eclipse.jdt; | 2,406,791 |
private File minifyJs(String filename, String prefix) throws IOException {
File minifiedFile = File.createTempFile(prefix, Constants.JS);
try (BufferedReader reader = new BufferedReader(new FileReader(filename))) {
String line;
StringBuilder buffer = new StringBuilder();
while((line = reader.readLine())!=null) {
// on pourrait supprimer les espaces supperflus, mais il faut tenir compte de : function_, return_, var_, _in_, _new_, else_if, delete_, get_, set_
line = line.replaceAll("^\\s*", "").replaceAll("^//.*", "").replaceAll("\\s+", " ").replaceAll("([;{])\\s*//.*", "$1");
if(line.isEmpty()) {
} else {
buffer.append(line);
}
}
try (Writer writer = new FileWriter(minifiedFile)) {
writer.write(buffer.toString().replaceAll("/\\*(?:.|[\\n\\r])*?\\*/", ""));
}
}
return minifiedFile;
}
| File function(String filename, String prefix) throws IOException { File minifiedFile = File.createTempFile(prefix, Constants.JS); try (BufferedReader reader = new BufferedReader(new FileReader(filename))) { String line; StringBuilder buffer = new StringBuilder(); while((line = reader.readLine())!=null) { line = line.replaceAll("^\\s*", STR^ if(line.isEmpty()) { } else { buffer.append(line); } } try (Writer writer = new FileWriter(minifiedFile)) { writer.write(buffer.toString().replaceAll(STR, "")); } } return minifiedFile; } | /**
* Minify javascriptFile
*
* @param filename
* @param prefix
* @return
* @throws IOException
*/ | Minify javascriptFile | minifyJs | {
"repo_name": "antoinesd/ocelot",
"path": "ocelot-web/src/main/java/org/ocelotds/web/ContextListener.java",
"license": "mpl-2.0",
"size": 7435
} | [
"java.io.BufferedReader",
"java.io.File",
"java.io.FileReader",
"java.io.FileWriter",
"java.io.IOException",
"java.io.Writer",
"org.ocelotds.Constants"
] | import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.Writer; import org.ocelotds.Constants; | import java.io.*; import org.ocelotds.*; | [
"java.io",
"org.ocelotds"
] | java.io; org.ocelotds; | 1,846,924 |
public List<LocaleEncodingMappingListType<WebAppType<T>>> getAllLocaleEncodingMappingList(); | List<LocaleEncodingMappingListType<WebAppType<T>>> function(); | /**
* Returns all <code>locale-encoding-mapping-list</code> elements
* @return list of <code>locale-encoding-mapping-list</code>
*/ | Returns all <code>locale-encoding-mapping-list</code> elements | getAllLocaleEncodingMappingList | {
"repo_name": "forge/javaee-descriptors",
"path": "api/src/main/java/org/jboss/shrinkwrap/descriptor/api/webapp31/WebAppType.java",
"license": "epl-1.0",
"size": 60822
} | [
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.webcommon31.LocaleEncodingMappingListType"
] | import java.util.List; import org.jboss.shrinkwrap.descriptor.api.webcommon31.LocaleEncodingMappingListType; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.webcommon31.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 2,563,369 |
private boolean isDuplicateStudyGroup(AddProtocolStudyGroupEvent event) {
boolean duplicateStudyGroup = false;
IacucProtocolStudyGroupBean procedureBean = event.getProcedureBean();
List<String> protocolSpeciesAndGroups = procedureBean.getProtocolSpeciesAndGroups();
for(String iacucProtocolSpeciesId : protocolSpeciesAndGroups) {
Integer newProtocolSpeciesId = Integer.parseInt(iacucProtocolSpeciesId);
for(IacucProtocolStudyGroup detailBean : procedureBean.getIacucProtocolStudyGroups()) {
if(detailBean.getIacucProtocolSpeciesId().equals(newProtocolSpeciesId)) {
GlobalVariables.getMessageMap().putError(getErrorPath(event),
KeyConstants.ERROR_IACUC_VALIDATION_DUPLICATE_STUDY_GROUP);
duplicateStudyGroup = true;
}
}
}
return duplicateStudyGroup;
} | boolean function(AddProtocolStudyGroupEvent event) { boolean duplicateStudyGroup = false; IacucProtocolStudyGroupBean procedureBean = event.getProcedureBean(); List<String> protocolSpeciesAndGroups = procedureBean.getProtocolSpeciesAndGroups(); for(String iacucProtocolSpeciesId : protocolSpeciesAndGroups) { Integer newProtocolSpeciesId = Integer.parseInt(iacucProtocolSpeciesId); for(IacucProtocolStudyGroup detailBean : procedureBean.getIacucProtocolStudyGroups()) { if(detailBean.getIacucProtocolSpeciesId().equals(newProtocolSpeciesId)) { GlobalVariables.getMessageMap().putError(getErrorPath(event), KeyConstants.ERROR_IACUC_VALIDATION_DUPLICATE_STUDY_GROUP); duplicateStudyGroup = true; } } } return duplicateStudyGroup; } | /**
* This method is to check for duplicate study group in the list
* @param event
* @return
*/ | This method is to check for duplicate study group in the list | isDuplicateStudyGroup | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/kra/iacuc/procedures/rule/AddProtocolStudyGroupRule.java",
"license": "apache-2.0",
"size": 4641
} | [
"java.util.List",
"org.kuali.kra.iacuc.procedures.IacucProtocolStudyGroup",
"org.kuali.kra.iacuc.procedures.IacucProtocolStudyGroupBean",
"org.kuali.kra.infrastructure.KeyConstants",
"org.kuali.rice.krad.util.GlobalVariables"
] | import java.util.List; import org.kuali.kra.iacuc.procedures.IacucProtocolStudyGroup; import org.kuali.kra.iacuc.procedures.IacucProtocolStudyGroupBean; import org.kuali.kra.infrastructure.KeyConstants; import org.kuali.rice.krad.util.GlobalVariables; | import java.util.*; import org.kuali.kra.iacuc.procedures.*; import org.kuali.kra.infrastructure.*; import org.kuali.rice.krad.util.*; | [
"java.util",
"org.kuali.kra",
"org.kuali.rice"
] | java.util; org.kuali.kra; org.kuali.rice; | 2,548,674 |
private void advance() {
next = null;
while (it.hasNext()) {
GridCacheEntryEx entry = it.next();
try {
next = toCacheEntry(entry, deserializeBinary);
if (next == null)
continue;
break;
}
catch (IgniteCheckedException e) {
throw CU.convertToCacheException(e);
}
catch (GridCacheEntryRemovedException ignore) {
// No-op.
}
}
}
};
} | void function() { next = null; while (it.hasNext()) { GridCacheEntryEx entry = it.next(); try { next = toCacheEntry(entry, deserializeBinary); if (next == null) continue; break; } catch (IgniteCheckedException e) { throw CU.convertToCacheException(e); } catch (GridCacheEntryRemovedException ignore) { } } } }; } | /**
* Switch to next entry.
*/ | Switch to next entry | advance | {
"repo_name": "andrey-kuznetsov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheAdapter.java",
"license": "apache-2.0",
"size": 237987
} | [
"org.apache.ignite.IgniteCheckedException",
"org.apache.ignite.internal.util.typedef.internal.CU"
] | import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.internal.util.typedef.internal.CU; | import org.apache.ignite.*; import org.apache.ignite.internal.util.typedef.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 1,330,764 |
@Override
public void onAuthSuccess(String accountName, boolean newlyAuthenticated) {
Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
LOGD(TAG, "onAuthSuccess, account " + accountName + ", newlyAuthenticated="
+ newlyAuthenticated);
refreshAccountDependantData();
if (newlyAuthenticated) {
LOGD(TAG, "Enabling auto sync on content provider for account " + accountName);
SyncHelper.updateSyncInterval(this, account);
SyncHelper.requestManualSync(account);
}
populateNavDrawer();
} | void function(String accountName, boolean newlyAuthenticated) { Account account = new Account(accountName, GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE); LOGD(TAG, STR + accountName + STR + newlyAuthenticated); refreshAccountDependantData(); if (newlyAuthenticated) { LOGD(TAG, STR + accountName); SyncHelper.updateSyncInterval(this, account); SyncHelper.requestManualSync(account); } populateNavDrawer(); } | /**
* Called when authentication succeeds. This may either happen because the user just
* authenticated for the first time (and went through the sign in flow), or because it's
* a returning user.
*
* @param accountName name of the account that just authenticated successfully.
* @param newlyAuthenticated If true, this user just authenticated for the first time.
* If false, it's a returning user.
*/ | Called when authentication succeeds. This may either happen because the user just authenticated for the first time (and went through the sign in flow), or because it's a returning user | onAuthSuccess | {
"repo_name": "lokling/AndroiditoJZ",
"path": "android/src/main/java/com/google/samples/apps/iosched/ui/BaseActivity.java",
"license": "apache-2.0",
"size": 50557
} | [
"android.accounts.Account",
"com.google.android.gms.auth.GoogleAuthUtil",
"com.google.samples.apps.iosched.sync.SyncHelper"
] | import android.accounts.Account; import com.google.android.gms.auth.GoogleAuthUtil; import com.google.samples.apps.iosched.sync.SyncHelper; | import android.accounts.*; import com.google.android.gms.auth.*; import com.google.samples.apps.iosched.sync.*; | [
"android.accounts",
"com.google.android",
"com.google.samples"
] | android.accounts; com.google.android; com.google.samples; | 1,602,196 |
@Test
public void testNewRegistrationsWithInvalidEndDate() throws Exception {
NewRegistrationReportForm form = new NewRegistrationReportForm();
form.setStartDate("04/30/2013");
form.setEndDate("endDate");
BindingResult result = validate(form);
request.setParameter("lang", Locale.getDefault().toString());
String resultString = reportController.newRegistrations(map, request, form, result);
Assert.assertNotNull(resultString);
Assert.assertEquals("report.newRegistration", resultString);
Report report = (Report) map.get("report");
Assert.assertNull(report);
} | void function() throws Exception { NewRegistrationReportForm form = new NewRegistrationReportForm(); form.setStartDate(STR); form.setEndDate(STR); BindingResult result = validate(form); request.setParameter("lang", Locale.getDefault().toString()); String resultString = reportController.newRegistrations(map, request, form, result); Assert.assertNotNull(resultString); Assert.assertEquals(STR, resultString); Report report = (Report) map.get(STR); Assert.assertNull(report); } | /**
* Author: vinayv Description: Test to generate and validate New Registration Report with Invalid End Date.
*/ | Author: vinayv Description: Test to generate and validate New Registration Report with Invalid End Date | testNewRegistrationsWithInvalidEndDate | {
"repo_name": "backbrainer/cpbm-customization",
"path": "citrix.cpbm.custom.portal/src/test/java/fragment/web/AbstractReportControllerTest.java",
"license": "bsd-2-clause",
"size": 35433
} | [
"com.vmops.model.Report",
"com.vmops.web.forms.NewRegistrationReportForm",
"java.util.Locale",
"org.junit.Assert",
"org.springframework.validation.BindingResult"
] | import com.vmops.model.Report; import com.vmops.web.forms.NewRegistrationReportForm; import java.util.Locale; import org.junit.Assert; import org.springframework.validation.BindingResult; | import com.vmops.model.*; import com.vmops.web.forms.*; import java.util.*; import org.junit.*; import org.springframework.validation.*; | [
"com.vmops.model",
"com.vmops.web",
"java.util",
"org.junit",
"org.springframework.validation"
] | com.vmops.model; com.vmops.web; java.util; org.junit; org.springframework.validation; | 882,050 |
protected static final Exercise getExercise() {
return Exercise.getExercise();
} | static final Exercise function() { return Exercise.getExercise(); } | /**
* This is a shortcut method for subclasses of Mode. It returns
* Exercise.getExercise()
* @return
*/ | This is a shortcut method for subclasses of Mode. It returns Exercise.getExercise() | getExercise | {
"repo_name": "jogjayr/InTEL-Project",
"path": "Statics/src/edu/gatech/statics/Mode.java",
"license": "gpl-3.0",
"size": 2510
} | [
"edu.gatech.statics.exercise.Exercise"
] | import edu.gatech.statics.exercise.Exercise; | import edu.gatech.statics.exercise.*; | [
"edu.gatech.statics"
] | edu.gatech.statics; | 1,247,175 |
void shutdown(NetworkProfile network, NetworkOffering offering); | void shutdown(NetworkProfile network, NetworkOffering offering); | /**
* When no virtual machines are running in the network, the network is
* shutdown and all physical resources are released. The NetworkGuru is
* informed via the shutdown method().
*
* @param network guest network being shut down
* @param offering network offering the guest network was created with.
*/ | When no virtual machines are running in the network, the network is shutdown and all physical resources are released. The NetworkGuru is informed via the shutdown method() | shutdown | {
"repo_name": "GabrielBrascher/cloudstack",
"path": "api/src/main/java/com/cloud/network/guru/NetworkGuru.java",
"license": "apache-2.0",
"size": 10338
} | [
"com.cloud.network.NetworkProfile",
"com.cloud.offering.NetworkOffering"
] | import com.cloud.network.NetworkProfile; import com.cloud.offering.NetworkOffering; | import com.cloud.network.*; import com.cloud.offering.*; | [
"com.cloud.network",
"com.cloud.offering"
] | com.cloud.network; com.cloud.offering; | 61,372 |
public static void setContentSettingCustomScope(BrowserContextHandle browserContextHandle,
@ContentSettingsType int contentSettingType, String primaryPattern,
String secondaryPattern, @ContentSettingValues int setting) {
// Currently only Cookie Settings support a non-empty, non-wildcard secondaryPattern.
// In addition, if a Cookie Setting uses secondaryPattern, the primaryPattern must be
// the wildcard.
if (contentSettingType != ContentSettingsType.COOKIES) {
assert secondaryPattern.equals(SITE_WILDCARD) || secondaryPattern.isEmpty();
} else if (!secondaryPattern.equals(SITE_WILDCARD) && !secondaryPattern.isEmpty()) {
assert primaryPattern.equals(SITE_WILDCARD);
}
WebsitePreferenceBridgeJni.get().setContentSettingCustomScope(browserContextHandle,
contentSettingType, primaryPattern, secondaryPattern, setting);
} | static void function(BrowserContextHandle browserContextHandle, @ContentSettingsType int contentSettingType, String primaryPattern, String secondaryPattern, @ContentSettingValues int setting) { if (contentSettingType != ContentSettingsType.COOKIES) { assert secondaryPattern.equals(SITE_WILDCARD) secondaryPattern.isEmpty(); } else if (!secondaryPattern.equals(SITE_WILDCARD) && !secondaryPattern.isEmpty()) { assert primaryPattern.equals(SITE_WILDCARD); } WebsitePreferenceBridgeJni.get().setContentSettingCustomScope(browserContextHandle, contentSettingType, primaryPattern, secondaryPattern, setting); } | /**
* Sets the ContentSetting for a specific pattern combination.Unless adding a custom-scoped
* setting, most developers will want to use setContentSettingDefaultScope()
* instead.
* See HostContentSettingsMap::SetContentSettingCustomScope() for more details.
*/ | Sets the ContentSetting for a specific pattern combination.Unless adding a custom-scoped setting, most developers will want to use setContentSettingDefaultScope() instead. See HostContentSettingsMap::SetContentSettingCustomScope() for more details | setContentSettingCustomScope | {
"repo_name": "chromium/chromium",
"path": "components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/WebsitePreferenceBridge.java",
"license": "bsd-3-clause",
"size": 20075
} | [
"org.chromium.components.content_settings.ContentSettingValues",
"org.chromium.components.content_settings.ContentSettingsType",
"org.chromium.content_public.browser.BrowserContextHandle"
] | import org.chromium.components.content_settings.ContentSettingValues; import org.chromium.components.content_settings.ContentSettingsType; import org.chromium.content_public.browser.BrowserContextHandle; | import org.chromium.components.content_settings.*; import org.chromium.content_public.browser.*; | [
"org.chromium.components",
"org.chromium.content_public"
] | org.chromium.components; org.chromium.content_public; | 1,301,181 |
public RestClientBuilder setHttpClientConfigCallback(HttpClientConfigCallback httpClientConfigCallback) {
Objects.requireNonNull(httpClientConfigCallback, "httpClientConfigCallback must not be null");
this.httpClientConfigCallback = httpClientConfigCallback;
return this;
} | RestClientBuilder function(HttpClientConfigCallback httpClientConfigCallback) { Objects.requireNonNull(httpClientConfigCallback, STR); this.httpClientConfigCallback = httpClientConfigCallback; return this; } | /**
* Sets the {@link HttpClientConfigCallback} to be used to customize http client configuration
*/ | Sets the <code>HttpClientConfigCallback</code> to be used to customize http client configuration | setHttpClientConfigCallback | {
"repo_name": "dpursehouse/elasticsearch",
"path": "client/rest/src/main/java/org/elasticsearch/client/RestClientBuilder.java",
"license": "apache-2.0",
"size": 8272
} | [
"java.util.Objects"
] | import java.util.Objects; | import java.util.*; | [
"java.util"
] | java.util; | 614,562 |
public ServiceFuture<VirtualNetworkGatewayInner> getByResourceGroupAsync(String resourceGroupName, String virtualNetworkGatewayName, final ServiceCallback<VirtualNetworkGatewayInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName), serviceCallback);
} | ServiceFuture<VirtualNetworkGatewayInner> function(String resourceGroupName, String virtualNetworkGatewayName, final ServiceCallback<VirtualNetworkGatewayInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, virtualNetworkGatewayName), serviceCallback); } | /**
* Gets the specified virtual network gateway by resource group.
*
* @param resourceGroupName The name of the resource group.
* @param virtualNetworkGatewayName The name of the virtual network gateway.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Gets the specified virtual network gateway by resource group | getByResourceGroupAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_04_01/src/main/java/com/microsoft/azure/management/network/v2019_04_01/implementation/VirtualNetworkGatewaysInner.java",
"license": "mit",
"size": 231307
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 2,113,908 |
@ServiceMethod(returns = ReturnType.SINGLE)
Mono<ProximityPlacementGroupInner> createOrUpdateAsync(
String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters); | @ServiceMethod(returns = ReturnType.SINGLE) Mono<ProximityPlacementGroupInner> createOrUpdateAsync( String resourceGroupName, String proximityPlacementGroupName, ProximityPlacementGroupInner parameters); | /**
* Create or update a proximity placement group.
*
* @param resourceGroupName The name of the resource group.
* @param proximityPlacementGroupName The name of the proximity placement group.
* @param parameters Specifies information about the proximity placement group.
* @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 specifies information about the proximity placement group.
*/ | Create or update a proximity placement group | createOrUpdateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-compute/src/main/java/com/azure/resourcemanager/compute/fluent/ProximityPlacementGroupsClient.java",
"license": "mit",
"size": 20219
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.compute.fluent.models.ProximityPlacementGroupInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.compute.fluent.models.ProximityPlacementGroupInner; | import com.azure.core.annotation.*; import com.azure.resourcemanager.compute.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 1,717,161 |
@Override
public boolean equals(Object object) {
if (object == this ) {
return true;
}
if (object instanceof AbstractStorelessUnivariateStatistic == false) {
return false;
}
AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object;
return getClass().equals(stat.getClass())&&
Precision.equalsIncludingNaN(stat.getResult(), this.getResult()) &&
Precision.equalsIncludingNaN(stat.getN(), this.getN());
} | boolean function(Object object) { if (object == this ) { return true; } if (object instanceof AbstractStorelessUnivariateStatistic == false) { return false; } AbstractStorelessUnivariateStatistic stat = (AbstractStorelessUnivariateStatistic) object; return getClass().equals(stat.getClass())&& Precision.equalsIncludingNaN(stat.getResult(), this.getResult()) && Precision.equalsIncludingNaN(stat.getN(), this.getN()); } | /**
* Returns true iff <code>object</code> is an
* <code>AbstractStorelessUnivariateStatistic</code> returning the same
* values as this for <code>getResult()</code> and <code>getN()</code>
* @param object object to test equality against.
* @return true if object returns the same value as this
*/ | Returns true iff <code>object</code> is an <code>AbstractStorelessUnivariateStatistic</code> returning the same values as this for <code>getResult()</code> and <code>getN()</code> | equals | {
"repo_name": "venkateshamurthy/java-quantiles",
"path": "src/main/java/org/apache/commons/math3/stat/descriptive/AbstractStorelessUnivariateStatistic.java",
"license": "apache-2.0",
"size": 7359
} | [
"org.apache.commons.math3.util.Precision"
] | import org.apache.commons.math3.util.Precision; | import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,724,679 |
public ReducedQueryPhase reducedQueryPhase(Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits) {
return reducedQueryPhase(queryResults, null, new ArrayList<>(), new TopDocsStats(trackTotalHits), 0, isScrollRequest);
} | ReducedQueryPhase function(Collection<? extends SearchPhaseResult> queryResults, boolean isScrollRequest, boolean trackTotalHits) { return reducedQueryPhase(queryResults, null, new ArrayList<>(), new TopDocsStats(trackTotalHits), 0, isScrollRequest); } | /**
* Reduces the given query results and consumes all aggregations and profile results.
* @param queryResults a list of non-null query shard results
*/ | Reduces the given query results and consumes all aggregations and profile results | reducedQueryPhase | {
"repo_name": "jprante/elasticsearch-server",
"path": "server/src/main/java/org/elasticsearch/action/search/SearchPhaseController.java",
"license": "apache-2.0",
"size": 41456
} | [
"java.util.ArrayList",
"java.util.Collection",
"org.elasticsearch.search.SearchPhaseResult"
] | import java.util.ArrayList; import java.util.Collection; import org.elasticsearch.search.SearchPhaseResult; | import java.util.*; import org.elasticsearch.search.*; | [
"java.util",
"org.elasticsearch.search"
] | java.util; org.elasticsearch.search; | 2,287,806 |
void handle(AvaIre avaire); | void handle(AvaIre avaire); | /**
* Handles the task when the task is ready to be invoked.
*
* @param avaire The AvaIre class instance.
*/ | Handles the task when the task is ready to be invoked | handle | {
"repo_name": "avaire/orion",
"path": "src/main/java/com/avairebot/contracts/scheduler/Task.java",
"license": "gpl-3.0",
"size": 970
} | [
"com.avairebot.AvaIre"
] | import com.avairebot.AvaIre; | import com.avairebot.*; | [
"com.avairebot"
] | com.avairebot; | 2,469,473 |
private String createFingerprint(final Document flowDoc, final FlowController controller) throws NoSuchAlgorithmException {
if (flowDoc == null) {
return "";
}
// builder to hold fingerprint state
final StringBuilder fingerprintBuilder = new StringBuilder();
// add flow controller fingerprint
final Element flowControllerElem = flowDoc.getDocumentElement();
if (flowControllerElem == null) {
logger.warn("Unable to create fingerprint because no 'flowController' element found in XML.");
return "";
}
final FlowEncodingVersion encodingVersion = FlowEncodingVersion.parse(flowControllerElem);
addFlowControllerFingerprint(fingerprintBuilder, flowControllerElem, controller, encodingVersion);
return fingerprintBuilder.toString();
} | String function(final Document flowDoc, final FlowController controller) throws NoSuchAlgorithmException { if (flowDoc == null) { return STRUnable to create fingerprint because no 'flowController' element found in XML.STR"; } final FlowEncodingVersion encodingVersion = FlowEncodingVersion.parse(flowControllerElem); addFlowControllerFingerprint(fingerprintBuilder, flowControllerElem, controller, encodingVersion); return fingerprintBuilder.toString(); } | /**
* Creates a fingerprint from an XML document representing the flow.xml.
*
* @param flowDoc the DOM
*
* @return the fingerprint
*
* @throws NoSuchAlgorithmException ex
* @throws UnsupportedEncodingException ex
*/ | Creates a fingerprint from an XML document representing the flow.xml | createFingerprint | {
"repo_name": "jtstorck/nifi",
"path": "nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/fingerprint/FingerprintFactory.java",
"license": "apache-2.0",
"size": 44792
} | [
"java.security.NoSuchAlgorithmException",
"org.apache.nifi.controller.FlowController",
"org.apache.nifi.controller.serialization.FlowEncodingVersion",
"org.w3c.dom.Document"
] | import java.security.NoSuchAlgorithmException; import org.apache.nifi.controller.FlowController; import org.apache.nifi.controller.serialization.FlowEncodingVersion; import org.w3c.dom.Document; | import java.security.*; import org.apache.nifi.controller.*; import org.apache.nifi.controller.serialization.*; import org.w3c.dom.*; | [
"java.security",
"org.apache.nifi",
"org.w3c.dom"
] | java.security; org.apache.nifi; org.w3c.dom; | 733,860 |
@GET
@Path("{organizationId}/plans/{planId}")
@Produces(MediaType.APPLICATION_JSON)
public PlanBean getPlan(@PathParam("organizationId") String organizationId,
@PathParam("planId") String planId) throws PlanNotFoundException,
NotAuthorizedException; | @Path(STR) @Produces(MediaType.APPLICATION_JSON) PlanBean function(@PathParam(STR) String organizationId, @PathParam(STR) String planId) throws PlanNotFoundException, NotAuthorizedException; | /**
* Use this endpoint to retrieve information about a single Plan by ID. Note
* that this only returns information about the Plan, not about any particular
* *version* of the Plan.
* @summary Get Plan By ID
* @param organizationId The Organization ID.
* @param planId The Plan ID.
* @statuscode 200 If the Plan is successfully returned.
* @statuscode 404 If the Organization does not exist.
* @statuscode 404 If the Plan does not exist.
* @return An Plan.
* when trying to get, update, or delete an plan that does not exist
* @throws PlanNotFoundException when trying to get, update, or delete an plan that does not exist
* @throws NotAuthorizedException when the user attempts to do or see something that they are not authorized (do not have permission) to
*/ | Use this endpoint to retrieve information about a single Plan by ID. Note that this only returns information about the Plan, not about any particular version* of the Plan | getPlan | {
"repo_name": "kunallimaye/apiman",
"path": "manager/api/rest/src/main/java/io/apiman/manager/api/rest/contract/IOrganizationResource.java",
"license": "apache-2.0",
"size": 111368
} | [
"io.apiman.manager.api.beans.plans.PlanBean",
"io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException",
"io.apiman.manager.api.rest.contract.exceptions.PlanNotFoundException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.Produces",
"javax.ws.rs.core.MediaType"
] | import io.apiman.manager.api.beans.plans.PlanBean; import io.apiman.manager.api.rest.contract.exceptions.NotAuthorizedException; import io.apiman.manager.api.rest.contract.exceptions.PlanNotFoundException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; | import io.apiman.manager.api.beans.plans.*; import io.apiman.manager.api.rest.contract.exceptions.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"io.apiman.manager",
"javax.ws"
] | io.apiman.manager; javax.ws; | 820,442 |
public static String getTimeNow(Date theTime) {
return getDateTime(TIME_PATTERN, theTime);
} | static String function(Date theTime) { return getDateTime(TIME_PATTERN, theTime); } | /**
* This method returns the current date time in the format:
* MM/dd/yyyy HH:MM a
*
* @param theTime the current time
* @return the current date/time
*/ | This method returns the current date time in the format: | getTimeNow | {
"repo_name": "dlwhitehurst/MusicRecital",
"path": "src/main/java/org/musicrecital/util/DateUtil.java",
"license": "apache-2.0",
"size": 6282
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 979,345 |
@Test
public void testOptimizedMarshallerIndex() {
// Put objects of different types into the same cache
CacheConfiguration<Object, Object> ccfg = cacheConfiguration("PersonEn");
IgniteCache<Object, Object> cache = grid().getOrCreateCache(ccfg);
cache.put(UUID.randomUUID(), new Person(TEST_NAME1, 42));
cache.put(UUID.randomUUID(), new FalsePerson(32, TEST_NAME2));
// Run query against one particular type
SqlFieldsQueryEx qry = new SqlFieldsQueryEx(
"select * from " + QueryUtils.typeName(FalsePerson.class), true);
// If fix for IGNITE-6915 doesn't work you should see exception like the one below in the log:
//
// org.h2.jdbc.JdbcSQLException: General error: "class org.apache.ignite.IgniteCheckedException:
// Failed to invoke getter method [type=int, property=name,
// obj=org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest$Person@...:
// org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest$Person@...,
// getter=public int org.apache.ignite.internal.processors.cache.index.OptimizedMarshallerIndexNameTest$FalsePerson.getName()]"
List<List<?>> res = cache.query(qry).getAll();
assertEquals(1, res.size());
} | void function() { CacheConfiguration<Object, Object> ccfg = cacheConfiguration(STR); IgniteCache<Object, Object> cache = grid().getOrCreateCache(ccfg); cache.put(UUID.randomUUID(), new Person(TEST_NAME1, 42)); cache.put(UUID.randomUUID(), new FalsePerson(32, TEST_NAME2)); SqlFieldsQueryEx qry = new SqlFieldsQueryEx( STR + QueryUtils.typeName(FalsePerson.class), true); List<List<?>> res = cache.query(qry).getAll(); assertEquals(1, res.size()); } | /**
* Verifies that BPlusTree are not erroneously shared between tables in the same cache
* due to IGNITE-6915 bug.
*/ | Verifies that BPlusTree are not erroneously shared between tables in the same cache due to IGNITE-6915 bug | testOptimizedMarshallerIndex | {
"repo_name": "NSAmelchev/ignite",
"path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/index/OptimizedMarshallerIndexNameTest.java",
"license": "apache-2.0",
"size": 9084
} | [
"java.util.List",
"java.util.UUID",
"org.apache.ignite.IgniteCache",
"org.apache.ignite.configuration.CacheConfiguration",
"org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx",
"org.apache.ignite.internal.processors.query.QueryUtils"
] | import java.util.List; import java.util.UUID; import org.apache.ignite.IgniteCache; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.processors.cache.query.SqlFieldsQueryEx; import org.apache.ignite.internal.processors.query.QueryUtils; | import java.util.*; import org.apache.ignite.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.processors.cache.query.*; import org.apache.ignite.internal.processors.query.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 183,124 |
public static String valToString(Object val) {
return ItemUtils.valToString(val);
} | static String function(Object val) { return ItemUtils.valToString(val); } | /**
* Returns the string representation of the given value; or null if the
* value is null. For <code>BigDecimal</code> it will be the string
* representation without an exponent field.
*/ | Returns the string representation of the given value; or null if the value is null. For <code>BigDecimal</code> it will be the string representation without an exponent field | valToString | {
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/internal/InternalUtils.java",
"license": "apache-2.0",
"size": 11471
} | [
"com.amazonaws.services.dynamodbv2.document.ItemUtils"
] | import com.amazonaws.services.dynamodbv2.document.ItemUtils; | import com.amazonaws.services.dynamodbv2.document.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 2,857,016 |
protected void subscribeToContext(final String... metricIds) {
Request request = new Request(getFullId(), getNode() + ".context",
getCurrentTime(), "subscribe",
new Object[]{metricIds, getFullId()});
sendRequest(request, new ShowIfErrorCallback());
} | void function(final String... metricIds) { Request request = new Request(getFullId(), getNode() + STR, getCurrentTime(), STR, new Object[]{metricIds, getFullId()}); sendRequest(request, new ShowIfErrorCallback()); } | /**
* Request a subscription to the context for a series of metrics.
*/ | Request a subscription to the context for a series of metrics | subscribeToContext | {
"repo_name": "jackybourgeois/active-home",
"path": "org.active-home.service/src/main/java/org/activehome/service/Service.java",
"license": "gpl-3.0",
"size": 19230
} | [
"org.activehome.com.Request",
"org.activehome.com.ShowIfErrorCallback"
] | import org.activehome.com.Request; import org.activehome.com.ShowIfErrorCallback; | import org.activehome.com.*; | [
"org.activehome.com"
] | org.activehome.com; | 791,783 |
@Test(expectedExceptions = { CertException.class })
public void testEncodeInvalidOIDValue()
throws Exception
{
// The first component of an OID must be between 0 and 2.
new GeneralNamesBuilder().addRegisteredID(new OID("1234.5678")).build().
encode();
} | @Test(expectedExceptions = { CertException.class }) void function() throws Exception { new GeneralNamesBuilder().addRegisteredID(new OID(STR)).build(). encode(); } | /**
* Tests the behavior when trying to encode a general names element that
* contains a malformed OID.
*
* @throws Exception If an unexpected problem occurs.
*/ | Tests the behavior when trying to encode a general names element that contains a malformed OID | testEncodeInvalidOIDValue | {
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/util/ssl/cert/GeneralNamesTestCase.java",
"license": "gpl-2.0",
"size": 8972
} | [
"org.testng.annotations.Test"
] | import org.testng.annotations.Test; | import org.testng.annotations.*; | [
"org.testng.annotations"
] | org.testng.annotations; | 324,168 |
@RequiresApi(28)
public @Nullable Network getNetwork() {
return mRuntimeExtras.network;
} | @RequiresApi(28) @Nullable Network function() { return mRuntimeExtras.network; } | /**
* Gets the {@link android.net.Network} to use for this Worker. This method returns
* {@code null} if there is no network needed for this work request.
*
* @return The {@link android.net.Network} specified by the OS to be used with this Worker
*/ | Gets the <code>android.net.Network</code> to use for this Worker. This method returns null if there is no network needed for this work request | getNetwork | {
"repo_name": "AndroidX/androidx",
"path": "work/work-runtime/src/main/java/androidx/work/WorkerParameters.java",
"license": "apache-2.0",
"size": 6802
} | [
"android.net.Network",
"androidx.annotation.Nullable",
"androidx.annotation.RequiresApi"
] | import android.net.Network; import androidx.annotation.Nullable; import androidx.annotation.RequiresApi; | import android.net.*; import androidx.annotation.*; | [
"android.net",
"androidx.annotation"
] | android.net; androidx.annotation; | 1,120,476 |
public @CheckForNull Plugin getPlugin(String artifactId) {
for (UpdateSite s : sites) {
Plugin p = s.getPlugin(artifactId);
if (p!=null) return p;
}
return null;
} | @CheckForNull Plugin function(String artifactId) { for (UpdateSite s : sites) { Plugin p = s.getPlugin(artifactId); if (p!=null) return p; } return null; } | /**
* Gets the plugin with the given name from the first {@link UpdateSite} to contain it.
* @return Discovered {@link Plugin}. {@code null} if it cannot be found
*/ | Gets the plugin with the given name from the first <code>UpdateSite</code> to contain it | getPlugin | {
"repo_name": "batmat/jenkins",
"path": "core/src/main/java/hudson/model/UpdateCenter.java",
"license": "mit",
"size": 88993
} | [
"hudson.model.UpdateSite",
"javax.annotation.CheckForNull"
] | import hudson.model.UpdateSite; import javax.annotation.CheckForNull; | import hudson.model.*; import javax.annotation.*; | [
"hudson.model",
"javax.annotation"
] | hudson.model; javax.annotation; | 326,121 |
@Idempotent
public void cancelDelegationToken(Token<DelegationTokenIdentifier> token)
throws IOException; | void function(Token<DelegationTokenIdentifier> token) throws IOException; | /**
* Cancel an existing delegation token.
*
* @param token delegation token
* @throws IOException
*/ | Cancel an existing delegation token | cancelDelegationToken | {
"repo_name": "ict-carch/hadoop-plus",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/protocol/ClientProtocol.java",
"license": "apache-2.0",
"size": 45751
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier",
"org.apache.hadoop.security.token.Token"
] | import java.io.IOException; import org.apache.hadoop.hdfs.security.token.delegation.DelegationTokenIdentifier; import org.apache.hadoop.security.token.Token; | import java.io.*; import org.apache.hadoop.hdfs.security.token.delegation.*; import org.apache.hadoop.security.token.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 802,106 |
@Inject
public void setRoleMapping(@Named("LdapRealm-role-mapping") RoleMapping roleMapping) {
this.roleMapping = roleMapping;
} | void function(@Named(STR) RoleMapping roleMapping) { this.roleMapping = roleMapping; } | /**
* Setter roleMapping
*
* @param roleMapping the role mapping
*/ | Setter roleMapping | setRoleMapping | {
"repo_name": "seedstack/ldap-addon",
"path": "src/main/java/org/seedstack/ldap/internal/LdapRealm.java",
"license": "mpl-2.0",
"size": 5048
} | [
"javax.inject.Named",
"org.seedstack.seed.security.RoleMapping"
] | import javax.inject.Named; import org.seedstack.seed.security.RoleMapping; | import javax.inject.*; import org.seedstack.seed.security.*; | [
"javax.inject",
"org.seedstack.seed"
] | javax.inject; org.seedstack.seed; | 578,513 |
@FIXVersion(introduced = "4.4")
public TrdRegTimestampsGroup deleteTrdRegTimestampsGroup(int index) {
throw new UnsupportedOperationException(getUnsupportedTagMessage());
} | @FIXVersion(introduced = "4.4") TrdRegTimestampsGroup function(int index) { throw new UnsupportedOperationException(getUnsupportedTagMessage()); } | /**
* This method deletes a {@link TrdRegTimestampsGroup} object from the existing array of <code>trdRegTimestampsGroups</code>
* and shrink the static array with 1 place.<br/>
* If the array does not have the index position then a null object will be returned.)<br/>
* This method will also update <code>noTrdRegTimestamps</code> field to the proper value.<br/>
* @param index position in array to be deleted starting at 0
* @return deleted block object
*/ | This method deletes a <code>TrdRegTimestampsGroup</code> object from the existing array of <code>trdRegTimestampsGroups</code> and shrink the static array with 1 place. If the array does not have the index position then a null object will be returned.) This method will also update <code>noTrdRegTimestamps</code> field to the proper value | deleteTrdRegTimestampsGroup | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/TradeCaptureReportAckMsg.java",
"license": "gpl-3.0",
"size": 118717
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.group.TrdRegTimestampsGroup"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.group.TrdRegTimestampsGroup; | import net.hades.fix.message.anno.*; import net.hades.fix.message.group.*; | [
"net.hades.fix"
] | net.hades.fix; | 544,594 |
public static InetAddress resolveHostname(final String hostname, final boolean preferInet6Address, final boolean throwException) throws UnknownHostException {
InetAddress retval = null;
//System.out.println(String.format("%s (%s)", hostname, preferInet6Address ? "6" : "4"));
// Do a special case for localhost since the DNS server will generally not
// return valid A and AAAA records for "localhost".
if ("localhost".equals(hostname)) {
return preferInet6Address ? InetAddress.getByName("::1") : InetAddress.getByName("127.0.0.1");
}
try {
// 2011-05-22 - Matt is seeing some platform-specific inconsistencies when using
// InetAddress.getAllByName(). It seems to miss some addresses occasionally on Mac.
// We need to use dnsjava here instead since it should be 100% reliable.
//
// InetAddress[] addresses = InetAddress.getAllByName(hostname);
//
List<InetAddress> v4Addresses = new ArrayList<>();
try {
Record[] aRecs = new Lookup(hostname, Type.A).run();
if (aRecs != null) {
for (Record aRec : aRecs) {
if (aRec instanceof ARecord) {
InetAddress addr = ((ARecord)aRec).getAddress();
if (addr instanceof Inet4Address) {
v4Addresses.add(addr);
} else {
// Should never happen
throw new UnknownHostException("Non-IPv4 address found via A record DNS lookup of host: " + hostname + ": " + addr.toString());
}
}
}
} else {
//throw new UnknownHostException("No IPv4 addresses found via A record DNS lookup of host: " + hostname);
}
} catch (final TextParseException e) {
final UnknownHostException ex = new UnknownHostException("Could not perform A record lookup for host: " + hostname);
ex.initCause(e);
throw ex;
}
final List<InetAddress> v6Addresses = new ArrayList<>();
try {
final Record[] quadARecs = new Lookup(hostname, Type.AAAA).run();
if (quadARecs != null) {
for (final Record quadARec : quadARecs) {
final InetAddress addr = ((AAAARecord)quadARec).getAddress();
if (addr instanceof Inet6Address) {
v6Addresses.add(addr);
} else {
// Should never happen
throw new UnknownHostException("Non-IPv6 address found via AAAA record DNS lookup of host: " + hostname + ": " + addr.toString());
}
}
} else {
// throw new UnknownHostException("No IPv6 addresses found via AAAA record DNS lookup of host: " + hostname);
}
} catch (final TextParseException e) {
final UnknownHostException ex = new UnknownHostException("Could not perform AAAA record lookup for host: " + hostname);
ex.initCause(e);
throw ex;
}
final List<InetAddress> addresses = new ArrayList<>();
if (preferInet6Address) {
addresses.addAll(v6Addresses);
addresses.addAll(v4Addresses);
} else {
addresses.addAll(v4Addresses);
addresses.addAll(v6Addresses);
}
for (final InetAddress address : addresses) {
retval = address;
if (!preferInet6Address && retval instanceof Inet4Address) break;
if (preferInet6Address && retval instanceof Inet6Address) break;
}
if (preferInet6Address && !(retval instanceof Inet6Address)) {
throw new UnknownHostException("No IPv6 address could be found for the hostname: " + hostname);
}
} catch (final UnknownHostException e) {
if (throwException) {
throw e;
} else {
//System.out.println(String.format("UnknownHostException for : %s (%s)", hostname, preferInet6Address ? "6" : "4"));
//e.printStackTrace();
return null;
}
}
return retval;
} | static InetAddress function(final String hostname, final boolean preferInet6Address, final boolean throwException) throws UnknownHostException { InetAddress retval = null; if (STR.equals(hostname)) { return preferInet6Address ? InetAddress.getByName("::1") : InetAddress.getByName(STR); } try { try { Record[] aRecs = new Lookup(hostname, Type.A).run(); if (aRecs != null) { for (Record aRec : aRecs) { if (aRec instanceof ARecord) { InetAddress addr = ((ARecord)aRec).getAddress(); if (addr instanceof Inet4Address) { v4Addresses.add(addr); } else { throw new UnknownHostException(STR + hostname + STR + addr.toString()); } } } } else { } } catch (final TextParseException e) { final UnknownHostException ex = new UnknownHostException(STR + hostname); ex.initCause(e); throw ex; } final List<InetAddress> v6Addresses = new ArrayList<>(); try { final Record[] quadARecs = new Lookup(hostname, Type.AAAA).run(); if (quadARecs != null) { for (final Record quadARec : quadARecs) { final InetAddress addr = ((AAAARecord)quadARec).getAddress(); if (addr instanceof Inet6Address) { v6Addresses.add(addr); } else { throw new UnknownHostException(STR + hostname + STR + addr.toString()); } } } else { } } catch (final TextParseException e) { final UnknownHostException ex = new UnknownHostException(STR + hostname); ex.initCause(e); throw ex; } final List<InetAddress> addresses = new ArrayList<>(); if (preferInet6Address) { addresses.addAll(v6Addresses); addresses.addAll(v4Addresses); } else { addresses.addAll(v4Addresses); addresses.addAll(v6Addresses); } for (final InetAddress address : addresses) { retval = address; if (!preferInet6Address && retval instanceof Inet4Address) break; if (preferInet6Address && retval instanceof Inet6Address) break; } if (preferInet6Address && !(retval instanceof Inet6Address)) { throw new UnknownHostException(STR + hostname); } } catch (final UnknownHostException e) { if (throwException) { throw e; } else { return null; } } return retval; } | /**
* This function is used inside XSLT documents, do a string search before refactoring.
*/ | This function is used inside XSLT documents, do a string search before refactoring | resolveHostname | {
"repo_name": "aihua/opennms",
"path": "features/poller/monitors/core/src/main/java/org/opennms/netmgt/utils/DnsUtils.java",
"license": "agpl-3.0",
"size": 6752
} | [
"java.net.Inet4Address",
"java.net.Inet6Address",
"java.net.InetAddress",
"java.net.UnknownHostException",
"java.util.ArrayList",
"java.util.List",
"org.xbill.DNS"
] | import java.net.Inet4Address; import java.net.Inet6Address; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; import java.util.List; import org.xbill.DNS; | import java.net.*; import java.util.*; import org.xbill.*; | [
"java.net",
"java.util",
"org.xbill"
] | java.net; java.util; org.xbill; | 750,178 |
public void testComplexWhenNullAndWrite() throws Exception {
ctx.setFormatting(true);
ctx.nextLevel("results");
Serialization ser = createMock(ComplexSerialization.class);
expect(ser.isWriteEmpty()).andReturn(true);
replay(ser);
writer.writeComplex(ser, "listing", new Object(), null, null, Arrays.asList("just a listing"), ctx);
verify(ser);
assertEquals("\n\n <!-- just a listing -->\n <listing/>", os.toString());
assertEquals("results", ctx.getPath());
}
| void function() throws Exception { ctx.setFormatting(true); ctx.nextLevel(STR); Serialization ser = createMock(ComplexSerialization.class); expect(ser.isWriteEmpty()).andReturn(true); replay(ser); writer.writeComplex(ser, STR, new Object(), null, null, Arrays.asList(STR), ctx); verify(ser); assertEquals(STR, os.toString()); assertEquals(STR, ctx.getPath()); } | /**
* Tests serializing a null object that should be written
*/ | Tests serializing a null object that should be written | testComplexWhenNullAndWrite | {
"repo_name": "localmatters/object-serializer",
"path": "src/test/java/org/localmatters/serializer/writer/XMLWriterTest.java",
"license": "apache-2.0",
"size": 25219
} | [
"java.util.Arrays",
"org.easymock.EasyMock",
"org.easymock.classextension.EasyMock",
"org.localmatters.serializer.serialization.ComplexSerialization",
"org.localmatters.serializer.serialization.Serialization"
] | import java.util.Arrays; import org.easymock.EasyMock; import org.easymock.classextension.EasyMock; import org.localmatters.serializer.serialization.ComplexSerialization; import org.localmatters.serializer.serialization.Serialization; | import java.util.*; import org.easymock.*; import org.easymock.classextension.*; import org.localmatters.serializer.serialization.*; | [
"java.util",
"org.easymock",
"org.easymock.classextension",
"org.localmatters.serializer"
] | java.util; org.easymock; org.easymock.classextension; org.localmatters.serializer; | 1,236,811 |
@SuppressWarnings("unchecked")
public final Request timeout(TimeValue timeout) {
this.timeout = timeout;
return (Request) this;
} | @SuppressWarnings(STR) final Request function(TimeValue timeout) { this.timeout = timeout; return (Request) this; } | /**
* A timeout to wait if the index operation can't be performed immediately. Defaults to {@code 1m}.
*/ | A timeout to wait if the index operation can't be performed immediately. Defaults to 1m | timeout | {
"repo_name": "coding0011/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/support/replication/ReplicationRequest.java",
"license": "apache-2.0",
"size": 7808
} | [
"org.elasticsearch.common.unit.TimeValue"
] | import org.elasticsearch.common.unit.TimeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,854,666 |
EReference getFunctionblockModel_Enums(); | EReference getFunctionblockModel_Enums(); | /**
* Returns the meta object for the containment reference list '{@link org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel#getEnums <em>Enums</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Enums</em>'.
* @see org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel#getEnums()
* @see #getFunctionblockModel()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.eclipse.vorto.core.api.model.functionblock.FunctionblockModel#getEnums Enums</code>'. | getFunctionblockModel_Enums | {
"repo_name": "erlemantos/eclipse-vorto",
"path": "bundles/org.eclipse.vorto.core/src/org/eclipse/vorto/core/api/model/functionblock/FunctionblockPackage.java",
"license": "epl-1.0",
"size": 46007
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 892,267 |
public void createTransfer(String accountId, Transfer transfer, final NessieResultsListener listener){
mService.createTransfer(mKey, accountId, transfer, new Callback<PostResponse<Transfer>>() { | void function(String accountId, Transfer transfer, final NessieResultsListener listener){ mService.createTransfer(mKey, accountId, transfer, new Callback<PostResponse<Transfer>>() { | /**
* Create a transfer.
*
* @param accountId The id of the account the transfer initiates from
* @param transfer The transfer object to create
* @param listener The listener object which will implement the callback interface
*/ | Create a transfer | createTransfer | {
"repo_name": "nessieisreal/nessie-android-sdk",
"path": "nessie-android-sdk/src/main/java/com/reimaginebanking/api/nessieandroidsdk/requestclients/TransferClient.java",
"license": "mit",
"size": 5790
} | [
"com.reimaginebanking.api.nessieandroidsdk.NessieResultsListener",
"com.reimaginebanking.api.nessieandroidsdk.models.PostResponse",
"com.reimaginebanking.api.nessieandroidsdk.models.Transfer"
] | import com.reimaginebanking.api.nessieandroidsdk.NessieResultsListener; import com.reimaginebanking.api.nessieandroidsdk.models.PostResponse; import com.reimaginebanking.api.nessieandroidsdk.models.Transfer; | import com.reimaginebanking.api.nessieandroidsdk.*; import com.reimaginebanking.api.nessieandroidsdk.models.*; | [
"com.reimaginebanking.api"
] | com.reimaginebanking.api; | 203,642 |
protected boolean openNextFile() {
try {
if ( data.currentFileIndex >= data.files.nrOfFiles() ) {
// all files already processed
return false;
}
// Is this the last file?
data.file = data.files.getFile( data.currentFileIndex );
data.filename = KettleVFS.getFilename( data.file );
fillFileAdditionalFields( data, data.file );
if ( meta.inputFiles.passingThruFields ) {
StringBuilder sb = new StringBuilder();
sb.append( data.currentFileIndex ).append( "_" ).append( data.file );
data.currentPassThruFieldsRow = data.passThruFields.get( sb.toString() );
}
// Add this files to the result of this transformation.
//
if ( meta.inputFiles.isaddresult ) {
ResultFile resultFile =
new ResultFile( ResultFile.FILE_TYPE_GENERAL, data.file, getTransMeta().getName(), toString() );
resultFile.setComment( "File was read by an Text File input step" );
addResultFile( resultFile );
}
if ( log.isBasic() ) {
logBasic( "Opening file: " + data.file.getName().getFriendlyURI() );
}
data.dataErrorLineHandler.handleFile( data.file );
data.reader = createReader( meta, data, data.file );
} catch ( Exception e ) {
if ( !handleOpenFileException( e ) ) {
return false;
}
data.reader = null;
}
// Move file pointer ahead!
data.currentFileIndex++;
return true;
} | boolean function() { try { if ( data.currentFileIndex >= data.files.nrOfFiles() ) { return false; } data.file = data.files.getFile( data.currentFileIndex ); data.filename = KettleVFS.getFilename( data.file ); fillFileAdditionalFields( data, data.file ); if ( meta.inputFiles.passingThruFields ) { StringBuilder sb = new StringBuilder(); sb.append( data.currentFileIndex ).append( "_" ).append( data.file ); data.currentPassThruFieldsRow = data.passThruFields.get( sb.toString() ); } ResultFile resultFile = new ResultFile( ResultFile.FILE_TYPE_GENERAL, data.file, getTransMeta().getName(), toString() ); resultFile.setComment( STR ); addResultFile( resultFile ); } if ( log.isBasic() ) { logBasic( STR + data.file.getName().getFriendlyURI() ); } data.dataErrorLineHandler.handleFile( data.file ); data.reader = createReader( meta, data, data.file ); } catch ( Exception e ) { if ( !handleOpenFileException( e ) ) { return false; } data.reader = null; } data.currentFileIndex++; return true; } | /**
* Open next VFS file for processing.
*
* This method will support different parallelization methods later.
*/ | Open next VFS file for processing. This method will support different parallelization methods later | openNextFile | {
"repo_name": "tkafalas/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/trans/steps/file/BaseFileInputStep.java",
"license": "apache-2.0",
"size": 17484
} | [
"org.pentaho.di.core.ResultFile",
"org.pentaho.di.core.vfs.KettleVFS"
] | import org.pentaho.di.core.ResultFile; import org.pentaho.di.core.vfs.KettleVFS; | import org.pentaho.di.core.*; import org.pentaho.di.core.vfs.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 2,038,534 |
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileEntityHopper();
} | TileEntity function(World worldIn, int meta) { return new TileEntityHopper(); } | /**
* Returns a new instance of a block's tile entity class. Called on placing the block.
*/ | Returns a new instance of a block's tile entity class. Called on placing the block | createNewTileEntity | {
"repo_name": "Hexeption/Youtube-Hacked-Client-1.8",
"path": "minecraft/net/minecraft/block/BlockHopper.java",
"license": "mit",
"size": 8189
} | [
"net.minecraft.tileentity.TileEntity",
"net.minecraft.tileentity.TileEntityHopper",
"net.minecraft.world.World"
] | import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.world.World; | import net.minecraft.tileentity.*; import net.minecraft.world.*; | [
"net.minecraft.tileentity",
"net.minecraft.world"
] | net.minecraft.tileentity; net.minecraft.world; | 953,279 |
protected static int attemptToOwnTask(boolean isFirstTime, ZooKeeperWatcher zkw,
ServerName server, String task, RecoveryMode mode, int taskZKVersion) {
int latestZKVersion = FAILED_TO_OWN_TASK;
try {
SplitLogTask slt = new SplitLogTask.Owned(server, mode);
Stat stat = zkw.getRecoverableZooKeeper().setData(task, slt.toByteArray(), taskZKVersion);
if (stat == null) {
LOG.warn("zk.setData() returned null for path " + task);
SplitLogCounters.tot_wkr_task_heartbeat_failed.incrementAndGet();
return FAILED_TO_OWN_TASK;
}
latestZKVersion = stat.getVersion();
SplitLogCounters.tot_wkr_task_heartbeat.incrementAndGet();
return latestZKVersion;
} catch (KeeperException e) {
if (!isFirstTime) {
if (e.code().equals(KeeperException.Code.NONODE)) {
LOG.warn("NONODE failed to assert ownership for " + task, e);
} else if (e.code().equals(KeeperException.Code.BADVERSION)) {
LOG.warn("BADVERSION failed to assert ownership for " + task, e);
} else {
LOG.warn("failed to assert ownership for " + task, e);
}
}
} catch (InterruptedException e1) {
LOG.warn("Interrupted while trying to assert ownership of " + task + " "
+ StringUtils.stringifyException(e1));
Thread.currentThread().interrupt();
}
SplitLogCounters.tot_wkr_task_heartbeat_failed.incrementAndGet();
return FAILED_TO_OWN_TASK;
} | static int function(boolean isFirstTime, ZooKeeperWatcher zkw, ServerName server, String task, RecoveryMode mode, int taskZKVersion) { int latestZKVersion = FAILED_TO_OWN_TASK; try { SplitLogTask slt = new SplitLogTask.Owned(server, mode); Stat stat = zkw.getRecoverableZooKeeper().setData(task, slt.toByteArray(), taskZKVersion); if (stat == null) { LOG.warn(STR + task); SplitLogCounters.tot_wkr_task_heartbeat_failed.incrementAndGet(); return FAILED_TO_OWN_TASK; } latestZKVersion = stat.getVersion(); SplitLogCounters.tot_wkr_task_heartbeat.incrementAndGet(); return latestZKVersion; } catch (KeeperException e) { if (!isFirstTime) { if (e.code().equals(KeeperException.Code.NONODE)) { LOG.warn(STR + task, e); } else if (e.code().equals(KeeperException.Code.BADVERSION)) { LOG.warn(STR + task, e); } else { LOG.warn(STR + task, e); } } } catch (InterruptedException e1) { LOG.warn(STR + task + " " + StringUtils.stringifyException(e1)); Thread.currentThread().interrupt(); } SplitLogCounters.tot_wkr_task_heartbeat_failed.incrementAndGet(); return FAILED_TO_OWN_TASK; } | /**
* Try to own the task by transitioning the zk node data from UNASSIGNED to OWNED.
* <p>
* This method is also used to periodically heartbeat the task progress by transitioning the node
* from OWNED to OWNED.
* <p>
* @param isFirstTime shows whther it's the first attempt.
* @param zkw zk wathcer
* @param server name
* @param task to own
* @param taskZKVersion version of the task in zk
* @return non-negative integer value when task can be owned by current region server otherwise -1
*/ | Try to own the task by transitioning the zk node data from UNASSIGNED to OWNED. This method is also used to periodically heartbeat the task progress by transitioning the node from OWNED to OWNED. | attemptToOwnTask | {
"repo_name": "juwi/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coordination/ZkSplitLogWorkerCoordination.java",
"license": "apache-2.0",
"size": 23994
} | [
"org.apache.hadoop.hbase.ServerName",
"org.apache.hadoop.hbase.SplitLogCounters",
"org.apache.hadoop.hbase.SplitLogTask",
"org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos",
"org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher",
"org.apache.hadoop.util.StringUtils",
"org.apache.zookeeper.Keeper... | import org.apache.hadoop.hbase.ServerName; import org.apache.hadoop.hbase.SplitLogCounters; import org.apache.hadoop.hbase.SplitLogTask; import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.hadoop.util.StringUtils; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat; | import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.protobuf.generated.*; import org.apache.hadoop.hbase.zookeeper.*; import org.apache.hadoop.util.*; import org.apache.zookeeper.*; import org.apache.zookeeper.data.*; | [
"org.apache.hadoop",
"org.apache.zookeeper"
] | org.apache.hadoop; org.apache.zookeeper; | 1,144,737 |
EClass getParameter();
| EClass getParameter(); | /**
* Returns the meta object for class '{@link org.dresdenocl.examples.pml.Parameter <em>Parameter</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Parameter</em>'.
* @see org.dresdenocl.examples.pml.Parameter
* @generated
*/ | Returns the meta object for class '<code>org.dresdenocl.examples.pml.Parameter Parameter</code>'. | getParameter | {
"repo_name": "dresden-ocl/dresdenocl",
"path": "plugins/org.dresdenocl.examples.pml/src/org/dresdenocl/examples/pml/PmlPackage.java",
"license": "lgpl-3.0",
"size": 38372
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,464,015 |
@SuppressWarnings("unchecked")
public static List<Tag> getSuggestedTag(HttpServletRequest request, String name, String selectedHostId) {
try {
name = escapeSingleQuote(name);
String currentHostId = "";
Host currentHost = null;
String hostId = "";
//if there's a host field on form, retrieve it
Host hostOnForm = null;
if(UtilMethods.isSet(selectedHostId)){
try{
hostOnForm = APILocator.getHostAPI().find(selectedHostId,APILocator.getUserAPI().getSystemUser(), true);
selectedHostId=hostOnForm.getMap().get("tagStorage").toString();
}
catch (Exception e) {
selectedHostId=Host.SYSTEM_HOST;
Logger.info(TagFactory.class, "Unable to load current host.");
}
}
HibernateUtil dh = new HibernateUtil(Tag.class);
dh.setQuery("from tag in class com.dotmarketing.tag.model.Tag where lower(tagname) like ? and (host_id like ? OR host_id like ?)");
dh.setParam("%" + name.toLowerCase() + "%");
//search global
dh.setParam(selectedHostId);
dh.setParam(Host.SYSTEM_HOST);
List<Tag> list = dh.list();
return list;
}
catch (Exception e) {}
return new ArrayList<Tag>();
}
| @SuppressWarnings(STR) static List<Tag> function(HttpServletRequest request, String name, String selectedHostId) { try { name = escapeSingleQuote(name); String currentHostId = STRSTRtagStorageSTRUnable to load current host.STRfrom tag in class com.dotmarketing.tag.model.Tag where lower(tagname) like ? and (host_id like ? OR host_id like ?)STR%STR%"); dh.setParam(selectedHostId); dh.setParam(Host.SYSTEM_HOST); List<Tag> list = dh.list(); return list; } catch (Exception e) {} return new ArrayList<Tag>(); } | /**
* Gets a suggested tag(s), by name
* @param name name of the tag searched
* @return list of suggested tags
*/ | Gets a suggested tag(s), by name | getSuggestedTag | {
"repo_name": "austindlawless/dotCMS",
"path": "src/com/dotmarketing/tag/factories/TagFactory.java",
"license": "gpl-3.0",
"size": 28513
} | [
"com.dotmarketing.beans.Host",
"com.dotmarketing.tag.model.Tag",
"java.util.ArrayList",
"java.util.List",
"javax.servlet.http.HttpServletRequest"
] | import com.dotmarketing.beans.Host; import com.dotmarketing.tag.model.Tag; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; | import com.dotmarketing.beans.*; import com.dotmarketing.tag.model.*; import java.util.*; import javax.servlet.http.*; | [
"com.dotmarketing.beans",
"com.dotmarketing.tag",
"java.util",
"javax.servlet"
] | com.dotmarketing.beans; com.dotmarketing.tag; java.util; javax.servlet; | 2,880,454 |
public static SocketChannel open() throws IOException
{
return SelectorProvider.provider().openSocketChannel();
} | static SocketChannel function() throws IOException { return SelectorProvider.provider().openSocketChannel(); } | /**
* Opens a socket channel.
*
* @exception IOException If an error occurs
*/ | Opens a socket channel | open | {
"repo_name": "aosm/gcc_40",
"path": "libjava/java/nio/channels/SocketChannel.java",
"license": "gpl-2.0",
"size": 7532
} | [
"java.io.IOException",
"java.nio.channels.spi.SelectorProvider"
] | import java.io.IOException; import java.nio.channels.spi.SelectorProvider; | import java.io.*; import java.nio.channels.spi.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,917,377 |
public void deleteShippingInclusionRule(String profilecode, String id) throws Exception
{
MozuClient client = com.mozu.api.clients.commerce.shipping.admin.profiles.ShippingInclusionRuleClient.deleteShippingInclusionRuleClient( profilecode, id);
client.setContext(_apiContext);
client.executeRequest();
client.cleanupHttpConnection();
} | void function(String profilecode, String id) throws Exception { MozuClient client = com.mozu.api.clients.commerce.shipping.admin.profiles.ShippingInclusionRuleClient.deleteShippingInclusionRuleClient( profilecode, id); client.setContext(_apiContext); client.executeRequest(); client.cleanupHttpConnection(); } | /**
*
* <p><pre><code>
* ShippingInclusionRule shippinginclusionrule = new ShippingInclusionRule();
* shippinginclusionrule.deleteShippingInclusionRule( profilecode, id);
* </code></pre></p>
* @param id
* @param profilecode
* @param dataViewMode DataViewMode
* @return
*/ | <code><code> ShippingInclusionRule shippinginclusionrule = new ShippingInclusionRule(); shippinginclusionrule.deleteShippingInclusionRule( profilecode, id); </code></code> | deleteShippingInclusionRule | {
"repo_name": "bhewett/mozu-java",
"path": "mozu-javaasync-core/src/main/java/com/mozu/api/resources/commerce/shipping/admin/profiles/ShippingInclusionRuleResource.java",
"license": "mit",
"size": 17794
} | [
"com.mozu.api.MozuClient"
] | import com.mozu.api.MozuClient; | import com.mozu.api.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,989,554 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.