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
|
---|---|---|---|---|---|---|---|---|---|---|---|
public static
AffineTransform getPreserveAspectRatioTransform(Element e,
float[] vb,
float w,
float h,
BridgeContext ctx) {
String aspectRatio
= e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE);
// 'preserveAspectRatio' attribute
PreserveAspectRatioParser p = new PreserveAspectRatioParser();
ViewHandler ph = new ViewHandler();
p.setPreserveAspectRatioHandler(ph);
try {
p.parse(aspectRatio);
} catch (ParseException pEx ) {
throw new BridgeException
(ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED,
new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE,
aspectRatio, pEx });
}
return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h);
} | static AffineTransform function(Element e, float[] vb, float w, float h, BridgeContext ctx) { String aspectRatio = e.getAttributeNS(null, SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE); PreserveAspectRatioParser p = new PreserveAspectRatioParser(); ViewHandler ph = new ViewHandler(); p.setPreserveAspectRatioHandler(ph); try { p.parse(aspectRatio); } catch (ParseException pEx ) { throw new BridgeException (ctx, e, pEx, ERR_ATTRIBUTE_VALUE_MALFORMED, new Object[] {SVG_PRESERVE_ASPECT_RATIO_ATTRIBUTE, aspectRatio, pEx }); } return getPreserveAspectRatioTransform(vb, ph.align, ph.meet, w, h); } | /**
* Returns the transformation matrix to apply to initalize a viewport or
* null if the specified viewBox disables the rendering of the element.
*
* @param e the element with a viewbox
* @param vb the viewBox definition as float
* @param w the width of the effective viewport
* @param h The height of the effective viewport
* @param ctx The BridgeContext to use for error information
*/ | Returns the transformation matrix to apply to initalize a viewport or null if the specified viewBox disables the rendering of the element | getPreserveAspectRatioTransform | {
"repo_name": "adufilie/flex-sdk",
"path": "modules/thirdparty/batik/sources/org/apache/flex/forks/batik/bridge/ViewBox.java",
"license": "apache-2.0",
"size": 26968
} | [
"java.awt.geom.AffineTransform",
"org.apache.flex.forks.batik.parser.ParseException",
"org.apache.flex.forks.batik.parser.PreserveAspectRatioParser",
"org.w3c.dom.Element"
]
| import java.awt.geom.AffineTransform; import org.apache.flex.forks.batik.parser.ParseException; import org.apache.flex.forks.batik.parser.PreserveAspectRatioParser; import org.w3c.dom.Element; | import java.awt.geom.*; import org.apache.flex.forks.batik.parser.*; import org.w3c.dom.*; | [
"java.awt",
"org.apache.flex",
"org.w3c.dom"
]
| java.awt; org.apache.flex; org.w3c.dom; | 2,904,198 |
private Criterion createTemporalCriterion(TimeOperator operator, String property, Time time) {
return createTemporalCriterion(operator, property, property, time);
} | Criterion function(TimeOperator operator, String property, Time time) { return createTemporalCriterion(operator, property, property, time); } | /**
* Create a {@code Criterion} for the specified temporal relation.
*
* @param operator the temporal relation type
* @param property the column holding the time
* @param time the time instant or period to compare against
*
* @return the criterion
*/ | Create a Criterion for the specified temporal relation | createTemporalCriterion | {
"repo_name": "SpeckiJ/dao-series-api",
"path": "dao/src/main/java/org/n52/series/db/dao/FESCriterionGenerator.java",
"license": "gpl-3.0",
"size": 49796
} | [
"org.hibernate.criterion.Criterion",
"org.n52.shetland.ogc.filter.FilterConstants",
"org.n52.shetland.ogc.gml.time.Time"
]
| import org.hibernate.criterion.Criterion; import org.n52.shetland.ogc.filter.FilterConstants; import org.n52.shetland.ogc.gml.time.Time; | import org.hibernate.criterion.*; import org.n52.shetland.ogc.filter.*; import org.n52.shetland.ogc.gml.time.*; | [
"org.hibernate.criterion",
"org.n52.shetland"
]
| org.hibernate.criterion; org.n52.shetland; | 1,332,305 |
int cancelLoopMembers(GraphBuildingContext context, Map<Chain, LoopState> visited);
} | int cancelLoopMembers(GraphBuildingContext context, Map<Chain, LoopState> visited); } | /**
* Detects any recursion in the onward chain of callbacks, canceling one or more of them to break the recursion by allowing a failure to propagate outwards.
*
* @param context the graph building context
* @param visited the map of visited callbacks to their loop detection state, no entry in the map if not visited
* @return the number of callbacks that were canceled
*/ | Detects any recursion in the onward chain of callbacks, canceling one or more of them to break the recursion by allowing a failure to propagate outwards | cancelLoopMembers | {
"repo_name": "McLeodMoores/starling",
"path": "projects/engine/src/main/java/com/opengamma/engine/depgraph/ResolvedValueProducer.java",
"license": "apache-2.0",
"size": 2434
} | [
"java.util.Map"
]
| import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 492,367 |
WorkspaceImpl get(String id) throws NotFoundException, ServerException; | WorkspaceImpl get(String id) throws NotFoundException, ServerException; | /**
* Gets workspace by identifier.
*
* @param id workspace identifier
* @return workspace instance, never null
* @throws NullPointerException when {@code id} is null
* @throws NotFoundException when workspace with given {@code id} was not found
* @throws ServerException when any other error occurs during workspace fetching
*/ | Gets workspace by identifier | get | {
"repo_name": "codenvy/che",
"path": "wsmaster/che-core-api-workspace/src/main/java/org/eclipse/che/api/workspace/server/spi/WorkspaceDao.java",
"license": "epl-1.0",
"size": 5630
} | [
"org.eclipse.che.api.core.NotFoundException",
"org.eclipse.che.api.core.ServerException",
"org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl"
]
| import org.eclipse.che.api.core.NotFoundException; import org.eclipse.che.api.core.ServerException; import org.eclipse.che.api.workspace.server.model.impl.WorkspaceImpl; | import org.eclipse.che.api.core.*; import org.eclipse.che.api.workspace.server.model.impl.*; | [
"org.eclipse.che"
]
| org.eclipse.che; | 825,979 |
public URL url() {
try {
return new URL(reference);
}
catch(MalformedURLException mue) {
return null;
}
}
| URL function() { try { return new URL(reference); } catch(MalformedURLException mue) { return null; } } | /**
* Gets the reference of this <CODE>Anchor</CODE>.
*
* @return an <CODE>URL</CODE>
*/ | Gets the reference of this <code>Anchor</code> | url | {
"repo_name": "MesquiteProject/MesquiteCore",
"path": "LibrarySource/com/lowagie/text/Anchor.java",
"license": "lgpl-3.0",
"size": 10366
} | [
"java.net.MalformedURLException"
]
| import java.net.MalformedURLException; | import java.net.*; | [
"java.net"
]
| java.net; | 2,144,337 |
public Person add(Person person) {
em.persist(person);
em.flush();
return person;
}
| Person function(Person person) { em.persist(person); em.flush(); return person; } | /**
* Add a person to the table.
*/ | Add a person to the table | add | {
"repo_name": "wangf1/play",
"path": "hcp/hcpjava/src/com/wangf/hcp/sdc/persistence/dao/PersonDaoEjb.java",
"license": "apache-2.0",
"size": 827
} | [
"com.wangf.hcp.sdc.persistence.entity.Person"
]
| import com.wangf.hcp.sdc.persistence.entity.Person; | import com.wangf.hcp.sdc.persistence.entity.*; | [
"com.wangf.hcp"
]
| com.wangf.hcp; | 133,961 |
@Override
public boolean shouldPrepare(DatabaseQuery query) {
return (query.getDatasourceCall() instanceof EISInteraction);
}
| boolean function(DatabaseQuery query) { return (query.getDatasourceCall() instanceof EISInteraction); } | /**
* Do not prepare dynamic queries, as the translation row is required.
*/ | Do not prepare dynamic queries, as the translation row is required | shouldPrepare | {
"repo_name": "bfg-repo-cleaner-demos/eclipselink.runtime-bfg-strip-big-blobs",
"path": "foundation/org.eclipse.persistence.nosql/src/org/eclipse/persistence/nosql/adapters/mongo/MongoPlatform.java",
"license": "epl-1.0",
"size": 26332
} | [
"org.eclipse.persistence.eis.interactions.EISInteraction",
"org.eclipse.persistence.queries.DatabaseQuery"
]
| import org.eclipse.persistence.eis.interactions.EISInteraction; import org.eclipse.persistence.queries.DatabaseQuery; | import org.eclipse.persistence.eis.interactions.*; import org.eclipse.persistence.queries.*; | [
"org.eclipse.persistence"
]
| org.eclipse.persistence; | 942,122 |
@Generated
@Selector("setEnabled:")
public native void setEnabled(boolean value); | @Selector(STR) native void function(boolean value); | /**
* Indicates whether the interaction is enabled. Defaults to YES.
*/ | Indicates whether the interaction is enabled. Defaults to YES | setEnabled | {
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/uikit/UIToolTipInteraction.java",
"license": "apache-2.0",
"size": 6424
} | [
"org.moe.natj.objc.ann.Selector"
]
| import org.moe.natj.objc.ann.Selector; | import org.moe.natj.objc.ann.*; | [
"org.moe.natj"
]
| org.moe.natj; | 2,257,581 |
public Message getChangedSubject() {
return roomSubject;
} | Message function() { return roomSubject; } | /**
* Returns the message within the history of the room that has changed the
* room's subject.
*
* @return the latest room subject change or null if none exists yet.
*/ | Returns the message within the history of the room that has changed the room's subject | getChangedSubject | {
"repo_name": "speedy01/Openfire",
"path": "xmppserver/src/main/java/org/jivesoftware/openfire/muc/HistoryStrategy.java",
"license": "apache-2.0",
"size": 12829
} | [
"org.xmpp.packet.Message"
]
| import org.xmpp.packet.Message; | import org.xmpp.packet.*; | [
"org.xmpp.packet"
]
| org.xmpp.packet; | 696,975 |
public final FormulaVo getFormula() {
return formula;
} | final FormulaVo function() { return formula; } | /**
* Get parsed result.
*
* @return FormulaOrTerm.
*/ | Get parsed result | getFormula | {
"repo_name": "m-31/qedeq",
"path": "QedeqKernelXml/src/org/qedeq/kernel/xml/handler/module/FormulaHandler.java",
"license": "gpl-2.0",
"size": 2471
} | [
"org.qedeq.kernel.se.dto.module.FormulaVo"
]
| import org.qedeq.kernel.se.dto.module.FormulaVo; | import org.qedeq.kernel.se.dto.module.*; | [
"org.qedeq.kernel"
]
| org.qedeq.kernel; | 92,284 |
public void updateBoolean (String columnName, boolean columnValue) throws SQLException
{
validateResultSet();
resultSet_.updateBoolean (columnName, columnValue);
eventSupport_.fireRowChanged(new RowSetEvent(this));
} | void function (String columnName, boolean columnValue) throws SQLException { validateResultSet(); resultSet_.updateBoolean (columnName, columnValue); eventSupport_.fireRowChanged(new RowSetEvent(this)); } | /**
* Updates a column in the current row using a Java boolean value.
* The driver converts this to an SQL SMALLINT value.
*
* <p>This does not update the database directly. Instead, it updates
* a copy of the data in memory. Call updateRow() or insertRow() to
* update the database.
*
* @param columnName The column name.
* @param columnValue The column value.
*
* @exception SQLException If the result set is not open,
* the result set is not updatable,
* the cursor is not positioned on a row,
* the column name is not found, or the
* requested conversion is not valid.
**/ | Updates a column in the current row using a Java boolean value. The driver converts this to an SQL SMALLINT value. This does not update the database directly. Instead, it updates a copy of the data in memory. Call updateRow() or insertRow() to update the database | updateBoolean | {
"repo_name": "piguangming/jt400",
"path": "jdbc40/com/ibm/as400/access/AS400JDBCRowSet.java",
"license": "epl-1.0",
"size": 308525
} | [
"java.sql.SQLException",
"javax.sql.RowSetEvent"
]
| import java.sql.SQLException; import javax.sql.RowSetEvent; | import java.sql.*; import javax.sql.*; | [
"java.sql",
"javax.sql"
]
| java.sql; javax.sql; | 522,717 |
checkNotNull(metricsRegistry, "metricsRegistry");
OperatingSystemMXBean mxBean = ManagementFactory.getOperatingSystemMXBean();
registerMethod(metricsRegistry, mxBean, "getCommittedVirtualMemorySize", "os.committedVirtualMemorySize");
registerMethod(metricsRegistry, mxBean, "getFreePhysicalMemorySize", "os.freePhysicalMemorySize");
registerMethod(metricsRegistry, mxBean, "getFreeSwapSpaceSize", "os.freeSwapSpaceSize");
registerMethod(metricsRegistry, mxBean, "getProcessCpuTime", "os.processCpuTime");
registerMethod(metricsRegistry, mxBean, "getTotalPhysicalMemorySize", "os.totalPhysicalMemorySize");
registerMethod(metricsRegistry, mxBean, "getTotalSwapSpaceSize", "os.totalSwapSpaceSize");
registerMethod(metricsRegistry, mxBean, "getMaxFileDescriptorCount", "os.maxFileDescriptorCount");
registerMethod(metricsRegistry, mxBean, "getOpenFileDescriptorCount", "os.openFileDescriptorCount");
registerMethod(metricsRegistry, mxBean, "getProcessCpuLoad", "os.processCpuLoad");
registerMethod(metricsRegistry, mxBean, "getSystemCpuLoad", "os.systemCpuLoad"); | checkNotNull(metricsRegistry, STR); OperatingSystemMXBean mxBean = ManagementFactory.getOperatingSystemMXBean(); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); registerMethod(metricsRegistry, mxBean, STR, STR); | /**
* Registers all the metrics in this metrics pack.
*
* @param metricsRegistry the MetricsRegistry upon which the metrics are registered.
*/ | Registers all the metrics in this metrics pack | register | {
"repo_name": "lmjacksoniii/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/internal/metrics/metricsets/OperatingSystemMetricSet.java",
"license": "apache-2.0",
"size": 4926
} | [
"java.lang.management.ManagementFactory",
"java.lang.management.OperatingSystemMXBean"
]
| import java.lang.management.ManagementFactory; import java.lang.management.OperatingSystemMXBean; | import java.lang.management.*; | [
"java.lang"
]
| java.lang; | 2,252,319 |
public Adapter createBoolAdapter() {
return null;
} | Adapter function() { return null; } | /**
* Creates a new adapter for an object of class
* '{@link fr.lip6.move.pnml.pthlpng.booleans.Bool <em>Bool</em>}'. <!--
* begin-user-doc --> This default implementation returns null so that we can
* easily ignore cases; it's useful to ignore a case when inheritance will catch
* all the cases anyway. <!-- end-user-doc -->
*
* @return the new adapter.
* @see fr.lip6.move.pnml.pthlpng.booleans.Bool
* @generated
*/ | Creates a new adapter for an object of class '<code>fr.lip6.move.pnml.pthlpng.booleans.Bool Bool</code>'. This default implementation returns null so that we can easily ignore cases; it's useful to ignore a case when inheritance will catch all the cases anyway. | createBoolAdapter | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-PT-HLPNG/src/fr/lip6/move/pnml/pthlpng/booleans/util/BooleansAdapterFactory.java",
"license": "epl-1.0",
"size": 13761
} | [
"org.eclipse.emf.common.notify.Adapter"
]
| import org.eclipse.emf.common.notify.Adapter; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
]
| org.eclipse.emf; | 917,013 |
public Set<String> placeholders() {
return m_Placeholders.keySet();
} | Set<String> function() { return m_Placeholders.keySet(); } | /**
* Returns all stored placeholder keys (local + global).
*
* @return the placeholder keys (local + global)
*/ | Returns all stored placeholder keys (local + global) | placeholders | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/main/java/adams/core/Placeholders.java",
"license": "gpl-3.0",
"size": 12244
} | [
"java.util.Set"
]
| import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 2,516,556 |
List<Product> deleteProduct(long clientId, Product product); | List<Product> deleteProduct(long clientId, Product product); | /**
* Delete product for the client.
*
* @param clientId client id.
* @param product product to be deleted.
*/ | Delete product for the client | deleteProduct | {
"repo_name": "jamalgithub/workdev",
"path": "multi-module-maven-project-2/business/impl/src/main/com/example/mock/data/client/ProductDO.java",
"license": "apache-2.0",
"size": 1007
} | [
"com.in28minutes.example.layering.model.impl.client.Product",
"java.util.List"
]
| import com.in28minutes.example.layering.model.impl.client.Product; import java.util.List; | import com.in28minutes.example.layering.model.impl.client.*; import java.util.*; | [
"com.in28minutes.example",
"java.util"
]
| com.in28minutes.example; java.util; | 2,241,639 |
public void print(PrintStream out) {
out.println("FilePartType = [" + getFilePartType() + "]");
out.println("GraphicID = [" + getGraphicID() + "]");
out.println("GraphicName = [" + getName() + "]");
out.println("GraphicSecurityClass = [" + getSecurityClass() + "]");
getSecurityGroup().print(out);
out.println("Encryption = [" + getEncrypted() + "]");
out.println("GraphicType = [" + getStype() + "]");
out.println("Reserved1 = [" + getRes1() + "]");
out.println("DisplayLevel = [" + getDisplayLevel() + "]");
out.println("AttachmentLevel = [" + getAttachmentLevel() + "]");
out.println("GraphicLocation = [" + getLocation() + "]");
out.println("BoundLocation1 = [" + getBound1Loc() + "]");
out.println("Color = [" + getColor() + "]");
out.println("BoundLocation2 = [" + getBound2Loc() + "]");
out.println("Reserved2 = [" + getRes2() + "]");
out.println("Reserved2 = [" + getExtendedHeaderLength() + "]");
} | void function(PrintStream out) { out.println(STR + getFilePartType() + "]"); out.println(STR + getGraphicID() + "]"); out.println(STR + getName() + "]"); out.println(STR + getSecurityClass() + "]"); getSecurityGroup().print(out); out.println(STR + getEncrypted() + "]"); out.println(STR + getStype() + "]"); out.println(STR + getRes1() + "]"); out.println(STR + getDisplayLevel() + "]"); out.println(STR + getAttachmentLevel() + "]"); out.println(STR + getLocation() + "]"); out.println(STR + getBound1Loc() + "]"); out.println(STR + getColor() + "]"); out.println(STR + getBound2Loc() + "]"); out.println(STR + getRes2() + "]"); out.println(STR + getExtendedHeaderLength() + "]"); } | /**
* Prints the data associated with the GraphicSubheader to a PrintStream
*
* @param out
*/ | Prints the data associated with the GraphicSubheader to a PrintStream | print | {
"repo_name": "oscarpicas/s2tbx",
"path": "s2tbx-rapideye-reader/src/main/java/nitf/GraphicSubheader.java",
"license": "gpl-3.0",
"size": 5666
} | [
"java.io.PrintStream"
]
| import java.io.PrintStream; | import java.io.*; | [
"java.io"
]
| java.io; | 2,835,170 |
public Node appendChild(Node newChild) {
if (newChild == null) {
throw new IllegalArgumentException("newChild == null!");
}
checkNode(newChild);
// insertBefore will increment numChildren
return insertBefore(newChild, null);
} | Node function(Node newChild) { if (newChild == null) { throw new IllegalArgumentException(STR); } checkNode(newChild); return insertBefore(newChild, null); } | /**
* Adds the node {@code newChild} to the end of the list of
* children of this node.
*
* @param newChild the {@code Node} to insert.
*
* @return the node added.
*
* @exception IllegalArgumentException if {@code newChild} is
* {@code null}.
*/ | Adds the node newChild to the end of the list of children of this node | appendChild | {
"repo_name": "mirkosertic/Bytecoder",
"path": "classlib/java.desktop/src/main/resources/META-INF/modules/java.desktop/classes/javax/imageio/metadata/IIOMetadataNode.java",
"license": "apache-2.0",
"size": 32881
} | [
"org.w3c.dom.Node"
]
| import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
]
| org.w3c.dom; | 2,565,126 |
ServerConnection getOrConnect(Address address, int streamId); | ServerConnection getOrConnect(Address address, int streamId); | /**
* Gets the existing connection for a given address or connects.
* <p>
* Default implementation is equivalent to calling:
* <pre>{@code
* getOrConnect(address, false)
* }</pre>
*
* @param address the address to connect to
* @param streamId the stream id
* @return the found connection, or {@code null} if no connection exists
* @see #getOrConnect(Address, boolean)
*/ | Gets the existing connection for a given address or connects. Default implementation is equivalent to calling: <code>getOrConnect(address, false) </code> | getOrConnect | {
"repo_name": "emre-aydin/hazelcast",
"path": "hazelcast/src/main/java/com/hazelcast/internal/server/ServerConnectionManager.java",
"license": "apache-2.0",
"size": 8305
} | [
"com.hazelcast.cluster.Address"
]
| import com.hazelcast.cluster.Address; | import com.hazelcast.cluster.*; | [
"com.hazelcast.cluster"
]
| com.hazelcast.cluster; | 2,742,104 |
public int findNrPrevJobEntries( JobEntryCopy to, boolean info ) {
int count = 0;
for ( JobHopMeta hi : jobhops ) {
// Look at all the hops
if ( hi.isEnabled() && hi.getToEntry().equals( to ) ) {
count++;
}
}
return count;
} | int function( JobEntryCopy to, boolean info ) { int count = 0; for ( JobHopMeta hi : jobhops ) { if ( hi.isEnabled() && hi.getToEntry().equals( to ) ) { count++; } } return count; } | /**
* Find nr prev job entries.
*
* @param to the to
* @param info the info
* @return the int
*/ | Find nr prev job entries | findNrPrevJobEntries | {
"repo_name": "TatsianaKasiankova/pentaho-kettle",
"path": "engine/src/main/java/org/pentaho/di/job/JobMeta.java",
"license": "apache-2.0",
"size": 87172
} | [
"org.pentaho.di.job.entry.JobEntryCopy"
]
| import org.pentaho.di.job.entry.JobEntryCopy; | import org.pentaho.di.job.entry.*; | [
"org.pentaho.di"
]
| org.pentaho.di; | 901,096 |
public void onTargetChange() {
AndroidTargetData targetData = mConfigChooser.onXmlModelLoaded();
updateCapabilities(targetData);
changed(CHANGED_FOLDER | CHANGED_RENDER_TARGET);
} | void function() { AndroidTargetData targetData = mConfigChooser.onXmlModelLoaded(); updateCapabilities(targetData); changed(CHANGED_FOLDER CHANGED_RENDER_TARGET); } | /**
* Responds to a target change for the project of the edited file
*/ | Responds to a target change for the project of the edited file | onTargetChange | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "sdk/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java",
"license": "gpl-2.0",
"size": 114055
} | [
"com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData"
]
| import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; | import com.android.ide.eclipse.adt.internal.sdk.*; | [
"com.android.ide"
]
| com.android.ide; | 2,273,016 |
void onPlaybackStatsReady(EventTime eventTime, PlaybackStats playbackStats);
}
private final PlaybackSessionManager sessionManager;
private final Map<String, PlaybackStatsTracker> playbackStatsTrackers;
private final Map<String, EventTime> sessionStartEventTimes;
@Nullable private final Callback callback;
private final boolean keepHistory;
private final Period period;
private PlaybackStats finishedPlaybackStats;
@Nullable private String discontinuityFromSession;
private long discontinuityFromPositionMs;
@Player.DiscontinuityReason private int discontinuityReason;
private int droppedFrames;
@Nullable private Exception nonFatalException;
private long bandwidthTimeMs;
private long bandwidthBytes;
@Nullable private Format videoFormat;
@Nullable private Format audioFormat;
private VideoSize videoSize;
public PlaybackStatsListener(boolean keepHistory, @Nullable Callback callback) {
this.callback = callback;
this.keepHistory = keepHistory;
sessionManager = new DefaultPlaybackSessionManager();
playbackStatsTrackers = new HashMap<>();
sessionStartEventTimes = new HashMap<>();
finishedPlaybackStats = PlaybackStats.EMPTY;
period = new Period();
videoSize = VideoSize.UNKNOWN;
sessionManager.setListener(this);
} | void onPlaybackStatsReady(EventTime eventTime, PlaybackStats playbackStats); } private final PlaybackSessionManager sessionManager; private final Map<String, PlaybackStatsTracker> playbackStatsTrackers; private final Map<String, EventTime> sessionStartEventTimes; @Nullable private final Callback callback; private final boolean keepHistory; private final Period period; private PlaybackStats finishedPlaybackStats; @Nullable private String discontinuityFromSession; private long discontinuityFromPositionMs; @Player.DiscontinuityReason private int discontinuityReason; private int droppedFrames; @Nullable private Exception nonFatalException; private long bandwidthTimeMs; private long bandwidthBytes; @Nullable private Format videoFormat; @Nullable private Format audioFormat; private VideoSize videoSize; public PlaybackStatsListener(boolean keepHistory, @Nullable Callback callback) { this.callback = callback; this.keepHistory = keepHistory; sessionManager = new DefaultPlaybackSessionManager(); playbackStatsTrackers = new HashMap<>(); sessionStartEventTimes = new HashMap<>(); finishedPlaybackStats = PlaybackStats.EMPTY; period = new Period(); videoSize = VideoSize.UNKNOWN; sessionManager.setListener(this); } | /**
* Called when a playback session ends and its {@link PlaybackStats} are ready.
*
* @param eventTime The {@link EventTime} at which the playback session started. Can be used to
* identify the playback session.
* @param playbackStats The {@link PlaybackStats} for the ended playback session.
*/ | Called when a playback session ends and its <code>PlaybackStats</code> are ready | onPlaybackStatsReady | {
"repo_name": "ened/ExoPlayer",
"path": "library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStatsListener.java",
"license": "apache-2.0",
"size": 37986
} | [
"androidx.annotation.Nullable",
"com.google.android.exoplayer2.Format",
"com.google.android.exoplayer2.Player",
"com.google.android.exoplayer2.Timeline",
"com.google.android.exoplayer2.video.VideoSize",
"java.util.HashMap",
"java.util.Map"
]
| import androidx.annotation.Nullable; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.video.VideoSize; import java.util.HashMap; import java.util.Map; | import androidx.annotation.*; import com.google.android.exoplayer2.*; import com.google.android.exoplayer2.video.*; import java.util.*; | [
"androidx.annotation",
"com.google.android",
"java.util"
]
| androidx.annotation; com.google.android; java.util; | 2,708,757 |
if (!checkBeanOfType(FreeMarkerConfigurer.class)) {
throw new BeanInitializationException("In addition to a FreeMarker view resolver " +
"there must also be a single FreeMarkerConfig bean in this web application context " +
"(or its parent): FreeMarkerConfigurer is the usual implementation. " +
"This bean may be given any name.");
}
FreeMarkerRegistration registration = new FreeMarkerRegistration();
UrlBasedViewResolver resolver = registration.getViewResolver();
if (this.applicationContext != null) {
resolver.setApplicationContext(this.applicationContext);
}
this.viewResolvers.add(resolver);
return registration;
} | if (!checkBeanOfType(FreeMarkerConfigurer.class)) { throw new BeanInitializationException(STR + STR + STR + STR); } FreeMarkerRegistration registration = new FreeMarkerRegistration(); UrlBasedViewResolver resolver = registration.getViewResolver(); if (this.applicationContext != null) { resolver.setApplicationContext(this.applicationContext); } this.viewResolvers.add(resolver); return registration; } | /**
* Register a {@code FreeMarkerViewResolver} with a ".ftl" suffix.
* <p><strong>Note</strong> that you must also configure FreeMarker by
* adding a {@link FreeMarkerConfigurer} bean.
*/ | Register a FreeMarkerViewResolver with a ".ftl" suffix. Note that you must also configure FreeMarker by adding a <code>FreeMarkerConfigurer</code> bean | freeMarker | {
"repo_name": "spring-projects/spring-framework",
"path": "spring-webflux/src/main/java/org/springframework/web/reactive/config/ViewResolverRegistry.java",
"license": "apache-2.0",
"size": 6536
} | [
"org.springframework.beans.factory.BeanInitializationException",
"org.springframework.web.reactive.result.view.UrlBasedViewResolver",
"org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer"
]
| import org.springframework.beans.factory.BeanInitializationException; import org.springframework.web.reactive.result.view.UrlBasedViewResolver; import org.springframework.web.reactive.result.view.freemarker.FreeMarkerConfigurer; | import org.springframework.beans.factory.*; import org.springframework.web.reactive.result.view.*; import org.springframework.web.reactive.result.view.freemarker.*; | [
"org.springframework.beans",
"org.springframework.web"
]
| org.springframework.beans; org.springframework.web; | 72,427 |
public ArrayList<Fact> createFacts (MAcctSchema as)
{
return null;
} // createFact
| ArrayList<Fact> function (MAcctSchema as) { return null; } | /**
* Create Facts (the accounting logic) for
* @param as accounting schema
* @return Fact
*/ | Create Facts (the accounting logic) for | createFacts | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiereLibero/extension/eevolution/libero/src/main/java/org/compiere/acct/Doc_DDOrder.java",
"license": "gpl-2.0",
"size": 2757
} | [
"java.util.ArrayList",
"org.compiere.model.MAcctSchema"
]
| import java.util.ArrayList; import org.compiere.model.MAcctSchema; | import java.util.*; import org.compiere.model.*; | [
"java.util",
"org.compiere.model"
]
| java.util; org.compiere.model; | 1,764,416 |
public static void main(String[] args) {
TerminalWindow window = new TerminalWindow();
new PatientMonitorClient(window);
} | static void function(String[] args) { TerminalWindow window = new TerminalWindow(); new PatientMonitorClient(window); } | /**
* Starts the patmon1 client.
*
* @param args
*/ | Starts the patmon1 client | main | {
"repo_name": "hip4/patmon1",
"path": "src/client/src/main/java/ch/bfh/ti/sed/patmon1/client/PatientMonitorClient.java",
"license": "apache-2.0",
"size": 3159
} | [
"ch.bfh.ti.sed.patmon1.client.cli.TerminalWindow"
]
| import ch.bfh.ti.sed.patmon1.client.cli.TerminalWindow; | import ch.bfh.ti.sed.patmon1.client.cli.*; | [
"ch.bfh.ti"
]
| ch.bfh.ti; | 1,339,841 |
@Test
public void alphaTest() {
DataPipe pipeToTransform = new DataPipe();
EquivalenceClassTransformer eqTransformer = new EquivalenceClassTransformer();
pipeToTransform.getDataMap().put("TEST", "%alpha(1)");
eqTransformer.transform(pipeToTransform);
Pattern alphaPattern = Pattern.compile("^[a-z0-9A-Z]{1}$");
Matcher didItMatch = alphaPattern.matcher(pipeToTransform.getDataMap().get("TEST"));
Assert.assertTrue(didItMatch.matches());
pipeToTransform.getDataMap().put("TEST", "%alpha(100)");
eqTransformer.transform(pipeToTransform);
alphaPattern = Pattern.compile("^[a-z0-9A-Z]{100}$");
didItMatch = alphaPattern.matcher(pipeToTransform.getDataMap().get("TEST"));
Assert.assertTrue(didItMatch.matches());
pipeToTransform.getDataMap().put("TEST", "%alpha(0)");
eqTransformer.transform(pipeToTransform);
Assert.assertEquals("", pipeToTransform.getDataMap().get("TEST"));
}
| void function() { DataPipe pipeToTransform = new DataPipe(); EquivalenceClassTransformer eqTransformer = new EquivalenceClassTransformer(); pipeToTransform.getDataMap().put("TEST", STR); eqTransformer.transform(pipeToTransform); Pattern alphaPattern = Pattern.compile(STR); Matcher didItMatch = alphaPattern.matcher(pipeToTransform.getDataMap().get("TEST")); Assert.assertTrue(didItMatch.matches()); pipeToTransform.getDataMap().put("TEST", STR); eqTransformer.transform(pipeToTransform); alphaPattern = Pattern.compile(STR); didItMatch = alphaPattern.matcher(pipeToTransform.getDataMap().get("TEST")); Assert.assertTrue(didItMatch.matches()); pipeToTransform.getDataMap().put("TEST", STR); eqTransformer.transform(pipeToTransform); Assert.assertEquals(STRTEST")); } | /**
* %alpha macro
*/ | %alpha macro | alphaTest | {
"repo_name": "leeny324/DataGenerator",
"path": "dg-core/src/test/java/org/finra/datagenerator/consumer/EquivalenceClassTransformerTest.java",
"license": "apache-2.0",
"size": 27496
} | [
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.junit.Assert"
]
| import java.util.regex.Matcher; import java.util.regex.Pattern; import org.junit.Assert; | import java.util.regex.*; import org.junit.*; | [
"java.util",
"org.junit"
]
| java.util; org.junit; | 1,619,498 |
public Builder setDefaults(int defaults) {
mNotification.defaults = defaults;
if ((defaults & Notification.DEFAULT_LIGHTS) != 0) {
mNotification.flags |= Notification.FLAG_SHOW_LIGHTS;
}
return this;
} | Builder function(int defaults) { mNotification.defaults = defaults; if ((defaults & Notification.DEFAULT_LIGHTS) != 0) { mNotification.flags = Notification.FLAG_SHOW_LIGHTS; } return this; } | /**
* Set the default notification options that will be used.
* <p>
* The value should be one or more of the following fields combined with
* bitwise-or:
* {@link Notification#DEFAULT_SOUND}, {@link Notification#DEFAULT_VIBRATE},
* {@link Notification#DEFAULT_LIGHTS}.
* <p>
* For all default values, use {@link Notification#DEFAULT_ALL}.
*/ | Set the default notification options that will be used. The value should be one or more of the following fields combined with bitwise-or: <code>Notification#DEFAULT_SOUND</code>, <code>Notification#DEFAULT_VIBRATE</code>, <code>Notification#DEFAULT_LIGHTS</code>. For all default values, use <code>Notification#DEFAULT_ALL</code> | setDefaults | {
"repo_name": "JSDemos/android-sdk-20",
"path": "src/android/support/v4/app/NotificationCompat.java",
"license": "apache-2.0",
"size": 97653
} | [
"android.app.Notification"
]
| import android.app.Notification; | import android.app.*; | [
"android.app"
]
| android.app; | 235,983 |
public JComponent getEditComponent(); | JComponent function(); | /**
* Gets the GUI component to edit
*
* @return the component to edit
*/ | Gets the GUI component to edit | getEditComponent | {
"repo_name": "gditzler/MassiveOnlineAnalysis",
"path": "moa/src/moa-2013.08-sources/moa-src/src/main/java/moa/options/Option.java",
"license": "gpl-3.0",
"size": 2644
} | [
"javax.swing.JComponent"
]
| import javax.swing.JComponent; | import javax.swing.*; | [
"javax.swing"
]
| javax.swing; | 1,482,501 |
public void cancelAlarm(Context context) {
// If the alarm has been set, cancel it.
if (alarmMgr!= null) {
alarmMgr.cancel(alarmIntent);
}
} | void function(Context context) { if (alarmMgr!= null) { alarmMgr.cancel(alarmIntent); } } | /**
* Cancels the alarm.
* @param context
*/ | Cancels the alarm | cancelAlarm | {
"repo_name": "CSUChico-CSCI567/CSCI567_Workspace_Spring2015",
"path": "Lecture7/app/src/main/java/examples/csci567/lecture7/AlarmReceiver.java",
"license": "mit",
"size": 3600
} | [
"android.content.Context"
]
| import android.content.Context; | import android.content.*; | [
"android.content"
]
| android.content; | 1,980,385 |
private void initForm(HttpServletRequest request,
MyDBSessionController myDBSC, boolean consultation, boolean newRecord)
throws MyDBException, FormException {
Form form = myDBSC.getForm(consultation, newRecord,
getSessionControlBeanName());
request.setAttribute("form", form);
PagesContext context = new PagesContext("detail", "0", myDBSC.getLanguage());
request.setAttribute("context", context);
DataRecord data = myDBSC.getRecord(newRecord);
request.setAttribute("data", data);
} | void function(HttpServletRequest request, MyDBSessionController myDBSC, boolean consultation, boolean newRecord) throws MyDBException, FormException { Form form = myDBSC.getForm(consultation, newRecord, getSessionControlBeanName()); request.setAttribute("form", form); PagesContext context = new PagesContext(STR, "0", myDBSC.getLanguage()); request.setAttribute(STR, context); DataRecord data = myDBSC.getRecord(newRecord); request.setAttribute("data", data); } | /**
* Creates the objects used to initialize the XML form describing a database record.
* @param request The HTTP request.
* @param myDBSC The session control.
* @param consultation Indicates if data have to be displayed as labels or input fields.
* @param newRecord Indicates if the form corresponds to a creation or a modification of a
* database record.
* @throws MyDBException
* @throws FormException
*/ | Creates the objects used to initialize the XML form describing a database record | initForm | {
"repo_name": "CecileBONIN/Silverpeas-Components",
"path": "mydb/mydb-war/src/main/java/com/silverpeas/mydb/servlets/MyDBRequestRouter.java",
"license": "agpl-3.0",
"size": 23727
} | [
"com.silverpeas.form.DataRecord",
"com.silverpeas.form.Form",
"com.silverpeas.form.FormException",
"com.silverpeas.form.PagesContext",
"com.silverpeas.mydb.control.MyDBSessionController",
"com.silverpeas.mydb.exception.MyDBException",
"javax.servlet.http.HttpServletRequest"
]
| import com.silverpeas.form.DataRecord; import com.silverpeas.form.Form; import com.silverpeas.form.FormException; import com.silverpeas.form.PagesContext; import com.silverpeas.mydb.control.MyDBSessionController; import com.silverpeas.mydb.exception.MyDBException; import javax.servlet.http.HttpServletRequest; | import com.silverpeas.form.*; import com.silverpeas.mydb.control.*; import com.silverpeas.mydb.exception.*; import javax.servlet.http.*; | [
"com.silverpeas.form",
"com.silverpeas.mydb",
"javax.servlet"
]
| com.silverpeas.form; com.silverpeas.mydb; javax.servlet; | 2,021,955 |
private TableScoresUI createTableScoresUI(String table) throws ContentTypeNotBoundException
{
TableScoresUI ui = new TableScoresUI(table);
IContainer rootContainer = stage.getContentFactory().create(IContainer.class, "", UUID.randomUUID());
container.addItem(rootContainer);
ui.buildUI(rootContainer, stage.getContentFactory());
setLocationForTableUI(rootContainer);
container.getZOrderManager().updateOrder();
return ui;
} | TableScoresUI function(String table) throws ContentTypeNotBoundException { TableScoresUI ui = new TableScoresUI(table); IContainer rootContainer = stage.getContentFactory().create(IContainer.class, "", UUID.randomUUID()); container.addItem(rootContainer); ui.buildUI(rootContainer, stage.getContentFactory()); setLocationForTableUI(rootContainer); container.getZOrderManager().updateOrder(); return ui; } | /**
* Creates the table scores ui.
*
* @param table
* the table
* @return the table scores ui
* @throws ContentTypeNotBoundException
* the content type not bound exception
*/ | Creates the table scores ui | createTableScoresUI | {
"repo_name": "synergynet/synergynet3.1",
"path": "synergynet3.1-parent/synergynet3-numbernet-table/src/main/java/synergynet3/apps/numbernet/ui/projection/scores/ProjectScoresUI.java",
"license": "bsd-3-clause",
"size": 3897
} | [
"java.util.UUID"
]
| import java.util.UUID; | import java.util.*; | [
"java.util"
]
| java.util; | 433,480 |
public List<Spatial> getChildren() {
return children;
} | List<Spatial> function() { return children; } | /**
* Returns all children to this node. Note that modifying that given
* list is not allowed.
*
* @return a list containing all children to this node
*/ | Returns all children to this node. Note that modifying that given list is not allowed | getChildren | {
"repo_name": "PlanetWaves/clockworkengine",
"path": "branches/3.0/engine/src/core/com/clockwork/scene/Node.java",
"license": "apache-2.0",
"size": 19068
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 286,455 |
GeodesyObservationsFilter filter = new GeodesyObservationsFilter(stationId, startDate, endDate);
HttpMethodBase method = null;
List<GeodesyObservation> allObservations = new ArrayList<GeodesyObservation>();
try {
//Make our request
method = this.generateWFSRequest(wfsUrl, "geodesy:station_observations", null, filter.getFilterStringAllRecords(), null, null, ResultType.Results);
InputStream response = httpServiceCaller.getMethodResponseAsStream(method);
//Parse it into a DOM doc
GeodesyNamespaceContext nc = new GeodesyNamespaceContext();
Document domDoc = DOMUtil.buildDomFromStream(response);
//Parse the dom doc into observation POJOs
XPathExpression exprStationId = DOMUtil.compileXPathExpr("geodesy:station_id", nc);
XPathExpression exprDate = DOMUtil.compileXPathExpr("geodesy:ob_date", nc);
XPathExpression exprUrl = DOMUtil.compileXPathExpr("geodesy:url", nc);
NodeList observationNodes = (NodeList) DOMUtil.compileXPathExpr("wfs:FeatureCollection/gml:featureMembers/geodesy:station_observations", nc).evaluate(domDoc, XPathConstants.NODESET);
for (int i = 0; i < observationNodes.getLength(); i++) {
Node observationNode = observationNodes.item(i);
String parsedId = (String) exprStationId.evaluate(observationNode, XPathConstants.STRING);
String parsedDate = (String) exprDate.evaluate(observationNode, XPathConstants.STRING);
String parsedUrl = (String) exprUrl.evaluate(observationNode, XPathConstants.STRING);
allObservations.add(new GeodesyObservation(parsedId, parsedDate, parsedUrl));
}
} catch (Exception ex) {
throw new PortalServiceException(method);
} finally {
if (method != null) {
method.releaseConnection();
}
}
return allObservations;
}
| GeodesyObservationsFilter filter = new GeodesyObservationsFilter(stationId, startDate, endDate); HttpMethodBase method = null; List<GeodesyObservation> allObservations = new ArrayList<GeodesyObservation>(); try { method = this.generateWFSRequest(wfsUrl, STR, null, filter.getFilterStringAllRecords(), null, null, ResultType.Results); InputStream response = httpServiceCaller.getMethodResponseAsStream(method); GeodesyNamespaceContext nc = new GeodesyNamespaceContext(); Document domDoc = DOMUtil.buildDomFromStream(response); XPathExpression exprStationId = DOMUtil.compileXPathExpr(STR, nc); XPathExpression exprDate = DOMUtil.compileXPathExpr(STR, nc); XPathExpression exprUrl = DOMUtil.compileXPathExpr(STR, nc); NodeList observationNodes = (NodeList) DOMUtil.compileXPathExpr(STR, nc).evaluate(domDoc, XPathConstants.NODESET); for (int i = 0; i < observationNodes.getLength(); i++) { Node observationNode = observationNodes.item(i); String parsedId = (String) exprStationId.evaluate(observationNode, XPathConstants.STRING); String parsedDate = (String) exprDate.evaluate(observationNode, XPathConstants.STRING); String parsedUrl = (String) exprUrl.evaluate(observationNode, XPathConstants.STRING); allObservations.add(new GeodesyObservation(parsedId, parsedDate, parsedUrl)); } } catch (Exception ex) { throw new PortalServiceException(method); } finally { if (method != null) { method.releaseConnection(); } } return allObservations; } | /**
* Gets all the observations for a particular station
* @param stationId The station ID to limit the filter to
* @param startDate The start date in the form 'YYYY-mm-DD'
* @param endDate The end date in the form 'YYYY-mm-DD'
* @return
*/ | Gets all the observations for a particular station | getObservationsForStation | {
"repo_name": "AuScope/EOI-TCP",
"path": "src/main/java/org/auscope/portal/server/web/service/GeodesyService.java",
"license": "gpl-3.0",
"size": 4139
} | [
"java.io.InputStream",
"java.util.ArrayList",
"java.util.List",
"javax.xml.xpath.XPathConstants",
"javax.xml.xpath.XPathExpression",
"org.apache.commons.httpclient.HttpMethodBase",
"org.auscope.portal.core.services.PortalServiceException",
"org.auscope.portal.core.services.methodmakers.WFSGetFeatureMethodMaker",
"org.auscope.portal.core.util.DOMUtil",
"org.auscope.portal.server.domain.geodesy.GeodesyNamespaceContext",
"org.auscope.portal.server.domain.geodesy.GeodesyObservation",
"org.auscope.portal.server.domain.geodesy.GeodesyObservationsFilter",
"org.w3c.dom.Document",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList"
]
| import java.io.InputStream; import java.util.ArrayList; import java.util.List; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpression; import org.apache.commons.httpclient.HttpMethodBase; import org.auscope.portal.core.services.PortalServiceException; import org.auscope.portal.core.services.methodmakers.WFSGetFeatureMethodMaker; import org.auscope.portal.core.util.DOMUtil; import org.auscope.portal.server.domain.geodesy.GeodesyNamespaceContext; import org.auscope.portal.server.domain.geodesy.GeodesyObservation; import org.auscope.portal.server.domain.geodesy.GeodesyObservationsFilter; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.w3c.dom.NodeList; | import java.io.*; import java.util.*; import javax.xml.xpath.*; import org.apache.commons.httpclient.*; import org.auscope.portal.core.services.*; import org.auscope.portal.core.services.methodmakers.*; import org.auscope.portal.core.util.*; import org.auscope.portal.server.domain.geodesy.*; import org.w3c.dom.*; | [
"java.io",
"java.util",
"javax.xml",
"org.apache.commons",
"org.auscope.portal",
"org.w3c.dom"
]
| java.io; java.util; javax.xml; org.apache.commons; org.auscope.portal; org.w3c.dom; | 2,020,582 |
public void fail(JSONObject err) {
this.callbackContext.error(err);
} | void function(JSONObject err) { this.callbackContext.error(err); } | /**
* Send error message to JavaScript.
*
* @param err
*/ | Send error message to JavaScript | fail | {
"repo_name": "magmastonealex/PGApp",
"path": "plugins/org.apache.cordova.core.media-capture/src/android/Capture.java",
"license": "apache-2.0",
"size": 18353
} | [
"org.json.JSONObject"
]
| import org.json.JSONObject; | import org.json.*; | [
"org.json"
]
| org.json; | 2,065,289 |
public static void writeQualifierSkippingBytes(DataOutputStream out, Cell cell, int qlength,
int commonPrefix) throws IOException {
if (cell instanceof ByteBufferExtendedCell) {
ByteBufferUtils.copyBufferToStream((DataOutput) out,
((ByteBufferExtendedCell) cell).getQualifierByteBuffer(),
((ByteBufferExtendedCell) cell).getQualifierPosition() + commonPrefix,
qlength - commonPrefix);
} else {
out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix,
qlength - commonPrefix);
}
} | static void function(DataOutputStream out, Cell cell, int qlength, int commonPrefix) throws IOException { if (cell instanceof ByteBufferExtendedCell) { ByteBufferUtils.copyBufferToStream((DataOutput) out, ((ByteBufferExtendedCell) cell).getQualifierByteBuffer(), ((ByteBufferExtendedCell) cell).getQualifierPosition() + commonPrefix, qlength - commonPrefix); } else { out.write(cell.getQualifierArray(), cell.getQualifierOffset() + commonPrefix, qlength - commonPrefix); } } | /**
* Writes the qualifier from the given cell to the output stream excluding the common prefix
* @param out The dataoutputstream to which the data has to be written
* @param cell The cell whose contents has to be written
* @param qlength the qualifier length
* @throws IOException
*/ | Writes the qualifier from the given cell to the output stream excluding the common prefix | writeQualifierSkippingBytes | {
"repo_name": "ChinmaySKulkarni/hbase",
"path": "hbase-common/src/main/java/org/apache/hadoop/hbase/PrivateCellUtil.java",
"license": "apache-2.0",
"size": 99961
} | [
"java.io.DataOutput",
"java.io.DataOutputStream",
"java.io.IOException",
"org.apache.hadoop.hbase.util.ByteBufferUtils"
]
| import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import org.apache.hadoop.hbase.util.ByteBufferUtils; | import java.io.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
]
| java.io; org.apache.hadoop; | 848,749 |
public Number getWeekday() {
return this.weekday;
}
| Number function() { return this.weekday; } | /**
* The day of the week (1-7, sunday = 1).
*
* @return the Number.
*/ | The day of the week (1-7, sunday = 1) | getWeekday | {
"repo_name": "NABUCCO/org.nabucco.framework.setup",
"path": "org.nabucco.framework.setup.facade.datatype/src/main/gen/org/nabucco/framework/setup/facade/datatype/agent/CronTrigger.java",
"license": "epl-1.0",
"size": 14235
} | [
"org.nabucco.framework.base.facade.datatype.Number"
]
| import org.nabucco.framework.base.facade.datatype.Number; | import org.nabucco.framework.base.facade.datatype.*; | [
"org.nabucco.framework"
]
| org.nabucco.framework; | 2,559,138 |
public Observable<ServiceResponse<Page<EndpointServiceResultInner>>> listSinglePageAsync(final String location) {
if (location == null) {
throw new IllegalArgumentException("Parameter location is required and cannot be null.");
}
if (this.client.subscriptionId() == null) {
throw new IllegalArgumentException("Parameter this.client.subscriptionId() is required and cannot be null.");
} | Observable<ServiceResponse<Page<EndpointServiceResultInner>>> function(final String location) { if (location == null) { throw new IllegalArgumentException(STR); } if (this.client.subscriptionId() == null) { throw new IllegalArgumentException(STR); } | /**
* List what values of endpoint services are available for use.
*
ServiceResponse<PageImpl<EndpointServiceResultInner>> * @param location The location to check available endpoint services.
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the PagedList<EndpointServiceResultInner> object wrapped in {@link ServiceResponse} if successful.
*/ | List what values of endpoint services are available for use | listSinglePageAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/network/mgmt-v2019_11_01/src/main/java/com/microsoft/azure/management/network/v2019_11_01/implementation/AvailableEndpointServicesInner.java",
"license": "mit",
"size": 15786
} | [
"com.microsoft.azure.Page",
"com.microsoft.rest.ServiceResponse"
]
| import com.microsoft.azure.Page; import com.microsoft.rest.ServiceResponse; | import com.microsoft.azure.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
]
| com.microsoft.azure; com.microsoft.rest; | 978,449 |
public Set<String> getConfiguredNodeLabels(String queuePath) {
Set<String> configuredNodeLabels = new HashSet<String>();
Entry<String, String> e = null;
Iterator<Entry<String, String>> iter = iterator();
while (iter.hasNext()) {
e = iter.next();
String key = e.getKey();
if (key.startsWith(getQueuePrefix(queuePath) + ACCESSIBLE_NODE_LABELS
+ DOT)) {
// Find <label-name> in
// <queue-path>.accessible-node-labels.<label-name>.property
int labelStartIdx =
key.indexOf(ACCESSIBLE_NODE_LABELS)
+ ACCESSIBLE_NODE_LABELS.length() + 1;
int labelEndIndx = key.indexOf('.', labelStartIdx);
String labelName = key.substring(labelStartIdx, labelEndIndx);
configuredNodeLabels.add(labelName);
}
}
// always add NO_LABEL
configuredNodeLabels.add(RMNodeLabelsManager.NO_LABEL);
return configuredNodeLabels;
} | Set<String> function(String queuePath) { Set<String> configuredNodeLabels = new HashSet<String>(); Entry<String, String> e = null; Iterator<Entry<String, String>> iter = iterator(); while (iter.hasNext()) { e = iter.next(); String key = e.getKey(); if (key.startsWith(getQueuePrefix(queuePath) + ACCESSIBLE_NODE_LABELS + DOT)) { int labelStartIdx = key.indexOf(ACCESSIBLE_NODE_LABELS) + ACCESSIBLE_NODE_LABELS.length() + 1; int labelEndIndx = key.indexOf('.', labelStartIdx); String labelName = key.substring(labelStartIdx, labelEndIndx); configuredNodeLabels.add(labelName); } } configuredNodeLabels.add(RMNodeLabelsManager.NO_LABEL); return configuredNodeLabels; } | /**
* Get configured node labels in a given queuePath
*/ | Get configured node labels in a given queuePath | getConfiguredNodeLabels | {
"repo_name": "GeLiXin/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/CapacitySchedulerConfiguration.java",
"license": "apache-2.0",
"size": 74917
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.Map",
"java.util.Set",
"org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager"
]
| import java.util.HashSet; import java.util.Iterator; import java.util.Map; import java.util.Set; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; | import java.util.*; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.*; | [
"java.util",
"org.apache.hadoop"
]
| java.util; org.apache.hadoop; | 877,359 |
@Deprecated
public Set<String> getEncodedUrlBlacklist() {
return getEncodedUrlBlocklist();
} | Set<String> function() { return getEncodedUrlBlocklist(); } | /**
* Provides the existing encoded url blocklist which can add/remove entries from
* @return the existing encoded url blocklist, never null
* @deprecated Use {@link #getEncodedUrlBlocklist()} instead
*/ | Provides the existing encoded url blocklist which can add/remove entries from | getEncodedUrlBlacklist | {
"repo_name": "spring-projects/spring-security",
"path": "web/src/main/java/org/springframework/security/web/firewall/StrictHttpFirewall.java",
"license": "apache-2.0",
"size": 26144
} | [
"java.util.Set"
]
| import java.util.Set; | import java.util.*; | [
"java.util"
]
| java.util; | 866,875 |
public void setDecompressor(Decompressor decompressor) {
this.decompressor = checkNotNull(decompressor, "Can't pass an empty decompressor");
} | void function(Decompressor decompressor) { this.decompressor = checkNotNull(decompressor, STR); } | /**
* Sets the decompressor available to use. The message encoding for the stream comes later in
* time, and thus will not be available at the time of construction. This should only be set
* once, since the compression codec cannot change after the headers have been sent.
*
* @param decompressor the decompressing wrapper.
*/ | Sets the decompressor available to use. The message encoding for the stream comes later in time, and thus will not be available at the time of construction. This should only be set once, since the compression codec cannot change after the headers have been sent | setDecompressor | {
"repo_name": "xzy256/grpc-java-mips64",
"path": "core/src/main/java/io/grpc/internal/MessageDeframer.java",
"license": "bsd-3-clause",
"size": 14826
} | [
"com.google.common.base.Preconditions",
"io.grpc.Decompressor"
]
| import com.google.common.base.Preconditions; import io.grpc.Decompressor; | import com.google.common.base.*; import io.grpc.*; | [
"com.google.common",
"io.grpc"
]
| com.google.common; io.grpc; | 2,711,716 |
@Override
public String getText(Object object) {
String label = ((Pipe)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_Pipe_type") :
getString("_UI_Pipe_type") + " " + label;
}
| String function(Object object) { String label = ((Pipe)object).getName(); return label == null label.length() == 0 ? getString(STR) : getString(STR) + " " + label; } | /**
* This returns the label text for the adapted class.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This returns the label text for the adapted class. | getText | {
"repo_name": "jarrah42/eavp",
"path": "org.eclipse.january.geometry.model.edit/src/org/eclipse/january/geometry/provider/PipeItemProvider.java",
"license": "epl-1.0",
"size": 7740
} | [
"org.eclipse.january.geometry.Pipe"
]
| import org.eclipse.january.geometry.Pipe; | import org.eclipse.january.geometry.*; | [
"org.eclipse.january"
]
| org.eclipse.january; | 154,858 |
public static BufferedImage rotateImage(Image inImage, int inMaxWidth, int inMaxHeight, int inRotationDegrees)
{
// Create scaled image of suitable size
boolean isRotated = (inRotationDegrees % 180 != 0);
int origWidth = inImage.getWidth(null);
int origHeight = inImage.getHeight(null);
int thumbWidth = isRotated?origHeight:origWidth;
int thumbHeight = isRotated?origWidth:origHeight;
Dimension scaledSize = getThumbnailSize(thumbWidth, thumbHeight, inMaxWidth, inMaxHeight);
BufferedImage result = new BufferedImage(scaledSize.width, scaledSize.height, BufferedImage.TYPE_INT_RGB);
// Do different things according to rotation angle (a bit messy, sorry!)
if (inRotationDegrees == 0)
{
// Not rotated, so just copy image directly
result.getGraphics().drawImage(inImage, 0, 0, scaledSize.width, scaledSize.height, null);
}
else
{
// Need to use Graphics2D for rotation, not Graphics
Graphics2D g2d = result.createGraphics();
switch (inRotationDegrees)
{
case 90:
g2d.rotate(Math.PI / 2, 0.0, 0.0);
g2d.drawImage(inImage, 0, -scaledSize.width, scaledSize.height, scaledSize.width, null);
break;
case 180:
g2d.rotate(Math.PI, scaledSize.width/2.0, scaledSize.height/2.0);
g2d.drawImage(inImage, 0, 0, scaledSize.width, scaledSize.height, null);
break;
case 270:
g2d.rotate(Math.PI * 3/2, 0.0, 0.0);
g2d.drawImage(inImage, -scaledSize.height, 0, scaledSize.height, scaledSize.width, null);
}
// Clear up memory
g2d.dispose();
}
return result;
} | static BufferedImage function(Image inImage, int inMaxWidth, int inMaxHeight, int inRotationDegrees) { boolean isRotated = (inRotationDegrees % 180 != 0); int origWidth = inImage.getWidth(null); int origHeight = inImage.getHeight(null); int thumbWidth = isRotated?origHeight:origWidth; int thumbHeight = isRotated?origWidth:origHeight; Dimension scaledSize = getThumbnailSize(thumbWidth, thumbHeight, inMaxWidth, inMaxHeight); BufferedImage result = new BufferedImage(scaledSize.width, scaledSize.height, BufferedImage.TYPE_INT_RGB); if (inRotationDegrees == 0) { result.getGraphics().drawImage(inImage, 0, 0, scaledSize.width, scaledSize.height, null); } else { Graphics2D g2d = result.createGraphics(); switch (inRotationDegrees) { case 90: g2d.rotate(Math.PI / 2, 0.0, 0.0); g2d.drawImage(inImage, 0, -scaledSize.width, scaledSize.height, scaledSize.width, null); break; case 180: g2d.rotate(Math.PI, scaledSize.width/2.0, scaledSize.height/2.0); g2d.drawImage(inImage, 0, 0, scaledSize.width, scaledSize.height, null); break; case 270: g2d.rotate(Math.PI * 3/2, 0.0, 0.0); g2d.drawImage(inImage, -scaledSize.height, 0, scaledSize.height, scaledSize.width, null); } g2d.dispose(); } return result; } | /**
* Create a new image by rotating and scaling the given one
* @param inImage input image
* @param inMaxWidth maximum width of output image
* @param inMaxHeight maximum height of output image
* @param inRotationDegrees number of degrees to rotate clockwise (0, 90, 180 or 270)
* @return rotated, scaled image
*/ | Create a new image by rotating and scaling the given one | rotateImage | {
"repo_name": "sebastic/GpsPrune",
"path": "tim/prune/gui/ImageUtils.java",
"license": "gpl-2.0",
"size": 4708
} | [
"java.awt.Dimension",
"java.awt.Graphics2D",
"java.awt.Image",
"java.awt.image.BufferedImage"
]
| import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Image; import java.awt.image.BufferedImage; | import java.awt.*; import java.awt.image.*; | [
"java.awt"
]
| java.awt; | 2,087,992 |
public static void resourceGroupQueryLegacy(
com.azure.resourcemanager.costmanagement.CostManagementManager costManagementManager) {
costManagementManager
.queries()
.usageWithResponse(
"subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/ScreenSharingTest-peer",
new QueryDefinition()
.withType(ExportType.USAGE)
.withTimeframe(TimeframeType.MONTH_TO_DATE)
.withDataset(
new QueryDataset()
.withGranularity(GranularityType.DAILY)
.withFilter(
new QueryFilter()
.withAnd(
Arrays
.asList(
new QueryFilter()
.withOr(
Arrays
.asList(
new QueryFilter()
.withDimensions(
new QueryComparisonExpression()
.withName("ResourceLocation")
.withOperator(OperatorType.IN)
.withValues(
Arrays
.asList("East US", "West Europe"))),
new QueryFilter()
.withTags(
new QueryComparisonExpression()
.withName("Environment")
.withOperator(OperatorType.IN)
.withValues(
Arrays.asList("UAT", "Prod"))))),
new QueryFilter()
.withDimensions(
new QueryComparisonExpression()
.withName("ResourceGroup")
.withOperator(OperatorType.IN)
.withValues(Arrays.asList("API"))))))),
Context.NONE);
} | static void function( com.azure.resourcemanager.costmanagement.CostManagementManager costManagementManager) { costManagementManager .queries() .usageWithResponse( STR, new QueryDefinition() .withType(ExportType.USAGE) .withTimeframe(TimeframeType.MONTH_TO_DATE) .withDataset( new QueryDataset() .withGranularity(GranularityType.DAILY) .withFilter( new QueryFilter() .withAnd( Arrays .asList( new QueryFilter() .withOr( Arrays .asList( new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues( Arrays .asList(STR, STR))), new QueryFilter() .withTags( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues( Arrays.asList("UAT", "Prod"))))), new QueryFilter() .withDimensions( new QueryComparisonExpression() .withName(STR) .withOperator(OperatorType.IN) .withValues(Arrays.asList("API"))))))), Context.NONE); } | /**
* Sample code: ResourceGroupQuery-Legacy.
*
* @param costManagementManager Entry point to CostManagementManager.
*/ | Sample code: ResourceGroupQuery-Legacy | resourceGroupQueryLegacy | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/costmanagement/azure-resourcemanager-costmanagement/src/samples/java/com/azure/resourcemanager/costmanagement/QueryUsageSamples.java",
"license": "mit",
"size": 48220
} | [
"com.azure.core.util.Context",
"com.azure.resourcemanager.costmanagement.models.ExportType",
"com.azure.resourcemanager.costmanagement.models.GranularityType",
"com.azure.resourcemanager.costmanagement.models.OperatorType",
"com.azure.resourcemanager.costmanagement.models.QueryComparisonExpression",
"com.azure.resourcemanager.costmanagement.models.QueryDataset",
"com.azure.resourcemanager.costmanagement.models.QueryDefinition",
"com.azure.resourcemanager.costmanagement.models.QueryFilter",
"com.azure.resourcemanager.costmanagement.models.TimeframeType",
"java.util.Arrays"
]
| import com.azure.core.util.Context; import com.azure.resourcemanager.costmanagement.models.ExportType; import com.azure.resourcemanager.costmanagement.models.GranularityType; import com.azure.resourcemanager.costmanagement.models.OperatorType; import com.azure.resourcemanager.costmanagement.models.QueryComparisonExpression; import com.azure.resourcemanager.costmanagement.models.QueryDataset; import com.azure.resourcemanager.costmanagement.models.QueryDefinition; import com.azure.resourcemanager.costmanagement.models.QueryFilter; import com.azure.resourcemanager.costmanagement.models.TimeframeType; import java.util.Arrays; | import com.azure.core.util.*; import com.azure.resourcemanager.costmanagement.models.*; import java.util.*; | [
"com.azure.core",
"com.azure.resourcemanager",
"java.util"
]
| com.azure.core; com.azure.resourcemanager; java.util; | 1,069,706 |
@Test
public void testMultipleInputWatermarkStatusToggling() throws Exception {
StatusWatermarkOutput valveOutput = new StatusWatermarkOutput();
StatusWatermarkValve valve = new StatusWatermarkValve(2);
// this also implicitly verifies that all input channels start as active
valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 0, valveOutput);
valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 1, valveOutput);
assertEquals(null, valveOutput.popLastSeenOutput());
valve.inputWatermarkStatus(WatermarkStatus.IDLE, 1, valveOutput);
assertEquals(null, valveOutput.popLastSeenOutput());
// now, all channels are IDLE
valve.inputWatermarkStatus(WatermarkStatus.IDLE, 0, valveOutput);
assertEquals(WatermarkStatus.IDLE, valveOutput.popLastSeenOutput());
valve.inputWatermarkStatus(WatermarkStatus.IDLE, 0, valveOutput);
valve.inputWatermarkStatus(WatermarkStatus.IDLE, 1, valveOutput);
assertEquals(null, valveOutput.popLastSeenOutput());
// as soon as at least one input becomes active again, the ACTIVE marker should be forwarded
valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 1, valveOutput);
assertEquals(WatermarkStatus.ACTIVE, valveOutput.popLastSeenOutput());
valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 0, valveOutput);
// already back to ACTIVE, should yield no output
assertEquals(null, valveOutput.popLastSeenOutput());
} | void function() throws Exception { StatusWatermarkOutput valveOutput = new StatusWatermarkOutput(); StatusWatermarkValve valve = new StatusWatermarkValve(2); valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 0, valveOutput); valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 1, valveOutput); assertEquals(null, valveOutput.popLastSeenOutput()); valve.inputWatermarkStatus(WatermarkStatus.IDLE, 1, valveOutput); assertEquals(null, valveOutput.popLastSeenOutput()); valve.inputWatermarkStatus(WatermarkStatus.IDLE, 0, valveOutput); assertEquals(WatermarkStatus.IDLE, valveOutput.popLastSeenOutput()); valve.inputWatermarkStatus(WatermarkStatus.IDLE, 0, valveOutput); valve.inputWatermarkStatus(WatermarkStatus.IDLE, 1, valveOutput); assertEquals(null, valveOutput.popLastSeenOutput()); valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 1, valveOutput); assertEquals(WatermarkStatus.ACTIVE, valveOutput.popLastSeenOutput()); valve.inputWatermarkStatus(WatermarkStatus.ACTIVE, 0, valveOutput); assertEquals(null, valveOutput.popLastSeenOutput()); } | /**
* Tests that watermark status toggling works correctly, as well as that non-toggling status
* inputs do not yield output for a multiple input valve.
*/ | Tests that watermark status toggling works correctly, as well as that non-toggling status inputs do not yield output for a multiple input valve | testMultipleInputWatermarkStatusToggling | {
"repo_name": "lincoln-lil/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/watermarkstatus/StatusWatermarkValveTest.java",
"license": "apache-2.0",
"size": 21289
} | [
"org.junit.Assert"
]
| import org.junit.Assert; | import org.junit.*; | [
"org.junit"
]
| org.junit; | 573,233 |
void createPullRequest(@Nonnull String user, @Nonnull String repository, @Nonnull GitHubPullRequestCreationInput input,
@Nonnull AsyncRequestCallback<GitHubPullRequest> callback); | void createPullRequest(@Nonnull String user, @Nonnull String repository, @Nonnull GitHubPullRequestCreationInput input, @Nonnull AsyncRequestCallback<GitHubPullRequest> callback); | /**
* Create a pull request on origin repository
*
* @param user
* the owner of the repository.
* @param repository
* the repository name.
* @param input
* the pull request information.
* @param callback
* callback called when operation is done.
*/ | Create a pull request on origin repository | createPullRequest | {
"repo_name": "Panthro/che-plugins",
"path": "plugin-github/che-plugin-github-ext-github/src/main/java/org/eclipse/che/ide/ext/github/client/GitHubClientService.java",
"license": "epl-1.0",
"size": 7967
} | [
"javax.annotation.Nonnull",
"org.eclipse.che.ide.ext.github.shared.GitHubPullRequest",
"org.eclipse.che.ide.ext.github.shared.GitHubPullRequestCreationInput",
"org.eclipse.che.ide.rest.AsyncRequestCallback"
]
| import javax.annotation.Nonnull; import org.eclipse.che.ide.ext.github.shared.GitHubPullRequest; import org.eclipse.che.ide.ext.github.shared.GitHubPullRequestCreationInput; import org.eclipse.che.ide.rest.AsyncRequestCallback; | import javax.annotation.*; import org.eclipse.che.ide.ext.github.shared.*; import org.eclipse.che.ide.rest.*; | [
"javax.annotation",
"org.eclipse.che"
]
| javax.annotation; org.eclipse.che; | 586,466 |
void registerAuditPrincipalResolver(String key, PrincipalResolver resolver); | void registerAuditPrincipalResolver(String key, PrincipalResolver resolver); | /**
* Register audit principal resolver.
*
* @param key the key
* @param resolver the resolver
*/ | Register audit principal resolver | registerAuditPrincipalResolver | {
"repo_name": "fogbeam/cas_mirror",
"path": "api/cas-server-core-api-audit/src/main/java/org/apereo/cas/audit/AuditTrailRecordResolutionPlan.java",
"license": "apache-2.0",
"size": 1913
} | [
"org.apereo.inspektr.common.spi.PrincipalResolver"
]
| import org.apereo.inspektr.common.spi.PrincipalResolver; | import org.apereo.inspektr.common.spi.*; | [
"org.apereo.inspektr"
]
| org.apereo.inspektr; | 834,778 |
public CommandLineArgument[] getActiveProcessorArgs() {
final Project p = getProject();
if (p == null) {
throw new java.lang.IllegalStateException("project must be set");
}
if (isReference()) {
return ((ProcessorDef) getCheckedRef(ProcessorDef.class, "ProcessorDef")).getActiveProcessorArgs();
}
final Vector activeArgs = new Vector(this.processorArgs.size());
for (int i = 0; i < this.processorArgs.size(); i++) {
final CommandLineArgument arg = (CommandLineArgument) this.processorArgs.elementAt(i);
if (arg.isActive(p)) {
activeArgs.addElement(arg);
}
}
final CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()];
activeArgs.copyInto(array);
return array;
} | CommandLineArgument[] function() { final Project p = getProject(); if (p == null) { throw new java.lang.IllegalStateException(STR); } if (isReference()) { return ((ProcessorDef) getCheckedRef(ProcessorDef.class, STR)).getActiveProcessorArgs(); } final Vector activeArgs = new Vector(this.processorArgs.size()); for (int i = 0; i < this.processorArgs.size(); i++) { final CommandLineArgument arg = (CommandLineArgument) this.processorArgs.elementAt(i); if (arg.isActive(p)) { activeArgs.addElement(arg); } } final CommandLineArgument[] array = new CommandLineArgument[activeArgs.size()]; activeArgs.copyInto(array); return array; } | /**
* Prepares list of processor arguments ( compilerarg, linkerarg ) that
* are active for the current project settings.
*
* @return active compiler arguments
*/ | Prepares list of processor arguments ( compilerarg, linkerarg ) that are active for the current project settings | getActiveProcessorArgs | {
"repo_name": "Zetten/nar-maven-plugin",
"path": "src/main/java/com/github/maven_nar/cpptasks/ProcessorDef.java",
"license": "apache-2.0",
"size": 21482
} | [
"com.github.maven_nar.cpptasks.types.CommandLineArgument",
"java.util.Vector",
"org.apache.tools.ant.Project"
]
| import com.github.maven_nar.cpptasks.types.CommandLineArgument; import java.util.Vector; import org.apache.tools.ant.Project; | import com.github.maven_nar.cpptasks.types.*; import java.util.*; import org.apache.tools.ant.*; | [
"com.github.maven_nar",
"java.util",
"org.apache.tools"
]
| com.github.maven_nar; java.util; org.apache.tools; | 1,283,504 |
public void desactivar(){
if(!this.validateDesactivar()){
return;
}
this.setEstado(Estado.INACTIVO.getId());
GdeDAOFactory.getEstadoConvenioDAO().update(this);
}
| void function(){ if(!this.validateDesactivar()){ return; } this.setEstado(Estado.INACTIVO.getId()); GdeDAOFactory.getEstadoConvenioDAO().update(this); } | /**
* Desactiva el EstadoConvenio. Previamente valida la desactivacion.
*
*/ | Desactiva el EstadoConvenio. Previamente valida la desactivacion | desactivar | {
"repo_name": "avdata99/SIAT",
"path": "siat-1.0-SOURCE/src/buss/src/ar/gov/rosario/siat/gde/buss/bean/EstadoConvenio.java",
"license": "gpl-3.0",
"size": 4400
} | [
"ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory",
"coop.tecso.demoda.iface.model.Estado"
]
| import ar.gov.rosario.siat.gde.buss.dao.GdeDAOFactory; import coop.tecso.demoda.iface.model.Estado; | import ar.gov.rosario.siat.gde.buss.dao.*; import coop.tecso.demoda.iface.model.*; | [
"ar.gov.rosario",
"coop.tecso.demoda"
]
| ar.gov.rosario; coop.tecso.demoda; | 868,204 |
public COSObject getObjectByType(COSName type) throws IOException {
for (COSObject object : objectPool.values()) {
COSBase realObject = object.getObject();
if (realObject instanceof COSDictionary) {
try {
COSDictionary dic = (COSDictionary) realObject;
COSBase typeItem = dic.getItem(COSName.TYPE);
if (typeItem instanceof COSName) {
COSName objectType = (COSName) typeItem;
if (objectType.equals(type)) {
return object;
}
} else if (typeItem != null) {
LOG.debug("Expected a /Name object after /Type, got '" + typeItem + "' instead");
}
} catch (ClassCastException e) {
LOG.warn(e, e);
}
}
}
return null;
} | COSObject function(COSName type) throws IOException { for (COSObject object : objectPool.values()) { COSBase realObject = object.getObject(); if (realObject instanceof COSDictionary) { try { COSDictionary dic = (COSDictionary) realObject; COSBase typeItem = dic.getItem(COSName.TYPE); if (typeItem instanceof COSName) { COSName objectType = (COSName) typeItem; if (objectType.equals(type)) { return object; } } else if (typeItem != null) { LOG.debug(STR + typeItem + STR); } } catch (ClassCastException e) { LOG.warn(e, e); } } } return null; } | /**
* This will get the first dictionary object by type.
*
* @param type The type of the object.
* @return This will return an object with the specified type.
* @throws IOException If there is an error getting the object
*/ | This will get the first dictionary object by type | getObjectByType | {
"repo_name": "gavanx/pdflearn",
"path": "pdfbox/src/main/java/org/apache/pdfbox/cos/COSDocument.java",
"license": "apache-2.0",
"size": 15995
} | [
"java.io.IOException"
]
| import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 1,999,671 |
protected void completeTransactionAfterThrowing(TransactionInfo txInfo, Throwable ex) {
if (txInfo != null && txInfo.hasTransaction()) {
if (logger.isTraceEnabled()) {
logger.trace("Completing transaction for [" + txInfo.getJoinpointIdentification() +
"] after exception: " + ex);
}
if (txInfo.transactionAttribute.rollbackOn(ex)) {
try {
getTransactionManager().rollback(txInfo.getTransactionStatus());
}
catch (TransactionSystemException ex2) {
logger.error("Application exception overridden by rollback exception", ex);
ex2.initApplicationException(ex);
throw ex2;
}
catch (RuntimeException ex2) {
logger.error("Application exception overridden by rollback exception", ex);
throw ex2;
}
catch (Error err) {
logger.error("Application exception overridden by rollback error", ex);
throw err;
}
}
else {
// We don't roll back on this exception.
// Will still roll back if TransactionStatus.isRollbackOnly() is true.
try {
getTransactionManager().commit(txInfo.getTransactionStatus());
}
catch (TransactionSystemException ex2) {
logger.error("Application exception overridden by commit exception", ex);
ex2.initApplicationException(ex);
throw ex2;
}
catch (RuntimeException ex2) {
logger.error("Application exception overridden by commit exception", ex);
throw ex2;
}
catch (Error err) {
logger.error("Application exception overridden by commit error", ex);
throw err;
}
}
}
} | void function(TransactionInfo txInfo, Throwable ex) { if (txInfo != null && txInfo.hasTransaction()) { if (logger.isTraceEnabled()) { logger.trace(STR + txInfo.getJoinpointIdentification() + STR + ex); } if (txInfo.transactionAttribute.rollbackOn(ex)) { try { getTransactionManager().rollback(txInfo.getTransactionStatus()); } catch (TransactionSystemException ex2) { logger.error(STR, ex); ex2.initApplicationException(ex); throw ex2; } catch (RuntimeException ex2) { logger.error(STR, ex); throw ex2; } catch (Error err) { logger.error(STR, ex); throw err; } } else { try { getTransactionManager().commit(txInfo.getTransactionStatus()); } catch (TransactionSystemException ex2) { logger.error(STR, ex); ex2.initApplicationException(ex); throw ex2; } catch (RuntimeException ex2) { logger.error(STR, ex); throw ex2; } catch (Error err) { logger.error(STR, ex); throw err; } } } } | /**
* Handle a throwable, completing the transaction.
* We may commit or roll back, depending on the configuration.
* @param txInfo information about the current transaction
* @param ex throwable encountered
*/ | Handle a throwable, completing the transaction. We may commit or roll back, depending on the configuration | completeTransactionAfterThrowing | {
"repo_name": "mattxia/spring-2.5-analysis",
"path": "src/org/springframework/transaction/interceptor/TransactionAspectSupport.java",
"license": "apache-2.0",
"size": 17352
} | [
"org.springframework.transaction.TransactionSystemException"
]
| import org.springframework.transaction.TransactionSystemException; | import org.springframework.transaction.*; | [
"org.springframework.transaction"
]
| org.springframework.transaction; | 996,935 |
public void downloadFile(HttpServletResponse response, String filePath, String fileName, boolean isDownload) {
try {
File file = new File(filePath);
if (!file.exists() || !file.isFile()) {
logger.debug("File: " + (filePath) + " Not Exists");
response.setHeader("Content-Type", "text/html; charset=GBK");
ServletOutputStream os = response.getOutputStream();
os.println("文件不存在!联系管理员!");
} else {
if (isDownload) {
response.setHeader("Content-Type", "application/octet-stream; charset=GBK");
response.setHeader("Content-Disposition", "attachment; filename=" + toUtf8String(fileName));
} else {
String contentType = "application/pdf; charset=GBK";
if (fileName != null && fileName.endsWith(".doc")) {
contentType = "application/msword; charset=GBK";
response.setHeader("Content-Type", contentType);
} else if (fileName != null && fileName.endsWith(".pdf")) {
contentType = "application/pdf; charset=GBK";
response.setHeader("Content-Type", contentType);
} else {
contentType = "application/force-download";
response.setHeader("Content-Type", contentType);
}
response.setHeader("Content-Disposition", "filename=" + toUtf8String(fileName));
}
FileInputStream fis = new FileInputStream(filePath);
byte data[] = new byte[8192];
ServletOutputStream os = response.getOutputStream();
int i;
while ((i = fis.read(data, 0, 8192)) != -1) {
os.write(data, 0, i);
}
os.flush();
fis.close();
os.close();
logger.debug("Download File: " + filePath + " Finished");
}
} catch (Exception e) {
logger.error("DownloadFile: " + filePath + " Error", e);
}
} | void function(HttpServletResponse response, String filePath, String fileName, boolean isDownload) { try { File file = new File(filePath); if (!file.exists() !file.isFile()) { logger.debug(STR + (filePath) + STR); response.setHeader(STR, STR); ServletOutputStream os = response.getOutputStream(); os.println(STR); } else { if (isDownload) { response.setHeader(STR, STR); response.setHeader(STR, STR + toUtf8String(fileName)); } else { String contentType = STR; if (fileName != null && fileName.endsWith(".doc")) { contentType = STR; response.setHeader(STR, contentType); } else if (fileName != null && fileName.endsWith(".pdf")) { contentType = STR; response.setHeader(STR, contentType); } else { contentType = STR; response.setHeader(STR, contentType); } response.setHeader(STR, STR + toUtf8String(fileName)); } FileInputStream fis = new FileInputStream(filePath); byte data[] = new byte[8192]; ServletOutputStream os = response.getOutputStream(); int i; while ((i = fis.read(data, 0, 8192)) != -1) { os.write(data, 0, i); } os.flush(); fis.close(); os.close(); logger.debug(STR + filePath + STR); } } catch (Exception e) { logger.error(STR + filePath + STR, e); } } | /**
* Download file.
*
* @param response
* the response
* @param filePath
* the file path
* @param fileName
* the file name
* @param isDownload
* the is download
*/ | Download file | downloadFile | {
"repo_name": "8090boy/gomall.la",
"path": "legendshop_util/src/java/com/legendshop/util/DownloadFileUtil.java",
"license": "apache-2.0",
"size": 4806
} | [
"java.io.File",
"java.io.FileInputStream",
"javax.servlet.ServletOutputStream",
"javax.servlet.http.HttpServletResponse"
]
| import java.io.File; import java.io.FileInputStream; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
]
| java.io; javax.servlet; | 177,576 |
public void goToForResult(Class<?> clazz, int requestCode, Bundle bundle, int flags) {
Intent intent = new Intent(this, clazz);
if (null != bundle) {
intent.putExtras(bundle);
}
intent.addFlags(flags);
startActivityForResult(intent, requestCode);
}
//</editor-fold> | void function(Class<?> clazz, int requestCode, Bundle bundle, int flags) { Intent intent = new Intent(this, clazz); if (null != bundle) { intent.putExtras(bundle); } intent.addFlags(flags); startActivityForResult(intent, requestCode); } | /**
* startActivityForResult with bundle and flags
*
* @param clazz Activity.class
* @param requestCode RequestCode
* @param bundle data
* @param flags FLAG_ACTIVITY
*/ | startActivityForResult with bundle and flags | goToForResult | {
"repo_name": "DragonsQC/QLibrary",
"path": "library/src/main/java/com/dqc/qlibrary/activity/QBaseActivity.java",
"license": "apache-2.0",
"size": 6135
} | [
"android.content.Intent",
"android.os.Bundle"
]
| import android.content.Intent; import android.os.Bundle; | import android.content.*; import android.os.*; | [
"android.content",
"android.os"
]
| android.content; android.os; | 348,709 |
protected void initContentViewCore(WebContents webContents) {
ContentViewCore cvc = new ContentViewCore(mContext);
ContentView cv = ContentView.newInstance(mContext, cvc);
cv.setContentDescription(mContext.getResources().getString(
R.string.accessibility_content_view));
cvc.initialize(cv, cv, webContents, getWindowAndroid());
setContentViewCore(cvc);
} | void function(WebContents webContents) { ContentViewCore cvc = new ContentViewCore(mContext); ContentView cv = ContentView.newInstance(mContext, cvc); cv.setContentDescription(mContext.getResources().getString( R.string.accessibility_content_view)); cvc.initialize(cv, cv, webContents, getWindowAndroid()); setContentViewCore(cvc); } | /**
* Creates and initializes the {@link ContentViewCore}.
*
* @param webContents The WebContents object that will be used to build the
* {@link ContentViewCore}.
*/ | Creates and initializes the <code>ContentViewCore</code> | initContentViewCore | {
"repo_name": "hefen1/chromium",
"path": "chrome/android/java/src/org/chromium/chrome/browser/Tab.java",
"license": "bsd-3-clause",
"size": 96371
} | [
"org.chromium.content.browser.ContentView",
"org.chromium.content.browser.ContentViewCore",
"org.chromium.content_public.browser.WebContents"
]
| import org.chromium.content.browser.ContentView; import org.chromium.content.browser.ContentViewCore; import org.chromium.content_public.browser.WebContents; | import org.chromium.content.browser.*; import org.chromium.content_public.browser.*; | [
"org.chromium.content",
"org.chromium.content_public"
]
| org.chromium.content; org.chromium.content_public; | 1,323,972 |
Optional<List<?>> getList(DataQuery path); | Optional<List<?>> getList(DataQuery path); | /**
* Gets the {@link List} of something by path, if available.
*
* <p>If a {@link List} of something does not exist, or the data
* residing at the path is not an instance of a {@link List} of something,
* an absent is returned.</p>
*
* @param path The path of the value to get
* @return The list, if available
*/ | Gets the <code>List</code> of something by path, if available. If a <code>List</code> of something does not exist, or the data residing at the path is not an instance of a <code>List</code> of something, an absent is returned | getList | {
"repo_name": "SpongePowered/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/data/persistence/DataView.java",
"license": "mit",
"size": 25096
} | [
"java.util.List",
"java.util.Optional"
]
| import java.util.List; import java.util.Optional; | import java.util.*; | [
"java.util"
]
| java.util; | 2,225,360 |
private static void multiAdd(final PeerDHT peer, final String rowKey, final String col, final String string)
throws IOException {
Number160 locationKey = Number160.createHash("users");
Number160 contentKey = combine(rowKey, col);
peer.put(locationKey).data(contentKey, new Data(string)).start().awaitUninterruptibly();
contentKey = combine(col, rowKey);
peer.put(locationKey).data(contentKey, new Data(string)).start().awaitUninterruptibly();
} | static void function(final PeerDHT peer, final String rowKey, final String col, final String string) throws IOException { Number160 locationKey = Number160.createHash("users"); Number160 contentKey = combine(rowKey, col); peer.put(locationKey).data(contentKey, new Data(string)).start().awaitUninterruptibly(); contentKey = combine(col, rowKey); peer.put(locationKey).data(contentKey, new Data(string)).start().awaitUninterruptibly(); } | /**
* Add it twice, once to search for the column, once for the row.
*
* @param peer
* The peer that stores the data
* @param rowKey
* The row key
* @param col
* The col key
* @param string
* The data to store
* @throws IOException .
*/ | Add it twice, once to search for the column, once for the row | multiAdd | {
"repo_name": "jonaswagner/TomP2P",
"path": "examples/src/main/java/net/tomp2p/examples/ExampleMultiColumn.java",
"license": "apache-2.0",
"size": 7999
} | [
"java.io.IOException",
"net.tomp2p.dht.PeerDHT",
"net.tomp2p.peers.Number160",
"net.tomp2p.storage.Data"
]
| import java.io.IOException; import net.tomp2p.dht.PeerDHT; import net.tomp2p.peers.Number160; import net.tomp2p.storage.Data; | import java.io.*; import net.tomp2p.dht.*; import net.tomp2p.peers.*; import net.tomp2p.storage.*; | [
"java.io",
"net.tomp2p.dht",
"net.tomp2p.peers",
"net.tomp2p.storage"
]
| java.io; net.tomp2p.dht; net.tomp2p.peers; net.tomp2p.storage; | 282,593 |
private ArrayList<GlueObject> getStorageAreas(String vo, String keyType, StringList keyValues) throws VrsException
{
StringBuffer searchPhrase = new StringBuffer();
searchPhrase.append("(&");
if (StringUtil.isEmpty(vo))
{
searchPhrase.append("(objectClass=" + GlueConstants.SA + ")");
}
else
{
searchPhrase.append("(& (objectClass=" + GlueConstants.SA + ")" + "("
+ GlueConstants.SA_ACCESS_CONTROL_BASE_RULE + "=*" + vo + "))");
}
if (!StringUtil.isEmpty(keyType))
{
searchPhrase.append("(|");
for (int i = 0; i < keyValues.size(); ++i)
{
searchPhrase.append("(" + keyType + "=" + keyValues.get(i) + ")");
}
searchPhrase.append(")");
}
searchPhrase.append(")");
return queryGlueObjects(null, searchPhrase.toString());
}
//
// public ArrayList<GlueObject> getVoInfoOrSA(String vo, String keyType,
// StringList keyValues) throws VlException
// {
// StringBuffer searchPhrase = new StringBuffer();
// // get any of...
// searchPhrase.append("(|");
// // ..VOinfo (unless the objectClass is not specified the query is too
// // slow on sara)
// searchPhrase.append("(&");
//
// if (StringUtil.isEmpty(vo))
// {
// searchPhrase.append("(objectClass=" + GlueConstants.VO_INFO + ")");
// }
// else
// {
// searchPhrase.append("(& (objectClass=" + GlueConstants.VO_INFO + ")" +
// "("
// + GlueConstants.VO_INFO_ACCSESS_CONTROL_BASE_RULE + "=*" + vo + "))");
// }
//
// if (!StringUtil.isEmpty(keyType))
// {
// searchPhrase.append("(|");
// for (int i = 0; i < keyValues.size(); ++i)
// {
// searchPhrase.append("(" + keyType + "=" + keyValues.get(i) + ")");
// }
// searchPhrase.append(")");
// }
//
// searchPhrase.append(")");
//
// // ...or SA
// searchPhrase.append("(&");
//
// if (StringUtil.isEmpty(vo))
// {
// searchPhrase.append("(objectClass=" + GlueConstants.SA + ")");
// }
// else
// {
// searchPhrase.append("(& (objectClass=" + GlueConstants.SA + ")" + "("
// + GlueConstants.SA_ACCESS_CONTROL_BASE_RULE + "=*" + vo + "))");
// }
//
// if (!StringUtil.isEmpty(keyType))
// {
// searchPhrase.append("(|");
// for (int i = 0; i < keyValues.size(); ++i)
// {
// searchPhrase.append("(" + keyType + "=" + keyValues.get(i) + ")");
// }
// searchPhrase.append(")");
// }
//
// searchPhrase.append(")");
//
// searchPhrase.append(")");
//
// // For example for UID the query should be something like:
// // (|
// // (& (objectClass=GlueVOInfo)
// // (| (GlueChunkKey=GlueSEUniqueID=uid1)
// // (GlueChunkKey=GlueSEUniqueID=uid2)...
// // (GlueChunkKey=GlueSEUniqueID=uidn) )
// // )
// // (& (objectClass=GlueSA)
// // (| (GlueChunkKey=GlueSEUniqueID=uid2)
// // (GlueChunkKey=GlueSEUniqueID=uid2)...
// // (GlueChunkKey=GlueSEUniqueID=uidn) )
// // )
// // )
//
// ArrayList<GlueObject> voOrSA = this.queryGlueObjects(null,
// searchPhrase.toString());
//
// return voOrSA;
// } | ArrayList<GlueObject> function(String vo, String keyType, StringList keyValues) throws VrsException { StringBuffer searchPhrase = new StringBuffer(); searchPhrase.append("(&"); if (StringUtil.isEmpty(vo)) { searchPhrase.append(STR + GlueConstants.SA + ")"); } else { searchPhrase.append(STR + GlueConstants.SA + ")" + "(" + GlueConstants.SA_ACCESS_CONTROL_BASE_RULE + "=*" + vo + "))"); } if (!StringUtil.isEmpty(keyType)) { searchPhrase.append(STR); for (int i = 0; i < keyValues.size(); ++i) { searchPhrase.append("(" + keyType + "=" + keyValues.get(i) + ")"); } searchPhrase.append(")"); } searchPhrase.append(")"); return queryGlueObjects(null, searchPhrase.toString()); } | /**
* Returns GlueSA object. VO and the keyType and keyValues are collectively
* exhaustive. If VO is null both keyType and keyValues must be specified or
* if keyType or keyValues are null VO must be specified if
*
* @param vo
* the VO's name
* @param keyType
* the type (e.g. GlueChunkKey)
* @param keyValues
* the values (e.g. GlueSEUniqueID=gb-se-emc.erasmusmc.nl,
* GlueSEUniqueID=tbn18.nikhef.nl, ....etc)
* @return
* @throws VrsException
*/ | Returns GlueSA object. VO and the keyType and keyValues are collectively exhaustive. If VO is null both keyType and keyValues must be specified or if keyType or keyValues are null VO must be specified if | getStorageAreas | {
"repo_name": "NLeSC/vbrowser",
"path": "source/nl.esciencecenter.vlet.vrs.infors/src/nl/esciencecenter/vlet/util/bdii/BDIIQuery.java",
"license": "apache-2.0",
"size": 35519
} | [
"java.util.ArrayList",
"nl.esciencecenter.ptk.data.StringList",
"nl.esciencecenter.ptk.util.StringUtil",
"nl.esciencecenter.vbrowser.vrs.exceptions.VrsException",
"nl.esciencecenter.vlet.util.bdii.info.glue.GlueConstants",
"nl.esciencecenter.vlet.util.bdii.info.glue.GlueObject"
]
| import java.util.ArrayList; import nl.esciencecenter.ptk.data.StringList; import nl.esciencecenter.ptk.util.StringUtil; import nl.esciencecenter.vbrowser.vrs.exceptions.VrsException; import nl.esciencecenter.vlet.util.bdii.info.glue.GlueConstants; import nl.esciencecenter.vlet.util.bdii.info.glue.GlueObject; | import java.util.*; import nl.esciencecenter.ptk.data.*; import nl.esciencecenter.ptk.util.*; import nl.esciencecenter.vbrowser.vrs.exceptions.*; import nl.esciencecenter.vlet.util.bdii.info.glue.*; | [
"java.util",
"nl.esciencecenter.ptk",
"nl.esciencecenter.vbrowser",
"nl.esciencecenter.vlet"
]
| java.util; nl.esciencecenter.ptk; nl.esciencecenter.vbrowser; nl.esciencecenter.vlet; | 5,983 |
@Test
public void createUsersWithArrayInputTest() {
List<User> body = null;
api.createUsersWithArrayInput(body);
// TODO: test validations
} | void function() { List<User> body = null; api.createUsersWithArrayInput(body); } | /**
* Creates list of users with given input array
*
*
*
* @throws ApiException
* if the Api call fails
*/ | Creates list of users with given input array | createUsersWithArrayInputTest | {
"repo_name": "Niky4000/UsefulUtils",
"path": "projects/tutorials-master/tutorials-master/spring-swagger-codegen/spring-swagger-codegen-api-client/src/test/java/com/baeldung/petstore/client/api/UserApiLiveTest.java",
"license": "gpl-3.0",
"size": 3508
} | [
"com.baeldung.petstore.client.model.User",
"java.util.List"
]
| import com.baeldung.petstore.client.model.User; import java.util.List; | import com.baeldung.petstore.client.model.*; import java.util.*; | [
"com.baeldung.petstore",
"java.util"
]
| com.baeldung.petstore; java.util; | 2,417,003 |
public String getString(@NonNull final String key, final String defaultValue) {
byte[] bytes = realGetBytes(TYPE_STRING + key);
if (bytes == null) return defaultValue;
return UtilsBridge.bytes2String(bytes);
}
///////////////////////////////////////////////////////////////////////////
// about JSONObject
/////////////////////////////////////////////////////////////////////////// | String function(@NonNull final String key, final String defaultValue) { byte[] bytes = realGetBytes(TYPE_STRING + key); if (bytes == null) return defaultValue; return UtilsBridge.bytes2String(bytes); } | /**
* Return the string value in cache.
*
* @param key The key of cache.
* @param defaultValue The default value if the cache doesn't exist.
* @return the string value if cache exists or defaultValue otherwise
*/ | Return the string value in cache | getString | {
"repo_name": "didi/DoraemonKit",
"path": "Android/dokit-util/src/main/java/com/didichuxing/doraemonkit/util/CacheDiskUtils.java",
"license": "apache-2.0",
"size": 30314
} | [
"androidx.annotation.NonNull"
]
| import androidx.annotation.NonNull; | import androidx.annotation.*; | [
"androidx.annotation"
]
| androidx.annotation; | 2,106,343 |
public static String getSourceFileName(CompilationUnit unit) {
return getQualifiedMainTypeName(unit).replace('.', File.separatorChar) + ".java";
} | static String function(CompilationUnit unit) { return getQualifiedMainTypeName(unit).replace('.', File.separatorChar) + ".java"; } | /**
* Gets the relative file path of the source java file for this compilation
* unit.
*/ | Gets the relative file path of the source java file for this compilation unit | getSourceFileName | {
"repo_name": "qq644531343/j2objc",
"path": "translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java",
"license": "apache-2.0",
"size": 14439
} | [
"java.io.File"
]
| import java.io.File; | import java.io.*; | [
"java.io"
]
| java.io; | 42,909 |
private void write (String s) throws IOException {
output.write(s);
} | void function (String s) throws IOException { output.write(s); } | /**
* Write a raw string.
*/ | Write a raw string | write | {
"repo_name": "FauxFaux/jdk9-jaxws",
"path": "src/java.xml.bind/share/classes/com/sun/xml/internal/txw2/output/XMLWriter.java",
"license": "gpl-2.0",
"size": 34920
} | [
"java.io.IOException"
]
| import java.io.IOException; | import java.io.*; | [
"java.io"
]
| java.io; | 1,596,778 |
void ensurePrefixIsValid() {
// Make sure the path prefix ends with the path separator
if (!TextUtils.isEmpty(mPathPrefix) && !TextUtils.isEmpty(mPathSeparator)) {
if (!mPathPrefix.endsWith(mPathSeparator)) {
mPathPrefix = mPathPrefix + mPathSeparator;
}
}
} | void ensurePrefixIsValid() { if (!TextUtils.isEmpty(mPathPrefix) && !TextUtils.isEmpty(mPathSeparator)) { if (!mPathPrefix.endsWith(mPathSeparator)) { mPathPrefix = mPathPrefix + mPathSeparator; } } } | /**
* Fixes the path prefix, if necessary. The path prefix must always end with the
* path separator.
*/ | Fixes the path prefix, if necessary. The path prefix must always end with the path separator | ensurePrefixIsValid | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Email/src/com/android/email/mail/store/ImapStore.java",
"license": "gpl-2.0",
"size": 27539
} | [
"android.text.TextUtils"
]
| import android.text.TextUtils; | import android.text.*; | [
"android.text"
]
| android.text; | 2,771,076 |
protected void prompt(Value value, String prompt, boolean hide) {
String v = value.toString();
if (hide) {
StringBuilder sb = new StringBuilder();
for (int i = 0; i < v.length(); i++) {
sb.append("*");
}
v = sb.toString();
}
System.out.print(String.format("%s[%s]:", prompt, v));
String input;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
while (true) {
try {
input = br.readLine();
if (input == null || input.trim().equals("")) {
continue;
}
value.set(value.fromString(input));
} catch (IOException e) {
log.error("IGNORING: ", e);
continue;
}
}
} | void function(Value value, String prompt, boolean hide) { String v = value.toString(); if (hide) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < v.length(); i++) { sb.append("*"); } v = sb.toString(); } System.out.print(String.format(STR, prompt, v)); String input; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); while (true) { try { input = br.readLine(); if (input == null input.trim().equals(STRIGNORING: ", e); continue; } } } | /**
* Build prompt
*
* @param value
* @param prompt
* @param hide - use *s for characters
*/ | Build prompt | prompt | {
"repo_name": "emilroz/openmicroscopy",
"path": "components/blitz/src/ome/formats/importer/ImportConfig.java",
"license": "gpl-2.0",
"size": 29249
} | [
"java.io.BufferedReader",
"java.io.InputStreamReader"
]
| import java.io.BufferedReader; import java.io.InputStreamReader; | import java.io.*; | [
"java.io"
]
| java.io; | 2,385,730 |
public IIcon getItemIcon(ItemStack p_70620_1_, int p_70620_2_)
{
return p_70620_1_.getItem().requiresMultipleRenderPasses() ? p_70620_1_.getItem().getIconFromDamageForRenderPass(p_70620_1_.getItemDamage(), p_70620_2_) : p_70620_1_.getIconIndex();
} | IIcon function(ItemStack p_70620_1_, int p_70620_2_) { return p_70620_1_.getItem().requiresMultipleRenderPasses() ? p_70620_1_.getItem().getIconFromDamageForRenderPass(p_70620_1_.getItemDamage(), p_70620_2_) : p_70620_1_.getIconIndex(); } | /**
* Gets the Icon Index of the item currently held
*/ | Gets the Icon Index of the item currently held | getItemIcon | {
"repo_name": "mviitanen/marsmod",
"path": "mcp/src/minecraft/net/minecraft/entity/EntityLivingBase.java",
"license": "gpl-2.0",
"size": 72968
} | [
"net.minecraft.item.ItemStack",
"net.minecraft.util.IIcon"
]
| import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; | import net.minecraft.item.*; import net.minecraft.util.*; | [
"net.minecraft.item",
"net.minecraft.util"
]
| net.minecraft.item; net.minecraft.util; | 919,356 |
public void addStateMachine(StateMachinesDiagram machine, Element stateMachine) {
stateMachine.setNamespace(doc.getRootElement().getNamespace());
doc.getRootElement().addContent(stateMachine);
allMachines.add(machine);
}
| void function(StateMachinesDiagram machine, Element stateMachine) { stateMachine.setNamespace(doc.getRootElement().getNamespace()); doc.getRootElement().addContent(stateMachine); allMachines.add(machine); } | /**
* adds a statemachine with an open editor to the DOMTree
* @param machine the stateMachinesDiagram with an open editor
* @param stateMachine the DOM element of the statemachine
*/ | adds a statemachine with an open editor to the DOMTree | addStateMachine | {
"repo_name": "nocnokneo/MITK",
"path": "Build/Tools/StateMachineEditor/src/dom/ReadDOMTree.java",
"license": "bsd-3-clause",
"size": 5737
} | [
"org.jdom.Element"
]
| import org.jdom.Element; | import org.jdom.*; | [
"org.jdom"
]
| org.jdom; | 431,972 |
public void setConstraint(Constraint<?, T> constraint) {
iConstraint = constraint;
} | void function(Constraint<?, T> constraint) { iConstraint = constraint; } | /** Sets constraint
* @param constraint a constraint
**/ | Sets constraint | setConstraint | {
"repo_name": "UniTime/cpsolver",
"path": "src/org/cpsolver/ifs/extension/AssignedValue.java",
"license": "lgpl-3.0",
"size": 6018
} | [
"org.cpsolver.ifs.model.Constraint"
]
| import org.cpsolver.ifs.model.Constraint; | import org.cpsolver.ifs.model.*; | [
"org.cpsolver.ifs"
]
| org.cpsolver.ifs; | 398,297 |
protected HttpStatus getHttpStatus(Map<String, Object> errorAttributes) {
int statusCode = (int) errorAttributes.get("status");
return HttpStatus.valueOf(statusCode);
} | HttpStatus function(Map<String, Object> errorAttributes) { int statusCode = (int) errorAttributes.get(STR); return HttpStatus.valueOf(statusCode); } | /**
* Get the HTTP error status information from the error map.
* @param errorAttributes the current error information
* @return the error HTTP status
*/ | Get the HTTP error status information from the error map | getHttpStatus | {
"repo_name": "lburgazzoli/spring-boot",
"path": "spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web/reactive/error/DefaultErrorWebExceptionHandler.java",
"license": "apache-2.0",
"size": 7486
} | [
"java.util.Map",
"org.springframework.http.HttpStatus"
]
| import java.util.Map; import org.springframework.http.HttpStatus; | import java.util.*; import org.springframework.http.*; | [
"java.util",
"org.springframework.http"
]
| java.util; org.springframework.http; | 737,118 |
protected ServiceResponse<FulltextQueryListMsg> invoke(ServiceRequest<FulltextQueryListMsg> rq)
throws MaintainException {
ServiceResponse<FulltextQueryListMsg> rs;
FulltextQueryListMsg msg;
try {
this.validateRequest(rq);
this.setContext(rq.getContext());
msg = this.maintainFulltextQuery(rq.getRequestMessage());
if ((msg == null)) {
super.getLogger().warning("No response message defined.");
} else {
super.cleanServiceMessage(msg);
}
rs = new ServiceResponse<FulltextQueryListMsg>(rq.getContext());
rs.setResponseMessage(msg);
return rs;
} catch (MaintainException e) {
super.getLogger().error(e);
throw e;
} catch (NabuccoException e) {
super.getLogger().error(e);
MaintainException wrappedException = new MaintainException(e);
throw wrappedException;
} catch (Exception e) {
super.getLogger().error(e);
throw new MaintainException("Error during service invocation.", e);
}
}
| ServiceResponse<FulltextQueryListMsg> function(ServiceRequest<FulltextQueryListMsg> rq) throws MaintainException { ServiceResponse<FulltextQueryListMsg> rs; FulltextQueryListMsg msg; try { this.validateRequest(rq); this.setContext(rq.getContext()); msg = this.maintainFulltextQuery(rq.getRequestMessage()); if ((msg == null)) { super.getLogger().warning(STR); } else { super.cleanServiceMessage(msg); } rs = new ServiceResponse<FulltextQueryListMsg>(rq.getContext()); rs.setResponseMessage(msg); return rs; } catch (MaintainException e) { super.getLogger().error(e); throw e; } catch (NabuccoException e) { super.getLogger().error(e); MaintainException wrappedException = new MaintainException(e); throw wrappedException; } catch (Exception e) { super.getLogger().error(e); throw new MaintainException(STR, e); } } | /**
* Invokes the service handler method.
*
* @param rq the ServiceRequest<FulltextQueryListMsg>.
* @return the ServiceResponse<FulltextQueryListMsg>.
* @throws MaintainException
*/ | Invokes the service handler method | invoke | {
"repo_name": "NABUCCO/org.nabucco.framework.setup",
"path": "org.nabucco.framework.setup.impl.service/src/main/gen/org/nabucco/framework/setup/impl/service/query/MaintainFulltextQueryServiceHandler.java",
"license": "epl-1.0",
"size": 3889
} | [
"org.nabucco.framework.base.facade.exception.NabuccoException",
"org.nabucco.framework.base.facade.exception.service.MaintainException",
"org.nabucco.framework.base.facade.message.ServiceRequest",
"org.nabucco.framework.base.facade.message.ServiceResponse",
"org.nabucco.framework.setup.facade.message.query.FulltextQueryListMsg"
]
| import org.nabucco.framework.base.facade.exception.NabuccoException; import org.nabucco.framework.base.facade.exception.service.MaintainException; import org.nabucco.framework.base.facade.message.ServiceRequest; import org.nabucco.framework.base.facade.message.ServiceResponse; import org.nabucco.framework.setup.facade.message.query.FulltextQueryListMsg; | import org.nabucco.framework.base.facade.exception.*; import org.nabucco.framework.base.facade.exception.service.*; import org.nabucco.framework.base.facade.message.*; import org.nabucco.framework.setup.facade.message.query.*; | [
"org.nabucco.framework"
]
| org.nabucco.framework; | 2,668,074 |
default void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx,
final String userName, final GlobalQuotaSettings quotas) throws IOException {} | default void preSetUserQuota(final ObserverContext<MasterCoprocessorEnvironment> ctx, final String userName, final GlobalQuotaSettings quotas) throws IOException {} | /**
* Called before the quota for the user is stored.
* @param ctx the environment to interact with the framework and master
* @param userName the name of user
* @param quotas the current quota for the user
*/ | Called before the quota for the user is stored | preSetUserQuota | {
"repo_name": "apurtell/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java",
"license": "apache-2.0",
"size": 74501
} | [
"java.io.IOException",
"org.apache.hadoop.hbase.quotas.GlobalQuotaSettings"
]
| import java.io.IOException; import org.apache.hadoop.hbase.quotas.GlobalQuotaSettings; | import java.io.*; import org.apache.hadoop.hbase.quotas.*; | [
"java.io",
"org.apache.hadoop"
]
| java.io; org.apache.hadoop; | 923,104 |
Collections.sort(list, new Comparator<Structure>() { | Collections.sort(list, new Comparator<Structure>() { | /**
* sorts natural order.
* @param list - List
* @return sorted list
*/ | sorts natural order | sortList | {
"repo_name": "dsaetgareev/junior",
"path": "chapter_003/subdivision/src/main/java/ru/job4j/subdivision/SortStructure.java",
"license": "apache-2.0",
"size": 1239
} | [
"java.util.Collections",
"java.util.Comparator"
]
| import java.util.Collections; import java.util.Comparator; | import java.util.*; | [
"java.util"
]
| java.util; | 1,804,051 |
public void setfixedpercentage (BigDecimal fixedpercentage)
{
set_Value (COLUMNNAME_fixedpercentage, fixedpercentage);
} | void function (BigDecimal fixedpercentage) { set_Value (COLUMNNAME_fixedpercentage, fixedpercentage); } | /** Set fixedpercentage.
@param fixedpercentage fixedpercentage */ | Set fixedpercentage | setfixedpercentage | {
"repo_name": "itzamnamx/AdempiereFS",
"path": "base/src/org/compiere/model/X_T_Report.java",
"license": "gpl-2.0",
"size": 16089
} | [
"java.math.BigDecimal"
]
| import java.math.BigDecimal; | import java.math.*; | [
"java.math"
]
| java.math; | 172,370 |
private JLabel getNoneLabel() {
if (noneLabel == null) {
noneLabel = new javax.swing.JLabel();
noneLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
noneLabel.addMouseListener(internalController);
noneLabel.setText(i18nStrings.getProperty("messages.clear"));
}
return noneLabel;
}
| JLabel function() { if (noneLabel == null) { noneLabel = new javax.swing.JLabel(); noneLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); noneLabel.addMouseListener(internalController); noneLabel.setText(i18nStrings.getProperty(STR)); } return noneLabel; } | /**
* This method initializes todayLabel
*
* @return javax.swing.JLabel
*/ | This method initializes todayLabel | getNoneLabel | {
"repo_name": "shookees/SmartFood_old",
"path": "lib/JDatePicker-1.3.2-dist/src/net/sourceforge/jdatepicker/impl/JDatePanelImpl.java",
"license": "mit",
"size": 29019
} | [
"javax.swing.JLabel"
]
| import javax.swing.JLabel; | import javax.swing.*; | [
"javax.swing"
]
| javax.swing; | 2,737,595 |
public void setMnemonic (GridField mField)
{
if (mField.isCreateMnemonic())
return;
String text = mField.getHeader();
int pos = text.indexOf('&');
if (pos != -1 && text.length() > pos) // We have a mnemonic - creates Ctrl_Shift_
{
char mnemonic = text.toUpperCase().charAt(pos+1);
if (mnemonic != ' ')
{
if (!m_mnemonics.contains(mnemonic))
{
mField.setMnemonic(mnemonic);
m_mnemonics.add(mnemonic);
}
else
log.warning(mField.getColumnName()
+ " - Conflict - Already exists: " + mnemonic + " (" + text + ")");
}
}
} // setMnemonic | void function (GridField mField) { if (mField.isCreateMnemonic()) return; String text = mField.getHeader(); int pos = text.indexOf('&'); if (pos != -1 && text.length() > pos) { char mnemonic = text.toUpperCase().charAt(pos+1); if (mnemonic != ' ') { if (!m_mnemonics.contains(mnemonic)) { mField.setMnemonic(mnemonic); m_mnemonics.add(mnemonic); } else log.warning(mField.getColumnName() + STR + mnemonic + STR + text + ")"); } } } | /**
* Set Field Mnemonic
* @param mField field
*/ | Set Field Mnemonic | setMnemonic | {
"repo_name": "armenrz/adempiere",
"path": "client/src/org/compiere/grid/VPanel.java",
"license": "gpl-2.0",
"size": 22055
} | [
"org.compiere.model.GridField"
]
| import org.compiere.model.GridField; | import org.compiere.model.*; | [
"org.compiere.model"
]
| org.compiere.model; | 1,026,785 |
public boolean editComment(ApiTypeWrapper apiTypeWrapper, String commentId, Comment comment) throws
APIManagementException {
try (Connection connection = APIMgtDBUtil.getConnection()) {
int id = -1;
String editCommentQuery = SQLConstants.EDIT_COMMENT;
Identifier identifier;
String uuid;
if (apiTypeWrapper.isAPIProduct()) {
identifier = apiTypeWrapper.getApiProduct().getId();
uuid = apiTypeWrapper.getApiProduct().getUuid();
} else {
identifier = apiTypeWrapper.getApi().getId();
uuid = apiTypeWrapper.getApi().getUuid();
}
id = getAPIID(uuid, connection);
if (id == -1) {
String msg = "Could not load API record for: " + identifier.getName();
throw new APIManagementException(msg);
}
connection.setAutoCommit(false);
try (PreparedStatement prepStmt = connection.prepareStatement(editCommentQuery)) {
prepStmt.setString(1, comment.getText());
prepStmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()), Calendar.getInstance());
prepStmt.setString(3, comment.getCategory());
prepStmt.setInt(4, id);
prepStmt.setString(5, commentId);
prepStmt.execute();
connection.commit();
return true;
}
} catch (SQLException e) {
handleException("Error while editing comment " + commentId + " from the database", e);
}
return false;
} | boolean function(ApiTypeWrapper apiTypeWrapper, String commentId, Comment comment) throws APIManagementException { try (Connection connection = APIMgtDBUtil.getConnection()) { int id = -1; String editCommentQuery = SQLConstants.EDIT_COMMENT; Identifier identifier; String uuid; if (apiTypeWrapper.isAPIProduct()) { identifier = apiTypeWrapper.getApiProduct().getId(); uuid = apiTypeWrapper.getApiProduct().getUuid(); } else { identifier = apiTypeWrapper.getApi().getId(); uuid = apiTypeWrapper.getApi().getUuid(); } id = getAPIID(uuid, connection); if (id == -1) { String msg = STR + identifier.getName(); throw new APIManagementException(msg); } connection.setAutoCommit(false); try (PreparedStatement prepStmt = connection.prepareStatement(editCommentQuery)) { prepStmt.setString(1, comment.getText()); prepStmt.setTimestamp(2, new Timestamp(System.currentTimeMillis()), Calendar.getInstance()); prepStmt.setString(3, comment.getCategory()); prepStmt.setInt(4, id); prepStmt.setString(5, commentId); prepStmt.execute(); connection.commit(); return true; } } catch (SQLException e) { handleException(STR + commentId + STR, e); } return false; } | /***********
* Edit a comment
*
* @param apiTypeWrapper API Type Wrapper
* @param commentId Comment ID
* @param comment Comment object
* @throws APIManagementException
*/ | Edit a comment | editComment | {
"repo_name": "fazlan-nazeem/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/dao/ApiMgtDAO.java",
"license": "apache-2.0",
"size": 821235
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.SQLException",
"java.sql.Timestamp",
"java.util.Calendar",
"org.wso2.carbon.apimgt.api.APIManagementException",
"org.wso2.carbon.apimgt.api.model.ApiTypeWrapper",
"org.wso2.carbon.apimgt.api.model.Comment",
"org.wso2.carbon.apimgt.api.model.Identifier",
"org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants",
"org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil"
]
| import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import java.util.Calendar; import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.model.ApiTypeWrapper; import org.wso2.carbon.apimgt.api.model.Comment; import org.wso2.carbon.apimgt.api.model.Identifier; import org.wso2.carbon.apimgt.impl.dao.constants.SQLConstants; import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil; | import java.sql.*; import java.util.*; import org.wso2.carbon.apimgt.api.*; import org.wso2.carbon.apimgt.api.model.*; import org.wso2.carbon.apimgt.impl.dao.constants.*; import org.wso2.carbon.apimgt.impl.utils.*; | [
"java.sql",
"java.util",
"org.wso2.carbon"
]
| java.sql; java.util; org.wso2.carbon; | 1,115,818 |
public static int hashCode(Circle thiz) {
int result;
long temp;
result = thiz.getCenter().hashCode();
temp = thiz.getRadius() != +0.0d ? Double.doubleToLongBits(thiz.getRadius()) : 0L;
result = 31 * result + (int) (temp ^ (temp >>> 32));
return result;
} | static int function(Circle thiz) { int result; long temp; result = thiz.getCenter().hashCode(); temp = thiz.getRadius() != +0.0d ? Double.doubleToLongBits(thiz.getRadius()) : 0L; result = 31 * result + (int) (temp ^ (temp >>> 32)); return result; } | /**
* All {@link Circle} implementations should use this definition of {@link Object#hashCode()}.
*/ | All <code>Circle</code> implementations should use this definition of <code>Object#hashCode()</code> | hashCode | {
"repo_name": "yipen9/spatial4j",
"path": "src/main/java/com/spatial4j/core/shape/impl/CircleImpl.java",
"license": "apache-2.0",
"size": 10033
} | [
"com.spatial4j.core.shape.Circle"
]
| import com.spatial4j.core.shape.Circle; | import com.spatial4j.core.shape.*; | [
"com.spatial4j.core"
]
| com.spatial4j.core; | 1,529,819 |
protected final ReplicationActionType configureReplicationActionType(final String replicationActionTypeName) {
try {
final ReplicationActionType repActionType =
ReplicationActionType.valueOf(replicationActionTypeName);
log.debug("Using replication action type: {}", repActionType.name());
return repActionType;
} catch (IllegalArgumentException ex) {
log.warn("Illegal action type configured: {}. Falling back to default: {}", replicationActionTypeName, OPTION_INHERIT);
return null;
}
} | final ReplicationActionType function(final String replicationActionTypeName) { try { final ReplicationActionType repActionType = ReplicationActionType.valueOf(replicationActionTypeName); log.debug(STR, repActionType.name()); return repActionType; } catch (IllegalArgumentException ex) { log.warn(STR, replicationActionTypeName, OPTION_INHERIT); return null; } } | /**
* Derive the ReplicationActionType to be used for Flushes.
*
* @param replicationActionTypeName String name of ReplicationActionType to use
* @return the ReplicationActionType to use, or null if the ReplicationActionType should be inherited from the
* incoming ReplicationAction
*/ | Derive the ReplicationActionType to be used for Flushes | configureReplicationActionType | {
"repo_name": "bstopp/acs-aem-commons",
"path": "bundle/src/main/java/com/adobe/acs/commons/replication/dispatcher/impl/DispatcherFlushRulesImpl.java",
"license": "apache-2.0",
"size": 14489
} | [
"com.day.cq.replication.ReplicationActionType"
]
| import com.day.cq.replication.ReplicationActionType; | import com.day.cq.replication.*; | [
"com.day.cq"
]
| com.day.cq; | 920,894 |
public boolean delete(String token, ContentData parent) {
validateDelete(token);
File f = new File(getRoot(), parent.getPath());
return(f.delete());
}
| boolean function(String token, ContentData parent) { validateDelete(token); File f = new File(getRoot(), parent.getPath()); return(f.delete()); } | /**
* ====================================================================
* Interface methods goes below.
*
*
*/ | ==================================================================== Interface methods goes below | delete | {
"repo_name": "afbits/OneCMDBwithMaven",
"path": "src/org.onecmdb.ui.gwt.desktop/src/main/java/org/onecmdb/ui/gwt/desktop/server/service/content/ContentServiceImpl.java",
"license": "gpl-2.0",
"size": 13081
} | [
"java.io.File",
"org.onecmdb.ui.gwt.desktop.client.service.content.ContentData"
]
| import java.io.File; import org.onecmdb.ui.gwt.desktop.client.service.content.ContentData; | import java.io.*; import org.onecmdb.ui.gwt.desktop.client.service.content.*; | [
"java.io",
"org.onecmdb.ui"
]
| java.io; org.onecmdb.ui; | 1,566,204 |
private static List<String> parseCrtFile(String path) throws IOException {
List<String> certs = new ArrayList<>();
StringBuilder sb = new StringBuilder();
for (String line : Files.readAllLines(Paths.get(path))) {
if (line.isEmpty() || line.contains("BEGIN CERTIFICATE"))
continue;
if (line.contains("END CERTIFICATE")) {
certs.add(sb.toString());
sb.setLength(0);
} else {
sb.append(line);
}
}
return certs;
} | static List<String> function(String path) throws IOException { List<String> certs = new ArrayList<>(); StringBuilder sb = new StringBuilder(); for (String line : Files.readAllLines(Paths.get(path))) { if (line.isEmpty() line.contains(STR)) continue; if (line.contains(STR)) { certs.add(sb.toString()); sb.setLength(0); } else { sb.append(line); } } return certs; } | /**
* Parse the parsed crt file to return an array of String certificates
*
* @param path to the crt file to be parsed
* @return a list of certificates in String format
*/ | Parse the parsed crt file to return an array of String certificates | parseCrtFile | {
"repo_name": "jboss-developer/jboss-jdg-quickstarts",
"path": "caching-service/src/main/java/org/infinispan/demo/online/TrustStore.java",
"license": "apache-2.0",
"size": 4937
} | [
"java.io.IOException",
"java.nio.file.Files",
"java.nio.file.Paths",
"java.util.ArrayList",
"java.util.List"
]
| import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; | import java.io.*; import java.nio.file.*; import java.util.*; | [
"java.io",
"java.nio",
"java.util"
]
| java.io; java.nio; java.util; | 713,618 |
public final List<AtomicReaderContext> leaves() {
return getContext().leaves();
} | final List<AtomicReaderContext> function() { return getContext().leaves(); } | /**
* Returns the reader's leaves, or itself if this reader is atomic.
* This is a convenience method calling {@code this.getContext().leaves()}.
* @see IndexReaderContext#leaves()
*/ | Returns the reader's leaves, or itself if this reader is atomic. This is a convenience method calling this.getContext().leaves() | leaves | {
"repo_name": "fogbeam/Heceta_solr",
"path": "lucene/core/src/java/org/apache/lucene/index/IndexReader.java",
"license": "apache-2.0",
"size": 18451
} | [
"java.util.List"
]
| import java.util.List; | import java.util.*; | [
"java.util"
]
| java.util; | 138,345 |
@ServiceMethod(returns = ReturnType.SINGLE)
private Mono<Void> deleteAsync(
String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch) {
final Boolean force = null;
return deleteWithResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch, force)
.flatMap((Response<Void> res) -> Mono.empty());
} | @ServiceMethod(returns = ReturnType.SINGLE) Mono<Void> function( String resourceGroupName, String serviceName, String apiId, String schemaId, String ifMatch) { final Boolean force = null; return deleteWithResponseAsync(resourceGroupName, serviceName, apiId, schemaId, ifMatch, force) .flatMap((Response<Void> res) -> Mono.empty()); } | /**
* Deletes the schema configuration at the Api.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param apiId API revision identifier. Must be unique in the current API Management service instance. Non-current
* revision has ;rev=n as a suffix where n is the revision number.
* @param schemaId Schema identifier within an API. Must be unique in the current API Management service instance.
* @param ifMatch ETag of the Entity. ETag should match the current entity state from the header response of the GET
* request or it should be * for unconditional update.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/ | Deletes the schema configuration at the Api | deleteAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/ApiSchemasClientImpl.java",
"license": "mit",
"size": 79226
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response"
]
| import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; | [
"com.azure.core"
]
| com.azure.core; | 1,294,580 |
boolean isGroupAssigned(PerunSession sess, Resource resource, Group group); | boolean isGroupAssigned(PerunSession sess, Resource resource, Group group); | /**
* Returns true if the group is assigned to the current resource with ACTIVE status, false otherwise.
*
* @param sess
* @param resource
* @param group
* @return true if the group is assigned to the current resource with active status.
* @throws InternalErrorException
*/ | Returns true if the group is assigned to the current resource with ACTIVE status, false otherwise | isGroupAssigned | {
"repo_name": "mvocu/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/implApi/ResourcesManagerImplApi.java",
"license": "bsd-2-clause",
"size": 29312
} | [
"cz.metacentrum.perun.core.api.Group",
"cz.metacentrum.perun.core.api.PerunSession",
"cz.metacentrum.perun.core.api.Resource"
]
| import cz.metacentrum.perun.core.api.Group; import cz.metacentrum.perun.core.api.PerunSession; import cz.metacentrum.perun.core.api.Resource; | import cz.metacentrum.perun.core.api.*; | [
"cz.metacentrum.perun"
]
| cz.metacentrum.perun; | 1,475,999 |
// [TARGET fetch(Key...)]
// [VARIABLE "my_first_key_name"]
// [VARIABLE "my_second_key_name"]
public List<Entity> fetchEntitiesWithKeys(String firstKeyName, String secondKeyName) {
Datastore datastore = transaction.getDatastore();
// [START fetchEntitiesWithKeys]
KeyFactory keyFactory = datastore.newKeyFactory().setKind("MyKind");
Key firstKey = keyFactory.newKey(firstKeyName);
Key secondKey = keyFactory.newKey(secondKeyName);
List<Entity> entities = transaction.fetch(firstKey, secondKey);
for (Entity entity : entities) {
// do something with the entity
}
transaction.commit();
// [END fetchEntitiesWithKeys]
return entities;
} | List<Entity> function(String firstKeyName, String secondKeyName) { Datastore datastore = transaction.getDatastore(); KeyFactory keyFactory = datastore.newKeyFactory().setKind(STR); Key firstKey = keyFactory.newKey(firstKeyName); Key secondKey = keyFactory.newKey(secondKeyName); List<Entity> entities = transaction.fetch(firstKey, secondKey); for (Entity entity : entities) { } transaction.commit(); return entities; } | /**
* Example of fetching a list of entities for several keys.
*/ | Example of fetching a list of entities for several keys | fetchEntitiesWithKeys | {
"repo_name": "shinfan/gcloud-java",
"path": "google-cloud-examples/src/main/java/com/google/cloud/examples/datastore/snippets/TransactionSnippets.java",
"license": "apache-2.0",
"size": 14136
} | [
"com.google.cloud.datastore.Datastore",
"com.google.cloud.datastore.Entity",
"com.google.cloud.datastore.Key",
"com.google.cloud.datastore.KeyFactory",
"java.util.List"
]
| import com.google.cloud.datastore.Datastore; import com.google.cloud.datastore.Entity; import com.google.cloud.datastore.Key; import com.google.cloud.datastore.KeyFactory; import java.util.List; | import com.google.cloud.datastore.*; import java.util.*; | [
"com.google.cloud",
"java.util"
]
| com.google.cloud; java.util; | 1,217,700 |
public ICacheElement<K, V> get( String cacheName, K key, long requesterId )
throws IOException
{
ICacheElement<K, V> element = null;
ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT );
try
{
element = processGet( cacheName, key, requesterId );
}
finally
{
logICacheEvent( cacheEvent );
}
return element;
}
| ICacheElement<K, V> function( String cacheName, K key, long requesterId ) throws IOException { ICacheElement<K, V> element = null; ICacheEvent<K> cacheEvent = createICacheEvent( cacheName, key, requesterId, ICacheEventLogger.GET_EVENT ); try { element = processGet( cacheName, key, requesterId ); } finally { logICacheEvent( cacheEvent ); } return element; } | /**
* Returns a cache bean from the specified cache; or null if the key does not exist.
* <p>
* Adding the requestor id, allows the cache to determine the source of the get.
* <p>
* The internal processing is wrapped in event logging calls.
* <p>
* @param cacheName
* @param key
* @param requesterId
* @return ICacheElement
* @throws IOException
*/ | Returns a cache bean from the specified cache; or null if the key does not exist. Adding the requestor id, allows the cache to determine the source of the get. The internal processing is wrapped in event logging calls. | get | {
"repo_name": "tikue/jcs2-snapshot",
"path": "src/java/org/apache/commons/jcs/auxiliary/remote/http/server/AbstractRemoteCacheService.java",
"license": "apache-2.0",
"size": 17602
} | [
"java.io.IOException",
"org.apache.commons.jcs.engine.behavior.ICacheElement",
"org.apache.commons.jcs.engine.logging.behavior.ICacheEvent",
"org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger"
]
| import java.io.IOException; import org.apache.commons.jcs.engine.behavior.ICacheElement; import org.apache.commons.jcs.engine.logging.behavior.ICacheEvent; import org.apache.commons.jcs.engine.logging.behavior.ICacheEventLogger; | import java.io.*; import org.apache.commons.jcs.engine.behavior.*; import org.apache.commons.jcs.engine.logging.behavior.*; | [
"java.io",
"org.apache.commons"
]
| java.io; org.apache.commons; | 2,730,513 |
public PropertyMappingBuilder compute(final String property, Computation computation) {
return mapping(new ComputeValueTransform(computation), selectProperty(property));
} | PropertyMappingBuilder function(final String property, Computation computation) { return mapping(new ComputeValueTransform(computation), selectProperty(property)); } | /**
* computes the new value of the property.
* @param property the property.
* @param computation the computation.
* @return the builder.
*/ | computes the new value of the property | compute | {
"repo_name": "ctrl-alt-dev/json-transform",
"path": "src/main/java/nl/ctrlaltdev/json/transform/mapping/builder/PropertyMappingBuilder.java",
"license": "apache-2.0",
"size": 11083
} | [
"nl.ctrlaltdev.json.transform.transforms.value.ComputeValueTransform"
]
| import nl.ctrlaltdev.json.transform.transforms.value.ComputeValueTransform; | import nl.ctrlaltdev.json.transform.transforms.value.*; | [
"nl.ctrlaltdev.json"
]
| nl.ctrlaltdev.json; | 1,736,966 |
public void setPassword(String password) throws UnsupportedEncodingException {
this.password = password.getBytes("UTF-16LE");
debug("Password usado: ", this.password);
} | void function(String password) throws UnsupportedEncodingException { this.password = password.getBytes(STR); debug(STR, this.password); } | /**
* Changes the password this object uses to encrypt and decrypt.
*
* @throws UnsupportedEncodingException if UTF-16 encoding is not supported.
*/ | Changes the password this object uses to encrypt and decrypt | setPassword | {
"repo_name": "fedevelatec/PruebasEclipse",
"path": "src/main/java/com/fedevela/Encriptar/AESCrypt.java",
"license": "apache-2.0",
"size": 17975
} | [
"java.io.UnsupportedEncodingException"
]
| import java.io.UnsupportedEncodingException; | import java.io.*; | [
"java.io"
]
| java.io; | 1,180,018 |
public List<String> getLoggerNames() {
while (true) {
try {
List<String> r = new ArrayList<String>();
Enumeration<String> e = LogManager.getLogManager().getLoggerNames();
while (e.hasMoreElements())
r.add(e.nextElement());
return r;
} catch (ConcurrentModificationException e) {
// retry
}
}
} | List<String> function() { while (true) { try { List<String> r = new ArrayList<String>(); Enumeration<String> e = LogManager.getLogManager().getLoggerNames(); while (e.hasMoreElements()) r.add(e.nextElement()); return r; } catch (ConcurrentModificationException e) { } } } | /**
* Work around for bug 6935026.
*/ | Work around for bug 6935026 | getLoggerNames | {
"repo_name": "mpeltonen/jenkins",
"path": "core/src/main/java/hudson/Functions.java",
"license": "mit",
"size": 61602
} | [
"java.util.ArrayList",
"java.util.ConcurrentModificationException",
"java.util.Enumeration",
"java.util.List",
"java.util.logging.LogManager"
]
| import java.util.ArrayList; import java.util.ConcurrentModificationException; import java.util.Enumeration; import java.util.List; import java.util.logging.LogManager; | import java.util.*; import java.util.logging.*; | [
"java.util"
]
| java.util; | 2,148,581 |
public static void deleteLocalDataLoadFolderLocation(CarbonLoadModel loadModel,
boolean isCompactionFlow) {
String databaseName = loadModel.getDatabaseName();
String tableName = loadModel.getTableName();
String tempLocationKey = databaseName + CarbonCommonConstants.UNDERSCORE + tableName
+ CarbonCommonConstants.UNDERSCORE + loadModel.getTaskNo();
if (isCompactionFlow) {
tempLocationKey = CarbonCommonConstants.COMPACTION_KEY_WORD + '_' + tempLocationKey;
}
// form local store location
String localStoreLocation = CarbonProperties.getInstance()
.getProperty(tempLocationKey, CarbonCommonConstants.STORE_LOCATION_DEFAULT_VAL);
try {
CarbonUtil.deleteFoldersAndFiles(new File[] { new File(localStoreLocation).getParentFile() });
LOGGER.info("Deleted the local store location" + localStoreLocation);
} catch (CarbonUtilException e) {
LOGGER.error(e, "Failed to delete local data load folder location");
}
} | static void function(CarbonLoadModel loadModel, boolean isCompactionFlow) { String databaseName = loadModel.getDatabaseName(); String tableName = loadModel.getTableName(); String tempLocationKey = databaseName + CarbonCommonConstants.UNDERSCORE + tableName + CarbonCommonConstants.UNDERSCORE + loadModel.getTaskNo(); if (isCompactionFlow) { tempLocationKey = CarbonCommonConstants.COMPACTION_KEY_WORD + '_' + tempLocationKey; } String localStoreLocation = CarbonProperties.getInstance() .getProperty(tempLocationKey, CarbonCommonConstants.STORE_LOCATION_DEFAULT_VAL); try { CarbonUtil.deleteFoldersAndFiles(new File[] { new File(localStoreLocation).getParentFile() }); LOGGER.info(STR + localStoreLocation); } catch (CarbonUtilException e) { LOGGER.error(e, STR); } } | /**
* This method will delete the local data load folder location after data load is complete
*
* @param loadModel
*/ | This method will delete the local data load folder location after data load is complete | deleteLocalDataLoadFolderLocation | {
"repo_name": "bill1208/incubator-carbondata",
"path": "integration/spark/src/main/java/org/apache/carbondata/spark/load/CarbonLoaderUtil.java",
"license": "apache-2.0",
"size": 41671
} | [
"java.io.File",
"org.apache.carbondata.core.constants.CarbonCommonConstants",
"org.apache.carbondata.core.util.CarbonProperties",
"org.apache.carbondata.core.util.CarbonUtil",
"org.apache.carbondata.core.util.CarbonUtilException"
]
| import java.io.File; import org.apache.carbondata.core.constants.CarbonCommonConstants; import org.apache.carbondata.core.util.CarbonProperties; import org.apache.carbondata.core.util.CarbonUtil; import org.apache.carbondata.core.util.CarbonUtilException; | import java.io.*; import org.apache.carbondata.core.constants.*; import org.apache.carbondata.core.util.*; | [
"java.io",
"org.apache.carbondata"
]
| java.io; org.apache.carbondata; | 871,194 |
public IntegrationRuntimeInner withAdditionalProperties(Map<String, Object> additionalProperties) {
this.additionalProperties = additionalProperties;
return this;
} | IntegrationRuntimeInner function(Map<String, Object> additionalProperties) { this.additionalProperties = additionalProperties; return this; } | /**
* Set unmatched properties from the message are deserialized this collection.
*
* @param additionalProperties the additionalProperties value to set
* @return the IntegrationRuntimeInner object itself.
*/ | Set unmatched properties from the message are deserialized this collection | withAdditionalProperties | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/synapse/mgmt-v2019_06_01_preview/src/main/java/com/microsoft/azure/management/synapse/v2019_06_01_preview/implementation/IntegrationRuntimeInner.java",
"license": "mit",
"size": 2739
} | [
"java.util.Map"
]
| import java.util.Map; | import java.util.*; | [
"java.util"
]
| java.util; | 925,427 |
@Fluent
public AMQPService cancelOutgoingLink(String outgoingLinkRef, Handler<AsyncResult<Void>> result);
/**
* Allows an application to accept a message it has received.
*
* @param msgRef The string ref. Use {@link AmqpMessage#getMsgRef()} | AMQPService function(String outgoingLinkRef, Handler<AsyncResult<Void>> result); /** * Allows an application to accept a message it has received. * * @param msgRef The string ref. Use {@link AmqpMessage#getMsgRef()} | /**
* Allows an application to cancel an outgoing link and remove it's mapping
* to an event-bus address.
*
* @param outgoingLinkRef The String ref return by the establishOutgoingLink method.
* This uniquely identifies the outgoing link and it's mapping to
* an event-bus address.
* @param result Notifies if there is an error.
* @return A reference to the service.
*/ | Allows an application to cancel an outgoing link and remove it's mapping to an event-bus address | cancelOutgoingLink | {
"repo_name": "vert-x3/vertx-amqp-service",
"path": "src/main/java/io/vertx/ext/amqp/AMQPService.java",
"license": "apache-2.0",
"size": 14439
} | [
"io.vertx.core.AsyncResult",
"io.vertx.core.Handler",
"io.vertx.ext.amqp.impl.protocol.AmqpMessage"
]
| import io.vertx.core.AsyncResult; import io.vertx.core.Handler; import io.vertx.ext.amqp.impl.protocol.AmqpMessage; | import io.vertx.core.*; import io.vertx.ext.amqp.impl.protocol.*; | [
"io.vertx.core",
"io.vertx.ext"
]
| io.vertx.core; io.vertx.ext; | 1,925,397 |
public void unredo(View view) {
if (view.getId() == R.id.undo) {
gridView.getGrid().Undo();
} else {
gridView.getGrid().Redo();
}
} | void function(View view) { if (view.getId() == R.id.undo) { gridView.getGrid().Undo(); } else { gridView.getGrid().Redo(); } } | /**
* Undoes an action if undo was pressed, redoes otherwise.
*
* @param view View witch triggered the action.
*/ | Undoes an action if undo was pressed, redoes otherwise | unredo | {
"repo_name": "Firtzberg/Lines2Polygons",
"path": "app/src/main/java/com/firtzberg/lines2polygons/LinesActivity.java",
"license": "apache-2.0",
"size": 3956
} | [
"android.view.View"
]
| import android.view.View; | import android.view.*; | [
"android.view"
]
| android.view; | 1,441,128 |
public void setInstanceProps(HashMap<String, String> addProps) {
super.addProps = addProps;
} | void function(HashMap<String, String> addProps) { super.addProps = addProps; } | /**
* Sets the instance properties, from which per dissemination changes can be based on.
* @param addProps HashMap object containing image transform instance properties
*/ | Sets the instance properties, from which per dissemination changes can be based on | setInstanceProps | {
"repo_name": "sul-dlss/djatoka",
"path": "src/gov/lanl/adore/djatoka/plugin/ImageWatermark.java",
"license": "mit",
"size": 4797
} | [
"java.util.HashMap"
]
| import java.util.HashMap; | import java.util.*; | [
"java.util"
]
| java.util; | 899,453 |
@Override
public void createControl(Composite parent) {
super.createControl(parent);
setPageComplete(true);
}
| void function(Composite parent) { super.createControl(parent); setPageComplete(true); } | /**
* creates the control.
*
* @param parent
* the parent Composite
*/ | creates the control | createControl | {
"repo_name": "franzbecker/test-editor",
"path": "ui/org.testeditor.ui/src/org/testeditor/ui/wizardpages/teamshare/TeamShareApproveWizardPage.java",
"license": "epl-1.0",
"size": 2558
} | [
"org.eclipse.swt.widgets.Composite"
]
| import org.eclipse.swt.widgets.Composite; | import org.eclipse.swt.widgets.*; | [
"org.eclipse.swt"
]
| org.eclipse.swt; | 2,019,100 |
private static boolean format(Configuration conf, boolean force,
boolean isInteractive) throws IOException {
String nsId = DFSUtil.getNamenodeNameServiceId(conf);
String namenodeId = HAUtil.getNameNodeId(conf, nsId);
initializeGenericKeys(conf, nsId, namenodeId);
checkAllowFormat(conf);
if (UserGroupInformation.isSecurityEnabled()) {
InetSocketAddress socAddr = getAddress(conf);
SecurityUtil.login(conf, DFS_NAMENODE_KEYTAB_FILE_KEY,
DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY, socAddr.getHostName());
}
Collection<URI> nameDirsToFormat = FSNamesystem.getNamespaceDirs(conf);
List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf);
List<URI> dirsToPrompt = new ArrayList<URI>();
dirsToPrompt.addAll(nameDirsToFormat);
dirsToPrompt.addAll(sharedDirs);
List<URI> editDirsToFormat =
FSNamesystem.getNamespaceEditsDirs(conf);
// if clusterID is not provided - see if you can find the current one
String clusterId = StartupOption.FORMAT.getClusterId();
if(clusterId == null || clusterId.equals("")) {
//Generate a new cluster id
clusterId = NNStorage.newClusterID();
}
System.out.println("Formatting using clusterid: " + clusterId);
FSImage fsImage = new FSImage(conf, nameDirsToFormat, editDirsToFormat);
try {
FSNamesystem fsn = new FSNamesystem(conf, fsImage);
fsImage.getEditLog().initJournalsForWrite();
if (!fsImage.confirmFormat(force, isInteractive)) {
return true; // aborted
}
fsImage.format(fsn, clusterId);
} catch (IOException ioe) {
LOG.warn("Encountered exception during format: ", ioe);
fsImage.close();
throw ioe;
}
return false;
} | static boolean function(Configuration conf, boolean force, boolean isInteractive) throws IOException { String nsId = DFSUtil.getNamenodeNameServiceId(conf); String namenodeId = HAUtil.getNameNodeId(conf, nsId); initializeGenericKeys(conf, nsId, namenodeId); checkAllowFormat(conf); if (UserGroupInformation.isSecurityEnabled()) { InetSocketAddress socAddr = getAddress(conf); SecurityUtil.login(conf, DFS_NAMENODE_KEYTAB_FILE_KEY, DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY, socAddr.getHostName()); } Collection<URI> nameDirsToFormat = FSNamesystem.getNamespaceDirs(conf); List<URI> sharedDirs = FSNamesystem.getSharedEditsDirs(conf); List<URI> dirsToPrompt = new ArrayList<URI>(); dirsToPrompt.addAll(nameDirsToFormat); dirsToPrompt.addAll(sharedDirs); List<URI> editDirsToFormat = FSNamesystem.getNamespaceEditsDirs(conf); String clusterId = StartupOption.FORMAT.getClusterId(); if(clusterId == null clusterId.equals(STRFormatting using clusterid: STREncountered exception during format: ", ioe); fsImage.close(); throw ioe; } return false; } | /**
* Verify that configured directories exist, then
* Interactively confirm that formatting is desired
* for each existing directory and format them.
*
* @param conf configuration to use
* @param force if true, format regardless of whether dirs exist
* @return true if formatting was aborted, false otherwise
* @throws IOException
*/ | Verify that configured directories exist, then Interactively confirm that formatting is desired for each existing directory and format them | format | {
"repo_name": "1tylermitchell/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/NameNode.java",
"license": "apache-2.0",
"size": 73799
} | [
"java.io.IOException",
"java.net.InetSocketAddress",
"java.util.ArrayList",
"java.util.Collection",
"java.util.List",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hdfs.DFSUtil",
"org.apache.hadoop.hdfs.HAUtil",
"org.apache.hadoop.hdfs.server.common.HdfsServerConstants",
"org.apache.hadoop.security.SecurityUtil",
"org.apache.hadoop.security.UserGroupInformation"
]
| import java.io.IOException; import java.net.InetSocketAddress; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hdfs.DFSUtil; import org.apache.hadoop.hdfs.HAUtil; import org.apache.hadoop.hdfs.server.common.HdfsServerConstants; import org.apache.hadoop.security.SecurityUtil; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import java.net.*; import java.util.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hdfs.*; import org.apache.hadoop.hdfs.server.common.*; import org.apache.hadoop.security.*; | [
"java.io",
"java.net",
"java.util",
"org.apache.hadoop"
]
| java.io; java.net; java.util; org.apache.hadoop; | 996,428 |
@Nullable
public static Bitmap readDownsampledImage(@NonNull final String filePath, final int maxX, final int maxY) {
int orientation = ExifInterface.ORIENTATION_NORMAL;
try {
final ExifInterface exif = new ExifInterface(filePath);
orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
} catch (final IOException e) {
Log.e("ImageUtils.readDownsampledImage", e);
}
final BitmapFactory.Options sizeOnlyOptions = new BitmapFactory.Options();
sizeOnlyOptions.inJustDecodeBounds = true;
BitmapFactory.decodeFile(filePath, sizeOnlyOptions);
final int myMaxXY = Math.max(sizeOnlyOptions.outHeight, sizeOnlyOptions.outWidth);
final int maxXY = Math.max(maxX, maxY);
final int sampleSize = myMaxXY / maxXY;
final BitmapFactory.Options sampleOptions = new BitmapFactory.Options();
if (sampleSize > 1) {
sampleOptions.inSampleSize = sampleSize;
}
final Bitmap decodedImage = BitmapFactory.decodeFile(filePath, sampleOptions);
if (decodedImage != null) {
for (int i = 0; i < ORIENTATIONS.length; i++) {
if (orientation == ORIENTATIONS[i]) {
final Matrix matrix = new Matrix();
matrix.postRotate(ROTATION[i]);
return Bitmap.createBitmap(decodedImage, 0, 0, decodedImage.getWidth(), decodedImage.getHeight(), matrix, true);
}
}
}
return decodedImage;
} | static Bitmap function(@NonNull final String filePath, final int maxX, final int maxY) { int orientation = ExifInterface.ORIENTATION_NORMAL; try { final ExifInterface exif = new ExifInterface(filePath); orientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL); } catch (final IOException e) { Log.e(STR, e); } final BitmapFactory.Options sizeOnlyOptions = new BitmapFactory.Options(); sizeOnlyOptions.inJustDecodeBounds = true; BitmapFactory.decodeFile(filePath, sizeOnlyOptions); final int myMaxXY = Math.max(sizeOnlyOptions.outHeight, sizeOnlyOptions.outWidth); final int maxXY = Math.max(maxX, maxY); final int sampleSize = myMaxXY / maxXY; final BitmapFactory.Options sampleOptions = new BitmapFactory.Options(); if (sampleSize > 1) { sampleOptions.inSampleSize = sampleSize; } final Bitmap decodedImage = BitmapFactory.decodeFile(filePath, sampleOptions); if (decodedImage != null) { for (int i = 0; i < ORIENTATIONS.length; i++) { if (orientation == ORIENTATIONS[i]) { final Matrix matrix = new Matrix(); matrix.postRotate(ROTATION[i]); return Bitmap.createBitmap(decodedImage, 0, 0, decodedImage.getWidth(), decodedImage.getHeight(), matrix, true); } } } return decodedImage; } | /**
* Reads and scales an image file with downsampling in one step to prevent memory consumption.
*
* @param filePath
* The file to read
* @param maxX
* The desired width
* @param maxY
* The desired height
* @return Bitmap the image or null if file can't be read
*/ | Reads and scales an image file with downsampling in one step to prevent memory consumption | readDownsampledImage | {
"repo_name": "SammysHP/cgeo",
"path": "main/src/cgeo/geocaching/utils/ImageUtils.java",
"license": "apache-2.0",
"size": 19511
} | [
"android.graphics.Bitmap",
"android.graphics.BitmapFactory",
"android.graphics.Matrix",
"android.media.ExifInterface",
"java.io.IOException",
"org.eclipse.jdt.annotation.NonNull"
]
| import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.media.ExifInterface; import java.io.IOException; import org.eclipse.jdt.annotation.NonNull; | import android.graphics.*; import android.media.*; import java.io.*; import org.eclipse.jdt.annotation.*; | [
"android.graphics",
"android.media",
"java.io",
"org.eclipse.jdt"
]
| android.graphics; android.media; java.io; org.eclipse.jdt; | 2,065,319 |
private double getLengthGew(final String gu) {
double length = 0;
for (final KatasterGewObj tmp : parts) {
if (tmp.getOwner().equals(gu)) {
length += tmp.getLength();
}
}
return length;
} | double function(final String gu) { double length = 0; for (final KatasterGewObj tmp : parts) { if (tmp.getOwner().equals(gu)) { length += tmp.getLength(); } } return length; } | /**
* DOCUMENT ME!
*
* @param gu DOCUMENT ME!
*
* @return DOCUMENT ME!
*/ | DOCUMENT ME | getLengthGew | {
"repo_name": "cismet/watergis-client",
"path": "src/main/java/de/cismet/watergis/reports/KatasterGewaesserReport.java",
"license": "lgpl-3.0",
"size": 87202
} | [
"de.cismet.watergis.reports.types.KatasterGewObj"
]
| import de.cismet.watergis.reports.types.KatasterGewObj; | import de.cismet.watergis.reports.types.*; | [
"de.cismet.watergis"
]
| de.cismet.watergis; | 1,760,168 |
return Flags.verboseExceptionSampler().isSampled(CancelledSubscriptionException.class) ?
new CancelledSubscriptionException() : INSTANCE;
}
private CancelledSubscriptionException() {}
private CancelledSubscriptionException(@SuppressWarnings("unused") boolean dummy) {
super(null, null, false, false);
} | return Flags.verboseExceptionSampler().isSampled(CancelledSubscriptionException.class) ? new CancelledSubscriptionException() : INSTANCE; } private CancelledSubscriptionException() {} private CancelledSubscriptionException(@SuppressWarnings(STR) boolean dummy) { super(null, null, false, false); } | /**
* Returns a {@link CancelledSubscriptionException} which may be a singleton or a new instance, depending
* on {@link Flags#verboseExceptionSampler()}'s decision.
*/ | Returns a <code>CancelledSubscriptionException</code> which may be a singleton or a new instance, depending on <code>Flags#verboseExceptionSampler()</code>'s decision | get | {
"repo_name": "line/armeria",
"path": "core/src/main/java/com/linecorp/armeria/common/stream/CancelledSubscriptionException.java",
"license": "apache-2.0",
"size": 1826
} | [
"com.linecorp.armeria.common.Flags"
]
| import com.linecorp.armeria.common.Flags; | import com.linecorp.armeria.common.*; | [
"com.linecorp.armeria"
]
| com.linecorp.armeria; | 2,357,973 |
public void setGeneralProgressListener(ProgressListener progressListener) {
this.progressListener = progressListener == null
? ProgressListener.NOOP
: progressListener;
} | void function(ProgressListener progressListener) { this.progressListener = progressListener == null ? ProgressListener.NOOP : progressListener; } | /**
* Sets the optional progress listener for receiving updates about the
* progress of the request.
*
* @param progressListener
* The new progress listener.
*/ | Sets the optional progress listener for receiving updates about the progress of the request | setGeneralProgressListener | {
"repo_name": "galaxynut/aws-sdk-java",
"path": "aws-java-sdk-core/src/main/java/com/amazonaws/AmazonWebServiceRequest.java",
"license": "apache-2.0",
"size": 8219
} | [
"com.amazonaws.event.ProgressListener"
]
| import com.amazonaws.event.ProgressListener; | import com.amazonaws.event.*; | [
"com.amazonaws.event"
]
| com.amazonaws.event; | 2,097,488 |
protected static CmsResource importTestResource(
CmsObject cms,
String rfsPath,
String vfsPath,
int type,
List<CmsProperty> properties) throws Exception {
byte[] content = CmsFileUtil.readFile(rfsPath);
CmsResource result = cms.createResource(vfsPath, type, content, properties);
cms.unlockResource(vfsPath);
return result;
} | static CmsResource function( CmsObject cms, String rfsPath, String vfsPath, int type, List<CmsProperty> properties) throws Exception { byte[] content = CmsFileUtil.readFile(rfsPath); CmsResource result = cms.createResource(vfsPath, type, content, properties); cms.unlockResource(vfsPath); return result; } | /**
* Imports a resource from the RFS test directories to the VFS.<p>
*
* The imported resource will be automatically unlocked.<p>
*
* @param cms the current users OpenCms context
* @param rfsPath the RTF path of the resource to import, must be a path accessibly by the current class loader
* @param vfsPath the VFS path for the imported resource
* @param type the type for the imported resource
* @param properties the properties for the imported resource
* @return the imported resource
*
* @throws Exception if the import fails
*/ | Imports a resource from the RFS test directories to the VFS. The imported resource will be automatically unlocked | importTestResource | {
"repo_name": "serrapos/opencms-core",
"path": "test/org/opencms/test/OpenCmsTestCase.java",
"license": "lgpl-2.1",
"size": 144807
} | [
"java.util.List",
"org.opencms.file.CmsObject",
"org.opencms.file.CmsProperty",
"org.opencms.file.CmsResource",
"org.opencms.util.CmsFileUtil"
]
| import java.util.List; import org.opencms.file.CmsObject; import org.opencms.file.CmsProperty; import org.opencms.file.CmsResource; import org.opencms.util.CmsFileUtil; | import java.util.*; import org.opencms.file.*; import org.opencms.util.*; | [
"java.util",
"org.opencms.file",
"org.opencms.util"
]
| java.util; org.opencms.file; org.opencms.util; | 1,070,189 |
void setPlayground(Playground playground); | void setPlayground(Playground playground); | /**
* Sets the playground
*
* @param playground the simulation playground
*/ | Sets the playground | setPlayground | {
"repo_name": "sergio-alves/RobotSimulator",
"path": "src/ch/santosalves/robotsimulator/inputs/RobotSensorInput.java",
"license": "gpl-2.0",
"size": 1116
} | [
"ch.santosalves.robotsimulator.playground.api.Playground"
]
| import ch.santosalves.robotsimulator.playground.api.Playground; | import ch.santosalves.robotsimulator.playground.api.*; | [
"ch.santosalves.robotsimulator"
]
| ch.santosalves.robotsimulator; | 2,633,536 |
public Element getPageContents(){
Paragraph content = new Paragraph();
content.setAlignment(Element.ALIGN_CENTER);
// add vertical whitespace
for(int i=0; i<8; i++){
content.add(Chunk.NEWLINE);
}
// add logo
content.add(getLogo());
content.add(Chunk.NEWLINE);
content.add(Chunk.NEWLINE);
// add title
Anchor title = new Anchor(new Paragraph(getTitle(),FontFactory.getFont(FontFactory.HELVETICA,16)));
String burl = job_info.getImageJobInformation().getAsString("base.url");
title.setReference(burl+"digilib.jsp?fn="+job_info.getImageJobInformation().getAsString("fn"));
content.add(title);
content.add(Chunk.NEWLINE);
// add author
if(getDate()!=" ")
content.add(new Paragraph(getAuthor()+" ("+getDate()+")",FontFactory.getFont(FontFactory.HELVETICA,14)));
else
content.add(new Paragraph(getAuthor(),FontFactory.getFont(FontFactory.HELVETICA,14)));
content.add(Chunk.NEWLINE);
// add page numbers
content.add(new Paragraph(getPages(), FontFactory.getFont(FontFactory.HELVETICA, 12)));
content.add(Chunk.NEWLINE);
content.add(Chunk.NEWLINE);
content.add(Chunk.NEWLINE);
// add digilib version
content.add(new Paragraph(getDigilibVersion(),FontFactory.getFont(FontFactory.HELVETICA,10)));
for(int i=0; i<8; i++){
content.add(Chunk.NEWLINE);
}
Anchor address = new Anchor(
new Paragraph(burl+"digilib.jsp?fn="+job_info.getImageJobInformation().getAsString("fn"), FontFactory.getFont(FontFactory.COURIER, 9))
);
address.setReference(burl+"digilib.jsp?fn="+job_info.getImageJobInformation().getAsString("fn"));
content.add(address);
return content;
}
| Element function(){ Paragraph content = new Paragraph(); content.setAlignment(Element.ALIGN_CENTER); for(int i=0; i<8; i++){ content.add(Chunk.NEWLINE); } content.add(getLogo()); content.add(Chunk.NEWLINE); content.add(Chunk.NEWLINE); Anchor title = new Anchor(new Paragraph(getTitle(),FontFactory.getFont(FontFactory.HELVETICA,16))); String burl = job_info.getImageJobInformation().getAsString(STR); title.setReference(burl+STR+job_info.getImageJobInformation().getAsString("fn")); content.add(title); content.add(Chunk.NEWLINE); if(getDate()!=" ") content.add(new Paragraph(getAuthor()+STR+getDate()+")",FontFactory.getFont(FontFactory.HELVETICA,14))); else content.add(new Paragraph(getAuthor(),FontFactory.getFont(FontFactory.HELVETICA,14))); content.add(Chunk.NEWLINE); content.add(new Paragraph(getPages(), FontFactory.getFont(FontFactory.HELVETICA, 12))); content.add(Chunk.NEWLINE); content.add(Chunk.NEWLINE); content.add(Chunk.NEWLINE); content.add(new Paragraph(getDigilibVersion(),FontFactory.getFont(FontFactory.HELVETICA,10))); for(int i=0; i<8; i++){ content.add(Chunk.NEWLINE); } Anchor address = new Anchor( new Paragraph(burl+STR+job_info.getImageJobInformation().getAsString("fn"), FontFactory.getFont(FontFactory.COURIER, 9)) ); address.setReference(burl+STR+job_info.getImageJobInformation().getAsString("fn")); content.add(address); return content; } | /**
* generate iText-PDF-Contents for the title page
*
* @return
*/ | generate iText-PDF-Contents for the title page | getPageContents | {
"repo_name": "jlerouge/digilib-pivaj",
"path": "pdf/src/main/java/digilib/pdf/PDFTitlePage.java",
"license": "lgpl-3.0",
"size": 5415
} | [
"com.itextpdf.text.Anchor",
"com.itextpdf.text.Chunk",
"com.itextpdf.text.Element",
"com.itextpdf.text.FontFactory",
"com.itextpdf.text.Paragraph"
]
| import com.itextpdf.text.Anchor; import com.itextpdf.text.Chunk; import com.itextpdf.text.Element; import com.itextpdf.text.FontFactory; import com.itextpdf.text.Paragraph; | import com.itextpdf.text.*; | [
"com.itextpdf.text"
]
| com.itextpdf.text; | 2,159,126 |
void touch(Entity entity, Boolean skipDryRun) throws DAGEngineException; | void touch(Entity entity, Boolean skipDryRun) throws DAGEngineException; | /**
* Re-builds the workflow.
* @param entity
* @param skipDryRun
* @return
*/ | Re-builds the workflow | touch | {
"repo_name": "pisaychuk/apache-falcon",
"path": "scheduler/src/main/java/org/apache/falcon/workflow/engine/DAGEngine.java",
"license": "apache-2.0",
"size": 3540
} | [
"org.apache.falcon.entity.v0.Entity",
"org.apache.falcon.exception.DAGEngineException"
]
| import org.apache.falcon.entity.v0.Entity; import org.apache.falcon.exception.DAGEngineException; | import org.apache.falcon.entity.v0.*; import org.apache.falcon.exception.*; | [
"org.apache.falcon"
]
| org.apache.falcon; | 1,359,824 |
void setOutlineColor(String color) {
// Add # to allow for mOutline color to be parsed correctly
mPolylineOptions.color(Color.parseColor("#" + convertColor(color)));
mPolygonOptions.strokeColor(Color.parseColor("#" + color));
mStylesSet.add("outlineColor");
} | void setOutlineColor(String color) { mPolylineOptions.color(Color.parseColor("#" + convertColor(color))); mPolygonOptions.strokeColor(Color.parseColor("#" + color)); mStylesSet.add(STR); } | /**
* Sets the outline color for a Polyline and a Polygon using a String
*
* @param color Outline color for a Polyline and a Polygon represented as a String
*/ | Sets the outline color for a Polyline and a Polygon using a String | setOutlineColor | {
"repo_name": "stephenmcd/android-maps-utils",
"path": "library/src/com/google/maps/android/data/kml/KmlStyle.java",
"license": "apache-2.0",
"size": 14380
} | [
"android.graphics.Color"
]
| import android.graphics.Color; | import android.graphics.*; | [
"android.graphics"
]
| android.graphics; | 540,403 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.