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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
protected BidimensionalMap getBidiMap()
{
return (BidimensionalMap) map;
}
| BidimensionalMap function() { return (BidimensionalMap) map; } | /**
* Gets the map being decorated.
*
* @return the decorated map
*/ | Gets the map being decorated | getBidiMap | {
"repo_name": "stefandmn/AREasy",
"path": "src/java/org/areasy/common/data/type/map/AbstractBidimensionalMapDecorator.java",
"license": "lgpl-3.0",
"size": 2437
} | [
"org.areasy.common.data.type.BidimensionalMap"
] | import org.areasy.common.data.type.BidimensionalMap; | import org.areasy.common.data.type.*; | [
"org.areasy.common"
] | org.areasy.common; | 2,115,264 |
@Override
public void error(TransformerException e)
throws TransformerException
{
Throwable wrapped = e.getException();
if (wrapped != null) {
System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
e.getMessageAndLocation(),
wrapped.getMessage()));
} else {
System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
e.getMessageAndLocation()));
}
throw e;
} | void function(TransformerException e) throws TransformerException { Throwable wrapped = e.getException(); if (wrapped != null) { System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG, e.getMessageAndLocation(), wrapped.getMessage())); } else { System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG, e.getMessageAndLocation())); } throw e; } | /**
* Receive notification of a recoverable error.
* The transformer must continue to provide normal parsing events after
* invoking this method. It should still be possible for the application
* to process the document through to the end.
*
* @param e The warning information encapsulated in a transformer
* exception.
* @throws TransformerException if the application chooses to discontinue
* the transformation (always does in our case).
*/ | Receive notification of a recoverable error. The transformer must continue to provide normal parsing events after invoking this method. It should still be possible for the application to process the document through to the end | error | {
"repo_name": "FauxFaux/jdk9-jaxp",
"path": "src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java",
"license": "gpl-2.0",
"size": 56268
} | [
"com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg",
"javax.xml.transform.TransformerException"
] | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.ErrorMsg; import javax.xml.transform.TransformerException; | import com.sun.org.apache.xalan.internal.xsltc.compiler.util.*; import javax.xml.transform.*; | [
"com.sun.org",
"javax.xml"
] | com.sun.org; javax.xml; | 2,895,618 |
@Override
public void chooseMeta(MetaClassImpl mci) {
Object receiver = getCorrectedReceiver();
if (receiver instanceof GroovyObject) {
Class aClass = receiver.getClass();
Method reflectionMethod = null;
try {
reflectionMethod = aClass.getMethod("getProperty", String.class);
if (!reflectionMethod.isSynthetic()) {
handle = MethodHandles.insertArguments(GROOVY_OBJECT_GET_PROPERTY, 1, name);
return;
}
} catch (ReflectiveOperationException e) {}
} else if (receiver instanceof Class) {
handle = MOP_GET;
handle = MethodHandles.insertArguments(handle, 2, name);
handle = MethodHandles.insertArguments(handle, 0, this.mc);
return;
}
if (method!=null || mci==null) return;
Class chosenSender = this.sender;
if (mci.getTheClass()!= chosenSender && GroovyCategorySupport.hasCategoryInCurrentThread()) {
chosenSender = mci.getTheClass();
}
MetaProperty res = mci.getEffectiveGetMetaProperty(chosenSender, receiver, name, false);
if (res instanceof MethodMetaProperty) {
MethodMetaProperty mmp = (MethodMetaProperty) res;
method = mmp.getMetaMethod();
insertName = true;
} else if (res instanceof CachedField) {
CachedField cf = (CachedField) res;
Field f = cf.field;
try {
handle = LOOKUP.unreflectGetter(f);
if (Modifier.isStatic(f.getModifiers())) {
// normally we would do the following
// handle = MethodHandles.dropArguments(handle,0,Class.class);
// but because there is a bug in invokedynamic in all jdk7 versions
// maybe use Unsafe.ensureClassInitialized
handle = META_PROPERTY_GETTER.bindTo(res);
}
} catch (IllegalAccessException iae) {
throw new GroovyBugError(iae);
}
} else {
handle = META_PROPERTY_GETTER.bindTo(res);
}
}
/**
* Additionally to the normal {@link MethodSelector#setHandleForMetaMethod()} | void function(MetaClassImpl mci) { Object receiver = getCorrectedReceiver(); if (receiver instanceof GroovyObject) { Class aClass = receiver.getClass(); Method reflectionMethod = null; try { reflectionMethod = aClass.getMethod(STR, String.class); if (!reflectionMethod.isSynthetic()) { handle = MethodHandles.insertArguments(GROOVY_OBJECT_GET_PROPERTY, 1, name); return; } } catch (ReflectiveOperationException e) {} } else if (receiver instanceof Class) { handle = MOP_GET; handle = MethodHandles.insertArguments(handle, 2, name); handle = MethodHandles.insertArguments(handle, 0, this.mc); return; } if (method!=null mci==null) return; Class chosenSender = this.sender; if (mci.getTheClass()!= chosenSender && GroovyCategorySupport.hasCategoryInCurrentThread()) { chosenSender = mci.getTheClass(); } MetaProperty res = mci.getEffectiveGetMetaProperty(chosenSender, receiver, name, false); if (res instanceof MethodMetaProperty) { MethodMetaProperty mmp = (MethodMetaProperty) res; method = mmp.getMetaMethod(); insertName = true; } else if (res instanceof CachedField) { CachedField cf = (CachedField) res; Field f = cf.field; try { handle = LOOKUP.unreflectGetter(f); if (Modifier.isStatic(f.getModifiers())) { handle = META_PROPERTY_GETTER.bindTo(res); } } catch (IllegalAccessException iae) { throw new GroovyBugError(iae); } } else { handle = META_PROPERTY_GETTER.bindTo(res); } } /** * Additionally to the normal {@link MethodSelector#setHandleForMetaMethod()} | /**
* this method chooses a property from the meta class.
*/ | this method chooses a property from the meta class | chooseMeta | {
"repo_name": "avafanasiev/groovy",
"path": "src/main/org/codehaus/groovy/vmplugin/v7/Selector.java",
"license": "apache-2.0",
"size": 50283
} | [
"groovy.lang.GroovyObject",
"groovy.lang.MetaClassImpl",
"groovy.lang.MetaProperty",
"java.lang.invoke.MethodHandles",
"java.lang.reflect.Field",
"java.lang.reflect.Method",
"java.lang.reflect.Modifier",
"org.codehaus.groovy.GroovyBugError",
"org.codehaus.groovy.reflection.CachedField",
"org.codeh... | import groovy.lang.GroovyObject; import groovy.lang.MetaClassImpl; import groovy.lang.MetaProperty; import java.lang.invoke.MethodHandles; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import org.codehaus.groovy.GroovyBugError; import org.codehaus.groovy.reflection.CachedField; import org.codehaus.groovy.runtime.GroovyCategorySupport; import org.codehaus.groovy.runtime.metaclass.MethodMetaProperty; import org.codehaus.groovy.vmplugin.v7.IndyInterface; | import groovy.lang.*; import java.lang.invoke.*; import java.lang.reflect.*; import org.codehaus.groovy.*; import org.codehaus.groovy.reflection.*; import org.codehaus.groovy.runtime.*; import org.codehaus.groovy.runtime.metaclass.*; import org.codehaus.groovy.vmplugin.v7.*; | [
"groovy.lang",
"java.lang",
"org.codehaus.groovy"
] | groovy.lang; java.lang; org.codehaus.groovy; | 288,980 |
public void contentTag(String tag, String name, String value, String content) throws IOException {
spacing();
out.write('<');
out.write(tag);
out.write(' ');
out.write(name);
out.write('=');
out.write('\"');
escapeString(value);
out.write('\"');
out.write('>');
escapeString(content);
out.write('<');
out.write('/');
out.write(tag);
out.write('>');
writeln();
} | void function(String tag, String name, String value, String content) throws IOException { spacing(); out.write('<'); out.write(tag); out.write(' '); out.write(name); out.write('='); out.write('\STR'); out.write('>'); escapeString(content); out.write('<'); out.write('/'); out.write(tag); out.write('>'); writeln(); } | /**
* Write a new content tag with a single attribute, consisting of an open tag, content text, and
* a closing tag, all on one line.
*
* @param tag the tag name
* @param name the name of the attribute
* @param value the value of the attribute, this text will be escaped
* @param content the text content, this text will be escaped
* @throws IOException unable to perform task for the stated reasons.
*/ | Write a new content tag with a single attribute, consisting of an open tag, content text, and a closing tag, all on one line | contentTag | {
"repo_name": "hsanchez/demodetect",
"path": "src/edu/ucsc/twitter/util/XmlWriter.java",
"license": "apache-2.0",
"size": 15362
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,432,319 |
public boolean isWeekend(String s) {
return contain(Constants.KEYWORDS_WEEKEND, s);
} | boolean function(String s) { return contain(Constants.KEYWORDS_WEEKEND, s); } | /**
* Checks if s is a weekend
* @param s string to check
* @return True if is a weekend word, False otherwise
*/ | Checks if s is a weekend | isWeekend | {
"repo_name": "gaoliyao/TimeParser",
"path": "src/com/github/TimeComponent.java",
"license": "apache-2.0",
"size": 13506
} | [
"com.github.StringUtils"
] | import com.github.StringUtils; | import com.github.*; | [
"com.github"
] | com.github; | 2,592,012 |
private void setForegroundLollipop(@Nullable Drawable newForeground) {
if (mForeground != newForeground) {
if (mForeground != null) {
mForeground.setCallback(null);
unscheduleDrawable(mForeground);
}
mForeground = newForeground;
if (newForeground != null) {
newForeground.setCallback(this);
if (newForeground.isStateful()) {
newForeground.setState(getDrawableState());
}
}
invalidate();
}
} | void function(@Nullable Drawable newForeground) { if (mForeground != newForeground) { if (mForeground != null) { mForeground.setCallback(null); unscheduleDrawable(mForeground); } mForeground = newForeground; if (newForeground != null) { newForeground.setCallback(this); if (newForeground.isStateful()) { newForeground.setState(getDrawableState()); } } invalidate(); } } | /**
* Copied over from FrameLayout#setForeground from API Version 16 with some differences: supports
* only fill gravity and does not support padded foreground
*/ | Copied over from FrameLayout#setForeground from API Version 16 with some differences: supports only fill gravity and does not support padded foreground | setForegroundLollipop | {
"repo_name": "facebook/litho",
"path": "litho-rendercore/src/main/java/com/facebook/rendercore/HostView.java",
"license": "apache-2.0",
"size": 18340
} | [
"android.graphics.drawable.Drawable",
"androidx.annotation.Nullable"
] | import android.graphics.drawable.Drawable; import androidx.annotation.Nullable; | import android.graphics.drawable.*; import androidx.annotation.*; | [
"android.graphics",
"androidx.annotation"
] | android.graphics; androidx.annotation; | 2,240,843 |
public static Date getDate(Date date, Double offset) {
GregorianCalendar g = new GregorianCalendar();
g.setTime(date);
g.add(Calendar.SECOND,
(int) Math.round(Math.floor(offset * 24 * 60 * 60)));
return g.getTime();
} | static Date function(Date date, Double offset) { GregorianCalendar g = new GregorianCalendar(); g.setTime(date); g.add(Calendar.SECOND, (int) Math.round(Math.floor(offset * 24 * 60 * 60))); return g.getTime(); } | /**
* Gets the date that is a number of days after a reference date.
*
* @param date the reference date
* @param offset the number of days offset
*
* @return the date
*/ | Gets the date that is a number of days after a reference date | getDate | {
"repo_name": "ptgrogan/spacenet",
"path": "src/main/java/edu/mit/spacenet/util/DateFunctions.java",
"license": "apache-2.0",
"size": 1657
} | [
"java.util.Calendar",
"java.util.Date",
"java.util.GregorianCalendar"
] | import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,435,044 |
public static Status getCachedStatus (Uid actionUid) throws SystemException
{
TransactionCacheItem cacheItem = getKnown (actionUid);
if (cacheItem != null)
{
return cacheItem.getStatus();
}
return Status.StatusNoTransaction; // used to mean it isn't cached
} | static Status function (Uid actionUid) throws SystemException { TransactionCacheItem cacheItem = getKnown (actionUid); if (cacheItem != null) { return cacheItem.getStatus(); } return Status.StatusNoTransaction; } | /**
* Get the status of a transaction that is already in the cache
*/ | Get the status of a transaction that is already in the cache | getCachedStatus | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/ArjunaJTS/jts/classes/com/arjuna/ats/internal/jts/recovery/transactions/TransactionCache.java",
"license": "apache-2.0",
"size": 9795
} | [
"com.arjuna.ats.arjuna.common.Uid",
"org.omg.CORBA",
"org.omg.CosTransactions"
] | import com.arjuna.ats.arjuna.common.Uid; import org.omg.CORBA; import org.omg.CosTransactions; | import com.arjuna.ats.arjuna.common.*; import org.omg.*; | [
"com.arjuna.ats",
"org.omg"
] | com.arjuna.ats; org.omg; | 762,923 |
private static Identity parse(final JsonObject json) {
final Map<String, String> props = new HashMap<>(json.size());
props.put(PsTwitter.NAME, json.getString(PsTwitter.NAME));
props.put("picture", json.getString("profile_image_url"));
return new Identity.Simple(
String.format("urn:twitter:%d", json.getInt("id")),
props
);
} | static Identity function(final JsonObject json) { final Map<String, String> props = new HashMap<>(json.size()); props.put(PsTwitter.NAME, json.getString(PsTwitter.NAME)); props.put(STR, json.getString(STR)); return new Identity.Simple( String.format(STR, json.getInt("id")), props ); } | /**
* Make identity from JSON object.
* @param json JSON received from Twitter
* @return Identity found
*/ | Make identity from JSON object | parse | {
"repo_name": "yegor256/takes",
"path": "src/main/java/org/takes/facets/auth/social/PsTwitter.java",
"license": "mit",
"size": 6471
} | [
"java.util.HashMap",
"java.util.Map",
"javax.json.JsonObject",
"org.takes.facets.auth.Identity"
] | import java.util.HashMap; import java.util.Map; import javax.json.JsonObject; import org.takes.facets.auth.Identity; | import java.util.*; import javax.json.*; import org.takes.facets.auth.*; | [
"java.util",
"javax.json",
"org.takes.facets"
] | java.util; javax.json; org.takes.facets; | 1,907,853 |
public static Expression transformInlineConstants(final Expression exp, final ClassNode attrType) {
if (exp instanceof PropertyExpression) {
PropertyExpression pe = (PropertyExpression) exp;
if (pe.getObjectExpression() instanceof ClassExpression) {
ClassExpression ce = (ClassExpression) pe.getObjectExpression();
ClassNode type = ce.getType();
if (type.isEnum() || !(type.isResolved() || type.isPrimaryClassNode()))
return exp;
if (type.isPrimaryClassNode()) {
FieldNode fn = type.redirect().getField(pe.getPropertyAsString());
if (fn != null && fn.isStatic() && fn.isFinal()) {
Expression ce2 = transformInlineConstants(fn.getInitialValueExpression(), attrType);
if (ce2 != null) {
return ce2;
}
}
} else {
try {
Field field = type.redirect().getTypeClass().getField(pe.getPropertyAsString());
if (field != null && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) {
ConstantExpression ce3 = new ConstantExpression(field.get(null), true);
configure(exp, ce3);
return ce3;
}
} catch(Exception e) {
// ignore, leave property expression in place and we'll report later
}
}
}
} else if (exp instanceof BinaryExpression) {
ConstantExpression ce = transformBinaryConstantExpression((BinaryExpression) exp, attrType);
if (ce != null) {
return ce;
}
} else if (exp instanceof VariableExpression) {
VariableExpression ve = (VariableExpression) exp;
if (ve.getAccessedVariable() instanceof FieldNode) {
FieldNode fn = (FieldNode) ve.getAccessedVariable();
if (fn.isStatic() && fn.isFinal()) {
Expression ce = transformInlineConstants(fn.getInitialValueExpression(), attrType);
if (ce != null) {
return ce;
}
}
}
} else if (exp instanceof ListExpression) {
return transformListOfConstants((ListExpression) exp, attrType);
}
return exp;
} | static Expression function(final Expression exp, final ClassNode attrType) { if (exp instanceof PropertyExpression) { PropertyExpression pe = (PropertyExpression) exp; if (pe.getObjectExpression() instanceof ClassExpression) { ClassExpression ce = (ClassExpression) pe.getObjectExpression(); ClassNode type = ce.getType(); if (type.isEnum() !(type.isResolved() type.isPrimaryClassNode())) return exp; if (type.isPrimaryClassNode()) { FieldNode fn = type.redirect().getField(pe.getPropertyAsString()); if (fn != null && fn.isStatic() && fn.isFinal()) { Expression ce2 = transformInlineConstants(fn.getInitialValueExpression(), attrType); if (ce2 != null) { return ce2; } } } else { try { Field field = type.redirect().getTypeClass().getField(pe.getPropertyAsString()); if (field != null && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) { ConstantExpression ce3 = new ConstantExpression(field.get(null), true); configure(exp, ce3); return ce3; } } catch(Exception e) { } } } } else if (exp instanceof BinaryExpression) { ConstantExpression ce = transformBinaryConstantExpression((BinaryExpression) exp, attrType); if (ce != null) { return ce; } } else if (exp instanceof VariableExpression) { VariableExpression ve = (VariableExpression) exp; if (ve.getAccessedVariable() instanceof FieldNode) { FieldNode fn = (FieldNode) ve.getAccessedVariable(); if (fn.isStatic() && fn.isFinal()) { Expression ce = transformInlineConstants(fn.getInitialValueExpression(), attrType); if (ce != null) { return ce; } } } } else if (exp instanceof ListExpression) { return transformListOfConstants((ListExpression) exp, attrType); } return exp; } | /**
* Converts simple expressions of constants into pre-evaluated simple constants.
* Handles:
* <ul>
* <li>Property expressions - referencing constants</li>
* <li>Simple binary expressions - String concatenation and numeric +, -, /, *</li>
* <li>List expressions - list of constants</li>
* <li>Variable expressions - referencing constants</li>
* </ul>
* @param exp the original expression
* @param attrType the type that the final constant should be
* @return the transformed type or the original if no transformation was possible
*/ | Converts simple expressions of constants into pre-evaluated simple constants. Handles: Property expressions - referencing constants Simple binary expressions - String concatenation and numeric +, -, /, * List expressions - list of constants Variable expressions - referencing constants | transformInlineConstants | {
"repo_name": "shils/groovy",
"path": "src/main/java/org/apache/groovy/ast/tools/ExpressionUtils.java",
"license": "apache-2.0",
"size": 16464
} | [
"java.lang.reflect.Field",
"java.lang.reflect.Modifier",
"org.codehaus.groovy.ast.ClassNode",
"org.codehaus.groovy.ast.FieldNode",
"org.codehaus.groovy.ast.expr.BinaryExpression",
"org.codehaus.groovy.ast.expr.ClassExpression",
"org.codehaus.groovy.ast.expr.ConstantExpression",
"org.codehaus.groovy.as... | import java.lang.reflect.Field; import java.lang.reflect.Modifier; import org.codehaus.groovy.ast.ClassNode; import org.codehaus.groovy.ast.FieldNode; import org.codehaus.groovy.ast.expr.BinaryExpression; import org.codehaus.groovy.ast.expr.ClassExpression; import org.codehaus.groovy.ast.expr.ConstantExpression; import org.codehaus.groovy.ast.expr.Expression; import org.codehaus.groovy.ast.expr.ListExpression; import org.codehaus.groovy.ast.expr.PropertyExpression; import org.codehaus.groovy.ast.expr.VariableExpression; | import java.lang.reflect.*; import org.codehaus.groovy.ast.*; import org.codehaus.groovy.ast.expr.*; | [
"java.lang",
"org.codehaus.groovy"
] | java.lang; org.codehaus.groovy; | 1,546,216 |
private void createReuseInstantiation(Aspect owner, Aspect externalAspect, AssociationEnd associationEnd,
CompoundCommand compoundCommand, COREModelReuse modelReuse) {
EditingDomain editingDomain = EMFEditUtil.getEditingDomain(associationEnd);
Classifier associatedClassifier = null;
Classifier dataClassifier = null;
Classifier keyClassifier = null;
AssociationEnd oppositeEnd = associationEnd.getOppositeEnd();
for (Classifier classifier : externalAspect.getStructuralView().getClasses()) {
if (classifier.getName().equals(AssociationConstants.ASSOCIATED_CLASS_NAME)
|| classifier.getName().equals(AssociationConstants.VALUE_CLASS_NAME)) {
associatedClassifier = classifier;
} else if (AssociationConstants.DATA_CLASS_NAME.equals(classifier.getName())) {
dataClassifier = classifier;
} else if (AssociationConstants.KEY_CLASS_NAME.equals(classifier.getName())) {
keyClassifier = classifier;
}
}
Instantiation instantiation = RamFactory.eINSTANCE.createInstantiation();
instantiation.setSource(externalAspect);
ClassifierMapping associatedClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping();
associatedClassifierMapping.setFrom(associatedClassifier);
associatedClassifierMapping.setTo(oppositeEnd.getClassifier());
ClassifierMapping dataClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping();
dataClassifierMapping.setFrom(dataClassifier);
dataClassifierMapping.setTo(associationEnd.getClassifier());
if (keyClassifier != null) {
ClassifierMapping keyClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping();
keyClassifierMapping.setFrom(keyClassifier);
instantiation.getMappings().add(keyClassifierMapping);
}
instantiation.getMappings().add(associatedClassifierMapping);
instantiation.getMappings().add(dataClassifierMapping);
modelReuse.getCompositions().add(instantiation);
for (Operation operation : dataClassifier.getOperations()) {
OperationMapping operationMapping = RamFactory.eINSTANCE.createOperationMapping();
dataClassifierMapping.getOperationMappings().add(operationMapping);
operationMapping.setFrom(operation);
Operation mapped = ControllerFactory.INSTANCE.getClassController().createOperationCopyWithoutCommand(
operationMapping, getOperationName(operation.getName(), associationEnd.getName()),
owner.getStructuralView());
operationMapping.setTo(mapped);
compoundCommand.append(AddCommand.create(editingDomain, associationEnd.getClassifier(),
RamPackage.Literals.CLASSIFIER__OPERATIONS, mapped));
}
} | void function(Aspect owner, Aspect externalAspect, AssociationEnd associationEnd, CompoundCommand compoundCommand, COREModelReuse modelReuse) { EditingDomain editingDomain = EMFEditUtil.getEditingDomain(associationEnd); Classifier associatedClassifier = null; Classifier dataClassifier = null; Classifier keyClassifier = null; AssociationEnd oppositeEnd = associationEnd.getOppositeEnd(); for (Classifier classifier : externalAspect.getStructuralView().getClasses()) { if (classifier.getName().equals(AssociationConstants.ASSOCIATED_CLASS_NAME) classifier.getName().equals(AssociationConstants.VALUE_CLASS_NAME)) { associatedClassifier = classifier; } else if (AssociationConstants.DATA_CLASS_NAME.equals(classifier.getName())) { dataClassifier = classifier; } else if (AssociationConstants.KEY_CLASS_NAME.equals(classifier.getName())) { keyClassifier = classifier; } } Instantiation instantiation = RamFactory.eINSTANCE.createInstantiation(); instantiation.setSource(externalAspect); ClassifierMapping associatedClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping(); associatedClassifierMapping.setFrom(associatedClassifier); associatedClassifierMapping.setTo(oppositeEnd.getClassifier()); ClassifierMapping dataClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping(); dataClassifierMapping.setFrom(dataClassifier); dataClassifierMapping.setTo(associationEnd.getClassifier()); if (keyClassifier != null) { ClassifierMapping keyClassifierMapping = RamFactory.eINSTANCE.createClassifierMapping(); keyClassifierMapping.setFrom(keyClassifier); instantiation.getMappings().add(keyClassifierMapping); } instantiation.getMappings().add(associatedClassifierMapping); instantiation.getMappings().add(dataClassifierMapping); modelReuse.getCompositions().add(instantiation); for (Operation operation : dataClassifier.getOperations()) { OperationMapping operationMapping = RamFactory.eINSTANCE.createOperationMapping(); dataClassifierMapping.getOperationMappings().add(operationMapping); operationMapping.setFrom(operation); Operation mapped = ControllerFactory.INSTANCE.getClassController().createOperationCopyWithoutCommand( operationMapping, getOperationName(operation.getName(), associationEnd.getName()), owner.getStructuralView()); operationMapping.setTo(mapped); compoundCommand.append(AddCommand.create(editingDomain, associationEnd.getClassifier(), RamPackage.Literals.CLASSIFIER__OPERATIONS, mapped)); } } | /**
* Create the instantiation for the COREReuse.
* @param owner The current aspect
* @param externalAspect the woven aspect
* @param associationEnd The association end for which a selection was done
* @param compoundCommand the compound command for creating/updating the feature selection
* @param modelReuse the model reuse to set the mappings for
*/ | Create the instantiation for the COREReuse | createReuseInstantiation | {
"repo_name": "sacooper/ECSE-429-Project-Group1",
"path": "ca.mcgill.sel.ram.controller/src/ca/mcgill/sel/ram/controller/AssociationController.java",
"license": "gpl-2.0",
"size": 20413
} | [
"ca.mcgill.sel.commons.emf.util.EMFEditUtil",
"ca.mcgill.sel.core.COREModelReuse",
"ca.mcgill.sel.ram.Aspect",
"ca.mcgill.sel.ram.AssociationEnd",
"ca.mcgill.sel.ram.Classifier",
"ca.mcgill.sel.ram.ClassifierMapping",
"ca.mcgill.sel.ram.Instantiation",
"ca.mcgill.sel.ram.Operation",
"ca.mcgill.sel.r... | import ca.mcgill.sel.commons.emf.util.EMFEditUtil; import ca.mcgill.sel.core.COREModelReuse; import ca.mcgill.sel.ram.Aspect; import ca.mcgill.sel.ram.AssociationEnd; import ca.mcgill.sel.ram.Classifier; import ca.mcgill.sel.ram.ClassifierMapping; import ca.mcgill.sel.ram.Instantiation; import ca.mcgill.sel.ram.Operation; import ca.mcgill.sel.ram.OperationMapping; import ca.mcgill.sel.ram.RamFactory; import ca.mcgill.sel.ram.RamPackage; import ca.mcgill.sel.ram.util.AssociationConstants; import org.eclipse.emf.common.command.CompoundCommand; import org.eclipse.emf.edit.command.AddCommand; import org.eclipse.emf.edit.domain.EditingDomain; | import ca.mcgill.sel.commons.emf.util.*; import ca.mcgill.sel.core.*; import ca.mcgill.sel.ram.*; import ca.mcgill.sel.ram.util.*; import org.eclipse.emf.common.command.*; import org.eclipse.emf.edit.command.*; import org.eclipse.emf.edit.domain.*; | [
"ca.mcgill.sel",
"org.eclipse.emf"
] | ca.mcgill.sel; org.eclipse.emf; | 4,310 |
public void setScreenData(String calorieLimit, String caloriesConsumed, String bf, String lnh, String dnr, String snk){
//set calorie bar, if no entry, set to zero
TextView caloriesUsed = (TextView) findViewById(R.id.currentPetCalories);
caloriesUsed.setText(caloriesConsumed);
TextView totalCalories = (TextView) findViewById(R.id.totalPetCalories);
totalCalories.setText(calorieLimit);
//set breakfast, if no entry, set to zero
Button breakfastBtn = (Button) findViewById(R.id.btn_petBreakfast);
breakfastBtn.setText(bf);
//set lunch, if no entry, set to zero
Button lunchBtn = (Button) findViewById(R.id.btn_petLunch);
lunchBtn.setText(lnh);
//set dinner, if no entry, set to zero
Button dinnerBtn = (Button) findViewById(R.id.btn_petDinner);
dinnerBtn.setText(dnr);
//set snacks, if no entry, set to zero
Button snackBtn = (Button) findViewById(R.id.btn_petSnack);
snackBtn.setText(snk);
} | void function(String calorieLimit, String caloriesConsumed, String bf, String lnh, String dnr, String snk){ TextView caloriesUsed = (TextView) findViewById(R.id.currentPetCalories); caloriesUsed.setText(caloriesConsumed); TextView totalCalories = (TextView) findViewById(R.id.totalPetCalories); totalCalories.setText(calorieLimit); Button breakfastBtn = (Button) findViewById(R.id.btn_petBreakfast); breakfastBtn.setText(bf); Button lunchBtn = (Button) findViewById(R.id.btn_petLunch); lunchBtn.setText(lnh); Button dinnerBtn = (Button) findViewById(R.id.btn_petDinner); dinnerBtn.setText(dnr); Button snackBtn = (Button) findViewById(R.id.btn_petSnack); snackBtn.setText(snk); } | /**
* Method to update total used calories for the day and meal calories
*/ | Method to update total used calories for the day and meal calories | setScreenData | {
"repo_name": "jfarnsworth95/NutriDog",
"path": "NutriDog/app/src/main/java/cjcompany/nutridog/PetInfoPage.java",
"license": "apache-2.0",
"size": 9503
} | [
"android.widget.Button",
"android.widget.TextView"
] | import android.widget.Button; import android.widget.TextView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 2,543,620 |
private double smartAdd(double a, double b) {
double _a = FastMath.abs(a);
double _b = FastMath.abs(b);
if (_a > _b) {
double eps = _a * Precision.EPSILON;
if (_b > eps) {
return a + b;
}
return a;
} else {
double eps = _b * Precision.EPSILON;
if (_a > eps) {
return a + b;
}
return b;
}
} | double function(double a, double b) { double _a = FastMath.abs(a); double _b = FastMath.abs(b); if (_a > _b) { double eps = _a * Precision.EPSILON; if (_b > eps) { return a + b; } return a; } else { double eps = _b * Precision.EPSILON; if (_a > eps) { return a + b; } return b; } } | /**
* Adds to number a and b such that the contamination due to
* numerical smallness of one addend does not corrupt the sum.
* @param a - an addend
* @param b - an addend
* @return the sum of the a and b
*/ | Adds to number a and b such that the contamination due to numerical smallness of one addend does not corrupt the sum | smartAdd | {
"repo_name": "SpoonLabs/astor",
"path": "examples/math_28/src/main/java/org/apache/commons/math3/stat/regression/MillerUpdatingRegression.java",
"license": "gpl-2.0",
"size": 38927
} | [
"org.apache.commons.math3.util.FastMath",
"org.apache.commons.math3.util.Precision"
] | import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.Precision; | import org.apache.commons.math3.util.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,526,691 |
public boolean execute(String action, JSONArray args, CallbackContext callbackContext) {
if (action.equals("getConnectionInfo")) {
this.connectionCallbackContext = callbackContext;
NetworkInfo info = sockMan.getActiveNetworkInfo();
String connectionType = "";
try {
connectionType = this.getConnectionInfo(info).get("type").toString();
} catch (JSONException e) { }
PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType);
pluginResult.setKeepCallback(true);
callbackContext.sendPluginResult(pluginResult);
return true;
}
return false;
} | boolean function(String action, JSONArray args, CallbackContext callbackContext) { if (action.equals(STR)) { this.connectionCallbackContext = callbackContext; NetworkInfo info = sockMan.getActiveNetworkInfo(); String connectionType = STRtype").toString(); } catch (JSONException e) { } PluginResult pluginResult = new PluginResult(PluginResult.Status.OK, connectionType); pluginResult.setKeepCallback(true); callbackContext.sendPluginResult(pluginResult); return true; } return false; } | /**
* Executes the request and returns PluginResult.
*
* @param action The action to execute.
* @param args JSONArry of arguments for the plugin.
* @param callbackContext The callback id used when calling back into JavaScript.
* @return True if the action was valid, false otherwise.
*/ | Executes the request and returns PluginResult | execute | {
"repo_name": "circular-code/ImageStream",
"path": "www/plugins/cordova-plugin-network-information/src/android/NetworkManager.java",
"license": "mit",
"size": 10195
} | [
"android.net.NetworkInfo",
"org.apache.cordova.CallbackContext",
"org.apache.cordova.PluginResult",
"org.json.JSONArray",
"org.json.JSONException"
] | import android.net.NetworkInfo; import org.apache.cordova.CallbackContext; import org.apache.cordova.PluginResult; import org.json.JSONArray; import org.json.JSONException; | import android.net.*; import org.apache.cordova.*; import org.json.*; | [
"android.net",
"org.apache.cordova",
"org.json"
] | android.net; org.apache.cordova; org.json; | 1,531,340 |
private CDWithChildren getConceptAndDescendants(String codeSystemOID, int namespaceId, boolean namespaceIsOntylog, AssociationType childOfAssociationType, String rootCode, ServerConnectionSecureSocket conn) throws IllegalArgumentException, DTSException
{
CDWithChildren cDWithChildrenToReturn = null;
DTSConceptQuery dtsConceptQuery = (DTSConceptQuery) DTSConceptQuery.createInstance(conn);
DTSPropertyType searchPropType = dtsConceptQuery.findPropertyTypeByName("Code in Source", namespaceId);
if (namespaceIsOntylog)
{
ConceptAttributeSetDescriptor ontylogCasd = new ConceptAttributeSetDescriptor("code with children");
ontylogCasd.addPropertyType(searchPropType);
ontylogCasd.setSubconcepts(true);
OntylogConceptQuery ontylogConceptQuery = OntylogConceptQuery.createInstance(conn);
OntylogConcept rootOntylogConcept = (OntylogConcept) ontylogConceptQuery.findConceptByCode(rootCode, namespaceId, ontylogCasd);
if (rootOntylogConcept != null)
{
String code = getCodeInSource(rootOntylogConcept);
cDWithChildrenToReturn = new CDWithChildren(codeSystemOID, SimpleKnowledgeRepository.getCodeSystemName(codeSystemOID), code, rootOntylogConcept.getName());
OntylogConcept[] childOntylogConcepts = rootOntylogConcept.getFetchedSubconcepts();
for (OntylogConcept childOntylogConcept : childOntylogConcepts)
{
String childOntylogCode = childOntylogConcept.getCode();
OntylogConcept childOntylogConceptWithCodeInSource = (OntylogConcept) ontylogConceptQuery.findConceptByCode(childOntylogCode, namespaceId, ontylogCasd);
cDWithChildrenToReturn.addChild(getConceptAndDescendants(codeSystemOID, namespaceId, namespaceIsOntylog, null, getCodeInSource(childOntylogConceptWithCodeInSource), conn));
}
}
}
else
{
// SearchQuery searchQuery = SearchQuery.createInstance(conn);
SearchQuery.createInstance(conn);
NavQuery navQuery = NavQuery.createInstance(conn);
ConceptAttributeSetDescriptor thesaurusCasd = new ConceptAttributeSetDescriptor("code only");
thesaurusCasd.addPropertyType(searchPropType);
// DTSSearchOptions searchOptions = new DTSSearchOptions(DTSSearchOptions.MAXIMUM_LIMIT, namespaceId, thesaurusCasd);
DTSConcept rootDtsConcept = dtsConceptQuery.findConceptByCode(rootCode, namespaceId, thesaurusCasd);
if (rootDtsConcept != null)
{
String code = getCodeInSource(rootDtsConcept);
String name = rootDtsConcept.getName();
cDWithChildrenToReturn = new CDWithChildren(codeSystemOID, SimpleKnowledgeRepository.getCodeSystemName(codeSystemOID), code, name);
NavChildContext navChildContext = navQuery.getNavChildContext(rootDtsConcept, thesaurusCasd, childOfAssociationType);
ConceptChild[] childThesaurusConcepts = navChildContext.getChildren();
for (ConceptChild childThesaurusConcept : childThesaurusConcepts)
{
String childThesaurusConceptCode = childThesaurusConcept.getCode();
DTSConcept childThesaurusConceptWithCodeInSource = dtsConceptQuery.findConceptByCode(childThesaurusConceptCode, namespaceId, thesaurusCasd);
cDWithChildrenToReturn.addChild(getConceptAndDescendants(codeSystemOID, namespaceId, namespaceIsOntylog, childOfAssociationType, getCodeInSource(childThesaurusConceptWithCodeInSource), conn));
}
}
}
return cDWithChildrenToReturn;
}
| CDWithChildren function(String codeSystemOID, int namespaceId, boolean namespaceIsOntylog, AssociationType childOfAssociationType, String rootCode, ServerConnectionSecureSocket conn) throws IllegalArgumentException, DTSException { CDWithChildren cDWithChildrenToReturn = null; DTSConceptQuery dtsConceptQuery = (DTSConceptQuery) DTSConceptQuery.createInstance(conn); DTSPropertyType searchPropType = dtsConceptQuery.findPropertyTypeByName(STR, namespaceId); if (namespaceIsOntylog) { ConceptAttributeSetDescriptor ontylogCasd = new ConceptAttributeSetDescriptor(STR); ontylogCasd.addPropertyType(searchPropType); ontylogCasd.setSubconcepts(true); OntylogConceptQuery ontylogConceptQuery = OntylogConceptQuery.createInstance(conn); OntylogConcept rootOntylogConcept = (OntylogConcept) ontylogConceptQuery.findConceptByCode(rootCode, namespaceId, ontylogCasd); if (rootOntylogConcept != null) { String code = getCodeInSource(rootOntylogConcept); cDWithChildrenToReturn = new CDWithChildren(codeSystemOID, SimpleKnowledgeRepository.getCodeSystemName(codeSystemOID), code, rootOntylogConcept.getName()); OntylogConcept[] childOntylogConcepts = rootOntylogConcept.getFetchedSubconcepts(); for (OntylogConcept childOntylogConcept : childOntylogConcepts) { String childOntylogCode = childOntylogConcept.getCode(); OntylogConcept childOntylogConceptWithCodeInSource = (OntylogConcept) ontylogConceptQuery.findConceptByCode(childOntylogCode, namespaceId, ontylogCasd); cDWithChildrenToReturn.addChild(getConceptAndDescendants(codeSystemOID, namespaceId, namespaceIsOntylog, null, getCodeInSource(childOntylogConceptWithCodeInSource), conn)); } } } else { SearchQuery.createInstance(conn); NavQuery navQuery = NavQuery.createInstance(conn); ConceptAttributeSetDescriptor thesaurusCasd = new ConceptAttributeSetDescriptor(STR); thesaurusCasd.addPropertyType(searchPropType); DTSConcept rootDtsConcept = dtsConceptQuery.findConceptByCode(rootCode, namespaceId, thesaurusCasd); if (rootDtsConcept != null) { String code = getCodeInSource(rootDtsConcept); String name = rootDtsConcept.getName(); cDWithChildrenToReturn = new CDWithChildren(codeSystemOID, SimpleKnowledgeRepository.getCodeSystemName(codeSystemOID), code, name); NavChildContext navChildContext = navQuery.getNavChildContext(rootDtsConcept, thesaurusCasd, childOfAssociationType); ConceptChild[] childThesaurusConcepts = navChildContext.getChildren(); for (ConceptChild childThesaurusConcept : childThesaurusConcepts) { String childThesaurusConceptCode = childThesaurusConcept.getCode(); DTSConcept childThesaurusConceptWithCodeInSource = dtsConceptQuery.findConceptByCode(childThesaurusConceptCode, namespaceId, thesaurusCasd); cDWithChildrenToReturn.addChild(getConceptAndDescendants(codeSystemOID, namespaceId, namespaceIsOntylog, childOfAssociationType, getCodeInSource(childThesaurusConceptWithCodeInSource), conn)); } } } return cDWithChildrenToReturn; } | /**
* Returns concept of interest with any nested descendants. Returns null if concept not found.
* @param namespaceId
* @param namespaceIsOntylog
* @param childOfAssociationType Only applicable for non-Ontylog namespaces
* @param rootCode
* @param conn
* @return
* @throws IllegalArgumentException If codeSystemOID is unrecognized.
* @throws DTSException
*/ | Returns concept of interest with any nested descendants. Returns null if concept not found | getConceptAndDescendants | {
"repo_name": "TonyWang-UMU/TFG-TWang",
"path": "opencds-parent/opencds-terminology-support/opencds-apelon/src/main/java/org/opencds/terminology/apelon/ApelonDtsUtility.java",
"license": "apache-2.0",
"size": 24985
} | [
"com.apelon.apelonserver.client.ServerConnectionSecureSocket",
"com.apelon.dts.client.DTSException",
"com.apelon.dts.client.association.AssociationType",
"com.apelon.dts.client.attribute.DTSPropertyType",
"com.apelon.dts.client.concept.ConceptAttributeSetDescriptor",
"com.apelon.dts.client.concept.Concept... | import com.apelon.apelonserver.client.ServerConnectionSecureSocket; import com.apelon.dts.client.DTSException; import com.apelon.dts.client.association.AssociationType; import com.apelon.dts.client.attribute.DTSPropertyType; import com.apelon.dts.client.concept.ConceptAttributeSetDescriptor; import com.apelon.dts.client.concept.ConceptChild; import com.apelon.dts.client.concept.DTSConcept; import com.apelon.dts.client.concept.DTSConceptQuery; import com.apelon.dts.client.concept.NavChildContext; import com.apelon.dts.client.concept.NavQuery; import com.apelon.dts.client.concept.OntylogConcept; import com.apelon.dts.client.concept.OntylogConceptQuery; import com.apelon.dts.client.concept.SearchQuery; import org.opencds.common.terminology.CDWithChildren; import org.opencds.knowledgeRepository.SimpleKnowledgeRepository; | import com.apelon.apelonserver.client.*; import com.apelon.dts.client.*; import com.apelon.dts.client.association.*; import com.apelon.dts.client.attribute.*; import com.apelon.dts.client.concept.*; import org.opencds.*; import org.opencds.common.terminology.*; | [
"com.apelon.apelonserver",
"com.apelon.dts",
"org.opencds",
"org.opencds.common"
] | com.apelon.apelonserver; com.apelon.dts; org.opencds; org.opencds.common; | 1,162,906 |
@Test(dataProvider = "conversions")
public void testConvertToZonedDateTime(final ZonedDateTime expected, final long input) {
assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(input, ZONE), expected);
assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(Long.MAX_VALUE, ZONE), LocalDateTime.MAX.atZone(ZONE));
assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(Long.MIN_VALUE, ZONE), LocalDateTime.MIN.atZone(ZONE));
} | @Test(dataProvider = STR) void function(final ZonedDateTime expected, final long input) { assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(input, ZONE), expected); assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(Long.MAX_VALUE, ZONE), LocalDateTime.MAX.atZone(ZONE)); assertEquals(ZonedDateTimeToLongConverter.convertToZonedDateTime(Long.MIN_VALUE, ZONE), LocalDateTime.MIN.atZone(ZONE)); } | /**
* Tests conversion of a long to date.
*
* @param expected the expected date
* @param input the input date as long
*/ | Tests conversion of a long to date | testConvertToZonedDateTime | {
"repo_name": "McLeodMoores/starling",
"path": "projects/time-series/src/test/java/com/opengamma/timeseries/precise/zdt/ZonedDateTimeToLongConverterTest.java",
"license": "apache-2.0",
"size": 2774
} | [
"org.testng.Assert",
"org.testng.annotations.Test",
"org.threeten.bp.LocalDateTime",
"org.threeten.bp.ZonedDateTime"
] | import org.testng.Assert; import org.testng.annotations.Test; import org.threeten.bp.LocalDateTime; import org.threeten.bp.ZonedDateTime; | import org.testng.*; import org.testng.annotations.*; import org.threeten.bp.*; | [
"org.testng",
"org.testng.annotations",
"org.threeten.bp"
] | org.testng; org.testng.annotations; org.threeten.bp; | 2,501,949 |
@Override
public List<AiTile> processSuccessors(AstarNode node)
{ // init
// avant tout : test d'interruption
List<AiTile> result = new ArrayList<AiTile>();
AiTile tile = node.getTile();
AiHero hero = node.getHero();
// pour chaque case voisine : on la rajoute si elle est traversable
for(Direction direction: Direction.getPrimaryValues())
{ AiTile neighbor = tile.getNeighbor(direction);
if(neighbor.isCrossableBy(hero)) {
//GeneralFuncs.printLog(neighbor+" Time:"+time.getTime(neighbor),VerboseLevel.MED);
if(time.getTime(neighbor)> (node.getDepth()+1)*Limits.tileDistance ||
time.getTime(neighbor)==0)
result.add(neighbor);
}
}
//
return result;
}
| List<AiTile> function(AstarNode node) { List<AiTile> result = new ArrayList<AiTile>(); AiTile tile = node.getTile(); AiHero hero = node.getHero(); for(Direction direction: Direction.getPrimaryValues()) { AiTile neighbor = tile.getNeighbor(direction); if(neighbor.isCrossableBy(hero)) { if(time.getTime(neighbor)> (node.getDepth()+1)*Limits.tileDistance time.getTime(neighbor)==0) result.add(neighbor); } } return result; } | /**
* Expand current tile neighbors and check time with Depth
*/ | Expand current tile neighbors and check time with Depth | processSuccessors | {
"repo_name": "vlabatut/totalboumboum",
"path": "resources/ai/org/totalboumboum/ai/v200910/ais/danesatir/v5/MySuccessor.java",
"license": "gpl-2.0",
"size": 2144
} | [
"java.util.ArrayList",
"java.util.List",
"org.totalboumboum.ai.v200910.adapter.data.AiHero",
"org.totalboumboum.ai.v200910.adapter.data.AiTile",
"org.totalboumboum.ai.v200910.adapter.path.astar.AstarNode",
"org.totalboumboum.engine.content.feature.Direction"
] | import java.util.ArrayList; import java.util.List; import org.totalboumboum.ai.v200910.adapter.data.AiHero; import org.totalboumboum.ai.v200910.adapter.data.AiTile; import org.totalboumboum.ai.v200910.adapter.path.astar.AstarNode; import org.totalboumboum.engine.content.feature.Direction; | import java.util.*; import org.totalboumboum.ai.v200910.adapter.data.*; import org.totalboumboum.ai.v200910.adapter.path.astar.*; import org.totalboumboum.engine.content.feature.*; | [
"java.util",
"org.totalboumboum.ai",
"org.totalboumboum.engine"
] | java.util; org.totalboumboum.ai; org.totalboumboum.engine; | 935,367 |
public void endpointActivation(MessageEndpointFactory endpointFactory,
ActivationSpec spec)
throws NotSupportedException, ResourceException
{
MessageListenerSpec listener = (MessageListenerSpec) spec;
listener.setEndpointFactory(endpointFactory);
try {
listener.start();
} catch (ResourceException e) {
throw new NotSupportedException(e);
}
} | void function(MessageEndpointFactory endpointFactory, ActivationSpec spec) throws NotSupportedException, ResourceException { MessageListenerSpec listener = (MessageListenerSpec) spec; listener.setEndpointFactory(endpointFactory); try { listener.start(); } catch (ResourceException e) { throw new NotSupportedException(e); } } | /**
* Called during activation of a message endpoint.
*/ | Called during activation of a message endpoint | endpointActivation | {
"repo_name": "christianchristensen/resin",
"path": "modules/resin/src/com/caucho/jms/jca/ResourceAdapterImpl.java",
"license": "gpl-2.0",
"size": 4310
} | [
"javax.resource.NotSupportedException",
"javax.resource.ResourceException",
"javax.resource.spi.ActivationSpec",
"javax.resource.spi.endpoint.MessageEndpointFactory"
] | import javax.resource.NotSupportedException; import javax.resource.ResourceException; import javax.resource.spi.ActivationSpec; import javax.resource.spi.endpoint.MessageEndpointFactory; | import javax.resource.*; import javax.resource.spi.*; import javax.resource.spi.endpoint.*; | [
"javax.resource"
] | javax.resource; | 1,235,864 |
public Histogram histogram(String id, double[] data, int k, Color color) {
if (base.dimension != 2) {
throw new IllegalArgumentException("Histogram can be only painted in a 2D canvas.");
}
Histogram histogram = new Histogram(data, k);
histogram.setID(id);
histogram.setColor(color);
double[] lowerBound = {Math.min(data), 0};
double[] upperBound = {Math.max(data), 0};
double[][] freq = histogram.getHistogram();
for (int i = 0; i < freq.length; i++) {
if (freq[i][1] > upperBound[1]) {
upperBound[1] = freq[i][1];
}
}
extendBound(lowerBound, upperBound);
add(histogram);
return histogram;
} | Histogram function(String id, double[] data, int k, Color color) { if (base.dimension != 2) { throw new IllegalArgumentException(STR); } Histogram histogram = new Histogram(data, k); histogram.setID(id); histogram.setColor(color); double[] lowerBound = {Math.min(data), 0}; double[] upperBound = {Math.max(data), 0}; double[][] freq = histogram.getHistogram(); for (int i = 0; i < freq.length; i++) { if (freq[i][1] > upperBound[1]) { upperBound[1] = freq[i][1]; } } extendBound(lowerBound, upperBound); add(histogram); return histogram; } | /**
* Adds a histogram to this canvas.
* @param id the id of the plot.
* @param data a sample set.
* @param k the number of bins.
*/ | Adds a histogram to this canvas | histogram | {
"repo_name": "dublinio/smile",
"path": "SmilePlot/src/main/java/smile/plot/PlotCanvas.java",
"license": "apache-2.0",
"size": 71375
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,116,922 |
public void testScanJumpStart() throws Exception {
AtomicBoolean called = new AtomicBoolean();
sourceWithMockedRemoteCall("start_scan.json", "scroll_ok.json").doStart(r -> {
assertFalse(r.isTimedOut());
assertEquals(FAKE_SCROLL_ID, r.getScrollId());
assertEquals(4, r.getTotalHits());
assertThat(r.getFailures(), empty());
assertThat(r.getHits(), hasSize(1));
assertEquals("test", r.getHits().get(0).getIndex());
assertEquals("test", r.getHits().get(0).getType());
assertEquals("AVToMiDL50DjIiBO3yKA", r.getHits().get(0).getId());
assertEquals("{\"test\":\"test3\"}", r.getHits().get(0).getSource().utf8ToString());
assertNull(r.getHits().get(0).getRouting());
called.set(true);
});
assertTrue(called.get());
} | void function() throws Exception { AtomicBoolean called = new AtomicBoolean(); sourceWithMockedRemoteCall(STR, STR).doStart(r -> { assertFalse(r.isTimedOut()); assertEquals(FAKE_SCROLL_ID, r.getScrollId()); assertEquals(4, r.getTotalHits()); assertThat(r.getFailures(), empty()); assertThat(r.getHits(), hasSize(1)); assertEquals("test", r.getHits().get(0).getIndex()); assertEquals("test", r.getHits().get(0).getType()); assertEquals(STR, r.getHits().get(0).getId()); assertEquals("{\"test\":\"test3\"}", r.getHits().get(0).getSource().utf8ToString()); assertNull(r.getHits().get(0).getRouting()); called.set(true); }); assertTrue(called.get()); } | /**
* Versions of Elasticsearch before 2.1.0 don't support sort:_doc and instead need to use search_type=scan. Scan doesn't return
* documents the first iteration but reindex doesn't like that. So we jump start strait to the next iteration.
*/ | Versions of Elasticsearch before 2.1.0 don't support sort:_doc and instead need to use search_type=scan. Scan doesn't return documents the first iteration but reindex doesn't like that. So we jump start strait to the next iteration | testScanJumpStart | {
"repo_name": "henakamaMSFT/elasticsearch",
"path": "modules/reindex/src/test/java/org/elasticsearch/index/reindex/remote/RemoteScrollableHitSourceTests.java",
"license": "apache-2.0",
"size": 28497
} | [
"java.util.concurrent.atomic.AtomicBoolean",
"org.hamcrest.Matchers"
] | import java.util.concurrent.atomic.AtomicBoolean; import org.hamcrest.Matchers; | import java.util.concurrent.atomic.*; import org.hamcrest.*; | [
"java.util",
"org.hamcrest"
] | java.util; org.hamcrest; | 426,374 |
public Response post(URI url, String data, List<Header> headers) throws IOException; | Response function(URI url, String data, List<Header> headers) throws IOException; | /**
* Perform a POST-request against the given URL
*
* @param url URL to perform request against
* @param data Post-data to send
* @param headers Headers to send along with the request
* @return HTTP response
* @throws IOException
*/ | Perform a POST-request against the given URL | post | {
"repo_name": "imbo/imboclient-java",
"path": "src/main/java/io/imbo/client/Http/HttpClient.java",
"license": "mit",
"size": 8922
} | [
"java.io.IOException",
"java.util.List",
"org.apache.http.Header"
] | import java.io.IOException; import java.util.List; import org.apache.http.Header; | import java.io.*; import java.util.*; import org.apache.http.*; | [
"java.io",
"java.util",
"org.apache.http"
] | java.io; java.util; org.apache.http; | 1,983,012 |
protected String getCrossTotalFmtStr(final Parameter _parameter,
final List<Calculator> _calcList)
throws EFapsException
{
return NumberFormatter.get().getFrmt4Total(getType4SysConf(_parameter))
.format(getCrossTotal(_parameter, _calcList));
} | String function(final Parameter _parameter, final List<Calculator> _calcList) throws EFapsException { return NumberFormatter.get().getFrmt4Total(getType4SysConf(_parameter)) .format(getCrossTotal(_parameter, _calcList)); } | /**
* Method to get formated String representation of the cross total for a
* list of Calculators.
*
* @param _parameter Parameter as passed by the eFasp API
* @param _calcList list of Calculator the net total is wanted for
* @return formated String representation of the cross total
* @throws EFapsException on error
*/ | Method to get formated String representation of the cross total for a list of Calculators | getCrossTotalFmtStr | {
"repo_name": "eFaps/eFapsApp-Sales",
"path": "src/main/efaps/ESJP/org/efaps/esjp/sales/document/AbstractDocumentSum_Base.java",
"license": "apache-2.0",
"size": 94322
} | [
"java.util.List",
"org.efaps.admin.event.Parameter",
"org.efaps.esjp.erp.NumberFormatter",
"org.efaps.esjp.sales.Calculator",
"org.efaps.util.EFapsException"
] | import java.util.List; import org.efaps.admin.event.Parameter; import org.efaps.esjp.erp.NumberFormatter; import org.efaps.esjp.sales.Calculator; import org.efaps.util.EFapsException; | import java.util.*; import org.efaps.admin.event.*; import org.efaps.esjp.erp.*; import org.efaps.esjp.sales.*; import org.efaps.util.*; | [
"java.util",
"org.efaps.admin",
"org.efaps.esjp",
"org.efaps.util"
] | java.util; org.efaps.admin; org.efaps.esjp; org.efaps.util; | 2,229,132 |
@Test
public void testBestRating() throws Exception {
Recommender recommender = buildRecommender();
List<RecommendedItem> recommended = recommender.recommend(1, 1);
assertNotNull(recommended);
assertEquals(1, recommended.size());
RecommendedItem firstRecommended = recommended.get(0);
// item one should be recommended because it has a greater rating/score
assertEquals(2, firstRecommended.getItemID());
assertEquals(0.1f, firstRecommended.getValue(), EPSILON);
} | void function() throws Exception { Recommender recommender = buildRecommender(); List<RecommendedItem> recommended = recommender.recommend(1, 1); assertNotNull(recommended); assertEquals(1, recommended.size()); RecommendedItem firstRecommended = recommended.get(0); assertEquals(2, firstRecommended.getItemID()); assertEquals(0.1f, firstRecommended.getValue(), EPSILON); } | /**
* Contributed test case that verifies fix for bug
* <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1396128&group_id=138771&atid=741665">
* 1396128</a>.
*/ | Contributed test case that verifies fix for bug 1396128 | testBestRating | {
"repo_name": "BigData-Lab-Frankfurt/HiBench-DSE",
"path": "common/mahout-distribution-0.7-hadoop1/core/src/test/java/org/apache/mahout/cf/taste/impl/recommender/GenericItemBasedRecommenderTest.java",
"license": "apache-2.0",
"size": 13304
} | [
"java.util.List",
"org.apache.mahout.cf.taste.recommender.RecommendedItem",
"org.apache.mahout.cf.taste.recommender.Recommender"
] | import java.util.List; import org.apache.mahout.cf.taste.recommender.RecommendedItem; import org.apache.mahout.cf.taste.recommender.Recommender; | import java.util.*; import org.apache.mahout.cf.taste.recommender.*; | [
"java.util",
"org.apache.mahout"
] | java.util; org.apache.mahout; | 172,309 |
//--------------------------------------------------------------------------
//
// a_ods_white_tape_detected
//
boolean a_ods_white_tape_detected ()
{
//
// Assume not.
//
boolean l_return = false;
if (v_sensor_ods != null)
{
//
// Is the amount of light detected above the threshold for white
// tape?
//
if (v_sensor_ods.getLightDetected () > 0.8)
{
l_return = true;
}
}
//
// Return
//
return l_return;
} // a_ods_white_tape_detected
//--------------------------------------------------------------------------
//
// v_sensor_touch
//
private TouchSensor v_sensor_touch;
//--------------------------------------------------------------------------
//
// v_sensor_ir
//
private IrSeekerSensor v_sensor_ir;
//--------------------------------------------------------------------------
//
// v_sensor_ods
//
private OpticalDistanceSensor v_sensor_ods; | boolean a_ods_white_tape_detected () { if (v_sensor_ods != null) { { l_return = true; } } } private TouchSensor v_sensor_touch; private IrSeekerSensor v_sensor_ir; private OpticalDistanceSensor v_sensor_ods; | /**
* Access whether the EOP is detecting white tape.
*/ | Access whether the EOP is detecting white tape | a_ods_white_tape_detected | {
"repo_name": "powerstackers/FTC-5029-Res-Q",
"path": "FtcRobotController/src/main/java/com/qualcomm/ftcrobotcontroller/opmodes/pushbot/PushBotHardwareSensors.java",
"license": "gpl-3.0",
"size": 9975
} | [
"com.qualcomm.robotcore.hardware.IrSeekerSensor",
"com.qualcomm.robotcore.hardware.OpticalDistanceSensor",
"com.qualcomm.robotcore.hardware.TouchSensor"
] | import com.qualcomm.robotcore.hardware.IrSeekerSensor; import com.qualcomm.robotcore.hardware.OpticalDistanceSensor; import com.qualcomm.robotcore.hardware.TouchSensor; | import com.qualcomm.robotcore.hardware.*; | [
"com.qualcomm.robotcore"
] | com.qualcomm.robotcore; | 1,072,248 |
@Nullable
ProjectInternal findProject(BuildIdentifier build, String path); | ProjectInternal findProject(BuildIdentifier build, String path); | /**
* Locates the project in the provided build with the provided path, or <code>null</code> if not found.
*
* @param build The build id of the build containing the project
* @param path Needs to be absolute
* @return The project belonging to the path in the build, or null if not found.
*/ | Locates the project in the provided build with the provided path, or <code>null</code> if not found | findProject | {
"repo_name": "robinverduijn/gradle",
"path": "subprojects/core/src/main/java/org/gradle/api/internal/artifacts/dsl/dependencies/ProjectFinder.java",
"license": "apache-2.0",
"size": 1811
} | [
"org.gradle.api.artifacts.component.BuildIdentifier",
"org.gradle.api.internal.project.ProjectInternal"
] | import org.gradle.api.artifacts.component.BuildIdentifier; import org.gradle.api.internal.project.ProjectInternal; | import org.gradle.api.artifacts.component.*; import org.gradle.api.internal.project.*; | [
"org.gradle.api"
] | org.gradle.api; | 1,263 |
public Observable<ServiceResponse<Page<GeoRegionInner>>> listGeoRegionsSinglePageAsync() {
if (this.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<Page<GeoRegionInner>>> function() { if (this.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Get a list of available geographical regions.
* Get a list of available geographical regions.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<GeoRegionInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Get a list of available geographical regions. Get a list of available geographical regions | listGeoRegionsSinglePageAsync | {
"repo_name": "anudeepsharma/azure-sdk-for-java",
"path": "azure-mgmt-appservice/src/main/java/com/microsoft/azure/management/appservice/implementation/WebSiteManagementClientImpl.java",
"license": "mit",
"size": 100978
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 116,412 |
public com.squareup.okhttp.Call getUniverseSystemJumpsAsync(String datasource, String userAgent, String xUserAgent, final ApiCallback<List<GetUniverseSystemJumps200Ok>> callback) throws ApiException {
ProgressResponseBody.ProgressListener progressListener = null;
ProgressRequestBody.ProgressRequestListener progressRequestListener = null; | com.squareup.okhttp.Call function(String datasource, String userAgent, String xUserAgent, final ApiCallback<List<GetUniverseSystemJumps200Ok>> callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; | /**
* Get system jumps (asynchronously)
* Get the number of jumps in solar systems within the last hour, excluding wormhole space. Only systems with jumps will be listed --- Alternate route: `/v1/universe/system_jumps/` Alternate route: `/legacy/universe/system_jumps/` Alternate route: `/dev/universe/system_jumps/` --- This route is cached for up to 3600 seconds
* @param datasource The server name you would like data from (optional, default to tranquility)
* @param userAgent Client identifier, takes precedence over headers (optional)
* @param xUserAgent Client identifier, takes precedence over User-Agent (optional)
* @param callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
*/ | Get system jumps (asynchronously) Get the number of jumps in solar systems within the last hour, excluding wormhole space. Only systems with jumps will be listed --- Alternate route: `/v1/universe/system_jumps/` Alternate route: `/legacy/universe/system_jumps/` Alternate route: `/dev/universe/system_jumps/` --- This route is cached for up to 3600 seconds | getUniverseSystemJumpsAsync | {
"repo_name": "Tmin10/EVE-Security-Service",
"path": "server-api/src/main/java/ru/tmin10/EVESecurityService/serverApi/api/UniverseApi.java",
"license": "gpl-3.0",
"size": 215688
} | [
"java.util.List",
"ru.tmin10.EVESecurityService"
] | import java.util.List; import ru.tmin10.EVESecurityService; | import java.util.*; import ru.tmin10.*; | [
"java.util",
"ru.tmin10"
] | java.util; ru.tmin10; | 1,873,921 |
public List<ReservedInstances> describeReservedInstances(List<String> instanceIds) throws EC2Exception {
return describeReservedInstances(instanceIds, null);
} | List<ReservedInstances> function(List<String> instanceIds) throws EC2Exception { return describeReservedInstances(instanceIds, null); } | /**
* Returns a list of Reserved Instance that are available for purchase.
*
* @param instanceIds specific reserved instance offering ids to return
* @throws EC2Exception wraps checked exceptions
*/ | Returns a list of Reserved Instance that are available for purchase | describeReservedInstances | {
"repo_name": "canwe/typica",
"path": "java/com/xerox/amazonws/ec2/Jec2.java",
"license": "apache-2.0",
"size": 117983
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,090,723 |
public static F.Promise<BulkResponse> indexBulkAsync(IndexQueryPath indexPath, List<? extends Index> indexables) {
return AsyncUtils.executeAsyncJava(getBulkRequestBuilder(indexPath, indexables));
} | static F.Promise<BulkResponse> function(IndexQueryPath indexPath, List<? extends Index> indexables) { return AsyncUtils.executeAsyncJava(getBulkRequestBuilder(indexPath, indexables)); } | /**
* Bulk index a list of indexables asynchronously
* @param indexPath
* @param indexables
* @return
*/ | Bulk index a list of indexables asynchronously | indexBulkAsync | {
"repo_name": "cleverage/play2-elasticsearch",
"path": "module/app/com/github/cleverage/elasticsearch/IndexService.java",
"license": "mit",
"size": 29832
} | [
"java.util.List",
"org.elasticsearch.action.bulk.BulkResponse"
] | import java.util.List; import org.elasticsearch.action.bulk.BulkResponse; | import java.util.*; import org.elasticsearch.action.bulk.*; | [
"java.util",
"org.elasticsearch.action"
] | java.util; org.elasticsearch.action; | 1,857,117 |
private void dedup(Collection<List<?>> res) throws Exception {
assert res != null;
if (cacheMode() != REPLICATED)
return;
Collection<List<?>> res0 = new ArrayList<>(res.size());
Collection<Object> keys = new HashSet<>();
for (List<?> row : res) {
Object key = row.get(0);
if (!keys.contains(key)) {
res0.add(row);
keys.add(key);
}
}
res.clear();
res.addAll(res0);
}
@SuppressWarnings("UnusedDeclaration")
private static class PersonKey implements Serializable {
@QuerySqlField
private final UUID id;
private PersonKey(UUID id) {
assert id != null;
this.id = id;
} | void function(Collection<List<?>> res) throws Exception { assert res != null; if (cacheMode() != REPLICATED) return; Collection<List<?>> res0 = new ArrayList<>(res.size()); Collection<Object> keys = new HashSet<>(); for (List<?> row : res) { Object key = row.get(0); if (!keys.contains(key)) { res0.add(row); keys.add(key); } } res.clear(); res.addAll(res0); } @SuppressWarnings(STR) private static class PersonKey implements Serializable { private final UUID id; private PersonKey(UUID id) { assert id != null; this.id = id; } | /**
* Dedups result.
*
* @param res Result.
* @throws Exception In case of error.
*/ | Dedups result | dedup | {
"repo_name": "alexzaitzev/ignite",
"path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/IgniteCacheAbstractFieldsQuerySelfTest.java",
"license": "apache-2.0",
"size": 36975
} | [
"java.io.Serializable",
"java.util.ArrayList",
"java.util.Collection",
"java.util.HashSet",
"java.util.List"
] | import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,372,801 |
public void setBigInt(BigInteger value) {
if (this.token == Token.BIGINT) {
throw new IllegalStateException("BigInt node not created with Node.newBigInt");
} else {
throw new UnsupportedOperationException(this + " is not a bigint node");
}
} | void function(BigInteger value) { if (this.token == Token.BIGINT) { throw new IllegalStateException(STR); } else { throw new UnsupportedOperationException(this + STR); } } | /**
* Can only be called when <code>getType() == Token.BIGINT</code>
*
* @param value value to set.
*/ | Can only be called when <code>getType() == Token.BIGINT</code> | setBigInt | {
"repo_name": "vobruba-martin/closure-compiler",
"path": "src/com/google/javascript/rhino/Node.java",
"license": "apache-2.0",
"size": 112945
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 2,069,354 |
protected String getPrivilegeKey(Object domainObject)
{
return Constants.ADD_EDIT_SPP;
}
| String function(Object domainObject) { return Constants.ADD_EDIT_SPP; } | /**
* To get PrivilegeName for authorization check from.
* 'PermissionMapDetails.xml' (non-Javadoc)
* @param domainObject domainObject
* @return String ADD_EDIT_SPP
*/ | To get PrivilegeName for authorization check from. 'PermissionMapDetails.xml' (non-Javadoc) | getPrivilegeKey | {
"repo_name": "NCIP/catissue-core",
"path": "software/caTissue/modules/core/src/main/java/edu/wustl/catissuecore/bizlogic/SPPBizLogic.java",
"license": "bsd-3-clause",
"size": 26902
} | [
"edu.wustl.catissuecore.util.global.Constants"
] | import edu.wustl.catissuecore.util.global.Constants; | import edu.wustl.catissuecore.util.global.*; | [
"edu.wustl.catissuecore"
] | edu.wustl.catissuecore; | 1,300,537 |
public ConfigDescriptionParameterBuilder withMinimum(BigDecimal min) {
this.min = min;
return this;
} | ConfigDescriptionParameterBuilder function(BigDecimal min) { this.min = min; return this; } | /**
* Set the minimum value of the configuration parameter
*
* @param min
*/ | Set the minimum value of the configuration parameter | withMinimum | {
"repo_name": "kaikreuzer/smarthome",
"path": "bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/ConfigDescriptionParameterBuilder.java",
"license": "epl-1.0",
"size": 5340
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 279,395 |
private void drawPiece(RightTriPiece piece, Canvas canvas) {
drawLine(piece.d, canvas, piecePaint);
drawLine(piece.e, canvas, piecePaint);
drawLine(piece.f, canvas, piecePaint);
canvas.drawText("A", piece.a.x.toFloat() * scale + xPad,
piece.a.y.toFloat() * scale + yPad, dimPaint);
canvas.drawText("B", piece.b.x.toFloat() * scale + xPad,
piece.b.y.toFloat() * scale + yPad, dimPaint);
canvas.drawText("C", piece.c.x.toFloat() * scale + xPad,
piece.c.y.toFloat() * scale + yPad, dimPaint);
if (piece.canShowAngles()) {
Vertex a = Geometry.getVertexAt(piece.a,
0 - Math.toRadians(piece.getPrimaryAngle() / 2),
piece.hypotenuse.getLength() / 10);
Vertex b = Geometry.getVertexAt(piece.b, 5 * Math.PI / 4,
piece.hypotenuse.getLength() / 10);
Vertex c = Geometry
.getVertexAt(
piece.c,
Math.PI
/ 2
+ Math.toRadians(piece.getSecondaryAngle() / 2),
piece.hypotenuse.getLength() / 5);
String aText = String.format("%1$.0f",
Math.abs(piece.getPrimaryAngle()));
String cText = String.format("%1$.0f",
Math.abs(piece.getSecondaryAngle()));
canvas.drawText(aText, a.x.toFloat() * scale + xPad, a.y.toFloat()
* scale + yPad, dimPaint);
canvas.drawText("90", b.x.toFloat() * scale + xPad, b.y.toFloat()
* scale + yPad, dimPaint);
canvas.drawText(cText, c.x.toFloat() * scale + xPad, c.y.toFloat()
* scale + yPad, dimPaint);
}
}
| void function(RightTriPiece piece, Canvas canvas) { drawLine(piece.d, canvas, piecePaint); drawLine(piece.e, canvas, piecePaint); drawLine(piece.f, canvas, piecePaint); canvas.drawText("A", piece.a.x.toFloat() * scale + xPad, piece.a.y.toFloat() * scale + yPad, dimPaint); canvas.drawText("B", piece.b.x.toFloat() * scale + xPad, piece.b.y.toFloat() * scale + yPad, dimPaint); canvas.drawText("C", piece.c.x.toFloat() * scale + xPad, piece.c.y.toFloat() * scale + yPad, dimPaint); if (piece.canShowAngles()) { Vertex a = Geometry.getVertexAt(piece.a, 0 - Math.toRadians(piece.getPrimaryAngle() / 2), piece.hypotenuse.getLength() / 10); Vertex b = Geometry.getVertexAt(piece.b, 5 * Math.PI / 4, piece.hypotenuse.getLength() / 10); Vertex c = Geometry .getVertexAt( piece.c, Math.PI / 2 + Math.toRadians(piece.getSecondaryAngle() / 2), piece.hypotenuse.getLength() / 5); String aText = String.format(STR, Math.abs(piece.getPrimaryAngle())); String cText = String.format(STR, Math.abs(piece.getSecondaryAngle())); canvas.drawText(aText, a.x.toFloat() * scale + xPad, a.y.toFloat() * scale + yPad, dimPaint); canvas.drawText("90", b.x.toFloat() * scale + xPad, b.y.toFloat() * scale + yPad, dimPaint); canvas.drawText(cText, c.x.toFloat() * scale + xPad, c.y.toFloat() * scale + yPad, dimPaint); } } | /**
* Draws a RightTriPiece. Labels the vertices and also shows the angles if
* the piece requests it.
*
* @param piece
* The piece that will be drawn.
* @param canvas
* The canvas that it will be drawn on.
*/ | Draws a RightTriPiece. Labels the vertices and also shows the angles if the piece requests it | drawPiece | {
"repo_name": "zgrannan/Technical-Theatre-Assistant",
"path": "src/com/zgrannan/crewandroid/CustomDrawableView.java",
"license": "mit",
"size": 16724
} | [
"android.graphics.Canvas",
"com.zgrannan.crewandroid.Geometry",
"com.zgrannan.crewandroid.Pieces"
] | import android.graphics.Canvas; import com.zgrannan.crewandroid.Geometry; import com.zgrannan.crewandroid.Pieces; | import android.graphics.*; import com.zgrannan.crewandroid.*; | [
"android.graphics",
"com.zgrannan.crewandroid"
] | android.graphics; com.zgrannan.crewandroid; | 2,780,153 |
public Releasable disableRecoveryMonitor() {
assert recoveryMonitorEnabled : "recovery monitor already disabled";
recoveryMonitorEnabled = false;
return () -> {
setLastAccessTime();
recoveryMonitorEnabled = true;
};
} | Releasable function() { assert recoveryMonitorEnabled : STR; recoveryMonitorEnabled = false; return () -> { setLastAccessTime(); recoveryMonitorEnabled = true; }; } | /**
* Set flag to signal to {@link org.elasticsearch.indices.recovery.RecoveriesCollection.RecoveryMonitor} that it must not cancel this
* recovery temporarily. This is used by the recovery clean files step to avoid recovery failure in case a long running condition was
* added to the shard via {@link IndexShard#addCleanFilesDependency()}.
*
* @return releasable that once closed will re-enable liveness checks by the recovery monitor
*/ | Set flag to signal to <code>org.elasticsearch.indices.recovery.RecoveriesCollection.RecoveryMonitor</code> that it must not cancel this recovery temporarily. This is used by the recovery clean files step to avoid recovery failure in case a long running condition was added to the shard via <code>IndexShard#addCleanFilesDependency()</code> | disableRecoveryMonitor | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/indices/recovery/RecoveryTarget.java",
"license": "apache-2.0",
"size": 25589
} | [
"org.elasticsearch.core.Releasable"
] | import org.elasticsearch.core.Releasable; | import org.elasticsearch.core.*; | [
"org.elasticsearch.core"
] | org.elasticsearch.core; | 244,618 |
@Test
@Category(NeedsRunner.class)
public void testCompressedAccordingToFilepatternGzip() throws Exception {
byte[] input = generateInput(100);
File tmpFile = tmpFolder.newFile("test.gz");
writeFile(tmpFile, input, CompressionMode.GZIP);
verifyReadContents(input, tmpFile, null );
} | @Category(NeedsRunner.class) void function() throws Exception { byte[] input = generateInput(100); File tmpFile = tmpFolder.newFile(STR); writeFile(tmpFile, input, CompressionMode.GZIP); verifyReadContents(input, tmpFile, null ); } | /**
* Test reading according to filepattern when the file is bzipped.
*/ | Test reading according to filepattern when the file is bzipped | testCompressedAccordingToFilepatternGzip | {
"repo_name": "jasonkuster/incubator-beam",
"path": "sdks/java/core/src/test/java/org/apache/beam/sdk/io/CompressedSourceTest.java",
"license": "apache-2.0",
"size": 24502
} | [
"java.io.File",
"org.apache.beam.sdk.io.CompressedSource",
"org.apache.beam.sdk.testing.NeedsRunner",
"org.junit.experimental.categories.Category"
] | import java.io.File; import org.apache.beam.sdk.io.CompressedSource; import org.apache.beam.sdk.testing.NeedsRunner; import org.junit.experimental.categories.Category; | import java.io.*; import org.apache.beam.sdk.io.*; import org.apache.beam.sdk.testing.*; import org.junit.experimental.categories.*; | [
"java.io",
"org.apache.beam",
"org.junit.experimental"
] | java.io; org.apache.beam; org.junit.experimental; | 790,749 |
private void renameTitle(HashMap<String, String> map) {
if (map.get(JSON_SCHEMA_TITLE) != null) {
if (getSelectedEditPart() instanceof TreeNodeEditPart) {
((TreeNodeEditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE),
map.get(JSON_SCHEMA_TYPE));
} else if (getSelectedEditPart() instanceof TreeNode2EditPart) {
((TreeNode2EditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE),
map.get(JSON_SCHEMA_TYPE));
} else if (getSelectedEditPart() instanceof TreeNode3EditPart) {
((TreeNode3EditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE),
map.get(JSON_SCHEMA_TYPE));
}
}
} | void function(HashMap<String, String> map) { if (map.get(JSON_SCHEMA_TITLE) != null) { if (getSelectedEditPart() instanceof TreeNodeEditPart) { ((TreeNodeEditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE), map.get(JSON_SCHEMA_TYPE)); } else if (getSelectedEditPart() instanceof TreeNode2EditPart) { ((TreeNode2EditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE), map.get(JSON_SCHEMA_TYPE)); } else if (getSelectedEditPart() instanceof TreeNode3EditPart) { ((TreeNode3EditPart) getSelectedEditPart()).renameElementItem(map.get(JSON_SCHEMA_TITLE), map.get(JSON_SCHEMA_TYPE)); } } } | /**
* Renames the title
*
* @param map
*/ | Renames the title | renameTitle | {
"repo_name": "prabushi/devstudio-tooling-esb",
"path": "plugins/org.wso2.developerstudio.visualdatamapper.diagram/src/org/wso2/developerstudio/datamapper/diagram/custom/action/EditFieldAction.java",
"license": "apache-2.0",
"size": 17376
} | [
"java.util.HashMap",
"org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNode2EditPart",
"org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNode3EditPart",
"org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNodeEditPart"
] | import java.util.HashMap; import org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNode2EditPart; import org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNode3EditPart; import org.wso2.developerstudio.datamapper.diagram.edit.parts.TreeNodeEditPart; | import java.util.*; import org.wso2.developerstudio.datamapper.diagram.edit.parts.*; | [
"java.util",
"org.wso2.developerstudio"
] | java.util; org.wso2.developerstudio; | 1,078,763 |
void convert(String inputFilePath, String outputFilePath, String encodedFileName, FileType outputFileType); | void convert(String inputFilePath, String outputFilePath, String encodedFileName, FileType outputFileType); | /**
* API to convert a file in one format to other.
*
* @param inputFilePath
* @param outputFilePath
* @param encodedFileName
* @param outputFileType
*/ | API to convert a file in one format to other | convert | {
"repo_name": "kuzavas/ephesoft",
"path": "dcma-core/src/main/java/com/ephesoft/dcma/core/service/FileFormatConvertor.java",
"license": "agpl-3.0",
"size": 2775
} | [
"com.ephesoft.dcma.core.common.FileType"
] | import com.ephesoft.dcma.core.common.FileType; | import com.ephesoft.dcma.core.common.*; | [
"com.ephesoft.dcma"
] | com.ephesoft.dcma; | 2,094,946 |
public UserCursor query(Context context) {
return query(context, null);
} | UserCursor function(Context context) { return query(context, null); } | /**
* Equivalent of calling {@code query(context, null)}.
*/ | Equivalent of calling query(context, null) | query | {
"repo_name": "chennemann/Recipr",
"path": "app/src/main/java/de/androidbytes/recipr/app/data/provider/user/UserSelection.java",
"license": "apache-2.0",
"size": 6870
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,512,072 |
@Test
public void testNewThreadExHandler() {
ThreadFactory wrapped = EasyMock.createMock(ThreadFactory.class);
Runnable r = EasyMock.createMock(Runnable.class);
Thread.UncaughtExceptionHandler handler = EasyMock
.createMock(Thread.UncaughtExceptionHandler.class);
Thread t = new Thread();
EasyMock.expect(wrapped.newThread(r)).andReturn(t);
EasyMock.replay(wrapped, r, handler);
BasicThreadFactory factory = builder.wrappedFactory(wrapped)
.uncaughtExceptionHandler(handler).build();
assertSame("Wrong thread", t, factory.newThread(r));
assertEquals("Wrong exception handler", handler, t
.getUncaughtExceptionHandler());
EasyMock.verify(wrapped, r, handler);
}
| void function() { ThreadFactory wrapped = EasyMock.createMock(ThreadFactory.class); Runnable r = EasyMock.createMock(Runnable.class); Thread.UncaughtExceptionHandler handler = EasyMock .createMock(Thread.UncaughtExceptionHandler.class); Thread t = new Thread(); EasyMock.expect(wrapped.newThread(r)).andReturn(t); EasyMock.replay(wrapped, r, handler); BasicThreadFactory factory = builder.wrappedFactory(wrapped) .uncaughtExceptionHandler(handler).build(); assertSame(STR, t, factory.newThread(r)); assertEquals(STR, handler, t .getUncaughtExceptionHandler()); EasyMock.verify(wrapped, r, handler); } | /**
* Tests whether the exception handler is set if one is provided.
*/ | Tests whether the exception handler is set if one is provided | testNewThreadExHandler | {
"repo_name": "SpoonLabs/astor",
"path": "examples/Lang-issue-428/src/test/java/org/apache/commons/lang3/concurrent/BasicThreadFactoryTest.java",
"license": "gpl-2.0",
"size": 11668
} | [
"java.util.concurrent.ThreadFactory",
"org.easymock.EasyMock",
"org.junit.Assert"
] | import java.util.concurrent.ThreadFactory; import org.easymock.EasyMock; import org.junit.Assert; | import java.util.concurrent.*; import org.easymock.*; import org.junit.*; | [
"java.util",
"org.easymock",
"org.junit"
] | java.util; org.easymock; org.junit; | 1,598,527 |
@ServiceMethod(returns = ReturnType.SINGLE)
PollerFlux<PollResult<Void>, Void> beginDeleteAsync(
String resourceGroupName, String virtualHubName, String routeTableName); | @ServiceMethod(returns = ReturnType.SINGLE) PollerFlux<PollResult<Void>, Void> beginDeleteAsync( String resourceGroupName, String virtualHubName, String routeTableName); | /**
* Deletes a VirtualHubRouteTableV2.
*
* @param resourceGroupName The resource group name of the VirtualHubRouteTableV2.
* @param virtualHubName The name of the VirtualHub.
* @param routeTableName The name of the VirtualHubRouteTableV2.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.resourcemanager.network.models.ErrorException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Deletes a VirtualHubRouteTableV2 | beginDeleteAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/VirtualHubRouteTableV2SClient.java",
"license": "mit",
"size": 19901
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.PollerFlux"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.PollerFlux; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; | [
"com.azure.core"
] | com.azure.core; | 393,192 |
@GwtIncompatible("TODO")
public static long checkedPow(long b, int k) {
checkNonNegative("exponent", k);
if (b >= -2 & b <= 2) {
switch ((int) b) {
case 0:
return (k == 0) ? 1 : 0;
case 1:
return 1;
case (-1):
return ((k & 1) == 0) ? 1 : -1;
case 2:
checkNoOverflow(k < Long.SIZE - 1);
return 1L << k;
case (-2):
checkNoOverflow(k < Long.SIZE);
return ((k & 1) == 0) ? (1L << k) : (-1L << k);
default:
throw new AssertionError();
}
}
long accum = 1;
while (true) {
switch (k) {
case 0:
return accum;
case 1:
return checkedMultiply(accum, b);
default:
if ((k & 1) != 0) {
accum = checkedMultiply(accum, b);
}
k >>= 1;
if (k > 0) {
checkNoOverflow(b <= FLOOR_SQRT_MAX_LONG);
b *= b;
}
}
}
}
@VisibleForTesting static final long FLOOR_SQRT_MAX_LONG = 3037000499L;
/**
* Returns {@code n!}, that is, the product of the first {@code n} positive
* integers, {@code 1} if {@code n == 0}, or {@link Long#MAX_VALUE} if the
* result does not fit in a {@code long}.
*
* @throws IllegalArgumentException if {@code n < 0}
| @GwtIncompatible("TODO") static long function(long b, int k) { checkNonNegative(STR, k); if (b >= -2 & b <= 2) { switch ((int) b) { case 0: return (k == 0) ? 1 : 0; case 1: return 1; case (-1): return ((k & 1) == 0) ? 1 : -1; case 2: checkNoOverflow(k < Long.SIZE - 1); return 1L << k; case (-2): checkNoOverflow(k < Long.SIZE); return ((k & 1) == 0) ? (1L << k) : (-1L << k); default: throw new AssertionError(); } } long accum = 1; while (true) { switch (k) { case 0: return accum; case 1: return checkedMultiply(accum, b); default: if ((k & 1) != 0) { accum = checkedMultiply(accum, b); } k >>= 1; if (k > 0) { checkNoOverflow(b <= FLOOR_SQRT_MAX_LONG); b *= b; } } } } @VisibleForTesting static final long FLOOR_SQRT_MAX_LONG = 3037000499L; /** * Returns {@code n!}, that is, the product of the first {@code n} positive * integers, {@code 1} if {@code n == 0}, or {@link Long#MAX_VALUE} if the * result does not fit in a {@code long}. * * @throws IllegalArgumentException if {@code n < 0} | /**
* Returns the {@code b} to the {@code k}th power, provided it does not overflow.
*
* @throws ArithmeticException if {@code b} to the {@code k}th power overflows in signed
* {@code long} arithmetic
*/ | Returns the b to the kth power, provided it does not overflow | checkedPow | {
"repo_name": "mariusj/org.openntf.domino",
"path": "domino/externals/guava/src/main/java/com/google/common/math/LongMath.java",
"license": "apache-2.0",
"size": 27186
} | [
"com.google.common.annotations.GwtIncompatible",
"com.google.common.annotations.VisibleForTesting",
"com.google.common.math.MathPreconditions"
] | import com.google.common.annotations.GwtIncompatible; import com.google.common.annotations.VisibleForTesting; import com.google.common.math.MathPreconditions; | import com.google.common.annotations.*; import com.google.common.math.*; | [
"com.google.common"
] | com.google.common; | 164,280 |
@Override
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
if (qName.equals(n)) {
urlOn = true;
sum += Integer.parseInt(attributes.getValue("n"));
//System.out.println(sum);
}
} | void function(String uri, String localName, String qName, Attributes attributes) throws SAXException { if (qName.equals(n)) { urlOn = true; sum += Integer.parseInt(attributes.getValue("n")); } } | /**
* Method calls when SAXParser begin tag processing.
*/ | Method calls when SAXParser begin tag processing | startElement | {
"repo_name": "AlxKonstantin/kalekseev",
"path": "chapter_003_junior/src/main/java/optimization/XMLParser.java",
"license": "apache-2.0",
"size": 2334
} | [
"org.xml.sax.Attributes",
"org.xml.sax.SAXException"
] | import org.xml.sax.Attributes; import org.xml.sax.SAXException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 2,390,899 |
return sendAsync(HttpMethod.GET, null);
} | return sendAsync(HttpMethod.GET, null); } | /**
* Gets the UpdateRecordingStatusOperation from the service
*
* @return a future with the result
*/ | Gets the UpdateRecordingStatusOperation from the service | getAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/UpdateRecordingStatusOperationRequest.java",
"license": "mit",
"size": 6764
} | [
"com.microsoft.graph.http.HttpMethod"
] | import com.microsoft.graph.http.HttpMethod; | import com.microsoft.graph.http.*; | [
"com.microsoft.graph"
] | com.microsoft.graph; | 1,809,922 |
public InetAddress getInetAddress(String id) {
return ((InetAddress) getObject(id));
} | InetAddress function(String id) { return ((InetAddress) getObject(id)); } | /**
* Returns the first InetAddress value associated with the specified id.
* @param id the id of the InetAddress value to retrieve
* @return the InetAddress value associated with the specified id.
* @see #getInetAddress(String, InetAddress)
* @see #getInetAddressArray(String)
* @see java.net.InetAddress
*/ | Returns the first InetAddress value associated with the specified id | getInetAddress | {
"repo_name": "j-hoppe/BlinkenBone",
"path": "projects/3rdparty/jsap/src/java/com/martiansoftware/jsap/JSAPResult.java",
"license": "mit",
"size": 54736
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 2,515,953 |
public void setNormalizationForm(
final Normalizer.Form normalizationForm) {
this.normalizationForm = normalizationForm;
} | void function( final Normalizer.Form normalizationForm) { this.normalizationForm = normalizationForm; } | /**
* Sets the normalisation form used for normalising identifiers, names and
* values.
* <p>
* The default value is {@value #DEFAULT_NORMALIZATION_FORM}.
* <p>
* This parameter may be set at any time during processing. It becomes
* immediately effective and affects all subsequently received events.
*
* @param normalizationForm the normalisation form to use.
*
*/ | Sets the normalisation form used for normalising identifiers, names and values. The default value is #DEFAULT_NORMALIZATION_FORM. This parameter may be set at any time during processing. It becomes immediately effective and affects all subsequently received events | setNormalizationForm | {
"repo_name": "dswarm/metafacture-core",
"path": "src/main/java/org/culturegraph/mf/stream/pipe/StreamUnicodeNormalizer.java",
"license": "apache-2.0",
"size": 5383
} | [
"java.text.Normalizer"
] | import java.text.Normalizer; | import java.text.*; | [
"java.text"
] | java.text; | 1,405,460 |
@ReactMethod
public void stopObserving() {
LocationManager locationManager =
(LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE);
locationManager.removeUpdates(mLocationListener);
mWatchedProvider = null;
} | void function() { LocationManager locationManager = (LocationManager) getReactApplicationContext().getSystemService(Context.LOCATION_SERVICE); locationManager.removeUpdates(mLocationListener); mWatchedProvider = null; } | /**
* Stop listening for location updates.
*
* NB: this is not balanced with {@link #startObserving}: any number of calls to that method will
* be canceled by just one call to this one.
*/ | Stop listening for location updates. be canceled by just one call to this one | stopObserving | {
"repo_name": "kssujithcj/TestMobileCenter",
"path": "node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/location/LocationModule.java",
"license": "mit",
"size": 10608
} | [
"android.content.Context",
"android.location.LocationManager"
] | import android.content.Context; import android.location.LocationManager; | import android.content.*; import android.location.*; | [
"android.content",
"android.location"
] | android.content; android.location; | 2,551,631 |
public String getStringAttribute(String name,
Hashtable valueSet,
String defaultKey,
boolean allowLiterals)
{
return (String) this.getAttribute(name, valueSet, defaultKey,
allowLiterals);
} | String function(String name, Hashtable valueSet, String defaultKey, boolean allowLiterals) { return (String) this.getAttribute(name, valueSet, defaultKey, allowLiterals); } | /**
* Returns an attribute by looking up a key in a hashtable.
* If the attribute doesn't exist, the value corresponding to defaultKey
* is returned.
* <P>
* As an example, if valueSet contains the mapping <code>"one" =>
* "1"</code>
* and the element contains the attribute <code>attr="one"</code>, then
* <code>getAttribute("attr", mapping, defaultKey, false)</code> returns
* <code>"1"</code>.
*
* @param name
* The name of the attribute.
* @param valueSet
* Hashtable mapping keys to values.
* @param defaultKey
* Key to use if the attribute is missing.
* @param allowLiterals
* <code>true</code> if literals are valid.
*
* </dl><dl><dt><b>Preconditions:</b></dt><dd>
* <ul><li><code>name != null</code>
* <li><code>name</code> is a valid XML identifier
* <li><code>valueSet</code> != null
* <li>the keys of <code>valueSet</code> are strings
* <li>the values of <code>valueSet</code> are strings
* </ul></dd></dl><dl>
*
* @see nanoxml.XMLElement#setAttribute(java.lang.String, java.lang.Object)
* setAttribute(String, Object)
* @see nanoxml.XMLElement#removeAttribute(java.lang.String)
* removeAttribute(String)
* @see nanoxml.XMLElement#enumerateAttributeNames()
* @see nanoxml.XMLElement#getStringAttribute(java.lang.String)
* getStringAttribute(String)
* @see nanoxml.XMLElement#getStringAttribute(java.lang.String,
* java.lang.String)
* getStringAttribute(String, String)
*/ | Returns an attribute by looking up a key in a hashtable. If the attribute doesn't exist, the value corresponding to defaultKey is returned. As an example, if valueSet contains the mapping <code>"one" => "1"</code> and the element contains the attribute <code>attr="one"</code>, then <code>getAttribute("attr", mapping, defaultKey, false)</code> returns <code>"1"</code> | getStringAttribute | {
"repo_name": "lsilvestre/Jogre",
"path": "api/src/nanoxml/XMLElement.java",
"license": "gpl-2.0",
"size": 99514
} | [
"java.util.Hashtable"
] | import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 1,896,470 |
public ByteBuffer toBuffer() {
ByteBuffer buffer = ByteBuffer.allocateDirect(HTTP2_HEADER_LENGTH + getLength());
buffer.put((byte) (getLength() >> 16));
buffer.put((byte) (getLength() >> 8));
buffer.put((byte) (getLength() ));
buffer.put((byte) getType());
buffer.put(getFlags());
buffer.putInt(getStreamID());
writePayload(buffer);
buffer.flip();
return buffer;
} | ByteBuffer function() { ByteBuffer buffer = ByteBuffer.allocateDirect(HTTP2_HEADER_LENGTH + getLength()); buffer.put((byte) (getLength() >> 16)); buffer.put((byte) (getLength() >> 8)); buffer.put((byte) (getLength() )); buffer.put((byte) getType()); buffer.put(getFlags()); buffer.putInt(getStreamID()); writePayload(buffer); buffer.flip(); return buffer; } | /**
* Serialize the frame to a buffer.
*
* @return the allocated buffer
*/ | Serialize the frame to a buffer | toBuffer | {
"repo_name": "yangzhongj/mina",
"path": "http2/src/main/java/org/apache/mina/http2/api/Http2Frame.java",
"license": "apache-2.0",
"size": 4830
} | [
"java.nio.ByteBuffer"
] | import java.nio.ByteBuffer; | import java.nio.*; | [
"java.nio"
] | java.nio; | 1,875,279 |
RotateArray test = new RotateArray();
int[][] result = test.rotate(new int[][] {{1, 2}, {3, 4}});
int[][] expected = {{3, 1}, {4, 2}};
assertThat(result, is(expected));
} | RotateArray test = new RotateArray(); int[][] result = test.rotate(new int[][] {{1, 2}, {3, 4}}); int[][] expected = {{3, 1}, {4, 2}}; assertThat(result, is(expected)); } | /**
* Test whenRotateTwoRowTwoColArrayThenRotatedArray.
*/ | Test whenRotateTwoRowTwoColArrayThenRotatedArray | whenRotateTwoRowTwoColArrayThenRotatedArray | {
"repo_name": "kochanovalexey/akochanov",
"path": "chapter_001/src/test/java/ru/job4j/array/RotateArrayTest.java",
"license": "apache-2.0",
"size": 938
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 277,813 |
public void tightMarshal2(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException {
super.tightMarshal2(wireFormat, o, dataOut, bs);
MessageDispatch info = (MessageDispatch)o;
tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs);
tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs);
tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessage(), dataOut, bs);
dataOut.writeInt(info.getRedeliveryCounter());
} | void function(OpenWireFormat wireFormat, Object o, DataByteArrayOutputStream dataOut, BooleanStream bs) throws IOException { super.tightMarshal2(wireFormat, o, dataOut, bs); MessageDispatch info = (MessageDispatch)o; tightMarshalCachedObject2(wireFormat, (DataStructure)info.getConsumerId(), dataOut, bs); tightMarshalCachedObject2(wireFormat, (DataStructure)info.getDestination(), dataOut, bs); tightMarshalNestedObject2(wireFormat, (DataStructure)info.getMessage(), dataOut, bs); dataOut.writeInt(info.getRedeliveryCounter()); } | /**
* Write a object instance to data output stream
*
* @param o the instance to be marshaled
* @param dataOut the output stream
* @throws IOException thrown if an error occurs
*/ | Write a object instance to data output stream | tightMarshal2 | {
"repo_name": "jonathanchristison/fabric8",
"path": "gateway/gateway-core/src/main/java/io/fabric8/gateway/handlers/detecting/protocol/openwire/codec/v1/MessageDispatchMarshaller.java",
"license": "apache-2.0",
"size": 5771
} | [
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure",
"io.fabric8.gateway.handlers.detecting.protocol.openwire.command.Messa... | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.BooleanStream; import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.OpenWireFormat; import io.fabric8.gateway.handlers.detecting.protocol.openwire.command.DataStructure; import io.fabric8.gateway.handlers.detecting.protocol.openwire.command.MessageDispatch; import java.io.IOException; import org.fusesource.hawtbuf.DataByteArrayOutputStream; | import io.fabric8.gateway.handlers.detecting.protocol.openwire.codec.*; import io.fabric8.gateway.handlers.detecting.protocol.openwire.command.*; import java.io.*; import org.fusesource.hawtbuf.*; | [
"io.fabric8.gateway",
"java.io",
"org.fusesource.hawtbuf"
] | io.fabric8.gateway; java.io; org.fusesource.hawtbuf; | 2,597,693 |
public static CharacterChromosome of(
final CharSeq validCharacters,
final IntRange lengthRange
) {
return new CharacterChromosome(
CharacterGene.seq(validCharacters, lengthRange),
lengthRange
);
}
/**
* Create a new chromosome with the {@link CharacterGene#DEFAULT_CHARACTERS} | static CharacterChromosome function( final CharSeq validCharacters, final IntRange lengthRange ) { return new CharacterChromosome( CharacterGene.seq(validCharacters, lengthRange), lengthRange ); } /** * Create a new chromosome with the {@link CharacterGene#DEFAULT_CHARACTERS} | /**
* Create a new chromosome with the {@code validCharacters} char set as
* valid characters.
*
* @since 4.3
*
* @param validCharacters the valid characters for this chromosome.
* @param lengthRange the allowed length range of the chromosome.
* @return a new {@code CharacterChromosome} with the given parameter
* @throws NullPointerException if the {@code validCharacters} is
* {@code null}.
* @throws IllegalArgumentException if the length of the gene sequence is
* empty, doesn't match with the allowed length range, the minimum
* or maximum of the range is smaller or equal zero or the given
* range size is zero.
*/ | Create a new chromosome with the validCharacters char set as valid characters | of | {
"repo_name": "jenetics/jenetics",
"path": "jenetics/src/main/java/io/jenetics/CharacterChromosome.java",
"license": "apache-2.0",
"size": 11334
} | [
"io.jenetics.util.CharSeq",
"io.jenetics.util.IntRange"
] | import io.jenetics.util.CharSeq; import io.jenetics.util.IntRange; | import io.jenetics.util.*; | [
"io.jenetics.util"
] | io.jenetics.util; | 2,241,035 |
private static final class SingleValue extends ValueSetter {
Object put(Object obj, Object[] args) {
args[0] = obj;
return null;
}
}
static final class AsyncBeanValueSetter extends ValueSetter {
private final PropertyAccessor accessor;
AsyncBeanValueSetter(ParameterImpl p, Class wrapper) {
QName name = p.getName();
try {
accessor = p.getOwner().getBindingContext().getElementPropertyAccessor(
wrapper, name.getNamespaceURI(), name.getLocalPart() );
} catch (JAXBException e) {
throw new WebServiceException( // TODO: i18n
wrapper+" do not have a property of the name "+name,e);
}
} | static final class SingleValue extends ValueSetter { Object function(Object obj, Object[] args) { args[0] = obj; return null; } } static final class AsyncBeanValueSetter extends ValueSetter { private final PropertyAccessor accessor; AsyncBeanValueSetter(ParameterImpl p, Class wrapper) { QName name = p.getName(); try { accessor = p.getOwner().getBindingContext().getElementPropertyAccessor( wrapper, name.getNamespaceURI(), name.getLocalPart() ); } catch (JAXBException e) { throw new WebServiceException( wrapper+STR+name,e); } } | /**
* Set args[0] as the value
*/ | Set args[0] as the value | put | {
"repo_name": "shelan/jdk9-mirror",
"path": "jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/client/sei/ValueSetter.java",
"license": "gpl-2.0",
"size": 6035
} | [
"com.sun.xml.internal.ws.model.ParameterImpl",
"com.sun.xml.internal.ws.spi.db.PropertyAccessor",
"javax.xml.bind.JAXBException",
"javax.xml.namespace.QName",
"javax.xml.ws.WebServiceException"
] | import com.sun.xml.internal.ws.model.ParameterImpl; import com.sun.xml.internal.ws.spi.db.PropertyAccessor; import javax.xml.bind.JAXBException; import javax.xml.namespace.QName; import javax.xml.ws.WebServiceException; | import com.sun.xml.internal.ws.model.*; import com.sun.xml.internal.ws.spi.db.*; import javax.xml.bind.*; import javax.xml.namespace.*; import javax.xml.ws.*; | [
"com.sun.xml",
"javax.xml"
] | com.sun.xml; javax.xml; | 58,806 |
public void addNearEvicted(KeyCacheObject key) {
if (nearEvicted == null)
nearEvicted = new ArrayList<>();
nearEvicted.add(key);
}
/** {@inheritDoc} | void function(KeyCacheObject key) { if (nearEvicted == null) nearEvicted = new ArrayList<>(); nearEvicted.add(key); } /** {@inheritDoc} | /**
* Adds near evicted key..
*
* @param key Evicted key.
*/ | Adds near evicted key. | addNearEvicted | {
"repo_name": "shurun19851206/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/dht/atomic/GridDhtAtomicUpdateResponse.java",
"license": "apache-2.0",
"size": 8240
} | [
"java.util.ArrayList",
"org.apache.ignite.internal.processors.cache.KeyCacheObject"
] | import java.util.ArrayList; import org.apache.ignite.internal.processors.cache.KeyCacheObject; | import java.util.*; import org.apache.ignite.internal.processors.cache.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,581,470 |
public void setChildren(FileStatus[] listStatus) {
this.children = listStatus;
} | void function(FileStatus[] listStatus) { this.children = listStatus; } | /**
* set children of this object
* @param listStatus the list of children
*/ | set children of this object | setChildren | {
"repo_name": "dennishuo/hadoop",
"path": "hadoop-tools/hadoop-archives/src/main/java/org/apache/hadoop/tools/HadoopArchives.java",
"license": "apache-2.0",
"size": 33528
} | [
"org.apache.hadoop.fs.FileStatus"
] | import org.apache.hadoop.fs.FileStatus; | import org.apache.hadoop.fs.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,405,881 |
public synchronized void add(long count) {
checkArgument(count >= 0, "Count must be non-negative");
if (end == 0L) {
total += count;
}
} | synchronized void function(long count) { checkArgument(count >= 0, STR); if (end == 0L) { total += count; } } | /**
* Adds the specified number of occurrences to the counter. No-op if the
* counter has been frozen.
*
* @param count number of occurrences
*/ | Adds the specified number of occurrences to the counter. No-op if the counter has been frozen | add | {
"repo_name": "donNewtonAlpha/onos",
"path": "utils/misc/src/main/java/org/onlab/util/Counter.java",
"license": "apache-2.0",
"size": 3971
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,923,779 |
public ServiceFuture<NetworkWatcherInner> getByResourceGroupAsync(String resourceGroupName, String networkWatcherName, final ServiceCallback<NetworkWatcherInner> serviceCallback) {
return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkWatcherName), serviceCallback);
} | ServiceFuture<NetworkWatcherInner> function(String resourceGroupName, String networkWatcherName, final ServiceCallback<NetworkWatcherInner> serviceCallback) { return ServiceFuture.fromResponse(getByResourceGroupWithServiceResponseAsync(resourceGroupName, networkWatcherName), serviceCallback); } | /**
* Gets the specified network watcher by resource group.
*
* @param resourceGroupName The name of the resource group.
* @param networkWatcherName The name of the network watcher.
* @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 network watcher by resource group | getByResourceGroupAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2020_03_01/src/main/java/com/microsoft/azure/management/network/v2020_03_01/implementation/NetworkWatchersInner.java",
"license": "mit",
"size": 190989
} | [
"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,227,840 |
public void testAdditionOfDuplicateXValues() {
YIntervalSeries s1 = new YIntervalSeries("Series 1");
s1.add(1.0, 1.0, 1.0, 1.0);
s1.add(2.0, 2.0, 2.0, 2.0);
s1.add(2.0, 3.0, 3.0, 3.0);
s1.add(2.0, 4.0, 4.0, 4.0);
s1.add(3.0, 5.0, 5.0, 5.0);
assertEquals(1.0, s1.getYValue(0), EPSILON);
assertEquals(2.0, s1.getYValue(1), EPSILON);
assertEquals(3.0, s1.getYValue(2), EPSILON);
assertEquals(4.0, s1.getYValue(3), EPSILON);
assertEquals(5.0, s1.getYValue(4), EPSILON);
} | void function() { YIntervalSeries s1 = new YIntervalSeries(STR); s1.add(1.0, 1.0, 1.0, 1.0); s1.add(2.0, 2.0, 2.0, 2.0); s1.add(2.0, 3.0, 3.0, 3.0); s1.add(2.0, 4.0, 4.0, 4.0); s1.add(3.0, 5.0, 5.0, 5.0); assertEquals(1.0, s1.getYValue(0), EPSILON); assertEquals(2.0, s1.getYValue(1), EPSILON); assertEquals(3.0, s1.getYValue(2), EPSILON); assertEquals(4.0, s1.getYValue(3), EPSILON); assertEquals(5.0, s1.getYValue(4), EPSILON); } | /**
* When items are added with duplicate x-values, we expect them to remain
* in the order they were added.
*/ | When items are added with duplicate x-values, we expect them to remain in the order they were added | testAdditionOfDuplicateXValues | {
"repo_name": "ilyessou/jfreechart",
"path": "tests/org/jfree/data/xy/junit/YIntervalSeriesTests.java",
"license": "lgpl-2.1",
"size": 9845
} | [
"org.jfree.data.xy.YIntervalSeries"
] | import org.jfree.data.xy.YIntervalSeries; | import org.jfree.data.xy.*; | [
"org.jfree.data"
] | org.jfree.data; | 2,232,482 |
@Nullable
public MediaType negotiatedResponseMediaType() {
ensurePresence();
return negotiatedResponseMediaType;
} | MediaType function() { ensurePresence(); return negotiatedResponseMediaType; } | /**
* Returns the negotiated producible media type.
*/ | Returns the negotiated producible media type | negotiatedResponseMediaType | {
"repo_name": "anuraaga/armeria",
"path": "core/src/main/java/com/linecorp/armeria/server/RoutingResult.java",
"license": "apache-2.0",
"size": 6293
} | [
"com.linecorp.armeria.common.MediaType"
] | import com.linecorp.armeria.common.MediaType; | import com.linecorp.armeria.common.*; | [
"com.linecorp.armeria"
] | com.linecorp.armeria; | 1,478,093 |
public synchronized void endIngestion ()
{
endCounter.incrementAndGet ();
LOGGER.info("End of product ingestion: processed=" +
endCounter.get () + ", error=" + errorCounter.get () + ", inbox=" +
(totalProcessed.get () - (endCounter.get () + errorCounter.get ())) +
", total=" + totalProcessed.get () + ".");
// Total number of product processed shall be coherent with
// passed/non-passed number of products.
if ((endCounter.get () + errorCounter.get ()) >= getTotalProcessed ())
{
this.scannerStatus = FileScanner.STATUS_OK;
processingsDone(null);
}
} | synchronized void function () { endCounter.incrementAndGet (); LOGGER.info(STR + endCounter.get () + STR + errorCounter.get () + STR + (totalProcessed.get () - (endCounter.get () + errorCounter.get ())) + STR + totalProcessed.get () + "."); if ((endCounter.get () + errorCounter.get ()) >= getTotalProcessed ()) { this.scannerStatus = FileScanner.STATUS_OK; processingsDone(null); } } | /**
* End of a product ingestion: check if the scanner is finished, and all
* processing are completed, in this case, it modifies the scanner status
* and message to inform user of finished processings.
*/ | End of a product ingestion: check if the scanner is finished, and all processing are completed, in this case, it modifies the scanner status and message to inform user of finished processings | endIngestion | {
"repo_name": "SentinelDataHub/DataHubSystem",
"path": "core/src/main/java/fr/gael/dhus/datastore/scanner/FileScannerWrapper.java",
"license": "agpl-3.0",
"size": 6828
} | [
"fr.gael.dhus.database.object.FileScanner"
] | import fr.gael.dhus.database.object.FileScanner; | import fr.gael.dhus.database.object.*; | [
"fr.gael.dhus"
] | fr.gael.dhus; | 2,891,489 |
public static void main(String[] args) {
try {
//=============================================================
// Authenticate
//
final AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
final TokenCredential credential = new DefaultAzureCredentialBuilder()
.authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint())
.build();
AzureResourceManager azureResourceManager = AzureResourceManager
.configure()
.withLogLevel(HttpLogDetailLevel.BASIC)
.authenticate(credential, profile)
.withDefaultSubscription();
// Print selected subscription
System.out.println("Selected subscription: " + azureResourceManager.subscriptionId());
runSample(azureResourceManager);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
private CreateVirtualMachinesAsyncTrackingRelatedResources() {
} | static void function(String[] args) { try { final TokenCredential credential = new DefaultAzureCredentialBuilder() .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) .build(); AzureResourceManager azureResourceManager = AzureResourceManager .configure() .withLogLevel(HttpLogDetailLevel.BASIC) .authenticate(credential, profile) .withDefaultSubscription(); System.out.println(STR + azureResourceManager.subscriptionId()); runSample(azureResourceManager); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } private CreateVirtualMachinesAsyncTrackingRelatedResources() { } | /**
* Main entry point.
* @param args the parameters
*/ | Main entry point | main | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-samples/src/main/java/com/azure/resourcemanager/compute/samples/CreateVirtualMachinesAsyncTrackingRelatedResources.java",
"license": "mit",
"size": 15682
} | [
"com.azure.core.credential.TokenCredential",
"com.azure.core.http.policy.HttpLogDetailLevel",
"com.azure.identity.DefaultAzureCredentialBuilder",
"com.azure.resourcemanager.AzureResourceManager"
] | import com.azure.core.credential.TokenCredential; import com.azure.core.http.policy.HttpLogDetailLevel; import com.azure.identity.DefaultAzureCredentialBuilder; import com.azure.resourcemanager.AzureResourceManager; | import com.azure.core.credential.*; import com.azure.core.http.policy.*; import com.azure.identity.*; import com.azure.resourcemanager.*; | [
"com.azure.core",
"com.azure.identity",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.identity; com.azure.resourcemanager; | 1,819,830 |
@Override
public void detach(@Nullable final O observer)
{
if (observer != null)
{
detach(observer, getObserverCollection());
}
} | void function(@Nullable final O observer) { if (observer != null) { detach(observer, getObserverCollection()); } } | /**
* Detaches given observer in order to stop being notified of state
* changes.
* @param observer the new observer to attach.
*/ | Detaches given observer in order to stop being notified of state changes | detach | {
"repo_name": "rydnr/java-commons",
"path": "src/main/java/org/acmsl/commons/patterns/Subject.java",
"license": "gpl-2.0",
"size": 4917
} | [
"org.jetbrains.annotations.Nullable"
] | import org.jetbrains.annotations.Nullable; | import org.jetbrains.annotations.*; | [
"org.jetbrains.annotations"
] | org.jetbrains.annotations; | 556,638 |
@Override
public final String toString() {
return "CHECKED/" + name();
}
public static final Set<CheckedRounding> VALUES = Collections.unmodifiableSet(EnumSet.allOf(CheckedRounding.class)); | final String function() { return STR + name(); } public static final Set<CheckedRounding> VALUES = Collections.unmodifiableSet(EnumSet.allOf(CheckedRounding.class)); | /**
* Returns "CHECKED/(name)" where {@code (name)} stands for the {@link #name()} of this constant.
*
* @return a string like "CHECKED/HALF_UP"
*/ | Returns "CHECKED/(name)" where (name) stands for the <code>#name()</code> of this constant | toString | {
"repo_name": "tools4j/decimal4j",
"path": "src/main/java/org/decimal4j/truncate/CheckedRounding.java",
"license": "mit",
"size": 8356
} | [
"java.util.Collections",
"java.util.EnumSet",
"java.util.Set"
] | import java.util.Collections; import java.util.EnumSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,235,236 |
public void sendSymbol(String recv, String sym) {
PdBase.sendSymbol(recv, sym);
} | void function(String recv, String sym) { PdBase.sendSymbol(recv, sym); } | /**
* Delegates to the corresponding method in {@link PdBase}.
*/ | Delegates to the corresponding method in <code>PdBase</code> | sendSymbol | {
"repo_name": "rvega/morphasynth",
"path": "vendors/pd-for-ios/libpd/java/org/puredata/processing/PureDataP5Base.java",
"license": "gpl-3.0",
"size": 6445
} | [
"org.puredata.core.PdBase"
] | import org.puredata.core.PdBase; | import org.puredata.core.*; | [
"org.puredata.core"
] | org.puredata.core; | 2,109,564 |
public boolean enrollProjectParticipant(Identity identity, Project projectAt, ProjectBrokerModuleConfiguration moduleConfig, int nbrSelectedProjects, boolean isParticipantInAnyProject); | boolean function(Identity identity, Project projectAt, ProjectBrokerModuleConfiguration moduleConfig, int nbrSelectedProjects, boolean isParticipantInAnyProject); | /**
* Enroll certain identity as participant or candidate of a project (depending on project-broker configuration).
* @param identity
* @param projectAt
* @param moduleConfig
* @param nbrSelectedProjects
* @param isParticipantInAnyProject
* @return
*/ | Enroll certain identity as participant or candidate of a project (depending on project-broker configuration) | enrollProjectParticipant | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/course/nodes/projectbroker/service/ProjectBrokerManager.java",
"license": "apache-2.0",
"size": 8643
} | [
"org.olat.core.id.Identity",
"org.olat.course.nodes.projectbroker.datamodel.Project"
] | import org.olat.core.id.Identity; import org.olat.course.nodes.projectbroker.datamodel.Project; | import org.olat.core.id.*; import org.olat.course.nodes.projectbroker.datamodel.*; | [
"org.olat.core",
"org.olat.course"
] | org.olat.core; org.olat.course; | 334,705 |
@Test
public void testExceptionWhenGroupNullRegistration() {
thrown.expect(PersistorException.class);
thrown.expectMessage("You have to specify a group when registering.");
final IPersistable persistable = new MockPersistable();
// execute the method
persistor.register(null, persistable);
} | void function() { thrown.expect(PersistorException.class); thrown.expectMessage(STR); final IPersistable persistable = new MockPersistable(); persistor.register(null, persistable); } | /**
* Tests the exception to be thrown when {@code null} is used as group for
* registration.
*/ | Tests the exception to be thrown when null is used as group for registration | testExceptionWhenGroupNullRegistration | {
"repo_name": "pmeisen/dis-timeintervaldataanalyzer",
"path": "test/net/meisen/dissertation/model/persistence/TestBasePersistor.java",
"license": "bsd-3-clause",
"size": 7481
} | [
"net.meisen.dissertation.exceptions.PersistorException",
"net.meisen.dissertation.model.persistence.mock.MockPersistable"
] | import net.meisen.dissertation.exceptions.PersistorException; import net.meisen.dissertation.model.persistence.mock.MockPersistable; | import net.meisen.dissertation.exceptions.*; import net.meisen.dissertation.model.persistence.mock.*; | [
"net.meisen.dissertation"
] | net.meisen.dissertation; | 1,177,331 |
public void logNetworkError(String url, String reason, int statusCode, String body) {
Bundle bundle = new Bundle();
bundle.putString("url", url);
bundle.putString("reason", reason);
bundle.putInt("statusCode", statusCode);
bundle.putString("body", body);
log(EVENT_TYPE.NETWORK_ERROR, bundle);
} | void function(String url, String reason, int statusCode, String body) { Bundle bundle = new Bundle(); bundle.putString("url", url); bundle.putString(STR, reason); bundle.putInt(STR, statusCode); bundle.putString("body", body); log(EVENT_TYPE.NETWORK_ERROR, bundle); } | /**
* Logs a network error to firebase
* @param url url of the failed request
* @param reason reason of the failed request
* @param statusCode status code of the failed request
* @param body body of the failed request
*/ | Logs a network error to firebase | logNetworkError | {
"repo_name": "francescotonini/univr-orari",
"path": "app/src/main/java/it/francescotonini/univrorari/helpers/LoggerHelper.java",
"license": "mit",
"size": 4075
} | [
"android.os.Bundle"
] | import android.os.Bundle; | import android.os.*; | [
"android.os"
] | android.os; | 1,578,141 |
public static PostalData constructPostalData(final List<String> propValueList,
final int type, final String label, boolean isPrimary, int vcardType) {
final String[] dataArray = new String[ADDR_MAX_DATA_SIZE];
int size = propValueList.size();
if (size > ADDR_MAX_DATA_SIZE) {
size = ADDR_MAX_DATA_SIZE;
}
// adr-value = 0*6(text-value ";") text-value
// ; PO Box, Extended Address, Street, Locality, Region, Postal Code, Country Name
//
// Use Iterator assuming List may be LinkedList, though actually it is
// always ArrayList in the current implementation.
int i = 0;
for (String addressElement : propValueList) {
dataArray[i] = addressElement;
if (++i >= size) {
break;
}
}
while (i < ADDR_MAX_DATA_SIZE) {
dataArray[i++] = null;
}
return new PostalData(dataArray[0], dataArray[1], dataArray[2], dataArray[3],
dataArray[4], dataArray[5], dataArray[6], type, label, isPrimary, vcardType);
} | static PostalData function(final List<String> propValueList, final int type, final String label, boolean isPrimary, int vcardType) { final String[] dataArray = new String[ADDR_MAX_DATA_SIZE]; int size = propValueList.size(); if (size > ADDR_MAX_DATA_SIZE) { size = ADDR_MAX_DATA_SIZE; } int i = 0; for (String addressElement : propValueList) { dataArray[i] = addressElement; if (++i >= size) { break; } } while (i < ADDR_MAX_DATA_SIZE) { dataArray[i++] = null; } return new PostalData(dataArray[0], dataArray[1], dataArray[2], dataArray[3], dataArray[4], dataArray[5], dataArray[6], type, label, isPrimary, vcardType); } | /**
* Accepts raw propertyValueList in vCard and constructs PostalData.
*/ | Accepts raw propertyValueList in vCard and constructs PostalData | constructPostalData | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/com/android/vcard/VCardEntry.java",
"license": "apache-2.0",
"size": 99419
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 830,556 |
@Override
public float getDescent() {
return dic.getFloat(COSName.DESCENT, 0);
} | float function() { return dic.getFloat(COSName.DESCENT, 0); } | /**
* This will get the descent for the font.
*
* @return The descent.
*/ | This will get the descent for the font | getDescent | {
"repo_name": "sencko/NALB",
"path": "nalb2013/src/org/apache/pdfbox/pdmodel/font/PDFontDescriptorDictionary.java",
"license": "gpl-2.0",
"size": 13861
} | [
"org.apache.pdfbox.cos.COSName"
] | import org.apache.pdfbox.cos.COSName; | import org.apache.pdfbox.cos.*; | [
"org.apache.pdfbox"
] | org.apache.pdfbox; | 2,325,158 |
public void setA_QTY_Original (BigDecimal A_QTY_Original)
{
set_Value (COLUMNNAME_A_QTY_Original, A_QTY_Original);
} | void function (BigDecimal A_QTY_Original) { set_Value (COLUMNNAME_A_QTY_Original, A_QTY_Original); } | /** Set A_QTY_Original.
@param A_QTY_Original A_QTY_Original */ | Set A_QTY_Original | setA_QTY_Original | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/X_A_Asset_Change.java",
"license": "gpl-2.0",
"size": 44348
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,951,090 |
public static List<NabuccoPropertyDescriptor> getPropertyDescriptorList() {
return PropertyCache.getInstance().retrieve(PhoneNumber.class).getAllProperties();
}
| static List<NabuccoPropertyDescriptor> function() { return PropertyCache.getInstance().retrieve(PhoneNumber.class).getAllProperties(); } | /**
* Getter for the PropertyDescriptorList.
*
* @return the List<NabuccoPropertyDescriptor>.
*/ | Getter for the PropertyDescriptorList | getPropertyDescriptorList | {
"repo_name": "NABUCCO/org.nabucco.framework.base",
"path": "org.nabucco.framework.base.facade.datatype/src/main/gen/org/nabucco/framework/base/facade/datatype/business/address/PhoneNumber.java",
"license": "epl-1.0",
"size": 3664
} | [
"java.util.List",
"org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor",
"org.nabucco.framework.base.facade.datatype.property.PropertyCache"
] | import java.util.List; import org.nabucco.framework.base.facade.datatype.property.NabuccoPropertyDescriptor; import org.nabucco.framework.base.facade.datatype.property.PropertyCache; | import java.util.*; import org.nabucco.framework.base.facade.datatype.property.*; | [
"java.util",
"org.nabucco.framework"
] | java.util; org.nabucco.framework; | 475,671 |
void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception;
/**
* Starts the given route if it has been previously stopped
*
* @param route the route to start
* @throws Exception is thrown if the route could not be started for whatever reason
* @deprecated favor using {@link CamelContext#startRoute(String)} | void removeRouteDefinition(RouteDefinition routeDefinition) throws Exception; /** * Starts the given route if it has been previously stopped * * @param route the route to start * @throws Exception is thrown if the route could not be started for whatever reason * @deprecated favor using {@link CamelContext#startRoute(String)} | /**
* Removes a route definition from the context - stopping any previously running
* routes if any of them are actively running
*
* @param routeDefinition route definition to remove
* @throws Exception if the route definition could not be removed for whatever reason
*/ | Removes a route definition from the context - stopping any previously running routes if any of them are actively running | removeRouteDefinition | {
"repo_name": "jarst/camel",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 68708
} | [
"org.apache.camel.model.RouteDefinition"
] | import org.apache.camel.model.RouteDefinition; | import org.apache.camel.model.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,241,686 |
public T caseBuiltInConstant(BuiltInConstant object) {
return null;
} | T function(BuiltInConstant object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Built In Constant</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Built In Constant</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Built In Constant'. This implementation returns null; returning a non-null result will terminate the switch. | caseBuiltInConstant | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/terms/util/TermsSwitch.java",
"license": "epl-1.0",
"size": 21182
} | [
"fr.lip6.move.pnml.hlpn.terms.BuiltInConstant"
] | import fr.lip6.move.pnml.hlpn.terms.BuiltInConstant; | import fr.lip6.move.pnml.hlpn.terms.*; | [
"fr.lip6.move"
] | fr.lip6.move; | 2,256,403 |
@Named("accessrule:delete")
@DELETE
@Fallback(FalseOnNotFoundOr404.class)
@Path("/accesslist/{id}")
@Consumes("*/*")
boolean delete(@PathParam("id") int id); | @Named(STR) @Fallback(FalseOnNotFoundOr404.class) @Path(STR) @Consumes("*/*") boolean delete(@PathParam("id") int id); | /**
* Delete an access rule from the access list.
*
* @return true on a successful delete, false if the access rule was not found
*/ | Delete an access rule from the access list | delete | {
"repo_name": "yanzhijun/jclouds-aliyun",
"path": "apis/rackspace-cloudloadbalancers/src/main/java/org/jclouds/rackspace/cloudloadbalancers/v1/features/AccessRuleApi.java",
"license": "apache-2.0",
"size": 3857
} | [
"javax.inject.Named",
"javax.ws.rs.Consumes",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"org.jclouds.Fallbacks",
"org.jclouds.rest.annotations.Fallback"
] | import javax.inject.Named; import javax.ws.rs.Consumes; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import org.jclouds.Fallbacks; import org.jclouds.rest.annotations.Fallback; | import javax.inject.*; import javax.ws.rs.*; import org.jclouds.*; import org.jclouds.rest.annotations.*; | [
"javax.inject",
"javax.ws",
"org.jclouds",
"org.jclouds.rest"
] | javax.inject; javax.ws; org.jclouds; org.jclouds.rest; | 2,832,125 |
int[] getCollationElementsForString()
throws StandardException
{
if (stringData.isNull())
{
return (int[]) null;
}
// Caching of collationElementsForString is not working properly, in
// order to cache it needs to get invalidated everytime the container
// type's value is changed - through any interface, eg: readExternal,
// setValue, ... To get proper behavior, disabling caching, and will
// file a performance enhancement to implement correct caching.
collationElementsForString = null;
countOfCollationElements = 0;
if (collationElementsForString != null)
{
return collationElementsForString;
}
// countOfCollationElements should always be 0 when
// collationElementsForString is null
if (SanityManager.DEBUG)
{
if (countOfCollationElements != 0)
{
SanityManager.THROWASSERT(
"countOfCollationElements expected to be 0, not " +
countOfCollationElements);
}
}
collationElementsForString = new int[stringData.getLength()];
CollationElementIterator cei =
collatorForCharacterDatatypes.getCollationElementIterator(
stringData.getString());
int nextInt;
while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER)
{
if (countOfCollationElements == collationElementsForString.length)
{
int[] expandedArray = new int[countOfCollationElements + 5];
System.arraycopy(collationElementsForString, 0, expandedArray,
0, collationElementsForString.length);
collationElementsForString = expandedArray;
}
collationElementsForString[countOfCollationElements++] = nextInt;
}
return collationElementsForString;
} | int[] getCollationElementsForString() throws StandardException { if (stringData.isNull()) { return (int[]) null; } collationElementsForString = null; countOfCollationElements = 0; if (collationElementsForString != null) { return collationElementsForString; } if (SanityManager.DEBUG) { if (countOfCollationElements != 0) { SanityManager.THROWASSERT( STR + countOfCollationElements); } } collationElementsForString = new int[stringData.getLength()]; CollationElementIterator cei = collatorForCharacterDatatypes.getCollationElementIterator( stringData.getString()); int nextInt; while ((nextInt = cei.next()) != CollationElementIterator.NULLORDER) { if (countOfCollationElements == collationElementsForString.length) { int[] expandedArray = new int[countOfCollationElements + 5]; System.arraycopy(collationElementsForString, 0, expandedArray, 0, collationElementsForString.length); collationElementsForString = expandedArray; } collationElementsForString[countOfCollationElements++] = nextInt; } return collationElementsForString; } | /**
* This method translates the string into a series of collation elements.
* These elements will get used in the like method.
*
* @return an array of collation elements for the string
* @throws StandardException
*/ | This method translates the string into a series of collation elements. These elements will get used in the like method | getCollationElementsForString | {
"repo_name": "lpxz/grail-derby104",
"path": "java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.java",
"license": "apache-2.0",
"size": 9173
} | [
"java.text.CollationElementIterator",
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.services.sanity.SanityManager"
] | import java.text.CollationElementIterator; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.services.sanity.SanityManager; | import java.text.*; import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.services.sanity.*; | [
"java.text",
"org.apache.derby"
] | java.text; org.apache.derby; | 40,703 |
public void cargaFiltrosDefecto(){
try {
Calendar fecha = new GregorianCalendar();
//Obtenemos el valor del año, mes
//usando el método get y el parámetro correspondiente
Integer anhoDefault = fecha.get(Calendar.YEAR);
Integer mesDefault = fecha.get(Calendar.MONTH) + 1;
selIndMes = mesDefault.toString();
selIndAnho = anhoDefault.toString();
} catch (Exception e) {
throw e;
}
}
/////////////////////////////////////////// get - set //////////////////////////////////////////////////////////////
| void function(){ try { Calendar fecha = new GregorianCalendar(); Integer anhoDefault = fecha.get(Calendar.YEAR); Integer mesDefault = fecha.get(Calendar.MONTH) + 1; selIndMes = mesDefault.toString(); selIndAnho = anhoDefault.toString(); } catch (Exception e) { throw e; } } | /***
* Metodo que carga los filtros con los datos por defecto
* @return
*/ | Metodo que carga los filtros con los datos por defecto | cargaFiltrosDefecto | {
"repo_name": "caxsolutions/moneyprivate2.0",
"path": "moneyprivate/src/com/presentation/backingBeans/ConCuentasMesesView.java",
"license": "gpl-2.0",
"size": 32311
} | [
"java.util.Calendar",
"java.util.GregorianCalendar"
] | import java.util.Calendar; import java.util.GregorianCalendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,538,615 |
public void addPanListener(PanListener listener) {
if (mPan != null) {
mPan.addPanListener(listener);
}
}
| void function(PanListener listener) { if (mPan != null) { mPan.addPanListener(listener); } } | /**
* Adds a new pan listener.
*
* @param listener pan listener
*/ | Adds a new pan listener | addPanListener | {
"repo_name": "joebowen/landing_zone_project",
"path": "openrocket-release-15.03/android-libraries/achartengine/src/org/achartengine/TouchHandler.java",
"license": "gpl-2.0",
"size": 6615
} | [
"org.achartengine.tools.PanListener"
] | import org.achartengine.tools.PanListener; | import org.achartengine.tools.*; | [
"org.achartengine.tools"
] | org.achartengine.tools; | 2,323,013 |
public static void verifyNumInvalidates() {
long invalidatesRecordedByStats = pool.getInvalidateCount();
LogWriterUtils.getLogWriter()
.info("invalidatesRecordedByStats = " + invalidatesRecordedByStats);
int expectedInvalidates = TOTAL_SERVERS * PUTS_PER_SERVER;
LogWriterUtils.getLogWriter().info("expectedInvalidates = " + expectedInvalidates);
if (invalidatesRecordedByStats != expectedInvalidates) {
fail("Invalidates received by client(" + invalidatesRecordedByStats
+ ") does not match with the number of operations(" + expectedInvalidates
+ ") done at server");
}
} | static void function() { long invalidatesRecordedByStats = pool.getInvalidateCount(); LogWriterUtils.getLogWriter() .info(STR + invalidatesRecordedByStats); int expectedInvalidates = TOTAL_SERVERS * PUTS_PER_SERVER; LogWriterUtils.getLogWriter().info(STR + expectedInvalidates); if (invalidatesRecordedByStats != expectedInvalidates) { fail(STR + invalidatesRecordedByStats + STR + expectedInvalidates + STR); } } | /**
* Verify that the invalidates stats at the client accounts for the operations done by both,
* primary and secondary.
*
*/ | Verify that the invalidates stats at the client accounts for the operations done by both, primary and secondary | verifyNumInvalidates | {
"repo_name": "davebarnes97/geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/StatsBugDUnitTest.java",
"license": "apache-2.0",
"size": 11682
} | [
"org.apache.geode.test.dunit.LogWriterUtils",
"org.junit.Assert"
] | import org.apache.geode.test.dunit.LogWriterUtils; import org.junit.Assert; | import org.apache.geode.test.dunit.*; import org.junit.*; | [
"org.apache.geode",
"org.junit"
] | org.apache.geode; org.junit; | 1,083,323 |
public LOSGoodsReceipt getByGoodsReceiptNumber(String number);
| LOSGoodsReceipt function(String number); | /**
* Retrieve {@link LOSGoodsReceipt} by its number.
*
* @param number
* @return
*/ | Retrieve <code>LOSGoodsReceipt</code> by its number | getByGoodsReceiptNumber | {
"repo_name": "Jacksson/mywms",
"path": "server.app/los.inventory-ejb/src/de/linogistix/los/inventory/businessservice/LOSGoodsReceiptComponent.java",
"license": "gpl-2.0",
"size": 7670
} | [
"de.linogistix.los.inventory.model.LOSGoodsReceipt"
] | import de.linogistix.los.inventory.model.LOSGoodsReceipt; | import de.linogistix.los.inventory.model.*; | [
"de.linogistix.los"
] | de.linogistix.los; | 2,421,131 |
protected void setRpcServiceServerAddress(Configuration conf,
InetSocketAddress serviceRPCAddress) {
setServiceAddress(conf, NetUtils.getHostPortString(serviceRPCAddress));
} | void function(Configuration conf, InetSocketAddress serviceRPCAddress) { setServiceAddress(conf, NetUtils.getHostPortString(serviceRPCAddress)); } | /**
* Modifies the configuration passed to contain the service rpc address
* setting
*/ | Modifies the configuration passed to contain the service rpc address setting | setRpcServiceServerAddress | {
"repo_name": "srijeyanthan/hops",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java",
"license": "apache-2.0",
"size": 40625
} | [
"java.net.InetSocketAddress",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.net.NetUtils"
] | import java.net.InetSocketAddress; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.net.NetUtils; | import java.net.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.net.*; | [
"java.net",
"org.apache.hadoop"
] | java.net; org.apache.hadoop; | 264,557 |
@Override
public void process(ClusterDistributionManager dm) {
PartitionedRegion.validatePRID(getSender(), this.regionId, this.regionName);
} | void function(ClusterDistributionManager dm) { PartitionedRegion.validatePRID(getSender(), this.regionId, this.regionName); } | /**
* completely override process() from PartitionMessage. This message doesn't operate on a specific
* partitioned region, so the superclass impl doesn't make any sense to it.
*
* @param dm the distribution manager to use
*/ | completely override process() from PartitionMessage. This message doesn't operate on a specific partitioned region, so the superclass impl doesn't make any sense to it | process | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/partitioned/PRSanityCheckMessage.java",
"license": "apache-2.0",
"size": 5972
} | [
"org.apache.geode.distributed.internal.ClusterDistributionManager",
"org.apache.geode.internal.cache.PartitionedRegion"
] | import org.apache.geode.distributed.internal.ClusterDistributionManager; import org.apache.geode.internal.cache.PartitionedRegion; | import org.apache.geode.distributed.internal.*; import org.apache.geode.internal.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,820,880 |
@FIXVersion(introduced = "4.1", retired = "4.3")
@TagNumRef(tagNum = TagNum.PutOrCall)
public PutOrCall getPutOrCall() {
return getSafeInstrument().getPutOrCall();
} | @FIXVersion(introduced = "4.1", retired = "4.3") @TagNumRef(tagNum = TagNum.PutOrCall) PutOrCall function() { return getSafeInstrument().getPutOrCall(); } | /**
* Message field getter.
* @return field value
*/ | Message field getter | getPutOrCall | {
"repo_name": "marvisan/HadesFIX",
"path": "Model/src/main/java/net/hades/fix/message/OrderModificationRequestMsg.java",
"license": "gpl-3.0",
"size": 149491
} | [
"net.hades.fix.message.anno.FIXVersion",
"net.hades.fix.message.anno.TagNumRef",
"net.hades.fix.message.type.PutOrCall",
"net.hades.fix.message.type.TagNum"
] | import net.hades.fix.message.anno.FIXVersion; import net.hades.fix.message.anno.TagNumRef; import net.hades.fix.message.type.PutOrCall; import net.hades.fix.message.type.TagNum; | import net.hades.fix.message.anno.*; import net.hades.fix.message.type.*; | [
"net.hades.fix"
] | net.hades.fix; | 1,390,162 |
// -------------------------------------------------------------------------
public String[] listAllGroups(List<EnsTestCase> tests) {
ArrayList<String> g = new ArrayList<String>();
for(EnsTestCase test: tests) {
List<String> thisTestsGroups = test.getGroups();
for(String group: thisTestsGroups) {
if (!g.contains(group)) {
g.add(group);
}
}
}
return (String[]) g.toArray(new String[g.size()]);
} // listAllGroups | String[] function(List<EnsTestCase> tests) { ArrayList<String> g = new ArrayList<String>(); for(EnsTestCase test: tests) { List<String> thisTestsGroups = test.getGroups(); for(String group: thisTestsGroups) { if (!g.contains(group)) { g.add(group); } } } return (String[]) g.toArray(new String[g.size()]); } | /**
* Get the union of all the test groups.
*
* @param tests
* The tests to check.
* @return An array containing the names of all the groups that any member
* of tests is a member of.
*/ | Get the union of all the test groups | listAllGroups | {
"repo_name": "thomasmaurel/ensj-healthcheck",
"path": "src/org/ensembl/healthcheck/TestRunner.java",
"license": "apache-2.0",
"size": 13901
} | [
"java.util.ArrayList",
"java.util.List",
"org.ensembl.healthcheck.testcase.EnsTestCase"
] | import java.util.ArrayList; import java.util.List; import org.ensembl.healthcheck.testcase.EnsTestCase; | import java.util.*; import org.ensembl.healthcheck.testcase.*; | [
"java.util",
"org.ensembl.healthcheck"
] | java.util; org.ensembl.healthcheck; | 1,139,338 |
@Test
public void shouldUnmarshalUsingAdvancedConfiguration() throws Exception {
template.sendBody("direct:advanced", join("!This is comment", "!This is comment too", "A;B", "", " ;D "));
result.expectedMessageCount(1);
result.assertIsSatisfied();
List<?> body = assertIsInstanceOf(List.class, result.getExchanges().get(0).getIn().getBody());
assertEquals(2, body.size());
assertEquals(Arrays.asList("A", "B"), body.get(0));
assertEquals(Arrays.asList("N/A", "D "), body.get(1));
}
| void function() throws Exception { template.sendBody(STR, join(STR, STR, "A;B", STR ;D STRASTRBSTRN/ASTRD "), body.get(1)); } | /**
* Tests that we can unmarshal CSV that has lots of configuration options
*/ | Tests that we can unmarshal CSV that has lots of configuration options | shouldUnmarshalUsingAdvancedConfiguration | {
"repo_name": "logzio/camel",
"path": "components/camel-univocity-parsers/src/test/java/org/apache/camel/dataformat/univocity/UniVocityCsvDataFormatUnmarshalTest.java",
"license": "apache-2.0",
"size": 7426
} | [
"org.apache.camel.dataformat.univocity.UniVocityTestHelper"
] | import org.apache.camel.dataformat.univocity.UniVocityTestHelper; | import org.apache.camel.dataformat.univocity.*; | [
"org.apache.camel"
] | org.apache.camel; | 796,302 |
private void updateShownFragmentsVisibility() {
for (int i = 0; i < fragmentsArray.size(); i++) {
final Fragment fragment = fragmentsArray.get(fragmentsArray.keyAt(i));
if (fragment != null && fragment.getUserVisibleHint()
&& fragment.isVisible()) {
fragment.setUserVisibleHint(true);
return;
}
}
} | void function() { for (int i = 0; i < fragmentsArray.size(); i++) { final Fragment fragment = fragmentsArray.get(fragmentsArray.keyAt(i)); if (fragment != null && fragment.getUserVisibleHint() && fragment.isVisible()) { fragment.setUserVisibleHint(true); return; } } } | /**
* This function lets the currently shown Fragment know that it has now become visible to
* the user by calling its {@link Fragment#setUserVisibleHint(boolean)} function.
*/ | This function lets the currently shown Fragment know that it has now become visible to the user by calling its <code>Fragment#setUserVisibleHint(boolean)</code> function | updateShownFragmentsVisibility | {
"repo_name": "edx/edx-app-android",
"path": "OpenEdXMobile/src/main/java/org/edx/mobile/view/MainDiscoveryFragment.java",
"license": "apache-2.0",
"size": 13225
} | [
"androidx.fragment.app.Fragment"
] | import androidx.fragment.app.Fragment; | import androidx.fragment.app.*; | [
"androidx.fragment"
] | androidx.fragment; | 90,542 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<PagedResponse<FirewallRuleInner>> listByAccountNextSinglePageAsync(String nextLink, Context context) {
if (nextLink == null) {
return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null."));
}
if (this.client.getEndpoint() == null) {
return Mono
.error(
new IllegalArgumentException(
"Parameter this.client.getEndpoint() is required and cannot be null."));
}
final String accept = "application/json";
context = this.client.mergeContext(context);
return service
.listByAccountNext(nextLink, this.client.getEndpoint(), accept, context)
.map(
res ->
new PagedResponseBase<>(
res.getRequest(),
res.getStatusCode(),
res.getHeaders(),
res.getValue().value(),
res.getValue().nextLink(),
null));
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<PagedResponse<FirewallRuleInner>> function(String nextLink, Context context) { if (nextLink == null) { return Mono.error(new IllegalArgumentException(STR)); } if (this.client.getEndpoint() == null) { return Mono .error( new IllegalArgumentException( STR)); } final String accept = STR; context = this.client.mergeContext(context); return service .listByAccountNext(nextLink, this.client.getEndpoint(), accept, context) .map( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), res.getValue().nextLink(), null)); } | /**
* Get the next page of items.
*
* @param nextLink The nextLink parameter.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return data Lake Store firewall rule list information.
*/ | Get the next page of items | listByAccountNextSinglePageAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/datalakestore/azure-resourcemanager-datalakestore/src/main/java/com/azure/resourcemanager/datalakestore/implementation/FirewallRulesClientImpl.java",
"license": "mit",
"size": 55791
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedResponse",
"com.azure.core.http.rest.PagedResponseBase",
"com.azure.core.util.Context",
"com.azure.resourcemanager.datalakestore.fluent.models.FirewallRuleInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedResponse; import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.util.Context; import com.azure.resourcemanager.datalakestore.fluent.models.FirewallRuleInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.datalakestore.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 2,162,417 |
protected Load getLinkFlowLoad(Link link) {
if (link != null && link.src().elementId() instanceof DeviceId) {
return services.flowStats().load(link);
}
return null;
} | Load function(Link link) { if (link != null && link.src().elementId() instanceof DeviceId) { return services.flowStats().load(link); } return null; } | /**
* Returns the load for the given link, as determined by the statistics
* service. May return null.
*
* @param link the link on which to look up the stats
* @return the corresponding load (or null)
*/ | Returns the load for the given link, as determined by the statistics service. May return null | getLinkFlowLoad | {
"repo_name": "LorenzReinhart/ONOSnew",
"path": "web/gui/src/main/java/org/onosproject/ui/impl/TrafficMonitorBase.java",
"license": "apache-2.0",
"size": 13921
} | [
"org.onosproject.net.DeviceId",
"org.onosproject.net.Link",
"org.onosproject.net.statistic.Load"
] | import org.onosproject.net.DeviceId; import org.onosproject.net.Link; import org.onosproject.net.statistic.Load; | import org.onosproject.net.*; import org.onosproject.net.statistic.*; | [
"org.onosproject.net"
] | org.onosproject.net; | 2,086,368 |
@Override
public synchronized List<Runnable> shutdownNow() {
List<Runnable> tasks = new ArrayList<>();
for (Iterator<Runnable> it = taskQueue.iterator(); it.hasNext();) {
tasks.add(it.next());
it.remove();
}
terminate();
return tasks;
} | synchronized List<Runnable> function() { List<Runnable> tasks = new ArrayList<>(); for (Iterator<Runnable> it = taskQueue.iterator(); it.hasNext();) { tasks.add(it.next()); it.remove(); } terminate(); return tasks; } | /**
* Shut down the thread pool, and attempt to stop all executing tasks.
*
* <p>
* This method interrupts all worker threads in the pool.
* </p>
*
* @return A list of tasks that were never executed.
*/ | Shut down the thread pool, and attempt to stop all executing tasks. This method interrupts all worker threads in the pool. | shutdownNow | {
"repo_name": "opendaylight/vtn",
"path": "manager/implementation/src/main/java/org/opendaylight/vtn/manager/internal/util/concurrent/VTNThreadPool.java",
"license": "epl-1.0",
"size": 16958
} | [
"java.util.ArrayList",
"java.util.Iterator",
"java.util.List"
] | import java.util.ArrayList; import java.util.Iterator; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,868,932 |
void enterUnaryOperator(@NotNull CQLParser.UnaryOperatorContext ctx);
void exitUnaryOperator(@NotNull CQLParser.UnaryOperatorContext ctx); | void enterUnaryOperator(@NotNull CQLParser.UnaryOperatorContext ctx); void exitUnaryOperator(@NotNull CQLParser.UnaryOperatorContext ctx); | /**
* Exit a parse tree produced by {@link CQLParser#unaryOperator}.
*/ | Exit a parse tree produced by <code>CQLParser#unaryOperator</code> | exitUnaryOperator | {
"repo_name": "HuaweiBigData/StreamCQL",
"path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserListener.java",
"license": "apache-2.0",
"size": 58667
} | [
"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,798,676 |
public void testAgencyAdvertiserStatisticsGreaterThanMaxFieldValueError()
throws MalformedURLException, XmlRpcException {
Object[] params = new Object[] { sessionId, agencyId,
DateUtils.MIN_DATE_VALUE, DateUtils.DATE_GREATER_THAN_MAX };
try {
client.execute(AGENCY_ADVERTISER_STATISTICS_METHOD, params);
fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE);
} catch (XmlRpcException e) {
assertEquals(ErrorMessage.YEAR_SHOULD_BE_IN_RANGE_1970_2038, e
.getMessage());
}
} | void function() throws MalformedURLException, XmlRpcException { Object[] params = new Object[] { sessionId, agencyId, DateUtils.MIN_DATE_VALUE, DateUtils.DATE_GREATER_THAN_MAX }; try { client.execute(AGENCY_ADVERTISER_STATISTICS_METHOD, params); fail(ErrorMessage.METHOD_EXECUTED_SUCCESSFULLY_BUT_SHOULD_NOT_HAVE); } catch (XmlRpcException e) { assertEquals(ErrorMessage.YEAR_SHOULD_BE_IN_RANGE_1970_2038, e .getMessage()); } } | /**
* Test method with fields that has value greater than max.
*
* @throws MalformedURLException
* @throws XmlRpcException
*/ | Test method with fields that has value greater than max | testAgencyAdvertiserStatisticsGreaterThanMaxFieldValueError | {
"repo_name": "switzer/revive-adserver",
"path": "www/api/v1/xmlrpc/tests/unit/src/test/java/org/openx/agency/TestAgencyAdvertiserStatistics.java",
"license": "gpl-2.0",
"size": 7188
} | [
"java.net.MalformedURLException",
"org.apache.xmlrpc.XmlRpcException",
"org.openx.utils.DateUtils",
"org.openx.utils.ErrorMessage"
] | import java.net.MalformedURLException; import org.apache.xmlrpc.XmlRpcException; import org.openx.utils.DateUtils; import org.openx.utils.ErrorMessage; | import java.net.*; import org.apache.xmlrpc.*; import org.openx.utils.*; | [
"java.net",
"org.apache.xmlrpc",
"org.openx.utils"
] | java.net; org.apache.xmlrpc; org.openx.utils; | 2,844,307 |
@SuppressWarnings("deprecation")
@SuppressLint("NewApi")
public static long getSize(File directory) {
StatFs statFs = new StatFs(directory.getAbsolutePath());
long blockSize = 0;
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
blockSize = statFs.getBlockSizeLong();
} else {
blockSize = statFs.getBlockSize();
}
// Can't understand why on some devices this fails
} catch (NoSuchMethodError e) {
}
return getSize(directory, blockSize);
} | @SuppressWarnings(STR) @SuppressLint(STR) static long function(File directory) { StatFs statFs = new StatFs(directory.getAbsolutePath()); long blockSize = 0; try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { blockSize = statFs.getBlockSizeLong(); } else { blockSize = statFs.getBlockSize(); } } catch (NoSuchMethodError e) { } return getSize(directory, blockSize); } | /**
* Returns a directory size in bytes
*
* @param directory
* @return
*/ | Returns a directory size in bytes | getSize | {
"repo_name": "yun2win/yun2win-sdk-android",
"path": "yun2winDemo/app/src/main/java/y2w/common/StorageManager.java",
"license": "mit",
"size": 10168
} | [
"android.annotation.SuppressLint",
"android.os.Build",
"android.os.StatFs",
"java.io.File"
] | import android.annotation.SuppressLint; import android.os.Build; import android.os.StatFs; import java.io.File; | import android.annotation.*; import android.os.*; import java.io.*; | [
"android.annotation",
"android.os",
"java.io"
] | android.annotation; android.os; java.io; | 2,551,932 |
public T caseLiteralSpecification(LiteralSpecification object) {
return null;
} | T function(LiteralSpecification object) { return null; } | /**
* Returns the result of interpreting the object as an instance of '<em>Literal Specification</em>'.
* <!-- begin-user-doc -->
* This implementation returns null;
* returning a non-null result will terminate the switch.
* <!-- end-user-doc -->
* @param object the target of the switch.
* @return the result of interpreting the object as an instance of '<em>Literal Specification</em>'.
* @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
* @generated
*/ | Returns the result of interpreting the object as an instance of 'Literal Specification'. This implementation returns null; returning a non-null result will terminate the switch. | caseLiteralSpecification | {
"repo_name": "mjorod/textram",
"path": "tool/ca.mcgill.sel.ram/src/ca/mcgill/cs/sel/ram/util/RamSwitch.java",
"license": "mit",
"size": 90316
} | [
"ca.mcgill.cs.sel.ram.LiteralSpecification"
] | import ca.mcgill.cs.sel.ram.LiteralSpecification; | import ca.mcgill.cs.sel.ram.*; | [
"ca.mcgill.cs"
] | ca.mcgill.cs; | 1,987,248 |
MockitoAnnotations.initMocks(this);
when(channel.newCall(
Mockito.<MethodDescriptor<String, Integer>>any(), any(CallOptions.class)))
.thenReturn(call); | MockitoAnnotations.initMocks(this); when(channel.newCall( Mockito.<MethodDescriptor<String, Integer>>any(), any(CallOptions.class))) .thenReturn(call); | /**
* Sets up mocks.
*/ | Sets up mocks | setUp | {
"repo_name": "xzy256/grpc-java-mips64",
"path": "core/src/test/java/io/grpc/ClientInterceptorsTest.java",
"license": "bsd-3-clause",
"size": 17964
} | [
"org.mockito.Matchers",
"org.mockito.Mockito",
"org.mockito.MockitoAnnotations"
] | import org.mockito.Matchers; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; | import org.mockito.*; | [
"org.mockito"
] | org.mockito; | 38,739 |
protected String[] shuffleProtectedFields() {
return Strings.EMPTY_ARRAY;
} | String[] function() { return Strings.EMPTY_ARRAY; } | /**
* Subclasses can override this method and return an array of fieldnames which should be protected from
* recursive random shuffling in the {@link #testFromXContent()} test case
*/ | Subclasses can override this method and return an array of fieldnames which should be protected from recursive random shuffling in the <code>#testFromXContent()</code> test case | shuffleProtectedFields | {
"repo_name": "qwerty4030/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/AbstractQueryTestCase.java",
"license": "apache-2.0",
"size": 53333
} | [
"org.elasticsearch.common.Strings"
] | import org.elasticsearch.common.Strings; | import org.elasticsearch.common.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 848,164 |
@GET
@Path("accounts/{address}/order_book/{base}/{counter}")
RippleOrderBook getOrderBook(@PathParam("address") final String address, @PathParam("base") final String base,
@PathParam("counter") final String counter, @QueryParam("limit") final String limit) throws IOException, RippleException; | @Path(STR) RippleOrderBook getOrderBook(@PathParam(STR) final String address, @PathParam("base") final String base, @PathParam(STR) final String counter, @QueryParam("limit") final String limit) throws IOException, RippleException; | /**
* Returns the order book for this address and base/counter pair.
*/ | Returns the order book for this address and base/counter pair | getOrderBook | {
"repo_name": "gaborkolozsy/XChange",
"path": "xchange-ripple/src/main/java/org/knowm/xchange/ripple/RipplePublic.java",
"license": "mit",
"size": 3576
} | [
"java.io.IOException",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.QueryParam",
"org.knowm.xchange.ripple.dto.RippleException",
"org.knowm.xchange.ripple.dto.marketdata.RippleOrderBook"
] | import java.io.IOException; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; import org.knowm.xchange.ripple.dto.RippleException; import org.knowm.xchange.ripple.dto.marketdata.RippleOrderBook; | import java.io.*; import javax.ws.rs.*; import org.knowm.xchange.ripple.dto.*; import org.knowm.xchange.ripple.dto.marketdata.*; | [
"java.io",
"javax.ws",
"org.knowm.xchange"
] | java.io; javax.ws; org.knowm.xchange; | 58,458 |
private List<String> generateDropStatementsForRoutines() throws SQLException {
List<Map<String, String>> rows =
jdbcTemplate.queryForList(
"SELECT proname, oidvectortypes(proargtypes) AS args "
+ "FROM pg_proc INNER JOIN pg_namespace ns ON (pg_proc.pronamespace = ns.oid) "
+ "WHERE pg_proc.proisagg = false AND ns.nspname = ?",
name
);
List<String> statements = new ArrayList<String>();
for (Map<String, String> row : rows) {
statements.add("DROP FUNCTION IF EXISTS " + dbSupport.quote(name, row.get("proname")) + "(" + row.get("args") + ") CASCADE");
}
return statements;
} | List<String> function() throws SQLException { List<Map<String, String>> rows = jdbcTemplate.queryForList( STR + STR + STR, name ); List<String> statements = new ArrayList<String>(); for (Map<String, String> row : rows) { statements.add(STR + dbSupport.quote(name, row.get(STR)) + "(" + row.get("args") + STR); } return statements; } | /**
* Generates the statements for dropping the routines in this schema.
*
* @return The drop statements.
* @throws SQLException when the clean statements could not be generated.
*/ | Generates the statements for dropping the routines in this schema | generateDropStatementsForRoutines | {
"repo_name": "typischmann/flyway",
"path": "flyway-core/src/main/java/org/flywaydb/core/internal/dbsupport/postgresql/PostgreSQLSchema.java",
"license": "apache-2.0",
"size": 10341
} | [
"java.sql.SQLException",
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import java.util.Map; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,222,570 |
public void toPNML(FileChannel fc); | void function(FileChannel fc); | /**
* Write the PNML xml tree of this object into file
*/ | Write the PNML xml tree of this object into file | toPNML | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-SNNet/src/fr/lip6/move/pnml/symmetricnet/hlcorestructure/Fill.java",
"license": "epl-1.0",
"size": 10870
} | [
"java.nio.channels.FileChannel"
] | import java.nio.channels.FileChannel; | import java.nio.channels.*; | [
"java.nio"
] | java.nio; | 1,206,471 |
public void remove(TestStructure test) {
if (protocolMap.containsKey(test)) {
protocolMap.remove(test);
}
if (protocolUnLoadedTestStructures.containsKey(test.getFullName())) {
protocolUnLoadedTestStructures.remove(test.getFullName());
}
if (updateProjectMap.containsKey(test)) {
updateProjectMap.remove(test);
}
}
| void function(TestStructure test) { if (protocolMap.containsKey(test)) { protocolMap.remove(test); } if (protocolUnLoadedTestStructures.containsKey(test.getFullName())) { protocolUnLoadedTestStructures.remove(test.getFullName()); } if (updateProjectMap.containsKey(test)) { updateProjectMap.remove(test); } } | /**
* Remove TestResult from Protocol for init tree node with default icon.
*
* @param test
* test to be removed from state storage.
*/ | Remove TestResult from Protocol for init tree node with default icon | remove | {
"repo_name": "test-editor/test-editor",
"path": "core/org.testeditor.core/src/main/java/org/testeditor/core/util/TestStateProtocolService.java",
"license": "epl-1.0",
"size": 7640
} | [
"org.testeditor.core.model.teststructure.TestStructure"
] | import org.testeditor.core.model.teststructure.TestStructure; | import org.testeditor.core.model.teststructure.*; | [
"org.testeditor.core"
] | org.testeditor.core; | 1,955,789 |
@Override
public void stop(long executionId) throws NoSuchJobExecutionException,
JobExecutionNotRunningException, JobSecurityException, BatchDispatcherException, BatchJobNotLocalException {
internalDispatcher.stop(executionId);
} | void function(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException, BatchDispatcherException, BatchJobNotLocalException { internalDispatcher.stop(executionId); } | /**
* Lookup the app associated with the given executionId, then bridge into
* the app's runtime context and stop the job.
* @throws BatchJobNotLocalException
* @throws BatchDispatcherException
*/ | Lookup the app associated with the given executionId, then bridge into the app's runtime context and stop the job | stop | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.jbatch.rest/src/com/ibm/ws/jbatch/rest/bridge/BatchLocalDispatcher.java",
"license": "epl-1.0",
"size": 9208
} | [
"com.ibm.jbatch.container.ws.BatchDispatcherException",
"com.ibm.jbatch.container.ws.BatchJobNotLocalException",
"javax.batch.operations.JobExecutionNotRunningException",
"javax.batch.operations.JobSecurityException",
"javax.batch.operations.NoSuchJobExecutionException"
] | import com.ibm.jbatch.container.ws.BatchDispatcherException; import com.ibm.jbatch.container.ws.BatchJobNotLocalException; import javax.batch.operations.JobExecutionNotRunningException; import javax.batch.operations.JobSecurityException; import javax.batch.operations.NoSuchJobExecutionException; | import com.ibm.jbatch.container.ws.*; import javax.batch.operations.*; | [
"com.ibm.jbatch",
"javax.batch"
] | com.ibm.jbatch; javax.batch; | 289,344 |
public DawgModel createTestStbModelAndCache() throws DawgTestException {
List<String> cachedDawgModelNames = TestContext.getCurrent().get(DawgHouseConstants.CONTEXT_TEST_STB_MODELS);
if (null == cachedDawgModelNames) {
cachedDawgModelNames = new ArrayList<String>();
}
DawgModel dawgModel = new DawgModel();
dawgModel.setName(MetaStbBuilder.getUID(TestConstants.MODEL_NAME_PREF));
dawgModel.setFamily(Family.AVAILABLE_TEST_FAMILY.name());
dawgModel.setCapabilities(new ArrayList<String>(Arrays.asList(Capability.AVAILABLE_TEST_CAP.name())));
int response = addStbModelViaRest(dawgModel);
LOGGER.info("Response of adding STB model : " + response);
if (HttpStatus.SC_OK != response) {
throw new DawgTestException("Failed to add the model, the response returned is : " + response);
}
cachedDawgModelNames.add(dawgModel.getName());
TestContext.getCurrent().set(DawgHouseConstants.CONTEXT_TEST_STB_MODELS, cachedDawgModelNames);
return dawgModel;
} | DawgModel function() throws DawgTestException { List<String> cachedDawgModelNames = TestContext.getCurrent().get(DawgHouseConstants.CONTEXT_TEST_STB_MODELS); if (null == cachedDawgModelNames) { cachedDawgModelNames = new ArrayList<String>(); } DawgModel dawgModel = new DawgModel(); dawgModel.setName(MetaStbBuilder.getUID(TestConstants.MODEL_NAME_PREF)); dawgModel.setFamily(Family.AVAILABLE_TEST_FAMILY.name()); dawgModel.setCapabilities(new ArrayList<String>(Arrays.asList(Capability.AVAILABLE_TEST_CAP.name()))); int response = addStbModelViaRest(dawgModel); LOGGER.info(STR + response); if (HttpStatus.SC_OK != response) { throw new DawgTestException(STR + response); } cachedDawgModelNames.add(dawgModel.getName()); TestContext.getCurrent().set(DawgHouseConstants.CONTEXT_TEST_STB_MODELS, cachedDawgModelNames); return dawgModel; } | /**
* Creates a test STB model with properties(family and capabilities) and cache the model name for later deletion.
* @return Successfully created STB model.
* @throws DawgTestException
*/ | Creates a test STB model with properties(family and capabilities) and cache the model name for later deletion | createTestStbModelAndCache | {
"repo_name": "vmatha002c/dawg",
"path": "functional-tests/src/main/java/com/comcast/dawg/utils/DawgStbModelUIUtils.java",
"license": "apache-2.0",
"size": 5872
} | [
"com.comcast.dawg.DawgTestException",
"com.comcast.dawg.MetaStbBuilder",
"com.comcast.dawg.constants.DawgHouseConstants",
"com.comcast.dawg.constants.TestConstants",
"com.comcast.video.dawg.common.DawgModel",
"com.comcast.zucchini.TestContext",
"java.util.ArrayList",
"java.util.Arrays",
"java.util.L... | import com.comcast.dawg.DawgTestException; import com.comcast.dawg.MetaStbBuilder; import com.comcast.dawg.constants.DawgHouseConstants; import com.comcast.dawg.constants.TestConstants; import com.comcast.video.dawg.common.DawgModel; import com.comcast.zucchini.TestContext; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.apache.http.HttpStatus; | import com.comcast.dawg.*; import com.comcast.dawg.constants.*; import com.comcast.video.dawg.common.*; import com.comcast.zucchini.*; import java.util.*; import org.apache.http.*; | [
"com.comcast.dawg",
"com.comcast.video",
"com.comcast.zucchini",
"java.util",
"org.apache.http"
] | com.comcast.dawg; com.comcast.video; com.comcast.zucchini; java.util; org.apache.http; | 673,502 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.