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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
@Test
@SuppressWarnings("unchecked")
public void testSessionWindowsWithContinuousEventTimeTrigger() throws Exception {
closeCalled.set(0);
final int sessionSize = 3;
TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse("Tuple2<String, Integer>");
ListStateDescriptor<Tuple2<String, Integer>> stateDesc = new ListStateDescriptor<>("window-contents",
inputType.createSerializer(new ExecutionConfig()));
WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>(
EventTimeSessionWindows.withGap(Time.seconds(sessionSize)),
new TimeWindow.Serializer(),
new TupleKeySelector(),
BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()),
stateDesc,
new InternalIterableWindowFunction<>(new SessionWindowFunction()),
ContinuousEventTimeTrigger.of(Time.seconds(2)),
0,
null );
OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness =
new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO);
ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>();
testHarness.open();
// add elements out-of-order and first trigger time is 2000
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1), 1500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 0));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 3), 2500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 2), 1000));
// triggers emit and next trigger time is 4000
testHarness.processWatermark(new Watermark(2500));
expectedOutput.add(new StreamRecord<>(new Tuple3<>("key1-1", 1500L, 4500L), 4499));
expectedOutput.add(new StreamRecord<>(new Tuple3<>("key2-6", 0L, 5500L), 5499));
expectedOutput.add(new Watermark(2500));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 5), 4000));
testHarness.processWatermark(new Watermark(3000));
expectedOutput.add(new Watermark(3000));
// do a snapshot, close and restore again
OperatorStateHandles snapshot = testHarness.snapshot(0L, 0L);
testHarness.close();
testHarness.setup();
testHarness.initializeState(snapshot);
testHarness.open();
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 2), 4000));
testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 4), 3500));
// triggers emit and next trigger time is 6000
testHarness.processWatermark(new Watermark(4000));
expectedOutput.add(new StreamRecord<>(new Tuple3<>("key1-3", 1500L, 7000L), 6999));
expectedOutput.add(new StreamRecord<>(new Tuple3<>("key2-15", 0L, 7000L), 6999));
expectedOutput.add(new Watermark(4000));
TestHarnessUtil.assertOutputEqualsSorted("Output was not correct.", expectedOutput, testHarness.getOutput(), new Tuple3ResultSortComparator());
testHarness.close();
} | @SuppressWarnings(STR) void function() throws Exception { closeCalled.set(0); final int sessionSize = 3; TypeInformation<Tuple2<String, Integer>> inputType = TypeInfoParser.parse(STR); ListStateDescriptor<Tuple2<String, Integer>> stateDesc = new ListStateDescriptor<>(STR, inputType.createSerializer(new ExecutionConfig())); WindowOperator<String, Tuple2<String, Integer>, Iterable<Tuple2<String, Integer>>, Tuple3<String, Long, Long>, TimeWindow> operator = new WindowOperator<>( EventTimeSessionWindows.withGap(Time.seconds(sessionSize)), new TimeWindow.Serializer(), new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO.createSerializer(new ExecutionConfig()), stateDesc, new InternalIterableWindowFunction<>(new SessionWindowFunction()), ContinuousEventTimeTrigger.of(Time.seconds(2)), 0, null ); OneInputStreamOperatorTestHarness<Tuple2<String, Integer>, Tuple3<String, Long, Long>> testHarness = new KeyedOneInputStreamOperatorTestHarness<>(operator, new TupleKeySelector(), BasicTypeInfo.STRING_TYPE_INFO); ConcurrentLinkedQueue<Object> expectedOutput = new ConcurrentLinkedQueue<>(); testHarness.open(); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 1), 1500)); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 1), 0)); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 3), 2500)); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 2), 1000)); testHarness.processWatermark(new Watermark(2500)); expectedOutput.add(new StreamRecord<>(new Tuple3<>(STR, 1500L, 4500L), 4499)); expectedOutput.add(new StreamRecord<>(new Tuple3<>(STR, 0L, 5500L), 5499)); expectedOutput.add(new Watermark(2500)); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 5), 4000)); testHarness.processWatermark(new Watermark(3000)); expectedOutput.add(new Watermark(3000)); OperatorStateHandles snapshot = testHarness.snapshot(0L, 0L); testHarness.close(); testHarness.setup(); testHarness.initializeState(snapshot); testHarness.open(); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key1", 2), 4000)); testHarness.processElement(new StreamRecord<>(new Tuple2<>("key2", 4), 3500)); testHarness.processWatermark(new Watermark(4000)); expectedOutput.add(new StreamRecord<>(new Tuple3<>(STR, 1500L, 7000L), 6999)); expectedOutput.add(new StreamRecord<>(new Tuple3<>(STR, 0L, 7000L), 6999)); expectedOutput.add(new Watermark(4000)); TestHarnessUtil.assertOutputEqualsSorted(STR, expectedOutput, testHarness.getOutput(), new Tuple3ResultSortComparator()); testHarness.close(); } | /**
* This tests whether merging works correctly with the ContinuousEventTimeTrigger.
* @throws Exception
*/ | This tests whether merging works correctly with the ContinuousEventTimeTrigger | testSessionWindowsWithContinuousEventTimeTrigger | {
"repo_name": "hongyuhong/flink",
"path": "flink-streaming-java/src/test/java/org/apache/flink/streaming/runtime/operators/windowing/WindowOperatorTest.java",
"license": "apache-2.0",
"size": 116111
} | [
"java.util.concurrent.ConcurrentLinkedQueue",
"org.apache.flink.api.common.ExecutionConfig",
"org.apache.flink.api.common.state.ListStateDescriptor",
"org.apache.flink.api.common.typeinfo.BasicTypeInfo",
"org.apache.flink.api.common.typeinfo.TypeInformation",
"org.apache.flink.api.java.tuple.Tuple2",
"org.apache.flink.api.java.tuple.Tuple3",
"org.apache.flink.api.java.typeutils.TypeInfoParser",
"org.apache.flink.streaming.api.watermark.Watermark",
"org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows",
"org.apache.flink.streaming.api.windowing.time.Time",
"org.apache.flink.streaming.api.windowing.triggers.ContinuousEventTimeTrigger",
"org.apache.flink.streaming.api.windowing.windows.TimeWindow",
"org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableWindowFunction",
"org.apache.flink.streaming.runtime.streamrecord.StreamRecord",
"org.apache.flink.streaming.runtime.tasks.OperatorStateHandles",
"org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness",
"org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness",
"org.apache.flink.streaming.util.TestHarnessUtil"
] | import java.util.concurrent.ConcurrentLinkedQueue; import org.apache.flink.api.common.ExecutionConfig; import org.apache.flink.api.common.state.ListStateDescriptor; import org.apache.flink.api.common.typeinfo.BasicTypeInfo; import org.apache.flink.api.common.typeinfo.TypeInformation; import org.apache.flink.api.java.tuple.Tuple2; import org.apache.flink.api.java.tuple.Tuple3; import org.apache.flink.api.java.typeutils.TypeInfoParser; import org.apache.flink.streaming.api.watermark.Watermark; import org.apache.flink.streaming.api.windowing.assigners.EventTimeSessionWindows; import org.apache.flink.streaming.api.windowing.time.Time; import org.apache.flink.streaming.api.windowing.triggers.ContinuousEventTimeTrigger; import org.apache.flink.streaming.api.windowing.windows.TimeWindow; import org.apache.flink.streaming.runtime.operators.windowing.functions.InternalIterableWindowFunction; import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles; import org.apache.flink.streaming.util.KeyedOneInputStreamOperatorTestHarness; import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness; import org.apache.flink.streaming.util.TestHarnessUtil; | import java.util.concurrent.*; import org.apache.flink.api.common.*; import org.apache.flink.api.common.state.*; import org.apache.flink.api.common.typeinfo.*; import org.apache.flink.api.java.tuple.*; import org.apache.flink.api.java.typeutils.*; import org.apache.flink.streaming.api.watermark.*; import org.apache.flink.streaming.api.windowing.assigners.*; import org.apache.flink.streaming.api.windowing.time.*; import org.apache.flink.streaming.api.windowing.triggers.*; import org.apache.flink.streaming.api.windowing.windows.*; import org.apache.flink.streaming.runtime.operators.windowing.functions.*; import org.apache.flink.streaming.runtime.streamrecord.*; import org.apache.flink.streaming.runtime.tasks.*; import org.apache.flink.streaming.util.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 240,411 |
public HttpRequest setContentType(ContentType contentType) {
this.contentType = contentType;
return this;
} | HttpRequest function(ContentType contentType) { this.contentType = contentType; return this; } | /**
* Set the content type for the payload to send with requests.
*
* @param contentType The content type for the data to send with the request.
* @return The current request instance.
*/ | Set the content type for the payload to send with requests | setContentType | {
"repo_name": "SelerityInc/CommonBase",
"path": "src/main/java/com/seleritycorp/common/base/http/client/HttpRequest.java",
"license": "apache-2.0",
"size": 7898
} | [
"org.apache.http.entity.ContentType"
] | import org.apache.http.entity.ContentType; | import org.apache.http.entity.*; | [
"org.apache.http"
] | org.apache.http; | 2,108,593 |
private static void clusterAndDisplayClusters(final Controller controller,
final Class<? extends IClusteringAlgorithm> clusteringAlgorithm)
{
final Map<String, Object> processingAttributes = Maps.newHashMap();
CommonAttributesDescriptor.attributeBuilder(processingAttributes)
.documents(Lists.newArrayList(SampleDocumentData.DOCUMENTS_DATA_MINING))
.query("data mining");
final ProcessingResult result = controller.process(processingAttributes,
clusteringAlgorithm);
ConsoleFormatter.displayClusters(result.getClusters(), 0);
} | static void function(final Controller controller, final Class<? extends IClusteringAlgorithm> clusteringAlgorithm) { final Map<String, Object> processingAttributes = Maps.newHashMap(); CommonAttributesDescriptor.attributeBuilder(processingAttributes) .documents(Lists.newArrayList(SampleDocumentData.DOCUMENTS_DATA_MINING)) .query(STR); final ProcessingResult result = controller.process(processingAttributes, clusteringAlgorithm); ConsoleFormatter.displayClusters(result.getClusters(), 0); } | /**
* Clusters results for query "data mining" and displays the clusters.
*/ | Clusters results for query "data mining" and displays the clusters | clusterAndDisplayClusters | {
"repo_name": "MjAbuz/carrot2",
"path": "applications/carrot2-examples/examples/org/carrot2/examples/clustering/UsingCustomLanguageModel.java",
"license": "bsd-3-clause",
"size": 6115
} | [
"java.util.Map",
"org.carrot2.core.Controller",
"org.carrot2.core.IClusteringAlgorithm",
"org.carrot2.core.ProcessingResult",
"org.carrot2.core.attribute.CommonAttributesDescriptor",
"org.carrot2.examples.ConsoleFormatter",
"org.carrot2.examples.SampleDocumentData",
"org.carrot2.shaded.guava.common.collect.Lists",
"org.carrot2.shaded.guava.common.collect.Maps"
] | import java.util.Map; import org.carrot2.core.Controller; import org.carrot2.core.IClusteringAlgorithm; import org.carrot2.core.ProcessingResult; import org.carrot2.core.attribute.CommonAttributesDescriptor; import org.carrot2.examples.ConsoleFormatter; import org.carrot2.examples.SampleDocumentData; import org.carrot2.shaded.guava.common.collect.Lists; import org.carrot2.shaded.guava.common.collect.Maps; | import java.util.*; import org.carrot2.core.*; import org.carrot2.core.attribute.*; import org.carrot2.examples.*; import org.carrot2.shaded.guava.common.collect.*; | [
"java.util",
"org.carrot2.core",
"org.carrot2.examples",
"org.carrot2.shaded"
] | java.util; org.carrot2.core; org.carrot2.examples; org.carrot2.shaded; | 2,855,222 |
public static MQVuserKeyingMaterial getInstance(
Object obj)
{
if (obj instanceof MQVuserKeyingMaterial)
{
return (MQVuserKeyingMaterial)obj;
}
else if (obj != null)
{
return new MQVuserKeyingMaterial(ASN1Sequence.getInstance(obj));
}
return null;
} | static MQVuserKeyingMaterial function( Object obj) { if (obj instanceof MQVuserKeyingMaterial) { return (MQVuserKeyingMaterial)obj; } else if (obj != null) { return new MQVuserKeyingMaterial(ASN1Sequence.getInstance(obj)); } return null; } | /**
* Return an MQVuserKeyingMaterial object from the given object.
* <p>
* Accepted inputs:
* <ul>
* <li> null → null
* <li> {@link MQVuserKeyingMaterial} object
* <li> {@link org.spongycastle.asn1.ASN1Sequence ASN1Sequence} with MQVuserKeyingMaterial inside it.
* </ul>
*
* @param obj the object we want converted.
* @throws IllegalArgumentException if the object cannot be converted.
*/ | Return an MQVuserKeyingMaterial object from the given object. Accepted inputs: null → null <code>MQVuserKeyingMaterial</code> object <code>org.spongycastle.asn1.ASN1Sequence ASN1Sequence</code> with MQVuserKeyingMaterial inside it. | getInstance | {
"repo_name": "Skywalker-11/spongycastle",
"path": "core/src/main/java/org/spongycastle/asn1/cms/ecc/MQVuserKeyingMaterial.java",
"license": "mit",
"size": 3712
} | [
"org.spongycastle.asn1.ASN1Sequence"
] | import org.spongycastle.asn1.ASN1Sequence; | import org.spongycastle.asn1.*; | [
"org.spongycastle.asn1"
] | org.spongycastle.asn1; | 158,624 |
public void deactivated(SessionEvent sevt) {
// Clear the context information.
setCurrentLocation(null, false);
} // deactivated | void function(SessionEvent sevt) { setCurrentLocation(null, false); } | /**
* Called when the Session has deactivated. The debuggee VM is no
* longer connected to the Session.
*
* @param sevt session event.
*/ | Called when the Session has deactivated. The debuggee VM is no longer connected to the Session | deactivated | {
"repo_name": "mbertacca/JSwat2",
"path": "classes/com/bluemarsh/jswat/ContextManager.java",
"license": "gpl-2.0",
"size": 13174
} | [
"com.bluemarsh.jswat.event.SessionEvent"
] | import com.bluemarsh.jswat.event.SessionEvent; | import com.bluemarsh.jswat.event.*; | [
"com.bluemarsh.jswat"
] | com.bluemarsh.jswat; | 2,498,972 |
public void delete(JsonObject doc) {
delete(this.currentQuery.getDeleteQueryWhereEqual(), doc);
} | void function(JsonObject doc) { delete(this.currentQuery.getDeleteQueryWhereEqual(), doc); } | /**
* Deletes a single JsonObject
* @param doc - to be deleted
*/ | Deletes a single JsonObject | delete | {
"repo_name": "AGES-Initiatives/alwb-utils-gui",
"path": "alwb.utils/src/main/java/net/ages/alwb/utils/core/datastores/db/h2/manager/H2ConnectionManager.java",
"license": "epl-1.0",
"size": 13295
} | [
"com.google.gson.JsonObject"
] | import com.google.gson.JsonObject; | import com.google.gson.*; | [
"com.google.gson"
] | com.google.gson; | 1,839,729 |
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
headerPanel = new javax.swing.JPanel();
scrollPane = new javax.swing.JScrollPane();
contentPanel = new javax.swing.JPanel();
setLayout(new java.awt.BorderLayout());
headerPanel.setLayout(new java.awt.BorderLayout());
add(headerPanel, java.awt.BorderLayout.NORTH);
contentPanel.setLayout(new java.awt.BorderLayout());
scrollPane.setViewportView(contentPanel);
add(scrollPane, java.awt.BorderLayout.CENTER);
}// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JPanel contentPanel;
private javax.swing.JPanel headerPanel;
private javax.swing.JScrollPane scrollPane;
// End of variables declaration//GEN-END:variables
| @SuppressWarnings(STR) void function() { headerPanel = new javax.swing.JPanel(); scrollPane = new javax.swing.JScrollPane(); contentPanel = new javax.swing.JPanel(); setLayout(new java.awt.BorderLayout()); headerPanel.setLayout(new java.awt.BorderLayout()); add(headerPanel, java.awt.BorderLayout.NORTH); contentPanel.setLayout(new java.awt.BorderLayout()); scrollPane.setViewportView(contentPanel); add(scrollPane, java.awt.BorderLayout.CENTER); } private javax.swing.JPanel contentPanel; private javax.swing.JPanel headerPanel; private javax.swing.JScrollPane scrollPane; | /**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/ | This method is called from within the constructor to initialize the form. regenerated by the Form Editor | initComponents | {
"repo_name": "Anisorf/ENCODE",
"path": "encode/src/org/wandora/application/gui/topicpanels/SketchGridPanel.java",
"license": "gpl-3.0",
"size": 8874
} | [
"java.awt.BorderLayout",
"javax.swing.JPanel"
] | import java.awt.BorderLayout; import javax.swing.JPanel; | import java.awt.*; import javax.swing.*; | [
"java.awt",
"javax.swing"
] | java.awt; javax.swing; | 128,557 |
public void generateMaze() {
if (randomSeed == 0) {
randomSeed = System.currentTimeMillis();
System.out.println("Maze.generateMaze - randomSeed: " + randomSeed);
}
final Random randomGenerator = new Random(randomSeed);
for (int curlyLineIndex = 0; curlyLineIndex < (mazeHeight * mazeWidth); curlyLineIndex++) {
final Point startPointCurlyLine = getStartPointCurlyLine(randomGenerator);
if (startPointCurlyLine != null)
createCurlyLine(randomGenerator, startPointCurlyLine);
}
fillRemainingHoles(randomGenerator);
} | void function() { if (randomSeed == 0) { randomSeed = System.currentTimeMillis(); System.out.println(STR + randomSeed); } final Random randomGenerator = new Random(randomSeed); for (int curlyLineIndex = 0; curlyLineIndex < (mazeHeight * mazeWidth); curlyLineIndex++) { final Point startPointCurlyLine = getStartPointCurlyLine(randomGenerator); if (startPointCurlyLine != null) createCurlyLine(randomGenerator, startPointCurlyLine); } fillRemainingHoles(randomGenerator); } | /**
* Generate a random maze.
*/ | Generate a random maze | generateMaze | {
"repo_name": "FreekDB/MazeGenerator",
"path": "src/main/java/nl/xs4all/home/freekdb/maze/model/Maze.java",
"license": "apache-2.0",
"size": 16776
} | [
"java.awt.Point",
"java.util.Random"
] | import java.awt.Point; import java.util.Random; | import java.awt.*; import java.util.*; | [
"java.awt",
"java.util"
] | java.awt; java.util; | 2,603,019 |
public static Expression sum (Expression[] rgExpressions, int nStart, int nEnd)
{
Expression exprSum = null;
for (int i = nStart; i <= nEnd; i++)
{
if (exprSum == null)
exprSum = rgExpressions[i].clone ();
else
exprSum = new BinaryExpression (exprSum, BinaryOperator.ADD, rgExpressions[i].clone ());
}
return exprSum == null ? new IntegerLiteral (0) : Symbolic.optimizeExpression (exprSum);
}
| static Expression function (Expression[] rgExpressions, int nStart, int nEnd) { Expression exprSum = null; for (int i = nStart; i <= nEnd; i++) { if (exprSum == null) exprSum = rgExpressions[i].clone (); else exprSum = new BinaryExpression (exprSum, BinaryOperator.ADD, rgExpressions[i].clone ()); } return exprSum == null ? new IntegerLiteral (0) : Symbolic.optimizeExpression (exprSum); } | /**
* Calculates the sum of the expressions <code>rgExpressions</code>.
*
* @param rgExpressions
* The expressions to add
* @return The sum of all the expressions <code>rgExpressions</code>
*/ | Calculates the sum of the expressions <code>rgExpressions</code> | sum | {
"repo_name": "bcosenza/patus",
"path": "src/ch/unibas/cs/hpwc/patus/util/ExpressionUtil.java",
"license": "lgpl-2.1",
"size": 34121
} | [
"ch.unibas.cs.hpwc.patus.symbolic.Symbolic"
] | import ch.unibas.cs.hpwc.patus.symbolic.Symbolic; | import ch.unibas.cs.hpwc.patus.symbolic.*; | [
"ch.unibas.cs"
] | ch.unibas.cs; | 1,739,635 |
public void deleteComment(String commentId) {
try {
LOG.debug("Deleting comment(id={})", commentId);
if (commentId == null) {
throw new IllegalArgumentException("Parameter 'commentId' can not be null");
}
BoxComment comment = new BoxComment(boxConnection, commentId);
comment.delete();
} catch (BoxAPIException e) {
throw new RuntimeException(
String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
} | void function(String commentId) { try { LOG.debug(STR, commentId); if (commentId == null) { throw new IllegalArgumentException(STR); } BoxComment comment = new BoxComment(boxConnection, commentId); comment.delete(); } catch (BoxAPIException e) { throw new RuntimeException( String.format(STR, e.getResponseCode(), e.getResponse()), e); } } | /**
* Delete comment.
*
* @param commentId
* - the id of comment to delete.
*/ | Delete comment | deleteComment | {
"repo_name": "kevinearls/camel",
"path": "components/camel-box/camel-box-api/src/main/java/org/apache/camel/component/box/api/BoxCommentsManager.java",
"license": "apache-2.0",
"size": 7179
} | [
"com.box.sdk.BoxAPIException",
"com.box.sdk.BoxComment"
] | import com.box.sdk.BoxAPIException; import com.box.sdk.BoxComment; | import com.box.sdk.*; | [
"com.box.sdk"
] | com.box.sdk; | 1,548,460 |
@ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY )
@org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE})
@Basic( optional = true )
@JoinColumn(name = "enrollmentid", nullable = true )
public Enrollment getEnrollmentid() {
return this.enrollmentid;
}
| @ManyToOne( cascade = { CascadeType.PERSIST, CascadeType.MERGE }, fetch = FetchType.LAZY ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE}) @Basic( optional = true ) @JoinColumn(name = STR, nullable = true ) Enrollment function() { return this.enrollmentid; } | /**
* Return the value associated with the column: enrollmentid.
* @return A Enrollment object (this.enrollmentid)
*/ | Return the value associated with the column: enrollmentid | getEnrollmentid | {
"repo_name": "servinglynk/servinglynk-hmis",
"path": "hmis-model-v2015/src/main/java/com/servinglynk/hmis/warehouse/model/v2015/Contact.java",
"license": "mpl-2.0",
"size": 10696
} | [
"javax.persistence.Basic",
"javax.persistence.CascadeType",
"javax.persistence.FetchType",
"javax.persistence.JoinColumn",
"javax.persistence.ManyToOne"
] | import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 1,892,223 |
String convert(N node, Map<N, Integer> mapNodeToId, N antecedent) throws ConllConverterException;
static final int ROOT_ID = 0;
static final char TAB = '\t';
static final String UNDERSCORE = "_";
static final String ROOT = "ROOT"; | String convert(N node, Map<N, Integer> mapNodeToId, N antecedent) throws ConllConverterException; static final int ROOT_ID = 0; static final char TAB = '\t'; static final String UNDERSCORE = "_"; static final String ROOT = "ROOT"; | /**
* Get a node, and a map from nodes to their respective CoNLL representation IDs, the antecedent, and return the line representing the
* node in CoNLL format.<br>
* <b>ASSUMPTION:</b> the map contains entries for the node and its antecedent
*
* @param node
* @param mapNodeToId
* @param antecedent
* @return
* @throws ConllConverterException
*/ | Get a node, and a map from nodes to their respective CoNLL representation IDs, the antecedent, and return the line representing the node in CoNLL format | convert | {
"repo_name": "madhumita-git/Excitement-Open-Platform",
"path": "transformations/src/main/java/eu/excitementproject/eop/transformations/generic/truthteller/conll/TreeConllStringConverter.java",
"license": "gpl-3.0",
"size": 1249
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,705,202 |
public void unequipp(Equippable item) {
if (item == weaponMain) {
weaponMain = null;
}
if (item == weaponSec) {
weaponSec = null;
}
if (item == boots) {
boots = null;
}
if (item == gloves) {
gloves = null;
}
if (item == shield) {
shield = null;
}
if (item == chest) {
chest = null;
}
if (item == ring) {
ring = null;
}
if (item == ringSec) {
ringSec = null;
}
if (item == amulet) {
amulet = null;
}
if (item == artifact) {
artifact = null;
}
item.reset();
} | void function(Equippable item) { if (item == weaponMain) { weaponMain = null; } if (item == weaponSec) { weaponSec = null; } if (item == boots) { boots = null; } if (item == gloves) { gloves = null; } if (item == shield) { shield = null; } if (item == chest) { chest = null; } if (item == ring) { ring = null; } if (item == ringSec) { ringSec = null; } if (item == amulet) { amulet = null; } if (item == artifact) { artifact = null; } item.reset(); } | /**
* Removes specific item from equipment
*
* @param item Equipped character item
*/ | Removes specific item from equipment | unequipp | {
"repo_name": "Isangeles/Senlin",
"path": "src/main/java/pl/isangeles/senlin/core/Equipment.java",
"license": "gpl-2.0",
"size": 8585
} | [
"pl.isangeles.senlin.core.item.Equippable"
] | import pl.isangeles.senlin.core.item.Equippable; | import pl.isangeles.senlin.core.item.*; | [
"pl.isangeles.senlin"
] | pl.isangeles.senlin; | 2,547,759 |
public static <K, V> Map<K, V> mapOf(K key, V value, Object... keyValues) {
final Map<K, V> map = new LinkedHashMap<>(1 + keyValues.length);
map.put(key, value);
for (int i = 0; i < keyValues.length;) {
//noinspection unchecked
map.put((K) keyValues[i++], (V) keyValues[i++]);
}
return map;
} | static <K, V> Map<K, V> function(K key, V value, Object... keyValues) { final Map<K, V> map = new LinkedHashMap<>(1 + keyValues.length); map.put(key, value); for (int i = 0; i < keyValues.length;) { map.put((K) keyValues[i++], (V) keyValues[i++]); } return map; } | /**
* Returns a hashmap with given contents.
*
* <p>Use this method in initializers. Type parameters are inferred from
* context, and the contents are initialized declaratively. For example,
*
* <blockquote><code>Map<String, Integer> population =<br>
* Olap4jUtil.mapOf(<br>
* "UK", 65000000,<br>
* "USA", 300000000);</code></blockquote>
*
* @param key First key
* @param value First value
* @param keyValues Second and sequent key/value pairs
* @param <K> Key type
* @param <V> Value type
* @return Map with given contents
*/ | Returns a hashmap with given contents. Use this method in initializers. Type parameters are inferred from context, and the contents are initialized declaratively. For example, <code>Map<String, Integer> population = Olap4jUtil.mapOf( "UK", 65000000, "USA", 300000000);</code> | mapOf | {
"repo_name": "julianhyde/calcite",
"path": "core/src/main/java/org/apache/calcite/util/Util.java",
"license": "apache-2.0",
"size": 86163
} | [
"java.util.LinkedHashMap",
"java.util.Map"
] | import java.util.LinkedHashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,675,785 |
public static String makeTimeString(final Context context, long secs) {
long hours, mins;
hours = secs / 3600;
secs -= hours * 3600;
mins = secs / 60;
secs -= mins * 60;
final String durationFormat = context.getResources().getString(
hours == 0 ? R.string.durationformatshort : R.string.durationformatlong);
return String.format(durationFormat, hours, mins, secs);
} | static String function(final Context context, long secs) { long hours, mins; hours = secs / 3600; secs -= hours * 3600; mins = secs / 60; secs -= mins * 60; final String durationFormat = context.getResources().getString( hours == 0 ? R.string.durationformatshort : R.string.durationformatlong); return String.format(durationFormat, hours, mins, secs); } | /**
* * Used to create a formatted time string for the duration of tracks.
*
* @param context The {@link Context} to use.
* @param secs The track in seconds.
* @return Duration of a track that's properly formatted.
*/ | Used to create a formatted time string for the duration of tracks | makeTimeString | {
"repo_name": "JavierNicolas/JadaMusic",
"path": "app3/src/main/java/org/opensilk/music/ui3/common/UtilsCommon.java",
"license": "gpl-3.0",
"size": 6891
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 500,347 |
public Counter getReadTimeouts() {
return readTimeouts;
} | Counter function() { return readTimeouts; } | /**
* Returns the number of read requests that returned a timeout (independently
* of the final decision taken by the {@link com.datastax.driver.core.policies.RetryPolicy}).
*
* @return the number of read timeout.
*/ | Returns the number of read requests that returned a timeout (independently of the final decision taken by the <code>com.datastax.driver.core.policies.RetryPolicy</code>) | getReadTimeouts | {
"repo_name": "ruivieira/java-driver",
"path": "driver-core/src/main/java/com/datastax/driver/core/Metrics.java",
"license": "apache-2.0",
"size": 9577
} | [
"com.yammer.metrics.core.Counter"
] | import com.yammer.metrics.core.Counter; | import com.yammer.metrics.core.*; | [
"com.yammer.metrics"
] | com.yammer.metrics; | 1,190,287 |
T visitReferenceMap(@NotNull BigDataScriptParser.ReferenceMapContext ctx); | T visitReferenceMap(@NotNull BigDataScriptParser.ReferenceMapContext ctx); | /**
* Visit a parse tree produced by {@link BigDataScriptParser#referenceMap}.
* @param ctx the parse tree
* @return the visitor result
*/ | Visit a parse tree produced by <code>BigDataScriptParser#referenceMap</code> | visitReferenceMap | {
"repo_name": "leepc12/BigDataScript",
"path": "src/org/bds/antlr/BigDataScriptVisitor.java",
"license": "apache-2.0",
"size": 22181
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 1,315,917 |
@ApiModelProperty(value = "Describes the installation of a package on the linked resource.")
public PackageManagerInstallationDetails getInstallationDetails() {
return installationDetails;
} | @ApiModelProperty(value = STR) PackageManagerInstallationDetails function() { return installationDetails; } | /**
* Describes the installation of a package on the linked resource.
* @return installationDetails
**/ | Describes the installation of a package on the linked resource | getInstallationDetails | {
"repo_name": "grafeas/client-java",
"path": "src/main/java/io/grafeas/model/ApiOccurrence.java",
"license": "apache-2.0",
"size": 13708
} | [
"io.grafeas.model.PackageManagerInstallationDetails",
"io.swagger.annotations.ApiModelProperty"
] | import io.grafeas.model.PackageManagerInstallationDetails; import io.swagger.annotations.ApiModelProperty; | import io.grafeas.model.*; import io.swagger.annotations.*; | [
"io.grafeas.model",
"io.swagger.annotations"
] | io.grafeas.model; io.swagger.annotations; | 1,018,555 |
public static String getMethodParameterType(String methodName, int parameter) {
Dbc.require("A method must be specified", methodName != null && methodName.length() > 0);
Dbc.require("A method must have " + ParameterStart + " and " + ParameterEnd + " characters", methodName.contains(ParameterStart) && methodName.contains(ParameterEnd));
Dbc.require("Method index must be 0 or greater", parameter >= 0);
String retValue = null;
String paramTypes [] = getMethodParameterTypes(methodName);
if (paramTypes.length > 0 && parameter < paramTypes.length) {
retValue = paramTypes[parameter];
}
return retValue;
}
| static String function(String methodName, int parameter) { Dbc.require(STR, methodName != null && methodName.length() > 0); Dbc.require(STR + ParameterStart + STR + ParameterEnd + STR, methodName.contains(ParameterStart) && methodName.contains(ParameterEnd)); Dbc.require(STR, parameter >= 0); String retValue = null; String paramTypes [] = getMethodParameterTypes(methodName); if (paramTypes.length > 0 && parameter < paramTypes.length) { retValue = paramTypes[parameter]; } return retValue; } | /**
* Determine the parameter type for a given parameter index
*
* @param methodName
* @param parameter
* @return String parameter type
*/ | Determine the parameter type for a given parameter index | getMethodParameterType | {
"repo_name": "EPapadopoulou/PersoNIS",
"path": "api/android/external2/src/main/java/org/societies/android/api/utilities/ServiceMethodTranslator.java",
"license": "bsd-2-clause",
"size": 20272
} | [
"org.societies.utilities.DBC"
] | import org.societies.utilities.DBC; | import org.societies.utilities.*; | [
"org.societies.utilities"
] | org.societies.utilities; | 1,727,886 |
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtils.writeStroke(this.groupStroke, stream);
SerialUtils.writePaint(this.groupPaint, stream);
}
| void function(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtils.writeStroke(this.groupStroke, stream); SerialUtils.writePaint(this.groupPaint, stream); } | /**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/ | Provides serialization support | writeObject | {
"repo_name": "oskopek/jfreechart-fse",
"path": "src/main/java/org/jfree/chart/renderer/category/MinMaxCategoryRenderer.java",
"license": "lgpl-2.1",
"size": 20286
} | [
"java.io.IOException",
"java.io.ObjectOutputStream",
"org.jfree.chart.util.SerialUtils"
] | import java.io.IOException; import java.io.ObjectOutputStream; import org.jfree.chart.util.SerialUtils; | import java.io.*; import org.jfree.chart.util.*; | [
"java.io",
"org.jfree.chart"
] | java.io; org.jfree.chart; | 593,327 |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
NavUtils.navigateUpFromSameTask(this);
return true;
}
return super.onOptionsItemSelected(item);
} | boolean function(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: NavUtils.navigateUpFromSameTask(this); return true; } return super.onOptionsItemSelected(item); } | /**
* Implements a up button to navigate one level up in the
* app structure
*/ | Implements a up button to navigate one level up in the app structure | onOptionsItemSelected | {
"repo_name": "bradleyjsimons/CounterApp",
"path": "src/ca/ualberta/ca/simons_counter/CounterListActivity.java",
"license": "apache-2.0",
"size": 12125
} | [
"android.support.v4.app.NavUtils",
"android.view.MenuItem"
] | import android.support.v4.app.NavUtils; import android.view.MenuItem; | import android.support.v4.app.*; import android.view.*; | [
"android.support",
"android.view"
] | android.support; android.view; | 2,686,074 |
protected void copyPropertyChangeListenersFrom(String propertyName, AbstractDataObject that) {
if ((that == null) || (that == this)) return;
for (PropertyChangeListener pcl : that.getPropertyChangeSupport().getPropertyChangeListeners(propertyName)) {
addPropertyChangeListener(propertyName, pcl);
}
} | void function(String propertyName, AbstractDataObject that) { if ((that == null) (that == this)) return; for (PropertyChangeListener pcl : that.getPropertyChangeSupport().getPropertyChangeListeners(propertyName)) { addPropertyChangeListener(propertyName, pcl); } } | /**
* Copies the property change listeners for the named property from the
* given data object, adding them all to this data object. This is a rather
* weird method, which was created when trying to support a rather weird
* feature of the old SPTargetList.
*/ | Copies the property change listeners for the named property from the given data object, adding them all to this data object. This is a rather weird method, which was created when trying to support a rather weird feature of the old SPTargetList | copyPropertyChangeListenersFrom | {
"repo_name": "spakzad/ocs",
"path": "bundle/edu.gemini.pot/src/main/java/edu/gemini/spModel/data/AbstractDataObject.java",
"license": "bsd-3-clause",
"size": 11313
} | [
"java.beans.PropertyChangeListener"
] | import java.beans.PropertyChangeListener; | import java.beans.*; | [
"java.beans"
] | java.beans; | 770,182 |
public static CommandResult execCommand(String[] commands, boolean isRoot, boolean isNeedResultMsg) {
int result = -1;
if (commands == null || commands.length == 0) {
return new CommandResult(result, null, null);
}
Process process = null;
InputStream successResult = null;
InputStream errorResult = null;
StringBuilder successMsg = null;
StringBuilder errorMsg = null;
DataOutputStream os = null;
try {
process = Runtime.getRuntime().exec(isRoot ? COMMAND_SU : COMMAND_SH);
os = new DataOutputStream(process.getOutputStream());
for (String command : commands) {
if (command == null) {
continue;
}
// donnot use os.writeBytes(commmand), avoid chinese charset error
os.write(command.getBytes());
os.writeBytes(COMMAND_LINE_END);
os.flush();
}
os.writeBytes(COMMAND_EXIT);
os.flush();
result = process.waitFor();
// get command result
if (isNeedResultMsg) {
successMsg = new StringBuilder();
errorMsg = new StringBuilder();
successResult = process.getInputStream();
errorResult = process.getErrorStream();
byte[] buf = new byte[1024];
for (int n; (n = successResult.read(buf)) != -1; ) {
successMsg.append(new String(buf, 0, n));
}
for (int n; (n = errorResult.read(buf)) != -1; ) {
errorMsg.append(new String(buf, 0, n));
}
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (os != null) {
os.close();
}
if (successResult != null) {
successResult.close();
}
if (errorResult != null) {
errorResult.close();
}
} catch (IOException e) {
e.printStackTrace();
}
if (process != null) {
process.destroy();
}
}
return new CommandResult(result, successMsg == null ? null : successMsg.toString(), errorMsg == null ? null
: errorMsg.toString());
}
@SuppressWarnings("unused")
public static class CommandResult {
public int result;
public String successMsg;
public String errorMsg;
public CommandResult(int result) {
this.result = result;
}
public CommandResult(int result, String successMsg, String errorMsg) {
this.result = result;
this.successMsg = successMsg;
this.errorMsg = errorMsg;
}
} | static CommandResult function(String[] commands, boolean isRoot, boolean isNeedResultMsg) { int result = -1; if (commands == null commands.length == 0) { return new CommandResult(result, null, null); } Process process = null; InputStream successResult = null; InputStream errorResult = null; StringBuilder successMsg = null; StringBuilder errorMsg = null; DataOutputStream os = null; try { process = Runtime.getRuntime().exec(isRoot ? COMMAND_SU : COMMAND_SH); os = new DataOutputStream(process.getOutputStream()); for (String command : commands) { if (command == null) { continue; } os.write(command.getBytes()); os.writeBytes(COMMAND_LINE_END); os.flush(); } os.writeBytes(COMMAND_EXIT); os.flush(); result = process.waitFor(); if (isNeedResultMsg) { successMsg = new StringBuilder(); errorMsg = new StringBuilder(); successResult = process.getInputStream(); errorResult = process.getErrorStream(); byte[] buf = new byte[1024]; for (int n; (n = successResult.read(buf)) != -1; ) { successMsg.append(new String(buf, 0, n)); } for (int n; (n = errorResult.read(buf)) != -1; ) { errorMsg.append(new String(buf, 0, n)); } } } catch (Exception e) { e.printStackTrace(); } finally { try { if (os != null) { os.close(); } if (successResult != null) { successResult.close(); } if (errorResult != null) { errorResult.close(); } } catch (IOException e) { e.printStackTrace(); } if (process != null) { process.destroy(); } } return new CommandResult(result, successMsg == null ? null : successMsg.toString(), errorMsg == null ? null : errorMsg.toString()); } @SuppressWarnings(STR) public static class CommandResult { public int result; public String successMsg; public String errorMsg; public CommandResult(int result) { this.result = result; } public CommandResult(int result, String successMsg, String errorMsg) { this.result = result; this.successMsg = successMsg; this.errorMsg = errorMsg; } } | /**
* execute shell commands
*
* @param commands command array
* @param isRoot whether need to run with root
* @param isNeedResultMsg whether need result msg
* @return <ul>
* <li>if isNeedResultMsg is false, {@link CommandResult#successMsg} is null and
* {@link CommandResult#errorMsg} is null.</li>
* <li>if {@link CommandResult#result} is -1, there maybe some excepiton.</li>
* </ul>
*/ | execute shell commands | execCommand | {
"repo_name": "wvqusrtg/Development-Java-Tools",
"path": "src/tools/ShellUtils.java",
"license": "apache-2.0",
"size": 7782
} | [
"java.io.DataOutputStream",
"java.io.IOException",
"java.io.InputStream"
] | import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,669,188 |
public void cleanUp() {
if (producers instanceof LRUCache) {
LRUCache<String, Producer> cache = (LRUCache<String, Producer>) producers;
cache.cleanUp();
}
} | void function() { if (producers instanceof LRUCache) { LRUCache<String, Producer> cache = (LRUCache<String, Producer>) producers; cache.cleanUp(); } } | /**
* Cleanup the cache (purging stale entries)
*/ | Cleanup the cache (purging stale entries) | cleanUp | {
"repo_name": "neoramon/camel",
"path": "camel-core/src/main/java/org/apache/camel/impl/ProducerCache.java",
"license": "apache-2.0",
"size": 30925
} | [
"org.apache.camel.Producer",
"org.apache.camel.util.LRUCache"
] | import org.apache.camel.Producer; import org.apache.camel.util.LRUCache; | import org.apache.camel.*; import org.apache.camel.util.*; | [
"org.apache.camel"
] | org.apache.camel; | 1,970,320 |
public void setTransacted(boolean transacted) {
if (transacted) {
setAcknowledgementMode(SessionAcknowledgementType.SESSION_TRANSACTED);
}
this.transacted = transacted;
} | void function(boolean transacted) { if (transacted) { setAcknowledgementMode(SessionAcknowledgementType.SESSION_TRANSACTED); } this.transacted = transacted; } | /**
* Enable/disable flag for transactions
*
* @param transacted true if transacted, otherwise false
*/ | Enable/disable flag for transactions | setTransacted | {
"repo_name": "logzio/camel",
"path": "components/camel-sjms/src/main/java/org/apache/camel/component/sjms/SjmsEndpoint.java",
"license": "apache-2.0",
"size": 15013
} | [
"org.apache.camel.component.sjms.jms.SessionAcknowledgementType"
] | import org.apache.camel.component.sjms.jms.SessionAcknowledgementType; | import org.apache.camel.component.sjms.jms.*; | [
"org.apache.camel"
] | org.apache.camel; | 613,478 |
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<PollResult<Void>, Void> beginHierarchicalNamespaceMigration(
String resourceGroupName, String accountName, String requestType, Context context) {
return beginHierarchicalNamespaceMigrationAsync(resourceGroupName, accountName, requestType, context)
.getSyncPoller();
} | @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller<PollResult<Void>, Void> function( String resourceGroupName, String accountName, String requestType, Context context) { return beginHierarchicalNamespaceMigrationAsync(resourceGroupName, accountName, requestType, context) .getSyncPoller(); } | /**
* Live Migration of storage account to enable Hns.
*
* @param resourceGroupName The name of the resource group within the user's subscription. The name is case
* insensitive.
* @param accountName The name of the storage account within the specified resource group. Storage account names
* must be between 3 and 24 characters in length and use numbers and lower-case letters only.
* @param requestType Required. Hierarchical namespace migration type can either be a hierarchical namespace
* validation request 'HnsOnValidationRequest' or a hydration request 'HnsOnHydrationRequest'. The validation
* request will validate the migration whereas the hydration request will migrate the account.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of long-running operation.
*/ | Live Migration of storage account to enable Hns | beginHierarchicalNamespaceMigration | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/resourcemanager/azure-resourcemanager-storage/src/main/java/com/azure/resourcemanager/storage/implementation/StorageAccountsClientImpl.java",
"license": "mit",
"size": 213141
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.management.polling.PollResult",
"com.azure.core.util.Context",
"com.azure.core.util.polling.SyncPoller"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.management.polling.PollResult; import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; | import com.azure.core.annotation.*; import com.azure.core.management.polling.*; import com.azure.core.util.*; import com.azure.core.util.polling.*; | [
"com.azure.core"
] | com.azure.core; | 2,333,724 |
public static HttpServer2.Builder httpServerTemplateForRM(Configuration conf,
final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr,
String name) throws IOException {
HttpServer2.Builder builder = new HttpServer2.Builder().setName(name)
.setConf(conf).setSecurityEnabled(false);
if (httpAddr.getPort() == 0) {
builder.setFindPort(true);
}
URI uri = URI.create("http://" + NetUtils.getHostPortString(httpAddr));
builder.addEndpoint(uri);
LOG.info("Starting Web-server for " + name + " at: " + uri);
return builder;
} | static HttpServer2.Builder function(Configuration conf, final InetSocketAddress httpAddr, final InetSocketAddress httpsAddr, String name) throws IOException { HttpServer2.Builder builder = new HttpServer2.Builder().setName(name) .setConf(conf).setSecurityEnabled(false); if (httpAddr.getPort() == 0) { builder.setFindPort(true); } URI uri = URI.create(STRStarting Web-server for STR at: " + uri); return builder; } | /**
* Return a HttpServer.Builder that the journalnode / namenode / secondary
* namenode can use to initialize their HTTP / HTTPS server.
*
* @param conf configuration object
* @param httpAddr HTTP address
* @param httpsAddr HTTPS address
* @param name Name of the server
* @throws IOException from Builder
* @return builder object
*/ | Return a HttpServer.Builder that the journalnode / namenode / secondary namenode can use to initialize their HTTP / HTTPS server | httpServerTemplateForRM | {
"repo_name": "WIgor/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceManager.java",
"license": "apache-2.0",
"size": 57905
} | [
"java.io.IOException",
"java.net.InetSocketAddress",
"java.net.URI",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.http.HttpServer2",
"org.apache.hadoop.yarn.webapp.WebApps"
] | import java.io.IOException; import java.net.InetSocketAddress; import java.net.URI; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.http.HttpServer2; import org.apache.hadoop.yarn.webapp.WebApps; | import java.io.*; import java.net.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.http.*; import org.apache.hadoop.yarn.webapp.*; | [
"java.io",
"java.net",
"org.apache.hadoop"
] | java.io; java.net; org.apache.hadoop; | 1,094,428 |
public FunctionType createFunctionTypeWithVarArgs(
JSType returnType, List<JSType> parameterTypes) {
return createFunctionType(
returnType, createParametersWithVarArgs(parameterTypes));
} | FunctionType function( JSType returnType, List<JSType> parameterTypes) { return createFunctionType( returnType, createParametersWithVarArgs(parameterTypes)); } | /**
* Creates a function type. The last parameter type of the function is
* considered a variable length argument.
*
* @param returnType the function's return type
* @param parameterTypes the parameters' types
*/ | Creates a function type. The last parameter type of the function is considered a variable length argument | createFunctionTypeWithVarArgs | {
"repo_name": "robbert/closure-compiler",
"path": "src/com/google/javascript/rhino/jstype/JSTypeRegistry.java",
"license": "apache-2.0",
"size": 68593
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 979,038 |
R processAudio(Asset asset, ResourceResolver resourceResolver, File tempFile, ExecutableLocator locator, File workingDir, A args)
throws AudioException;
} | R processAudio(Asset asset, ResourceResolver resourceResolver, File tempFile, ExecutableLocator locator, File workingDir, A args) throws AudioException; } | /**
* Process a file given an FFMpeg environment.
*
* @param asset an Asset
* @param resourceResolver a ResourceResolver
* @param tempFile the Asset's original rendition as a File
* @param locator the FFMpeg Executable Locator
* @param workingDir a working directory for FFMpeg
* @param args the arguments object
* @return a result
* @throws AudioException if something goes wrong
*/ | Process a file given an FFMpeg environment | processAudio | {
"repo_name": "badvision/acs-aem-commons",
"path": "bundle/src/main/java/com/adobe/acs/commons/dam/audio/impl/AudioHelper.java",
"license": "apache-2.0",
"size": 2494
} | [
"com.day.cq.dam.api.Asset",
"com.day.cq.dam.handler.ffmpeg.ExecutableLocator",
"java.io.File",
"org.apache.sling.api.resource.ResourceResolver"
] | import com.day.cq.dam.api.Asset; import com.day.cq.dam.handler.ffmpeg.ExecutableLocator; import java.io.File; import org.apache.sling.api.resource.ResourceResolver; | import com.day.cq.dam.api.*; import com.day.cq.dam.handler.ffmpeg.*; import java.io.*; import org.apache.sling.api.resource.*; | [
"com.day.cq",
"java.io",
"org.apache.sling"
] | com.day.cq; java.io; org.apache.sling; | 1,508,630 |
public Set<String> getIdCandidates(RecognizedEntity recognizedEntity){
Set<String> candidates = new HashSet<String>();
IdentificationStatus identificationStatus = identificationStatusMap.get(recognizedEntity);
if(identificationStatus!=null){
candidates = identificationStatus.getIdCandidates();
}
return candidates;
} | Set<String> function(RecognizedEntity recognizedEntity){ Set<String> candidates = new HashSet<String>(); IdentificationStatus identificationStatus = identificationStatusMap.get(recognizedEntity); if(identificationStatus!=null){ candidates = identificationStatus.getIdCandidates(); } return candidates; } | /**
* Returns a set of candidate ids for a recognized entity.
* */ | Returns a set of candidate ids for a recognized entity | getIdCandidates | {
"repo_name": "miroculus/GNAT",
"path": "src/gnat/representation/Context.java",
"license": "bsd-2-clause",
"size": 30321
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,287,980 |
public int connect(JSONObject vnfmObj,String authModel) {
LOG.info("function=connect, msg=enter connect function.");
ConnectInfo info = new ConnectInfo(vnfmObj.getString("url"), vnfmObj.getString("userName"),
vnfmObj.getString("password"), authModel);
HttpMethod httpMethod = null;
int statusCode = Constant.INTERNAL_EXCEPTION;
try {
httpMethod = new HttpRequests.Builder(info.getAuthenticateMode())
.setUrl(info.getUrl(), ParamConstants.CSM_AUTH_CONNECT)
.setParams(String.format(ParamConstants.GET_TOKENS_V2, info.getUserName(), info.getUserPwd()))
.post().execute();
statusCode = httpMethod.getStatusCode();
String result = httpMethod.getResponseBodyAsString();
LOG.info("connect result:"+result);
if(statusCode == HttpStatus.SC_CREATED) {
JSONObject accessObj = JSONObject.fromObject(result);
JSONObject tokenObj = accessObj.getJSONObject("token");
Header header = httpMethod.getResponseHeader("accessSession");
setAccessSession(header.getValue());
setRoaRand(tokenObj.getString("roa_rand"));
statusCode = HttpStatus.SC_OK;
} else {
LOG.error("connect fail, code:" + statusCode + " re:" + result);
}
} catch(JSONException e) {
LOG.error("function=connect, msg=connect JSONException e={}.", e);
} catch(VnfmException e) {
LOG.error("function=connect, msg=connect VnfmException e={}.", e);
} catch(IOException e) {
LOG.error("function=connect, msg=connect IOException e={}.", e);
} finally {
clearCSMPwd(info);
if(httpMethod != null) {
httpMethod.releaseConnection();
}
}
return statusCode;
} | int function(JSONObject vnfmObj,String authModel) { LOG.info(STR); ConnectInfo info = new ConnectInfo(vnfmObj.getString("url"), vnfmObj.getString(STR), vnfmObj.getString(STR), authModel); HttpMethod httpMethod = null; int statusCode = Constant.INTERNAL_EXCEPTION; try { httpMethod = new HttpRequests.Builder(info.getAuthenticateMode()) .setUrl(info.getUrl(), ParamConstants.CSM_AUTH_CONNECT) .setParams(String.format(ParamConstants.GET_TOKENS_V2, info.getUserName(), info.getUserPwd())) .post().execute(); statusCode = httpMethod.getStatusCode(); String result = httpMethod.getResponseBodyAsString(); LOG.info(STR+result); if(statusCode == HttpStatus.SC_CREATED) { JSONObject accessObj = JSONObject.fromObject(result); JSONObject tokenObj = accessObj.getJSONObject("token"); Header header = httpMethod.getResponseHeader(STR); setAccessSession(header.getValue()); setRoaRand(tokenObj.getString(STR)); statusCode = HttpStatus.SC_OK; } else { LOG.error(STR + statusCode + STR + result); } } catch(JSONException e) { LOG.error(STR, e); } catch(VnfmException e) { LOG.error(STR, e); } catch(IOException e) { LOG.error(STR, e); } finally { clearCSMPwd(info); if(httpMethod != null) { httpMethod.releaseConnection(); } } return statusCode; } | /**
* Make connection
* <br>
*
* @param vnfmObj
* @return
* @since NFVO 0.5
*/ | Make connection | connect | {
"repo_name": "open-o/nfvo",
"path": "drivers/vnfm/svnfm/huawei/vnfmadapter/VnfmadapterService/service/src/main/java/org/openo/nfvo/vnfmadapter/service/csm/connect/ConnectMgrVnfm.java",
"license": "apache-2.0",
"size": 6075
} | [
"java.io.IOException",
"net.sf.json.JSONException",
"net.sf.json.JSONObject",
"org.apache.commons.httpclient.Header",
"org.apache.commons.httpclient.HttpMethod",
"org.apache.commons.httpclient.HttpStatus",
"org.openo.nfvo.vnfmadapter.common.VnfmException",
"org.openo.nfvo.vnfmadapter.service.constant.Constant",
"org.openo.nfvo.vnfmadapter.service.constant.ParamConstants",
"org.openo.nfvo.vnfmadapter.service.csm.api.ConnectInfo"
] | import java.io.IOException; import net.sf.json.JSONException; import net.sf.json.JSONObject; import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpMethod; import org.apache.commons.httpclient.HttpStatus; import org.openo.nfvo.vnfmadapter.common.VnfmException; import org.openo.nfvo.vnfmadapter.service.constant.Constant; import org.openo.nfvo.vnfmadapter.service.constant.ParamConstants; import org.openo.nfvo.vnfmadapter.service.csm.api.ConnectInfo; | import java.io.*; import net.sf.json.*; import org.apache.commons.httpclient.*; import org.openo.nfvo.vnfmadapter.common.*; import org.openo.nfvo.vnfmadapter.service.constant.*; import org.openo.nfvo.vnfmadapter.service.csm.api.*; | [
"java.io",
"net.sf.json",
"org.apache.commons",
"org.openo.nfvo"
] | java.io; net.sf.json; org.apache.commons; org.openo.nfvo; | 2,050,590 |
public static <T> SimpleTemplate<T> template(Class<? extends T> cl, Template template, List<?> args) {
return simpleTemplate(cl, template, args);
} | static <T> SimpleTemplate<T> function(Class<? extends T> cl, Template template, List<?> args) { return simpleTemplate(cl, template, args); } | /**
* Create a new Template expression
*
* @param cl type of expression
* @param template template
* @param args template parameters
* @return template expression
*/ | Create a new Template expression | template | {
"repo_name": "johnktims/querydsl",
"path": "querydsl-core/src/main/java/com/querydsl/core/types/dsl/Expressions.java",
"license": "apache-2.0",
"size": 74346
} | [
"com.querydsl.core.types.Template",
"java.util.List"
] | import com.querydsl.core.types.Template; import java.util.List; | import com.querydsl.core.types.*; import java.util.*; | [
"com.querydsl.core",
"java.util"
] | com.querydsl.core; java.util; | 164,301 |
public static void init(ServerConf serverConf) {
TransformFunctionFactory.init(
ArrayUtils.addAll(TransformUtils.getBuiltInTransform(), serverConf.getTransformFunctions()));
} | static void function(ServerConf serverConf) { TransformFunctionFactory.init( ArrayUtils.addAll(TransformUtils.getBuiltInTransform(), serverConf.getTransformFunctions())); } | /**
* This method initializes the transform factory containing built-in functions
* as well as functions specified in the server configuration.
*
* @param serverConf Server configuration
*/ | This method initializes the transform factory containing built-in functions as well as functions specified in the server configuration | init | {
"repo_name": "sajavadi/pinot",
"path": "pinot-server/src/main/java/com/linkedin/pinot/server/starter/ServerBuilder.java",
"license": "apache-2.0",
"size": 7171
} | [
"com.linkedin.pinot.core.operator.transform.TransformUtils",
"com.linkedin.pinot.core.operator.transform.function.TransformFunctionFactory",
"com.linkedin.pinot.server.conf.ServerConf",
"org.apache.commons.lang3.ArrayUtils"
] | import com.linkedin.pinot.core.operator.transform.TransformUtils; import com.linkedin.pinot.core.operator.transform.function.TransformFunctionFactory; import com.linkedin.pinot.server.conf.ServerConf; import org.apache.commons.lang3.ArrayUtils; | import com.linkedin.pinot.core.operator.transform.*; import com.linkedin.pinot.core.operator.transform.function.*; import com.linkedin.pinot.server.conf.*; import org.apache.commons.lang3.*; | [
"com.linkedin.pinot",
"org.apache.commons"
] | com.linkedin.pinot; org.apache.commons; | 1,150,927 |
@Override
public NugetPackage parse(InputStream stream) throws NuspecParseException {
try {
final DocumentBuilder db = XmlUtils.buildSecureDocumentBuilder();
final Document d = db.parse(stream);
final XPath xpath = XPathFactory.newInstance().newXPath();
final NugetPackage nuspec = new NugetPackage();
if (xpath.evaluate("/package/metadata/id", d, XPathConstants.NODE) == null
|| xpath.evaluate("/package/metadata/version", d, XPathConstants.NODE) == null
|| xpath.evaluate("/package/metadata/authors", d, XPathConstants.NODE) == null
|| xpath.evaluate("/package/metadata/description", d, XPathConstants.NODE) == null) {
throw new NuspecParseException("Invalid Nuspec format");
}
nuspec.setId(xpath.evaluate("/package/metadata/id", d));
nuspec.setVersion(xpath.evaluate("/package/metadata/version", d));
nuspec.setAuthors(xpath.evaluate("/package/metadata/authors", d));
nuspec.setOwners(getOrNull((Node) xpath.evaluate("/package/metadata/owners", d, XPathConstants.NODE)));
nuspec.setLicenseUrl(getOrNull((Node) xpath.evaluate("/package/metadata/licenseUrl", d, XPathConstants.NODE)));
nuspec.setTitle(getOrNull((Node) xpath.evaluate("/package/metadata/title", d, XPathConstants.NODE)));
nuspec.setDescription(xpath.evaluate("/package/metadata/description", d));
return nuspec;
} catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException | NuspecParseException e) {
throw new NuspecParseException("Unable to parse nuspec", e);
}
} | NugetPackage function(InputStream stream) throws NuspecParseException { try { final DocumentBuilder db = XmlUtils.buildSecureDocumentBuilder(); final Document d = db.parse(stream); final XPath xpath = XPathFactory.newInstance().newXPath(); final NugetPackage nuspec = new NugetPackage(); if (xpath.evaluate(STR, d, XPathConstants.NODE) == null xpath.evaluate(STR, d, XPathConstants.NODE) == null xpath.evaluate(STR, d, XPathConstants.NODE) == null xpath.evaluate(STR, d, XPathConstants.NODE) == null) { throw new NuspecParseException(STR); } nuspec.setId(xpath.evaluate(STR, d)); nuspec.setVersion(xpath.evaluate(STR, d)); nuspec.setAuthors(xpath.evaluate(STR, d)); nuspec.setOwners(getOrNull((Node) xpath.evaluate(STR, d, XPathConstants.NODE))); nuspec.setLicenseUrl(getOrNull((Node) xpath.evaluate(STR, d, XPathConstants.NODE))); nuspec.setTitle(getOrNull((Node) xpath.evaluate(STR, d, XPathConstants.NODE))); nuspec.setDescription(xpath.evaluate(STR, d)); return nuspec; } catch (ParserConfigurationException SAXException IOException XPathExpressionException NuspecParseException e) { throw new NuspecParseException(STR, e); } } | /**
* Parse an input stream and return the resulting {@link NugetPackage}.
*
* @param stream the input stream to parse
* @return the populated bean
* @throws NuspecParseException when an exception occurs
*/ | Parse an input stream and return the resulting <code>NugetPackage</code> | parse | {
"repo_name": "jeremylong/DependencyCheck",
"path": "core/src/main/java/org/owasp/dependencycheck/data/nuget/XPathNuspecParser.java",
"license": "apache-2.0",
"size": 3725
} | [
"java.io.IOException",
"java.io.InputStream",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.ParserConfigurationException",
"javax.xml.xpath.XPath",
"javax.xml.xpath.XPathConstants",
"javax.xml.xpath.XPathExpressionException",
"javax.xml.xpath.XPathFactory",
"org.owasp.dependencycheck.utils.XmlUtils",
"org.w3c.dom.Document",
"org.w3c.dom.Node",
"org.xml.sax.SAXException"
] | import java.io.IOException; import java.io.InputStream; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.ParserConfigurationException; import javax.xml.xpath.XPath; import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathExpressionException; import javax.xml.xpath.XPathFactory; import org.owasp.dependencycheck.utils.XmlUtils; import org.w3c.dom.Document; import org.w3c.dom.Node; import org.xml.sax.SAXException; | import java.io.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.owasp.dependencycheck.utils.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"java.io",
"javax.xml",
"org.owasp.dependencycheck",
"org.w3c.dom",
"org.xml.sax"
] | java.io; javax.xml; org.owasp.dependencycheck; org.w3c.dom; org.xml.sax; | 86,023 |
@SuppressWarnings("deprecation")
public static Time valueOf(LocalTime time) {
return new Time(time.getHour(), time.getMinute(), time.getSecond());
} | @SuppressWarnings(STR) static Time function(LocalTime time) { return new Time(time.getHour(), time.getMinute(), time.getSecond()); } | /**
* Obtains an instance of {@code Time} from a {@link LocalTime} object
* with the same hour, minute and second time value as the given
* {@code LocalTime}.
*
* @param time a {@code LocalTime} to convert
* @return a {@code Time} object
* @exception NullPointerException if {@code time} is null
* @since 1.8
*/ | Obtains an instance of Time from a <code>LocalTime</code> object with the same hour, minute and second time value as the given LocalTime | valueOf | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/java/sql/Time.java",
"license": "mit",
"size": 9428
} | [
"java.time.LocalTime"
] | import java.time.LocalTime; | import java.time.*; | [
"java.time"
] | java.time; | 1,733,611 |
@Test
void wrapFileLinksExpandFile() throws IOException {
when(layoutFormatterPreferences.getFileLinkPreferences()).thenReturn(
new FileLinkPreferences(Collections.emptyList(), Collections.singletonList("src/test/resources/pdfs/")));
BibEntry entry = new BibEntry(StandardEntryType.Article);
entry.addFile(new LinkedFile("Test file", "encrypted.pdf", "PDF"));
String layoutText = layout("\\begin{file}\\format[WrapFileLinks(\\i. \\d (\\p))]{\\file}\\end{file}", entry);
assertEquals(
"1. Test file (" + new File("src/test/resources/pdfs/encrypted.pdf").getCanonicalPath() + ")",
layoutText);
} | void wrapFileLinksExpandFile() throws IOException { when(layoutFormatterPreferences.getFileLinkPreferences()).thenReturn( new FileLinkPreferences(Collections.emptyList(), Collections.singletonList(STR))); BibEntry entry = new BibEntry(StandardEntryType.Article); entry.addFile(new LinkedFile(STR, STR, "PDF")); String layoutText = layout(STR, entry); assertEquals( STR + new File(STR).getCanonicalPath() + ")", layoutText); } | /**
* Test for http://discourse.jabref.org/t/the-wrapfilelinks-formatter/172 (the example in the help files)
*/ | Test for HREF (the example in the help files) | wrapFileLinksExpandFile | {
"repo_name": "zellerdev/jabref",
"path": "src/test/java/org/jabref/logic/layout/LayoutTest.java",
"license": "mit",
"size": 6438
} | [
"java.io.File",
"java.io.IOException",
"java.util.Collections",
"org.jabref.logic.layout.format.FileLinkPreferences",
"org.jabref.model.entry.BibEntry",
"org.jabref.model.entry.LinkedFile",
"org.jabref.model.entry.types.StandardEntryType",
"org.junit.jupiter.api.Assertions",
"org.mockito.Mockito"
] | import java.io.File; import java.io.IOException; import java.util.Collections; import org.jabref.logic.layout.format.FileLinkPreferences; import org.jabref.model.entry.BibEntry; import org.jabref.model.entry.LinkedFile; import org.jabref.model.entry.types.StandardEntryType; import org.junit.jupiter.api.Assertions; import org.mockito.Mockito; | import java.io.*; import java.util.*; import org.jabref.logic.layout.format.*; import org.jabref.model.entry.*; import org.jabref.model.entry.types.*; import org.junit.jupiter.api.*; import org.mockito.*; | [
"java.io",
"java.util",
"org.jabref.logic",
"org.jabref.model",
"org.junit.jupiter",
"org.mockito"
] | java.io; java.util; org.jabref.logic; org.jabref.model; org.junit.jupiter; org.mockito; | 2,828,979 |
public void setIntactOrganisms(String taxonIds) {
this.taxonIds = new HashSet<String>(Arrays.asList(StringUtil.split(taxonIds, " ")));
}
class PsiHandler extends DefaultHandler
{
private Map<String, ExperimentHolder> experimentIds
= new HashMap<String, ExperimentHolder>();
// current interaction being processed
private InteractionHolder holder = null;
// current experiment being processed
private ExperimentHolder experimentHolder = null;
// current gene being processed
private InteractorHolder interactorHolder = null;
private Item comment = null;
private String experimentId = null, interactorId = null;
private String regionName = null;
private Stack<String> stack = new Stack<String>();
private String attName = null;
private StringBuffer attValue = null;
// intactId to temporary holding object
private Map<String, InteractorHolder> intactIdToHolder
= new HashMap<String, InteractorHolder>();
// per gene - list of identifiers
private Map<String, Set<String>> geneIdentifiers = new HashMap<String, Set<String>>();
/**
* {@inheritDoc} | void function(String taxonIds) { this.taxonIds = new HashSet<String>(Arrays.asList(StringUtil.split(taxonIds, " "))); } class PsiHandler extends DefaultHandler { private Map<String, ExperimentHolder> experimentIds = new HashMap<String, ExperimentHolder>(); private InteractionHolder holder = null; private ExperimentHolder experimentHolder = null; private InteractorHolder interactorHolder = null; private Item comment = null; private String experimentId = null, interactorId = null; private String regionName = null; private Stack<String> stack = new Stack<String>(); private String attName = null; private StringBuffer attValue = null; private Map<String, InteractorHolder> intactIdToHolder = new HashMap<String, InteractorHolder>(); private Map<String, Set<String>> geneIdentifiers = new HashMap<String, Set<String>>(); /** * {@inheritDoc} | /**
* Sets the list of taxonIds that should be imported if using split input files.
*
* @param taxonIds a space-separated list of taxonIds
*/ | Sets the list of taxonIds that should be imported if using split input files | setIntactOrganisms | {
"repo_name": "drhee/toxoMine",
"path": "bio/sources/psi/main/src/org/intermine/bio/dataconversion/PsiConverter.java",
"license": "lgpl-2.1",
"size": 47642
} | [
"java.util.Arrays",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.Stack",
"org.intermine.util.StringUtil",
"org.intermine.xml.full.Item",
"org.xml.sax.helpers.DefaultHandler"
] | import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.Stack; import org.intermine.util.StringUtil; import org.intermine.xml.full.Item; import org.xml.sax.helpers.DefaultHandler; | import java.util.*; import org.intermine.util.*; import org.intermine.xml.full.*; import org.xml.sax.helpers.*; | [
"java.util",
"org.intermine.util",
"org.intermine.xml",
"org.xml.sax"
] | java.util; org.intermine.util; org.intermine.xml; org.xml.sax; | 277,752 |
@CanIgnoreReturnValue
public Builder<K, V> put(K key, V value) {
checkEntryNotNull(key, value);
builderMultimap.put(key, value);
return this;
} | Builder<K, V> function(K key, V value) { checkEntryNotNull(key, value); builderMultimap.put(key, value); return this; } | /**
* Adds a key-value mapping to the built multimap.
*/ | Adds a key-value mapping to the built multimap | put | {
"repo_name": "DavesMan/guava",
"path": "guava/src/com/google/common/collect/ImmutableMultimap.java",
"license": "apache-2.0",
"size": 22902
} | [
"com.google.common.collect.CollectPreconditions"
] | import com.google.common.collect.CollectPreconditions; | import com.google.common.collect.*; | [
"com.google.common"
] | com.google.common; | 1,668,799 |
public void addChild(XslNode node)
throws XslParseException
{
throw error(L.l("element <{0}> is not allowed in <{1}>.",
node.getTagName(), getTagName()));
} | void function(XslNode node) throws XslParseException { throw error(L.l(STR, node.getTagName(), getTagName())); } | /**
* Adds a child.
*/ | Adds a child | addChild | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/xsl/java/XslValueOf.java",
"license": "gpl-2.0",
"size": 3190
} | [
"com.caucho.xsl.XslParseException"
] | import com.caucho.xsl.XslParseException; | import com.caucho.xsl.*; | [
"com.caucho.xsl"
] | com.caucho.xsl; | 1,716,722 |
synchronized public void addDTM(DTM dtm, int id, int offset)
{
if(id>=IDENT_MAX_DTMS)
{
// TODO: %REVIEW% Not really the right error message.
throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!");
}
// We used to just allocate the array size to IDENT_MAX_DTMS.
// But we expect to increase that to 16 bits, and I'm not willing
// to allocate that much space unless needed. We could use one of our
// handy-dandy Fast*Vectors, but this will do for now.
// %REVIEW%
int oldlen=m_dtms.length;
if(oldlen<=id)
{
// Various growth strategies are possible. I think we don't want
// to over-allocate excessively, and I'm willing to reallocate
// more often to get that. See also Fast*Vector classes.
//
// %REVIEW% Should throw a more diagnostic error if we go over the max...
int newlen=Math.min((id+256),IDENT_MAX_DTMS);
DTM new_m_dtms[] = new DTM[newlen];
System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen);
m_dtms=new_m_dtms;
int new_m_dtm_offsets[] = new int[newlen];
System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen);
m_dtm_offsets=new_m_dtm_offsets;
}
m_dtms[id] = dtm;
m_dtm_offsets[id]=offset;
dtm.documentRegistration();
// The DTM should have been told who its manager was when we created it.
// Do we need to allow for adopting DTMs _not_ created by this manager?
} | synchronized void function(DTM dtm, int id, int offset) { if(id>=IDENT_MAX_DTMS) { throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); } int oldlen=m_dtms.length; if(oldlen<=id) { int newlen=Math.min((id+256),IDENT_MAX_DTMS); DTM new_m_dtms[] = new DTM[newlen]; System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen); m_dtms=new_m_dtms; int new_m_dtm_offsets[] = new int[newlen]; System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen); m_dtm_offsets=new_m_dtm_offsets; } m_dtms[id] = dtm; m_dtm_offsets[id]=offset; dtm.documentRegistration(); } | /**
* Add a DTM to the DTM table.
*
* @param dtm Should be a valid reference to a DTM.
* @param id Integer DTM ID to be bound to this DTM.
* @param offset Integer addressing offset. The internal DTM Node ID is
* obtained by adding this offset to the node-number field of the
* public DTM Handle. For the first DTM ID accessing each DTM, this is 0;
* for overflow addressing it will be a multiple of 1<<IDENT_DTM_NODE_BITS.
*/ | Add a DTM to the DTM table | addDTM | {
"repo_name": "wangsongpeng/jdk-src",
"path": "src/main/java/com/sun/org/apache/xml/internal/dtm/ref/DTMManagerDefault.java",
"license": "apache-2.0",
"size": 32131
} | [
"com.sun.org.apache.xml.internal.dtm.DTMException",
"com.sun.org.apache.xml.internal.res.XMLErrorResources",
"com.sun.org.apache.xml.internal.res.XMLMessages"
] | import com.sun.org.apache.xml.internal.dtm.DTMException; import com.sun.org.apache.xml.internal.res.XMLErrorResources; import com.sun.org.apache.xml.internal.res.XMLMessages; | import com.sun.org.apache.xml.internal.dtm.*; import com.sun.org.apache.xml.internal.res.*; | [
"com.sun.org"
] | com.sun.org; | 256,027 |
@Deprecated
public static InetSocketAddress createSocketAddr(String target
) throws IOException {
return NetUtils.createSocketAddr(target);
}
public DatanodeProtocol namenode = null;
public FSDatasetInterface data = null;
public DatanodeRegistration dnRegistration = null;
volatile boolean shouldRun = true;
private LinkedList<Block> receivedBlockList = new LinkedList<Block>();
private final Map<Block, Block> ongoingRecovery = new HashMap<Block, Block>();
private LinkedList<String> delHints = new LinkedList<String>();
public final static String EMPTY_DEL_HINT = "";
AtomicInteger xmitsInProgress = new AtomicInteger();
Daemon dataXceiverServer = null;
ThreadGroup threadGroup = null;
long blockReportInterval;
//disallow the sending of BR before instructed to do so
long lastBlockReport = 0;
boolean resetBlockReportTime = true;
long initialBlockReportDelay = BLOCKREPORT_INITIAL_DELAY * 1000L;
long lastHeartbeat = 0;
long heartBeatInterval;
private DataStorage storage = null;
private HttpServer infoServer = null;
DataNodeMetrics myMetrics;
private static InetSocketAddress nameNodeAddr;
private InetSocketAddress selfAddr;
private static DataNode datanodeObject = null;
private Thread dataNodeThread = null;
String machineName;
private static String dnThreadName;
int socketTimeout;
int socketWriteTimeout = 0;
boolean transferToAllowed = true;
int writePacketSize = 0;
public DataBlockScanner blockScanner = null;
public Daemon blockScannerThread = null;
private static final Random R = new Random();
// For InterDataNodeProtocol
public Server ipcServer; | static InetSocketAddress function(String target ) throws IOException { return NetUtils.createSocketAddr(target); } public DatanodeProtocol namenode = null; public FSDatasetInterface data = null; public DatanodeRegistration dnRegistration = null; volatile boolean shouldRun = true; private LinkedList<Block> receivedBlockList = new LinkedList<Block>(); private final Map<Block, Block> ongoingRecovery = new HashMap<Block, Block>(); private LinkedList<String> delHints = new LinkedList<String>(); public final static String EMPTY_DEL_HINT = ""; AtomicInteger xmitsInProgress = new AtomicInteger(); Daemon dataXceiverServer = null; ThreadGroup threadGroup = null; long blockReportInterval; long lastBlockReport = 0; boolean resetBlockReportTime = true; long initialBlockReportDelay = BLOCKREPORT_INITIAL_DELAY * 1000L; long lastHeartbeat = 0; long heartBeatInterval; private DataStorage storage = null; private HttpServer infoServer = null; DataNodeMetrics myMetrics; private static InetSocketAddress nameNodeAddr; private InetSocketAddress selfAddr; private static DataNode datanodeObject = null; private Thread dataNodeThread = null; String machineName; private static String dnThreadName; int socketTimeout; int socketWriteTimeout = 0; boolean transferToAllowed = true; int writePacketSize = 0; public DataBlockScanner blockScanner = null; public Daemon blockScannerThread = null; private static final Random R = new Random(); public Server ipcServer; | /**
* Use {@link NetUtils#createSocketAddr(String)} instead.
*/ | Use <code>NetUtils#createSocketAddr(String)</code> instead | createSocketAddr | {
"repo_name": "zyguan/HDFS-503-on-0.20.2",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataNode.java",
"license": "apache-2.0",
"size": 59581
} | [
"java.io.IOException",
"java.net.InetSocketAddress",
"java.util.HashMap",
"java.util.LinkedList",
"java.util.Map",
"java.util.Random",
"java.util.concurrent.atomic.AtomicInteger",
"org.apache.hadoop.hdfs.protocol.Block",
"org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics",
"org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol",
"org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration",
"org.apache.hadoop.http.HttpServer",
"org.apache.hadoop.ipc.Server",
"org.apache.hadoop.net.NetUtils",
"org.apache.hadoop.util.Daemon"
] | import java.io.IOException; import java.net.InetSocketAddress; import java.util.HashMap; import java.util.LinkedList; import java.util.Map; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; import org.apache.hadoop.hdfs.protocol.Block; import org.apache.hadoop.hdfs.server.datanode.metrics.DataNodeMetrics; import org.apache.hadoop.hdfs.server.protocol.DatanodeProtocol; import org.apache.hadoop.hdfs.server.protocol.DatanodeRegistration; import org.apache.hadoop.http.HttpServer; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.util.Daemon; | import java.io.*; import java.net.*; import java.util.*; import java.util.concurrent.atomic.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.hdfs.server.datanode.metrics.*; import org.apache.hadoop.hdfs.server.protocol.*; import org.apache.hadoop.http.*; import org.apache.hadoop.ipc.*; import org.apache.hadoop.net.*; import org.apache.hadoop.util.*; | [
"java.io",
"java.net",
"java.util",
"org.apache.hadoop"
] | java.io; java.net; java.util; org.apache.hadoop; | 2,799,634 |
public void drawOutline(Graphics2D g2, CategoryPlot plot,
Rectangle2D dataArea) {
float x0 = (float) dataArea.getX();
float x1 = x0 + (float) Math.abs(this.xOffset);
float x3 = (float) dataArea.getMaxX();
float x2 = x3 - (float) Math.abs(this.xOffset);
float y0 = (float) dataArea.getMaxY();
float y1 = y0 - (float) Math.abs(this.yOffset);
float y3 = (float) dataArea.getMinY();
float y2 = y3 + (float) Math.abs(this.yOffset);
GeneralPath clip = new GeneralPath();
clip.moveTo(x0, y0);
clip.lineTo(x0, y2);
clip.lineTo(x1, y3);
clip.lineTo(x3, y3);
clip.lineTo(x3, y1);
clip.lineTo(x2, y0);
clip.closePath();
// put an outline around the data area...
Stroke outlineStroke = plot.getOutlineStroke();
Paint outlinePaint = plot.getOutlinePaint();
if ((outlineStroke != null) && (outlinePaint != null)) {
g2.setStroke(outlineStroke);
g2.setPaint(outlinePaint);
g2.draw(clip);
}
} | void function(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea) { float x0 = (float) dataArea.getX(); float x1 = x0 + (float) Math.abs(this.xOffset); float x3 = (float) dataArea.getMaxX(); float x2 = x3 - (float) Math.abs(this.xOffset); float y0 = (float) dataArea.getMaxY(); float y1 = y0 - (float) Math.abs(this.yOffset); float y3 = (float) dataArea.getMinY(); float y2 = y3 + (float) Math.abs(this.yOffset); GeneralPath clip = new GeneralPath(); clip.moveTo(x0, y0); clip.lineTo(x0, y2); clip.lineTo(x1, y3); clip.lineTo(x3, y3); clip.lineTo(x3, y1); clip.lineTo(x2, y0); clip.closePath(); Stroke outlineStroke = plot.getOutlineStroke(); Paint outlinePaint = plot.getOutlinePaint(); if ((outlineStroke != null) && (outlinePaint != null)) { g2.setStroke(outlineStroke); g2.setPaint(outlinePaint); g2.draw(clip); } } | /**
* Draws the outline for the plot.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param dataArea the area inside the axes.
*/ | Draws the outline for the plot | drawOutline | {
"repo_name": "opensim-org/opensim-gui",
"path": "Gui/opensim/jfreechart/src/org/jfree/chart/renderer/category/BarRenderer3D.java",
"license": "apache-2.0",
"size": 28796
} | [
"java.awt.Graphics2D",
"java.awt.Paint",
"java.awt.Stroke",
"java.awt.geom.GeneralPath",
"java.awt.geom.Rectangle2D",
"org.jfree.chart.plot.CategoryPlot"
] | import java.awt.Graphics2D; import java.awt.Paint; import java.awt.Stroke; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; import org.jfree.chart.plot.CategoryPlot; | import java.awt.*; import java.awt.geom.*; import org.jfree.chart.plot.*; | [
"java.awt",
"org.jfree.chart"
] | java.awt; org.jfree.chart; | 690,532 |
@Override
public boolean updateUserModel(String username, UserModel model) {
UserModel originalUser = null;
try {
read();
originalUser = users.remove(username.toLowerCase());
users.put(model.username.toLowerCase(), model);
// null check on "final" teams because JSON-sourced UserModel
// can have a null teams object
if (model.teams != null) {
for (TeamModel team : model.teams) {
TeamModel t = teams.get(team.name.toLowerCase());
if (t == null) {
// new team
team.addUser(username);
teams.put(team.name.toLowerCase(), team);
} else {
// do not clobber existing team definition
// maybe because this is a federated user
t.removeUser(username);
t.addUser(model.username);
}
}
// check for implicit team removal
if (originalUser != null) {
for (TeamModel team : originalUser.teams) {
if (!model.isTeamMember(team.name)) {
team.removeUser(username);
}
}
}
}
write();
return true;
} catch (Throwable t) {
if (originalUser != null) {
// restore original user
users.put(originalUser.username.toLowerCase(), originalUser);
} else {
// drop attempted add
users.remove(model.username.toLowerCase());
}
logger.error(MessageFormat.format("Failed to update user model {0}!", model.username),
t);
}
return false;
}
| boolean function(String username, UserModel model) { UserModel originalUser = null; try { read(); originalUser = users.remove(username.toLowerCase()); users.put(model.username.toLowerCase(), model); if (model.teams != null) { for (TeamModel team : model.teams) { TeamModel t = teams.get(team.name.toLowerCase()); if (t == null) { team.addUser(username); teams.put(team.name.toLowerCase(), team); } else { t.removeUser(username); t.addUser(model.username); } } if (originalUser != null) { for (TeamModel team : originalUser.teams) { if (!model.isTeamMember(team.name)) { team.removeUser(username); } } } } write(); return true; } catch (Throwable t) { if (originalUser != null) { users.put(originalUser.username.toLowerCase(), originalUser); } else { users.remove(model.username.toLowerCase()); } logger.error(MessageFormat.format(STR, model.username), t); } return false; } | /**
* Updates/writes and replaces a complete user object keyed by username.
* This method allows for renaming a user.
*
* @param username
* the old username
* @param model
* the user object to use for username
* @return true if update is successful
*/ | Updates/writes and replaces a complete user object keyed by username. This method allows for renaming a user | updateUserModel | {
"repo_name": "pdinc-oss/gitblit",
"path": "src/com/gitblit/ConfigUserService.java",
"license": "apache-2.0",
"size": 25525
} | [
"com.gitblit.models.TeamModel",
"com.gitblit.models.UserModel",
"java.text.MessageFormat"
] | import com.gitblit.models.TeamModel; import com.gitblit.models.UserModel; import java.text.MessageFormat; | import com.gitblit.models.*; import java.text.*; | [
"com.gitblit.models",
"java.text"
] | com.gitblit.models; java.text; | 1,675,326 |
@Deprecated
static public InputStream open(String fileName, ExecType execType, DataStorage storage) throws IOException {
fileName = checkDefaultPrefix(execType, fileName);
if (!fileName.startsWith(LOCAL_PREFIX)) {
ElementDescriptor elem = storage.asElement(fullPath(fileName, storage));
return openDFSFile(elem);
}
else {
fileName = fileName.substring(LOCAL_PREFIX.length());
ElementDescriptor elem = storage.asElement(fullPath(fileName, storage));
return openLFSFile(elem);
}
} | static InputStream function(String fileName, ExecType execType, DataStorage storage) throws IOException { fileName = checkDefaultPrefix(execType, fileName); if (!fileName.startsWith(LOCAL_PREFIX)) { ElementDescriptor elem = storage.asElement(fullPath(fileName, storage)); return openDFSFile(elem); } else { fileName = fileName.substring(LOCAL_PREFIX.length()); ElementDescriptor elem = storage.asElement(fullPath(fileName, storage)); return openLFSFile(elem); } } | /**
* This function returns an input stream to a local file system file or
* a file residing on Hadoop's DFS
* @param fileName The filename to open
* @param execType execType indicating whether executing in local mode or MapReduce mode (Hadoop)
* @param storage The DataStorage object used to open the fileSpec
* @return InputStream to the fileSpec
* @throws IOException
* @deprecated Use {@link #open(String, PigContext)} instead
*/ | This function returns an input stream to a local file system file or a file residing on Hadoop's DFS | open | {
"repo_name": "simplegeo/hadoop-pig",
"path": "src/org/apache/pig/impl/io/FileLocalizer.java",
"license": "apache-2.0",
"size": 28028
} | [
"java.io.IOException",
"java.io.InputStream",
"org.apache.pig.ExecType",
"org.apache.pig.backend.datastorage.DataStorage",
"org.apache.pig.backend.datastorage.ElementDescriptor"
] | import java.io.IOException; import java.io.InputStream; import org.apache.pig.ExecType; import org.apache.pig.backend.datastorage.DataStorage; import org.apache.pig.backend.datastorage.ElementDescriptor; | import java.io.*; import org.apache.pig.*; import org.apache.pig.backend.datastorage.*; | [
"java.io",
"org.apache.pig"
] | java.io; org.apache.pig; | 1,883,188 |
if (!mLockedBlockIds.containsKey(blockId)) {
StorageDir storageDir = mWorkerStorage.lockBlock(blockId, mUserId);
if (storageDir != null) {
Set<Integer> lockIdSet = new HashSet<Integer>();
lockIdSet.add(blockLockId);
mLockedBlockIds.put(blockId, lockIdSet);
mLockedBlockIdToStorageDir.put(blockId, storageDir);
return storageDir;
}
return null;
} else {
mLockedBlockIds.get(blockId).add(blockLockId);
return mLockedBlockIdToStorageDir.get(blockId);
}
} | if (!mLockedBlockIds.containsKey(blockId)) { StorageDir storageDir = mWorkerStorage.lockBlock(blockId, mUserId); if (storageDir != null) { Set<Integer> lockIdSet = new HashSet<Integer>(); lockIdSet.add(blockLockId); mLockedBlockIds.put(blockId, lockIdSet); mLockedBlockIdToStorageDir.put(blockId, storageDir); return storageDir; } return null; } else { mLockedBlockIds.get(blockId).add(blockLockId); return mLockedBlockIdToStorageDir.get(blockId); } } | /**
* Lock a block with specified lock id.
*
* @param blockId The id of the block.
* @param blockLockId The lock id of the block
* @return the StorageDir in which this block is locked.
*/ | Lock a block with specified lock id | lock | {
"repo_name": "carsonwang/tachyon",
"path": "core/src/main/java/tachyon/worker/BlocksLocker.java",
"license": "apache-2.0",
"size": 3547
} | [
"java.util.HashSet",
"java.util.Set"
] | import java.util.HashSet; import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 2,465,160 |
final synchronized void _sendCommand(byte cmd) throws IOException
{
_output_.write(TelnetCommand.IAC);
_output_.write(cmd);
_output_.flush();
} | final synchronized void _sendCommand(byte cmd) throws IOException { _output_.write(TelnetCommand.IAC); _output_.write(cmd); _output_.flush(); } | /**
* Sends a command, automatically adds IAC prefix and flushes the output.
*
* @param cmd - command data to be sent
* @throws IOException - Exception in I/O.
* @since 3.0
*/ | Sends a command, automatically adds IAC prefix and flushes the output | _sendCommand | {
"repo_name": "grtlinux/KIEA_JAVA7",
"path": "KIEA_JAVA7/src/tain/kr/com/commons/net/v01/telnet/Telnet.java",
"license": "gpl-3.0",
"size": 33948
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,378,425 |
public static TableDataListOption startIndex(long index) {
checkArgument(index >= 0);
return new TableDataListOption(BigQueryRpc.Option.START_INDEX, index);
}
}
class JobListOption extends Option {
private static final long serialVersionUID = -8207122131226481423L;
private JobListOption(BigQueryRpc.Option option, Object value) {
super(option, value);
} | static TableDataListOption function(long index) { checkArgument(index >= 0); return new TableDataListOption(BigQueryRpc.Option.START_INDEX, index); } } class JobListOption extends Option { private static final long serialVersionUID = -8207122131226481423L; private JobListOption(BigQueryRpc.Option option, Object value) { super(option, value); } | /**
* Returns an option that sets the zero-based index of the row from which to start listing table
* data.
*/ | Returns an option that sets the zero-based index of the row from which to start listing table data | startIndex | {
"repo_name": "googleapis/java-bigquery",
"path": "google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQuery.java",
"license": "apache-2.0",
"size": 55895
} | [
"com.google.cloud.bigquery.spi.v2.BigQueryRpc",
"com.google.common.base.Preconditions"
] | import com.google.cloud.bigquery.spi.v2.BigQueryRpc; import com.google.common.base.Preconditions; | import com.google.cloud.bigquery.spi.v2.*; import com.google.common.base.*; | [
"com.google.cloud",
"com.google.common"
] | com.google.cloud; com.google.common; | 2,755,374 |
void quickRecycleScrapView(View view) {
final ViewHolder holder = getChildViewHolderInt(view);
holder.mScrapContainer = null;
holder.clearReturnedFromScrapFlag();
recycleViewHolderInternal(holder);
} | void quickRecycleScrapView(View view) { final ViewHolder holder = getChildViewHolderInt(view); holder.mScrapContainer = null; holder.clearReturnedFromScrapFlag(); recycleViewHolderInternal(holder); } | /**
* Used as a fast path for unscrapping and recycling a view during a bulk operation.
* The caller must call {@link #clearScrap()} when it's done to update the recycler's
* internal bookkeeping.
*/ | Used as a fast path for unscrapping and recycling a view during a bulk operation. The caller must call <code>#clearScrap()</code> when it's done to update the recycler's internal bookkeeping | quickRecycleScrapView | {
"repo_name": "devDavide/Decisiongram",
"path": "TMessagesProj/src/main/java/org/telegram/messenger/support/widget/RecyclerView.java",
"license": "gpl-2.0",
"size": 438498
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 659,814 |
public void testNoSuchElementException() throws RepositoryException {
NodeIterator it = execute(testPath + "//*", Query.XPATH).getNodes();
while (it.hasNext()) {
it.nextNode();
}
try {
it.nextNode();
fail("nextNode() must throw a NoSuchElementException when no nodes are available");
} catch (NoSuchElementException e) {
// success
}
} | void function() throws RepositoryException { NodeIterator it = execute(testPath + STRnextNode() must throw a NoSuchElementException when no nodes are available"); } catch (NoSuchElementException e) { } } | /**
* Tests if a {@link java.util.NoSuchElementException} is thrown when {@link
* javax.jcr.NodeIterator#nextNode()} is called and there are no more nodes
* available.
*/ | Tests if a <code>java.util.NoSuchElementException</code> is thrown when <code>javax.jcr.NodeIterator#nextNode()</code> is called and there are no more nodes available | testNoSuchElementException | {
"repo_name": "jalkanen/Priha",
"path": "tests/tck/org/apache/jackrabbit/test/api/query/QueryResultNodeIteratorTest.java",
"license": "apache-2.0",
"size": 5574
} | [
"java.util.NoSuchElementException",
"javax.jcr.NodeIterator",
"javax.jcr.RepositoryException"
] | import java.util.NoSuchElementException; import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; | import java.util.*; import javax.jcr.*; | [
"java.util",
"javax.jcr"
] | java.util; javax.jcr; | 620,341 |
public void setMycoplasmaStatus(String
mycoplasmaStatus) {
this.mycoplasmaStatus = mycoplasmaStatus;
}
private Integer passageNumber;
@Column(name = "PASSAGENUMBER", length = EntityWithId.COLUMNLENGTH)
| void function(String mycoplasmaStatus) { this.mycoplasmaStatus = mycoplasmaStatus; } private Integer passageNumber; @Column(name = STR, length = EntityWithId.COLUMNLENGTH) | /**
* Sets the value of mycoplasmaStatus attribute.
* @param mycoplasmaStatus .
**/ | Sets the value of mycoplasmaStatus attribute | setMycoplasmaStatus | {
"repo_name": "NCIP/calims",
"path": "calims2-model/src/java/gov/nih/nci/calims2/domain/inventory/CellSpecimen.java",
"license": "bsd-3-clause",
"size": 8019
} | [
"gov.nih.nci.calims2.domain.interfaces.EntityWithId",
"javax.persistence.Column"
] | import gov.nih.nci.calims2.domain.interfaces.EntityWithId; import javax.persistence.Column; | import gov.nih.nci.calims2.domain.interfaces.*; import javax.persistence.*; | [
"gov.nih.nci",
"javax.persistence"
] | gov.nih.nci; javax.persistence; | 483,706 |
@Override
public void deleteWikiPage(WikiPageKey key) throws SynapseException {
ValidateArgument.required(key, "key");
String uri = createWikiURL(key);
deleteUri(getRepoEndpoint(), uri);
} | void function(WikiPageKey key) throws SynapseException { ValidateArgument.required(key, "key"); String uri = createWikiURL(key); deleteUri(getRepoEndpoint(), uri); } | /**
* Delete a WikiPage
*
* @param key
* @throws SynapseException
*/ | Delete a WikiPage | deleteWikiPage | {
"repo_name": "zimingd/Synapse-Repository-Services",
"path": "client/synapseJavaClient/src/main/java/org/sagebionetworks/client/SynapseClientImpl.java",
"license": "apache-2.0",
"size": 229293
} | [
"org.sagebionetworks.client.exceptions.SynapseException",
"org.sagebionetworks.repo.model.dao.WikiPageKey",
"org.sagebionetworks.util.ValidateArgument"
] | import org.sagebionetworks.client.exceptions.SynapseException; import org.sagebionetworks.repo.model.dao.WikiPageKey; import org.sagebionetworks.util.ValidateArgument; | import org.sagebionetworks.client.exceptions.*; import org.sagebionetworks.repo.model.dao.*; import org.sagebionetworks.util.*; | [
"org.sagebionetworks.client",
"org.sagebionetworks.repo",
"org.sagebionetworks.util"
] | org.sagebionetworks.client; org.sagebionetworks.repo; org.sagebionetworks.util; | 698,380 |
public SharesChangeLeaseHeaders setDateProperty(OffsetDateTime dateProperty) {
if (dateProperty == null) {
this.dateProperty = null;
} else {
this.dateProperty = new DateTimeRfc1123(dateProperty);
}
return this;
} | SharesChangeLeaseHeaders function(OffsetDateTime dateProperty) { if (dateProperty == null) { this.dateProperty = null; } else { this.dateProperty = new DateTimeRfc1123(dateProperty); } return this; } | /**
* Set the dateProperty property: The Date property.
*
* @param dateProperty the dateProperty value to set.
* @return the SharesChangeLeaseHeaders object itself.
*/ | Set the dateProperty property: The Date property | setDateProperty | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/storage/azure-storage-file-share/src/main/java/com/azure/storage/file/share/implementation/models/SharesChangeLeaseHeaders.java",
"license": "mit",
"size": 5783
} | [
"com.azure.core.util.DateTimeRfc1123",
"java.time.OffsetDateTime"
] | import com.azure.core.util.DateTimeRfc1123; import java.time.OffsetDateTime; | import com.azure.core.util.*; import java.time.*; | [
"com.azure.core",
"java.time"
] | com.azure.core; java.time; | 2,187,221 |
private void recalculateChecksum(int errBlkIndex, long blockLength)
throws IOException {
LOG.debug("Recalculate checksum for the missing/failed block index {}",
errBlkIndex);
byte[] errIndices = new byte[1];
errIndices[0] = (byte) errBlkIndex;
StripedReconstructionInfo stripedReconInfo =
new StripedReconstructionInfo(
blockGroup, ecPolicy, blockIndices, datanodes, errIndices);
final StripedBlockChecksumReconstructor checksumRecon =
new StripedBlockChecksumReconstructor(
getDatanode().getErasureCodingWorker(), stripedReconInfo,
md5writer, blockLength);
checksumRecon.reconstruct();
DataChecksum checksum = checksumRecon.getChecksum();
long crcPerBlock = checksum.getChecksumSize() <= 0 ? 0
: checksumRecon.getChecksumDataLen() / checksum.getChecksumSize();
setOrVerifyChecksumProperties(errBlkIndex,
checksum.getBytesPerChecksum(), crcPerBlock,
checksum.getChecksumType());
LOG.debug("Recalculated checksum for the block index:{}, md5={}",
errBlkIndex, checksumRecon.getMD5());
} | void function(int errBlkIndex, long blockLength) throws IOException { LOG.debug(STR, errBlkIndex); byte[] errIndices = new byte[1]; errIndices[0] = (byte) errBlkIndex; StripedReconstructionInfo stripedReconInfo = new StripedReconstructionInfo( blockGroup, ecPolicy, blockIndices, datanodes, errIndices); final StripedBlockChecksumReconstructor checksumRecon = new StripedBlockChecksumReconstructor( getDatanode().getErasureCodingWorker(), stripedReconInfo, md5writer, blockLength); checksumRecon.reconstruct(); DataChecksum checksum = checksumRecon.getChecksum(); long crcPerBlock = checksum.getChecksumSize() <= 0 ? 0 : checksumRecon.getChecksumDataLen() / checksum.getChecksumSize(); setOrVerifyChecksumProperties(errBlkIndex, checksum.getBytesPerChecksum(), crcPerBlock, checksum.getChecksumType()); LOG.debug(STR, errBlkIndex, checksumRecon.getMD5()); } | /**
* Reconstruct this data block and recalculate checksum.
*
* @param errBlkIndex
* error index to be reconstructed and recalculate checksum.
* @param blockLength
* number of bytes in the block to compute checksum.
* @throws IOException
*/ | Reconstruct this data block and recalculate checksum | recalculateChecksum | {
"repo_name": "jaypatil/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockChecksumHelper.java",
"license": "gpl-3.0",
"size": 17655
} | [
"java.io.IOException",
"org.apache.hadoop.hdfs.server.datanode.erasurecode.StripedBlockChecksumReconstructor",
"org.apache.hadoop.hdfs.server.datanode.erasurecode.StripedReconstructionInfo",
"org.apache.hadoop.util.DataChecksum"
] | import java.io.IOException; import org.apache.hadoop.hdfs.server.datanode.erasurecode.StripedBlockChecksumReconstructor; import org.apache.hadoop.hdfs.server.datanode.erasurecode.StripedReconstructionInfo; import org.apache.hadoop.util.DataChecksum; | import java.io.*; import org.apache.hadoop.hdfs.server.datanode.erasurecode.*; import org.apache.hadoop.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,217,648 |
public static <D extends Drawable> D mockDrawable(Class<D> drawableClassToMock) {
D drawable = mock(drawableClassToMock);
when(drawable.mutate()).thenReturn(drawable);
stubGetAndSetBounds(drawable);
stubGetAndSetCallback(drawable);
stubSetVisibilityCallback(drawable);
stubSetAlpha(drawable);
stubGetPaint(drawable);
stubGetBitmap(drawable);
return drawable;
} | static <D extends Drawable> D function(Class<D> drawableClassToMock) { D drawable = mock(drawableClassToMock); when(drawable.mutate()).thenReturn(drawable); stubGetAndSetBounds(drawable); stubGetAndSetCallback(drawable); stubSetVisibilityCallback(drawable); stubSetAlpha(drawable); stubGetPaint(drawable); stubGetBitmap(drawable); return drawable; } | /**
* Creates a mock Drawable with some methods stubbed.
*
* @return mock Drawable
*/ | Creates a mock Drawable with some methods stubbed | mockDrawable | {
"repo_name": "facebook/fresco",
"path": "drawee/src/test/java/com/facebook/drawee/drawable/DrawableTestUtils.java",
"license": "mit",
"size": 7914
} | [
"android.graphics.drawable.Drawable",
"org.mockito.Mockito"
] | import android.graphics.drawable.Drawable; import org.mockito.Mockito; | import android.graphics.drawable.*; import org.mockito.*; | [
"android.graphics",
"org.mockito"
] | android.graphics; org.mockito; | 2,745,655 |
private GenericDataRecord selectRecordRow(Connection con,
IdentifiedRecordTemplate template, String externalId, String language)
throws SQLException, FormException {
PreparedStatement select = null;
ResultSet rs = null;
try {
if (!I18NHelper.isI18nContentActivated || I18NHelper.isDefaultLanguage(language)) {
language = null;
}
if (language != null) {
select = con.prepareStatement(SELECT_RECORD + " AND lang = ? ");
} else {
select = con.prepareStatement(SELECT_RECORD + " AND lang is null");
}
select.setInt(1, template.getInternalId());
select.setString(2, externalId);
if (language != null) {
select.setString(3, language);
}
rs = select.executeQuery();
if (!rs.next()) {
return null;
}
int internalId = rs.getInt(1);
GenericDataRecord record = new GenericDataRecord(template);
record.setInternalId(internalId);
record.setId(externalId);
record.setLanguage(language);
return record;
} finally {
DBUtil.close(rs, select);
}
} | GenericDataRecord function(Connection con, IdentifiedRecordTemplate template, String externalId, String language) throws SQLException, FormException { PreparedStatement select = null; ResultSet rs = null; try { if (!I18NHelper.isI18nContentActivated I18NHelper.isDefaultLanguage(language)) { language = null; } if (language != null) { select = con.prepareStatement(SELECT_RECORD + STR); } else { select = con.prepareStatement(SELECT_RECORD + STR); } select.setInt(1, template.getInternalId()); select.setString(2, externalId); if (language != null) { select.setString(3, language); } rs = select.executeQuery(); if (!rs.next()) { return null; } int internalId = rs.getInt(1); GenericDataRecord record = new GenericDataRecord(template); record.setInternalId(internalId); record.setId(externalId); record.setLanguage(language); return record; } finally { DBUtil.close(rs, select); } } | /**
* Select the template header.
*/ | Select the template header | selectRecordRow | {
"repo_name": "auroreallibe/Silverpeas-Core",
"path": "core-library/src/main/java/org/silverpeas/core/contribution/content/form/record/GenericRecordSetManager.java",
"license": "agpl-3.0",
"size": 41104
} | [
"java.sql.Connection",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"java.sql.SQLException",
"org.silverpeas.core.contribution.content.form.FormException",
"org.silverpeas.core.i18n.I18NHelper",
"org.silverpeas.core.persistence.jdbc.DBUtil"
] | import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import org.silverpeas.core.contribution.content.form.FormException; import org.silverpeas.core.i18n.I18NHelper; import org.silverpeas.core.persistence.jdbc.DBUtil; | import java.sql.*; import org.silverpeas.core.contribution.content.form.*; import org.silverpeas.core.i18n.*; import org.silverpeas.core.persistence.jdbc.*; | [
"java.sql",
"org.silverpeas.core"
] | java.sql; org.silverpeas.core; | 1,137,923 |
public final Object getContent() throws IOException {
return openConnection().getContent();
} | final Object function() throws IOException { return openConnection().getContent(); } | /**
* Returns the content of the resource which is referred by this URL. By
* default this returns an {@code InputStream}, or null if the content type
* of the response is unknown.
*/ | Returns the content of the resource which is referred by this URL. By default this returns an InputStream, or null if the content type of the response is unknown | getContent | {
"repo_name": "xdajog/samsung_sources_i927",
"path": "libcore/luni/src/main/java/java/net/URL.java",
"license": "gpl-2.0",
"size": 24437
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,969,991 |
public static void f(String tag, String msg, Throwable throwable) {
if (sLevel > LEVEL_FATAL) {
return;
}
Log.wtf(tag, msg, throwable);
} | static void function(String tag, String msg, Throwable throwable) { if (sLevel > LEVEL_FATAL) { return; } Log.wtf(tag, msg, throwable); } | /**
* Send a FATAL ERROR log message
*
* @param tag
* @param msg
* @param throwable
*/ | Send a FATAL ERROR log message | f | {
"repo_name": "xu6148152/binea_project_for_android",
"path": "PullToRefresh/pulltorefreshlib/src/main/java/demo/binea/com/pulltorefreshlib/util/PtrCLog.java",
"license": "mit",
"size": 6150
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,586,102 |
public void jobQueueEvent(JobQueueEvent event);
| void function(JobQueueEvent event); | /**
* A job-queue event happened.
*
* @param event - details about the event.
*/ | A job-queue event happened | jobQueueEvent | {
"repo_name": "Paolo-Maffei/freebus-fts",
"path": "freebus-fts-service/src/main/java/org/freebus/fts/service/job/JobQueueListener.java",
"license": "gpl-3.0",
"size": 626
} | [
"org.freebus.fts.service.job.event.JobQueueEvent"
] | import org.freebus.fts.service.job.event.JobQueueEvent; | import org.freebus.fts.service.job.event.*; | [
"org.freebus.fts"
] | org.freebus.fts; | 447,901 |
@Test
public void testGetProperties_0args() throws Exception {
Reporter.println("getProperties");
Properties result = PropertiesLoader.getProperties();
} | void function() throws Exception { Reporter.println(STR); Properties result = PropertiesLoader.getProperties(); } | /**
* Test of getProperties method, of class PropertiesLoader.
*/ | Test of getProperties method, of class PropertiesLoader | testGetProperties_0args | {
"repo_name": "openphacts/Validator",
"path": "rdf-tools/test/uk/ac/manchester/cs/datadesc/validator/utils/PropertiesLoaderTest.java",
"license": "apache-2.0",
"size": 1280
} | [
"java.util.Properties",
"uk.ac.manchester.cs.datadesc.validator.rdftools.Reporter"
] | import java.util.Properties; import uk.ac.manchester.cs.datadesc.validator.rdftools.Reporter; | import java.util.*; import uk.ac.manchester.cs.datadesc.validator.rdftools.*; | [
"java.util",
"uk.ac.manchester"
] | java.util; uk.ac.manchester; | 2,497,695 |
public void ptrmapPut(int key, SqlJetPtrMapType eType, int parent) throws SqlJetException {
assert !ptrmapIsPage(pendingBytePage());
assert autoVacuumMode.isAutoVacuum();
SqlJetAssert.assertFalse(key == 0, SqlJetErrorCode.CORRUPT);
int iPtrmap = ptrmapPageNo(key);
ISqlJetPage pDbPage = pPager
.getPage(iPtrmap);
int offset = ptrmapPtrOffset(iPtrmap,
key);
ISqlJetMemoryPointer pPtrmap = pDbPage
.getData();
if (eType.getValue() != pPtrmap.getByteUnsigned(offset) || pPtrmap.getInt(offset + 1) != parent) {
TRACE("PTRMAP_UPDATE: %d->(%s,%d)\n", Integer.valueOf(key), eType.toString(), Integer.valueOf(parent));
pDbPage.write();
pPtrmap.putByteUnsigned(offset, eType.getValue());
pPtrmap.putIntUnsigned(offset + 1, parent);
}
pDbPage.unref();
} | void function(int key, SqlJetPtrMapType eType, int parent) throws SqlJetException { assert !ptrmapIsPage(pendingBytePage()); assert autoVacuumMode.isAutoVacuum(); SqlJetAssert.assertFalse(key == 0, SqlJetErrorCode.CORRUPT); int iPtrmap = ptrmapPageNo(key); ISqlJetPage pDbPage = pPager .getPage(iPtrmap); int offset = ptrmapPtrOffset(iPtrmap, key); ISqlJetMemoryPointer pPtrmap = pDbPage .getData(); if (eType.getValue() != pPtrmap.getByteUnsigned(offset) pPtrmap.getInt(offset + 1) != parent) { TRACE(STR, Integer.valueOf(key), eType.toString(), Integer.valueOf(parent)); pDbPage.write(); pPtrmap.putByteUnsigned(offset, eType.getValue()); pPtrmap.putIntUnsigned(offset + 1, parent); } pDbPage.unref(); } | /**
* Write an entry into the pointer map.
*
* This routine updates the pointer map entry for page number 'key' so that
* it maps to type 'eType' and parent page number 'pgno'. An error code is
* returned if something goes wrong, otherwise SQLITE_OK.
*/ | Write an entry into the pointer map. This routine updates the pointer map entry for page number 'key' so that it maps to type 'eType' and parent page number 'pgno'. An error code is returned if something goes wrong, otherwise SQLITE_OK | ptrmapPut | {
"repo_name": "printingin3d/sqljet",
"path": "src/main/java/org/tmatesoft/sqljet/core/internal/btree/SqlJetBtreeShared.java",
"license": "gpl-3.0",
"size": 35801
} | [
"org.tmatesoft.sqljet.core.SqlJetErrorCode",
"org.tmatesoft.sqljet.core.SqlJetException",
"org.tmatesoft.sqljet.core.internal.ISqlJetMemoryPointer",
"org.tmatesoft.sqljet.core.internal.ISqlJetPage",
"org.tmatesoft.sqljet.core.internal.SqlJetAssert"
] | import org.tmatesoft.sqljet.core.SqlJetErrorCode; import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.sqljet.core.internal.ISqlJetMemoryPointer; import org.tmatesoft.sqljet.core.internal.ISqlJetPage; import org.tmatesoft.sqljet.core.internal.SqlJetAssert; | import org.tmatesoft.sqljet.core.*; import org.tmatesoft.sqljet.core.internal.*; | [
"org.tmatesoft.sqljet"
] | org.tmatesoft.sqljet; | 326,775 |
public static Expression compile(StatementContext context, FilterableStatement statement, ParseNode viewWhere, List<Expression> dynamicFilters, Set<SubqueryParseNode> subqueryNodes) throws SQLException {
ParseNode where = statement.getWhere();
if (subqueryNodes != null) { // if the subqueryNodes passed in is null, we assume there will be no sub-queries in the WHERE clause.
SubqueryParseNodeVisitor subqueryVisitor = new SubqueryParseNodeVisitor(context, subqueryNodes);
if (where != null) {
where.accept(subqueryVisitor);
}
if (viewWhere != null) {
viewWhere.accept(subqueryVisitor);
}
if (!subqueryNodes.isEmpty()) {
return null;
}
}
Set<Expression> extractedNodes = Sets.<Expression>newHashSet();
WhereExpressionCompiler whereCompiler = new WhereExpressionCompiler(context);
Expression expression = where == null ? LiteralExpression.newConstant(true, PBoolean.INSTANCE,Determinism.ALWAYS) : where.accept(whereCompiler);
if (whereCompiler.isAggregate()) {
throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_WHERE).build().buildException();
}
if (expression.getDataType() != PBoolean.INSTANCE) {
throw TypeMismatchException.newException(PBoolean.INSTANCE, expression.getDataType(), expression.toString());
}
if (viewWhere != null) {
WhereExpressionCompiler viewWhereCompiler = new WhereExpressionCompiler(context, true);
Expression viewExpression = viewWhere.accept(viewWhereCompiler);
expression = AndExpression.create(Lists.newArrayList(expression, viewExpression));
}
if (!dynamicFilters.isEmpty()) {
List<Expression> filters = Lists.newArrayList(expression);
filters.addAll(dynamicFilters);
expression = AndExpression.create(filters);
}
if (context.getCurrentTable().getTable().getType() != PTableType.PROJECTED && context.getCurrentTable().getTable().getType() != PTableType.SUBQUERY) {
expression = WhereOptimizer.pushKeyExpressionsToScan(context, statement, expression, extractedNodes);
}
setScanFilter(context, statement, expression, whereCompiler.disambiguateWithFamily);
return expression;
}
private static class WhereExpressionCompiler extends ExpressionCompiler {
private boolean disambiguateWithFamily;
WhereExpressionCompiler(StatementContext context) {
super(context, true);
}
WhereExpressionCompiler(StatementContext context, boolean resolveViewConstants) {
super(context, resolveViewConstants);
} | static Expression function(StatementContext context, FilterableStatement statement, ParseNode viewWhere, List<Expression> dynamicFilters, Set<SubqueryParseNode> subqueryNodes) throws SQLException { ParseNode where = statement.getWhere(); if (subqueryNodes != null) { SubqueryParseNodeVisitor subqueryVisitor = new SubqueryParseNodeVisitor(context, subqueryNodes); if (where != null) { where.accept(subqueryVisitor); } if (viewWhere != null) { viewWhere.accept(subqueryVisitor); } if (!subqueryNodes.isEmpty()) { return null; } } Set<Expression> extractedNodes = Sets.<Expression>newHashSet(); WhereExpressionCompiler whereCompiler = new WhereExpressionCompiler(context); Expression expression = where == null ? LiteralExpression.newConstant(true, PBoolean.INSTANCE,Determinism.ALWAYS) : where.accept(whereCompiler); if (whereCompiler.isAggregate()) { throw new SQLExceptionInfo.Builder(SQLExceptionCode.AGGREGATE_IN_WHERE).build().buildException(); } if (expression.getDataType() != PBoolean.INSTANCE) { throw TypeMismatchException.newException(PBoolean.INSTANCE, expression.getDataType(), expression.toString()); } if (viewWhere != null) { WhereExpressionCompiler viewWhereCompiler = new WhereExpressionCompiler(context, true); Expression viewExpression = viewWhere.accept(viewWhereCompiler); expression = AndExpression.create(Lists.newArrayList(expression, viewExpression)); } if (!dynamicFilters.isEmpty()) { List<Expression> filters = Lists.newArrayList(expression); filters.addAll(dynamicFilters); expression = AndExpression.create(filters); } if (context.getCurrentTable().getTable().getType() != PTableType.PROJECTED && context.getCurrentTable().getTable().getType() != PTableType.SUBQUERY) { expression = WhereOptimizer.pushKeyExpressionsToScan(context, statement, expression, extractedNodes); } setScanFilter(context, statement, expression, whereCompiler.disambiguateWithFamily); return expression; } private static class WhereExpressionCompiler extends ExpressionCompiler { private boolean disambiguateWithFamily; WhereExpressionCompiler(StatementContext context) { super(context, true); } WhereExpressionCompiler(StatementContext context, boolean resolveViewConstants) { super(context, resolveViewConstants); } | /**
* Optimize scan ranges by applying dynamically generated filter expressions.
* @param context the shared context during query compilation
* @param statement TODO
* @throws SQLException if mismatched types are found, bind value do not match binds,
* or invalid function arguments are encountered.
* @throws SQLFeatureNotSupportedException if an unsupported expression is encountered.
* @throws ColumnNotFoundException if column name could not be resolved
* @throws AmbiguousColumnException if an unaliased column name is ambiguous across multiple tables
*/ | Optimize scan ranges by applying dynamically generated filter expressions | compile | {
"repo_name": "growingio/phoenix",
"path": "phoenix-core/src/main/java/org/apache/phoenix/compile/WhereCompiler.java",
"license": "apache-2.0",
"size": 15317
} | [
"com.google.common.collect.Lists",
"com.google.common.collect.Sets",
"java.sql.SQLException",
"java.util.List",
"java.util.Set",
"org.apache.phoenix.exception.SQLExceptionCode",
"org.apache.phoenix.exception.SQLExceptionInfo",
"org.apache.phoenix.expression.AndExpression",
"org.apache.phoenix.expression.Determinism",
"org.apache.phoenix.expression.Expression",
"org.apache.phoenix.expression.LiteralExpression",
"org.apache.phoenix.parse.FilterableStatement",
"org.apache.phoenix.parse.ParseNode",
"org.apache.phoenix.parse.SubqueryParseNode",
"org.apache.phoenix.schema.PTableType",
"org.apache.phoenix.schema.TypeMismatchException",
"org.apache.phoenix.schema.types.PBoolean"
] | import com.google.common.collect.Lists; import com.google.common.collect.Sets; import java.sql.SQLException; import java.util.List; import java.util.Set; import org.apache.phoenix.exception.SQLExceptionCode; import org.apache.phoenix.exception.SQLExceptionInfo; import org.apache.phoenix.expression.AndExpression; import org.apache.phoenix.expression.Determinism; import org.apache.phoenix.expression.Expression; import org.apache.phoenix.expression.LiteralExpression; import org.apache.phoenix.parse.FilterableStatement; import org.apache.phoenix.parse.ParseNode; import org.apache.phoenix.parse.SubqueryParseNode; import org.apache.phoenix.schema.PTableType; import org.apache.phoenix.schema.TypeMismatchException; import org.apache.phoenix.schema.types.PBoolean; | import com.google.common.collect.*; import java.sql.*; import java.util.*; import org.apache.phoenix.exception.*; import org.apache.phoenix.expression.*; import org.apache.phoenix.parse.*; import org.apache.phoenix.schema.*; import org.apache.phoenix.schema.types.*; | [
"com.google.common",
"java.sql",
"java.util",
"org.apache.phoenix"
] | com.google.common; java.sql; java.util; org.apache.phoenix; | 110,303 |
protected boolean isPermissive(Object mappedValue) {
if(mappedValue != null) {
String[] values = (String[]) mappedValue;
return Arrays.binarySearch(values, PERMISSIVE) >= 0;
}
return false;
} | boolean function(Object mappedValue) { if(mappedValue != null) { String[] values = (String[]) mappedValue; return Arrays.binarySearch(values, PERMISSIVE) >= 0; } return false; } | /**
* Returns <code>true</code> if the mappedValue contains the {@link #PERMISSIVE} qualifier.
*
* @return <code>true</code> if this filter should be permissive
*/ | Returns <code>true</code> if the mappedValue contains the <code>#PERMISSIVE</code> qualifier | isPermissive | {
"repo_name": "apache/shiro",
"path": "web/src/main/java/org/apache/shiro/web/filter/authc/AuthenticatingFilter.java",
"license": "apache-2.0",
"size": 6767
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 457,783 |
@Override
public BigDecimal getBalance()
{
BigDecimal retValue = Env.ZERO;
return retValue;
} // getBalance | BigDecimal function() { BigDecimal retValue = Env.ZERO; return retValue; } | /**
* Get Balance
* @return Zero (always balanced)
*/ | Get Balance | getBalance | {
"repo_name": "klst-com/metasfresh",
"path": "de.metas.acct.base/src/main/java-legacy/org/compiere/acct/Doc_ProjectIssue.java",
"license": "gpl-2.0",
"size": 7707
} | [
"java.math.BigDecimal",
"org.compiere.util.Env"
] | import java.math.BigDecimal; import org.compiere.util.Env; | import java.math.*; import org.compiere.util.*; | [
"java.math",
"org.compiere.util"
] | java.math; org.compiere.util; | 2,327,398 |
// @RequiresPermission(value = Manifest.permission.BIND_ACCESSIBILITY_SERVICE)
public static PStreamProvider asUpdates() {
return new TextEntryProvider();
} | static PStreamProvider function() { return new TextEntryProvider(); } | /**
* Provide a live stream of TextEntry items.
* The provider will generate a TextEntry item once the user type some text.
*
* @return the provider function.
*/ | Provide a live stream of TextEntry items. The provider will generate a TextEntry item once the user type some text | asUpdates | {
"repo_name": "ylimit/PrivacyStreams",
"path": "privacystreams-android-sdk/src/main/java/io/github/privacystreams/accessibility/TextEntry.java",
"license": "apache-2.0",
"size": 1093
} | [
"io.github.privacystreams.core.PStreamProvider"
] | import io.github.privacystreams.core.PStreamProvider; | import io.github.privacystreams.core.*; | [
"io.github.privacystreams"
] | io.github.privacystreams; | 1,897,839 |
public void testGetHoldability() throws SQLException, Exception {
Connection conn = getConnection();
conn.setAutoCommit(false);
// test default holdability
Statement stmt = createStatement();
ResultSet rs = stmt.executeQuery("values(1)");
assertEquals("default holdability is HOLD_CURSORS_OVER_COMMIT", ResultSet.HOLD_CURSORS_OVER_COMMIT, rs.getHoldability());
rs.close();
try {
rs.getHoldability();
fail("getHoldability() should fail when closed");
} catch (SQLException sqle) {
assertSQLState("XCL16", sqle);
// DERBY-4767, sample verification test for operation in XCL16 message.
assertTrue(sqle.getMessage().indexOf("getHoldability") > 0);
}
// test explicitly set holdability
final int[] holdabilities = {
ResultSet.HOLD_CURSORS_OVER_COMMIT,
ResultSet.CLOSE_CURSORS_AT_COMMIT,
};
for (int h=0; h < holdabilities.length; h++) {
Statement s =
createStatement(ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY, holdabilities[h]);
rs = s.executeQuery("values(1)");
assertEquals("holdability " + holdabilityString(holdabilities[h]), holdabilities[h], rs.getHoldability());
rs.close();
s.close();
}
// test holdability of result set returned from a stored
// procedure (DERBY-1101)
stmt.execute("create procedure getresultsetwithhold(in hold int) " +
"parameter style java language java external name " +
"'com.splicemachine.dbTesting.functionTests.tests." +
"jdbc4.ResultSetTest." +
"getResultSetWithHoldability' " +
"dynamic result sets 1 reads sql data");
for (int statementHoldability=0; statementHoldability<holdabilities.length; statementHoldability++) {
for (int procHoldability=0; procHoldability < holdabilities.length; procHoldability++) {
CallableStatement cs =
prepareCall("call getresultsetwithhold(?)",
ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY,
holdabilities[statementHoldability]);
cs.setInt(1, holdabilities[procHoldability]);
cs.execute();
rs = cs.getResultSet();
assertSame(cs, rs.getStatement());
int holdability = rs.getHoldability();
assertEquals("holdability of ResultSet from stored proc: " + holdabilityString(holdability), holdabilities[procHoldability], holdability);
commit();
try {
rs.next();
assertEquals("non-holdable result set not closed on commit", ResultSet.HOLD_CURSORS_OVER_COMMIT, holdability);
} catch (SQLException sqle) {
assertSQLState("XCL16",sqle);
assertEquals("holdable result set closed on commit", ResultSet.CLOSE_CURSORS_AT_COMMIT, holdability);
}
rs.close();
cs.close();
}
}
stmt.execute("drop procedure getresultsetwithhold");
stmt.close();
commit();
}
| void function() throws SQLException, Exception { Connection conn = getConnection(); conn.setAutoCommit(false); Statement stmt = createStatement(); ResultSet rs = stmt.executeQuery(STR); assertEquals(STR, ResultSet.HOLD_CURSORS_OVER_COMMIT, rs.getHoldability()); rs.close(); try { rs.getHoldability(); fail(STR); } catch (SQLException sqle) { assertSQLState("XCL16", sqle); assertTrue(sqle.getMessage().indexOf(STR) > 0); } final int[] holdabilities = { ResultSet.HOLD_CURSORS_OVER_COMMIT, ResultSet.CLOSE_CURSORS_AT_COMMIT, }; for (int h=0; h < holdabilities.length; h++) { Statement s = createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdabilities[h]); rs = s.executeQuery(STR); assertEquals(STR + holdabilityString(holdabilities[h]), holdabilities[h], rs.getHoldability()); rs.close(); s.close(); } stmt.execute(STR + STR + STR + STR + STR + STR); for (int statementHoldability=0; statementHoldability<holdabilities.length; statementHoldability++) { for (int procHoldability=0; procHoldability < holdabilities.length; procHoldability++) { CallableStatement cs = prepareCall(STR, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdabilities[statementHoldability]); cs.setInt(1, holdabilities[procHoldability]); cs.execute(); rs = cs.getResultSet(); assertSame(cs, rs.getStatement()); int holdability = rs.getHoldability(); assertEquals(STR + holdabilityString(holdability), holdabilities[procHoldability], holdability); commit(); try { rs.next(); assertEquals(STR, ResultSet.HOLD_CURSORS_OVER_COMMIT, holdability); } catch (SQLException sqle) { assertSQLState("XCL16",sqle); assertEquals(STR, ResultSet.CLOSE_CURSORS_AT_COMMIT, holdability); } rs.close(); cs.close(); } } stmt.execute(STR); stmt.close(); commit(); } | /**
* Tests that <code>ResultSet.getHoldability()</code> has the
* correct behaviour.
*
* @throws SQLException Thrown if some unexpected error happens
* @throws Exception Thrown if some unexpected error happens
*/ | Tests that <code>ResultSet.getHoldability()</code> has the correct behaviour | testGetHoldability | {
"repo_name": "splicemachine/spliceengine",
"path": "db-testing/src/test/java/com/splicemachine/dbTesting/functionTests/tests/jdbc4/ResultSetTest.java",
"license": "agpl-3.0",
"size": 73189
} | [
"java.sql.CallableStatement",
"java.sql.Connection",
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement"
] | import java.sql.CallableStatement; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 252,723 |
@NotNull
@Guarded(NotNullGuard.class)
@Deprecated
default var getPairValue() {
return toVarMap().values().iterator().next();
} | @Guarded(NotNullGuard.class) default var getPairValue() { return toVarMap().values().iterator().next(); } | /**
* Gets pair value.
*
* @return the pair value
* @deprecated use $pairValue()
*/ | Gets pair value | getPairValue | {
"repo_name": "sillelien/dollar-core",
"path": "src/main/java/com/sillelien/dollar/api/TypeAware.java",
"license": "apache-2.0",
"size": 9120
} | [
"com.sillelien.dollar.api.guard.Guarded",
"com.sillelien.dollar.api.guard.NotNullGuard"
] | import com.sillelien.dollar.api.guard.Guarded; import com.sillelien.dollar.api.guard.NotNullGuard; | import com.sillelien.dollar.api.guard.*; | [
"com.sillelien.dollar"
] | com.sillelien.dollar; | 300,049 |
final String key = "name";
final JsonStructure json = Json.createObjectBuilder()
.add(key, "Jeffrey Lebowski")
.build();
MatcherAssert.assertThat(
Json.createReader(
new RsJson(json).body()
).readObject().getString(key),
Matchers.startsWith("Jeffrey")
);
} | final String key = "name"; final JsonStructure json = Json.createObjectBuilder() .add(key, STR) .build(); MatcherAssert.assertThat( Json.createReader( new RsJson(json).body() ).readObject().getString(key), Matchers.startsWith(STR) ); } | /**
* RsJSON can build JSON response.
* @throws IOException If some problem inside
*/ | RsJSON can build JSON response | buildsJsonResponse | {
"repo_name": "yegor256/takes",
"path": "src/test/java/org/takes/rs/RsJsonTest.java",
"license": "mit",
"size": 2668
} | [
"javax.json.Json",
"javax.json.JsonStructure",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import javax.json.Json; import javax.json.JsonStructure; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import javax.json.*; import org.hamcrest.*; | [
"javax.json",
"org.hamcrest"
] | javax.json; org.hamcrest; | 1,274,517 |
public Map<Long,QuorumPeer.QuorumServer> getVotingView() {
return getQuorumVerifier().getVotingMembers();
} | Map<Long,QuorumPeer.QuorumServer> function() { return getQuorumVerifier().getVotingMembers(); } | /**
* Observers are not contained in this view, only nodes with
* PeerType=PARTICIPANT.
*/ | Observers are not contained in this view, only nodes with PeerType=PARTICIPANT | getVotingView | {
"repo_name": "AkihiroSuda/zookeeper",
"path": "src/java/main/org/apache/zookeeper/server/quorum/QuorumPeer.java",
"license": "apache-2.0",
"size": 66802
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,868,493 |
public static CPreparedStatement prepareStatement (String sql, String trxName)
{
int concurrency = ResultSet.CONCUR_READ_ONLY;
String upper = sql.toUpperCase();
if (upper.startsWith("UPDATE ") || upper.startsWith("DELETE "))
concurrency = ResultSet.CONCUR_UPDATABLE;
return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, concurrency, trxName);
} // prepareStatement
| static CPreparedStatement function (String sql, String trxName) { int concurrency = ResultSet.CONCUR_READ_ONLY; String upper = sql.toUpperCase(); if (upper.startsWith(STR) upper.startsWith(STR)) concurrency = ResultSet.CONCUR_UPDATABLE; return prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, concurrency, trxName); } | /**
* Prepare Statement
* @param sql
* @param trxName transaction
* @return Prepared Statement
*/ | Prepare Statement | prepareStatement | {
"repo_name": "arthurmelo88/palmetalADP",
"path": "adempiere_360/base/src/org/compiere/util/DB.java",
"license": "gpl-2.0",
"size": 69445
} | [
"java.sql.ResultSet"
] | import java.sql.ResultSet; | import java.sql.*; | [
"java.sql"
] | java.sql; | 303,878 |
Coordinate transformCoordinate(Coordinate coordinate, String from, String to); | Coordinate transformCoordinate(Coordinate coordinate, String from, String to); | /**
* Transform the given coordinate from a certain rendering space to another.
*
* @param coordinate
* The coordinate to transform. The X and Y coordinates are expected to be expressed in the 'from'
* rendering space.
* @param from
* The rendering space as a String value that expresses the X and Y ordinates of the given coordinate.
* @param to
* The rendering space as a String value where to the coordinate should be transformed.
* @return The transformed coordinate.
*/ | Transform the given coordinate from a certain rendering space to another | transformCoordinate | {
"repo_name": "geomajas/geomajas-project-javascript",
"path": "api/src/main/java/org/geomajas/javascript/api/client/map/JsViewPortTransformationService.java",
"license": "agpl-3.0",
"size": 2038
} | [
"org.geomajas.geometry.Coordinate"
] | import org.geomajas.geometry.Coordinate; | import org.geomajas.geometry.*; | [
"org.geomajas.geometry"
] | org.geomajas.geometry; | 2,653,160 |
protected String mapElement(ClassInfo ci) {
if (ci == null)
return null;
String s = null;
MapEntry me = options.elementMapEntry(ci.name(), ci.encodingRule("xsd"));
if (me == null) {
if (classHasObjectElement(ci)) {
s = elementName(ci, true);
} else {
MessageContext mc = result.addError(this, 119, ci.name());
if (mc != null)
mc.addDetail(null, 400, "Class", ci.fullName());
}
} else {
s = addImport(me.p1);
}
return s;
} | String function(ClassInfo ci) { if (ci == null) return null; String s = null; MapEntry me = options.elementMapEntry(ci.name(), ci.encodingRule("xsd")); if (me == null) { if (classHasObjectElement(ci)) { s = elementName(ci, true); } else { MessageContext mc = result.addError(this, 119, ci.name()); if (mc != null) mc.addDetail(null, 400, "Class", ci.fullName()); } } else { s = addImport(me.p1); } return s; } | /**
* Map an element to a predefined representation in GML, ISO/TS 19139, etc.
*
* @param ci tbd
* @return tbd
*/ | Map an element to a predefined representation in GML, ISO/TS 19139, etc | mapElement | {
"repo_name": "ShapeChange/ShapeChange",
"path": "src/main/java/de/interactive_instruments/ShapeChange/Target/XmlSchema/XsdDocument.java",
"license": "gpl-3.0",
"size": 165716
} | [
"de.interactive_instruments.ShapeChange"
] | import de.interactive_instruments.ShapeChange; | import de.interactive_instruments.*; | [
"de.interactive_instruments"
] | de.interactive_instruments; | 179,126 |
public Maybe<ListContainersSegmentResponse> listContainersSegmentAsync(Context context, String prefix, String marker, Integer maxresults, ListContainersIncludeType include, Integer timeout, String requestId) {
return listContainersSegmentWithRestResponseAsync(context, prefix, marker, maxresults, include, timeout, requestId)
.flatMapMaybe((ServiceListContainersSegmentResponse res) -> res.body() == null ? Maybe.empty() : Maybe.just(res.body()));
} | Maybe<ListContainersSegmentResponse> function(Context context, String prefix, String marker, Integer maxresults, ListContainersIncludeType include, Integer timeout, String requestId) { return listContainersSegmentWithRestResponseAsync(context, prefix, marker, maxresults, include, timeout, requestId) .flatMapMaybe((ServiceListContainersSegmentResponse res) -> res.body() == null ? Maybe.empty() : Maybe.just(res.body())); } | /**
* The List Containers Segment operation returns a list of the containers under the specified account.
*
* @param context The context to associate with this operation.
* @param prefix Filters the results to return only containers whose name begins with the specified prefix.
* @param marker A string value that identifies the portion of the list of containers to be returned with the next listing operation. The operation returns the NextMarker value within the response body if the listing operation did not return all containers remaining to be listed with the current page. The NextMarker value can be used as the value for the marker parameter in a subsequent call to request the next page of list items. The marker value is opaque to the client.
* @param maxresults Specifies the maximum number of containers to return. If the request does not specify maxresults, or specifies a value greater than 5000, the server will return up to 5000 items. Note that if the listing operation crosses a partition boundary, then the service will return a continuation token for retrieving the remainder of the results. For this reason, it is possible that the service will return fewer results than specified by maxresults, or than the default of 5000.
* @param include Include this parameter to specify that the container's metadata be returned as part of the response body. Possible values include: 'metadata'.
* @param timeout The timeout parameter is expressed in seconds. For more information, see <a href="https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/setting-timeouts-for-blob-service-operations">Setting Timeouts for Blob Service Operations.</a>.
* @param requestId Provides a client-generated, opaque value with a 1 KB character limit that is recorded in the analytics logs when storage analytics logging is enabled.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @return a Single which performs the network request upon subscription.
*/ | The List Containers Segment operation returns a list of the containers under the specified account | listContainersSegmentAsync | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/storage/microsoft-azure-storage-blob/src/main/java/com/microsoft/azure/storage/blob/GeneratedServices.java",
"license": "mit",
"size": 40188
} | [
"com.microsoft.azure.storage.blob.models.ListContainersIncludeType",
"com.microsoft.azure.storage.blob.models.ListContainersSegmentResponse",
"com.microsoft.azure.storage.blob.models.ServiceListContainersSegmentResponse",
"com.microsoft.rest.v2.Context",
"io.reactivex.Maybe"
] | import com.microsoft.azure.storage.blob.models.ListContainersIncludeType; import com.microsoft.azure.storage.blob.models.ListContainersSegmentResponse; import com.microsoft.azure.storage.blob.models.ServiceListContainersSegmentResponse; import com.microsoft.rest.v2.Context; import io.reactivex.Maybe; | import com.microsoft.azure.storage.blob.models.*; import com.microsoft.rest.v2.*; import io.reactivex.*; | [
"com.microsoft.azure",
"com.microsoft.rest",
"io.reactivex"
] | com.microsoft.azure; com.microsoft.rest; io.reactivex; | 1,732,973 |
private void procesaImagen(HashMap<String, String> parametros, BasicDBObject anterior) {
if (null == parametros.get("issueSateliteImg") || "".equals(parametros.get("issueSateliteImg").trim())) {
if (null != anterior && null != anterior.getString("issueSateliteImg")) {
System.out.println("Arreglando: issueSateliteImg=" + anterior.getString("issueSateliteImg"));
parametros.put("issueSateliteImg", anterior.getString("issueSateliteImg"));
}
}
} | void function(HashMap<String, String> parametros, BasicDBObject anterior) { if (null == parametros.get(STR) "".equals(parametros.get(STR).trim())) { if (null != anterior && null != anterior.getString(STR)) { System.out.println("Arreglando: issueSateliteImg=" + anterior.getString(STR)); parametros.put(STR, anterior.getString(STR)); } } } | /**
* Updates uploaded images from the web form.
* @param parametros new advice properties
* @param anterior previous advice properties
*/ | Updates uploaded images from the web form | procesaImagen | {
"repo_name": "mxabierto/avisos",
"path": "src/main/java/mx/org/cedn/avisosconagua/engine/processors/Init.java",
"license": "mit",
"size": 10804
} | [
"com.mongodb.BasicDBObject",
"java.util.HashMap"
] | import com.mongodb.BasicDBObject; import java.util.HashMap; | import com.mongodb.*; import java.util.*; | [
"com.mongodb",
"java.util"
] | com.mongodb; java.util; | 2,661,489 |
public void unbindWireHelperService(final WireHelperService wireHelperService) {
if (this.wireHelperService == wireHelperService) {
this.wireHelperService = null;
}
} | void function(final WireHelperService wireHelperService) { if (this.wireHelperService == wireHelperService) { this.wireHelperService = null; } } | /**
* Unbinds the Wire Helper Service.
*
* @param wireHelperService
* the new Wire Helper Service
*/ | Unbinds the Wire Helper Service | unbindWireHelperService | {
"repo_name": "ctron/kura",
"path": "kura/org.eclipse.kura.wire.component.provider/src/main/java/org/eclipse/kura/internal/wire/asset/WireAsset.java",
"license": "epl-1.0",
"size": 15376
} | [
"org.eclipse.kura.wire.WireHelperService"
] | import org.eclipse.kura.wire.WireHelperService; | import org.eclipse.kura.wire.*; | [
"org.eclipse.kura"
] | org.eclipse.kura; | 2,167,169 |
public void incrementStatistic(Statistic statistic) {
incrementStatistic(statistic, 1);
} | void function(Statistic statistic) { incrementStatistic(statistic, 1); } | /**
* Increment a statistic by 1.
* This increments both the instrumentation and storage statistics.
* @param statistic The operation to increment
*/ | Increment a statistic by 1. This increments both the instrumentation and storage statistics | incrementStatistic | {
"repo_name": "plusplusjiajia/hadoop",
"path": "hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/StoreContext.java",
"license": "apache-2.0",
"size": 10586
} | [
"org.apache.hadoop.fs.s3a.Statistic"
] | import org.apache.hadoop.fs.s3a.Statistic; | import org.apache.hadoop.fs.s3a.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,179,168 |
@Deprecated
public int scheduleAsyncDelayedTask(Plugin plugin, Runnable task); | int function(Plugin plugin, Runnable task); | /**
* <b>Asynchronous tasks should never access any API in Bukkit. Great care
* should be taken to assure the thread-safety of asynchronous tasks.</b>
* <p>
* Schedules a once off task to occur as soon as possible. This task will
* be executed by a thread managed by the scheduler.
*
* @param plugin Plugin that owns the task
* @param task Task to be executed
* @return Task id number (-1 if scheduling failed)
* @deprecated This name is misleading, as it does not schedule "a sync"
* task, but rather, "an async" task
*/ | Asynchronous tasks should never access any API in Bukkit. Great care should be taken to assure the thread-safety of asynchronous tasks. Schedules a once off task to occur as soon as possible. This task will be executed by a thread managed by the scheduler | scheduleAsyncDelayedTask | {
"repo_name": "Sindresgaming/Spigot-API",
"path": "src/main/java/org/bukkit/scheduler/BukkitScheduler.java",
"license": "gpl-3.0",
"size": 10177
} | [
"org.bukkit.plugin.Plugin"
] | import org.bukkit.plugin.Plugin; | import org.bukkit.plugin.*; | [
"org.bukkit.plugin"
] | org.bukkit.plugin; | 832,860 |
public void logPurchase(BigDecimal purchaseAmount, Currency currency, Bundle parameters) {
appEventsLogger.logPurchase(purchaseAmount, currency, parameters);
} | void function(BigDecimal purchaseAmount, Currency currency, Bundle parameters) { appEventsLogger.logPurchase(purchaseAmount, currency, parameters); } | /**
* Deprecated. Please use {@link AppEventsLogger} instead.
*/ | Deprecated. Please use <code>AppEventsLogger</code> instead | logPurchase | {
"repo_name": "codenpk/yelo-android",
"path": "libraries/facebookSDK/src/main/java/com/facebook/InsightsLogger.java",
"license": "apache-2.0",
"size": 3259
} | [
"android.os.Bundle",
"java.math.BigDecimal",
"java.util.Currency"
] | import android.os.Bundle; import java.math.BigDecimal; import java.util.Currency; | import android.os.*; import java.math.*; import java.util.*; | [
"android.os",
"java.math",
"java.util"
] | android.os; java.math; java.util; | 1,034,324 |
private void replaceModuleName() throws CmsException, UnsupportedEncodingException {
CmsResourceFilter filter = CmsResourceFilter.ALL.addRequireFile().addExcludeState(CmsResource.STATE_DELETED).addRequireTimerange().addRequireVisible();
List<CmsResource> resources = getCms().readResources(
CmsWorkplace.VFS_PATH_MODULES + m_cloneInfo.getName() + "/",
filter);
for (CmsResource resource : resources) {
CmsFile file = getCms().readFile(resource);
byte[] contents = file.getContents();
String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file);
String content = new String(contents, encoding);
Matcher matcher = Pattern.compile(m_cloneInfo.getSourceModuleName()).matcher(content);
if (matcher.find()) {
contents = matcher.replaceAll(m_cloneInfo.getName()).getBytes(encoding);
if (lockResource(getCms(), file)) {
file.setContents(contents);
getCms().writeFile(file);
}
}
}
} | void function() throws CmsException, UnsupportedEncodingException { CmsResourceFilter filter = CmsResourceFilter.ALL.addRequireFile().addExcludeState(CmsResource.STATE_DELETED).addRequireTimerange().addRequireVisible(); List<CmsResource> resources = getCms().readResources( CmsWorkplace.VFS_PATH_MODULES + m_cloneInfo.getName() + "/", filter); for (CmsResource resource : resources) { CmsFile file = getCms().readFile(resource); byte[] contents = file.getContents(); String encoding = CmsLocaleManager.getResourceEncoding(getCms(), file); String content = new String(contents, encoding); Matcher matcher = Pattern.compile(m_cloneInfo.getSourceModuleName()).matcher(content); if (matcher.find()) { contents = matcher.replaceAll(m_cloneInfo.getName()).getBytes(encoding); if (lockResource(getCms(), file)) { file.setContents(contents); getCms().writeFile(file); } } } } | /**
* Initializes a thread to find and replace all occurrence of the module's path.<p>
*
* @throws CmsException
* @throws UnsupportedEncodingException
*/ | Initializes a thread to find and replace all occurrence of the module's path | replaceModuleName | {
"repo_name": "it-tavis/opencms-core",
"path": "src-modules/org/opencms/workplace/tools/modules/CmsCloneModuleThread.java",
"license": "lgpl-2.1",
"size": 43310
} | [
"java.io.UnsupportedEncodingException",
"java.util.List",
"java.util.regex.Matcher",
"java.util.regex.Pattern",
"org.opencms.file.CmsFile",
"org.opencms.file.CmsResource",
"org.opencms.file.CmsResourceFilter",
"org.opencms.i18n.CmsLocaleManager",
"org.opencms.main.CmsException",
"org.opencms.workplace.CmsWorkplace"
] | import java.io.UnsupportedEncodingException; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.opencms.file.CmsFile; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.i18n.CmsLocaleManager; import org.opencms.main.CmsException; import org.opencms.workplace.CmsWorkplace; | import java.io.*; import java.util.*; import java.util.regex.*; import org.opencms.file.*; import org.opencms.i18n.*; import org.opencms.main.*; import org.opencms.workplace.*; | [
"java.io",
"java.util",
"org.opencms.file",
"org.opencms.i18n",
"org.opencms.main",
"org.opencms.workplace"
] | java.io; java.util; org.opencms.file; org.opencms.i18n; org.opencms.main; org.opencms.workplace; | 242,098 |
public static void closeStream(Closeable aStream) throws IOException {
aStream.close();
} | static void function(Closeable aStream) throws IOException { aStream.close(); } | /**
* Tries to close the specified stream.
*
* @param aStream
* an input or output stream
*
* @throws IOException
* is thrown if the specified stream couldn't be closed properly
*/ | Tries to close the specified stream | closeStream | {
"repo_name": "gammalgris/jmul",
"path": "Utilities/IO/src/jmul/io/StreamsHelper.java",
"license": "gpl-3.0",
"size": 3646
} | [
"java.io.Closeable",
"java.io.IOException"
] | import java.io.Closeable; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,640,642 |
private void writeObject(ObjectOutputStream stream) throws IOException {
stream.defaultWriteObject();
SerialUtilities.writePaintType(this.fillPaintType, stream);
SerialUtilities.writePaintType(this.outlinePaintType, stream);
} | void function(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); SerialUtilities.writePaintType(this.fillPaintType, stream); SerialUtilities.writePaintType(this.outlinePaintType, stream); } | /**
* Provides serialization support.
*
* @param stream the output stream.
*
* @throws IOException if there is an I/O error.
*/ | Provides serialization support | writeObject | {
"repo_name": "djun100/afreechart",
"path": "src/org/afree/chart/plot/dial/DialPointer.java",
"license": "lgpl-3.0",
"size": 20703
} | [
"java.io.IOException",
"java.io.ObjectOutputStream",
"org.afree.io.SerialUtilities"
] | import java.io.IOException; import java.io.ObjectOutputStream; import org.afree.io.SerialUtilities; | import java.io.*; import org.afree.io.*; | [
"java.io",
"org.afree.io"
] | java.io; org.afree.io; | 764,928 |
protected void loadChildren()
{
DynamicTreeNode newNode;
// Font font;
// int randomIndex;
NodeData dataParent = (NodeData)this.getUserObject();
FieldList fieldList = dataParent.makeRecord();
FieldTable fieldTable = fieldList.getTable();
m_fNameCount = 0;
try {
fieldTable.close();
// while (fieldTable.hasNext())
while (fieldTable.next() != null)
{
String objID = fieldList.getField(0).toString();
String strDescription = fieldList.getField(3).toString();
NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName());
newNode = new DynamicTreeNode(data);
this.insert(newNode, (int)m_fNameCount);
m_fNameCount++;
}
} catch (Exception ex) {
ex.printStackTrace();
}
m_bHasLoaded = true;
} | void function() { DynamicTreeNode newNode; NodeData dataParent = (NodeData)this.getUserObject(); FieldList fieldList = dataParent.makeRecord(); FieldTable fieldTable = fieldList.getTable(); m_fNameCount = 0; try { fieldTable.close(); while (fieldTable.next() != null) { String objID = fieldList.getField(0).toString(); String strDescription = fieldList.getField(3).toString(); NodeData data = new NodeData(dataParent.getBaseApplet(), dataParent.getRemoteSession(), strDescription, objID, dataParent.getSubRecordClassName()); newNode = new DynamicTreeNode(data); this.insert(newNode, (int)m_fNameCount); m_fNameCount++; } } catch (Exception ex) { ex.printStackTrace(); } m_bHasLoaded = true; } | /**
* Messaged the first time getChildCount is messaged. Creates
* children with random names from names.
*/ | Messaged the first time getChildCount is messaged. Creates children with random names from names | loadChildren | {
"repo_name": "jbundle/jbundle",
"path": "thin/opt/location/src/main/java/org/jbundle/thin/opt/location/DynamicTreeNode.java",
"license": "gpl-3.0",
"size": 3254
} | [
"org.jbundle.thin.base.db.FieldList",
"org.jbundle.thin.base.db.FieldTable"
] | import org.jbundle.thin.base.db.FieldList; import org.jbundle.thin.base.db.FieldTable; | import org.jbundle.thin.base.db.*; | [
"org.jbundle.thin"
] | org.jbundle.thin; | 948,603 |
boolean canSpreadInto(Block block, Side side); | boolean canSpreadInto(Block block, Side side); | /**
* Checks if the value can propagate into a given block, through a specific side
*
* @param block The block to propagate into
* @param side The side to propagate via
* @return Whether the given block can be propagated
* into through side
*/ | Checks if the value can propagate into a given block, through a specific side | canSpreadInto | {
"repo_name": "Malanius/Terasology",
"path": "engine/src/main/java/org/terasology/world/propagation/PropagationRules.java",
"license": "apache-2.0",
"size": 3593
} | [
"org.terasology.math.Side",
"org.terasology.world.block.Block"
] | import org.terasology.math.Side; import org.terasology.world.block.Block; | import org.terasology.math.*; import org.terasology.world.block.*; | [
"org.terasology.math",
"org.terasology.world"
] | org.terasology.math; org.terasology.world; | 693,213 |
@Override
public int toBooleanMarshalCost() {
return Marshal.COST_FROM_NULL;
} | int function() { return Marshal.COST_FROM_NULL; } | /**
* Cost to convert to a boolean
*/ | Cost to convert to a boolean | toBooleanMarshalCost | {
"repo_name": "CleverCloud/Quercus",
"path": "quercus/src/main/java/com/caucho/quercus/env/NullValue.java",
"license": "gpl-2.0",
"size": 11788
} | [
"com.caucho.quercus.marshal.Marshal"
] | import com.caucho.quercus.marshal.Marshal; | import com.caucho.quercus.marshal.*; | [
"com.caucho.quercus"
] | com.caucho.quercus; | 1,784,997 |
public void addAnnotation(XYAnnotation annotation) {
addAnnotation(annotation, true);
} | void function(XYAnnotation annotation) { addAnnotation(annotation, true); } | /**
* Adds an annotation to the plot and sends a {@link PlotChangeEvent} to
* all registered listeners.
*
* @param annotation the annotation (<code>null</code> not permitted).
*
* @see #getAnnotations()
* @see #removeAnnotation(XYAnnotation)
*/ | Adds an annotation to the plot and sends a <code>PlotChangeEvent</code> to all registered listeners | addAnnotation | {
"repo_name": "Epsilon2/Memetic-Algorithm-for-TSP",
"path": "jfreechart-1.0.16/source/org/jfree/chart/plot/XYPlot.java",
"license": "mit",
"size": 199979
} | [
"org.jfree.chart.annotations.XYAnnotation"
] | import org.jfree.chart.annotations.XYAnnotation; | import org.jfree.chart.annotations.*; | [
"org.jfree.chart"
] | org.jfree.chart; | 2,198,119 |
public void loadSettingsForDialog(final NodeSettingsRO settings) {
m_chartTitle = settings.getString(CHART_TITLE, DEF_CHART_TITLE);
allModelAreSelected = settings.getBoolean(modelSelection, allModelAreSelected);
secondaryModel = settings.getBoolean(secondarySelection, secondaryModel);
headLess = settings.getBoolean(HEADLESS, headLess);
m_isHideInWizard = settings.getBoolean(HIDE_IN_WIZARD, false);
m_y0 = settings.getDouble(Y0, DEF_Y0);
m_minXAxis = settings.getInt(MIN_X_AXIS, DEF_MIN_X_AXIS);
m_maxXAxis = settings.getInt(MAX_X_AXIS, DEF_MAX_X_AXIS);
m_minYAxis = settings.getInt(MIN_Y_AXIS, DEF_MIN_Y_AXIS);
m_maxYAxis = settings.getInt(MAX_Y_AXIS, DEF_MAX_Y_AXIS);
}
| void function(final NodeSettingsRO settings) { m_chartTitle = settings.getString(CHART_TITLE, DEF_CHART_TITLE); allModelAreSelected = settings.getBoolean(modelSelection, allModelAreSelected); secondaryModel = settings.getBoolean(secondarySelection, secondaryModel); headLess = settings.getBoolean(HEADLESS, headLess); m_isHideInWizard = settings.getBoolean(HIDE_IN_WIZARD, false); m_y0 = settings.getDouble(Y0, DEF_Y0); m_minXAxis = settings.getInt(MIN_X_AXIS, DEF_MIN_X_AXIS); m_maxXAxis = settings.getInt(MAX_X_AXIS, DEF_MAX_X_AXIS); m_minYAxis = settings.getInt(MIN_Y_AXIS, DEF_MIN_Y_AXIS); m_maxYAxis = settings.getInt(MAX_Y_AXIS, DEF_MAX_Y_AXIS); } | /**
* Loads parameters in Dialog.
*
* @param settings To load from.
*/ | Loads parameters in Dialog | loadSettingsForDialog | {
"repo_name": "SiLeBAT/FSK-Lab",
"path": "de.bund.bfr.knime.pmm.nodes/src/de/bund/bfr/knime/pmm/js/modelplotter/modern/ModelPlotterViewConfig.java",
"license": "gpl-3.0",
"size": 7774
} | [
"org.knime.core.node.NodeSettingsRO"
] | import org.knime.core.node.NodeSettingsRO; | import org.knime.core.node.*; | [
"org.knime.core"
] | org.knime.core; | 746,777 |
public List<AssignmentVerificationReport> verifyRegionPlacement(boolean isDetailMode)
throws IOException {
System.out.println("Start to verify the region assignment and " +
"generate the verification report");
// Get the region assignment snapshot
SnapshotOfRegionAssignmentFromMeta snapshot = this.getRegionAssignmentSnapshot();
// Get all the tables
Set<TableName> tables = snapshot.getTableSet();
// Get the region locality map
Map<String, Map<String, Float>> regionLocalityMap = null;
if (this.enforceLocality == true) {
regionLocalityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf);
}
List<AssignmentVerificationReport> reports = new ArrayList<AssignmentVerificationReport>();
// Iterate all the tables to fill up the verification report
for (TableName table : tables) {
if (!this.targetTableSet.isEmpty() &&
!this.targetTableSet.contains(table)) {
continue;
}
AssignmentVerificationReport report = new AssignmentVerificationReport();
report.fillUp(table, snapshot, regionLocalityMap);
report.print(isDetailMode);
reports.add(report);
}
return reports;
} | List<AssignmentVerificationReport> function(boolean isDetailMode) throws IOException { System.out.println(STR + STR); SnapshotOfRegionAssignmentFromMeta snapshot = this.getRegionAssignmentSnapshot(); Set<TableName> tables = snapshot.getTableSet(); Map<String, Map<String, Float>> regionLocalityMap = null; if (this.enforceLocality == true) { regionLocalityMap = FSUtils.getRegionDegreeLocalityMappingFromFS(conf); } List<AssignmentVerificationReport> reports = new ArrayList<AssignmentVerificationReport>(); for (TableName table : tables) { if (!this.targetTableSet.isEmpty() && !this.targetTableSet.contains(table)) { continue; } AssignmentVerificationReport report = new AssignmentVerificationReport(); report.fillUp(table, snapshot, regionLocalityMap); report.print(isDetailMode); reports.add(report); } return reports; } | /**
* Verify the region placement is consistent with the assignment plan
* @param isDetailMode
* @return reports
* @throws IOException
*/ | Verify the region placement is consistent with the assignment plan | verifyRegionPlacement | {
"repo_name": "throughsky/lywebank",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/master/RegionPlacementMaintainer.java",
"license": "apache-2.0",
"size": 48273
} | [
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"java.util.Map",
"java.util.Set",
"org.apache.hadoop.hbase.TableName",
"org.apache.hadoop.hbase.util.FSUtils"
] | import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Set; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.util.FSUtils; | import java.io.*; import java.util.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"java.util",
"org.apache.hadoop"
] | java.io; java.util; org.apache.hadoop; | 2,604,123 |
@ServiceMethod(returns = ReturnType.COLLECTION)
private PagedFlux<SensitivityLabelInner> listCurrentAsync(
String resourceGroupName, String workspaceName, String sqlPoolName, String filter) {
return new PagedFlux<>(
() -> listCurrentSinglePageAsync(resourceGroupName, workspaceName, sqlPoolName, filter),
nextLink -> listCurrentNextSinglePageAsync(nextLink));
} | @ServiceMethod(returns = ReturnType.COLLECTION) PagedFlux<SensitivityLabelInner> function( String resourceGroupName, String workspaceName, String sqlPoolName, String filter) { return new PagedFlux<>( () -> listCurrentSinglePageAsync(resourceGroupName, workspaceName, sqlPoolName, filter), nextLink -> listCurrentNextSinglePageAsync(nextLink)); } | /**
* Gets SQL pool sensitivity labels.
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param workspaceName The name of the workspace.
* @param sqlPoolName SQL pool name.
* @param filter An OData filter expression that filters elements in the collection.
* @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 sQL pool sensitivity labels.
*/ | Gets SQL pool sensitivity labels | listCurrentAsync | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/synapse/azure-resourcemanager-synapse/src/main/java/com/azure/resourcemanager/synapse/implementation/SqlPoolSensitivityLabelsClientImpl.java",
"license": "mit",
"size": 109648
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.PagedFlux",
"com.azure.resourcemanager.synapse.fluent.models.SensitivityLabelInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedFlux; import com.azure.resourcemanager.synapse.fluent.models.SensitivityLabelInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.resourcemanager.synapse.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 582,600 |
ByteBuf nextInboundByteBuffer(); | ByteBuf nextInboundByteBuffer(); | /**
* Return the {@link ByteBuf} of the next {@link ChannelInboundByteHandler} in the pipeline.
*/ | Return the <code>ByteBuf</code> of the next <code>ChannelInboundByteHandler</code> in the pipeline | nextInboundByteBuffer | {
"repo_name": "menacher/netty",
"path": "transport/src/main/java/io/netty/channel/ChannelHandlerContext.java",
"license": "apache-2.0",
"size": 10055
} | [
"io.netty.buffer.ByteBuf"
] | import io.netty.buffer.ByteBuf; | import io.netty.buffer.*; | [
"io.netty.buffer"
] | io.netty.buffer; | 360,487 |
protected void activate(BundleContext bundleContext, Map<String, Object> properties) throws Exception {
ruleEngine.setCompositeModuleHandlerFactory(
new CompositeModuleHandlerFactory(bundleContext, moduleTypeRegistry, ruleEngine));
ruleEngine.setStatusInfoCallback(this);
modified(properties);
super.activate(bundleContext);
} | void function(BundleContext bundleContext, Map<String, Object> properties) throws Exception { ruleEngine.setCompositeModuleHandlerFactory( new CompositeModuleHandlerFactory(bundleContext, moduleTypeRegistry, ruleEngine)); ruleEngine.setStatusInfoCallback(this); modified(properties); super.activate(bundleContext); } | /**
* Activates this component. Called from DS.
*
* @param componentContext this component context.
*/ | Activates this component. Called from DS | activate | {
"repo_name": "BenediktNiehues/smarthome",
"path": "bundles/automation/org.eclipse.smarthome.automation.core/src/main/java/org/eclipse/smarthome/automation/core/internal/RuleRegistryImpl.java",
"license": "epl-1.0",
"size": 23480
} | [
"java.util.Map",
"org.eclipse.smarthome.automation.core.internal.composite.CompositeModuleHandlerFactory",
"org.osgi.framework.BundleContext"
] | import java.util.Map; import org.eclipse.smarthome.automation.core.internal.composite.CompositeModuleHandlerFactory; import org.osgi.framework.BundleContext; | import java.util.*; import org.eclipse.smarthome.automation.core.internal.composite.*; import org.osgi.framework.*; | [
"java.util",
"org.eclipse.smarthome",
"org.osgi.framework"
] | java.util; org.eclipse.smarthome; org.osgi.framework; | 976,409 |
public void doAlias(AbstractCompiler compiler) {
if (isAliased) {
for (Map.Entry<Node, Node> entry : nodes.entrySet()) {
Node n = entry.getKey();
Node parent = entry.getValue();
aliasNode(n, parent);
compiler.reportCodeChange();
}
}
} | void function(AbstractCompiler compiler) { if (isAliased) { for (Map.Entry<Node, Node> entry : nodes.entrySet()) { Node n = entry.getKey(); Node parent = entry.getValue(); aliasNode(n, parent); compiler.reportCodeChange(); } } } | /**
* Update all of the nodes with a reference to the corresponding
* alias node.
*/ | Update all of the nodes with a reference to the corresponding alias node | doAlias | {
"repo_name": "robbert/closure-compiler",
"path": "src/com/google/javascript/jscomp/AliasKeywords.java",
"license": "apache-2.0",
"size": 15467
} | [
"com.google.javascript.rhino.Node",
"java.util.Map"
] | import com.google.javascript.rhino.Node; import java.util.Map; | import com.google.javascript.rhino.*; import java.util.*; | [
"com.google.javascript",
"java.util"
] | com.google.javascript; java.util; | 753,805 |
public boolean isContent(Item item);
public void delAllItems(boolean destroy);
public void eachItem(final EachApplicable<Item> applier);
| boolean isContent(Item item); public void delAllItems(boolean destroy); public void function(final EachApplicable<Item> applier); | /**
* Applies the given code to each item in this collection
* @param applier code to execute against each object
*/ | Applies the given code to each item in this collection | eachItem | {
"repo_name": "bozimmerman/CoffeeMud",
"path": "com/planet_ink/coffee_mud/core/interfaces/ItemCollection.java",
"license": "apache-2.0",
"size": 4462
} | [
"com.planet_ink.coffee_mud.Items"
] | import com.planet_ink.coffee_mud.Items; | import com.planet_ink.coffee_mud.*; | [
"com.planet_ink.coffee_mud"
] | com.planet_ink.coffee_mud; | 2,354,858 |
void setScaleType(ImageView.ScaleType scaleType); | void setScaleType(ImageView.ScaleType scaleType); | /**
* Controls how the image should be resized or moved to match the size of
* the ImageView. Any scaling or panning will happen within the confines of
* this {@link ImageView.ScaleType}.
*
* @param scaleType - The desired scaling mode.
*/ | Controls how the image should be resized or moved to match the size of the ImageView. Any scaling or panning will happen within the confines of this <code>ImageView.ScaleType</code> | setScaleType | {
"repo_name": "bangqu/eshow-android",
"path": "photoslib/src/main/java/com/bangqu/photos/widget/IPhotoView.java",
"license": "apache-2.0",
"size": 4000
} | [
"android.widget.ImageView"
] | import android.widget.ImageView; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,377,627 |
void snapToTargetExistingView() {
if (mRecyclerView == null) {
return;
}
RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager();
if (layoutManager == null) {
return;
}
View snapView = findSnapView(layoutManager);
if (snapView == null) {
return;
}
int[] snapDistance = calculateDistanceToFinalSnap(layoutManager, snapView);
if (snapDistance[0] != 0 || snapDistance[1] != 0) {
mRecyclerView.smoothScrollBy(snapDistance[0], snapDistance[1]);
}
} | void snapToTargetExistingView() { if (mRecyclerView == null) { return; } RecyclerView.LayoutManager layoutManager = mRecyclerView.getLayoutManager(); if (layoutManager == null) { return; } View snapView = findSnapView(layoutManager); if (snapView == null) { return; } int[] snapDistance = calculateDistanceToFinalSnap(layoutManager, snapView); if (snapDistance[0] != 0 snapDistance[1] != 0) { mRecyclerView.smoothScrollBy(snapDistance[0], snapDistance[1]); } } | /**
* Snaps to a target view which currently exists in the attached {@link RecyclerView}. This
* method is used to snap the view when the {@link RecyclerView} is first attached; when
* snapping was triggered by a scroll and when the fling is at its final stages.
*/ | Snaps to a target view which currently exists in the attached <code>RecyclerView</code>. This method is used to snap the view when the <code>RecyclerView</code> is first attached; when snapping was triggered by a scroll and when the fling is at its final stages | snapToTargetExistingView | {
"repo_name": "hanhailong/GridPagerSnapHelper",
"path": "gridpagersnaphelper/src/main/java/com/hhl/gridpagersnaphelper/SnapHelper.java",
"license": "apache-2.0",
"size": 10995
} | [
"android.support.v7.widget.RecyclerView",
"android.view.View"
] | import android.support.v7.widget.RecyclerView; import android.view.View; | import android.support.v7.widget.*; import android.view.*; | [
"android.support",
"android.view"
] | android.support; android.view; | 2,347,869 |
private static int[][][] compileMultiplicationIndirection(final int parameters, final int order,
final DSCompiler valueCompiler,
final DSCompiler derivativeCompiler,
final int[] lowerIndirection) {
if ((parameters == 0) || (order == 0)) {
return new int[][][] { { { 1, 0, 0 } } };
}
// this is an implementation of definition 3 in Dan Kalman's paper.
final int vSize = valueCompiler.multIndirection.length;
final int dSize = derivativeCompiler.multIndirection.length;
final int[][][] multIndirection = new int[vSize + dSize][][];
System.arraycopy(valueCompiler.multIndirection, 0, multIndirection, 0, vSize);
for (int i = 0; i < dSize; ++i) {
final int[][] dRow = derivativeCompiler.multIndirection[i];
List<int[]> row = new ArrayList<>(dRow.length * 2);
for (int j = 0; j < dRow.length; ++j) {
row.add(new int[] { dRow[j][0], lowerIndirection[dRow[j][1]], vSize + dRow[j][2] });
row.add(new int[] { dRow[j][0], vSize + dRow[j][1], lowerIndirection[dRow[j][2]] });
}
// combine terms with similar derivation orders
final List<int[]> combined = new ArrayList<>(row.size());
for (int j = 0; j < row.size(); ++j) {
final int[] termJ = row.get(j);
if (termJ[0] > 0) {
for (int k = j + 1; k < row.size(); ++k) {
final int[] termK = row.get(k);
if (termJ[1] == termK[1] && termJ[2] == termK[2]) {
// combine termJ and termK
termJ[0] += termK[0];
// make sure we will skip termK later on in the outer loop
termK[0] = 0;
}
}
combined.add(termJ);
}
}
multIndirection[vSize + i] = combined.toArray(new int[combined.size()][]);
}
return multIndirection;
} | static int[][][] function(final int parameters, final int order, final DSCompiler valueCompiler, final DSCompiler derivativeCompiler, final int[] lowerIndirection) { if ((parameters == 0) (order == 0)) { return new int[][][] { { { 1, 0, 0 } } }; } final int vSize = valueCompiler.multIndirection.length; final int dSize = derivativeCompiler.multIndirection.length; final int[][][] multIndirection = new int[vSize + dSize][][]; System.arraycopy(valueCompiler.multIndirection, 0, multIndirection, 0, vSize); for (int i = 0; i < dSize; ++i) { final int[][] dRow = derivativeCompiler.multIndirection[i]; List<int[]> row = new ArrayList<>(dRow.length * 2); for (int j = 0; j < dRow.length; ++j) { row.add(new int[] { dRow[j][0], lowerIndirection[dRow[j][1]], vSize + dRow[j][2] }); row.add(new int[] { dRow[j][0], vSize + dRow[j][1], lowerIndirection[dRow[j][2]] }); } final List<int[]> combined = new ArrayList<>(row.size()); for (int j = 0; j < row.size(); ++j) { final int[] termJ = row.get(j); if (termJ[0] > 0) { for (int k = j + 1; k < row.size(); ++k) { final int[] termK = row.get(k); if (termJ[1] == termK[1] && termJ[2] == termK[2]) { termJ[0] += termK[0]; termK[0] = 0; } } combined.add(termJ); } } multIndirection[vSize + i] = combined.toArray(new int[combined.size()][]); } return multIndirection; } | /** Compile the multiplication indirection array.
* <p>
* This indirection array contains the indices of all pairs of elements
* involved when computing a multiplication. This allows a straightforward
* loop-based multiplication (see {@link #multiply(double[], int, double[], int, double[], int)}).
* </p>
* @param parameters number of free parameters
* @param order derivation order
* @param valueCompiler compiler for the value part
* @param derivativeCompiler compiler for the derivative part
* @param lowerIndirection lower derivatives indirection array
* @return multiplication indirection array
*/ | Compile the multiplication indirection array. This indirection array contains the indices of all pairs of elements involved when computing a multiplication. This allows a straightforward loop-based multiplication (see <code>#multiply(double[], int, double[], int, double[], int)</code>). | compileMultiplicationIndirection | {
"repo_name": "virtualdataset/metagen-java",
"path": "virtdata-lib-curves4/src/main/java/org/apache/commons/math4/analysis/differentiation/DSCompiler.java",
"license": "apache-2.0",
"size": 78787
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 566,832 |
public void delete(UserInfo userInfo, String id) throws DatastoreException, UnauthorizedException, NotFoundException;
| void function(UserInfo userInfo, String id) throws DatastoreException, UnauthorizedException, NotFoundException; | /**
* Delete an invitation
*
* @param userInfo
* @param id
* @throws DatastoreException
* @throws UnauthorizedException
* @throws NotFoundException
*/ | Delete an invitation | delete | {
"repo_name": "xschildw/Synapse-Repository-Services",
"path": "services/repository-managers/src/main/java/org/sagebionetworks/repo/manager/team/MembershipInvitationManager.java",
"license": "apache-2.0",
"size": 5092
} | [
"org.sagebionetworks.repo.model.DatastoreException",
"org.sagebionetworks.repo.model.UnauthorizedException",
"org.sagebionetworks.repo.model.UserInfo",
"org.sagebionetworks.repo.web.NotFoundException"
] | import org.sagebionetworks.repo.model.DatastoreException; import org.sagebionetworks.repo.model.UnauthorizedException; import org.sagebionetworks.repo.model.UserInfo; import org.sagebionetworks.repo.web.NotFoundException; | import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.web.*; | [
"org.sagebionetworks.repo"
] | org.sagebionetworks.repo; | 2,300,163 |
public VNode addNode(VNode node) throws VlException
{
return null;
} | VNode function(VNode node) throws VlException { return null; } | /**
* Adds (Sub) Cluster to the registry.
*/ | Adds (Sub) Cluster to the registry | addNode | {
"repo_name": "skoulouzis/vlet-1.5.0",
"path": "source/core/nl.uva.vlet.vrs.core/source/main/nl/uva/vlet/vrms/Cluster.java",
"license": "apache-2.0",
"size": 7102
} | [
"nl.uva.vlet.exception.VlException",
"nl.uva.vlet.vrs.VNode"
] | import nl.uva.vlet.exception.VlException; import nl.uva.vlet.vrs.VNode; | import nl.uva.vlet.exception.*; import nl.uva.vlet.vrs.*; | [
"nl.uva.vlet"
] | nl.uva.vlet; | 2,590,085 |
@POST
@Path("/saveCompanyBasicInfo")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
public Response saveCompanyBasicInfo(@Context HttpServletRequest request,
@Context final HttpServletResponse response,
@FormParam("user") final String user,
@FormParam("password") final String password,
@FormParam("portalURL") final String portalURL,
@FormParam("mx") final String mx,
@FormParam("emailAddress") final String emailAddress,
@FormParam("size") final String backgroundColor,
@FormParam("type") final String primaryColor,
@FormParam("street") final String secondaryColor,
@FormParam("homeURL") final String homeURL,
@FormParam("city") final String loginLogo,
@FormParam("state") String navLogo) throws IOException, JSONException {
InitDataObject initData = webResource.init( "user/" + user + "/password/" + password, request, response, true, PortletID.CONFIGURATION.toString() );
//Nav Logo Feature is not for Community level license
if(LicenseUtil.getLevel() == LicenseLevel.COMMUNITY.level && UtilMethods.isSet(navLogo)){
Logger.warn(this,"NavLogo Feature is only for Enterprise Edition");
navLogo = StringPool.BLANK;
}
Map<String, String> paramsMap = initData.getParamsMap();
paramsMap.put( "portalURL", portalURL );
paramsMap.put( "mx", mx );
paramsMap.put( "emailAddress", emailAddress );
paramsMap.put( "size", backgroundColor );
paramsMap.put("type", primaryColor);
paramsMap.put("street", secondaryColor);
paramsMap.put( "homeURL", homeURL );
paramsMap.put("city",loginLogo);
paramsMap.put("state",navLogo);
ResourceResponse responseResource = new ResourceResponse( paramsMap );
StringBuilder responseMessage = new StringBuilder();
//Validate the parameters
if ( !responseResource.validate( responseMessage, "portalURL", "emailAddress", "size","type","street" ) ) {
return responseResource.responseError( responseMessage.toString(), HttpStatus.SC_BAD_REQUEST );
}
try {
ConfigurationHelper.INSTANCE.parseMailAndSender(emailAddress);
} catch (IllegalArgumentException iae){
return responseResource.responseError( iae.getMessage(), HttpStatus.SC_BAD_REQUEST );
}
try {
PrincipalThreadLocal.setName( initData.getUser().getUserId() );
//Getting the current company
final Company currentCompany = APILocator.getCompanyAPI().getDefaultCompany();
//Set the values
currentCompany.setPortalURL( portalURL );
currentCompany.setMx( mx );
currentCompany.setEmailAddress( emailAddress );
currentCompany.setSize( backgroundColor );
currentCompany.setType(primaryColor);
currentCompany.setStreet(secondaryColor);
currentCompany.setHomeURL( homeURL );
currentCompany.setCity(loginLogo);
currentCompany.setState(navLogo);
//Update the company
CompanyManagerUtil.updateCompany( currentCompany );
//And prepare the response
JSONObject jsonResponse = new JSONObject();
jsonResponse.put( "success", true );
jsonResponse.put( "message", LanguageUtil.get( initData.getUser().getLocale(), "you-have-successfully-updated-the-company-profile" ) );
responseMessage.append( jsonResponse.toString() );
} catch ( Exception e ) {
Logger.error( this.getClass(), "Error saving basic information for current company.", e );
if ( e.getMessage() != null ) {
responseMessage.append( e.getMessage() );
} else {
responseMessage.append( "Error saving basic information for current company." );
}
return responseResource.responseError( responseMessage.toString() );
} finally {
// Clear the principal associated with this thread
PrincipalThreadLocal.setName( null );
}
return responseResource.response( responseMessage.toString() );
} | @Path(STR) @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_FORM_URLENCODED) Response function(@Context HttpServletRequest request, @Context final HttpServletResponse response, @FormParam("user") final String user, @FormParam(STR) final String password, @FormParam(STR) final String portalURL, @FormParam("mx") final String mx, @FormParam(STR) final String emailAddress, @FormParam("size") final String backgroundColor, @FormParam("type") final String primaryColor, @FormParam(STR) final String secondaryColor, @FormParam(STR) final String homeURL, @FormParam("city") final String loginLogo, @FormParam("state") String navLogo) throws IOException, JSONException { InitDataObject initData = webResource.init( "user/" + user + STR + password, request, response, true, PortletID.CONFIGURATION.toString() ); if(LicenseUtil.getLevel() == LicenseLevel.COMMUNITY.level && UtilMethods.isSet(navLogo)){ Logger.warn(this,STR); navLogo = StringPool.BLANK; } Map<String, String> paramsMap = initData.getParamsMap(); paramsMap.put( STR, portalURL ); paramsMap.put( "mx", mx ); paramsMap.put( STR, emailAddress ); paramsMap.put( "size", backgroundColor ); paramsMap.put("type", primaryColor); paramsMap.put(STR, secondaryColor); paramsMap.put( STR, homeURL ); paramsMap.put("city",loginLogo); paramsMap.put("state",navLogo); ResourceResponse responseResource = new ResourceResponse( paramsMap ); StringBuilder responseMessage = new StringBuilder(); if ( !responseResource.validate( responseMessage, STR, STR, "size","type",STR ) ) { return responseResource.responseError( responseMessage.toString(), HttpStatus.SC_BAD_REQUEST ); } try { ConfigurationHelper.INSTANCE.parseMailAndSender(emailAddress); } catch (IllegalArgumentException iae){ return responseResource.responseError( iae.getMessage(), HttpStatus.SC_BAD_REQUEST ); } try { PrincipalThreadLocal.setName( initData.getUser().getUserId() ); final Company currentCompany = APILocator.getCompanyAPI().getDefaultCompany(); currentCompany.setPortalURL( portalURL ); currentCompany.setMx( mx ); currentCompany.setEmailAddress( emailAddress ); currentCompany.setSize( backgroundColor ); currentCompany.setType(primaryColor); currentCompany.setStreet(secondaryColor); currentCompany.setHomeURL( homeURL ); currentCompany.setCity(loginLogo); currentCompany.setState(navLogo); CompanyManagerUtil.updateCompany( currentCompany ); JSONObject jsonResponse = new JSONObject(); jsonResponse.put( STR, true ); jsonResponse.put( STR, LanguageUtil.get( initData.getUser().getLocale(), STR ) ); responseMessage.append( jsonResponse.toString() ); } catch ( Exception e ) { Logger.error( this.getClass(), STR, e ); if ( e.getMessage() != null ) { responseMessage.append( e.getMessage() ); } else { responseMessage.append( STR ); } return responseResource.responseError( responseMessage.toString() ); } finally { PrincipalThreadLocal.setName( null ); } return responseResource.response( responseMessage.toString() ); } | /**
* Updates some given basic information to the current company, this method will be call it from the CMS Config portlet
*
* @param request
* @param user
* @param password
* @param portalURL
* @param mx
* @param emailAddress
* @param backgroundColor this one is the Background Color
* @param primaryColor this one is the Primary Color
* @param secondaryColor this one is the Secondary Color
* @param homeURL
* @param loginLogo dotAsset Path of the logo showed at the login screen
* @paramnavLogo dotAsset Path of the logo showed at the nav bar
* @return
* @throws IOException
* @throws JSONException
*/ | Updates some given basic information to the current company, this method will be call it from the CMS Config portlet | saveCompanyBasicInfo | {
"repo_name": "dotCMS/core",
"path": "dotCMS/src/main/java/com/dotcms/rest/CMSConfigResource.java",
"license": "gpl-3.0",
"size": 25101
} | [
"com.dotcms.enterprise.LicenseUtil",
"com.dotcms.enterprise.license.LicenseLevel",
"com.dotcms.repackage.org.apache.commons.httpclient.HttpStatus",
"com.dotcms.rest.api.v1.system.ConfigurationHelper",
"com.dotmarketing.business.APILocator",
"com.dotmarketing.util.Logger",
"com.dotmarketing.util.PortletID",
"com.dotmarketing.util.UtilMethods",
"com.dotmarketing.util.json.JSONException",
"com.dotmarketing.util.json.JSONObject",
"com.liferay.portal.auth.PrincipalThreadLocal",
"com.liferay.portal.ejb.CompanyManagerUtil",
"com.liferay.portal.language.LanguageUtil",
"com.liferay.portal.model.Company",
"com.liferay.util.StringPool",
"java.io.IOException",
"java.util.Map",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse",
"javax.ws.rs.Consumes",
"javax.ws.rs.FormParam",
"javax.ws.rs.Path",
"javax.ws.rs.Produces",
"javax.ws.rs.core.Context",
"javax.ws.rs.core.MediaType",
"javax.ws.rs.core.Response"
] | import com.dotcms.enterprise.LicenseUtil; import com.dotcms.enterprise.license.LicenseLevel; import com.dotcms.repackage.org.apache.commons.httpclient.HttpStatus; import com.dotcms.rest.api.v1.system.ConfigurationHelper; import com.dotmarketing.business.APILocator; import com.dotmarketing.util.Logger; import com.dotmarketing.util.PortletID; import com.dotmarketing.util.UtilMethods; import com.dotmarketing.util.json.JSONException; import com.dotmarketing.util.json.JSONObject; import com.liferay.portal.auth.PrincipalThreadLocal; import com.liferay.portal.ejb.CompanyManagerUtil; import com.liferay.portal.language.LanguageUtil; import com.liferay.portal.model.Company; import com.liferay.util.StringPool; import java.io.IOException; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.ws.rs.Consumes; import javax.ws.rs.FormParam; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Context; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; | import com.dotcms.enterprise.*; import com.dotcms.enterprise.license.*; import com.dotcms.repackage.org.apache.commons.httpclient.*; import com.dotcms.rest.api.v1.system.*; import com.dotmarketing.business.*; import com.dotmarketing.util.*; import com.dotmarketing.util.json.*; import com.liferay.portal.auth.*; import com.liferay.portal.ejb.*; import com.liferay.portal.language.*; import com.liferay.portal.model.*; import com.liferay.util.*; import java.io.*; import java.util.*; import javax.servlet.http.*; import javax.ws.rs.*; import javax.ws.rs.core.*; | [
"com.dotcms.enterprise",
"com.dotcms.repackage",
"com.dotcms.rest",
"com.dotmarketing.business",
"com.dotmarketing.util",
"com.liferay.portal",
"com.liferay.util",
"java.io",
"java.util",
"javax.servlet",
"javax.ws"
] | com.dotcms.enterprise; com.dotcms.repackage; com.dotcms.rest; com.dotmarketing.business; com.dotmarketing.util; com.liferay.portal; com.liferay.util; java.io; java.util; javax.servlet; javax.ws; | 2,746,152 |
private static ISms getISmsServiceOrThrow() {
ISms iccISms = getISmsService();
if (iccISms == null) {
throw new UnsupportedOperationException("Sms is not supported");
}
return iccISms;
} | static ISms function() { ISms iccISms = getISmsService(); if (iccISms == null) { throw new UnsupportedOperationException(STR); } return iccISms; } | /**
* Returns the ISms service, or throws an UnsupportedOperationException if
* the service does not exist.
*/ | Returns the ISms service, or throws an UnsupportedOperationException if the service does not exist | getISmsServiceOrThrow | {
"repo_name": "syslover33/ctank",
"path": "java/android-sdk-linux_r24.4.1_src/sources/android-23/android/telephony/SmsManager.java",
"license": "gpl-3.0",
"size": 69171
} | [
"com.android.internal.telephony.ISms"
] | import com.android.internal.telephony.ISms; | import com.android.internal.telephony.*; | [
"com.android.internal"
] | com.android.internal; | 561,527 |
@Test
public final void returnFalseInHasNextValueOnEmptyList() {
MatcherAssert.assertThat(
new VerboseIterable<String>(
Collections.<String>emptyList(),
"Non used Error Message"
).iterator().hasNext(),
Matchers.equalTo(false)
);
} | final void function() { MatcherAssert.assertThat( new VerboseIterable<String>( Collections.<String>emptyList(), STR ).iterator().hasNext(), Matchers.equalTo(false) ); } | /**
* VerboseIterator returns false in has next value on empty list.
*/ | VerboseIterator returns false in has next value on empty list | returnFalseInHasNextValueOnEmptyList | {
"repo_name": "dalifreire/takes",
"path": "src/test/java/org/takes/misc/VerboseIteratorTest.java",
"license": "mit",
"size": 4137
} | [
"java.util.Collections",
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import java.util.Collections; import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import java.util.*; import org.hamcrest.*; | [
"java.util",
"org.hamcrest"
] | java.util; org.hamcrest; | 226,700 |
public String resolveThemeName(HttpServletRequest request)
{
String theme = request.getParameter(THEME_PARAMETER_NAME);
if (theme != null)
return theme;
return DEFAULT_THEME;
} | String function(HttpServletRequest request) { String theme = request.getParameter(THEME_PARAMETER_NAME); if (theme != null) return theme; return DEFAULT_THEME; } | /**
* Resolve the current theme name via the given request based on a 'theme=' parameter.
* Returns 'default' if not theme specified.
*
* @param request request to be used for resolution
* @return the current theme name
*/ | Resolve the current theme name via the given request based on a 'theme=' parameter. Returns 'default' if not theme specified | resolveThemeName | {
"repo_name": "0x006EA1E5/oo6",
"path": "src/main/java/org/otherobjects/cms/theme/OoThemeResolver.java",
"license": "gpl-3.0",
"size": 2386
} | [
"javax.servlet.http.HttpServletRequest"
] | import javax.servlet.http.HttpServletRequest; | import javax.servlet.http.*; | [
"javax.servlet"
] | javax.servlet; | 1,855,565 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.