method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public void push(int id, View v) {
switch (id) {
case R.id.action_bar_info: {
QuickAction qa = new QuickAction(v);
infoQuickaction.setTitle(createGpsInfo());
qa.addActionItem(infoQuickaction);
qa.setAnimStyle(QuickAction.ANIM_AUTO);
qa.show();
break;
}
case R.id.action_bar_compass: {
Context context = actionBarView.getContext();
openCompass(context);
break;
}
default:
break;
}
} | void function(int id, View v) { switch (id) { case R.id.action_bar_info: { QuickAction qa = new QuickAction(v); infoQuickaction.setTitle(createGpsInfo()); qa.addActionItem(infoQuickaction); qa.setAnimStyle(QuickAction.ANIM_AUTO); qa.show(); break; } case R.id.action_bar_compass: { Context context = actionBarView.getContext(); openCompass(context); break; } default: break; } } | /**
* Push action.
*
* @param id id.
* @param v view.
*/ | Push action | push | {
"repo_name": "integracaomt/MTISIG4",
"path": "geopaparazzi.app/src/eu/hydrologis/geopaparazzi/dashboard/ActionBar.java",
"license": "gpl-3.0",
"size": 18107
} | [
"android.content.Context",
"android.view.View",
"eu.hydrologis.geopaparazzi.dashboard.quickaction.actionbar.QuickAction"
] | import android.content.Context; import android.view.View; import eu.hydrologis.geopaparazzi.dashboard.quickaction.actionbar.QuickAction; | import android.content.*; import android.view.*; import eu.hydrologis.geopaparazzi.dashboard.quickaction.actionbar.*; | [
"android.content",
"android.view",
"eu.hydrologis.geopaparazzi"
] | android.content; android.view; eu.hydrologis.geopaparazzi; | 473,641 |
@Override
public FlywayCallback[] getCallbacks() {
return callbacks;
} | FlywayCallback[] function() { return callbacks; } | /**
* Gets the callbacks for lifecycle notifications.
*
* @return The callbacks for lifecycle notifications. An empty array if none. (default: none)
*/ | Gets the callbacks for lifecycle notifications | getCallbacks | {
"repo_name": "FulcrumTechnologies/flyway",
"path": "flyway-core/src/main/java/org/flywaydb/core/Flyway.java",
"license": "apache-2.0",
"size": 63134
} | [
"org.flywaydb.core.api.callback.FlywayCallback"
] | import org.flywaydb.core.api.callback.FlywayCallback; | import org.flywaydb.core.api.callback.*; | [
"org.flywaydb.core"
] | org.flywaydb.core; | 1,295,171 |
public void validate(SqlValidator validator, SqlValidatorScope scope) {
validator.validateCall(this, scope);
} | void function(SqlValidator validator, SqlValidatorScope scope) { validator.validateCall(this, scope); } | /**
* Validates this call.
*
* <p>The default implementation delegates the validation to the operator's
* {@link SqlOperator#validateCall}. Derived classes may override (as do,
* for example {@link SqlSelect} and {@link SqlUpdate}).
*/ | Validates this call. The default implementation delegates the validation to the operator's <code>SqlOperator#validateCall</code>. Derived classes may override (as do, for example <code>SqlSelect</code> and <code>SqlUpdate</code>) | validate | {
"repo_name": "YrAuYong/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/sql/SqlCall.java",
"license": "apache-2.0",
"size": 6377
} | [
"org.apache.calcite.sql.validate.SqlValidator",
"org.apache.calcite.sql.validate.SqlValidatorScope"
] | import org.apache.calcite.sql.validate.SqlValidator; import org.apache.calcite.sql.validate.SqlValidatorScope; | import org.apache.calcite.sql.validate.*; | [
"org.apache.calcite"
] | org.apache.calcite; | 1,489,062 |
public void fillClassesList(String selEntry, String selPackage) {
if(selPackage == null) {
return;
}
clearClasses();
clearFields();
clearMethods();
boolean isArchive = !(new File(selEntry)).isDirectory();
List files = (List)entryToFilesMap.get(selEntry);
if(files == null) {
return;
}
for(int i=0; i < files.size(); i++) {
String fileName = (String)files.get(i);
String className = null;
String packagePart = null;
int pos1 = 0;
if(isArchive) {
pos1 = fileName.lastIndexOf("/");
}
else {
pos1 = fileName.lastIndexOf(File.separator);
}
int pos2 = fileName.lastIndexOf(".");
if(pos1 == -1) {
className = fileName.substring(0, pos2);
}
else {
packagePart = fileName.substring(0, pos1).replace(File.separatorChar, '.');
if(isArchive) {
packagePart = packagePart.replace('/', '.');
}
className = fileName.substring(pos1+1, pos2);
}
if(packagePart == null) {
if(selPackage.equals(ANONYMOUS_PACKAGE)) {
if(!classes.contains(className)) {
classes.add(className);
}
}
}
else {
if(packagePart.equals(selPackage)) {
if(!classes.contains(className)) {
classes.add(className);
}
}
}
}
Collections.sort(classes);
}
| void function(String selEntry, String selPackage) { if(selPackage == null) { return; } clearClasses(); clearFields(); clearMethods(); boolean isArchive = !(new File(selEntry)).isDirectory(); List files = (List)entryToFilesMap.get(selEntry); if(files == null) { return; } for(int i=0; i < files.size(); i++) { String fileName = (String)files.get(i); String className = null; String packagePart = null; int pos1 = 0; if(isArchive) { pos1 = fileName.lastIndexOf("/"); } else { pos1 = fileName.lastIndexOf(File.separator); } int pos2 = fileName.lastIndexOf("."); if(pos1 == -1) { className = fileName.substring(0, pos2); } else { packagePart = fileName.substring(0, pos1).replace(File.separatorChar, '.'); if(isArchive) { packagePart = packagePart.replace('/', '.'); } className = fileName.substring(pos1+1, pos2); } if(packagePart == null) { if(selPackage.equals(ANONYMOUS_PACKAGE)) { if(!classes.contains(className)) { classes.add(className); } } } else { if(packagePart.equals(selPackage)) { if(!classes.contains(className)) { classes.add(className); } } } } Collections.sort(classes); } | /**
* Fills out the content of the classes list
*
* @param selEntry selected entry
* @param selPackage selected package
*/ | Fills out the content of the classes list | fillClassesList | {
"repo_name": "shvets/cafebabe",
"path": "cafebabe/src/main/java/org/sf/cafebabe/task/classhound/ClassHound.java",
"license": "mit",
"size": 12498
} | [
"java.io.File",
"java.util.Collections",
"java.util.List"
] | import java.io.File; import java.util.Collections; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,089,937 |
String addCompositeApiFromDefinition(String swaggerResourceUrl) throws APIManagementException; | String addCompositeApiFromDefinition(String swaggerResourceUrl) throws APIManagementException; | /**
* Create Composite API from Swagger definition located by a given url
*
* @param swaggerResourceUrl url of the Swagger resource
* @return details of the added Composite API.
* @throws APIManagementException If failed to add the Composite API.
*/ | Create Composite API from Swagger definition located by a given url | addCompositeApiFromDefinition | {
"repo_name": "rswijesena/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.core/src/main/java/org/wso2/carbon/apimgt/core/api/APIStore.java",
"license": "apache-2.0",
"size": 20425
} | [
"org.wso2.carbon.apimgt.core.exception.APIManagementException"
] | import org.wso2.carbon.apimgt.core.exception.APIManagementException; | import org.wso2.carbon.apimgt.core.exception.*; | [
"org.wso2.carbon"
] | org.wso2.carbon; | 2,564,778 |
public void send(int code, @Nullable OnFinished onFinished, @Nullable Handler handler)
throws CanceledException {
send(null, code, null, onFinished, handler, null, null);
} | void function(int code, @Nullable OnFinished onFinished, @Nullable Handler handler) throws CanceledException { send(null, code, null, onFinished, handler, null, null); } | /**
* Perform the operation associated with this PendingIntent, allowing the
* caller to be notified when the send has completed.
*
* @param code Result code to supply back to the PendingIntent's target.
* @param onFinished The object to call back on when the send has
* completed, or null for no callback.
* @param handler Handler identifying the thread on which the callback
* should happen. If null, the callback will happen from the thread
* pool of the process.
*
* @see #send(Context, int, Intent, android.app.PendingIntent.OnFinished, Handler)
*
* @throws CanceledException Throws CanceledException if the PendingIntent
* is no longer allowing more intents to be sent through it.
*/ | Perform the operation associated with this PendingIntent, allowing the caller to be notified when the send has completed | send | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/app/PendingIntent.java",
"license": "gpl-3.0",
"size": 48642
} | [
"android.annotation.Nullable",
"android.os.Handler"
] | import android.annotation.Nullable; import android.os.Handler; | import android.annotation.*; import android.os.*; | [
"android.annotation",
"android.os"
] | android.annotation; android.os; | 2,823,446 |
public void setField(String name, AnnotatedField field) {
if (notNull(name, field)) {
final ArrayList<AnnotatedField> list = new ArrayList<AnnotatedField>();
list.add(field);
fieldMap.put(name, list);
}
} | void function(String name, AnnotatedField field) { if (notNull(name, field)) { final ArrayList<AnnotatedField> list = new ArrayList<AnnotatedField>(); list.add(field); fieldMap.put(name, list); } } | /**
* Sets field-value to a given field. If either <tt>name</tt> or <tt>field</tt> is <tt>null</tt> no change will
* occur.
*
* @param name the name of the field.
* @param field the new value of the field.
*/ | Sets field-value to a given field. If either name or field is null no change will occur | setField | {
"repo_name": "kolstae/openpipe",
"path": "openpipe-core/src/main/java/no/trank/openpipe/api/document/Document.java",
"license": "apache-2.0",
"size": 10501
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 273,436 |
public void setSimbad(int x, int z, int waitTime, UltrasonicSensor sensorL, UltrasonicSensor sensorR, UltrasonicSensor sensorF,
boolean realism, int maze) {
this.toWaitTime = waitTime;
this.maze = maze;
this.realism = realism;
if (realism) width = 0.8;
Vector3d posicion = new Vector3d(x + offsetX, 0, z + 0.5 + offsetZ);
this.setPiloto(posicion, "Skids");
this.setEnviroment();
this.setMotores();
this.sensorF = sensorF;
this.sensorF.setSensor(robot);
this.sensorL = sensorL;
this.sensorL.setSensor(robot);
this.sensorR = sensorR;
this.sensorR.setSensor(robot);
enviroment.showAxis(false);
this.frame = new Simbad(enviroment, false);
frame.startSimbad("topview", true);
this.calibrarSimbad(waitTime);
} | void function(int x, int z, int waitTime, UltrasonicSensor sensorL, UltrasonicSensor sensorR, UltrasonicSensor sensorF, boolean realism, int maze) { this.toWaitTime = waitTime; this.maze = maze; this.realism = realism; if (realism) width = 0.8; Vector3d posicion = new Vector3d(x + offsetX, 0, z + 0.5 + offsetZ); this.setPiloto(posicion, "Skids"); this.setEnviroment(); this.setMotores(); this.sensorF = sensorF; this.sensorF.setSensor(robot); this.sensorL = sensorL; this.sensorL.setSensor(robot); this.sensorR = sensorR; this.sensorR.setSensor(robot); enviroment.showAxis(false); this.frame = new Simbad(enviroment, false); frame.startSimbad(STR, true); this.calibrarSimbad(waitTime); } | /**
* Method to configure and start simbad.
*
* @param x,y 'int' Starting position for the robot
* @param waitTime 'int' time to wait between sensor measurements
* @param sensor the 'UltrasonicSensor' used by the pilot
* @param realism if true, add random deviations to the movements
* @param maze The maze number (from 0 to 5)
*/ | Method to configure and start simbad | setSimbad | {
"repo_name": "gsi-upm/gsilejos",
"path": "src/main/java/es/upm/dit/gsi/gsilejos/lejos/robotics/navigation/DifferentialPilot.java",
"license": "gpl-3.0",
"size": 31367
} | [
"es.upm.dit.gsi.gsilejos.lejos.nxt.UltrasonicSensor",
"es.upm.dit.gsi.gsilejos.simbad.gui.Simbad",
"javax.vecmath.Vector3d"
] | import es.upm.dit.gsi.gsilejos.lejos.nxt.UltrasonicSensor; import es.upm.dit.gsi.gsilejos.simbad.gui.Simbad; import javax.vecmath.Vector3d; | import es.upm.dit.gsi.gsilejos.lejos.nxt.*; import es.upm.dit.gsi.gsilejos.simbad.gui.*; import javax.vecmath.*; | [
"es.upm.dit",
"javax.vecmath"
] | es.upm.dit; javax.vecmath; | 190,464 |
public void setPaint(Paint paint) {
if (paint instanceof Color) {
setColor((Color) paint);
return;
}
if (paint == null || this.paint == paint) {
return;
}
this.paint = paint;
if (imageComp == CompositeType.SrcOverNoEa) {
// special case where compState depends on opacity of paint
if (paint.getTransparency() == Transparency.OPAQUE) {
if (compositeState != COMP_ISCOPY) {
compositeState = COMP_ISCOPY;
}
} else {
if (compositeState == COMP_ISCOPY) {
compositeState = COMP_ALPHA;
}
}
}
Class<? extends Paint> paintClass = paint.getClass();
if (paintClass == GradientPaint.class) {
paintState = PAINT_GRADIENT;
} else if (paintClass == LinearGradientPaint.class) {
paintState = PAINT_LIN_GRADIENT;
} else if (paintClass == RadialGradientPaint.class) {
paintState = PAINT_RAD_GRADIENT;
} else if (paintClass == TexturePaint.class) {
paintState = PAINT_TEXTURE;
} else {
paintState = PAINT_CUSTOM;
}
validFontInfo = false;
invalidatePipe();
}
static final int NON_UNIFORM_SCALE_MASK =
(AffineTransform.TYPE_GENERAL_TRANSFORM |
AffineTransform.TYPE_GENERAL_SCALE);
public static final double MinPenSizeAA =
sun.java2d.pipe.RenderingEngine.getInstance().getMinimumAAPenSize();
public static final double MinPenSizeAASquared =
(MinPenSizeAA * MinPenSizeAA);
// Since inaccuracies in the trig package can cause us to
// calculated a rotated pen width of just slightly greater
// than 1.0, we add a fudge factor to our comparison value
// here so that we do not misclassify single width lines as
// wide lines under certain rotations.
public static final double MinPenSizeSquared = 1.000000001; | void function(Paint paint) { if (paint instanceof Color) { setColor((Color) paint); return; } if (paint == null this.paint == paint) { return; } this.paint = paint; if (imageComp == CompositeType.SrcOverNoEa) { if (paint.getTransparency() == Transparency.OPAQUE) { if (compositeState != COMP_ISCOPY) { compositeState = COMP_ISCOPY; } } else { if (compositeState == COMP_ISCOPY) { compositeState = COMP_ALPHA; } } } Class<? extends Paint> paintClass = paint.getClass(); if (paintClass == GradientPaint.class) { paintState = PAINT_GRADIENT; } else if (paintClass == LinearGradientPaint.class) { paintState = PAINT_LIN_GRADIENT; } else if (paintClass == RadialGradientPaint.class) { paintState = PAINT_RAD_GRADIENT; } else if (paintClass == TexturePaint.class) { paintState = PAINT_TEXTURE; } else { paintState = PAINT_CUSTOM; } validFontInfo = false; invalidatePipe(); } static final int NON_UNIFORM_SCALE_MASK = (AffineTransform.TYPE_GENERAL_TRANSFORM AffineTransform.TYPE_GENERAL_SCALE); public static final double MinPenSizeAA = sun.java2d.pipe.RenderingEngine.getInstance().getMinimumAAPenSize(); public static final double MinPenSizeAASquared = (MinPenSizeAA * MinPenSizeAA); public static final double MinPenSizeSquared = 1.000000001; | /**
* Sets the Paint in the current graphics state.
* @param paint The Paint object to be used to generate color in
* the rendering process.
* @see java.awt.Graphics#setColor
* @see GradientPaint
* @see TexturePaint
*/ | Sets the Paint in the current graphics state | setPaint | {
"repo_name": "karianna/jdk8_tl",
"path": "jdk/src/share/classes/sun/java2d/SunGraphics2D.java",
"license": "gpl-2.0",
"size": 125632
} | [
"java.awt.Color",
"java.awt.GradientPaint",
"java.awt.LinearGradientPaint",
"java.awt.Paint",
"java.awt.RadialGradientPaint",
"java.awt.TexturePaint",
"java.awt.Transparency",
"java.awt.geom.AffineTransform"
] | import java.awt.Color; import java.awt.GradientPaint; import java.awt.LinearGradientPaint; import java.awt.Paint; import java.awt.RadialGradientPaint; import java.awt.TexturePaint; import java.awt.Transparency; import java.awt.geom.AffineTransform; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 92,253 |
HibBranch findConflictingBranch(HibBranch branch, String name);
| HibBranch findConflictingBranch(HibBranch branch, String name); | /**
* Find the existing branch for the name, before using it in an update.
*
* @param name
* @return
*/ | Find the existing branch for the name, before using it in an update | findConflictingBranch | {
"repo_name": "gentics/mesh",
"path": "mdm/api/src/main/java/com/gentics/mesh/core/data/dao/BranchDao.java",
"license": "apache-2.0",
"size": 3317
} | [
"com.gentics.mesh.core.data.branch.HibBranch"
] | import com.gentics.mesh.core.data.branch.HibBranch; | import com.gentics.mesh.core.data.branch.*; | [
"com.gentics.mesh"
] | com.gentics.mesh; | 1,132,971 |
public Adapter createMinusAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class '{@link klaper.expr.Minus <em>Minus</em>}'.
* <!-- begin-user-doc -->
* This default implementation returns null so that we can easily ignore cases;
* it's useful to ignore a case when inheritance will catch all the cases anyway.
* <!-- end-user-doc -->
* @return the new adapter.
* @see klaper.expr.Minus
* @generated
*/ | Creates a new adapter for an object of class '<code>klaper.expr.Minus Minus</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createMinusAdapter | {
"repo_name": "aciancone/klapersuite",
"path": "klapersuite.metamodel.klaper/src/klaper/expr/util/ExprAdapterFactory.java",
"license": "epl-1.0",
"size": 10567
} | [
"org.eclipse.emf.common.notify.Adapter"
] | import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,268,109 |
public void setFeature (String name, boolean state)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (parent != null) {
parent.setFeature(name, state);
} else {
throw new SAXNotRecognizedException("Feature: " + name);
}
}
| void function (String name, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException { if (parent != null) { parent.setFeature(name, state); } else { throw new SAXNotRecognizedException(STR + name); } } | /**
* Set the state of a feature.
*
* <p>This will always fail if the parent is null.</p>
*
* @param name The feature name.
* @param state The requested feature state.
* @exception org.xml.sax.SAXNotRecognizedException When the
* XMLReader does not recognize the feature name.
* @exception org.xml.sax.SAXNotSupportedException When the
* XMLReader recognizes the feature name but
* cannot set the requested value.
* @see org.xml.sax.XMLReader#setFeature
*/ | Set the state of a feature. This will always fail if the parent is null | setFeature | {
"repo_name": "nslu2/Build-gcc-3.2.1",
"path": "libjava/org/xml/sax/helpers/XMLFilterImpl.java",
"license": "gpl-2.0",
"size": 22759
} | [
"org.xml.sax.SAXNotRecognizedException",
"org.xml.sax.SAXNotSupportedException"
] | import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXNotSupportedException; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,010,373 |
public static <T> void resize(FasterList<T> list, int size, Class<T> valueCls) {
try {
int ls = list.size();
while (ls < size) {
list.add(valueCls != null? valueCls.getConstructor().newInstance() : null);
ls++;
}
while (ls > size) {
list.removeFast(--ls);
}
}
catch (IllegalAccessException | InstantiationException e) {
throw new IllegalStateException(e);
} catch (NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
}
}
| static <T> void function(FasterList<T> list, int size, Class<T> valueCls) { try { int ls = list.size(); while (ls < size) { list.add(valueCls != null? valueCls.getConstructor().newInstance() : null); ls++; } while (ls > size) { list.removeFast(--ls); } } catch (IllegalAccessException InstantiationException e) { throw new IllegalStateException(e); } catch (NoSuchMethodException InvocationTargetException e) { e.printStackTrace(); } } | /**
* Resizes list to exact size, filling with new instances of given class type
* when expanding.
*/ | Resizes list to exact size, filling with new instances of given class type when expanding | resize | {
"repo_name": "automenta/narchy",
"path": "ui/src/main/java/spacegraph/space3d/phys/math/MiscUtil.java",
"license": "agpl-3.0",
"size": 5688
} | [
"java.lang.reflect.InvocationTargetException"
] | import java.lang.reflect.InvocationTargetException; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,481,733 |
protected void sequence_WhileLoop(EObject context, WhileLoop semanticObject) {
genericSequencer.createSequence(context, semanticObject);
} | void function(EObject context, WhileLoop semanticObject) { genericSequencer.createSequence(context, semanticObject); } | /**
* Constraint:
* (condition=Expr (whileblock+=Statement | breakcontinue+=BreakContinue)*)
*/ | Constraint: (condition=Expr (whileblock+=Statement | breakcontinue+=BreakContinue)*) | sequence_WhileLoop | {
"repo_name": "niksavis/mm-dsl",
"path": "org.xtext.nv.dsl/src-gen/org/xtext/nv/dsl/serializer/MMDSLSemanticSequencer.java",
"license": "epl-1.0",
"size": 190481
} | [
"org.eclipse.emf.ecore.EObject",
"org.xtext.nv.dsl.mMDSL.WhileLoop"
] | import org.eclipse.emf.ecore.EObject; import org.xtext.nv.dsl.mMDSL.WhileLoop; | import org.eclipse.emf.ecore.*; import org.xtext.nv.dsl.*; | [
"org.eclipse.emf",
"org.xtext.nv"
] | org.eclipse.emf; org.xtext.nv; | 1,125,940 |
public void cacheResult(
java.util.List<it.gebhard.qa.model.Question> questions); | void function( java.util.List<it.gebhard.qa.model.Question> questions); | /**
* Caches the Questions in the entity cache if it is enabled.
*
* @param questions the Questions
*/ | Caches the Questions in the entity cache if it is enabled | cacheResult | {
"repo_name": "p-gebhard/QuickAnswer",
"path": "docroot/WEB-INF/service/it/gebhard/qa/service/persistence/QuestionPersistence.java",
"license": "gpl-3.0",
"size": 25566
} | [
"it.gebhard.qa.model.Question"
] | import it.gebhard.qa.model.Question; | import it.gebhard.qa.model.*; | [
"it.gebhard.qa"
] | it.gebhard.qa; | 900,415 |
// check if matcher already exists
MethodDefinitionInClassListMatcher matcher = engine.getExistingMatcher(querySpecification());
if (matcher == null) {
matcher = new MethodDefinitionInClassListMatcher(engine);
// do not have to "put" it into engine.matchers, reportMatcherInitialized() will take care of it
}
return matcher;
}
private final static int POSITION_PARENTCLASS = 0;
private final static int POSITION_METHODSIGNATURE = 1;
private final static int POSITION_CLAZZ = 2;
private final static int POSITION_METHODDEFINITION = 3;
private final static Logger LOGGER = IncQueryLoggingUtil.getLogger(MethodDefinitionInClassListMatcher.class);
@Deprecated
public MethodDefinitionInClassListMatcher(final Notifier emfRoot) throws IncQueryException {
this(IncQueryEngine.on(emfRoot));
}
@Deprecated
public MethodDefinitionInClassListMatcher(final IncQueryEngine engine) throws IncQueryException {
super(engine, querySpecification());
} | MethodDefinitionInClassListMatcher matcher = engine.getExistingMatcher(querySpecification()); if (matcher == null) { matcher = new MethodDefinitionInClassListMatcher(engine); } return matcher; } private final static int POSITION_PARENTCLASS = 0; private final static int POSITION_METHODSIGNATURE = 1; private final static int POSITION_CLAZZ = 2; private final static int POSITION_METHODDEFINITION = 3; private final static Logger LOGGER = IncQueryLoggingUtil.getLogger(MethodDefinitionInClassListMatcher.class); public MethodDefinitionInClassListMatcher(final Notifier emfRoot) throws IncQueryException { this(IncQueryEngine.on(emfRoot)); } public MethodDefinitionInClassListMatcher(final IncQueryEngine engine) throws IncQueryException { super(engine, querySpecification()); } | /**
* Initializes the pattern matcher within an existing EMF-IncQuery engine.
* If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.
* The match set will be incrementally refreshed upon updates.
* @param engine the existing EMF-IncQuery engine in which this matcher will be created.
* @throws IncQueryException if an error occurs during pattern matcher creation
*
*/ | Initializes the pattern matcher within an existing EMF-IncQuery engine. If the pattern matcher is already constructed in the engine, only a light-weight reference is returned. The match set will be incrementally refreshed upon updates | on | {
"repo_name": "FTSRG/java-refactoring-ttc-viatra",
"path": "hu.bme.mit.ttc.refactoring.patterns/src-gen/hu/bme/mit/ttc/refactoring/patterns/MethodDefinitionInClassListMatcher.java",
"license": "epl-1.0",
"size": 20668
} | [
"org.apache.log4j.Logger",
"org.eclipse.emf.common.notify.Notifier",
"org.eclipse.incquery.runtime.api.IncQueryEngine",
"org.eclipse.incquery.runtime.exception.IncQueryException",
"org.eclipse.incquery.runtime.util.IncQueryLoggingUtil"
] | import org.apache.log4j.Logger; import org.eclipse.emf.common.notify.Notifier; import org.eclipse.incquery.runtime.api.IncQueryEngine; import org.eclipse.incquery.runtime.exception.IncQueryException; import org.eclipse.incquery.runtime.util.IncQueryLoggingUtil; | import org.apache.log4j.*; import org.eclipse.emf.common.notify.*; import org.eclipse.incquery.runtime.api.*; import org.eclipse.incquery.runtime.exception.*; import org.eclipse.incquery.runtime.util.*; | [
"org.apache.log4j",
"org.eclipse.emf",
"org.eclipse.incquery"
] | org.apache.log4j; org.eclipse.emf; org.eclipse.incquery; | 580,414 |
public String activityName () throws NoActivityException, SystemException
{
return "ActivityImple: " + toString();
} | String function () throws NoActivityException, SystemException { return STR + toString(); } | /**
* What is the name of the current activity? Use only for debugging
* purposes!
*
* @exception NoActivityException
* Thrown if there is no activity associated with the
* invoking thread.
* @exception SystemException
* Thrown if any other error occurs.
*
* @return the name of the activity.
*/ | What is the name of the current activity? Use only for debugging purposes | activityName | {
"repo_name": "nmcl/scratch",
"path": "graalvm/transactions/fork/narayana/XTS/WSAS/classes/com/arjuna/mwlabs/wsas/activity/ActivityImple.java",
"license": "apache-2.0",
"size": 18042
} | [
"com.arjuna.mw.wsas.exceptions.NoActivityException",
"com.arjuna.mw.wsas.exceptions.SystemException"
] | import com.arjuna.mw.wsas.exceptions.NoActivityException; import com.arjuna.mw.wsas.exceptions.SystemException; | import com.arjuna.mw.wsas.exceptions.*; | [
"com.arjuna.mw"
] | com.arjuna.mw; | 2,858,014 |
public void setRootViewId(int id) {
mRootView = (ViewGroup) inflater.inflate(id, null);
mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks);
mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down);
mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up);
//This was previously defined on show() method, moved here to prevent force close that occured
//when tapping fastly on a view to show quickaction dialog.
//Thanx to zammbi (github.com/zammbi)
mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
setContentView(mRootView);
}
| void function(int id) { mRootView = (ViewGroup) inflater.inflate(id, null); mTrack = (ViewGroup) mRootView.findViewById(R.id.tracks); mArrowDown = (ImageView) mRootView.findViewById(R.id.arrow_down); mArrowUp = (ImageView) mRootView.findViewById(R.id.arrow_up); mRootView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); setContentView(mRootView); } | /**
* Set root view.
*
* @param id Layout resource id
*/ | Set root view | setRootViewId | {
"repo_name": "n8fr8/ObscuraCam",
"path": "src/net/londatiga/android/QuickAction.java",
"license": "gpl-3.0",
"size": 9478
} | [
"android.view.ViewGroup",
"android.widget.ImageView"
] | import android.view.ViewGroup; import android.widget.ImageView; | import android.view.*; import android.widget.*; | [
"android.view",
"android.widget"
] | android.view; android.widget; | 1,929,943 |
public static ServletUriComponentsBuilder fromRequest(HttpServletRequest request) {
ServletUriComponentsBuilder builder = initFromRequest(request);
builder.initPath(prependForwardedPrefix(request, request.getRequestURI()));
builder.query(request.getQueryString());
return builder;
} | static ServletUriComponentsBuilder function(HttpServletRequest request) { ServletUriComponentsBuilder builder = initFromRequest(request); builder.initPath(prependForwardedPrefix(request, request.getRequestURI())); builder.query(request.getQueryString()); return builder; } | /**
* Prepare a builder by copying the scheme, host, port, path, and
* query string of an HttpServletRequest.
*/ | Prepare a builder by copying the scheme, host, port, path, and query string of an HttpServletRequest | fromRequest | {
"repo_name": "QBNemo/spring-mvc-showcase",
"path": "src/main/java/org/springframework/web/servlet/support/ServletUriComponentsBuilder.java",
"license": "apache-2.0",
"size": 8139
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 1,468,917 |
public int getIndexOf(PolarItemRenderer renderer) {
Args.nullNotPermitted(renderer, "renderer");
for (Entry<Integer, PolarItemRenderer> entry : this.renderers.entrySet()) {
if (renderer.equals(entry.getValue())) {
return entry.getKey();
}
}
return -1;
} | int function(PolarItemRenderer renderer) { Args.nullNotPermitted(renderer, STR); for (Entry<Integer, PolarItemRenderer> entry : this.renderers.entrySet()) { if (renderer.equals(entry.getValue())) { return entry.getKey(); } } return -1; } | /**
* Returns the index of the specified renderer, or {@code -1} if the
* renderer is not assigned to this plot.
*
* @param renderer the renderer ({@code null} not permitted).
*
* @return The renderer index.
*/ | Returns the index of the specified renderer, or -1 if the renderer is not assigned to this plot | getIndexOf | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/plot/PolarPlot.java",
"license": "lgpl-2.1",
"size": 65051
} | [
"java.util.Map",
"org.jfree.chart.internal.Args",
"org.jfree.chart.renderer.PolarItemRenderer"
] | import java.util.Map; import org.jfree.chart.internal.Args; import org.jfree.chart.renderer.PolarItemRenderer; | import java.util.*; import org.jfree.chart.internal.*; import org.jfree.chart.renderer.*; | [
"java.util",
"org.jfree.chart"
] | java.util; org.jfree.chart; | 1,817,806 |
public CoapClient setExecutor(ExecutorService executor) {
this.executor = executor;
return this;
} | CoapClient function(ExecutorService executor) { this.executor = executor; return this; } | /**
* Sets the executor service for this client.
* All handlers will be invoked by this executor.
*
* @param executor the executor service
* @return the CoAP client
*/ | Sets the executor service for this client. All handlers will be invoked by this executor | setExecutor | {
"repo_name": "iotoasis/SI",
"path": "si-onem2m-src/IITP_IoT_2_7/src/extlib/java/org/eclipse/californium/core/CoapClient.java",
"license": "bsd-2-clause",
"size": 33098
} | [
"java.util.concurrent.ExecutorService"
] | import java.util.concurrent.ExecutorService; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 694,644 |
public Set<String> getCategories() {
return categories;
} | Set<String> function() { return categories; } | /**
* Returns all category IDs (group tags) of this report.
*
* @return Categories.
*/ | Returns all category IDs (group tags) of this report | getCategories | {
"repo_name": "chrpin/rodi",
"path": "src/com/fluidops/rdb2rdfbench/eval/QueryResultChecker.java",
"license": "mit",
"size": 11062
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 463,306 |
public void setEndDate(Date end) {
this.mEndDate = end;
} | void function(Date end) { this.mEndDate = end; } | /***
* Set the end date of feed entries for all requests in this specific Channel.
*
* @param end The end date.
*/ | Set the end date of feed entries for all requests in this specific Channel | setEndDate | {
"repo_name": "kiyongki/jemuran",
"path": "library/src/main/java/com/macroyau/thingspeakandroid/ThingSpeakChannel.java",
"license": "apache-2.0",
"size": 12873
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,293,369 |
public static void copyResourcesToDirectory(String jarDir, String destDir)
throws IOException {
JarFile fromJar = new JarFile(Main.JAR_LOCATION);
for (Enumeration<JarEntry> entries = fromJar.entries(); entries.hasMoreElements();) {
JarEntry entry = entries.nextElement();
if (entry.getName().startsWith(jarDir + "/") && !entry.isDirectory()) {
File dest = new File(destDir + "/" + entry.getName().substring(jarDir.length() + 1));
File parent = dest.getParentFile();
if (parent != null) {
parent.mkdirs();
}
FileOutputStream out = new FileOutputStream(dest);
InputStream in = fromJar.getInputStream(entry);
try {
byte[] buffer = new byte[8 * 1024];
int s = 0;
while ((s = in.read(buffer)) > 0) {
out.write(buffer, 0, s);
}
} catch (IOException e) {
throw new IOException("Could not copy asset from jar file", e);
} finally {
try {
in.close();
} catch (IOException ignored) {}
try {
out.close();
} catch (IOException ignored) {}
}
}
}
}
private JarUtils() {} // non-instantiable | static void function(String jarDir, String destDir) throws IOException { JarFile fromJar = new JarFile(Main.JAR_LOCATION); for (Enumeration<JarEntry> entries = fromJar.entries(); entries.hasMoreElements();) { JarEntry entry = entries.nextElement(); if (entry.getName().startsWith(jarDir + "/") && !entry.isDirectory()) { File dest = new File(destDir + "/" + entry.getName().substring(jarDir.length() + 1)); File parent = dest.getParentFile(); if (parent != null) { parent.mkdirs(); } FileOutputStream out = new FileOutputStream(dest); InputStream in = fromJar.getInputStream(entry); try { byte[] buffer = new byte[8 * 1024]; int s = 0; while ((s = in.read(buffer)) > 0) { out.write(buffer, 0, s); } } catch (IOException e) { throw new IOException(STR, e); } finally { try { in.close(); } catch (IOException ignored) {} try { out.close(); } catch (IOException ignored) {} } } } } private JarUtils() {} | /**
* Copies a directory from a jar file to an external directory.
*/ | Copies a directory from a jar file to an external directory | copyResourcesToDirectory | {
"repo_name": "KapibaraInc/Kapibara",
"path": "miner/src/main/java/io.github.psychicwaddle/miner/miner/JarUtils.java",
"license": "lgpl-3.0",
"size": 3433
} | [
"io.github.psychicwaddle.Main",
"java.io.File",
"java.io.FileOutputStream",
"java.io.IOException",
"java.io.InputStream",
"java.util.Enumeration",
"java.util.jar.JarEntry",
"java.util.jar.JarFile"
] | import io.github.psychicwaddle.Main; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.jar.JarEntry; import java.util.jar.JarFile; | import io.github.psychicwaddle.*; import java.io.*; import java.util.*; import java.util.jar.*; | [
"io.github.psychicwaddle",
"java.io",
"java.util"
] | io.github.psychicwaddle; java.io; java.util; | 2,342,742 |
private void doWithField(final Object from, final Field field,
final Field entityField, final Object entity)
throws IllegalArgumentException, IllegalAccessException {
Object value = field.get(from);
if (value != null && dtoInfoRegistry.contains(field.getType()))
value = mapperDelegator.create(value);
entityField.set(entity, value);
} | void function(final Object from, final Field field, final Field entityField, final Object entity) throws IllegalArgumentException, IllegalAccessException { Object value = field.get(from); if (value != null && dtoInfoRegistry.contains(field.getType())) value = mapperDelegator.create(value); entityField.set(entity, value); } | /**
* Method handles fields that are not collections. It checks whether dto's
* field is dto itself. If so it invokes create method, otherwise entity
* field is set to dto's field value.
*
* @param from
* - dto
* @param field
* -dto's field
* @param entityField
* @param entity
* @throws IllegalArgumentException
* @throws IllegalAccessException
*/ | Method handles fields that are not collections. It checks whether dto's field is dto itself. If so it invokes create method, otherwise entity field is set to dto's field value | doWithField | {
"repo_name": "konik32/openrest",
"path": "openrest-dto/src/main/java/pl/openrest/dto/mapper/DefaultCreateAndUpdateMapper.java",
"license": "apache-2.0",
"size": 9589
} | [
"java.lang.reflect.Field"
] | import java.lang.reflect.Field; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,599,886 |
public double resourceBalancePercentage(Resource resource) {
return _resourceBalancePercentage.get(resource);
} | double function(Resource resource) { return _resourceBalancePercentage.get(resource); } | /**
* Get the balance percentage for the requested resource. We give a balance margin to avoid the case
* that right after a rebalance we need to issue another rebalance.
*
* @param resource Resource for which the balance percentage will be provided.
* @return Resource balance percentage.
*/ | Get the balance percentage for the requested resource. We give a balance margin to avoid the case that right after a rebalance we need to issue another rebalance | resourceBalancePercentage | {
"repo_name": "becketqin/cruise-control",
"path": "cruise-control/src/main/java/com/linkedin/kafka/cruisecontrol/analyzer/BalancingConstraint.java",
"license": "bsd-2-clause",
"size": 9943
} | [
"com.linkedin.kafka.cruisecontrol.common.Resource"
] | import com.linkedin.kafka.cruisecontrol.common.Resource; | import com.linkedin.kafka.cruisecontrol.common.*; | [
"com.linkedin.kafka"
] | com.linkedin.kafka; | 360,668 |
@Override
public DefaultListModel<Product> getListModel(Map<String, String> params) {
DefaultListModel<Product> listModel = new DefaultListModel<>();
items.clear();
try {
PreparedStatement ps = database.prepareQuery("SELECT * FROM glo_products "
+ "WHERE name LIKE ? ORDER BY name LIMIT ?;");
ps.setString(1, "%"+params.get("name")+"%");
ps.setInt(2, dbLimit);
ResultSet rs = ps.executeQuery();
while (rs.next()) {
items.add(new Product(rs));
}
rs.close();
} catch (SQLException e) {
System.err.println(Lang.get("Error.Sql", e));
}
Iterator<Product> iterator = items.iterator();
while (iterator.hasNext()) listModel.addElement(iterator.next());
return listModel;
}
| DefaultListModel<Product> function(Map<String, String> params) { DefaultListModel<Product> listModel = new DefaultListModel<>(); items.clear(); try { PreparedStatement ps = database.prepareQuery(STR + STR); ps.setString(1, "%"+params.get("name")+"%"); ps.setInt(2, dbLimit); ResultSet rs = ps.executeQuery(); while (rs.next()) { items.add(new Product(rs)); } rs.close(); } catch (SQLException e) { System.err.println(Lang.get(STR, e)); } Iterator<Product> iterator = items.iterator(); while (iterator.hasNext()) listModel.addElement(iterator.next()); return listModel; } | /**
* Metoda pobiera model dla komponentu JList
* @param params Zestaw (mapa) parametrów - filtrów
* @return Model dla komponentu JList
*/ | Metoda pobiera model dla komponentu JList | getListModel | {
"repo_name": "makaw/somado",
"path": "src/main/java/datamodel/glossaries/GlossProducts.java",
"license": "mit",
"size": 5610
} | [
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.util.Iterator",
"java.util.Map",
"javax.swing.DefaultListModel"
] | import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.Iterator; import java.util.Map; import javax.swing.DefaultListModel; | import java.sql.*; import java.util.*; import javax.swing.*; | [
"java.sql",
"java.util",
"javax.swing"
] | java.sql; java.util; javax.swing; | 1,944,392 |
private byte[] loadContent(String fileName) throws IOException {
InputStream input = null;
try {
ByteArrayOutputStream output = new ByteArrayOutputStream();
input = mAssets.open(fileName);
byte[] buffer = new byte[1024];
int size;
while (-1 != (size = input.read(buffer))) {
output.write(buffer, 0, size);
}
output.flush();
return output.toByteArray();
} catch (FileNotFoundException e) {
return null;
} finally {
if (null != input) {
input.close();
}
}
} | byte[] function(String fileName) throws IOException { InputStream input = null; try { ByteArrayOutputStream output = new ByteArrayOutputStream(); input = mAssets.open(fileName); byte[] buffer = new byte[1024]; int size; while (-1 != (size = input.read(buffer))) { output.write(buffer, 0, size); } output.flush(); return output.toByteArray(); } catch (FileNotFoundException e) { return null; } finally { if (null != input) { input.close(); } } } | /**
* Loads all the content of {@code fileName}.
*
* @param fileName The name of the file.
* @return The content of the file.
* @throws IOException
*/ | Loads all the content of fileName | loadContent | {
"repo_name": "googlesamples/android-PermissionRequest",
"path": "Application/src/main/java/com/example/android/permissionrequest/SimpleWebServer.java",
"license": "apache-2.0",
"size": 6546
} | [
"java.io.ByteArrayOutputStream",
"java.io.FileNotFoundException",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,382,932 |
private void assertRegistryRefreshHasExpectedResults(ServiceBus serviceBus, ServiceRegistry serviceRegistry, ServiceInfo regularInfo,
QName serviceName, boolean serviceDefinitionsShouldDiffer) throws Exception {
// Sync the bus
serviceBus.synchronize();
ServiceInfo newRegularInfo = findLocallyPublishedService(regularInfo.getInstanceId(), serviceName, serviceRegistry);
// Perform the assertions that should have the same outcome regardless of whether or not a ServiceDefinition was modified.
assertTrue("The ServiceInfo instances for the service should satisy the non-ServiceDefinition part of an isSame() check",
regularInfo.getStatus().equals(newRegularInfo.getStatus()) && regularInfo.getServiceName().equals(newRegularInfo.getServiceName()) &&
regularInfo.getServerIpAddress().equals(newRegularInfo.getServerIpAddress()) &&
regularInfo.getApplicationId().equals(newRegularInfo.getApplicationId()));
// Perform the appropriate assertions based on whether or not any updates are expected.
if (serviceDefinitionsShouldDiffer) {
assertNotSame("The checksum for the configured service should have been modified after refreshing the registry.",
regularInfo.getChecksum(), newRegularInfo.getChecksum());
} else {
assertEquals("The checksum for the configured service should not have been modified after refreshing the registry.",
regularInfo.getChecksum(), newRegularInfo.getChecksum());
}
}
| void function(ServiceBus serviceBus, ServiceRegistry serviceRegistry, ServiceInfo regularInfo, QName serviceName, boolean serviceDefinitionsShouldDiffer) throws Exception { serviceBus.synchronize(); ServiceInfo newRegularInfo = findLocallyPublishedService(regularInfo.getInstanceId(), serviceName, serviceRegistry); assertTrue(STR, regularInfo.getStatus().equals(newRegularInfo.getStatus()) && regularInfo.getServiceName().equals(newRegularInfo.getServiceName()) && regularInfo.getServerIpAddress().equals(newRegularInfo.getServerIpAddress()) && regularInfo.getApplicationId().equals(newRegularInfo.getApplicationId())); if (serviceDefinitionsShouldDiffer) { assertNotSame(STR, regularInfo.getChecksum(), newRegularInfo.getChecksum()); } else { assertEquals(STR, regularInfo.getChecksum(), newRegularInfo.getChecksum()); } } | /**
* A convenience method for asserting that expected similarities and differences should have occurred after refreshing the registry. This includes
* comparing the checksums and ensuring that non-similar checksums are corresponding to modifications to the serialized and non-serialized
* ServiceDefinition instances.
*
* @param remotedServiceRegistry The service registry to test with.
* @param regularInfo The ServiceInfo containing the configured service.
* @param forwardInfo The ServiceInfo containing the ForwardedCallHandler for the configured service.
* @param serviceName The QName of the configured service.
* @param forwardServiceName The QName of the ForwardedCallHandler for the configured service.
* @param serviceDefinitionsShouldDiffer A flag indicating if the service definitions should be tested for similarity or difference after the refresh.
* @throws Exception
*/ | A convenience method for asserting that expected similarities and differences should have occurred after refreshing the registry. This includes comparing the checksums and ensuring that non-similar checksums are corresponding to modifications to the serialized and non-serialized ServiceDefinition instances | assertRegistryRefreshHasExpectedResults | {
"repo_name": "ua-eas/ua-rice-2.1.9",
"path": "it/ksb/src/test/java/org/kuali/rice/ksb/messaging/ServiceUpdateAndRemovalTest.java",
"license": "apache-2.0",
"size": 7483
} | [
"javax.xml.namespace.QName",
"org.junit.Assert",
"org.kuali.rice.ksb.api.bus.ServiceBus",
"org.kuali.rice.ksb.api.registry.ServiceInfo",
"org.kuali.rice.ksb.api.registry.ServiceRegistry"
] | import javax.xml.namespace.QName; import org.junit.Assert; import org.kuali.rice.ksb.api.bus.ServiceBus; import org.kuali.rice.ksb.api.registry.ServiceInfo; import org.kuali.rice.ksb.api.registry.ServiceRegistry; | import javax.xml.namespace.*; import org.junit.*; import org.kuali.rice.ksb.api.bus.*; import org.kuali.rice.ksb.api.registry.*; | [
"javax.xml",
"org.junit",
"org.kuali.rice"
] | javax.xml; org.junit; org.kuali.rice; | 1,567,356 |
public void setDeletionDate(final Calendar deletionDateValue) {
this.deletionDate = deletionDateValue;
}
private String edition; | void function(final Calendar deletionDateValue) { this.deletionDate = deletionDateValue; } private String edition; | /**
* Optional. Gets the date this database was deleted.
* @param deletionDateValue The DeletionDate value.
*/ | Optional. Gets the date this database was deleted | setDeletionDate | {
"repo_name": "flydream2046/azure-sdk-for-java",
"path": "service-management/azure-svc-mgmt-sql/src/main/java/com/microsoft/windowsazure/management/sql/models/RestorableDroppedDatabase.java",
"license": "apache-2.0",
"size": 4607
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,317,725 |
public Builder addExcludedCerts(Set excludedCerts)
{
this.excludedCerts.addAll(excludedCerts);
return this;
} | Builder function(Set excludedCerts) { this.excludedCerts.addAll(excludedCerts); return this; } | /**
* Adds excluded certificates which are not used for building a
* certification path.
* <p>
* The given set is cloned to protect it against subsequent modifications.
*
* @param excludedCerts The excluded certificates to set.
*/ | Adds excluded certificates which are not used for building a certification path. The given set is cloned to protect it against subsequent modifications | addExcludedCerts | {
"repo_name": "Skywalker-11/spongycastle",
"path": "prov/src/main/jdk1.2/org/spongycastle/jcajce/PKIXExtendedBuilderParameters.java",
"license": "mit",
"size": 4169
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,857,914 |
private boolean storeInIdentityDataStore(String userName,
UserStoreManager userStoreManager,
String operationType,
Map<String, String> claims) throws UserStoreException {
// No need to separately handle if data identityDataStore is user store based
if (identityDataStore instanceof UserStoreBasedIdentityDataStore) {
return true;
}
// Top level try and finally blocks are used to unset thread local variables
try {
if (!IdentityUtil.threadLocalProperties.get().containsKey(operationType)) {
IdentityUtil.threadLocalProperties.get().put(operationType, true);
UserIdentityClaim userIdentityClaim = null;
if (!StringUtils.equalsIgnoreCase(operationType, PRE_USER_ADD_CLAIM_VALUES)) {
// we avoid loading claims for pre user add operations
userIdentityClaim = identityDataStore.load(userName, userStoreManager);
}
if (userIdentityClaim == null) {
userIdentityClaim = new UserIdentityClaim(userName);
}
Iterator<Map.Entry<String, String>> it = claims.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> claim = it.next();
String key = claim.getKey();
String value = claim.getValue();
if (key.contains(UserCoreConstants.ClaimTypeURIs.IDENTITY_CLAIM_URI)) {
userIdentityClaim.setUserIdentityDataClaim(key, value);
it.remove();
}
}
// storing the identity claims and challenge questions
try {
identityDataStore.store(userIdentityClaim, userStoreManager);
} catch (IdentityException e) {
throw new UserStoreException(
"Error while saving user identityDataStore data for user : " + userName, e);
}
}
return true;
} finally {
// Remove thread local variable
IdentityUtil.threadLocalProperties.get().remove(operationType);
}
} | boolean function(String userName, UserStoreManager userStoreManager, String operationType, Map<String, String> claims) throws UserStoreException { if (identityDataStore instanceof UserStoreBasedIdentityDataStore) { return true; } try { if (!IdentityUtil.threadLocalProperties.get().containsKey(operationType)) { IdentityUtil.threadLocalProperties.get().put(operationType, true); UserIdentityClaim userIdentityClaim = null; if (!StringUtils.equalsIgnoreCase(operationType, PRE_USER_ADD_CLAIM_VALUES)) { userIdentityClaim = identityDataStore.load(userName, userStoreManager); } if (userIdentityClaim == null) { userIdentityClaim = new UserIdentityClaim(userName); } Iterator<Map.Entry<String, String>> it = claims.entrySet().iterator(); while (it.hasNext()) { Map.Entry<String, String> claim = it.next(); String key = claim.getKey(); String value = claim.getValue(); if (key.contains(UserCoreConstants.ClaimTypeURIs.IDENTITY_CLAIM_URI)) { userIdentityClaim.setUserIdentityDataClaim(key, value); it.remove(); } } try { identityDataStore.store(userIdentityClaim, userStoreManager); } catch (IdentityException e) { throw new UserStoreException( STR + userName, e); } } return true; } finally { IdentityUtil.threadLocalProperties.get().remove(operationType); } } | /**
* Store identity claims in the IdentityDataStore
*
* @param userName
* @param userStoreManager
* @param operationType
* @param claims
* @return
* @throws UserStoreException
*/ | Store identity claims in the IdentityDataStore | storeInIdentityDataStore | {
"repo_name": "IsuraD/identity-governance",
"path": "components/org.wso2.carbon.identity.governance/src/main/java/org/wso2/carbon/identity/governance/listener/IdentityStoreEventListener.java",
"license": "apache-2.0",
"size": 21574
} | [
"java.util.Iterator",
"java.util.Map",
"org.apache.commons.lang.StringUtils",
"org.wso2.carbon.identity.base.IdentityException",
"org.wso2.carbon.identity.core.util.IdentityUtil",
"org.wso2.carbon.identity.governance.model.UserIdentityClaim",
"org.wso2.carbon.identity.governance.store.UserStoreBasedIdentityDataStore",
"org.wso2.carbon.user.core.UserCoreConstants",
"org.wso2.carbon.user.core.UserStoreException",
"org.wso2.carbon.user.core.UserStoreManager"
] | import java.util.Iterator; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.wso2.carbon.identity.base.IdentityException; import org.wso2.carbon.identity.core.util.IdentityUtil; import org.wso2.carbon.identity.governance.model.UserIdentityClaim; import org.wso2.carbon.identity.governance.store.UserStoreBasedIdentityDataStore; import org.wso2.carbon.user.core.UserCoreConstants; import org.wso2.carbon.user.core.UserStoreException; import org.wso2.carbon.user.core.UserStoreManager; | import java.util.*; import org.apache.commons.lang.*; import org.wso2.carbon.identity.base.*; import org.wso2.carbon.identity.core.util.*; import org.wso2.carbon.identity.governance.model.*; import org.wso2.carbon.identity.governance.store.*; import org.wso2.carbon.user.core.*; | [
"java.util",
"org.apache.commons",
"org.wso2.carbon"
] | java.util; org.apache.commons; org.wso2.carbon; | 1,059,046 |
@Override
public Object take() throws CacheException, InterruptedException {
// merge42180.
throw new UnsupportedOperationException();
} | Object function() throws CacheException, InterruptedException { throw new UnsupportedOperationException(); } | /**
* Take will choose a random BucketRegionQueue which is primary and will take the head element
* from it.
*/ | Take will choose a random BucketRegionQueue which is primary and will take the head element from it | take | {
"repo_name": "smgoller/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/wan/parallel/ParallelGatewaySenderQueue.java",
"license": "apache-2.0",
"size": 78249
} | [
"org.apache.geode.cache.CacheException"
] | import org.apache.geode.cache.CacheException; | import org.apache.geode.cache.*; | [
"org.apache.geode"
] | org.apache.geode; | 1,253,149 |
public void visit(Visitor v) throws JasperException {
Iterator<Node> iter = list.iterator();
while (iter.hasNext()) {
Node n = iter.next();
n.accept(v);
}
}
| void function(Visitor v) throws JasperException { Iterator<Node> iter = list.iterator(); while (iter.hasNext()) { Node n = iter.next(); n.accept(v); } } | /**
* Visit the nodes in the list with the supplied visitor
*
* @param v
* The visitor used
*/ | Visit the nodes in the list with the supplied visitor | visit | {
"repo_name": "wenzhucjy/tomcat_source",
"path": "tomcat-8.0.9-sourcecode/java/org/apache/jasper/compiler/Node.java",
"license": "apache-2.0",
"size": 78296
} | [
"java.util.Iterator",
"org.apache.jasper.JasperException"
] | import java.util.Iterator; import org.apache.jasper.JasperException; | import java.util.*; import org.apache.jasper.*; | [
"java.util",
"org.apache.jasper"
] | java.util; org.apache.jasper; | 1,748,937 |
public boolean isLocaleSupported(Locale locale); | boolean function(Locale locale); | /**
* Returns true if the locale is supported.
*/ | Returns true if the locale is supported | isLocaleSupported | {
"repo_name": "christianchristensen/resin",
"path": "modules/j2ee-deploy/src/javax/enterprise/deploy/spi/DeploymentManager.java",
"license": "gpl-2.0",
"size": 5097
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 2,313,335 |
private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
this.paint = SerialUtilities.readPaint(stream);
}
| void function(ObjectInputStream stream) throws IOException, ClassNotFoundException { stream.defaultReadObject(); this.paint = SerialUtilities.readPaint(stream); } | /**
* Provides serialization support.
*
* @param stream the input stream.
*
* @throws IOException if there is an I/O error.
* @throws ClassNotFoundException if there is a classpath problem.
*/ | Provides serialization support | readObject | {
"repo_name": "sternze/CurrentTopics_JFreeChart",
"path": "source/org/jfree/chart/plot/dial/DialTextAnnotation.java",
"license": "lgpl-2.1",
"size": 12359
} | [
"java.io.IOException",
"java.io.ObjectInputStream",
"org.jfree.io.SerialUtilities"
] | import java.io.IOException; import java.io.ObjectInputStream; import org.jfree.io.SerialUtilities; | import java.io.*; import org.jfree.io.*; | [
"java.io",
"org.jfree.io"
] | java.io; org.jfree.io; | 1,289,885 |
boolean requiresUniqueIndex()
{
switch (constraintType)
{
case DataDictionary.PRIMARYKEY_CONSTRAINT:
case DataDictionary.UNIQUE_CONSTRAINT:
return true;
default:
return false;
}
} | boolean requiresUniqueIndex() { switch (constraintType) { case DataDictionary.PRIMARYKEY_CONSTRAINT: case DataDictionary.UNIQUE_CONSTRAINT: return true; default: return false; } } | /**
* Is this a foreign key constraint.
*
* @return boolean Whether or not this is a unique key constraint
*/ | Is this a foreign key constraint | requiresUniqueIndex | {
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/impl/sql/compile/ConstraintDefinitionNode.java",
"license": "apache-2.0",
"size": 13814
} | [
"com.pivotal.gemfirexd.internal.iapi.sql.dictionary.DataDictionary"
] | import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.DataDictionary; | import com.pivotal.gemfirexd.internal.iapi.sql.dictionary.*; | [
"com.pivotal.gemfirexd"
] | com.pivotal.gemfirexd; | 524,096 |
private void createLabel(final HierarchyWizardModelGrouping<T> model,
final boolean lower,
final HierarchyWizardGroupingRange<T> adjustment) {
createLabel(composite, lower ? Resources.getMessage("HierarchyWizardEditorRange.7") : //$NON-NLS-1$
Resources.getMessage("HierarchyWizardEditorRange.8")); //$NON-NLS-1$
label = new EditorString(composite) {
| void function(final HierarchyWizardModelGrouping<T> model, final boolean lower, final HierarchyWizardGroupingRange<T> adjustment) { createLabel(composite, lower ? Resources.getMessage(STR) : Resources.getMessage(STR)); label = new EditorString(composite) { | /**
* Create the label editor.
*
* @param model
* @param lower
* @param adjustment
* @param bottom
*/ | Create the label editor | createLabel | {
"repo_name": "kbabioch/arx",
"path": "src/gui/org/deidentifier/arx/gui/view/impl/wizard/HierarchyWizardEditorRange.java",
"license": "apache-2.0",
"size": 11118
} | [
"org.deidentifier.arx.gui.resources.Resources",
"org.deidentifier.arx.gui.view.impl.menu.EditorString",
"org.deidentifier.arx.gui.view.impl.wizard.HierarchyWizardModelGrouping"
] | import org.deidentifier.arx.gui.resources.Resources; import org.deidentifier.arx.gui.view.impl.menu.EditorString; import org.deidentifier.arx.gui.view.impl.wizard.HierarchyWizardModelGrouping; | import org.deidentifier.arx.gui.resources.*; import org.deidentifier.arx.gui.view.impl.menu.*; import org.deidentifier.arx.gui.view.impl.wizard.*; | [
"org.deidentifier.arx"
] | org.deidentifier.arx; | 1,030,998 |
public ManagementPostMenuOrderMocker mockMenuOrder(Integer id, Integer menuOrder) {
if (isMocking() && menuMappings.containsKey(id)) {
removeStub(menuMappings.get(id));
}
try {
menuMappings.put(id, createOkGetMapping(id, menuOrder));
} catch (JsonProcessingException e) {
fail(e.getMessage());
}
if (isMocking()) {
stubFor(menuMappings.get(id));
}
return this;
} | ManagementPostMenuOrderMocker function(Integer id, Integer menuOrder) { if (isMocking() && menuMappings.containsKey(id)) { removeStub(menuMappings.get(id)); } try { menuMappings.put(id, createOkGetMapping(id, menuOrder)); } catch (JsonProcessingException e) { fail(e.getMessage()); } if (isMocking()) { stubFor(menuMappings.get(id)); } return this; } | /**
* Mocks given menu order for the post id
*
* @param id post id
* @param menuOrder menu order
* @return self
*/ | Mocks given menu order for the post id | mockMenuOrder | {
"repo_name": "Metatavu/kunta-api-server",
"path": "src/test/java/fi/metatavu/kuntaapi/test/ManagementPostMenuOrderMocker.java",
"license": "agpl-3.0",
"size": 3052
} | [
"com.fasterxml.jackson.core.JsonProcessingException",
"com.github.tomakehurst.wiremock.client.WireMock",
"org.junit.Assert"
] | import com.fasterxml.jackson.core.JsonProcessingException; import com.github.tomakehurst.wiremock.client.WireMock; import org.junit.Assert; | import com.fasterxml.jackson.core.*; import com.github.tomakehurst.wiremock.client.*; import org.junit.*; | [
"com.fasterxml.jackson",
"com.github.tomakehurst",
"org.junit"
] | com.fasterxml.jackson; com.github.tomakehurst; org.junit; | 1,070,166 |
public void clearMisfire(final Collection<Integer> items) {
for (int each : items) {
jobNodeStorage.removeJobNodeIfExisted(ShardingNode.getMisfireNode(each));
}
} | void function(final Collection<Integer> items) { for (int each : items) { jobNodeStorage.removeJobNodeIfExisted(ShardingNode.getMisfireNode(each)); } } | /**
* Clear misfire flag.
*
* @param items sharding items need to be cleared
*/ | Clear misfire flag | clearMisfire | {
"repo_name": "dangdangdotcom/elastic-job",
"path": "elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/sharding/ExecutionService.java",
"license": "apache-2.0",
"size": 6596
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,208,376 |
List<Trace> searchFragments(String tenantId, Criteria criteria); | List<Trace> searchFragments(String tenantId, Criteria criteria); | /**
* This method returns a set of trace fragments that meet the
* supplied query criteria.
*
* @param tenantId The tenant
* @param criteria The query criteria
* @return The list of trace fragments that meet the criteria
*/ | This method returns a set of trace fragments that meet the supplied query criteria | searchFragments | {
"repo_name": "hawkular/hawkular-btm",
"path": "api/src/main/java/org/hawkular/apm/api/services/TraceService.java",
"license": "apache-2.0",
"size": 2268
} | [
"java.util.List",
"org.hawkular.apm.api.model.trace.Trace"
] | import java.util.List; import org.hawkular.apm.api.model.trace.Trace; | import java.util.*; import org.hawkular.apm.api.model.trace.*; | [
"java.util",
"org.hawkular.apm"
] | java.util; org.hawkular.apm; | 1,914,121 |
public Collection<String> getStackRPN() {
return Collections.unmodifiableCollection(stackRPN);
} | Collection<String> function() { return Collections.unmodifiableCollection(stackRPN); } | /**
* Get back an <b>unmodifiable copy</b> of the stack
*/ | Get back an unmodifiable copy of the stack | getStackRPN | {
"repo_name": "RuedigerMoeller/bracer",
"path": "src/main/java/com/autsia/bracer/BracerParser.java",
"license": "apache-2.0",
"size": 16472
} | [
"java.util.Collection",
"java.util.Collections"
] | import java.util.Collection; import java.util.Collections; | import java.util.*; | [
"java.util"
] | java.util; | 1,888,397 |
public void color(int group, int value) throws IOException,
IllegalArgumentException {
// create message array
byte[][] messages = new byte[2][3];
// switch on first
messages[0] = getSwitchOnCommand(group);
// adjust color
messages[1] = getColorCommand(value);
// send messages
sendMultipleMessages(messages, MIN_SLEEP_BETWEEN_MESSAGES);
} | void function(int group, int value) throws IOException, IllegalArgumentException { byte[][] messages = new byte[2][3]; messages[0] = getSwitchOnCommand(group); messages[1] = getColorCommand(value); sendMultipleMessages(messages, MIN_SLEEP_BETWEEN_MESSAGES); } | /**
* Set the color value for a given group of lights.
*
* @param group
* is the number of the group to set the color for
* @param value
* is the color value to set (between MilightColor.MIN_COLOR and
* MilightColor.MAX_COLOR)
* @throws IOException
* if the message could not be sent
* @throws IllegalArgumentException
* if group is not between 1 and 4 or the color value is not
* between MilightColor.MIN_COLOR and MilightColor.MAX_COLOR
*/ | Set the color value for a given group of lights | color | {
"repo_name": "stoman/MilightAPI",
"path": "src/de/toman/milight/WiFiBox.java",
"license": "mit",
"size": 39506
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,256,128 |
public Category getActiveCategory(final int dotPosition) {
if (dotPosition < 0 || dotPosition > right.length) throw new InvalidDotPosition(dotPosition, right);
if (dotPosition < right.length) {
final Category returnValue = right[dotPosition];
if (returnValue == null) throw new NullPointerException();
else return returnValue;
} else return null;
} | Category function(final int dotPosition) { if (dotPosition < 0 dotPosition > right.length) throw new InvalidDotPosition(dotPosition, right); if (dotPosition < right.length) { final Category returnValue = right[dotPosition]; if (returnValue == null) throw new NullPointerException(); else return returnValue; } else return null; } | /**
* Gets the active category in the underlying rule, if any.
* Runs in O(1).
*
* @return The category at this dotted rule's
* dot position in the underlying rule's
* {@link Rule#getRight() right side category sequence}. If this rule's
* dot position is already at the end of the right side category sequence,
* returns <code>null</code>.
*/ | Gets the active category in the underlying rule, if any. Runs in O(1) | getActiveCategory | {
"repo_name": "digitalheir/java-probabilistic-earley-parser",
"path": "src/main/java/org/leibnizcenter/cfg/rule/Rule.java",
"license": "mit",
"size": 9659
} | [
"org.leibnizcenter.cfg.category.Category"
] | import org.leibnizcenter.cfg.category.Category; | import org.leibnizcenter.cfg.category.*; | [
"org.leibnizcenter.cfg"
] | org.leibnizcenter.cfg; | 2,773,263 |
public String[] getIdentifiers() {
return identifiers == null ? null : copyOf(identifiers, identifiers.length);
} | String[] function() { return identifiers == null ? null : copyOf(identifiers, identifiers.length); } | /**
* Returns the <code>uuids</code> parameter of the filter.
*
* @return a <code>String</code> array.
*/ | Returns the <code>uuids</code> parameter of the filter | getIdentifiers | {
"repo_name": "trekawek/jackrabbit-oak",
"path": "oak-jackrabbit-api/src/main/java/org/apache/jackrabbit/api/observation/JackrabbitEventFilter.java",
"license": "apache-2.0",
"size": 10948
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,777,970 |
public static void deleteDb ( Catalogue catalogue ) throws IOException {
System.gc();
// close all the catalogue connections
catalogue.closeConnection();
// delete the DB with all the subfiles
GlobalUtil.deleteFileCascade ( new File( catalogue.getDbPath() ) );
// check if no catalogue is present in the parent folder, if so delete also the
// parent directory (the dir which contains all the catalogue versions)
File parent = new File( catalogue.getDbPath() ).getParentFile();
if ( parent.listFiles().length == 0 )
parent.delete();
}
| static void function ( Catalogue catalogue ) throws IOException { System.gc(); catalogue.closeConnection(); GlobalUtil.deleteFileCascade ( new File( catalogue.getDbPath() ) ); File parent = new File( catalogue.getDbPath() ).getParentFile(); if ( parent.listFiles().length == 0 ) parent.delete(); } | /**
* Delete the catalogue database from disk.
* @param catalogue
* @throws IOException
*/ | Delete the catalogue database from disk | deleteDb | {
"repo_name": "openefsa/CatalogueBrowser",
"path": "src/catalogue_browser_dao/DatabaseManager.java",
"license": "lgpl-3.0",
"size": 16016
} | [
"java.io.File",
"java.io.IOException"
] | import java.io.File; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,048,844 |
public SnapshotPolicyProperties withWeeklySchedule(WeeklySchedule weeklySchedule) {
this.weeklySchedule = weeklySchedule;
return this;
} | SnapshotPolicyProperties function(WeeklySchedule weeklySchedule) { this.weeklySchedule = weeklySchedule; return this; } | /**
* Set the weeklySchedule property: Schedule for weekly snapshots.
*
* @param weeklySchedule the weeklySchedule value to set.
* @return the SnapshotPolicyProperties object itself.
*/ | Set the weeklySchedule property: Schedule for weekly snapshots | withWeeklySchedule | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/netapp/azure-resourcemanager-netapp/src/main/java/com/azure/resourcemanager/netapp/fluent/models/SnapshotPolicyProperties.java",
"license": "mit",
"size": 5429
} | [
"com.azure.resourcemanager.netapp.models.WeeklySchedule"
] | import com.azure.resourcemanager.netapp.models.WeeklySchedule; | import com.azure.resourcemanager.netapp.models.*; | [
"com.azure.resourcemanager"
] | com.azure.resourcemanager; | 418,401 |
private String stripQuotes(Object value) {
return StringUtils.strip((String)value, "\"");
} | String function(Object value) { return StringUtils.strip((String)value, "\""); } | /**
* Strips value from quotes at the beginning and at the end of string.
* It is necessary for json text values returned by postgresql.
*/ | Strips value from quotes at the beginning and at the end of string. It is necessary for json text values returned by postgresql | stripQuotes | {
"repo_name": "CeON/saos",
"path": "saos-enrichment/src/main/java/pl/edu/icm/saos/enrichment/hash/EnrichmentTagLawJournalEntryFetcher.java",
"license": "gpl-3.0",
"size": 3196
} | [
"org.apache.commons.lang3.StringUtils"
] | import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,815,012 |
public static double uniform(Random rng,double min, double max) {
return rng.nextDouble() * (max - min) + min;
} | static double function(Random rng,double min, double max) { return rng.nextDouble() * (max - min) + min; } | /**
* Generate a uniform random number from the given rng
* @param rng the rng to use
* @param min the min num
* @param max the max num
* @return a number uniformly distributed between min and max
*/ | Generate a uniform random number from the given rng | uniform | {
"repo_name": "xuzhongxing/deeplearning4j",
"path": "deeplearning4j-nn/src/main/java/org/deeplearning4j/util/MathUtils.java",
"license": "apache-2.0",
"size": 41490
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,146,226 |
@Override public void processDependencies(List<Span> spans) {
InMemoryStorage mem = new InMemoryStorage();
mem.spanConsumer().accept(spans);
List<DependencyLink> links = mem.spanStore().getDependencies(TODAY + DAY, null);
// This gets or derives a timestamp from the spans
long midnightUTC = midnightUTC(guessTimestamp(MergeById.apply(spans).get(0)) / 1000);
InternalForTests.writeDependencyLinks(esStorage().delegate, links, midnightUTC);
} | @Override void function(List<Span> spans) { InMemoryStorage mem = new InMemoryStorage(); mem.spanConsumer().accept(spans); List<DependencyLink> links = mem.spanStore().getDependencies(TODAY + DAY, null); long midnightUTC = midnightUTC(guessTimestamp(MergeById.apply(spans).get(0)) / 1000); InternalForTests.writeDependencyLinks(esStorage().delegate, links, midnightUTC); } | /**
* The current implementation does not include dependency aggregation. It includes retrieval of
* pre-aggregated links.
*/ | The current implementation does not include dependency aggregation. It includes retrieval of pre-aggregated links | processDependencies | {
"repo_name": "soundcloud/zipkin",
"path": "zipkin-storage/elasticsearch-http/src/test/java/zipkin/storage/elasticsearch/http/integration/ElasticsearchHttpDependenciesTest.java",
"license": "apache-2.0",
"size": 2241
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 277,817 |
default Optional<ServerStageVoiceChannel> getStageVoiceChannelById(long id) {
return getChannelById(id)
.filter(channel -> channel instanceof ServerStageVoiceChannel)
.map(channel -> (ServerStageVoiceChannel) channel);
} | default Optional<ServerStageVoiceChannel> getStageVoiceChannelById(long id) { return getChannelById(id) .filter(channel -> channel instanceof ServerStageVoiceChannel) .map(channel -> (ServerStageVoiceChannel) channel); } | /**
* Gets a stage voice channel by its id.
*
* @param id The id of the stage voice channel.
* @return The stage voice channel with the given id.
*/ | Gets a stage voice channel by its id | getStageVoiceChannelById | {
"repo_name": "BtoBastian/Javacord",
"path": "javacord-api/src/main/java/org/javacord/api/entity/server/Server.java",
"license": "lgpl-3.0",
"size": 103692
} | [
"java.util.Optional",
"org.javacord.api.entity.channel.ServerStageVoiceChannel"
] | import java.util.Optional; import org.javacord.api.entity.channel.ServerStageVoiceChannel; | import java.util.*; import org.javacord.api.entity.channel.*; | [
"java.util",
"org.javacord.api"
] | java.util; org.javacord.api; | 1,044,752 |
public synchronized String getCommonProperty(@Nonnull String key) {
Validate.notNull(key, "key");
return commonProperties.get(key);
} | synchronized String function(@Nonnull String key) { Validate.notNull(key, "key"); return commonProperties.get(key); } | /**
* Gets the property value.
* @param key Property key.
* @return Property value or null.
*/ | Gets the property value | getCommonProperty | {
"repo_name": "expanset/expanset",
"path": "hk2/hk2-persistence/src/main/java/com/expanset/hk2/persistence/PersistenceContextFactoryAccessor.java",
"license": "apache-2.0",
"size": 6237
} | [
"javax.annotation.Nonnull",
"org.apache.commons.lang3.Validate"
] | import javax.annotation.Nonnull; import org.apache.commons.lang3.Validate; | import javax.annotation.*; import org.apache.commons.lang3.*; | [
"javax.annotation",
"org.apache.commons"
] | javax.annotation; org.apache.commons; | 1,496,610 |
public void setTimeToLive(int ttl) throws IOException {
mPacketizer.setTimeToLive(ttl);
} | void function(int ttl) throws IOException { mPacketizer.setTimeToLive(ttl); } | /**
* Sets the Time To Live of packets sent over the network.
* @param ttl The time to live
* @throws IOException
*/ | Sets the Time To Live of packets sent over the network | setTimeToLive | {
"repo_name": "jamesrdelaney/ecg_over_rtp",
"path": "src/net/majorkernelpanic/streaming/FileStream.java",
"license": "gpl-3.0",
"size": 9456
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 673,225 |
public static TeTopologyKey teTopologyKey() {
return teTopologyKey;
} | static TeTopologyKey function() { return teTopologyKey; } | /**
* Returns the key for the sample TE Topology.
*
* @return value of TE Topology key
*/ | Returns the key for the sample TE Topology | teTopologyKey | {
"repo_name": "osinstom/onos",
"path": "apps/tetopology/app/src/test/java/org/onosproject/tetopology/management/DefaultBuilder.java",
"license": "apache-2.0",
"size": 15085
} | [
"org.onosproject.tetopology.management.api.TeTopologyKey"
] | import org.onosproject.tetopology.management.api.TeTopologyKey; | import org.onosproject.tetopology.management.api.*; | [
"org.onosproject.tetopology"
] | org.onosproject.tetopology; | 1,684,760 |
public List<JdbcParameterMeta> parameterMetaData(String schemaName, SqlFieldsQuery sql) throws IgniteSQLException; | List<JdbcParameterMeta> function(String schemaName, SqlFieldsQuery sql) throws IgniteSQLException; | /**
* Jdbc parameters metadata of the specified query.
*
* @param schemaName the default schema name for query.
* @param sql Sql query.
* @return metadata describing all the parameters, even in case of multi-statement.
* @throws SQLException if failed to get meta.
*/ | Jdbc parameters metadata of the specified query | parameterMetaData | {
"repo_name": "shroman/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/query/GridQueryIndexing.java",
"license": "apache-2.0",
"size": 15927
} | [
"java.util.List",
"org.apache.ignite.cache.query.SqlFieldsQuery",
"org.apache.ignite.internal.processors.odbc.jdbc.JdbcParameterMeta"
] | import java.util.List; import org.apache.ignite.cache.query.SqlFieldsQuery; import org.apache.ignite.internal.processors.odbc.jdbc.JdbcParameterMeta; | import java.util.*; import org.apache.ignite.cache.query.*; import org.apache.ignite.internal.processors.odbc.jdbc.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 848,882 |
public SiteAuthSettingsInner withUnauthenticatedClientAction(UnauthenticatedClientAction unauthenticatedClientAction) {
this.unauthenticatedClientAction = unauthenticatedClientAction;
return this;
} | SiteAuthSettingsInner function(UnauthenticatedClientAction unauthenticatedClientAction) { this.unauthenticatedClientAction = unauthenticatedClientAction; return this; } | /**
* Set the action to take when an unauthenticated client attempts to access the app. Possible values include: 'RedirectToLoginPage', 'AllowAnonymous'.
*
* @param unauthenticatedClientAction the unauthenticatedClientAction value to set
* @return the SiteAuthSettingsInner object itself.
*/ | Set the action to take when an unauthenticated client attempts to access the app. Possible values include: 'RedirectToLoginPage', 'AllowAnonymous' | withUnauthenticatedClientAction | {
"repo_name": "navalev/azure-sdk-for-java",
"path": "sdk/appservice/mgmt-v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/SiteAuthSettingsInner.java",
"license": "mit",
"size": 34563
} | [
"com.microsoft.azure.management.appservice.v2018_02_01.UnauthenticatedClientAction"
] | import com.microsoft.azure.management.appservice.v2018_02_01.UnauthenticatedClientAction; | import com.microsoft.azure.management.appservice.v2018_02_01.*; | [
"com.microsoft.azure"
] | com.microsoft.azure; | 1,761,005 |
public String getDraftSequenceNumber(Model model) throws AxelorException {
if (model.getId() == null) {
throw new AxelorException(
model,
TraceBackRepository.CATEGORY_INCONSISTENCY,
I18n.get(IExceptionMessage.SEQUENCE_NOT_SAVED_RECORD));
}
return String.format("%s%d", DRAFT_PREFIX, model.getId());
} | String function(Model model) throws AxelorException { if (model.getId() == null) { throw new AxelorException( model, TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.SEQUENCE_NOT_SAVED_RECORD)); } return String.format("%s%d", DRAFT_PREFIX, model.getId()); } | /**
* Get draft sequence number.
*
* @param model
* @return
* @throws AxelorException
*/ | Get draft sequence number | getDraftSequenceNumber | {
"repo_name": "axelor/axelor-business-suite",
"path": "axelor-base/src/main/java/com/axelor/apps/base/service/administration/SequenceService.java",
"license": "agpl-3.0",
"size": 12198
} | [
"com.axelor.apps.base.exceptions.IExceptionMessage",
"com.axelor.db.Model",
"com.axelor.exception.AxelorException",
"com.axelor.exception.db.repo.TraceBackRepository",
"com.axelor.i18n.I18n"
] | import com.axelor.apps.base.exceptions.IExceptionMessage; import com.axelor.db.Model; import com.axelor.exception.AxelorException; import com.axelor.exception.db.repo.TraceBackRepository; import com.axelor.i18n.I18n; | import com.axelor.apps.base.exceptions.*; import com.axelor.db.*; import com.axelor.exception.*; import com.axelor.exception.db.repo.*; import com.axelor.i18n.*; | [
"com.axelor.apps",
"com.axelor.db",
"com.axelor.exception",
"com.axelor.i18n"
] | com.axelor.apps; com.axelor.db; com.axelor.exception; com.axelor.i18n; | 2,332,091 |
public static String fixXmlAttributes(String xml) {
String ret = xml;
Pattern attr = Pattern.compile("=\"(.*?)\""); // name="value"
Matcher m = attr.matcher(xml);
while (m.find()) {
String g = m.group(1);
if (g.contains("<") || g.contains(">")) {
LOGGER.warn("Fixing invalid XML entities: {}", g);
String fixed = m.group(1).replaceAll("<", "<").replaceAll(">", ">");
ret = ret.replace(g, fixed); // use string replace
}
}
return ret;
} | static String function(String xml) { String ret = xml; Pattern attr = Pattern.compile("=\"(.*?)\STR<STR>STRFixing invalid XML entities: {}STR<STR<STR>STR>"); ret = ret.replace(g, fixed); } } return ret; } | /**
* tries to fix invalid XML structure
*
* @param xml
* @return
*/ | tries to fix invalid XML structure | fixXmlAttributes | {
"repo_name": "tinyMediaManager/scraper-kodi",
"path": "src/main/java/org/tinymediamanager/scraper/kodi/KodiUtil.java",
"license": "apache-2.0",
"size": 13130
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 452,170 |
@Deprecated
public boolean isPossibleShortNumberForRegion(String shortNumber, String regionDialingFrom) {
PhoneMetadata phoneMetadata =
MetadataManager.getShortNumberMetadataForRegion(regionDialingFrom);
if (phoneMetadata == null) {
return false;
}
return matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.getGeneralDesc());
} | boolean function(String shortNumber, String regionDialingFrom) { PhoneMetadata phoneMetadata = MetadataManager.getShortNumberMetadataForRegion(regionDialingFrom); if (phoneMetadata == null) { return false; } return matcherApi.matchesPossibleNumber(shortNumber, phoneMetadata.getGeneralDesc()); } | /**
* Check whether a short number is a possible number when dialled from a region, given the number
* in the form of a string, and the region where the number is dialed from. This provides a more
* lenient check than {@link #isValidShortNumberForRegion}.
*
* @param shortNumber the short number to check as a string
* @param regionDialingFrom the region from which the number is dialed
* @return whether the number is a possible short number
* @deprecated Anyone who was using it and passing in a string with whitespace (or other
* formatting characters) would have been getting the wrong result. You should parse
* the string to PhoneNumber and use the method
* {@code #isPossibleShortNumberForRegion(PhoneNumber, String)}. This method will be
* removed in the next release.
*/ | Check whether a short number is a possible number when dialled from a region, given the number in the form of a string, and the region where the number is dialed from. This provides a more lenient check than <code>#isValidShortNumberForRegion</code> | isPossibleShortNumberForRegion | {
"repo_name": "hejunbinlan/libphonenumber",
"path": "java/libphonenumber/src/com/google/i18n/phonenumbers/ShortNumberInfo.java",
"license": "apache-2.0",
"size": 26976
} | [
"com.google.i18n.phonenumbers.Phonemetadata"
] | import com.google.i18n.phonenumbers.Phonemetadata; | import com.google.i18n.phonenumbers.*; | [
"com.google.i18n"
] | com.google.i18n; | 1,786,711 |
private Block addStoredBlock(final BlockInfoContiguous block,
DatanodeStorageInfo storageInfo,
DatanodeDescriptor delNodeHint,
boolean logEveryBlock)
throws IOException {
assert block != null && namesystem.hasWriteLock();
BlockInfoContiguous storedBlock;
DatanodeDescriptor node = storageInfo.getDatanodeDescriptor();
if (block instanceof BlockInfoContiguousUnderConstruction) {
//refresh our copy in case the block got completed in another thread
storedBlock = blocksMap.getStoredBlock(block);
} else {
storedBlock = block;
}
if (storedBlock == null || storedBlock.isDeleted()) {
// If this block does not belong to anyfile, then we are done.
blockLog.info("BLOCK* addStoredBlock: {} on {} size {} but it does not" +
" belong to any file", block, node, block.getNumBytes());
// we could add this block to invalidate set of this datanode.
// it will happen in next block report otherwise.
return block;
}
BlockCollection bc = storedBlock.getBlockCollection();
assert bc != null : "Block must belong to a file";
// add block to the datanode
AddBlockResult result = storageInfo.addBlock(storedBlock);
int curReplicaDelta;
if (result == AddBlockResult.ADDED) {
curReplicaDelta = 1;
if (logEveryBlock) {
logAddStoredBlock(storedBlock, node);
}
} else if (result == AddBlockResult.REPLACED) {
curReplicaDelta = 0;
blockLog.warn("BLOCK* addStoredBlock: block {} moved to storageType " +
"{} on node {}", storedBlock, storageInfo.getStorageType(), node);
} else {
// if the same block is added again and the replica was corrupt
// previously because of a wrong gen stamp, remove it from the
// corrupt block list.
corruptReplicas.removeFromCorruptReplicasMap(block, node,
Reason.GENSTAMP_MISMATCH);
curReplicaDelta = 0;
blockLog.warn("BLOCK* addStoredBlock: Redundant addStoredBlock request"
+ " received for {} on node {} size {}", storedBlock, node,
storedBlock.getNumBytes());
}
// Now check for completion of blocks and safe block count
NumberReplicas num = countNodes(storedBlock);
int numLiveReplicas = num.liveReplicas();
int numCurrentReplica = numLiveReplicas
+ pendingReplications.getNumReplicas(storedBlock);
if(storedBlock.getBlockUCState() == BlockUCState.COMMITTED &&
numLiveReplicas >= minReplication) {
storedBlock = completeBlock(bc, storedBlock, false);
} else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) {
// check whether safe replication is reached for the block
// only complete blocks are counted towards that
// Is no-op if not in safe mode.
// In the case that the block just became complete above, completeBlock()
// handles the safe block count maintenance.
namesystem.incrementSafeBlockCount(numCurrentReplica);
}
pendingAsync.remove(storedBlock);
blockLog.info("ASYNC_SIZE, " + pendingAsync.size() );
// if file is under construction, then done for now
if (bc.isUnderConstruction()) {
return storedBlock;
}
// do not try to handle over/under-replicated blocks during first safe mode
if (!namesystem.isPopulatingReplQueues()) {
return storedBlock;
}
// handle underReplication/overReplication
short fileReplication = bc.getBlockReplication();
if (!isNeededReplication(storedBlock, fileReplication, numCurrentReplica)) {
neededReplications.remove(storedBlock, numCurrentReplica,
num.decommissionedAndDecommissioning(), fileReplication);
} else {
updateNeededReplications(storedBlock, curReplicaDelta, 0);
}
if (numCurrentReplica > fileReplication) {
processOverReplicatedBlock(storedBlock, fileReplication, node, delNodeHint);
}
// If the file replication has reached desired value
// we can remove any corrupt replicas the block may have
int corruptReplicasCount = corruptReplicas.numCorruptReplicas(storedBlock);
int numCorruptNodes = num.corruptReplicas();
if (numCorruptNodes != corruptReplicasCount) {
LOG.warn("Inconsistent number of corrupt replicas for " +
storedBlock + "blockMap has " + numCorruptNodes +
" but corrupt replicas map has " + corruptReplicasCount);
}
if ((corruptReplicasCount > 0) && (numLiveReplicas >= fileReplication))
invalidateCorruptReplicas(storedBlock);
return storedBlock;
} | Block function(final BlockInfoContiguous block, DatanodeStorageInfo storageInfo, DatanodeDescriptor delNodeHint, boolean logEveryBlock) throws IOException { assert block != null && namesystem.hasWriteLock(); BlockInfoContiguous storedBlock; DatanodeDescriptor node = storageInfo.getDatanodeDescriptor(); if (block instanceof BlockInfoContiguousUnderConstruction) { storedBlock = blocksMap.getStoredBlock(block); } else { storedBlock = block; } if (storedBlock == null storedBlock.isDeleted()) { blockLog.info(STR + STR, block, node, block.getNumBytes()); return block; } BlockCollection bc = storedBlock.getBlockCollection(); assert bc != null : STR; AddBlockResult result = storageInfo.addBlock(storedBlock); int curReplicaDelta; if (result == AddBlockResult.ADDED) { curReplicaDelta = 1; if (logEveryBlock) { logAddStoredBlock(storedBlock, node); } } else if (result == AddBlockResult.REPLACED) { curReplicaDelta = 0; blockLog.warn(STR + STR, storedBlock, storageInfo.getStorageType(), node); } else { corruptReplicas.removeFromCorruptReplicasMap(block, node, Reason.GENSTAMP_MISMATCH); curReplicaDelta = 0; blockLog.warn(STR + STR, storedBlock, node, storedBlock.getNumBytes()); } NumberReplicas num = countNodes(storedBlock); int numLiveReplicas = num.liveReplicas(); int numCurrentReplica = numLiveReplicas + pendingReplications.getNumReplicas(storedBlock); if(storedBlock.getBlockUCState() == BlockUCState.COMMITTED && numLiveReplicas >= minReplication) { storedBlock = completeBlock(bc, storedBlock, false); } else if (storedBlock.isComplete() && result == AddBlockResult.ADDED) { namesystem.incrementSafeBlockCount(numCurrentReplica); } pendingAsync.remove(storedBlock); blockLog.info(STR + pendingAsync.size() ); if (bc.isUnderConstruction()) { return storedBlock; } if (!namesystem.isPopulatingReplQueues()) { return storedBlock; } short fileReplication = bc.getBlockReplication(); if (!isNeededReplication(storedBlock, fileReplication, numCurrentReplica)) { neededReplications.remove(storedBlock, numCurrentReplica, num.decommissionedAndDecommissioning(), fileReplication); } else { updateNeededReplications(storedBlock, curReplicaDelta, 0); } if (numCurrentReplica > fileReplication) { processOverReplicatedBlock(storedBlock, fileReplication, node, delNodeHint); } int corruptReplicasCount = corruptReplicas.numCorruptReplicas(storedBlock); int numCorruptNodes = num.corruptReplicas(); if (numCorruptNodes != corruptReplicasCount) { LOG.warn(STR + storedBlock + STR + numCorruptNodes + STR + corruptReplicasCount); } if ((corruptReplicasCount > 0) && (numLiveReplicas >= fileReplication)) invalidateCorruptReplicas(storedBlock); return storedBlock; } | /**
* Modify (block-->datanode) map. Remove block from set of
* needed replications if this takes care of the problem.
* @return the block that is stored in blockMap.
*/ | Modify (block-->datanode) map. Remove block from set of needed replications if this takes care of the problem | addStoredBlock | {
"repo_name": "simbadzina/hadoop-fcfs",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/blockmanagement/BlockManager.java",
"license": "apache-2.0",
"size": 150088
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.protocol.Block",
"org.apache.hadoop.hdfs.server.blockmanagement.CorruptReplicasMap",
"org.apache.hadoop.hdfs.server.blockmanagement.DatanodeStorageInfo",
"org.apache.hadoop.hdfs.server.common.HdfsServerConstants"
] | import java.io.IOException; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.blockmanagement.CorruptReplicasMap; import org.apache.hadoop.hdfs.server.blockmanagement.DatanodeStorageInfo; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; | import java.io.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.blockmanagement.*; import org.apache.hadoop.hdfs.server.common.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,243,369 |
public static ItemStack itemStackFromBase64(String base42String) {
try {
ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(base42String));
BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);
ItemStack items = (ItemStack) dataInput.readObject();
dataInput.close();
return items;
} catch (ClassNotFoundException e) {
try {
throw new IOException("Unable to decode class type.", e);
} catch (IOException e1) {
e1.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
return null;
} | static ItemStack function(String base42String) { try { ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(base42String)); BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream); ItemStack items = (ItemStack) dataInput.readObject(); dataInput.close(); return items; } catch (ClassNotFoundException e) { try { throw new IOException(STR, e); } catch (IOException e1) { e1.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } return null; } | /**
* Get an itemStack from the base64String
*
* @param base42String
* @return
* @since 1.0
*/ | Get an itemStack from the base64String | itemStackFromBase64 | {
"repo_name": "TheSecretLife/DR-API",
"path": "game/src/main/java/net/dungeonrealms/game/mastery/ItemSerialization.java",
"license": "gpl-3.0",
"size": 4720
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"org.bukkit.inventory.ItemStack",
"org.bukkit.util.io.BukkitObjectInputStream",
"org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import org.bukkit.inventory.ItemStack; import org.bukkit.util.io.BukkitObjectInputStream; import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; | import java.io.*; import org.bukkit.inventory.*; import org.bukkit.util.io.*; import org.yaml.snakeyaml.external.biz.*; | [
"java.io",
"org.bukkit.inventory",
"org.bukkit.util",
"org.yaml.snakeyaml"
] | java.io; org.bukkit.inventory; org.bukkit.util; org.yaml.snakeyaml; | 2,438,951 |
public String getActionName(HandlerMethod handler) {
return handler.getMethod().getName();
} | String function(HandlerMethod handler) { return handler.getMethod().getName(); } | /**
* Gets the action name from the handler.
*
* @param handler
* the handler
* @return the method name
*/ | Gets the action name from the handler | getActionName | {
"repo_name": "mevdschee/tqdev-metrics",
"path": "metrics-spring-webmvc/src/main/java/com/tqdev/metrics/spring/webmvc/MvcDurationInterceptor.java",
"license": "mit",
"size": 3676
} | [
"org.springframework.web.method.HandlerMethod"
] | import org.springframework.web.method.HandlerMethod; | import org.springframework.web.method.*; | [
"org.springframework.web"
] | org.springframework.web; | 2,461,681 |
@Override
public boolean isNull( Object data ) throws KettleValueException {
//noinspection deprecation
return isNull( data, emptyStringAndNullAreDifferent );
} | boolean function( Object data ) throws KettleValueException { return isNull( data, emptyStringAndNullAreDifferent ); } | /**
* Determine if an object is null. This is the case if data==null or if it's an empty string.
*
* @param data
* the object to test
* @return true if the object is considered null.
* @throws KettleValueException
* in case there is a conversion error (only thrown in case of lazy conversion)
*/ | Determine if an object is null. This is the case if data==null or if it's an empty string | isNull | {
"repo_name": "tmcsantos/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/row/value/ValueMetaBase.java",
"license": "apache-2.0",
"size": 191568
} | [
"org.pentaho.di.core.exception.KettleValueException"
] | import org.pentaho.di.core.exception.KettleValueException; | import org.pentaho.di.core.exception.*; | [
"org.pentaho.di"
] | org.pentaho.di; | 2,085,211 |
public static <O extends Object> Collector<O, ?, O[]> toArray(final Class<O> pElementType) {
return new ArrayCollector<>(pElementType);
} | static <O extends Object> Collector<O, ?, O[]> function(final Class<O> pElementType) { return new ArrayCollector<>(pElementType); } | /**
* Returns a {@code Collector} that accumulates the input elements into a
* new array.
*
* @param pElementType Type of an element in the array.
* @param <O> the type of the input elements
* @return a {@code Collector} which collects all the input elements into an
* array, in encounter order
*/ | Returns a Collector that accumulates the input elements into a new array | toArray | {
"repo_name": "apache/commons-lang",
"path": "src/main/java/org/apache/commons/lang3/Streams.java",
"license": "apache-2.0",
"size": 22168
} | [
"java.util.stream.Collector"
] | import java.util.stream.Collector; | import java.util.stream.*; | [
"java.util"
] | java.util; | 2,806,582 |
public ManagedCustomer getManagedCustomer(String customerId) throws RemoteException {
return delegateLocator.getManagedCustomerDelegate().getByCustomerId(customerId);
} | ManagedCustomer function(String customerId) throws RemoteException { return delegateLocator.getManagedCustomerDelegate().getByCustomerId(customerId); } | /**
* Gets the ManagedCustomers for the ExtendedMcc in the customerIds list.
*
* @param customerId the customerId of the ManagedCustomer to retrieve
* @return the ManagedCustomer for the customerId
* @throws UtilityLibraryException if there is an error in the reflection call
* @throws RemoteException for communication-related exceptions
*/ | Gets the ManagedCustomers for the ExtendedMcc in the customerIds list | getManagedCustomer | {
"repo_name": "nafae/developer",
"path": "modules/adwords_axis_utility_extension/src/main/java/com/google/api/ads/adwords/axis/utility/extension/ExtendedMcc.java",
"license": "apache-2.0",
"size": 17405
} | [
"com.google.api.ads.adwords.axis.v201409.mcm.ManagedCustomer",
"java.rmi.RemoteException"
] | import com.google.api.ads.adwords.axis.v201409.mcm.ManagedCustomer; import java.rmi.RemoteException; | import com.google.api.ads.adwords.axis.v201409.mcm.*; import java.rmi.*; | [
"com.google.api",
"java.rmi"
] | com.google.api; java.rmi; | 836,787 |
@RequestMapping(method = RequestMethod.GET,
value = "/students/deletestudent/{id}")
public ModelAndView deleteStudentRedirect(@PathVariable final String id) {
studentService.deleteStudent(id);
ModelAndView mav = new ModelAndView("students");
mav.addObject("allprofessors", studentService.getAllStudents());
mav.addObject("school_name", Global.SCHOOL_NAME);
return mav;
} | @RequestMapping(method = RequestMethod.GET, value = STR) ModelAndView function(@PathVariable final String id) { studentService.deleteStudent(id); ModelAndView mav = new ModelAndView(STR); mav.addObject(STR, studentService.getAllStudents()); mav.addObject(STR, Global.SCHOOL_NAME); return mav; } | /**
* Deletes the selected student.
*
* @param id The id of the student
* @return ModelAndView containing the list of all students
*/ | Deletes the selected student | deleteStudentRedirect | {
"repo_name": "cs3250-team6/msubanner",
"path": "src/main/java/edu/msudenver/cs3250/group6/msubanner/controllers/StudentController.java",
"license": "mit",
"size": 5909
} | [
"edu.msudenver.cs3250.group6.msubanner.Global",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod",
"org.springframework.web.servlet.ModelAndView"
] | import edu.msudenver.cs3250.group6.msubanner.Global; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.servlet.ModelAndView; | import edu.msudenver.cs3250.group6.msubanner.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.*; | [
"edu.msudenver.cs3250",
"org.springframework.web"
] | edu.msudenver.cs3250; org.springframework.web; | 2,022,656 |
@Test
public final void testReadIntegerFromByteOffsetLengthPlusOffsetBiggerThan8() {
// Setup the resources for the test.
int expectedResult = 3;
// Call the method under test.
int result = ByteUtils.readIntegerFromByte((byte)54, 4, 5);
// Verify the result.
assertThat("Returned int must be equal to 'expectedResult'", result, is(equalTo(expectedResult)));
}
| final void function() { int expectedResult = 3; int result = ByteUtils.readIntegerFromByte((byte)54, 4, 5); assertThat(STR, result, is(equalTo(expectedResult))); } | /**
* Test method for {@link com.digi.xbee.api.utils.ByteUtils#readIntegerFromByte(byte, int, int)}.
*/ | Test method for <code>com.digi.xbee.api.utils.ByteUtils#readIntegerFromByte(byte, int, int)</code> | testReadIntegerFromByteOffsetLengthPlusOffsetBiggerThan8 | {
"repo_name": "digidotcom/XBeeJavaLibrary",
"path": "library/src/test/java/com/digi/xbee/api/utils/ByteUtilsTest.java",
"license": "mpl-2.0",
"size": 36318
} | [
"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; | 379,681 |
public String translate(final String cobolSource)
throws RecognizerException, XsdGenerationException {
if (_log.isDebugEnabled()) {
debug("Translating with options:", getModel().toString());
}
return xsdToString(emitXsd(toModel(cobolSource)));
}
| String function(final String cobolSource) throws RecognizerException, XsdGenerationException { if (_log.isDebugEnabled()) { debug(STR, getModel().toString()); } return xsdToString(emitXsd(toModel(cobolSource))); } | /**
* Execute the translation from COBOL to XML Schema.
*
* @param cobolSource the COBOL source code
* @return the XML Schema
* @throws RecognizerException if COBOL recognition fails
* @throws XsdGenerationException if XML schema generation process fails
*/ | Execute the translation from COBOL to XML Schema | translate | {
"repo_name": "raihaan05/legstar-cob2xsd",
"path": "src/main/java/com/legstar/cob2xsd/Cob2Xsd.java",
"license": "lgpl-2.1",
"size": 20885
} | [
"com.legstar.antlr.RecognizerException"
] | import com.legstar.antlr.RecognizerException; | import com.legstar.antlr.*; | [
"com.legstar.antlr"
] | com.legstar.antlr; | 1,503,671 |
@SuppressForbidden(reason = "needs JarFile for speed, just reading entries")
public static void checkJarHell(URL urls[]) throws URISyntaxException, IOException {
Logger logger = Loggers.getLogger(JarHell.class);
// we don't try to be sneaky and use deprecated/internal/not portable stuff
// like sun.boot.class.path, and with jigsaw we don't yet have a way to get
// a "list" at all. So just exclude any elements underneath the java home
String javaHome = System.getProperty("java.home");
logger.debug("java.home: {}", javaHome);
final Map<String,Path> clazzes = new HashMap<>(32768);
Set<Path> seenJars = new HashSet<>();
for (final URL url : urls) {
final Path path = PathUtils.get(url.toURI());
// exclude system resources
if (path.startsWith(javaHome)) {
logger.debug("excluding system resource: {}", path);
continue;
}
if (path.toString().endsWith(".jar")) {
if (!seenJars.add(path)) {
logger.debug("excluding duplicate classpath element: {}", path);
continue;
}
logger.debug("examining jar: {}", path);
try (JarFile file = new JarFile(path.toString())) {
Manifest manifest = file.getManifest();
if (manifest != null) {
checkManifest(manifest, path);
}
// inspect entries
Enumeration<JarEntry> elements = file.entries();
while (elements.hasMoreElements()) {
String entry = elements.nextElement().getName();
if (entry.endsWith(".class")) {
// for jar format, the separator is defined as /
entry = entry.replace('/', '.').substring(0, entry.length() - 6);
checkClass(clazzes, entry, path);
}
}
} | @SuppressForbidden(reason = STR) static void function(URL urls[]) throws URISyntaxException, IOException { Logger logger = Loggers.getLogger(JarHell.class); String javaHome = System.getProperty(STR); logger.debug(STR, javaHome); final Map<String,Path> clazzes = new HashMap<>(32768); Set<Path> seenJars = new HashSet<>(); for (final URL url : urls) { final Path path = PathUtils.get(url.toURI()); if (path.startsWith(javaHome)) { logger.debug(STR, path); continue; } if (path.toString().endsWith(".jar")) { if (!seenJars.add(path)) { logger.debug(STR, path); continue; } logger.debug(STR, path); try (JarFile file = new JarFile(path.toString())) { Manifest manifest = file.getManifest(); if (manifest != null) { checkManifest(manifest, path); } Enumeration<JarEntry> elements = file.entries(); while (elements.hasMoreElements()) { String entry = elements.nextElement().getName(); if (entry.endsWith(STR)) { entry = entry.replace('/', '.').substring(0, entry.length() - 6); checkClass(clazzes, entry, path); } } } | /**
* Checks the set of URLs for duplicate classes
* @throws IllegalStateException if jar hell was found
*/ | Checks the set of URLs for duplicate classes | checkJarHell | {
"repo_name": "wuranbo/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/bootstrap/JarHell.java",
"license": "apache-2.0",
"size": 12928
} | [
"java.io.IOException",
"java.net.URISyntaxException",
"java.nio.file.Path",
"java.util.Enumeration",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.jar.JarEntry",
"java.util.jar.JarFile",
"java.util.jar.Manifest",
"org.apache.logging.log4j.Logger",
"org.elasticsearch.common.SuppressForbidden",
"org.elasticsearch.common.io.PathUtils",
"org.elasticsearch.common.logging.Loggers"
] | import java.io.IOException; import java.net.URISyntaxException; import java.nio.file.Path; import java.util.Enumeration; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.jar.JarEntry; import java.util.jar.JarFile; import java.util.jar.Manifest; import org.apache.logging.log4j.Logger; import org.elasticsearch.common.SuppressForbidden; import org.elasticsearch.common.io.PathUtils; import org.elasticsearch.common.logging.Loggers; | import java.io.*; import java.net.*; import java.nio.file.*; import java.util.*; import java.util.jar.*; import org.apache.logging.log4j.*; import org.elasticsearch.common.*; import org.elasticsearch.common.io.*; import org.elasticsearch.common.logging.*; | [
"java.io",
"java.net",
"java.nio",
"java.util",
"org.apache.logging",
"org.elasticsearch.common"
] | java.io; java.net; java.nio; java.util; org.apache.logging; org.elasticsearch.common; | 2,397,073 |
if (parsedFormatInfo != null) {
return parsedFormatInfo;
}
// Read top-left format info bits
int formatInfoBits1 = 0;
for (int i = 0; i < 6; i++) {
formatInfoBits1 = copyBit(i, 8, formatInfoBits1);
}
// .. and skip a bit in the timing pattern ...
formatInfoBits1 = copyBit(7, 8, formatInfoBits1);
formatInfoBits1 = copyBit(8, 8, formatInfoBits1);
formatInfoBits1 = copyBit(8, 7, formatInfoBits1);
// .. and skip a bit in the timing pattern ...
for (int j = 5; j >= 0; j--) {
formatInfoBits1 = copyBit(8, j, formatInfoBits1);
}
// Read the top-right/bottom-left pattern too
int dimension = bitMatrix.getHeight();
int formatInfoBits2 = 0;
int jMin = dimension - 7;
for (int j = dimension - 1; j >= jMin; j--) {
formatInfoBits2 = copyBit(8, j, formatInfoBits2);
}
for (int i = dimension - 8; i < dimension; i++) {
formatInfoBits2 = copyBit(i, 8, formatInfoBits2);
}
parsedFormatInfo = FormatInformation.decodeFormatInformation(
formatInfoBits1, formatInfoBits2);
if (parsedFormatInfo != null) {
return parsedFormatInfo;
}
throw FormatException.getFormatInstance();
} | if (parsedFormatInfo != null) { return parsedFormatInfo; } int formatInfoBits1 = 0; for (int i = 0; i < 6; i++) { formatInfoBits1 = copyBit(i, 8, formatInfoBits1); } formatInfoBits1 = copyBit(7, 8, formatInfoBits1); formatInfoBits1 = copyBit(8, 8, formatInfoBits1); formatInfoBits1 = copyBit(8, 7, formatInfoBits1); for (int j = 5; j >= 0; j--) { formatInfoBits1 = copyBit(8, j, formatInfoBits1); } int dimension = bitMatrix.getHeight(); int formatInfoBits2 = 0; int jMin = dimension - 7; for (int j = dimension - 1; j >= jMin; j--) { formatInfoBits2 = copyBit(8, j, formatInfoBits2); } for (int i = dimension - 8; i < dimension; i++) { formatInfoBits2 = copyBit(i, 8, formatInfoBits2); } parsedFormatInfo = FormatInformation.decodeFormatInformation( formatInfoBits1, formatInfoBits2); if (parsedFormatInfo != null) { return parsedFormatInfo; } throw FormatException.getFormatInstance(); } | /**
* <p>
* Reads format information from one of its two locations within the QR
* Code.
* </p>
*
* @return {@link FormatInformation} encapsulating the QR Code's format info
* @throws FormatException
* if both format information locations cannot be parsed as the
* valid encoding of format information
*/ | Reads format information from one of its two locations within the QR Code. | readFormatInformation | {
"repo_name": "Tinker-S/FaceBarCodeDemo",
"path": "src/com/google/zxing/qrcode/decoder/BitMatrixParser.java",
"license": "apache-2.0",
"size": 8013
} | [
"com.google.zxing.FormatException"
] | import com.google.zxing.FormatException; | import com.google.zxing.*; | [
"com.google.zxing"
] | com.google.zxing; | 1,610,139 |
public Class<?> findType(String typeName) throws EvaluationException {
String nameToLookup = typeName;
try {
return ClassUtils.forName(nameToLookup, this.classLoader);
}
catch (ClassNotFoundException ey) {
// try any registered prefixes before giving up
}
for (String prefix : this.knownPackagePrefixes) {
try {
nameToLookup = prefix + "." + typeName;
return ClassUtils.forName(nameToLookup, this.classLoader);
}
catch (ClassNotFoundException ex) {
// might be a different prefix
}
}
throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName);
} | Class<?> function(String typeName) throws EvaluationException { String nameToLookup = typeName; try { return ClassUtils.forName(nameToLookup, this.classLoader); } catch (ClassNotFoundException ey) { } for (String prefix : this.knownPackagePrefixes) { try { nameToLookup = prefix + "." + typeName; return ClassUtils.forName(nameToLookup, this.classLoader); } catch (ClassNotFoundException ex) { } } throw new SpelEvaluationException(SpelMessage.TYPE_NOT_FOUND, typeName); } | /**
* Find a (possibly unqualified) type reference - first using the type name as-is,
* then trying any registered prefixes if the type name cannot be found.
* @param typeName the type to locate
* @return the class object for the type
* @throws EvaluationException if the type cannot be found
*/ | Find a (possibly unqualified) type reference - first using the type name as-is, then trying any registered prefixes if the type name cannot be found | findType | {
"repo_name": "deathspeeder/class-guard",
"path": "spring-framework-3.2.x/spring-expression/src/main/java/org/springframework/expression/spel/support/StandardTypeLocator.java",
"license": "gpl-2.0",
"size": 3739
} | [
"org.springframework.expression.EvaluationException",
"org.springframework.expression.spel.SpelEvaluationException",
"org.springframework.expression.spel.SpelMessage",
"org.springframework.util.ClassUtils"
] | import org.springframework.expression.EvaluationException; import org.springframework.expression.spel.SpelEvaluationException; import org.springframework.expression.spel.SpelMessage; import org.springframework.util.ClassUtils; | import org.springframework.expression.*; import org.springframework.expression.spel.*; import org.springframework.util.*; | [
"org.springframework.expression",
"org.springframework.util"
] | org.springframework.expression; org.springframework.util; | 2,137,151 |
public ImageTranscoder getTestImageTranscoder(){
ImageTranscoder t = new InternalPNGTranscoder();
t.addTranscodingHint(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE,
Boolean.FALSE);
t.addTranscodingHint(PNGTranscoder.KEY_BACKGROUND_COLOR,
new Color(0,0,0,0));
t.addTranscodingHint(PNGTranscoder.KEY_EXECUTE_ONLOAD,
Boolean.TRUE);
if (validate){
t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_VALIDATING,
Boolean.TRUE);
t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME,
VALIDATING_PARSER);
}
if (userLanguage != null){
t.addTranscodingHint(PNGTranscoder.KEY_LANGUAGE,
userLanguage);
}
return t;
} | ImageTranscoder function(){ ImageTranscoder t = new InternalPNGTranscoder(); t.addTranscodingHint(PNGTranscoder.KEY_FORCE_TRANSPARENT_WHITE, Boolean.FALSE); t.addTranscodingHint(PNGTranscoder.KEY_BACKGROUND_COLOR, new Color(0,0,0,0)); t.addTranscodingHint(PNGTranscoder.KEY_EXECUTE_ONLOAD, Boolean.TRUE); if (validate){ t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_VALIDATING, Boolean.TRUE); t.addTranscodingHint(PNGTranscoder.KEY_XML_PARSER_CLASSNAME, VALIDATING_PARSER); } if (userLanguage != null){ t.addTranscodingHint(PNGTranscoder.KEY_LANGUAGE, userLanguage); } return t; } | /**
* Returns the <code>ImageTranscoder</code> the Test should
* use
*/ | Returns the <code>ImageTranscoder</code> the Test should use | getTestImageTranscoder | {
"repo_name": "apache/batik",
"path": "batik-test-svg/src/main/java/org/apache/batik/test/svg/SVGRenderingAccuracyTest.java",
"license": "apache-2.0",
"size": 7868
} | [
"java.awt.Color",
"org.apache.batik.transcoder.image.ImageTranscoder",
"org.apache.batik.transcoder.image.PNGTranscoder"
] | import java.awt.Color; import org.apache.batik.transcoder.image.ImageTranscoder; import org.apache.batik.transcoder.image.PNGTranscoder; | import java.awt.*; import org.apache.batik.transcoder.image.*; | [
"java.awt",
"org.apache.batik"
] | java.awt; org.apache.batik; | 406,705 |
private List<AbstractBulkAction<? extends BaseDto, ? extends BaseFilter>> getEnabledActionsForDto(Class<? extends BaseDto> dtoClass) {
return pluginExecutors
.getPlugins()
.stream()
.filter(enabledEvaluator::isEnabled)
.filter(action -> !action.isDisabled())
.filter(action -> !action.isGeneric()) // Generic actions are not supported for DTO now.
.filter(action -> dtoClass.equals(action.getDtoClass()))
.collect(Collectors.toList());
}
| List<AbstractBulkAction<? extends BaseDto, ? extends BaseFilter>> function(Class<? extends BaseDto> dtoClass) { return pluginExecutors .getPlugins() .stream() .filter(enabledEvaluator::isEnabled) .filter(action -> !action.isDisabled()) .filter(action -> !action.isGeneric()) .filter(action -> dtoClass.equals(action.getDtoClass())) .collect(Collectors.toList()); } | /**
* Get enabled actions
*
* @param entity
* @return
*/ | Get enabled actions | getEnabledActionsForDto | {
"repo_name": "bcvsolutions/CzechIdMng",
"path": "Realization/backend/core/core-impl/src/main/java/eu/bcvsolutions/idm/core/bulk/action/impl/DefaultBulkActionManager.java",
"license": "mit",
"size": 17008
} | [
"eu.bcvsolutions.idm.core.api.bulk.action.AbstractBulkAction",
"eu.bcvsolutions.idm.core.api.dto.BaseDto",
"eu.bcvsolutions.idm.core.api.dto.filter.BaseFilter",
"java.util.List",
"java.util.stream.Collectors"
] | import eu.bcvsolutions.idm.core.api.bulk.action.AbstractBulkAction; import eu.bcvsolutions.idm.core.api.dto.BaseDto; import eu.bcvsolutions.idm.core.api.dto.filter.BaseFilter; import java.util.List; import java.util.stream.Collectors; | import eu.bcvsolutions.idm.core.api.bulk.action.*; import eu.bcvsolutions.idm.core.api.dto.*; import eu.bcvsolutions.idm.core.api.dto.filter.*; import java.util.*; import java.util.stream.*; | [
"eu.bcvsolutions.idm",
"java.util"
] | eu.bcvsolutions.idm; java.util; | 2,522,987 |
private void checkDefaultDisplayMode()
{
Integer value = (Integer) ImViewerAgent.getRegistry().lookup(
LookupNames.DATA_DISPLAY);
if (value == null) setDisplayMode(LookupNames.EXPERIMENTER_DISPLAY);
else setDisplayMode(value.intValue());
}
| void function() { Integer value = (Integer) ImViewerAgent.getRegistry().lookup( LookupNames.DATA_DISPLAY); if (value == null) setDisplayMode(LookupNames.EXPERIMENTER_DISPLAY); else setDisplayMode(value.intValue()); } | /**
* Invokes the value is not set.
*/ | Invokes the value is not set | checkDefaultDisplayMode | {
"repo_name": "stelfrich/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/agents/imviewer/view/ImViewerModel.java",
"license": "gpl-2.0",
"size": 80456
} | [
"org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent",
"org.openmicroscopy.shoola.env.LookupNames"
] | import org.openmicroscopy.shoola.agents.imviewer.ImViewerAgent; import org.openmicroscopy.shoola.env.LookupNames; | import org.openmicroscopy.shoola.agents.imviewer.*; import org.openmicroscopy.shoola.env.*; | [
"org.openmicroscopy.shoola"
] | org.openmicroscopy.shoola; | 591,997 |
protected void registerRoutes() {
boolean hideApiKey;
String apiKeyName;
String apiKeyType = settings.getString("swagger.ui.apiKeyType", "header");
if ("none".equals(apiKeyType)) {
apiKeyName = "";
hideApiKey = true;
} else {
hideApiKey = settings.getBoolean("swagger.ui.hideApiKey", false);
apiKeyName = settings.getString("swagger.ui.apiKeyName", RequireToken.DEFAULT);
}
// Swagger UI route
String swaggerPath = settings.getString("swagger.ui.path", "/api");
String swaggerTemplate = settings.getString("swagger.ui.template", "swagger/index");
GET(swaggerPath, (ctx) -> {
ctx.setLocal("apiTitle", settings.getString("swagger.api.title", settings.getApplicationName()));
ctx.setLocal("bannerText", settings.getString("swagger.ui.bannerText", "swagger"));
ctx.setLocal("swaggerPath", StringUtils.removeStart(swaggerPath, "/"));
ctx.setLocal("hideApiKey", hideApiKey);
ctx.setLocal("apiKeyName", apiKeyName);
ctx.setLocal("apiKeyType", apiKeyType);
// Get the current account and it's first token, might be guest and/or may have no tokens
Account session = ctx.getSession(AuthConstants.ACCOUNT_ATTRIBUTE);
Account local = ctx.getLocal(AuthConstants.ACCOUNT_ATTRIBUTE);
Account account = Optional.fromNullable(session).or(Optional.fromNullable(local).or(Account.GUEST));
ctx.setLocal("apiKey", Optional.fromNullable(account.getToken()).or(""));
ctx.render(swaggerTemplate);
});
// Swagger specification routes
for (String filename : specifications.keySet()) {
String specPath = Joiner.on("/").join(swaggerPath, filename);
HEAD(specPath, (ctx) -> serveSpecification(ctx, filename));
GET(specPath, (ctx) -> serveSpecification(ctx, filename));
}
// Register a WebJars Route if we don't already have one
String webJarsUri = router.uriPatternFor(WebjarsResourceHandler.class);
if (webJarsUri == null) {
WebjarsResourceHandler webjars = new WebjarsResourceHandler();
router.addRoute(new Route(HttpMethod.GET, webjars.getUriPattern(), webjars));
}
} | void function() { boolean hideApiKey; String apiKeyName; String apiKeyType = settings.getString(STR, STR); if ("none".equals(apiKeyType)) { apiKeyName = STRswagger.ui.hideApiKeySTRswagger.ui.apiKeyNameSTRswagger.ui.pathSTR/apiSTRswagger.ui.templateSTRswagger/indexSTRapiTitleSTRswagger.api.titleSTRbannerTextSTRswagger.ui.bannerTextSTRswaggerSTRswaggerPathSTR/STRhideApiKeySTRapiKeyNameSTRapiKeyTypeSTRapiKeySTRSTR/").join(swaggerPath, filename); HEAD(specPath, (ctx) -> serveSpecification(ctx, filename)); GET(specPath, (ctx) -> serveSpecification(ctx, filename)); } String webJarsUri = router.uriPatternFor(WebjarsResourceHandler.class); if (webJarsUri == null) { WebjarsResourceHandler webjars = new WebjarsResourceHandler(); router.addRoute(new Route(HttpMethod.GET, webjars.getUriPattern(), webjars)); } } | /**
* Register the Routes for serving the Swagger UI and generated specifications.
*/ | Register the Routes for serving the Swagger UI and generated specifications | registerRoutes | {
"repo_name": "gitblit/fathom",
"path": "fathom-rest-swagger/src/main/java/fathom/rest/swagger/SwaggerService.java",
"license": "apache-2.0",
"size": 8183
} | [
"ro.pippo.core.route.Route",
"ro.pippo.core.route.WebjarsResourceHandler"
] | import ro.pippo.core.route.Route; import ro.pippo.core.route.WebjarsResourceHandler; | import ro.pippo.core.route.*; | [
"ro.pippo.core"
] | ro.pippo.core; | 293,694 |
OffsetDateTime nextRunTime(); | OffsetDateTime nextRunTime(); | /**
* Gets the nextRunTime property: The next run time based on customer's settings.
*
* @return the nextRunTime value.
*/ | Gets the nextRunTime property: The next run time based on customer's settings | nextRunTime | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/customerinsights/azure-resourcemanager-customerinsights/src/main/java/com/azure/resourcemanager/customerinsights/models/ConnectorMappingResourceFormat.java",
"license": "mit",
"size": 12904
} | [
"java.time.OffsetDateTime"
] | import java.time.OffsetDateTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,573,440 |
@Nonnull
public ProvisioningObjectSummaryCollectionRequest select(@Nonnull final String value) {
addSelectOption(value);
return this;
} | ProvisioningObjectSummaryCollectionRequest function(@Nonnull final String value) { addSelectOption(value); return this; } | /**
* Sets the select clause for the request
*
* @param value the select clause
* @return the updated request
*/ | Sets the select clause for the request | select | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/ProvisioningObjectSummaryCollectionRequest.java",
"license": "mit",
"size": 6263
} | [
"com.microsoft.graph.requests.ProvisioningObjectSummaryCollectionRequest",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.requests.ProvisioningObjectSummaryCollectionRequest; import javax.annotation.Nonnull; | import com.microsoft.graph.requests.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 1,455,904 |
public String checkinVersion(RuleAsset asset) throws SerializableException; | String function(RuleAsset asset) throws SerializableException; | /**
* This checks in a new version of an asset.
* @return the UUID of the asset you are checking in,
* null if there was some problem (and an exception was not thrown).
*/ | This checks in a new version of an asset | checkinVersion | {
"repo_name": "bobmcwhirter/drools",
"path": "drools-guvnor/src/main/java/org/drools/guvnor/client/rpc/RepositoryService.java",
"license": "apache-2.0",
"size": 16424
} | [
"com.google.gwt.user.client.rpc.SerializableException"
] | import com.google.gwt.user.client.rpc.SerializableException; | import com.google.gwt.user.client.rpc.*; | [
"com.google.gwt"
] | com.google.gwt; | 755,740 |
public static int getId(Effect effect) {
Preconditions.checkArgument(effect.getType() == Effect.Type.VISUAL, "Effect must be visual to have a particle!");
return getParticle(effect).getId();
} | static int function(Effect effect) { Preconditions.checkArgument(effect.getType() == Effect.Type.VISUAL, STR); return getParticle(effect).getId(); } | /**
* Get the particle id for a specified {@link Effect}.
*
* @param effect the effect.
* @return the particle id.
*/ | Get the particle id for a specified <code>Effect</code> | getId | {
"repo_name": "GlowstonePlusPlus/GlowstonePlusPlus",
"path": "src/main/java/net/glowstone/constants/GlowParticle.java",
"license": "mit",
"size": 11631
} | [
"com.google.common.base.Preconditions",
"org.bukkit.Effect"
] | import com.google.common.base.Preconditions; import org.bukkit.Effect; | import com.google.common.base.*; import org.bukkit.*; | [
"com.google.common",
"org.bukkit"
] | com.google.common; org.bukkit; | 2,464,923 |
public List<String> getSuggestions() {
if (suggestionsSorted || !hasSuggestionBase()) {
return suggestions;
}
suggestions.sort(new LevenshteinComparator(getSuggestionBase()));
suggestionsSorted = true;
return suggestions;
} | List<String> function() { if (suggestionsSorted !hasSuggestionBase()) { return suggestions; } suggestions.sort(new LevenshteinComparator(getSuggestionBase())); suggestionsSorted = true; return suggestions; } | /**
* Returns a list of suggestions.
* <p/>
* If a {@link #getSuggestionBase() suggestion-base} has been set, the suggestions will be
* sorted according to the suggestion-base such that suggestions close to the base appear
* first in the list.
*
* @return a list of suggestions, or the empty list if there are no suggestions available.
*/ | Returns a list of suggestions. If a <code>#getSuggestionBase() suggestion-base</code> has been set, the suggestions will be sorted according to the suggestion-base such that suggestions close to the base appear first in the list | getSuggestions | {
"repo_name": "patrox/dropwizard",
"path": "dropwizard-configuration/src/main/java/io/dropwizard/configuration/ConfigurationParsingException.java",
"license": "apache-2.0",
"size": 13192
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,703,133 |
public void analyseImpact(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String input[], String output[], RowMetaInterface info) throws KettleStepException
{
}
| void function(List<DatabaseImpact> impact, TransMeta transMeta, StepMeta stepMeta, RowMetaInterface prev, String input[], String output[], RowMetaInterface info) throws KettleStepException { } | /**
* Each step must be able to report on the impact it has on a database, table field, etc.
* @param impact The list of impacts @see org.pentaho.di.transMeta.DatabaseImpact
* @param transMeta The transformation information
* @param stepMeta The step information
* @param prev The fields entering this step
* @param input The previous step names
* @param output The output step names
* @param info The fields used as information by this step
*/ | Each step must be able to report on the impact it has on a database, table field, etc | analyseImpact | {
"repo_name": "yintaoxue/read-open-source-code",
"path": "kettle4.3/src/org/pentaho/di/trans/step/BaseStepMeta.java",
"license": "apache-2.0",
"size": 20554
} | [
"java.util.List",
"org.pentaho.di.core.exception.KettleStepException",
"org.pentaho.di.core.row.RowMetaInterface",
"org.pentaho.di.trans.DatabaseImpact",
"org.pentaho.di.trans.TransMeta"
] | import java.util.List; import org.pentaho.di.core.exception.KettleStepException; import org.pentaho.di.core.row.RowMetaInterface; import org.pentaho.di.trans.DatabaseImpact; import org.pentaho.di.trans.TransMeta; | import java.util.*; import org.pentaho.di.core.exception.*; import org.pentaho.di.core.row.*; import org.pentaho.di.trans.*; | [
"java.util",
"org.pentaho.di"
] | java.util; org.pentaho.di; | 2,276,124 |
default Offset<Byte> byLessThan(Byte value) {
return Assertions.byLessThan(value);
} | default Offset<Byte> byLessThan(Byte value) { return Assertions.byLessThan(value); } | /**
* Assertions entry point for Byte {@link Offset} to use with isCloseTo assertions.
* <p>
* Typical usage :
* <pre><code class='java'> assertThat((byte) 10).isCloseTo((byte) 11, byLessThan((byte) 1));</code></pre>
*
* @param value the value of the offset.
* @return the created {@code Offset}.
* @throws NullPointerException if the given value is {@code null}.
* @throws IllegalArgumentException if the given value is negative.
* @since 3.9.0
*/ | Assertions entry point for Byte <code>Offset</code> to use with isCloseTo assertions. Typical usage : <code> assertThat((byte) 10).isCloseTo((byte) 11, byLessThan((byte) 1));</code></code> | byLessThan | {
"repo_name": "ChrisA89/assertj-core",
"path": "src/main/java/org/assertj/core/api/WithAssertions.java",
"license": "apache-2.0",
"size": 102131
} | [
"org.assertj.core.data.Offset"
] | import org.assertj.core.data.Offset; | import org.assertj.core.data.*; | [
"org.assertj.core"
] | org.assertj.core; | 242,329 |
public int getScale(int column) throws SQLException {
checkColumn(column);
return columnMetaData[--column].scale;
} | int function(int column) throws SQLException { checkColumn(column); return columnMetaData[--column].scale; } | /**
* <!-- start generic documentation -->
* Gets the designated column's number of digits to right of the
* decimal point. <p>
* <!-- end generic documentation -->
*
* <!-- start Release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with 1.8.0, HSQLDB reports the declared
* scale for table columns depending on the value of the database
* property: <p>
*
* <pre>
* sql.enforce_strict_size
* </pre>
*
* </div>
* <!-- end release-specific documentation -->
*
* @param column the first column is 1, the second is 2, ...
* @return scale
* @exception SQLException if a database access error occurs
*/ | Gets the designated column's number of digits to right of the decimal point. HSQLDB-Specific Information: Starting with 1.8.0, HSQLDB reports the declared scale for table columns depending on the value of the database property: <code> sql.enforce_strict_size </code> | getScale | {
"repo_name": "proudh0n/emergencymasta",
"path": "hsqldb/src/org/hsqldb/jdbc/jdbcResultSetMetaData.java",
"license": "gpl-2.0",
"size": 45184
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,672,609 |
public void addImageCache(FragmentManager fragmentManager,
ImageCache.ImageCacheParams cacheParams) {
mImageCacheParams = cacheParams;
mImageCache = ImageCache.getInstance(fragmentManager, mImageCacheParams);
new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE);
} | void function(FragmentManager fragmentManager, ImageCache.ImageCacheParams cacheParams) { mImageCacheParams = cacheParams; mImageCache = ImageCache.getInstance(fragmentManager, mImageCacheParams); new CacheAsyncTask().execute(MESSAGE_INIT_DISK_CACHE); } | /**
* Adds an {@link se.kth.prodreal.dumbdevices.dumbdisplayhelper.util.ImageCache} to this {@link se.kth.prodreal.dumbdevices.dumbdisplayhelper.util.ImageWorkerLocal} to handle disk and memory bitmap
* caching.
* @param fragmentManager
* @param cacheParams The cache parameters to use for the image cache.
*/ | Adds an <code>se.kth.prodreal.dumbdevices.dumbdisplayhelper.util.ImageCache</code> to this <code>se.kth.prodreal.dumbdevices.dumbdisplayhelper.util.ImageWorkerLocal</code> to handle disk and memory bitmap caching | addImageCache | {
"repo_name": "hahnjas/DumbDisplayDriver",
"path": "Application/src/main/java/se/kth/prodreal/dumbdevices/dumbdisplayhelper/util/ImageWorkerLocal.java",
"license": "apache-2.0",
"size": 17551
} | [
"android.support.v4.app.FragmentManager"
] | import android.support.v4.app.FragmentManager; | import android.support.v4.app.*; | [
"android.support"
] | android.support; | 188,782 |
public static void setActiveServerManagedPlayIDs(String setIntString)
{
Set<Integer> receivedSet = MapListHelper.deserializeIntegerSet(setIntString);
activeServerManagedPlayIDs.addAll(receivedSet);
activeServerManagedPlayIDs.removeIf(playID -> !receivedSet.contains(playID));
} | static void function(String setIntString) { Set<Integer> receivedSet = MapListHelper.deserializeIntegerSet(setIntString); activeServerManagedPlayIDs.addAll(receivedSet); activeServerManagedPlayIDs.removeIf(playID -> !receivedSet.contains(playID)); } | /**
* Update the active play IDs without replacing the collection instance.
* @param setIntString serialized set
*/ | Update the active play IDs without replacing the collection instance | setActiveServerManagedPlayIDs | {
"repo_name": "Aeronica/mxTune",
"path": "src/main/java/net/aeronica/mods/mxtune/managers/GroupHelper.java",
"license": "apache-2.0",
"size": 11588
} | [
"java.util.Set",
"net.aeronica.mods.mxtune.util.MapListHelper"
] | import java.util.Set; import net.aeronica.mods.mxtune.util.MapListHelper; | import java.util.*; import net.aeronica.mods.mxtune.util.*; | [
"java.util",
"net.aeronica.mods"
] | java.util; net.aeronica.mods; | 2,615,536 |
private void disableAndShutdownHost(Connection conn, Host host) throws BadServerResponse, XenAPIException, XmlRpcException {
host.disable(conn);
host.shutdown(conn);
}
| void function(Connection conn, Host host) throws BadServerResponse, XenAPIException, XmlRpcException { host.disable(conn); host.shutdown(conn); } | /**
* Disables the host (using {@link Host#disable(Connection)}) and shuts it down
* using the {@link Host#shutdown(Connection)} method.
*/ | Disables the host (using <code>Host#disable(Connection)</code>) and shuts it down using the <code>Host#shutdown(Connection)</code> method | disableAndShutdownHost | {
"repo_name": "rafaelweingartner/autonomiccs-platform",
"path": "autonomic-administration-plugin/src/main/java/br/com/autonomiccs/autonomic/administration/plugin/hypervisors/xenserver/XenHypervisor.java",
"license": "apache-2.0",
"size": 8725
} | [
"com.xensource.xenapi.Connection",
"com.xensource.xenapi.Host",
"com.xensource.xenapi.Types",
"org.apache.xmlrpc.XmlRpcException"
] | import com.xensource.xenapi.Connection; import com.xensource.xenapi.Host; import com.xensource.xenapi.Types; import org.apache.xmlrpc.XmlRpcException; | import com.xensource.xenapi.*; import org.apache.xmlrpc.*; | [
"com.xensource.xenapi",
"org.apache.xmlrpc"
] | com.xensource.xenapi; org.apache.xmlrpc; | 1,193,855 |
public void testStateRecoveryWithTopologyChange(int scaleType) throws Exception {
Tuple2<JobVertexID, OperatorID> id1 = generateIDPair();
Tuple2<JobVertexID, OperatorID> id2 = generateIDPair();
int parallelism1 = 10;
int maxParallelism1 = 64;
Tuple2<JobVertexID, OperatorID> id3 = generateIDPair();
Tuple2<JobVertexID, OperatorID> id4 = generateIDPair();
int parallelism2 = 10;
int maxParallelism2 = 64;
List<KeyGroupRange> keyGroupPartitions2 =
StateAssignmentOperation.createKeyGroupPartitions(maxParallelism2, parallelism2);
Map<OperatorID, OperatorState> operatorStates = new HashMap<>();
//prepare vertex1 state
for (Tuple2<JobVertexID, OperatorID> id : Arrays.asList(id1, id2)) {
OperatorState taskState = new OperatorState(id.f1, parallelism1, maxParallelism1);
operatorStates.put(id.f1, taskState);
for (int index = 0; index < taskState.getParallelism(); index++) {
OperatorStateHandle subManagedOperatorState =
generatePartitionableStateHandle(id.f0, index, 2, 8, false);
OperatorStateHandle subRawOperatorState =
generatePartitionableStateHandle(id.f0, index, 2, 8, true);
OperatorSubtaskState subtaskState = new OperatorSubtaskState(
subManagedOperatorState,
subRawOperatorState,
null,
null);
taskState.putState(index, subtaskState);
}
}
List<List<ChainedStateHandle<OperatorStateHandle>>> expectedManagedOperatorStates = new ArrayList<>();
List<List<ChainedStateHandle<OperatorStateHandle>>> expectedRawOperatorStates = new ArrayList<>();
//prepare vertex2 state
for (Tuple2<JobVertexID, OperatorID> id : Arrays.asList(id3, id4)) {
OperatorState operatorState = new OperatorState(id.f1, parallelism2, maxParallelism2);
operatorStates.put(id.f1, operatorState);
List<ChainedStateHandle<OperatorStateHandle>> expectedManagedOperatorState = new ArrayList<>();
List<ChainedStateHandle<OperatorStateHandle>> expectedRawOperatorState = new ArrayList<>();
expectedManagedOperatorStates.add(expectedManagedOperatorState);
expectedRawOperatorStates.add(expectedRawOperatorState);
for (int index = 0; index < operatorState.getParallelism(); index++) {
OperatorStateHandle subManagedOperatorState =
generateChainedPartitionableStateHandle(id.f0, index, 2, 8, false)
.get(0);
OperatorStateHandle subRawOperatorState =
generateChainedPartitionableStateHandle(id.f0, index, 2, 8, true)
.get(0);
KeyGroupsStateHandle subManagedKeyedState = id.f0.equals(id3.f0)
? generateKeyGroupState(id.f0, keyGroupPartitions2.get(index), false)
: null;
KeyGroupsStateHandle subRawKeyedState = id.f0.equals(id3.f0)
? generateKeyGroupState(id.f0, keyGroupPartitions2.get(index), true)
: null;
expectedManagedOperatorState.add(ChainedStateHandle.wrapSingleHandle(subManagedOperatorState));
expectedRawOperatorState.add(ChainedStateHandle.wrapSingleHandle(subRawOperatorState));
OperatorSubtaskState subtaskState = new OperatorSubtaskState(
subManagedOperatorState,
subRawOperatorState,
subManagedKeyedState,
subRawKeyedState);
operatorState.putState(index, subtaskState);
}
}
Tuple2<JobVertexID, OperatorID> id5 = generateIDPair();
int newParallelism1 = 10;
Tuple2<JobVertexID, OperatorID> id6 = generateIDPair();
int newParallelism2 = parallelism2;
if (scaleType == 0) {
newParallelism2 = 20;
} else if (scaleType == 1) {
newParallelism2 = 8;
}
List<KeyGroupRange> newKeyGroupPartitions2 =
StateAssignmentOperation.createKeyGroupPartitions(maxParallelism2, newParallelism2);
final ExecutionJobVertex newJobVertex1 = mockExecutionJobVertex(
id5.f0,
Arrays.asList(id2.f1, id1.f1, id5.f1),
newParallelism1,
maxParallelism1);
final ExecutionJobVertex newJobVertex2 = mockExecutionJobVertex(
id3.f0,
Arrays.asList(id6.f1, id3.f1),
newParallelism2,
maxParallelism2);
Map<JobVertexID, ExecutionJobVertex> tasks = new HashMap<>();
tasks.put(id5.f0, newJobVertex1);
tasks.put(id3.f0, newJobVertex2);
JobID jobID = new JobID();
StandaloneCompletedCheckpointStore standaloneCompletedCheckpointStore =
spy(new StandaloneCompletedCheckpointStore(1));
CompletedCheckpoint completedCheckpoint = new CompletedCheckpoint(
jobID,
2,
System.currentTimeMillis(),
System.currentTimeMillis() + 3000,
operatorStates,
Collections.<MasterState>emptyList(),
CheckpointProperties.forCheckpoint(CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION),
new TestCompletedCheckpointStorageLocation());
when(standaloneCompletedCheckpointStore.getLatestCheckpoint(false)).thenReturn(completedCheckpoint);
// set up the coordinator and validate the initial state
CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration(
600000,
600000,
0,
Integer.MAX_VALUE,
CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION,
true,
false,
0);
CheckpointCoordinator coord = new CheckpointCoordinator(
new JobID(),
chkConfig,
newJobVertex1.getTaskVertices(),
newJobVertex1.getTaskVertices(),
newJobVertex1.getTaskVertices(),
new StandaloneCheckpointIDCounter(),
standaloneCompletedCheckpointStore,
new MemoryStateBackend(),
Executors.directExecutor(),
SharedStateRegistry.DEFAULT_FACTORY,
failureManager);
coord.restoreLatestCheckpointedState(tasks, false, true);
for (int i = 0; i < newJobVertex1.getParallelism(); i++) {
final List<OperatorID> operatorIds = newJobVertex1.getOperatorIDs();
JobManagerTaskRestore taskRestore = newJobVertex1.getTaskVertices()[i].getCurrentExecutionAttempt().getTaskRestore();
Assert.assertEquals(2L, taskRestore.getRestoreCheckpointId());
TaskStateSnapshot stateSnapshot = taskRestore.getTaskStateSnapshot();
OperatorSubtaskState headOpState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIds.size() - 1));
assertTrue(headOpState.getManagedKeyedState().isEmpty());
assertTrue(headOpState.getRawKeyedState().isEmpty());
// operator5
{
int operatorIndexInChain = 2;
OperatorSubtaskState opState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain));
assertTrue(opState.getManagedOperatorState().isEmpty());
assertTrue(opState.getRawOperatorState().isEmpty());
}
// operator1
{
int operatorIndexInChain = 1;
OperatorSubtaskState opState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain));
OperatorStateHandle expectedManagedOpState = generatePartitionableStateHandle(
id1.f0, i, 2, 8, false);
OperatorStateHandle expectedRawOpState = generatePartitionableStateHandle(
id1.f0, i, 2, 8, true);
Collection<OperatorStateHandle> managedOperatorState = opState.getManagedOperatorState();
assertEquals(1, managedOperatorState.size());
assertTrue(CommonTestUtils.isStreamContentEqual(expectedManagedOpState.openInputStream(),
managedOperatorState.iterator().next().openInputStream()));
Collection<OperatorStateHandle> rawOperatorState = opState.getRawOperatorState();
assertEquals(1, rawOperatorState.size());
assertTrue(CommonTestUtils.isStreamContentEqual(expectedRawOpState.openInputStream(),
rawOperatorState.iterator().next().openInputStream()));
}
// operator2
{
int operatorIndexInChain = 0;
OperatorSubtaskState opState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain));
OperatorStateHandle expectedManagedOpState = generatePartitionableStateHandle(
id2.f0, i, 2, 8, false);
OperatorStateHandle expectedRawOpState = generatePartitionableStateHandle(
id2.f0, i, 2, 8, true);
Collection<OperatorStateHandle> managedOperatorState = opState.getManagedOperatorState();
assertEquals(1, managedOperatorState.size());
assertTrue(CommonTestUtils.isStreamContentEqual(expectedManagedOpState.openInputStream(),
managedOperatorState.iterator().next().openInputStream()));
Collection<OperatorStateHandle> rawOperatorState = opState.getRawOperatorState();
assertEquals(1, rawOperatorState.size());
assertTrue(CommonTestUtils.isStreamContentEqual(expectedRawOpState.openInputStream(),
rawOperatorState.iterator().next().openInputStream()));
}
}
List<List<Collection<OperatorStateHandle>>> actualManagedOperatorStates = new ArrayList<>(newJobVertex2.getParallelism());
List<List<Collection<OperatorStateHandle>>> actualRawOperatorStates = new ArrayList<>(newJobVertex2.getParallelism());
for (int i = 0; i < newJobVertex2.getParallelism(); i++) {
final List<OperatorID> operatorIds = newJobVertex2.getOperatorIDs();
JobManagerTaskRestore taskRestore = newJobVertex2.getTaskVertices()[i].getCurrentExecutionAttempt().getTaskRestore();
Assert.assertEquals(2L, taskRestore.getRestoreCheckpointId());
TaskStateSnapshot stateSnapshot = taskRestore.getTaskStateSnapshot();
// operator 3
{
int operatorIndexInChain = 1;
OperatorSubtaskState opState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain));
List<Collection<OperatorStateHandle>> actualSubManagedOperatorState = new ArrayList<>(1);
actualSubManagedOperatorState.add(opState.getManagedOperatorState());
List<Collection<OperatorStateHandle>> actualSubRawOperatorState = new ArrayList<>(1);
actualSubRawOperatorState.add(opState.getRawOperatorState());
actualManagedOperatorStates.add(actualSubManagedOperatorState);
actualRawOperatorStates.add(actualSubRawOperatorState);
}
// operator 6
{
int operatorIndexInChain = 0;
OperatorSubtaskState opState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain));
assertTrue(opState.getManagedOperatorState().isEmpty());
assertTrue(opState.getRawOperatorState().isEmpty());
}
KeyGroupsStateHandle originalKeyedStateBackend = generateKeyGroupState(id3.f0, newKeyGroupPartitions2.get(i), false);
KeyGroupsStateHandle originalKeyedStateRaw = generateKeyGroupState(id3.f0, newKeyGroupPartitions2.get(i), true);
OperatorSubtaskState headOpState =
stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIds.size() - 1));
Collection<KeyedStateHandle> keyedStateBackend = headOpState.getManagedKeyedState();
Collection<KeyedStateHandle> keyGroupStateRaw = headOpState.getRawKeyedState();
compareKeyedState(Collections.singletonList(originalKeyedStateBackend), keyedStateBackend);
compareKeyedState(Collections.singletonList(originalKeyedStateRaw), keyGroupStateRaw);
}
comparePartitionableState(expectedManagedOperatorStates.get(0), actualManagedOperatorStates);
comparePartitionableState(expectedRawOperatorStates.get(0), actualRawOperatorStates);
} | void function(int scaleType) throws Exception { Tuple2<JobVertexID, OperatorID> id1 = generateIDPair(); Tuple2<JobVertexID, OperatorID> id2 = generateIDPair(); int parallelism1 = 10; int maxParallelism1 = 64; Tuple2<JobVertexID, OperatorID> id3 = generateIDPair(); Tuple2<JobVertexID, OperatorID> id4 = generateIDPair(); int parallelism2 = 10; int maxParallelism2 = 64; List<KeyGroupRange> keyGroupPartitions2 = StateAssignmentOperation.createKeyGroupPartitions(maxParallelism2, parallelism2); Map<OperatorID, OperatorState> operatorStates = new HashMap<>(); for (Tuple2<JobVertexID, OperatorID> id : Arrays.asList(id1, id2)) { OperatorState taskState = new OperatorState(id.f1, parallelism1, maxParallelism1); operatorStates.put(id.f1, taskState); for (int index = 0; index < taskState.getParallelism(); index++) { OperatorStateHandle subManagedOperatorState = generatePartitionableStateHandle(id.f0, index, 2, 8, false); OperatorStateHandle subRawOperatorState = generatePartitionableStateHandle(id.f0, index, 2, 8, true); OperatorSubtaskState subtaskState = new OperatorSubtaskState( subManagedOperatorState, subRawOperatorState, null, null); taskState.putState(index, subtaskState); } } List<List<ChainedStateHandle<OperatorStateHandle>>> expectedManagedOperatorStates = new ArrayList<>(); List<List<ChainedStateHandle<OperatorStateHandle>>> expectedRawOperatorStates = new ArrayList<>(); for (Tuple2<JobVertexID, OperatorID> id : Arrays.asList(id3, id4)) { OperatorState operatorState = new OperatorState(id.f1, parallelism2, maxParallelism2); operatorStates.put(id.f1, operatorState); List<ChainedStateHandle<OperatorStateHandle>> expectedManagedOperatorState = new ArrayList<>(); List<ChainedStateHandle<OperatorStateHandle>> expectedRawOperatorState = new ArrayList<>(); expectedManagedOperatorStates.add(expectedManagedOperatorState); expectedRawOperatorStates.add(expectedRawOperatorState); for (int index = 0; index < operatorState.getParallelism(); index++) { OperatorStateHandle subManagedOperatorState = generateChainedPartitionableStateHandle(id.f0, index, 2, 8, false) .get(0); OperatorStateHandle subRawOperatorState = generateChainedPartitionableStateHandle(id.f0, index, 2, 8, true) .get(0); KeyGroupsStateHandle subManagedKeyedState = id.f0.equals(id3.f0) ? generateKeyGroupState(id.f0, keyGroupPartitions2.get(index), false) : null; KeyGroupsStateHandle subRawKeyedState = id.f0.equals(id3.f0) ? generateKeyGroupState(id.f0, keyGroupPartitions2.get(index), true) : null; expectedManagedOperatorState.add(ChainedStateHandle.wrapSingleHandle(subManagedOperatorState)); expectedRawOperatorState.add(ChainedStateHandle.wrapSingleHandle(subRawOperatorState)); OperatorSubtaskState subtaskState = new OperatorSubtaskState( subManagedOperatorState, subRawOperatorState, subManagedKeyedState, subRawKeyedState); operatorState.putState(index, subtaskState); } } Tuple2<JobVertexID, OperatorID> id5 = generateIDPair(); int newParallelism1 = 10; Tuple2<JobVertexID, OperatorID> id6 = generateIDPair(); int newParallelism2 = parallelism2; if (scaleType == 0) { newParallelism2 = 20; } else if (scaleType == 1) { newParallelism2 = 8; } List<KeyGroupRange> newKeyGroupPartitions2 = StateAssignmentOperation.createKeyGroupPartitions(maxParallelism2, newParallelism2); final ExecutionJobVertex newJobVertex1 = mockExecutionJobVertex( id5.f0, Arrays.asList(id2.f1, id1.f1, id5.f1), newParallelism1, maxParallelism1); final ExecutionJobVertex newJobVertex2 = mockExecutionJobVertex( id3.f0, Arrays.asList(id6.f1, id3.f1), newParallelism2, maxParallelism2); Map<JobVertexID, ExecutionJobVertex> tasks = new HashMap<>(); tasks.put(id5.f0, newJobVertex1); tasks.put(id3.f0, newJobVertex2); JobID jobID = new JobID(); StandaloneCompletedCheckpointStore standaloneCompletedCheckpointStore = spy(new StandaloneCompletedCheckpointStore(1)); CompletedCheckpoint completedCheckpoint = new CompletedCheckpoint( jobID, 2, System.currentTimeMillis(), System.currentTimeMillis() + 3000, operatorStates, Collections.<MasterState>emptyList(), CheckpointProperties.forCheckpoint(CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION), new TestCompletedCheckpointStorageLocation()); when(standaloneCompletedCheckpointStore.getLatestCheckpoint(false)).thenReturn(completedCheckpoint); CheckpointCoordinatorConfiguration chkConfig = new CheckpointCoordinatorConfiguration( 600000, 600000, 0, Integer.MAX_VALUE, CheckpointRetentionPolicy.NEVER_RETAIN_AFTER_TERMINATION, true, false, 0); CheckpointCoordinator coord = new CheckpointCoordinator( new JobID(), chkConfig, newJobVertex1.getTaskVertices(), newJobVertex1.getTaskVertices(), newJobVertex1.getTaskVertices(), new StandaloneCheckpointIDCounter(), standaloneCompletedCheckpointStore, new MemoryStateBackend(), Executors.directExecutor(), SharedStateRegistry.DEFAULT_FACTORY, failureManager); coord.restoreLatestCheckpointedState(tasks, false, true); for (int i = 0; i < newJobVertex1.getParallelism(); i++) { final List<OperatorID> operatorIds = newJobVertex1.getOperatorIDs(); JobManagerTaskRestore taskRestore = newJobVertex1.getTaskVertices()[i].getCurrentExecutionAttempt().getTaskRestore(); Assert.assertEquals(2L, taskRestore.getRestoreCheckpointId()); TaskStateSnapshot stateSnapshot = taskRestore.getTaskStateSnapshot(); OperatorSubtaskState headOpState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIds.size() - 1)); assertTrue(headOpState.getManagedKeyedState().isEmpty()); assertTrue(headOpState.getRawKeyedState().isEmpty()); { int operatorIndexInChain = 2; OperatorSubtaskState opState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain)); assertTrue(opState.getManagedOperatorState().isEmpty()); assertTrue(opState.getRawOperatorState().isEmpty()); } { int operatorIndexInChain = 1; OperatorSubtaskState opState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain)); OperatorStateHandle expectedManagedOpState = generatePartitionableStateHandle( id1.f0, i, 2, 8, false); OperatorStateHandle expectedRawOpState = generatePartitionableStateHandle( id1.f0, i, 2, 8, true); Collection<OperatorStateHandle> managedOperatorState = opState.getManagedOperatorState(); assertEquals(1, managedOperatorState.size()); assertTrue(CommonTestUtils.isStreamContentEqual(expectedManagedOpState.openInputStream(), managedOperatorState.iterator().next().openInputStream())); Collection<OperatorStateHandle> rawOperatorState = opState.getRawOperatorState(); assertEquals(1, rawOperatorState.size()); assertTrue(CommonTestUtils.isStreamContentEqual(expectedRawOpState.openInputStream(), rawOperatorState.iterator().next().openInputStream())); } { int operatorIndexInChain = 0; OperatorSubtaskState opState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain)); OperatorStateHandle expectedManagedOpState = generatePartitionableStateHandle( id2.f0, i, 2, 8, false); OperatorStateHandle expectedRawOpState = generatePartitionableStateHandle( id2.f0, i, 2, 8, true); Collection<OperatorStateHandle> managedOperatorState = opState.getManagedOperatorState(); assertEquals(1, managedOperatorState.size()); assertTrue(CommonTestUtils.isStreamContentEqual(expectedManagedOpState.openInputStream(), managedOperatorState.iterator().next().openInputStream())); Collection<OperatorStateHandle> rawOperatorState = opState.getRawOperatorState(); assertEquals(1, rawOperatorState.size()); assertTrue(CommonTestUtils.isStreamContentEqual(expectedRawOpState.openInputStream(), rawOperatorState.iterator().next().openInputStream())); } } List<List<Collection<OperatorStateHandle>>> actualManagedOperatorStates = new ArrayList<>(newJobVertex2.getParallelism()); List<List<Collection<OperatorStateHandle>>> actualRawOperatorStates = new ArrayList<>(newJobVertex2.getParallelism()); for (int i = 0; i < newJobVertex2.getParallelism(); i++) { final List<OperatorID> operatorIds = newJobVertex2.getOperatorIDs(); JobManagerTaskRestore taskRestore = newJobVertex2.getTaskVertices()[i].getCurrentExecutionAttempt().getTaskRestore(); Assert.assertEquals(2L, taskRestore.getRestoreCheckpointId()); TaskStateSnapshot stateSnapshot = taskRestore.getTaskStateSnapshot(); { int operatorIndexInChain = 1; OperatorSubtaskState opState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain)); List<Collection<OperatorStateHandle>> actualSubManagedOperatorState = new ArrayList<>(1); actualSubManagedOperatorState.add(opState.getManagedOperatorState()); List<Collection<OperatorStateHandle>> actualSubRawOperatorState = new ArrayList<>(1); actualSubRawOperatorState.add(opState.getRawOperatorState()); actualManagedOperatorStates.add(actualSubManagedOperatorState); actualRawOperatorStates.add(actualSubRawOperatorState); } { int operatorIndexInChain = 0; OperatorSubtaskState opState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIndexInChain)); assertTrue(opState.getManagedOperatorState().isEmpty()); assertTrue(opState.getRawOperatorState().isEmpty()); } KeyGroupsStateHandle originalKeyedStateBackend = generateKeyGroupState(id3.f0, newKeyGroupPartitions2.get(i), false); KeyGroupsStateHandle originalKeyedStateRaw = generateKeyGroupState(id3.f0, newKeyGroupPartitions2.get(i), true); OperatorSubtaskState headOpState = stateSnapshot.getSubtaskStateByOperatorID(operatorIds.get(operatorIds.size() - 1)); Collection<KeyedStateHandle> keyedStateBackend = headOpState.getManagedKeyedState(); Collection<KeyedStateHandle> keyGroupStateRaw = headOpState.getRawKeyedState(); compareKeyedState(Collections.singletonList(originalKeyedStateBackend), keyedStateBackend); compareKeyedState(Collections.singletonList(originalKeyedStateRaw), keyGroupStateRaw); } comparePartitionableState(expectedManagedOperatorStates.get(0), actualManagedOperatorStates); comparePartitionableState(expectedRawOperatorStates.get(0), actualRawOperatorStates); } | /**
* old topology
* [operator1,operator2] * parallelism1 -> [operator3,operator4] * parallelism2
*
*
* new topology
*
* [operator5,operator1,operator3] * newParallelism1 -> [operator3, operator6] * newParallelism2
*
* scaleType:
* 0 increase parallelism
* 1 decrease parallelism
* 2 same parallelism
*/ | old topology [operator1,operator2] * parallelism1 -> [operator3,operator4] * parallelism2 new topology [operator5,operator1,operator3] * newParallelism1 -> [operator3, operator6] * newParallelism2 scaleType: 0 increase parallelism 1 decrease parallelism 2 same parallelism | testStateRecoveryWithTopologyChange | {
"repo_name": "fhueske/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/checkpoint/CheckpointCoordinatorTest.java",
"license": "apache-2.0",
"size": 162607
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.Collection",
"java.util.Collections",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.apache.flink.api.common.JobID",
"org.apache.flink.api.java.tuple.Tuple2",
"org.apache.flink.runtime.concurrent.Executors",
"org.apache.flink.runtime.executiongraph.ExecutionJobVertex",
"org.apache.flink.runtime.jobgraph.JobVertexID",
"org.apache.flink.runtime.jobgraph.OperatorID",
"org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration",
"org.apache.flink.runtime.state.ChainedStateHandle",
"org.apache.flink.runtime.state.KeyGroupRange",
"org.apache.flink.runtime.state.KeyGroupsStateHandle",
"org.apache.flink.runtime.state.KeyedStateHandle",
"org.apache.flink.runtime.state.OperatorStateHandle",
"org.apache.flink.runtime.state.SharedStateRegistry",
"org.apache.flink.runtime.state.memory.MemoryStateBackend",
"org.apache.flink.runtime.state.testutils.TestCompletedCheckpointStorageLocation",
"org.apache.flink.runtime.testutils.CommonTestUtils",
"org.junit.Assert",
"org.mockito.Mockito"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.flink.api.common.JobID; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.runtime.concurrent.Executors; import org.apache.flink.runtime.executiongraph.ExecutionJobVertex; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.runtime.jobgraph.OperatorID; import org.apache.flink.runtime.jobgraph.tasks.CheckpointCoordinatorConfiguration; import org.apache.flink.runtime.state.ChainedStateHandle; import org.apache.flink.runtime.state.KeyGroupRange; import org.apache.flink.runtime.state.KeyGroupsStateHandle; import org.apache.flink.runtime.state.KeyedStateHandle; import org.apache.flink.runtime.state.OperatorStateHandle; import org.apache.flink.runtime.state.SharedStateRegistry; import org.apache.flink.runtime.state.memory.MemoryStateBackend; import org.apache.flink.runtime.state.testutils.TestCompletedCheckpointStorageLocation; import org.apache.flink.runtime.testutils.CommonTestUtils; import org.junit.Assert; import org.mockito.Mockito; | import java.util.*; import org.apache.flink.api.common.*; import org.apache.flink.api.java.tuple.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.executiongraph.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.runtime.jobgraph.tasks.*; import org.apache.flink.runtime.state.*; import org.apache.flink.runtime.state.memory.*; import org.apache.flink.runtime.state.testutils.*; import org.apache.flink.runtime.testutils.*; import org.junit.*; import org.mockito.*; | [
"java.util",
"org.apache.flink",
"org.junit",
"org.mockito"
] | java.util; org.apache.flink; org.junit; org.mockito; | 2,507,501 |
public boolean supportsMixin(Name mixin); | boolean function(Name mixin); | /**
* Determines whether this effective node type supports adding
* the specified mixin.
* @param mixin name of mixin type
* @return <code>true</code> if the mixin type is supported, otherwise
* <code>false</code>
*/ | Determines whether this effective node type supports adding the specified mixin | supportsMixin | {
"repo_name": "tripodsan/jackrabbit",
"path": "jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/EffectiveNodeType.java",
"license": "apache-2.0",
"size": 4895
} | [
"org.apache.jackrabbit.spi.Name"
] | import org.apache.jackrabbit.spi.Name; | import org.apache.jackrabbit.spi.*; | [
"org.apache.jackrabbit"
] | org.apache.jackrabbit; | 2,166,845 |
EList<Long> getListPositions(); | EList<Long> getListPositions(); | /**
* Returns the value of the '<em><b>List Positions</b></em>' attribute list.
* The list contents are of type {@link java.lang.Long}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>List Positions</em>' attribute list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>List Positions</em>' attribute list.
* @see #isSetListPositions()
* @see #unsetListPositions()
* @see cn.dlb.bim.models.ifc4.Ifc4Package#getIfcReference_ListPositions()
* @model unique="false" unsettable="true"
* @generated
*/ | Returns the value of the 'List Positions' attribute list. The list contents are of type <code>java.lang.Long</code>. If the meaning of the 'List Positions' attribute list isn't clear, there really should be more of a description here... | getListPositions | {
"repo_name": "shenan4321/BIMplatform",
"path": "generated/cn/dlb/bim/models/ifc4/IfcReference.java",
"license": "agpl-3.0",
"size": 10347
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,037,826 |
public static ViewGroup inflateViewHierarchy(
Context baseContext, int toolbarContainerId, int toolbarId) {
// Inflating the view hierarchy causes StrictMode violations on some
// devices. Since layout inflation should happen on the UI thread, allow
// the disk reads. crbug.com/644243.
try (TraceEvent e = TraceEvent.scoped("WarmupManager.inflateViewHierarchy");
StrictModeContext c = StrictModeContext.allowDiskReads()) {
ContextThemeWrapper context =
new ContextThemeWrapper(baseContext, ChromeActivity.getThemeId());
FrameLayout contentHolder = new FrameLayout(context);
ViewGroup mainView =
(ViewGroup) LayoutInflater.from(context).inflate(R.layout.main, contentHolder);
if (toolbarContainerId != ChromeActivity.NO_CONTROL_CONTAINER) {
ViewStub stub = (ViewStub) mainView.findViewById(R.id.control_container_stub);
stub.setLayoutResource(toolbarContainerId);
stub.inflate();
}
// It cannot be assumed that the result of toolbarContainerStub.inflate() will be
// the control container since it may be wrapped in another view.
ControlContainer controlContainer =
(ControlContainer) mainView.findViewById(R.id.control_container);
if (toolbarId != ChromeActivity.NO_TOOLBAR_LAYOUT && controlContainer != null) {
controlContainer.initWithToolbar(toolbarId);
}
return mainView;
} catch (InflateException e) {
// See https://crbug.com/606715.
Log.e(TAG, "Inflation exception.", e);
return null;
}
} | static ViewGroup function( Context baseContext, int toolbarContainerId, int toolbarId) { try (TraceEvent e = TraceEvent.scoped(STR); StrictModeContext c = StrictModeContext.allowDiskReads()) { ContextThemeWrapper context = new ContextThemeWrapper(baseContext, ChromeActivity.getThemeId()); FrameLayout contentHolder = new FrameLayout(context); ViewGroup mainView = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.main, contentHolder); if (toolbarContainerId != ChromeActivity.NO_CONTROL_CONTAINER) { ViewStub stub = (ViewStub) mainView.findViewById(R.id.control_container_stub); stub.setLayoutResource(toolbarContainerId); stub.inflate(); } ControlContainer controlContainer = (ControlContainer) mainView.findViewById(R.id.control_container); if (toolbarId != ChromeActivity.NO_TOOLBAR_LAYOUT && controlContainer != null) { controlContainer.initWithToolbar(toolbarId); } return mainView; } catch (InflateException e) { Log.e(TAG, STR, e); return null; } } | /**
* Inflates and constructs the view hierarchy that the app will use.
* Calls to this are not restricted to the UI thread.
* @param baseContext The base context to use for creating the ContextWrapper.
* @param toolbarContainerId Id of the toolbar container.
* @param toolbarId The toolbar's layout ID.
*/ | Inflates and constructs the view hierarchy that the app will use. Calls to this are not restricted to the UI thread | inflateViewHierarchy | {
"repo_name": "endlessm/chromium-browser",
"path": "chrome/android/java/src/org/chromium/chrome/browser/WarmupManager.java",
"license": "bsd-3-clause",
"size": 17721
} | [
"android.content.Context",
"android.view.ContextThemeWrapper",
"android.view.InflateException",
"android.view.LayoutInflater",
"android.view.ViewGroup",
"android.view.ViewStub",
"android.widget.FrameLayout",
"org.chromium.base.Log",
"org.chromium.base.StrictModeContext",
"org.chromium.base.TraceEvent",
"org.chromium.chrome.browser.toolbar.ControlContainer"
] | import android.content.Context; import android.view.ContextThemeWrapper; import android.view.InflateException; import android.view.LayoutInflater; import android.view.ViewGroup; import android.view.ViewStub; import android.widget.FrameLayout; import org.chromium.base.Log; import org.chromium.base.StrictModeContext; import org.chromium.base.TraceEvent; import org.chromium.chrome.browser.toolbar.ControlContainer; | import android.content.*; import android.view.*; import android.widget.*; import org.chromium.base.*; import org.chromium.chrome.browser.toolbar.*; | [
"android.content",
"android.view",
"android.widget",
"org.chromium.base",
"org.chromium.chrome"
] | android.content; android.view; android.widget; org.chromium.base; org.chromium.chrome; | 2,905,912 |
@Override
public Boolean isTraversable(File f) {
return f.isDirectory();
} | Boolean function(File f) { return f.isDirectory(); } | /**
* Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed.
*
* @param f the <code>File</code>
* @return <code>true</code> if the file/directory can be traversed, otherwise <code>false</code>
* @see JFileChooser#isTraversable
* @see FileView#isTraversable
*/ | Returns true if the file (directory) can be visited. Returns false if the directory cannot be traversed | isTraversable | {
"repo_name": "DigitalMediaServer/DigitalMediaServer",
"path": "src/main/java/net/pms/newgui/RestrictedFileSystemView.java",
"license": "gpl-2.0",
"size": 11295
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,733,212 |
public static ImmutableArrayNode of(final ArrayNode node) {
return new ImmutableArrayNode(node);
} | static ImmutableArrayNode function(final ArrayNode node) { return new ImmutableArrayNode(node); } | /**
* Get an immutable JSON-array node instance.
*
* @param node the mutable {@link ImmutableArrayNode} to wrap
* @return immutable JSON-array node instance
*/ | Get an immutable JSON-array node instance | of | {
"repo_name": "sirixdb/sirix",
"path": "bundles/sirix-core/src/main/java/org/sirix/node/immutable/json/ImmutableArrayNode.java",
"license": "bsd-3-clause",
"size": 1572
} | [
"org.sirix.node.json.ArrayNode"
] | import org.sirix.node.json.ArrayNode; | import org.sirix.node.json.*; | [
"org.sirix.node"
] | org.sirix.node; | 86,277 |
public static HttpServletRequest getOuterRequest( HttpServletRequest request )
{
ScopedRequest scopedRequest = unwrapRequest( request );
return scopedRequest != null ? scopedRequest.getOuterRequest() : request;
} | static HttpServletRequest function( HttpServletRequest request ) { ScopedRequest scopedRequest = unwrapRequest( request ); return scopedRequest != null ? scopedRequest.getOuterRequest() : request; } | /**
* Get the outer (unwrapped) request.
*
* @param request the request to unwrap.
* @return the outer request, if the given request is a ScopedRequest (or wraps a ScopedRequest);
* otherwise, the given request itself.
*/ | Get the outer (unwrapped) request | getOuterRequest | {
"repo_name": "moparisthebest/beehive",
"path": "beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/scoping/ScopedServletUtils.java",
"license": "apache-2.0",
"size": 16416
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 2,106,140 |
@Nonnull
public java.util.concurrent.CompletableFuture<BuiltInIdentityProvider> postAsync(@Nonnull final BuiltInIdentityProvider newBuiltInIdentityProvider) {
return sendAsync(HttpMethod.POST, newBuiltInIdentityProvider);
} | java.util.concurrent.CompletableFuture<BuiltInIdentityProvider> function(@Nonnull final BuiltInIdentityProvider newBuiltInIdentityProvider) { return sendAsync(HttpMethod.POST, newBuiltInIdentityProvider); } | /**
* Creates a BuiltInIdentityProvider with a new object
*
* @param newBuiltInIdentityProvider the new object to create
* @return a future with the result
*/ | Creates a BuiltInIdentityProvider with a new object | postAsync | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/BuiltInIdentityProviderRequest.java",
"license": "mit",
"size": 6379
} | [
"com.microsoft.graph.http.HttpMethod",
"com.microsoft.graph.models.BuiltInIdentityProvider",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.http.HttpMethod; import com.microsoft.graph.models.BuiltInIdentityProvider; import javax.annotation.Nonnull; | import com.microsoft.graph.http.*; import com.microsoft.graph.models.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 2,768,762 |
public boolean isMeasurePending( Hierarchy hierarchy, MeasureTask measure )
{
boolean result = false;
lock.lock();
try {
if ( currentTask != null ) {
result = currentTask.getMiddle().equals( hierarchy )
&& currentTask.getRight().equals( measure );
}
else {
for ( Triple<MeasureResultHolder, Hierarchy, MeasureTask> task : tasks ) {
if ( task.getMiddle().equals( hierarchy )
&& task.getRight().equals( measure ) ) {
result = true;
break;
}
}
}
}
finally {
lock.unlock();
}
return result;
} | boolean function( Hierarchy hierarchy, MeasureTask measure ) { boolean result = false; lock.lock(); try { if ( currentTask != null ) { result = currentTask.getMiddle().equals( hierarchy ) && currentTask.getRight().equals( measure ); } else { for ( Triple<MeasureResultHolder, Hierarchy, MeasureTask> task : tasks ) { if ( task.getMiddle().equals( hierarchy ) && task.getRight().equals( measure ) ) { result = true; break; } } } } finally { lock.unlock(); } return result; } | /**
* Checks whether the measure with the specified name is scheduled for processing, or
* currently being processed.
*
* @param measure
* the task to look for
* @return true if a measure with the specified identifier is pending calculation, or
* is currently being calculated. False otherwise.
*/ | Checks whether the measure with the specified name is scheduled for processing, or currently being processed | isMeasurePending | {
"repo_name": "kartoFlane/hiervis",
"path": "src/pl/pwr/hiervis/measures/MeasureComputeThread.java",
"license": "mit",
"size": 6655
} | [
"org.apache.commons.lang3.tuple.Triple"
] | import org.apache.commons.lang3.tuple.Triple; | import org.apache.commons.lang3.tuple.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,642,319 |
public static OrderLineDTO newLine(Integer itemId, BigDecimal quantity) {
OrderLineDTO line = new OrderLineDTO();
line.setItemId(itemId);
line.setQuantity(quantity);
line.setDefaults();
return line;
} | static OrderLineDTO function(Integer itemId, BigDecimal quantity) { OrderLineDTO line = new OrderLineDTO(); line.setItemId(itemId); line.setQuantity(quantity); line.setDefaults(); return line; } | /**
* Convenience method to create a new line with a given item ID and quantity and to set a simple price
* WITHOUT the influence of the pricing engine.
*
* @param itemId item id
* @param quantity quantity
* @return order line
*/ | Convenience method to create a new line with a given item ID and quantity and to set a simple price WITHOUT the influence of the pricing engine | newLine | {
"repo_name": "psalaberria002/jbilling3",
"path": "src/java/com/sapienter/jbilling/server/mediation/task/AbstractResolverMediationTask.java",
"license": "agpl-3.0",
"size": 10133
} | [
"com.sapienter.jbilling.server.order.db.OrderLineDTO",
"java.math.BigDecimal"
] | import com.sapienter.jbilling.server.order.db.OrderLineDTO; import java.math.BigDecimal; | import com.sapienter.jbilling.server.order.db.*; import java.math.*; | [
"com.sapienter.jbilling",
"java.math"
] | com.sapienter.jbilling; java.math; | 600,468 |
private static void enableView(final View view, final boolean enable) {
view.setEnabled(enable);
view.setAlpha(enable ? 1f : 0.1f);
} | static void function(final View view, final boolean enable) { view.setEnabled(enable); view.setAlpha(enable ? 1f : 0.1f); } | /**
* Used for enabling or disabling views, while also changing the alpha.
*
* @param view The view to enable or disable.
* @param enable Whether to enable or disable the view.
*/ | Used for enabling or disabling views, while also changing the alpha | enableView | {
"repo_name": "prolificinteractive/material-calendarview",
"path": "library/src/main/java/com/prolificinteractive/materialcalendarview/MaterialCalendarView.java",
"license": "mit",
"size": 64348
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,513,377 |
@Override
public void run() {
ConcurrentHashMap<String, TransferData> trasferData = communicationManager.transferData;
for (Entry<String, TransferData> entry : trasferData.entrySet()) {
String key = entry.getKey();
TransferData value = entry.getValue();
if (value.getUpdate() == 1) {
System.out.println("UPDATE: " + key + " : " + value.getValue() + " / " + value.getSignal());
// TODO DON'T FORGET TO ADD THREAD DELAY AFTER RECEIVING REQUEEST FROM MASTER!!!!
// TODO just for testing sending data to the sensor
// TODO This is the alternative for testing. Method sendDataToDevice is responsible for this
String valueData = value.getValue();
int num = Integer.parseInt(valueData);
if (num < 26 && key.equals("smg-client-adroino_nano.12.1")) {
communicationManager.updateSensorValue("smg-client-adroino_nano.0.4", 0);
try {
Thread.currentThread().sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
communicationManager.updateSensorValue("smg-client-adroino_nano.0.3", 1);
System.out.println("SEND DATA: " + key + " : " + value.getValue() + " / " + 1);
}
if (num >= 26 && key.equals("smg-client-adroino_nano.12.1")) {
communicationManager.updateSensorValue("smg-client-adroino_nano.0.3", 0);
try {
Thread.currentThread().sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
communicationManager.updateSensorValue("smg-client-adroino_nano.0.4", 1);
System.out.println("SEND DATA: " + key + " : " + value.getValue() + " / " + 0);
}
value.setUpdate(0);
entry.setValue(value);
// TODO Currently not possible: Data from Arduino is string and int, but possible when change data just to int
for(DeviceContainer device : devices){
if (value.getDeviceId().equals(device.getDeviceId().getDevid())) {
DoubleEvent doubleEvent = new DoubleEvent(Double.parseDouble(value.getValue()));
try {
master.sendDoubleEvent(doubleEvent, device.getDeviceId(), clientId);
} catch (TimeoutException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}
}
| void function() { ConcurrentHashMap<String, TransferData> trasferData = communicationManager.transferData; for (Entry<String, TransferData> entry : trasferData.entrySet()) { String key = entry.getKey(); TransferData value = entry.getValue(); if (value.getUpdate() == 1) { System.out.println(STR + key + STR + value.getValue() + STR + value.getSignal()); String valueData = value.getValue(); int num = Integer.parseInt(valueData); if (num < 26 && key.equals(STR)) { communicationManager.updateSensorValue(STR, 0); try { Thread.currentThread().sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } communicationManager.updateSensorValue(STR, 1); System.out.println(STR + key + STR + value.getValue() + STR + 1); } if (num >= 26 && key.equals(STR)) { communicationManager.updateSensorValue(STR, 0); try { Thread.currentThread().sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } communicationManager.updateSensorValue(STR, 1); System.out.println(STR + key + STR + value.getValue() + STR + 0); } value.setUpdate(0); entry.setValue(value); for(DeviceContainer device : devices){ if (value.getDeviceId().equals(device.getDeviceId().getDevid())) { DoubleEvent doubleEvent = new DoubleEvent(Double.parseDouble(value.getValue())); try { master.sendDoubleEvent(doubleEvent, device.getDeviceId(), clientId); } catch (TimeoutException e) { e.printStackTrace(); } } } } } } | /**
* Method called every frequence of seconds, that is getting data from the trasnferData (global hashmap)
* and sending them to the actuator master
*/ | Method called every frequence of seconds, that is getting data from the trasnferData (global hashmap) and sending them to the actuator master | run | {
"repo_name": "B2M-Software/project-drahtlos-smg20",
"path": "actuatorclient.arduino.impl/src/main/java/org/fortiss/smg/actuatorclient/arduino/impl/commands/CommandFactory.java",
"license": "apache-2.0",
"size": 6966
} | [
"java.util.Map",
"java.util.concurrent.ConcurrentHashMap",
"java.util.concurrent.TimeoutException",
"org.fortiss.smg.actuatorclient.arduino.impl.connectors.TransferData",
"org.fortiss.smg.actuatormaster.api.events.DoubleEvent",
"org.fortiss.smg.containermanager.api.devices.DeviceContainer"
] | import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeoutException; import org.fortiss.smg.actuatorclient.arduino.impl.connectors.TransferData; import org.fortiss.smg.actuatormaster.api.events.DoubleEvent; import org.fortiss.smg.containermanager.api.devices.DeviceContainer; | import java.util.*; import java.util.concurrent.*; import org.fortiss.smg.actuatorclient.arduino.impl.connectors.*; import org.fortiss.smg.actuatormaster.api.events.*; import org.fortiss.smg.containermanager.api.devices.*; | [
"java.util",
"org.fortiss.smg"
] | java.util; org.fortiss.smg; | 730,111 |
public static void addSmeltingBonus(ItemStack in, ItemStack out) {
smeltingBonus.put(
Arrays.asList(in.getItem(),in.getItemDamage()),
new ItemStack(out.getItem(),0,out.getItemDamage()));
}
| static void function(ItemStack in, ItemStack out) { smeltingBonus.put( Arrays.asList(in.getItem(),in.getItemDamage()), new ItemStack(out.getItem(),0,out.getItemDamage())); } | /**
* This method is used to determine what bonus items are generated when the infernal furnace smelts items
* @param in The input of the smelting operation. e.g. new ItemStack(Block.oreGold)
* @param out The bonus item that can be produced from the smelting operation e.g. new ItemStack(nuggetGold,0,0).
* Stacksize should be 0 unless you want to guarantee that at least 1 item is always produced.
*/ | This method is used to determine what bonus items are generated when the infernal furnace smelts items | addSmeltingBonus | {
"repo_name": "darkeports/tc5-port",
"path": "src/main/java/thaumcraft/api/ThaumcraftApi.java",
"license": "lgpl-2.1",
"size": 29069
} | [
"java.util.Arrays",
"net.minecraft.item.ItemStack"
] | import java.util.Arrays; import net.minecraft.item.ItemStack; | import java.util.*; import net.minecraft.item.*; | [
"java.util",
"net.minecraft.item"
] | java.util; net.minecraft.item; | 1,374,635 |
@Override
public void shutdown() {
logger.info("XCPDInitiatingGateway::shutdown()");
this.ATNAlogStop(ATNAAuditEvent.ActorType.INITIATING_GATEWAY);
} | void function() { logger.info(STR); this.ATNAlogStop(ATNAAuditEvent.ActorType.INITIATING_GATEWAY); } | /**
* This will be called during the system shut down time. Irrespective
* of the service scope this method will be called
*/ | This will be called during the system shut down time. Irrespective of the service scope this method will be called | shutdown | {
"repo_name": "kef/hieos",
"path": "src/xcpd/src/com/vangent/hieos/services/xcpd/gateway/serviceimpl/XCPDInitiatingGateway.java",
"license": "apache-2.0",
"size": 5364
} | [
"com.vangent.hieos.xutil.atna.ATNAAuditEvent"
] | import com.vangent.hieos.xutil.atna.ATNAAuditEvent; | import com.vangent.hieos.xutil.atna.*; | [
"com.vangent.hieos"
] | com.vangent.hieos; | 2,631,559 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.