method
stringlengths 13
441k
| clean_method
stringlengths 7
313k
| doc
stringlengths 17
17.3k
| comment
stringlengths 3
1.42k
| method_name
stringlengths 1
273
| extra
dict | imports
list | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
list | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
|---|---|---|---|---|---|---|---|---|---|---|---|
public void diff_cleanupSemantic(LinkedList<Diff> diffs) {
if (diffs.isEmpty()) {
return;
}
boolean changes = false;
Stack<Diff> equalities = new Stack<Diff>(); // Stack of qualities.
String lastequality = null; // Always equal to equalities.lastElement().text
ListIterator<Diff> pointer = diffs.listIterator();
// Number of characters that changed prior to the equality.
int length_changes1 = 0;
// Number of characters that changed after the equality.
int length_changes2 = 0;
Diff thisDiff = pointer.next();
while (thisDiff != null) {
if (thisDiff.operation == Operation.EQUAL) {
// equality found
equalities.push(thisDiff);
length_changes1 = length_changes2;
length_changes2 = 0;
lastequality = thisDiff.text;
} else {
// an insertion or deletion
length_changes2 += thisDiff.text.length();
if (lastequality != null && (lastequality.length() <= length_changes1)
&& (lastequality.length() <= length_changes2)) {
//System.out.println("Splitting: '" + lastequality + "'");
// Walk back to offending equality.
while (thisDiff != equalities.lastElement()) {
thisDiff = pointer.previous();
}
pointer.next();
// Replace equality with a delete.
pointer.set(new Diff(Operation.DELETE, lastequality));
// Insert a corresponding an insert.
pointer.add(new Diff(Operation.INSERT, lastequality));
equalities.pop(); // Throw away the equality we just deleted.
if (!equalities.empty()) {
// Throw away the previous equality (it needs to be reevaluated).
equalities.pop();
}
if (equalities.empty()) {
// There are no previous equalities, walk back to the start.
while (pointer.hasPrevious()) {
pointer.previous();
}
} else {
// There is a safe equality we can fall back to.
thisDiff = equalities.lastElement();
while (thisDiff != pointer.previous()) {
// Intentionally empty loop.
}
}
length_changes1 = 0; // Reset the counters.
length_changes2 = 0;
lastequality = null;
changes = true;
}
}
thisDiff = pointer.hasNext() ? pointer.next() : null;
}
if (changes) {
diff_cleanupMerge(diffs);
}
diff_cleanupSemanticLossless(diffs);
}
|
void function(LinkedList<Diff> diffs) { if (diffs.isEmpty()) { return; } boolean changes = false; Stack<Diff> equalities = new Stack<Diff>(); String lastequality = null; ListIterator<Diff> pointer = diffs.listIterator(); int length_changes1 = 0; int length_changes2 = 0; Diff thisDiff = pointer.next(); while (thisDiff != null) { if (thisDiff.operation == Operation.EQUAL) { equalities.push(thisDiff); length_changes1 = length_changes2; length_changes2 = 0; lastequality = thisDiff.text; } else { length_changes2 += thisDiff.text.length(); if (lastequality != null && (lastequality.length() <= length_changes1) && (lastequality.length() <= length_changes2)) { while (thisDiff != equalities.lastElement()) { thisDiff = pointer.previous(); } pointer.next(); pointer.set(new Diff(Operation.DELETE, lastequality)); pointer.add(new Diff(Operation.INSERT, lastequality)); equalities.pop(); if (!equalities.empty()) { equalities.pop(); } if (equalities.empty()) { while (pointer.hasPrevious()) { pointer.previous(); } } else { thisDiff = equalities.lastElement(); while (thisDiff != pointer.previous()) { } } length_changes1 = 0; length_changes2 = 0; lastequality = null; changes = true; } } thisDiff = pointer.hasNext() ? pointer.next() : null; } if (changes) { diff_cleanupMerge(diffs); } diff_cleanupSemanticLossless(diffs); }
|
/**
* Reduce the number of edits by eliminating semantically trivial equalities.
* @param diffs LinkedList of Diff objects.
*/
|
Reduce the number of edits by eliminating semantically trivial equalities
|
diff_cleanupSemantic
|
{
"repo_name": "ZsZs/ProcessPuzzleCommons",
"path": "Implementation/DomainTier/Source/com/processpuzzle/commons/text/TextDifferencer.java",
"license": "agpl-3.0",
"size": 81623
}
|
[
"java.util.LinkedList",
"java.util.ListIterator",
"java.util.Stack"
] |
import java.util.LinkedList; import java.util.ListIterator; import java.util.Stack;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,792,109
|
@Test
public void testWriteV2ReadV1() throws Exception {
final File outputFile = this.testFolder.newFile();
RainbowFishSerializer.writeV2(V2, outputFile.getPath());
final RainbowFish fish = RainbowFishSerializer.readV1(outputFile.getPath());
assertNotSame(V2, fish);
assertEquals(V2.getName(), fish.getName());
assertEquals(V2.getAge(), fish.getAge());
assertEquals(V2.getLengthMeters(), fish.getLengthMeters());
assertEquals(V2.getWeightTons(), fish.getWeightTons());
}
|
void function() throws Exception { final File outputFile = this.testFolder.newFile(); RainbowFishSerializer.writeV2(V2, outputFile.getPath()); final RainbowFish fish = RainbowFishSerializer.readV1(outputFile.getPath()); assertNotSame(V2, fish); assertEquals(V2.getName(), fish.getName()); assertEquals(V2.getAge(), fish.getAge()); assertEquals(V2.getLengthMeters(), fish.getLengthMeters()); assertEquals(V2.getWeightTons(), fish.getWeightTons()); }
|
/**
* Verify if a fish, written as version 2 can be read back as version 1
*/
|
Verify if a fish, written as version 2 can be read back as version 1
|
testWriteV2ReadV1
|
{
"repo_name": "Crossy147/java-design-patterns",
"path": "tolerant-reader/src/test/java/com/iluwatar/tolerantreader/RainbowFishSerializerTest.java",
"license": "mit",
"size": 3161
}
|
[
"java.io.File",
"org.junit.Assert"
] |
import java.io.File; import org.junit.Assert;
|
import java.io.*; import org.junit.*;
|
[
"java.io",
"org.junit"
] |
java.io; org.junit;
| 612,341
|
@NonNull
public static float[] sizeToVertices(@NonNull Size size) {
return new float[]{0, 0, size.getWidth(), 0, size.getWidth(), size.getHeight(), 0,
size.getHeight()};
}
|
static float[] function(@NonNull Size size) { return new float[]{0, 0, size.getWidth(), 0, size.getWidth(), size.getHeight(), 0, size.getHeight()}; }
|
/**
* Converts a {@link Size} to a float array of vertices.
*/
|
Converts a <code>Size</code> to a float array of vertices
|
sizeToVertices
|
{
"repo_name": "AndroidX/androidx",
"path": "camera/camera-view/src/main/java/androidx/camera/view/TransformUtils.java",
"license": "apache-2.0",
"size": 11403
}
|
[
"android.util.Size",
"androidx.annotation.NonNull"
] |
import android.util.Size; import androidx.annotation.NonNull;
|
import android.util.*; import androidx.annotation.*;
|
[
"android.util",
"androidx.annotation"
] |
android.util; androidx.annotation;
| 316,496
|
QueryBuilder queryBuilder();
|
QueryBuilder queryBuilder();
|
/**
* Get the current query builder.
*
* @return
*/
|
Get the current query builder
|
queryBuilder
|
{
"repo_name": "alien4cloud/alien4cloud",
"path": "alien4cloud-dao/src/main/java/alien4cloud/dao/IESQueryBuilderHelper.java",
"license": "apache-2.0",
"size": 2577
}
|
[
"org.elasticsearch.index.query.QueryBuilder"
] |
import org.elasticsearch.index.query.QueryBuilder;
|
import org.elasticsearch.index.query.*;
|
[
"org.elasticsearch.index"
] |
org.elasticsearch.index;
| 457,159
|
void postModifyColumnHandler(
final ObserverContext<MasterCoprocessorEnvironment> ctx,
byte[] tableName, HColumnDescriptor descriptor) throws IOException;
|
void postModifyColumnHandler( final ObserverContext<MasterCoprocessorEnvironment> ctx, byte[] tableName, HColumnDescriptor descriptor) throws IOException;
|
/**
* Called after the column family has been updated. Called as part of modify
* column handler.
* @param ctx the environment to interact with the framework and master
* @param tableName the name of the table
* @param descriptor the HColumnDescriptor
*/
|
Called after the column family has been updated. Called as part of modify column handler
|
postModifyColumnHandler
|
{
"repo_name": "daidong/DominoHBase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/MasterObserver.java",
"license": "apache-2.0",
"size": 21042
}
|
[
"java.io.IOException",
"org.apache.hadoop.hbase.HColumnDescriptor"
] |
import java.io.IOException; import org.apache.hadoop.hbase.HColumnDescriptor;
|
import java.io.*; import org.apache.hadoop.hbase.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 459,976
|
@Override
public void compute(RandomAccessibleInterval<T> correction,
RandomAccessibleInterval<T> estimate)
{
// TODO: delte these lines when problem in initialization is fixed
if (mul == null) {
mul = Hybrids.binaryCF(ops(), IIToIIOutputII.Multiply.class, estimate,
correction, estimate);
}
mul.compute(estimate, correction, estimate);
}
|
void function(RandomAccessibleInterval<T> correction, RandomAccessibleInterval<T> estimate) { if (mul == null) { mul = Hybrids.binaryCF(ops(), IIToIIOutputII.Multiply.class, estimate, correction, estimate); } mul.compute(estimate, correction, estimate); }
|
/**
* performs update step of the Richardson Lucy Algorithm
*/
|
performs update step of the Richardson Lucy Algorithm
|
compute
|
{
"repo_name": "gab1one/imagej-ops",
"path": "src/main/java/net/imagej/ops/deconvolve/RichardsonLucyUpdate.java",
"license": "bsd-2-clause",
"size": 3454
}
|
[
"net.imagej.ops.math.IIToIIOutputII",
"net.imagej.ops.special.hybrid.Hybrids",
"net.imglib2.RandomAccessibleInterval"
] |
import net.imagej.ops.math.IIToIIOutputII; import net.imagej.ops.special.hybrid.Hybrids; import net.imglib2.RandomAccessibleInterval;
|
import net.imagej.ops.math.*; import net.imagej.ops.special.hybrid.*; import net.imglib2.*;
|
[
"net.imagej.ops",
"net.imglib2"
] |
net.imagej.ops; net.imglib2;
| 997,420
|
@ApiModelProperty(value = "The file atributes")
public Integer getAttributes() {
return attributes;
}
|
@ApiModelProperty(value = STR) Integer function() { return attributes; }
|
/**
* The file atributes
* @return attributes
**/
|
The file atributes
|
getAttributes
|
{
"repo_name": "iterate-ch/cyberduck",
"path": "storegate/src/main/java/ch/cyberduck/core/storegate/io/swagger/client/model/FileMetadata.java",
"license": "gpl-3.0",
"size": 7733
}
|
[
"io.swagger.annotations.ApiModelProperty"
] |
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.*;
|
[
"io.swagger.annotations"
] |
io.swagger.annotations;
| 1,654,302
|
public RefConstructor findConstructor(final int number) {
final List<Constructor> constructors = new ArrayList<>();
Collections.addAll(constructors, clazz.getConstructors());
Collections.addAll(constructors, clazz.getDeclaredConstructors());
for (final Constructor m : constructors) {
if (m.getParameterTypes().length == number) {
return new RefConstructor(m);
}
}
throw new RuntimeException("no such constructor");
}
|
RefConstructor function(final int number) { final List<Constructor> constructors = new ArrayList<>(); Collections.addAll(constructors, clazz.getConstructors()); Collections.addAll(constructors, clazz.getDeclaredConstructors()); for (final Constructor m : constructors) { if (m.getParameterTypes().length == number) { return new RefConstructor(m); } } throw new RuntimeException(STR); }
|
/**
* find constructor by number of arguments
*
* @param number number of arguments
*
* @return RefConstructor
*
* @throws RuntimeException if constructor not found
*/
|
find constructor by number of arguments
|
findConstructor
|
{
"repo_name": "Litss/PlotSquared",
"path": "src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java",
"license": "gpl-3.0",
"size": 23156
}
|
[
"java.lang.reflect.Constructor",
"java.util.ArrayList",
"java.util.Collections",
"java.util.List"
] |
import java.lang.reflect.Constructor; import java.util.ArrayList; import java.util.Collections; import java.util.List;
|
import java.lang.reflect.*; import java.util.*;
|
[
"java.lang",
"java.util"
] |
java.lang; java.util;
| 1,351,014
|
ProcessInstance startProcessInstanceByMessage(String messageName, Map<String, Object> processVariables);
|
ProcessInstance startProcessInstanceByMessage(String messageName, Map<String, Object> processVariables);
|
/**
* <p>
* Signals the process engine that a message is received and starts a new {@link ProcessInstance}.
* </p>
* <p>
* See {@link #startProcessInstanceByMessage(String)}. In addition, this method allows specifying a the payload of the message as a map of process variables.
*
* @param messageName
* the 'name' of the message as specified as an attribute on the bpmn20 {@code <message name="messageName" />} element.
* @param processVariables
* the 'payload' of the message. The variables are added as processes variables to the started process instance.
* @return the {@link ProcessInstance} object representing the started process instance
* @throws FlowableException
* if no subscription to a message with the given name exists
* @since 5.9
*/
|
Signals the process engine that a message is received and starts a new <code>ProcessInstance</code>. See <code>#startProcessInstanceByMessage(String)</code>. In addition, this method allows specifying a the payload of the message as a map of process variables
|
startProcessInstanceByMessage
|
{
"repo_name": "paulstapleton/flowable-engine",
"path": "modules/flowable-engine/src/main/java/org/flowable/engine/RuntimeService.java",
"license": "apache-2.0",
"size": 63251
}
|
[
"java.util.Map",
"org.flowable.engine.runtime.ProcessInstance"
] |
import java.util.Map; import org.flowable.engine.runtime.ProcessInstance;
|
import java.util.*; import org.flowable.engine.runtime.*;
|
[
"java.util",
"org.flowable.engine"
] |
java.util; org.flowable.engine;
| 177,214
|
@Override
public String getText(Object object) {
String label = ((BTSText)object).getName();
return label == null || label.length() == 0 ?
getString("_UI_BTSText_type") :
label;
}
|
String function(Object object) { String label = ((BTSText)object).getName(); return label == null label.length() == 0 ? getString(STR) : label; }
|
/**
* This returns the label text for the adapted class. <!-- begin-user-doc
* --> <!-- end-user-doc -->
*
* @generatedNOT
*/
|
This returns the label text for the adapted class.
|
getText
|
{
"repo_name": "JKatzwinkel/bts",
"path": "org.bbaw.bts.model.corpus.edit/src/org/bbaw/bts/corpus/btsCorpusModel/provider/BTSTextItemProvider.java",
"license": "lgpl-3.0",
"size": 6573
}
|
[
"org.bbaw.bts.corpus.btsCorpusModel.BTSText"
] |
import org.bbaw.bts.corpus.btsCorpusModel.BTSText;
|
import org.bbaw.bts.corpus.*;
|
[
"org.bbaw.bts"
] |
org.bbaw.bts;
| 2,827,952
|
public static <T> List<T> readFirstSheetFrom( InputStream inputStream, Class<T> toClass ) throws UncheckedIOException {
return getHandler().readFirstSheetFrom( inputStream, toClass );
}
|
static <T> List<T> function( InputStream inputStream, Class<T> toClass ) throws UncheckedIOException { return getHandler().readFirstSheetFrom( inputStream, toClass ); }
|
/**
* Read sheet from input stream
*
* @param inputStream input stream to read data
* @param toClass generic type of list's class
* @param <T> expected class of return
* @return grid data
* @throws UncheckedIOException File I/O Exception
*/
|
Read sheet from input stream
|
readFirstSheetFrom
|
{
"repo_name": "NyBatis/NyBatisCore",
"path": "src/main/java/org/nybatis/core/file/ExcelUtil.java",
"license": "apache-2.0",
"size": 15563
}
|
[
"java.io.InputStream",
"java.util.List",
"org.nybatis.core.exception.unchecked.UncheckedIOException"
] |
import java.io.InputStream; import java.util.List; import org.nybatis.core.exception.unchecked.UncheckedIOException;
|
import java.io.*; import java.util.*; import org.nybatis.core.exception.unchecked.*;
|
[
"java.io",
"java.util",
"org.nybatis.core"
] |
java.io; java.util; org.nybatis.core;
| 2,798,283
|
private StaffMemberEto privateFindStaffMemberByLogin(String login) {
return getBeanMapper().map(getStaffMemberDao().findByLogin(login), StaffMemberEto.class);
}
|
StaffMemberEto function(String login) { return getBeanMapper().map(getStaffMemberDao().findByLogin(login), StaffMemberEto.class); }
|
/**
* Do not extract this method as a service, because of PermitAll. (only for login)
*/
|
Do not extract this method as a service, because of PermitAll. (only for login)
|
privateFindStaffMemberByLogin
|
{
"repo_name": "hendrik1287/tp-off-oasp4j",
"path": "oasp4j-samples/oasp4j-sample-core/src/main/java/io/oasp/gastronomy/restaurant/staffmanagement/logic/impl/StaffmanagementImpl.java",
"license": "apache-2.0",
"size": 5317
}
|
[
"io.oasp.gastronomy.restaurant.staffmanagement.logic.api.to.StaffMemberEto"
] |
import io.oasp.gastronomy.restaurant.staffmanagement.logic.api.to.StaffMemberEto;
|
import io.oasp.gastronomy.restaurant.staffmanagement.logic.api.to.*;
|
[
"io.oasp.gastronomy"
] |
io.oasp.gastronomy;
| 1,962,004
|
@Override
public String getLogicalDefinitionChronologyReport(StampFilter stampFilter,
PremiseType premiseType,
LogicCoordinate logicCoordinate) {
int assemblageSequence;
if (premiseType == PremiseType.INFERRED) {
assemblageSequence = logicCoordinate.getInferredAssemblageNid();
} else {
assemblageSequence = logicCoordinate.getStatedAssemblageNid();
}
final Optional<SemanticChronology> definitionChronologyOptional = Get.assemblageService()
.getSemanticChronologyStreamForComponentFromAssemblage(getNid(), assemblageSequence, false).findFirst();
if (definitionChronologyOptional.isPresent()) {
final List<LogicGraphVersionImpl> versions =
definitionChronologyOptional.get().getVisibleOrderedVersionList(stampFilter);
// Collection<LogicGraphSemanticImpl> versionsList = new ArrayList<>();
// for (LogicGraphVersionImpl lgs : definitionChronologyOptional.get().getVisibleOrderedVersionList(stampCoordinate)) {
//
// }
final StringBuilder builder = new StringBuilder();
builder.append("_______________________________________________________________________\n");
builder.append(" Encountered concept '")
.append(Get.conceptDescriptionText(getNid()))
.append("' with ")
.append(versions.size())
.append(" definition versions:\n");
builder.append(" ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\n");
int version = 0;
LogicalExpression previousVersion = null;
for (final LogicGraphVersionImpl lgmv: versions) {
final LogicalExpression lg = lgmv.getLogicalExpression();
builder.append(" Version ")
.append(version++)
.append("\n")
.append(Get.stampService()
.describeStampSequence(lgmv.getStampSequence()))
.append("\n");
if (previousVersion == null) {
builder.append(lg);
} else {
builder.append(lg.findIsomorphisms(previousVersion));
}
builder.append("_______________________________________________________________________\n");
previousVersion = lg;
}
builder.append(" ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄ ̄\n");
return builder.toString();
}
return "No definition found. ";
}
|
String function(StampFilter stampFilter, PremiseType premiseType, LogicCoordinate logicCoordinate) { int assemblageSequence; if (premiseType == PremiseType.INFERRED) { assemblageSequence = logicCoordinate.getInferredAssemblageNid(); } else { assemblageSequence = logicCoordinate.getStatedAssemblageNid(); } final Optional<SemanticChronology> definitionChronologyOptional = Get.assemblageService() .getSemanticChronologyStreamForComponentFromAssemblage(getNid(), assemblageSequence, false).findFirst(); if (definitionChronologyOptional.isPresent()) { final List<LogicGraphVersionImpl> versions = definitionChronologyOptional.get().getVisibleOrderedVersionList(stampFilter); final StringBuilder builder = new StringBuilder(); builder.append(STR); builder.append(STR) .append(Get.conceptDescriptionText(getNid())) .append(STR) .append(versions.size()) .append(STR); builder.append(STR); int version = 0; LogicalExpression previousVersion = null; for (final LogicGraphVersionImpl lgmv: versions) { final LogicalExpression lg = lgmv.getLogicalExpression(); builder.append(STR) .append(version++) .append("\n") .append(Get.stampService() .describeStampSequence(lgmv.getStampSequence())) .append("\n"); if (previousVersion == null) { builder.append(lg); } else { builder.append(lg.findIsomorphisms(previousVersion)); } builder.append(STR); previousVersion = lg; } builder.append(STR); return builder.toString(); } return STR; }
|
/**
* Gets the logical definition chronology report.
*
* @param stampFilter the stamp coordinate
* @param premiseType the premise type
* @param logicCoordinate the logic coordinate
* @return the logical definition chronology report
*/
|
Gets the logical definition chronology report
|
getLogicalDefinitionChronologyReport
|
{
"repo_name": "OSEHRA/ISAAC",
"path": "core/model/src/main/java/sh/isaac/model/concept/ConceptChronologyImpl.java",
"license": "apache-2.0",
"size": 15446
}
|
[
"java.util.List",
"java.util.Optional",
"sh.isaac.api.Get",
"sh.isaac.api.component.semantic.SemanticChronology",
"sh.isaac.api.coordinate.LogicCoordinate",
"sh.isaac.api.coordinate.PremiseType",
"sh.isaac.api.coordinate.StampFilter",
"sh.isaac.api.logic.LogicalExpression",
"sh.isaac.model.semantic.version.LogicGraphVersionImpl"
] |
import java.util.List; import java.util.Optional; import sh.isaac.api.Get; import sh.isaac.api.component.semantic.SemanticChronology; import sh.isaac.api.coordinate.LogicCoordinate; import sh.isaac.api.coordinate.PremiseType; import sh.isaac.api.coordinate.StampFilter; import sh.isaac.api.logic.LogicalExpression; import sh.isaac.model.semantic.version.LogicGraphVersionImpl;
|
import java.util.*; import sh.isaac.api.*; import sh.isaac.api.component.semantic.*; import sh.isaac.api.coordinate.*; import sh.isaac.api.logic.*; import sh.isaac.model.semantic.version.*;
|
[
"java.util",
"sh.isaac.api",
"sh.isaac.model"
] |
java.util; sh.isaac.api; sh.isaac.model;
| 2,414,738
|
public void addCellListener(CellListener listener)
{
if (listener != null)
myCellListeners.add(listener);
}
|
void function(CellListener listener) { if (listener != null) myCellListeners.add(listener); }
|
/**
* Registers the given <code>CellListener</code>.
* @param listener A <code>CellListener</code>.
*/
|
Registers the given <code>CellListener</code>
|
addCellListener
|
{
"repo_name": "rmage/gnvc-ims",
"path": "java/net/sf/jett/transform/ExcelTransformer.java",
"license": "lgpl-3.0",
"size": 27387
}
|
[
"net.sf.jett.event.CellListener"
] |
import net.sf.jett.event.CellListener;
|
import net.sf.jett.event.*;
|
[
"net.sf.jett"
] |
net.sf.jett;
| 1,374,719
|
public static String encodeForRFC5597(String text) {
try {
return "utf-8''" + URLEncoder.encode(text, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
}
|
static String function(String text) { try { return STR + URLEncoder.encode(text, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
|
/**
* Encode the given text to conform to RFC 5597.
*
* @param text
* @return
*/
|
Encode the given text to conform to RFC 5597
|
encodeForRFC5597
|
{
"repo_name": "gentics/mesh",
"path": "api/src/main/java/com/gentics/mesh/util/EncodeUtil.java",
"license": "apache-2.0",
"size": 3556
}
|
[
"java.io.UnsupportedEncodingException",
"java.net.URLEncoder"
] |
import java.io.UnsupportedEncodingException; import java.net.URLEncoder;
|
import java.io.*; import java.net.*;
|
[
"java.io",
"java.net"
] |
java.io; java.net;
| 544,996
|
protected void doUser(final OutputStream output, final String args) throws IOException {
println(output, "230 User logged in, proceed.");
}
|
void function(final OutputStream output, final String args) throws IOException { println(output, STR); }
|
/**
* Sends response to USER control command.
*
* @param output output to write response
* @param args arguments, ignored
* @throws IOException socket IO exception
*/
|
Sends response to USER control command
|
doUser
|
{
"repo_name": "kokorin/Jaffree",
"path": "src/main/java/com/github/kokorin/jaffree/net/FtpServer.java",
"license": "apache-2.0",
"size": 14169
}
|
[
"java.io.IOException",
"java.io.OutputStream"
] |
import java.io.IOException; import java.io.OutputStream;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,519,129
|
@Override
public void onEnable() {
messagingLib = this;
messageRegistry = new MessageRegistry();
messageManager = new BungeeCordMessageManager();
messageReceiver = new MessageReceiver();
messageRegistry.registerMessage( new IPMessage() );
messageRegistry.registerMessage( new PlayerCountMessage() );
messageRegistry.registerMessage( new GetServersMessage() );
getProxy().getPluginManager().registerListener( this, messageReceiver );
getLogger().info( "Starting to register plugin channels" );
this.registerChannels();
getLogger().info( "Registered plugin channels" );
}
|
void function() { messagingLib = this; messageRegistry = new MessageRegistry(); messageManager = new BungeeCordMessageManager(); messageReceiver = new MessageReceiver(); messageRegistry.registerMessage( new IPMessage() ); messageRegistry.registerMessage( new PlayerCountMessage() ); messageRegistry.registerMessage( new GetServersMessage() ); getProxy().getPluginManager().registerListener( this, messageReceiver ); getLogger().info( STR ); this.registerChannels(); getLogger().info( STR ); }
|
/**
* Called when the plugin is enabling.
*/
|
Called when the plugin is enabling
|
onEnable
|
{
"repo_name": "devtmxx/MessagingLib",
"path": "messaging-lib-bungeecord/src/main/java/net/tmxx/messaginglib/MessagingLib.java",
"license": "gpl-3.0",
"size": 3151
}
|
[
"net.tmxx.messaginglib.core.message.MessageRegistry",
"net.tmxx.messaginglib.core.message.bungeecord.GetServersMessage",
"net.tmxx.messaginglib.core.message.bungeecord.IPMessage",
"net.tmxx.messaginglib.core.message.bungeecord.PlayerCountMessage",
"net.tmxx.messaginglib.receiver.MessageReceiver"
] |
import net.tmxx.messaginglib.core.message.MessageRegistry; import net.tmxx.messaginglib.core.message.bungeecord.GetServersMessage; import net.tmxx.messaginglib.core.message.bungeecord.IPMessage; import net.tmxx.messaginglib.core.message.bungeecord.PlayerCountMessage; import net.tmxx.messaginglib.receiver.MessageReceiver;
|
import net.tmxx.messaginglib.core.message.*; import net.tmxx.messaginglib.core.message.bungeecord.*; import net.tmxx.messaginglib.receiver.*;
|
[
"net.tmxx.messaginglib"
] |
net.tmxx.messaginglib;
| 897,952
|
protected XmlResourceType getXmlResourceType(CollectionAgent agent, String resourceType) {
if (!m_resourceTypeList.containsKey(resourceType)) {
ResourceType rt = DataCollectionConfigFactory.getInstance().getConfiguredResourceTypes().get(resourceType);
if (rt == null) {
log().debug("getXmlResourceType: using default XML resource type strategy.");
rt = new ResourceType();
rt.setName(resourceType);
rt.setStorageStrategy(new StorageStrategy());
rt.getStorageStrategy().setClazz(XmlStorageStrategy.class.getName());
rt.setPersistenceSelectorStrategy(new PersistenceSelectorStrategy());
rt.getPersistenceSelectorStrategy().setClazz(PersistAllSelectorStrategy.class.getName());
}
XmlResourceType type = new XmlResourceType(agent, rt);
m_resourceTypeList.put(resourceType, type);
}
return m_resourceTypeList.get(resourceType);
}
|
XmlResourceType function(CollectionAgent agent, String resourceType) { if (!m_resourceTypeList.containsKey(resourceType)) { ResourceType rt = DataCollectionConfigFactory.getInstance().getConfiguredResourceTypes().get(resourceType); if (rt == null) { log().debug(STR); rt = new ResourceType(); rt.setName(resourceType); rt.setStorageStrategy(new StorageStrategy()); rt.getStorageStrategy().setClazz(XmlStorageStrategy.class.getName()); rt.setPersistenceSelectorStrategy(new PersistenceSelectorStrategy()); rt.getPersistenceSelectorStrategy().setClazz(PersistAllSelectorStrategy.class.getName()); } XmlResourceType type = new XmlResourceType(agent, rt); m_resourceTypeList.put(resourceType, type); } return m_resourceTypeList.get(resourceType); }
|
/**
* Gets the XML resource type.
*
* @param agent the collection agent
* @param resourceType the resource type
* @return the XML resource type
*/
|
Gets the XML resource type
|
getXmlResourceType
|
{
"repo_name": "RangerRick/opennms",
"path": "protocols/xml/src/main/java/org/opennms/protocols/xml/collector/AbstractXmlCollectionHandler.java",
"license": "gpl-2.0",
"size": 15062
}
|
[
"org.opennms.netmgt.collectd.CollectionAgent",
"org.opennms.netmgt.collectd.PersistAllSelectorStrategy",
"org.opennms.netmgt.config.DataCollectionConfigFactory",
"org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy",
"org.opennms.netmgt.config.datacollection.ResourceType",
"org.opennms.netmgt.config.datacollection.StorageStrategy"
] |
import org.opennms.netmgt.collectd.CollectionAgent; import org.opennms.netmgt.collectd.PersistAllSelectorStrategy; import org.opennms.netmgt.config.DataCollectionConfigFactory; import org.opennms.netmgt.config.datacollection.PersistenceSelectorStrategy; import org.opennms.netmgt.config.datacollection.ResourceType; import org.opennms.netmgt.config.datacollection.StorageStrategy;
|
import org.opennms.netmgt.collectd.*; import org.opennms.netmgt.config.*; import org.opennms.netmgt.config.datacollection.*;
|
[
"org.opennms.netmgt"
] |
org.opennms.netmgt;
| 2,680,473
|
public static String toString(Readable r) throws IOException {
return toStringBuilder(r).toString();
}
|
static String function(Readable r) throws IOException { return toStringBuilder(r).toString(); }
|
/**
* Reads all characters from a {@link Readable} object into a {@link String}.
* Does not close the {@code Readable}.
*
* @param r the object to read from
* @return a string containing all the characters
* @throws IOException if an I/O error occurs
*/
|
Reads all characters from a <code>Readable</code> object into a <code>String</code>. Does not close the Readable
|
toString
|
{
"repo_name": "maxvetrenko/guava-libraries-17-0",
"path": "guava/src/com/google/common/io/CharStreams.java",
"license": "apache-2.0",
"size": 19794
}
|
[
"java.io.IOException"
] |
import java.io.IOException;
|
import java.io.*;
|
[
"java.io"
] |
java.io;
| 1,097,253
|
private void configureComponentsBeforeBuilding(final AnalysisJobBuilder jobBuilder, final int partitionNumber) {
// update datastores and resource properties to point to node-specific
// targets if possible. This way parallel writing to files on HDFS does
// not cause any inconsistencies because each node is writing to a
// separate file.
for (final ComponentBuilder cb : jobBuilder.getComponentBuilders()) {
// find any datastore properties that point to HDFS files
final Set<ConfiguredPropertyDescriptor> targetDatastoreProperties =
cb.getDescriptor().getConfiguredPropertiesByType(UpdateableDatastore.class, false);
for (final ConfiguredPropertyDescriptor targetDatastoreProperty : targetDatastoreProperties) {
final Object datastoreObject = cb.getConfiguredProperty(targetDatastoreProperty);
if (datastoreObject instanceof ResourceDatastore) {
final ResourceDatastore resourceDatastore = (ResourceDatastore) datastoreObject;
final Resource resource = resourceDatastore.getResource();
final Resource replacementResource = createReplacementResource(resource, partitionNumber);
if (replacementResource != null) {
final ResourceDatastore replacementDatastore =
createReplacementDatastore(cb, resourceDatastore, replacementResource);
if (replacementDatastore != null) {
cb.setConfiguredProperty(targetDatastoreProperty, replacementDatastore);
}
}
}
}
final Set<ConfiguredPropertyDescriptor> resourceProperties =
cb.getDescriptor().getConfiguredPropertiesByType(Resource.class, false);
for (final ConfiguredPropertyDescriptor resourceProperty : resourceProperties) {
final Resource resource = (Resource) cb.getConfiguredProperty(resourceProperty);
final Resource replacementResource = createReplacementResource(resource, partitionNumber);
if (replacementResource != null) {
cb.setConfiguredProperty(resourceProperty, replacementResource);
}
}
// special handlings of specific component types are handled here
if (cb.getComponentInstance() instanceof CreateCsvFileAnalyzer) {
if (partitionNumber > 0) {
// ensure header is only created once
cb.setConfiguredProperty(CreateCsvFileAnalyzer.PROPERTY_INCLUDE_HEADER, false);
}
}
}
// recursively apply this function also on output data stream jobs
final List<AnalysisJobBuilder> children = jobBuilder.getConsumedOutputDataStreamsJobBuilders();
for (final AnalysisJobBuilder childJobBuilder : children) {
configureComponentsBeforeBuilding(childJobBuilder, partitionNumber);
}
}
|
void function(final AnalysisJobBuilder jobBuilder, final int partitionNumber) { for (final ComponentBuilder cb : jobBuilder.getComponentBuilders()) { final Set<ConfiguredPropertyDescriptor> targetDatastoreProperties = cb.getDescriptor().getConfiguredPropertiesByType(UpdateableDatastore.class, false); for (final ConfiguredPropertyDescriptor targetDatastoreProperty : targetDatastoreProperties) { final Object datastoreObject = cb.getConfiguredProperty(targetDatastoreProperty); if (datastoreObject instanceof ResourceDatastore) { final ResourceDatastore resourceDatastore = (ResourceDatastore) datastoreObject; final Resource resource = resourceDatastore.getResource(); final Resource replacementResource = createReplacementResource(resource, partitionNumber); if (replacementResource != null) { final ResourceDatastore replacementDatastore = createReplacementDatastore(cb, resourceDatastore, replacementResource); if (replacementDatastore != null) { cb.setConfiguredProperty(targetDatastoreProperty, replacementDatastore); } } } } final Set<ConfiguredPropertyDescriptor> resourceProperties = cb.getDescriptor().getConfiguredPropertiesByType(Resource.class, false); for (final ConfiguredPropertyDescriptor resourceProperty : resourceProperties) { final Resource resource = (Resource) cb.getConfiguredProperty(resourceProperty); final Resource replacementResource = createReplacementResource(resource, partitionNumber); if (replacementResource != null) { cb.setConfiguredProperty(resourceProperty, replacementResource); } } if (cb.getComponentInstance() instanceof CreateCsvFileAnalyzer) { if (partitionNumber > 0) { cb.setConfiguredProperty(CreateCsvFileAnalyzer.PROPERTY_INCLUDE_HEADER, false); } } } final List<AnalysisJobBuilder> children = jobBuilder.getConsumedOutputDataStreamsJobBuilders(); for (final AnalysisJobBuilder childJobBuilder : children) { configureComponentsBeforeBuilding(childJobBuilder, partitionNumber); } }
|
/**
* Applies any partition-specific configuration to the job builder before
* building it.
*
* @param jobBuilder
* @param partitionNumber
*/
|
Applies any partition-specific configuration to the job builder before building it
|
configureComponentsBeforeBuilding
|
{
"repo_name": "datacleaner/DataCleaner",
"path": "engine/env/spark/src/main/java/org/datacleaner/spark/functions/RowProcessingFunction.java",
"license": "lgpl-3.0",
"size": 14661
}
|
[
"java.util.List",
"java.util.Set",
"org.apache.metamodel.util.Resource",
"org.datacleaner.connection.ResourceDatastore",
"org.datacleaner.connection.UpdateableDatastore",
"org.datacleaner.descriptors.ConfiguredPropertyDescriptor",
"org.datacleaner.extension.output.CreateCsvFileAnalyzer",
"org.datacleaner.job.builder.AnalysisJobBuilder",
"org.datacleaner.job.builder.ComponentBuilder"
] |
import java.util.List; import java.util.Set; import org.apache.metamodel.util.Resource; import org.datacleaner.connection.ResourceDatastore; import org.datacleaner.connection.UpdateableDatastore; import org.datacleaner.descriptors.ConfiguredPropertyDescriptor; import org.datacleaner.extension.output.CreateCsvFileAnalyzer; import org.datacleaner.job.builder.AnalysisJobBuilder; import org.datacleaner.job.builder.ComponentBuilder;
|
import java.util.*; import org.apache.metamodel.util.*; import org.datacleaner.connection.*; import org.datacleaner.descriptors.*; import org.datacleaner.extension.output.*; import org.datacleaner.job.builder.*;
|
[
"java.util",
"org.apache.metamodel",
"org.datacleaner.connection",
"org.datacleaner.descriptors",
"org.datacleaner.extension",
"org.datacleaner.job"
] |
java.util; org.apache.metamodel; org.datacleaner.connection; org.datacleaner.descriptors; org.datacleaner.extension; org.datacleaner.job;
| 771,332
|
public void removeAll2(final Collection<?> outCollection) {
synchronized (models) {
models.removeAll(outCollection);
}
}
/**
* Quits this queue after it sleeps for the {@link #modelSaveCheckTime}
|
void function(final Collection<?> outCollection) { synchronized (models) { models.removeAll(outCollection); } } /** * Quits this queue after it sleeps for the {@link #modelSaveCheckTime}
|
/**
* Removes a {@link java.util.Collection} of DB objects from this queue
* before it is processed.
*/
|
Removes a <code>java.util.Collection</code> of DB objects from this queue before it is processed
|
removeAll2
|
{
"repo_name": "mickele/DBFlow",
"path": "dbflow/src/main/java/com/raizlabs/android/dbflow/runtime/DBBatchSaveQueue.java",
"license": "mit",
"size": 7740
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 589,550
|
public Location getFrom() {
return this.from;
}
|
Location function() { return this.from; }
|
/**
* Get the from location
*
* @return Location
*/
|
Get the from location
|
getFrom
|
{
"repo_name": "Mayomi/PlotSquared-Chinese",
"path": "src/main/java/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java",
"license": "gpl-3.0",
"size": 3725
}
|
[
"com.intellectualcrafters.plot.object.Location"
] |
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.*;
|
[
"com.intellectualcrafters.plot"
] |
com.intellectualcrafters.plot;
| 1,977,173
|
List<String> listTaskIdsForSelectedItems(
List<SelectedItem> selectedItems, TaskTimestamp timestamp)
throws NotAuthorizedException, InvalidArgumentException;
|
List<String> listTaskIdsForSelectedItems( List<SelectedItem> selectedItems, TaskTimestamp timestamp) throws NotAuthorizedException, InvalidArgumentException;
|
/**
* Returns a list of all taskIds of the report that are in the list of selected items.
*
* @param selectedItems a list of selectedItems
* @param timestamp the task timestamp of interest
* @return the list of all taskIds
* @throws InvalidArgumentException if the column headers are not initialized
* @throws NotAuthorizedException if the user has no rights to access the monitor
*/
|
Returns a list of all taskIds of the report that are in the list of selected items
|
listTaskIdsForSelectedItems
|
{
"repo_name": "Taskana/taskana",
"path": "lib/taskana-core/src/main/java/pro/taskana/monitor/api/reports/TimeIntervalReportBuilder.java",
"license": "apache-2.0",
"size": 7084
}
|
[
"java.util.List",
"pro.taskana.common.api.exceptions.InvalidArgumentException",
"pro.taskana.common.api.exceptions.NotAuthorizedException",
"pro.taskana.monitor.api.SelectedItem",
"pro.taskana.monitor.api.TaskTimestamp"
] |
import java.util.List; import pro.taskana.common.api.exceptions.InvalidArgumentException; import pro.taskana.common.api.exceptions.NotAuthorizedException; import pro.taskana.monitor.api.SelectedItem; import pro.taskana.monitor.api.TaskTimestamp;
|
import java.util.*; import pro.taskana.common.api.exceptions.*; import pro.taskana.monitor.api.*;
|
[
"java.util",
"pro.taskana.common",
"pro.taskana.monitor"
] |
java.util; pro.taskana.common; pro.taskana.monitor;
| 2,767,094
|
@Test()
public void testObjectClassNotAllowed()
{
final SchemaValidator schemaValidator = new SchemaValidator();
assertEquals(schemaValidator.getAllowedSchemaElementTypes(),
EnumSet.allOf(SchemaElementType.class));
final Set<SchemaElementType> allowedElementTypes =
EnumSet.allOf(SchemaElementType.class);
allowedElementTypes.remove(SchemaElementType.OBJECT_CLASS);
schemaValidator.setAllowedSchemaElementTypes(allowedElementTypes);
assertEquals(schemaValidator.getAllowedSchemaElementTypes(),
allowedElementTypes);
final List<String> errorMessages = new ArrayList<>(5);
final Schema schema =
schemaValidator.validateSchema(minimalSchemaFile, null, errorMessages);
assertNotNull(schema);
assertNotNull(schema.getAttributeType("dc"));
assertFalse(errorMessages.isEmpty());
}
|
@Test() void function() { final SchemaValidator schemaValidator = new SchemaValidator(); assertEquals(schemaValidator.getAllowedSchemaElementTypes(), EnumSet.allOf(SchemaElementType.class)); final Set<SchemaElementType> allowedElementTypes = EnumSet.allOf(SchemaElementType.class); allowedElementTypes.remove(SchemaElementType.OBJECT_CLASS); schemaValidator.setAllowedSchemaElementTypes(allowedElementTypes); assertEquals(schemaValidator.getAllowedSchemaElementTypes(), allowedElementTypes); final List<String> errorMessages = new ArrayList<>(5); final Schema schema = schemaValidator.validateSchema(minimalSchemaFile, null, errorMessages); assertNotNull(schema); assertNotNull(schema.getAttributeType("dc")); assertFalse(errorMessages.isEmpty()); }
|
/**
* Tests the behavior for a schema entry that has object class definitions
* when they are not allowed.
*/
|
Tests the behavior for a schema entry that has object class definitions when they are not allowed
|
testObjectClassNotAllowed
|
{
"repo_name": "UnboundID/ldapsdk",
"path": "tests/unit/src/com/unboundid/ldap/sdk/schema/SchemaValidatorTestCase.java",
"license": "gpl-2.0",
"size": 262381
}
|
[
"java.util.ArrayList",
"java.util.EnumSet",
"java.util.List",
"java.util.Set",
"org.testng.annotations.Test"
] |
import java.util.ArrayList; import java.util.EnumSet; import java.util.List; import java.util.Set; import org.testng.annotations.Test;
|
import java.util.*; import org.testng.annotations.*;
|
[
"java.util",
"org.testng.annotations"
] |
java.util; org.testng.annotations;
| 932,304
|
public ExtensionDependenciesPane openDependenciesSection()
{
WebElement section = clickTab("Dependencies");
return section != null ? new ExtensionDependenciesPane(section) : null;
}
|
ExtensionDependenciesPane function() { WebElement section = clickTab(STR); return section != null ? new ExtensionDependenciesPane(section) : null; }
|
/**
* Selects the extension dependencies tab.
*
* @return the extension dependencies section
*/
|
Selects the extension dependencies tab
|
openDependenciesSection
|
{
"repo_name": "xwiki/xwiki-platform",
"path": "xwiki-platform-core/xwiki-platform-extension/xwiki-platform-extension-test/xwiki-platform-extension-test-pageobjects/src/main/java/org/xwiki/extension/test/po/ExtensionPane.java",
"license": "lgpl-2.1",
"size": 14780
}
|
[
"org.openqa.selenium.WebElement"
] |
import org.openqa.selenium.WebElement;
|
import org.openqa.selenium.*;
|
[
"org.openqa.selenium"
] |
org.openqa.selenium;
| 1,341,949
|
public void removeAppService(AuthzSubject caller, Integer appId, Integer appServiceId) throws ApplicationException,
ApplicationNotFoundException, PermissionException;
|
void function(AuthzSubject caller, Integer appId, Integer appServiceId) throws ApplicationException, ApplicationNotFoundException, PermissionException;
|
/**
* Remove an application service.
* @param caller - Valid spider subject of caller.
* @param appId - The application identifier.
* @param appServiceId - The service identifier
* @throws ApplicationException when unable to perform remove
* @throws ApplicationNotFoundException - when the app can't be found
* @throws PermissionException - when caller is not authorized to remove.
*/
|
Remove an application service
|
removeAppService
|
{
"repo_name": "cc14514/hq6",
"path": "hq-server/src/main/java/org/hyperic/hq/appdef/shared/ApplicationManager.java",
"license": "unlicense",
"size": 8029
}
|
[
"org.hyperic.hq.authz.server.session.AuthzSubject",
"org.hyperic.hq.authz.shared.PermissionException",
"org.hyperic.hq.common.ApplicationException"
] |
import org.hyperic.hq.authz.server.session.AuthzSubject; import org.hyperic.hq.authz.shared.PermissionException; import org.hyperic.hq.common.ApplicationException;
|
import org.hyperic.hq.authz.server.session.*; import org.hyperic.hq.authz.shared.*; import org.hyperic.hq.common.*;
|
[
"org.hyperic.hq"
] |
org.hyperic.hq;
| 2,586,696
|
public double getAverageRating() {
double sum = 0;
Collection<Rating> ratings = getRatings().values();
for (Rating rating : ratings) {
sum += rating.getAverageRating();
}
return (sum / ratings.size());
}
|
double function() { double sum = 0; Collection<Rating> ratings = getRatings().values(); for (Rating rating : ratings) { sum += rating.getAverageRating(); } return (sum / ratings.size()); }
|
/**
* Get the average rating of the plot
* @return average rating as double
*/
|
Get the average rating of the plot
|
getAverageRating
|
{
"repo_name": "PiLogic/PlotSquared",
"path": "src/main/java/com/intellectualcrafters/plot/object/Plot.java",
"license": "gpl-3.0",
"size": 28745
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,797,853
|
private int[] readArr(Scanner scr) {
String line = scr.nextLine().trim();
String[] data = line.split(" ");
int[] ret = new int[data.length];
for (int i = 0; i < ret.length; i++) {
ret[i] = Integer.parseInt(data[i]);
}
return ret;
}
|
int[] function(Scanner scr) { String line = scr.nextLine().trim(); String[] data = line.split(" "); int[] ret = new int[data.length]; for (int i = 0; i < ret.length; i++) { ret[i] = Integer.parseInt(data[i]); } return ret; }
|
/**
* Read in an int array of coefficients
*
* @param scr - Scanner to read form
* @return
*/
|
Read in an int array of coefficients
|
readArr
|
{
"repo_name": "midkiffj/knapsacks",
"path": "src/Problems/Unconstrained.java",
"license": "gpl-3.0",
"size": 7789
}
|
[
"java.util.Scanner"
] |
import java.util.Scanner;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,734,144
|
static ImmutableList<String> parseRequirecssAttr(@Nullable String requirecssAttr,
SourceLocation srcLoc) {
if (requirecssAttr == null) {
return ImmutableList.of();
}
String[] namespaces = requirecssAttr.trim().split("\\s*,\\s*");
for (String namespace : namespaces) {
if (!BaseUtils.isDottedIdentifier(namespace)) {
throw LegacyInternalSyntaxException.createWithMetaInfo(
"Invalid required CSS namespace name \"" + namespace + "\".", srcLoc);
}
}
return ImmutableList.copyOf(namespaces);
}
|
static ImmutableList<String> parseRequirecssAttr(@Nullable String requirecssAttr, SourceLocation srcLoc) { if (requirecssAttr == null) { return ImmutableList.of(); } String[] namespaces = requirecssAttr.trim().split(STR); for (String namespace : namespaces) { if (!BaseUtils.isDottedIdentifier(namespace)) { throw LegacyInternalSyntaxException.createWithMetaInfo( STRSTR\".", srcLoc); } } return ImmutableList.copyOf(namespaces); }
|
/**
* Parses a 'requirecss' attribute value (for a Soy file or a template).
*
* @param requirecssAttr The 'requirecss' attribute value to parse.
* @return A list of required CSS namespaces parsed from the given attribute value.
*/
|
Parses a 'requirecss' attribute value (for a Soy file or a template)
|
parseRequirecssAttr
|
{
"repo_name": "nathancomstock/closure-templates",
"path": "java/src/com/google/template/soy/soytree/RequirecssUtils.java",
"license": "apache-2.0",
"size": 1918
}
|
[
"com.google.common.collect.ImmutableList",
"com.google.template.soy.base.SourceLocation",
"com.google.template.soy.base.internal.BaseUtils",
"com.google.template.soy.base.internal.LegacyInternalSyntaxException",
"javax.annotation.Nullable"
] |
import com.google.common.collect.ImmutableList; import com.google.template.soy.base.SourceLocation; import com.google.template.soy.base.internal.BaseUtils; import com.google.template.soy.base.internal.LegacyInternalSyntaxException; import javax.annotation.Nullable;
|
import com.google.common.collect.*; import com.google.template.soy.base.*; import com.google.template.soy.base.internal.*; import javax.annotation.*;
|
[
"com.google.common",
"com.google.template",
"javax.annotation"
] |
com.google.common; com.google.template; javax.annotation;
| 251,303
|
public okhttp3.Call listNamespacedHorizontalPodAutoscalerAsync(
String namespace,
String pretty,
Boolean allowWatchBookmarks,
String _continue,
String fieldSelector,
String labelSelector,
Integer limit,
String resourceVersion,
String resourceVersionMatch,
Integer timeoutSeconds,
Boolean watch,
final ApiCallback<V2HorizontalPodAutoscalerList> _callback)
throws ApiException {
okhttp3.Call localVarCall =
listNamespacedHorizontalPodAutoscalerValidateBeforeCall(
namespace,
pretty,
allowWatchBookmarks,
_continue,
fieldSelector,
labelSelector,
limit,
resourceVersion,
resourceVersionMatch,
timeoutSeconds,
watch,
_callback);
Type localVarReturnType = new TypeToken<V2HorizontalPodAutoscalerList>() {}.getType();
localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
return localVarCall;
}
|
okhttp3.Call function( String namespace, String pretty, Boolean allowWatchBookmarks, String _continue, String fieldSelector, String labelSelector, Integer limit, String resourceVersion, String resourceVersionMatch, Integer timeoutSeconds, Boolean watch, final ApiCallback<V2HorizontalPodAutoscalerList> _callback) throws ApiException { okhttp3.Call localVarCall = listNamespacedHorizontalPodAutoscalerValidateBeforeCall( namespace, pretty, allowWatchBookmarks, _continue, fieldSelector, labelSelector, limit, resourceVersion, resourceVersionMatch, timeoutSeconds, watch, _callback); Type localVarReturnType = new TypeToken<V2HorizontalPodAutoscalerList>() {}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; }
|
/**
* (asynchronously) list or watch objects of kind HorizontalPodAutoscaler
*
* @param namespace object name and auth scope, such as for teams and projects (required)
* @param pretty If 'true', then the output is pretty printed. (optional)
* @param allowWatchBookmarks allowWatchBookmarks requests watch events with type
* \"BOOKMARK\". Servers that do not implement bookmarks may ignore this flag and
* bookmarks are sent at the server's discretion. Clients should not assume bookmarks are
* returned at any specific interval, nor may they assume the server will send any BOOKMARK
* event during a session. If this is not a watch, this field is ignored. (optional)
* @param _continue The continue option should be set when retrieving more results from the
* server. Since this value is server defined, clients may only use the continue value from a
* previous query result with identical query parameters (except for the value of continue)
* and the server may reject a continue value it does not recognize. If the specified continue
* value is no longer valid whether due to expiration (generally five to fifteen minutes) or a
* configuration change on the server, the server will respond with a 410 ResourceExpired
* error together with a continue token. If the client needs a consistent list, it must
* restart their list without the continue field. Otherwise, the client may send another list
* request with the token received with the 410 error, the server will respond with a list
* starting from the next key, but from the latest snapshot, which is inconsistent from the
* previous list results - objects that are created, modified, or deleted after the first list
* request will be included in the response, as long as their keys are after the \"next
* key\". This field is not supported when watch is true. Clients may start a watch from
* the last resourceVersion value returned by the server and not miss any modifications.
* (optional)
* @param fieldSelector A selector to restrict the list of returned objects by their fields.
* Defaults to everything. (optional)
* @param labelSelector A selector to restrict the list of returned objects by their labels.
* Defaults to everything. (optional)
* @param limit limit is a maximum number of responses to return for a list call. If more items
* exist, the server will set the `continue` field on the list metadata to a value
* that can be used with the same initial query to retrieve the next set of results. Setting a
* limit may return fewer than the requested amount of items (up to zero items) in the event
* all requested objects are filtered out and clients should only use the presence of the
* continue field to determine whether more results are available. Servers may choose not to
* support the limit argument and will return all of the available results. If limit is
* specified and the continue field is empty, clients may assume that no more results are
* available. This field is not supported if watch is true. The server guarantees that the
* objects returned when using continue will be identical to issuing a single list call
* without a limit - that is, no objects created, modified, or deleted after the first request
* is issued will be included in any subsequent continued requests. This is sometimes referred
* to as a consistent snapshot, and ensures that a client that is using limit to receive
* smaller chunks of a very large result can ensure they see all possible objects. If objects
* are updated during a chunked list the version of the object that was present at the time
* the first list result was calculated is returned. (optional)
* @param resourceVersion resourceVersion sets a constraint on what resource versions a request
* may be served from. See
* https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.
* Defaults to unset (optional)
* @param resourceVersionMatch resourceVersionMatch determines how resourceVersion is applied to
* list calls. It is highly recommended that resourceVersionMatch be set for list calls where
* resourceVersion is set See
* https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions for details.
* Defaults to unset (optional)
* @param timeoutSeconds Timeout for the list/watch call. This limits the duration of the call,
* regardless of any activity or inactivity. (optional)
* @param watch Watch for changes to the described resources and return them as a stream of add,
* update, and remove notifications. Specify resourceVersion. (optional)
* @param _callback The callback to be executed when the API call finishes
* @return The request call
* @throws ApiException If fail to process the API call, e.g. serializing the request body object
* @http.response.details
* <table summary="Response Details" border="1">
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 200 </td><td> OK </td><td> - </td></tr>
* <tr><td> 401 </td><td> Unauthorized </td><td> - </td></tr>
* </table>
*/
|
(asynchronously) list or watch objects of kind HorizontalPodAutoscaler
|
listNamespacedHorizontalPodAutoscalerAsync
|
{
"repo_name": "kubernetes-client/java",
"path": "kubernetes/src/main/java/io/kubernetes/client/openapi/apis/AutoscalingV2Api.java",
"license": "apache-2.0",
"size": 203946
}
|
[
"com.google.gson.reflect.TypeToken",
"io.kubernetes.client.openapi.ApiCallback",
"io.kubernetes.client.openapi.ApiException",
"io.kubernetes.client.openapi.models.V2HorizontalPodAutoscalerList",
"java.lang.reflect.Type"
] |
import com.google.gson.reflect.TypeToken; import io.kubernetes.client.openapi.ApiCallback; import io.kubernetes.client.openapi.ApiException; import io.kubernetes.client.openapi.models.V2HorizontalPodAutoscalerList; import java.lang.reflect.Type;
|
import com.google.gson.reflect.*; import io.kubernetes.client.openapi.*; import io.kubernetes.client.openapi.models.*; import java.lang.reflect.*;
|
[
"com.google.gson",
"io.kubernetes.client",
"java.lang"
] |
com.google.gson; io.kubernetes.client; java.lang;
| 403,502
|
@Override
public boolean isValid(AnnotatedTypeMirror type, Tree tree) {
AnnotationMirror classVal = type.getAnnotation(ClassVal.class);
classVal = classVal == null ? type.getAnnotation(ClassBound.class)
: classVal;
if (classVal != null) {
List<String> classNames = getClassNamesFromAnnotation(classVal);
for (String className : classNames) {
if (!isLegalClassName(className)) {
checker.report(
Result.failure("illegal.classname", className, type), tree);
}
}
}
return super.isValid(type, tree);
}
|
boolean function(AnnotatedTypeMirror type, Tree tree) { AnnotationMirror classVal = type.getAnnotation(ClassVal.class); classVal = classVal == null ? type.getAnnotation(ClassBound.class) : classVal; if (classVal != null) { List<String> classNames = getClassNamesFromAnnotation(classVal); for (String className : classNames) { if (!isLegalClassName(className)) { checker.report( Result.failure(STR, className, type), tree); } } } return super.isValid(type, tree); }
|
/**
* Reports an "illegal.classname" error if the type contains a classVal
* annotation with classNames that cannot possibly be valid class
* annotations.
*/
|
Reports an "illegal.classname" error if the type contains a classVal annotation with classNames that cannot possibly be valid class annotations
|
isValid
|
{
"repo_name": "biddyweb/checker-framework",
"path": "framework/src/org/checkerframework/common/reflection/ClassValVisitor.java",
"license": "gpl-2.0",
"size": 3892
}
|
[
"com.sun.source.tree.Tree",
"java.util.List",
"javax.lang.model.element.AnnotationMirror",
"org.checkerframework.common.reflection.ClassValAnnotatedTypeFactory",
"org.checkerframework.common.reflection.qual.ClassBound",
"org.checkerframework.common.reflection.qual.ClassVal",
"org.checkerframework.framework.source.Result",
"org.checkerframework.framework.type.AnnotatedTypeMirror"
] |
import com.sun.source.tree.Tree; import java.util.List; import javax.lang.model.element.AnnotationMirror; import org.checkerframework.common.reflection.ClassValAnnotatedTypeFactory; import org.checkerframework.common.reflection.qual.ClassBound; import org.checkerframework.common.reflection.qual.ClassVal; import org.checkerframework.framework.source.Result; import org.checkerframework.framework.type.AnnotatedTypeMirror;
|
import com.sun.source.tree.*; import java.util.*; import javax.lang.model.element.*; import org.checkerframework.common.reflection.*; import org.checkerframework.common.reflection.qual.*; import org.checkerframework.framework.source.*; import org.checkerframework.framework.type.*;
|
[
"com.sun.source",
"java.util",
"javax.lang",
"org.checkerframework.common",
"org.checkerframework.framework"
] |
com.sun.source; java.util; javax.lang; org.checkerframework.common; org.checkerframework.framework;
| 1,912,351
|
List<TeamModel> getAllTeams();
|
List<TeamModel> getAllTeams();
|
/**
* Returns the list of all teams available to the login service.
*
* @return list of all teams
* @since 0.8.0
*/
|
Returns the list of all teams available to the login service
|
getAllTeams
|
{
"repo_name": "heavenlyhash/gitblit",
"path": "src/main/java/com/gitblit/IUserService.java",
"license": "apache-2.0",
"size": 7855
}
|
[
"com.gitblit.models.TeamModel",
"java.util.List"
] |
import com.gitblit.models.TeamModel; import java.util.List;
|
import com.gitblit.models.*; import java.util.*;
|
[
"com.gitblit.models",
"java.util"
] |
com.gitblit.models; java.util;
| 1,140,237
|
Logger getLogger();
|
Logger getLogger();
|
/**
* Returns the logger for this script. You can use this in your script to write log messages.
*
* @return The logger. Never returns null.
*/
|
Returns the logger for this script. You can use this in your script to write log messages
|
getLogger
|
{
"repo_name": "tkmnet/RCRS-ADF",
"path": "gradle/gradle-2.1/src/core/org/gradle/api/Script.java",
"license": "bsd-2-clause",
"size": 14585
}
|
[
"org.gradle.api.logging.Logger"
] |
import org.gradle.api.logging.Logger;
|
import org.gradle.api.logging.*;
|
[
"org.gradle.api"
] |
org.gradle.api;
| 2,337,066
|
@Generated
@Selector("topic")
public native String topic();
|
@Selector("topic") native String function();
|
/**
* Topic associated with this context.
* <p>
* See above for valid, predefined topics.
*/
|
Topic associated with this context. See above for valid, predefined topics
|
topic
|
{
"repo_name": "multi-os-engine/moe-core",
"path": "moe.apple/moe.platform.ios/src/main/java/apple/classkit/CLSContext.java",
"license": "apache-2.0",
"size": 22699
}
|
[
"org.moe.natj.objc.ann.Selector"
] |
import org.moe.natj.objc.ann.Selector;
|
import org.moe.natj.objc.ann.*;
|
[
"org.moe.natj"
] |
org.moe.natj;
| 2,466,452
|
@Test
public void checkCopying() {
// Local declarations
LWReactor object;
LWReactor copyObject = new LWReactor(0), clonedObject;
int size = 5;
// Setup root object
object = new LWReactor(size);
// Run the copy routine
copyObject = new LWReactor(0);
copyObject.copy(object);
// Check contents
assertTrue(object.equals(copyObject));
// Run the clone routine
clonedObject = (LWReactor) object.clone();
// Check contents
assertTrue(object.equals(clonedObject));
// Pass null for the copy routine
copyObject.copy(null);
// Show that nothing as changed
assertTrue(object.equals(copyObject));
}
|
void function() { LWReactor object; LWReactor copyObject = new LWReactor(0), clonedObject; int size = 5; object = new LWReactor(size); copyObject = new LWReactor(0); copyObject.copy(object); assertTrue(object.equals(copyObject)); clonedObject = (LWReactor) object.clone(); assertTrue(object.equals(clonedObject)); copyObject.copy(null); assertTrue(object.equals(copyObject)); }
|
/**
* <p>
* This operation checks the copy and clone routines.
* </p>
*
*/
|
This operation checks the copy and clone routines.
|
checkCopying
|
{
"repo_name": "SmithRWORNL/ice",
"path": "tests/org.eclipse.ice.reactor.test/src/org/eclipse/ice/reactor/test/LWReactorTester.java",
"license": "epl-1.0",
"size": 16145
}
|
[
"org.eclipse.ice.reactor.LWReactor",
"org.junit.Assert"
] |
import org.eclipse.ice.reactor.LWReactor; import org.junit.Assert;
|
import org.eclipse.ice.reactor.*; import org.junit.*;
|
[
"org.eclipse.ice",
"org.junit"
] |
org.eclipse.ice; org.junit;
| 2,537,868
|
private JsonNode json(Collection<BgpSession> bgpSessions) {
ObjectMapper mapper = new ObjectMapper();
ArrayNode result = mapper.createArrayNode();
for (BgpSession bgpSession : bgpSessions) {
result.add(json(mapper, bgpSession));
}
return result;
}
|
JsonNode function(Collection<BgpSession> bgpSessions) { ObjectMapper mapper = new ObjectMapper(); ArrayNode result = mapper.createArrayNode(); for (BgpSession bgpSession : bgpSessions) { result.add(json(mapper, bgpSession)); } return result; }
|
/**
* Produces a JSON array of BGP neighbors.
*
* @param bgpSessions the BGP sessions with the data
* @return JSON array with the neighbors
*/
|
Produces a JSON array of BGP neighbors
|
json
|
{
"repo_name": "sdnwiselab/onos",
"path": "apps/routing/common/src/main/java/org/onosproject/routing/cli/BgpNeighborsListCommand.java",
"license": "apache-2.0",
"size": 7864
}
|
[
"com.fasterxml.jackson.databind.JsonNode",
"com.fasterxml.jackson.databind.ObjectMapper",
"com.fasterxml.jackson.databind.node.ArrayNode",
"java.util.Collection",
"org.onosproject.routing.bgp.BgpSession"
] |
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; import java.util.Collection; import org.onosproject.routing.bgp.BgpSession;
|
import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.node.*; import java.util.*; import org.onosproject.routing.bgp.*;
|
[
"com.fasterxml.jackson",
"java.util",
"org.onosproject.routing"
] |
com.fasterxml.jackson; java.util; org.onosproject.routing;
| 1,881,609
|
public static Matchable asMatchable(Object toCoerce){
return As.asMatchable(toCoerce);
}
/**
* Create a duck typed Monad wrapper. Using AnyM we focus only on the underlying type
* e.g. instead of
* <pre>
* {@code
* Monad<Stream<Integer>,Integer> stream;
*
* we can write
*
* AnyM<Integer> stream;
* }</pre>
*
* The wrapped Monaad should have equivalent methods for
*
* <pre>
* {@code
* map(F f)
*
* flatMap(F<x,MONAD> fm)
*
* and optionally
*
* filter(P p)
* }
|
static Matchable function(Object toCoerce){ return As.asMatchable(toCoerce); } /** * Create a duck typed Monad wrapper. Using AnyM we focus only on the underlying type * e.g. instead of * <pre> * {@code * Monad<Stream<Integer>,Integer> stream; * * we can write * * AnyM<Integer> stream; * }</pre> * * The wrapped Monaad should have equivalent methods for * * <pre> * {@code * map(F f) * * flatMap(F<x,MONAD> fm) * * and optionally * * filter(P p) * }
|
/**
* Coerce / wrap an Object as a Matchable instance
* This adds match / _match methods for pattern matching against the object
*
* @param toCoerce Object to convert into a Matchable
* @return Matchable that adds functionality to the supplied object
*/
|
Coerce / wrap an Object as a Matchable instance This adds match / _match methods for pattern matching against the object
|
asMatchable
|
{
"repo_name": "sjfloat/cyclops",
"path": "cyclops-core/src/main/java/com/aol/cyclops/core/Core.java",
"license": "mit",
"size": 29907
}
|
[
"com.aol.cyclops.dynamic.As",
"com.aol.cyclops.lambda.monads.AnyM",
"com.aol.cyclops.matcher.Matchable",
"java.util.stream.Stream"
] |
import com.aol.cyclops.dynamic.As; import com.aol.cyclops.lambda.monads.AnyM; import com.aol.cyclops.matcher.Matchable; import java.util.stream.Stream;
|
import com.aol.cyclops.dynamic.*; import com.aol.cyclops.lambda.monads.*; import com.aol.cyclops.matcher.*; import java.util.stream.*;
|
[
"com.aol.cyclops",
"java.util"
] |
com.aol.cyclops; java.util;
| 1,383,412
|
public void assertHasSize(AssertionInfo info, char[] actual, int expectedSize) {
arrays.assertHasSize(info, failures, actual, expectedSize);
}
|
void function(AssertionInfo info, char[] actual, int expectedSize) { arrays.assertHasSize(info, failures, actual, expectedSize); }
|
/**
* Asserts that the number of elements in the given array is equal to the expected one.
*
* @param info contains information about the assertion.
* @param actual the given array.
* @param expectedSize the expected size of {@code actual}.
* @throws AssertionError if the given array is {@code null}.
* @throws AssertionError if the number of elements in the given array is different than the expected one.
*/
|
Asserts that the number of elements in the given array is equal to the expected one
|
assertHasSize
|
{
"repo_name": "ChrisCanCompute/assertj-core",
"path": "src/main/java/org/assertj/core/internal/CharArrays.java",
"license": "apache-2.0",
"size": 14759
}
|
[
"org.assertj.core.api.AssertionInfo"
] |
import org.assertj.core.api.AssertionInfo;
|
import org.assertj.core.api.*;
|
[
"org.assertj.core"
] |
org.assertj.core;
| 127,390
|
@GameProperty(xmlProperty = true, gameProperty = true, adds = true)
public void setDefenseRollsBonus(final String value) throws GameParseException
{
final String[] s = value.split(":");
if (s.length <= 0 || s.length > 2)
throw new GameParseException("defenseRollsBonus can not be empty or have more than two fields" + thisErrorMsg());
String unitType;
unitType = s[1];
// validate that this unit exists in the xml
final UnitType ut = getData().getUnitTypeList().getUnitType(unitType);
if (ut == null)
throw new GameParseException("No unit called:" + unitType + thisErrorMsg());
// we should allow positive and negative numbers
final int n = getInt(s[0]);
m_defenseRollsBonus.put(ut, n);
}
|
@GameProperty(xmlProperty = true, gameProperty = true, adds = true) void function(final String value) throws GameParseException { final String[] s = value.split(":"); if (s.length <= 0 s.length > 2) throw new GameParseException(STR + thisErrorMsg()); String unitType; unitType = s[1]; final UnitType ut = getData().getUnitTypeList().getUnitType(unitType); if (ut == null) throw new GameParseException(STR + unitType + thisErrorMsg()); final int n = getInt(s[0]); m_defenseRollsBonus.put(ut, n); }
|
/**
* Adds to, not sets. Anything that adds to instead of setting needs a clear function as well.
*/
|
Adds to, not sets. Anything that adds to instead of setting needs a clear function as well
|
setDefenseRollsBonus
|
{
"repo_name": "tea-dragon/triplea",
"path": "src/main/java/games/strategy/triplea/attatchments/TechAbilityAttachment.java",
"license": "gpl-2.0",
"size": 50555
}
|
[
"games.strategy.engine.data.GameParseException",
"games.strategy.engine.data.UnitType",
"games.strategy.engine.data.annotations.GameProperty"
] |
import games.strategy.engine.data.GameParseException; import games.strategy.engine.data.UnitType; import games.strategy.engine.data.annotations.GameProperty;
|
import games.strategy.engine.data.*; import games.strategy.engine.data.annotations.*;
|
[
"games.strategy.engine"
] |
games.strategy.engine;
| 437,087
|
private AbstractTypeDeclaration getContainingTypeDeclarationNode() throws JavaModelException {
AbstractTypeDeclaration result= (AbstractTypeDeclaration) ASTNodes.getParent(getSelectedExpression().getAssociatedNode(), AbstractTypeDeclaration.class);
Assert.isNotNull(result);
return result;
}
|
AbstractTypeDeclaration function() throws JavaModelException { AbstractTypeDeclaration result= (AbstractTypeDeclaration) ASTNodes.getParent(getSelectedExpression().getAssociatedNode(), AbstractTypeDeclaration.class); Assert.isNotNull(result); return result; }
|
/**
* Returns the type to which the new constant will be added to. It is the first non-anonymous parent.
* @return the type to add the new constant to
*
* @throws JavaModelException shouldn't happen
*/
|
Returns the type to which the new constant will be added to. It is the first non-anonymous parent
|
getContainingTypeDeclarationNode
|
{
"repo_name": "brunyuriy/quick-fix-scout",
"path": "org.eclipse.jdt.ui_3.7.1.r371_v20110824-0800/src/org/eclipse/jdt/internal/corext/refactoring/code/ExtractConstantRefactoring.java",
"license": "mit",
"size": 39260
}
|
[
"org.eclipse.core.runtime.Assert",
"org.eclipse.jdt.core.JavaModelException",
"org.eclipse.jdt.core.dom.AbstractTypeDeclaration",
"org.eclipse.jdt.internal.corext.dom.ASTNodes"
] |
import org.eclipse.core.runtime.Assert; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; import org.eclipse.jdt.internal.corext.dom.ASTNodes;
|
import org.eclipse.core.runtime.*; import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.dom.*; import org.eclipse.jdt.internal.corext.dom.*;
|
[
"org.eclipse.core",
"org.eclipse.jdt"
] |
org.eclipse.core; org.eclipse.jdt;
| 340,149
|
private int getSecMecValue(String s)
{
int secmec = INVALID_OR_NOTSET_SECURITYMECHANISM;
if( StringUtil.SQLEqualsIgnoreCase(s,"USER_ONLY_SECURITY"))
secmec = CodePoint.SECMEC_USRIDONL;
else if( StringUtil.SQLEqualsIgnoreCase(s,"CLEAR_TEXT_PASSWORD_SECURITY"))
secmec = CodePoint.SECMEC_USRIDPWD;
else if( StringUtil.SQLEqualsIgnoreCase(s,"ENCRYPTED_USER_AND_PASSWORD_SECURITY"))
secmec = CodePoint.SECMEC_EUSRIDPWD;
else if( StringUtil.SQLEqualsIgnoreCase(s,"STRONG_PASSWORD_SUBSTITUTE_SECURITY"))
secmec = CodePoint.SECMEC_USRSSBPWD;
return secmec;
}
|
int function(String s) { int secmec = INVALID_OR_NOTSET_SECURITYMECHANISM; if( StringUtil.SQLEqualsIgnoreCase(s,STR)) secmec = CodePoint.SECMEC_USRIDONL; else if( StringUtil.SQLEqualsIgnoreCase(s,STR)) secmec = CodePoint.SECMEC_USRIDPWD; else if( StringUtil.SQLEqualsIgnoreCase(s,STR)) secmec = CodePoint.SECMEC_EUSRIDPWD; else if( StringUtil.SQLEqualsIgnoreCase(s,STR)) secmec = CodePoint.SECMEC_USRSSBPWD; return secmec; }
|
/**
* Retrieve the SECMEC integer value from the
* user friendly security mechanism name
* @param s security mechanism name
* @return integer value , return the SECMEC value for
* the security mechanism as defined by DRDA spec
* or INVALID_OR_NOTSET_SECURITYMECHANISM if 's'
* passed is invalid or not supported security
* mechanism
*/
|
Retrieve the SECMEC integer value from the user friendly security mechanism name
|
getSecMecValue
|
{
"repo_name": "papicella/snappy-store",
"path": "gemfirexd/core/src/drda/java/com/pivotal/gemfirexd/internal/impl/drda/NetworkServerControlImpl.java",
"license": "apache-2.0",
"size": 138180
}
|
[
"com.pivotal.gemfirexd.internal.iapi.util.StringUtil"
] |
import com.pivotal.gemfirexd.internal.iapi.util.StringUtil;
|
import com.pivotal.gemfirexd.internal.iapi.util.*;
|
[
"com.pivotal.gemfirexd"
] |
com.pivotal.gemfirexd;
| 2,514,767
|
boolean startEnableIntent(AppCompatActivity activity, int requestCode);
|
boolean startEnableIntent(AppCompatActivity activity, int requestCode);
|
/**
* Presents the user if the settings screen to enable the provider's protocol. When this is done,
* 'activity' will have called
*
* @param activity The {@link AppCompatActivity} currently being displayed to the user
* @param requestCode An arbitrary code that will be given to
*
* @return true if the intent was sent
*/
|
Presents the user if the settings screen to enable the provider's protocol. When this is done, 'activity' will have called
|
startEnableIntent
|
{
"repo_name": "gerhardol/runnerup",
"path": "hrdevice/src/org/runnerup/hr/HRProvider.java",
"license": "gpl-3.0",
"size": 5381
}
|
[
"androidx.appcompat.app.AppCompatActivity"
] |
import androidx.appcompat.app.AppCompatActivity;
|
import androidx.appcompat.app.*;
|
[
"androidx.appcompat"
] |
androidx.appcompat;
| 1,794,301
|
return stats.stream().filter(s -> isAssocType(s.getType()) && isAssocParams(s.getParameters(), assocs))
.collect(Collectors.toList());
}
|
return stats.stream().filter(s -> isAssocType(s.getType()) && isAssocParams(s.getParameters(), assocs)) .collect(Collectors.toList()); }
|
/**
* Returns the {@link Statement}s defined on {@link LineAssociation}s.
*
* @param stats
* the {@link Statement}s to check.
* @param assocs
* the {@link LineAssociation}s to check.
* @return the {@link Statement}s defined on {@link LineAssociation}s.
*/
|
Returns the <code>Statement</code>s defined on <code>LineAssociation</code>s
|
splitAssocs
|
{
"repo_name": "ELTE-Soft/txtUML",
"path": "dev/plugins/hu.elte.txtuml.layout.visualizer/src/hu/elte/txtuml/layout/visualizer/helpers/StatementHelper.java",
"license": "epl-1.0",
"size": 11938
}
|
[
"java.util.stream.Collectors"
] |
import java.util.stream.Collectors;
|
import java.util.stream.*;
|
[
"java.util"
] |
java.util;
| 272,720
|
public List<Observation> getAll(String activityId) {
Log.i(TAG, activityId);
List<Observation> observationsList = new ArrayList<Observation>();
try {
// Query the Database to get all the records.
Cursor c = db.query(
EntityTable.ObservationsTable.TABLENAME,
observationEntryArray,
EntityTable.ObservationsTable.COLUMN_FK_ACTIVITY_ID + "=?",
new String[]{activityId},
null, null, null, null);
if (c != null && c.moveToFirst()) {
// loop until the end of Cursor and add each entry to Observations ArrayList.
do {
Observation observationItem = buildFromCursor(c);
if (observationItem != null) {
observationsList.add(observationItem);
}
} while (c.moveToNext());
}
} catch (SQLiteException se) {
if (BuildConfig.DEBUG)
Log.e(TAG, "ObsDAO getAll: ", se);
} catch (Exception e) {
if (BuildConfig.DEBUG)
Log.e(TAG, "ObsDAO getAll: ", e);
}
return observationsList;
}
|
List<Observation> function(String activityId) { Log.i(TAG, activityId); List<Observation> observationsList = new ArrayList<Observation>(); try { Cursor c = db.query( EntityTable.ObservationsTable.TABLENAME, observationEntryArray, EntityTable.ObservationsTable.COLUMN_FK_ACTIVITY_ID + "=?", new String[]{activityId}, null, null, null, null); if (c != null && c.moveToFirst()) { do { Observation observationItem = buildFromCursor(c); if (observationItem != null) { observationsList.add(observationItem); } } while (c.moveToNext()); } } catch (SQLiteException se) { if (BuildConfig.DEBUG) Log.e(TAG, STR, se); } catch (Exception e) { if (BuildConfig.DEBUG) Log.e(TAG, STR, e); } return observationsList; }
|
/**
* Returns all the {@link Observation} for the ActivityId passed
*
* @return
*/
|
Returns all the <code>Observation</code> for the ActivityId passed
|
getAll
|
{
"repo_name": "pmk2429/investickation",
"path": "app/src/main/java/com/sfsu/db/ObservationsDao.java",
"license": "apache-2.0",
"size": 12521
}
|
[
"android.database.Cursor",
"android.database.sqlite.SQLiteException",
"android.support.v7.appcompat.BuildConfig",
"android.util.Log",
"com.sfsu.entities.Observation",
"java.util.ArrayList",
"java.util.List"
] |
import android.database.Cursor; import android.database.sqlite.SQLiteException; import android.support.v7.appcompat.BuildConfig; import android.util.Log; import com.sfsu.entities.Observation; import java.util.ArrayList; import java.util.List;
|
import android.database.*; import android.database.sqlite.*; import android.support.v7.appcompat.*; import android.util.*; import com.sfsu.entities.*; import java.util.*;
|
[
"android.database",
"android.support",
"android.util",
"com.sfsu.entities",
"java.util"
] |
android.database; android.support; android.util; com.sfsu.entities; java.util;
| 1,297,590
|
public static NodesSpecification nonDedicated(int count, ConfigModelContext context) {
return new NodesSpecification(new ClusterResources(count, 1, NodeResources.unspecified()),
new ClusterResources(count, 1, NodeResources.unspecified()),
false,
context.getDeployState().getWantedNodeVespaVersion(),
false,
! context.getDeployState().getProperties().isBootstrap(),
false,
context.getDeployState().getWantedDockerImageRepo(),
Optional.empty());
}
|
static NodesSpecification function(int count, ConfigModelContext context) { return new NodesSpecification(new ClusterResources(count, 1, NodeResources.unspecified()), new ClusterResources(count, 1, NodeResources.unspecified()), false, context.getDeployState().getWantedNodeVespaVersion(), false, ! context.getDeployState().getProperties().isBootstrap(), false, context.getDeployState().getWantedDockerImageRepo(), Optional.empty()); }
|
/**
* Returns a requirement from <code>count</code> non-dedicated nodes in one group
*/
|
Returns a requirement from <code>count</code> non-dedicated nodes in one group
|
nonDedicated
|
{
"repo_name": "vespa-engine/vespa",
"path": "config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/NodesSpecification.java",
"license": "apache-2.0",
"size": 23813
}
|
[
"com.yahoo.config.model.ConfigModelContext",
"com.yahoo.config.provision.ClusterResources",
"com.yahoo.config.provision.NodeResources",
"java.util.Optional"
] |
import com.yahoo.config.model.ConfigModelContext; import com.yahoo.config.provision.ClusterResources; import com.yahoo.config.provision.NodeResources; import java.util.Optional;
|
import com.yahoo.config.model.*; import com.yahoo.config.provision.*; import java.util.*;
|
[
"com.yahoo.config",
"java.util"
] |
com.yahoo.config; java.util;
| 3,680
|
public void setAnnotationTypeColor(Object annotationType, Color color) {
if (color != null)
fAnnotationType2Color.put(annotationType, color);
else
fAnnotationType2Color.remove(annotationType);
fCachedAnnotationType2Color.clear();
}
/**
* Adds the given annotation type to the list of annotation types whose annotations should be
* painted by this painter using squiggly drawing. If the annotation type is already in this
* list, this method is without effect.
*
* @param annotationType the annotation type
* @deprecated As of 3.4 replaced by
* {@link #addTextStyleStrategy(Object, AnnotationPainter.ITextStyleStrategy)} and
* {@link UnderlineStrategy}
|
void function(Object annotationType, Color color) { if (color != null) fAnnotationType2Color.put(annotationType, color); else fAnnotationType2Color.remove(annotationType); fCachedAnnotationType2Color.clear(); } /** * Adds the given annotation type to the list of annotation types whose annotations should be * painted by this painter using squiggly drawing. If the annotation type is already in this * list, this method is without effect. * * @param annotationType the annotation type * @deprecated As of 3.4 replaced by * {@link #addTextStyleStrategy(Object, AnnotationPainter.ITextStyleStrategy)} and * {@link UnderlineStrategy}
|
/**
* Sets the color in which the squiggly for the given annotation type should be drawn.
*
* @param annotationType the annotation type
* @param color the color
*/
|
Sets the color in which the squiggly for the given annotation type should be drawn
|
setAnnotationTypeColor
|
{
"repo_name": "brunyuriy/quick-fix-scout",
"path": "org.eclipse.jface.text_3.8.1.v20120828-155502/src/org/eclipse/jface/text/source/AnnotationPainter.java",
"license": "mit",
"size": 54312
}
|
[
"org.eclipse.swt.graphics.Color"
] |
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.*;
|
[
"org.eclipse.swt"
] |
org.eclipse.swt;
| 1,338,134
|
public static <S, T> Aggregate<S, Map<String, T>> select(
ImmutableSet<NamedAggregate<? super S, ? extends T>> aggregates
) {
return new SelectAggregate<>(aggregates);
}
|
static <S, T> Aggregate<S, Map<String, T>> function( ImmutableSet<NamedAggregate<? super S, ? extends T>> aggregates ) { return new SelectAggregate<>(aggregates); }
|
/**
* An aggregate that combines several aggregates together into a map (where keys are the names of the aggregates)
* @param <S> the type of the {@link Match} results
* @param <T> the type of the aggregate results
*/
|
An aggregate that combines several aggregates together into a map (where keys are the names of the aggregates)
|
select
|
{
"repo_name": "pluraliseseverythings/grakn",
"path": "grakn-graql/src/main/java/ai/grakn/graql/internal/query/aggregate/Aggregates.java",
"license": "gpl-3.0",
"size": 4158
}
|
[
"ai.grakn.graql.Aggregate",
"ai.grakn.graql.NamedAggregate",
"com.google.common.collect.ImmutableSet",
"java.util.Map"
] |
import ai.grakn.graql.Aggregate; import ai.grakn.graql.NamedAggregate; import com.google.common.collect.ImmutableSet; import java.util.Map;
|
import ai.grakn.graql.*; import com.google.common.collect.*; import java.util.*;
|
[
"ai.grakn.graql",
"com.google.common",
"java.util"
] |
ai.grakn.graql; com.google.common; java.util;
| 224,071
|
public List<String> getFriendUsernames() {
return friends;
}
|
List<String> function() { return friends; }
|
/**
* Gets the {@link List} of this player's friends.
*
* @return The list.
*/
|
Gets the <code>List</code> of this player's friends
|
getFriendUsernames
|
{
"repo_name": "Major-/apollo",
"path": "game/src/main/org/apollo/game/model/entity/Player.java",
"license": "isc",
"size": 24470
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,986,308
|
private String getPhoneType(int type) {
String stringType;
switch (type) {
case ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM:
stringType = "custom";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_HOME:
stringType = "home fax";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK:
stringType = "work fax";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_HOME:
stringType = "home";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE:
stringType = "mobile";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_PAGER:
stringType = "pager";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_WORK:
stringType = "work";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_CALLBACK:
stringType = "callback";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_CAR:
stringType = "car";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_COMPANY_MAIN:
stringType = "company main";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER_FAX:
stringType = "other fax";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_RADIO:
stringType = "radio";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_TELEX:
stringType = "telex";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_TTY_TDD:
stringType = "tty tdd";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_MOBILE:
stringType = "work mobile";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_PAGER:
stringType = "work pager";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_ASSISTANT:
stringType = "assistant";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_MMS:
stringType = "mms";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_ISDN:
stringType = "isdn";
break;
case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER:
default:
stringType = "other";
break;
}
return stringType;
}
|
String function(int type) { String stringType; switch (type) { case ContactsContract.CommonDataKinds.Phone.TYPE_CUSTOM: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_HOME: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_FAX_WORK: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_HOME: stringType = "home"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_MOBILE: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_PAGER: stringType = "pager"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK: stringType = "work"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_CALLBACK: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_CAR: stringType = "car"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_COMPANY_MAIN: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER_FAX: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_RADIO: stringType = "radio"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_TELEX: stringType = "telex"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_TTY_TDD: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_MOBILE: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_WORK_PAGER: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_ASSISTANT: stringType = STR; break; case ContactsContract.CommonDataKinds.Phone.TYPE_MMS: stringType = "mms"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_ISDN: stringType = "isdn"; break; case ContactsContract.CommonDataKinds.Phone.TYPE_OTHER: default: stringType = "other"; break; } return stringType; }
|
/**
* getPhoneType converts an Android phone type into a string
* @param type
* @return phone type as string.
*/
|
getPhoneType converts an Android phone type into a string
|
getPhoneType
|
{
"repo_name": "evernym/cordova-plugin-contacts",
"path": "src/android/ContactAccessorSdk5.java",
"license": "apache-2.0",
"size": 109550
}
|
[
"android.provider.ContactsContract"
] |
import android.provider.ContactsContract;
|
import android.provider.*;
|
[
"android.provider"
] |
android.provider;
| 487,737
|
public static long fieldOffset(Class<?> cls, String fieldName) {
try {
return objectFieldOffset(cls.getDeclaredField(fieldName));
}
catch (NoSuchFieldException e) {
throw new IllegalStateException(e);
}
}
|
static long function(Class<?> cls, String fieldName) { try { return objectFieldOffset(cls.getDeclaredField(fieldName)); } catch (NoSuchFieldException e) { throw new IllegalStateException(e); } }
|
/**
* Gets object field offset.
*
* @param cls Object class.
* @param fieldName Field name.
* @return Field offset.
*/
|
Gets object field offset
|
fieldOffset
|
{
"repo_name": "SomeFire/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 374177
}
|
[
"org.apache.ignite.internal.util.GridUnsafe"
] |
import org.apache.ignite.internal.util.GridUnsafe;
|
import org.apache.ignite.internal.util.*;
|
[
"org.apache.ignite"
] |
org.apache.ignite;
| 211,435
|
PackageContextType loadPackage(PackageNameQualified p)
throws JPRAModelLoadingException;
|
PackageContextType loadPackage(PackageNameQualified p) throws JPRAModelLoadingException;
|
/**
* Load and return a package into the context.
*
* @param p The name of the package
*
* @return The loaded package
*
* @throws JPRAModelLoadingException Iff the package cannot be loaded
*/
|
Load and return a package into the context
|
loadPackage
|
{
"repo_name": "io7m/jpra",
"path": "com.io7m.jpra.model/src/main/java/com/io7m/jpra/model/contexts/GlobalContextType.java",
"license": "isc",
"size": 2254
}
|
[
"com.io7m.jpra.model.loading.JPRAModelLoadingException",
"com.io7m.jpra.model.names.PackageNameQualified"
] |
import com.io7m.jpra.model.loading.JPRAModelLoadingException; import com.io7m.jpra.model.names.PackageNameQualified;
|
import com.io7m.jpra.model.loading.*; import com.io7m.jpra.model.names.*;
|
[
"com.io7m.jpra"
] |
com.io7m.jpra;
| 2,799,741
|
@Override
public void onClose() {
sttListener.sttEventReceived(new RecognitionStopEvent());
}
|
void function() { sttListener.sttEventReceived(new RecognitionStopEvent()); }
|
/**
* Called when the WebSocket is closed
*/
|
Called when the WebSocket is closed
|
onClose
|
{
"repo_name": "actong/openhab2",
"path": "addons/voice/org.openhab.voice.kaldi/src/main/java/org/openhab/voice/kaldi/internal/RecognitionEventListenerKaldi.java",
"license": "epl-1.0",
"size": 4576
}
|
[
"org.eclipse.smarthome.core.voice.RecognitionStopEvent"
] |
import org.eclipse.smarthome.core.voice.RecognitionStopEvent;
|
import org.eclipse.smarthome.core.voice.*;
|
[
"org.eclipse.smarthome"
] |
org.eclipse.smarthome;
| 2,260,729
|
public Optional<Integer> getMaxQueueLength() {
return m_maxQueueLength;
}
|
Optional<Integer> function() { return m_maxQueueLength; }
|
/**
* Returns the maximum queue length.<p>
*
* @return the maximum queue length
*/
|
Returns the maximum queue length
|
getMaxQueueLength
|
{
"repo_name": "victos/opencms-core",
"path": "src/org/opencms/ugc/CmsUgcConfiguration.java",
"license": "lgpl-2.1",
"size": 9029
}
|
[
"com.google.common.base.Optional"
] |
import com.google.common.base.Optional;
|
import com.google.common.base.*;
|
[
"com.google.common"
] |
com.google.common;
| 2,322,108
|
public static Date dateFromNumbers(int year, int month, int day) {
Calendar calendar = Calendar.getInstance();
calendar.set(year, month - 1, day); // Month - 1 is used to get the
// correct month.
return calendar.getTime();
}
|
static Date function(int year, int month, int day) { Calendar calendar = Calendar.getInstance(); calendar.set(year, month - 1, day); return calendar.getTime(); }
|
/**
* Create a Date object from numeric values.
*
* @param year
* - The year
* @param month
* - The month [1:12]
* @param day
* - The day [1:31]
* @return The created Date object
*/
|
Create a Date object from numeric values
|
dateFromNumbers
|
{
"repo_name": "javapathshala/WisdomCode",
"path": "JP_KONCEPT/src/main/java/com/jp/koncept/date/DateUtil.java",
"license": "gpl-2.0",
"size": 9676
}
|
[
"java.util.Calendar",
"java.util.Date"
] |
import java.util.Calendar; import java.util.Date;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,827,049
|
private int getCreateOrder() {
switch(objectType) {
case DbObject.SETTING:
return 0;
case DbObject.USER:
return 1;
case DbObject.SCHEMA:
return 2;
case DbObject.FUNCTION_ALIAS:
return 3;
case DbObject.USER_DATATYPE:
return 4;
case DbObject.SEQUENCE:
return 5;
case DbObject.CONSTANT:
return 6;
case DbObject.TABLE_OR_VIEW:
return 7;
case DbObject.INDEX:
return 8;
case DbObject.CONSTRAINT:
return 9;
case DbObject.TRIGGER:
return 10;
case DbObject.ROLE:
return 11;
case DbObject.RIGHT:
return 12;
case DbObject.AGGREGATE:
return 13;
case DbObject.COMMENT:
return 14;
default:
throw DbException.throwInternalError("type="+objectType);
}
}
|
int function() { switch(objectType) { case DbObject.SETTING: return 0; case DbObject.USER: return 1; case DbObject.SCHEMA: return 2; case DbObject.FUNCTION_ALIAS: return 3; case DbObject.USER_DATATYPE: return 4; case DbObject.SEQUENCE: return 5; case DbObject.CONSTANT: return 6; case DbObject.TABLE_OR_VIEW: return 7; case DbObject.INDEX: return 8; case DbObject.CONSTRAINT: return 9; case DbObject.TRIGGER: return 10; case DbObject.ROLE: return 11; case DbObject.RIGHT: return 12; case DbObject.AGGREGATE: return 13; case DbObject.COMMENT: return 14; default: throw DbException.throwInternalError("type="+objectType); } }
|
/**
* Get the sort order id for this object type. Objects are created in this
* order when opening a database.
*
* @return the sort index
*/
|
Get the sort order id for this object type. Objects are created in this order when opening a database
|
getCreateOrder
|
{
"repo_name": "vdr007/ThriftyPaxos",
"path": "src/applications/h2/src/main/org/h2/engine/MetaRecord.java",
"license": "apache-2.0",
"size": 3936
}
|
[
"org.h2.message.DbException"
] |
import org.h2.message.DbException;
|
import org.h2.message.*;
|
[
"org.h2.message"
] |
org.h2.message;
| 2,700,765
|
boolean canRecipeBeAdded(IToken<?> ignored);
|
boolean canRecipeBeAdded(IToken<?> ignored);
|
/**
* Check if a recipe can be added. This is only important for 3x3 crafting. Workers shall override this if necessary.
*
* @param ignored the token of the recipe.
* @return true if so.
*/
|
Check if a recipe can be added. This is only important for 3x3 crafting. Workers shall override this if necessary
|
canRecipeBeAdded
|
{
"repo_name": "Minecolonies/minecolonies",
"path": "src/api/java/com/minecolonies/api/colony/buildings/IBuildingWorker.java",
"license": "gpl-3.0",
"size": 6375
}
|
[
"com.minecolonies.api.colony.requestsystem.token.IToken"
] |
import com.minecolonies.api.colony.requestsystem.token.IToken;
|
import com.minecolonies.api.colony.requestsystem.token.*;
|
[
"com.minecolonies.api"
] |
com.minecolonies.api;
| 919,537
|
private File getConfigurationFile()
{
try
{
// Attempt to get the CCML configuration file from the profile directory.
File profileDirectory = new File(PMS.getConfiguration().getProfileDirectory());
File pluginConfigurationFile = new File(profileDirectory, CCML_CONFIGURATION_FILENAME);
// Directory exists instead? Ignore.
if (pluginConfigurationFile.isDirectory() == true)
{
_logger.error("[CCML] Cannot prepare use for configuration file as its path is a directory."); //$NON-NLS-1$
return null;
}
return pluginConfigurationFile;
}
catch (NullPointerException e)
{
_logger.error("[CCML] Cannot acquire configuration file as profile directory is not defined."); //$NON-NLS-1$
}
return null;
}
|
File function() { try { File profileDirectory = new File(PMS.getConfiguration().getProfileDirectory()); File pluginConfigurationFile = new File(profileDirectory, CCML_CONFIGURATION_FILENAME); if (pluginConfigurationFile.isDirectory() == true) { _logger.error(STR); return null; } return pluginConfigurationFile; } catch (NullPointerException e) { _logger.error(STR); } return null; }
|
/**
* Return the CCML configuration file.
*
* @return The configuration file; null if the configuration file cannot be determined.
*/
|
Return the CCML configuration file
|
getConfigurationFile
|
{
"repo_name": "jdknight/ums.ccml",
"path": "src/main/java/me/jdknight/ums/ccml/core/CcmlConfiguration.java",
"license": "gpl-2.0",
"size": 12353
}
|
[
"java.io.File",
"net.pms.PMS"
] |
import java.io.File; import net.pms.PMS;
|
import java.io.*; import net.pms.*;
|
[
"java.io",
"net.pms"
] |
java.io; net.pms;
| 2,160,002
|
protected void logRemove(ImagePanel panel, int x, int y, int w, int h, List<Map<String,Object>> removed) {
InteractionEvent e;
Map<String,Object> data;
data = new HashMap<>();
data.put("x", x);
data.put("y", y);
data.put("width", w);
data.put("height", h);
data.put("removed", removed);
e = new InteractionEvent(panel, new Date(), "remove", data);
panel.getInteractionLoggingFilter().filterInteractionLog(e);
}
|
void function(ImagePanel panel, int x, int y, int w, int h, List<Map<String,Object>> removed) { InteractionEvent e; Map<String,Object> data; data = new HashMap<>(); data.put("x", x); data.put("y", y); data.put("width", w); data.put(STR, h); data.put(STR, removed); e = new InteractionEvent(panel, new Date(), STR, data); panel.getInteractionLoggingFilter().filterInteractionLog(e); }
|
/**
* Logs the removal of the of objects.
*
* @param panel the panel to use for logging
* @param x the x of the removal rectangle
* @param y the y of the removal rectangle
* @param w the width of the removal rectangle
* @param h the height of the removal rectangle
* @param removed the removed objects
*/
|
Logs the removal of the of objects
|
logRemove
|
{
"repo_name": "waikato-datamining/adams-base",
"path": "adams-imaging/src/main/java/adams/gui/visualization/image/selection/SelectObjects.java",
"license": "gpl-3.0",
"size": 12807
}
|
[
"java.util.Date",
"java.util.HashMap",
"java.util.List",
"java.util.Map"
] |
import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,220,702
|
public void fireNotifyChanged(Notification notification) {
changeNotifier.fireNotifyChanged(notification);
if (parentAdapterFactory != null) {
parentAdapterFactory.fireNotifyChanged(notification);
}
}
|
void function(Notification notification) { changeNotifier.fireNotifyChanged(notification); if (parentAdapterFactory != null) { parentAdapterFactory.fireNotifyChanged(notification); } }
|
/**
* This delegates to {@link #changeNotifier} and to {@link #parentAdapterFactory}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
*
* @generated
*/
|
This delegates to <code>#changeNotifier</code> and to <code>#parentAdapterFactory</code>.
|
fireNotifyChanged
|
{
"repo_name": "drbgfc/mdht",
"path": "cts2/plugins/org.openhealthtools.mdht.cts2.core.edit/src/org/openhealthtools/mdht/cts2/entity/provider/EntityItemProviderAdapterFactory.java",
"license": "epl-1.0",
"size": 21447
}
|
[
"org.eclipse.emf.common.notify.Notification"
] |
import org.eclipse.emf.common.notify.Notification;
|
import org.eclipse.emf.common.notify.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 1,403,834
|
public void delete(Integer executorId) throws SessionInternalError {
if (invoice == null) {
throw new SessionInternalError("An invoice has to be set before delete");
}
//prevent a delegated Invoice from being deleted
if (invoice.getDelegatedInvoiceId() != null && invoice.getDelegatedInvoiceId().intValue() > 0 ) {
SessionInternalError sie= new SessionInternalError("A carried forward Invoice cannot be deleted");
sie.setErrorMessages(new String[] {
"InvoiceDTO,invoice,invoice.error.fkconstraint," + invoice.getId()});
throw sie;
}
// start by updating purchase_order.next_billable_day if applicatble
// for each of the orders included in this invoice
for (OrderProcessDTO orderProcess : (Collection<OrderProcessDTO>) invoice.getOrderProcesses()) {
OrderDTO order = orderProcess.getPurchaseOrder();
if (order.getNextBillableDay() == null) {
// the next billable day doesn't need updating
if (order.getStatusId().equals(Constants.ORDER_STATUS_FINISHED)) {
OrderBL orderBL = new OrderBL(order);
orderBL.setStatus(null, Constants.ORDER_STATUS_ACTIVE);
}
continue;
}
// only if this invoice is the responsible for the order's
// next billable day
if (order.getNextBillableDay().equals(orderProcess.getPeriodEnd())) {
order.setNextBillableDay(orderProcess.getPeriodStart());
if (order.getStatusId().equals(Constants.ORDER_STATUS_FINISHED)) {
OrderBL orderBL = new OrderBL(order);
orderBL.setStatus(null, Constants.ORDER_STATUS_ACTIVE);
}
}
}
// go over the order process records again just to delete them
// we are done with this order, delete the process row
for (OrderProcessDTO orderProcess : (Collection<OrderProcessDTO>) invoice.getOrderProcesses()) {
OrderDTO order = orderProcess.getPurchaseOrder();
OrderProcessDAS das = new OrderProcessDAS();
order.getOrderProcesses().remove(orderProcess);
das.delete(orderProcess);
}
invoice.getOrderProcesses().clear();
// get rid of the contact associated with this invoice
try {
ContactBL contact = new ContactBL();
if (contact.setInvoice(invoice.getId())) {
contact.delete();
}
} catch (Exception e1) {
LOG.error("Exception deleting the contact of an invoice", e1);
}
// remove the payment link/s
PaymentBL payment = new PaymentBL();
Iterator<PaymentInvoiceMapDTO> it = invoice.getPaymentMap().iterator();
while (it.hasNext()) {
PaymentInvoiceMapDTO map = it.next();
payment.removeInvoiceLink(map.getId());
invoice.getPaymentMap().remove(map);
// needed because the collection has changed
it = invoice.getPaymentMap().iterator();
}
// log that this was deleted, otherwise there will be no trace
if (executorId != null) {
eLogger.audit(executorId, invoice.getBaseUser().getId(),
Constants.TABLE_INVOICE, invoice.getId(),
EventLogger.MODULE_INVOICE_MAINTENANCE,
EventLogger.ROW_DELETED, null, null, null);
}
// before delete the invoice most delete the reference in table
// PAYMENT_INVOICE
new PaymentInvoiceMapDAS().deleteAllWithInvoice(invoice);
Set<InvoiceDTO> invoices= invoice.getInvoices();
if (invoices.size() > 0 ) {
for (InvoiceDTO delegate: invoices) {
//set status to unpaid as against carried
delegate.setInvoiceStatus(new InvoiceStatusDAS().find(Constants.INVOICE_STATUS_UNPAID));
//remove delegated invoice link
delegate.setInvoice(null);
getHome().save(delegate);
}
}
// now delete the invoice itself
getHome().delete(invoice);
getHome().flush();
}
|
void function(Integer executorId) throws SessionInternalError { if (invoice == null) { throw new SessionInternalError(STR); } if (invoice.getDelegatedInvoiceId() != null && invoice.getDelegatedInvoiceId().intValue() > 0 ) { SessionInternalError sie= new SessionInternalError(STR); sie.setErrorMessages(new String[] { STR + invoice.getId()}); throw sie; } for (OrderProcessDTO orderProcess : (Collection<OrderProcessDTO>) invoice.getOrderProcesses()) { OrderDTO order = orderProcess.getPurchaseOrder(); if (order.getNextBillableDay() == null) { if (order.getStatusId().equals(Constants.ORDER_STATUS_FINISHED)) { OrderBL orderBL = new OrderBL(order); orderBL.setStatus(null, Constants.ORDER_STATUS_ACTIVE); } continue; } if (order.getNextBillableDay().equals(orderProcess.getPeriodEnd())) { order.setNextBillableDay(orderProcess.getPeriodStart()); if (order.getStatusId().equals(Constants.ORDER_STATUS_FINISHED)) { OrderBL orderBL = new OrderBL(order); orderBL.setStatus(null, Constants.ORDER_STATUS_ACTIVE); } } } for (OrderProcessDTO orderProcess : (Collection<OrderProcessDTO>) invoice.getOrderProcesses()) { OrderDTO order = orderProcess.getPurchaseOrder(); OrderProcessDAS das = new OrderProcessDAS(); order.getOrderProcesses().remove(orderProcess); das.delete(orderProcess); } invoice.getOrderProcesses().clear(); try { ContactBL contact = new ContactBL(); if (contact.setInvoice(invoice.getId())) { contact.delete(); } } catch (Exception e1) { LOG.error(STR, e1); } PaymentBL payment = new PaymentBL(); Iterator<PaymentInvoiceMapDTO> it = invoice.getPaymentMap().iterator(); while (it.hasNext()) { PaymentInvoiceMapDTO map = it.next(); payment.removeInvoiceLink(map.getId()); invoice.getPaymentMap().remove(map); it = invoice.getPaymentMap().iterator(); } if (executorId != null) { eLogger.audit(executorId, invoice.getBaseUser().getId(), Constants.TABLE_INVOICE, invoice.getId(), EventLogger.MODULE_INVOICE_MAINTENANCE, EventLogger.ROW_DELETED, null, null, null); } new PaymentInvoiceMapDAS().deleteAllWithInvoice(invoice); Set<InvoiceDTO> invoices= invoice.getInvoices(); if (invoices.size() > 0 ) { for (InvoiceDTO delegate: invoices) { delegate.setInvoiceStatus(new InvoiceStatusDAS().find(Constants.INVOICE_STATUS_UNPAID)); delegate.setInvoice(null); getHome().save(delegate); } } getHome().delete(invoice); getHome().flush(); }
|
/**
* This will remove all the records (sql delete, not just flag them). It
* will also update the related orders if applicable
*/
|
This will remove all the records (sql delete, not just flag them). It will also update the related orders if applicable
|
delete
|
{
"repo_name": "psalaberria002/jbilling3",
"path": "src/java/com/sapienter/jbilling/server/invoice/InvoiceBL.java",
"license": "agpl-3.0",
"size": 42869
}
|
[
"com.sapienter.jbilling.common.SessionInternalError",
"com.sapienter.jbilling.server.invoice.db.InvoiceDTO",
"com.sapienter.jbilling.server.invoice.db.InvoiceStatusDAS",
"com.sapienter.jbilling.server.order.OrderBL",
"com.sapienter.jbilling.server.order.db.OrderDTO",
"com.sapienter.jbilling.server.order.db.OrderProcessDAS",
"com.sapienter.jbilling.server.order.db.OrderProcessDTO",
"com.sapienter.jbilling.server.payment.PaymentBL",
"com.sapienter.jbilling.server.payment.db.PaymentInvoiceMapDAS",
"com.sapienter.jbilling.server.payment.db.PaymentInvoiceMapDTO",
"com.sapienter.jbilling.server.user.ContactBL",
"com.sapienter.jbilling.server.util.Constants",
"com.sapienter.jbilling.server.util.audit.EventLogger",
"java.util.Collection",
"java.util.Iterator",
"java.util.Set"
] |
import com.sapienter.jbilling.common.SessionInternalError; import com.sapienter.jbilling.server.invoice.db.InvoiceDTO; import com.sapienter.jbilling.server.invoice.db.InvoiceStatusDAS; import com.sapienter.jbilling.server.order.OrderBL; import com.sapienter.jbilling.server.order.db.OrderDTO; import com.sapienter.jbilling.server.order.db.OrderProcessDAS; import com.sapienter.jbilling.server.order.db.OrderProcessDTO; import com.sapienter.jbilling.server.payment.PaymentBL; import com.sapienter.jbilling.server.payment.db.PaymentInvoiceMapDAS; import com.sapienter.jbilling.server.payment.db.PaymentInvoiceMapDTO; import com.sapienter.jbilling.server.user.ContactBL; import com.sapienter.jbilling.server.util.Constants; import com.sapienter.jbilling.server.util.audit.EventLogger; import java.util.Collection; import java.util.Iterator; import java.util.Set;
|
import com.sapienter.jbilling.common.*; import com.sapienter.jbilling.server.invoice.db.*; import com.sapienter.jbilling.server.order.*; import com.sapienter.jbilling.server.order.db.*; import com.sapienter.jbilling.server.payment.*; import com.sapienter.jbilling.server.payment.db.*; import com.sapienter.jbilling.server.user.*; import com.sapienter.jbilling.server.util.*; import com.sapienter.jbilling.server.util.audit.*; import java.util.*;
|
[
"com.sapienter.jbilling",
"java.util"
] |
com.sapienter.jbilling; java.util;
| 437,355
|
// TODO: on java8 make this a default method returning emptyList
Collection<Accountable> getChildResources();
|
Collection<Accountable> getChildResources();
|
/**
* Returns nested resources of this class.
* The result should be a point-in-time snapshot (to avoid race conditions).
* @see Accountables
*/
|
Returns nested resources of this class. The result should be a point-in-time snapshot (to avoid race conditions)
|
getChildResources
|
{
"repo_name": "q474818917/solr-5.2.0",
"path": "lucene/core/src/java/org/apache/lucene/util/Accountable.java",
"license": "apache-2.0",
"size": 1371
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 701,247
|
private void loadConnectorConfigurations( ) {
ConnectorConfigurationManager connectorConfigurationManager = new ConnectorConfigurationManager();
if( getConfigurationManager( ).contains( ConfigurationConstants.HTTP_CONNECTORS ) ) {
logger.info( "Preparing connectors for '{}'.", this.getCanonicalName( ) );
RegisteredCollection<ConnectorConfiguration> connectorCollection = this.getConfigurationManager().getCollectionValues( ConfigurationConstants.HTTP_CONNECTORS, ConnectorConfiguration.class );
// TODO: don't like doing it this way, ideally this handled differently
for( ConnectorConfiguration connectorConfiguration : connectorCollection.getAll( ) ) {
connectorConfigurationManager.register( connectorConfiguration );
}
}
// we register this regardless of having any loaded this
// allows others to manual register if they so desire
this.facilityManager.addFacility( ConnectorConfigurationManager.class, connectorConfigurationManager );
}
|
void function( ) { ConnectorConfigurationManager connectorConfigurationManager = new ConnectorConfigurationManager(); if( getConfigurationManager( ).contains( ConfigurationConstants.HTTP_CONNECTORS ) ) { logger.info( STR, this.getCanonicalName( ) ); RegisteredCollection<ConnectorConfiguration> connectorCollection = this.getConfigurationManager().getCollectionValues( ConfigurationConstants.HTTP_CONNECTORS, ConnectorConfiguration.class ); for( ConnectorConfiguration connectorConfiguration : connectorCollection.getAll( ) ) { connectorConfigurationManager.register( connectorConfiguration ); } } this.facilityManager.addFacility( ConnectorConfigurationManager.class, connectorConfigurationManager ); }
|
/**
* Private method, creating a set of connector configurations, for used by http interfaces.
*/
|
Private method, creating a set of connector configurations, for used by http interfaces
|
loadConnectorConfigurations
|
{
"repo_name": "Talvish/Tales",
"path": "product/services/src/com/talvish/tales/services/Service.java",
"license": "apache-2.0",
"size": 43265
}
|
[
"com.talvish.tales.services.http.ConnectorConfiguration",
"com.talvish.tales.services.http.ConnectorConfigurationManager",
"com.talvish.tales.system.configuration.annotated.RegisteredCollection"
] |
import com.talvish.tales.services.http.ConnectorConfiguration; import com.talvish.tales.services.http.ConnectorConfigurationManager; import com.talvish.tales.system.configuration.annotated.RegisteredCollection;
|
import com.talvish.tales.services.http.*; import com.talvish.tales.system.configuration.annotated.*;
|
[
"com.talvish.tales"
] |
com.talvish.tales;
| 1,280,607
|
ObservableMutableDocument<N, E, T> getDocument();
|
ObservableMutableDocument<N, E, T> getDocument();
|
/**
* Returns the document wrapped by this object.
*/
|
Returns the document wrapped by this object
|
getDocument
|
{
"repo_name": "gburd/wave",
"path": "src/org/waveprotocol/wave/model/document/util/DocumentEventRouter.java",
"license": "apache-2.0",
"size": 2169
}
|
[
"org.waveprotocol.wave.model.document.ObservableMutableDocument"
] |
import org.waveprotocol.wave.model.document.ObservableMutableDocument;
|
import org.waveprotocol.wave.model.document.*;
|
[
"org.waveprotocol.wave"
] |
org.waveprotocol.wave;
| 1,893,653
|
@Override
protected void appendTimestamp(java.sql.Timestamp timestamp, Writer writer) throws IOException {
writer.write("TIMESTAMP'" + Helper.printTimestampWithoutNanos(timestamp) + "'" );
}
|
void function(java.sql.Timestamp timestamp, Writer writer) throws IOException { writer.write(STR + Helper.printTimestampWithoutNanos(timestamp) + "'" ); }
|
/**
* Appends a TimeStamp in Symfoware specific format.<br>
* Note that Symfoware does not support the milli- and nanoseconds.<br>
* Symfoware: TIMESTAMP'YYYY-MM-DD hh:mm:ss'
*/
|
Appends a TimeStamp in Symfoware specific format. Note that Symfoware does not support the milli- and nanoseconds. Symfoware: TIMESTAMP'YYYY-MM-DD hh:mm:ss'
|
appendTimestamp
|
{
"repo_name": "RallySoftware/eclipselink.runtime",
"path": "foundation/org.eclipse.persistence.core/src/org/eclipse/persistence/platform/database/SymfowarePlatform.java",
"license": "epl-1.0",
"size": 51856
}
|
[
"java.io.IOException",
"java.io.Writer",
"org.eclipse.persistence.internal.helper.Helper"
] |
import java.io.IOException; import java.io.Writer; import org.eclipse.persistence.internal.helper.Helper;
|
import java.io.*; import org.eclipse.persistence.internal.helper.*;
|
[
"java.io",
"org.eclipse.persistence"
] |
java.io; org.eclipse.persistence;
| 719,314
|
public void verifyConfigurationName() {
for (Map.Entry<String, String> entry: configuration) {
if (getDefaultOozieConfig(entry.getKey()) == null) {
log.warn("Invalid configuration defined, [{0}] ", entry.getKey());
}
}
}
|
void function() { for (Map.Entry<String, String> entry: configuration) { if (getDefaultOozieConfig(entry.getKey()) == null) { log.warn(STR, entry.getKey()); } } }
|
/**
* Verify the configuration is in oozie-default
*/
|
Verify the configuration is in oozie-default
|
verifyConfigurationName
|
{
"repo_name": "cbaenziger/oozie",
"path": "core/src/main/java/org/apache/oozie/service/ConfigurationService.java",
"license": "apache-2.0",
"size": 24495
}
|
[
"java.util.Map"
] |
import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,766,991
|
public void test_java_util_Arrays_sort_short_array_NPE() {
short[] short_array_null = null;
try {
java.util.Arrays.sort(short_array_null);
fail("Should throw java.lang.NullPointerException");
} catch (NullPointerException e) {
// Expected
}
try {
// Regression for HARMONY-378
java.util.Arrays.sort(short_array_null, (int) -1, (int) 1);
fail("Should throw java.lang.NullPointerException");
} catch (NullPointerException e) {
// Expected
}
}
// Lenghts of arrays to test in test_sort;
private static final int[] LENGTHS = { 0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 100, 1000, 10000 };
|
void function() { short[] short_array_null = null; try { java.util.Arrays.sort(short_array_null); fail(STR); } catch (NullPointerException e) { } try { java.util.Arrays.sort(short_array_null, (int) -1, (int) 1); fail(STR); } catch (NullPointerException e) { } } private static final int[] LENGTHS = { 0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 100, 1000, 10000 };
|
/**
* java.util.Arrays#sort(short[], int, int)
*/
|
java.util.Arrays#sort(short[], int, int)
|
test_java_util_Arrays_sort_short_array_NPE
|
{
"repo_name": "mirego/j2objc",
"path": "jre_emul/android/platform/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ArraysTest.java",
"license": "apache-2.0",
"size": 207868
}
|
[
"java.util.Arrays"
] |
import java.util.Arrays;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,183,362
|
public static <A extends AbstractAssert> A isOfClass(A assertion, WritableAssertionInfo info,
Value valueAtStartPoint, Value valueAtEndPoint,
Class<?> expected, boolean lenient) {
if (expected == null) {
throw new AssertJDBException("Class of the column is null");
}
if (valueAtStartPoint.getValue() == null || !expected.isAssignableFrom(valueAtStartPoint.getValue().getClass())) {
if (!lenient || valueAtStartPoint.getValue() != null) {
throw failures.failure(info, shouldBeValueClassWithStartPoint(valueAtStartPoint, expected));
}
}
if (valueAtEndPoint.getValue() == null || !expected.isAssignableFrom(valueAtEndPoint.getValue().getClass())) {
if (!lenient || valueAtEndPoint.getValue() != null) {
throw failures.failure(info, shouldBeValueClassWithEndPoint(valueAtEndPoint, expected));
}
}
return assertion;
}
|
static <A extends AbstractAssert> A function(A assertion, WritableAssertionInfo info, Value valueAtStartPoint, Value valueAtEndPoint, Class<?> expected, boolean lenient) { if (expected == null) { throw new AssertJDBException(STR); } if (valueAtStartPoint.getValue() == null !expected.isAssignableFrom(valueAtStartPoint.getValue().getClass())) { if (!lenient valueAtStartPoint.getValue() != null) { throw failures.failure(info, shouldBeValueClassWithStartPoint(valueAtStartPoint, expected)); } } if (valueAtEndPoint.getValue() == null !expected.isAssignableFrom(valueAtEndPoint.getValue().getClass())) { if (!lenient valueAtEndPoint.getValue() != null) { throw failures.failure(info, shouldBeValueClassWithEndPoint(valueAtEndPoint, expected)); } } return assertion; }
|
/**
* Verifies that the class of the values of the column is equal to the class in parameter.
*
* @param <A> The type of the assertion which call this method.
* @param assertion The assertion which call this method.
* @param info Writable information about an assertion.
* @param valueAtStartPoint The value at start point.
* @param valueAtEndPoint The value at end point.
* @param expected The expected class to compare to.
* @param lenient {@code true} if the test is lenient : if the class of a value is not identified (for example when the
* value is {@code null}), it consider that it is ok.
* @return {@code this} assertion object.
* @throws AssertionError If the class of the column is different to the class in parameter.
* @since 1.1.0
*/
|
Verifies that the class of the values of the column is equal to the class in parameter
|
isOfClass
|
{
"repo_name": "otoniel-isidoro/assertj-db",
"path": "src/main/java/org/assertj/db/api/assertions/impl/AssertionsOnColumnOfChangeClass.java",
"license": "apache-2.0",
"size": 3337
}
|
[
"org.assertj.core.api.WritableAssertionInfo",
"org.assertj.db.api.AbstractAssert",
"org.assertj.db.error.ShouldBeValueClassWithEndPoint",
"org.assertj.db.error.ShouldBeValueClassWithStartPoint",
"org.assertj.db.exception.AssertJDBException",
"org.assertj.db.type.Value"
] |
import org.assertj.core.api.WritableAssertionInfo; import org.assertj.db.api.AbstractAssert; import org.assertj.db.error.ShouldBeValueClassWithEndPoint; import org.assertj.db.error.ShouldBeValueClassWithStartPoint; import org.assertj.db.exception.AssertJDBException; import org.assertj.db.type.Value;
|
import org.assertj.core.api.*; import org.assertj.db.api.*; import org.assertj.db.error.*; import org.assertj.db.exception.*; import org.assertj.db.type.*;
|
[
"org.assertj.core",
"org.assertj.db"
] |
org.assertj.core; org.assertj.db;
| 2,020,681
|
public static Map<String, Object> updateCreditCard(DispatchContext ctx, Map<String, Object> context) {
Map<String, Object> result = new HashMap<String, Object>();
Delegator delegator = ctx.getDelegator();
Security security = ctx.getSecurity();
GenericValue userLogin = (GenericValue) context.get("userLogin");
Locale locale = (Locale) context.get("locale");
Timestamp now = UtilDateTime.nowTimestamp();
String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin, security, context, result, "PAY_INFO", "_UPDATE", "ACCOUNTING", "_UPDATE");
if (result.size() > 0) return result;
List<GenericValue> toBeStored = new LinkedList<GenericValue>();
boolean isModified = false;
GenericValue paymentMethod = null;
GenericValue newPm = null;
GenericValue creditCard = null;
GenericValue newCc = null;
String paymentMethodId = (String) context.get("paymentMethodId");
try {
creditCard = EntityQuery.use(delegator).from("CreditCard").where("paymentMethodId", paymentMethodId).queryOne();
paymentMethod = EntityQuery.use(delegator).from("PaymentMethod").where("paymentMethodId", paymentMethodId).queryOne();
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingCreditCardUpdateReadFailure", locale) + e.getMessage());
}
if (creditCard == null || paymentMethod == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingCreditCardUpdateWithPaymentMethodId", locale) + paymentMethodId);
}
if (!paymentMethod.getString("partyId").equals(partyId) && !security.hasEntityPermission("PAY_INFO", "_UPDATE", userLogin) && !security.hasEntityPermission("ACCOUNTING", "_UPDATE", userLogin)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingCreditCardUpdateWithoutPermission", UtilMisc.toMap("partyId", partyId,
"paymentMethodId", paymentMethodId), locale));
}
// do some more complicated/critical validation...
List<String> messages = new LinkedList<String>();
// first remove all spaces from the credit card number
String updatedCardNumber = StringUtil.removeSpaces((String) context.get("cardNumber"));
if (updatedCardNumber.startsWith("*")) {
// get the masked card number from the db
String origCardNumber = creditCard.getString("cardNumber");
String origMaskedNumber = "";
int cardLength = origCardNumber.length() - 4;
for (int i = 0; i < cardLength; i++) {
origMaskedNumber = origMaskedNumber + "*";
}
origMaskedNumber = origMaskedNumber + origCardNumber.substring(cardLength);
// compare the two masked numbers
if (updatedCardNumber.equals(origMaskedNumber)) {
updatedCardNumber = origCardNumber;
}
}
context.put("cardNumber", updatedCardNumber);
if (!UtilValidate.isCardMatch((String) context.get("cardType"), (String) context.get("cardNumber"))) {
messages.add(
UtilProperties.getMessage(resource, "AccountingCreditCardNumberInvalid",
UtilMisc.toMap("cardType", (String) context.get("cardType"),
"validCardType", UtilValidate.getCardType((String) context.get("cardNumber"))), locale));
}
if (!UtilValidate.isDateAfterToday((String) context.get("expireDate"))) {
messages.add(
UtilProperties.getMessage(resource, "AccountingCreditCardExpireDateBeforeToday",
UtilMisc.toMap("expireDate", (String) context.get("expireDate")), locale));
}
if (messages.size() > 0) {
return ServiceUtil.returnError(messages);
}
newPm = GenericValue.create(paymentMethod);
toBeStored.add(newPm);
newCc = GenericValue.create(creditCard);
toBeStored.add(newCc);
String newPmId = null;
try {
newPmId = delegator.getNextSeqId("PaymentMethod");
} catch (IllegalArgumentException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingCreditCardUpdateIdGenerationFailure", locale));
}
newPm.set("partyId", partyId);
newPm.set("fromDate", context.get("fromDate"), false);
newPm.set("description",context.get("description"));
// The following check is needed to avoid to reactivate an expired pm
if (newPm.get("thruDate") == null) {
newPm.set("thruDate", context.get("thruDate"));
}
newCc.set("companyNameOnCard", context.get("companyNameOnCard"));
newCc.set("titleOnCard", context.get("titleOnCard"));
newCc.set("firstNameOnCard", context.get("firstNameOnCard"));
newCc.set("middleNameOnCard", context.get("middleNameOnCard"));
newCc.set("lastNameOnCard", context.get("lastNameOnCard"));
newCc.set("suffixOnCard", context.get("suffixOnCard"));
newCc.set("cardType", context.get("cardType"));
newCc.set("cardNumber", context.get("cardNumber"));
newCc.set("expireDate", context.get("expireDate"));
GenericValue newPartyContactMechPurpose = null;
String contactMechId = (String) context.get("contactMechId");
if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) {
// set the contactMechId on the credit card
newCc.set("contactMechId", contactMechId);
}
if (!newCc.equals(creditCard) || !newPm.equals(paymentMethod)) {
newPm.set("paymentMethodId", newPmId);
newCc.set("paymentMethodId", newPmId);
newPm.set("fromDate", (context.get("fromDate") != null ? context.get("fromDate") : now));
isModified = true;
}
if (UtilValidate.isNotEmpty(contactMechId) && !contactMechId.equals("_NEW_")) {
// add a PartyContactMechPurpose of BILLING_LOCATION if necessary
String contactMechPurposeTypeId = "BILLING_LOCATION";
GenericValue tempVal = null;
try {
List<GenericValue> allPCWPs = EntityQuery.use(delegator).from("PartyContactWithPurpose")
.where("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId).queryList();
allPCWPs = EntityUtil.filterByDate(allPCWPs, now, "contactFromDate", "contactThruDate", true);
allPCWPs = EntityUtil.filterByDate(allPCWPs, now, "purposeFromDate", "purposeThruDate", true);
tempVal = EntityUtil.getFirst(allPCWPs);
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
tempVal = null;
}
if (tempVal == null) {
// no value found, create a new one
newPartyContactMechPurpose = delegator.makeValue("PartyContactMechPurpose",
UtilMisc.toMap("partyId", partyId, "contactMechId", contactMechId, "contactMechPurposeTypeId", contactMechPurposeTypeId, "fromDate", now));
}
}
if (isModified) {
if (newPartyContactMechPurpose != null) toBeStored.add(newPartyContactMechPurpose);
// set thru date on old paymentMethod
paymentMethod.set("thruDate", now);
toBeStored.add(paymentMethod);
try {
delegator.storeAll(toBeStored);
} catch (GenericEntityException e) {
Debug.logWarning(e.getMessage(), module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingCreditCardUpdateWriteFailure", locale) + e.getMessage());
}
} else {
result.put("paymentMethodId", paymentMethodId);
result.put("oldPaymentMethodId", paymentMethodId);
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
if (contactMechId == null || !contactMechId.equals("_NEW_")) {
result.put(ModelService.SUCCESS_MESSAGE, UtilProperties.getMessage(resource,
"AccountingNoChangesMadeNotUpdatingCreditCard", locale));
}
return result;
}
result.put("oldPaymentMethodId", paymentMethodId);
result.put("paymentMethodId", newCc.getString("paymentMethodId"));
result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS);
return result;
}
|
static Map<String, Object> function(DispatchContext ctx, Map<String, Object> context) { Map<String, Object> result = new HashMap<String, Object>(); Delegator delegator = ctx.getDelegator(); Security security = ctx.getSecurity(); GenericValue userLogin = (GenericValue) context.get(STR); Locale locale = (Locale) context.get(STR); Timestamp now = UtilDateTime.nowTimestamp(); String partyId = ServiceUtil.getPartyIdCheckSecurity(userLogin, security, context, result, STR, STR, STR, STR); if (result.size() > 0) return result; List<GenericValue> toBeStored = new LinkedList<GenericValue>(); boolean isModified = false; GenericValue paymentMethod = null; GenericValue newPm = null; GenericValue creditCard = null; GenericValue newCc = null; String paymentMethodId = (String) context.get(STR); try { creditCard = EntityQuery.use(delegator).from(STR).where(STR, paymentMethodId).queryOne(); paymentMethod = EntityQuery.use(delegator).from(STR).where(STR, paymentMethodId).queryOne(); } catch (GenericEntityException e) { Debug.logWarning(e.getMessage(), module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, STR, locale) + e.getMessage()); } if (creditCard == null paymentMethod == null) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, STR, locale) + paymentMethodId); } if (!paymentMethod.getString(STR).equals(partyId) && !security.hasEntityPermission(STR, STR, userLogin) && !security.hasEntityPermission(STR, STR, userLogin)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, STR, UtilMisc.toMap(STR, partyId, STR, paymentMethodId), locale)); } List<String> messages = new LinkedList<String>(); String updatedCardNumber = StringUtil.removeSpaces((String) context.get(STR)); if (updatedCardNumber.startsWith("*")) { String origCardNumber = creditCard.getString(STR); String origMaskedNumber = STR*"; } origMaskedNumber = origMaskedNumber + origCardNumber.substring(cardLength); if (updatedCardNumber.equals(origMaskedNumber)) { updatedCardNumber = origCardNumber; } } context.put(STR, updatedCardNumber); if (!UtilValidate.isCardMatch((String) context.get("cardType"), (String) context.get(STR))) { messages.add( UtilProperties.getMessage(resource, "AccountingCreditCardNumberInvalidSTRcardTypeSTRcardTypeSTRvalidCardType", UtilValidate.getCardType((String) context.get(STR))), locale)); } if (!UtilValidate.isDateAfterToday((String) context.get("expireDateSTRAccountingCreditCardExpireDateBeforeTodaySTRexpireDateSTRexpireDate")), locale)); } if (messages.size() > 0) { return ServiceUtil.returnError(messages); } newPm = GenericValue.create(paymentMethod); toBeStored.add(newPm); newCc = GenericValue.create(creditCard); toBeStored.add(newCc); String newPmId = null; try { newPmId = delegator.getNextSeqId(STR); } catch (IllegalArgumentException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "AccountingCreditCardUpdateIdGenerationFailure", locale)); } newPm.set(STR, partyId); newPm.set("fromDateSTRfromDateSTRdescriptionSTRdescriptionSTRthruDateSTRthruDateSTRthruDateSTRcompanyNameOnCardSTRcompanyNameOnCardSTRtitleOnCardSTRtitleOnCardSTRfirstNameOnCardSTRfirstNameOnCardSTRmiddleNameOnCardSTRmiddleNameOnCardSTRlastNameOnCardSTRlastNameOnCardSTRsuffixOnCardSTRsuffixOnCardSTRcardTypeSTRcardType")); newCc.set(STR, context.get(STR)); newCc.set("expireDateSTRexpireDateSTRcontactMechIdSTR_NEW_STRcontactMechId", contactMechId); } if (!newCc.equals(creditCard) !newPm.equals(paymentMethod)) { newPm.set(STR, newPmId); newCc.set(STR, newPmId); newPm.set("fromDateSTRfromDateSTRfromDateSTR_NEW_STRBILLING_LOCATIONSTRPartyContactWithPurpose") .where(STR, partyId, "contactMechIdSTRcontactMechPurposeTypeIdSTRcontactFromDateSTRcontactThruDateSTRpurposeFromDateSTRpurposeThruDateSTRPartyContactMechPurpose", UtilMisc.toMap(STR, partyId, "contactMechIdSTRcontactMechPurposeTypeIdSTRfromDateSTRthruDateSTRAccountingCreditCardUpdateWriteFailure", locale) + e.getMessage()); } } else { result.put(STR, paymentMethodId); result.put("oldPaymentMethodIdSTR_NEW_STRAccountingNoChangesMadeNotUpdatingCreditCardSTRoldPaymentMethodId", paymentMethodId); result.put(STR, newCc.getString(STR)); result.put(ModelService.RESPONSE_MESSAGE, ModelService.RESPOND_SUCCESS); return result; }
|
/**
* Updates CreditCard and PaymentMethod entities according to the parameters passed in the context
* <b>security check</b>: userLogin partyId must equal partyId, or must have PAY_INFO_UPDATE permission
* @param ctx The DispatchContext that this service is operating in
* @param context Map containing the input parameters
* @return Map with the result of the service, the output parameters
*/
|
Updates CreditCard and PaymentMethod entities according to the parameters passed in the context security check: userLogin partyId must equal partyId, or must have PAY_INFO_UPDATE permission
|
updateCreditCard
|
{
"repo_name": "yuri0x7c1/ofbiz-explorer",
"path": "src/test/resources/apache-ofbiz-16.11.03/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentMethodServices.java",
"license": "apache-2.0",
"size": 54558
}
|
[
"java.sql.Timestamp",
"java.util.HashMap",
"java.util.LinkedList",
"java.util.List",
"java.util.Locale",
"java.util.Map",
"org.apache.ofbiz.base.util.Debug",
"org.apache.ofbiz.base.util.StringUtil",
"org.apache.ofbiz.base.util.UtilDateTime",
"org.apache.ofbiz.base.util.UtilMisc",
"org.apache.ofbiz.base.util.UtilProperties",
"org.apache.ofbiz.base.util.UtilValidate",
"org.apache.ofbiz.entity.Delegator",
"org.apache.ofbiz.entity.GenericEntityException",
"org.apache.ofbiz.entity.GenericValue",
"org.apache.ofbiz.entity.util.EntityQuery",
"org.apache.ofbiz.security.Security",
"org.apache.ofbiz.service.DispatchContext",
"org.apache.ofbiz.service.ModelService",
"org.apache.ofbiz.service.ServiceUtil"
] |
import java.sql.Timestamp; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.StringUtil; import org.apache.ofbiz.base.util.UtilDateTime; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilProperties; import org.apache.ofbiz.base.util.UtilValidate; import org.apache.ofbiz.entity.Delegator; import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.util.EntityQuery; import org.apache.ofbiz.security.Security; import org.apache.ofbiz.service.DispatchContext; import org.apache.ofbiz.service.ModelService; import org.apache.ofbiz.service.ServiceUtil;
|
import java.sql.*; import java.util.*; import org.apache.ofbiz.base.util.*; import org.apache.ofbiz.entity.*; import org.apache.ofbiz.entity.util.*; import org.apache.ofbiz.security.*; import org.apache.ofbiz.service.*;
|
[
"java.sql",
"java.util",
"org.apache.ofbiz"
] |
java.sql; java.util; org.apache.ofbiz;
| 1,272,871
|
public final void setCellDimensions(long cellWidth, long cellHeight) {
if (cellWidth <= 0) {
throw new RuntimeException("Attempted to give a SpaceState a non-positive cell width (about "
+ Frac.toDouble(cellWidth) + " fracunits)");
}
if (cellHeight <= 0) {
throw new RuntimeException("Attempted to give a SpaceState a non-positive cell height (about "
+ Frac.toDouble(cellHeight) + " fracunits)");
}
cells.clear();
this.cellWidth = cellWidth;
this.cellHeight = cellHeight;
if (!spaceObjects.isEmpty()) {
for (SpaceObject object : spaceObjects) {
object.addCellData();
}
}
}
|
final void function(long cellWidth, long cellHeight) { if (cellWidth <= 0) { throw new RuntimeException(STR + Frac.toDouble(cellWidth) + STR); } if (cellHeight <= 0) { throw new RuntimeException(STR + Frac.toDouble(cellHeight) + STR); } cells.clear(); this.cellWidth = cellWidth; this.cellHeight = cellHeight; if (!spaceObjects.isEmpty()) { for (SpaceObject object : spaceObjects) { object.addCellData(); } } }
|
/**
* Sets the dimensions of each of this SpaceState's cells to the specified
* values. The more SpaceObjects are currently assigned to this SpaceState,
* the longer this operation takes, as SpaceObjects need to be reorganized.
* @param cellWidth The new width of each of this SpaceState's cells
* @param cellHeight The new height of each of this SpaceState's cells
*/
|
Sets the dimensions of each of this SpaceState's cells to the specified values. The more SpaceObjects are currently assigned to this SpaceState, the longer this operation takes, as SpaceObjects need to be reorganized
|
setCellDimensions
|
{
"repo_name": "742mph/Ironclad2D",
"path": "src/org/cell2d/space/SpaceState.java",
"license": "gpl-3.0",
"size": 167865
}
|
[
"org.cell2d.Frac"
] |
import org.cell2d.Frac;
|
import org.cell2d.*;
|
[
"org.cell2d"
] |
org.cell2d;
| 1,415,746
|
public synchronized boolean containsAll(Collection<?> c)
{
for(java.lang.Object loItem : c)
{
if (!this.contains(loItem))
{
return false;
}
}
return true;
}
|
synchronized boolean function(Collection<?> c) { for(java.lang.Object loItem : c) { if (!this.contains(loItem)) { return false; } } return true; }
|
/**
* Checks if all the items in the specified collection are contained
* in this collection
*
* @param c the specified collection
* @return true if all the items are contained
*/
|
Checks if all the items in the specified collection are contained in this collection
|
containsAll
|
{
"repo_name": "kmchugh/Goliath",
"path": "src/Goliath/Collections/CommandQueue.java",
"license": "mit",
"size": 11671
}
|
[
"java.util.Collection"
] |
import java.util.Collection;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,331,758
|
public List<TableMetadataUnit> request(RequestMetadata requestMetadata) {
return tables.read()
.filter(requestMetadata.filter())
.columns(requestMetadata.columns())
.execute();
}
|
List<TableMetadataUnit> function(RequestMetadata requestMetadata) { return tables.read() .filter(requestMetadata.filter()) .columns(requestMetadata.columns()) .execute(); }
|
/**
* Executes Metastore Tables read request based on given information in {@link RequestMetadata}.
*
* @param requestMetadata request metadata
* @return list of metadata units
*/
|
Executes Metastore Tables read request based on given information in <code>RequestMetadata</code>
|
request
|
{
"repo_name": "kkhatua/drill",
"path": "metastore/metastore-api/src/main/java/org/apache/drill/metastore/components/tables/BasicTablesRequests.java",
"license": "apache-2.0",
"size": 23771
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 398,579
|
public File getSolrSchemaFile() {
return new File(getHome() + CONF_FOLDER + IndexSchema.DEFAULT_SCHEMA_FILE);
}
|
File function() { return new File(getHome() + CONF_FOLDER + IndexSchema.DEFAULT_SCHEMA_FILE); }
|
/**
* Returns the Solr index schema file.<p>
*
* @return the Solr index schema file
*/
|
Returns the Solr index schema file
|
getSolrSchemaFile
|
{
"repo_name": "mediaworx/opencms-core",
"path": "src/org/opencms/search/solr/CmsSolrConfiguration.java",
"license": "lgpl-2.1",
"size": 9495
}
|
[
"java.io.File",
"org.apache.solr.schema.IndexSchema"
] |
import java.io.File; import org.apache.solr.schema.IndexSchema;
|
import java.io.*; import org.apache.solr.schema.*;
|
[
"java.io",
"org.apache.solr"
] |
java.io; org.apache.solr;
| 1,441,833
|
public void removeVertice(Location<World> location);
|
void function(Location<World> location);
|
/**
* Removes a vertice in the shape
* @param location
*/
|
Removes a vertice in the shape
|
removeVertice
|
{
"repo_name": "Jano1/RegionsAPI",
"path": "src/main/java/de/jano1/sponge/regions_api/RegionShape.java",
"license": "mit",
"size": 690
}
|
[
"org.spongepowered.api.world.Location",
"org.spongepowered.api.world.World"
] |
import org.spongepowered.api.world.Location; import org.spongepowered.api.world.World;
|
import org.spongepowered.api.world.*;
|
[
"org.spongepowered.api"
] |
org.spongepowered.api;
| 1,778,021
|
@Ensure({"count() == {old count()} + 1",
"item(0) == {arg 1}",
"generation() == {old generation()} + 1"})
public void addFirst(final G element) {
if (count == items.length) {
makeRoom();
}
lower = (lower - 1 + items.length) % items.length;
items[lower] = element;
count++;
generation++;
}
|
@Ensure({STR, STR, STR}) void function(final G element) { if (count == items.length) { makeRoom(); } lower = (lower - 1 + items.length) % items.length; items[lower] = element; count++; generation++; }
|
/**
* Add an element at the head of the array
*
* @param element
* the element to insert
*/
|
Add an element at the head of the array
|
addFirst
|
{
"repo_name": "cadrian/incentive",
"path": "src/main/java/net/cadrian/collection/RingArray.java",
"license": "gpl-3.0",
"size": 4094
}
|
[
"net.cadrian.incentive.Ensure"
] |
import net.cadrian.incentive.Ensure;
|
import net.cadrian.incentive.*;
|
[
"net.cadrian.incentive"
] |
net.cadrian.incentive;
| 781,151
|
IRequestContext onResult(IUpdateSubscriber<IRequestContext> subscriber);
|
IRequestContext onResult(IUpdateSubscriber<IRequestContext> subscriber);
|
/**
* Register a subscriber for updates when the request receives any type of update.
*
* @param subscriber The subscriber.
*
* @return Self for chaining.
*/
|
Register a subscriber for updates when the request receives any type of update
|
onResult
|
{
"repo_name": "JCThePants/NucleusFramework",
"path": "src/com/jcwhatever/nucleus/managed/commands/response/IRequestContext.java",
"license": "mit",
"size": 4548
}
|
[
"com.jcwhatever.nucleus.utils.observer.update.IUpdateSubscriber"
] |
import com.jcwhatever.nucleus.utils.observer.update.IUpdateSubscriber;
|
import com.jcwhatever.nucleus.utils.observer.update.*;
|
[
"com.jcwhatever.nucleus"
] |
com.jcwhatever.nucleus;
| 1,773,712
|
protected Collection<PermissionEntry> readPermissionEntries(
StreamTokenizer st) throws IOException, InvalidFormatException {
Collection<PermissionEntry> permissions = new HashSet<PermissionEntry>();
parsing: while (true) {
switch (st.nextToken()) {
case StreamTokenizer.TT_WORD:
if (Util.equalsIgnoreCase("permission", st.sval)) {
PermissionEntry pe = new PermissionEntry();
if (st.nextToken() == StreamTokenizer.TT_WORD) {
pe.klass = st.sval;
if (st.nextToken() == '"') {
pe.name = st.sval;
st.nextToken();
}
if (st.ttype == ',') {
st.nextToken();
}
if (st.ttype == '"') {
pe.actions = st.sval;
if (st.nextToken() == ',') {
st.nextToken();
}
}
if (st.ttype == StreamTokenizer.TT_WORD
&& Util.equalsIgnoreCase("signedby", st.sval)) {
if (st.nextToken() == '"') {
pe.signers = st.sval;
} else {
handleUnexpectedToken(st);
}
} else { // handle token in the next iteration
st.pushBack();
}
permissions.add(pe);
continue parsing;
}
}
handleUnexpectedToken(st, "Expected syntax is permission permission_class_name [\"target_name\"] [, \"action_list\"] [, signedby \"name1,...,nameN\"]");
break;
case ';': //just delimiter of entries
break;
case '}': //end of list
break parsing;
default: // invalid token
handleUnexpectedToken(st);
break;
}
}
return permissions;
}
|
Collection<PermissionEntry> function( StreamTokenizer st) throws IOException, InvalidFormatException { Collection<PermissionEntry> permissions = new HashSet<PermissionEntry>(); parsing: while (true) { switch (st.nextToken()) { case StreamTokenizer.TT_WORD: if (Util.equalsIgnoreCase(STR, st.sval)) { PermissionEntry pe = new PermissionEntry(); if (st.nextToken() == StreamTokenizer.TT_WORD) { pe.klass = st.sval; if (st.nextToken() == 'STR') { pe.actions = st.sval; if (st.nextToken() == ',') { st.nextToken(); } } if (st.ttype == StreamTokenizer.TT_WORD && Util.equalsIgnoreCase(STR, st.sval)) { if (st.nextToken() == 'STRExpected syntax is permission permission_class_name [\STR] [, \STR] [, signedby \STR]"); break; case ';': break; case '}': break parsing; default: handleUnexpectedToken(st); break; } } return permissions; }
|
/**
* Tries to read a list of <i>permission </i> entries. The expected syntax
* is
*
* <pre>
*
* permission permission_class_name
* [ "target_name" ] [, "action_list"]
* [, signedby "name1,name2,..."];
*
* </pre>
*
* List is terminated by '}' (closing curly brace) symbol.
*
* @return collection of successfully parsed PermissionEntries
* @throws IOException
* if stream reading failed
* @throws InvalidFormatException
* if unexpected or unknown token encountered
*/
|
Tries to read a list of permission entries. The expected syntax is <code> permission permission_class_name [ "target_name" ] [, "action_list"] [, signedby "name1,name2,..."]; </code> List is terminated by '}' (closing curly brace) symbol
|
readPermissionEntries
|
{
"repo_name": "openweave/openweave-core",
"path": "third_party/android/platform-libcore/android-platform-libcore/luni/src/main/java/org/apache/harmony/security/DefaultPolicyScanner.java",
"license": "apache-2.0",
"size": 17688
}
|
[
"java.io.IOException",
"java.io.StreamTokenizer",
"java.util.Collection",
"java.util.HashSet"
] |
import java.io.IOException; import java.io.StreamTokenizer; import java.util.Collection; import java.util.HashSet;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 1,524,270
|
List<String> getLanguageNames();
|
List<String> getLanguageNames();
|
/**
* Gets a readonly list with the names of the languages currently registered.
*
* @return a readonly list with the names of the the languages
*/
|
Gets a readonly list with the names of the languages currently registered
|
getLanguageNames
|
{
"repo_name": "NickCis/camel",
"path": "camel-core/src/main/java/org/apache/camel/CamelContext.java",
"license": "apache-2.0",
"size": 74001
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,112,017
|
public OpenIndexRequest indicesOptions(IndicesOptions indicesOptions) {
this.indicesOptions = indicesOptions;
return this;
}
|
OpenIndexRequest function(IndicesOptions indicesOptions) { this.indicesOptions = indicesOptions; return this; }
|
/**
* Specifies what type of requested indices to ignore and how to deal with wildcard expressions.
* For example indices that don't exist.
*
* @param indicesOptions the desired behaviour regarding indices to ignore and wildcard indices expressions
* @return the request itself
*/
|
Specifies what type of requested indices to ignore and how to deal with wildcard expressions. For example indices that don't exist
|
indicesOptions
|
{
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/action/admin/indices/open/OpenIndexRequest.java",
"license": "apache-2.0",
"size": 5494
}
|
[
"org.elasticsearch.action.support.IndicesOptions"
] |
import org.elasticsearch.action.support.IndicesOptions;
|
import org.elasticsearch.action.support.*;
|
[
"org.elasticsearch.action"
] |
org.elasticsearch.action;
| 2,520,607
|
public static boolean ping(String url, int timeout) {
//url = url.replaceFirst("https", "http"); // Otherwise an exception may be thrown on invalid SSL certificates.
try {
HttpURLConnection connection = (HttpURLConnection) prepareURLConnection(url, timeout);
connection.setRequestMethod("HEAD");
int responseCode = connection.getResponseCode();
return (200 <= responseCode && responseCode <= 399);
} catch (IOException exception) {
return false;
}
}
|
static boolean function(String url, int timeout) { try { HttpURLConnection connection = (HttpURLConnection) prepareURLConnection(url, timeout); connection.setRequestMethod("HEAD"); int responseCode = connection.getResponseCode(); return (200 <= responseCode && responseCode <= 399); } catch (IOException exception) { return false; } }
|
/**
* Pings a HTTP URL. This effectively sends a HEAD request and returns
* <code>true</code> if the response code is in the 200-399 range.
*
* @param url The HTTP URL to be pinged.
* @param timeout The timeout in millis for both the connection timeout and
* the response read timeout. Note that the total timeout is effectively two
* times the given timeout.
* @return <code>true</code> if the given HTTP URL has returned response
* code 200-399 on a HEAD request within the given timeout, otherwise
* <code>false</code>.
* @author BalusC,
* http://stackoverflow.com/questions/3584210/preferred-java-way-to-ping-a-http-url-for-availability
*/
|
Pings a HTTP URL. This effectively sends a HEAD request and returns <code>true</code> if the response code is in the 200-399 range
|
ping
|
{
"repo_name": "lafita/biojava",
"path": "biojava-core/src/main/java/org/biojava/nbio/core/util/FileDownloadUtils.java",
"license": "lgpl-2.1",
"size": 9094
}
|
[
"java.io.IOException",
"java.net.HttpURLConnection"
] |
import java.io.IOException; import java.net.HttpURLConnection;
|
import java.io.*; import java.net.*;
|
[
"java.io",
"java.net"
] |
java.io; java.net;
| 1,168,574
|
public synchronized void addPersistedDelegationToken(
DelegationTokenIdentifier identifier, long expiryTime)
throws IOException {
if (running) {
// a safety check
throw new IOException(
"Can't add persisted delegation token to a running SecretManager.");
}
int keyId = identifier.getMasterKeyId();
DelegationKey dKey = allKeys.get(keyId);
if (dKey == null) {
LOG.warn(
"No KEY found for persisted identifier " + identifier.toString());
return;
}
byte[] password = createPassword(identifier.getBytes(), dKey.getKey());
if (identifier.getSequenceNumber() > this.delegationTokenSequenceNumber) {
this.delegationTokenSequenceNumber = identifier.getSequenceNumber();
}
if (currentTokens.get(identifier) == null) {
currentTokens.put(identifier,
new DelegationTokenInformation(expiryTime, password));
} else {
throw new IOException(
"Same delegation token being added twice; invalid entry in fsimage or editlogs");
}
}
|
synchronized void function( DelegationTokenIdentifier identifier, long expiryTime) throws IOException { if (running) { throw new IOException( STR); } int keyId = identifier.getMasterKeyId(); DelegationKey dKey = allKeys.get(keyId); if (dKey == null) { LOG.warn( STR + identifier.toString()); return; } byte[] password = createPassword(identifier.getBytes(), dKey.getKey()); if (identifier.getSequenceNumber() > this.delegationTokenSequenceNumber) { this.delegationTokenSequenceNumber = identifier.getSequenceNumber(); } if (currentTokens.get(identifier) == null) { currentTokens.put(identifier, new DelegationTokenInformation(expiryTime, password)); } else { throw new IOException( STR); } }
|
/**
* This method is intended to be used only while reading edit logs.
*
* @param identifier
* DelegationTokenIdentifier read from the edit logs or
* fsimage
* @param expiryTime
* token expiry time
* @throws IOException
*/
|
This method is intended to be used only while reading edit logs
|
addPersistedDelegationToken
|
{
"repo_name": "srijeyanthan/hops",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java",
"license": "apache-2.0",
"size": 11121
}
|
[
"java.io.IOException",
"org.apache.hadoop.security.token.delegation.DelegationKey"
] |
import java.io.IOException; import org.apache.hadoop.security.token.delegation.DelegationKey;
|
import java.io.*; import org.apache.hadoop.security.token.delegation.*;
|
[
"java.io",
"org.apache.hadoop"
] |
java.io; org.apache.hadoop;
| 1,617,086
|
public final void removeTeamRule(final TeamRule rule) {
getTeamRulesModifiable().remove(rule);
}
|
final void function(final TeamRule rule) { getTeamRulesModifiable().remove(rule); }
|
/**
* Removes a team rule.
*
* @param rule
* the team rule to remove
*/
|
Removes a team rule
|
removeTeamRule
|
{
"repo_name": "Bernardo-MG/dreadball-model-persistence",
"path": "src/main/java/com/bernardomg/tabletop/dreadball/model/persistence/faction/PersistentTeamType.java",
"license": "apache-2.0",
"size": 6028
}
|
[
"com.bernardomg.tabletop.dreadball.model.faction.TeamRule"
] |
import com.bernardomg.tabletop.dreadball.model.faction.TeamRule;
|
import com.bernardomg.tabletop.dreadball.model.faction.*;
|
[
"com.bernardomg.tabletop"
] |
com.bernardomg.tabletop;
| 2,638,594
|
@Test(groups = { "setup", "database", "couchdb" }, dependsOnMethods = { "persistProjectTest" })
public void findNewProjectByIdTest() throws Exception {
WifProject project = wifProjectDao.findProjectById(newProjectId);
Assert.assertNotNull(project);
Assert.assertNotNull(project.getCreationDate());
}
|
@Test(groups = { "setup", STR, STR }, dependsOnMethods = { STR }) void function() throws Exception { WifProject project = wifProjectDao.findProjectById(newProjectId); Assert.assertNotNull(project); Assert.assertNotNull(project.getCreationDate()); }
|
/**
* Find new project by id test.
*
* @throws Exception
* the exception
*/
|
Find new project by id test
|
findNewProjectByIdTest
|
{
"repo_name": "tosseto/online-whatif",
"path": "src/test/java/au/org/aurin/wif/repo/impl/CouchWifProjectDaoIT.java",
"license": "mit",
"size": 3828
}
|
[
"au.org.aurin.wif.model.WifProject",
"org.testng.Assert",
"org.testng.annotations.Test"
] |
import au.org.aurin.wif.model.WifProject; import org.testng.Assert; import org.testng.annotations.Test;
|
import au.org.aurin.wif.model.*; import org.testng.*; import org.testng.annotations.*;
|
[
"au.org.aurin",
"org.testng",
"org.testng.annotations"
] |
au.org.aurin; org.testng; org.testng.annotations;
| 1,716,086
|
@Test
public void thenAcceptAsyncExample() {
StringBuilder result = new StringBuilder();
CompletableFuture<Void> cf = CompletableFuture.completedFuture("thenAcceptAsync message")
.thenAcceptAsync(result::append);
System.out.println("before cf.join() : " + result);
cf.join();
System.out.println("after cf.join() : " + result);
assertTrue("Result was empty", result.length() > 0);
}
|
void function() { StringBuilder result = new StringBuilder(); CompletableFuture<Void> cf = CompletableFuture.completedFuture(STR) .thenAcceptAsync(result::append); System.out.println(STR + result); cf.join(); System.out.println(STR + result); assertTrue(STR, result.length() > 0); }
|
/**
* 7. Asynchronously consuming result of previous stage
* <p>
* Again, using the async version of thenAccept, the chained CompletableFuture would execute asynchronously:
*/
|
7. Asynchronously consuming result of previous stage Again, using the async version of thenAccept, the chained CompletableFuture would execute asynchronously:
|
thenAcceptAsyncExample
|
{
"repo_name": "yuweijun/learning-programming",
"path": "language-java/src/test/java/com/example/util/concurrent/CompletableFutureExamples.java",
"license": "mit",
"size": 23884
}
|
[
"java.util.concurrent.CompletableFuture",
"org.junit.Assert"
] |
import java.util.concurrent.CompletableFuture; import org.junit.Assert;
|
import java.util.concurrent.*; import org.junit.*;
|
[
"java.util",
"org.junit"
] |
java.util; org.junit;
| 1,738,057
|
public static void main(final String[] args) throws RunnerException
{
BenchmarkSuiteRunner.runJmhBasicBenchmarkWithCommandLine(BenchmarkHashCollisions.class, args, 1000, 2000);
}
|
static void function(final String[] args) throws RunnerException { BenchmarkSuiteRunner.runJmhBasicBenchmarkWithCommandLine(BenchmarkHashCollisions.class, args, 1000, 2000); }
|
/**
* Running main
* @param args
* @throws RunnerException
*/
|
Running main
|
main
|
{
"repo_name": "vsonnier/hppcrt",
"path": "hppcrt-benchmarks/src/main/java/com/carrotsearch/hppcrt/jmh/BenchmarkHashCollisions.java",
"license": "apache-2.0",
"size": 7129
}
|
[
"com.carrotsearch.hppcrt.BenchmarkSuiteRunner",
"org.openjdk.jmh.runner.RunnerException"
] |
import com.carrotsearch.hppcrt.BenchmarkSuiteRunner; import org.openjdk.jmh.runner.RunnerException;
|
import com.carrotsearch.hppcrt.*; import org.openjdk.jmh.runner.*;
|
[
"com.carrotsearch.hppcrt",
"org.openjdk.jmh"
] |
com.carrotsearch.hppcrt; org.openjdk.jmh;
| 604,497
|
private void appendHeaders(HttpHeaders headers, StringBuilder builder) {
for (Entry<String, List<String>> headerEntry : headers.entrySet()) {
builder.append(headerEntry.getKey());
builder.append(":");
builder.append(StringUtils.arrayToCommaDelimitedString(headerEntry.getValue().toArray()));
builder.append(NEWLINE);
}
}
private static final class CachingClientHttpResponseWrapper implements ClientHttpResponse {
private final ClientHttpResponse response;
private byte[] body;
CachingClientHttpResponseWrapper(ClientHttpResponse response) {
this.response = response;
}
|
void function(HttpHeaders headers, StringBuilder builder) { for (Entry<String, List<String>> headerEntry : headers.entrySet()) { builder.append(headerEntry.getKey()); builder.append(":"); builder.append(StringUtils.arrayToCommaDelimitedString(headerEntry.getValue().toArray())); builder.append(NEWLINE); } } private static final class CachingClientHttpResponseWrapper implements ClientHttpResponse { private final ClientHttpResponse response; private byte[] body; CachingClientHttpResponseWrapper(ClientHttpResponse response) { this.response = response; }
|
/**
* Append Http headers to string builder.
* @param headers
* @param builder
*/
|
Append Http headers to string builder
|
appendHeaders
|
{
"repo_name": "christophd/citrus",
"path": "endpoints/citrus-http/src/main/java/com/consol/citrus/http/interceptor/LoggingClientInterceptor.java",
"license": "apache-2.0",
"size": 7376
}
|
[
"java.util.List",
"java.util.Map",
"org.springframework.http.HttpHeaders",
"org.springframework.http.client.ClientHttpResponse",
"org.springframework.util.StringUtils"
] |
import java.util.List; import java.util.Map; import org.springframework.http.HttpHeaders; import org.springframework.http.client.ClientHttpResponse; import org.springframework.util.StringUtils;
|
import java.util.*; import org.springframework.http.*; import org.springframework.http.client.*; import org.springframework.util.*;
|
[
"java.util",
"org.springframework.http",
"org.springframework.util"
] |
java.util; org.springframework.http; org.springframework.util;
| 1,054,225
|
public NavigableMap<byte[], byte[]> getFamilyMap(byte [] family) {
if(this.familyMap == null) {
getMap();
}
if(isEmpty()) {
return null;
}
NavigableMap<byte[], byte[]> returnMap = new TreeMap<>(Bytes.BYTES_COMPARATOR);
NavigableMap<byte[], NavigableMap<Long, byte[]>> qualifierMap =
familyMap.get(family);
if(qualifierMap == null) {
return returnMap;
}
for(Map.Entry<byte[], NavigableMap<Long, byte[]>> entry :
qualifierMap.entrySet()) {
byte [] value =
entry.getValue().get(entry.getValue().firstKey());
returnMap.put(entry.getKey(), value);
}
return returnMap;
}
|
NavigableMap<byte[], byte[]> function(byte [] family) { if(this.familyMap == null) { getMap(); } if(isEmpty()) { return null; } NavigableMap<byte[], byte[]> returnMap = new TreeMap<>(Bytes.BYTES_COMPARATOR); NavigableMap<byte[], NavigableMap<Long, byte[]>> qualifierMap = familyMap.get(family); if(qualifierMap == null) { return returnMap; } for(Map.Entry<byte[], NavigableMap<Long, byte[]>> entry : qualifierMap.entrySet()) { byte [] value = entry.getValue().get(entry.getValue().firstKey()); returnMap.put(entry.getKey(), value); } return returnMap; }
|
/**
* Map of qualifiers to values.
* <p>
* Returns a Map of the form: <code>Map<qualifier,value></code>
* @param family column family to get
* @return map of qualifiers to values
*/
|
Map of qualifiers to values. Returns a Map of the form: <code>Map<qualifier,value></code>
|
getFamilyMap
|
{
"repo_name": "ndimiduk/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/Result.java",
"license": "apache-2.0",
"size": 34271
}
|
[
"java.util.Map",
"java.util.NavigableMap",
"java.util.TreeMap",
"org.apache.hadoop.hbase.util.Bytes"
] |
import java.util.Map; import java.util.NavigableMap; import java.util.TreeMap; import org.apache.hadoop.hbase.util.Bytes;
|
import java.util.*; import org.apache.hadoop.hbase.util.*;
|
[
"java.util",
"org.apache.hadoop"
] |
java.util; org.apache.hadoop;
| 1,102,414
|
// ===================================================================
// ===================================================================
public boolean isCommandAllowed(String classname, String cmd) throws DevFailed {
return databaseDAO.isCommandAllowed(this, classname, cmd);
}
|
boolean function(String classname, String cmd) throws DevFailed { return databaseDAO.isCommandAllowed(this, classname, cmd); }
|
/**
* Check for specified class, the specified command is allowed.
*
* @param classname Specified class name.
* @param cmd Specified command name.
* @return true if specified command is allowed
* @throws DevFailed in case of database access failed
*/
|
Check for specified class, the specified command is allowed
|
isCommandAllowed
|
{
"repo_name": "tango-controls/JTango",
"path": "common/src/main/java/fr/esrf/TangoApi/Database.java",
"license": "lgpl-3.0",
"size": 86099
}
|
[
"fr.esrf.Tango"
] |
import fr.esrf.Tango;
|
import fr.esrf.*;
|
[
"fr.esrf"
] |
fr.esrf;
| 163,903
|
@Test void testToArray() {
int[][] arrays = {{}, {0}, {0, 2}, {1, 65}, {100}};
for (int[] array : arrays) {
assertThat(ImmutableBitSet.of(array).toArray(), equalTo(array));
}
}
|
@Test void testToArray() { int[][] arrays = {{}, {0}, {0, 2}, {1, 65}, {100}}; for (int[] array : arrays) { assertThat(ImmutableBitSet.of(array).toArray(), equalTo(array)); } }
|
/**
* Tests the method
* {@link org.apache.calcite.util.ImmutableBitSet#toArray}.
*/
|
Tests the method <code>org.apache.calcite.util.ImmutableBitSet#toArray</code>
|
testToArray
|
{
"repo_name": "vlsi/calcite",
"path": "core/src/test/java/org/apache/calcite/util/ImmutableBitSetTest.java",
"license": "apache-2.0",
"size": 23545
}
|
[
"org.hamcrest.CoreMatchers",
"org.hamcrest.MatcherAssert",
"org.junit.jupiter.api.Test"
] |
import org.hamcrest.CoreMatchers; import org.hamcrest.MatcherAssert; import org.junit.jupiter.api.Test;
|
import org.hamcrest.*; import org.junit.jupiter.api.*;
|
[
"org.hamcrest",
"org.junit.jupiter"
] |
org.hamcrest; org.junit.jupiter;
| 2,006,852
|
private void report(JSError error) throws JsonMLException {
report(error, true);
}
|
void function(JSError error) throws JsonMLException { report(error, true); }
|
/**
* Reports a new parser error to the compiler and terminates the job.
* @param error JSError instance to be passed to the compiler
*/
|
Reports a new parser error to the compiler and terminates the job
|
report
|
{
"repo_name": "wenzowski/closure-compiler",
"path": "src/com/google/javascript/jscomp/jsonml/Reader.java",
"license": "apache-2.0",
"size": 44938
}
|
[
"com.google.javascript.jscomp.JSError"
] |
import com.google.javascript.jscomp.JSError;
|
import com.google.javascript.jscomp.*;
|
[
"com.google.javascript"
] |
com.google.javascript;
| 1,693,281
|
void presentModals(List<Dispatcher.Dispatch> modals, final Dispatcher.Callback callback) {
Preconditions.checkNotNull(view, "Container view cannot be null");
Preconditions.checkArgument(view.hasCurrentView(), "Container view must have current view");
Preconditions.checkNull(dispatchingCallback, "Previous dispatching callback not completed");
Logger.d("Present modals: %d", modals.size());
// set and track the callback from dispatcher
// dispatcher is waiting for the onComplete call
// either when present is done, or when presenter is desactivated
dispatchingCallback = callback;
// first, build the views for new modals, or reuse old ones for existing modals
final List<NavigatorView.Presentation> presentations = new ArrayList<>(modals.size());
Dispatcher.Dispatch dispatch;
ViewTransition viewTransition;
View newView;
ViewTransitionDirection direction;
for (int i = 0; i < modals.size(); i++) {
dispatch = modals.get(i);
Logger.d("%s : %s", dispatch.entry.scopeName, dispatch.entry.dead ? "DEAD" : "ALIVE");
boolean addView;
if (dispatch.entry.dead) {
newView = view.getChildAt(0);
addView = false;
direction = ViewTransitionDirection.BACKWARD;
Logger.d("Reuse view");
} else {
newView = dispatch.entry.path.createView(dispatch.scope.createContext(view.getContext()), view);
addView = true;
direction = ViewTransitionDirection.FORWARD;
Logger.d("Create new view");
}
viewTransition = transitions.findTransition(view.getCurrentView(), newView, direction);
presentations.add(new NavigatorView.Presentation(newView, addView, !addView, direction, viewTransition));
}
// show/hide them all at once
// keep track of view transitions that are finished
// and complete dispatching callback one all are done
Logger.d("Show presentations: %d", presentations.size());
view.showModals(presentations, new PresentationCallback() {
|
void presentModals(List<Dispatcher.Dispatch> modals, final Dispatcher.Callback callback) { Preconditions.checkNotNull(view, STR); Preconditions.checkArgument(view.hasCurrentView(), STR); Preconditions.checkNull(dispatchingCallback, STR); Logger.d(STR, modals.size()); dispatchingCallback = callback; final List<NavigatorView.Presentation> presentations = new ArrayList<>(modals.size()); Dispatcher.Dispatch dispatch; ViewTransition viewTransition; View newView; ViewTransitionDirection direction; for (int i = 0; i < modals.size(); i++) { dispatch = modals.get(i); Logger.d(STR, dispatch.entry.scopeName, dispatch.entry.dead ? "DEAD" : "ALIVE"); boolean addView; if (dispatch.entry.dead) { newView = view.getChildAt(0); addView = false; direction = ViewTransitionDirection.BACKWARD; Logger.d(STR); } else { newView = dispatch.entry.path.createView(dispatch.scope.createContext(view.getContext()), view); addView = true; direction = ViewTransitionDirection.FORWARD; Logger.d(STR); } viewTransition = transitions.findTransition(view.getCurrentView(), newView, direction); presentations.add(new NavigatorView.Presentation(newView, addView, !addView, direction, viewTransition)); } Logger.d(STR, presentations.size()); view.showModals(presentations, new PresentationCallback() {
|
/**
* Present several modals that will all show/hide in parallel
* Once all view transitions have been executed, the dispatcher callback will complete
*/
|
Present several modals that will all show/hide in parallel Once all view transitions have been executed, the dispatcher callback will complete
|
presentModals
|
{
"repo_name": "Wrywulf/Mortar-architect",
"path": "architect/src/main/java/architect/Presenter.java",
"license": "mit",
"size": 11262
}
|
[
"android.view.View",
"java.util.ArrayList",
"java.util.List"
] |
import android.view.View; import java.util.ArrayList; import java.util.List;
|
import android.view.*; import java.util.*;
|
[
"android.view",
"java.util"
] |
android.view; java.util;
| 2,610,875
|
void removeAttributes(PerunSession sess, Resource resource, Group group, List<? extends AttributeDefinition> attributes) throws PrivilegeException, ResourceNotExistsException, GroupNotExistsException, AttributeNotExistsException, WrongAttributeAssignmentException, GroupResourceMismatchException, WrongAttributeValueException, WrongReferenceAttributeValueException;
|
void removeAttributes(PerunSession sess, Resource resource, Group group, List<? extends AttributeDefinition> attributes) throws PrivilegeException, ResourceNotExistsException, GroupNotExistsException, AttributeNotExistsException, WrongAttributeAssignmentException, GroupResourceMismatchException, WrongAttributeValueException, WrongReferenceAttributeValueException;
|
/**
* PRIVILEGE: Remove attributes only when principal has access to write on them.
* <p>
* Batch version of removeAttribute
*
* @see AttributesManager#removeAttribute(PerunSession, Resource, Group, AttributeDefinition)
*/
|
Batch version of removeAttribute
|
removeAttributes
|
{
"repo_name": "zoraseb/perun",
"path": "perun-core/src/main/java/cz/metacentrum/perun/core/api/AttributesManager.java",
"license": "bsd-2-clause",
"size": 265364
}
|
[
"cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException",
"cz.metacentrum.perun.core.api.exceptions.GroupNotExistsException",
"cz.metacentrum.perun.core.api.exceptions.GroupResourceMismatchException",
"cz.metacentrum.perun.core.api.exceptions.PrivilegeException",
"cz.metacentrum.perun.core.api.exceptions.ResourceNotExistsException",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException",
"cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException",
"cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException",
"java.util.List"
] |
import cz.metacentrum.perun.core.api.exceptions.AttributeNotExistsException; import cz.metacentrum.perun.core.api.exceptions.GroupNotExistsException; import cz.metacentrum.perun.core.api.exceptions.GroupResourceMismatchException; import cz.metacentrum.perun.core.api.exceptions.PrivilegeException; import cz.metacentrum.perun.core.api.exceptions.ResourceNotExistsException; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeAssignmentException; import cz.metacentrum.perun.core.api.exceptions.WrongAttributeValueException; import cz.metacentrum.perun.core.api.exceptions.WrongReferenceAttributeValueException; import java.util.List;
|
import cz.metacentrum.perun.core.api.exceptions.*; import java.util.*;
|
[
"cz.metacentrum.perun",
"java.util"
] |
cz.metacentrum.perun; java.util;
| 1,122,956
|
protected void addMappedRolePropertyDescriptor(Object object) {
itemPropertyDescriptors.add
(createItemPropertyDescriptor
(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
getResourceLocator(),
getString("_UI_AssocEndMapping_mappedRole_feature"),
getString("_UI_PropertyDescriptor_description", "_UI_AssocEndMapping_mappedRole_feature", "_UI_AssocEndMapping_type"),
MapperPackage.Literals.ASSOC_END_MAPPING__MAPPED_ROLE,
true,
false,
false,
ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
null,
null));
}
|
void function(Object object) { itemPropertyDescriptors.add (createItemPropertyDescriptor (((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(), getResourceLocator(), getString(STR), getString(STR, STR, STR), MapperPackage.Literals.ASSOC_END_MAPPING__MAPPED_ROLE, true, false, false, ItemPropertyDescriptor.GENERIC_VALUE_IMAGE, null, null)); }
|
/**
* This adds a property descriptor for the Mapped Role feature.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
|
This adds a property descriptor for the Mapped Role feature.
|
addMappedRolePropertyDescriptor
|
{
"repo_name": "openmapsoftware/mappingtools",
"path": "openmap-mapper-edit/src/main/java/com/openMap1/mapper/provider/AssocEndMappingItemProvider.java",
"license": "epl-1.0",
"size": 7780
}
|
[
"org.eclipse.emf.edit.provider.ComposeableAdapterFactory",
"org.eclipse.emf.edit.provider.ItemPropertyDescriptor"
] |
import org.eclipse.emf.edit.provider.ComposeableAdapterFactory; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
|
import org.eclipse.emf.edit.provider.*;
|
[
"org.eclipse.emf"
] |
org.eclipse.emf;
| 59,664
|
@Test
public void lockWriteAndCheckNameAndParent() throws Exception {
String name = "file";
InodeFile inode1 = createInodeFile(1);
InodeDirectory dir1 = createInodeDirectory();
inode1.setName(name);
inode1.setParentId(dir1.getId());
inode1.lockWriteAndCheckNameAndParent(dir1, name);
Assert.assertTrue(inode1.isWriteLocked());
inode1.unlockWrite();
}
|
void function() throws Exception { String name = "file"; InodeFile inode1 = createInodeFile(1); InodeDirectory dir1 = createInodeDirectory(); inode1.setName(name); inode1.setParentId(dir1.getId()); inode1.lockWriteAndCheckNameAndParent(dir1, name); Assert.assertTrue(inode1.isWriteLocked()); inode1.unlockWrite(); }
|
/**
* Tests the {@link Inode#lockWriteAndCheckNameAndParent(Inode, String)} method.
*/
|
Tests the <code>Inode#lockWriteAndCheckNameAndParent(Inode, String)</code> method
|
lockWriteAndCheckNameAndParent
|
{
"repo_name": "yuluo-ding/alluxio",
"path": "core/server/master/src/test/java/alluxio/master/file/meta/InodeFileTest.java",
"license": "apache-2.0",
"size": 12808
}
|
[
"org.junit.Assert"
] |
import org.junit.Assert;
|
import org.junit.*;
|
[
"org.junit"
] |
org.junit;
| 1,724,814
|
public static List<String> readLines(File file) throws IOException {
BufferedReader reader = new BufferedReader(new FileReader(file));
List<String> answer = new ArrayList<String>();
try {
while (true) {
String line = reader.readLine();
if (line != null) {
answer.add(line);
} else {
break;
}
}
} finally {
reader.close();
}
return answer;
}
/**
* Writes the given lines to the {@link File}
|
static List<String> function(File file) throws IOException { BufferedReader reader = new BufferedReader(new FileReader(file)); List<String> answer = new ArrayList<String>(); try { while (true) { String line = reader.readLine(); if (line != null) { answer.add(line); } else { break; } } } finally { reader.close(); } return answer; } /** * Writes the given lines to the {@link File}
|
/**
* Reads a {@link File} and returns the list of lines
*/
|
Reads a <code>File</code> and returns the list of lines
|
readLines
|
{
"repo_name": "rajdavies/fabric8",
"path": "components/fabric8-utils/src/main/java/io/fabric8/utils/Files.java",
"license": "apache-2.0",
"size": 19018
}
|
[
"java.io.BufferedReader",
"java.io.File",
"java.io.FileReader",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List"
] |
import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List;
|
import java.io.*; import java.util.*;
|
[
"java.io",
"java.util"
] |
java.io; java.util;
| 2,522,554
|
public void setNotifiedUsers(List<QualifiedUsers> notifiedUsersList);
|
void function(List<QualifiedUsers> notifiedUsersList);
|
/**
* Set all the users that have to be notified
* @param QualifiedUsers object containing notified users
*/
|
Set all the users that have to be notified
|
setNotifiedUsers
|
{
"repo_name": "NicolasEYSSERIC/Silverpeas-Core",
"path": "ejb-core/formtemplate/src/main/java/com/silverpeas/workflow/api/model/Consequence.java",
"license": "agpl-3.0",
"size": 4702
}
|
[
"java.util.List"
] |
import java.util.List;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 2,731,627
|
@Transactional(readOnly = false)
public boolean deleteType(final Long typeId) {
try {
Type t = this.typeDao.getTypeById(typeId);
if (t.equals(typeDao.getTypeByName(NewsConstants.DEFAULT_TYPE))) {
throw new IllegalArgumentException("This isn't authorized to delete the default type.");
}
return this.typeDao.deleteTypeById(typeId);
} catch (DataAccessException e) {
LOG.error("Delete Type error : " + e.getLocalizedMessage());
throw e;
}
}
|
@Transactional(readOnly = false) boolean function(final Long typeId) { try { Type t = this.typeDao.getTypeById(typeId); if (t.equals(typeDao.getTypeByName(NewsConstants.DEFAULT_TYPE))) { throw new IllegalArgumentException(STR); } return this.typeDao.deleteTypeById(typeId); } catch (DataAccessException e) { LOG.error(STR + e.getLocalizedMessage()); throw e; } }
|
/**
* Supprimer un type.
* @param typeId
* @return true si la suppression s'est bien passée, faux sinon.
*/
|
Supprimer un type
|
deleteType
|
{
"repo_name": "GIP-RECIA/esup-news",
"path": "src/org/esco/portlets/news/services/TypeManagerImpl.java",
"license": "gpl-3.0",
"size": 7612
}
|
[
"org.esco.portlets.news.domain.Type",
"org.springframework.dao.DataAccessException",
"org.springframework.transaction.annotation.Transactional",
"org.uhp.portlets.news.NewsConstants"
] |
import org.esco.portlets.news.domain.Type; import org.springframework.dao.DataAccessException; import org.springframework.transaction.annotation.Transactional; import org.uhp.portlets.news.NewsConstants;
|
import org.esco.portlets.news.domain.*; import org.springframework.dao.*; import org.springframework.transaction.annotation.*; import org.uhp.portlets.news.*;
|
[
"org.esco.portlets",
"org.springframework.dao",
"org.springframework.transaction",
"org.uhp.portlets"
] |
org.esco.portlets; org.springframework.dao; org.springframework.transaction; org.uhp.portlets;
| 919,575
|
public String deadlineDateRule(DevelopmentProposal developmentProposal, String deadlineDate) {
try {
Date checkDeadLineDate = getDateTimeService().convertToSqlDate(deadlineDate);
if(developmentProposal.getDeadlineDate().before(checkDeadLineDate)) {
return TRUE;
}
}catch(Exception ex) {
LOG.error(ex.getMessage());
}
return FALSE;
}
|
String function(DevelopmentProposal developmentProposal, String deadlineDate) { try { Date checkDeadLineDate = getDateTimeService().convertToSqlDate(deadlineDate); if(developmentProposal.getDeadlineDate().before(checkDeadLineDate)) { return TRUE; } }catch(Exception ex) { LOG.error(ex.getMessage()); } return FALSE; }
|
/**
* This method is to check if the proposal's deadline date is before a specified date.
* @param developmentProposal
* FN_DEADLINE_DATE
*/
|
This method is to check if the proposal's deadline date is before a specified date
|
deadlineDateRule
|
{
"repo_name": "sanjupolus/KC6.oLatest",
"path": "coeus-impl/src/main/java/org/kuali/coeus/propdev/impl/krms/PropDevJavaFunctionKrmsTermServiceImpl.java",
"license": "agpl-3.0",
"size": 47019
}
|
[
"java.sql.Date",
"org.kuali.coeus.propdev.impl.core.DevelopmentProposal"
] |
import java.sql.Date; import org.kuali.coeus.propdev.impl.core.DevelopmentProposal;
|
import java.sql.*; import org.kuali.coeus.propdev.impl.core.*;
|
[
"java.sql",
"org.kuali.coeus"
] |
java.sql; org.kuali.coeus;
| 2,410,400
|
@Override public ImmutableSetMultimap<K, V> build() {
if (keyComparator != null) {
Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>();
List<Map.Entry<K, Collection<V>>> entries = Lists.newArrayList(
builderMultimap.asMap().entrySet());
Collections.sort(
entries,
Ordering.from(keyComparator).<K>onKeys());
for (Map.Entry<K, Collection<V>> entry : entries) {
sortedCopy.putAll(entry.getKey(), entry.getValue());
}
builderMultimap = sortedCopy;
}
return copyOf(builderMultimap, valueComparator);
}
}
|
@Override ImmutableSetMultimap<K, V> function() { if (keyComparator != null) { Multimap<K, V> sortedCopy = new BuilderMultimap<K, V>(); List<Map.Entry<K, Collection<V>>> entries = Lists.newArrayList( builderMultimap.asMap().entrySet()); Collections.sort( entries, Ordering.from(keyComparator).<K>onKeys()); for (Map.Entry<K, Collection<V>> entry : entries) { sortedCopy.putAll(entry.getKey(), entry.getValue()); } builderMultimap = sortedCopy; } return copyOf(builderMultimap, valueComparator); } }
|
/**
* Returns a newly-created immutable set multimap.
*/
|
Returns a newly-created immutable set multimap
|
build
|
{
"repo_name": "mariusj/org.openntf.domino",
"path": "domino/externals/guava/src/main/java/com/google/common/collect/ImmutableSetMultimap.java",
"license": "apache-2.0",
"size": 18824
}
|
[
"java.util.Collection",
"java.util.Collections",
"java.util.List",
"java.util.Map"
] |
import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map;
|
import java.util.*;
|
[
"java.util"
] |
java.util;
| 1,370,314
|
@LogMessage(level = Logger.Level.WARN)
@Message(id = 212053,
value = "CompletionListener/SendAcknowledgementHandler used with confirmationWindowSize=-1. Enable confirmationWindowSize to receive acks from server!",
format = Message.Format.MESSAGE_FORMAT)
void confirmationWindowDisabledWarning();
|
@LogMessage(level = Logger.Level.WARN) @Message(id = 212053, value = STR, format = Message.Format.MESSAGE_FORMAT) void confirmationWindowDisabledWarning();
|
/**
* Warns about usage of {@link org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler} or JMS's {@code CompletionWindow} with
* confirmations disabled (confirmationWindowSize=-1).
*/
|
Warns about usage of <code>org.apache.activemq.artemis.api.core.client.SendAcknowledgementHandler</code> or JMS's CompletionWindow with confirmations disabled (confirmationWindowSize=-1)
|
confirmationWindowDisabledWarning
|
{
"repo_name": "gtully/activemq-artemis",
"path": "artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/ActiveMQClientLogger.java",
"license": "apache-2.0",
"size": 26946
}
|
[
"org.jboss.logging.Logger",
"org.jboss.logging.annotations.LogMessage",
"org.jboss.logging.annotations.Message"
] |
import org.jboss.logging.Logger; import org.jboss.logging.annotations.LogMessage; import org.jboss.logging.annotations.Message;
|
import org.jboss.logging.*; import org.jboss.logging.annotations.*;
|
[
"org.jboss.logging"
] |
org.jboss.logging;
| 904,247
|
Utils.nonNull(m, "Cannot perform SVD on a null.");
return createSVD(m, null);
}
/**
* Create a SVD instance using a spark context.
*
* @param m matrix that is not {@code null}
* @param ctx JavaSparkContext. {@code null} is allowed, but will fall back to Apache Commons Math implementation.
* @return SVD instance that is never {@code null}
|
Utils.nonNull(m, STR); return createSVD(m, null); } /** * Create a SVD instance using a spark context. * * @param m matrix that is not {@code null} * @param ctx JavaSparkContext. {@code null} is allowed, but will fall back to Apache Commons Math implementation. * @return SVD instance that is never {@code null}
|
/**
* Create a SVD instance using Apache Commons Math.
*
* @param m matrix that is not {@code null}
* @return SVD instance that is never {@code null}
*/
|
Create a SVD instance using Apache Commons Math
|
createSVD
|
{
"repo_name": "broadinstitute/hellbender",
"path": "src/main/java/org/broadinstitute/hellbender/utils/svd/SVDFactory.java",
"license": "bsd-3-clause",
"size": 1329
}
|
[
"org.apache.spark.api.java.JavaSparkContext",
"org.broadinstitute.hellbender.utils.Utils"
] |
import org.apache.spark.api.java.JavaSparkContext; import org.broadinstitute.hellbender.utils.Utils;
|
import org.apache.spark.api.java.*; import org.broadinstitute.hellbender.utils.*;
|
[
"org.apache.spark",
"org.broadinstitute.hellbender"
] |
org.apache.spark; org.broadinstitute.hellbender;
| 2,377,811
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.