method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
iViewer activateViewer(iWidget context, Viewer cfg, String target); | iViewer activateViewer(iWidget context, Viewer cfg, String target); | /**
* Creates and activates the viewer for the specified viewer configuration
*
* @param context the context
* @param cfg the viewer configuration
* @param target the target for the viewer
* @return an instance of the viewer that was created or null if the viewer could no be created
*/ | Creates and activates the viewer for the specified viewer configuration | activateViewer | {
"repo_name": "appnativa/rare",
"path": "source/rare/core/com/appnativa/rare/ui/iWindowManager.java",
"license": "gpl-3.0",
"size": 16340
} | [
"com.appnativa.rare.spot.Viewer"
] | import com.appnativa.rare.spot.Viewer; | import com.appnativa.rare.spot.*; | [
"com.appnativa.rare"
] | com.appnativa.rare; | 2,731,493 |
private static String validateField(String content, CLColumn field, String code) {
if ((content == null || content.isEmpty()) && field.isMandatory()) {
return "Content for " + field + " field is mandatory for code with identifier: " + code;
} else if (content != null && !content.matches(field.getPattern())) {
return "Content in " + field + " field does not match pattern for code with identifier: " + code;
}
return null;
} | static String function(String content, CLColumn field, String code) { if ((content == null content.isEmpty()) && field.isMandatory()) { return STR + field + STR + code; } else if (content != null && !content.matches(field.getPattern())) { return STR + field + STR + code; } return null; } | /**
* Validates a single field's content based on a specific {@link CLColumn} restrictions
*
* @param content
* the content to be validated
* @param field
* the field / column restrictions
* @param code
* the code identifier to which this field belongs
* @return error message or null if no error has occurred during validation
*/ | Validates a single field's content based on a specific <code>CLColumn</code> restrictions | validateField | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sirma-platform/platform/seip-parent/platform/cls/cls-impl/src/main/java/com/sirma/itt/emf/cls/validator/CodeValidatorImpl.java",
"license": "lgpl-3.0",
"size": 7959
} | [
"com.sirma.itt.emf.cls.columns.CLColumn"
] | import com.sirma.itt.emf.cls.columns.CLColumn; | import com.sirma.itt.emf.cls.columns.*; | [
"com.sirma.itt"
] | com.sirma.itt; | 343,217 |
public Set<String> getNamespaces() {
return Collections.unmodifiableSet(this.namespaces);
} | Set<String> function() { return Collections.unmodifiableSet(this.namespaces); } | /**
* The namespace, or source, IDs to be searched. At least one namespace should be provided.
*/ | The namespace, or source, IDs to be searched. At least one namespace should be provided | getNamespaces | {
"repo_name": "phenoscape/PhenoscapeOBD-WS",
"path": "src/org/phenoscape/obd/query/SearchConfig.java",
"license": "mit",
"size": 2530
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 668,101 |
public static void applyRowHeaderStyles(HTMLTable table, int row, int column) {
applyColumnHeaderStyles(table, row, column);
table.getCellFormatter().addStyleName(row, column, "html-grid-header-row");
} | static void function(HTMLTable table, int row, int column) { applyColumnHeaderStyles(table, row, column); table.getCellFormatter().addStyleName(row, column, STR); } | /**
* Applies the CSS row-header styles to a cell.
*
* @param table
* The GWT table.
* @param row
* The row index.
* @param column
* The column index.
*/ | Applies the CSS row-header styles to a cell | applyRowHeaderStyles | {
"repo_name": "Raphcal/sigmah",
"path": "src/main/java/org/sigmah/client/ui/view/project/logframe/grid/HTMLTableUtils.java",
"license": "gpl-3.0",
"size": 4462
} | [
"com.google.gwt.user.client.ui.HTMLTable"
] | import com.google.gwt.user.client.ui.HTMLTable; | import com.google.gwt.user.client.ui.*; | [
"com.google.gwt"
] | com.google.gwt; | 447,897 |
private void startConversationWith(String who) {
final TextIter pointer;
pointer = buffer.getIterStart();
buffer.insert(pointer, "Starting conversation with " + who, italics);
} | void function(String who) { final TextIter pointer; pointer = buffer.getIterStart(); buffer.insert(pointer, STR + who, italics); } | /**
* When a conversation starts we want to indicate who it is with.
*/ | When a conversation starts we want to indicate who it is with | startConversationWith | {
"repo_name": "nhrdl/java_gnome",
"path": "java-gnome-4.1.3-Webkitgtk2/doc/examples/textview/ExampleInstantMessenger.java",
"license": "gpl-2.0",
"size": 12521
} | [
"org.gnome.gtk.TextIter"
] | import org.gnome.gtk.TextIter; | import org.gnome.gtk.*; | [
"org.gnome.gtk"
] | org.gnome.gtk; | 278,815 |
@Deprecated
public List<PackageDto> listAllPackages(User loggedInUser, String channelLabel,
String startDate, String endDate) throws NoSuchChannelException {
Channel channel = lookupChannelByLabel(loggedInUser, channelLabel);
return ChannelManager.listAllPackages(channel, startDate, endDate);
} | List<PackageDto> function(User loggedInUser, String channelLabel, String startDate, String endDate) throws NoSuchChannelException { Channel channel = lookupChannelByLabel(loggedInUser, channelLabel); return ChannelManager.listAllPackages(channel, startDate, endDate); } | /**
* Lists all packages in the channel, regardless of version, between the
* given dates.
* @param loggedInUser The current user
* @param channelLabel Label of channel whose package are sought.
* @param startDate last modified begin date (as a string)
* @param endDate last modified end date (as a string)
* @return all packages in the channel, regardless of version between the
* given dates.
* @throws NoSuchChannelException thrown if no channel is found.
* @deprecated being replaced by listAllPackages(string sessionKey,
* string channelLabel, dateTime.iso8601 startDate, dateTime.iso8601 endDate)
*
* @xmlrpc.doc Lists all packages in the channel, regardless of package version,
* between the given dates.
* Example Date: '2008-08-20 08:00:00'
* @xmlrpc.param #session_key()
* @xmlrpc.param #param_desc("string", "channelLabel", "channel to query")
* @xmlrpc.param #param("string", "startDate")
* @xmlrpc.param #param("string", "endDate")
* @xmlrpc.returntype
* #array()
* $PackageDtoSerializer
* #array_end()
*/ | Lists all packages in the channel, regardless of version, between the given dates | listAllPackages | {
"repo_name": "PaulWay/spacewalk",
"path": "java/code/src/com/redhat/rhn/frontend/xmlrpc/channel/software/ChannelSoftwareHandler.java",
"license": "gpl-2.0",
"size": 127025
} | [
"com.redhat.rhn.domain.channel.Channel",
"com.redhat.rhn.domain.user.User",
"com.redhat.rhn.frontend.dto.PackageDto",
"com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException",
"com.redhat.rhn.manager.channel.ChannelManager",
"java.util.List"
] | import com.redhat.rhn.domain.channel.Channel; import com.redhat.rhn.domain.user.User; import com.redhat.rhn.frontend.dto.PackageDto; import com.redhat.rhn.frontend.xmlrpc.NoSuchChannelException; import com.redhat.rhn.manager.channel.ChannelManager; import java.util.List; | import com.redhat.rhn.domain.channel.*; import com.redhat.rhn.domain.user.*; import com.redhat.rhn.frontend.dto.*; import com.redhat.rhn.frontend.xmlrpc.*; import com.redhat.rhn.manager.channel.*; import java.util.*; | [
"com.redhat.rhn",
"java.util"
] | com.redhat.rhn; java.util; | 2,650,331 |
public final static String readUTF(final DataInput in) throws IOException
{
return "";
} | final static String function(final DataInput in) throws IOException { return ""; } | /**
* dont call this it is not implemented
* @return empty new string
**/ | dont call this it is not implemented | readUTF | {
"repo_name": "elect86/joglDX10",
"path": "joglDX10/src/texture/spi/LEDataInputStream.java",
"license": "mit",
"size": 7372
} | [
"java.io.DataInput",
"java.io.IOException"
] | import java.io.DataInput; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,705,708 |
@CheckReturnValue
public static <T> PredicateAssert<T> assertThat(Predicate<T> actual) {
return AssertionsForInterfaceTypes.assertThat(actual);
} | static <T> PredicateAssert<T> function(Predicate<T> actual) { return AssertionsForInterfaceTypes.assertThat(actual); } | /**
* Create assertion for {@link Predicate}.
*
* @param actual the actual value.
* @param <T> the type of the value contained in the {@link Predicate}.
* @return the created assertion object.
*
* @since 3.5.0
*/ | Create assertion for <code>Predicate</code> | assertThat | {
"repo_name": "ChrisA89/assertj-core",
"path": "src/main/java/org/assertj/core/api/Assertions.java",
"license": "apache-2.0",
"size": 107527
} | [
"java.util.function.Predicate"
] | import java.util.function.Predicate; | import java.util.function.*; | [
"java.util"
] | java.util; | 792,662 |
@Nonnull
public WorkbookFunctionsNotRequest buildRequest(@Nonnull final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) {
final WorkbookFunctionsNotRequest request = new WorkbookFunctionsNotRequest(
getRequestUrl(),
getClient(),
requestOptions);
request.body = this.body;
return request;
} | WorkbookFunctionsNotRequest function(@Nonnull final java.util.List<? extends com.microsoft.graph.options.Option> requestOptions) { final WorkbookFunctionsNotRequest request = new WorkbookFunctionsNotRequest( getRequestUrl(), getClient(), requestOptions); request.body = this.body; return request; } | /**
* Creates the WorkbookFunctionsNotRequest with specific requestOptions instead of the existing requestOptions
*
* @param requestOptions the options for the request
* @return the WorkbookFunctionsNotRequest instance
*/ | Creates the WorkbookFunctionsNotRequest with specific requestOptions instead of the existing requestOptions | buildRequest | {
"repo_name": "microsoftgraph/msgraph-sdk-java",
"path": "src/main/java/com/microsoft/graph/requests/WorkbookFunctionsNotRequestBuilder.java",
"license": "mit",
"size": 3374
} | [
"com.microsoft.graph.requests.WorkbookFunctionsNotRequest",
"javax.annotation.Nonnull"
] | import com.microsoft.graph.requests.WorkbookFunctionsNotRequest; import javax.annotation.Nonnull; | import com.microsoft.graph.requests.*; import javax.annotation.*; | [
"com.microsoft.graph",
"javax.annotation"
] | com.microsoft.graph; javax.annotation; | 1,369,235 |
private String getPropertyName(Field field) {
final JcrProperty annotation = field.getAnnotation(JcrProperty.class);
if ((annotation != null) && StringUtils.isNotBlank(annotation.value())) {
return annotation.value();
}
return field.getName();
} | String function(Field field) { final JcrProperty annotation = field.getAnnotation(JcrProperty.class); if ((annotation != null) && StringUtils.isNotBlank(annotation.value())) { return annotation.value(); } return field.getName(); } | /**
* Gets name of property associated with given field. Usually - same as field name, but can be overridden
* using {@link JcrProperty} annotation.
*
* @param field field to get associated property name for
* @return property name associated with given field, never null.
*/ | Gets name of property associated with given field. Usually - same as field name, but can be overridden using <code>JcrProperty</code> annotation | getPropertyName | {
"repo_name": "Sivaramvt/Slice",
"path": "slice-mapper/src/main/java/com/cognifide/slice/mapper/GenericSlingMapper.java",
"license": "apache-2.0",
"size": 9015
} | [
"com.cognifide.slice.mapper.annotation.JcrProperty",
"java.lang.reflect.Field",
"org.apache.commons.lang.StringUtils"
] | import com.cognifide.slice.mapper.annotation.JcrProperty; import java.lang.reflect.Field; import org.apache.commons.lang.StringUtils; | import com.cognifide.slice.mapper.annotation.*; import java.lang.reflect.*; import org.apache.commons.lang.*; | [
"com.cognifide.slice",
"java.lang",
"org.apache.commons"
] | com.cognifide.slice; java.lang; org.apache.commons; | 2,819,092 |
private void moveRight(final long nanoFrameTime) {
double rightPos = image.getStartX() + MAX_SPEED * nanoFrameTime / Time.SECOND_NANO *
getMoveSpeedMultiplier();
double rightBorder = getClosestRightBorder();
if (rightBorder - 100 > rightPos) {
image.setX(rightPos);
} else {
image.setX(rightBorder - 100);
}
image.setScaleX(-1);
notifyObservers(EventType.WALK);
} | void function(final long nanoFrameTime) { double rightPos = image.getStartX() + MAX_SPEED * nanoFrameTime / Time.SECOND_NANO * getMoveSpeedMultiplier(); double rightBorder = getClosestRightBorder(); if (rightBorder - 100 > rightPos) { image.setX(rightPos); } else { image.setX(rightBorder - 100); } image.setScaleX(-1); notifyObservers(EventType.WALK); } | /**
* Move right.
*
* @param nanoFrameTime the framerate (nanoseconds/frame)
*/ | Move right | moveRight | {
"repo_name": "JoshCode/SEM",
"path": "src/main/java/nl/joshuaslik/tudelft/SEM/control/gameObjects/Player.java",
"license": "apache-2.0",
"size": 10704
} | [
"nl.joshuaslik.tudelft.SEM"
] | import nl.joshuaslik.tudelft.SEM; | import nl.joshuaslik.tudelft.*; | [
"nl.joshuaslik.tudelft"
] | nl.joshuaslik.tudelft; | 1,643,533 |
public ImmutableList<ImmutableSet<E>> allEquivalenceClasses(); | ImmutableList<ImmutableSet<E>> function(); | /**
* Returns an immutable collection containing all equivalence classes. The returned collection
* represents a snapshot of the current state and will not reflect changes made to the data
* structure.
*/ | Returns an immutable collection containing all equivalence classes. The returned collection represents a snapshot of the current state and will not reflect changes made to the data structure | allEquivalenceClasses | {
"repo_name": "GoogleChromeLabs/chromeos_smart_card_connector",
"path": "third_party/closure-compiler/src/src/com/google/javascript/jscomp/graph/UnionFind.java",
"license": "apache-2.0",
"size": 3047
} | [
"com.google.common.collect.ImmutableList",
"com.google.common.collect.ImmutableSet"
] | import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 813,630 |
public static TimeUnit toTimeUnit(final ChronoUnit tu) {
if (tu == null) {
return null;
}
switch (tu) {
case DAYS:
return TimeUnit.DAYS;
case HOURS:
return TimeUnit.HOURS;
case MINUTES:
return TimeUnit.MINUTES;
case SECONDS:
return TimeUnit.SECONDS;
case MICROS:
return TimeUnit.MICROSECONDS;
case MILLIS:
return TimeUnit.MILLISECONDS;
case NANOS:
return TimeUnit.NANOSECONDS;
default:
throw new UnsupportedOperationException("Temporal unit is not supported");
}
} | static TimeUnit function(final ChronoUnit tu) { if (tu == null) { return null; } switch (tu) { case DAYS: return TimeUnit.DAYS; case HOURS: return TimeUnit.HOURS; case MINUTES: return TimeUnit.MINUTES; case SECONDS: return TimeUnit.SECONDS; case MICROS: return TimeUnit.MICROSECONDS; case MILLIS: return TimeUnit.MILLISECONDS; case NANOS: return TimeUnit.NANOSECONDS; default: throw new UnsupportedOperationException(STR); } } | /**
* To time unit time unit.
*
* @param tu the tu
* @return the time unit
*/ | To time unit time unit | toTimeUnit | {
"repo_name": "robertoschwald/cas",
"path": "core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java",
"license": "apache-2.0",
"size": 9289
} | [
"java.time.temporal.ChronoUnit",
"java.util.concurrent.TimeUnit"
] | import java.time.temporal.ChronoUnit; import java.util.concurrent.TimeUnit; | import java.time.temporal.*; import java.util.concurrent.*; | [
"java.time",
"java.util"
] | java.time; java.util; | 1,959,692 |
public BigDecimal getProcessedOn();
public static final String COLUMNNAME_Processing = "Processing"; | BigDecimal function(); public static final String COLUMNNAME_Processing = STR; | /** Get Processed On.
* The date+time (expressed in decimal format) when the document has been processed
*/ | Get Processed On. The date+time (expressed in decimal format) when the document has been processed | getProcessedOn | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/model/I_C_ProjectIssue.java",
"license": "gpl-2.0",
"size": 8842
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 2,293,030 |
private static boolean markCommitRoot(@Nonnull NodeDocument document,
@Nonnull Revision revision,
@Nonnull DocumentStore store) {
String p = document.getPath();
String commitRootPath = null;
// first check if we can mark the commit with the given revision
if (document.containsRevision(revision)) {
if (document.isCommitted(revision)) {
// already committed
return false;
}
// node is also commit root, but not yet committed
// i.e. a branch commit, which is not yet merged
commitRootPath = p;
} else {
// next look at commit root
commitRootPath = document.getCommitRootPath(revision);
if (commitRootPath == null) {
throwNoCommitRootException(revision, document);
}
}
// at this point we have a commitRootPath
UpdateOp op = new UpdateOp(Utils.getIdFromPath(commitRootPath), false);
NodeDocument commitRoot = store.find(Collection.NODES, op.getId());
// check commit status of revision
if (commitRoot.isCommitted(revision)) {
return false;
}
// check if there is already a collision marker
if (commitRoot.getLocalMap(NodeDocument.COLLISIONS).containsKey(revision)) {
// already marked
return true;
}
NodeDocument.addCollision(op, revision);
commitRoot = store.createOrUpdate(Collection.NODES, op);
// check again on old document right before our update was applied
if (commitRoot.isCommitted(revision)) {
return false;
}
// otherwise collision marker was set successfully
LOG.debug("Marked collision on: {} for {} ({})",
new Object[]{commitRootPath, p, revision});
return true;
} | static boolean function(@Nonnull NodeDocument document, @Nonnull Revision revision, @Nonnull DocumentStore store) { String p = document.getPath(); String commitRootPath = null; if (document.containsRevision(revision)) { if (document.isCommitted(revision)) { return false; } commitRootPath = p; } else { commitRootPath = document.getCommitRootPath(revision); if (commitRootPath == null) { throwNoCommitRootException(revision, document); } } UpdateOp op = new UpdateOp(Utils.getIdFromPath(commitRootPath), false); NodeDocument commitRoot = store.find(Collection.NODES, op.getId()); if (commitRoot.isCommitted(revision)) { return false; } if (commitRoot.getLocalMap(NodeDocument.COLLISIONS).containsKey(revision)) { return true; } NodeDocument.addCollision(op, revision); commitRoot = store.createOrUpdate(Collection.NODES, op); if (commitRoot.isCommitted(revision)) { return false; } LOG.debug(STR, new Object[]{commitRootPath, p, revision}); return true; } | /**
* Marks the commit root of the change to the given <code>document</code> in
* <code>revision</code>.
*
* @param document the document.
* @param revision the revision of the commit to annotated with a collision
* marker.
* @param store the document store.
* @return <code>true</code> if the commit for the given revision was marked
* successfully; <code>false</code> otherwise.
*/ | Marks the commit root of the change to the given <code>document</code> in <code>revision</code> | markCommitRoot | {
"repo_name": "denismo/jackrabbit-dynamodb-store",
"path": "oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/document/Collision.java",
"license": "apache-2.0",
"size": 6479
} | [
"javax.annotation.Nonnull",
"org.apache.jackrabbit.oak.plugins.document.util.Utils"
] | import javax.annotation.Nonnull; import org.apache.jackrabbit.oak.plugins.document.util.Utils; | import javax.annotation.*; import org.apache.jackrabbit.oak.plugins.document.util.*; | [
"javax.annotation",
"org.apache.jackrabbit"
] | javax.annotation; org.apache.jackrabbit; | 2,653,571 |
private void neuronIdMapFromXml( Node xml ) {
NodeList children = xml.getChildNodes();
for ( int i = 0; i < children.getLength(); ++i ) {
Node child = children.item( i );
if ( CONNECTION_TO_NEURON_XML_TAG.equals( child.getNodeName() ) ) {
NamedNodeMap attrs = child.getAttributes();
if ( attrs == null )
throw new IllegalArgumentException( "missing attributes" );
Node neuronIdAttr = attrs.getNamedItem( ID_XML_TAG );
if ( neuronIdAttr == null )
throw new IllegalArgumentException( "missing neuron id" );
Node connIdAttr = attrs.getNamedItem( CONNECTION_ID_XML_TAG );
if ( connIdAttr == null )
throw new IllegalArgumentException( "missing connection id" );
putNeuronId( Long.valueOf( connIdAttr.getNodeValue() ), Long.valueOf( neuronIdAttr
.getNodeValue() ) );
}
}
} | void function( Node xml ) { NodeList children = xml.getChildNodes(); for ( int i = 0; i < children.getLength(); ++i ) { Node child = children.item( i ); if ( CONNECTION_TO_NEURON_XML_TAG.equals( child.getNodeName() ) ) { NamedNodeMap attrs = child.getAttributes(); if ( attrs == null ) throw new IllegalArgumentException( STR ); Node neuronIdAttr = attrs.getNamedItem( ID_XML_TAG ); if ( neuronIdAttr == null ) throw new IllegalArgumentException( STR ); Node connIdAttr = attrs.getNamedItem( CONNECTION_ID_XML_TAG ); if ( connIdAttr == null ) throw new IllegalArgumentException( STR ); putNeuronId( Long.valueOf( connIdAttr.getNodeValue() ), Long.valueOf( neuronIdAttr .getNodeValue() ) ); } } } | /**
* Load neuron innovation ID mapping from <code>xml</code> node.
*
* @param xml
*/ | Load neuron innovation ID mapping from <code>xml</code> node | neuronIdMapFromXml | {
"repo_name": "jmenashe/cppn-image-evolver",
"path": "cppn-image-evolver/src/com/anji/neat/NeatIdMap.java",
"license": "gpl-3.0",
"size": 11260
} | [
"org.w3c.dom.NamedNodeMap",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
] | import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 1,072,208 |
public final List<MathDefVariableDec> getDefinitionVarList() {
List<MathDefVariableDec> newMathDefVarDecs = new ArrayList<>(myDefVarList.size());
for (MathDefVariableDec variableDec : myDefVarList) {
newMathDefVarDecs.add((MathDefVariableDec) variableDec.clone());
}
return myDefVarList;
} | final List<MathDefVariableDec> function() { List<MathDefVariableDec> newMathDefVarDecs = new ArrayList<>(myDefVarList.size()); for (MathDefVariableDec variableDec : myDefVarList) { newMathDefVarDecs.add((MathDefVariableDec) variableDec.clone()); } return myDefVarList; } | /**
* <p>
* Since this is used by multiple objects, we really don't want to be returning a reference, therefore this method
* returns a deep copy of all the definition variables.
* </p>
*
* @return A list of {@link MathDefVariableDec} representation objects.
*/ | Since this is used by multiple objects, we really don't want to be returning a reference, therefore this method returns a deep copy of all the definition variables. | getDefinitionVarList | {
"repo_name": "yushan87/RESOLVE",
"path": "src/java/edu/clemson/rsrg/typeandpopulate/entry/TypeFamilyEntry.java",
"license": "bsd-3-clause",
"size": 5464
} | [
"edu.clemson.rsrg.absyn.declarations.mathdecl.MathDefVariableDec",
"java.util.ArrayList",
"java.util.List"
] | import edu.clemson.rsrg.absyn.declarations.mathdecl.MathDefVariableDec; import java.util.ArrayList; import java.util.List; | import edu.clemson.rsrg.absyn.declarations.mathdecl.*; import java.util.*; | [
"edu.clemson.rsrg",
"java.util"
] | edu.clemson.rsrg; java.util; | 1,707,576 |
@Nonnull
public Task getTask(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig)
{
return project.getTasks().getByName(pTaskName.getName(pDepConfig));
} | Task function(@Nonnull final TaskNames pTaskName, @Nonnull final DependencyConfig pDepConfig) { return project.getTasks().getByName(pTaskName.getName(pDepConfig)); } | /**
* Convenience method for getting a specific task directly.
*
* @param pTaskName the task to get
* @param pDepConfig the dependency configuration for which the task is intended
* @return a task object
*/ | Convenience method for getting a specific task directly | getTask | {
"repo_name": "checkstyle-addons/checkstyle-addons",
"path": "buildSrc/src/main/java/com/thomasjensen/checkstyle/addons/build/BuildUtil.java",
"license": "gpl-3.0",
"size": 6715
} | [
"javax.annotation.Nonnull",
"org.gradle.api.Task"
] | import javax.annotation.Nonnull; import org.gradle.api.Task; | import javax.annotation.*; import org.gradle.api.*; | [
"javax.annotation",
"org.gradle.api"
] | javax.annotation; org.gradle.api; | 1,308,804 |
Collection<MPDSavedPlaylist> listSavedPlaylists(); | Collection<MPDSavedPlaylist> listSavedPlaylists(); | /**
* Returns a {@link java.util.Collection} of {@link org.bff.javampd.playlist.MPDSavedPlaylist}s of
* all saved playlists. This is an expensive call so use it cautiously.
*
* @return a {@link java.util.Collection} of all {@link
* org.bff.javampd.playlist.MPDSavedPlaylist}s
*/ | Returns a <code>java.util.Collection</code> of <code>org.bff.javampd.playlist.MPDSavedPlaylist</code>s of all saved playlists. This is an expensive call so use it cautiously | listSavedPlaylists | {
"repo_name": "finnyb/javampd",
"path": "src/main/java/org/bff/javampd/playlist/PlaylistDatabase.java",
"license": "gpl-2.0",
"size": 859
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,928,798 |
public void removeSearchPerson(String person){
// search all occurrences of the tag and remove them
Matcher m = pat_searchSpecial.matcher(searchQuery);
StringBuffer buf = new StringBuffer();
while(m.find()) {
String kind = m.group(1);
String query = m.group(2);
if(query.startsWith("\")")) {
query = m.group(3);
}
if("person".equals(kind) && person.equals(query)) {
m.appendReplacement(buf, "");
} else {
m.appendReplacement(buf, m.group());
}
}
m.appendTail(buf);
searchQuery = buf.toString();
runFromInside();
}
| void function(String person){ Matcher m = pat_searchSpecial.matcher(searchQuery); StringBuffer buf = new StringBuffer(); while(m.find()) { String kind = m.group(1); String query = m.group(2); if(query.startsWith("\")STRpersonSTR"); } else { m.appendReplacement(buf, m.group()); } } m.appendTail(buf); searchQuery = buf.toString(); runFromInside(); } | /**
* Remove the person with the given label from the search
* @param tag
*/ | Remove the person with the given label from the search | removeSearchPerson | {
"repo_name": "fregaham/KiWi",
"path": "src/action/kiwi/action/search/KiWiSearchEngine.java",
"license": "bsd-3-clause",
"size": 22071
} | [
"java.util.regex.Matcher"
] | import java.util.regex.Matcher; | import java.util.regex.*; | [
"java.util"
] | java.util; | 1,816,033 |
@Override
public boolean getBoolean(int parameterIndex) throws SQLException {
checkRegistered(parameterIndex);
return getOpenResultSet().getBoolean(parameterIndex);
} | boolean function(int parameterIndex) throws SQLException { checkRegistered(parameterIndex); return getOpenResultSet().getBoolean(parameterIndex); } | /**
* Returns the value of the specified column as a boolean.
*
* @param parameterIndex (1,2,...)
* @return the value
* @throws SQLException if the column is not found or if this object is
* closed
*/ | Returns the value of the specified column as a boolean | getBoolean | {
"repo_name": "miloszpiglas/h2mod",
"path": "src/main/org/h2/jdbc/JdbcCallableStatement.java",
"license": "mpl-2.0",
"size": 53201
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,450,844 |
public String getAnswerFormat() {
try {
JSONObject model = mCurrentCard.model();
JSONObject template;
if (model.getInt("type") == Consts.MODEL_STD) {
template = model.getJSONArray("tmpls").getJSONObject(mCurrentCard.getOrd());
} else {
template = model.getJSONArray("tmpls").getJSONObject(0);
}
return template.getString("afmt");
} catch (JSONException e) {
throw new RuntimeException(e);
}
} | String function() { try { JSONObject model = mCurrentCard.model(); JSONObject template; if (model.getInt("type") == Consts.MODEL_STD) { template = model.getJSONArray("tmpls").getJSONObject(mCurrentCard.getOrd()); } else { template = model.getJSONArray("tmpls").getJSONObject(0); } return template.getString("afmt"); } catch (JSONException e) { throw new RuntimeException(e); } } | /**
* getAnswerFormat returns the answer part of this card's template as entered by user, without any parsing
*/ | getAnswerFormat returns the answer part of this card's template as entered by user, without any parsing | getAnswerFormat | {
"repo_name": "Litemn/Anki-Android",
"path": "AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.java",
"license": "gpl-3.0",
"size": 103622
} | [
"com.ichi2.libanki.Consts",
"org.json.JSONException",
"org.json.JSONObject"
] | import com.ichi2.libanki.Consts; import org.json.JSONException; import org.json.JSONObject; | import com.ichi2.libanki.*; import org.json.*; | [
"com.ichi2.libanki",
"org.json"
] | com.ichi2.libanki; org.json; | 374,804 |
public void appendThrow() {
append(InstructionConstants.ATHROW);
m_stackState = null;
} | void function() { append(InstructionConstants.ATHROW); m_stackState = null; } | /**
* Append exception throw.
*/ | Append exception throw | appendThrow | {
"repo_name": "vkorbut/jibx",
"path": "jibx/build/src/org/jibx/binding/classes/MethodBuilder.java",
"license": "bsd-3-clause",
"size": 60081
} | [
"org.apache.bcel.generic.InstructionConstants"
] | import org.apache.bcel.generic.InstructionConstants; | import org.apache.bcel.generic.*; | [
"org.apache.bcel"
] | org.apache.bcel; | 2,503,161 |
public Notation createNotation(String name)
throws DOMException {
if (errorChecking && !isXMLName(name,xml11Version)) {
String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
}
return new NotationImpl(this, name);
} // createNotation(String):Notation | Notation function(String name) throws DOMException { if (errorChecking && !isXMLName(name,xml11Version)) { String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, STR, null); throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg); } return new NotationImpl(this, name); } | /**
* NON-DOM
* Factory method; creates a Notation having this Document
* as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
* DTD information unspecified.)
*
* @param name The name of the Notation we wish to describe
*
* @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
* notations are not permitted. (HTML not yet
* implemented.)
*/ | NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.) | createNotation | {
"repo_name": "jimma/xerces",
"path": "src/org/apache/xerces/dom/CoreDocumentImpl.java",
"license": "apache-2.0",
"size": 99456
} | [
"org.w3c.dom.DOMException",
"org.w3c.dom.Notation"
] | import org.w3c.dom.DOMException; import org.w3c.dom.Notation; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 522,132 |
public Observable<ServiceResponse<Page<ProximityPlacementGroupInner>>> listSinglePageAsync() {
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<Page<ProximityPlacementGroupInner>>> function() { if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* Lists all proximity placement groups in a subscription.
*
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<ProximityPlacementGroupInner> object wrapped in {@link ServiceResponse} if successful.
*/ | Lists all proximity placement groups in a subscription | listSinglePageAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/compute/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/compute/v2020_06_01/implementation/ProximityPlacementGroupsInner.java",
"license": "mit",
"size": 63949
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
] | import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 1,642,474 |
// ----- private methods -----
private Folder getCurrentWorkingDir() {
final Principal _owner = getProperty(owner);
Folder workingOrHomeDir = null;
if (_owner != null && _owner instanceof User) {
workingOrHomeDir = _owner.getProperty(User.workingDirectory);
if (workingOrHomeDir == null) {
workingOrHomeDir = _owner.getProperty(User.homeDirectory);
}
}
return workingOrHomeDir;
} | Folder function() { final Principal _owner = getProperty(owner); Folder workingOrHomeDir = null; if (_owner != null && _owner instanceof User) { workingOrHomeDir = _owner.getProperty(User.workingDirectory); if (workingOrHomeDir == null) { workingOrHomeDir = _owner.getProperty(User.homeDirectory); } } return workingOrHomeDir; } | /**
* Returns the Folder entity for the current working directory,
* or the user's home directory as a fallback.
* @return
*/ | Returns the Folder entity for the current working directory, or the user's home directory as a fallback | getCurrentWorkingDir | {
"repo_name": "joansmith/structr",
"path": "structr-ui/src/main/java/org/structr/web/entity/FileBase.java",
"license": "gpl-3.0",
"size": 14087
} | [
"org.structr.core.entity.Principal"
] | import org.structr.core.entity.Principal; | import org.structr.core.entity.*; | [
"org.structr.core"
] | org.structr.core; | 1,502,507 |
public void setOnItemClickListener(OnItemClickListener listener) {
mRefreshableView.setOnItemClickListener(listener);
} | void function(OnItemClickListener listener) { mRefreshableView.setOnItemClickListener(listener); } | /**
* Pass-through method for {@link PullToRefreshBase#getRefreshableView()
* getRefreshableView()}.
* {@link AdapterView#setOnItemClickListener(OnItemClickListener)
* setOnItemClickListener(listener)}. This is just for convenience!
*
* @param listener - OnItemClickListener to use
*/ | Pass-through method for <code>PullToRefreshBase#getRefreshableView() getRefreshableView()</code>. <code>AdapterView#setOnItemClickListener(OnItemClickListener) setOnItemClickListener(listener)</code>. This is just for convenience | setOnItemClickListener | {
"repo_name": "ChengCheng-Hello/PullToRefreshListView",
"path": "pulltorefresh/src/main/java/com/handmark/pulltorefresh/library/PullToRefreshAdapterViewBase.java",
"license": "apache-2.0",
"size": 14785
} | [
"android.widget.AdapterView"
] | import android.widget.AdapterView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,144,276 |
public static String getText(URL url) throws IOException {
return getText(url, CharsetToolkit.getDefaultSystemCharset().toString());
} | static String function(URL url) throws IOException { return getText(url, CharsetToolkit.getDefaultSystemCharset().toString()); } | /**
* Read the content of this URL and returns it as a String.
*
* @param url URL to read content from
* @return the text from that URL
* @throws IOException if an IOException occurs.
* @since 1.0
*/ | Read the content of this URL and returns it as a String | getText | {
"repo_name": "xien777/yajsw",
"path": "yajsw/wrapper/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java",
"license": "lgpl-2.1",
"size": 704150
} | [
"groovy.util.CharsetToolkit",
"java.io.IOException"
] | import groovy.util.CharsetToolkit; import java.io.IOException; | import groovy.util.*; import java.io.*; | [
"groovy.util",
"java.io"
] | groovy.util; java.io; | 2,416,094 |
public static Mac getHmacSha256(final byte[] key) {
return getInitializedMac(HmacAlgorithms.HMAC_SHA_256, key);
}
| static Mac function(final byte[] key) { return getInitializedMac(HmacAlgorithms.HMAC_SHA_256, key); } | /**
* Returns an initialized <code>Mac</code> for the HmacSHA256 algorithm.
* <p>
* Every implementation of the Java platform is required to support this standard Mac algorithm.
* </p>
*
* @param key
* They key for the keyed digest (must not be null)
* @return A Mac instance initialized with the given key.
* @see Mac#getInstance(String)
* @see Mac#init(Key)
* @throws IllegalArgumentException
* when a {@link NoSuchAlgorithmException} is caught or key is null or key is invalid.
*/ | Returns an initialized <code>Mac</code> for the HmacSHA256 algorithm. Every implementation of the Java platform is required to support this standard Mac algorithm. | getHmacSha256 | {
"repo_name": "456838/usefulCode",
"path": "YHamburgGit/app/src/main/java/org/apache/commons/codec/digest/HmacUtils.java",
"license": "apache-2.0",
"size": 34340
} | [
"javax.crypto.Mac"
] | import javax.crypto.Mac; | import javax.crypto.*; | [
"javax.crypto"
] | javax.crypto; | 2,030,870 |
@Transactional(readOnly = true)
@Override
public List<TableInfo> getTableInfoByDocumentType(DocumentType documentType) {
List<TableInfo> tableInfos = null;
if (null == documentType) {
LOGGER.info("Document type object is null.");
} else {
tableInfos = tableInfoDao.getTableInfoByDocumentType(documentType);
}
return tableInfos;
} | @Transactional(readOnly = true) List<TableInfo> function(DocumentType documentType) { List<TableInfo> tableInfos = null; if (null == documentType) { LOGGER.info(STR); } else { tableInfos = tableInfoDao.getTableInfoByDocumentType(documentType); } return tableInfos; } | /**
* An api to fetch all TableInfo by document type.
*
* @param documentType DocumentType
* @return List<TableInfo>
*/ | An api to fetch all TableInfo by document type | getTableInfoByDocumentType | {
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/dcma-data-access/src/main/java/com/ephesoft/dcma/da/service/TableInfoServiceImpl.java",
"license": "agpl-3.0",
"size": 4944
} | [
"com.ephesoft.dcma.da.domain.DocumentType",
"com.ephesoft.dcma.da.domain.TableInfo",
"java.util.List",
"org.springframework.transaction.annotation.Transactional"
] | import com.ephesoft.dcma.da.domain.DocumentType; import com.ephesoft.dcma.da.domain.TableInfo; import java.util.List; import org.springframework.transaction.annotation.Transactional; | import com.ephesoft.dcma.da.domain.*; import java.util.*; import org.springframework.transaction.annotation.*; | [
"com.ephesoft.dcma",
"java.util",
"org.springframework.transaction"
] | com.ephesoft.dcma; java.util; org.springframework.transaction; | 428,382 |
void showDataDisconnectedRoaming() {
if (DBG) log("showDataDisconnectedRoaming()...");
// "Mobile network settings" screen / dialog
Intent intent = new Intent(mContext, com.android.phone.MobileNetworkSettings.class);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0);
final CharSequence contentText = mContext.getText(R.string.roaming_reenable_message);
final Notification.Builder builder = new Notification.Builder(mContext)
.setSmallIcon(android.R.drawable.stat_sys_warning)
.setContentTitle(mContext.getText(R.string.roaming))
.setColor(mContext.getResources().getColor(R.color.dialer_theme_color))
.setContentText(contentText);
List<UserInfo> users = mUserManager.getUsers(true);
for (int i = 0; i < users.size(); i++) {
final UserInfo user = users.get(i);
if (user.isManagedProfile()) {
continue;
}
UserHandle userHandle = user.getUserHandle();
builder.setContentIntent(userHandle.isOwner() ? contentIntent : null);
final Notification notif =
new Notification.BigTextStyle(builder).bigText(contentText).build();
mNotificationManager.notifyAsUser(
null , DATA_DISCONNECTED_ROAMING_NOTIFICATION, notif, userHandle);
}
} | void showDataDisconnectedRoaming() { if (DBG) log(STR); Intent intent = new Intent(mContext, com.android.phone.MobileNetworkSettings.class); PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent, 0); final CharSequence contentText = mContext.getText(R.string.roaming_reenable_message); final Notification.Builder builder = new Notification.Builder(mContext) .setSmallIcon(android.R.drawable.stat_sys_warning) .setContentTitle(mContext.getText(R.string.roaming)) .setColor(mContext.getResources().getColor(R.color.dialer_theme_color)) .setContentText(contentText); List<UserInfo> users = mUserManager.getUsers(true); for (int i = 0; i < users.size(); i++) { final UserInfo user = users.get(i); if (user.isManagedProfile()) { continue; } UserHandle userHandle = user.getUserHandle(); builder.setContentIntent(userHandle.isOwner() ? contentIntent : null); final Notification notif = new Notification.BigTextStyle(builder).bigText(contentText).build(); mNotificationManager.notifyAsUser( null , DATA_DISCONNECTED_ROAMING_NOTIFICATION, notif, userHandle); } } | /**
* Shows the "data disconnected due to roaming" notification, which
* appears when you lose data connectivity because you're roaming and
* you have the "data roaming" feature turned off.
*/ | Shows the "data disconnected due to roaming" notification, which appears when you lose data connectivity because you're roaming and you have the "data roaming" feature turned off | showDataDisconnectedRoaming | {
"repo_name": "md5555/android_packages_services_Telephony",
"path": "src/com/android/phone/NotificationMgr.java",
"license": "apache-2.0",
"size": 27247
} | [
"android.app.Notification",
"android.app.PendingIntent",
"android.content.Intent",
"android.content.pm.UserInfo",
"android.os.UserHandle",
"java.util.List"
] | import android.app.Notification; import android.app.PendingIntent; import android.content.Intent; import android.content.pm.UserInfo; import android.os.UserHandle; import java.util.List; | import android.app.*; import android.content.*; import android.content.pm.*; import android.os.*; import java.util.*; | [
"android.app",
"android.content",
"android.os",
"java.util"
] | android.app; android.content; android.os; java.util; | 2,560,502 |
@SuppressWarnings("unchecked")
public T syslogHandler(SyslogHandler value) {
this.subresources.syslogHandlers.add(value);
return (T) this;
} | @SuppressWarnings(STR) T function(SyslogHandler value) { this.subresources.syslogHandlers.add(value); return (T) this; } | /**
* Add the SyslogHandler object to the list of subresources
* @param value The SyslogHandler to add
* @return this
*/ | Add the SyslogHandler object to the list of subresources | syslogHandler | {
"repo_name": "wildfly-swarm/wildfly-config-api",
"path": "generator/src/test/java/org/wildfly/apigen/test/invocation/logging/Logging.java",
"license": "apache-2.0",
"size": 17694
} | [
"org.wildfly.apigen.test.invocation.logging.subsystem.syslogHandler.SyslogHandler"
] | import org.wildfly.apigen.test.invocation.logging.subsystem.syslogHandler.SyslogHandler; | import org.wildfly.apigen.test.invocation.logging.subsystem.*; | [
"org.wildfly.apigen"
] | org.wildfly.apigen; | 1,316,510 |
public void finalizeCopiedFiles() throws IOException {
if (jobToRun != null) {
finalizeCopiedFilesInternal(jobToRun);
}
} | void function() throws IOException { if (jobToRun != null) { finalizeCopiedFilesInternal(jobToRun); } } | /**
* Finalize copied files after the MapReduce job. So far all it
* does is to set metadata information of the copied files to be
* the same as source files.
* @throws IOException
*/ | Finalize copied files after the MapReduce job. So far all it does is to set metadata information of the copied files to be the same as source files | finalizeCopiedFiles | {
"repo_name": "iVCE/RDFS",
"path": "src/tools/org/apache/hadoop/tools/DistCp.java",
"license": "apache-2.0",
"size": 107503
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 496,914 |
Matrix createMatrix(Matrix matrix); | Matrix createMatrix(Matrix matrix); | /**
* Creates a matrix from another matrix.
*
* @param matrix
* @return
*/ | Creates a matrix from another matrix | createMatrix | {
"repo_name": "hisohito/la4j",
"path": "src/main/java/org/la4j/factory/Factory.java",
"license": "apache-2.0",
"size": 5006
} | [
"org.la4j.matrix.Matrix"
] | import org.la4j.matrix.Matrix; | import org.la4j.matrix.*; | [
"org.la4j.matrix"
] | org.la4j.matrix; | 1,456,953 |
@Override
public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
if (itemPropertyDescriptors == null) {
super.getPropertyDescriptors(object);
addNonTerminalPropertyDescriptor(object);
}
return itemPropertyDescriptors;
}
| List<IItemPropertyDescriptor> function(Object object) { if (itemPropertyDescriptors == null) { super.getPropertyDescriptors(object); addNonTerminalPropertyDescriptor(object); } return itemPropertyDescriptors; } | /**
* This returns the property descriptors for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the property descriptors for the adapted class. | getPropertyDescriptors | {
"repo_name": "balazsgrill/temon",
"path": "hu.temon.edit/src/hu/temon/grammar/provider/RuleItemProvider.java",
"license": "epl-1.0",
"size": 6710
} | [
"java.util.List",
"org.eclipse.emf.edit.provider.IItemPropertyDescriptor"
] | import java.util.List; import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; | import java.util.*; import org.eclipse.emf.edit.provider.*; | [
"java.util",
"org.eclipse.emf"
] | java.util; org.eclipse.emf; | 1,656,408 |
int getMonthLength(int prolepticYear, int monthOfYear) {
int epochMonth = yearToEpochMonth(prolepticYear) + (monthOfYear - 1);
if (epochMonth < 0 || epochMonth >= hijrahEpochMonthStartDays.length) {
throw new DateTimeException("Invalid Hijrah date, year: " +
prolepticYear + ", month: " + monthOfYear);
}
return epochMonthLength(epochMonth);
} | int getMonthLength(int prolepticYear, int monthOfYear) { int epochMonth = yearToEpochMonth(prolepticYear) + (monthOfYear - 1); if (epochMonth < 0 epochMonth >= hijrahEpochMonthStartDays.length) { throw new DateTimeException(STR + prolepticYear + STR + monthOfYear); } return epochMonthLength(epochMonth); } | /**
* Returns month length for the year and month.
*
* @param prolepticYear a proleptic year
* @param monthOfYear a month, 1-origin.
* @return the length of the month
*/ | Returns month length for the year and month | getMonthLength | {
"repo_name": "google/desugar_jdk_libs",
"path": "jdk11/src/java.base/share/classes/java/time/chrono/HijrahChronology.java",
"license": "gpl-2.0",
"size": 59395
} | [
"java.time.DateTimeException"
] | import java.time.DateTimeException; | import java.time.*; | [
"java.time"
] | java.time; | 1,791,930 |
@SuppressWarnings("unchecked")
protected Object newArray(Object old, int size, Schema schema) {
if (old instanceof Collection) {
((Collection) old).clear();
return old;
} else return new GenericData.Array(size, schema);
} | @SuppressWarnings(STR) Object function(Object old, int size, Schema schema) { if (old instanceof Collection) { ((Collection) old).clear(); return old; } else return new GenericData.Array(size, schema); } | /** Called to create new array instances. Subclasses may override to use a
* different array implementation. By default, this returns a {@link
* GenericData.Array}.*/ | Called to create new array instances. Subclasses may override to use a different array implementation. By default, this returns a {@link | newArray | {
"repo_name": "wojtkiewicz/avro",
"path": "lang/java/avro/src/main/java/org/apache/avro/generic/GenericDatumReader.java",
"license": "apache-2.0",
"size": 21343
} | [
"java.util.Collection",
"org.apache.avro.Schema"
] | import java.util.Collection; import org.apache.avro.Schema; | import java.util.*; import org.apache.avro.*; | [
"java.util",
"org.apache.avro"
] | java.util; org.apache.avro; | 311,867 |
protected final IndexResponse index(String index, String type, String id, XContentBuilder source) {
return client().prepareIndex(index, type, id).setSource(source).execute().actionGet();
} | final IndexResponse function(String index, String type, String id, XContentBuilder source) { return client().prepareIndex(index, type, id).setSource(source).execute().actionGet(); } | /**
* Syntactic sugar for:
* <pre>
* return client().prepareIndex(index, type, id).setSource(source).execute().actionGet();
* </pre>
*/ | Syntactic sugar for: <code> return client().prepareIndex(index, type, id).setSource(source).execute().actionGet(); </code> | index | {
"repo_name": "shreejay/elasticsearch",
"path": "test/framework/src/main/java/org/elasticsearch/test/ESIntegTestCase.java",
"license": "apache-2.0",
"size": 105253
} | [
"org.elasticsearch.action.index.IndexResponse",
"org.elasticsearch.common.xcontent.XContentBuilder"
] | import org.elasticsearch.action.index.IndexResponse; import org.elasticsearch.common.xcontent.XContentBuilder; | import org.elasticsearch.action.index.*; import org.elasticsearch.common.xcontent.*; | [
"org.elasticsearch.action",
"org.elasticsearch.common"
] | org.elasticsearch.action; org.elasticsearch.common; | 396,450 |
private void verifyRequiredSevicesAreRunning() throws ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException {
Path manifestPath = currentJob.getManifest().getFilePath();
sysLogger.log(Level.INFO, "Checking services availability for {0}", manifestPath);
currentJob.setProcessingStage(AutoIngestJob.Stage.CHECKING_SERVICES, Date.from(Instant.now()));
if (!isServiceUp(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString())) {
throw new DatabaseServerDownException("Case database server is down");
}
if (!isServiceUp(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString())) {
throw new KeywordSearchServerDownException("Keyword search server is down");
}
} | void function() throws ServicesMonitorException, DatabaseServerDownException, KeywordSearchServerDownException { Path manifestPath = currentJob.getManifest().getFilePath(); sysLogger.log(Level.INFO, STR, manifestPath); currentJob.setProcessingStage(AutoIngestJob.Stage.CHECKING_SERVICES, Date.from(Instant.now())); if (!isServiceUp(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString())) { throw new DatabaseServerDownException(STR); } if (!isServiceUp(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString())) { throw new KeywordSearchServerDownException(STR); } } | /**
* Checks the availability of the services required to process an
* automated ingest job.
*
* @throws ServicesMonitorException if there is an error querying the
* services monitor.
* @throws DatabaseServerDownException if the database server is down.
* @throws SolrServerDownException if the keyword search server is
* down.
*/ | Checks the availability of the services required to process an automated ingest job | verifyRequiredSevicesAreRunning | {
"repo_name": "APriestman/autopsy",
"path": "Experimental/src/org/sleuthkit/autopsy/experimental/autoingest/AutoIngestManager.java",
"license": "apache-2.0",
"size": 162441
} | [
"java.nio.file.Path",
"java.time.Instant",
"java.util.Date",
"java.util.logging.Level",
"org.sleuthkit.autopsy.core.ServicesMonitor"
] | import java.nio.file.Path; import java.time.Instant; import java.util.Date; import java.util.logging.Level; import org.sleuthkit.autopsy.core.ServicesMonitor; | import java.nio.file.*; import java.time.*; import java.util.*; import java.util.logging.*; import org.sleuthkit.autopsy.core.*; | [
"java.nio",
"java.time",
"java.util",
"org.sleuthkit.autopsy"
] | java.nio; java.time; java.util; org.sleuthkit.autopsy; | 2,639,044 |
public int getMetaFromState(IBlockState state)
{
return ((BlockCustomWorkbench.EnumType)state.getValue(TYPE)).getMetadata();
} | int function(IBlockState state) { return ((BlockCustomWorkbench.EnumType)state.getValue(TYPE)).getMetadata(); } | /**
* Convert the BlockState into the correct metadata value
*/ | Convert the BlockState into the correct metadata value | getMetaFromState | {
"repo_name": "TheValarProject/AwakenDreamsClient",
"path": "mcp/src/minecraft/com/elementfx/tvp/ad/block/BlockCustomWorkbench.java",
"license": "gpl-3.0",
"size": 7420
} | [
"net.minecraft.block.state.IBlockState"
] | import net.minecraft.block.state.IBlockState; | import net.minecraft.block.state.*; | [
"net.minecraft.block"
] | net.minecraft.block; | 2,495,082 |
private void preemptAMContainers(Resource clusterResource,
Map<ApplicationAttemptId, Set<RMContainer>> preemptMap,
List<RMContainer> skippedAMContainerlist, Resource resToObtain,
Resource skippedAMSize, Resource maxAMCapacityForThisQueue) {
for (RMContainer c : skippedAMContainerlist) {
// Got required amount of resources for preemption, can stop now
if (Resources.lessThanOrEqual(rc, clusterResource, resToObtain,
Resources.none())) {
break;
}
// Once skippedAMSize reaches down to maxAMCapacityForThisQueue,
// container selection iteration for preemption will be stopped.
if (Resources.lessThanOrEqual(rc, clusterResource, skippedAMSize,
maxAMCapacityForThisQueue)) {
break;
}
Set<RMContainer> contToPrempt = preemptMap.get(c
.getApplicationAttemptId());
if (null == contToPrempt) {
contToPrempt = new HashSet<RMContainer>();
preemptMap.put(c.getApplicationAttemptId(), contToPrempt);
}
contToPrempt.add(c);
Resources.subtractFrom(resToObtain, c.getContainer().getResource());
Resources.subtractFrom(skippedAMSize, c.getContainer()
.getResource());
}
skippedAMContainerlist.clear();
} | void function(Resource clusterResource, Map<ApplicationAttemptId, Set<RMContainer>> preemptMap, List<RMContainer> skippedAMContainerlist, Resource resToObtain, Resource skippedAMSize, Resource maxAMCapacityForThisQueue) { for (RMContainer c : skippedAMContainerlist) { if (Resources.lessThanOrEqual(rc, clusterResource, resToObtain, Resources.none())) { break; } if (Resources.lessThanOrEqual(rc, clusterResource, skippedAMSize, maxAMCapacityForThisQueue)) { break; } Set<RMContainer> contToPrempt = preemptMap.get(c .getApplicationAttemptId()); if (null == contToPrempt) { contToPrempt = new HashSet<RMContainer>(); preemptMap.put(c.getApplicationAttemptId(), contToPrempt); } contToPrempt.add(c); Resources.subtractFrom(resToObtain, c.getContainer().getResource()); Resources.subtractFrom(skippedAMSize, c.getContainer() .getResource()); } skippedAMContainerlist.clear(); } | /**
* As more resources are needed for preemption, saved AMContainers has to be
* rescanned. Such AMContainers can be preempted based on resToObtain, but
* maxAMCapacityForThisQueue resources will be still retained.
*
* @param clusterResource
* @param preemptMap
* @param skippedAMContainerlist
* @param resToObtain
* @param skippedAMSize
* @param maxAMCapacityForThisQueue
*/ | As more resources are needed for preemption, saved AMContainers has to be rescanned. Such AMContainers can be preempted based on resToObtain, but maxAMCapacityForThisQueue resources will be still retained | preemptAMContainers | {
"repo_name": "bruthe/hadoop-2.6.0r",
"path": "src/yarn/server/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicy.java",
"license": "apache-2.0",
"size": 32295
} | [
"java.util.HashSet",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.apache.hadoop.yarn.api.records.ApplicationAttemptId",
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer",
"org.apache.hadoop.yarn.util.resource.Resources"
] | import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.util.resource.Resources; | import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.*; import org.apache.hadoop.yarn.util.resource.*; | [
"java.util",
"org.apache.hadoop"
] | java.util; org.apache.hadoop; | 1,134,324 |
public final void show() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (ClassNotFoundException e) {
log.warn("Cannot change GUI to SystemLookAndFeel", e);
} catch (InstantiationException e) {
log.warn("Cannot Instantiate GUI to SystemLookAndFeel", e);
} catch (IllegalAccessException e) {
log.warn("Cannot access SystemLookAndFeel GUI", e);
} catch (UnsupportedLookAndFeelException e) {
log.warn("SystemLookAndFeel GUI is not supported", e);
}
JOptionPane.showMessageDialog(new JFrame(), message, "Meerkat Monitor",
messageType);
}
| final void function() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { log.warn(STR, e); } catch (InstantiationException e) { log.warn(STR, e); } catch (IllegalAccessException e) { log.warn(STR, e); } catch (UnsupportedLookAndFeelException e) { log.warn(STR, e); } JOptionPane.showMessageDialog(new JFrame(), message, STR, messageType); } | /**
* Show a simple popup dialog
*
* @param message
*/ | Show a simple popup dialog | show | {
"repo_name": "felpsPnd/Meerkat-Monitor",
"path": "src/org/meerkat/gui/SimplePopup.java",
"license": "lgpl-3.0",
"size": 3913
} | [
"javax.swing.JFrame",
"javax.swing.JOptionPane",
"javax.swing.UIManager",
"javax.swing.UnsupportedLookAndFeelException"
] | import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.UnsupportedLookAndFeelException; | import javax.swing.*; | [
"javax.swing"
] | javax.swing; | 1,257,156 |
void recordError( Path path,
String message,
Throwable exception ); | void recordError( Path path, String message, Throwable exception ); | /**
* Record an error at the given path in a document.
*
* @param path the path; may not be null
* @param message the message describing the error; may not be null
* @param exception the exception that occurred and that is considered the cause
*/ | Record an error at the given path in a document | recordError | {
"repo_name": "pleacu/modeshape",
"path": "modeshape-schematic/src/main/java/org/modeshape/schematic/internal/schema/Problems.java",
"license": "apache-2.0",
"size": 2819
} | [
"org.modeshape.schematic.document.Path"
] | import org.modeshape.schematic.document.Path; | import org.modeshape.schematic.document.*; | [
"org.modeshape.schematic"
] | org.modeshape.schematic; | 1,726,023 |
private int parseMasks(MetadataStore store, int series, int roi,
String overlayTiff) throws FormatException, IOException
{
if (!parseMasks || series >= getSeriesCount()) return 0;
int nOverlays = 0;
for (int i=0; i<3; i++) {
String roiId = MetadataTools.createLSID("ROI", series, roi + nOverlays);
String maskId =
MetadataTools.createLSID("Mask", series, roi + nOverlays, 0);
overlayFiles.put(maskId, overlayTiff);
overlayPlanes.put(maskId, i);
boolean validMask = populateMaskPixels(series, roi + nOverlays, 0, store);
if (validMask) {
store.setROIID(roiId, roi + nOverlays);
String maskID = MetadataTools.createLSID("Shape", roi + nOverlays, 0);
store.setMaskID(maskID, roi + nOverlays, 0);
store.setMaskX(0d, roi + nOverlays, 0);
store.setMaskY(0d, roi + nOverlays, 0);
store.setMaskWidth((double) getSizeX(), roi + nOverlays, 0);
store.setMaskHeight((double) getSizeY(), roi + nOverlays, 0);
int color = 0xff000000 | (0xff << (8 * (2 - i)));
store.setMaskStrokeColor(new Color(color), roi + nOverlays, 0);
store.setMaskFillColor(new Color(color), roi + nOverlays, 0);
store.setImageROIRef(roiId, series, roi + nOverlays);
nOverlays++;
}
}
return nOverlays;
}
// -- MIASReader API methods -- | int function(MetadataStore store, int series, int roi, String overlayTiff) throws FormatException, IOException { if (!parseMasks series >= getSeriesCount()) return 0; int nOverlays = 0; for (int i=0; i<3; i++) { String roiId = MetadataTools.createLSID("ROI", series, roi + nOverlays); String maskId = MetadataTools.createLSID("Mask", series, roi + nOverlays, 0); overlayFiles.put(maskId, overlayTiff); overlayPlanes.put(maskId, i); boolean validMask = populateMaskPixels(series, roi + nOverlays, 0, store); if (validMask) { store.setROIID(roiId, roi + nOverlays); String maskID = MetadataTools.createLSID("Shape", roi + nOverlays, 0); store.setMaskID(maskID, roi + nOverlays, 0); store.setMaskX(0d, roi + nOverlays, 0); store.setMaskY(0d, roi + nOverlays, 0); store.setMaskWidth((double) getSizeX(), roi + nOverlays, 0); store.setMaskHeight((double) getSizeY(), roi + nOverlays, 0); int color = 0xff000000 (0xff << (8 * (2 - i))); store.setMaskStrokeColor(new Color(color), roi + nOverlays, 0); store.setMaskFillColor(new Color(color), roi + nOverlays, 0); store.setImageROIRef(roiId, series, roi + nOverlays); nOverlays++; } } return nOverlays; } | /**
* Parse Mask ROIs from the given TIFF and place them in the given
* MetadataStore.
* @return the number of masks parsed
*/ | Parse Mask ROIs from the given TIFF and place them in the given MetadataStore | parseMasks | {
"repo_name": "JoeHsiao/bioformats",
"path": "components/formats-gpl/src/loci/formats/in/MIASReader.java",
"license": "gpl-2.0",
"size": 41417
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 746,194 |
public ArrayList<Claim> filterByTag(String user, ArrayList<String> tag){
ArrayList<Claim> filteredClaimList = new ArrayList<Claim>();
for (int i = 0; i < ClaimList.claims.size(); i++) {
for (int j = 0; j < ClaimList.claims.get(i).getTagList().size(); j++){
if (ClaimList.claims.get(i).getClaimant().getUserName().equals(user) && tag.contains(ClaimList.claims.get(i).getTagList().get(j)) && !filteredClaimList.contains(ClaimList.claims.get(i))){
filteredClaimList.add(ClaimList.claims.get(i));
}
}
}
//leave sort until after demo
return sort(filteredClaimList);
} | ArrayList<Claim> function(String user, ArrayList<String> tag){ ArrayList<Claim> filteredClaimList = new ArrayList<Claim>(); for (int i = 0; i < ClaimList.claims.size(); i++) { for (int j = 0; j < ClaimList.claims.get(i).getTagList().size(); j++){ if (ClaimList.claims.get(i).getClaimant().getUserName().equals(user) && tag.contains(ClaimList.claims.get(i).getTagList().get(j)) && !filteredClaimList.contains(ClaimList.claims.get(i))){ filteredClaimList.add(ClaimList.claims.get(i)); } } } return sort(filteredClaimList); } | /**
* filters claims for claims containing a particular tag and user
* @param user
* @param tag
* @return an arraylist of claims
*/ | filters claims for claims containing a particular tag and user | filterByTag | {
"repo_name": "CMPUT301W15T12/C301Project",
"path": "CMPUT301W15T12/src/ca/ualberta/cs/cmput301w15t12/ClaimList.java",
"license": "apache-2.0",
"size": 6905
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,257,221 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> startAsync(String resourceGroupName, String applicationGatewayName, Context context) {
return beginStartAsync(resourceGroupName, applicationGatewayName, context)
.last()
.flatMap(this.client::getLroFinalResultOrError);
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function(String resourceGroupName, String applicationGatewayName, Context context) { return beginStartAsync(resourceGroupName, applicationGatewayName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } | /**
* Starts the specified application gateway.
*
* @param resourceGroupName The name of the resource group.
* @param applicationGatewayName The name of the application gateway.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return A {@link Mono} that completes when a successful response is received.
*/ | Starts the specified application gateway | startAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-network/src/main/java/com/azure/resourcemanager/network/implementation/ApplicationGatewaysClientImpl.java",
"license": "mit",
"size": 190366
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.util.Context"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.util.Context; | import com.azure.core.annotation.*; import com.azure.core.util.*; | [
"com.azure.core"
] | com.azure.core; | 1,798,446 |
private boolean isValidEmail(String email) {
return Patterns.EMAIL_ADDRESS.matcher(email).matches();
} | boolean function(String email) { return Patterns.EMAIL_ADDRESS.matcher(email).matches(); } | /**
* Just a simple check for now to see if there is an at sign and a period
*
* @param email
* @return true if the email is valid enough..
*/ | Just a simple check for now to see if there is an at sign and a period | isValidEmail | {
"repo_name": "smalldatalab/android-ohmage",
"path": "ohmage/src/main/java/org/ohmage/auth/CreateAccountFragment.java",
"license": "apache-2.0",
"size": 11524
} | [
"android.util.Patterns"
] | import android.util.Patterns; | import android.util.*; | [
"android.util"
] | android.util; | 2,852,649 |
private void closeDatabase(String dbname, CallbackContext cbc) {
DBRunner r = dbrmap.get(dbname);
if (r != null) {
try {
r.q.put(new DBQuery(false, cbc));
} catch(Exception e) {
if (cbc != null) {
cbc.error("couldn't close database" + e);
}
Log.e(SQLitePlugin.class.getSimpleName(), "couldn't close database", e);
}
} else {
if (cbc != null) {
cbc.success();
}
}
} | void function(String dbname, CallbackContext cbc) { DBRunner r = dbrmap.get(dbname); if (r != null) { try { r.q.put(new DBQuery(false, cbc)); } catch(Exception e) { if (cbc != null) { cbc.error(STR + e); } Log.e(SQLitePlugin.class.getSimpleName(), STR, e); } } else { if (cbc != null) { cbc.success(); } } } | /**
* Close a database (in another thread).
*
* @param dbName The name of the database file
*/ | Close a database (in another thread) | closeDatabase | {
"repo_name": "jimmywalkergit/Kibblebit",
"path": "plugins/cordova-sqlite-ext/src/android/io/sqlc/SQLitePlugin.java",
"license": "mit",
"size": 16809
} | [
"android.util.Log",
"org.apache.cordova.CallbackContext"
] | import android.util.Log; import org.apache.cordova.CallbackContext; | import android.util.*; import org.apache.cordova.*; | [
"android.util",
"org.apache.cordova"
] | android.util; org.apache.cordova; | 1,986,935 |
public List<String> genJsSrc(
SoyFileSetNode soyTree,
TemplateRegistry registry,
SoyIncrementalDomSrcOptions options,
ErrorReporter errorReporter)
throws SoySyntaxException {
SoyJsSrcOptions incrementalJSSrcOptions = options.toJsSrcOptions();
try (GuiceSimpleScope.InScope inScope = apiCallScope.enter()) {
// Seed the scoped parameters.
inScope.seed(SoyJsSrcOptions.class, incrementalJSSrcOptions);
BidiGlobalDir bidiGlobalDir =
SoyBidiUtils.decodeBidiGlobalDirFromJsOptions(
incrementalJSSrcOptions.getBidiGlobalDir(),
incrementalJSSrcOptions.getUseGoogIsRtlForBidiGlobalDir());
ApiCallScopeUtils.seedSharedParams(inScope, null , bidiGlobalDir);
// Do the code generation.
optimizeBidiCodeGenVisitorProvider.get().exec(soyTree);
simplifyVisitor.simplify(soyTree, registry);
new HtmlTransformVisitor(errorReporter).exec(soyTree);
new UnescapingVisitor().exec(soyTree);
// Must happen after HtmlTransformVisitor, so it can infer context for {msg} nodes.
new IncrementalDomExtractMsgVariablesVisitor().exec(soyTree);
return genIncrementalDomCodeVisitorProvider.get().gen(soyTree, registry, errorReporter);
}
} | List<String> function( SoyFileSetNode soyTree, TemplateRegistry registry, SoyIncrementalDomSrcOptions options, ErrorReporter errorReporter) throws SoySyntaxException { SoyJsSrcOptions incrementalJSSrcOptions = options.toJsSrcOptions(); try (GuiceSimpleScope.InScope inScope = apiCallScope.enter()) { inScope.seed(SoyJsSrcOptions.class, incrementalJSSrcOptions); BidiGlobalDir bidiGlobalDir = SoyBidiUtils.decodeBidiGlobalDirFromJsOptions( incrementalJSSrcOptions.getBidiGlobalDir(), incrementalJSSrcOptions.getUseGoogIsRtlForBidiGlobalDir()); ApiCallScopeUtils.seedSharedParams(inScope, null , bidiGlobalDir); optimizeBidiCodeGenVisitorProvider.get().exec(soyTree); simplifyVisitor.simplify(soyTree, registry); new HtmlTransformVisitor(errorReporter).exec(soyTree); new UnescapingVisitor().exec(soyTree); new IncrementalDomExtractMsgVariablesVisitor().exec(soyTree); return genIncrementalDomCodeVisitorProvider.get().gen(soyTree, registry, errorReporter); } } | /**
* Generates Incremental DOM JS source code given a Soy parse tree, an options object, and an
* optional bundle of translated messages.
*
* @param soyTree The Soy parse tree to generate JS source code for.
* @param options The compilation options relevant to this backend.
* @return A list of strings where each string represents the JS source code that belongs in one
* JS file. The generated JS files correspond one-to-one to the original Soy source files.
* @throws SoySyntaxException If a syntax error is found.
*/ | Generates Incremental DOM JS source code given a Soy parse tree, an options object, and an optional bundle of translated messages | genJsSrc | {
"repo_name": "rpatil26/closure-templates",
"path": "java/src/com/google/template/soy/incrementaldomsrc/IncrementalDomSrcMain.java",
"license": "apache-2.0",
"size": 7763
} | [
"com.google.template.soy.base.SoySyntaxException",
"com.google.template.soy.error.ErrorReporter",
"com.google.template.soy.html.passes.HtmlTransformVisitor",
"com.google.template.soy.internal.i18n.BidiGlobalDir",
"com.google.template.soy.internal.i18n.SoyBidiUtils",
"com.google.template.soy.jssrc.SoyJsSrc... | import com.google.template.soy.base.SoySyntaxException; import com.google.template.soy.error.ErrorReporter; import com.google.template.soy.html.passes.HtmlTransformVisitor; import com.google.template.soy.internal.i18n.BidiGlobalDir; import com.google.template.soy.internal.i18n.SoyBidiUtils; import com.google.template.soy.jssrc.SoyJsSrcOptions; import com.google.template.soy.shared.internal.ApiCallScopeUtils; import com.google.template.soy.shared.internal.GuiceSimpleScope; import com.google.template.soy.soytree.SoyFileSetNode; import com.google.template.soy.soytree.TemplateRegistry; import java.util.List; | import com.google.template.soy.base.*; import com.google.template.soy.error.*; import com.google.template.soy.html.passes.*; import com.google.template.soy.internal.i18n.*; import com.google.template.soy.jssrc.*; import com.google.template.soy.shared.internal.*; import com.google.template.soy.soytree.*; import java.util.*; | [
"com.google.template",
"java.util"
] | com.google.template; java.util; | 1,598,092 |
String initialContent = "abc";
TestDocumentContext<Node, Element, Text> test =
ContextProviders.createTestPojoContext(
DocProviders.POJO.parse(initialContent).asOperation(), null, null, null,
DocumentSchema.NO_SCHEMA_CONSTRAINTS);
MutableDocument<Node, Element, Text> doc = test.document();
RangeTracker rangeTracker = new RangeTracker(test.localAnnotations());
assertNull(rangeTracker.getRange());
rangeTracker.trackRange(new Range(1, 2));
assertEquals(new Range(1, 2), rangeTracker.getRange());
doc.insertText(doc.locate(0), "012");
assertEquals(new Range(4, 5), rangeTracker.getRange());
doc.insertText(doc.locate(4), "a");
assertEquals(new Range(5, 6), rangeTracker.getRange());
doc.insertText(doc.locate(6), "a");
assertEquals(new Range(5, 7), rangeTracker.getRange());
rangeTracker.clearRange();
assertNull(rangeTracker.getRange());
} | String initialContent = "abc"; TestDocumentContext<Node, Element, Text> test = ContextProviders.createTestPojoContext( DocProviders.POJO.parse(initialContent).asOperation(), null, null, null, DocumentSchema.NO_SCHEMA_CONSTRAINTS); MutableDocument<Node, Element, Text> doc = test.document(); RangeTracker rangeTracker = new RangeTracker(test.localAnnotations()); assertNull(rangeTracker.getRange()); rangeTracker.trackRange(new Range(1, 2)); assertEquals(new Range(1, 2), rangeTracker.getRange()); doc.insertText(doc.locate(0), "012"); assertEquals(new Range(4, 5), rangeTracker.getRange()); doc.insertText(doc.locate(4), "a"); assertEquals(new Range(5, 6), rangeTracker.getRange()); doc.insertText(doc.locate(6), "a"); assertEquals(new Range(5, 7), rangeTracker.getRange()); rangeTracker.clearRange(); assertNull(rangeTracker.getRange()); } | /**
* Basic sanity test.
*/ | Basic sanity test | testTrackRange | {
"repo_name": "gburd/wave",
"path": "test/org/waveprotocol/wave/model/document/util/RangeTrackerTest.java",
"license": "apache-2.0",
"size": 7573
} | [
"org.waveprotocol.wave.model.document.MutableDocument",
"org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema",
"org.waveprotocol.wave.model.document.raw.impl.Element",
"org.waveprotocol.wave.model.document.raw.impl.Node",
"org.waveprotocol.wave.model.document.raw.impl.Text",
"org.wavep... | import org.waveprotocol.wave.model.document.MutableDocument; import org.waveprotocol.wave.model.document.operation.automaton.DocumentSchema; import org.waveprotocol.wave.model.document.raw.impl.Element; import org.waveprotocol.wave.model.document.raw.impl.Node; import org.waveprotocol.wave.model.document.raw.impl.Text; import org.waveprotocol.wave.model.document.util.ContextProviders; | import org.waveprotocol.wave.model.document.*; import org.waveprotocol.wave.model.document.operation.automaton.*; import org.waveprotocol.wave.model.document.raw.impl.*; import org.waveprotocol.wave.model.document.util.*; | [
"org.waveprotocol.wave"
] | org.waveprotocol.wave; | 529,420 |
public void testDataElementQualifiedName() throws Exception {
Element.QualifiedName qn1, qn2, qn3;
String uri = "SomeURI";
String localName = "SomeName";
try {
new Element.QualifiedName(null, null);
fail("Element.QualifiedName(null, null) should throw an IllegalArgumentException.");
} catch (IllegalArgumentException e) {
// as expected
}
try {
new Element.QualifiedName(uri, null);
fail("Element.QualifiedName(\"" + uri + "\", null) should throw an IllegalArgumentException.");
} catch (IllegalArgumentException e) {
// as expected
}
qn1 = new Element.QualifiedName(null, localName);
assertEquals(null, qn1.getNamespaceURI());
assertEquals(localName, qn1.getLocalName());
qn2 = new Element.QualifiedName(null, localName);
assertEquals(qn1, qn1);
assertEquals(qn1, qn2);
assertEquals(qn2, qn1);
assertEquals(qn2, qn2);
qn3 = new Element.QualifiedName("", localName);
assertEquals(null, qn1.getNamespaceURI());
assertEquals(localName, qn1.getLocalName());
assertEquals(qn1, qn2);
assertEquals(qn1, qn3);
assertEquals(qn2, qn1);
assertEquals(qn2, qn3);
assertEquals(qn3, qn1);
assertEquals(qn3, qn2);
qn1 = new Element.QualifiedName(uri, localName);
assertEquals(uri, qn1.getNamespaceURI());
assertEquals(localName, qn1.getLocalName());
qn2 = new Element.QualifiedName(uri, localName);
assertEquals(qn1, qn2);
assertEquals(qn2, qn1);
} | void function() throws Exception { Element.QualifiedName qn1, qn2, qn3; String uri = STR; String localName = STR; try { new Element.QualifiedName(null, null); fail(STR); } catch (IllegalArgumentException e) { } try { new Element.QualifiedName(uri, null); fail(STRSTR\STR); } catch (IllegalArgumentException e) { } qn1 = new Element.QualifiedName(null, localName); assertEquals(null, qn1.getNamespaceURI()); assertEquals(localName, qn1.getLocalName()); qn2 = new Element.QualifiedName(null, localName); assertEquals(qn1, qn1); assertEquals(qn1, qn2); assertEquals(qn2, qn1); assertEquals(qn2, qn2); qn3 = new Element.QualifiedName("", localName); assertEquals(null, qn1.getNamespaceURI()); assertEquals(localName, qn1.getLocalName()); assertEquals(qn1, qn2); assertEquals(qn1, qn3); assertEquals(qn2, qn1); assertEquals(qn2, qn3); assertEquals(qn3, qn1); assertEquals(qn3, qn2); qn1 = new Element.QualifiedName(uri, localName); assertEquals(uri, qn1.getNamespaceURI()); assertEquals(localName, qn1.getLocalName()); qn2 = new Element.QualifiedName(uri, localName); assertEquals(qn1, qn2); assertEquals(qn2, qn1); } | /**
* Tests the behaviour of the <code>Element.QualifiedName</code> class.
*
* @throws Exception
* if an unexpected exception is thrown.
*/ | Tests the behaviour of the <code>Element.QualifiedName</code> class | testDataElementQualifiedName | {
"repo_name": "znerd/xins",
"path": "src/tests/org/xins/tests/common/xml/ElementTests.java",
"license": "bsd-3-clause",
"size": 8984
} | [
"org.xins.common.xml.Element"
] | import org.xins.common.xml.Element; | import org.xins.common.xml.*; | [
"org.xins.common"
] | org.xins.common; | 915,938 |
public static void closeSession() throws HibernateException {
Session session = (Session) threadLocal.get();
threadLocal.set(null);
if (session != null) {
session.close();
}
} | static void function() throws HibernateException { Session session = (Session) threadLocal.get(); threadLocal.set(null); if (session != null) { session.close(); } } | /**
* Close the single hibernate session instance.
*
* @throws HibernateException
*/ | Close the single hibernate session instance | closeSession | {
"repo_name": "hemoye/ic",
"path": "src/com/jsu/ic/commons/HibernateSessionFactory.java",
"license": "gpl-2.0",
"size": 3213
} | [
"org.hibernate.HibernateException",
"org.hibernate.Session"
] | import org.hibernate.HibernateException; import org.hibernate.Session; | import org.hibernate.*; | [
"org.hibernate"
] | org.hibernate; | 398,017 |
public ProgressDialog loading(boolean preventBack) {
return loading("Loading…", preventBack);
}
| ProgressDialog function(boolean preventBack) { return loading(STR, preventBack); } | /**
* Shows a dialog box telling the user that something is loading
* @param preventBack
* If set to true, the user won't be able to close the progress dialog himself
* @return
* The progress dialog created
*/ | Shows a dialog box telling the user that something is loading | loading | {
"repo_name": "tmalahie/aQuery",
"path": "main/java/aquery/com/aquery/$Utils.java",
"license": "lgpl-3.0",
"size": 65615
} | [
"android.app.ProgressDialog"
] | import android.app.ProgressDialog; | import android.app.*; | [
"android.app"
] | android.app; | 2,280,456 |
@Test
public void testCreateDelimitedString_EmptySpace() {
List<String> list = CollectionsUtil.createList();
assertEquals(0, list.size());
String delimitedStr = CollectionsUtil.createDelimitedString(list, "|");
String expectedStr = "";
assertEquals(String.format("output or createDelimitedString not as expected."), expectedStr, delimitedStr);
} | void function() { List<String> list = CollectionsUtil.createList(); assertEquals(0, list.size()); String delimitedStr = CollectionsUtil.createDelimitedString(list, " "); String expectedStr = STRoutput or createDelimitedString not as expected."), expectedStr, delimitedStr); } | /**
* Testing createDelimitedString() method with Null and Empty space as collection input
*/ | Testing createDelimitedString() method with Null and Empty space as collection input | testCreateDelimitedString_EmptySpace | {
"repo_name": "UCDenver-ccp/common",
"path": "src/test/java/edu/ucdenver/ccp/common/collections/CollectionsUtilTest.java",
"license": "bsd-3-clause",
"size": 27803
} | [
"java.util.List",
"org.junit.Assert"
] | import java.util.List; import org.junit.Assert; | import java.util.*; import org.junit.*; | [
"java.util",
"org.junit"
] | java.util; org.junit; | 2,278,984 |
private static boolean isImmediatelyFollowedByText(DetailNode tag) {
final DetailNode nextSibling = JavadocUtils.getNextSibling(tag);
return nextSibling.getType() == JavadocTokenTypes.NEWLINE
|| nextSibling.getType() == JavadocTokenTypes.EOF
|| CommonUtils.startsWithChar(nextSibling.getText(), ' ');
} | static boolean function(DetailNode tag) { final DetailNode nextSibling = JavadocUtils.getNextSibling(tag); return nextSibling.getType() == JavadocTokenTypes.NEWLINE nextSibling.getType() == JavadocTokenTypes.EOF CommonUtils.startsWithChar(nextSibling.getText(), ' '); } | /**
* Tests whether the paragraph tag is immediately followed by the text.
* @param tag html tag.
* @return true, if the paragraph tag is immediately followed by the text.
*/ | Tests whether the paragraph tag is immediately followed by the text | isImmediatelyFollowedByText | {
"repo_name": "baratali/checkstyle",
"path": "src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocParagraphCheck.java",
"license": "lgpl-2.1",
"size": 9802
} | [
"com.puppycrawl.tools.checkstyle.api.DetailNode",
"com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes",
"com.puppycrawl.tools.checkstyle.utils.CommonUtils",
"com.puppycrawl.tools.checkstyle.utils.JavadocUtils"
] | import com.puppycrawl.tools.checkstyle.api.DetailNode; import com.puppycrawl.tools.checkstyle.api.JavadocTokenTypes; import com.puppycrawl.tools.checkstyle.utils.CommonUtils; import com.puppycrawl.tools.checkstyle.utils.JavadocUtils; | import com.puppycrawl.tools.checkstyle.api.*; import com.puppycrawl.tools.checkstyle.utils.*; | [
"com.puppycrawl.tools"
] | com.puppycrawl.tools; | 337,654 |
@Test
public void shouldNormalizeDecimalIntegerLiteral() {
assertThat(chunk("543"), isNumericLiteral());
assertThat(chunk("543l"), isNumericLiteral());
assertThat(chunk("543L"), isNumericLiteral());
} | void function() { assertThat(chunk("543"), isNumericLiteral()); assertThat(chunk("543l"), isNumericLiteral()); assertThat(chunk("543L"), isNumericLiteral()); } | /**
* <a href="http://java.sun.com/docs/books/jls/third_edition/html/lexical.html#3.10.1">Integer Literals</a>
*/ | Integer Literals | shouldNormalizeDecimalIntegerLiteral | {
"repo_name": "teryk/sonarqube",
"path": "sonar-duplications/src/test/java/org/sonar/duplications/java/JavaTokenProducerTest.java",
"license": "lgpl-3.0",
"size": 12718
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 80,105 |
public static boolean verifyConnectivityAndRouteToHost(Context ctx,String urlString)
{
boolean HaveConnectedWifi = false;
boolean HaveConnectedMobile = false;
int ip = -1;
ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo[] netInfo = cm.getAllNetworkInfo();
if(netInfo!=null && netInfo.length>0)
{
ip =lookupHost(urlString);
for (NetworkInfo ni : netInfo)
{
if ("WIFI".equalsIgnoreCase(ni.getTypeName()))
if (ni.isConnected() && cm.requestRouteToHost(ni.getType(), ip) )
HaveConnectedWifi = true;
if (!HaveConnectedWifi && "MOBILE".equalsIgnoreCase(ni.getTypeName()))
if (ni.isConnected() && cm.requestRouteToHost(ni.getType(), ip) )
HaveConnectedMobile = true;
}
}
return HaveConnectedWifi || HaveConnectedMobile;
} | static boolean function(Context ctx,String urlString) { boolean HaveConnectedWifi = false; boolean HaveConnectedMobile = false; int ip = -1; ConnectivityManager cm = (ConnectivityManager) ctx.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo[] netInfo = cm.getAllNetworkInfo(); if(netInfo!=null && netInfo.length>0) { ip =lookupHost(urlString); for (NetworkInfo ni : netInfo) { if ("WIFI".equalsIgnoreCase(ni.getTypeName())) if (ni.isConnected() && cm.requestRouteToHost(ni.getType(), ip) ) HaveConnectedWifi = true; if (!HaveConnectedWifi && STR.equalsIgnoreCase(ni.getTypeName())) if (ni.isConnected() && cm.requestRouteToHost(ni.getType(), ip) ) HaveConnectedMobile = true; } } return HaveConnectedWifi HaveConnectedMobile; } | /**
* verify if there is a connection and a route to specific host
* @param ctx
* @param urlString
* @return
*/ | verify if there is a connection and a route to specific host | verifyConnectivityAndRouteToHost | {
"repo_name": "vocefiscal/vocefiscal-android",
"path": "Code/src/org/vocefiscal/communications/CommunicationUtils.java",
"license": "apache-2.0",
"size": 4690
} | [
"android.content.Context",
"android.net.ConnectivityManager",
"android.net.NetworkInfo"
] | import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; | import android.content.*; import android.net.*; | [
"android.content",
"android.net"
] | android.content; android.net; | 1,002,646 |
public void save(String dbName) throws TorqueException
{
Connection con = null;
try
{
con = Transaction.begin(dbName);
save(con);
Transaction.commit(con);
}
catch(TorqueException e)
{
Transaction.safeRollback(con);
throw e;
}
} | void function(String dbName) throws TorqueException { Connection con = null; try { con = Transaction.begin(dbName); save(con); Transaction.commit(con); } catch(TorqueException e) { Transaction.safeRollback(con); throw e; } } | /**
* Stores the object in the database. If the object is new,
* it inserts it; otherwise an update is performed.
* Note: this code is here because the method body is
* auto-generated conditionally and therefore needs to be
* in this file instead of in the super class, BaseObject.
*
* @param dbName
* @throws TorqueException
*/ | Stores the object in the database. If the object is new, it inserts it; otherwise an update is performed. Note: this code is here because the method body is auto-generated conditionally and therefore needs to be in this file instead of in the super class, BaseObject | save | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTRoleListType.java",
"license": "gpl-3.0",
"size": 27028
} | [
"java.sql.Connection",
"org.apache.torque.TorqueException",
"org.apache.torque.util.Transaction"
] | import java.sql.Connection; import org.apache.torque.TorqueException; import org.apache.torque.util.Transaction; | import java.sql.*; import org.apache.torque.*; import org.apache.torque.util.*; | [
"java.sql",
"org.apache.torque"
] | java.sql; org.apache.torque; | 2,810,735 |
@Test
public void testCreateIndexAndAddAnAccessor() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
setCacheInVMs(vm0, vm1, vm2, vm3);
vm1.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME,
redundancy, PortfolioData.class));
vm2.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME,
redundancy, PortfolioData.class));
vm3.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME,
redundancy, PortfolioData.class));
PortfolioData[] portfolio = createPortfolioData(cnt, cntDest);
// Putting the data into the PR's created
vm2.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(PARTITIONED_REGION_NAME,
portfolio, cnt, cntDest));
// create index from a data store.
vm1.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate(
PARTITIONED_REGION_NAME, "PrIndexOnStatus", "p.status", null, "p"));
// create an accessor vm.
vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRAccessorCreate(
PARTITIONED_REGION_NAME, redundancy, PortfolioData.class));
} | void function() throws Exception { Host host = Host.getHost(0); VM vm0 = host.getVM(0); VM vm1 = host.getVM(1); VM vm2 = host.getVM(2); VM vm3 = host.getVM(3); setCacheInVMs(vm0, vm1, vm2, vm3); vm1.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME, redundancy, PortfolioData.class)); vm2.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME, redundancy, PortfolioData.class)); vm3.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRCreate(PARTITIONED_REGION_NAME, redundancy, PortfolioData.class)); PortfolioData[] portfolio = createPortfolioData(cnt, cntDest); vm2.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRPuts(PARTITIONED_REGION_NAME, portfolio, cnt, cntDest)); vm1.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRIndexCreate( PARTITIONED_REGION_NAME, STR, STR, null, "p")); vm0.invoke(prQueryDUnitHelper.getCacheSerializableRunnableForPRAccessorCreate( PARTITIONED_REGION_NAME, redundancy, PortfolioData.class)); } | /**
* Test for bug fix 37985, NullPointerException in IndexCreationMsg operateOnPartitionedRegion.
* This bug show up when an accessor (PR with max memory = 0) vm joins the PR system when there
* are index on the PR and an index creation message is sent to this accessor VM.
*/ | Test for bug fix 37985, NullPointerException in IndexCreationMsg operateOnPartitionedRegion. This bug show up when an accessor (PR with max memory = 0) vm joins the PR system when there are index on the PR and an index creation message is sent to this accessor VM | testCreateIndexAndAddAnAccessor | {
"repo_name": "deepakddixit/incubator-geode",
"path": "geode-core/src/distributedTest/java/org/apache/geode/cache/query/partitioned/PRBasicIndexCreationDUnitTest.java",
"license": "apache-2.0",
"size": 38317
} | [
"org.apache.geode.cache.query.Utils",
"org.apache.geode.cache.query.data.PortfolioData",
"org.apache.geode.test.dunit.Host"
] | import org.apache.geode.cache.query.Utils; import org.apache.geode.cache.query.data.PortfolioData; import org.apache.geode.test.dunit.Host; | import org.apache.geode.cache.query.*; import org.apache.geode.cache.query.data.*; import org.apache.geode.test.dunit.*; | [
"org.apache.geode"
] | org.apache.geode; | 2,406,048 |
ISampleFactory sampleFactory = SampleFactory.getInstance();
executeTest(sampleFactory);
} | ISampleFactory sampleFactory = SampleFactory.getInstance(); executeTest(sampleFactory); } | /**
* This tests every sample fragment in the app. See implementation notes on how to increase
* the duration and iteration count for longer running tests and memory leak testing
*/ | This tests every sample fragment in the app. See implementation notes on how to increase the duration and iteration count for longer running tests and memory leak testing | testActivity | {
"repo_name": "osmdroid/osmdroid",
"path": "osmdroid-android-it/src/main/java/org/osmdroid/test/ExtraSamplesTest.java",
"license": "apache-2.0",
"size": 6680
} | [
"org.osmdroid.ISampleFactory",
"org.osmdroid.samplefragments.SampleFactory"
] | import org.osmdroid.ISampleFactory; import org.osmdroid.samplefragments.SampleFactory; | import org.osmdroid.*; import org.osmdroid.samplefragments.*; | [
"org.osmdroid",
"org.osmdroid.samplefragments"
] | org.osmdroid; org.osmdroid.samplefragments; | 2,724,518 |
public Type resultType() {
return fResultType;
} | Type function() { return fResultType; } | /**
* Returns the declared result type of the operation.
*
* @return resultType or null, if no return type specified
*/ | Returns the declared result type of the operation | resultType | {
"repo_name": "vnu-dse/rtl",
"path": "src/main/org/tzi/use/uml/mm/MOperation.java",
"license": "gpl-2.0",
"size": 8601
} | [
"org.tzi.use.uml.ocl.type.Type"
] | import org.tzi.use.uml.ocl.type.Type; | import org.tzi.use.uml.ocl.type.*; | [
"org.tzi.use"
] | org.tzi.use; | 2,570,169 |
public void setModuleFilePath(File file) {
Preferences prefs = Preferences.userNodeForPackage(MainApp.class);
if (file != null) {
prefs.put("filePath", file.getPath());
// Update the stage title.
primaryStage.setTitle("AddressApp - " + file.getName());
} else {
prefs.remove("filePath");
// Update the stage title.
primaryStage.setTitle("AddressApp");
}
} | void function(File file) { Preferences prefs = Preferences.userNodeForPackage(MainApp.class); if (file != null) { prefs.put(STR, file.getPath()); primaryStage.setTitle(STR + file.getName()); } else { prefs.remove(STR); primaryStage.setTitle(STR); } } | /**
* Sets the file path of the currently loaded file. The path is persisted in
* the OS specific registry.
*
* @param file
* the file or null to remove the path
*/ | Sets the file path of the currently loaded file. The path is persisted in the OS specific registry | setModuleFilePath | {
"repo_name": "zeroSDN/ZSDN-Controller",
"path": "util/startup-selector/src/main/java/zsdn/startup_selector/MainApp.java",
"license": "apache-2.0",
"size": 8038
} | [
"java.io.File",
"java.util.prefs.Preferences"
] | import java.io.File; import java.util.prefs.Preferences; | import java.io.*; import java.util.prefs.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 405,747 |
public DefaultHeaders<K, V, T> copy() {
DefaultHeaders<K, V, T> copy = new DefaultHeaders<K, V, T>(
hashingStrategy, valueConverter, nameValidator, entries.length);
copy.addImpl(this);
return copy;
}
private final class HeaderIterator implements Iterator<Map.Entry<K, V>> {
private HeaderEntry<K, V> current = head; | DefaultHeaders<K, V, T> function() { DefaultHeaders<K, V, T> copy = new DefaultHeaders<K, V, T>( hashingStrategy, valueConverter, nameValidator, entries.length); copy.addImpl(this); return copy; } private final class HeaderIterator implements Iterator<Map.Entry<K, V>> { private HeaderEntry<K, V> current = head; | /**
* Returns a deep copy of this instance.
*/ | Returns a deep copy of this instance | copy | {
"repo_name": "NiteshKant/netty",
"path": "codec/src/main/java/io/netty/handler/codec/DefaultHeaders.java",
"license": "apache-2.0",
"size": 34549
} | [
"java.util.Iterator",
"java.util.Map"
] | import java.util.Iterator; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,611,805 |
@Override
public Optional<ProjectConfig> apply(Source source,
LocalProjectConfig localProjectConfig) {
Module module = moduleService.resolveModule(Paths.convert(source.getPath().resolve("pom.xml")));
return Optional.of(new LocalModuleImpl(module));
} | Optional<ProjectConfig> function(Source source, LocalProjectConfig localProjectConfig) { Module module = moduleService.resolveModule(Paths.convert(source.getPath().resolve(STR))); return Optional.of(new LocalModuleImpl(module)); } | /**
* This executor mainly translates project configuration provided by the pipeline input into an internal format
* convenient for the local build system.
* @param source the internal representation of the sources in the local build system.
* @param localProjectConfig the project configuration.
* @return the internal representation of the project in the local build system.
*/ | This executor mainly translates project configuration provided by the pipeline input into an internal format convenient for the local build system | apply | {
"repo_name": "romartin/kie-wb-common",
"path": "kie-wb-common-services/kie-wb-common-services-backend/src/main/java/org/kie/workbench/common/services/backend/builder/ala/LocalModuleConfigExecutor.java",
"license": "apache-2.0",
"size": 2646
} | [
"java.util.Optional",
"org.guvnor.ala.config.ProjectConfig",
"org.guvnor.ala.source.Source",
"org.guvnor.common.services.project.model.Module",
"org.kie.workbench.common.services.backend.builder.ala.impl.LocalModuleImpl",
"org.uberfire.backend.server.util.Paths"
] | import java.util.Optional; import org.guvnor.ala.config.ProjectConfig; import org.guvnor.ala.source.Source; import org.guvnor.common.services.project.model.Module; import org.kie.workbench.common.services.backend.builder.ala.impl.LocalModuleImpl; import org.uberfire.backend.server.util.Paths; | import java.util.*; import org.guvnor.ala.config.*; import org.guvnor.ala.source.*; import org.guvnor.common.services.project.model.*; import org.kie.workbench.common.services.backend.builder.ala.impl.*; import org.uberfire.backend.server.util.*; | [
"java.util",
"org.guvnor.ala",
"org.guvnor.common",
"org.kie.workbench",
"org.uberfire.backend"
] | java.util; org.guvnor.ala; org.guvnor.common; org.kie.workbench; org.uberfire.backend; | 1,814,406 |
private boolean launchWebApkIfSoleIntentHandler(
List<ResolveInfo> resolvingInfos, Intent targetIntent) {
String packageName = pickWebApkIfSoleIntentHandler(resolvingInfos);
if (packageName == null) return false;
Intent webApkIntent = new Intent(targetIntent);
webApkIntent.setPackage(packageName);
try {
startActivity(webApkIntent, false);
if (DEBUG) Log.i(TAG, "Launched WebAPK");
return true;
} catch (ActivityNotFoundException e) {
// The WebApk must have been uninstalled/disabled since we queried for Activities to
// handle this intent.
if (DEBUG) Log.i(TAG, "WebAPK launch failed");
return false;
}
} | boolean function( List<ResolveInfo> resolvingInfos, Intent targetIntent) { String packageName = pickWebApkIfSoleIntentHandler(resolvingInfos); if (packageName == null) return false; Intent webApkIntent = new Intent(targetIntent); webApkIntent.setPackage(packageName); try { startActivity(webApkIntent, false); if (DEBUG) Log.i(TAG, STR); return true; } catch (ActivityNotFoundException e) { if (DEBUG) Log.i(TAG, STR); return false; } } | /**
* Launches WebAPK if the WebAPK is the sole non-browser handler for the given intent.
* @return Whether a WebAPK was launched.
*/ | Launches WebAPK if the WebAPK is the sole non-browser handler for the given intent | launchWebApkIfSoleIntentHandler | {
"repo_name": "scheib/chromium",
"path": "components/external_intents/android/java/src/org/chromium/components/external_intents/ExternalNavigationHandler.java",
"license": "bsd-3-clause",
"size": 96459
} | [
"android.content.ActivityNotFoundException",
"android.content.Intent",
"android.content.pm.ResolveInfo",
"java.util.List",
"org.chromium.base.Log"
] | import android.content.ActivityNotFoundException; import android.content.Intent; import android.content.pm.ResolveInfo; import java.util.List; import org.chromium.base.Log; | import android.content.*; import android.content.pm.*; import java.util.*; import org.chromium.base.*; | [
"android.content",
"java.util",
"org.chromium.base"
] | android.content; java.util; org.chromium.base; | 1,212,490 |
public byte[] getHeaderAndData() throws IOException {
ensureBlockReady();
return onDiskBytesWithHeader;
} | byte[] function() throws IOException { ensureBlockReady(); return onDiskBytesWithHeader; } | /**
* Returns the header or the compressed data (or uncompressed data when not
* using compression) as a byte array. Can be called in the "writing" state
* or in the "block ready" state. If called in the "writing" state,
* transitions the writer to the "block ready" state.
*
* @return header and data as they would be stored on disk in a byte array
* @throws IOException
*/ | Returns the header or the compressed data (or uncompressed data when not using compression) as a byte array. Can be called in the "writing" state or in the "block ready" state. If called in the "writing" state, transitions the writer to the "block ready" state | getHeaderAndData | {
"repo_name": "throughsky/lywebank",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/io/hfile/TestHFileBlockCompatibility.java",
"license": "apache-2.0",
"size": 28483
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 267,609 |
@WebMethod(operationName = "GetGeoIP")
@WebResult(name = "GeoIP", targetNamespace = "http://www.webservicex.net/", partName = "Body")
public GeoIP getGeoIP(
@WebParam(partName = "IPAddress", name = "IPAddress", targetNamespace = "")
java.lang.String ipAddress
); | @WebMethod(operationName = STR) @WebResult(name = "GeoIP", targetNamespace = STRIPAddressSTRIPAddressSTR") java.lang.String ipAddress ); | /**
* GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses
*/ | GeoIPService - GetGeoIP enables you to easily look up countries by IP addresses | getGeoIP | {
"repo_name": "subkorvin/java_learning",
"path": "soap-sample/src/main/java/net/webservicex/GeoIPServiceHttpPost.java",
"license": "apache-2.0",
"size": 1271
} | [
"javax.jws.WebMethod",
"javax.jws.WebResult"
] | import javax.jws.WebMethod; import javax.jws.WebResult; | import javax.jws.*; | [
"javax.jws"
] | javax.jws; | 831,954 |
public static String toString(JSONObject jo) throws JSONException {
StringBuffer sb = new StringBuffer();
Object e;
int i;
JSONArray ja;
String k;
Iterator keys;
int len;
String tagName;
String v;
//Emit <tagName
tagName = jo.optString("tagName");
if (tagName == null) {
return XML.escape(jo.toString());
}
XML.noSpace(tagName);
tagName = XML.escape(tagName);
sb.append('<');
sb.append(tagName);
//Emit the attributesByClass
keys = jo.keys();
while (keys.hasNext()) {
k = keys.next().toString();
if (!k.equals("tagName") && !k.equals("childNodes")) {
XML.noSpace(k);
v = jo.optString(k);
if (v != null) {
sb.append(' ');
sb.append(XML.escape(k));
sb.append('=');
sb.append('"');
sb.append(XML.escape(v));
sb.append('"');
}
}
}
//Emit content in body
ja = jo.optJSONArray("childNodes");
if (ja == null) {
sb.append('/');
sb.append('>');
} else {
sb.append('>');
len = ja.length();
for (i = 0; i < len; i += 1) {
e = ja.get(i);
if (e != null) {
if (e instanceof String) {
sb.append(XML.escape(e.toString()));
} else if (e instanceof JSONObject) {
sb.append(toString((JSONObject)e));
} else if (e instanceof JSONArray) {
sb.append(toString((JSONArray)e));
}
}
}
sb.append('<');
sb.append('/');
sb.append(tagName);
sb.append('>');
}
return sb.toString();
} | static String function(JSONObject jo) throws JSONException { StringBuffer sb = new StringBuffer(); Object e; int i; JSONArray ja; String k; Iterator keys; int len; String tagName; String v; tagName = jo.optString(STR); if (tagName == null) { return XML.escape(jo.toString()); } XML.noSpace(tagName); tagName = XML.escape(tagName); sb.append('<'); sb.append(tagName); keys = jo.keys(); while (keys.hasNext()) { k = keys.next().toString(); if (!k.equals(STR) && !k.equals(STR)) { XML.noSpace(k); v = jo.optString(k); if (v != null) { sb.append(' '); sb.append(XML.escape(k)); sb.append('='); sb.append('STR'); } } } ja = jo.optJSONArray(STR); if (ja == null) { sb.append('/'); sb.append('>'); } else { sb.append('>'); len = ja.length(); for (i = 0; i < len; i += 1) { e = ja.get(i); if (e != null) { if (e instanceof String) { sb.append(XML.escape(e.toString())); } else if (e instanceof JSONObject) { sb.append(toString((JSONObject)e)); } else if (e instanceof JSONArray) { sb.append(toString((JSONArray)e)); } } } sb.append('<'); sb.append('/'); sb.append(tagName); sb.append('>'); } return sb.toString(); } | /**
* Reverse the JSONML transformation, making an XML text from a JSONObject.
* The JSONObject must contain a "tagName" property. If it has children,
* then it must have a "childNodes" property containing an array of objects.
* The other properties are attributesByClass with string values.
* @param jo A JSONObject.
* @return An XML string.
* @throws JSONException
*/ | Reverse the JSONML transformation, making an XML text from a JSONObject. The JSONObject must contain a "tagName" property. If it has children, then it must have a "childNodes" property containing an array of objects. The other properties are attributesByClass with string values | toString | {
"repo_name": "edvin/tornadofaces",
"path": "tornadofaces/src/main/java/io/tornadofaces/json/JSONML.java",
"license": "apache-2.0",
"size": 14920
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 642,828 |
@BeforeEach
public void setup() {
beans = new HashMap<>();
var fishingBoatAdapter = spy(new FishingBoatAdapter());
beans.put(FISHING_BEAN, fishingBoatAdapter);
var captain = new Captain();
captain.setRowingBoat((FishingBoatAdapter) beans.get(FISHING_BEAN));
beans.put(ROWING_BEAN, captain);
} | void function() { beans = new HashMap<>(); var fishingBoatAdapter = spy(new FishingBoatAdapter()); beans.put(FISHING_BEAN, fishingBoatAdapter); var captain = new Captain(); captain.setRowingBoat((FishingBoatAdapter) beans.get(FISHING_BEAN)); beans.put(ROWING_BEAN, captain); } | /**
* This method runs before the test execution and sets the bean objects in the beans Map.
*/ | This method runs before the test execution and sets the bean objects in the beans Map | setup | {
"repo_name": "zik43/java-design-patterns",
"path": "adapter/src/test/java/com/iluwatar/adapter/AdapterPatternTest.java",
"license": "mit",
"size": 2658
} | [
"java.util.HashMap",
"org.mockito.Mockito"
] | import java.util.HashMap; import org.mockito.Mockito; | import java.util.*; import org.mockito.*; | [
"java.util",
"org.mockito"
] | java.util; org.mockito; | 1,161,510 |
@Test
public void testQueuedExecutionTimeoutFallbackFailure() {
TestHystrixCommand<?> command = getCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.ExecutionResult.SUCCESS, 200, AbstractTestHystrixCommand.FallbackResult.FAILURE, 50);
try {
command.queue().get();
fail("we shouldn't get here");
} catch (Exception e) {
if (e instanceof ExecutionException && e.getCause() instanceof HystrixRuntimeException) {
HystrixRuntimeException de = (HystrixRuntimeException) e.getCause();
assertNotNull(de.getFallbackException());
assertFalse(de.getFallbackException() instanceof UnsupportedOperationException);
assertNotNull(de.getImplementingClass());
assertNotNull(de.getCause());
assertTrue(de.getCause() instanceof TimeoutException);
} else {
fail("the exception should be ExecutionException with cause as HystrixRuntimeException");
}
}
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS));
assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION));
assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED));
assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT));
assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE));
assertEquals(100, command.getBuilder().metrics.getHealthCounts().getErrorPercentage());
assertEquals(0, command.getBuilder().metrics.getCurrentConcurrentExecutionCount());
assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size());
} | void function() { TestHystrixCommand<?> command = getCommand(ExecutionIsolationStrategy.THREAD, AbstractTestHystrixCommand.ExecutionResult.SUCCESS, 200, AbstractTestHystrixCommand.FallbackResult.FAILURE, 50); try { command.queue().get(); fail(STR); } catch (Exception e) { if (e instanceof ExecutionException && e.getCause() instanceof HystrixRuntimeException) { HystrixRuntimeException de = (HystrixRuntimeException) e.getCause(); assertNotNull(de.getFallbackException()); assertFalse(de.getFallbackException() instanceof UnsupportedOperationException); assertNotNull(de.getImplementingClass()); assertNotNull(de.getCause()); assertTrue(de.getCause() instanceof TimeoutException); } else { fail(STR); } } assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SUCCESS)); assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.EXCEPTION_THROWN)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.BAD_REQUEST)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_REJECTION)); assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_FAILURE)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.FALLBACK_SUCCESS)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SEMAPHORE_REJECTED)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.SHORT_CIRCUITED)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.THREAD_POOL_REJECTED)); assertEquals(1, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.TIMEOUT)); assertEquals(0, command.getBuilder().metrics.getRollingCount(HystrixRollingNumberEvent.RESPONSE_FROM_CACHE)); assertEquals(100, command.getBuilder().metrics.getHealthCounts().getErrorPercentage()); assertEquals(0, command.getBuilder().metrics.getCurrentConcurrentExecutionCount()); assertEquals(1, HystrixRequestLog.getCurrentRequest().getAllExecutedCommands().size()); } | /**
* Test a queued command execution timeout where the command implemented getFallback but it fails.
* <p>
* We specifically want to protect against developers queuing commands and using queue().get() without a timeout (such as queue().get(3000, TimeUnit.Milliseconds)) and ending up blocking
* indefinitely by skipping the timeout protection of the execute() command.
*/ | Test a queued command execution timeout where the command implemented getFallback but it fails. We specifically want to protect against developers queuing commands and using queue().get() without a timeout (such as queue().get(3000, TimeUnit.Milliseconds)) and ending up blocking indefinitely by skipping the timeout protection of the execute() command | testQueuedExecutionTimeoutFallbackFailure | {
"repo_name": "manwithharmonica/Hystrix",
"path": "hystrix-core/src/test/java/com/netflix/hystrix/HystrixCommandTest.java",
"license": "apache-2.0",
"size": 265467
} | [
"com.netflix.hystrix.HystrixCommandProperties",
"com.netflix.hystrix.exception.HystrixRuntimeException",
"com.netflix.hystrix.util.HystrixRollingNumberEvent",
"java.util.concurrent.ExecutionException",
"java.util.concurrent.TimeoutException",
"org.junit.Assert"
] | import com.netflix.hystrix.HystrixCommandProperties; import com.netflix.hystrix.exception.HystrixRuntimeException; import com.netflix.hystrix.util.HystrixRollingNumberEvent; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeoutException; import org.junit.Assert; | import com.netflix.hystrix.*; import com.netflix.hystrix.exception.*; import com.netflix.hystrix.util.*; import java.util.concurrent.*; import org.junit.*; | [
"com.netflix.hystrix",
"java.util",
"org.junit"
] | com.netflix.hystrix; java.util; org.junit; | 920,188 |
public static CQLQueryResults deserializeCQLQueryResults(InputStream xmlStream) throws Exception {
return deserializeCQLQueryResults(xmlStream, null);
}
| static CQLQueryResults function(InputStream xmlStream) throws Exception { return deserializeCQLQueryResults(xmlStream, null); } | /**
* Create an instance of CQLQuery from the specified input stream. The stream
* must contain an XML representation of the CQLQuery. If the reader is
* null, an IllegalArgumentException will be thrown.
*
* @param xmlStream
* @return an instance of CQLQueryResults from the specified input stream.
* @throws Exception
* on null argument or deserialization failure
*/ | Create an instance of CQLQuery from the specified input stream. The stream must contain an XML representation of the CQLQuery. If the reader is null, an IllegalArgumentException will be thrown | deserializeCQLQueryResults | {
"repo_name": "NCIP/cagrid-core",
"path": "caGrid/projects/fqp/src/gov/nih/nci/cagrid/fqp/common/SerializationUtils.java",
"license": "bsd-3-clause",
"size": 11435
} | [
"gov.nih.nci.cagrid.cqlresultset.CQLQueryResults",
"java.io.InputStream"
] | import gov.nih.nci.cagrid.cqlresultset.CQLQueryResults; import java.io.InputStream; | import gov.nih.nci.cagrid.cqlresultset.*; import java.io.*; | [
"gov.nih.nci",
"java.io"
] | gov.nih.nci; java.io; | 1,377,760 |
TestSetGroup createTestSetGroup(String name, TestSetGroup groupOrNull) throws RemoteException;
| TestSetGroup createTestSetGroup(String name, TestSetGroup groupOrNull) throws RemoteException; | /**
* Creates a new {@link TestSetGroup} with the given name below the given {@link TestSetGroup}. If
* <code>groupOrNull == null</code> the new {@link TestSetGroup} will automatically become a top
* level item.
*
* @param name
* The name of the new Test Set Group. <code>Null</code> will be reduced to an empty
* string.
* @param groupOrNull
* The parent group for the new Test Set Group or null.
* @return The object representing the new TestSet Group.
*
* @throws RemoteException
* remote communication problem
*/ | Creates a new <code>TestSetGroup</code> with the given name below the given <code>TestSetGroup</code>. If <code>groupOrNull == null</code> the new <code>TestSetGroup</code> will automatically become a top level item | createTestSetGroup | {
"repo_name": "jenkinsci/piketec-tpt-plugin",
"path": "src/main/java/com/piketec/tpt/api/Project.java",
"license": "mit",
"size": 47574
} | [
"java.rmi.RemoteException"
] | import java.rmi.RemoteException; | import java.rmi.*; | [
"java.rmi"
] | java.rmi; | 1,817,191 |
public static void writeByteArray(DataOutput out, @Nullable byte[] arr, int maxLen) throws IOException {
if (arr == null)
out.writeInt(-1);
else {
int len = Math.min(arr.length, maxLen);
out.writeInt(len);
out.write(arr, 0, len);
}
} | static void function(DataOutput out, @Nullable byte[] arr, int maxLen) throws IOException { if (arr == null) out.writeInt(-1); else { int len = Math.min(arr.length, maxLen); out.writeInt(len); out.write(arr, 0, len); } } | /**
* Writes byte array to output stream accounting for <tt>null</tt> values.
*
* @param out Output stream to write to.
* @param arr Array to write, possibly <tt>null</tt>.
* @throws java.io.IOException If write failed.
*/ | Writes byte array to output stream accounting for null values | writeByteArray | {
"repo_name": "pperalta/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 314980
} | [
"java.io.DataOutput",
"java.io.IOException",
"org.jetbrains.annotations.Nullable"
] | import java.io.DataOutput; import java.io.IOException; import org.jetbrains.annotations.Nullable; | import java.io.*; import org.jetbrains.annotations.*; | [
"java.io",
"org.jetbrains.annotations"
] | java.io; org.jetbrains.annotations; | 1,151,743 |
@Override
@Deprecated
public KeyValue transform(KeyValue currentKV) throws IOException {
return currentKV;
} | KeyValue function(KeyValue currentKV) throws IOException { return currentKV; } | /**
* WARNING: please to not override this method. Instead override {@link #transformCell(Cell)}.
*
* This is for transition from 0.94 -> 0.96
*/ | This is for transition from 0.94 -> 0.96 | transform | {
"repo_name": "intel-hadoop/hbase-rhino",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/filter/FilterBase.java",
"license": "apache-2.0",
"size": 5748
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.KeyValue"
] | import java.io.IOException; import org.apache.hadoop.hbase.KeyValue; | import java.io.*; import org.apache.hadoop.hbase.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,837,349 |
public void setPreferredScrollableViewportSize(Dimension p)
{
preferredViewportSize = p;
revalidate();
repaint();
} | void function(Dimension p) { preferredViewportSize = p; revalidate(); repaint(); } | /**
* Set the value of the {@link #preferredViewportSize} property.
*
* @param p The new value of the preferredViewportSize property
*/ | Set the value of the <code>#preferredViewportSize</code> property | setPreferredScrollableViewportSize | {
"repo_name": "unofficial-opensource-apple/gcc_40",
"path": "libjava/javax/swing/JTable.java",
"license": "gpl-2.0",
"size": 50166
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,126,117 |
public void test_012_referencedColumns()
throws Exception
{
Connection conn = getConnection();
expectCompilationError
(
CANT_REFERENCE_GENERATED_COLUMN,
"create table t_recurse_1( a int, b int generated always as ( -a ), c int generated always as ( b*b) )"
);
expectCompilationError
(
CANT_REFERENCE_GENERATED_COLUMN,
"create table t_recurse_1( a int, b int generated always as ( -b ) )"
);
goodStatement
(
conn,
"create table t_recurse_1( a int, b int generated always as ( -a ) )"
);
expectCompilationError
(
CANT_REFERENCE_GENERATED_COLUMN,
"alter table t_recurse_1 add column c int generated always as ( b*b )"
);
expectCompilationError
(
CANT_REFERENCE_GENERATED_COLUMN,
"alter table t_recurse_1 add column c int generated always as ( -c )"
);
} | void function() throws Exception { Connection conn = getConnection(); expectCompilationError ( CANT_REFERENCE_GENERATED_COLUMN, STR ); expectCompilationError ( CANT_REFERENCE_GENERATED_COLUMN, STR ); goodStatement ( conn, STR ); expectCompilationError ( CANT_REFERENCE_GENERATED_COLUMN, STR ); expectCompilationError ( CANT_REFERENCE_GENERATED_COLUMN, STR ); } | /**
* <p>
* Verify that generated columns can't refer to one another.
* </p>
*/ | Verify that generated columns can't refer to one another. | test_012_referencedColumns | {
"repo_name": "kavin256/Derby",
"path": "java/testing/org/apache/derbyTesting/functionTests/tests/lang/GeneratedColumnsTest.java",
"license": "apache-2.0",
"size": 173723
} | [
"java.sql.Connection"
] | import java.sql.Connection; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,798,004 |
public void processTouchEvent(MotionEvent ev) {
final int action = MotionEventCompat.getActionMasked(ev);
final int actionIndex = MotionEventCompat.getActionIndex(ev);
if (action == MotionEvent.ACTION_DOWN) {
// Reset things for a new event stream, just in case we didn't get
// the whole previous stream.
cancel();
}
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
}
mVelocityTracker.addMovement(ev);
switch (action) {
case MotionEvent.ACTION_DOWN: {
final float x = ev.getX();
final float y = ev.getY();
final int pointerId = MotionEventCompat.getPointerId(ev, 0);
final View toCapture = findTopChildUnder((int) x, (int) y);
saveInitialMotion(x, y, pointerId);
// Since the parent is already directly processing this touch
// event,
// there is no reason to delay for a slop before dragging.
// Start immediately if possible.
tryCaptureViewForDrag(toCapture, pointerId);
final int edgesTouched = mInitialEdgeTouched[pointerId];
if ((edgesTouched & mTrackingEdges) != 0) {
mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
}
break;
}
case MotionEventCompat.ACTION_POINTER_DOWN: {
final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex);
final float x = MotionEventCompat.getX(ev, actionIndex);
final float y = MotionEventCompat.getY(ev, actionIndex);
saveInitialMotion(x, y, pointerId);
// A ViewDragHelper can only manipulate one view at a time.
if (mDragState == STATE_IDLE) {
// If we're idle we can do anything! Treat it like a normal
// down event.
final View toCapture = findTopChildUnder((int) x, (int) y);
tryCaptureViewForDrag(toCapture, pointerId);
final int edgesTouched = mInitialEdgeTouched[pointerId];
if ((edgesTouched & mTrackingEdges) != 0) {
mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId);
}
} else if (isCapturedViewUnder((int) x, (int) y)) {
// We're still tracking a captured view. If the same view is
// under this
// point, we'll swap to controlling it with this pointer
// instead.
// (This will still work if we're "catching" a settling
// view.)
tryCaptureViewForDrag(mCapturedView, pointerId);
}
break;
}
case MotionEvent.ACTION_MOVE: {
if (mDragState == STATE_DRAGGING) {
final int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId);
final float x = MotionEventCompat.getX(ev, index);
final float y = MotionEventCompat.getY(ev, index);
final int idx = (int) (x - mLastMotionX[mActivePointerId]);
final int idy = (int) (y - mLastMotionY[mActivePointerId]);
dragTo(mCapturedView.getLeft() + idx, mCapturedView.getTop() + idy, idx, idy);
saveLastMotion(ev);
} else {
// Check to see if any pointer is now over a draggable view.
final int pointerCount = MotionEventCompat.getPointerCount(ev);
for (int i = 0; i < pointerCount; i++) {
final int pointerId = MotionEventCompat.getPointerId(ev, i);
final float x = MotionEventCompat.getX(ev, i);
final float y = MotionEventCompat.getY(ev, i);
final float dx = x - mInitialMotionX[pointerId];
final float dy = y - mInitialMotionY[pointerId];
reportNewEdgeDrags(dx, dy, pointerId);
if (mDragState == STATE_DRAGGING) {
// Callback might have started an edge drag.
break;
}
final View toCapture = findTopChildUnder((int) x, (int) y);
if (checkTouchSlop(toCapture, dx, dy)
&& tryCaptureViewForDrag(toCapture, pointerId)) {
break;
}
}
saveLastMotion(ev);
}
break;
}
case MotionEventCompat.ACTION_POINTER_UP: {
final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex);
if (mDragState == STATE_DRAGGING && pointerId == mActivePointerId) {
// Try to find another pointer that's still holding on to
// the captured view.
int newActivePointer = INVALID_POINTER;
final int pointerCount = MotionEventCompat.getPointerCount(ev);
for (int i = 0; i < pointerCount; i++) {
final int id = MotionEventCompat.getPointerId(ev, i);
if (id == mActivePointerId) {
// This one's going away, skip.
continue;
}
final float x = MotionEventCompat.getX(ev, i);
final float y = MotionEventCompat.getY(ev, i);
if (findTopChildUnder((int) x, (int) y) == mCapturedView
&& tryCaptureViewForDrag(mCapturedView, id)) {
newActivePointer = mActivePointerId;
break;
}
}
if (newActivePointer == INVALID_POINTER) {
// We didn't find another pointer still touching the
// view, release it.
releaseViewForPointerUp();
}
}
clearMotionHistory(pointerId);
break;
}
case MotionEvent.ACTION_UP: {
if (mDragState == STATE_DRAGGING) {
releaseViewForPointerUp();
}
cancel();
break;
}
case MotionEvent.ACTION_CANCEL: {
if (mDragState == STATE_DRAGGING) {
dispatchViewReleased(0, 0);
}
cancel();
break;
}
}
} | void function(MotionEvent ev) { final int action = MotionEventCompat.getActionMasked(ev); final int actionIndex = MotionEventCompat.getActionIndex(ev); if (action == MotionEvent.ACTION_DOWN) { cancel(); } if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(ev); switch (action) { case MotionEvent.ACTION_DOWN: { final float x = ev.getX(); final float y = ev.getY(); final int pointerId = MotionEventCompat.getPointerId(ev, 0); final View toCapture = findTopChildUnder((int) x, (int) y); saveInitialMotion(x, y, pointerId); tryCaptureViewForDrag(toCapture, pointerId); final int edgesTouched = mInitialEdgeTouched[pointerId]; if ((edgesTouched & mTrackingEdges) != 0) { mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId); } break; } case MotionEventCompat.ACTION_POINTER_DOWN: { final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex); final float x = MotionEventCompat.getX(ev, actionIndex); final float y = MotionEventCompat.getY(ev, actionIndex); saveInitialMotion(x, y, pointerId); if (mDragState == STATE_IDLE) { final View toCapture = findTopChildUnder((int) x, (int) y); tryCaptureViewForDrag(toCapture, pointerId); final int edgesTouched = mInitialEdgeTouched[pointerId]; if ((edgesTouched & mTrackingEdges) != 0) { mCallback.onEdgeTouched(edgesTouched & mTrackingEdges, pointerId); } } else if (isCapturedViewUnder((int) x, (int) y)) { tryCaptureViewForDrag(mCapturedView, pointerId); } break; } case MotionEvent.ACTION_MOVE: { if (mDragState == STATE_DRAGGING) { final int index = MotionEventCompat.findPointerIndex(ev, mActivePointerId); final float x = MotionEventCompat.getX(ev, index); final float y = MotionEventCompat.getY(ev, index); final int idx = (int) (x - mLastMotionX[mActivePointerId]); final int idy = (int) (y - mLastMotionY[mActivePointerId]); dragTo(mCapturedView.getLeft() + idx, mCapturedView.getTop() + idy, idx, idy); saveLastMotion(ev); } else { final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int pointerId = MotionEventCompat.getPointerId(ev, i); final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); final float dx = x - mInitialMotionX[pointerId]; final float dy = y - mInitialMotionY[pointerId]; reportNewEdgeDrags(dx, dy, pointerId); if (mDragState == STATE_DRAGGING) { break; } final View toCapture = findTopChildUnder((int) x, (int) y); if (checkTouchSlop(toCapture, dx, dy) && tryCaptureViewForDrag(toCapture, pointerId)) { break; } } saveLastMotion(ev); } break; } case MotionEventCompat.ACTION_POINTER_UP: { final int pointerId = MotionEventCompat.getPointerId(ev, actionIndex); if (mDragState == STATE_DRAGGING && pointerId == mActivePointerId) { int newActivePointer = INVALID_POINTER; final int pointerCount = MotionEventCompat.getPointerCount(ev); for (int i = 0; i < pointerCount; i++) { final int id = MotionEventCompat.getPointerId(ev, i); if (id == mActivePointerId) { continue; } final float x = MotionEventCompat.getX(ev, i); final float y = MotionEventCompat.getY(ev, i); if (findTopChildUnder((int) x, (int) y) == mCapturedView && tryCaptureViewForDrag(mCapturedView, id)) { newActivePointer = mActivePointerId; break; } } if (newActivePointer == INVALID_POINTER) { releaseViewForPointerUp(); } } clearMotionHistory(pointerId); break; } case MotionEvent.ACTION_UP: { if (mDragState == STATE_DRAGGING) { releaseViewForPointerUp(); } cancel(); break; } case MotionEvent.ACTION_CANCEL: { if (mDragState == STATE_DRAGGING) { dispatchViewReleased(0, 0); } cancel(); break; } } } | /**
* Process a touch event received by the parent view. This method will
* dispatch callback events as needed before returning. The parent view's
* onTouchEvent implementation should call this.
*
* @param ev The touch event received by the parent view
*/ | Process a touch event received by the parent view. This method will dispatch callback events as needed before returning. The parent view's onTouchEvent implementation should call this | processTouchEvent | {
"repo_name": "KouChengjian/PhoneMate",
"path": "PhoneSuperviser/src/com/kcj/phonesuperviser/view/swipeback/ViewDragHelper.java",
"license": "gpl-2.0",
"size": 61280
} | [
"android.support.v4.view.MotionEventCompat",
"android.view.MotionEvent",
"android.view.VelocityTracker",
"android.view.View"
] | import android.support.v4.view.MotionEventCompat; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; | import android.support.v4.view.*; import android.view.*; | [
"android.support",
"android.view"
] | android.support; android.view; | 2,787,681 |
private Collection<QueryTree<String>> getUncoveredTrees(QueryTree<String> tree, List<QueryTree<String>> allTrees){
Collection<QueryTree<String>> uncoveredTrees = new ArrayList<QueryTree<String>>();
for (QueryTree<String> queryTree : allTrees) {
boolean subsumed = queryTree.isSubsumedBy(tree);
if(!subsumed){
uncoveredTrees.add(queryTree);
}
}
return uncoveredTrees;
} | Collection<QueryTree<String>> function(QueryTree<String> tree, List<QueryTree<String>> allTrees){ Collection<QueryTree<String>> uncoveredTrees = new ArrayList<QueryTree<String>>(); for (QueryTree<String> queryTree : allTrees) { boolean subsumed = queryTree.isSubsumedBy(tree); if(!subsumed){ uncoveredTrees.add(queryTree); } } return uncoveredTrees; } | /**
* Return all trees from the given list {@code allTrees} which are not already subsumed by {@code tree}.
* @param tree
* @param allTrees
* @return
*/ | Return all trees from the given list allTrees which are not already subsumed by tree | getUncoveredTrees | {
"repo_name": "MaRoe/DL-Learner",
"path": "components-core/src/main/java/org/dllearner/algorithms/qtl/QTL2DisjunctiveMT.java",
"license": "gpl-3.0",
"size": 20269
} | [
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"org.dllearner.algorithms.qtl.datastructures.QueryTree"
] | import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.dllearner.algorithms.qtl.datastructures.QueryTree; | import java.util.*; import org.dllearner.algorithms.qtl.datastructures.*; | [
"java.util",
"org.dllearner.algorithms"
] | java.util; org.dllearner.algorithms; | 2,480,159 |
private void setDefaultReplicationFactor(Map<String, String> strategy_options)
{
strategy_options.put("replication_factor", CassandraConstants.DEFAULT_REPLICATION_FACTOR);
} | void function(Map<String, String> strategy_options) { strategy_options.put(STR, CassandraConstants.DEFAULT_REPLICATION_FACTOR); } | /**
* Sets the default replication factor.
*
* @param strategy_options
* the strategy_options
*/ | Sets the default replication factor | setDefaultReplicationFactor | {
"repo_name": "impetus-opensource/Kundera",
"path": "src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java",
"license": "apache-2.0",
"size": 123023
} | [
"com.impetus.client.cassandra.common.CassandraConstants",
"java.util.Map"
] | import com.impetus.client.cassandra.common.CassandraConstants; import java.util.Map; | import com.impetus.client.cassandra.common.*; import java.util.*; | [
"com.impetus.client",
"java.util"
] | com.impetus.client; java.util; | 28,693 |
List<N> findDirectChildren(List<N> treeCacheable); | List<N> findDirectChildren(List<N> treeCacheable); | /**
* Finds direct children in a cached list of tree nodes, parent is first in that cached list.
* The subNodes list was returned from a call to <code>getTreeCacheable()</code> or <code>findSubTree()</code>.
* Mind that any cached tree could be out-of-sync with database when another client performs changes.
* @param treeCacheable a list of nodes from which to extract the direct child list, parent at head of list.
* @return a list of direct children of the the parent which is first in list.
*/ | Finds direct children in a cached list of tree nodes, parent is first in that cached list. The subNodes list was returned from a call to <code>getTreeCacheable()</code> or <code>findSubTree()</code>. Mind that any cached tree could be out-of-sync with database when another client performs changes | findDirectChildren | {
"repo_name": "yangboz/JPATreeDAO",
"path": "src/main/java/fri/util/database/jpa/tree/TreeDao.java",
"license": "bsd-2-clause",
"size": 13790
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,412,904 |
protected static UserAccountAssignment getUserAccountAssignment() {
UserAccountAssignment entity = new UserAccountAssignment();
entity.setAssignmentDate(new Date());
return entity;
} | static UserAccountAssignment function() { UserAccountAssignment entity = new UserAccountAssignment(); entity.setAssignmentDate(new Date()); return entity; } | /**
* Creates an instance of UserAccountAssignment.
*
* @return the UserAccountAssignment instance.
*
* @since 1.1 (OPM - Data Migration - Entities Update Module Assembly 1.0)
*/ | Creates an instance of UserAccountAssignment | getUserAccountAssignment | {
"repo_name": "NASA-Tournament-Lab/CoECI-OPM-Service-Credit-Redeposit-Deposit-Application",
"path": "Code/SCRD_BRE/src/java/tests/gov/opm/scrd/BasePersistenceTests.java",
"license": "apache-2.0",
"size": 58033
} | [
"gov.opm.scrd.entities.application.UserAccountAssignment",
"java.util.Date"
] | import gov.opm.scrd.entities.application.UserAccountAssignment; import java.util.Date; | import gov.opm.scrd.entities.application.*; import java.util.*; | [
"gov.opm.scrd",
"java.util"
] | gov.opm.scrd; java.util; | 801,041 |
@Test
public void reportMessageTest22() throws PcepParseException, PcepOutOfBoundMessageException {
byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0,
0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, //LSP Object
0x00, 0x12, 0x00, 0x10, //StatefulIPv4LspIdentidiersTlv
(byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01,
(byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20,
0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, //SymbolicPathNameTlv
0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, //StatefulLspErrorCodeTlv
0x07, 0x10, 0x00, 0x14, //ERO Object
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00,
0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00,
0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, //Bandwidth Object
0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, //Metric Object
0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, //RRO Object
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06,
0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01,
0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00};
byte[] testReportMsg = {0};
ChannelBuffer buffer = ChannelBuffers.dynamicBuffer();
buffer.writeBytes(reportMsg);
PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader();
PcepMessage message = null;
message = reader.readFrom(buffer);
assertThat(message, instanceOf(PcepReportMsg.class));
ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
message.writeTo(buf);
int readLen = buf.writerIndex();
testReportMsg = new byte[readLen];
buf.readBytes(testReportMsg, 0, readLen);
assertThat(testReportMsg, is(reportMsg));
} | void function() throws PcepParseException, PcepOutOfBoundMessageException { byte[] reportMsg = new byte[]{0x20, 0x0a, 0x00, (byte) 0xA0, 0x20, 0x10, 0x00, 0x2c, 0x00, 0x00, 0x10, 0x03, 0x00, 0x12, 0x00, 0x10, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x00, 0x01, (byte) 0x80, 0x01, (byte) 0xb6, 0x02, 0x4e, 0x1f, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x00, 0x11, 0x00, 0x02, 0x54, 0x31, 0x00, 0x00, 0x00, 0x14, 0x00, 0x04, 0x00, 0x00, 0x00, 0x08, 0x07, 0x10, 0x00, 0x14, 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x1f, 0x04, 0x00, 0x01, 0x08, (byte) 0xb6, 0x02, 0x4e, 0x20, 0x04, 0x00, 0x09, 0x10, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x20, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x20, 0x08, 0x10, 0x00, 0x34, 0x01, 0x08, 0x11, 0x01, 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x11, 0x01, 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x06, 0x06, 0x06, 0x06, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, 0x01, 0x02, 0x04, 0x00, 0x01, 0x08, 0x12, 0x01, 0x01, 0x01, 0x04, 0x00, 0x01, 0x08, 0x05, 0x05, 0x05, 0x05, 0x04, 0x00}; byte[] testReportMsg = {0}; ChannelBuffer buffer = ChannelBuffers.dynamicBuffer(); buffer.writeBytes(reportMsg); PcepMessageReader<PcepMessage> reader = PcepFactories.getGenericReader(); PcepMessage message = null; message = reader.readFrom(buffer); assertThat(message, instanceOf(PcepReportMsg.class)); ChannelBuffer buf = ChannelBuffers.dynamicBuffer(); message.writeTo(buf); int readLen = buf.writerIndex(); testReportMsg = new byte[readLen]; buf.readBytes(testReportMsg, 0, readLen); assertThat(testReportMsg, is(reportMsg)); } | /**
* This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv )
* ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object
* in PcRpt message.
*/ | This test case checks for LSP Object(Symbolic path tlv, StatefulIPv4LspIdentidiersTlv,StatefulLspErrorCodeTlv ) ERO Object,LSPA Object,BandWidth Object,Metric-list,RRO Object in PcRpt message | reportMessageTest22 | {
"repo_name": "donNewtonAlpha/onos",
"path": "protocols/pcep/pcepio/src/test/java/org/onosproject/pcepio/protocol/PcepReportMsgTest.java",
"license": "apache-2.0",
"size": 76875
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers",
"org.hamcrest.core.Is",
"org.jboss.netty.buffer.ChannelBuffer",
"org.jboss.netty.buffer.ChannelBuffers",
"org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException",
"org.onosproject.pcepio.exceptions.PcepParseException"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; import org.hamcrest.core.Is; import org.jboss.netty.buffer.ChannelBuffer; import org.jboss.netty.buffer.ChannelBuffers; import org.onosproject.pcepio.exceptions.PcepOutOfBoundMessageException; import org.onosproject.pcepio.exceptions.PcepParseException; | import org.hamcrest.*; import org.hamcrest.core.*; import org.jboss.netty.buffer.*; import org.onosproject.pcepio.exceptions.*; | [
"org.hamcrest",
"org.hamcrest.core",
"org.jboss.netty",
"org.onosproject.pcepio"
] | org.hamcrest; org.hamcrest.core; org.jboss.netty; org.onosproject.pcepio; | 506,289 |
@Test
public void networkHostEc2PrivateIp() throws IOException {
Settings nodeSettings = Settings.builder()
.put("network.host", "_ec2:privateIp_")
.build();
NetworkService networkService = new NetworkService(nodeSettings);
networkService.addCustomNameResolver(new Ec2NameResolver(nodeSettings));
// TODO we need to replace that with a mock. For now we check the URL we are supposed to reach.
try {
networkService.resolveBindHostAddress(null);
} catch (IOException e) {
assertThat(e.getMessage(), containsString("local-ipv4"));
}
} | void function() throws IOException { Settings nodeSettings = Settings.builder() .put(STR, STR) .build(); NetworkService networkService = new NetworkService(nodeSettings); networkService.addCustomNameResolver(new Ec2NameResolver(nodeSettings)); try { networkService.resolveBindHostAddress(null); } catch (IOException e) { assertThat(e.getMessage(), containsString(STR)); } } | /**
* Test for network.host: _ec2:privateIp_
*/ | Test for network.host: _ec2:privateIp_ | networkHostEc2PrivateIp | {
"repo_name": "jeteve/elasticsearch",
"path": "plugins/discovery-ec2/src/test/java/org/elasticsearch/discovery/ec2/Ec2NetworkTests.java",
"license": "apache-2.0",
"size": 7025
} | [
"java.io.IOException",
"org.elasticsearch.cloud.aws.network.Ec2NameResolver",
"org.elasticsearch.common.network.NetworkService",
"org.elasticsearch.common.settings.Settings",
"org.hamcrest.Matchers"
] | import java.io.IOException; import org.elasticsearch.cloud.aws.network.Ec2NameResolver; import org.elasticsearch.common.network.NetworkService; import org.elasticsearch.common.settings.Settings; import org.hamcrest.Matchers; | import java.io.*; import org.elasticsearch.cloud.aws.network.*; import org.elasticsearch.common.network.*; import org.elasticsearch.common.settings.*; import org.hamcrest.*; | [
"java.io",
"org.elasticsearch.cloud",
"org.elasticsearch.common",
"org.hamcrest"
] | java.io; org.elasticsearch.cloud; org.elasticsearch.common; org.hamcrest; | 2,146,929 |
public static JLabel createJLabel(String text, Font font) {
JLabel result = new JLabel(text);
result.setFont(font);
return result;
} | static JLabel function(String text, Font font) { JLabel result = new JLabel(text); result.setFont(font); return result; } | /**
* Creates a label with a specific font.
*
* @param text the text for the label.
* @param font the font.
*
* @return The label.
*/ | Creates a label with a specific font | createJLabel | {
"repo_name": "linuxuser586/jfreechart",
"path": "source/org/jfree/chart/util/RefineryUtilities.java",
"license": "lgpl-2.1",
"size": 10846
} | [
"java.awt.Font",
"javax.swing.JLabel"
] | import java.awt.Font; import javax.swing.JLabel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 531,761 |
public static String rewriteViewStatement(PhoenixConnection conn, PTable index, PTable table, String viewStatement) throws SQLException {
if (viewStatement == null) {
return null;
} | static String function(PhoenixConnection conn, PTable index, PTable table, String viewStatement) throws SQLException { if (viewStatement == null) { return null; } | /**
* Rewrite a view statement to be valid against an index
* @param conn
* @param index
* @param table
* @return
* @throws SQLException
*/ | Rewrite a view statement to be valid against an index | rewriteViewStatement | {
"repo_name": "shehzaadn/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/util/IndexUtil.java",
"license": "apache-2.0",
"size": 40398
} | [
"java.sql.SQLException",
"org.apache.phoenix.jdbc.PhoenixConnection",
"org.apache.phoenix.schema.PTable"
] | import java.sql.SQLException; import org.apache.phoenix.jdbc.PhoenixConnection; import org.apache.phoenix.schema.PTable; | import java.sql.*; import org.apache.phoenix.jdbc.*; import org.apache.phoenix.schema.*; | [
"java.sql",
"org.apache.phoenix"
] | java.sql; org.apache.phoenix; | 231,159 |
public void setSuspensionErrorCorrection(float val) {
if ( suspensionErrorCorrection == null ) {
suspensionErrorCorrection = (SFFloat)getField( "suspensionErrorCorrection" );
}
suspensionErrorCorrection.setValue( val );
} | void function(float val) { if ( suspensionErrorCorrection == null ) { suspensionErrorCorrection = (SFFloat)getField( STR ); } suspensionErrorCorrection.setValue( val ); } | /** Set the suspensionErrorCorrection field.
* @param val The float to set. */ | Set the suspensionErrorCorrection field | setSuspensionErrorCorrection | {
"repo_name": "Norkart/NK-VirtualGlobe",
"path": "Xj3D/src/java/org/xj3d/sai/external/node/rigidbodyphysics/SAIDoubleAxisHingeJoint.java",
"license": "gpl-2.0",
"size": 15540
} | [
"org.web3d.x3d.sai.SFFloat"
] | import org.web3d.x3d.sai.SFFloat; | import org.web3d.x3d.sai.*; | [
"org.web3d.x3d"
] | org.web3d.x3d; | 259,467 |
@Test
public void testCloseWithoutStream() throws Exception {
IStreamDecoder decoder = new TestStreamDecoder(testData);
Assert.assertNull(decoder.getInputStream());
// Make sure nothing happens
decoder.close();
} | void function() throws Exception { IStreamDecoder decoder = new TestStreamDecoder(testData); Assert.assertNull(decoder.getInputStream()); decoder.close(); } | /**
* Test the close method without a stream.
*
* @throws Exception Should not throw an exception.
*/ | Test the close method without a stream | testCloseWithoutStream | {
"repo_name": "krotscheck/data-file-reader",
"path": "data-file-reader-base/src/test/java/net/krotscheck/dfr/stream/AbstractStreamDecoderTest.java",
"license": "apache-2.0",
"size": 4540
} | [
"net.krotscheck.test.dfr.TestStreamDecoder",
"org.junit.Assert"
] | import net.krotscheck.test.dfr.TestStreamDecoder; import org.junit.Assert; | import net.krotscheck.test.dfr.*; import org.junit.*; | [
"net.krotscheck.test",
"org.junit"
] | net.krotscheck.test; org.junit; | 2,357,416 |
int[] getOutputTensorShape(int outputIndex) {
Tensor tensor = getOutputTensor(outputIndex);
return getShape(tensor);
} | int[] getOutputTensorShape(int outputIndex) { Tensor tensor = getOutputTensor(outputIndex); return getShape(tensor); } | /**
* Gets shape of the output tensor with {@code outputIndex}.
*
* @param outputIndex The index of the desired outtput tensor.
*/ | Gets shape of the output tensor with outputIndex | getOutputTensorShape | {
"repo_name": "chromium/chromium",
"path": "third_party/tflite_support/src/tensorflow_lite_support/metadata/java/src/java/org/tensorflow/lite/support/metadata/ModelInfo.java",
"license": "bsd-3-clause",
"size": 10276
} | [
"org.tensorflow.lite.schema.Tensor"
] | import org.tensorflow.lite.schema.Tensor; | import org.tensorflow.lite.schema.*; | [
"org.tensorflow.lite"
] | org.tensorflow.lite; | 504,151 |
void addDataCollection(Map<String, List<Object>> result);
| void addDataCollection(Map<String, List<Object>> result); | /**
* Updates the plot by adding the new data.
*
* @param result a map containing new data
*/ | Updates the plot by adding the new data | addDataCollection | {
"repo_name": "crisis-economics/CRISIS",
"path": "CRISIS/src/eu/crisis_economics/abm/dashboard/plot/DynamicPlot.java",
"license": "gpl-3.0",
"size": 1839
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,893,363 |
@Override
public List<Class<?>> getEnvVarTypeList() {
return envVarTypeList;
} | List<Class<?>> function() { return envVarTypeList; } | /**
* Gets the environment variable type list.
*
* @return the env var type list
*/ | Gets the environment variable type list | getEnvVarTypeList | {
"repo_name": "robward-scisys/sldeditor",
"path": "modules/application/src/main/java/com/sldeditor/filter/v2/envvar/EnvironmentVariableManager.java",
"license": "gpl-3.0",
"size": 12545
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,978,543 |
public static void writeText(String fileName, String text, Charset encoding)
throws IOException {
Path path = Paths.get(fileName);
try (BufferedWriter writer = Files.newBufferedWriter(path, encoding)) {
writer.write(text);
}
} | static void function(String fileName, String text, Charset encoding) throws IOException { Path path = Paths.get(fileName); try (BufferedWriter writer = Files.newBufferedWriter(path, encoding)) { writer.write(text); } } | /**
* Write given text into file.
*
* @param fileName represents file location
* @param text to be written in file
* @param encoding represents Charset use for encoding
*
* @throws IOException Throw IOException
*/ | Write given text into file | writeText | {
"repo_name": "quantxt/NLPAnalytics",
"path": "src/main/java/com/quantxt/io/file/FileUtil.java",
"license": "apache-2.0",
"size": 4900
} | [
"java.io.BufferedWriter",
"java.io.IOException",
"java.nio.charset.Charset",
"java.nio.file.Files",
"java.nio.file.Path",
"java.nio.file.Paths"
] | import java.io.BufferedWriter; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; | import java.io.*; import java.nio.charset.*; import java.nio.file.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 1,432,225 |
public com.google.protobuf.Empty deleteCallSet(com.google.genomics.v1.DeleteCallSetRequest request) {
return blockingUnaryCall(
getChannel(), METHOD_DELETE_CALL_SET, getCallOptions(), request);
} | com.google.protobuf.Empty function(com.google.genomics.v1.DeleteCallSetRequest request) { return blockingUnaryCall( getChannel(), METHOD_DELETE_CALL_SET, getCallOptions(), request); } | /**
* <pre>
* Deletes a call set.
* For the definitions of call sets and other genomics resources, see
* [Fundamentals of Google
* Genomics](https://cloud.google.com/genomics/fundamentals-of-google-genomics)
* </pre>
*/ | <code> Deletes a call set. For the definitions of call sets and other genomics resources, see [Fundamentals of Google Genomics](HREF) </code> | deleteCallSet | {
"repo_name": "speedycontrol/googleapis",
"path": "output/com/google/genomics/v1/VariantServiceV1Grpc.java",
"license": "apache-2.0",
"size": 86208
} | [
"io.grpc.stub.ClientCalls"
] | import io.grpc.stub.ClientCalls; | import io.grpc.stub.*; | [
"io.grpc.stub"
] | io.grpc.stub; | 1,559,999 |
@SuppressWarnings("unchecked")
@Test(expected = CommandInitializationFailedException.class)
public void testCommandFailsIfDestinationDirectoryKeyIsEmpty() throws Exception {
// complete mock execution result setup
EasyMock.replay(executionResult);
// setup context
context.put(DESTINATION_DIR_KEY, "");
context.put(EXECUTIONRESULT_KEY, executionResult);
// execute command
command.execute(context);
// Verify mocks
EasyMock.verify(executionResult);
}
| @SuppressWarnings(STR) @Test(expected = CommandInitializationFailedException.class) void function() throws Exception { EasyMock.replay(executionResult); context.put(DESTINATION_DIR_KEY, ""); context.put(EXECUTIONRESULT_KEY, executionResult); command.execute(context); EasyMock.verify(executionResult); } | /**
* Test that command fails if destination directory is empty.
*/ | Test that command fails if destination directory is empty | testCommandFailsIfDestinationDirectoryKeyIsEmpty | {
"repo_name": "athrane/pineapple",
"path": "modules/pineapple-core/src/test/java/com/alpha/pineapple/command/CopyExampleModulesCommandTest.java",
"license": "gpl-3.0",
"size": 10108
} | [
"com.alpha.pineapple.command.initialization.CommandInitializationFailedException",
"org.easymock.EasyMock",
"org.junit.Test"
] | import com.alpha.pineapple.command.initialization.CommandInitializationFailedException; import org.easymock.EasyMock; import org.junit.Test; | import com.alpha.pineapple.command.initialization.*; import org.easymock.*; import org.junit.*; | [
"com.alpha.pineapple",
"org.easymock",
"org.junit"
] | com.alpha.pineapple; org.easymock; org.junit; | 317,319 |
void addEvents(Collection<Event> events); | void addEvents(Collection<Event> events); | /**
* Add to the accumulated <code>Event</code> to be processed the next time {@link #fire()} is called. After the
* rules are fired on the accumulated <code>Event</code> it will be cleared.
* @param events the events
*/ | Add to the accumulated <code>Event</code> to be processed the next time <code>#fire()</code> is called. After the rules are fired on the accumulated <code>Event</code> it will be cleared | addEvents | {
"repo_name": "jsanda/hawkular-alerts",
"path": "hawkular-alerts-engine/src/main/java/org/hawkular/alerts/engine/service/RulesEngine.java",
"license": "apache-2.0",
"size": 4709
} | [
"java.util.Collection",
"org.hawkular.alerts.api.model.event.Event"
] | import java.util.Collection; import org.hawkular.alerts.api.model.event.Event; | import java.util.*; import org.hawkular.alerts.api.model.event.*; | [
"java.util",
"org.hawkular.alerts"
] | java.util; org.hawkular.alerts; | 1,676,287 |
public com.mozu.api.contracts.productadmin.ProductType getProductType(com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, AuthTicket authTicket) throws Exception
{
MozuClient<com.mozu.api.contracts.productadmin.ProductType> client = com.mozu.api.clients.commerce.catalog.admin.attributedefinition.ProductTypeClient.getProductTypeClient(dataViewMode, productTypeId, authTicket);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | com.mozu.api.contracts.productadmin.ProductType function(com.mozu.api.DataViewMode dataViewMode, Integer productTypeId, AuthTicket authTicket) throws Exception { MozuClient<com.mozu.api.contracts.productadmin.ProductType> client = com.mozu.api.clients.commerce.catalog.admin.attributedefinition.ProductTypeClient.getProductTypeClient(dataViewMode, productTypeId, authTicket); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Retrieves the details of the product type specified in the request.
* <p><pre><code>
* ProductType producttype = new ProductType();
* ProductType productType = producttype.GetProductType(dataViewMode, productTypeId, authTicket);
* </code></pre></p>
* @param productTypeId Identifier of the product type to retrieve.
* @param dataViewMode DataViewMode
* @param authTicket User Auth Ticket
* @return com.mozu.api.contracts.productadmin.ProductType
* @see com.mozu.api.contracts.productadmin.ProductType
*/ | Retrieves the details of the product type specified in the request. <code><code> ProductType producttype = new ProductType(); ProductType productType = producttype.GetProductType(dataViewMode, productTypeId, authTicket); </code></code> | getProductType | {
"repo_name": "carsonreinke/mozu-java-sdk",
"path": "src/main/java/com/mozu/api/resources/commerce/catalog/admin/attributedefinition/ProductTypeResource.java",
"license": "mit",
"size": 7625
} | [
"com.mozu.api.MozuClient",
"com.mozu.api.security.AuthTicket"
] | import com.mozu.api.MozuClient; import com.mozu.api.security.AuthTicket; | import com.mozu.api.*; import com.mozu.api.security.*; | [
"com.mozu.api"
] | com.mozu.api; | 1,180,689 |
public static void mergeDefaults(Map<String, Object> content, Map<String, Object> defaults) {
for (Map.Entry<String, Object> defaultEntry : defaults.entrySet()) {
if (!content.containsKey(defaultEntry.getKey())) {
// copy it over, it does not exists in the content
content.put(defaultEntry.getKey(), defaultEntry.getValue());
} else {
// in the content and in the default, only merge compound ones (maps)
if (content.get(defaultEntry.getKey()) instanceof Map && defaultEntry.getValue() instanceof Map) {
mergeDefaults((Map<String, Object>) content.get(defaultEntry.getKey()), (Map<String, Object>) defaultEntry.getValue());
} else if (content.get(defaultEntry.getKey()) instanceof List && defaultEntry.getValue() instanceof List) {
List<Object> defaultList = (List<Object>) defaultEntry.getValue();
List<Object> contentList = (List<Object>) content.get(defaultEntry.getKey());
if (allListValuesAreMapsOfOne(defaultList) && allListValuesAreMapsOfOne(contentList)) {
// all are in the form of [ {"key1" : {}}, {"key2" : {}} ], merge based on keys
Map<String, Map<String, Object>> processed = new LinkedHashMap<>();
for (Object o : contentList) {
Map<String, Object> map = (Map<String, Object>) o;
Map.Entry<String, Object> entry = map.entrySet().iterator().next();
processed.put(entry.getKey(), map);
}
for (Object o : defaultList) {
Map<String, Object> map = (Map<String, Object>) o;
Map.Entry<String, Object> entry = map.entrySet().iterator().next();
if (processed.containsKey(entry.getKey())) {
mergeDefaults(processed.get(entry.getKey()), map);
} else {
// put the default entries after the content ones.
processed.put(entry.getKey(), map);
}
}
content.put(defaultEntry.getKey(), new ArrayList<>(processed.values()));
} else {
// if both are lists, simply combine them, first the defaults, then the content
// just make sure not to add the same value twice
List<Object> mergedList = new ArrayList<>(defaultList);
for (Object o : contentList) {
if (!mergedList.contains(o)) {
mergedList.add(o);
}
}
content.put(defaultEntry.getKey(), mergedList);
}
}
}
}
} | static void function(Map<String, Object> content, Map<String, Object> defaults) { for (Map.Entry<String, Object> defaultEntry : defaults.entrySet()) { if (!content.containsKey(defaultEntry.getKey())) { content.put(defaultEntry.getKey(), defaultEntry.getValue()); } else { if (content.get(defaultEntry.getKey()) instanceof Map && defaultEntry.getValue() instanceof Map) { mergeDefaults((Map<String, Object>) content.get(defaultEntry.getKey()), (Map<String, Object>) defaultEntry.getValue()); } else if (content.get(defaultEntry.getKey()) instanceof List && defaultEntry.getValue() instanceof List) { List<Object> defaultList = (List<Object>) defaultEntry.getValue(); List<Object> contentList = (List<Object>) content.get(defaultEntry.getKey()); if (allListValuesAreMapsOfOne(defaultList) && allListValuesAreMapsOfOne(contentList)) { Map<String, Map<String, Object>> processed = new LinkedHashMap<>(); for (Object o : contentList) { Map<String, Object> map = (Map<String, Object>) o; Map.Entry<String, Object> entry = map.entrySet().iterator().next(); processed.put(entry.getKey(), map); } for (Object o : defaultList) { Map<String, Object> map = (Map<String, Object>) o; Map.Entry<String, Object> entry = map.entrySet().iterator().next(); if (processed.containsKey(entry.getKey())) { mergeDefaults(processed.get(entry.getKey()), map); } else { processed.put(entry.getKey(), map); } } content.put(defaultEntry.getKey(), new ArrayList<>(processed.values())); } else { List<Object> mergedList = new ArrayList<>(defaultList); for (Object o : contentList) { if (!mergedList.contains(o)) { mergedList.add(o); } } content.put(defaultEntry.getKey(), mergedList); } } } } } | /**
* Merges the defaults provided as the second parameter into the content of the first. Only does recursive merge
* for inner maps.
*/ | Merges the defaults provided as the second parameter into the content of the first. Only does recursive merge for inner maps | mergeDefaults | {
"repo_name": "scorpionvicky/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/common/xcontent/XContentHelper.java",
"license": "apache-2.0",
"size": 23002
} | [
"java.util.ArrayList",
"java.util.LinkedHashMap",
"java.util.List",
"java.util.Map"
] | import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,221,389 |
Code selectByPrimaryKey(Long id); | Code selectByPrimaryKey(Long id); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table code
*
* @mbggenerated Fri Feb 14 17:12:07 CST 2014
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table code | selectByPrimaryKey | {
"repo_name": "kane-chen/mybatisDemo",
"path": "src/main/java/cn/kane/mybatis/unpage/CodeMapper.java",
"license": "gpl-3.0",
"size": 3617
} | [
"cn.kane.mybatis.unpage.Code"
] | import cn.kane.mybatis.unpage.Code; | import cn.kane.mybatis.unpage.*; | [
"cn.kane.mybatis"
] | cn.kane.mybatis; | 2,200,942 |
public boolean contains (CodedValue codedvalue){
return this.codes.contains(codedvalue);
} | boolean function (CodedValue codedvalue){ return this.codes.contains(codedvalue); } | /**
* Check if a codeset is in the TermSet
* @param codedvalue The codeset to check for
* @return <code>true</code> if in the TermSet
*/ | Check if a codeset is in the TermSet | contains | {
"repo_name": "eedrummer/ccr-importer",
"path": "src/java/org/ohd/pophealth/ccr/importer/TermSet.java",
"license": "apache-2.0",
"size": 3979
} | [
"org.ohd.pophealth.json.measuremodel.CodedValue"
] | import org.ohd.pophealth.json.measuremodel.CodedValue; | import org.ohd.pophealth.json.measuremodel.*; | [
"org.ohd.pophealth"
] | org.ohd.pophealth; | 167,390 |
// comparisons
public int compare(XMLGregorianCalendar rhs) {
XMLGregorianCalendar lhs = this;
int result = DatatypeConstants.INDETERMINATE;
XMLGregorianCalendarImpl P = (XMLGregorianCalendarImpl) lhs;
XMLGregorianCalendarImpl Q = (XMLGregorianCalendarImpl) rhs;
if (P.getTimezone() == Q.getTimezone()) {
// Optimization:
// both instances are in same timezone or
// both are FIELD_UNDEFINED.
// Avoid costly normalization of timezone to 'Z' time.
return internalCompare(P, Q);
} else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED &&
Q.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {
// Both instances have different timezones.
// Normalize to UTC time and compare.
P = (XMLGregorianCalendarImpl) P.normalize();
Q = (XMLGregorianCalendarImpl) Q.normalize();
return internalCompare(P, Q);
} else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) {
if (P.getTimezone() != 0) {
P = (XMLGregorianCalendarImpl) P.normalize();
}
// C. step 1
XMLGregorianCalendar MinQ = Q.normalizeToTimezone(DatatypeConstants.MIN_TIMEZONE_OFFSET);
result = internalCompare(P, MinQ);
if (result == DatatypeConstants.LESSER) {
return result;
}
// C. step 2
XMLGregorianCalendar MaxQ = Q.normalizeToTimezone(DatatypeConstants.MAX_TIMEZONE_OFFSET);
result = internalCompare(P, MaxQ);
if (result == DatatypeConstants.GREATER) {
return result;
} else {
// C. step 3
return DatatypeConstants.INDETERMINATE;
}
} else { // Q.getTimezone() != DatatypeConstants.FIELD_UNDEFINED
// P has no timezone and Q does.
if (Q.getTimezone() != 0) {
Q = (XMLGregorianCalendarImpl) Q.normalizeToTimezone(Q.getTimezone());
}
// D. step 1
XMLGregorianCalendar MaxP = P.normalizeToTimezone(DatatypeConstants.MAX_TIMEZONE_OFFSET);
result = internalCompare(MaxP, Q);
if (result == DatatypeConstants.LESSER) {
return result;
}
// D. step 2
XMLGregorianCalendar MinP = P.normalizeToTimezone(DatatypeConstants.MIN_TIMEZONE_OFFSET);
result = internalCompare(MinP, Q);
if (result == DatatypeConstants.GREATER) {
return result;
} else {
// D. step 3
return DatatypeConstants.INDETERMINATE;
}
}
}
| int function(XMLGregorianCalendar rhs) { XMLGregorianCalendar lhs = this; int result = DatatypeConstants.INDETERMINATE; XMLGregorianCalendarImpl P = (XMLGregorianCalendarImpl) lhs; XMLGregorianCalendarImpl Q = (XMLGregorianCalendarImpl) rhs; if (P.getTimezone() == Q.getTimezone()) { return internalCompare(P, Q); } else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED && Q.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) { P = (XMLGregorianCalendarImpl) P.normalize(); Q = (XMLGregorianCalendarImpl) Q.normalize(); return internalCompare(P, Q); } else if (P.getTimezone() != DatatypeConstants.FIELD_UNDEFINED) { if (P.getTimezone() != 0) { P = (XMLGregorianCalendarImpl) P.normalize(); } XMLGregorianCalendar MinQ = Q.normalizeToTimezone(DatatypeConstants.MIN_TIMEZONE_OFFSET); result = internalCompare(P, MinQ); if (result == DatatypeConstants.LESSER) { return result; } XMLGregorianCalendar MaxQ = Q.normalizeToTimezone(DatatypeConstants.MAX_TIMEZONE_OFFSET); result = internalCompare(P, MaxQ); if (result == DatatypeConstants.GREATER) { return result; } else { return DatatypeConstants.INDETERMINATE; } } else { if (Q.getTimezone() != 0) { Q = (XMLGregorianCalendarImpl) Q.normalizeToTimezone(Q.getTimezone()); } XMLGregorianCalendar MaxP = P.normalizeToTimezone(DatatypeConstants.MAX_TIMEZONE_OFFSET); result = internalCompare(MaxP, Q); if (result == DatatypeConstants.LESSER) { return result; } XMLGregorianCalendar MinP = P.normalizeToTimezone(DatatypeConstants.MIN_TIMEZONE_OFFSET); result = internalCompare(MinP, Q); if (result == DatatypeConstants.GREATER) { return result; } else { return DatatypeConstants.INDETERMINATE; } } } | /**
* <p>Compare two instances of W3C XML Schema 1.0 date/time datatypes
* according to partial order relation defined in
* <a href="http://www.w3.org/TR/xmlschema-2/#dateTime-order">W3C XML Schema 1.0 Part 2, Section 3.2.7.3,
* <i>Order relation on dateTime</i></a>.</p>
*
* <p><code>xsd:dateTime</code> datatype field mapping to accessors of
* this class are defined in
* <a href="#datetimefieldmapping">date/time field mapping table</a>.</p>
*
* @param rhs instance of <code>XMLGregorianCalendar</code> to compare
*
* @return the relationship between <code>lhs</code> and <code>rhs</code> as
* {@link DatatypeConstants#LESSER},
* {@link DatatypeConstants#EQUAL},
* {@link DatatypeConstants#GREATER} or
* {@link DatatypeConstants#INDETERMINATE}.
*
* @throws NullPointerException if <code>lhs</code> or <code>rhs</code>
* parameters are null.
*/ | Compare two instances of W3C XML Schema 1.0 date/time datatypes according to partial order relation defined in W3C XML Schema 1.0 Part 2, Section 3.2.7.3, Order relation on dateTime. <code>xsd:dateTime</code> datatype field mapping to accessors of this class are defined in date/time field mapping table | compare | {
"repo_name": "krishna174/Java_C",
"path": "AadharValidation-PFX/src/com/tin/aadhaar/AadhaarAuth/util/XMLGregorianCalendarImpl.java",
"license": "gpl-2.0",
"size": 116283
} | [
"javax.xml.datatype.DatatypeConstants",
"javax.xml.datatype.XMLGregorianCalendar"
] | import javax.xml.datatype.DatatypeConstants; import javax.xml.datatype.XMLGregorianCalendar; | import javax.xml.datatype.*; | [
"javax.xml"
] | javax.xml; | 693,607 |
Jenkins jenkins = j.jenkins;
FreeStyleProject p = jenkins.createProject(FreeStyleProject.class, "foo");
p.setDescription("Hello World");
FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0));
b.setDescription("This is my build");
// update on disk representation
File f = p.getConfigFile().getFile();
FileUtils.writeStringToFile(f, FileUtils.readFileToString(f).replaceAll("Hello World", "Good Evening"));
// reload away
p.doReload();
assertEquals("Good Evening", p.getDescription());
FreeStyleBuild b2 = p.getBuildByNumber(1);
assertNotEquals(b, b2); // should be different object
assertEquals(b.getDescription(), b2.getDescription()); // but should have the same properties
} | Jenkins jenkins = j.jenkins; FreeStyleProject p = jenkins.createProject(FreeStyleProject.class, "foo"); p.setDescription(STR); FreeStyleBuild b = j.assertBuildStatusSuccess(p.scheduleBuild2(0)); b.setDescription(STR); File f = p.getConfigFile().getFile(); FileUtils.writeStringToFile(f, FileUtils.readFileToString(f).replaceAll(STR, STR)); p.doReload(); assertEquals(STR, p.getDescription()); FreeStyleBuild b2 = p.getBuildByNumber(1); assertNotEquals(b, b2); assertEquals(b.getDescription(), b2.getDescription()); } | /**
* Tests the reload functionality
*/ | Tests the reload functionality | reload | {
"repo_name": "andresrc/jenkins",
"path": "test/src/test/java/hudson/model/AbstractItemTest.java",
"license": "mit",
"size": 6235
} | [
"java.io.File",
"org.apache.commons.io.FileUtils",
"org.junit.Assert"
] | import java.io.File; import org.apache.commons.io.FileUtils; import org.junit.Assert; | import java.io.*; import org.apache.commons.io.*; import org.junit.*; | [
"java.io",
"org.apache.commons",
"org.junit"
] | java.io; org.apache.commons; org.junit; | 2,477,253 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.