method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public String getHeader(String name) {
ArrayList values = null;
synchronized (headers) {
values = (ArrayList) headers.get(name);
}
if (values != null)
return ((String) values.get(0));
else
return (null);
} | String function(String name) { ArrayList values = null; synchronized (headers) { values = (ArrayList) headers.get(name); } if (values != null) return ((String) values.get(0)); else return (null); } | /**
* Return the value for the specified header, or <code>null</code> if this
* header has not been set. If more than one value was added for this
* name, only the first is returned; use getHeaderValues() to retrieve all
* of them.
*
* @param name Header name to look up
*/ | Return the value for the specified header, or <code>null</code> if this header has not been set. If more than one value was added for this name, only the first is returned; use getHeaderValues() to retrieve all of them | getHeader | {
"repo_name": "eclipsky/HowTomcatWorks",
"path": "src/org/apache/catalina/connector/HttpResponseBase.java",
"license": "apache-2.0",
"size": 34102
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,882,068 |
@Test
public void testSetKey_1()
throws Exception {
ScriptFilterAction fixture = new ScriptFilterAction();
fixture.setKey("");
fixture.setValue("");
fixture.setAction(ScriptFilterActionType.add);
fixture.setScope("");
String key = "";
fixture.setKey(key);
} | void function() throws Exception { ScriptFilterAction fixture = new ScriptFilterAction(); fixture.setKey(STRSTRSTR"; fixture.setKey(key); } | /**
* Run the void setKey(String) method test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/15/14 1:34 PM
*/ | Run the void setKey(String) method test | testSetKey_1 | {
"repo_name": "kevinmcgoldrick/Tank",
"path": "data_model/src/test/java/com/intuit/tank/project/ScriptFilterActionTest.java",
"license": "epl-1.0",
"size": 9432
} | [
"com.intuit.tank.project.ScriptFilterAction"
] | import com.intuit.tank.project.ScriptFilterAction; | import com.intuit.tank.project.*; | [
"com.intuit.tank"
] | com.intuit.tank; | 332,741 |
@SuppressWarnings("unchecked")
public static <T> T asType(Object[] ary, Class<T> clazz) {
if (clazz == List.class) {
return (T) new ArrayList(Arrays.asList(ary));
}
if (clazz == Set.class) {
return (T) new HashSet(Arrays.asList(ary));
}
if (clazz == SortedSet.class) {
return (T) new TreeSet(Arrays.asList(ary));
}
return asType((Object) ary, clazz);
} | @SuppressWarnings(STR) static <T> T function(Object[] ary, Class<T> clazz) { if (clazz == List.class) { return (T) new ArrayList(Arrays.asList(ary)); } if (clazz == Set.class) { return (T) new HashSet(Arrays.asList(ary)); } if (clazz == SortedSet.class) { return (T) new TreeSet(Arrays.asList(ary)); } return asType((Object) ary, clazz); } | /**
* Converts the given array to either a List, Set, or
* SortedSet. If the given class is something else, the
* call is deferred to {link #asType(Object,Class)}.
*
* @param ary an array
* @param clazz the desired class
* @return the object resulting from this type conversion
* @see #asType(java.lang.Object, java.lang.Class)
* @since 1.5.1
*/ | Converts the given array to either a List, Set, or SortedSet. If the given class is something else, the call is deferred to {link #asType(Object,Class)} | asType | {
"repo_name": "mv2a/yajsw",
"path": "src/groovy-patch/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "apache-2.0",
"size": 704164
} | [
"java.util.ArrayList",
"java.util.Arrays",
"java.util.HashSet",
"java.util.List",
"java.util.Set",
"java.util.SortedSet",
"java.util.TreeSet"
] | import java.util.ArrayList; import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 1,565,561 |
return INSTANCE;
}
private NoopMeterRegistry() {
super(Clock.SYSTEM);
config().namingConvention(NamingConvention.identity);
} | return INSTANCE; } private NoopMeterRegistry() { super(Clock.SYSTEM); config().namingConvention(NamingConvention.identity); } | /**
* Returns the singleton instance.
*/ | Returns the singleton instance | get | {
"repo_name": "anuraaga/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/metric/NoopMeterRegistry.java",
"license": "apache-2.0",
"size": 4237
} | [
"io.micrometer.core.instrument.Clock",
"io.micrometer.core.instrument.config.NamingConvention"
] | import io.micrometer.core.instrument.Clock; import io.micrometer.core.instrument.config.NamingConvention; | import io.micrometer.core.instrument.*; import io.micrometer.core.instrument.config.*; | [
"io.micrometer.core"
] | io.micrometer.core; | 712,167 |
@Generated
@Selector("initWithCoder:device:")
public native MPSMatrixCopyToImage initWithCoderDevice(NSCoder aDecoder,
@Mapped(ObjCObjectMapper.class) Object device); | @Selector(STR) native MPSMatrixCopyToImage function(NSCoder aDecoder, @Mapped(ObjCObjectMapper.class) Object device); | /**
* NSSecureCoding compatability
* <p>
* While the standard NSSecureCoding/NSCoding method
* -initWithCoder: should work, since the file can't
* know which device your data is allocated on, we
* have to guess and may guess incorrectly. To avoid
* that problem, use initWithCoder:device instead.
*
* @param aDecoder The NSCoder subclass with your serialized MPSKernel
* @param device The MTLDevice on which to make the MPSKernel
* @return A new MPSKernel object, or nil if failure.
*/ | NSSecureCoding compatability While the standard NSSecureCoding/NSCoding method -initWithCoder: should work, since the file can't know which device your data is allocated on, we have to guess and may guess incorrectly. To avoid that problem, use initWithCoder:device instead | initWithCoderDevice | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/metalperformanceshaders/MPSMatrixCopyToImage.java",
"license": "apache-2.0",
"size": 9472
} | [
"org.moe.natj.general.ann.Mapped",
"org.moe.natj.objc.ann.Selector",
"org.moe.natj.objc.map.ObjCObjectMapper"
] | import org.moe.natj.general.ann.Mapped; import org.moe.natj.objc.ann.Selector; import org.moe.natj.objc.map.ObjCObjectMapper; | import org.moe.natj.general.ann.*; import org.moe.natj.objc.ann.*; import org.moe.natj.objc.map.*; | [
"org.moe.natj"
] | org.moe.natj; | 1,479,973 |
public IndexMetadata getIndexMetadata(String name, long timestamp)
throws IOException, InterruptedException, ExecutionException; | IndexMetadata function(String name, long timestamp) throws IOException, InterruptedException, ExecutionException; | /**
* Return the metadata for the named index.
*
* @param name
* The index name.
* @param timestamp
* A transaction identifier, {@link ITx#UNISOLATED} for the
* unisolated index view, {@link ITx#READ_COMMITTED}, or
* <code>timestamp</code> for a historical view no later than
* the specified timestamp.
*
* @return The metadata for the named index.
*
* @throws IOException
*/ | Return the metadata for the named index | getIndexMetadata | {
"repo_name": "smalyshev/blazegraph",
"path": "bigdata/src/java/com/bigdata/service/IDataService.java",
"license": "gpl-2.0",
"size": 27496
} | [
"com.bigdata.btree.IndexMetadata",
"java.io.IOException",
"java.util.concurrent.ExecutionException"
] | import com.bigdata.btree.IndexMetadata; import java.io.IOException; import java.util.concurrent.ExecutionException; | import com.bigdata.btree.*; import java.io.*; import java.util.concurrent.*; | [
"com.bigdata.btree",
"java.io",
"java.util"
] | com.bigdata.btree; java.io; java.util; | 2,870,361 |
@RequestMapping(value = "/feature/estimates/done/{teamId}", method = GET, produces = APPLICATION_JSON_VALUE)
@Deprecated
public DataResponse<List<Feature>> featureDoneEstimate(
@RequestParam(value = "agileType", required = false) Optional<String> agileType,
@RequestParam(value = "estimateMetricType", required = false) Optional<String> estimateMetricType,
@RequestParam(value = "component", required = true) String cId,
@PathVariable String teamId) {
ObjectId componentId = new ObjectId(cId);
return this.featureService.getDoneEstimate(componentId, teamId, agileType, estimateMetricType);
} | @RequestMapping(value = STR, method = GET, produces = APPLICATION_JSON_VALUE) DataResponse<List<Feature>> function( @RequestParam(value = STR, required = false) Optional<String> agileType, @RequestParam(value = STR, required = false) Optional<String> estimateMetricType, @RequestParam(value = STR, required = true) String cId, @PathVariable String teamId) { ObjectId componentId = new ObjectId(cId); return this.featureService.getDoneEstimate(componentId, teamId, agileType, estimateMetricType); } | /**
* REST endpoint for retrieving the current done estimate for a team and
* sprint
*
* @param teamId
* A given scope-owner's source-system ID
* @return A response list of type Feature containing the done estimate of
* current features
*/ | REST endpoint for retrieving the current done estimate for a team and sprint | featureDoneEstimate | {
"repo_name": "pavan149679/Hygieia",
"path": "api/src/main/java/com/capitalone/dashboard/rest/FeatureController.java",
"license": "apache-2.0",
"size": 8256
} | [
"com.capitalone.dashboard.model.DataResponse",
"com.capitalone.dashboard.model.Feature",
"java.util.List",
"java.util.Optional",
"org.bson.types.ObjectId",
"org.springframework.web.bind.annotation.PathVariable",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestParam"
] | import com.capitalone.dashboard.model.DataResponse; import com.capitalone.dashboard.model.Feature; import java.util.List; import java.util.Optional; import org.bson.types.ObjectId; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; | import com.capitalone.dashboard.model.*; import java.util.*; import org.bson.types.*; import org.springframework.web.bind.annotation.*; | [
"com.capitalone.dashboard",
"java.util",
"org.bson.types",
"org.springframework.web"
] | com.capitalone.dashboard; java.util; org.bson.types; org.springframework.web; | 1,936,769 |
public void updateDaysIfNecessary(AjaxBehaviorEvent event) {
Calendar calendar = Calendar.getInstance();
calendar.set(Calendar.DATE, 1);
calendar.set(Calendar.MONTH, (Integer) month.getValue() - 1);
calendar.set(Calendar.YEAR, (Integer) year.getValue());
int maxDay = calendar.getActualMaximum(Calendar.DATE);
if (getDays().length != maxDay) {
setDays(createIntegerArray(1, maxDay));
if ((Integer) day.getValue() > maxDay) {
day.setValue(maxDay); // Fix the selected value if it exceeds new max value.
}
FacesContext context = FacesContext.getCurrentInstance(); // Update day field.
context.getPartialViewContext().getRenderIds().add(day.getClientId(context));
}
}
// Helpers ------------------------------------------------------------------------------------ | void function(AjaxBehaviorEvent event) { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.DATE, 1); calendar.set(Calendar.MONTH, (Integer) month.getValue() - 1); calendar.set(Calendar.YEAR, (Integer) year.getValue()); int maxDay = calendar.getActualMaximum(Calendar.DATE); if (getDays().length != maxDay) { setDays(createIntegerArray(1, maxDay)); if ((Integer) day.getValue() > maxDay) { day.setValue(maxDay); } FacesContext context = FacesContext.getCurrentInstance(); context.getPartialViewContext().getRenderIds().add(day.getClientId(context)); } } | /**
* Update the available days based on the selected month and year, if necessary.
*/ | Update the available days based on the selected month and year, if necessary | updateDaysIfNecessary | {
"repo_name": "federicomartinlara1976/chronos-libs",
"path": "chronos-jsf-components/src/main/java/net/bounceme/chronos/utils/jsf/components/InputDate.java",
"license": "gpl-3.0",
"size": 5322
} | [
"java.util.Calendar",
"javax.faces.context.FacesContext",
"javax.faces.event.AjaxBehaviorEvent"
] | import java.util.Calendar; import javax.faces.context.FacesContext; import javax.faces.event.AjaxBehaviorEvent; | import java.util.*; import javax.faces.context.*; import javax.faces.event.*; | [
"java.util",
"javax.faces"
] | java.util; javax.faces; | 680,991 |
DocumentModel addComment(DocumentModel parent, DocumentModel comment) throws ClientException; | DocumentModel addComment(DocumentModel parent, DocumentModel comment) throws ClientException; | /**
* Creates a new comment as a reply to an existing comment.
*
* @param parent the parent comment, which must exist
* @param comment the comment to be added
* @throws ClientException
*/ | Creates a new comment as a reply to an existing comment | addComment | {
"repo_name": "deadcyclo/nuxeo-features",
"path": "nuxeo-platform-comment/nuxeo-platform-comment-api/src/main/java/org/nuxeo/ecm/platform/comment/api/CommentableDocument.java",
"license": "lgpl-2.1",
"size": 2136
} | [
"org.nuxeo.ecm.core.api.ClientException",
"org.nuxeo.ecm.core.api.DocumentModel"
] | import org.nuxeo.ecm.core.api.ClientException; import org.nuxeo.ecm.core.api.DocumentModel; | import org.nuxeo.ecm.core.api.*; | [
"org.nuxeo.ecm"
] | org.nuxeo.ecm; | 2,096,078 |
public static RouterDefinition createDefaultRouterDefinition() {
RouterDefinition def = new RouterDefinition();
def.setName(MailController.class.getSimpleName());
def.setBlocking(false);
def.setController(MailController.class);
def.setHandlerProperties(getDefaultProperties());
def.setRoutes(new String[] { "/api/sendmail" });
return def;
} | static RouterDefinition function() { RouterDefinition def = new RouterDefinition(); def.setName(MailController.class.getSimpleName()); def.setBlocking(false); def.setController(MailController.class); def.setHandlerProperties(getDefaultProperties()); def.setRoutes(new String[] { STR }); return def; } | /**
* Creates a default definition for the current instance
*
* @return
*/ | Creates a default definition for the current instance | createDefaultRouterDefinition | {
"repo_name": "BraintagsGmbH/NetRelay-Controller",
"path": "src/main/java/de/braintags/netrelay/controller/api/MailController.java",
"license": "epl-1.0",
"size": 23890
} | [
"de.braintags.netrelay.routing.RouterDefinition"
] | import de.braintags.netrelay.routing.RouterDefinition; | import de.braintags.netrelay.routing.*; | [
"de.braintags.netrelay"
] | de.braintags.netrelay; | 2,794,955 |
@Override
public void setHeightInPoints(float height) {
throw new NotSupportedException();
} | void function(float height) { throw new NotSupportedException(); } | /**
* Not supported
*/ | Not supported | setHeightInPoints | {
"repo_name": "monitorjbl/excel-streaming-reader",
"path": "src/main/java/com/monitorjbl/xlsx/impl/StreamingRow.java",
"license": "apache-2.0",
"size": 5442
} | [
"com.monitorjbl.xlsx.exceptions.NotSupportedException"
] | import com.monitorjbl.xlsx.exceptions.NotSupportedException; | import com.monitorjbl.xlsx.exceptions.*; | [
"com.monitorjbl.xlsx"
] | com.monitorjbl.xlsx; | 843,838 |
public CcLibraryHelper addPicIndependentObjectFiles(Artifact... objectFiles) {
return addPicIndependentObjectFiles(Arrays.asList(objectFiles));
} | CcLibraryHelper function(Artifact... objectFiles) { return addPicIndependentObjectFiles(Arrays.asList(objectFiles)); } | /**
* Add the corresponding files as linker inputs for both PIC and non-PIC links.
*/ | Add the corresponding files as linker inputs for both PIC and non-PIC links | addPicIndependentObjectFiles | {
"repo_name": "hhclam/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/cpp/CcLibraryHelper.java",
"license": "apache-2.0",
"size": 43692
} | [
"com.google.devtools.build.lib.actions.Artifact",
"java.util.Arrays"
] | import com.google.devtools.build.lib.actions.Artifact; import java.util.Arrays; | import com.google.devtools.build.lib.actions.*; import java.util.*; | [
"com.google.devtools",
"java.util"
] | com.google.devtools; java.util; | 1,657,428 |
private boolean checkTouchSlop(View child, float dx, float dy) {
if (child == null) {
return false;
}
final boolean checkHorizontal = mCallback.getViewHorizontalDragRange(child) > 0;
final boolean checkVertical = mCallback.getViewVerticalDragRange(child) > 0;
if (checkHorizontal && checkVertical) {
return dx * dx + dy * dy > mTouchSlop * mTouchSlop;
} else if (checkHorizontal) {
return Math.abs(dx) > mTouchSlop;
} else if (checkVertical) {
return Math.abs(dy) > mTouchSlop;
}
return false;
}
/**
* Check if any pointer tracked in the current gesture has crossed
* the required slop threshold.
*
* <p>This depends on internal state populated by
* {@link #shouldInterceptTouchEvent(MotionEvent)} or
* {@link #processTouchEvent(MotionEvent)}. You should only rely on
* the results of this method after all currently available touch data
* has been provided to one of these two methods.</p>
*
* @param directions Combination of direction flags, see {@link #DIRECTION_HORIZONTAL},
* {@link #DIRECTION_VERTICAL}, {@link #DIRECTION_ALL} | boolean function(View child, float dx, float dy) { if (child == null) { return false; } final boolean checkHorizontal = mCallback.getViewHorizontalDragRange(child) > 0; final boolean checkVertical = mCallback.getViewVerticalDragRange(child) > 0; if (checkHorizontal && checkVertical) { return dx * dx + dy * dy > mTouchSlop * mTouchSlop; } else if (checkHorizontal) { return Math.abs(dx) > mTouchSlop; } else if (checkVertical) { return Math.abs(dy) > mTouchSlop; } return false; } /** * Check if any pointer tracked in the current gesture has crossed * the required slop threshold. * * <p>This depends on internal state populated by * {@link #shouldInterceptTouchEvent(MotionEvent)} or * {@link #processTouchEvent(MotionEvent)}. You should only rely on * the results of this method after all currently available touch data * has been provided to one of these two methods.</p> * * @param directions Combination of direction flags, see {@link #DIRECTION_HORIZONTAL}, * {@link #DIRECTION_VERTICAL}, {@link #DIRECTION_ALL} | /**
* Check if we've crossed a reasonable touch slop for the given child view.
* If the child cannot be dragged along the horizontal or vertical axis, motion
* along that axis will not count toward the slop check.
*
* @param child Child to check
* @param dx Motion since initial position along X axis
* @param dy Motion since initial position along Y axis
* @return true if the touch slop has been crossed
*/ | Check if we've crossed a reasonable touch slop for the given child view. If the child cannot be dragged along the horizontal or vertical axis, motion along that axis will not count toward the slop check | checkTouchSlop | {
"repo_name": "hejunlin2013/DragVideo",
"path": "app/src/main/java/com/hejunlin/dragvideo/CustomViewDragHelper.java",
"license": "apache-2.0",
"size": 61235
} | [
"android.view.MotionEvent",
"android.view.View"
] | import android.view.MotionEvent; import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 364,989 |
private Document objectToDocument(Object object) throws JaxonException {
JackObject jackObject = jack.toJack(object);
KlaxonObject klaxonEntry = j2k.jackToKlaxon(jackObject);
Document document = klaxon.toDocument(klaxonEntry);
return document;
} | Document function(Object object) throws JaxonException { JackObject jackObject = jack.toJack(object); KlaxonObject klaxonEntry = j2k.jackToKlaxon(jackObject); Document document = klaxon.toDocument(klaxonEntry); return document; } | /**
* Converts given object to document.
*
* @param object
* @return
* @throws JaxonException
*/ | Converts given object to document | objectToDocument | {
"repo_name": "martlin2cz/jaxon",
"path": "src/main/java/cz/martlin/jaxon/jaxon/JaxonConverter.java",
"license": "gpl-3.0",
"size": 3358
} | [
"cz.martlin.jaxon.jack.data.values.JackObject",
"cz.martlin.jaxon.klaxon.data.KlaxonObject",
"org.w3c.dom.Document"
] | import cz.martlin.jaxon.jack.data.values.JackObject; import cz.martlin.jaxon.klaxon.data.KlaxonObject; import org.w3c.dom.Document; | import cz.martlin.jaxon.jack.data.values.*; import cz.martlin.jaxon.klaxon.data.*; import org.w3c.dom.*; | [
"cz.martlin.jaxon",
"org.w3c.dom"
] | cz.martlin.jaxon; org.w3c.dom; | 866,176 |
public Dimension getPreferredScrollableViewportSize() {
Dimension size = super.getPreferredScrollableViewportSize();
size = (size == null) ? new Dimension(400, 400) : size;
Insets insets = getInsets();
size.width = (columns == 0) ? size.width
: columns * getColumnWidth() + insets.left + insets.right;
size.height = (rows == 0) ? size.height
: rows * getRowHeight() + insets.top + insets.bottom;
return size;
} | Dimension function() { Dimension size = super.getPreferredScrollableViewportSize(); size = (size == null) ? new Dimension(400, 400) : size; Insets insets = getInsets(); size.width = (columns == 0) ? size.width : columns * getColumnWidth() + insets.left + insets.right; size.height = (rows == 0) ? size.height : rows * getRowHeight() + insets.top + insets.bottom; return size; } | /**
* Returns the preferred size of the viewport if this component is embedded
* in a JScrollPane. This uses the desired column and row settings if they
* have been set, otherwise the superclass behavior is used.
*
* @return The preferredSize of a JViewport whose view is this Scrollable.
* @see JViewport#getPreferredSize
*/ | Returns the preferred size of the viewport if this component is embedded in a JScrollPane. This uses the desired column and row settings if they have been set, otherwise the superclass behavior is used | getPreferredScrollableViewportSize | {
"repo_name": "javalovercn/j2se_for_android",
"path": "src/javax/swing/JTextArea.java",
"license": "gpl-2.0",
"size": 18478
} | [
"java.awt.Dimension",
"java.awt.Insets"
] | import java.awt.Dimension; import java.awt.Insets; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,366,308 |
public CCNode addChild(CCNode child, int z,
float ratioX, float ratioY, float offsetX, float offsetY) {
assert child != null : "Argument must be non-null";
CCPointObject obj = new CCPointObject(ratioX, ratioY, offsetX, offsetY);
obj.setChild(child);
parallaxArray_.add(obj);
CGPoint pnt = getPosition();
float x = pnt.x * ratioX + offsetX;
float y = pnt.y * ratioY + offsetY;
child.setPosition(CGPoint.make(x, y));
return super.addChild(child, z, child.getTag());
} | CCNode function(CCNode child, int z, float ratioX, float ratioY, float offsetX, float offsetY) { assert child != null : STR; CCPointObject obj = new CCPointObject(ratioX, ratioY, offsetX, offsetY); obj.setChild(child); parallaxArray_.add(obj); CGPoint pnt = getPosition(); float x = pnt.x * ratioX + offsetX; float y = pnt.y * ratioY + offsetY; child.setPosition(CGPoint.make(x, y)); return super.addChild(child, z, child.getTag()); } | /** Adds a child to the container with a z-order, a parallax ratio and a position offset
It returns self, so you can chain several addChilds.
@since v0.8
*/ | Adds a child to the container with a z-order, a parallax ratio and a position offset | addChild | {
"repo_name": "ouyangwenyuan/androidapp",
"path": "tofuflee/src/org/cocos2d/nodes/CCParallaxNode.java",
"license": "apache-2.0",
"size": 4202
} | [
"org.cocos2d.types.CGPoint"
] | import org.cocos2d.types.CGPoint; | import org.cocos2d.types.*; | [
"org.cocos2d.types"
] | org.cocos2d.types; | 2,258,306 |
public void startExecuting()
{
this.taskOwner.setAttackTarget(this.attacker);
EntityLivingBase entitylivingbase = this.tameable.getOwner();
if (entitylivingbase != null)
{
this.timestamp = entitylivingbase.getRevengeTimer();
}
super.startExecuting();
} | void function() { this.taskOwner.setAttackTarget(this.attacker); EntityLivingBase entitylivingbase = this.tameable.getOwner(); if (entitylivingbase != null) { this.timestamp = entitylivingbase.getRevengeTimer(); } super.startExecuting(); } | /**
* Execute a one shot task or start executing a continuous task
*/ | Execute a one shot task or start executing a continuous task | startExecuting | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/entity/ai/EntityAIOwnerHurtByTarget.java",
"license": "gpl-3.0",
"size": 1664
} | [
"net.minecraft.entity.EntityLivingBase"
] | import net.minecraft.entity.EntityLivingBase; | import net.minecraft.entity.*; | [
"net.minecraft.entity"
] | net.minecraft.entity; | 860,560 |
private static Object readField(Field field, Object target) throws IllegalAccessException {
return readField(field, target, false);
} | static Object function(Field field, Object target) throws IllegalAccessException { return readField(field, target, false); } | /**
* Reads an accessible Field.
*
* @param field the field to use
* @param target the object to call on, may be null for static fields
* @return the field value
* @throws IllegalArgumentException if the field is null
* @throws IllegalAccessException if the field is not accessible
*/ | Reads an accessible Field | readField | {
"repo_name": "joel-costigliola/assertj-core",
"path": "src/main/java/org/assertj/core/util/introspection/FieldUtils.java",
"license": "apache-2.0",
"size": 6625
} | [
"java.lang.reflect.Field"
] | import java.lang.reflect.Field; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 1,579,203 |
public final void addListener(ConfigurationKey key,
PropertyChangeListener p) {
if (pcl == null) {
pcl = new PropertyChangeSupport(this);
}
LOG.debug("addPropertyChangeListener("
+ key.getKey() + ")");
pcl.addPropertyChangeListener(key.getKey(), p);
} | final void function(ConfigurationKey key, PropertyChangeListener p) { if (pcl == null) { pcl = new PropertyChangeSupport(this); } LOG.debug(STR + key.getKey() + ")"); pcl.addPropertyChangeListener(key.getKey(), p); } | /**
* Adds a property change listener.Static for simplicity of use.
*
* @param key The specific key to listen for.
* @param p The class which will listen for property changes.
*/ | Adds a property change listener.Static for simplicity of use | addListener | {
"repo_name": "carvalhomb/tsmells",
"path": "sample/argouml/argouml/org/argouml/application/configuration/ConfigurationHandler.java",
"license": "gpl-2.0",
"size": 16877
} | [
"java.beans.PropertyChangeListener",
"java.beans.PropertyChangeSupport",
"org.argouml.application.api.ConfigurationKey"
] | import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import org.argouml.application.api.ConfigurationKey; | import java.beans.*; import org.argouml.application.api.*; | [
"java.beans",
"org.argouml.application"
] | java.beans; org.argouml.application; | 395,572 |
public static long countFailures(Result<?>... results) {
return Stream.of(results).filter(Result::isFailure).count();
} | static long function(Result<?>... results) { return Stream.of(results).filter(Result::isFailure).count(); } | /**
* Counts how many of the results are failures.
*
* @param results the results to check
* @return the number of results that are failures
*/ | Counts how many of the results are failures | countFailures | {
"repo_name": "OpenGamma/Strata",
"path": "modules/collect/src/main/java/com/opengamma/strata/collect/result/Result.java",
"license": "apache-2.0",
"size": 43278
} | [
"java.util.stream.Stream"
] | import java.util.stream.Stream; | import java.util.stream.*; | [
"java.util"
] | java.util; | 716,488 |
public void setObjectMapper(ObjectMapper objectMapper) {
this.objectMapper = objectMapper;
} | void function(ObjectMapper objectMapper) { this.objectMapper = objectMapper; } | /**
* Custom Jackson ObjectMapper to use when serializing/deserializing
* Salesforce objects.
*/ | Custom Jackson ObjectMapper to use when serializing/deserializing Salesforce objects | setObjectMapper | {
"repo_name": "objectiser/camel",
"path": "components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceEndpointConfig.java",
"license": "apache-2.0",
"size": 24729
} | [
"com.fasterxml.jackson.databind.ObjectMapper"
] | import com.fasterxml.jackson.databind.ObjectMapper; | import com.fasterxml.jackson.databind.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 2,085,306 |
@Override
protected Dialog onCreateDialog(int id) {
switch (id) {
case DLG_Allergien:
return createDialog();
case DLG_Medikamente:
return createDialog2();
default:
return null;
}
} | Dialog function(int id) { switch (id) { case DLG_Allergien: return createDialog(); case DLG_Medikamente: return createDialog2(); default: return null; } } | /**
* Called to create a dialog to be shown.
*/ | Called to create a dialog to be shown | onCreateDialog | {
"repo_name": "wrk-fmd/CoCeCl",
"path": "app/src/main/java/it/fmd/cocecl/PatmanActivity.java",
"license": "gpl-3.0",
"size": 12237
} | [
"android.app.Dialog"
] | import android.app.Dialog; | import android.app.*; | [
"android.app"
] | android.app; | 948,835 |
public static byte[] createByteArray(BytesWritable sourceBw){
//TODO should replace with BytesWritable.copyData() once Hive
//removes support for the Hadoop 0.20 series.
return Arrays.copyOf(sourceBw.getBytes(), sourceBw.getLength());
} | static byte[] function(BytesWritable sourceBw){ return Arrays.copyOf(sourceBw.getBytes(), sourceBw.getLength()); } | /**
* gets a byte[] with copy of data from source BytesWritable
* @param sourceBw - source BytesWritable
*/ | gets a byte[] with copy of data from source BytesWritable | createByteArray | {
"repo_name": "vergilchiu/hive",
"path": "serde/src/java/org/apache/hadoop/hive/serde2/lazy/LazyUtils.java",
"license": "apache-2.0",
"size": 16463
} | [
"java.util.Arrays",
"org.apache.hadoop.io.BytesWritable"
] | import java.util.Arrays; import org.apache.hadoop.io.BytesWritable; | import java.util.*; import org.apache.hadoop.io.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 574,623 |
@Override
public LegendItem getLegendItem(int datasetIndex, int series) {
XYPlot plot = getPlot();
if (plot == null) {
return null;
}
XYDataset dataset = plot.getDataset(datasetIndex);
if (dataset == null) {
return null;
}
if (!getItemVisible(series, 0)) {
return null;
}
String label = getLegendItemLabelGenerator().generateLabel(dataset,
series);
String description = label;
String toolTipText = null;
if (getLegendItemToolTipGenerator() != null) {
toolTipText = getLegendItemToolTipGenerator().generateLabel(
dataset, series);
}
String urlText = null;
if (getLegendItemURLGenerator() != null) {
urlText = getLegendItemURLGenerator().generateLabel(dataset,
series);
}
boolean shapeIsVisible = getItemShapeVisible(series, 0);
Shape shape = lookupLegendShape(series);
boolean shapeIsFilled = getItemShapeFilled(series, 0);
Paint fillPaint = (this.useFillPaint ? lookupSeriesFillPaint(series)
: lookupSeriesPaint(series));
boolean shapeOutlineVisible = this.drawOutlines;
Paint outlinePaint = (this.useOutlinePaint ? lookupSeriesOutlinePaint(
series) : lookupSeriesPaint(series));
Stroke outlineStroke = lookupSeriesOutlineStroke(series);
boolean lineVisible = getItemLineVisible(series, 0);
Stroke lineStroke = lookupSeriesStroke(series);
Paint linePaint = lookupSeriesPaint(series);
LegendItem result = new LegendItem(label, description, toolTipText,
urlText, shapeIsVisible, shape, shapeIsFilled, fillPaint,
shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible,
this.legendLine, lineStroke, linePaint);
result.setLabelFont(lookupLegendTextFont(series));
Paint labelPaint = lookupLegendTextPaint(series);
if (labelPaint != null) {
result.setLabelPaint(labelPaint);
}
result.setSeriesKey(dataset.getSeriesKey(series));
result.setSeriesIndex(series);
result.setDataset(dataset);
result.setDatasetIndex(datasetIndex);
return result;
}
| LegendItem function(int datasetIndex, int series) { XYPlot plot = getPlot(); if (plot == null) { return null; } XYDataset dataset = plot.getDataset(datasetIndex); if (dataset == null) { return null; } if (!getItemVisible(series, 0)) { return null; } String label = getLegendItemLabelGenerator().generateLabel(dataset, series); String description = label; String toolTipText = null; if (getLegendItemToolTipGenerator() != null) { toolTipText = getLegendItemToolTipGenerator().generateLabel( dataset, series); } String urlText = null; if (getLegendItemURLGenerator() != null) { urlText = getLegendItemURLGenerator().generateLabel(dataset, series); } boolean shapeIsVisible = getItemShapeVisible(series, 0); Shape shape = lookupLegendShape(series); boolean shapeIsFilled = getItemShapeFilled(series, 0); Paint fillPaint = (this.useFillPaint ? lookupSeriesFillPaint(series) : lookupSeriesPaint(series)); boolean shapeOutlineVisible = this.drawOutlines; Paint outlinePaint = (this.useOutlinePaint ? lookupSeriesOutlinePaint( series) : lookupSeriesPaint(series)); Stroke outlineStroke = lookupSeriesOutlineStroke(series); boolean lineVisible = getItemLineVisible(series, 0); Stroke lineStroke = lookupSeriesStroke(series); Paint linePaint = lookupSeriesPaint(series); LegendItem result = new LegendItem(label, description, toolTipText, urlText, shapeIsVisible, shape, shapeIsFilled, fillPaint, shapeOutlineVisible, outlinePaint, outlineStroke, lineVisible, this.legendLine, lineStroke, linePaint); result.setLabelFont(lookupLegendTextFont(series)); Paint labelPaint = lookupLegendTextPaint(series); if (labelPaint != null) { result.setLabelPaint(labelPaint); } result.setSeriesKey(dataset.getSeriesKey(series)); result.setSeriesIndex(series); result.setDataset(dataset); result.setDatasetIndex(datasetIndex); return result; } | /**
* Returns a legend item for the specified series.
*
* @param datasetIndex the dataset index (zero-based).
* @param series the series index (zero-based).
*
* @return A legend item for the series (possibly {@code null}).
*/ | Returns a legend item for the specified series | getLegendItem | {
"repo_name": "simon04/jfreechart",
"path": "src/main/java/org/jfree/chart/renderer/xy/XYLineAndShapeRenderer.java",
"license": "lgpl-2.1",
"size": 47113
} | [
"java.awt.Paint",
"java.awt.Shape",
"java.awt.Stroke",
"org.jfree.chart.LegendItem",
"org.jfree.chart.plot.XYPlot",
"org.jfree.data.xy.XYDataset"
] | import java.awt.Paint; import java.awt.Shape; import java.awt.Stroke; import org.jfree.chart.LegendItem; import org.jfree.chart.plot.XYPlot; import org.jfree.data.xy.XYDataset; | import java.awt.*; import org.jfree.chart.*; import org.jfree.chart.plot.*; import org.jfree.data.xy.*; | [
"java.awt",
"org.jfree.chart",
"org.jfree.data"
] | java.awt; org.jfree.chart; org.jfree.data; | 2,501,842 |
public Map<Integer, Long> getMaxLastSeenTxnByPartition(); | Map<Integer, Long> function(); | /**
* IV2 ONLY:
* Get the map of the max TXN ID seen for each partition in the command l0g
*/ | Get the map of the max TXN ID seen for each partition in the command l0g | getMaxLastSeenTxnByPartition | {
"repo_name": "migue/voltdb",
"path": "src/frontend/org/voltdb/CommandLogReinitiator.java",
"license": "agpl-3.0",
"size": 3733
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,650,776 |
@Override
public TextGraphics subAreaGraphics(final TerminalPosition terminalPosition)
{
TerminalSize newArea;
newArea = areaSize.withColumns(areaSize.getColumns() - terminalPosition.getColumn());
newArea = newArea.withRows(areaSize.getRows() - terminalPosition.getRow());
return subAreaGraphics(terminalPosition, newArea);
} | TextGraphics function(final TerminalPosition terminalPosition) { TerminalSize newArea; newArea = areaSize.withColumns(areaSize.getColumns() - terminalPosition.getColumn()); newArea = newArea.withRows(areaSize.getRows() - terminalPosition.getRow()); return subAreaGraphics(terminalPosition, newArea); } | /**
* Creates a new TextGraphics object using the same area or smaller. Use the
* terminalPosition variable to determine what the new TextGraphics object
* will cover.
* @param terminalPosition In local coordinates of the current TextGraphics,
* the left-left coordinates of the new TextGraphics
* @return A new TextGraphics object covering the same or smaller area as
* this
*/ | Creates a new TextGraphics object using the same area or smaller. Use the terminalPosition variable to determine what the new TextGraphics object will cover | subAreaGraphics | {
"repo_name": "aaron-santos/lanterna",
"path": "src/main/java/com/googlecode/lanterna/gui/TextGraphicsImpl.java",
"license": "lgpl-3.0",
"size": 12549
} | [
"com.googlecode.lanterna.terminal.TerminalPosition",
"com.googlecode.lanterna.terminal.TerminalSize"
] | import com.googlecode.lanterna.terminal.TerminalPosition; import com.googlecode.lanterna.terminal.TerminalSize; | import com.googlecode.lanterna.terminal.*; | [
"com.googlecode.lanterna"
] | com.googlecode.lanterna; | 925,968 |
void thumbnailPassStarted(ImageReader source,
BufferedImage theThumbnail,
int pass,
int minPass, int maxPass,
int minX, int minY,
int periodX, int periodY,
int[] bands); | void thumbnailPassStarted(ImageReader source, BufferedImage theThumbnail, int pass, int minPass, int maxPass, int minX, int minY, int periodX, int periodY, int[] bands); | /**
* Reports that the current thumbnail read operation is about to
* begin a progressive pass. Readers of formats that support
* progressive encoding should use this to notify clients when
* each pass is completed when reading a progressively encoded
* thumbnail image.
*
* @param source the <code>ImageReader</code> object calling this
* method.
* @param theThumbnail the <code>BufferedImage</code> thumbnail
* being updated.
* @param pass the number of the pass that is about to begin,
* starting with 0.
* @param minPass the index of the first pass that will be decoded.
* @param maxPass the index of the last pass that will be decoded.
* @param minX the X coordinate of the leftmost updated column
* of pixels.
* @param minY the Y coordinate of the uppermost updated row
* of pixels.
* @param periodX the horizontal spacing between updated pixels;
* a value of 1 means no gaps.
* @param periodY the vertical spacing between updated pixels;
* a value of 1 means no gaps.
* @param bands an array of <code>int</code>s indicating the the
* set bands that may be updated.
*
* @see #passStarted
*/ | Reports that the current thumbnail read operation is about to begin a progressive pass. Readers of formats that support progressive encoding should use this to notify clients when each pass is completed when reading a progressively encoded thumbnail image | thumbnailPassStarted | {
"repo_name": "wangsongpeng/jdk-src",
"path": "src/main/java/javax/imageio/event/IIOReadUpdateListener.java",
"license": "apache-2.0",
"size": 9647
} | [
"java.awt.image.BufferedImage",
"javax.imageio.ImageReader"
] | import java.awt.image.BufferedImage; import javax.imageio.ImageReader; | import java.awt.image.*; import javax.imageio.*; | [
"java.awt",
"javax.imageio"
] | java.awt; javax.imageio; | 643,203 |
@SuppressWarnings("unchecked")
public void setForcedReadOnlyFields(Map forcedReadOnlyFields) {
this.forcedReadOnlyFields = forcedReadOnlyFields;
} | @SuppressWarnings(STR) void function(Map forcedReadOnlyFields) { this.forcedReadOnlyFields = forcedReadOnlyFields; } | /**
* Sets the forcedReadOnlyFields attribute value.
*
* @param forcedReadOnlyFields The forcedReadOnlyFields to set.
*/ | Sets the forcedReadOnlyFields attribute value | setForcedReadOnlyFields | {
"repo_name": "quikkian-ua-devops/will-financials",
"path": "kfs-kns/src/main/java/org/kuali/kfs/kns/web/struts/form/KualiTransactionalDocumentFormBase.java",
"license": "agpl-3.0",
"size": 8257
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,527,547 |
public static ModelPackage init() {
if (isInited) return (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI);
// Obtain or create and register package
ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ModelPackageImpl());
isInited = true;
// Create package meta-data objects
theModelPackage.createPackageContents();
// Initialize created meta-data
theModelPackage.initializePackageContents();
// Mark meta-data to indicate it can't be changed
theModelPackage.freeze();
// Update the registry and return the package
EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
return theModelPackage;
} | static ModelPackage function() { if (isInited) return (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI); ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ModelPackageImpl()); isInited = true; theModelPackage.createPackageContents(); theModelPackage.initializePackageContents(); theModelPackage.freeze(); EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage); return theModelPackage; } | /**
* Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
*
* <p>This method is used to initialize {@link ModelPackage#eINSTANCE} when that field is accessed.
* Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #eNS_URI
* @see #createPackageContents()
* @see #initializePackageContents()
* @generated
*/ | Creates, registers, and initializes the Package for this model, and for any others upon which it depends. This method is used to initialize <code>ModelPackage#eINSTANCE</code> when that field is accessed. Clients should not invoke it directly. Instead, they should simply access that field to obtain the package. | init | {
"repo_name": "andre-santos-pt/viscte",
"path": "pt.iscte.osgi.viscte.model/src/pt/iscte/osgi/viscte/model/impl/ModelPackageImpl.java",
"license": "epl-1.0",
"size": 13757
} | [
"org.eclipse.emf.ecore.EPackage",
"pt.iscte.osgi.viscte.model.ModelPackage"
] | import org.eclipse.emf.ecore.EPackage; import pt.iscte.osgi.viscte.model.ModelPackage; | import org.eclipse.emf.ecore.*; import pt.iscte.osgi.viscte.model.*; | [
"org.eclipse.emf",
"pt.iscte.osgi"
] | org.eclipse.emf; pt.iscte.osgi; | 1,228,052 |
public static Color blend(Color color1, Color color2) {
return ColorUtil.blend(color1, color2, 0.5);
} | static Color function(Color color1, Color color2) { return ColorUtil.blend(color1, color2, 0.5); } | /**
* Make an even blend between two colors.
*
* @param color1 First color to blend.
* @param color2 Second color to blend.
* @return Blended color.
*/ | Make an even blend between two colors | blend | {
"repo_name": "guusdk/Spark",
"path": "core/src/main/java/org/jivesoftware/spark/util/ColorUtil.java",
"license": "apache-2.0",
"size": 6948
} | [
"java.awt.Color"
] | import java.awt.Color; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,268,414 |
public void recordSecondaryLink(NodeRef nodeRef)
{
Set<NodeRef> nodes = nodesWithSecondaryLinks.get(index);
if (nodes == null)
{
nodes = new HashSet<NodeRef>();
nodesWithSecondaryLinks.put(index, nodes);
}
nodes.add(nodeRef);
}
| void function(NodeRef nodeRef) { Set<NodeRef> nodes = nodesWithSecondaryLinks.get(index); if (nodes == null) { nodes = new HashSet<NodeRef>(); nodesWithSecondaryLinks.put(index, nodes); } nodes.add(nodeRef); } | /**
* Record that secondary links exist for node
*
* @param nodeRef
*/ | Record that secondary links exist for node | recordSecondaryLink | {
"repo_name": "daniel-he/community-edition",
"path": "projects/repository/source/java/org/alfresco/repo/exporter/ExporterComponent.java",
"license": "lgpl-3.0",
"size": 47106
} | [
"java.util.HashSet",
"java.util.Set",
"org.alfresco.service.cmr.repository.NodeRef"
] | import java.util.HashSet; import java.util.Set; import org.alfresco.service.cmr.repository.NodeRef; | import java.util.*; import org.alfresco.service.cmr.repository.*; | [
"java.util",
"org.alfresco.service"
] | java.util; org.alfresco.service; | 2,457,633 |
// public boolean isSummaryPeriodCalcAmountChanged(BudgetPeriod budgetPeriod);
boolean checkForOutstandingBudgets(Award award); | boolean checkForOutstandingBudgets(Award award); | /**
* Checks for budgets that have not been posted, cancelled or rejected.
* @param event
* @param award
* @return true if any unfinalized budgets are found
* @throws WorkflowException
*/ | Checks for budgets that have not been posted, cancelled or rejected | checkForOutstandingBudgets | {
"repo_name": "jwillia/kc-old1",
"path": "coeus-impl/src/main/java/org/kuali/kra/award/budget/AwardBudgetService.java",
"license": "agpl-3.0",
"size": 5252
} | [
"org.kuali.kra.award.home.Award"
] | import org.kuali.kra.award.home.Award; | import org.kuali.kra.award.home.*; | [
"org.kuali.kra"
] | org.kuali.kra; | 1,128,338 |
public void onOptsChanged() {
mOpts.validate();
// Placeholder and progress.
if ((mOpts.features & ExtendedOptions.FEATURE_STATE_CHANGES) != 0) {
final int fadeOutDurationMs = mResources.getInteger(R.integer.bitmap_fade_animation_duration);
mProgressDelayMs = mResources.getInteger(R.integer.bitmap_progress_animation_delay);
// Placeholder is not optional because backgroundColor is part of it.
Drawable placeholder = null;
int placeholderWidth = mResources.getDimensionPixelSize(R.dimen.placeholder_size);
int placeholderHeight = mResources.getDimensionPixelSize(R.dimen.placeholder_size);
if (mOpts.placeholder != null) {
ConstantState constantState = mOpts.placeholder.getConstantState();
if (constantState != null) {
placeholder = constantState.newDrawable(mResources);
Rect bounds = mOpts.placeholder.getBounds();
if (bounds.width() != 0) {
placeholderWidth = bounds.width();
} else if (placeholder.getIntrinsicWidth() != -1) {
placeholderWidth = placeholder.getIntrinsicWidth();
}
if (bounds.height() != 0) {
placeholderHeight = bounds.height();
} else if (placeholder.getIntrinsicHeight() != -1) {
placeholderHeight = placeholder.getIntrinsicHeight();
}
}
}
mPlaceholder = new Placeholder(placeholder, mResources, placeholderWidth, placeholderHeight,
fadeOutDurationMs, mOpts);
mPlaceholder.setCallback(this);
mPlaceholder.setBounds(getBounds());
// Progress bar is optional.
if (mOpts.progressBar != null) {
int progressBarSize = mResources.getDimensionPixelSize(R.dimen.progress_bar_size);
mProgress = new Progress(mOpts.progressBar.getConstantState().newDrawable(mResources), mResources,
progressBarSize, progressBarSize, fadeOutDurationMs, mOpts);
mProgress.setCallback(this);
mProgress.setBounds(getBounds());
} else {
mProgress = null;
}
}
setLoadState(mLoadState);
} | void function() { mOpts.validate(); if ((mOpts.features & ExtendedOptions.FEATURE_STATE_CHANGES) != 0) { final int fadeOutDurationMs = mResources.getInteger(R.integer.bitmap_fade_animation_duration); mProgressDelayMs = mResources.getInteger(R.integer.bitmap_progress_animation_delay); Drawable placeholder = null; int placeholderWidth = mResources.getDimensionPixelSize(R.dimen.placeholder_size); int placeholderHeight = mResources.getDimensionPixelSize(R.dimen.placeholder_size); if (mOpts.placeholder != null) { ConstantState constantState = mOpts.placeholder.getConstantState(); if (constantState != null) { placeholder = constantState.newDrawable(mResources); Rect bounds = mOpts.placeholder.getBounds(); if (bounds.width() != 0) { placeholderWidth = bounds.width(); } else if (placeholder.getIntrinsicWidth() != -1) { placeholderWidth = placeholder.getIntrinsicWidth(); } if (bounds.height() != 0) { placeholderHeight = bounds.height(); } else if (placeholder.getIntrinsicHeight() != -1) { placeholderHeight = placeholder.getIntrinsicHeight(); } } } mPlaceholder = new Placeholder(placeholder, mResources, placeholderWidth, placeholderHeight, fadeOutDurationMs, mOpts); mPlaceholder.setCallback(this); mPlaceholder.setBounds(getBounds()); if (mOpts.progressBar != null) { int progressBarSize = mResources.getDimensionPixelSize(R.dimen.progress_bar_size); mProgress = new Progress(mOpts.progressBar.getConstantState().newDrawable(mResources), mResources, progressBarSize, progressBarSize, fadeOutDurationMs, mOpts); mProgress.setCallback(this); mProgress.setBounds(getBounds()); } else { mProgress = null; } } setLoadState(mLoadState); } | /**
* Called after a field is changed in an {@link ExtendedOptions}, if that field requests this
* method to be called.
*/ | Called after a field is changed in an <code>ExtendedOptions</code>, if that field requests this method to be called | onOptsChanged | {
"repo_name": "s20121035/rk3288_android5.1_repo",
"path": "frameworks/opt/bitmap/src/com/android/bitmap/drawable/ExtendedBitmapDrawable.java",
"license": "gpl-3.0",
"size": 31235
} | [
"android.graphics.Rect",
"android.graphics.drawable.Drawable"
] | import android.graphics.Rect; import android.graphics.drawable.Drawable; | import android.graphics.*; import android.graphics.drawable.*; | [
"android.graphics"
] | android.graphics; | 210,885 |
Collection<Reservation> getReservations(); | Collection<Reservation> getReservations(); | /**
* Returns all current {@link Reservation} in the system.
*
* @return
*/ | Returns all current <code>Reservation</code> in the system | getReservations | {
"repo_name": "b2ihealthcare/snow-owl",
"path": "cis/com.b2international.snowowl.snomed.cis/src/com/b2international/snowowl/snomed/cis/reservations/ISnomedIdentifierReservationService.java",
"license": "apache-2.0",
"size": 2520
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 320,340 |
List<Node> getNodesInTo(Node node, Endpoint n); | List<Node> getNodesInTo(Node node, Endpoint n); | /**
* Nodes adjacent to the given node with the given proximal endpoint.
*/ | Nodes adjacent to the given node with the given proximal endpoint | getNodesInTo | {
"repo_name": "lizziesilver/tetrad",
"path": "tetrad-lib/src/main/java/edu/cmu/tetrad/graph/Graph.java",
"license": "gpl-2.0",
"size": 21477
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 201,536 |
public Map getRelatedSchoolYears(Resource rsc) {
HashMap yearMap = null;
try {
Collection rscColl = rsc.findRelatedSchoolYears();
yearMap = new HashMap(rscColl.size());
for (Iterator iter = rscColl.iterator(); iter.hasNext();) {
SchoolYear aYear = (SchoolYear) iter.next();
yearMap.put(aYear.getPrimaryKey(), aYear);
}
return yearMap;
} catch (IDORelationshipException e) {
e.printStackTrace();
}
return yearMap;
} | Map function(Resource rsc) { HashMap yearMap = null; try { Collection rscColl = rsc.findRelatedSchoolYears(); yearMap = new HashMap(rscColl.size()); for (Iterator iter = rscColl.iterator(); iter.hasNext();) { SchoolYear aYear = (SchoolYear) iter.next(); yearMap.put(aYear.getPrimaryKey(), aYear); } return yearMap; } catch (IDORelationshipException e) { e.printStackTrace(); } return yearMap; } | /**
* Gets all SchoolYear instances from db related to the Resource rsc
* @param rsc The Resource
*/ | Gets all SchoolYear instances from db related to the Resource rsc | getRelatedSchoolYears | {
"repo_name": "idega/platform2",
"path": "src/se/idega/idegaweb/commune/care/resource/business/ResourceBusinessBean.java",
"license": "gpl-3.0",
"size": 33518
} | [
"com.idega.block.school.data.SchoolYear",
"com.idega.data.IDORelationshipException",
"java.util.Collection",
"java.util.HashMap",
"java.util.Iterator",
"java.util.Map",
"se.idega.idegaweb.commune.care.resource.data.Resource"
] | import com.idega.block.school.data.SchoolYear; import com.idega.data.IDORelationshipException; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import se.idega.idegaweb.commune.care.resource.data.Resource; | import com.idega.block.school.data.*; import com.idega.data.*; import java.util.*; import se.idega.idegaweb.commune.care.resource.data.*; | [
"com.idega.block",
"com.idega.data",
"java.util",
"se.idega.idegaweb"
] | com.idega.block; com.idega.data; java.util; se.idega.idegaweb; | 1,170,822 |
public void idht3(boolean scale) {
int oldNthreads = ConcurrencyUtils.getNumberOfThreads();
ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads));
if (dht3 == null) {
dht3 = new FloatDHT_3D(slices, rows, columns);
}
dht3.inverse(elements, scale);
ConcurrencyUtils.setNumberOfThreads(oldNthreads);
}
| void function(boolean scale) { int oldNthreads = ConcurrencyUtils.getNumberOfThreads(); ConcurrencyUtils.setNumberOfThreads(ConcurrencyUtils.nextPow2(oldNthreads)); if (dht3 == null) { dht3 = new FloatDHT_3D(slices, rows, columns); } dht3.inverse(elements, scale); ConcurrencyUtils.setNumberOfThreads(oldNthreads); } | /**
* Computes the 3D inverse of the discrete Hartley transform (IDHT) of this
* matrix.
*
* @param scale
* if true then scaling is performed
*
* @throws IllegalArgumentException
* if the slice size or the row size or the column size of this
* matrix is not a power of 2 number.
*
*/ | Computes the 3D inverse of the discrete Hartley transform (IDHT) of this matrix | idht3 | {
"repo_name": "Shappiro/GEOFRAME",
"path": "PROJECTS/oms3.proj.richards1d/src/JAVA/parallelcolt-code/src/cern/colt/matrix/tfloat/impl/DenseLargeFloatMatrix3D.java",
"license": "gpl-3.0",
"size": 32669
} | [
"edu.emory.mathcs.utils.ConcurrencyUtils"
] | import edu.emory.mathcs.utils.ConcurrencyUtils; | import edu.emory.mathcs.utils.*; | [
"edu.emory.mathcs"
] | edu.emory.mathcs; | 958,974 |
public void testVisitor() {
assertEquals(SECURITY.accept(TestVisitor.INSTANCE), "visited");
}
private static final class TestVisitor extends FinancialSecurityVisitorAdapter<String> {
public static final TestVisitor INSTANCE = new TestVisitor();
private TestVisitor() {
} | void function() { assertEquals(SECURITY.accept(TestVisitor.INSTANCE), STR); } private static final class TestVisitor extends FinancialSecurityVisitorAdapter<String> { public static final TestVisitor INSTANCE = new TestVisitor(); private TestVisitor() { } | /**
* Tests that the accept() method points to the correct method in the visitor.
*/ | Tests that the accept() method points to the correct method in the visitor | testVisitor | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial-types/src/test/java/com/opengamma/financial/security/cash/CashBalanceSecurityTest.java",
"license": "apache-2.0",
"size": 1895
} | [
"com.opengamma.financial.security.FinancialSecurityVisitorAdapter",
"org.testng.Assert"
] | import com.opengamma.financial.security.FinancialSecurityVisitorAdapter; import org.testng.Assert; | import com.opengamma.financial.security.*; import org.testng.*; | [
"com.opengamma.financial",
"org.testng"
] | com.opengamma.financial; org.testng; | 1,200,187 |
public SVGLength getBaseVal() {
if (baseVal == null) {
baseVal = new BaseSVGLength(direction);
}
return baseVal;
} | SVGLength function() { if (baseVal == null) { baseVal = new BaseSVGLength(direction); } return baseVal; } | /**
* <b>DOM</b>: Implements {@link SVGAnimatedLength#getBaseVal()}.
*/ | DOM: Implements <code>SVGAnimatedLength#getBaseVal()</code> | getBaseVal | {
"repo_name": "Groostav/CMPT880-term-project",
"path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/svg/AbstractSVGAnimatedLength.java",
"license": "apache-2.0",
"size": 11645
} | [
"org.w3c.dom.svg.SVGLength"
] | import org.w3c.dom.svg.SVGLength; | import org.w3c.dom.svg.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 2,055,148 |
private void setPrinciple(String rawText){
BigDecimal num = new BigDecimal(Double.parseDouble(rawText));
if(num.compareTo(new BigDecimal(0)) < 0){
throw new IllegalArgumentException("Principle can't be less than 0: " + num);
}
synchronized(this){
this.principle = num;
}
}
| void function(String rawText){ BigDecimal num = new BigDecimal(Double.parseDouble(rawText)); if(num.compareTo(new BigDecimal(0)) < 0){ throw new IllegalArgumentException(STR + num); } synchronized(this){ this.principle = num; } } | /**
* Sets the principle field. This method is private to only serve as
* a helper method for <tt>setStockDetails(StockDownloader,boolean)</tt>.
*
* @param rawText the text for the principle, the initial amount spent on this stock.
* @throws NumberFormatException if the raw text value wasn't properly
* parsed and is not a number value.
* @throws IllegalArgumentException if the value passed to this method is
* less than 0.
*/ | Sets the principle field. This method is private to only serve as a helper method for setStockDetails(StockDownloader,boolean) | setPrinciple | {
"repo_name": "craigmiller160/StockMarket-2.0",
"path": "src/main/java/io/craigmiller160/stockmarket/stock/DefaultOwnedStock.java",
"license": "apache-2.0",
"size": 16939
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 221,175 |
public void setModel(final Model model) {
this.model = model;
} | void function(final Model model) { this.model = model; } | /**
* Setter of model
*
* @param model
* the model to set
*/ | Setter of model | setModel | {
"repo_name": "TheProjecter/ztermapplet",
"path": "src/org/zhouer/zterm/view/ComponentHandler.java",
"license": "gpl-2.0",
"size": 795
} | [
"org.zhouer.zterm.model.Model"
] | import org.zhouer.zterm.model.Model; | import org.zhouer.zterm.model.*; | [
"org.zhouer.zterm"
] | org.zhouer.zterm; | 533,825 |
public void receiveHeaperIntoFrom(Category cat, Heaper memory, SpecialistRcvr rcvr) {
rcvr.basicReceiveInto((getRecipe(cat)), memory);
} | void function(Category cat, Heaper memory, SpecialistRcvr rcvr) { rcvr.basicReceiveInto((getRecipe(cat)), memory); } | /**
* No special cases. Punt to the rcvr.
*/ | No special cases. Punt to the rcvr | receiveHeaperIntoFrom | {
"repo_name": "jonesd/udanax-gold2java",
"path": "abora-gold/src/generated-sources/translator/info/dgjones/abora/gold/xcvr/TransferGeneralist.java",
"license": "mit",
"size": 2999
} | [
"info.dgjones.abora.gold.xcvr.SpecialistRcvr",
"info.dgjones.abora.gold.xpp.basic.Category",
"info.dgjones.abora.gold.xpp.basic.Heaper"
] | import info.dgjones.abora.gold.xcvr.SpecialistRcvr; import info.dgjones.abora.gold.xpp.basic.Category; import info.dgjones.abora.gold.xpp.basic.Heaper; | import info.dgjones.abora.gold.xcvr.*; import info.dgjones.abora.gold.xpp.basic.*; | [
"info.dgjones.abora"
] | info.dgjones.abora; | 2,318,028 |
public IgniteFuture<Void> clearAsync();
/**
* Clears entry from the cache and swap storage, without notifying listeners or
* {@link CacheWriter}s. Entry is cleared only if it is not currently locked,
* and is not participating in a transaction.
*
* @param key Key to clear.
* @throws IllegalStateException if the cache is {@link #isClosed()} | IgniteFuture<Void> function(); /** * Clears entry from the cache and swap storage, without notifying listeners or * {@link CacheWriter}s. Entry is cleared only if it is not currently locked, * and is not participating in a transaction. * * @param key Key to clear. * @throws IllegalStateException if the cache is {@link #isClosed()} | /**
* Asynchronously clears the contents of the cache, without notifying listeners or
* {@link CacheWriter}s.
*
* @return a Future representing pending completion of the operation.
*/ | Asynchronously clears the contents of the cache, without notifying listeners or <code>CacheWriter</code>s | clearAsync | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/IgniteCache.java",
"license": "apache-2.0",
"size": 72051
} | [
"javax.cache.integration.CacheWriter",
"org.apache.ignite.lang.IgniteFuture"
] | import javax.cache.integration.CacheWriter; import org.apache.ignite.lang.IgniteFuture; | import javax.cache.integration.*; import org.apache.ignite.lang.*; | [
"javax.cache",
"org.apache.ignite"
] | javax.cache; org.apache.ignite; | 1,861,563 |
@Nonnull
Vec3d getLoc(); | Vec3d getLoc(); | /**
* Get the position vector for this location.
*
* This will be the centre of the block for blocks.
*
* @return The decimal position for this location
*/ | Get the position vector for this location. This will be the centre of the block for blocks | getLoc | {
"repo_name": "SquidDev-CC/plethora",
"path": "src/main/java/org/squiddev/plethora/api/IWorldLocation.java",
"license": "mit",
"size": 1334
} | [
"net.minecraft.util.math.Vec3d"
] | import net.minecraft.util.math.Vec3d; | import net.minecraft.util.math.*; | [
"net.minecraft.util"
] | net.minecraft.util; | 1,367,314 |
private void processExifIFD(ContentHandler ch, RandomAccessFile tiffRAF, long ifdOffset, boolean useBigEndianOrdering) throws IOException,
SAXException {
// Start at the beginning of the EXIF IFD
long currentOffset = ifdOffset;
tiffRAF.seek(ifdOffset);
// The first two bytes contain the number of EXIF tags within the IFD
byte[] intBuffer = new byte[2];
int bytesRead = tiffRAF.read(intBuffer);
if (bytesRead != 2) {
throw new IOException("Could not read EXIF IFD Tag Entry Count at offset" + currentOffset);
}
currentOffset += 2;
int tagEntryCount = getIntFromBytes(intBuffer, useBigEndianOrdering);
// Each tag is represented by 12 bytes. If the tag value is small enough it will fit at the end of these
// 12 bytes, otherwise the tag value will point to an offset into the TIFF file which will contain the value.
for (int i = 0; i < tagEntryCount; i++) {
byte[] tagBytes = new byte[TIFF_TAG_SIZE];
bytesRead = tiffRAF.read(tagBytes);
if (bytesRead != TIFF_TAG_SIZE) {
throw new IOException("Could not read tag entry at offset" + currentOffset);
}
currentOffset += TIFF_TAG_SIZE;
int tagID = getIntFromBytes(tagBytes, TAG_ENTRY_TAG_ID_OFFSET, useBigEndianOrdering);
int dataType = getIntFromBytes(tagBytes, TAG_ENTRY_DATA_TYPE_OFFSET, useBigEndianOrdering);
long dataCount = getLongFromBytes(tagBytes, TAG_ENTRY_DATA_COUNT_OFFSET, useBigEndianOrdering);
byte[] tagValueBytes = new byte[4];
System.arraycopy(tagBytes, TAG_ENTRY_DATA_OFFSET, tagValueBytes, 0, 4);
String tagValue = "";
try {
// Obtain the tag value, either from the end of the tag's 12 bytes, or from the offset into the TIFF file
tagValue = getEXIFStringValue(tagID, tagValueBytes, tiffRAF, dataType, dataCount, useBigEndianOrdering);
} catch (Exception ex) {
tagValue = "INVALID TAG DATA";
}
// Write the tag to the Xena file
outputEXIFTag(ch, tagID, dataType, tagValue);
// We may have been reading from an offset into the TIFF file, so ensure that we return to the right spot in the RAF
tiffRAF.seek(currentOffset);
}
} | void function(ContentHandler ch, RandomAccessFile tiffRAF, long ifdOffset, boolean useBigEndianOrdering) throws IOException, SAXException { long currentOffset = ifdOffset; tiffRAF.seek(ifdOffset); byte[] intBuffer = new byte[2]; int bytesRead = tiffRAF.read(intBuffer); if (bytesRead != 2) { throw new IOException(STR + currentOffset); } currentOffset += 2; int tagEntryCount = getIntFromBytes(intBuffer, useBigEndianOrdering); for (int i = 0; i < tagEntryCount; i++) { byte[] tagBytes = new byte[TIFF_TAG_SIZE]; bytesRead = tiffRAF.read(tagBytes); if (bytesRead != TIFF_TAG_SIZE) { throw new IOException(STR + currentOffset); } currentOffset += TIFF_TAG_SIZE; int tagID = getIntFromBytes(tagBytes, TAG_ENTRY_TAG_ID_OFFSET, useBigEndianOrdering); int dataType = getIntFromBytes(tagBytes, TAG_ENTRY_DATA_TYPE_OFFSET, useBigEndianOrdering); long dataCount = getLongFromBytes(tagBytes, TAG_ENTRY_DATA_COUNT_OFFSET, useBigEndianOrdering); byte[] tagValueBytes = new byte[4]; System.arraycopy(tagBytes, TAG_ENTRY_DATA_OFFSET, tagValueBytes, 0, 4); String tagValue = STRINVALID TAG DATA"; } outputEXIFTag(ch, tagID, dataType, tagValue); tiffRAF.seek(currentOffset); } } | /**
* Extract the individual EXIF tags from the EXIF IFD - a data structure which may contain many tags, the
* data for each which may be at various offsets throughout the TIFF file. Each tag will be output
* to the normalised Xena file.
* @param ch ContentHandler which will write XML to the Xena file
* @param tiffRAF RandomAccessFile of the original TIFF file
* @param ifdOffset IFD offset - the offset into the original TIFF file on which the EXIF IFD data structure begins
* @param useBigEndianOrdering
* @throws IOException
* @throws SAXException
*/ | Extract the individual EXIF tags from the EXIF IFD - a data structure which may contain many tags, the data for each which may be at various offsets throughout the TIFF file. Each tag will be output to the normalised Xena file | processExifIFD | {
"repo_name": "srnsw/xena",
"path": "plugins/image/src/au/gov/naa/digipres/xena/plugin/image/tiff/TiffToXenaPngNormaliser.java",
"license": "gpl-3.0",
"size": 38593
} | [
"java.io.IOException",
"java.io.RandomAccessFile",
"org.xml.sax.ContentHandler",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.io.RandomAccessFile; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; | import java.io.*; import org.xml.sax.*; | [
"java.io",
"org.xml.sax"
] | java.io; org.xml.sax; | 2,068,925 |
private ReplicaInfo getReplicaInfo(String bpid, long blkid)
throws ReplicaNotFoundException {
ReplicaInfo info = volumeMap.get(bpid, blkid);
if (info == null) {
throw new ReplicaNotFoundException(
ReplicaNotFoundException.NON_EXISTENT_REPLICA + bpid + ":" + blkid);
}
return info;
} | ReplicaInfo function(String bpid, long blkid) throws ReplicaNotFoundException { ReplicaInfo info = volumeMap.get(bpid, blkid); if (info == null) { throw new ReplicaNotFoundException( ReplicaNotFoundException.NON_EXISTENT_REPLICA + bpid + ":" + blkid); } return info; } | /**
* Get the meta info of a block stored in volumeMap. Block is looked up
* without matching the generation stamp.
* @param bpid block pool Id
* @param blkid block Id
* @return the meta replica information; null if block was not found
* @throws ReplicaNotFoundException if no entry is in the map or
* there is a generation stamp mismatch
*/ | Get the meta info of a block stored in volumeMap. Block is looked up without matching the generation stamp | getReplicaInfo | {
"repo_name": "f7753/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java",
"license": "apache-2.0",
"size": 113025
} | [
"org.apache.hadoop.hdfs.server.datanode.ReplicaInfo",
"org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException"
] | import org.apache.hadoop.hdfs.server.datanode.ReplicaInfo; import org.apache.hadoop.hdfs.server.datanode.ReplicaNotFoundException; | import org.apache.hadoop.hdfs.server.datanode.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 767,828 |
public void setInactiveTimeTo(Context context, int minutes, OnConfigChangedListener listener) {
boolean changed = mInactiveTimeTo != (mInactiveTimeTo = minutes);
saveOption(context, KEY_INACTIVE_TIME_TO, minutes, listener, changed);
} | void function(Context context, int minutes, OnConfigChangedListener listener) { boolean changed = mInactiveTimeTo != (mInactiveTimeTo = minutes); saveOption(context, KEY_INACTIVE_TIME_TO, minutes, listener, changed); } | /**
* Setter for the time "night mode" should end.
*/ | Setter for the time "night mode" should end | setInactiveTimeTo | {
"repo_name": "makovkastar/AcDisplay",
"path": "project/app/src/main/java/com/achep/acdisplay/Config.java",
"license": "gpl-2.0",
"size": 40385
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 2,039,838 |
@ApiModelProperty(example = "null", value = "Voicemail Notifications Object. See below for details. Can be set to NULL to disable notifications.")
public Notification getNotifications() {
return notifications;
} | @ApiModelProperty(example = "null", value = STR) Notification function() { return notifications; } | /**
* Voicemail Notifications Object. See below for details. Can be set to NULL to disable notifications.
* @return notifications
**/ | Voicemail Notifications Object. See below for details. Can be set to NULL to disable notifications | getNotifications | {
"repo_name": "vladutbutnaru/java-phonecom-sdk",
"path": "src/main/java/io/swagger/client/model/Voicemail.java",
"license": "apache-2.0",
"size": 6537
} | [
"io.swagger.annotations.ApiModelProperty",
"io.swagger.client.model.Notification"
] | import io.swagger.annotations.ApiModelProperty; import io.swagger.client.model.Notification; | import io.swagger.annotations.*; import io.swagger.client.model.*; | [
"io.swagger.annotations",
"io.swagger.client"
] | io.swagger.annotations; io.swagger.client; | 1,397,991 |
public void addExternalAssessment(String gradebookUid, String externalId, String externalUrl,
String title, Double points, Date dueDate, String externalServiceDescription, Boolean ungraded)
throws GradebookNotFoundException, ConflictingAssignmentNameException,
ConflictingExternalIdException, AssignmentHasIllegalPointsException;
| void function(String gradebookUid, String externalId, String externalUrl, String title, Double points, Date dueDate, String externalServiceDescription, Boolean ungraded) throws GradebookNotFoundException, ConflictingAssignmentNameException, ConflictingExternalIdException, AssignmentHasIllegalPointsException; | /**
* Add an externally-managed assessment to a gradebook to be treated as a
* read-only assignment. The gradebook application will not modify the
* assessment properties or create any scores for the assessment.
* Since each assignment in a given gradebook must have a unique name,
* conflicts are possible.
*
* @param gradebookUid
* @param externalId
* some unique identifier which Samigo uses for the assessment.
* The externalId is globally namespaced within the gradebook, so
* if other apps decide to put assessments into the gradebook,
* they should prefix their externalIds with a well known (and
* unique within sakai) string.
* @param externalUrl
* a link to go to if the instructor or student wants to look at the assessment
* in Samigo; if null, no direct link will be provided in the
* gradebook, and the user will have to navigate to the assessment
* within the other application
* @param title
* @param points
* this is the total amount of points available and must be greater than zero.
* it could be null if it's an ungraded item.
* @param dueDate
* @param externalServiceDescription
* @param ungraded
*
* @param externalServiceDescription
* what to display as the source of the assignment (e.g., "from Samigo")
*
*/ | Add an externally-managed assessment to a gradebook to be treated as a read-only assignment. The gradebook application will not modify the assessment properties or create any scores for the assessment. Since each assignment in a given gradebook must have a unique name, conflicts are possible | addExternalAssessment | {
"repo_name": "rodriguezdevera/sakai",
"path": "edu-services/gradebook-service/api/src/java/org/sakaiproject/service/gradebook/shared/GradebookExternalAssessmentService.java",
"license": "apache-2.0",
"size": 14476
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 1,285,973 |
protected boolean containNullableProperties(
@NotNull final List<Property<DecoratedString>> properties,
@NotNull final ResultDecoratorHelper resultDecoratorHelper)
{
return resultDecoratorHelper.containNullableProperties(properties);
} | boolean function( @NotNull final List<Property<DecoratedString>> properties, @NotNull final ResultDecoratorHelper resultDecoratorHelper) { return resultDecoratorHelper.containNullableProperties(properties); } | /**
* Checks whether some of the given properties are nullable or not.
* @param properties the {@link Property properties}.
* @param resultDecoratorHelper the {@link ResultDecoratorHelper} instance.
* @return {@code true} in such case.
*/ | Checks whether some of the given properties are nullable or not | containNullableProperties | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-core/src/main/java/org/acmsl/queryj/metadata/AbstractResultDecorator.java",
"license": "gpl-2.0",
"size": 28508
} | [
"java.util.List",
"org.acmsl.queryj.customsql.Property",
"org.jetbrains.annotations.NotNull"
] | import java.util.List; import org.acmsl.queryj.customsql.Property; import org.jetbrains.annotations.NotNull; | import java.util.*; import org.acmsl.queryj.customsql.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | java.util; org.acmsl.queryj; org.jetbrains.annotations; | 567,650 |
@Override
public DestinationPatternsMessageCondition getMatchingCondition(Message<?> message) {
String destination = (String) message.getHeaders().get(LOOKUP_DESTINATION_HEADER);
if (destination == null) {
return null;
}
if (this.patterns.isEmpty()) {
return this;
}
List<String> matches = new ArrayList<>();
for (String pattern : this.patterns) {
if (pattern.equals(destination) || this.pathMatcher.match(pattern, destination)) {
matches.add(pattern);
}
}
if (matches.isEmpty()) {
return null;
}
Collections.sort(matches, this.pathMatcher.getPatternComparator(destination));
return new DestinationPatternsMessageCondition(matches, this.pathMatcher);
} | DestinationPatternsMessageCondition function(Message<?> message) { String destination = (String) message.getHeaders().get(LOOKUP_DESTINATION_HEADER); if (destination == null) { return null; } if (this.patterns.isEmpty()) { return this; } List<String> matches = new ArrayList<>(); for (String pattern : this.patterns) { if (pattern.equals(destination) this.pathMatcher.match(pattern, destination)) { matches.add(pattern); } } if (matches.isEmpty()) { return null; } Collections.sort(matches, this.pathMatcher.getPatternComparator(destination)); return new DestinationPatternsMessageCondition(matches, this.pathMatcher); } | /**
* Check if any of the patterns match the given Message destination and return an instance
* that is guaranteed to contain matching patterns, sorted via
* {@link org.springframework.util.PathMatcher#getPatternComparator(String)}.
* @param message the message to match to
* @return the same instance if the condition contains no patterns;
* or a new condition with sorted matching patterns;
* or {@code null} either if a destination can not be extracted or there is no match
*/ | Check if any of the patterns match the given Message destination and return an instance that is guaranteed to contain matching patterns, sorted via <code>org.springframework.util.PathMatcher#getPatternComparator(String)</code> | getMatchingCondition | {
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.messaging/org/springframework/messaging/handler/DestinationPatternsMessageCondition.java",
"license": "mit",
"size": 7036
} | [
"java.util.ArrayList",
"java.util.Collections",
"java.util.List",
"org.springframework.messaging.Message"
] | import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.springframework.messaging.Message; | import java.util.*; import org.springframework.messaging.*; | [
"java.util",
"org.springframework.messaging"
] | java.util; org.springframework.messaging; | 413,694 |
@ServiceMethod(returns = ReturnType.SINGLE)
SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String interfaceEndpointName); | @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller<PollResult<Void>, Void> beginDelete(String resourceGroupName, String interfaceEndpointName); | /**
* Deletes the specified interface endpoint.
*
* @param resourceGroupName The name of the resource group.
* @param interfaceEndpointName The name of the interface endpoint.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Deletes the specified interface endpoint | beginDelete | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanagerhybrid/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/fluent/InterfaceEndpointsClient.java",
"license": "mit",
"size": 20412
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.polling.SyncPoller"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.polling.SyncPoller; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.polling.*; | [
"com.azure.core"
] | com.azure.core; | 1,789,483 |
public CapabilitiesType getCapabilities(GetCapabilitiesType request) throws ServiceExceptionReport; | CapabilitiesType function(GetCapabilitiesType request) throws ServiceExceptionReport; | /**
* Invokes the CSW Capabilities service operation.
*
* @param request
* @return
* @throws be.kzen.ergorr.interfaces.soap.ServiceExceptionReport
*/ | Invokes the CSW Capabilities service operation | getCapabilities | {
"repo_name": "IntecsSPA/buddata-ebxml-registry",
"path": "ErgoRR/ErgoRR-jaxb/src/main/java/be/kzen/ergorr/interfaces/soap/csw/CswClient.java",
"license": "gpl-3.0",
"size": 3609
} | [
"be.kzen.ergorr.model.csw.CapabilitiesType",
"be.kzen.ergorr.model.csw.GetCapabilitiesType"
] | import be.kzen.ergorr.model.csw.CapabilitiesType; import be.kzen.ergorr.model.csw.GetCapabilitiesType; | import be.kzen.ergorr.model.csw.*; | [
"be.kzen.ergorr"
] | be.kzen.ergorr; | 1,153,248 |
List<Entity> findRelatedConceptsWithFile(
TokenProxy<?, TokenType.Simple> tokenProxy,
byte[] bytes,
FindRelatedConceptsRequestBuilder params
) throws HodErrorException;
/**
* Query Micro Focus Haven OnDemand for related concepts using query text in a file using a token proxy
* provided by a {@link com.hp.autonomy.hod.client.token.TokenProxyService} | List<Entity> findRelatedConceptsWithFile( TokenProxy<?, TokenType.Simple> tokenProxy, byte[] bytes, FindRelatedConceptsRequestBuilder params ) throws HodErrorException; /** * Query Micro Focus Haven OnDemand for related concepts using query text in a file using a token proxy * provided by a {@link com.hp.autonomy.hod.client.token.TokenProxyService} | /**
* Query Micro Focus Haven OnDemand for related concepts using query text in a file using the given token proxy
* @param tokenProxy The token proxy to use to authenticate the request
* @param bytes The bytes of a file containing the query text
* @param params Additional parameters to be sent as part of the request
* @return A list of related concepts that match the query text
* @throws com.hp.autonomy.hod.client.api.authentication.HodAuthenticationFailedException If the token associated
* with the token proxy has expired
*/ | Query Micro Focus Haven OnDemand for related concepts using query text in a file using the given token proxy | findRelatedConceptsWithFile | {
"repo_name": "hpautonomy/java-hod-client",
"path": "src/main/java/com/hp/autonomy/hod/client/api/textindex/query/search/FindRelatedConceptsService.java",
"license": "mit",
"size": 10342
} | [
"com.hp.autonomy.hod.client.api.authentication.TokenType",
"com.hp.autonomy.hod.client.error.HodErrorException",
"com.hp.autonomy.hod.client.token.TokenProxy",
"java.util.List"
] | import com.hp.autonomy.hod.client.api.authentication.TokenType; import com.hp.autonomy.hod.client.error.HodErrorException; import com.hp.autonomy.hod.client.token.TokenProxy; import java.util.List; | import com.hp.autonomy.hod.client.api.authentication.*; import com.hp.autonomy.hod.client.error.*; import com.hp.autonomy.hod.client.token.*; import java.util.*; | [
"com.hp.autonomy",
"java.util"
] | com.hp.autonomy; java.util; | 2,541,793 |
public SearchType getSearchType() {
return this.searchRequest.searchType();
} | SearchType function() { return this.searchRequest.searchType(); } | /**
* Get the search type to execute, defaults to {@link SearchType#DEFAULT}.
*/ | Get the search type to execute, defaults to <code>SearchType#DEFAULT</code> | getSearchType | {
"repo_name": "HonzaKral/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/asyncsearch/SubmitAsyncSearchRequest.java",
"license": "apache-2.0",
"size": 9734
} | [
"org.elasticsearch.action.search.SearchType"
] | import org.elasticsearch.action.search.SearchType; | import org.elasticsearch.action.search.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 242,472 |
public int mapToLocal(User loggedInUser,
Integer masterId,
Integer masterOrgId,
Integer localOrgId) {
boolean found = false;
IssMaster master = getMaster(loggedInUser, masterId);
Set<IssMasterOrg> orgs = master.getMasterOrgs();
Org localOrg = OrgFactory.lookupById(localOrgId.longValue());
if (localOrg == null) {
fail("Unable to locate or access Local Organization :" + localOrgId,
"lookup.issmaster.local.title", "lookup.issmaster.local.reason1",
localOrgId.toString());
}
for (IssMasterOrg o : orgs) {
if (o.getMasterOrgId().equals(masterOrgId.longValue())) {
o.setLocalOrg(localOrg);
found = true;
break;
}
}
if (!found) {
fail("Unable to locate or access ISS Master Organization : " + masterOrgId,
"lookup.issmasterorg.title", "lookup.issmasterorg.reason1",
masterOrgId.toString());
}
IssFactory.save(master);
return 1;
} | int function(User loggedInUser, Integer masterId, Integer masterOrgId, Integer localOrgId) { boolean found = false; IssMaster master = getMaster(loggedInUser, masterId); Set<IssMasterOrg> orgs = master.getMasterOrgs(); Org localOrg = OrgFactory.lookupById(localOrgId.longValue()); if (localOrg == null) { fail(STR + localOrgId, STR, STR, localOrgId.toString()); } for (IssMasterOrg o : orgs) { if (o.getMasterOrgId().equals(masterOrgId.longValue())) { o.setLocalOrg(localOrg); found = true; break; } } if (!found) { fail(STR + masterOrgId, STR, STR, masterOrgId.toString()); } IssFactory.save(master); return 1; } | /**
* Map a given master-organization to a specific local-organization
*
* @param loggedInUser The current user
* @param masterId Id of the Master to look for
* @param masterOrgId id of the master-organization to work with
* @param localOrgId id of the local organization to map to masterOrgId
* @return 1 if success, exception otherwise
*
* @xmlrpc.doc Add a single organizations to the list of those the specified Master has
* exported to this Slave
* @xmlrpc.param #param("string", "sessionKey")
* @xmlrpc.param #param_desc("int", "masterId", "Id of the desired Master")
* @xmlrpc.param #param_desc("int", "masterOrgId", "Id of the desired Master")
* @xmlrpc.param #param_desc("int", "localOrgId", "Id of the desired Master")
* @xmlrpc.returntype #return_int_success()
*
*/ | Map a given master-organization to a specific local-organization | mapToLocal | {
"repo_name": "xkollar/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/sync/master/MasterHandler.java",
"license": "gpl-2.0",
"size": 16560
} | [
"com.redhat.rhn.domain.iss.IssFactory",
"com.redhat.rhn.domain.iss.IssMaster",
"com.redhat.rhn.domain.iss.IssMasterOrg",
"com.redhat.rhn.domain.org.Org",
"com.redhat.rhn.domain.org.OrgFactory",
"com.redhat.rhn.domain.user.User",
"java.util.Set"
] | import com.redhat.rhn.domain.iss.IssFactory; import com.redhat.rhn.domain.iss.IssMaster; import com.redhat.rhn.domain.iss.IssMasterOrg; import com.redhat.rhn.domain.org.Org; import com.redhat.rhn.domain.org.OrgFactory; import com.redhat.rhn.domain.user.User; import java.util.Set; | import com.redhat.rhn.domain.iss.*; import com.redhat.rhn.domain.org.*; import com.redhat.rhn.domain.user.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 2,138,006 |
public double getLInfNorm() {
double norm = 0;
Iterator<Entry> it = iterator();
while (it.hasNext()) {
final Entry e = it.next();
norm = FastMath.max(norm, FastMath.abs(e.getValue()));
}
return norm;
} | double function() { double norm = 0; Iterator<Entry> it = iterator(); while (it.hasNext()) { final Entry e = it.next(); norm = FastMath.max(norm, FastMath.abs(e.getValue())); } return norm; } | /**
* Returns the L<sub>∞</sub> norm of the vector.
* <p>The L<sub>∞</sub> norm is the max of the absolute
* values of the elements.</p>
*
* @return the norm.
* @see #getNorm()
* @see #getL1Norm()
* @see #getLInfDistance(RealVector)
*/ | Returns the L∞ norm of the vector. The L∞ norm is the max of the absolute values of the elements | getLInfNorm | {
"repo_name": "happyjack27/autoredistrict",
"path": "src/org/apache/commons/math3/linear/RealVector.java",
"license": "gpl-3.0",
"size": 54340
} | [
"java.util.Iterator",
"org.apache.commons.math3.util.FastMath"
] | import java.util.Iterator; import org.apache.commons.math3.util.FastMath; | import java.util.*; import org.apache.commons.math3.util.*; | [
"java.util",
"org.apache.commons"
] | java.util; org.apache.commons; | 2,182,109 |
@Test
public void codecCriteriaFlowTest() throws Exception {
FlowRule rule = getRule("criteria-flow.json");
checkCommonData(rule);
assertThat(rule.selector().criteria().size(), is(32));
rule.selector().criteria()
.stream()
.forEach(criterion ->
criteria.put(criterion.type().name(), criterion));
Criterion criterion;
criterion = getCriterion(Criterion.Type.ETH_TYPE);
assertThat(((EthTypeCriterion) criterion).ethType(), is(2054));
criterion = getCriterion(Criterion.Type.ETH_DST);
assertThat(((EthCriterion) criterion).mac(),
is(MacAddress.valueOf("00:11:22:33:44:55")));
criterion = getCriterion(Criterion.Type.ETH_SRC);
assertThat(((EthCriterion) criterion).mac(),
is(MacAddress.valueOf("00:11:22:33:44:55")));
criterion = getCriterion(Criterion.Type.IN_PORT);
assertThat(((PortCriterion) criterion).port(),
is(PortNumber.portNumber(23)));
criterion = getCriterion(Criterion.Type.IN_PHY_PORT);
assertThat(((PortCriterion) criterion).port(),
is(PortNumber.portNumber(44)));
criterion = getCriterion(Criterion.Type.VLAN_VID);
assertThat(((VlanIdCriterion) criterion).vlanId(),
is(VlanId.vlanId((short) 777)));
criterion = getCriterion(Criterion.Type.VLAN_PCP);
assertThat(((VlanPcpCriterion) criterion).priority(),
is(((byte) 3)));
criterion = getCriterion(Criterion.Type.IP_DSCP);
assertThat(((IPDscpCriterion) criterion).ipDscp(),
is(((byte) 2)));
criterion = getCriterion(Criterion.Type.IP_ECN);
assertThat(((IPEcnCriterion) criterion).ipEcn(),
is(((byte) 1)));
criterion = getCriterion(Criterion.Type.IP_PROTO);
assertThat(((IPProtocolCriterion) criterion).protocol(),
is(((short) 4)));
criterion = getCriterion(Criterion.Type.IPV4_SRC);
assertThat(((IPCriterion) criterion).ip(),
is((IpPrefix.valueOf("1.2.0.0/32"))));
criterion = getCriterion(Criterion.Type.IPV4_DST);
assertThat(((IPCriterion) criterion).ip(),
is((IpPrefix.valueOf("2.2.0.0/32"))));
criterion = getCriterion(Criterion.Type.IPV6_SRC);
assertThat(((IPCriterion) criterion).ip(),
is((IpPrefix.valueOf("3.2.0.0/32"))));
criterion = getCriterion(Criterion.Type.IPV6_DST);
assertThat(((IPCriterion) criterion).ip(),
is((IpPrefix.valueOf("4.2.0.0/32"))));
criterion = getCriterion(Criterion.Type.TCP_SRC);
assertThat(((TcpPortCriterion) criterion).tcpPort(),
is(80));
criterion = getCriterion(Criterion.Type.TCP_DST);
assertThat(((TcpPortCriterion) criterion).tcpPort(),
is(443));
criterion = getCriterion(Criterion.Type.UDP_SRC);
assertThat(((UdpPortCriterion) criterion).udpPort(),
is(180));
criterion = getCriterion(Criterion.Type.UDP_DST);
assertThat(((UdpPortCriterion) criterion).udpPort(),
is(1443));
criterion = getCriterion(Criterion.Type.SCTP_SRC);
assertThat(((SctpPortCriterion) criterion).sctpPort(),
is(280));
criterion = getCriterion(Criterion.Type.SCTP_DST);
assertThat(((SctpPortCriterion) criterion).sctpPort(),
is(2443));
criterion = getCriterion(Criterion.Type.ICMPV4_TYPE);
assertThat(((IcmpTypeCriterion) criterion).icmpType(),
is((short) 24));
criterion = getCriterion(Criterion.Type.ICMPV4_CODE);
assertThat(((IcmpCodeCriterion) criterion).icmpCode(),
is((short) 16));
criterion = getCriterion(Criterion.Type.ICMPV6_TYPE);
assertThat(((Icmpv6TypeCriterion) criterion).icmpv6Type(),
is((short) 14));
criterion = getCriterion(Criterion.Type.ICMPV6_CODE);
assertThat(((Icmpv6CodeCriterion) criterion).icmpv6Code(),
is((short) 6));
criterion = getCriterion(Criterion.Type.IPV6_FLABEL);
assertThat(((IPv6FlowLabelCriterion) criterion).flowLabel(),
is(8));
criterion = getCriterion(Criterion.Type.IPV6_ND_TARGET);
assertThat(((IPv6NDTargetAddressCriterion) criterion)
.targetAddress().toString(),
is("1111:2222:3333:4444:5555:6666:7777:8888"));
criterion = getCriterion(Criterion.Type.IPV6_ND_SLL);
assertThat(((IPv6NDLinkLayerAddressCriterion) criterion).mac(),
is(MacAddress.valueOf("00:11:22:33:44:56")));
criterion = getCriterion(Criterion.Type.IPV6_ND_TLL);
assertThat(((IPv6NDLinkLayerAddressCriterion) criterion).mac(),
is(MacAddress.valueOf("00:11:22:33:44:57")));
criterion = getCriterion(Criterion.Type.MPLS_LABEL);
assertThat(((MplsCriterion) criterion).label(),
is(MplsLabel.mplsLabel(123)));
criterion = getCriterion(Criterion.Type.IPV6_EXTHDR);
assertThat(((IPv6ExthdrFlagsCriterion) criterion).exthdrFlags(),
is(99));
criterion = getCriterion(Criterion.Type.OCH_SIGID);
assertThat(((IndexedLambdaCriterion) criterion).lambda(),
is(Lambda.indexedLambda(122)));
} | void function() throws Exception { FlowRule rule = getRule(STR); checkCommonData(rule); assertThat(rule.selector().criteria().size(), is(32)); rule.selector().criteria() .stream() .forEach(criterion -> criteria.put(criterion.type().name(), criterion)); Criterion criterion; criterion = getCriterion(Criterion.Type.ETH_TYPE); assertThat(((EthTypeCriterion) criterion).ethType(), is(2054)); criterion = getCriterion(Criterion.Type.ETH_DST); assertThat(((EthCriterion) criterion).mac(), is(MacAddress.valueOf(STR))); criterion = getCriterion(Criterion.Type.ETH_SRC); assertThat(((EthCriterion) criterion).mac(), is(MacAddress.valueOf(STR))); criterion = getCriterion(Criterion.Type.IN_PORT); assertThat(((PortCriterion) criterion).port(), is(PortNumber.portNumber(23))); criterion = getCriterion(Criterion.Type.IN_PHY_PORT); assertThat(((PortCriterion) criterion).port(), is(PortNumber.portNumber(44))); criterion = getCriterion(Criterion.Type.VLAN_VID); assertThat(((VlanIdCriterion) criterion).vlanId(), is(VlanId.vlanId((short) 777))); criterion = getCriterion(Criterion.Type.VLAN_PCP); assertThat(((VlanPcpCriterion) criterion).priority(), is(((byte) 3))); criterion = getCriterion(Criterion.Type.IP_DSCP); assertThat(((IPDscpCriterion) criterion).ipDscp(), is(((byte) 2))); criterion = getCriterion(Criterion.Type.IP_ECN); assertThat(((IPEcnCriterion) criterion).ipEcn(), is(((byte) 1))); criterion = getCriterion(Criterion.Type.IP_PROTO); assertThat(((IPProtocolCriterion) criterion).protocol(), is(((short) 4))); criterion = getCriterion(Criterion.Type.IPV4_SRC); assertThat(((IPCriterion) criterion).ip(), is((IpPrefix.valueOf(STR)))); criterion = getCriterion(Criterion.Type.IPV4_DST); assertThat(((IPCriterion) criterion).ip(), is((IpPrefix.valueOf(STR)))); criterion = getCriterion(Criterion.Type.IPV6_SRC); assertThat(((IPCriterion) criterion).ip(), is((IpPrefix.valueOf(STR)))); criterion = getCriterion(Criterion.Type.IPV6_DST); assertThat(((IPCriterion) criterion).ip(), is((IpPrefix.valueOf(STR)))); criterion = getCriterion(Criterion.Type.TCP_SRC); assertThat(((TcpPortCriterion) criterion).tcpPort(), is(80)); criterion = getCriterion(Criterion.Type.TCP_DST); assertThat(((TcpPortCriterion) criterion).tcpPort(), is(443)); criterion = getCriterion(Criterion.Type.UDP_SRC); assertThat(((UdpPortCriterion) criterion).udpPort(), is(180)); criterion = getCriterion(Criterion.Type.UDP_DST); assertThat(((UdpPortCriterion) criterion).udpPort(), is(1443)); criterion = getCriterion(Criterion.Type.SCTP_SRC); assertThat(((SctpPortCriterion) criterion).sctpPort(), is(280)); criterion = getCriterion(Criterion.Type.SCTP_DST); assertThat(((SctpPortCriterion) criterion).sctpPort(), is(2443)); criterion = getCriterion(Criterion.Type.ICMPV4_TYPE); assertThat(((IcmpTypeCriterion) criterion).icmpType(), is((short) 24)); criterion = getCriterion(Criterion.Type.ICMPV4_CODE); assertThat(((IcmpCodeCriterion) criterion).icmpCode(), is((short) 16)); criterion = getCriterion(Criterion.Type.ICMPV6_TYPE); assertThat(((Icmpv6TypeCriterion) criterion).icmpv6Type(), is((short) 14)); criterion = getCriterion(Criterion.Type.ICMPV6_CODE); assertThat(((Icmpv6CodeCriterion) criterion).icmpv6Code(), is((short) 6)); criterion = getCriterion(Criterion.Type.IPV6_FLABEL); assertThat(((IPv6FlowLabelCriterion) criterion).flowLabel(), is(8)); criterion = getCriterion(Criterion.Type.IPV6_ND_TARGET); assertThat(((IPv6NDTargetAddressCriterion) criterion) .targetAddress().toString(), is(STR)); criterion = getCriterion(Criterion.Type.IPV6_ND_SLL); assertThat(((IPv6NDLinkLayerAddressCriterion) criterion).mac(), is(MacAddress.valueOf(STR))); criterion = getCriterion(Criterion.Type.IPV6_ND_TLL); assertThat(((IPv6NDLinkLayerAddressCriterion) criterion).mac(), is(MacAddress.valueOf(STR))); criterion = getCriterion(Criterion.Type.MPLS_LABEL); assertThat(((MplsCriterion) criterion).label(), is(MplsLabel.mplsLabel(123))); criterion = getCriterion(Criterion.Type.IPV6_EXTHDR); assertThat(((IPv6ExthdrFlagsCriterion) criterion).exthdrFlags(), is(99)); criterion = getCriterion(Criterion.Type.OCH_SIGID); assertThat(((IndexedLambdaCriterion) criterion).lambda(), is(Lambda.indexedLambda(122))); } | /**
* Checks that a rule with one of each kind of criterion decodes properly.
*
* @throws IOException if the resource cannot be processed
*/ | Checks that a rule with one of each kind of criterion decodes properly | codecCriteriaFlowTest | {
"repo_name": "maxkondr/onos-porta",
"path": "core/common/src/test/java/org/onosproject/codec/impl/FlowRuleCodecTest.java",
"license": "apache-2.0",
"size": 22038
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers",
"org.onlab.packet.IpPrefix",
"org.onlab.packet.MacAddress",
"org.onlab.packet.MplsLabel",
"org.onlab.packet.VlanId",
"org.onosproject.net.Lambda",
"org.onosproject.net.PortNumber",
"org.onosproject.net.flow.FlowRule",
"org.onosproject.net.flow.criteria.Criterion",
"org.onosproject.net.flow.criteria.EthCriterion",
"org.onosproject.net.flow.criteria.EthTypeCriterion",
"org.onosproject.net.flow.criteria.IPCriterion",
"org.onosproject.net.flow.criteria.IPDscpCriterion",
"org.onosproject.net.flow.criteria.IPEcnCriterion",
"org.onosproject.net.flow.criteria.IPProtocolCriterion",
"org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion",
"org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion",
"org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion",
"org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion",
"org.onosproject.net.flow.criteria.IcmpCodeCriterion",
"org.onosproject.net.flow.criteria.IcmpTypeCriterion",
"org.onosproject.net.flow.criteria.Icmpv6CodeCriterion",
"org.onosproject.net.flow.criteria.Icmpv6TypeCriterion",
"org.onosproject.net.flow.criteria.IndexedLambdaCriterion",
"org.onosproject.net.flow.criteria.MplsCriterion",
"org.onosproject.net.flow.criteria.PortCriterion",
"org.onosproject.net.flow.criteria.SctpPortCriterion",
"org.onosproject.net.flow.criteria.TcpPortCriterion",
"org.onosproject.net.flow.criteria.UdpPortCriterion",
"org.onosproject.net.flow.criteria.VlanIdCriterion",
"org.onosproject.net.flow.criteria.VlanPcpCriterion"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.onlab.packet.IpPrefix; import org.onlab.packet.MacAddress; import org.onlab.packet.MplsLabel; import org.onlab.packet.VlanId; import org.onosproject.net.Lambda; import org.onosproject.net.PortNumber; import org.onosproject.net.flow.FlowRule; import org.onosproject.net.flow.criteria.Criterion; import org.onosproject.net.flow.criteria.EthCriterion; import org.onosproject.net.flow.criteria.EthTypeCriterion; import org.onosproject.net.flow.criteria.IPCriterion; import org.onosproject.net.flow.criteria.IPDscpCriterion; import org.onosproject.net.flow.criteria.IPEcnCriterion; import org.onosproject.net.flow.criteria.IPProtocolCriterion; import org.onosproject.net.flow.criteria.IPv6ExthdrFlagsCriterion; import org.onosproject.net.flow.criteria.IPv6FlowLabelCriterion; import org.onosproject.net.flow.criteria.IPv6NDLinkLayerAddressCriterion; import org.onosproject.net.flow.criteria.IPv6NDTargetAddressCriterion; import org.onosproject.net.flow.criteria.IcmpCodeCriterion; import org.onosproject.net.flow.criteria.IcmpTypeCriterion; import org.onosproject.net.flow.criteria.Icmpv6CodeCriterion; import org.onosproject.net.flow.criteria.Icmpv6TypeCriterion; import org.onosproject.net.flow.criteria.IndexedLambdaCriterion; import org.onosproject.net.flow.criteria.MplsCriterion; import org.onosproject.net.flow.criteria.PortCriterion; import org.onosproject.net.flow.criteria.SctpPortCriterion; import org.onosproject.net.flow.criteria.TcpPortCriterion; import org.onosproject.net.flow.criteria.UdpPortCriterion; import org.onosproject.net.flow.criteria.VlanIdCriterion; import org.onosproject.net.flow.criteria.VlanPcpCriterion; | import org.hamcrest.*; import org.onlab.packet.*; import org.onosproject.net.*; import org.onosproject.net.flow.*; import org.onosproject.net.flow.criteria.*; | [
"org.hamcrest",
"org.onlab.packet",
"org.onosproject.net"
] | org.hamcrest; org.onlab.packet; org.onosproject.net; | 2,157,181 |
public ArrayList<Hand> getHandList() {
ArrayList<Hand> hands = new ArrayList<Hand>();
Frame frame = getFrame();
if (frame.hands().isEmpty() == false) {
for (Hand hand : frame.hands()) {
hands.add(hand);
}
}
return hands;
} | ArrayList<Hand> function() { ArrayList<Hand> hands = new ArrayList<Hand>(); Frame frame = getFrame(); if (frame.hands().isEmpty() == false) { for (Hand hand : frame.hands()) { hands.add(hand); } } return hands; } | /**
* returns an arraylist containing all currently tracked hands
*
* @return ArrayList<Hand> an arraylist containing all currently tracked hands
*/ | returns an arraylist containing all currently tracked hands | getHandList | {
"repo_name": "manorius/Processing",
"path": "libraries/LeapMotionP5/src/com/onformative/leap/LeapMotionP5.java",
"license": "mit",
"size": 31364
} | [
"com.leapmotion.leap.Frame",
"com.leapmotion.leap.Hand",
"java.util.ArrayList"
] | import com.leapmotion.leap.Frame; import com.leapmotion.leap.Hand; import java.util.ArrayList; | import com.leapmotion.leap.*; import java.util.*; | [
"com.leapmotion.leap",
"java.util"
] | com.leapmotion.leap; java.util; | 2,183,943 |
private void detachFile(File file, Block b) throws IOException {
File tmpFile = volume.createDetachFile(b, file.getName());
try {
IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream(
tmpFile), 16 * 1024, true);
if (file.length() != tmpFile.length()) {
throw new IOException("Copy of file " + file + " size "
+ file.length() + " into file " + tmpFile
+ " resulted in a size of " + tmpFile.length());
}
FileUtil.replaceFile(tmpFile, file);
} catch (IOException e) {
boolean done = tmpFile.delete();
if (!done) {
DataNode.LOG.info("detachFile failed to delete temporary file "
+ tmpFile);
}
throw e;
}
} | void function(File file, Block b) throws IOException { File tmpFile = volume.createDetachFile(b, file.getName()); try { IOUtils.copyBytes(new FileInputStream(file), new FileOutputStream( tmpFile), 16 * 1024, true); if (file.length() != tmpFile.length()) { throw new IOException(STR + file + STR + file.length() + STR + tmpFile + STR + tmpFile.length()); } FileUtil.replaceFile(tmpFile, file); } catch (IOException e) { boolean done = tmpFile.delete(); if (!done) { DataNode.LOG.info(STR + tmpFile); } throw e; } } | /**
* Copy specified file into a temporary file. Then rename the temporary file
* to the original name. This will cause any hardlinks to the original file
* to be removed. The temporary files are created in the detachDir. The
* temporary files will be recovered (especially on Windows) on datanode
* restart.
*/ | Copy specified file into a temporary file. Then rename the temporary file to the original name. This will cause any hardlinks to the original file to be removed. The temporary files are created in the detachDir. The temporary files will be recovered (especially on Windows) on datanode restart | detachFile | {
"repo_name": "shot/hadoop-source-reading",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/DatanodeBlockInfo.java",
"license": "apache-2.0",
"size": 3820
} | [
"java.io.File",
"java.io.FileInputStream",
"java.io.FileOutputStream",
"java.io.IOException",
"org.apache.hadoop.fs.FileUtil",
"org.apache.hadoop.hdfs.protocol.Block",
"org.apache.hadoop.io.IOUtils"
] | import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import org.apache.hadoop.fs.FileUtil; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.io.IOUtils; | import java.io.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.io.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 845,748 |
public Future<Long> commit(); | Future<Long> function(); | /**
* Commit the current acknowledged data. It is the consequent operation of {@link #flush()},
* which makes all the acknowledged data visible to
*
* @return future representing the commit result.
*/ | Commit the current acknowledged data. It is the consequent operation of <code>#flush()</code>, which makes all the acknowledged data visible to | commit | {
"repo_name": "twitter/distributedlog",
"path": "distributedlog-core/src/main/java/com/twitter/distributedlog/logsegment/LogSegmentWriter.java",
"license": "apache-2.0",
"size": 3495
} | [
"com.twitter.util.Future"
] | import com.twitter.util.Future; | import com.twitter.util.*; | [
"com.twitter.util"
] | com.twitter.util; | 190,981 |
public Paint getGridBandPaint() {
return this.gridBandPaint;
}
/**
* Sets the grid band paint and notifies registered listeners that the
* axis has been changed. See the {@link #setGridBandsVisible(boolean)}
| Paint function() { return this.gridBandPaint; } /** * Sets the grid band paint and notifies registered listeners that the * axis has been changed. See the {@link #setGridBandsVisible(boolean)} | /**
* Returns the paint used to color grid bands (two colors are used
* alternately, the other is returned by
* {@link #getGridBandAlternatePaint()}). The default value is
* {@link #DEFAULT_GRID_BAND_PAINT}.
*
* @return The paint (never {@code null}).
*
* @see #setGridBandPaint(Paint)
* @see #isGridBandsVisible()
*/ | Returns the paint used to color grid bands (two colors are used alternately, the other is returned by <code>#getGridBandAlternatePaint()</code>). The default value is <code>#DEFAULT_GRID_BAND_PAINT</code> | getGridBandPaint | {
"repo_name": "aaronc/jfreechart",
"path": "source/org/jfree/chart/axis/SymbolAxis.java",
"license": "lgpl-2.1",
"size": 31017
} | [
"java.awt.Paint"
] | import java.awt.Paint; | import java.awt.*; | [
"java.awt"
] | java.awt; | 104,921 |
private void setUpPrivateKeyDataSETUP(Composite localParent) {
Composite cText = new Composite(localParent, SWT.NONE);
GridData gd2 = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1);
gd2.minimumWidth = 100;
gd2.widthHint = 300;
cText.setLayoutData(gd2);
cText.setLayout(new GridLayout(1, true));
lCalculationsSETUP = new Label(cText, SWT.WRAP);
lCalculationsSETUP.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
lCalculationsSETUP.setText(Messages.RSAAttackView_SETUP_Calculations_Desc);
lPSETUP1 = new Label(localParent, SWT.None);
lPSETUP1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
lPSETUP1.setText(Messages.RSAAttackView_SETUP_P1);
lPSETUP2 = new Label(localParent, SWT.None);
lPSETUP2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
lPSETUP2.setText(Messages.RSAAttackView_SETUP_P2);
tPSETUP1 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tPSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tPSETUP1.setMargins(4, 0, 4, 0);
tPSETUP1.setAlwaysShowScrollBars(false);
tPSETUP2 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tPSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tPSETUP2.setMargins(4, 0, 4, 0);
tPSETUP2.setAlwaysShowScrollBars(false);
lQSETUP1 = new Label(localParent, SWT.None);
lQSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
lQSETUP1.setText(Messages.RSAAttackView_SETUP_Q1);
lQSETUP2 = new Label(localParent, SWT.None);
lQSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
lQSETUP2.setText(Messages.RSAAttackView_SETUP_Q2);
tQSETUP1 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tQSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tQSETUP1.setMargins(4, 0, 4, 0);
tQSETUP1.setAlwaysShowScrollBars(false);
tQSETUP2 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tQSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tQSETUP2.setMargins(4, 0, 4, 0);
tQSETUP2.setAlwaysShowScrollBars(false);
lDSETUP1 = new Label(localParent, SWT.None);
lDSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
lDSETUP1.setText(Messages.RSAAttackView_SETUP_D1);
lDSETUP2 = new Label(localParent, SWT.None);
lDSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
lDSETUP2.setText(Messages.RSAAttackView_SETUP_D2);
tDSETUP1 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tDSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tDSETUP1.setMargins(4, 0, 4, 0);
tDSETUP1.setAlwaysShowScrollBars(false);
tDSETUP2 = new StyledText(localParent, SWT.WRAP | SWT.V_SCROLL | SWT.BORDER);
tDSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1));
tDSETUP2.setMargins(4, 0, 4, 0);
tDSETUP2.setAlwaysShowScrollBars(false);
} | void function(Composite localParent) { Composite cText = new Composite(localParent, SWT.NONE); GridData gd2 = new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1); gd2.minimumWidth = 100; gd2.widthHint = 300; cText.setLayoutData(gd2); cText.setLayout(new GridLayout(1, true)); lCalculationsSETUP = new Label(cText, SWT.WRAP); lCalculationsSETUP.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); lCalculationsSETUP.setText(Messages.RSAAttackView_SETUP_Calculations_Desc); lPSETUP1 = new Label(localParent, SWT.None); lPSETUP1.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lPSETUP1.setText(Messages.RSAAttackView_SETUP_P1); lPSETUP2 = new Label(localParent, SWT.None); lPSETUP2.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1)); lPSETUP2.setText(Messages.RSAAttackView_SETUP_P2); tPSETUP1 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tPSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tPSETUP1.setMargins(4, 0, 4, 0); tPSETUP1.setAlwaysShowScrollBars(false); tPSETUP2 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tPSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tPSETUP2.setMargins(4, 0, 4, 0); tPSETUP2.setAlwaysShowScrollBars(false); lQSETUP1 = new Label(localParent, SWT.None); lQSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); lQSETUP1.setText(Messages.RSAAttackView_SETUP_Q1); lQSETUP2 = new Label(localParent, SWT.None); lQSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); lQSETUP2.setText(Messages.RSAAttackView_SETUP_Q2); tQSETUP1 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tQSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tQSETUP1.setMargins(4, 0, 4, 0); tQSETUP1.setAlwaysShowScrollBars(false); tQSETUP2 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tQSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tQSETUP2.setMargins(4, 0, 4, 0); tQSETUP2.setAlwaysShowScrollBars(false); lDSETUP1 = new Label(localParent, SWT.None); lDSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); lDSETUP1.setText(Messages.RSAAttackView_SETUP_D1); lDSETUP2 = new Label(localParent, SWT.None); lDSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); lDSETUP2.setText(Messages.RSAAttackView_SETUP_D2); tDSETUP1 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tDSETUP1.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tDSETUP1.setMargins(4, 0, 4, 0); tDSETUP1.setAlwaysShowScrollBars(false); tDSETUP2 = new StyledText(localParent, SWT.WRAP SWT.V_SCROLL SWT.BORDER); tDSETUP2.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 1, 1)); tDSETUP2.setMargins(4, 0, 4, 0); tDSETUP2.setAlwaysShowScrollBars(false); } | /**
* Sets up the private key fields of the SETUP attack.
* @param localParent The parent control of the SETUP private key fields.
*/ | Sets up the private key fields of the SETUP attack | setUpPrivateKeyDataSETUP | {
"repo_name": "jcryptool/crypto",
"path": "org.jcryptool.visual.kleptography/src/org/jcryptool/visual/kleptography/ui/RSAAttackView.java",
"license": "epl-1.0",
"size": 66380
} | [
"org.eclipse.swt.custom.StyledText",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.layout.GridLayout",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.swt.widgets.Label"
] | import org.eclipse.swt.custom.StyledText; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.custom.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 52,217 |
private List<LatLng> decodePoly(String encoded) {
List<LatLng> poly = new ArrayList<>();
int index = 0, len = encoded.length();
int lat = 0, lng = 0;
while (index < len) {
int b, shift = 0, result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lat += dlat;
shift = 0;
result = 0;
do {
b = encoded.charAt(index++) - 63;
result |= (b & 0x1f) << shift;
shift += 5;
} while (b >= 0x20);
int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
lng += dlng;
LatLng p = new LatLng((((double) lat / 1E5)),
(((double) lng / 1E5)));
poly.add(p);
}
return poly;
} | List<LatLng> function(String encoded) { List<LatLng> poly = new ArrayList<>(); int index = 0, len = encoded.length(); int lat = 0, lng = 0; while (index < len) { int b, shift = 0, result = 0; do { b = encoded.charAt(index++) - 63; result = (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lat += dlat; shift = 0; result = 0; do { b = encoded.charAt(index++) - 63; result = (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lng += dlng; LatLng p = new LatLng((((double) lat / 1E5)), (((double) lng / 1E5))); poly.add(p); } return poly; } | /**
* Method to decode polyline points
* Courtesy : http://jeffreysambells.com/2010/05/27/decoding-polylines-from-google-maps-direction-api-with-java
*/ | Method to decode polyline points Courtesy : HREF | decodePoly | {
"repo_name": "Salcor7/LBB-Gis",
"path": "draw/src/main/java/com/ahmadrosid/lib/drawroutemap/DataRouteParser.java",
"license": "gpl-3.0",
"size": 3500
} | [
"com.google.android.gms.maps.model.LatLng",
"java.util.ArrayList",
"java.util.List"
] | import com.google.android.gms.maps.model.LatLng; import java.util.ArrayList; import java.util.List; | import com.google.android.gms.maps.model.*; import java.util.*; | [
"com.google.android",
"java.util"
] | com.google.android; java.util; | 403,020 |
private Object getValidController(WorkDTO dto, String controllerName) throws AppException {
try {
if (StringUtils.isEmpty(controllerName)) {
// controller name should not be empty
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.controllerIdEmpty", null));
}
final Object bean = ContextLoader.getCurrentWebApplicationContext().getBean(controllerName);
if (ObjectUtils.isEmpty(bean)) {
// the bean with given controller name should be found
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.targetBeanNull", null,
controllerName));
}
if (AnnotationUtils.isAnnotationInherited(Controller.class, bean.getClass())) {
// the target bean should be a Controller but not service nor dao
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.targetBeanNotController", null,
controllerName));
}
if (AopUtils.isAopProxy(bean)) {
// the target bean should not be proxied by any proxy
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.targetControllerIsProxy", null,
controllerName));
}
return bean;
} catch (NoSuchBeanDefinitionException ex) {
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.canNotFindController", ex,
controllerName));
} catch (BeansException | IllegalArgumentException ex) {
throw dto.setIssue(createEx("ERR_DISPATCHER_001/DispatchExecutor.canNotCreateController", ex,
controllerName));
}
} | Object function(WorkDTO dto, String controllerName) throws AppException { try { if (StringUtils.isEmpty(controllerName)) { throw dto.setIssue(createEx(STR, null)); } final Object bean = ContextLoader.getCurrentWebApplicationContext().getBean(controllerName); if (ObjectUtils.isEmpty(bean)) { throw dto.setIssue(createEx(STR, null, controllerName)); } if (AnnotationUtils.isAnnotationInherited(Controller.class, bean.getClass())) { throw dto.setIssue(createEx(STR, null, controllerName)); } if (AopUtils.isAopProxy(bean)) { throw dto.setIssue(createEx(STR, null, controllerName)); } return bean; } catch (NoSuchBeanDefinitionException ex) { throw dto.setIssue(createEx(STR, ex, controllerName)); } catch (BeansException IllegalArgumentException ex) { throw dto.setIssue(createEx(STR, ex, controllerName)); } } | /**
* Validate the parameter and try to find the controller bean in the WebContext.
* @param dto the workDTO
* @param controllerName the name of the controller
* @return the valid method
* @throws AppException if the parameter is not valid
*/ | Validate the parameter and try to find the controller bean in the WebContext | getValidController | {
"repo_name": "jimmyblylee/ESH",
"path": "src/framework/dispatcher/src/main/java/com/lee/jwaf/action/DispatchExecutor.java",
"license": "mit",
"size": 16315
} | [
"com.lee.jwaf.dto.WorkDTO",
"com.lee.jwaf.exception.AppException",
"com.lee.util.ObjectUtils",
"com.lee.util.StringUtils",
"org.springframework.aop.support.AopUtils",
"org.springframework.beans.BeansException",
"org.springframework.beans.factory.NoSuchBeanDefinitionException",
"org.springframework.core.annotation.AnnotationUtils",
"org.springframework.stereotype.Controller",
"org.springframework.web.context.ContextLoader"
] | import com.lee.jwaf.dto.WorkDTO; import com.lee.jwaf.exception.AppException; import com.lee.util.ObjectUtils; import com.lee.util.StringUtils; import org.springframework.aop.support.AopUtils; import org.springframework.beans.BeansException; import org.springframework.beans.factory.NoSuchBeanDefinitionException; import org.springframework.core.annotation.AnnotationUtils; import org.springframework.stereotype.Controller; import org.springframework.web.context.ContextLoader; | import com.lee.jwaf.dto.*; import com.lee.jwaf.exception.*; import com.lee.util.*; import org.springframework.aop.support.*; import org.springframework.beans.*; import org.springframework.beans.factory.*; import org.springframework.core.annotation.*; import org.springframework.stereotype.*; import org.springframework.web.context.*; | [
"com.lee.jwaf",
"com.lee.util",
"org.springframework.aop",
"org.springframework.beans",
"org.springframework.core",
"org.springframework.stereotype",
"org.springframework.web"
] | com.lee.jwaf; com.lee.util; org.springframework.aop; org.springframework.beans; org.springframework.core; org.springframework.stereotype; org.springframework.web; | 1,887,177 |
@Test
public void testConsentDeniedWithExpiredAndClearedClientSession() {
driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName()));
logInWithBroker(bc);
// Set time offset
invokeTimeOffset(60);
try {
testingClient.server(bc.providerRealmName()).run(removeBrokerExpiredSessions());
// User rejected consent
grantPage.assertCurrent();
grantPage.cancel();
// Assert login page with "You took too long to login..." message
Assert.assertEquals("Your login attempt timed out. Login will start from the beginning.", loginPage.getError());
} finally {
invokeTimeOffset(0);
}
} | void function() { driver.navigate().to(getAccountUrl(getConsumerRoot(), bc.consumerRealmName())); logInWithBroker(bc); invokeTimeOffset(60); try { testingClient.server(bc.providerRealmName()).run(removeBrokerExpiredSessions()); grantPage.assertCurrent(); grantPage.cancel(); Assert.assertEquals(STR, loginPage.getError()); } finally { invokeTimeOffset(0); } } | /**
* Referes to in old testsuite: org.keycloak.testsuite.broker.OIDCKeycloakServerBrokerWithConsentTest#testConsentDeniedWithExpiredAndClearedClientSession
*/ | Referes to in old testsuite: org.keycloak.testsuite.broker.OIDCKeycloakServerBrokerWithConsentTest#testConsentDeniedWithExpiredAndClearedClientSession | testConsentDeniedWithExpiredAndClearedClientSession | {
"repo_name": "keycloak/keycloak",
"path": "testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/broker/KcOidcBrokerWithConsentTest.java",
"license": "apache-2.0",
"size": 7311
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 127,995 |
private void createCssClassBasedOnConditionsLabelAndTextfield(Composite body) {
Label label = new Label(body, SWT.NONE);
label.setText("CSS class based on conditions");
label.setBackground(body.getBackground());
conditionClass = widgetFactory.createText(body, "", SWT.None);
GridData data = new GridData();
data.widthHint = 250;
conditionClass.setLayoutData(data);
conditionClass.setEditable(false); | void function(Composite body) { Label label = new Label(body, SWT.NONE); label.setText(STR); label.setBackground(body.getBackground()); conditionClass = widgetFactory.createText(body, "", SWT.None); GridData data = new GridData(); data.widthHint = 250; conditionClass.setLayoutData(data); conditionClass.setEditable(false); | /**
* Extracted from createControls.
*
* @param body
*/ | Extracted from createControls | createCssClassBasedOnConditionsLabelAndTextfield | {
"repo_name": "debabratahazra/DS",
"path": "designstudio/components/page/ui/com.odcgroup.page.ui/src/main/java/com/odcgroup/page/ui/properties/sections/matrix/MatrixCssClassPropertySection.java",
"license": "epl-1.0",
"size": 10502
} | [
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.widgets.Composite",
"org.eclipse.swt.widgets.Label"
] | import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; | import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 1,392,387 |
ExtensionDescription desc = new ExtensionDescription();
desc.setExtensionClass(GmlEnvelope.class);
desc.setNamespace(Namespaces.GML_NAMESPACE);
desc.setLocalName(NAME);
desc.setRepeatable(repeatable);
return desc;
} | ExtensionDescription desc = new ExtensionDescription(); desc.setExtensionClass(GmlEnvelope.class); desc.setNamespace(Namespaces.GML_NAMESPACE); desc.setLocalName(NAME); desc.setRepeatable(repeatable); return desc; } | /**
* Returns the suggested extension description with configurable
* repeatability.
*/ | Returns the suggested extension description with configurable repeatability | getDefaultDescription | {
"repo_name": "simonrrr/gdata-java-client",
"path": "java/src/com/google/gdata/data/geo/impl/GmlEnvelope.java",
"license": "apache-2.0",
"size": 5680
} | [
"com.google.gdata.data.ExtensionDescription",
"com.google.gdata.data.geo.Namespaces"
] | import com.google.gdata.data.ExtensionDescription; import com.google.gdata.data.geo.Namespaces; | import com.google.gdata.data.*; import com.google.gdata.data.geo.*; | [
"com.google.gdata"
] | com.google.gdata; | 64,301 |
public void playPause() {
Dispatch.call(this, "PlayPause");
} | void function() { Dispatch.call(this, STR); } | /**
* Wrapper for calling the ActiveX-Method with input-parameter(s).
*/ | Wrapper for calling the ActiveX-Method with input-parameter(s) | playPause | {
"repo_name": "cpesch/MetaMusic",
"path": "itunes-com-library/src/main/java/slash/metamusic/itunes/com/binding/IiTunes.java",
"license": "gpl-2.0",
"size": 26278
} | [
"com.jacob.com.Dispatch"
] | import com.jacob.com.Dispatch; | import com.jacob.com.*; | [
"com.jacob.com"
] | com.jacob.com; | 2,189,300 |
public static <K> void deepCopyMap(Map<K, Object> source, Map<K, Object> target) {
for (Entry<K, Object> e : source.entrySet()) {
Object value = e.getValue();
Comparator<? super K> comparator = null;
if (value instanceof SortedMap) {
@SuppressWarnings("unchecked")
SortedMap<K, Object> map = (SortedMap<K, Object>) value;
comparator = map.comparator();
}
if (value instanceof Map<?, ?>) {
@SuppressWarnings("unchecked")
Map<K, Object> old = (Map<K, Object>) value;
Map<K, Object> c = new TreeMap<K, Object>(comparator);
deepCopyMap(old, c);
value = c;
}
target.put(e.getKey(), value);
}
} | static <K> void function(Map<K, Object> source, Map<K, Object> target) { for (Entry<K, Object> e : source.entrySet()) { Object value = e.getValue(); Comparator<? super K> comparator = null; if (value instanceof SortedMap) { @SuppressWarnings(STR) SortedMap<K, Object> map = (SortedMap<K, Object>) value; comparator = map.comparator(); } if (value instanceof Map<?, ?>) { @SuppressWarnings(STR) Map<K, Object> old = (Map<K, Object>) value; Map<K, Object> c = new TreeMap<K, Object>(comparator); deepCopyMap(old, c); value = c; } target.put(e.getKey(), value); } } | /**
* Deep copy of a map that may contain map values.
*
* @param source the source map
* @param target the target map
* @param <K> the type of the map key
*/ | Deep copy of a map that may contain map values | deepCopyMap | {
"repo_name": "denismo/jackrabbit-dynamodb-store",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/util/Utils.java",
"license": "apache-2.0",
"size": 15036
} | [
"java.util.Comparator",
"java.util.Map",
"java.util.SortedMap",
"java.util.TreeMap"
] | import java.util.Comparator; import java.util.Map; import java.util.SortedMap; import java.util.TreeMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,323,391 |
@Override
public String getAverageCourseGrade(String gradebookUid) {
if (gradebookUid == null) {
throw new IllegalArgumentException("Null gradebookUid passed to getAverageCourseGrade");
}
// Check user has permission to invoke method.
if (!currentUserHasGradeAllPerm(gradebookUid)) {
StringBuilder sb = new StringBuilder()
.append("User ")
.append(authn.getUserUid())
.append(" attempted to access the average course grade without permission in gb ")
.append(gradebookUid)
.append(" using gradebookService.getAverageCourseGrade");
throw new SecurityException(sb.toString());
}
String courseGradeLetter = null;
Gradebook gradebook = getGradebook(gradebookUid);
if (gradebook != null) {
CourseGrade courseGrade = getCourseGrade(gradebook.getId());
Set<String> studentUids = getAllStudentUids(gradebookUid);
// This call handles the complex rules of which assignments and grades to include in the calculation
List<CourseGradeRecord> courseGradeRecs = getPointsEarnedCourseGradeRecords(courseGrade, studentUids);
if (courseGrade != null) {
// Calculate the course mean grade whether the student grade was manually entered or auto-calculated.
courseGrade.calculateStatistics(courseGradeRecs, studentUids.size());
if (courseGrade.getMean() != null) {
courseGradeLetter = gradebook.getSelectedGradeMapping().getGrade(courseGrade.getMean());
}
}
}
return courseGradeLetter;
}
| String function(String gradebookUid) { if (gradebookUid == null) { throw new IllegalArgumentException(STR); } if (!currentUserHasGradeAllPerm(gradebookUid)) { StringBuilder sb = new StringBuilder() .append(STR) .append(authn.getUserUid()) .append(STR) .append(gradebookUid) .append(STR); throw new SecurityException(sb.toString()); } String courseGradeLetter = null; Gradebook gradebook = getGradebook(gradebookUid); if (gradebook != null) { CourseGrade courseGrade = getCourseGrade(gradebook.getId()); Set<String> studentUids = getAllStudentUids(gradebookUid); List<CourseGradeRecord> courseGradeRecs = getPointsEarnedCourseGradeRecords(courseGrade, studentUids); if (courseGrade != null) { courseGrade.calculateStatistics(courseGradeRecs, studentUids.size()); if (courseGrade.getMean() != null) { courseGradeLetter = gradebook.getSelectedGradeMapping().getGrade(courseGrade.getMean()); } } } return courseGradeLetter; } | /**
* Retrieves the calculated average course grade.
*/ | Retrieves the calculated average course grade | getAverageCourseGrade | {
"repo_name": "introp-software/sakai",
"path": "edu-services/gradebook-service/impl/src/java/org/sakaiproject/component/gradebook/GradebookServiceHibernateImpl.java",
"license": "apache-2.0",
"size": 122390
} | [
"java.util.List",
"java.util.Set",
"org.sakaiproject.tool.gradebook.CourseGrade",
"org.sakaiproject.tool.gradebook.CourseGradeRecord",
"org.sakaiproject.tool.gradebook.Gradebook"
] | import java.util.List; import java.util.Set; import org.sakaiproject.tool.gradebook.CourseGrade; import org.sakaiproject.tool.gradebook.CourseGradeRecord; import org.sakaiproject.tool.gradebook.Gradebook; | import java.util.*; import org.sakaiproject.tool.gradebook.*; | [
"java.util",
"org.sakaiproject.tool"
] | java.util; org.sakaiproject.tool; | 864,673 |
@Named("listServiceOfferings")
@GET
@QueryParams(keys = { "command", "listAll" }, values = { "listServiceOfferings", "true" })
@SelectJson("serviceoffering")
@Consumes(MediaType.APPLICATION_JSON)
@Fallback(EmptySetOnNotFoundOr404.class)
Set<ServiceOffering> listServiceOfferings(ListServiceOfferingsOptions... options); | @Named(STR) @QueryParams(keys = { STR, STR }, values = { STR, "true" }) @SelectJson(STR) @Consumes(MediaType.APPLICATION_JSON) @Fallback(EmptySetOnNotFoundOr404.class) Set<ServiceOffering> listServiceOfferings(ListServiceOfferingsOptions... options); | /**
* Lists service offerings
*
* @param options
* if present, how to constrain the list.
* @return service offerings matching query, or empty set, if no service
* offerings are found
*/ | Lists service offerings | listServiceOfferings | {
"repo_name": "yanzhijun/jclouds-aliyun",
"path": "apis/cloudstack/src/main/java/org/jclouds/cloudstack/features/OfferingApi.java",
"license": "apache-2.0",
"size": 5271
} | [
"java.util.Set",
"javax.inject.Named",
"javax.ws.rs.Consumes",
"javax.ws.rs.core.MediaType",
"org.jclouds.Fallbacks",
"org.jclouds.cloudstack.domain.ServiceOffering",
"org.jclouds.cloudstack.options.ListServiceOfferingsOptions",
"org.jclouds.rest.annotations.Fallback",
"org.jclouds.rest.annotations.QueryParams",
"org.jclouds.rest.annotations.SelectJson"
] | import java.util.Set; import javax.inject.Named; import javax.ws.rs.Consumes; import javax.ws.rs.core.MediaType; import org.jclouds.Fallbacks; import org.jclouds.cloudstack.domain.ServiceOffering; import org.jclouds.cloudstack.options.ListServiceOfferingsOptions; import org.jclouds.rest.annotations.Fallback; import org.jclouds.rest.annotations.QueryParams; import org.jclouds.rest.annotations.SelectJson; | import java.util.*; import javax.inject.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.jclouds.*; import org.jclouds.cloudstack.domain.*; import org.jclouds.cloudstack.options.*; import org.jclouds.rest.annotations.*; | [
"java.util",
"javax.inject",
"javax.ws",
"org.jclouds",
"org.jclouds.cloudstack",
"org.jclouds.rest"
] | java.util; javax.inject; javax.ws; org.jclouds; org.jclouds.cloudstack; org.jclouds.rest; | 93,624 |
public static void reverse(double[] array) {
checkNotNull(array);
reverse(array, 0, array.length);
}
/**
* Reverses the elements of {@code array} between {@code fromIndex} inclusive and {@code toIndex}
* exclusive. This is equivalent to {@code
* Collections.reverse(Doubles.asList(array).subList(fromIndex, toIndex))}, but is likely to be
* more efficient.
*
* @throws IndexOutOfBoundsException if {@code fromIndex < 0}, {@code toIndex > array.length}, or
* {@code toIndex > fromIndex} | static void function(double[] array) { checkNotNull(array); reverse(array, 0, array.length); } /** * Reverses the elements of {@code array} between {@code fromIndex} inclusive and {@code toIndex} * exclusive. This is equivalent to { * Collections.reverse(Doubles.asList(array).subList(fromIndex, toIndex))}, but is likely to be * more efficient. * * @throws IndexOutOfBoundsException if {@code fromIndex < 0}, {@code toIndex > array.length}, or * {@code toIndex > fromIndex} | /**
* Reverses the elements of {@code array}. This is equivalent to {@code
* Collections.reverse(Doubles.asList(array))}, but is likely to be more efficient.
*
* @since 23.1
*/ | Reverses the elements of array. This is equivalent to Collections.reverse(Doubles.asList(array)), but is likely to be more efficient | reverse | {
"repo_name": "rgoldberg/guava",
"path": "android/guava/src/com/google/common/primitives/Doubles.java",
"license": "apache-2.0",
"size": 25085
} | [
"com.google.common.base.Preconditions",
"java.util.Collections"
] | import com.google.common.base.Preconditions; import java.util.Collections; | import com.google.common.base.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 2,044,348 |
public Map<String, ModelTClosenessCriterion> getTClosenessModel() {
if (this.tClosenessModel == null) {
this.tClosenessModel = new HashMap<String, ModelTClosenessCriterion>();
}
return tClosenessModel;
} | Map<String, ModelTClosenessCriterion> function() { if (this.tClosenessModel == null) { this.tClosenessModel = new HashMap<String, ModelTClosenessCriterion>(); } return tClosenessModel; } | /**
* Returns the t-closeness model.
*
* @return
*/ | Returns the t-closeness model | getTClosenessModel | {
"repo_name": "arx-deidentifier/arx",
"path": "src/gui/org/deidentifier/arx/gui/model/Model.java",
"license": "apache-2.0",
"size": 57645
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 866,928 |
long getDbId() throws IOException; | long getDbId() throws IOException; | /**
* the dbid for this transaction log.
* @return the dbid for this transaction log.
* @throws IOException
*/ | the dbid for this transaction log | getDbId | {
"repo_name": "joyent/zookeeper",
"path": "src/java/main/org/apache/zookeeper/server/persistence/TxnLog.java",
"license": "apache-2.0",
"size": 3685
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,885,676 |
@Override
public RequestStatus updateResources(Request request, Predicate predicate)
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
final Set<RequestScheduleRequest> requests = new
HashSet<RequestScheduleRequest>();
Iterator<Map<String,Object>> iterator = request.getProperties().iterator();
if (iterator.hasNext()) {
for (Map<String, Object> propertyMap : getPropertyMaps(iterator.next(), predicate)) {
requests.add(getRequestScheduleRequest(propertyMap));
} | RequestStatus function(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { final Set<RequestScheduleRequest> requests = new HashSet<RequestScheduleRequest>(); Iterator<Map<String,Object>> iterator = request.getProperties().iterator(); if (iterator.hasNext()) { for (Map<String, Object> propertyMap : getPropertyMaps(iterator.next(), predicate)) { requests.add(getRequestScheduleRequest(propertyMap)); } | /**
* Currently unsupported operation. Since strong guarantees are required
* that no jobs are currently running.
* @param request the request object which defines the set of properties
* for the resources to be updated
* @param predicate the predicate object which can be used to filter which
* resources are updated
*
* @return
* @throws SystemException
* @throws UnsupportedPropertyException
* @throws NoSuchResourceException
* @throws NoSuchParentResourceException
*/ | Currently unsupported operation. Since strong guarantees are required that no jobs are currently running | updateResources | {
"repo_name": "zouzhberk/ambaridemo",
"path": "demo-server/src/main/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProvider.java",
"license": "apache-2.0",
"size": 26859
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.Map",
"java.util.Set",
"org.apache.ambari.server.controller.RequestScheduleRequest",
"org.apache.ambari.server.controller.spi.NoSuchParentResourceException",
"org.apache.ambari.server.controller.spi.NoSuchResourceException",
"org.apache.ambari.server.controller.spi.Predicate",
"org.apache.ambari.server.controller.spi.Request",
"org.apache.ambari.server.controller.spi.RequestStatus",
"org.apache.ambari.server.controller.spi.SystemException",
"org.apache.ambari.server.controller.spi.UnsupportedPropertyException"
] | import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.ambari.server.controller.RequestScheduleRequest; import org.apache.ambari.server.controller.spi.NoSuchParentResourceException; import org.apache.ambari.server.controller.spi.NoSuchResourceException; import org.apache.ambari.server.controller.spi.Predicate; import org.apache.ambari.server.controller.spi.Request; import org.apache.ambari.server.controller.spi.RequestStatus; import org.apache.ambari.server.controller.spi.SystemException; import org.apache.ambari.server.controller.spi.UnsupportedPropertyException; | import java.util.*; import org.apache.ambari.server.controller.*; import org.apache.ambari.server.controller.spi.*; | [
"java.util",
"org.apache.ambari"
] | java.util; org.apache.ambari; | 2,347,773 |
@Override
public boolean isItemValid( ItemStack par1ItemStack )
{
return false;
} | boolean function( ItemStack par1ItemStack ) { return false; } | /**
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
*/ | Check if the stack is a valid item for this slot. Always true beside for the armor slots | isItemValid | {
"repo_name": "SKCraft/Applied-Energistics-2",
"path": "src/main/java/appeng/container/slot/AppEngCraftingSlot.java",
"license": "gpl-3.0",
"size": 5978
} | [
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 1,354,785 |
public void onBeforeContextMenu(CefBrowser browser,
CefContextMenuParams params,
CefMenuModel model); | void function(CefBrowser browser, CefContextMenuParams params, CefMenuModel model); | /**
* Called before a context menu is displayed.
*
* @param browser The corresponding browser.
* @param params provides information about the context menu state.
* @param model can be cleared to show no context menu or modified
* to show a custom menu.
*/ | Called before a context menu is displayed | onBeforeContextMenu | {
"repo_name": "viglucci/app-jcef-example",
"path": "src/main/java/org/cef/handler/CefContextMenuHandler.java",
"license": "bsd-3-clause",
"size": 3103
} | [
"org.cef.browser.CefBrowser",
"org.cef.callback.CefContextMenuParams",
"org.cef.callback.CefMenuModel"
] | import org.cef.browser.CefBrowser; import org.cef.callback.CefContextMenuParams; import org.cef.callback.CefMenuModel; | import org.cef.browser.*; import org.cef.callback.*; | [
"org.cef.browser",
"org.cef.callback"
] | org.cef.browser; org.cef.callback; | 278,695 |
public static void setBytes(OutputStream os, byte[] bytes) throws IOException {
try {
os.write(bytes);
} finally {
closeWithWarning(os);
}
} | static void function(OutputStream os, byte[] bytes) throws IOException { try { os.write(bytes); } finally { closeWithWarning(os); } } | /**
* Write the byte[] to the output stream.
* The stream is closed before this method returns.
*
* @param os an output stream
* @param bytes the byte[] to write to the output stream
* @throws IOException if an IOException occurs.
* @since 1.7.1
*/ | Write the byte[] to the output stream. The stream is closed before this method returns | setBytes | {
"repo_name": "graemerocher/incubator-groovy",
"path": "src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java",
"license": "apache-2.0",
"size": 64289
} | [
"java.io.IOException",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,618,852 |
EReference getModel_C(); | EReference getModel_C(); | /**
* Returns the meta object for the containment reference '{@link com.euclideanspace.spad.editor.Model#getC <em>C</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference '<em>C</em>'.
* @see com.euclideanspace.spad.editor.Model#getC()
* @see #getModel()
* @generated
*/ | Returns the meta object for the containment reference '<code>com.euclideanspace.spad.editor.Model#getC C</code>'. | getModel_C | {
"repo_name": "martinbaker/euclideanspace",
"path": "com.euclideanspace.spad/src-gen/com/euclideanspace/spad/editor/EditorPackage.java",
"license": "agpl-3.0",
"size": 593321
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,228,495 |
Date getLastModifiedDateTime(); | Date getLastModifiedDateTime(); | /**
* Returns the value of the '<em><b>Last Modified Date Time</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Last Modified Date Time</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Last Modified Date Time</em>' attribute.
* @see #setLastModifiedDateTime(Date)
* @see gluemodel.CIM.IEC61968.Common.CommonPackage#getDocument_LastModifiedDateTime()
* @model required="true"
* annotation="http://iec.ch/TC57/2009/CIM-schema-cim14 Documentation='Date and time this document was last modified. Documents may potentially be modified many times during their lifetime.'"
* annotation="http://www.eclipse.org/emf/2002/GenModel Documentation='Date and time this document was last modified. Documents may potentially be modified many times during their lifetime.'"
* @generated
*/ | Returns the value of the 'Last Modified Date Time' attribute. If the meaning of the 'Last Modified Date Time' attribute isn't clear, there really should be more of a description here... | getLastModifiedDateTime | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61968/Common/Document.java",
"license": "mit",
"size": 27417
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,901,293 |
@ManagedAttribute(description = "Timer Daemon")
public void setDaemon(boolean daemon) {
this.daemon = daemon;
} | @ManagedAttribute(description = STR) void function(boolean daemon) { this.daemon = daemon; } | /**
* Specifies whether or not the thread associated with the timer endpoint runs as a daemon.
* <p/>
* The default value is true.
*/ | Specifies whether or not the thread associated with the timer endpoint runs as a daemon. The default value is true | setDaemon | {
"repo_name": "ramonmaruko/camel",
"path": "camel-core/src/main/java/org/apache/camel/component/timer/TimerEndpoint.java",
"license": "apache-2.0",
"size": 7543
} | [
"org.apache.camel.api.management.ManagedAttribute"
] | import org.apache.camel.api.management.ManagedAttribute; | import org.apache.camel.api.management.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,865,201 |
public Group getGroup(String alias) throws GroupNotFoundException {
Group group = userGroupManagement.findGroupByAlias(alias, new IdentityConverter<Group>());
if (group == null) {
group = getGroup(alias, null);
}
return group;
}
| Group function(String alias) throws GroupNotFoundException { Group group = userGroupManagement.findGroupByAlias(alias, new IdentityConverter<Group>()); if (group == null) { group = getGroup(alias, null); } return group; } | /**
* Get a group by its alias. The group will be searched in the local database. If not found, the
* primary repository will be queried.
*
* @param alias
* the alias of the group
* @return the found group
* @throws GroupNotFoundException
* in case the group was not found
*/ | Get a group by its alias. The group will be searched in the local database. If not found, the primary repository will be queried | getGroup | {
"repo_name": "Communote/communote-server",
"path": "communote/persistence/src/main/java/com/communote/server/service/UserService.java",
"license": "apache-2.0",
"size": 32605
} | [
"com.communote.common.converter.IdentityConverter",
"com.communote.server.core.user.group.GroupNotFoundException",
"com.communote.server.model.user.group.Group"
] | import com.communote.common.converter.IdentityConverter; import com.communote.server.core.user.group.GroupNotFoundException; import com.communote.server.model.user.group.Group; | import com.communote.common.converter.*; import com.communote.server.core.user.group.*; import com.communote.server.model.user.group.*; | [
"com.communote.common",
"com.communote.server"
] | com.communote.common; com.communote.server; | 1,613,905 |
@Test
public void testSerialization() throws IOException, ClassNotFoundException {
DefaultCategoryDataset d = new DefaultCategoryDataset();
d.addValue(1.0, "R1", "C1");
d.addValue(2.0, "R1", "C2");
d.addValue(3.0, "R2", "C1");
d.addValue(4.0, "R2", "C2");
CategoryItemEntity e1 = new CategoryItemEntity(new Rectangle2D.Double(
1.0, 2.0, 3.0, 4.0), "ToolTip", "URL", d, "R1", "C2");
ByteArrayOutputStream buffer = new ByteArrayOutputStream();
ObjectOutput out = new ObjectOutputStream(buffer);
out.writeObject(e1);
out.close();
ObjectInput in = new ObjectInputStream(
new ByteArrayInputStream(buffer.toByteArray()));
CategoryItemEntity e2 = (CategoryItemEntity) in.readObject();
in.close();
assertEquals(e1, e2);
} | void function() throws IOException, ClassNotFoundException { DefaultCategoryDataset d = new DefaultCategoryDataset(); d.addValue(1.0, "R1", "C1"); d.addValue(2.0, "R1", "C2"); d.addValue(3.0, "R2", "C1"); d.addValue(4.0, "R2", "C2"); CategoryItemEntity e1 = new CategoryItemEntity(new Rectangle2D.Double( 1.0, 2.0, 3.0, 4.0), STR, "URL", d, "R1", "C2"); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(e1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); CategoryItemEntity e2 = (CategoryItemEntity) in.readObject(); in.close(); assertEquals(e1, e2); } | /**
* Serialize an instance, restore it, and check for equality.
*/ | Serialize an instance, restore it, and check for equality | testSerialization | {
"repo_name": "akardapolov/ASH-Viewer",
"path": "jfreechart-fse/src/test/java/org/jfree/chart/entity/CategoryItemEntityTest.java",
"license": "gpl-3.0",
"size": 5260
} | [
"java.awt.geom.Rectangle2D",
"java.io.ByteArrayInputStream",
"java.io.ByteArrayOutputStream",
"java.io.IOException",
"java.io.ObjectInput",
"java.io.ObjectInputStream",
"java.io.ObjectOutput",
"java.io.ObjectOutputStream",
"org.jfree.data.category.DefaultCategoryDataset",
"org.junit.Assert"
] | import java.awt.geom.Rectangle2D; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectInputStream; import java.io.ObjectOutput; import java.io.ObjectOutputStream; import org.jfree.data.category.DefaultCategoryDataset; import org.junit.Assert; | import java.awt.geom.*; import java.io.*; import org.jfree.data.category.*; import org.junit.*; | [
"java.awt",
"java.io",
"org.jfree.data",
"org.junit"
] | java.awt; java.io; org.jfree.data; org.junit; | 2,164,998 |
public long getOffset( )
{
return offset;
}
private ByteArrayOutputStream buffer = new ByteArrayOutputStream( );
private DataOutputStream bufferStream = new DataOutputStream( buffer );
protected Stack contents = new Stack( ); | long function( ) { return offset; } private ByteArrayOutputStream buffer = new ByteArrayOutputStream( ); private DataOutputStream bufferStream = new DataOutputStream( buffer ); protected Stack contents = new Stack( ); | /**
* get the current offset.
*
* @return
*/ | get the current offset | getOffset | {
"repo_name": "sguan-actuate/birt",
"path": "engine/org.eclipse.birt.report.engine/src/org/eclipse/birt/report/engine/internal/document/v2/ReportContentWriterV2.java",
"license": "epl-1.0",
"size": 6486
} | [
"java.io.ByteArrayOutputStream",
"java.io.DataOutputStream",
"java.util.Stack"
] | import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.util.Stack; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 164,873 |
public static String getTagValue( Node n, String tag, String subtag ) {
NodeList children, tags;
Node childnode, tagnode;
if ( n == null ) {
return null;
}
children = n.getChildNodes();
for ( int i = 0; i < children.getLength(); i++ ) {
childnode = children.item( i );
if ( childnode.getNodeName().equalsIgnoreCase( tag ) ) {
// <file>
tags = childnode.getChildNodes();
for ( int j = 0; j < tags.getLength(); j++ ) {
tagnode = tags.item( j );
if ( tagnode.getNodeName().equalsIgnoreCase( subtag ) ) {
if ( tagnode.getFirstChild() != null ) {
return tagnode.getFirstChild().getNodeValue();
}
}
}
}
}
return null;
} | static String function( Node n, String tag, String subtag ) { NodeList children, tags; Node childnode, tagnode; if ( n == null ) { return null; } children = n.getChildNodes(); for ( int i = 0; i < children.getLength(); i++ ) { childnode = children.item( i ); if ( childnode.getNodeName().equalsIgnoreCase( tag ) ) { tags = childnode.getChildNodes(); for ( int j = 0; j < tags.getLength(); j++ ) { tagnode = tags.item( j ); if ( tagnode.getNodeName().equalsIgnoreCase( subtag ) ) { if ( tagnode.getFirstChild() != null ) { return tagnode.getFirstChild().getNodeValue(); } } } } } return null; } | /**
* Search a node for a certain tag, in that subnode search for a certain subtag. Return the value of that subtag.
*
* @param n The node to look in
* @param tag The tag to look for
* @param subtag The subtag to look for
* @return The string of the subtag or null if nothing was found.
*/ | Search a node for a certain tag, in that subnode search for a certain subtag. Return the value of that subtag | getTagValue | {
"repo_name": "ccaspanello/pentaho-kettle",
"path": "core/src/main/java/org/pentaho/di/core/xml/XMLHandler.java",
"license": "apache-2.0",
"size": 37476
} | [
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,515,649 |
public XmlSimpleCertificateReport getJaxbModel() {
return simpleReport;
} | XmlSimpleCertificateReport function() { return simpleReport; } | /**
* This methods returns the jaxb model of the simple certificate report
*
* @return the jaxb model
*/ | This methods returns the jaxb model of the simple certificate report | getJaxbModel | {
"repo_name": "esig/dss",
"path": "dss-simple-certificate-report-jaxb/src/main/java/eu/europa/esig/dss/simplecertificatereport/SimpleCertificateReport.java",
"license": "lgpl-2.1",
"size": 13121
} | [
"eu.europa.esig.dss.simplecertificatereport.jaxb.XmlSimpleCertificateReport"
] | import eu.europa.esig.dss.simplecertificatereport.jaxb.XmlSimpleCertificateReport; | import eu.europa.esig.dss.simplecertificatereport.jaxb.*; | [
"eu.europa.esig"
] | eu.europa.esig; | 2,160,358 |
public void processInfo(OneResponse info)
{
if (info.isError())
{
return;
}
try
{
DocumentBuilder builder;
Document doc;
Element xml;
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
doc = builder.parse(
new ByteArrayInputStream(info.getMessage().getBytes()));
xml = doc.getDocumentElement();
poolElements = xml.getElementsByTagName(elementName);
}
catch (ParserConfigurationException e) {}
catch (SAXException e) {}
catch (IOException e) {}
} | void function(OneResponse info) { if (info.isError()) { return; } try { DocumentBuilder builder; Document doc; Element xml; builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); doc = builder.parse( new ByteArrayInputStream(info.getMessage().getBytes())); xml = doc.getDocumentElement(); poolElements = xml.getElementsByTagName(elementName); } catch (ParserConfigurationException e) {} catch (SAXException e) {} catch (IOException e) {} } | /**
* After a *pool.info call, this method builds the internal xml
* representation of the pool.
* @param info The XML-RPC *pool.info response
*/ | After a *pool.info call, this method builds the internal xml representation of the pool | processInfo | {
"repo_name": "philsavor/opennebula3.2.1",
"path": "src/oca/java/src/org/opennebula/client/Pool.java",
"license": "apache-2.0",
"size": 7018
} | [
"java.io.ByteArrayInputStream",
"java.io.IOException",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Document",
"org.w3c.dom.Element",
"org.xml.sax.SAXException"
] | import java.io.ByteArrayInputStream; import java.io.IOException; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | java.io; javax.xml; org.w3c.dom; org.xml.sax; | 794,955 |
void dialogChanged() {
if (!groupIdChanged || groupId.getText().length() == 0) {
updateStatus("group Id must be specified");
return;
}
if (!artifactIdChanged || artifactId.getText().length() == 0) {
updateStatus("artifact Id must be specified");
return;
}
if (advancedSettings.version.getText().length() == 0) {
updateStatus("version must be specified");
return;
}
if (advancedSettings.javaPackage.getText().length() == 0) {
updateStatus("package must be specified");
return;
}
IProject existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(artifactId.getText());
if (existingProject.exists()) {
updateStatus("A project with the name " + artifactId.getText() + " already exists.");
return;
}
int cnt = advancedSettings.propertiesTable.getItemCount();
for (int i = 0; i < cnt; i++) {
TableItem item = advancedSettings.propertiesTable.getItem(i);
if (item.getText(1).length() == 0) {
updateStatus(item.getText(0) + " must be specified");
return;
}
}
updateStatus(null);
} | void dialogChanged() { if (!groupIdChanged groupId.getText().length() == 0) { updateStatus(STR); return; } if (!artifactIdChanged artifactId.getText().length() == 0) { updateStatus(STR); return; } if (advancedSettings.version.getText().length() == 0) { updateStatus(STR); return; } if (advancedSettings.javaPackage.getText().length() == 0) { updateStatus(STR); return; } IProject existingProject = ResourcesPlugin.getWorkspace().getRoot().getProject(artifactId.getText()); if (existingProject.exists()) { updateStatus(STR + artifactId.getText() + STR); return; } int cnt = advancedSettings.propertiesTable.getItemCount(); for (int i = 0; i < cnt; i++) { TableItem item = advancedSettings.propertiesTable.getItem(i); if (item.getText(1).length() == 0) { updateStatus(item.getText(0) + STR); return; } } updateStatus(null); } | /**
* Ensures that both text fields are set.
*/ | Ensures that both text fields are set | dialogChanged | {
"repo_name": "Adobe-Marketing-Cloud/aem-eclipse-developer-tools",
"path": "com.adobe.granite.ide.eclipse-ui/src/main/java/com/adobe/granite/ide/eclipse/ui/wizards/np/SimplerParametersWizardPage.java",
"license": "apache-2.0",
"size": 8984
} | [
"org.eclipse.core.resources.IProject",
"org.eclipse.core.resources.ResourcesPlugin",
"org.eclipse.swt.widgets.TableItem"
] | import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.swt.widgets.TableItem; | import org.eclipse.core.resources.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.core",
"org.eclipse.swt"
] | org.eclipse.core; org.eclipse.swt; | 2,400,791 |
@SuppressWarnings({"unchecked"})
private CacheStore cacheStoreWrapper(GridKernalContext ctx,
@Nullable CacheStore cfgStore,
CacheConfiguration cfg) {
if (cfgStore == null || !cfg.isWriteBehindEnabled())
return cfgStore;
GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(this,
ctx.gridName(),
cfg.getName(),
ctx.log(GridCacheWriteBehindStore.class),
cfgStore);
store.setFlushSize(cfg.getWriteBehindFlushSize());
store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount());
store.setFlushFrequency(cfg.getWriteBehindFlushFrequency());
store.setBatchSize(cfg.getWriteBehindBatchSize());
return store;
} | @SuppressWarnings({STR}) CacheStore function(GridKernalContext ctx, @Nullable CacheStore cfgStore, CacheConfiguration cfg) { if (cfgStore == null !cfg.isWriteBehindEnabled()) return cfgStore; GridCacheWriteBehindStore store = new GridCacheWriteBehindStore(this, ctx.gridName(), cfg.getName(), ctx.log(GridCacheWriteBehindStore.class), cfgStore); store.setFlushSize(cfg.getWriteBehindFlushSize()); store.setFlushThreadCount(cfg.getWriteBehindFlushThreadCount()); store.setFlushFrequency(cfg.getWriteBehindFlushFrequency()); store.setBatchSize(cfg.getWriteBehindBatchSize()); return store; } | /**
* Creates a wrapped cache store if write-behind cache is configured.
*
* @param ctx Kernal context.
* @param cfgStore Store provided in configuration.
* @param cfg Cache configuration.
* @return Instance if {@link GridCacheWriteBehindStore} if write-behind store is configured,
* or user-defined cache store.
*/ | Creates a wrapped cache store if write-behind cache is configured | cacheStoreWrapper | {
"repo_name": "VladimirErshov/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/processors/cache/store/GridCacheStoreManagerAdapter.java",
"license": "apache-2.0",
"size": 38678
} | [
"org.apache.ignite.cache.store.CacheStore",
"org.apache.ignite.configuration.CacheConfiguration",
"org.apache.ignite.internal.GridKernalContext",
"org.jetbrains.annotations.Nullable"
] | import org.apache.ignite.cache.store.CacheStore; import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.GridKernalContext; import org.jetbrains.annotations.Nullable; | import org.apache.ignite.cache.store.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.jetbrains.annotations.*; | [
"org.apache.ignite",
"org.jetbrains.annotations"
] | org.apache.ignite; org.jetbrains.annotations; | 2,778,733 |
public void closeConnection()
throws SeException {
conn.close();
}
| void function() throws SeException { conn.close(); } | /**
* Close the current connection to the ArcSDE server <br>
* throws SeException
*
* @throws SeException
*/ | Close the current connection to the ArcSDE server throws SeException | closeConnection | {
"repo_name": "lat-lon/deegree2-base",
"path": "deegree2-arcsde/src/main/java/org/deegree/io/sdeapi/SpatialQuery.java",
"license": "lgpl-2.1",
"size": 26858
} | [
"com.esri.sde.sdk.client.SeException"
] | import com.esri.sde.sdk.client.SeException; | import com.esri.sde.sdk.client.*; | [
"com.esri.sde"
] | com.esri.sde; | 1,290,677 |
protected static void registerItemBlock(Block blockIn, Item itemIn)
{
registerItem(Block.getIdFromBlock(blockIn), Block.REGISTRY.getNameForObject(blockIn), itemIn);
BLOCK_TO_ITEM.put(blockIn, itemIn);
} | static void function(Block blockIn, Item itemIn) { registerItem(Block.getIdFromBlock(blockIn), Block.REGISTRY.getNameForObject(blockIn), itemIn); BLOCK_TO_ITEM.put(blockIn, itemIn); } | /**
* Register the given Item as the ItemBlock for the given Block.
*/ | Register the given Item as the ItemBlock for the given Block | registerItemBlock | {
"repo_name": "Severed-Infinity/technium",
"path": "build/tmp/recompileMc/sources/net/minecraft/item/Item.java",
"license": "gpl-3.0",
"size": 94271
} | [
"net.minecraft.block.Block"
] | import net.minecraft.block.Block; | import net.minecraft.block.*; | [
"net.minecraft.block"
] | net.minecraft.block; | 1,479,181 |
public Observable<ServiceResponse<List<MetricDefinitionInner>>> listMetricDefinitionsWithServiceResponseAsync(String resourceGroupName, String accountName, String databaseRid) {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
}
if (resourceGroupName == null) {
throw new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.");
}
if (accountName == null) {
throw new IllegalArgumentException("Parameter accountName is required and cannot be null.");
}
if (databaseRid == null) {
throw new IllegalArgumentException("Parameter databaseRid is required and cannot be null.");
} | Observable<ServiceResponse<List<MetricDefinitionInner>>> function(String resourceGroupName, String accountName, String databaseRid) { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } if (resourceGroupName == null) { throw new IllegalArgumentException(STR); } if (accountName == null) { throw new IllegalArgumentException(STR); } if (databaseRid == null) { throw new IllegalArgumentException(STR); } | /**
* Retrieves metric definitions for the given database.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param accountName Cosmos DB database account name.
* @param databaseRid Cosmos DB database rid.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List<MetricDefinitionInner> object
*/ | Retrieves metric definitions for the given database | listMetricDefinitionsWithServiceResponseAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/cosmos/mgmt-v2020_06_01_preview/src/main/java/com/microsoft/azure/management/cosmosdb/v2020_06_01_preview/implementation/DatabasesInner.java",
"license": "mit",
"size": 28327
} | [
"com.microsoft.rest.ServiceResponse",
"java.util.List"
] | import com.microsoft.rest.ServiceResponse; import java.util.List; | import com.microsoft.rest.*; import java.util.*; | [
"com.microsoft.rest",
"java.util"
] | com.microsoft.rest; java.util; | 969,248 |
public ModelCheckerResult computeBoundedUntilProbs(CTMDP ctmdp, BitSet remain, BitSet target, double t, boolean min) throws PrismException
{
return computeBoundedReachProbs(ctmdp, remain, target, t, min, null, null);
} | ModelCheckerResult function(CTMDP ctmdp, BitSet remain, BitSet target, double t, boolean min) throws PrismException { return computeBoundedReachProbs(ctmdp, remain, target, t, min, null, null); } | /**
* Compute bounded until probabilities.
* i.e. compute the min/max probability of reaching a state in {@code target},
* within time t, and while remaining in states in @{code remain}.
* @param ctmdp The CTMDP
* @param remain Remain in these states (optional: null means "all")
* @param target Target states
* @param t Bound
* @param min Min or max probabilities (true=min, false=max)
*/ | Compute bounded until probabilities. i.e. compute the min/max probability of reaching a state in target, within time t, and while remaining in states in @{code remain} | computeBoundedUntilProbs | {
"repo_name": "nicodelpiano/prism",
"path": "src/explicit/CTMDPModelChecker.java",
"license": "gpl-2.0",
"size": 10400
} | [
"java.util.BitSet"
] | import java.util.BitSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,535,388 |
T visitSourceAlias(@NotNull CQLParser.SourceAliasContext ctx); | T visitSourceAlias(@NotNull CQLParser.SourceAliasContext ctx); | /**
* Visit a parse tree produced by {@link CQLParser#sourceAlias}.
*/ | Visit a parse tree produced by <code>CQLParser#sourceAlias</code> | visitSourceAlias | {
"repo_name": "HuaweiBigData/StreamCQL",
"path": "cql/src/main/java/com/huawei/streaming/cql/semanticanalyzer/parser/CQLParserVisitor.java",
"license": "apache-2.0",
"size": 29279
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 2,161,091 |
public static void recordTimesHistogram(String name, long duration, TimeUnit timeUnit) {
recordCustomTimesHistogramMilliseconds(
name, timeUnit.toMillis(duration), 1, TimeUnit.SECONDS.toMillis(10), 50);
} | static void function(String name, long duration, TimeUnit timeUnit) { recordCustomTimesHistogramMilliseconds( name, timeUnit.toMillis(duration), 1, TimeUnit.SECONDS.toMillis(10), 50); } | /**
* Records a sample in a histogram of times. Useful for recording short durations. This is the
* Java equivalent of the UMA_HISTOGRAM_TIMES C++ macro.
* @param name name of the histogram
* @param duration duration to be recorded
* @param timeUnit the unit of the duration argument
*/ | Records a sample in a histogram of times. Useful for recording short durations. This is the Java equivalent of the UMA_HISTOGRAM_TIMES C++ macro | recordTimesHistogram | {
"repo_name": "junhuac/MQUIC",
"path": "src/base/android/java/src/org/chromium/base/metrics/RecordHistogram.java",
"license": "mit",
"size": 10852
} | [
"java.util.concurrent.TimeUnit"
] | import java.util.concurrent.TimeUnit; | import java.util.concurrent.*; | [
"java.util"
] | java.util; | 1,959,719 |
Set<DataElement> getDataElements( ValidationRule validationRule );
| Set<DataElement> getDataElements( ValidationRule validationRule ); | /**
* Get data elements part of the left side and right side expressions of the
* given validation rule.
*
* @param validationRule the validation rule.
* @return a set of data elements.
*/ | Get data elements part of the left side and right side expressions of the given validation rule | getDataElements | {
"repo_name": "troyel/dhis2-core",
"path": "dhis-2/dhis-api/src/main/java/org/hisp/dhis/validation/ValidationRuleService.java",
"license": "bsd-3-clause",
"size": 7529
} | [
"java.util.Set",
"org.hisp.dhis.dataelement.DataElement"
] | import java.util.Set; import org.hisp.dhis.dataelement.DataElement; | import java.util.*; import org.hisp.dhis.dataelement.*; | [
"java.util",
"org.hisp.dhis"
] | java.util; org.hisp.dhis; | 1,147,160 |
try {
return CacheBuilderSpec.parse(value);
} catch (Exception ex) {
throw new ParameterException("Couldn't convert value \"" + value + "\" to CacheBuilderSpec.", ex);
}
} | try { return CacheBuilderSpec.parse(value); } catch (Exception ex) { throw new ParameterException(STRSTR\STR, ex); } } | /**
* Returns a {@link CacheBuilderSpec} instance representing the specified {@link String} {@literal value}.
*
* @param value The configuration parameter's {@link String} value
* @return A {@link CacheBuilderSpec} instance representing the configuration parameter's value
*/ | Returns a <code>CacheBuilderSpec</code> instance representing the specified <code>String</code> value | convertFrom | {
"repo_name": "joschi/JadConfig",
"path": "src/main/java/com/github/joschi/jadconfig/guava/converters/CacheBuilderSpecConverter.java",
"license": "apache-2.0",
"size": 1484
} | [
"com.github.joschi.jadconfig.ParameterException",
"com.google.common.cache.CacheBuilderSpec"
] | import com.github.joschi.jadconfig.ParameterException; import com.google.common.cache.CacheBuilderSpec; | import com.github.joschi.jadconfig.*; import com.google.common.cache.*; | [
"com.github.joschi",
"com.google.common"
] | com.github.joschi; com.google.common; | 2,442,353 |
@InterfaceAudience.Public
public View getView(String name) {
View view = null;
if (views != null) {
view = views.get(name);
}
if (view != null) {
return view;
}
try {
return registerView(new View(this, name, true));
} catch (CouchbaseLiteException e) {
Log.e(TAG, "Error in registerView", e);
return null;
}
} | @InterfaceAudience.Public View function(String name) { View view = null; if (views != null) { view = views.get(name); } if (view != null) { return view; } try { return registerView(new View(this, name, true)); } catch (CouchbaseLiteException e) { Log.e(TAG, STR, e); return null; } } | /**
* Returns a View object for the view with the given name.
* (This succeeds even if the view doesn't already exist, but the view won't be added to
* the database until the View is assigned a map function.)
*/ | Returns a View object for the view with the given name. (This succeeds even if the view doesn't already exist, but the view won't be added to the database until the View is assigned a map function.) | getView | {
"repo_name": "Spotme/couchbase-lite-java-core",
"path": "src/main/java/com/couchbase/lite/Database.java",
"license": "apache-2.0",
"size": 87852
} | [
"com.couchbase.lite.internal.InterfaceAudience",
"com.couchbase.lite.util.Log"
] | import com.couchbase.lite.internal.InterfaceAudience; import com.couchbase.lite.util.Log; | import com.couchbase.lite.internal.*; import com.couchbase.lite.util.*; | [
"com.couchbase.lite"
] | com.couchbase.lite; | 2,172,193 |
@Test
public void readWriteBatchOneShotWithColumnFamilyOnly() throws Exception {
int maxInserts = 100000;
Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<>();
String format = "%1$05d";
for (int i = 0; i < maxInserts; i++) {
addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10));
if (i % 1000 == 0 || i == maxInserts - 1) {
tpc.proxy().updateAndFlush(userpass, testtable, mutations);
mutations.clear();
}
}
BatchScanOptions options = new BatchScanOptions();
ScanColumn sc = new ScanColumn();
sc.colFamily = ByteBuffer.wrap("cf0".getBytes());
options.columns = Collections.singletonList(sc);
String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options);
int i = 0;
boolean hasNext = true;
int k = 1000;
while (hasNext) {
ScanResult kvList = tpc.proxy().nextK(cookie, k);
i += kvList.getResultsSize();
hasNext = kvList.isMore();
}
assertEquals(i, 50000);
} | void function() throws Exception { int maxInserts = 100000; Map<ByteBuffer,List<ColumnUpdate>> mutations = new HashMap<>(); String format = STR; for (int i = 0; i < maxInserts; i++) { addMutation(mutations, String.format(format, i), "cf" + (i % 2), "cq" + (i % 2), Util.randString(10)); if (i % 1000 == 0 i == maxInserts - 1) { tpc.proxy().updateAndFlush(userpass, testtable, mutations); mutations.clear(); } } BatchScanOptions options = new BatchScanOptions(); ScanColumn sc = new ScanColumn(); sc.colFamily = ByteBuffer.wrap("cf0".getBytes()); options.columns = Collections.singletonList(sc); String cookie = tpc.proxy().createBatchScanner(userpass, testtable, options); int i = 0; boolean hasNext = true; int k = 1000; while (hasNext) { ScanResult kvList = tpc.proxy().nextK(cookie, k); i += kvList.getResultsSize(); hasNext = kvList.isMore(); } assertEquals(i, 50000); } | /**
* Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back
* (there should be 50,000)
*/ | Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a columnFamily so only the entries with specified column family come back (there should be 50,000) | readWriteBatchOneShotWithColumnFamilyOnly | {
"repo_name": "mikewalch/accumulo",
"path": "test/src/main/java/org/apache/accumulo/test/proxy/TestProxyReadWrite.java",
"license": "apache-2.0",
"size": 15885
} | [
"java.nio.ByteBuffer",
"java.util.Collections",
"java.util.HashMap",
"java.util.List",
"java.util.Map",
"org.apache.accumulo.proxy.Util",
"org.apache.accumulo.proxy.thrift.BatchScanOptions",
"org.apache.accumulo.proxy.thrift.ColumnUpdate",
"org.apache.accumulo.proxy.thrift.ScanColumn",
"org.apache.accumulo.proxy.thrift.ScanResult",
"org.junit.Assert"
] | import java.nio.ByteBuffer; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.accumulo.proxy.Util; import org.apache.accumulo.proxy.thrift.BatchScanOptions; import org.apache.accumulo.proxy.thrift.ColumnUpdate; import org.apache.accumulo.proxy.thrift.ScanColumn; import org.apache.accumulo.proxy.thrift.ScanResult; import org.junit.Assert; | import java.nio.*; import java.util.*; import org.apache.accumulo.proxy.*; import org.apache.accumulo.proxy.thrift.*; import org.junit.*; | [
"java.nio",
"java.util",
"org.apache.accumulo",
"org.junit"
] | java.nio; java.util; org.apache.accumulo; org.junit; | 2,311,848 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.