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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Basic( optional = true )
@Type(type = "com.servinglynk.hmis.warehouse.enums.SchoolStatusEnumType")
@Column( name = "school_status" )
public SchoolStatusEnum getSchoolStatus() {
return this.schoolStatus;
} | @Basic( optional = true ) @Type(type = STR) @Column( name = STR ) SchoolStatusEnum function() { return this.schoolStatus; } | /**
* Return the value associated with the column: schoolStatus.
* @return A Integer object (this.schoolStatus)
*/ | Return the value associated with the column: schoolStatus | getSchoolStatus | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "hmis-model-v2014/src/main/java/com/servinglynk/hmis/warehouse/model/v2014/Schoolstatus.java",
"license": "mpl-2.0",
"size": 9262
} | [
"com.servinglynk.hmis.warehouse.enums.SchoolStatusEnum",
"javax.persistence.Basic",
"javax.persistence.Column",
"org.hibernate.annotations.Type"
] | import com.servinglynk.hmis.warehouse.enums.SchoolStatusEnum; import javax.persistence.Basic; import javax.persistence.Column; import org.hibernate.annotations.Type; | import com.servinglynk.hmis.warehouse.enums.*; import javax.persistence.*; import org.hibernate.annotations.*; | [
"com.servinglynk.hmis",
"javax.persistence",
"org.hibernate.annotations"
] | com.servinglynk.hmis; javax.persistence; org.hibernate.annotations; | 1,157,577 |
public static boolean isHoliday(Date date) {
return isHoliday(dateToCalendar(date));
} | static boolean function(Date date) { return isHoliday(dateToCalendar(date)); } | /**
* Check if given Date object is a holiday.
*
* @param date
* The Date to check.
* @return true if holiday, false otherwise.
*/ | Check if given Date object is a holiday | isHoliday | {
"repo_name": "bekkopen/NoCommons",
"path": "src/main/java/no/bekk/bekkopen/date/NorwegianDateUtil.java",
"license": "mit",
"size": 7571
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 556,252 |
@ApiModelProperty(value = "")
public Integer getNumber() {
return number;
} | @ApiModelProperty(value = "") Integer function() { return number; } | /**
* Get number
* @return number
**/ | Get number | getNumber | {
"repo_name": "knetikmedia/knetikcloud-java-client",
"path": "src/main/java/com/knetikcloud/model/PageResourceQuestionResource.java",
"license": "apache-2.0",
"size": 7545
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 2,156,950 |
JSONObject jsonObject = new JSONObject();
if (data==null) {
return jsonObject;
} else {
char prefix = 'x';
for (int i = 0; i < data.length; i++) {
jsonObject.put(valueOf(prefix), data[i]);
if (prefix == 'z') {
prefix = 'a';
} else {
prefix++;
}
}
//Log.d("JSON", jsonObject.toString());
return jsonObject;
}
} | JSONObject jsonObject = new JSONObject(); if (data==null) { return jsonObject; } else { char prefix = 'x'; for (int i = 0; i < data.length; i++) { jsonObject.put(valueOf(prefix), data[i]); if (prefix == 'z') { prefix = 'a'; } else { prefix++; } } return jsonObject; } } | /**
* Converts input float[] to JSONObject
* @param data
* @return
* @throws JSONException
*/ | Converts input float[] to JSONObject | convertToJSON | {
"repo_name": "OhtuWearable/WearableDataServer",
"path": "app/src/main/java/com/ohtu/wearable/wearabledataservice/sensors/JSONConverter.java",
"license": "apache-2.0",
"size": 2402
} | [
"org.json.JSONObject"
] | import org.json.JSONObject; | import org.json.*; | [
"org.json"
] | org.json; | 336,948 |
public List<PQTreeNode> findLeavesOf(List<E> virtualEdges){
List<PQTreeNode> ret = new ArrayList<PQTreeNode>();
for (E e : virtualEdges){
if (getVertexByContent(e.getOrigin()).getType() == PQNodeType.LEAF)
ret.add(getVertexByContent(e.getOrigin()));
else if (getVertexByContent(e.getDestination()).getType() == PQNodeType.LEAF)
ret.add(getVertexByContent(e.getDestination()));
}
return ret;
}
/**
* Finds all descendants of a tree node
* @param node Node
* @return A list of descendants of {@code node} | List<PQTreeNode> function(List<E> virtualEdges){ List<PQTreeNode> ret = new ArrayList<PQTreeNode>(); for (E e : virtualEdges){ if (getVertexByContent(e.getOrigin()).getType() == PQNodeType.LEAF) ret.add(getVertexByContent(e.getOrigin())); else if (getVertexByContent(e.getDestination()).getType() == PQNodeType.LEAF) ret.add(getVertexByContent(e.getDestination())); } return ret; } /** * Finds all descendants of a tree node * @param node Node * @return A list of descendants of {@code node} | /**
* Finds all leaves which are destination or source of the edge
* belonging to the provided list
* @param virtualEdges A list of virtual edges
* @return A list of leaves which are either source or destination nodes of edges
* belonging to {@code virtualEdges} list
*/ | Finds all leaves which are destination or source of the edge belonging to the provided list | findLeavesOf | {
"repo_name": "renatav/GraphDrawing",
"path": "GraphDrawingTheory/src/graph/tree/pq/PQTree.java",
"license": "mit",
"size": 5678
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,059,098 |
protected String sourceUrl(String special, String source, String context, boolean macroExpansion, boolean passPid, String pid, String sakaiPropertiesUrlKey)
{
String rv = StringUtils.trimToNull(source);
// if marked for "site", use the site intro from the properties
if (SPECIAL_SITE.equals(special))
{
rv = StringUtils.trimToNull(getLocalizedURL("server.info.url"));
}
// if marked for "workspace", use the "user" site info from the properties
else if (SPECIAL_WORKSPACE.equals(special))
{
rv = StringUtils.trimToNull(getLocalizedURL("myworkspace.info.url"));
}
// if marked for "worksite", use the setting from the site's definition
else if (SPECIAL_WORKSITE.equals(special))
{
// set the url to the site of this request's config'ed url
try
{
// get the site's info URL, if defined
Site s = SiteService.getSite(context);
rv = StringUtils.trimToNull(s.getInfoUrlFull());
// compute the info url for the site if it has no specific InfoUrl
if (rv == null)
{
// access will show the site description or title...
rv = ServerConfigurationService.getAccessUrl() + s.getReference();
}
}
catch (Exception any)
{
}
}
else if (sakaiPropertiesUrlKey != null && sakaiPropertiesUrlKey.length() > 1)
{
// set the url to a string defined in sakai.properties
rv = StringUtils.trimToNull(ServerConfigurationService.getString(sakaiPropertiesUrlKey));
}
// if it's not special, and we have no value yet, set it to the webcontent instruction page, as configured
if (rv == null || rv.equals("http://") || rv.equals("https://"))
{
rv = StringUtils.trimToNull(getLocalizedURL("webcontent.instructions.url"));
}
if (rv != null)
{
// accept a partial reference url (i.e. "/content/group/sakai/test.gif"), convert to full url
rv = convertReferenceUrl(rv);
// pass the PID through on the URL, IF configured to do so
if (passPid)
{
if (rv.indexOf("?") < 0)
{
rv = rv + "?";
}
else
{
rv = rv + "&";
}
rv = rv + "pid=" + pid;
}
if (macroExpansion)
{
rv = doMacroExpansion(rv);
}
}
return rv;
} | String function(String special, String source, String context, boolean macroExpansion, boolean passPid, String pid, String sakaiPropertiesUrlKey) { String rv = StringUtils.trimToNull(source); if (SPECIAL_SITE.equals(special)) { rv = StringUtils.trimToNull(getLocalizedURL(STR)); } else if (SPECIAL_WORKSPACE.equals(special)) { rv = StringUtils.trimToNull(getLocalizedURL(STR)); } else if (SPECIAL_WORKSITE.equals(special)) { try { Site s = SiteService.getSite(context); rv = StringUtils.trimToNull(s.getInfoUrlFull()); if (rv == null) { rv = ServerConfigurationService.getAccessUrl() + s.getReference(); } } catch (Exception any) { } } else if (sakaiPropertiesUrlKey != null && sakaiPropertiesUrlKey.length() > 1) { rv = StringUtils.trimToNull(ServerConfigurationService.getString(sakaiPropertiesUrlKey)); } if (rv == null rv.equals(STRwebcontent.instructions.urlSTR?STR?STR&STRpid=" + pid; } if (macroExpansion) { rv = doMacroExpansion(rv); } } return rv; } | /**
* Compute the actual URL we will used, based on the configuration special and source URLs
*/ | Compute the actual URL we will used, based on the configuration special and source URLs | sourceUrl | {
"repo_name": "marktriggs/nyu-sakai-10.4",
"path": "web/web-tool/tool/src/java/org/sakaiproject/web/tool/IFrameAction.java",
"license": "apache-2.0",
"size": 36694
} | [
"org.apache.commons.lang.StringUtils",
"org.sakaiproject.component.cover.ServerConfigurationService",
"org.sakaiproject.site.api.Site",
"org.sakaiproject.site.cover.SiteService"
] | import org.apache.commons.lang.StringUtils; import org.sakaiproject.component.cover.ServerConfigurationService; import org.sakaiproject.site.api.Site; import org.sakaiproject.site.cover.SiteService; | import org.apache.commons.lang.*; import org.sakaiproject.component.cover.*; import org.sakaiproject.site.api.*; import org.sakaiproject.site.cover.*; | [
"org.apache.commons",
"org.sakaiproject.component",
"org.sakaiproject.site"
] | org.apache.commons; org.sakaiproject.component; org.sakaiproject.site; | 1,548,334 |
public void addReceiveFileTransfer(IFileTransferSession fileTransferSession) {
mReceiveFileTransferManager.addReceiveFileTransfer(fileTransferSession);
} | void function(IFileTransferSession fileTransferSession) { mReceiveFileTransferManager.addReceiveFileTransfer(fileTransferSession); } | /**
* Handle a file transfer invitation
*/ | Handle a file transfer invitation | addReceiveFileTransfer | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "mediatek/packages/apps/RCSe/core/src/com/mediatek/rcse/mvc/One2OneChat.java",
"license": "gpl-2.0",
"size": 95982
} | [
"com.orangelabs.rcs.service.api.client.messaging.IFileTransferSession"
] | import com.orangelabs.rcs.service.api.client.messaging.IFileTransferSession; | import com.orangelabs.rcs.service.api.client.messaging.*; | [
"com.orangelabs.rcs"
] | com.orangelabs.rcs; | 1,701,096 |
@JsonProperty("category")
String category(); | @JsonProperty(STR) String category(); | /**
* Category of the result.
* @return String.
*/ | Category of the result | category | {
"repo_name": "opencharles/charles-rest",
"path": "src/main/java/com/amihaiemil/charles/rest/model/SearchResult.java",
"license": "bsd-3-clause",
"size": 2376
} | [
"com.fasterxml.jackson.annotation.JsonProperty"
] | import com.fasterxml.jackson.annotation.JsonProperty; | import com.fasterxml.jackson.annotation.*; | [
"com.fasterxml.jackson"
] | com.fasterxml.jackson; | 750,037 |
final DataContext dataContext = anActionEvent.getDataContext();
final Project project = CommonDataKeys.PROJECT.getData(dataContext);
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
if (project == null || editor == null) {
return;
}
execute(editor, project);
} | final DataContext dataContext = anActionEvent.getDataContext(); final Project project = CommonDataKeys.PROJECT.getData(dataContext); Editor editor = CommonDataKeys.EDITOR.getData(dataContext); if (project == null editor == null) { return; } execute(editor, project); } | /**
* Action performed from Intellij
* @param anActionEvent
*/ | Action performed from Intellij | actionPerformed | {
"repo_name": "asebak/ui5-intellij-plugin",
"path": "src/com/atsebak/ui5/actions/search/UI5ApiSearch.java",
"license": "apache-2.0",
"size": 1663
} | [
"com.intellij.openapi.actionSystem.CommonDataKeys",
"com.intellij.openapi.actionSystem.DataContext",
"com.intellij.openapi.editor.Editor",
"com.intellij.openapi.project.Project"
] | import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.actionSystem.DataContext; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.project.Project; | import com.intellij.openapi.*; import com.intellij.openapi.editor.*; import com.intellij.openapi.project.*; | [
"com.intellij.openapi"
] | com.intellij.openapi; | 398,612 |
ListenableFuture<Boolean> setTopology(
TopologyAPI.Topology topology, String topologyName); | ListenableFuture<Boolean> setTopology( TopologyAPI.Topology topology, String topologyName); | /**
* Set the topology definition for the given topology
*
* @return Boolean - Success or Failure
*/ | Set the topology definition for the given topology | setTopology | {
"repo_name": "lucperkins/heron",
"path": "heron/spi/src/java/com/twitter/heron/spi/statemgr/IStateManager.java",
"license": "apache-2.0",
"size": 9653
} | [
"com.google.common.util.concurrent.ListenableFuture",
"com.twitter.heron.api.generated.TopologyAPI"
] | import com.google.common.util.concurrent.ListenableFuture; import com.twitter.heron.api.generated.TopologyAPI; | import com.google.common.util.concurrent.*; import com.twitter.heron.api.generated.*; | [
"com.google.common",
"com.twitter.heron"
] | com.google.common; com.twitter.heron; | 1,069,188 |
public final void writeDGCAck(UID uid) throws ProtocolException {
try {
new Message(uid).writeExternal(out);
} catch (IOException e) {
throw new ProtocolException("Error while sending DGCAck", e);
}
}
| final void function(UID uid) throws ProtocolException { try { new Message(uid).writeExternal(out); } catch (IOException e) { throw new ProtocolException(STR, e); } } | /**
* Constructs a message with the <code>uid</code> and then, writes the
* DGCAck.
*
* @param uid
* a unique identifier
* @throws ProtocolException
* if an I/O exceptions ocurrs
*/ | Constructs a message with the <code>uid</code> and then, writes the DGCAck | writeDGCAck | {
"repo_name": "freeVM/freeVM",
"path": "enhanced/archive/classlib/modules/rmi2.1.4/src/main/java/org/apache/harmony/rmi/internal/transport/jrmp/ClientProtocolHandler.java",
"license": "apache-2.0",
"size": 6636
} | [
"java.io.IOException",
"org.apache.harmony.rmi.internal.transport.ProtocolException"
] | import java.io.IOException; import org.apache.harmony.rmi.internal.transport.ProtocolException; | import java.io.*; import org.apache.harmony.rmi.internal.transport.*; | [
"java.io",
"org.apache.harmony"
] | java.io; org.apache.harmony; | 738,535 |
private static void readLog(final XMLStreamReader reader, final Configuration configuration,
final Executable executable, final ActionsContainer parent)
throws XMLStreamException {
Log log = new Log();
log.setExpr(readAV(reader, ATTR_EXPR));
log.setLabel(readAV(reader, ATTR_LABEL));
readNamespaces(configuration, log);
log.setParent(executable);
if (parent != null) {
parent.addAction(log);
} else {
executable.addAction(log);
}
skipToEndElement(reader);
} | static void function(final XMLStreamReader reader, final Configuration configuration, final Executable executable, final ActionsContainer parent) throws XMLStreamException { Log log = new Log(); log.setExpr(readAV(reader, ATTR_EXPR)); log.setLabel(readAV(reader, ATTR_LABEL)); readNamespaces(configuration, log); log.setParent(executable); if (parent != null) { parent.addAction(log); } else { executable.addAction(log); } skipToEndElement(reader); } | /**
* Read the contents of this <log> element.
*
* @param reader The {@link XMLStreamReader} providing the SCXML document to parse.
* @param configuration The {@link Configuration} to use while parsing.
* @param executable The parent {@link Executable} for this action.
* @param parent The optional parent {@link ActionsContainer} if this action is a child of one.
*
* @throws XMLStreamException An exception processing the underlying {@link XMLStreamReader}.
*/ | Read the contents of this <log> element | readLog | {
"repo_name": "wmudge/commons-scxml",
"path": "src/main/java/org/apache/commons/scxml2/io/SCXMLReader.java",
"license": "apache-2.0",
"size": 138470
} | [
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader",
"org.apache.commons.scxml2.model.ActionsContainer",
"org.apache.commons.scxml2.model.Executable",
"org.apache.commons.scxml2.model.Log"
] | import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.commons.scxml2.model.ActionsContainer; import org.apache.commons.scxml2.model.Executable; import org.apache.commons.scxml2.model.Log; | import javax.xml.stream.*; import org.apache.commons.scxml2.model.*; | [
"javax.xml",
"org.apache.commons"
] | javax.xml; org.apache.commons; | 1,684,708 |
public Timestamp getUpdated();
public static final String COLUMNNAME_UpdatedBy = "UpdatedBy"; | Timestamp function(); public static final String COLUMNNAME_UpdatedBy = STR; | /** Get Updated.
* Date this record was updated
*/ | Get Updated. Date this record was updated | getUpdated | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.adempiere.adempiere/base/src/main/java-gen/org/compiere/model/I_CM_AccessStage.java",
"license": "gpl-2.0",
"size": 4428
} | [
"java.sql.Timestamp"
] | import java.sql.Timestamp; | import java.sql.*; | [
"java.sql"
] | java.sql; | 60,910 |
public void setChunk(ChunkCoordIntPair value) {
handle.getChunkCoordIntPairs().write(0, value);
} | void function(ChunkCoordIntPair value) { handle.getChunkCoordIntPairs().write(0, value); } | /**
* Set the chunk that has been altered.
* @param value - new value
*/ | Set the chunk that has been altered | setChunk | {
"repo_name": "pekomiya/AirRide",
"path": "src/main/java/com/comphenix/packetwrapper/WrapperPlayServerMultiBlockChange.java",
"license": "lgpl-3.0",
"size": 2364
} | [
"com.comphenix.protocol.wrappers.ChunkCoordIntPair"
] | import com.comphenix.protocol.wrappers.ChunkCoordIntPair; | import com.comphenix.protocol.wrappers.*; | [
"com.comphenix.protocol"
] | com.comphenix.protocol; | 2,050,432 |
public static void closeRegionAndWAL(final Region r) throws IOException {
closeRegionAndWAL((HRegion)r);
} | static void function(final Region r) throws IOException { closeRegionAndWAL((HRegion)r); } | /**
* Close both the region {@code r} and it's underlying WAL. For use in tests.
*/ | Close both the region r and it's underlying WAL. For use in tests | closeRegionAndWAL | {
"repo_name": "francisliu/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/HBaseTestingUtility.java",
"license": "apache-2.0",
"size": 169730
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.regionserver.HRegion",
"org.apache.hadoop.hbase.regionserver.Region"
] | import java.io.IOException; import org.apache.hadoop.hbase.regionserver.HRegion; import org.apache.hadoop.hbase.regionserver.Region; | import java.io.*; import org.apache.hadoop.hbase.regionserver.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,283,362 |
@Test
public void testGetValue_1()
throws Exception {
ScriptFilterAction fixture = new ScriptFilterAction();
fixture.setKey("");
fixture.setValue("");
fixture.setAction(ScriptFilterActionType.add);
fixture.setScope("");
String result = fixture.getValue();
assertEquals("", result);
} | void function() throws Exception { ScriptFilterAction fixture = new ScriptFilterAction(); fixture.setKey(STRSTRSTR", result); } | /**
* Run the String getValue() method test.
*
* @throws Exception
*
* @generatedBy CodePro at 12/15/14 1:34 PM
*/ | Run the String getValue() method test | testGetValue_1 | {
"repo_name": "intuit/Tank",
"path": "data_model/src/test/java/com/intuit/tank/project/ScriptFilterActionTest.java",
"license": "epl-1.0",
"size": 9476
} | [
"com.intuit.tank.project.ScriptFilterAction"
] | import com.intuit.tank.project.ScriptFilterAction; | import com.intuit.tank.project.*; | [
"com.intuit.tank"
] | com.intuit.tank; | 2,021,569 |
public PrivateMessage selectById(PrivateMessage pm) ;
| PrivateMessage function(PrivateMessage pm) ; | /**
* Gets a <code>PrivateMessage</code> by its id.
*
* @param pm A <code>PrivateMessage</code> instance containing the pm's id
* to retrieve
* @return The pm contents
*/ | Gets a <code>PrivateMessage</code> by its id | selectById | {
"repo_name": "dalinhuang/suduforum",
"path": "src/net/jforum/dao/PrivateMessageDAO.java",
"license": "bsd-3-clause",
"size": 3569
} | [
"net.jforum.entities.PrivateMessage"
] | import net.jforum.entities.PrivateMessage; | import net.jforum.entities.*; | [
"net.jforum.entities"
] | net.jforum.entities; | 1,572,778 |
public static java.util.List extractWardStayList(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.WardStayVoCollection voCollection)
{
return extractWardStayList(domainFactory, voCollection, null, new HashMap());
}
| static java.util.List function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.WardStayVoCollection voCollection) { return extractWardStayList(domainFactory, voCollection, null, new HashMap()); } | /**
* Create the ims.core.admin.pas.domain.objects.WardStay list from the value object collection.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param voCollection - the collection of value objects
*/ | Create the ims.core.admin.pas.domain.objects.WardStay list from the value object collection | extractWardStayList | {
"repo_name": "open-health-hub/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/WardStayVoAssembler.java",
"license": "agpl-3.0",
"size": 19137
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 1,930,397 |
public Artifact linkerObjList() {
return appendExtension("-linker.objlist");
} | Artifact function() { return appendExtension(STR); } | /**
* The .objlist file, which contains a list of paths of object files to archive and is read by
* clang (via -filelist flag) in the link action (for binary creation).
*/ | The .objlist file, which contains a list of paths of object files to archive and is read by clang (via -filelist flag) in the link action (for binary creation) | linkerObjList | {
"repo_name": "mikelalcon/bazel",
"path": "src/main/java/com/google/devtools/build/lib/rules/objc/IntermediateArtifacts.java",
"license": "apache-2.0",
"size": 15694
} | [
"com.google.devtools.build.lib.actions.Artifact"
] | import com.google.devtools.build.lib.actions.Artifact; | import com.google.devtools.build.lib.actions.*; | [
"com.google.devtools"
] | com.google.devtools; | 1,196,900 |
private static boolean isElementOfType(Element element, java.lang.Class<? extends Element> type){
return element.eClass().getInstanceClass() == type;
} | static boolean function(Element element, java.lang.Class<? extends Element> type){ return element.eClass().getInstanceClass() == type; } | /**
* Checks if an {@link Element} is of type
* @param <T>
* @param element - Element that is to be analyzed
* @param type - The type
* @return Returns true if the Element is of type
*/ | Checks if an <code>Element</code> is of type | isElementOfType | {
"repo_name": "ELTE-Soft/txtUML",
"path": "dev/plugins/hu.elte.txtuml.export.papyrus/src/hu/elte/txtuml/export/papyrus/UMLModelManager.java",
"license": "epl-1.0",
"size": 4597
} | [
"org.eclipse.uml2.uml.Element"
] | import org.eclipse.uml2.uml.Element; | import org.eclipse.uml2.uml.*; | [
"org.eclipse.uml2"
] | org.eclipse.uml2; | 2,164,773 |
@Override
public void addChangeListener(AnnotationChangeListener listener) {
this.listenerList.add(AnnotationChangeListener.class, listener);
} | void function(AnnotationChangeListener listener) { this.listenerList.add(AnnotationChangeListener.class, listener); } | /**
* Registers an object to receive notification of changes to the
* annotation.
*
* @param listener the object to register.
*
* @see #removeChangeListener(AnnotationChangeListener)
*/ | Registers an object to receive notification of changes to the annotation | addChangeListener | {
"repo_name": "jfree/jfreechart",
"path": "src/main/java/org/jfree/chart/annotations/AbstractAnnotation.java",
"license": "lgpl-2.1",
"size": 6884
} | [
"org.jfree.chart.event.AnnotationChangeListener"
] | import org.jfree.chart.event.AnnotationChangeListener; | import org.jfree.chart.event.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 279,799 |
protected Authentication getAuthenticationSatisfiedByPolicy(final Authentication authentication, final ServiceContext context)
throws AbstractTicketException {
final ContextualAuthenticationPolicy<ServiceContext> policy = this.serviceContextAuthenticationPolicyFactory.createPolicy(context);
if (policy.isSatisfiedBy(authentication)) {
return authentication;
}
throw new UnsatisfiedAuthenticationPolicyException(policy);
} | Authentication function(final Authentication authentication, final ServiceContext context) throws AbstractTicketException { final ContextualAuthenticationPolicy<ServiceContext> policy = this.serviceContextAuthenticationPolicyFactory.createPolicy(context); if (policy.isSatisfiedBy(authentication)) { return authentication; } throw new UnsatisfiedAuthenticationPolicyException(policy); } | /**
* Gets the authentication satisfied by policy.
*
* @param authentication the authentication
* @param context the context
* @return the authentication satisfied by policy
* @throws AbstractTicketException the ticket exception
*/ | Gets the authentication satisfied by policy | getAuthenticationSatisfiedByPolicy | {
"repo_name": "gabedwrds/cas",
"path": "core/cas-server-core/src/main/java/org/apereo/cas/AbstractCentralAuthenticationService.java",
"license": "apache-2.0",
"size": 13646
} | [
"org.apereo.cas.authentication.Authentication",
"org.apereo.cas.authentication.ContextualAuthenticationPolicy",
"org.apereo.cas.services.ServiceContext",
"org.apereo.cas.ticket.AbstractTicketException",
"org.apereo.cas.ticket.UnsatisfiedAuthenticationPolicyException"
] | import org.apereo.cas.authentication.Authentication; import org.apereo.cas.authentication.ContextualAuthenticationPolicy; import org.apereo.cas.services.ServiceContext; import org.apereo.cas.ticket.AbstractTicketException; import org.apereo.cas.ticket.UnsatisfiedAuthenticationPolicyException; | import org.apereo.cas.authentication.*; import org.apereo.cas.services.*; import org.apereo.cas.ticket.*; | [
"org.apereo.cas"
] | org.apereo.cas; | 2,594,882 |
private Graph<String> buildGraph(HashMap<String, HashSet<String>> edges) {
Graph<String> result = new Graph<String>();
for (Entry<String, HashSet<String>> entry : edges.entrySet()) {
// add Node
result.addNode(entry.getKey());
// add Link
for (String to : entry.getValue()) {
result.addLink(new Link<String>(entry.getKey(), to));
result.addLink(new Link<String>(to, entry.getKey()));
}
}
return result;
} | Graph<String> function(HashMap<String, HashSet<String>> edges) { Graph<String> result = new Graph<String>(); for (Entry<String, HashSet<String>> entry : edges.entrySet()) { result.addNode(entry.getKey()); for (String to : entry.getValue()) { result.addLink(new Link<String>(entry.getKey(), to)); result.addLink(new Link<String>(to, entry.getKey())); } } return result; } | /**
* Method to construct the {@link Graph} we want to search in.
*
* @param edges
* the accesses from one Box.
* @return the {@link Graph} to search in.
*/ | Method to construct the <code>Graph</code> we want to search in | buildGraph | {
"repo_name": "ELTE-Soft/txtUML",
"path": "dev/plugins/hu.elte.txtuml.layout.visualizer/src/hu/elte/txtuml/layout/visualizer/algorithms/DefaultStatements.java",
"license": "epl-1.0",
"size": 8643
} | [
"hu.elte.txtuml.layout.visualizer.algorithms.links.graphsearchhelpers.Graph",
"hu.elte.txtuml.layout.visualizer.algorithms.links.graphsearchhelpers.Link",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map"
] | import hu.elte.txtuml.layout.visualizer.algorithms.links.graphsearchhelpers.Graph; import hu.elte.txtuml.layout.visualizer.algorithms.links.graphsearchhelpers.Link; import java.util.HashMap; import java.util.HashSet; import java.util.Map; | import hu.elte.txtuml.layout.visualizer.algorithms.links.graphsearchhelpers.*; import java.util.*; | [
"hu.elte.txtuml",
"java.util"
] | hu.elte.txtuml; java.util; | 331,246 |
@Nullable
HttpData content(); | HttpData content(); | /**
* Returns the content of the file.
*
* @return the content, or {@code null} if the file does not exist.
*/ | Returns the content of the file | content | {
"repo_name": "minwoox/armeria",
"path": "core/src/main/java/com/linecorp/armeria/server/file/AggregatedHttpFile.java",
"license": "apache-2.0",
"size": 4545
} | [
"com.linecorp.armeria.common.HttpData"
] | import com.linecorp.armeria.common.HttpData; | import com.linecorp.armeria.common.*; | [
"com.linecorp.armeria"
] | com.linecorp.armeria; | 1,106,037 |
private void fixSpannedWithSpaces(SpannableStringBuilder builder, int widthMeasureSpec, int heightMeasureSpec) {
long startFix = System.currentTimeMillis();
FixingResult result = addSpacesAroundSpansUntilFixed(builder, widthMeasureSpec, heightMeasureSpec);
if (result.fixed) {
removeUnneededSpaces(widthMeasureSpec, heightMeasureSpec, builder, result);
} else {
fallbackToString(widthMeasureSpec, heightMeasureSpec);
}
if (BuildConfig.DEBUG) {
long fixDuration = System.currentTimeMillis() - startFix;
Log.d(TAG, "fixSpannedWithSpaces() duration in ms: " + fixDuration);
}
} | void function(SpannableStringBuilder builder, int widthMeasureSpec, int heightMeasureSpec) { long startFix = System.currentTimeMillis(); FixingResult result = addSpacesAroundSpansUntilFixed(builder, widthMeasureSpec, heightMeasureSpec); if (result.fixed) { removeUnneededSpaces(widthMeasureSpec, heightMeasureSpec, builder, result); } else { fallbackToString(widthMeasureSpec, heightMeasureSpec); } if (BuildConfig.DEBUG) { long fixDuration = System.currentTimeMillis() - startFix; Log.d(TAG, STR + fixDuration); } } | /**
* Add spaces around spans until the text is fixed, and then removes the
* unneeded spaces
*/ | Add spaces around spans until the text is fixed, and then removes the unneeded spaces | fixSpannedWithSpaces | {
"repo_name": "genious7/FanFictionReader",
"path": "fanfictionReader/src/main/java/info/piwai/android/JellyBeanSpanFixTextView.java",
"license": "gpl-3.0",
"size": 6832
} | [
"android.text.SpannableStringBuilder",
"android.util.Log",
"com.spicymango.fanfictionreader.BuildConfig"
] | import android.text.SpannableStringBuilder; import android.util.Log; import com.spicymango.fanfictionreader.BuildConfig; | import android.text.*; import android.util.*; import com.spicymango.fanfictionreader.*; | [
"android.text",
"android.util",
"com.spicymango.fanfictionreader"
] | android.text; android.util; com.spicymango.fanfictionreader; | 442,483 |
//-----------------------------------------------------------------------
int checkValidYear(long prolepticYear) {
if (prolepticYear < getMinimumYear() || prolepticYear > getMaximumYear()) {
throw new DateTimeException("Invalid Hijrah year: " + prolepticYear);
}
return (int) prolepticYear;
} | int checkValidYear(long prolepticYear) { if (prolepticYear < getMinimumYear() prolepticYear > getMaximumYear()) { throw new DateTimeException(STR + prolepticYear); } return (int) prolepticYear; } | /**
* Check the validity of a year.
*
* @param prolepticYear the year to check
*/ | Check the validity of a year | checkValidYear | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/java/time/chrono/HijrahChronology.java",
"license": "apache-2.0",
"size": 41464
} | [
"java.time.DateTimeException"
] | import java.time.DateTimeException; | import java.time.*; | [
"java.time"
] | java.time; | 889,190 |
public boolean contains(RelativePath path) {
lock.lock();
try {
checkIndex();
return getZipIndexEntry(path) != null;
}
catch (IOException e) {
return false;
}
finally {
lock.unlock();
}
} | boolean function(RelativePath path) { lock.lock(); try { checkIndex(); return getZipIndexEntry(path) != null; } catch (IOException e) { return false; } finally { lock.unlock(); } } | /**
* Tests if a specific path exists in the zip. This method will return true
* for file entries and directories.
*
* @param path A path within the zip.
* @return True if the path is a file or dir, false otherwise.
*/ | Tests if a specific path exists in the zip. This method will return true for file entries and directories | contains | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndex.java",
"license": "gpl-2.0",
"size": 45314
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 388,222 |
public final MetaProperty<SecuritySource> securitySource() {
return _securitySource;
} | final MetaProperty<SecuritySource> function() { return _securitySource; } | /**
* The meta-property for the {@code securitySource} property.
* @return the meta-property, not null
*/ | The meta-property for the securitySource property | securitySource | {
"repo_name": "McLeodMoores/starling",
"path": "projects/integration/src/main/java/com/opengamma/integration/cashflow/PaymentServiceComponentFactory.java",
"license": "apache-2.0",
"size": 14733
} | [
"com.opengamma.core.security.SecuritySource",
"org.joda.beans.MetaProperty"
] | import com.opengamma.core.security.SecuritySource; import org.joda.beans.MetaProperty; | import com.opengamma.core.security.*; import org.joda.beans.*; | [
"com.opengamma.core",
"org.joda.beans"
] | com.opengamma.core; org.joda.beans; | 1,094,284 |
public static Currency getCurrency(final String code) {
try {
return Currency.getInstance(code);
} catch (IllegalArgumentException e) {
}
return null;
} | static Currency function(final String code) { try { return Currency.getInstance(code); } catch (IllegalArgumentException e) { } return null; } | /**
* A wrapper arround <code>Currency.getInstance</code> that returns null
* instead of throwing <code>IllegalArgumentException</code>
* if the specified Currency does not exist in this JVM.
*
* @see Currency#getInstance(String)
*/ | A wrapper arround <code>Currency.getInstance</code> that returns null instead of throwing <code>IllegalArgumentException</code> if the specified Currency does not exist in this JVM | getCurrency | {
"repo_name": "cscorley/solr-only-mirror",
"path": "core/src/java/org/apache/solr/schema/CurrencyField.java",
"license": "apache-2.0",
"size": 39311
} | [
"java.util.Currency"
] | import java.util.Currency; | import java.util.*; | [
"java.util"
] | java.util; | 1,082,442 |
public FSArray getAnswerList() {
if (AnswerList_Type.featOkTst && ((AnswerList_Type)jcasType).casFeat_answerList == null)
jcasType.jcas.throwFeatMissing("answerList", "edu.cmu.lti.oaqa.type.answer.AnswerList");
return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((AnswerList_Type)jcasType).casFeatCode_answerList)));} | FSArray function() { if (AnswerList_Type.featOkTst && ((AnswerList_Type)jcasType).casFeat_answerList == null) jcasType.jcas.throwFeatMissing(STR, STR); return (FSArray)(jcasType.ll_cas.ll_getFSForRef(jcasType.ll_cas.ll_getRefValue(addr, ((AnswerList_Type)jcasType).casFeatCode_answerList)));} | /** getter for answerList - gets Hit list of candidate answers, rank ordered, with highest scoring answer first.
* @generated
* @return value of the feature
*/ | getter for answerList - gets Hit list of candidate answers, rank ordered, with highest scoring answer first | getAnswerList | {
"repo_name": "junanita/project-team05",
"path": "project-team05/src/main/java/edu/cmu/lti/oaqa/type/answer/AnswerList.java",
"license": "mit",
"size": 4466
} | [
"org.apache.uima.jcas.cas.FSArray"
] | import org.apache.uima.jcas.cas.FSArray; | import org.apache.uima.jcas.cas.*; | [
"org.apache.uima"
] | org.apache.uima; | 2,135,562 |
public void attemptLogin() {
if (loginTask != null) {
return;
}
// Reset errors.
mEmailView.setError(null);
mPasswordView.setError(null);
// Store values at the time of the login attempt.
mEmail = mEmailView.getText().toString();
mPassword = mPasswordView.getText().toString();
boolean cancel = false;
View focusView = null;
// Check for a valid password.
if (TextUtils.isEmpty(mPassword)) {
mPasswordView.setError(getString(R.string.error_field_required));
focusView = mPasswordView;
cancel = true;
} else if (mPassword.length() < 4) {
mPasswordView.setError(getString(R.string.error_invalid_password));
focusView = mPasswordView;
cancel = true;
}
// Check for a valid email address.
if (TextUtils.isEmpty(mEmail)) {
mEmailView.setError(getString(R.string.error_field_required));
focusView = mEmailView;
cancel = true;
} else if (!mEmail.contains("@")) {
mEmailView.setError(getString(R.string.error_invalid_email));
focusView = mEmailView;
cancel = true;
}
if (cancel) {
// There was an error; don't attempt login and focus the first
// form field with an error.
focusView.requestFocus();
} else {
// Show a progress spinner, and kick off a background task to
// perform the user login attempt.
//mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
//showProgress(true);
loginTask=new LoginTask(LoginActivity.this) ;
loginTask.setMessageLoading("Logging in...");
loginTask.execute(LOGIN_API_ENDPOINT_URL);
}
} | void function() { if (loginTask != null) { return; } mEmailView.setError(null); mPasswordView.setError(null); mEmail = mEmailView.getText().toString(); mPassword = mPasswordView.getText().toString(); boolean cancel = false; View focusView = null; if (TextUtils.isEmpty(mPassword)) { mPasswordView.setError(getString(R.string.error_field_required)); focusView = mPasswordView; cancel = true; } else if (mPassword.length() < 4) { mPasswordView.setError(getString(R.string.error_invalid_password)); focusView = mPasswordView; cancel = true; } if (TextUtils.isEmpty(mEmail)) { mEmailView.setError(getString(R.string.error_field_required)); focusView = mEmailView; cancel = true; } else if (!mEmail.contains("@")) { mEmailView.setError(getString(R.string.error_invalid_email)); focusView = mEmailView; cancel = true; } if (cancel) { focusView.requestFocus(); } else { loginTask=new LoginTask(LoginActivity.this) ; loginTask.setMessageLoading(STR); loginTask.execute(LOGIN_API_ENDPOINT_URL); } } | /**
* Attempts to sign in or register the account specified by the login form.
* If there are form errors (invalid email, missing fields, etc.), the
* errors are presented and no actual login attempt is made.
*/ | Attempts to sign in or register the account specified by the login form. If there are form errors (invalid email, missing fields, etc.), the errors are presented and no actual login attempt is made | attemptLogin | {
"repo_name": "elrimo/IndoorLNS",
"path": "src/com/github/elrimo/indoorlns/LoginActivity.java",
"license": "artistic-2.0",
"size": 8736
} | [
"android.text.TextUtils",
"android.view.View"
] | import android.text.TextUtils; import android.view.View; | import android.text.*; import android.view.*; | [
"android.text",
"android.view"
] | android.text; android.view; | 859,910 |
public IElementType advance() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
CharSequence zzBufferL = zzBuffer;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
yychar+= zzMarkedPosL-zzStartRead;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
// set up zzAction for empty match case:
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
}
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL) {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL);
zzCurrentPosL += Character.charCount(zzInput);
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
return null;
}
else {
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 1:
{ return BAD_CHARACTER;
}
case 185: break;
case 2:
{ if (yystate() == X_HERE_STRING) {
closeHereStringIfAvailable();
return LINE_FEED;
}
if ((yystate() == S_PARAM_EXPANSION || yystate() == S_SUBSHELL || yystate() == S_ARITH || yystate() == S_ARITH_SQUARE_MODE) && isInState(X_HEREDOC)) {
backToPreviousState();
return LINE_FEED;
}
if (!heredocState().isEmpty()) {
// first linebreak after the start marker
goToState(X_HEREDOC);
return LINE_FEED;
}
return LINE_FEED;
}
case 186: break;
case 3:
{ return BACKSLASH;
}
case 187: break;
case 4:
{ return WHITESPACE;
}
case 188: break;
case 5:
{ return COMMENT;
}
case 189: break;
case 6:
{ return WORD;
}
case 190: break;
case 7:
{ return DOLLAR;
}
case 191: break;
case 8:
{ stringParsingState().enterString(); if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent();
goToState(X_STRINGMODE); return STRING_BEGIN;
}
case 192: break;
case 9:
{ return INTEGER_LITERAL;
}
case 193: break;
case 10:
{ closeHereStringIfAvailable(); return AMP;
}
case 194: break;
case 11:
{ return AT;
}
case 195: break;
case 12:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); stringParsingState().enterSubshell(); goToState(S_SUBSHELL); return LEFT_PAREN;
}
case 196: break;
case 13:
{ return RIGHT_PAREN;
}
case 197: break;
case 14:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH_SQUARE_MODE); return EXPR_ARITH_SQUARE;
}
case 198: break;
case 15:
{ return PIPE;
}
case 199: break;
case 16:
{ if (yystate() == S_BACKQUOTE) backToPreviousState(); else goToState(S_BACKQUOTE); return BACKQUOTE;
}
case 200: break;
case 17:
{ closeHereStringIfAvailable(); return SEMI;
}
case 201: break;
case 18:
{ return EQ;
}
case 202: break;
case 19:
{ return LEFT_CURLY;
}
case 203: break;
case 20:
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; return RIGHT_CURLY;
}
case 204: break;
case 21:
{ return GREATER_THAN;
}
case 205: break;
case 22:
{ return LESS_THAN;
}
case 206: break;
case 23:
{ return COND_OP_NOT;
}
case 207: break;
case 24:
{ if (isEmptyConditionalCommand()) {
setEmptyConditionalCommand(false);
backToPreviousState();
return _EXPR_CONDITIONAL;
} else {
setEmptyConditionalCommand(false);
return WORD;
}
}
case 208: break;
case 25:
{ return COND_OP;
}
case 209: break;
case 26:
{ return LEFT_PAREN;
}
case 210: break;
case 27:
{ return ARITH_BASE_CHAR;
}
case 211: break;
case 28:
{ return ARITH_NEGATE;
}
case 212: break;
case 29:
{ return ARITH_BITWISE_XOR;
}
case 213: break;
case 30:
{ return RIGHT_SQUARE;
}
case 214: break;
case 31:
{ return ARITH_NUMBER;
}
case 215: break;
case 32:
{ return ARITH_BITWISE_AND;
}
case 216: break;
case 33:
{ return ARITH_MULT;
}
case 217: break;
case 34:
{ return ARITH_QMARK;
}
case 218: break;
case 35:
{ return ARITH_PLUS;
}
case 219: break;
case 36:
{ incOpenParenthesisCount(); return LEFT_PAREN;
}
case 220: break;
case 37:
{ decOpenParenthesisCount(); return RIGHT_PAREN;
}
case 221: break;
case 38:
{ return LEFT_SQUARE;
}
case 222: break;
case 39:
{ return ARITH_MINUS;
}
case 223: break;
case 40:
{ return COMMA;
}
case 224: break;
case 41:
{ return ARITH_BITWISE_NEGATE;
}
case 225: break;
case 42:
{ return ARITH_GT;
}
case 226: break;
case 43:
{ return ARITH_LT;
}
case 227: break;
case 44:
{ return ARITH_DIV;
}
case 228: break;
case 45:
{ return ARITH_MOD;
}
case 229: break;
case 46:
{ return ARITH_COLON;
}
case 230: break;
case 47:
{ backToPreviousState(); return _EXPR_ARITH_SQUARE;
}
case 231: break;
case 48:
{ return EXPR_ARITH_SQUARE;
}
case 232: break;
case 49:
{ backToPreviousState(); return RIGHT_SQUARE;
}
case 233: break;
case 50:
{ backToPreviousState(); return RIGHT_PAREN;
}
case 234: break;
case 51:
{ backToPreviousState(); if (stringParsingState().isInSubshell()) stringParsingState().leaveSubshell(); return RIGHT_PAREN;
}
case 235: break;
case 52:
{ backToPreviousState(); goToState(S_ARITH_ARRAY_MODE); return LEFT_SQUARE;
}
case 236: break;
case 53:
{ goToState(S_ARITH_ARRAY_MODE); return LEFT_SQUARE;
}
case 237: break;
case 54:
{ return STRING_DATA;
}
case 238: break;
case 55:
{ if (!stringParsingState().isInSubstring() && stringParsingState().isSubstringAllowed()) {
stringParsingState().enterString();
goToState(X_STRINGMODE);
return STRING_BEGIN;
}
stringParsingState().leaveString();
backToPreviousState();
return STRING_END;
}
case 239: break;
case 56:
{ if (yystate() == S_BACKQUOTE) {
backToPreviousState();
}
else {
goToState(S_BACKQUOTE);
}
return BACKQUOTE;
}
case 240: break;
case 57:
{ setParamExpansionHash(isParamExpansionWord()); return PARAM_EXPANSION_OP_HASH;
}
case 241: break;
case 58:
{ return PARAM_EXPANSION_OP_EXCL;
}
case 242: break;
case 59:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_UPPERCASE_FIRST;
}
case 243: break;
case 60:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_DOT;
}
case 244: break;
case 61:
{ setParamExpansionWord(true); return WORD;
}
case 245: break;
case 62:
{ return PARAM_EXPANSION_OP_STAR;
}
case 246: break;
case 63:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_QMARK;
}
case 247: break;
case 64:
{ return PARAM_EXPANSION_OP_PLUS;
}
case 248: break;
case 65:
{ return PARAM_EXPANSION_OP_AT;
}
case 249: break;
case 66:
{ if (!isParamExpansionOther() && (!isParamExpansionWord() || !isParamExpansionHash())) {
// If we expect an array reference parse the next tokens as arithmetic expression
goToState(S_ARITH_ARRAY_MODE);
}
return LEFT_SQUARE;
}
case 250: break;
case 67:
{ return PARAM_EXPANSION_OP_MINUS;
}
case 251: break;
case 68:
{ return PARAM_EXPANSION_OP_EQ;
}
case 252: break;
case 69:
{ setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false);
return LEFT_CURLY;
}
case 253: break;
case 70:
{ setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false);
backToPreviousState();
closeHereStringIfAvailable();
return RIGHT_CURLY;
}
case 254: break;
case 71:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_LOWERCASE_FIRST;
}
case 255: break;
case 72:
{ goToState(S_PARAM_EXPANSION_PATTERN); return PARAM_EXPANSION_OP_SLASH;
}
case 256: break;
case 73:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_PERCENT;
}
case 257: break;
case 74:
{ return PARAM_EXPANSION_OP_COLON;
}
case 258: break;
case 75:
{ backToPreviousState(); return PARAM_EXPANSION_PATTERN;
}
case 259: break;
case 76:
{ yypushback(1); backToPreviousState();
}
case 260: break;
case 77:
{ backToPreviousState(); goToState(S_PARAM_EXPANSION_REPLACEMENT); return PARAM_EXPANSION_OP_SLASH;
}
case 261: break;
case 78:
{ backToPreviousState(); return WORD;
}
case 262: break;
case 79:
{ heredocState().pushMarker(zzCurrentPos, yytext(), yystate() == X_HEREDOC_MARKER_IGNORE_TABS);
backToPreviousState();
goToState(S_HEREDOC_EXPECTED);
return HEREDOC_MARKER_START;
}
case 263: break;
case 80:
{ heredocState().removeMarker(zzCurrentPos); backToPreviousState(); return LINE_FEED;
}
case 264: break;
case 81:
{ //support end marker followed by a backtick if nested in a backtick command
CharSequence markerText = yytext();
boolean dropLastChar = false;
if (isInState(S_BACKQUOTE) && yylength() >= 2 && yycharat(yylength()-1) == '`') {
markerText = markerText.subSequence(0, yylength()-1);
dropLastChar = true;
}
if (heredocState().isNextMarker(markerText)) {
boolean ignoreTabs = heredocState().isIgnoringTabs();
heredocState().popMarker(markerText);
popStates(X_HEREDOC);
if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) {
backToPreviousState();
}
if (dropLastChar) {
yypushback(1);
}
return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END;
}
return HEREDOC_LINE;
}
case 265: break;
case 82:
{ if (!heredocState().isEmpty()) {
return HEREDOC_LINE;
}
return LINE_FEED;
}
case 266: break;
case 83:
{ return HEREDOC_LINE;
}
case 267: break;
case 84:
{ if (heredocState().isNextMarker(yytext())) {
boolean ignoreTabs = heredocState().isIgnoringTabs();
heredocState().popMarker(yytext());
popStates(X_HEREDOC);
if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) {
backToPreviousState();
}
return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END;
}
return HEREDOC_LINE;
}
case 268: break;
case 85:
{ if (isInHereStringContent()) { leaveHereStringContent(); backToPreviousState(); } return WHITESPACE;
}
case 269: break;
case 86:
{ if (!isInHereStringContent()) enterHereStringContent(); return WORD;
}
case 270: break;
case 87:
{ return LINE_CONTINUATION;
}
case 271: break;
case 88:
{ return SHEBANG;
}
case 272: break;
case 89:
{ return VARIABLE;
}
case 273: break;
case 90:
{ yypushback(1); goToState(S_ARITH_SQUARE_MODE); return DOLLAR;
}
case 274: break;
case 91:
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; goToState(S_PARAM_EXPANSION); yypushback(1); return DOLLAR;
}
case 275: break;
case 92:
{ if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent(); return STRING2;
}
case 276: break;
case 93:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -1);
{ return ASSIGNMENT_WORD;
}
case 277: break;
case 94:
{ return FILEDESCRIPTOR;
}
case 278: break;
case 95:
{ closeHereStringIfAvailable(); return AND_AND;
}
case 279: break;
case 96:
{ if (isBash4()) {
return REDIRECT_AMP_GREATER;
} else {
yypushback(1);
return AMP;
}
}
case 280: break;
case 97:
{ return ADD_EQ;
}
case 281: break;
case 98:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH); return EXPR_ARITH;
}
case 282: break;
case 99:
{ goToState(S_TEST); setEmptyConditionalCommand(false); return EXPR_CONDITIONAL;
}
case 283: break;
case 100:
{ if (isBash4()) {
return PIPE_AMP;
} else {
yypushback(1);
return PIPE;
}
}
case 284: break;
case 101:
{ closeHereStringIfAvailable(); return OR_OR;
}
case 285: break;
case 102:
{ return IF_KEYWORD;
}
case 286: break;
case 103:
{ return DO_KEYWORD;
}
case 287: break;
case 104:
{ return FI_KEYWORD;
}
case 288: break;
case 105:
{ return REDIRECT_GREATER_BAR;
}
case 289: break;
case 106:
{ return SHIFT_RIGHT;
}
case 290: break;
case 107:
{ return REDIRECT_LESS_GREATER;
}
case 291: break;
case 108:
{ goToState(X_HEREDOC_MARKER);
return HEREDOC_MARKER_TAG;
}
case 292: break;
case 109:
{ backToPreviousState(); setEmptyConditionalCommand(false); return _EXPR_CONDITIONAL;
}
case 293: break;
case 110:
{ return COND_OP_EQ_EQ;
}
case 294: break;
case 111:
{ return COND_OP_REGEX;
}
case 295: break;
case 112:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 1);
{ goToState(S_DOLLAR_PREFIXED); return DOLLAR;
}
case 296: break;
case 113:
{ return AND_AND;
}
case 297: break;
case 114:
{ return OR_OR;
}
case 298: break;
case 115:
{ return ARITH_NE;
}
case 299: break;
case 116:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 1);
{ if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; goToState(S_DOLLAR_PREFIXED); return DOLLAR;
}
case 300: break;
case 117:
{ return ARITH_ASS_BIT_XOR;
}
case 301: break;
case 118:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -1);
{ goToState(S_ARRAY); return ASSIGNMENT_WORD;
}
case 302: break;
case 119:
{ return ARITH_ASS_BIT_AND;
}
case 303: break;
case 120:
{ return ARITH_EXPONENT;
}
case 304: break;
case 121:
{ return ARITH_ASS_MUL;
}
case 305: break;
case 122:
{ return ARITH_PLUS_PLUS;
}
case 306: break;
case 123:
{ return ARITH_ASS_PLUS;
}
case 307: break;
case 124:
{ if (openParenthesisCount() > 0) {
decOpenParenthesisCount();
yypushback(1);
return RIGHT_PAREN;
} else {
backToPreviousState();
return _EXPR_ARITH;
}
}
case 308: break;
case 125:
{ return ARITH_MINUS_MINUS;
}
case 309: break;
case 126:
{ return ARITH_ASS_MINUS;
}
case 310: break;
case 127:
{ return ARITH_OCTAL_NUMBER;
}
case 311: break;
case 128:
{ return ARITH_ASS_BIT_OR;
}
case 312: break;
case 129:
{ return ARITH_EQ;
}
case 313: break;
case 130:
{ return ARITH_GE;
}
case 314: break;
case 131:
{ return ARITH_SHIFT_RIGHT;
}
case 315: break;
case 132:
{ return ARITH_LE;
}
case 316: break;
case 133:
{ return ARITH_SHIFT_LEFT;
}
case 317: break;
case 134:
{ return ARITH_ASS_DIV;
}
case 318: break;
case 135:
{ return ARITH_ASS_MOD;
}
case 319: break;
case 136:
{ goToState(S_CASE_PATTERN);
if (isBash4()) {
return CASE_END;
}
else {
yypushback(1);
return SEMI;
}
}
case 320: break;
case 137:
{ goToState(S_CASE_PATTERN); return CASE_END;
}
case 321: break;
case 138:
{ if (!isInCaseBody()) { setInCaseBody(true); goToState(S_CASE_PATTERN); }; return WORD;
}
case 322: break;
case 139:
{ setParamExpansionHash(isParamExpansionWord()); return PARAM_EXPANSION_OP_HASH_HASH;
}
case 323: break;
case 140:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_UPPERCASE_ALL;
}
case 324: break;
case 141:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 1);
{ return LEFT_SQUARE;
}
case 325: break;
case 142:
{ setParamExpansionOther(true); return PARAM_EXPANSION_OP_LOWERCASE_ALL;
}
case 326: break;
case 143:
{ goToState(S_PARAM_EXPANSION_PATTERN); return PARAM_EXPANSION_OP_SLASH_SLASH;
}
case 327: break;
case 144:
{ return PARAM_EXPANSION_OP_COLON_QMARK;
}
case 328: break;
case 145:
{ return PARAM_EXPANSION_OP_COLON_PLUS;
}
case 329: break;
case 146:
{ return PARAM_EXPANSION_OP_COLON_MINUS;
}
case 330: break;
case 147:
{ return PARAM_EXPANSION_OP_COLON_EQ;
}
case 331: break;
case 148:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -1);
{ backToPreviousState(); goToState(S_PARAM_EXPANSION_DELIMITER); return PARAM_EXPANSION_PATTERN;
}
case 332: break;
case 149:
{ if (heredocState().isNextMarker(yytext())) {
boolean ignoreTabs = heredocState().isIgnoringTabs();
heredocState().popMarker(yytext());
popStates(X_HEREDOC);
if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) {
backToPreviousState();
}
return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END;
}
return yystate() == X_HEREDOC && heredocState().isExpectingEvaluatingHeredoc() && !"$".equals(yytext().toString())
? VARIABLE
: HEREDOC_LINE;
}
case 333: break;
case 150:
{ if (!isInHereStringContent()) enterHereStringContent(); return VARIABLE;
}
case 334: break;
case 151:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -2);
{ return ASSIGNMENT_WORD;
}
case 335: break;
case 152:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -2);
{ goToState(S_ASSIGNMENT_LIST); return ASSIGNMENT_WORD;
}
case 336: break;
case 153:
{ if (isBash4()) {
return REDIRECT_AMP_GREATER_GREATER;
} else {
yypushback(2);
return AMP;
}
}
case 337: break;
case 154:
{ if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); yypushback(2); goToState(S_SUBSHELL); return LEFT_PAREN;
}
case 338: break;
case 155:
{ goToState(S_TEST_COMMAND); return BRACKET_KEYWORD;
}
case 339: break;
case 156:
{ yypushback(1); goToState(S_TEST); setEmptyConditionalCommand(true); return EXPR_CONDITIONAL;
}
case 340: break;
case 157:
{ return LET_KEYWORD;
}
case 341: break;
case 158:
{ return FOR_KEYWORD;
}
case 342: break;
case 159:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 2);
{ return REDIRECT_GREATER_AMP;
}
case 343: break;
case 160:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 2);
{ return REDIRECT_LESS_AMP;
}
case 344: break;
case 161:
{ goToState(X_HEREDOC_MARKER_IGNORE_TABS);
return HEREDOC_MARKER_TAG;
}
case 345: break;
case 162:
{ goToState(X_HERE_STRING); return REDIRECT_HERE_STRING;
}
case 346: break;
case 163:
{ backToPreviousState(); return _BRACKET_KEYWORD;
}
case 347: break;
case 164:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 2);
{ yypushback(1); return ARITH_MINUS;
}
case 348: break;
case 165:
{ return ARITH_HEX_NUMBER;
}
case 349: break;
case 166:
{ return ARITH_ASS_SHIFT_RIGHT;
}
case 350: break;
case 167:
{ return ARITH_ASS_SHIFT_LEFT;
}
case 351: break;
case 168:
// lookahead expression with fixed base length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzStartRead, 1);
{ backToPreviousState(); goToState(S_ASSIGNMENT_LIST); return RIGHT_SQUARE;
}
case 352: break;
case 169:
{ goToState(S_CASE_PATTERN);
if (!isBash4()) {
yypushback(1);
}
return CASE_END;
}
case 353: break;
case 170:
// lookahead expression with fixed lookahead length
zzMarkedPos = Character.offsetByCodePoints
(zzBufferL, zzMarkedPos, -3);
{ goToState(S_ASSIGNMENT_LIST); return ASSIGNMENT_WORD;
}
case 354: break;
case 171:
// general lookahead, find correct zzMarkedPos
{ int zzFState = 21;
int zzFPos = zzStartRead;
if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; }
boolean zzFinL[] = zzFin;
while (zzFState != -1 && zzFPos < zzMarkedPos) {
zzFinL[zzFPos] = ((zzAttrL[zzFState] & 1) == 1);
zzInput = Character.codePointAt(zzBufferL, zzFPos);
zzFPos += Character.charCount(zzInput);
zzFState = zzTransL[ zzRowMapL[zzFState] + ZZ_CMAP(zzInput) ];
}
if (zzFState != -1) { zzFinL[zzFPos++] = ((zzAttrL[zzFState] & 1) == 1); }
while (zzFPos <= zzMarkedPos) {
zzFinL[zzFPos++] = false;
}
zzFState = 22;
zzFPos = zzMarkedPos;
while (!zzFinL[zzFPos] || (zzAttrL[zzFState] & 1) != 1) {
zzInput = Character.codePointBefore(zzBufferL, zzFPos);
zzFPos -= Character.charCount(zzInput);
zzFState = zzTransL[ zzRowMapL[zzFState] + ZZ_CMAP(zzInput) ];
};
zzMarkedPos = zzFPos;
}
{ goToState(S_ARRAY); return ASSIGNMENT_WORD;
}
case 355: break;
case 172:
{ return TIME_KEYWORD;
}
case 356: break;
case 173:
{ return TRAP_KEYWORD;
}
case 357: break;
case 174:
{ return THEN_KEYWORD;
}
case 358: break;
case 175:
{ return ELIF_KEYWORD;
}
case 359: break;
case 176:
{ return ELSE_KEYWORD;
}
case 360: break;
case 177:
{ setInCaseBody(false); goToState(S_CASE); return CASE_KEYWORD;
}
case 361: break;
case 178:
{ return DONE_KEYWORD;
}
case 362: break;
case 179:
{ backToPreviousState(); return ESAC_KEYWORD;
}
case 363: break;
case 180:
{ backToPreviousState(); yypushback(yylength());
}
case 364: break;
case 181:
{ return UNTIL_KEYWORD;
}
case 365: break;
case 182:
{ return WHILE_KEYWORD;
}
case 366: break;
case 183:
{ return SELECT_KEYWORD;
}
case 367: break;
case 184:
{ return FUNCTION_KEYWORD;
}
case 368: break;
default:
zzScanError(ZZ_NO_MATCH);
}
}
}
} | IElementType function() throws java.io.IOException { int zzInput; int zzAction; int zzCurrentPosL; int zzMarkedPosL; int zzEndReadL = zzEndRead; CharSequence zzBufferL = zzBuffer; int [] zzTransL = ZZ_TRANS; int [] zzRowMapL = ZZ_ROWMAP; int [] zzAttrL = ZZ_ATTRIBUTE; while (true) { zzMarkedPosL = zzMarkedPos; yychar+= zzMarkedPosL-zzStartRead; zzAction = -1; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL; zzState = ZZ_LEXSTATE[zzLexicalState]; int zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; } zzForAction: { while (true) { if (zzCurrentPosL < zzEndReadL) { zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL); zzCurrentPosL += Character.charCount(zzInput); } else if (zzAtEOF) { zzInput = YYEOF; break zzForAction; } else { zzCurrentPos = zzCurrentPosL; zzMarkedPos = zzMarkedPosL; boolean eof = zzRefill(); zzCurrentPosL = zzCurrentPos; zzMarkedPosL = zzMarkedPos; zzBufferL = zzBuffer; zzEndReadL = zzEndRead; if (eof) { zzInput = YYEOF; break zzForAction; } else { zzInput = Character.codePointAt(zzBufferL, zzCurrentPosL); zzCurrentPosL += Character.charCount(zzInput); } } int zzNext = zzTransL[ zzRowMapL[zzState] + ZZ_CMAP(zzInput) ]; if (zzNext == -1) break zzForAction; zzState = zzNext; zzAttributes = zzAttrL[zzState]; if ( (zzAttributes & 1) == 1 ) { zzAction = zzState; zzMarkedPosL = zzCurrentPosL; if ( (zzAttributes & 8) == 8 ) break zzForAction; } } } zzMarkedPos = zzMarkedPosL; if (zzInput == YYEOF && zzStartRead == zzCurrentPos) { zzAtEOF = true; return null; } else { switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) { case 1: { return BAD_CHARACTER; } case 185: break; case 2: { if (yystate() == X_HERE_STRING) { closeHereStringIfAvailable(); return LINE_FEED; } if ((yystate() == S_PARAM_EXPANSION yystate() == S_SUBSHELL yystate() == S_ARITH yystate() == S_ARITH_SQUARE_MODE) && isInState(X_HEREDOC)) { backToPreviousState(); return LINE_FEED; } if (!heredocState().isEmpty()) { goToState(X_HEREDOC); return LINE_FEED; } return LINE_FEED; } case 186: break; case 3: { return BACKSLASH; } case 187: break; case 4: { return WHITESPACE; } case 188: break; case 5: { return COMMENT; } case 189: break; case 6: { return WORD; } case 190: break; case 7: { return DOLLAR; } case 191: break; case 8: { stringParsingState().enterString(); if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent(); goToState(X_STRINGMODE); return STRING_BEGIN; } case 192: break; case 9: { return INTEGER_LITERAL; } case 193: break; case 10: { closeHereStringIfAvailable(); return AMP; } case 194: break; case 11: { return AT; } case 195: break; case 12: { if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); stringParsingState().enterSubshell(); goToState(S_SUBSHELL); return LEFT_PAREN; } case 196: break; case 13: { return RIGHT_PAREN; } case 197: break; case 14: { if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH_SQUARE_MODE); return EXPR_ARITH_SQUARE; } case 198: break; case 15: { return PIPE; } case 199: break; case 16: { if (yystate() == S_BACKQUOTE) backToPreviousState(); else goToState(S_BACKQUOTE); return BACKQUOTE; } case 200: break; case 17: { closeHereStringIfAvailable(); return SEMI; } case 201: break; case 18: { return EQ; } case 202: break; case 19: { return LEFT_CURLY; } case 203: break; case 20: { if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; return RIGHT_CURLY; } case 204: break; case 21: { return GREATER_THAN; } case 205: break; case 22: { return LESS_THAN; } case 206: break; case 23: { return COND_OP_NOT; } case 207: break; case 24: { if (isEmptyConditionalCommand()) { setEmptyConditionalCommand(false); backToPreviousState(); return _EXPR_CONDITIONAL; } else { setEmptyConditionalCommand(false); return WORD; } } case 208: break; case 25: { return COND_OP; } case 209: break; case 26: { return LEFT_PAREN; } case 210: break; case 27: { return ARITH_BASE_CHAR; } case 211: break; case 28: { return ARITH_NEGATE; } case 212: break; case 29: { return ARITH_BITWISE_XOR; } case 213: break; case 30: { return RIGHT_SQUARE; } case 214: break; case 31: { return ARITH_NUMBER; } case 215: break; case 32: { return ARITH_BITWISE_AND; } case 216: break; case 33: { return ARITH_MULT; } case 217: break; case 34: { return ARITH_QMARK; } case 218: break; case 35: { return ARITH_PLUS; } case 219: break; case 36: { incOpenParenthesisCount(); return LEFT_PAREN; } case 220: break; case 37: { decOpenParenthesisCount(); return RIGHT_PAREN; } case 221: break; case 38: { return LEFT_SQUARE; } case 222: break; case 39: { return ARITH_MINUS; } case 223: break; case 40: { return COMMA; } case 224: break; case 41: { return ARITH_BITWISE_NEGATE; } case 225: break; case 42: { return ARITH_GT; } case 226: break; case 43: { return ARITH_LT; } case 227: break; case 44: { return ARITH_DIV; } case 228: break; case 45: { return ARITH_MOD; } case 229: break; case 46: { return ARITH_COLON; } case 230: break; case 47: { backToPreviousState(); return _EXPR_ARITH_SQUARE; } case 231: break; case 48: { return EXPR_ARITH_SQUARE; } case 232: break; case 49: { backToPreviousState(); return RIGHT_SQUARE; } case 233: break; case 50: { backToPreviousState(); return RIGHT_PAREN; } case 234: break; case 51: { backToPreviousState(); if (stringParsingState().isInSubshell()) stringParsingState().leaveSubshell(); return RIGHT_PAREN; } case 235: break; case 52: { backToPreviousState(); goToState(S_ARITH_ARRAY_MODE); return LEFT_SQUARE; } case 236: break; case 53: { goToState(S_ARITH_ARRAY_MODE); return LEFT_SQUARE; } case 237: break; case 54: { return STRING_DATA; } case 238: break; case 55: { if (!stringParsingState().isInSubstring() && stringParsingState().isSubstringAllowed()) { stringParsingState().enterString(); goToState(X_STRINGMODE); return STRING_BEGIN; } stringParsingState().leaveString(); backToPreviousState(); return STRING_END; } case 239: break; case 56: { if (yystate() == S_BACKQUOTE) { backToPreviousState(); } else { goToState(S_BACKQUOTE); } return BACKQUOTE; } case 240: break; case 57: { setParamExpansionHash(isParamExpansionWord()); return PARAM_EXPANSION_OP_HASH; } case 241: break; case 58: { return PARAM_EXPANSION_OP_EXCL; } case 242: break; case 59: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_UPPERCASE_FIRST; } case 243: break; case 60: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_DOT; } case 244: break; case 61: { setParamExpansionWord(true); return WORD; } case 245: break; case 62: { return PARAM_EXPANSION_OP_STAR; } case 246: break; case 63: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_QMARK; } case 247: break; case 64: { return PARAM_EXPANSION_OP_PLUS; } case 248: break; case 65: { return PARAM_EXPANSION_OP_AT; } case 249: break; case 66: { if (!isParamExpansionOther() && (!isParamExpansionWord() !isParamExpansionHash())) { goToState(S_ARITH_ARRAY_MODE); } return LEFT_SQUARE; } case 250: break; case 67: { return PARAM_EXPANSION_OP_MINUS; } case 251: break; case 68: { return PARAM_EXPANSION_OP_EQ; } case 252: break; case 69: { setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false); return LEFT_CURLY; } case 253: break; case 70: { setParamExpansionWord(false); setParamExpansionHash(false); setParamExpansionOther(false); backToPreviousState(); closeHereStringIfAvailable(); return RIGHT_CURLY; } case 254: break; case 71: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_LOWERCASE_FIRST; } case 255: break; case 72: { goToState(S_PARAM_EXPANSION_PATTERN); return PARAM_EXPANSION_OP_SLASH; } case 256: break; case 73: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_PERCENT; } case 257: break; case 74: { return PARAM_EXPANSION_OP_COLON; } case 258: break; case 75: { backToPreviousState(); return PARAM_EXPANSION_PATTERN; } case 259: break; case 76: { yypushback(1); backToPreviousState(); } case 260: break; case 77: { backToPreviousState(); goToState(S_PARAM_EXPANSION_REPLACEMENT); return PARAM_EXPANSION_OP_SLASH; } case 261: break; case 78: { backToPreviousState(); return WORD; } case 262: break; case 79: { heredocState().pushMarker(zzCurrentPos, yytext(), yystate() == X_HEREDOC_MARKER_IGNORE_TABS); backToPreviousState(); goToState(S_HEREDOC_EXPECTED); return HEREDOC_MARKER_START; } case 263: break; case 80: { heredocState().removeMarker(zzCurrentPos); backToPreviousState(); return LINE_FEED; } case 264: break; case 81: { CharSequence markerText = yytext(); boolean dropLastChar = false; if (isInState(S_BACKQUOTE) && yylength() >= 2 && yycharat(yylength()-1) == '`') { markerText = markerText.subSequence(0, yylength()-1); dropLastChar = true; } if (heredocState().isNextMarker(markerText)) { boolean ignoreTabs = heredocState().isIgnoringTabs(); heredocState().popMarker(markerText); popStates(X_HEREDOC); if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) { backToPreviousState(); } if (dropLastChar) { yypushback(1); } return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END; } return HEREDOC_LINE; } case 265: break; case 82: { if (!heredocState().isEmpty()) { return HEREDOC_LINE; } return LINE_FEED; } case 266: break; case 83: { return HEREDOC_LINE; } case 267: break; case 84: { if (heredocState().isNextMarker(yytext())) { boolean ignoreTabs = heredocState().isIgnoringTabs(); heredocState().popMarker(yytext()); popStates(X_HEREDOC); if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) { backToPreviousState(); } return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END; } return HEREDOC_LINE; } case 268: break; case 85: { if (isInHereStringContent()) { leaveHereStringContent(); backToPreviousState(); } return WHITESPACE; } case 269: break; case 86: { if (!isInHereStringContent()) enterHereStringContent(); return WORD; } case 270: break; case 87: { return LINE_CONTINUATION; } case 271: break; case 88: { return SHEBANG; } case 272: break; case 89: { return VARIABLE; } case 273: break; case 90: { yypushback(1); goToState(S_ARITH_SQUARE_MODE); return DOLLAR; } case 274: break; case 91: { if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; goToState(S_PARAM_EXPANSION); yypushback(1); return DOLLAR; } case 275: break; case 92: { if (yystate() == X_HERE_STRING && !isInHereStringContent()) enterHereStringContent(); return STRING2; } case 276: break; case 93: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -1); { return ASSIGNMENT_WORD; } case 277: break; case 94: { return FILEDESCRIPTOR; } case 278: break; case 95: { closeHereStringIfAvailable(); return AND_AND; } case 279: break; case 96: { if (isBash4()) { return REDIRECT_AMP_GREATER; } else { yypushback(1); return AMP; } } case 280: break; case 97: { return ADD_EQ; } case 281: break; case 98: { if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); goToState(S_ARITH); return EXPR_ARITH; } case 282: break; case 99: { goToState(S_TEST); setEmptyConditionalCommand(false); return EXPR_CONDITIONAL; } case 283: break; case 100: { if (isBash4()) { return PIPE_AMP; } else { yypushback(1); return PIPE; } } case 284: break; case 101: { closeHereStringIfAvailable(); return OR_OR; } case 285: break; case 102: { return IF_KEYWORD; } case 286: break; case 103: { return DO_KEYWORD; } case 287: break; case 104: { return FI_KEYWORD; } case 288: break; case 105: { return REDIRECT_GREATER_BAR; } case 289: break; case 106: { return SHIFT_RIGHT; } case 290: break; case 107: { return REDIRECT_LESS_GREATER; } case 291: break; case 108: { goToState(X_HEREDOC_MARKER); return HEREDOC_MARKER_TAG; } case 292: break; case 109: { backToPreviousState(); setEmptyConditionalCommand(false); return _EXPR_CONDITIONAL; } case 293: break; case 110: { return COND_OP_EQ_EQ; } case 294: break; case 111: { return COND_OP_REGEX; } case 295: break; case 112: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 1); { goToState(S_DOLLAR_PREFIXED); return DOLLAR; } case 296: break; case 113: { return AND_AND; } case 297: break; case 114: { return OR_OR; } case 298: break; case 115: { return ARITH_NE; } case 299: break; case 116: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 1); { if (yystate() == X_HEREDOC && !heredocState().isExpectingEvaluatingHeredoc()) return HEREDOC_LINE; goToState(S_DOLLAR_PREFIXED); return DOLLAR; } case 300: break; case 117: { return ARITH_ASS_BIT_XOR; } case 301: break; case 118: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -1); { goToState(S_ARRAY); return ASSIGNMENT_WORD; } case 302: break; case 119: { return ARITH_ASS_BIT_AND; } case 303: break; case 120: { return ARITH_EXPONENT; } case 304: break; case 121: { return ARITH_ASS_MUL; } case 305: break; case 122: { return ARITH_PLUS_PLUS; } case 306: break; case 123: { return ARITH_ASS_PLUS; } case 307: break; case 124: { if (openParenthesisCount() > 0) { decOpenParenthesisCount(); yypushback(1); return RIGHT_PAREN; } else { backToPreviousState(); return _EXPR_ARITH; } } case 308: break; case 125: { return ARITH_MINUS_MINUS; } case 309: break; case 126: { return ARITH_ASS_MINUS; } case 310: break; case 127: { return ARITH_OCTAL_NUMBER; } case 311: break; case 128: { return ARITH_ASS_BIT_OR; } case 312: break; case 129: { return ARITH_EQ; } case 313: break; case 130: { return ARITH_GE; } case 314: break; case 131: { return ARITH_SHIFT_RIGHT; } case 315: break; case 132: { return ARITH_LE; } case 316: break; case 133: { return ARITH_SHIFT_LEFT; } case 317: break; case 134: { return ARITH_ASS_DIV; } case 318: break; case 135: { return ARITH_ASS_MOD; } case 319: break; case 136: { goToState(S_CASE_PATTERN); if (isBash4()) { return CASE_END; } else { yypushback(1); return SEMI; } } case 320: break; case 137: { goToState(S_CASE_PATTERN); return CASE_END; } case 321: break; case 138: { if (!isInCaseBody()) { setInCaseBody(true); goToState(S_CASE_PATTERN); }; return WORD; } case 322: break; case 139: { setParamExpansionHash(isParamExpansionWord()); return PARAM_EXPANSION_OP_HASH_HASH; } case 323: break; case 140: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_UPPERCASE_ALL; } case 324: break; case 141: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 1); { return LEFT_SQUARE; } case 325: break; case 142: { setParamExpansionOther(true); return PARAM_EXPANSION_OP_LOWERCASE_ALL; } case 326: break; case 143: { goToState(S_PARAM_EXPANSION_PATTERN); return PARAM_EXPANSION_OP_SLASH_SLASH; } case 327: break; case 144: { return PARAM_EXPANSION_OP_COLON_QMARK; } case 328: break; case 145: { return PARAM_EXPANSION_OP_COLON_PLUS; } case 329: break; case 146: { return PARAM_EXPANSION_OP_COLON_MINUS; } case 330: break; case 147: { return PARAM_EXPANSION_OP_COLON_EQ; } case 331: break; case 148: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -1); { backToPreviousState(); goToState(S_PARAM_EXPANSION_DELIMITER); return PARAM_EXPANSION_PATTERN; } case 332: break; case 149: { if (heredocState().isNextMarker(yytext())) { boolean ignoreTabs = heredocState().isIgnoringTabs(); heredocState().popMarker(yytext()); popStates(X_HEREDOC); if (heredocState().isEmpty() && yystate() == S_HEREDOC_EXPECTED) { backToPreviousState(); } return ignoreTabs ? HEREDOC_MARKER_IGNORING_TABS_END : HEREDOC_MARKER_END; } return yystate() == X_HEREDOC && heredocState().isExpectingEvaluatingHeredoc() && !"$".equals(yytext().toString()) ? VARIABLE : HEREDOC_LINE; } case 333: break; case 150: { if (!isInHereStringContent()) enterHereStringContent(); return VARIABLE; } case 334: break; case 151: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -2); { return ASSIGNMENT_WORD; } case 335: break; case 152: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -2); { goToState(S_ASSIGNMENT_LIST); return ASSIGNMENT_WORD; } case 336: break; case 153: { if (isBash4()) { return REDIRECT_AMP_GREATER_GREATER; } else { yypushback(2); return AMP; } } case 337: break; case 154: { if (yystate() == S_DOLLAR_PREFIXED) backToPreviousState(); yypushback(2); goToState(S_SUBSHELL); return LEFT_PAREN; } case 338: break; case 155: { goToState(S_TEST_COMMAND); return BRACKET_KEYWORD; } case 339: break; case 156: { yypushback(1); goToState(S_TEST); setEmptyConditionalCommand(true); return EXPR_CONDITIONAL; } case 340: break; case 157: { return LET_KEYWORD; } case 341: break; case 158: { return FOR_KEYWORD; } case 342: break; case 159: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 2); { return REDIRECT_GREATER_AMP; } case 343: break; case 160: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 2); { return REDIRECT_LESS_AMP; } case 344: break; case 161: { goToState(X_HEREDOC_MARKER_IGNORE_TABS); return HEREDOC_MARKER_TAG; } case 345: break; case 162: { goToState(X_HERE_STRING); return REDIRECT_HERE_STRING; } case 346: break; case 163: { backToPreviousState(); return _BRACKET_KEYWORD; } case 347: break; case 164: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 2); { yypushback(1); return ARITH_MINUS; } case 348: break; case 165: { return ARITH_HEX_NUMBER; } case 349: break; case 166: { return ARITH_ASS_SHIFT_RIGHT; } case 350: break; case 167: { return ARITH_ASS_SHIFT_LEFT; } case 351: break; case 168: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzStartRead, 1); { backToPreviousState(); goToState(S_ASSIGNMENT_LIST); return RIGHT_SQUARE; } case 352: break; case 169: { goToState(S_CASE_PATTERN); if (!isBash4()) { yypushback(1); } return CASE_END; } case 353: break; case 170: zzMarkedPos = Character.offsetByCodePoints (zzBufferL, zzMarkedPos, -3); { goToState(S_ASSIGNMENT_LIST); return ASSIGNMENT_WORD; } case 354: break; case 171: { int zzFState = 21; int zzFPos = zzStartRead; if (zzFin.length <= zzBufferL.length()) { zzFin = new boolean[zzBufferL.length()+1]; } boolean zzFinL[] = zzFin; while (zzFState != -1 && zzFPos < zzMarkedPos) { zzFinL[zzFPos] = ((zzAttrL[zzFState] & 1) == 1); zzInput = Character.codePointAt(zzBufferL, zzFPos); zzFPos += Character.charCount(zzInput); zzFState = zzTransL[ zzRowMapL[zzFState] + ZZ_CMAP(zzInput) ]; } if (zzFState != -1) { zzFinL[zzFPos++] = ((zzAttrL[zzFState] & 1) == 1); } while (zzFPos <= zzMarkedPos) { zzFinL[zzFPos++] = false; } zzFState = 22; zzFPos = zzMarkedPos; while (!zzFinL[zzFPos] (zzAttrL[zzFState] & 1) != 1) { zzInput = Character.codePointBefore(zzBufferL, zzFPos); zzFPos -= Character.charCount(zzInput); zzFState = zzTransL[ zzRowMapL[zzFState] + ZZ_CMAP(zzInput) ]; }; zzMarkedPos = zzFPos; } { goToState(S_ARRAY); return ASSIGNMENT_WORD; } case 355: break; case 172: { return TIME_KEYWORD; } case 356: break; case 173: { return TRAP_KEYWORD; } case 357: break; case 174: { return THEN_KEYWORD; } case 358: break; case 175: { return ELIF_KEYWORD; } case 359: break; case 176: { return ELSE_KEYWORD; } case 360: break; case 177: { setInCaseBody(false); goToState(S_CASE); return CASE_KEYWORD; } case 361: break; case 178: { return DONE_KEYWORD; } case 362: break; case 179: { backToPreviousState(); return ESAC_KEYWORD; } case 363: break; case 180: { backToPreviousState(); yypushback(yylength()); } case 364: break; case 181: { return UNTIL_KEYWORD; } case 365: break; case 182: { return WHILE_KEYWORD; } case 366: break; case 183: { return SELECT_KEYWORD; } case 367: break; case 184: { return FUNCTION_KEYWORD; } case 368: break; default: zzScanError(ZZ_NO_MATCH); } } } } | /**
* Resumes scanning until the next regular expression is matched,
* the end of input is encountered or an I/O-Error occurs.
*
* @return the next token
* @exception java.io.IOException if any I/O-Error occurs
*/ | Resumes scanning until the next regular expression is matched, the end of input is encountered or an I/O-Error occurs | advance | {
"repo_name": "jansorg/BashSupport",
"path": "src/com/ansorgit/plugins/bash/lang/lexer/_BashLexerBase.java",
"license": "apache-2.0",
"size": 94461
} | [
"com.intellij.psi.tree.IElementType"
] | import com.intellij.psi.tree.IElementType; | import com.intellij.psi.tree.*; | [
"com.intellij.psi"
] | com.intellij.psi; | 578,685 |
public boolean moveModuleIntoRegion(String instanceId, String formerParentId, String pageKey, String regionId, String regionLabel) throws Exception {
boolean returner = false;
if("null".equals(regionLabel)){
regionLabel = null;
}
IBXMLPage page = getIBXMLPage(pageKey);
//find
XMLElement moduleXML = getIBXMLWriter().findModule(page,instanceId);
XMLElement parentXML = getIBXMLWriter().findModule(page,formerParentId);
XMLElement moduleXMLCopy = (XMLElement)moduleXML.clone();
if(moduleXML!=null && parentXML!=null){
//remove
try {
returner = getIBXMLWriter().removeElement(parentXML,moduleXML,false);
}
catch (Exception e) {
e.printStackTrace();
throw new Exception(e.getMessage());
}
if(returner){
returner = getIBXMLWriter().insertElementLastIntoParentOrRegion(page, pageKey, regionId, regionLabel,moduleXMLCopy);
}
if(!returner){
return false;
}
return page.store();
}
return returner;
} | boolean function(String instanceId, String formerParentId, String pageKey, String regionId, String regionLabel) throws Exception { boolean returner = false; if("null".equals(regionLabel)){ regionLabel = null; } IBXMLPage page = getIBXMLPage(pageKey); XMLElement moduleXML = getIBXMLWriter().findModule(page,instanceId); XMLElement parentXML = getIBXMLWriter().findModule(page,formerParentId); XMLElement moduleXMLCopy = (XMLElement)moduleXML.clone(); if(moduleXML!=null && parentXML!=null){ try { returner = getIBXMLWriter().removeElement(parentXML,moduleXML,false); } catch (Exception e) { e.printStackTrace(); throw new Exception(e.getMessage()); } if(returner){ returner = getIBXMLWriter().insertElementLastIntoParentOrRegion(page, pageKey, regionId, regionLabel,moduleXMLCopy); } if(!returner){ return false; } return page.store(); } return returner; } | /**
* Copies, cuts and then pastes the module as the last item in a region
* @param instanceId
* @param formerParentId
* @param pageKey
* @param regionId
* @param regionLabel
* @return
* @throws Exception
*/ | Copies, cuts and then pastes the module as the last item in a region | moveModuleIntoRegion | {
"repo_name": "idega/com.idega.builder",
"path": "src/java/com/idega/builder/business/BuilderLogic.java",
"license": "gpl-3.0",
"size": 145872
} | [
"com.idega.xml.XMLElement"
] | import com.idega.xml.XMLElement; | import com.idega.xml.*; | [
"com.idega.xml"
] | com.idega.xml; | 703,965 |
public void _ImageMap() {
if (! util.utils.hasPropertyByName(oObj,"ImageMap")) {
log.println("optional property 'ImageMap' isn't available");
tRes.tested("ImageMap",true);
return;
}
try {
boolean result = true;
Object imapObject = tEnv.getObjRelation("ImapObject");
if ( imapObject == null){
System.out.println("ERROR: object relation 'ImapObject' isn't available");
tRes.tested("ImageMap", false);
return;
}
Object o = oObj.getPropertyValue("ImageMap");
XIndexContainer xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, o);
util.dbg.printInterfaces(xIndexContainer);
int elementCountFirst = xIndexContainer.getCount();
xIndexContainer.insertByIndex(elementCountFirst, imapObject);
// this does not really change the property: the implementation
// behind "ImageMap" stays the same, but for a real change a C++
// implementation is needed. See css.lang.XUnoTunnel
oObj.setPropertyValue("ImageMap", xIndexContainer);
Object newObject = oObj.getPropertyValue("ImageMap");
xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, newObject);
int elementCountSecond = xIndexContainer.getCount();
result = (elementCountFirst + 1 == elementCountSecond);
tRes.tested("ImageMap", result);
} catch (com.sun.star.beans.UnknownPropertyException e) {
log.println("Exception while checking 'ImageMap'");
e.printStackTrace(log);
tRes.tested("ImageMap",false);
} catch (com.sun.star.lang.WrappedTargetException e) {
log.println("Exception while checking 'ImageMap'");
e.printStackTrace(log);
tRes.tested("ImageMap",false);
} catch (com.sun.star.lang.IllegalArgumentException e) {
log.println("Exception while checking 'ImageMap'");
e.printStackTrace(log);
tRes.tested("ImageMap",false);
}
catch(Exception e) {
e.printStackTrace(log);
}
} | void function() { if (! util.utils.hasPropertyByName(oObj,STR)) { log.println(STR); tRes.tested(STR,true); return; } try { boolean result = true; Object imapObject = tEnv.getObjRelation(STR); if ( imapObject == null){ System.out.println(STR); tRes.tested(STR, false); return; } Object o = oObj.getPropertyValue(STR); XIndexContainer xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, o); util.dbg.printInterfaces(xIndexContainer); int elementCountFirst = xIndexContainer.getCount(); xIndexContainer.insertByIndex(elementCountFirst, imapObject); oObj.setPropertyValue(STR, xIndexContainer); Object newObject = oObj.getPropertyValue(STR); xIndexContainer = UnoRuntime.queryInterface(XIndexContainer.class, newObject); int elementCountSecond = xIndexContainer.getCount(); result = (elementCountFirst + 1 == elementCountSecond); tRes.tested(STR, result); } catch (com.sun.star.beans.UnknownPropertyException e) { log.println(STR); e.printStackTrace(log); tRes.tested(STR,false); } catch (com.sun.star.lang.WrappedTargetException e) { log.println(STR); e.printStackTrace(log); tRes.tested(STR,false); } catch (com.sun.star.lang.IllegalArgumentException e) { log.println(STR); e.printStackTrace(log); tRes.tested(STR,false); } catch(Exception e) { e.printStackTrace(log); } } | /**
* The test first retrieves ImageMap relation, then inserts it
* to the current container.
*/ | The test first retrieves ImageMap relation, then inserts it to the current container | _ImageMap | {
"repo_name": "beppec56/core",
"path": "qadevOOo/tests/java/ifc/drawing/_GraphicObjectShape.java",
"license": "gpl-3.0",
"size": 6035
} | [
"com.sun.star.container.XIndexContainer",
"com.sun.star.uno.UnoRuntime"
] | import com.sun.star.container.XIndexContainer; import com.sun.star.uno.UnoRuntime; | import com.sun.star.container.*; import com.sun.star.uno.*; | [
"com.sun.star"
] | com.sun.star; | 1,761,650 |
public String loadraw2(String userId, long projectId, String fileId) {
byte [] filedata = storageIo.downloadRawFile(userId, projectId, fileId);
return Base64Util.encodeLines(filedata);
} | String function(String userId, long projectId, String fileId) { byte [] filedata = storageIo.downloadRawFile(userId, projectId, fileId); return Base64Util.encodeLines(filedata); } | /**
* Loads the raw content of the associated file, base 64 encodes it
* and returns the resulting base64 encoded string.
*
* @param userId the userid
* @param projectId the project root node ID
* @param fileId project node whose content is to be downloaded
* @param the file contents encoded in base64
*/ | Loads the raw content of the associated file, base 64 encodes it and returns the resulting base64 encoded string | loadraw2 | {
"repo_name": "josmas/app-inventor",
"path": "appinventor/appengine/src/com/google/appinventor/server/project/CommonProjectService.java",
"license": "apache-2.0",
"size": 14391
} | [
"com.google.appinventor.shared.util.Base64Util"
] | import com.google.appinventor.shared.util.Base64Util; | import com.google.appinventor.shared.util.*; | [
"com.google.appinventor"
] | com.google.appinventor; | 1,467,060 |
public Set<String> getSuppressions() {
Set<String> suppressions = info == null ? null : info.suppressions;
return suppressions == null ? Collections.<String>emptySet() : suppressions;
} | Set<String> function() { Set<String> suppressions = info == null ? null : info.suppressions; return suppressions == null ? Collections.<String>emptySet() : suppressions; } | /**
* Returns the set of suppressed warnings.
*/ | Returns the set of suppressed warnings | getSuppressions | {
"repo_name": "fredj/closure-compiler",
"path": "src/com/google/javascript/rhino/JSDocInfo.java",
"license": "apache-2.0",
"size": 46658
} | [
"java.util.Collections",
"java.util.Set"
] | import java.util.Collections; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,314,583 |
private void updateServices(List<ServiceEntry> services, int tenantId, String username, Connection connection)
throws SQLException {
try (PreparedStatement ps = connection.prepareStatement(SQLConstants.ServiceCatalogConstants
.UPDATE_SERVICE_BY_KEY)) {
for (ServiceEntry service: services) {
setUpdateServiceParams(ps, service, tenantId, username);
ps.addBatch();
}
ps.executeBatch();
}
} | void function(List<ServiceEntry> services, int tenantId, String username, Connection connection) throws SQLException { try (PreparedStatement ps = connection.prepareStatement(SQLConstants.ServiceCatalogConstants .UPDATE_SERVICE_BY_KEY)) { for (ServiceEntry service: services) { setUpdateServiceParams(ps, service, tenantId, username); ps.addBatch(); } ps.executeBatch(); } } | /**
* Update list of services available in Service Catalog
* @param services List of Services that needs to be updated
* @param tenantId Tenant ID of the logged-in user
* @param username Logged-in username
* @param connection DB Connection
*
*/ | Update list of services available in Service Catalog | updateServices | {
"repo_name": "wso2/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ServiceCatalogDAO.java",
"license": "apache-2.0",
"size": 35335
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"java.util.List",
"org.wso2.carbon.apimgt.api.model.ServiceEntry",
"org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.List; import org.wso2.carbon.apimgt.api.model.ServiceEntry; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; | import java.sql.*; import java.util.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; | [
"java.sql",
"java.util",
"org.wso2.carbon"
] | java.sql; java.util; org.wso2.carbon; | 222,461 |
public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
ArrayList<LayoutElementParcelable> positions = adapter.getCheckedItems();
TextView textView1 = actionModeView.findViewById(R.id.item_count);
textView1.setText(String.valueOf(positions.size()));
textView1.setOnClickListener(null);
mode.setTitle(positions.size() + "");
hideOption(R.id.openmulti, menu);
menu.findItem(R.id.all)
.setTitle(
positions.size() == folder_count + file_count
? R.string.deselect_all
: R.string.select_all);
if (openMode != OpenMode.FILE) {
hideOption(R.id.addshortcut, menu);
hideOption(R.id.compress, menu);
return true;
}
if (getMainActivity().mReturnIntent)
if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu);
// tv.setText(positions.size());
if (!results) {
hideOption(R.id.openparent, menu);
if (positions.size() == 1) {
showOption(R.id.addshortcut, menu);
showOption(R.id.openwith, menu);
showOption(R.id.share, menu);
File x = new File(adapter.getCheckedItems().get(0).desc);
if (x.isDirectory()) {
hideOption(R.id.openwith, menu);
hideOption(R.id.share, menu);
hideOption(R.id.openmulti, menu);
}
if (getMainActivity().mReturnIntent)
if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu);
} else {
try {
showOption(R.id.share, menu);
if (getMainActivity().mReturnIntent)
if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu);
for (LayoutElementParcelable e : adapter.getCheckedItems()) {
File x = new File(e.desc);
if (x.isDirectory()) {
hideOption(R.id.share, menu);
hideOption(R.id.openmulti, menu);
}
}
} catch (Exception e) {
e.printStackTrace();
}
hideOption(R.id.openwith, menu);
hideOption(R.id.addshortcut, menu);
}
} else {
if (positions.size() == 1) {
showOption(R.id.addshortcut, menu);
showOption(R.id.openparent, menu);
showOption(R.id.openwith, menu);
showOption(R.id.share, menu);
File x = new File(adapter.getCheckedItems().get(0).desc);
if (x.isDirectory()) {
hideOption(R.id.openwith, menu);
hideOption(R.id.share, menu);
hideOption(R.id.openmulti, menu);
}
if (getMainActivity().mReturnIntent)
if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu);
} else {
hideOption(R.id.openparent, menu);
hideOption(R.id.addshortcut, menu);
if (getMainActivity().mReturnIntent)
if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu);
try {
for (LayoutElementParcelable e : adapter.getCheckedItems()) {
File x = new File(e.desc);
if (x.isDirectory()) {
hideOption(R.id.share, menu);
hideOption(R.id.openmulti, menu);
}
}
} catch (Exception e) {
e.printStackTrace();
}
hideOption(R.id.openwith, menu);
}
}
return true; // Return false if nothing is done
} | boolean function(ActionMode mode, Menu menu) { ArrayList<LayoutElementParcelable> positions = adapter.getCheckedItems(); TextView textView1 = actionModeView.findViewById(R.id.item_count); textView1.setText(String.valueOf(positions.size())); textView1.setOnClickListener(null); mode.setTitle(positions.size() + ""); hideOption(R.id.openmulti, menu); menu.findItem(R.id.all) .setTitle( positions.size() == folder_count + file_count ? R.string.deselect_all : R.string.select_all); if (openMode != OpenMode.FILE) { hideOption(R.id.addshortcut, menu); hideOption(R.id.compress, menu); return true; } if (getMainActivity().mReturnIntent) if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu); if (!results) { hideOption(R.id.openparent, menu); if (positions.size() == 1) { showOption(R.id.addshortcut, menu); showOption(R.id.openwith, menu); showOption(R.id.share, menu); File x = new File(adapter.getCheckedItems().get(0).desc); if (x.isDirectory()) { hideOption(R.id.openwith, menu); hideOption(R.id.share, menu); hideOption(R.id.openmulti, menu); } if (getMainActivity().mReturnIntent) if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu); } else { try { showOption(R.id.share, menu); if (getMainActivity().mReturnIntent) if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu); for (LayoutElementParcelable e : adapter.getCheckedItems()) { File x = new File(e.desc); if (x.isDirectory()) { hideOption(R.id.share, menu); hideOption(R.id.openmulti, menu); } } } catch (Exception e) { e.printStackTrace(); } hideOption(R.id.openwith, menu); hideOption(R.id.addshortcut, menu); } } else { if (positions.size() == 1) { showOption(R.id.addshortcut, menu); showOption(R.id.openparent, menu); showOption(R.id.openwith, menu); showOption(R.id.share, menu); File x = new File(adapter.getCheckedItems().get(0).desc); if (x.isDirectory()) { hideOption(R.id.openwith, menu); hideOption(R.id.share, menu); hideOption(R.id.openmulti, menu); } if (getMainActivity().mReturnIntent) if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu); } else { hideOption(R.id.openparent, menu); hideOption(R.id.addshortcut, menu); if (getMainActivity().mReturnIntent) if (Build.VERSION.SDK_INT >= 16) showOption(R.id.openmulti, menu); try { for (LayoutElementParcelable e : adapter.getCheckedItems()) { File x = new File(e.desc); if (x.isDirectory()) { hideOption(R.id.share, menu); hideOption(R.id.openmulti, menu); } } } catch (Exception e) { e.printStackTrace(); } hideOption(R.id.openwith, menu); } } return true; } | /**
* the following method is called each time the action mode is shown. Always called after
* onCreateActionMode, but may be called multiple times if the mode is invalidated.
*/ | the following method is called each time the action mode is shown. Always called after onCreateActionMode, but may be called multiple times if the mode is invalidated | onPrepareActionMode | {
"repo_name": "arpitkh96/AmazeFileManager",
"path": "app/src/main/java/com/amaze/filemanager/ui/fragments/MainFragment.java",
"license": "gpl-3.0",
"size": 64408
} | [
"android.os.Build",
"android.view.Menu",
"android.widget.TextView",
"androidx.appcompat.view.ActionMode",
"com.amaze.filemanager.adapters.data.LayoutElementParcelable",
"com.amaze.filemanager.utils.OpenMode",
"java.io.File",
"java.util.ArrayList"
] | import android.os.Build; import android.view.Menu; import android.widget.TextView; import androidx.appcompat.view.ActionMode; import com.amaze.filemanager.adapters.data.LayoutElementParcelable; import com.amaze.filemanager.utils.OpenMode; import java.io.File; import java.util.ArrayList; | import android.os.*; import android.view.*; import android.widget.*; import androidx.appcompat.view.*; import com.amaze.filemanager.adapters.data.*; import com.amaze.filemanager.utils.*; import java.io.*; import java.util.*; | [
"android.os",
"android.view",
"android.widget",
"androidx.appcompat",
"com.amaze.filemanager",
"java.io",
"java.util"
] | android.os; android.view; android.widget; androidx.appcompat; com.amaze.filemanager; java.io; java.util; | 2,735,943 |
public void scan(Class<?> clazz, Class<?> endClazz, boolean includeTransient) {
Class<?> currentClazz = clazz;
while (currentClazz != endClazz) {
for (Field field : currentClazz.getDeclaredFields()) {
if (Modifier.isStatic(field.getModifiers())) {
continue;
}
if (!includeTransient && Modifier.isTransient(field.getModifiers())) {
continue;
}
long offset = calc.getOffset(field);
scanField(field, offset);
}
currentClazz = currentClazz.getSuperclass();
}
} | void function(Class<?> clazz, Class<?> endClazz, boolean includeTransient) { Class<?> currentClazz = clazz; while (currentClazz != endClazz) { for (Field field : currentClazz.getDeclaredFields()) { if (Modifier.isStatic(field.getModifiers())) { continue; } if (!includeTransient && Modifier.isTransient(field.getModifiers())) { continue; } long offset = calc.getOffset(field); scanField(field, offset); } currentClazz = currentClazz.getSuperclass(); } } | /**
* Scans the fields in a class hierarchy.
*
* @param clazz the class at which to start scanning
* @param endClazz scanning stops when this class is encountered (i.e. {@code endClazz} is not
* scanned)
*/ | Scans the fields in a class hierarchy | scan | {
"repo_name": "smarr/Truffle",
"path": "compiler/src/org.graalvm.compiler.core.common/src/org/graalvm/compiler/core/common/FieldsScanner.java",
"license": "gpl-2.0",
"size": 4454
} | [
"java.lang.reflect.Field",
"java.lang.reflect.Modifier"
] | import java.lang.reflect.Field; import java.lang.reflect.Modifier; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 2,885,097 |
public void setSelectedRows(ArrayList<Integer> rows) {
// Only store the array if it exists
if (rows != null) {
// Create the new array to store the rows
ArrayList<Integer> rowsToStore = new ArrayList<Integer>();
// Get the rows ids in the table
ArrayList<Integer> rowIds = getRowIds();
// Check the incoming rows
for (int rowId : rows) {
if (rowIds.contains(rowId)) {
rowsToStore.add(rowId);
}
}
// Update the list if it exists
if (!rowsToStore.isEmpty()) {
selectedRows = rowsToStore;
}
}
return;
} | void function(ArrayList<Integer> rows) { if (rows != null) { ArrayList<Integer> rowsToStore = new ArrayList<Integer>(); ArrayList<Integer> rowIds = getRowIds(); for (int rowId : rows) { if (rowIds.contains(rowId)) { rowsToStore.add(rowId); } } if (!rowsToStore.isEmpty()) { selectedRows = rowsToStore; } } return; } | /**
* This operation sets the selected rows in the table.
*
* @param rows
* An array of the rows in the table that should be marked as
* selected. If an id in this array is not also in the table then
* it is ignored and will not be returned in a call to
* getSelectedRows.
*/ | This operation sets the selected rows in the table | setSelectedRows | {
"repo_name": "eclipse/ice",
"path": "org.eclipse.ice.datastructures/src/org/eclipse/ice/datastructures/form/TableComponent.java",
"license": "epl-1.0",
"size": 17777
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 234,014 |
public void addPropertyChangeListener(final PropertyChangeListener listener) {
_pSupport.addPropertyChangeListener(listener);
}
| void function(final PropertyChangeListener listener) { _pSupport.addPropertyChangeListener(listener); } | /**
* somebody cares about us, aaah
*
* @param listener that loving soul
*/ | somebody cares about us, aaah | addPropertyChangeListener | {
"repo_name": "debrief/debrief",
"path": "org.mwc.asset.legacy/src/ASSET/Scenario/Observers/CoreObserver.java",
"license": "epl-1.0",
"size": 7732
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 2,554,909 |
super.init(channel);
if (log.isLoggable(Level.FINE)) {
log.fine("initialize ssl tooling");
}
helper = new SSLEngineHelper(getRemoteHost(), channel.socket().getPort(), this);
addBufferTransformer(helper);
} | super.init(channel); if (log.isLoggable(Level.FINE)) { log.fine(STR); } helper = new SSLEngineHelper(getRemoteHost(), channel.socket().getPort(), this); addBufferTransformer(helper); } | /**
* Initializes this connection by setting a {@link SSLEngineHelper } and calling the super.
*
* @see SSLEngineHelper
* @param key the Selection key provided by the {@link Selector}.
* @throws ICPException
*/ | Initializes this connection by setting a <code>SSLEngineHelper </code> and calling the super | init | {
"repo_name": "mru00/jade_agents",
"path": "src/jade/imtp/leap/nio/NIOJICPSConnection.java",
"license": "lgpl-2.1",
"size": 2006
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 101,085 |
private void getMyPropertiesFromModel() throws InvalidSPDXAnalysisException {
this.offset = findIntPropertyValue(SpdxRdfConstants.RDF_POINTER_NAMESPACE,
SpdxRdfConstants.PROP_POINTER_OFFSET);
} | void function() throws InvalidSPDXAnalysisException { this.offset = findIntPropertyValue(SpdxRdfConstants.RDF_POINTER_NAMESPACE, SpdxRdfConstants.PROP_POINTER_OFFSET); } | /**
* Get the local properties just associated with this class
*/ | Get the local properties just associated with this class | getMyPropertiesFromModel | {
"repo_name": "spdx/tools",
"path": "src/org/spdx/rdfparser/model/pointer/ByteOffsetPointer.java",
"license": "apache-2.0",
"size": 4826
} | [
"org.spdx.rdfparser.InvalidSPDXAnalysisException",
"org.spdx.rdfparser.SpdxRdfConstants"
] | import org.spdx.rdfparser.InvalidSPDXAnalysisException; import org.spdx.rdfparser.SpdxRdfConstants; | import org.spdx.rdfparser.*; | [
"org.spdx.rdfparser"
] | org.spdx.rdfparser; | 2,702,403 |
public void setTickLabels_Number(List<Number> value) {
this.tickLabels = new ArrayList<>();
for (Number v : value) {
this.tickLabels.add(new ChartText(v.toString()));
}
this.autoTick = false;
}
| void function(List<Number> value) { this.tickLabels = new ArrayList<>(); for (Number v : value) { this.tickLabels.add(new ChartText(v.toString())); } this.autoTick = false; } | /**
* Set tick labels
*
* @param value Tick labels
*/ | Set tick labels | setTickLabels_Number | {
"repo_name": "meteoinfo/meteoinfolib",
"path": "src/org/meteoinfo/chart/axis/Axis.java",
"license": "lgpl-3.0",
"size": 53295
} | [
"java.util.ArrayList",
"java.util.List",
"org.meteoinfo.chart.ChartText"
] | import java.util.ArrayList; import java.util.List; import org.meteoinfo.chart.ChartText; | import java.util.*; import org.meteoinfo.chart.*; | [
"java.util",
"org.meteoinfo.chart"
] | java.util; org.meteoinfo.chart; | 403,339 |
public SessionBeanType<T> mappedName(String mappedName)
{
childNode.getOrCreate("mapped-name").text(mappedName);
return this;
} | SessionBeanType<T> function(String mappedName) { childNode.getOrCreate(STR).text(mappedName); return this; } | /**
* Sets the <code>mapped-name</code> element
* @param mappedName the value for the element <code>mapped-name</code>
* @return the current instance of <code>SessionBeanType<T></code>
*/ | Sets the <code>mapped-name</code> element | mappedName | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/ejbjar32/SessionBeanTypeImpl.java",
"license": "epl-1.0",
"size": 107840
} | [
"org.jboss.shrinkwrap.descriptor.api.ejbjar32.SessionBeanType"
] | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.SessionBeanType; | import org.jboss.shrinkwrap.descriptor.api.ejbjar32.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,761,710 |
public IdragClusterable[] getselectedComps() {
selectedComps.clear();
for (IdragClusterable currentCard : dragSelectables) {
Vector3D globCenter = new Vector3D(currentCard.getCenterPointGlobal());
globCenter.setZ(0);
// if (this.getPolygon().containsPointGlobal(currentCard.getCenterPointGlobal())){
if (this.getPolygon().containsPointGlobal(globCenter)) {
selectedComps.add(currentCard);
}
}
return selectedComps.toArray(new IdragClusterable[this.selectedComps.size()]);
}
| IdragClusterable[] function() { selectedComps.clear(); for (IdragClusterable currentCard : dragSelectables) { Vector3D globCenter = new Vector3D(currentCard.getCenterPointGlobal()); globCenter.setZ(0); if (this.getPolygon().containsPointGlobal(globCenter)) { selectedComps.add(currentCard); } } return selectedComps.toArray(new IdragClusterable[this.selectedComps.size()]); } | /**
* Gets the selected comps.
*
* @return the selected comps
*/ | Gets the selected comps | getselectedComps | {
"repo_name": "Twelve-60/mt4j",
"path": "src/org/mt4j/input/inputProcessors/componentProcessors/lassoProcessor/LassoProcessor.java",
"license": "gpl-2.0",
"size": 14605
} | [
"org.mt4j.util.math.Vector3D"
] | import org.mt4j.util.math.Vector3D; | import org.mt4j.util.math.*; | [
"org.mt4j.util"
] | org.mt4j.util; | 2,777,516 |
@Test
@Category(RunnableOnService.class)
public void testContainsInAnyOrder() throws Exception {
Pipeline pipeline = TestPipeline.create();
PCollection<Integer> pcollection = pipeline.apply(Create.of(1, 2, 3, 4));
DataflowAssert.that(pcollection).containsInAnyOrder(2, 1, 4, 3);
pipeline.run();
} | @Category(RunnableOnService.class) void function() throws Exception { Pipeline pipeline = TestPipeline.create(); PCollection<Integer> pcollection = pipeline.apply(Create.of(1, 2, 3, 4)); DataflowAssert.that(pcollection).containsInAnyOrder(2, 1, 4, 3); pipeline.run(); } | /**
* Tests that {@code containsInAnyOrder} is actually order-independent.
*/ | Tests that containsInAnyOrder is actually order-independent | testContainsInAnyOrder | {
"repo_name": "sammcveety/DataflowJavaSDK",
"path": "sdk/src/test/java/com/google/cloud/dataflow/sdk/testing/DataflowAssertTest.java",
"license": "apache-2.0",
"size": 15970
} | [
"com.google.cloud.dataflow.sdk.Pipeline",
"com.google.cloud.dataflow.sdk.transforms.Create",
"com.google.cloud.dataflow.sdk.values.PCollection",
"org.junit.experimental.categories.Category"
] | import com.google.cloud.dataflow.sdk.Pipeline; import com.google.cloud.dataflow.sdk.transforms.Create; import com.google.cloud.dataflow.sdk.values.PCollection; import org.junit.experimental.categories.Category; | import com.google.cloud.dataflow.sdk.*; import com.google.cloud.dataflow.sdk.transforms.*; import com.google.cloud.dataflow.sdk.values.*; import org.junit.experimental.categories.*; | [
"com.google.cloud",
"org.junit.experimental"
] | com.google.cloud; org.junit.experimental; | 433,068 |
Changes changes = new Changes(source).setStartPointNow();
updateChangesForTests();
changes.setEndPointNow();
Field fieldList = Changes.class.getDeclaredField("changesList");
fieldList.setAccessible(true);
Field fieldIndex = ChangesAssert.class.getDeclaredField("indexNextChangeMap");
fieldIndex.setAccessible(true);
Field fieldChange = ChangeAssert.class.getDeclaredField("change");
fieldChange.setAccessible(true);
ChangesAssert changesAssert = assertThat(changes);
Map<ChangeType, Map<String, Integer>> map = (Map<ChangeType, Map<String, Integer>>)fieldIndex.get(changesAssert);
assertThat(map).hasSize(0);
assertThat(map.get(null)).isNull();
ChangeAssert changeAssert0 = changesAssert.changeOfDeletion();
assertThat(map).hasSize(1);
assertThat(map.get(null)).isNull();
assertThat(map.get(ChangeType.DELETION)).hasSize(1);
assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(1);
ChangeAssert changeAssert1 = changesAssert.changeOfDeletion();
assertThat(map).hasSize(1);
assertThat(map.get(null)).isNull();
assertThat(map.get(ChangeType.DELETION)).hasSize(1);
assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(2);
try {
changesAssert.changeOfDeletion();
fail("An exception must be raised");
} catch (AssertJDBException e) {
Assertions.assertThat(e.getMessage()).isEqualTo("Index 2 out of the limits [0, 2[");
}
ChangesAssert changesAssertBis = assertThat(changes);
map = (Map<ChangeType, Map<String, Integer>>)fieldIndex.get(changesAssertBis);
assertThat(map).hasSize(0);
assertThat(map.get(null)).isNull();
ChangeAssert changeAssertBis0 = changesAssertBis.changeOfDeletion();
assertThat(map).hasSize(1);
assertThat(map.get(null)).isNull();
assertThat(map.get(ChangeType.DELETION)).hasSize(1);
assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(1);
ChangeAssert changeAssertBis1 = changeAssertBis0.changeOfDeletion();
assertThat(map).hasSize(1);
assertThat(map.get(null)).isNull();
assertThat(map.get(ChangeType.DELETION)).hasSize(1);
assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(2);
try {
changeAssertBis1.changeOfDeletion();
fail("An exception must be raised");
} catch (AssertJDBException e) {
Assertions.assertThat(e.getMessage()).isEqualTo("Index 2 out of the limits [0, 2[");
}
List<Changes> changesList = (List<Changes>) fieldList.get(changes);
assertThat(fieldChange.get(changeAssert0)).isSameAs(fieldChange.get(changeAssertBis0)).isSameAs(changesList.get(6));
assertThat(fieldChange.get(changeAssert1)).isSameAs(fieldChange.get(changeAssertBis1)).isSameAs(changesList.get(7));
} | Changes changes = new Changes(source).setStartPointNow(); updateChangesForTests(); changes.setEndPointNow(); Field fieldList = Changes.class.getDeclaredField(STR); fieldList.setAccessible(true); Field fieldIndex = ChangesAssert.class.getDeclaredField(STR); fieldIndex.setAccessible(true); Field fieldChange = ChangeAssert.class.getDeclaredField(STR); fieldChange.setAccessible(true); ChangesAssert changesAssert = assertThat(changes); Map<ChangeType, Map<String, Integer>> map = (Map<ChangeType, Map<String, Integer>>)fieldIndex.get(changesAssert); assertThat(map).hasSize(0); assertThat(map.get(null)).isNull(); ChangeAssert changeAssert0 = changesAssert.changeOfDeletion(); assertThat(map).hasSize(1); assertThat(map.get(null)).isNull(); assertThat(map.get(ChangeType.DELETION)).hasSize(1); assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(1); ChangeAssert changeAssert1 = changesAssert.changeOfDeletion(); assertThat(map).hasSize(1); assertThat(map.get(null)).isNull(); assertThat(map.get(ChangeType.DELETION)).hasSize(1); assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(2); try { changesAssert.changeOfDeletion(); fail(STR); } catch (AssertJDBException e) { Assertions.assertThat(e.getMessage()).isEqualTo(STR); } ChangesAssert changesAssertBis = assertThat(changes); map = (Map<ChangeType, Map<String, Integer>>)fieldIndex.get(changesAssertBis); assertThat(map).hasSize(0); assertThat(map.get(null)).isNull(); ChangeAssert changeAssertBis0 = changesAssertBis.changeOfDeletion(); assertThat(map).hasSize(1); assertThat(map.get(null)).isNull(); assertThat(map.get(ChangeType.DELETION)).hasSize(1); assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(1); ChangeAssert changeAssertBis1 = changeAssertBis0.changeOfDeletion(); assertThat(map).hasSize(1); assertThat(map.get(null)).isNull(); assertThat(map.get(ChangeType.DELETION)).hasSize(1); assertThat(map.get(ChangeType.DELETION).get(null)).isEqualTo(2); try { changeAssertBis1.changeOfDeletion(); fail(STR); } catch (AssertJDBException e) { Assertions.assertThat(e.getMessage()).isEqualTo(STR); } List<Changes> changesList = (List<Changes>) fieldList.get(changes); assertThat(fieldChange.get(changeAssert0)).isSameAs(fieldChange.get(changeAssertBis0)).isSameAs(changesList.get(6)); assertThat(fieldChange.get(changeAssert1)).isSameAs(fieldChange.get(changeAssertBis1)).isSameAs(changesList.get(7)); } | /**
* This method tests the {@code changeOfDeletion} navigation method.
*/ | This method tests the changeOfDeletion navigation method | test_change_of_deletion | {
"repo_name": "otoniel-isidoro/assertj-db",
"path": "src/test/java/org/assertj/db/navigation/ToChange_ChangeOfDeletion_Test.java",
"license": "apache-2.0",
"size": 4350
} | [
"java.lang.reflect.Field",
"java.util.List",
"java.util.Map",
"org.assertj.core.api.Assertions",
"org.assertj.db.api.Assertions",
"org.assertj.db.api.ChangeAssert",
"org.assertj.db.api.ChangesAssert",
"org.assertj.db.exception.AssertJDBException",
"org.assertj.db.type.ChangeType",
"org.assertj.db.... | import java.lang.reflect.Field; import java.util.List; import java.util.Map; import org.assertj.core.api.Assertions; import org.assertj.db.api.Assertions; import org.assertj.db.api.ChangeAssert; import org.assertj.db.api.ChangesAssert; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.type.ChangeType; import org.assertj.db.type.Changes; import org.junit.Assert; | import java.lang.reflect.*; import java.util.*; import org.assertj.core.api.*; import org.assertj.db.api.*; import org.assertj.db.exception.*; import org.assertj.db.type.*; import org.junit.*; | [
"java.lang",
"java.util",
"org.assertj.core",
"org.assertj.db",
"org.junit"
] | java.lang; java.util; org.assertj.core; org.assertj.db; org.junit; | 1,904,969 |
public void addContextLifecycleListeners(
LifecycleListener... contextLifecycleListeners) {
Assert.notNull(contextLifecycleListeners,
"ContextLifecycleListeners must not be null");
this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleListeners));
} | void function( LifecycleListener... contextLifecycleListeners) { Assert.notNull(contextLifecycleListeners, STR); this.contextLifecycleListeners.addAll(Arrays.asList(contextLifecycleListeners)); } | /**
* Add {@link LifecycleListener}s that should be added to the Tomcat {@link Context}.
* @param contextLifecycleListeners the listeners to add
*/ | Add <code>LifecycleListener</code>s that should be added to the Tomcat <code>Context</code> | addContextLifecycleListeners | {
"repo_name": "coolcao/spring-boot",
"path": "spring-boot/src/main/java/org/springframework/boot/context/embedded/tomcat/TomcatEmbeddedServletContainerFactory.java",
"license": "apache-2.0",
"size": 26181
} | [
"java.util.Arrays",
"org.apache.catalina.LifecycleListener",
"org.springframework.util.Assert"
] | import java.util.Arrays; import org.apache.catalina.LifecycleListener; import org.springframework.util.Assert; | import java.util.*; import org.apache.catalina.*; import org.springframework.util.*; | [
"java.util",
"org.apache.catalina",
"org.springframework.util"
] | java.util; org.apache.catalina; org.springframework.util; | 863,063 |
public int convertToAbsoluteDirection(int flags, int layoutDirection) {
int masked = flags & RELATIVE_DIR_FLAGS;
if (masked == 0) {
return flags;// does not have any relative flags, good.
}
flags &= ~masked; //remove start / end
if (layoutDirection == ViewCompat.LAYOUT_DIRECTION_LTR) {
// no change. just OR with 2 bits shifted mask and return
flags |= masked >> 2; // START is 2 bits after LEFT, END is 2 bits after RIGHT.
return flags;
} else {
// add START flag as RIGHT
flags |= ((masked >> 1) & ~RELATIVE_DIR_FLAGS);
// first clean start bit then add END flag as LEFT
flags |= ((masked >> 1) & RELATIVE_DIR_FLAGS) >> 2;
}
return flags;
} | int function(int flags, int layoutDirection) { int masked = flags & RELATIVE_DIR_FLAGS; if (masked == 0) { return flags; } flags &= ~masked; if (layoutDirection == ViewCompat.LAYOUT_DIRECTION_LTR) { flags = masked >> 2; return flags; } else { flags = ((masked >> 1) & ~RELATIVE_DIR_FLAGS); flags = ((masked >> 1) & RELATIVE_DIR_FLAGS) >> 2; } return flags; } | /**
* Converts a given set of flags to absolution direction which means {@link #START} and
* {@link #END} are replaced with {@link #LEFT} and {@link #RIGHT} depending on the layout
* direction.
*
* @param flags The flag value that include any number of movement flags.
* @param layoutDirection The layout direction of the RecyclerView.
* @return Updated flags which includes only absolute direction values.
*/ | Converts a given set of flags to absolution direction which means <code>#START</code> and <code>#END</code> are replaced with <code>#LEFT</code> and <code>#RIGHT</code> depending on the layout direction | convertToAbsoluteDirection | {
"repo_name": "ilzar/Telegram",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/helper/ItemTouchHelper.java",
"license": "gpl-2.0",
"size": 102734
} | [
"android.support.v4.view.ViewCompat"
] | import android.support.v4.view.ViewCompat; | import android.support.v4.view.*; | [
"android.support"
] | android.support; | 1,566,522 |
public RectangleConstraint toRangeWidth(Range range) {
if (range == null) {
throw new IllegalArgumentException("Null 'range' argument.");
}
return new RectangleConstraint(range.getUpperBound(), range,
LengthConstraintType.RANGE, this.height, this.heightRange,
this.heightConstraintType);
}
| RectangleConstraint function(Range range) { if (range == null) { throw new IllegalArgumentException(STR); } return new RectangleConstraint(range.getUpperBound(), range, LengthConstraintType.RANGE, this.height, this.heightRange, this.heightConstraintType); } | /**
* Returns a constraint that matches this one on the height attributes,
* but has a range width constraint.
*
* @param range the width range (<code>null</code> not permitted).
*
* @return A new constraint.
*/ | Returns a constraint that matches this one on the height attributes, but has a range width constraint | toRangeWidth | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/block/RectangleConstraint.java",
"license": "lgpl-2.1",
"size": 12250
} | [
"org.jfree.data.Range"
] | import org.jfree.data.Range; | import org.jfree.data.*; | [
"org.jfree.data"
] | org.jfree.data; | 1,326,822 |
public static long getFreeSpaceAvailable(String path) {
StatFs stat = new StatFs(path);
long availableBlocks = stat.getAvailableBlocksLong();
long blockSize = stat.getBlockSizeLong();
return availableBlocks * blockSize;
} | static long function(String path) { StatFs stat = new StatFs(path); long availableBlocks = stat.getAvailableBlocksLong(); long blockSize = stat.getBlockSizeLong(); return availableBlocks * blockSize; } | /**
* Get the number of free bytes that are available on the external storage.
*/ | Get the number of free bytes that are available on the external storage | getFreeSpaceAvailable | {
"repo_name": "ByteHamster/AntennaPod",
"path": "core/src/main/java/de/danoeh/antennapod/core/util/StorageUtils.java",
"license": "gpl-3.0",
"size": 2430
} | [
"android.os.StatFs"
] | import android.os.StatFs; | import android.os.*; | [
"android.os"
] | android.os; | 2,046,549 |
public static double getDpsMonthlyAmountFunctionalArea(final Statement statement, final int[] dpsClassKey, final int[] dpsKey, final Date date, final int functionalAreaId) throws Exception {
return getDpsMonthlyAmount(statement, dpsClassKey, dpsKey, date, functionalAreaId, 0);
} | static double function(final Statement statement, final int[] dpsClassKey, final int[] dpsKey, final Date date, final int functionalAreaId) throws Exception { return getDpsMonthlyAmount(statement, dpsClassKey, dpsKey, date, functionalAreaId, 0); } | /**
* Obtain total amount before taxes in local currency accumulated by functional area and period corresponding for supplied date.
* @param statement Statement of database connection.
* @param dpsClassKey Document class to filter.
* @param dpsKey Document primary key to exclude.
* @param date Date of document.
* @param functionalAreaId ID of required functional area.
* @return Sum of monthly amount.
* @throws Exception
*/ | Obtain total amount before taxes in local currency accumulated by functional area and period corresponding for supplied date | getDpsMonthlyAmountFunctionalArea | {
"repo_name": "swaplicado/siie32",
"path": "src/erp/mod/trn/db/STrnUtils.java",
"license": "mit",
"size": 34230
} | [
"java.sql.Statement",
"java.util.Date"
] | import java.sql.Statement; import java.util.Date; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 263,674 |
public static void updateDatabase(Map<String, Object> userInput) throws DatabaseUpdateException, InputRequiredException {
DatabaseUpdater.executeChangelog(null, userInput);
}
| static void function(Map<String, Object> userInput) throws DatabaseUpdateException, InputRequiredException { DatabaseUpdater.executeChangelog(null, userInput); } | /**
* Updates the openmrs database to the latest. This is only needed if using the API alone. <br>
* <br>
* The typical use-case would be: Try to {@link #startup(String, String, String, Properties)},
* if that fails, call this method to get the database up to speed.
*
* @param userInput (can be null) responses from the user about needed input
* @throws DatabaseUpdateException if an error occurred while updating
* @throws InputRequiredException if user input is required
* @since 1.5
*/ | Updates the openmrs database to the latest. This is only needed if using the API alone. The typical use-case would be: Try to <code>#startup(String, String, String, Properties)</code>, if that fails, call this method to get the database up to speed | updateDatabase | {
"repo_name": "jamesfeshner/openmrs-module",
"path": "api/src/main/java/org/openmrs/api/context/Context.java",
"license": "mpl-2.0",
"size": 41469
} | [
"java.util.Map",
"org.openmrs.util.DatabaseUpdateException",
"org.openmrs.util.DatabaseUpdater",
"org.openmrs.util.InputRequiredException"
] | import java.util.Map; import org.openmrs.util.DatabaseUpdateException; import org.openmrs.util.DatabaseUpdater; import org.openmrs.util.InputRequiredException; | import java.util.*; import org.openmrs.util.*; | [
"java.util",
"org.openmrs.util"
] | java.util; org.openmrs.util; | 2,354,188 |
void storeGalleryTypes(Collection<CmsGalleryType> galleryTypes) {
m_galleryTypes.clear();
for (CmsGalleryType type : galleryTypes) {
m_galleryTypes.put(new Integer(type.getTypeId()), type);
}
} | void storeGalleryTypes(Collection<CmsGalleryType> galleryTypes) { m_galleryTypes.clear(); for (CmsGalleryType type : galleryTypes) { m_galleryTypes.put(new Integer(type.getTypeId()), type); } } | /**
* Store the gallery type information.<p>
*
* @param galleryTypes the gallery types
*/ | Store the gallery type information | storeGalleryTypes | {
"repo_name": "sbonoc/opencms-core",
"path": "src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java",
"license": "lgpl-2.1",
"size": 64474
} | [
"java.util.Collection",
"org.opencms.ade.sitemap.shared.CmsGalleryType"
] | import java.util.Collection; import org.opencms.ade.sitemap.shared.CmsGalleryType; | import java.util.*; import org.opencms.ade.sitemap.shared.*; | [
"java.util",
"org.opencms.ade"
] | java.util; org.opencms.ade; | 1,643,075 |
private void setClip(Rect s) {
state.cliprgn = s;
g.clipRect(s, Op.REPLACE);
} | void function(Rect s) { state.cliprgn = s; g.clipRect(s, Op.REPLACE); } | /**
* set the clip to be the given shape. The current clip is not taken
* into account.
*/ | set the clip to be the given shape. The current clip is not taken into account | setClip | {
"repo_name": "erpragatisingh/androidTraining",
"path": "Android_6_weekTraning/AndroidPdfViewer/src/com/sun/pdfview/PDFRenderer.java",
"license": "gpl-2.0",
"size": 28993
} | [
"android.graphics.Rect",
"android.graphics.Region"
] | import android.graphics.Rect; import android.graphics.Region; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,633,528 |
private ServletContextListener prepareAndgetContextListener() {
try {
if (StringUtils.isNotBlank(this.loggerContextPackageName)) {
final Collection<URL> set = ClasspathHelper.forPackage(this.loggerContextPackageName);
final Reflections reflections = new Reflections(new ConfigurationBuilder().addUrls(set).setScanners(new SubTypesScanner()));
final Set<Class<? extends ServletContextListener>> subTypesOf = reflections.getSubTypesOf(ServletContextListener.class);
final ServletContextListener loggingContext = subTypesOf.iterator().next().newInstance();
this.context.setInitParameter(this.logConfigurationField, this.logConfigurationFile.getURI().toString());
return loggingContext;
}
return null;
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
/**
* {@inheritDoc} | ServletContextListener function() { try { if (StringUtils.isNotBlank(this.loggerContextPackageName)) { final Collection<URL> set = ClasspathHelper.forPackage(this.loggerContextPackageName); final Reflections reflections = new Reflections(new ConfigurationBuilder().addUrls(set).setScanners(new SubTypesScanner())); final Set<Class<? extends ServletContextListener>> subTypesOf = reflections.getSubTypesOf(ServletContextListener.class); final ServletContextListener loggingContext = subTypesOf.iterator().next().newInstance(); this.context.setInitParameter(this.logConfigurationField, this.logConfigurationFile.getURI().toString()); return loggingContext; } return null; } catch (final Exception e) { throw new RuntimeException(e); } } /** * {@inheritDoc} | /**
* Prepares the logger context. Locates the context and
* sets the configuration file.
* @return the logger context
*/ | Prepares the logger context. Locates the context and sets the configuration file | prepareAndgetContextListener | {
"repo_name": "keshvari/cas",
"path": "cas-server-webapp-support/src/main/java/org/jasig/cas/util/CasLoggerContextInitializer.java",
"license": "apache-2.0",
"size": 6303
} | [
"java.util.Collection",
"java.util.Set",
"javax.servlet.ServletContextListener",
"org.apache.commons.lang3.StringUtils",
"org.reflections.Reflections",
"org.reflections.scanners.SubTypesScanner",
"org.reflections.util.ClasspathHelper",
"org.reflections.util.ConfigurationBuilder"
] | import java.util.Collection; import java.util.Set; import javax.servlet.ServletContextListener; import org.apache.commons.lang3.StringUtils; import org.reflections.Reflections; import org.reflections.scanners.SubTypesScanner; import org.reflections.util.ClasspathHelper; import org.reflections.util.ConfigurationBuilder; | import java.util.*; import javax.servlet.*; import org.apache.commons.lang3.*; import org.reflections.*; import org.reflections.scanners.*; import org.reflections.util.*; | [
"java.util",
"javax.servlet",
"org.apache.commons",
"org.reflections",
"org.reflections.scanners",
"org.reflections.util"
] | java.util; javax.servlet; org.apache.commons; org.reflections; org.reflections.scanners; org.reflections.util; | 132,425 |
public String getZknDescription() {
// get the child element
Element el = metainfFile.getRootElement().getChild(ELEMEMT_DESCRIPTION);
// check whether it's null
if (null == el) {
return "";
}
// else return element-text
return el.getText();
} | String function() { Element el = metainfFile.getRootElement().getChild(ELEMEMT_DESCRIPTION); if (null == el) { return ""; } return el.getText(); } | /**
* This method returns the description of the zettelkasten-data, which is
* stored in the metainformation-file of the zipped data-file. Usually
* needed when showing information on the opened datafile
*
* @return a string with the description of this zettelkasten
*/ | This method returns the description of the zettelkasten-data, which is stored in the metainformation-file of the zipped data-file. Usually needed when showing information on the opened datafile | getZknDescription | {
"repo_name": "sjPlot/Zettelkasten",
"path": "src/main/java/de/danielluedecke/zettelkasten/database/Daten.java",
"license": "gpl-3.0",
"size": 336724
} | [
"org.jdom2.Element"
] | import org.jdom2.Element; | import org.jdom2.*; | [
"org.jdom2"
] | org.jdom2; | 181,367 |
public static void copy( final InputStream input,
final Writer output,
final String encoding,
final int bufferSize )
throws IOException
{
final InputStreamReader in = new InputStreamReader( input, encoding );
copy( in, output, bufferSize );
}
///////////////////////////////////////////////////////////////
// InputStream -> String | static void function( final InputStream input, final Writer output, final String encoding, final int bufferSize ) throws IOException { final InputStreamReader in = new InputStreamReader( input, encoding ); copy( in, output, bufferSize ); } | /**
* Copy and convert bytes from an <code>InputStream</code> to chars on a
* <code>Writer</code>, using the specified encoding.
* @param encoding The name of a supported character encoding. See the
* <a href="http://www.iana.org/assignments/character-sets">IANA
* Charset Registry</a> for a list of valid encoding types.
* @param bufferSize Size of internal buffer to use.
*/ | Copy and convert bytes from an <code>InputStream</code> to chars on a <code>Writer</code>, using the specified encoding | copy | {
"repo_name": "CCM-Modding/Nucleum-Omnium",
"path": "src/main/java/ccm/libs/org/codehaus/plexus/util/IOUtil.java",
"license": "mit",
"size": 29391
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.InputStreamReader",
"java.io.Writer"
] | import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Writer; | import java.io.*; | [
"java.io"
] | java.io; | 1,478,895 |
@Override
public void beforeLocalFork() {
for (BulkItemRequest item : items) {
if (item.request() instanceof InstanceShardOperationRequest) {
((InstanceShardOperationRequest) item.request()).beforeLocalFork();
} else {
((ShardReplicationOperationRequest) item.request()).beforeLocalFork();
}
}
} | void function() { for (BulkItemRequest item : items) { if (item.request() instanceof InstanceShardOperationRequest) { ((InstanceShardOperationRequest) item.request()).beforeLocalFork(); } else { ((ShardReplicationOperationRequest) item.request()).beforeLocalFork(); } } } | /**
* Before we fork on a local thread, make sure we copy over the bytes if they are unsafe
*/ | Before we fork on a local thread, make sure we copy over the bytes if they are unsafe | beforeLocalFork | {
"repo_name": "dmiszkiewicz/elasticsearch",
"path": "src/main/java/org/elasticsearch/action/bulk/BulkShardRequest.java",
"license": "apache-2.0",
"size": 3534
} | [
"org.elasticsearch.action.support.replication.ShardReplicationOperationRequest",
"org.elasticsearch.action.support.single.instance.InstanceShardOperationRequest"
] | import org.elasticsearch.action.support.replication.ShardReplicationOperationRequest; import org.elasticsearch.action.support.single.instance.InstanceShardOperationRequest; | import org.elasticsearch.action.support.replication.*; import org.elasticsearch.action.support.single.instance.*; | [
"org.elasticsearch.action"
] | org.elasticsearch.action; | 202,093 |
public boolean addNode(Lop node) {
if (nodes.contains(node))
return false;
nodes.add(node);
return true;
} | boolean function(Lop node) { if (nodes.contains(node)) return false; nodes.add(node); return true; } | /**
* Method to add a node to the DAG.
*
* @param node low-level operator
* @return true if node was not already present, false if not.
*/ | Method to add a node to the DAG | addNode | {
"repo_name": "iyounus/incubator-systemml",
"path": "src/main/java/org/apache/sysml/lops/compile/Dag.java",
"license": "apache-2.0",
"size": 143562
} | [
"org.apache.sysml.lops.Lop"
] | import org.apache.sysml.lops.Lop; | import org.apache.sysml.lops.*; | [
"org.apache.sysml"
] | org.apache.sysml; | 1,285,207 |
void setSignatureFactories(List<Factory.Named<Signature>> signatureFactories); | void setSignatureFactories(List<Factory.Named<Signature>> signatureFactories); | /**
* Set the named factories for {@link Signature}.
*
* @param signatureFactories a list of named factories
*/ | Set the named factories for <code>Signature</code> | setSignatureFactories | {
"repo_name": "rwinston/netling",
"path": "src/main/java/org/netling/ssh/Config.java",
"license": "apache-2.0",
"size": 4658
} | [
"java.util.List",
"org.netling.ssh.common.Factory",
"org.netling.ssh.signature.Signature"
] | import java.util.List; import org.netling.ssh.common.Factory; import org.netling.ssh.signature.Signature; | import java.util.*; import org.netling.ssh.common.*; import org.netling.ssh.signature.*; | [
"java.util",
"org.netling.ssh"
] | java.util; org.netling.ssh; | 2,031,328 |
public void setNoReplyLogLevel(LoggingLevel noReplyLogLevel) {
this.noReplyLogLevel = noReplyLogLevel;
} | void function(LoggingLevel noReplyLogLevel) { this.noReplyLogLevel = noReplyLogLevel; } | /**
* If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back.
*/ | If sync is enabled this option dictates MinaConsumer which logging level to use when logging a there is no reply to send back | setNoReplyLogLevel | {
"repo_name": "curso007/camel",
"path": "components/camel-mina2/src/main/java/org/apache/camel/component/mina2/Mina2Configuration.java",
"license": "apache-2.0",
"size": 13011
} | [
"org.apache.camel.LoggingLevel"
] | import org.apache.camel.LoggingLevel; | import org.apache.camel.*; | [
"org.apache.camel"
] | org.apache.camel; | 2,403,894 |
public PortProto findPortProto(String name) {
if (name == null) {
return null;
}
return findPortProto(Name.findName(name));
} | PortProto function(String name) { if (name == null) { return null; } return findPortProto(Name.findName(name)); } | /**
* Method to find the PortProto that has a particular name.
* @return the PortProto, or null if there is no PortProto with that name.
*/ | Method to find the PortProto that has a particular name | findPortProto | {
"repo_name": "imr/Electric8",
"path": "com/sun/electric/database/hierarchy/Cell.java",
"license": "gpl-3.0",
"size": 185659
} | [
"com.sun.electric.database.prototype.PortProto",
"com.sun.electric.database.text.Name"
] | import com.sun.electric.database.prototype.PortProto; import com.sun.electric.database.text.Name; | import com.sun.electric.database.prototype.*; import com.sun.electric.database.text.*; | [
"com.sun.electric"
] | com.sun.electric; | 476,022 |
public MiniZincResult solve(File modelFile) {
return solve(modelFile, NO_TIMEOUT);
} | MiniZincResult function(File modelFile) { return solve(modelFile, NO_TIMEOUT); } | /**
* {@code timeout} defaults to no time out at all (-1)
*
* @see MiniZincRunner#solve(File, int)
*/ | timeout defaults to no time out at all (-1) | solve | {
"repo_name": "isse-augsburg/minibrass",
"path": "source-code/java/src/isse/mbr/tools/execution/MiniZincRunner.java",
"license": "mit",
"size": 7392
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 1,062,648 |
public static Object getInstance(String service, String algorithm,
Provider provider, Object[] initArgs)
throws InvocationTargetException, NoSuchAlgorithmException
{
if (service != null)
service = service.trim();
if (algorithm != null)
algorithm = algorithm.trim();
if (service == null || service.length() == 0
|| algorithm == null || algorithm.length() == 0
|| provider == null || initArgs == null)
throw new IllegalArgumentException();
Enumeration enumer = provider.propertyNames();
String key;
String alias;
int count = 0;
boolean algorithmFound = false;
while (enumer.hasMoreElements())
{
key = (String) enumer.nextElement();
if (key.equalsIgnoreCase(service + "." + algorithm))
{
// remove the service portion from the key
algorithm = key.substring(service.length() + 1);
algorithmFound = true;
break;
}
else if (key.equalsIgnoreCase(ALG_ALIAS + service + "." + algorithm))
{
alias = (String) provider.getProperty(key);
if (! algorithm.equalsIgnoreCase(alias)) // does not refer to itself
{
algorithm = alias;
if (count++ > MAX_ALIASES)
throw new NoSuchAlgorithmException("too many aliases");
// need to reset enumeration to now look for the alias
enumer = provider.propertyNames();
}
}
}
if (! algorithmFound)
{
throw new NoSuchAlgorithmException(algorithm);
}
// Find and instantiate the implementation.
Class clazz = null;
ClassLoader loader = provider.getClass().getClassLoader();
Constructor constructor = null;
String error = algorithm;
try
{
if (loader != null)
clazz = loader.loadClass(provider.getProperty(service+"."+algorithm));
else
clazz = Class.forName(provider.getProperty(service+"."+algorithm));
constructor = getCompatibleConstructor(clazz, initArgs);
return constructor.newInstance(initArgs);
}
catch (ClassNotFoundException cnfe)
{
error = "class not found: " + algorithm;
}
catch (IllegalAccessException iae)
{
error = "illegal access: " + iae.getMessage();
}
catch (InstantiationException ie)
{
error = "instantiation exception: " + ie.getMessage();
}
catch (ExceptionInInitializerError eiie)
{
error = "exception in initializer: " + eiie.getMessage();
}
catch (SecurityException se)
{
error = "security exception: " + se.getMessage();
}
catch (NoSuchMethodException nsme)
{
error = "no appropriate constructor found";
}
throw new NoSuchAlgorithmException(error);
}
// Own methods.
// ------------------------------------------------------------------------ | static Object function(String service, String algorithm, Provider provider, Object[] initArgs) throws InvocationTargetException, NoSuchAlgorithmException { if (service != null) service = service.trim(); if (algorithm != null) algorithm = algorithm.trim(); if (service == null service.length() == 0 algorithm == null algorithm.length() == 0 provider == null initArgs == null) throw new IllegalArgumentException(); Enumeration enumer = provider.propertyNames(); String key; String alias; int count = 0; boolean algorithmFound = false; while (enumer.hasMoreElements()) { key = (String) enumer.nextElement(); if (key.equalsIgnoreCase(service + "." + algorithm)) { algorithm = key.substring(service.length() + 1); algorithmFound = true; break; } else if (key.equalsIgnoreCase(ALG_ALIAS + service + "." + algorithm)) { alias = (String) provider.getProperty(key); if (! algorithm.equalsIgnoreCase(alias)) { algorithm = alias; if (count++ > MAX_ALIASES) throw new NoSuchAlgorithmException(STR); enumer = provider.propertyNames(); } } } if (! algorithmFound) { throw new NoSuchAlgorithmException(algorithm); } Class clazz = null; ClassLoader loader = provider.getClass().getClassLoader(); Constructor constructor = null; String error = algorithm; try { if (loader != null) clazz = loader.loadClass(provider.getProperty(service+"."+algorithm)); else clazz = Class.forName(provider.getProperty(service+"."+algorithm)); constructor = getCompatibleConstructor(clazz, initArgs); return constructor.newInstance(initArgs); } catch (ClassNotFoundException cnfe) { error = STR + algorithm; } catch (IllegalAccessException iae) { error = STR + iae.getMessage(); } catch (InstantiationException ie) { error = STR + ie.getMessage(); } catch (ExceptionInInitializerError eiie) { error = STR + eiie.getMessage(); } catch (SecurityException se) { error = STR + se.getMessage(); } catch (NoSuchMethodException nsme) { error = STR; } throw new NoSuchAlgorithmException(error); } | /**
* Get the implementation for <i>algorithm</i> for service
* <i>service</i> from <i>provider</i>, passing <i>initArgs</i> to the
* SPI class's constructor (which cannot be null; pass a zero-length
* array if the SPI takes no arguments). The service is e.g.
* "Signature", and the algorithm "DSA".
*
* @param service The service name.
* @param algorithm The name of the algorithm to get.
* @param provider The provider to get the implementation from.
* @param initArgs The arguments to pass to the SPI class's
* constructor (cannot be null).
* @return The engine class for the specified algorithm; the object
* returned is typically a subclass of the SPI class for that
* service, but callers should check that this is so.
* @throws NoSuchAlgorithmException If the implementation cannot be
* found or cannot be instantiated.
* @throws InvocationTargetException If the SPI class's constructor
* throws an exception.
* @throws IllegalArgumentException If any of the four arguments are null.
*/ | Get the implementation for algorithm for service service from provider, passing initArgs to the SPI class's constructor (which cannot be null; pass a zero-length array if the SPI takes no arguments). The service is e.g. "Signature", and the algorithm "DSA" | getInstance | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/gnu/java/security/Engine.java",
"license": "bsd-3-clause",
"size": 9872
} | [
"java.lang.reflect.Constructor",
"java.lang.reflect.InvocationTargetException",
"java.security.NoSuchAlgorithmException",
"java.security.Provider",
"java.util.Enumeration"
] | import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.security.NoSuchAlgorithmException; import java.security.Provider; import java.util.Enumeration; | import java.lang.reflect.*; import java.security.*; import java.util.*; | [
"java.lang",
"java.security",
"java.util"
] | java.lang; java.security; java.util; | 374,265 |
public void setProcedures(List<String> procedures) {
this.procedures = procedures;
}
| void function(List<String> procedures) { this.procedures = procedures; } | /**
* Set procedures
*
* @param procedures
* procedures
*/ | Set procedures | setProcedures | {
"repo_name": "sauloperez/sos",
"path": "src/core/api/src/main/java/org/n52/sos/request/GetObservationRequest.java",
"license": "apache-2.0",
"size": 13142
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 44,656 |
public BlockingTaskExecutorBuilder keepAliveTime(Duration keepAliveTime) {
checkArgument(!requireNonNull(keepAliveTime, "keepAliveTime").isNegative(),
"keepAliveTime: %s (expected: >= 0)");
return keepAliveTimeMillis(keepAliveTime.toMillis());
} | BlockingTaskExecutorBuilder function(Duration keepAliveTime) { checkArgument(!requireNonNull(keepAliveTime, STR).isNegative(), STR); return keepAliveTimeMillis(keepAliveTime.toMillis()); } | /**
* Sets the amount of keep alive time in seconds.
*/ | Sets the amount of keep alive time in seconds | keepAliveTime | {
"repo_name": "line/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/util/BlockingTaskExecutorBuilder.java",
"license": "apache-2.0",
"size": 5558
} | [
"com.google.common.base.Preconditions",
"java.time.Duration"
] | import com.google.common.base.Preconditions; import java.time.Duration; | import com.google.common.base.*; import java.time.*; | [
"com.google.common",
"java.time"
] | com.google.common; java.time; | 2,258,102 |
public void finishResponse() throws IOException {
// Writing leftover bytes
outputBuffer.close();
} | void function() throws IOException { outputBuffer.close(); } | /**
* Perform whatever actions are required to flush and close the output
* stream or writer, in a single operation.
*
* @exception IOException if an input/output error occurs
*/ | Perform whatever actions are required to flush and close the output stream or writer, in a single operation | finishResponse | {
"repo_name": "plumer/codana",
"path": "tomcat_files/7.0.61/Response.java",
"license": "mit",
"size": 53408
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 603,307 |
public String get(String key, String bundle, Object[] args, Locale locale)
{
MessageResources res = getResources(bundle);
if (res == null)
{
return null;
}
// return the requested message
if (args == null)
{
return res.getMessage(locale, key);
}
else
{
return res.getMessage(locale, key, args);
}
}
| String function(String key, String bundle, Object[] args, Locale locale) { MessageResources res = getResources(bundle); if (res == null) { return null; } if (args == null) { return res.getMessage(locale, key); } else { return res.getMessage(locale, key, args); } } | /**
* Looks up and returns the localized message for the specified key.
* Replacement parameters passed with <code>args</code> are
* inserted into the message.
*
* @param key message key
* @param bundle The bundle name to look for.
* @param args replacement parameters for this message
* @param locale The locale to use for this message.
*
* @return the localized message for the specified key or
* <code>null</code> if no such message exists
* @since VelocityTools 1.4
*/ | Looks up and returns the localized message for the specified key. Replacement parameters passed with <code>args</code> are inserted into the message | get | {
"repo_name": "fluidinfo/velocity-tools-packaging",
"path": "src/main/java/org/apache/velocity/tools/struts/MessageTool.java",
"license": "apache-2.0",
"size": 14662
} | [
"java.util.Locale",
"org.apache.struts.util.MessageResources"
] | import java.util.Locale; import org.apache.struts.util.MessageResources; | import java.util.*; import org.apache.struts.util.*; | [
"java.util",
"org.apache.struts"
] | java.util; org.apache.struts; | 54,453 |
private void updateConnectionInfo(NetworkInfo info) {
//Log.d("WifiPreference","updateConnectionInfo just called");
//Toast.makeText(cordova.getActivity().getApplicationContext(), "updateConnectionInfo() just called", Toast.LENGTH_SHORT).show();
// send update to javascript "navigator.network.connection"
// Jellybean sends its own info
JSONObject thisInfo = this.getConnectionInfo(info);
if(!thisInfo.equals(lastInfo))
{
String connectionType = "";
try {
connectionType = thisInfo.get("type").toString();
} catch (JSONException e) {
LOG.d(LOG_TAG, e.getLocalizedMessage());
}
sendUpdate(connectionType);
lastInfo = thisInfo;
}
// Check current state of cellular connection
if (!handlerCheckEnabled) {
// First Check if cellular is enabled in settings
if (checkCellularEnabled()) {
// Check if cellular data is suspended (loss of cellular network)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
for (Network networkInfo : sockMan.getAllNetworks()) {
NetworkInfo i = sockMan.getNetworkInfo(networkInfo);
//Log.d(SWITCH_TAG, "Network Info: " + i);
if (i != null) {
if (i.getType() == sockMan.TYPE_MOBILE && i.getState() == NetworkInfo.State.SUSPENDED) {
//Log.d(SWITCH_TAG, "This network is mobile and suspended");
mobileDataEnabled = false;
}
}
}
}
}
else {
mobileDataEnabled = false;
}
// Run handler logic when standard WiFi not active or when mobile data not available
if (!mobileDataEnabled) {
// Enable handler or keep handler running
handlerCheckEnabled = true;
}
}
} | void function(NetworkInfo info) { JSONObject thisInfo = this.getConnectionInfo(info); if(!thisInfo.equals(lastInfo)) { String connectionType = STRtype").toString(); } catch (JSONException e) { LOG.d(LOG_TAG, e.getLocalizedMessage()); } sendUpdate(connectionType); lastInfo = thisInfo; } if (!handlerCheckEnabled) { if (checkCellularEnabled()) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for (Network networkInfo : sockMan.getAllNetworks()) { NetworkInfo i = sockMan.getNetworkInfo(networkInfo); if (i != null) { if (i.getType() == sockMan.TYPE_MOBILE && i.getState() == NetworkInfo.State.SUSPENDED) { mobileDataEnabled = false; } } } } } else { mobileDataEnabled = false; } if (!mobileDataEnabled) { handlerCheckEnabled = true; } } } | /**
* Updates the JavaScript side whenever the connection changes
*
* @param info the current active network info
* @return
*/ | Updates the JavaScript side whenever the connection changes | updateConnectionInfo | {
"repo_name": "AmritShokar/cordova-network-info-plugin",
"path": "src/android/NetworkManager.java",
"license": "apache-2.0",
"size": 18829
} | [
"android.net.Network",
"android.net.NetworkInfo",
"android.os.Build",
"org.apache.cordova.LOG",
"org.json.JSONException",
"org.json.JSONObject"
] | import android.net.Network; import android.net.NetworkInfo; import android.os.Build; import org.apache.cordova.LOG; import org.json.JSONException; import org.json.JSONObject; | import android.net.*; import android.os.*; import org.apache.cordova.*; import org.json.*; | [
"android.net",
"android.os",
"org.apache.cordova",
"org.json"
] | android.net; android.os; org.apache.cordova; org.json; | 963,437 |
public static <T> int size(@Nullable Collection<? extends T> c, @Nullable IgnitePredicate<? super T>... p) {
return c == null || c.isEmpty() ? 0 : isEmpty(p) || isAlwaysTrue(p) ? c.size() : size(c.iterator(), p);
} | static <T> int function(@Nullable Collection<? extends T> c, @Nullable IgnitePredicate<? super T>... p) { return c == null c.isEmpty() ? 0 : isEmpty(p) isAlwaysTrue(p) ? c.size() : size(c.iterator(), p); } | /**
* Gets size of the given collection with provided optional predicates.
*
* @param c Collection to size.
* @param p Optional predicates that filters out elements from count.
* @param <T> Type of the iterator.
* @return Number of elements in the collection for which all given predicates
* evaluates to {@code true}. If no predicates is provided - all elements are counted.
*/ | Gets size of the given collection with provided optional predicates | size | {
"repo_name": "dlnufox/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/lang/GridFunc.java",
"license": "apache-2.0",
"size": 157742
} | [
"java.util.Collection",
"org.apache.ignite.lang.IgnitePredicate",
"org.jetbrains.annotations.Nullable"
] | import java.util.Collection; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 1,669,999 |
private FocusListener getButtonFocusListener() {
if (buttonFocusListener == null) {
buttonFocusListener = new FocusListener() { | FocusListener function() { if (buttonFocusListener == null) { buttonFocusListener = new FocusListener() { | /**
* Return a listener for button focus.
* @return FocusListener
*/ | Return a listener for button focus | getButtonFocusListener | {
"repo_name": "neelance/jface4ruby",
"path": "jface4ruby/src/org/eclipse/jface/viewers/DialogCellEditor.java",
"license": "epl-1.0",
"size": 12782
} | [
"org.eclipse.swt.events.FocusListener"
] | import org.eclipse.swt.events.FocusListener; | import org.eclipse.swt.events.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 328,852 |
public static Setting<ByteSizeValue> memorySizeSetting(String key, Function<Settings, String> defaultValue, Property... properties) {
return new Setting<>(key, defaultValue, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), properties);
} | static Setting<ByteSizeValue> function(String key, Function<Settings, String> defaultValue, Property... properties) { return new Setting<>(key, defaultValue, (s) -> MemorySizeValue.parseBytesSizeValueOrHeapRatio(s, key), properties); } | /**
* Creates a setting which specifies a memory size. This can either be
* specified as an absolute bytes value or as a percentage of the heap
* memory.
*
* @param key the key for the setting
* @param defaultValue a function that supplies the default value for this setting
* @param properties properties properties for this setting like scope, filtering...
* @return the setting object
*/ | Creates a setting which specifies a memory size. This can either be specified as an absolute bytes value or as a percentage of the heap memory | memorySizeSetting | {
"repo_name": "ern/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/common/settings/Setting.java",
"license": "apache-2.0",
"size": 85939
} | [
"java.util.function.Function",
"org.elasticsearch.common.unit.ByteSizeValue",
"org.elasticsearch.common.unit.MemorySizeValue"
] | import java.util.function.Function; import org.elasticsearch.common.unit.ByteSizeValue; import org.elasticsearch.common.unit.MemorySizeValue; | import java.util.function.*; import org.elasticsearch.common.unit.*; | [
"java.util",
"org.elasticsearch.common"
] | java.util; org.elasticsearch.common; | 2,009,136 |
@Nullable
public static String findThreeDSSessionData(@NonNull String html) {
if (html.trim().isEmpty()) return null;
String cRes = null;
Matcher threeDSSessionDataMatcher = threeDSSessionDataFinder.matcher(html);
if (threeDSSessionDataMatcher.find()) {
cRes = threeDSSessionDataMatcher.group(1);
}
return cRes;
} | static String function(@NonNull String html) { if (html.trim().isEmpty()) return null; String cRes = null; Matcher threeDSSessionDataMatcher = threeDSSessionDataFinder.matcher(html); if (threeDSSessionDataMatcher.find()) { cRes = threeDSSessionDataMatcher.group(1); } return cRes; } | /**
* Finds the threeDSSessionData in an html page.
* <p>
* Note: If more than one threeDSSessionData is found in a page only the first will be returned.
*
* @param html String representation of the html page to search within.
* @return threeDSSessionData or null if not found
*/ | Finds the threeDSSessionData in an html page. Note: If more than one threeDSSessionData is found in a page only the first will be returned | findThreeDSSessionData | {
"repo_name": "LivotovLabs/3DSView",
"path": "3DSView/src/main/java/eu/livotov/labs/android/d3s/D3SRegexUtils.java",
"license": "apache-2.0",
"size": 4167
} | [
"androidx.annotation.NonNull",
"java.util.regex.Matcher"
] | import androidx.annotation.NonNull; import java.util.regex.Matcher; | import androidx.annotation.*; import java.util.regex.*; | [
"androidx.annotation",
"java.util"
] | androidx.annotation; java.util; | 2,703,840 |
//-----------------------------------------------------------------------
public static final void writeStringToFile(File file, String data, boolean append, Charset encoding) throws IOException {
try (OutputStream out = openOutputStream(file, append)) {
IOUtils.write(data, out, encoding);
}catch (IOException e) {
throw e;
}
}
| static final void function(File file, String data, boolean append, Charset encoding) throws IOException { try (OutputStream out = openOutputStream(file, append)) { IOUtils.write(data, out, encoding); }catch (IOException e) { throw e; } } | /**
* Writes a String to a file creating the file if it does not exist.
*
* NOTE: As from v1.3, the parent directories of the file will be created
* if they do not exist.
*
* @param file the file to write
* @param data the content to write to the file
* @param append if true, then bytes will be written to the end of the file rather than the beginning
* @param append Charset
* @throws IOException in case of an I/O error
* @throws java.io.UnsupportedEncodingException if the encoding is not supported by the VM
*/ | Writes a String to a file creating the file if it does not exist. if they do not exist | writeStringToFile | {
"repo_name": "wenhsiaoyi/commons-mylib",
"path": "source/edu/lib/common/io/FileTK.java",
"license": "gpl-2.0",
"size": 36159
} | [
"java.io.File",
"java.io.IOException",
"java.io.OutputStream",
"java.nio.charset.Charset",
"org.apache.commons.io.IOUtils"
] | import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.nio.charset.Charset; import org.apache.commons.io.IOUtils; | import java.io.*; import java.nio.charset.*; import org.apache.commons.io.*; | [
"java.io",
"java.nio",
"org.apache.commons"
] | java.io; java.nio; org.apache.commons; | 673,061 |
public void addFeatureOfInterestRestrictionToObservationCriteria(Criteria criteria, String featureOfInterest) {
criteria.createCriteria(AbstractObservation.FEATURE_OF_INTEREST).add(
eq(FeatureOfInterest.IDENTIFIER, featureOfInterest));
} | void function(Criteria criteria, String featureOfInterest) { criteria.createCriteria(AbstractObservation.FEATURE_OF_INTEREST).add( eq(FeatureOfInterest.IDENTIFIER, featureOfInterest)); } | /**
* Add featureOfInterest restriction to Hibernate Criteria for Observation
*
* @param criteria
* Hibernate Criteria for Observation
* @param featureOfInterest
* FeatureOfInterest identifier to add
*/ | Add featureOfInterest restriction to Hibernate Criteria for Observation | addFeatureOfInterestRestrictionToObservationCriteria | {
"repo_name": "kinow/SOS",
"path": "hibernate/common/src/main/java/org/n52/sos/ds/hibernate/dao/ObservationDAO.java",
"license": "gpl-2.0",
"size": 20465
} | [
"org.hibernate.Criteria",
"org.hibernate.criterion.Restrictions",
"org.n52.sos.ds.hibernate.entities.AbstractObservation",
"org.n52.sos.ds.hibernate.entities.FeatureOfInterest"
] | import org.hibernate.Criteria; import org.hibernate.criterion.Restrictions; import org.n52.sos.ds.hibernate.entities.AbstractObservation; import org.n52.sos.ds.hibernate.entities.FeatureOfInterest; | import org.hibernate.*; import org.hibernate.criterion.*; import org.n52.sos.ds.hibernate.entities.*; | [
"org.hibernate",
"org.hibernate.criterion",
"org.n52.sos"
] | org.hibernate; org.hibernate.criterion; org.n52.sos; | 2,119,299 |
public void interactiveBackgroundAlphaColorDependsOnOpaque() {
JPanel container = new JPanel(new GridLayout(0, 2));
Color alpha = PaintUtils.setAlpha(Color.RED, 100);
JXPanel opaque = new JXPanel();
opaque.setBorder(BorderFactory
.createTitledBorder("xpanel (alpha color, real opaque)"));
opaque.setBackground(alpha);
JXPanel nonOpaque = new JXPanel();
nonOpaque.setOpaque(false);
nonOpaque.setBorder(BorderFactory
.createTitledBorder("xpanel (alpha color, real !opaque)"));
nonOpaque.setBackground(alpha);
container.add(opaque);
container.add(nonOpaque);
show(wrapInFrame(container,
"compare alpha background: opaque <-> not opaque"), 400, 400);
} | void function() { JPanel container = new JPanel(new GridLayout(0, 2)); Color alpha = PaintUtils.setAlpha(Color.RED, 100); JXPanel opaque = new JXPanel(); opaque.setBorder(BorderFactory .createTitledBorder(STR)); opaque.setBackground(alpha); JXPanel nonOpaque = new JXPanel(); nonOpaque.setOpaque(false); nonOpaque.setBorder(BorderFactory .createTitledBorder(STR)); nonOpaque.setBackground(alpha); container.add(opaque); container.add(nonOpaque); show(wrapInFrame(container, STR), 400, 400); } | /**
* Issue 1517-swingx: JXPanel - background color depends on opaqueness prior
* to setting
*/ | Issue 1517-swingx: JXPanel - background color depends on opaqueness prior to setting | interactiveBackgroundAlphaColorDependsOnOpaque | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/test/java/org/jdesktop/swingx/JXPanelVisualCheck.java",
"license": "lgpl-2.1",
"size": 15228
} | [
"java.awt.Color",
"java.awt.GridLayout",
"javax.swing.BorderFactory",
"javax.swing.JPanel",
"org.jdesktop.swingx.util.PaintUtils"
] | import java.awt.Color; import java.awt.GridLayout; import javax.swing.BorderFactory; import javax.swing.JPanel; import org.jdesktop.swingx.util.PaintUtils; | import java.awt.*; import javax.swing.*; import org.jdesktop.swingx.util.*; | [
"java.awt",
"javax.swing",
"org.jdesktop.swingx"
] | java.awt; javax.swing; org.jdesktop.swingx; | 1,254,906 |
@Nullable
public static Rational valueOf(@Nullable BigInteger numerator, @Nullable BigInteger denominator) {
if (numerator == null || denominator == null) {
return null;
}
if (numerator.signum() == 0 && denominator.signum() == 0) {
return NaN;
}
if (denominator.signum() == 0) {
return numerator.signum() > 0 ? POSITIVE_INFINITY : NEGATIVE_INFINITY;
}
if (numerator.signum() == 0) {
return ZERO;
}
if (numerator.equals(denominator)) {
return ONE;
}
if (denominator.signum() < 0) {
numerator = numerator.negate();
denominator = denominator.negate();
}
BigInteger reducedNumerator;
BigInteger reducedDenominator;
BigInteger greatestCommonDivisor = calculateGreatestCommonDivisor(numerator, denominator);
if (BigInteger.ONE.equals(greatestCommonDivisor)) {
reducedNumerator = numerator;
reducedDenominator = denominator;
} else {
reducedNumerator = numerator.divide(greatestCommonDivisor);
reducedDenominator = denominator.divide(greatestCommonDivisor);
}
return new Rational(
numerator,
denominator,
greatestCommonDivisor,
reducedNumerator,
reducedDenominator
);
} | static Rational function(@Nullable BigInteger numerator, @Nullable BigInteger denominator) { if (numerator == null denominator == null) { return null; } if (numerator.signum() == 0 && denominator.signum() == 0) { return NaN; } if (denominator.signum() == 0) { return numerator.signum() > 0 ? POSITIVE_INFINITY : NEGATIVE_INFINITY; } if (numerator.signum() == 0) { return ZERO; } if (numerator.equals(denominator)) { return ONE; } if (denominator.signum() < 0) { numerator = numerator.negate(); denominator = denominator.negate(); } BigInteger reducedNumerator; BigInteger reducedDenominator; BigInteger greatestCommonDivisor = calculateGreatestCommonDivisor(numerator, denominator); if (BigInteger.ONE.equals(greatestCommonDivisor)) { reducedNumerator = numerator; reducedDenominator = denominator; } else { reducedNumerator = numerator.divide(greatestCommonDivisor); reducedDenominator = denominator.divide(greatestCommonDivisor); } return new Rational( numerator, denominator, greatestCommonDivisor, reducedNumerator, reducedDenominator ); } | /**
* Returns an instance with the given {@code numerator} and
* {@code denominator}.
*
* @param numerator the numerator.
* @param denominator the denominator.
* @return An instance that represents the value of {@code numerator}/
* {@code denominator}.
*/ | Returns an instance with the given numerator and denominator | valueOf | {
"repo_name": "UniversalMediaServer/UniversalMediaServer",
"path": "src/main/java/net/pms/util/Rational.java",
"license": "gpl-2.0",
"size": 72265
} | [
"java.math.BigInteger",
"javax.annotation.Nullable"
] | import java.math.BigInteger; import javax.annotation.Nullable; | import java.math.*; import javax.annotation.*; | [
"java.math",
"javax.annotation"
] | java.math; javax.annotation; | 1,369,413 |
private static String createMessage(List<?> missingOptions)
{
StringBuilder buf = new StringBuilder("Missing required option");
buf.append(missingOptions.size() == 1 ? "" : "s");
buf.append(": ");
Iterator<?> it = missingOptions.iterator();
while (it.hasNext())
{
buf.append(it.next());
if (it.hasNext())
{
buf.append(", ");
}
}
return buf.toString();
}
| static String function(List<?> missingOptions) { StringBuilder buf = new StringBuilder(STR); buf.append(missingOptions.size() == 1 ? STRsSTR: STR, "); } } return buf.toString(); } | /**
* Build the exception message from the specified list of options.
*
* @param missingOptions the list of missing options and groups
* @since 1.2
*/ | Build the exception message from the specified list of options | createMessage | {
"repo_name": "ufctester/commons-cli",
"path": "src/main/java/org/apache/commons/cli/MissingOptionException.java",
"license": "apache-2.0",
"size": 3077
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,524,005 |
Mat fromTemplate(BufferedImage image) throws IllegalArgumentException; | Mat fromTemplate(BufferedImage image) throws IllegalArgumentException; | /**
* Creates a new {@link Mat} based on the supplied image. This will have the same dimensions
* as the supplied image and data type as indicated by {@link #getMatType()}. No image data
* will be copied into the returned image.
*
* @param image The image to use as a template.
* @return The newly created matrix. Must be released by client when no longer in use.
* @throws IllegalArgumentException If a new {@link Mat} could not be constructed from the
* supplied image.
*/ | Creates a new <code>Mat</code> based on the supplied image. This will have the same dimensions as the supplied image and data type as indicated by <code>#getMatType()</code>. No image data will be copied into the returned image | fromTemplate | {
"repo_name": "tcat-tamu/Document-Image-Analysis",
"path": "bundles/edu.tamu.tcat.dia.morphological/src/edu/tamu/tcat/dia/morphological/opencv/util/BufferedImageAdapterStrategy.java",
"license": "apache-2.0",
"size": 3410
} | [
"java.awt.image.BufferedImage",
"org.opencv.core.Mat"
] | import java.awt.image.BufferedImage; import org.opencv.core.Mat; | import java.awt.image.*; import org.opencv.core.*; | [
"java.awt",
"org.opencv.core"
] | java.awt; org.opencv.core; | 2,400,313 |
public void start() throws XMLStreamException {
start(true);
} | void function() throws XMLStreamException { start(true); } | /**
* Begins the document stream.
*
* @throws XMLStreamException
*/ | Begins the document stream | start | {
"repo_name": "tsauerwein/geogig",
"path": "src/web/api/src/main/java/org/locationtech/geogig/web/api/ResponseWriter.java",
"license": "bsd-3-clause",
"size": 53075
} | [
"javax.xml.stream.XMLStreamException"
] | import javax.xml.stream.XMLStreamException; | import javax.xml.stream.*; | [
"javax.xml"
] | javax.xml; | 1,986,727 |
private void mergeMethods(TypeWithMethods base, TypeWithMethods given, Events events) {
// go over the method of the given entity
for (MethodType givenMethod : given.getMethods()) {
// check if this method is already in the stored class.
if (base.getMethods().contains(givenMethod)) {
for (MethodType baseMethod : base.getMethods()) {
if (!baseMethod.equals(givenMethod)) {
continue;
}
boolean changed = false;
for (AnnotationType a : findNewEntries(baseMethod.getAnnotations(), givenMethod.getAnnotations())) {
changed = true;
baseMethod.addAnnotation(getOrAddReferredType(a, events, AnnotationType.class));
}
for (ClassType a : findNewEntries(baseMethod.getExceptions(), givenMethod.getExceptions())) {
changed = true;
baseMethod.addException(getOrAddReferredType(a, events, ClassType.class));
}
if (mergeModifiers(baseMethod, givenMethod)) {
changed = true;
}
if (changed) {
fireAndSave(new NodeEvent(base, NodeEventType.CHANGED, NodeEventDetails.METHOD_CHANGED_OR_ADDED), events);
}
break;
}
} else {
// add it but also resolve it first
fireAndSave(new NodeEvent(base, NodeEventType.CHANGED, NodeEventDetails.METHOD_CHANGED_OR_ADDED), events);
base.addMethod(resolveMethodReferences(givenMethod, events));
}
}
} | void function(TypeWithMethods base, TypeWithMethods given, Events events) { for (MethodType givenMethod : given.getMethods()) { if (base.getMethods().contains(givenMethod)) { for (MethodType baseMethod : base.getMethods()) { if (!baseMethod.equals(givenMethod)) { continue; } boolean changed = false; for (AnnotationType a : findNewEntries(baseMethod.getAnnotations(), givenMethod.getAnnotations())) { changed = true; baseMethod.addAnnotation(getOrAddReferredType(a, events, AnnotationType.class)); } for (ClassType a : findNewEntries(baseMethod.getExceptions(), givenMethod.getExceptions())) { changed = true; baseMethod.addException(getOrAddReferredType(a, events, ClassType.class)); } if (mergeModifiers(baseMethod, givenMethod)) { changed = true; } if (changed) { fireAndSave(new NodeEvent(base, NodeEventType.CHANGED, NodeEventDetails.METHOD_CHANGED_OR_ADDED), events); } break; } } else { fireAndSave(new NodeEvent(base, NodeEventType.CHANGED, NodeEventDetails.METHOD_CHANGED_OR_ADDED), events); base.addMethod(resolveMethodReferences(givenMethod, events)); } } } | /**
* Merges two entities with methods.
*
* @param base
* entity in the storage.
* @param given
* entity that was given
* @param events
* list of events.
*/ | Merges two entities with methods | mergeMethods | {
"repo_name": "inspectIT/inspectIT",
"path": "inspectit.server/src/main/java/rocks/inspectit/server/instrumentation/classcache/ClassCacheModification.java",
"license": "agpl-3.0",
"size": 20015
} | [
"rocks.inspectit.server.instrumentation.classcache.events.Events",
"rocks.inspectit.server.instrumentation.classcache.events.NodeEvent",
"rocks.inspectit.shared.all.instrumentation.classcache.AnnotationType",
"rocks.inspectit.shared.all.instrumentation.classcache.ClassType",
"rocks.inspectit.shared.all.inst... | import rocks.inspectit.server.instrumentation.classcache.events.Events; import rocks.inspectit.server.instrumentation.classcache.events.NodeEvent; import rocks.inspectit.shared.all.instrumentation.classcache.AnnotationType; import rocks.inspectit.shared.all.instrumentation.classcache.ClassType; import rocks.inspectit.shared.all.instrumentation.classcache.MethodType; import rocks.inspectit.shared.all.instrumentation.classcache.TypeWithMethods; | import rocks.inspectit.server.instrumentation.classcache.events.*; import rocks.inspectit.shared.all.instrumentation.classcache.*; | [
"rocks.inspectit.server",
"rocks.inspectit.shared"
] | rocks.inspectit.server; rocks.inspectit.shared; | 772,540 |
public static PercentageColumnBuilder percentageColumn(String fieldName, Class<? extends Number> valueClass) {
return percentageColumn(DynamicReports.field(fieldName, valueClass));
} | static PercentageColumnBuilder function(String fieldName, Class<? extends Number> valueClass) { return percentageColumn(DynamicReports.field(fieldName, valueClass)); } | /**
* Creates a new percentage column.<br/>
* It calculates percentage values from field values.
*
* @param fieldName the name of the field
* @param valueClass the field value class
* @return a column builder
*/ | Creates a new percentage column. It calculates percentage values from field values | percentageColumn | {
"repo_name": "robcowell/dynamicreports",
"path": "dynamicreports-core/src/main/java/net/sf/dynamicreports/report/builder/column/Columns.java",
"license": "lgpl-3.0",
"size": 12629
} | [
"net.sf.dynamicreports.report.builder.DynamicReports"
] | import net.sf.dynamicreports.report.builder.DynamicReports; | import net.sf.dynamicreports.report.builder.*; | [
"net.sf.dynamicreports"
] | net.sf.dynamicreports; | 2,800,472 |
@Test
public void testDXAPICustomEnvironment() throws IOException {
DXEnvironment env = DXEnvironment.create();
DXHTTPRequest c = new DXHTTPRequest(env);
JsonNode responseJson =
c.request("/system/findDataObjects", DXJSON.parseJson("{}"),
RetryStrategy.SAFE_TO_RETRY);
Assert.assertEquals(responseJson.isObject(), true);
// System.out.println(responseJson);
String responseText =
c.request("/system/findDataObjects", "{}", RetryStrategy.SAFE_TO_RETRY);
Assert.assertEquals(responseText.substring(0, 1), "{");
// Tests deserialization of InvalidAuthentication
env = DXEnvironment.Builder.fromDefaults().setBearerToken("BOGUS").build();
DXHTTPRequest c2 = new DXHTTPRequest(env);
try {
c2.request("/system/findDataObjects", DXJSON.parseJson("{}"),
RetryStrategy.SAFE_TO_RETRY);
Assert.fail("Expected findDataObjects to fail with InvalidAuthentication");
} catch (InvalidAuthenticationException e) {
// Error message should be something like
// "the token could not be found"
Assert.assertTrue(e.toString().contains("token"));
Assert.assertEquals(401, e.getStatusCode());
}
} | void function() throws IOException { DXEnvironment env = DXEnvironment.create(); DXHTTPRequest c = new DXHTTPRequest(env); JsonNode responseJson = c.request(STR, DXJSON.parseJson("{}"), RetryStrategy.SAFE_TO_RETRY); Assert.assertEquals(responseJson.isObject(), true); String responseText = c.request(STR, "{}", RetryStrategy.SAFE_TO_RETRY); Assert.assertEquals(responseText.substring(0, 1), "{"); env = DXEnvironment.Builder.fromDefaults().setBearerToken("BOGUS").build(); DXHTTPRequest c2 = new DXHTTPRequest(env); try { c2.request(STR, DXJSON.parseJson("{}"), RetryStrategy.SAFE_TO_RETRY); Assert.fail(STR); } catch (InvalidAuthenticationException e) { Assert.assertTrue(e.toString().contains("token")); Assert.assertEquals(401, e.getStatusCode()); } } | /**
* Tests use of the API with a custom environment.
*
* @throws IOException
*/ | Tests use of the API with a custom environment | testDXAPICustomEnvironment | {
"repo_name": "johnwallace123/dx-toolkit",
"path": "src/java/src/test/java/com/dnanexus/DXHTTPRequestTest.java",
"license": "apache-2.0",
"size": 15027
} | [
"com.dnanexus.DXHTTPRequest",
"com.dnanexus.exceptions.InvalidAuthenticationException",
"com.fasterxml.jackson.databind.JsonNode",
"java.io.IOException",
"org.junit.Assert"
] | import com.dnanexus.DXHTTPRequest; import com.dnanexus.exceptions.InvalidAuthenticationException; import com.fasterxml.jackson.databind.JsonNode; import java.io.IOException; import org.junit.Assert; | import com.dnanexus.*; import com.dnanexus.exceptions.*; import com.fasterxml.jackson.databind.*; import java.io.*; import org.junit.*; | [
"com.dnanexus",
"com.dnanexus.exceptions",
"com.fasterxml.jackson",
"java.io",
"org.junit"
] | com.dnanexus; com.dnanexus.exceptions; com.fasterxml.jackson; java.io; org.junit; | 2,331,116 |
public void testInvalidProperties_HY1884() {
BeanWithInvalidProps bean = new BeanWithInvalidProps();
Object proxy;
// "prop1" and "prop2" is neither the name of valid property nor the
// name of any public method
// setter without parameter
proxy = EventHandler
.create(PropertyChangeListener.class, bean, "prop1");
try {
((PropertyChangeListener) proxy)
.propertyChange(new PropertyChangeEvent(bean, "prop1", "1",
"2"));
fail();
} catch (Exception e) {
// expected
}
// "is" prefix for big Boolean
proxy = EventHandler.create(PropertyChangeListener.class, bean,
"goodProp3", "source.prop2");
try{
((PropertyChangeListener) proxy)
.propertyChange(new PropertyChangeEvent(bean, "goodProp3",
Boolean.TRUE, Boolean.FALSE));
fail("Should throw NPE");
}catch(NullPointerException e){
}
}
| void function() { BeanWithInvalidProps bean = new BeanWithInvalidProps(); Object proxy; proxy = EventHandler .create(PropertyChangeListener.class, bean, "prop1"); try { ((PropertyChangeListener) proxy) .propertyChange(new PropertyChangeEvent(bean, "prop1", "1", "2")); fail(); } catch (Exception e) { } proxy = EventHandler.create(PropertyChangeListener.class, bean, STR, STR); try{ ((PropertyChangeListener) proxy) .propertyChange(new PropertyChangeEvent(bean, STR, Boolean.TRUE, Boolean.FALSE)); fail(STR); }catch(NullPointerException e){ } } | /**
* Checks some invalid property cases Regression for HARMONY-1884
*
* Note: this test fails on RI and it is considered as Non-Bug Difference,
* please refer HARMONY-1884 for details
*/ | Checks some invalid property cases Regression for HARMONY-1884 Note: this test fails on RI and it is considered as Non-Bug Difference, please refer HARMONY-1884 for details | testInvalidProperties_HY1884 | {
"repo_name": "skyHALud/codenameone",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/beans/src/test/java/org/apache/harmony/beans/tests/java/beans/EventHandlerTest.java",
"license": "gpl-2.0",
"size": 45044
} | [
"java.beans.EventHandler",
"java.beans.PropertyChangeEvent",
"java.beans.PropertyChangeListener"
] | import java.beans.EventHandler; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 590,828 |
private List<ProvenanceAction> loadWorkspaceObjectProvenance(
TestSpec tspec, FileSpec fs) throws Exception {
BufferedReader reader = getReaderForFile(tspec, fs,
EXT_PROV_JSON);
@SuppressWarnings("unchecked")
List<ProvenanceAction> prov = new ObjectMapper().readValue(reader,
List.class);
reader.close();
return prov;
} | List<ProvenanceAction> function( TestSpec tspec, FileSpec fs) throws Exception { BufferedReader reader = getReaderForFile(tspec, fs, EXT_PROV_JSON); @SuppressWarnings(STR) List<ProvenanceAction> prov = new ObjectMapper().readValue(reader, List.class); reader.close(); return prov; } | /** Load workspace object provenance from file.
* @param tspec the test specification associated with the provenance.
* @param fs the file specification for the provenance.
* @return the provenance.
* @throws Exception if an exception occurs.
*/ | Load workspace object provenance from file | loadWorkspaceObjectProvenance | {
"repo_name": "MrCreosote/jgi_kbase_integration_tests",
"path": "src/us/kbase/jgiintegration/test/JGIIntegrationTest.java",
"license": "mit",
"size": 63558
} | [
"com.fasterxml.jackson.databind.ObjectMapper",
"java.io.BufferedReader",
"java.util.List",
"us.kbase.workspace.ProvenanceAction"
] | import com.fasterxml.jackson.databind.ObjectMapper; import java.io.BufferedReader; import java.util.List; import us.kbase.workspace.ProvenanceAction; | import com.fasterxml.jackson.databind.*; import java.io.*; import java.util.*; import us.kbase.workspace.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.workspace"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.workspace; | 233,954 |
public void yyreset(Reader reader); | void function(Reader reader); | /**
* Resets the scanner to read from a new input stream.
* Does not close the old reader.
*
* All internal variables are reset, the old input stream
* <b>cannot</b> be reused (internal buffer is discarded and lost).
* Lexical state is set to <tt>ZZ_INITIAL</tt>.
*
* @param reader the new input stream
*/ | Resets the scanner to read from a new input stream. Does not close the old reader. All internal variables are reset, the old input stream cannot be reused (internal buffer is discarded and lost). Lexical state is set to ZZ_INITIAL | yyreset | {
"repo_name": "smartan/lucene",
"path": "src/main/java/org/apache/lucene/analysis/standard/StandardTokenizerInterface.java",
"license": "apache-2.0",
"size": 2260
} | [
"java.io.Reader"
] | import java.io.Reader; | import java.io.*; | [
"java.io"
] | java.io; | 1,639,664 |
void enterIdentifierExpression(@NotNull ECMAScriptParser.IdentifierExpressionContext ctx);
void exitIdentifierExpression(@NotNull ECMAScriptParser.IdentifierExpressionContext ctx); | void enterIdentifierExpression(@NotNull ECMAScriptParser.IdentifierExpressionContext ctx); void exitIdentifierExpression(@NotNull ECMAScriptParser.IdentifierExpressionContext ctx); | /**
* Exit a parse tree produced by {@link ECMAScriptParser#IdentifierExpression}.
* @param ctx the parse tree
*/ | Exit a parse tree produced by <code>ECMAScriptParser#IdentifierExpression</code> | exitIdentifierExpression | {
"repo_name": "IsThisThePayneResidence/intellidots",
"path": "src/main/java/ua/edu/hneu/ast/parsers/ECMAScriptListener.java",
"license": "gpl-3.0",
"size": 39591
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 44,103 |
public ServiceFuture<FirewallPolicyInner> createOrUpdateAsync(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback<FirewallPolicyInner> serviceCallback) {
return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback);
} | ServiceFuture<FirewallPolicyInner> function(String resourceGroupName, String firewallPolicyName, FirewallPolicyInner parameters, final ServiceCallback<FirewallPolicyInner> serviceCallback) { return ServiceFuture.fromResponse(createOrUpdateWithServiceResponseAsync(resourceGroupName, firewallPolicyName, parameters), serviceCallback); } | /**
* Creates or updates the specified Firewall Policy.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param parameters Parameters supplied to the create or update Firewall Policy operation.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceFuture} object
*/ | Creates or updates the specified Firewall Policy | createOrUpdateAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_08_01/src/main/java/com/microsoft/azure/management/network/v2019_08_01/implementation/FirewallPoliciesInner.java",
"license": "mit",
"size": 69669
} | [
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.rest.*; | [
"com.microsoft.rest"
] | com.microsoft.rest; | 278,432 |
public boolean removeAuthToken(String authToken) {
String foundKey = null;
for (Map.Entry<String, String> tokenEntry : mAuthTokens.entrySet()) {
if (authToken.equals(tokenEntry.getValue())) {
foundKey = tokenEntry.getKey();
break;
}
}
if (foundKey == null) {
return false;
} else {
mAuthTokens.remove(foundKey);
return true;
}
} | boolean function(String authToken) { String foundKey = null; for (Map.Entry<String, String> tokenEntry : mAuthTokens.entrySet()) { if (authToken.equals(tokenEntry.getValue())) { foundKey = tokenEntry.getKey(); break; } } if (foundKey == null) { return false; } else { mAuthTokens.remove(foundKey); return true; } } | /**
* Removes an auth token from the auth token map.
*
* @param authToken the auth token to remove
* @return true if the auth token was found
*/ | Removes an auth token from the auth token map | removeAuthToken | {
"repo_name": "KitKatXperience/platform_external_chromium_org",
"path": "sync/test/android/javatests/src/org/chromium/sync/test/util/AccountHolder.java",
"license": "bsd-3-clause",
"size": 5759
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 338,084 |
@RequestMapping(method = RequestMethod.GET)
public String view(ModelMap model) {
loadCustomerListDTOs(model);
return "customers/customerList";
}
| @RequestMapping(method = RequestMethod.GET) String function(ModelMap model) { loadCustomerListDTOs(model); return STR; } | /**
* Handles all GET requests. Loads a list of all customers and binds it with the key "customerListDTOs" into a model.
*
* @param model
* @return
*/ | Handles all GET requests. Loads a list of all customers and binds it with the key "customerListDTOs" into a model | view | {
"repo_name": "CIT-VSB-TUO/ResBill",
"path": "resbill/src/main/java/cz/vsb/resbill/web/customers/CustomerListController.java",
"license": "bsd-3-clause",
"size": 2146
} | [
"org.springframework.ui.ModelMap",
"org.springframework.web.bind.annotation.RequestMapping",
"org.springframework.web.bind.annotation.RequestMethod"
] | import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; | import org.springframework.ui.*; import org.springframework.web.bind.annotation.*; | [
"org.springframework.ui",
"org.springframework.web"
] | org.springframework.ui; org.springframework.web; | 2,283,419 |
public Node getTaskMetadataNode()
{
return this.startTaskNode;
} | Node function() { return this.startTaskNode; } | /**
* Returns the Node representing the start task metadata required
*
* @return The Node for the start task
*/ | Returns the Node representing the start task metadata required | getTaskMetadataNode | {
"repo_name": "nguyentienlong/community-edition",
"path": "projects/web-client/source/java/org/alfresco/web/bean/workflow/StartWorkflowWizard.java",
"license": "lgpl-3.0",
"size": 27235
} | [
"org.alfresco.web.bean.repository.Node"
] | import org.alfresco.web.bean.repository.Node; | import org.alfresco.web.bean.repository.*; | [
"org.alfresco.web"
] | org.alfresco.web; | 966,204 |
public Protocol.File[] listFiles(String backupUDID, int snapshotID, int offset, Long limit) throws InvalidResponseException {
ProtoBuilder pb = new ProtoBuilder();
pb.setHost(mobileBackupUrl);
pb.setPath(String.format("/mbs/%s/%s/%s/listFiles?offset=%s&limit=%s", dsPrsID.toString(), backupUDID, snapshotID, offset, (limit == null) ? "65536" : String.valueOf(limit)));
pb.addHeader("Authorization", "X-MobileMe-AuthToken " + Utils.encode(dsPrsID.toString(), mmeAuthToken));
EasyProto<Protocol.File> ep = pb.build(Protocol.File.PARSER);
if (prog != null) {
prog.activate(true);
prog.intermediate();
prog.status("Calculating File Size..."); //Just like Windows Explorer!
Protocol.File[] response = ep.parseVarint(prog, "Parsing File List").toArray(new Protocol.File[0]);
prog.activate(false);
return response;
} else {
return ep.parseVarint().toArray(new Protocol.File[0]);
}
} | Protocol.File[] function(String backupUDID, int snapshotID, int offset, Long limit) throws InvalidResponseException { ProtoBuilder pb = new ProtoBuilder(); pb.setHost(mobileBackupUrl); pb.setPath(String.format(STR, dsPrsID.toString(), backupUDID, snapshotID, offset, (limit == null) ? "65536" : String.valueOf(limit))); pb.addHeader(STR, STR + Utils.encode(dsPrsID.toString(), mmeAuthToken)); EasyProto<Protocol.File> ep = pb.build(Protocol.File.PARSER); if (prog != null) { prog.activate(true); prog.intermediate(); prog.status(STR); Protocol.File[] response = ep.parseVarint(prog, STR).toArray(new Protocol.File[0]); prog.activate(false); return response; } else { return ep.parseVarint().toArray(new Protocol.File[0]); } } | /**
* Gets Uris for the iCloud backup data
* @param backupUDID The UDID of the device to retrieve info on
* @param snapshotID The ID of the backup to get
* @param offset Where to start
* @param limit Max length
* @throws com.alexhulbert.icewind.autocol.InvalidResponseException Invalid response to the protobuf
* @return A list of files to download
*/ | Gets Uris for the iCloud backup data | listFiles | {
"repo_name": "scorpiovn/Icew1nd",
"path": "Icewind/src/com/alexhulbert/icewind/iCloud.java",
"license": "gpl-2.0",
"size": 15096
} | [
"com.alexhulbert.icewind.autocol.EasyProto",
"com.alexhulbert.icewind.autocol.InvalidResponseException",
"com.alexhulbert.icewind.autocol.ProtoBuilder",
"java.io.File"
] | import com.alexhulbert.icewind.autocol.EasyProto; import com.alexhulbert.icewind.autocol.InvalidResponseException; import com.alexhulbert.icewind.autocol.ProtoBuilder; import java.io.File; | import com.alexhulbert.icewind.autocol.*; import java.io.*; | [
"com.alexhulbert.icewind",
"java.io"
] | com.alexhulbert.icewind; java.io; | 2,583,322 |
private static List<BmMatchParam> buildMatchParamsList(Bmv2MatchKey matchKey) {
List<BmMatchParam> paramsList = Lists.newArrayList();
matchKey.matchParams().forEach(x -> {
ByteBuffer value;
ByteBuffer mask;
switch (x.type()) {
case EXACT:
value = ByteBuffer.wrap(((Bmv2ExactMatchParam) x).value().asArray());
paramsList.add(
new BmMatchParam(BmMatchParamType.EXACT)
.setExact(new BmMatchParamExact(value)));
break;
case TERNARY:
value = ByteBuffer.wrap(((Bmv2TernaryMatchParam) x).value().asArray());
mask = ByteBuffer.wrap(((Bmv2TernaryMatchParam) x).mask().asArray());
paramsList.add(
new BmMatchParam(BmMatchParamType.TERNARY)
.setTernary(new BmMatchParamTernary(value, mask)));
break;
case LPM:
value = ByteBuffer.wrap(((Bmv2LpmMatchParam) x).value().asArray());
int prefixLength = ((Bmv2LpmMatchParam) x).prefixLength();
paramsList.add(
new BmMatchParam(BmMatchParamType.LPM)
.setLpm(new BmMatchParamLPM(value, prefixLength)));
break;
case VALID:
boolean flag = ((Bmv2ValidMatchParam) x).flag();
paramsList.add(
new BmMatchParam(BmMatchParamType.VALID)
.setValid(new BmMatchParamValid(flag)));
break;
default:
// should never be here
throw new RuntimeException("Unknown match param type " + x.type().name());
}
});
return paramsList;
} | static List<BmMatchParam> function(Bmv2MatchKey matchKey) { List<BmMatchParam> paramsList = Lists.newArrayList(); matchKey.matchParams().forEach(x -> { ByteBuffer value; ByteBuffer mask; switch (x.type()) { case EXACT: value = ByteBuffer.wrap(((Bmv2ExactMatchParam) x).value().asArray()); paramsList.add( new BmMatchParam(BmMatchParamType.EXACT) .setExact(new BmMatchParamExact(value))); break; case TERNARY: value = ByteBuffer.wrap(((Bmv2TernaryMatchParam) x).value().asArray()); mask = ByteBuffer.wrap(((Bmv2TernaryMatchParam) x).mask().asArray()); paramsList.add( new BmMatchParam(BmMatchParamType.TERNARY) .setTernary(new BmMatchParamTernary(value, mask))); break; case LPM: value = ByteBuffer.wrap(((Bmv2LpmMatchParam) x).value().asArray()); int prefixLength = ((Bmv2LpmMatchParam) x).prefixLength(); paramsList.add( new BmMatchParam(BmMatchParamType.LPM) .setLpm(new BmMatchParamLPM(value, prefixLength))); break; case VALID: boolean flag = ((Bmv2ValidMatchParam) x).flag(); paramsList.add( new BmMatchParam(BmMatchParamType.VALID) .setValid(new BmMatchParamValid(flag))); break; default: throw new RuntimeException(STR + x.type().name()); } }); return paramsList; } | /**
* Builds a list of Bmv2/Thrift compatible match parameters.
*
* @param matchKey a bmv2 matchKey
* @return list of thrift-compatible bm match parameters
*/ | Builds a list of Bmv2/Thrift compatible match parameters | buildMatchParamsList | {
"repo_name": "donNewtonAlpha/onos",
"path": "protocols/bmv2/ctl/src/main/java/org/onosproject/bmv2/ctl/Bmv2DeviceThriftClient.java",
"license": "apache-2.0",
"size": 20173
} | [
"com.google.common.collect.Lists",
"java.nio.ByteBuffer",
"java.util.List",
"org.onosproject.bmv2.api.runtime.Bmv2ExactMatchParam",
"org.onosproject.bmv2.api.runtime.Bmv2LpmMatchParam",
"org.onosproject.bmv2.api.runtime.Bmv2MatchKey",
"org.onosproject.bmv2.api.runtime.Bmv2TernaryMatchParam",
"org.onos... | import com.google.common.collect.Lists; import java.nio.ByteBuffer; import java.util.List; import org.onosproject.bmv2.api.runtime.Bmv2ExactMatchParam; import org.onosproject.bmv2.api.runtime.Bmv2LpmMatchParam; import org.onosproject.bmv2.api.runtime.Bmv2MatchKey; import org.onosproject.bmv2.api.runtime.Bmv2TernaryMatchParam; import org.onosproject.bmv2.api.runtime.Bmv2ValidMatchParam; import org.onosproject.bmv2.thriftapi.BmMatchParam; import org.onosproject.bmv2.thriftapi.BmMatchParamExact; import org.onosproject.bmv2.thriftapi.BmMatchParamLPM; import org.onosproject.bmv2.thriftapi.BmMatchParamTernary; import org.onosproject.bmv2.thriftapi.BmMatchParamType; import org.onosproject.bmv2.thriftapi.BmMatchParamValid; | import com.google.common.collect.*; import java.nio.*; import java.util.*; import org.onosproject.bmv2.api.runtime.*; import org.onosproject.bmv2.thriftapi.*; | [
"com.google.common",
"java.nio",
"java.util",
"org.onosproject.bmv2"
] | com.google.common; java.nio; java.util; org.onosproject.bmv2; | 1,642,241 |
private String encryptPassword(String password) {
MessageDigest md = null;
StringBuilder sb = new StringBuilder();
byte[] hash;
try {
md = MessageDigest.getInstance("SHA-256");
md.update(this.salt);
hash = md.digest(password.getBytes());
for (int i=0; i<hash.length; i++) {
sb.append(Integer.toString((hash[i]&0xff) + 0x100, 16).substring(1));
}
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
return sb.toString();
}
public User() {}
public User(String id, String password) {
Random randomizer = new Random();
this.id = id;
this.salt = id.getBytes();
randomizer.nextBytes(this.salt);
this.password = this.encryptPassword(password);
}
| String function(String password) { MessageDigest md = null; StringBuilder sb = new StringBuilder(); byte[] hash; try { md = MessageDigest.getInstance(STR); md.update(this.salt); hash = md.digest(password.getBytes()); for (int i=0; i<hash.length; i++) { sb.append(Integer.toString((hash[i]&0xff) + 0x100, 16).substring(1)); } } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } return sb.toString(); } public User() {} public User(String id, String password) { Random randomizer = new Random(); this.id = id; this.salt = id.getBytes(); randomizer.nextBytes(this.salt); this.password = this.encryptPassword(password); } | /**
* Creates a hash out of the given password String.
* Used for Saving the Password to the database and for validating during login procedure.
*
* @param password The password to be encrypted
* @return The encrypted password hash
*/ | Creates a hash out of the given password String. Used for Saving the Password to the database and for validating during login procedure | encryptPassword | {
"repo_name": "m11t/paf-quiz",
"path": "src/main/java/m11/mib/paf/quiz/user/User.java",
"license": "mit",
"size": 5142
} | [
"java.security.MessageDigest",
"java.security.NoSuchAlgorithmException",
"java.util.Random"
] | import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.Random; | import java.security.*; import java.util.*; | [
"java.security",
"java.util"
] | java.security; java.util; | 165,370 |
public static Calendar getTime(Date date) {
return getTime(date.getTime());
} | static Calendar function(Date date) { return getTime(date.getTime()); } | /**
* Derives a Calendar object from a Date object
* @param date date object
* @return Calendar object
*/ | Derives a Calendar object from a Date object | getTime | {
"repo_name": "elegnamnden/tsl-trust",
"path": "common/src/main/java/se/tillvaxtverket/tsltrust/common/utils/general/GeneralStaticUtils.java",
"license": "gpl-3.0",
"size": 6348
} | [
"java.util.Calendar",
"java.util.Date"
] | import java.util.Calendar; import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 696,054 |
@Test
public void whenStringIsNotContainsSubStringThenTrue() {
String origin = "Hello world!";
String sub = "word";
DetectSubStr d = new DetectSubStr();
boolean result = d.contains(origin, sub);
assertThat(result, is(false));
}
| void function() { String origin = STR; String sub = "word"; DetectSubStr d = new DetectSubStr(); boolean result = d.contains(origin, sub); assertThat(result, is(false)); } | /**
* Test detect subtring in string(false).
*/ | Test detect subtring in string(false) | whenStringIsNotContainsSubStringThenTrue | {
"repo_name": "nik1202/EduProject",
"path": "chapter_001/src/test/java/ru/substr/DetectSubStrTest.java",
"license": "apache-2.0",
"size": 2211
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 1,085,076 |
@Test void testMemberFunction() {
sql("SELECT myColumn.func(a, b) FROM tbl")
.ok("SELECT `MYCOLUMN`.`FUNC`(`A`, `B`)\n"
+ "FROM `TBL`");
sql("SELECT myColumn.mySubField.func() FROM tbl")
.ok("SELECT `MYCOLUMN`.`MYSUBFIELD`.`FUNC`()\n"
+ "FROM `TBL`");
sql("SELECT tbl.myColumn.mySubField.func() FROM tbl")
.ok("SELECT `TBL`.`MYCOLUMN`.`MYSUBFIELD`.`FUNC`()\n"
+ "FROM `TBL`");
sql("SELECT tbl.foo(0).col.bar(2, 3) FROM tbl")
.ok("SELECT ((`TBL`.`FOO`(0).`COL`).`BAR`(2, 3))\n"
+ "FROM `TBL`");
} | @Test void testMemberFunction() { sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); sql(STR) .ok(STR + STR); } | /**
* Tests that applying member function of a specific type as a suffix function
*/ | Tests that applying member function of a specific type as a suffix function | testMemberFunction | {
"repo_name": "googleinterns/calcite",
"path": "parsing/src/test/java/org/apache/calcite/test/SqlDialectParserTest.java",
"license": "apache-2.0",
"size": 360542
} | [
"org.junit.jupiter.api.Test"
] | import org.junit.jupiter.api.Test; | import org.junit.jupiter.api.*; | [
"org.junit.jupiter"
] | org.junit.jupiter; | 253,140 |
public static int getR_Request_ID (String mailText)
{
if (mailText == null)
return 0;
int indexStart = mailText.indexOf(TAG_START);
if (indexStart == -1)
return 0;
int indexEnd = mailText.indexOf(TAG_END, indexStart);
if (indexEnd == -1)
return 0;
//
indexStart += 5;
String idString = mailText.substring(indexStart, indexEnd);
int R_Request_ID = 0;
try
{
R_Request_ID = Integer.parseInt(idString);
}
catch (Exception e)
{
s_log.severe ("Cannot parse " + idString);
}
return R_Request_ID;
} // getR_Request_ID
private static CLogger s_log = CLogger.getCLogger (MRequest.class);
private static final String TAG_START = "[Req#";
private static final String TAG_END = "#ID]";
public MRequest(Properties ctx, int R_Request_ID, String trxName)
{
super (ctx, R_Request_ID, trxName);
if (R_Request_ID == 0)
{
setDueType (DUETYPE_Due);
// setSalesRep_ID (0);
// setDocumentNo (null);
setConfidentialType (CONFIDENTIALTYPE_PublicInformation); // A
setConfidentialTypeEntry (CONFIDENTIALTYPEENTRY_PublicInformation); // A
setProcessed (false);
setRequestAmt (Env.ZERO);
setPriorityUser (PRIORITY_Low);
// setR_RequestType_ID (0);
// setSummary (null);
setIsEscalated (false);
setIsSelfService (false);
setIsInvoiced (false);
}
} // MRequest
public MRequest (Properties ctx, int SalesRep_ID,
int R_RequestType_ID, String Summary, boolean isSelfService, String trxName)
{
this(ctx, 0, trxName);
set_Value ("SalesRep_ID", new Integer(SalesRep_ID)); // could be 0
set_Value ("R_RequestType_ID", new Integer(R_RequestType_ID));
setSummary (Summary);
setIsSelfService(isSelfService);
getRequestType();
if (m_requestType != null)
{
String ct = m_requestType.getConfidentialType();
if (ct != null)
{
setConfidentialType (ct);
setConfidentialTypeEntry (ct);
}
}
} // MRequest
public MRequest (Properties ctx, ResultSet rs, String trxName)
{
super(ctx, rs, trxName);
} // MRequest
private MRequestType m_requestType = null;
private boolean m_changed = false;
private MBPartner m_partner = null;
private MUser m_user = null;
private StringBuffer m_emailTo = new StringBuffer();
public static final String SEPARATOR =
"\n---------.----------.----------.----------.----------.----------\n";
| static int function (String mailText) { if (mailText == null) return 0; int indexStart = mailText.indexOf(TAG_START); if (indexStart == -1) return 0; int indexEnd = mailText.indexOf(TAG_END, indexStart); if (indexEnd == -1) return 0; indexStart += 5; String idString = mailText.substring(indexStart, indexEnd); int R_Request_ID = 0; try { R_Request_ID = Integer.parseInt(idString); } catch (Exception e) { s_log.severe (STR + idString); } return R_Request_ID; } private static CLogger s_log = CLogger.getCLogger (MRequest.class); private static final String TAG_START = "[Req#"; private static final String TAG_END = "#ID]"; public MRequest(Properties ctx, int R_Request_ID, String trxName) { super (ctx, R_Request_ID, trxName); if (R_Request_ID == 0) { setDueType (DUETYPE_Due); setConfidentialType (CONFIDENTIALTYPE_PublicInformation); setConfidentialTypeEntry (CONFIDENTIALTYPEENTRY_PublicInformation); setProcessed (false); setRequestAmt (Env.ZERO); setPriorityUser (PRIORITY_Low); setIsEscalated (false); setIsSelfService (false); setIsInvoiced (false); } } public MRequest (Properties ctx, int SalesRep_ID, int R_RequestType_ID, String Summary, boolean isSelfService, String trxName) { this(ctx, 0, trxName); set_Value (STR, new Integer(SalesRep_ID)); set_Value (STR, new Integer(R_RequestType_ID)); setSummary (Summary); setIsSelfService(isSelfService); getRequestType(); if (m_requestType != null) { String ct = m_requestType.getConfidentialType(); if (ct != null) { setConfidentialType (ct); setConfidentialTypeEntry (ct); } } } public MRequest (Properties ctx, ResultSet rs, String trxName) { super(ctx, rs, trxName); } private MRequestType m_requestType = null; private boolean m_changed = false; private MBPartner m_partner = null; private MUser m_user = null; private StringBuffer m_emailTo = new StringBuffer(); public static final String SEPARATOR = STR; | /**
* Get Request ID from mail text
* @param mailText mail text
* @return ID if it contains request tag otherwise 0
*/ | Get Request ID from mail text | getR_Request_ID | {
"repo_name": "erpcya/adempierePOS",
"path": "base/src/org/compiere/model/MRequest.java",
"license": "gpl-2.0",
"size": 37907
} | [
"java.sql.ResultSet",
"java.util.Properties",
"org.compiere.util.CLogger",
"org.compiere.util.Env"
] | import java.sql.ResultSet; import java.util.Properties; import org.compiere.util.CLogger; import org.compiere.util.Env; | import java.sql.*; import java.util.*; import org.compiere.util.*; | [
"java.sql",
"java.util",
"org.compiere.util"
] | java.sql; java.util; org.compiere.util; | 279,060 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.