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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
private Widget getPatternLabel(final FactPattern fp) {
ClickHandler click = new ClickHandler() { | Widget function(final FactPattern fp) { ClickHandler click = new ClickHandler() { | /**
* This returns the pattern label.
*/ | This returns the pattern label | getPatternLabel | {
"repo_name": "cyberdrcarr/guvnor",
"path": "guvnor-webapp-drools/src/main/java/org/drools/guvnor/client/asseteditor/drools/modeldriven/ui/FactPatternWidget.java",
"license": "apache-2.0",
"size": 37669
} | [
"com.google.gwt.event.dom.client.ClickHandler",
"com.google.gwt.user.client.ui.Widget",
"org.drools.ide.common.client.modeldriven.brl.FactPattern"
] | import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.user.client.ui.Widget; import org.drools.ide.common.client.modeldriven.brl.FactPattern; | import com.google.gwt.event.dom.client.*; import com.google.gwt.user.client.ui.*; import org.drools.ide.common.client.modeldriven.brl.*; | [
"com.google.gwt",
"org.drools.ide"
] | com.google.gwt; org.drools.ide; | 1,122,016 |
private boolean removeEldestEntry(Entry<Long, SearchEntry> eldest) {
SearchEntry val = eldest.getValue();
if (val.getPositionLastSeen() + maxAllowedGap < currentPos) {
potentiaHit(eldest.getKey(), eldest.getValue());
return true;
}
return false;
}
}
private static final double THREE_PRECENT = 0.03;
private final ISegmentCache cache;
private final int maxAllowedGap;
private final int minimumHits;
private final int seglen;
public SegmentCacheSearch(ISegmentCache cache, Configuration fpConf,
Configuration searchConf) {
seglen = fpConf.getInt(FingerprintKey.SEGMENT_LENGTH);
minimumHits = searchConf.getInt(SearchKey.MINIMUM_HITS);
maxAllowedGap = minimumHits * seglen
+ (int) Math.ceil((minimumHits * seglen) * THREE_PRECENT);
this.cache = cache;
} | boolean function(Entry<Long, SearchEntry> eldest) { SearchEntry val = eldest.getValue(); if (val.getPositionLastSeen() + maxAllowedGap < currentPos) { potentiaHit(eldest.getKey(), eldest.getValue()); return true; } return false; } } private static final double THREE_PRECENT = 0.03; private final ISegmentCache cache; private final int maxAllowedGap; private final int minimumHits; private final int seglen; public SegmentCacheSearch(ISegmentCache cache, Configuration fpConf, Configuration searchConf) { seglen = fpConf.getInt(FingerprintKey.SEGMENT_LENGTH); minimumHits = searchConf.getInt(SearchKey.MINIMUM_HITS); maxAllowedGap = minimumHits * seglen + (int) Math.ceil((minimumHits * seglen) * THREE_PRECENT); this.cache = cache; } | /**
* Returns true if the search entry has not been updated since last
* {@link #maxAllowedGap} positions while searching the fingerprint.
*
* @param eldest
* @return
*/ | Returns true if the search entry has not been updated since last <code>#maxAllowedGap</code> positions while searching the fingerprint | removeEldestEntry | {
"repo_name": "inter6/jHears",
"path": "jhears-server/src/main/java/org/jhears/server/SegmentCacheSearch.java",
"license": "agpl-3.0",
"size": 9028
} | [
"java.util.Map",
"org.apache.commons.configuration.Configuration",
"org.jhears.cache.ISegmentCache",
"org.jhears.cnf.Cnf"
] | import java.util.Map; import org.apache.commons.configuration.Configuration; import org.jhears.cache.ISegmentCache; import org.jhears.cnf.Cnf; | import java.util.*; import org.apache.commons.configuration.*; import org.jhears.cache.*; import org.jhears.cnf.*; | [
"java.util",
"org.apache.commons",
"org.jhears.cache",
"org.jhears.cnf"
] | java.util; org.apache.commons; org.jhears.cache; org.jhears.cnf; | 1,288,461 |
void removeCq(String cqName) {
// On server side cqName will be server side cqName.
synchronized (cqQueryMapLock) {
HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<>(cqQueryMap);
tmpCqQueryMap.remove(cqName);
this.cqNameToUserAttributesMap.remove(cqName);
cqQueryMap = tmpCqQueryMap;
}
} | void removeCq(String cqName) { synchronized (cqQueryMapLock) { HashMap<String, CqQueryImpl> tmpCqQueryMap = new HashMap<>(cqQueryMap); tmpCqQueryMap.remove(cqName); this.cqNameToUserAttributesMap.remove(cqName); cqQueryMap = tmpCqQueryMap; } } | /**
* Removes given CQ from the cqMap..
*/ | Removes given CQ from the cqMap. | removeCq | {
"repo_name": "pdxrunner/geode",
"path": "geode-cq/src/main/java/org/apache/geode/cache/query/internal/cq/CqServiceImpl.java",
"license": "apache-2.0",
"size": 59842
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,776,858 |
boolean schedule(String taskId);
class TaskSchedulerImpl implements TaskScheduler {
@VisibleForTesting
@Qualifier
@Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME)
public @interface ReservationDuration { }
private static final Logger LOG = Logger.getLogger(TaskSchedulerImpl.class.getName());
private final Storage storage;
private final TaskAssigner assigner;
private final Preemptor preemptor;
private final BiCache<String, TaskGroupKey> reservations;
private final AtomicLong attemptsFired = Stats.exportLong("schedule_attempts_fired");
private final AtomicLong attemptsFailed = Stats.exportLong("schedule_attempts_failed");
private final AtomicLong attemptsNoMatch = Stats.exportLong("schedule_attempts_no_match");
@Inject
TaskSchedulerImpl(
Storage storage,
TaskAssigner assigner,
Preemptor preemptor,
BiCache<String, TaskGroupKey> reservations) {
this.storage = requireNonNull(storage);
this.assigner = requireNonNull(assigner);
this.preemptor = requireNonNull(preemptor);
this.reservations = requireNonNull(reservations);
} | boolean schedule(String taskId); class TaskSchedulerImpl implements TaskScheduler { @Target({ FIELD, PARAMETER, METHOD }) @Retention(RUNTIME) public @interface ReservationDuration { } private static final Logger LOG = Logger.getLogger(TaskSchedulerImpl.class.getName()); private final Storage storage; private final TaskAssigner assigner; private final Preemptor preemptor; private final BiCache<String, TaskGroupKey> reservations; private final AtomicLong attemptsFired = Stats.exportLong(STR); private final AtomicLong attemptsFailed = Stats.exportLong(STR); private final AtomicLong attemptsNoMatch = Stats.exportLong(STR); TaskSchedulerImpl( Storage storage, TaskAssigner assigner, Preemptor preemptor, BiCache<String, TaskGroupKey> reservations) { this.storage = requireNonNull(storage); this.assigner = requireNonNull(assigner); this.preemptor = requireNonNull(preemptor); this.reservations = requireNonNull(reservations); } | /**
* Attempts to schedule a task, possibly performing irreversible actions.
*
* @param taskId The task to attempt to schedule.
* @return {@code true} if the task was scheduled, {@code false} otherwise. The caller should
* call schedule again if {@code false} is returned.
*/ | Attempts to schedule a task, possibly performing irreversible actions | schedule | {
"repo_name": "rosmo/aurora",
"path": "src/main/java/org/apache/aurora/scheduler/scheduling/TaskScheduler.java",
"license": "apache-2.0",
"size": 7347
} | [
"java.lang.annotation.Retention",
"java.lang.annotation.Target",
"java.util.Objects",
"java.util.concurrent.atomic.AtomicLong",
"java.util.logging.Logger",
"org.apache.aurora.common.stats.Stats",
"org.apache.aurora.scheduler.base.TaskGroupKey",
"org.apache.aurora.scheduler.preemptor.BiCache",
"org.a... | import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.Objects; import java.util.concurrent.atomic.AtomicLong; import java.util.logging.Logger; import org.apache.aurora.common.stats.Stats; import org.apache.aurora.scheduler.base.TaskGroupKey; import org.apache.aurora.scheduler.preemptor.BiCache; import org.apache.aurora.scheduler.preemptor.Preemptor; import org.apache.aurora.scheduler.state.TaskAssigner; import org.apache.aurora.scheduler.storage.Storage; | import java.lang.annotation.*; import java.util.*; import java.util.concurrent.atomic.*; import java.util.logging.*; import org.apache.aurora.common.stats.*; import org.apache.aurora.scheduler.base.*; import org.apache.aurora.scheduler.preemptor.*; import org.apache.aurora.scheduler.state.*; import org.apache.aurora.scheduler.storage.*; | [
"java.lang",
"java.util",
"org.apache.aurora"
] | java.lang; java.util; org.apache.aurora; | 1,407,699 |
Form populate(Map<String, List<String>> formData, boolean keepOtherValues);
| Form populate(Map<String, List<String>> formData, boolean keepOtherValues); | /**
* Clears data and validation status (like {@link #reset()}) from all elements in the form only if {@code keepOtherValues} is false,
* and populates them <b>by name</b> calling their {@code populate} method.
* Input data must be a list of Strings or null for every element with a value.
*
* @param formData Form data indexed by element name
* @param keepOtherValues True to keep values of elements not specified in the {@code formData} parameter
* @return This form
*/ | Clears data and validation status (like <code>#reset()</code>) from all elements in the form only if keepOtherValues is false, and populates them by name calling their populate method. Input data must be a list of Strings or null for every element with a value | populate | {
"repo_name": "uniform-java/uniform",
"path": "src/main/java/net/uniform/api/Form.java",
"license": "apache-2.0",
"size": 21618
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,765,955 |
public Properties getProperties()
{
return properties;
} | Properties function() { return properties; } | /**
* Get the display properties.
*
* @return The display properties.
*/ | Get the display properties | getProperties | {
"repo_name": "iritgo/iritgo-aktario",
"path": "aktario-framework/src/main/java/de/iritgo/aktario/core/gui/IDialog.java",
"license": "apache-2.0",
"size": 8641
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,948,118 |
private static List<FactoredLexiconEvent> treebankToLexiconEvents(List<Tree> treebank,
FactoredLexicon lexicon) {
List<FactoredLexiconEvent> events = new ArrayList<FactoredLexiconEvent>(70000);
for (Tree tree : treebank) {
List<Label> yield = tree.yield();
List<Label> preterm = tree.preTerminalYield();
assert yield.size() == preterm.size();
int yieldLen = yield.size();
for (int i = 0; i < yieldLen; ++i) {
String tag = preterm.get(i).value();
int tagId = lexicon.tagIndex.indexOf(tag);
String word = yield.get(i).value();
int wordId = lexicon.wordIndex.indexOf(word);
// Two checks to see if we keep this example
if (tagId < 0) {
System.err.println("Discarding training example: " + word + " " + tag);
continue;
}
// if (counts.probWordTag(wordId, tagId) == 0.0) {
// System.err.println("Discarding low counts <w,t> pair: " + word + " " + tag);
// continue;
// }
String featureStr = ((CoreLabel) yield.get(i)).originalText();
Pair<String,String> lemmaMorph = MorphoFeatureSpecification.splitMorphString(word, featureStr);
String lemma = lemmaMorph.first();
String richTag = lemmaMorph.second();
String reducedTag = lexicon.morphoSpec.strToFeatures(richTag).toString();
reducedTag = reducedTag.length() == 0 ? NO_MORPH_ANALYSIS : reducedTag;
int lemmaId = lexicon.wordIndex.indexOf(lemma);
int morphId = lexicon.morphIndex.indexOf(reducedTag);
FactoredLexiconEvent event = new FactoredLexiconEvent(wordId, tagId, lemmaId, morphId, i, word, featureStr);
events.add(event);
}
}
return events;
} | static List<FactoredLexiconEvent> function(List<Tree> treebank, FactoredLexicon lexicon) { List<FactoredLexiconEvent> events = new ArrayList<FactoredLexiconEvent>(70000); for (Tree tree : treebank) { List<Label> yield = tree.yield(); List<Label> preterm = tree.preTerminalYield(); assert yield.size() == preterm.size(); int yieldLen = yield.size(); for (int i = 0; i < yieldLen; ++i) { String tag = preterm.get(i).value(); int tagId = lexicon.tagIndex.indexOf(tag); String word = yield.get(i).value(); int wordId = lexicon.wordIndex.indexOf(word); if (tagId < 0) { System.err.println(STR + word + " " + tag); continue; } String featureStr = ((CoreLabel) yield.get(i)).originalText(); Pair<String,String> lemmaMorph = MorphoFeatureSpecification.splitMorphString(word, featureStr); String lemma = lemmaMorph.first(); String richTag = lemmaMorph.second(); String reducedTag = lexicon.morphoSpec.strToFeatures(richTag).toString(); reducedTag = reducedTag.length() == 0 ? NO_MORPH_ANALYSIS : reducedTag; int lemmaId = lexicon.wordIndex.indexOf(lemma); int morphId = lexicon.morphIndex.indexOf(reducedTag); FactoredLexiconEvent event = new FactoredLexiconEvent(wordId, tagId, lemmaId, morphId, i, word, featureStr); events.add(event); } } return events; } | /**
* Convert a treebank to factored lexicon events for fast iteration in the
* optimizer.
* @param treebank
* @param tlpp
* @param counts
* @param morphoSpec
* @return
*/ | Convert a treebank to factored lexicon events for fast iteration in the optimizer | treebankToLexiconEvents | {
"repo_name": "amark-india/eventspotter",
"path": "src/edu/stanford/nlp/parser/lexparser/FactoredLexicon.java",
"license": "apache-2.0",
"size": 21351
} | [
"edu.stanford.nlp.international.morph.MorphoFeatureSpecification",
"edu.stanford.nlp.ling.CoreLabel",
"edu.stanford.nlp.ling.Label",
"edu.stanford.nlp.trees.Tree",
"edu.stanford.nlp.util.Pair",
"java.util.ArrayList",
"java.util.List"
] | import edu.stanford.nlp.international.morph.MorphoFeatureSpecification; import edu.stanford.nlp.ling.CoreLabel; import edu.stanford.nlp.ling.Label; import edu.stanford.nlp.trees.Tree; import edu.stanford.nlp.util.Pair; import java.util.ArrayList; import java.util.List; | import edu.stanford.nlp.international.morph.*; import edu.stanford.nlp.ling.*; import edu.stanford.nlp.trees.*; import edu.stanford.nlp.util.*; import java.util.*; | [
"edu.stanford.nlp",
"java.util"
] | edu.stanford.nlp; java.util; | 1,118,427 |
//----------------------------------------------------------------------------
public float getFontSize() throws TextException {
return fontSize;
}
| float function() throws TextException { return fontSize; } | /**
* Returns the font size.
*
* @return the font size
*
* @throws TextException if any error occurs
*
* @author Sebastian Rösgen
*/ | Returns the font size | getFontSize | {
"repo_name": "LibreOffice/noa-libre",
"path": "src/ag/ion/bion/officelayer/internal/text/CharacterPropertyStore.java",
"license": "lgpl-2.1",
"size": 11032
} | [
"ag.ion.bion.officelayer.text.TextException"
] | import ag.ion.bion.officelayer.text.TextException; | import ag.ion.bion.officelayer.text.*; | [
"ag.ion.bion"
] | ag.ion.bion; | 2,427,939 |
public Endpoint getRealEndpoint(MessageContext synCtx) {
reLoadAndInitEndpoint(((Axis2MessageContext) synCtx).
getAxis2MessageContext().getConfigurationContext());
return realEndpoint;
} | Endpoint function(MessageContext synCtx) { reLoadAndInitEndpoint(((Axis2MessageContext) synCtx). getAxis2MessageContext().getConfigurationContext()); return realEndpoint; } | /**
* Get the real endpoint
*
* @param synCtx Message Context
* @return real endpoint which is referred by the indirect endpoint
*/ | Get the real endpoint | getRealEndpoint | {
"repo_name": "asanka88/apache-synapse",
"path": "modules/core/src/main/java/org/apache/synapse/endpoints/IndirectEndpoint.java",
"license": "apache-2.0",
"size": 5991
} | [
"org.apache.synapse.MessageContext",
"org.apache.synapse.core.axis2.Axis2MessageContext"
] | import org.apache.synapse.MessageContext; import org.apache.synapse.core.axis2.Axis2MessageContext; | import org.apache.synapse.*; import org.apache.synapse.core.axis2.*; | [
"org.apache.synapse"
] | org.apache.synapse; | 162,686 |
public interface BattleHandler {
Pokemon[] createTeam(PokemonGo api, Battle battle); | interface BattleHandler { Pokemon[] function(PokemonGo api, Battle battle); | /**
* Called to create a team of Pokemon to use in the battle
*
* @param api the current API
* @param battle the current battle
* @return the team to use in this battle
*/ | Called to create a team of Pokemon to use in the battle | createTeam | {
"repo_name": "Grover-c13/PokeGOAPI-Java",
"path": "library/src/main/java/com/pokegoapi/api/gym/Battle.java",
"license": "gpl-3.0",
"size": 33367
} | [
"com.pokegoapi.api.PokemonGo",
"com.pokegoapi.api.pokemon.Pokemon"
] | import com.pokegoapi.api.PokemonGo; import com.pokegoapi.api.pokemon.Pokemon; | import com.pokegoapi.api.*; import com.pokegoapi.api.pokemon.*; | [
"com.pokegoapi.api"
] | com.pokegoapi.api; | 1,344,030 |
private CTCellProtection getCellProtection() {
if (_cellXf.getProtection() == null) {
_cellXf.addNewProtection();
}
return _cellXf.getProtection();
} | CTCellProtection function() { if (_cellXf.getProtection() == null) { _cellXf.addNewProtection(); } return _cellXf.getProtection(); } | /**
* get a cellProtection from the supplied XML definition
* @return CTCellProtection
*/ | get a cellProtection from the supplied XML definition | getCellProtection | {
"repo_name": "tobyclemson/msci-project",
"path": "vendor/poi-3.6/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFCellStyle.java",
"license": "mit",
"size": 52029
} | [
"org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellProtection"
] | import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCellProtection; | import org.openxmlformats.schemas.spreadsheetml.x2006.main.*; | [
"org.openxmlformats.schemas"
] | org.openxmlformats.schemas; | 443,251 |
public synchronized Map<String, FieldType<?>> getAll() {
return new HashMap<String, FieldType<?>>(this.typesByName);
} | synchronized Map<String, FieldType<?>> function() { return new HashMap<String, FieldType<?>>(this.typesByName); } | /**
* Get all types registered with this instance.
*
* @return mapping from type name to type
*/ | Get all types registered with this instance | getAll | {
"repo_name": "tempbottle/jsimpledb",
"path": "src/java/org/jsimpledb/core/FieldTypeRegistry.java",
"license": "apache-2.0",
"size": 18907
} | [
"java.util.HashMap",
"java.util.Map"
] | import java.util.HashMap; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,093,938 |
public static String getAdminRestAPIResource() throws APIManagementException {
if (adminRestAPIDefinition == null) {
// this is admin API and pick resources accordingly
try {
adminRestAPIDefinition = IOUtils
.toString(RestApiUtil.class.getResourceAsStream(RestApiConstants.ADMIN_API_YAML), "UTF-8");
} catch (IOException e) {
String message = "Error while reading the swagger definition of Admin Rest API";
log.error(message, e);
throw new APIMgtSecurityException(message, ExceptionCodes.API_NOT_FOUND);
}
}
return adminRestAPIDefinition;
} | static String function() throws APIManagementException { if (adminRestAPIDefinition == null) { try { adminRestAPIDefinition = IOUtils .toString(RestApiUtil.class.getResourceAsStream(RestApiConstants.ADMIN_API_YAML), "UTF-8"); } catch (IOException e) { String message = STR; log.error(message, e); throw new APIMgtSecurityException(message, ExceptionCodes.API_NOT_FOUND); } } return adminRestAPIDefinition; } | /**
* This method return API swagger definition of Admin REST API
*
* @return String associated with API Manager admin REST API
* @throws APIManagementException if failed to get admin api resource
*/ | This method return API swagger definition of Admin REST API | getAdminRestAPIResource | {
"repo_name": "Minoli/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.commons/src/main/java/org/wso2/carbon/apimgt/rest/api/common/util/RestApiUtil.java",
"license": "apache-2.0",
"size": 24664
} | [
"java.io.IOException",
"org.apache.commons.io.IOUtils",
"org.wso2.carbon.apimgt.core.exception.APIManagementException",
"org.wso2.carbon.apimgt.core.exception.ExceptionCodes",
"org.wso2.carbon.apimgt.rest.api.common.RestApiConstants",
"org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityExcepti... | import java.io.IOException; import org.apache.commons.io.IOUtils; import org.wso2.carbon.apimgt.core.exception.APIManagementException; import org.wso2.carbon.apimgt.core.exception.ExceptionCodes; import org.wso2.carbon.apimgt.rest.api.common.RestApiConstants; import org.wso2.carbon.apimgt.rest.api.common.exception.APIMgtSecurityException; | import java.io.*; import org.apache.commons.io.*; import org.wso2.carbon.apimgt.core.exception.*; import org.wso2.carbon.apimgt.rest.api.common.*; import org.wso2.carbon.apimgt.rest.api.common.exception.*; | [
"java.io",
"org.apache.commons",
"org.wso2.carbon"
] | java.io; org.apache.commons; org.wso2.carbon; | 1,778,872 |
public boolean processInclude(mxCodec dec, Node node, Object into)
{
if (node.getNodeType() == Node.ELEMENT_NODE
&& node.getNodeName().equalsIgnoreCase("include"))
{
String name = ((Element) node).getAttribute("name");
if (name != null)
{
try
{
Node xml = mxUtils.loadDocument(
mxObjectCodec.class.getResource(name).toString())
.getDocumentElement();
if (xml != null)
{
dec.decode(xml, into);
}
}
catch (Exception e)
{
log.log(Level.FINEST, "Cannot process include: " + name, e);
}
}
return true;
}
return false;
} | boolean function(mxCodec dec, Node node, Object into) { if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equalsIgnoreCase(STR)) { String name = ((Element) node).getAttribute("name"); if (name != null) { try { Node xml = mxUtils.loadDocument( mxObjectCodec.class.getResource(name).toString()) .getDocumentElement(); if (xml != null) { dec.decode(xml, into); } } catch (Exception e) { log.log(Level.FINEST, STR + name, e); } } return true; } return false; } | /**
* Returns true if the given node is an include directive and executes the
* include by decoding the XML document. Returns false if the given node is
* not an include directive.
*
* @param dec Codec that controls the encoding/decoding process.
* @param node XML node to be checked.
* @param into Optional object to pass-thru to the codec.
* @return Returns true if the given node was processed as an include.
*/ | Returns true if the given node is an include directive and executes the include by decoding the XML document. Returns false if the given node is not an include directive | processInclude | {
"repo_name": "jgraph/mxgraph",
"path": "java/src/com/mxgraph/io/mxObjectCodec.java",
"license": "apache-2.0",
"size": 33561
} | [
"java.util.logging.Level",
"org.w3c.dom.Element",
"org.w3c.dom.Node"
] | import java.util.logging.Level; import org.w3c.dom.Element; import org.w3c.dom.Node; | import java.util.logging.*; import org.w3c.dom.*; | [
"java.util",
"org.w3c.dom"
] | java.util; org.w3c.dom; | 1,835,703 |
public String[] getNextRecord() throws EOFException, EPException
{
try
{
String[] result = getNextValidRecord();
if(atEOF && result == null)
{
throw new EOFException("In reading CSV file, reached end-of-file and not looping to the beginning");
}
if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled()))
{
log.debug(".getNextRecord record==" + Arrays.asList(result));
}
return result;
}
catch (EOFException e)
{
throw e;
}
catch(IOException e)
{
throw new EPException(e);
}
} | String[] function() throws EOFException, EPException { try { String[] result = getNextValidRecord(); if(atEOF && result == null) { throw new EOFException(STR); } if ((ExecutionPathDebugLog.isDebugEnabled) && (log.isDebugEnabled())) { log.debug(STR + Arrays.asList(result)); } return result; } catch (EOFException e) { throw e; } catch(IOException e) { throw new EPException(e); } } | /**
* Get the next record from the CSV file.
* @return a string array containing the values of the record
* @throws EOFException in case no more records can be read (end-of-file has been reached and isLooping is false)
* @throws EPException in case of error in reading the CSV file
*/ | Get the next record from the CSV file | getNextRecord | {
"repo_name": "b-cuts/esper",
"path": "esperio-csv/src/main/java/com/espertech/esperio/csv/CSVReader.java",
"license": "gpl-2.0",
"size": 10596
} | [
"com.espertech.esper.client.EPException",
"com.espertech.esper.util.ExecutionPathDebugLog",
"java.io.EOFException",
"java.io.IOException",
"java.util.Arrays"
] | import com.espertech.esper.client.EPException; import com.espertech.esper.util.ExecutionPathDebugLog; import java.io.EOFException; import java.io.IOException; import java.util.Arrays; | import com.espertech.esper.client.*; import com.espertech.esper.util.*; import java.io.*; import java.util.*; | [
"com.espertech.esper",
"java.io",
"java.util"
] | com.espertech.esper; java.io; java.util; | 697,143 |
public XMLErrorHandler getErrorHandler() {
// REVISIT: Should this be a property?
return (XMLErrorHandler)fProperties.get(ERROR_HANDLER);
} // getErrorHandler():XMLErrorHandler | XMLErrorHandler function() { return (XMLErrorHandler)fProperties.get(ERROR_HANDLER); } | /**
* Return the current error handler.
*
* @return The current error handler, or null if none
* has been registered.
* @see #setErrorHandler
*/ | Return the current error handler | getErrorHandler | {
"repo_name": "zarue/jdk7u-hotspot",
"path": "jaxp/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java",
"license": "gpl-2.0",
"size": 64664
} | [
"com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler"
] | import com.sun.org.apache.xerces.internal.xni.parser.XMLErrorHandler; | import com.sun.org.apache.xerces.internal.xni.parser.*; | [
"com.sun.org"
] | com.sun.org; | 2,676,434 |
public void setAddr(String addr) {
IpPrefix spfx = IpPrefix.valueOf(addr);
setAddr(spfx);
} | void function(String addr) { IpPrefix spfx = IpPrefix.valueOf(addr); setAddr(spfx); } | /**
* PIM Encoded Source Address.
*
* @param addr IPv4 or IPv6
*/ | PIM Encoded Source Address | setAddr | {
"repo_name": "sonu283304/onos",
"path": "utils/misc/src/main/java/org/onlab/packet/pim/PIMAddrSource.java",
"license": "apache-2.0",
"size": 7549
} | [
"org.onlab.packet.IpPrefix"
] | import org.onlab.packet.IpPrefix; | import org.onlab.packet.*; | [
"org.onlab.packet"
] | org.onlab.packet; | 1,170,874 |
@Override
public NodeStepResult executeRemoteScript(
final ExecutionContext context,
final Framework framework,
final INodeEntry node,
final String[] args,
final String filepath,
final String scriptInterpreter,
final boolean interpreterargsquoted
) throws NodeStepException
{
boolean removeFile = true;
if (null != node.getAttributes() && null != node.getAttributes().get(SCRIPT_FILE_REMOVE_TMP)) {
removeFile = Boolean.parseBoolean(node.getAttributes().get(SCRIPT_FILE_REMOVE_TMP));
}
return executeRemoteScript(context, framework, node, args, filepath, scriptInterpreter,
interpreterargsquoted, removeFile
);
} | NodeStepResult function( final ExecutionContext context, final Framework framework, final INodeEntry node, final String[] args, final String filepath, final String scriptInterpreter, final boolean interpreterargsquoted ) throws NodeStepException { boolean removeFile = true; if (null != node.getAttributes() && null != node.getAttributes().get(SCRIPT_FILE_REMOVE_TMP)) { removeFile = Boolean.parseBoolean(node.getAttributes().get(SCRIPT_FILE_REMOVE_TMP)); } return executeRemoteScript(context, framework, node, args, filepath, scriptInterpreter, interpreterargsquoted, removeFile ); } | /**
* Execute a scriptfile already copied to a remote node with the given args
*
* @param context context
* @param framework framework
* @param node the node
* @param args arguments to script
* @param filepath the remote path for the script
* @param scriptInterpreter interpreter used to invoke the script
* @param interpreterargsquoted if true, pass the file and script args as a single argument to the interpreter
*
* @return result
*
* @throws NodeStepException on error
*/ | Execute a scriptfile already copied to a remote node with the given args | executeRemoteScript | {
"repo_name": "variacode95/rundeck",
"path": "core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java",
"license": "apache-2.0",
"size": 12187
} | [
"com.dtolabs.rundeck.core.common.Framework",
"com.dtolabs.rundeck.core.common.INodeEntry",
"com.dtolabs.rundeck.core.execution.ExecutionContext",
"com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepException",
"com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepResult"
] | import com.dtolabs.rundeck.core.common.Framework; import com.dtolabs.rundeck.core.common.INodeEntry; import com.dtolabs.rundeck.core.execution.ExecutionContext; import com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepException; import com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepResult; | import com.dtolabs.rundeck.core.common.*; import com.dtolabs.rundeck.core.execution.*; import com.dtolabs.rundeck.core.execution.workflow.steps.node.*; | [
"com.dtolabs.rundeck"
] | com.dtolabs.rundeck; | 343,872 |
EList<LaborItem> getLaborItems(); | EList<LaborItem> getLaborItems(); | /**
* Returns the value of the '<em><b>Labor Items</b></em>' reference list.
* The list contents are of type {@link gluemodel.CIM.IEC61970.Informative.InfWork.LaborItem}.
* It is bidirectional and its opposite is '{@link gluemodel.CIM.IEC61970.Informative.InfWork.LaborItem#getErpPersons <em>Erp Persons</em>}'.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Labor Items</em>' reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Labor Items</em>' reference list.
* @see gluemodel.CIM.IEC61970.Informative.InfERPSupport.InfERPSupportPackage#getErpPerson_LaborItems()
* @see gluemodel.CIM.IEC61970.Informative.InfWork.LaborItem#getErpPersons
* @model opposite="ErpPersons"
* @generated
*/ | Returns the value of the 'Labor Items' reference list. The list contents are of type <code>gluemodel.CIM.IEC61970.Informative.InfWork.LaborItem</code>. It is bidirectional and its opposite is '<code>gluemodel.CIM.IEC61970.Informative.InfWork.LaborItem#getErpPersons Erp Persons</code>'. If the meaning of the 'Labor Items' reference list isn't clear, there really should be more of a description here... | getLaborItems | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/eMoflon/rgse.ttc17.metamodels.src/src/gluemodel/CIM/IEC61970/Informative/InfERPSupport/ErpPerson.java",
"license": "mit",
"size": 36663
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,049,030 |
public SessionDescription createSessionDescription() throws SdpException {
SessionDescriptionImpl sessionDescriptionImpl = new SessionDescriptionImpl();
ProtoVersionField ProtoVersionField = new ProtoVersionField();
ProtoVersionField.setVersion(0);
sessionDescriptionImpl.setVersion(ProtoVersionField);
OriginField originImpl = null;
try {
originImpl =
(OriginField) this.createOrigin("user", InetAddress.getLocalHost().getHostAddress());
} catch (UnknownHostException e) {
e.printStackTrace();
}
sessionDescriptionImpl.setOrigin(originImpl);
SessionNameField sessionNameImpl = new SessionNameField();
sessionNameImpl.setValue("-");
sessionDescriptionImpl.setSessionName(sessionNameImpl);
TimeDescription timeDescriptionImpl = new TimeDescriptionImpl();
TimeField timeImpl = new TimeField();
timeImpl.setZero();
timeDescriptionImpl.setTime(timeImpl);
Vector<TimeDescription> times = new Vector<TimeDescription>();
times.addElement(timeDescriptionImpl);
sessionDescriptionImpl.setTimeDescriptions(times);
// Dan Muresan: this was a memory leak
// sessionDescriptionsList.addElement(sessionDescriptionImpl);
return sessionDescriptionImpl;
} | SessionDescription function() throws SdpException { SessionDescriptionImpl sessionDescriptionImpl = new SessionDescriptionImpl(); ProtoVersionField ProtoVersionField = new ProtoVersionField(); ProtoVersionField.setVersion(0); sessionDescriptionImpl.setVersion(ProtoVersionField); OriginField originImpl = null; try { originImpl = (OriginField) this.createOrigin("user", InetAddress.getLocalHost().getHostAddress()); } catch (UnknownHostException e) { e.printStackTrace(); } sessionDescriptionImpl.setOrigin(originImpl); SessionNameField sessionNameImpl = new SessionNameField(); sessionNameImpl.setValue("-"); sessionDescriptionImpl.setSessionName(sessionNameImpl); TimeDescription timeDescriptionImpl = new TimeDescriptionImpl(); TimeField timeImpl = new TimeField(); timeImpl.setZero(); timeDescriptionImpl.setTime(timeImpl); Vector<TimeDescription> times = new Vector<TimeDescription>(); times.addElement(timeDescriptionImpl); sessionDescriptionImpl.setTimeDescriptions(times); return sessionDescriptionImpl; } | /**
* Creates a new, empty SessionDescription. The session is set as follows: v=0 o=this.createOrigin
* ("user", InetAddress.getLocalHost().toString()); s=- t=0 0
*
* @throws SdpException SdpException, - if there is a problem constructing the SessionDescription.
* @return a new, empty SessionDescription.
*/ | Creates a new, empty SessionDescription. The session is set as follows: v=0 o=this.createOrigin ("user", InetAddress.getLocalHost().toString()); s=- t=0 0 | createSessionDescription | {
"repo_name": "darkmi/rtspproxy",
"path": "src/main/java/javax/sdp/SdpFactory.java",
"license": "gpl-2.0",
"size": 22738
} | [
"gov.nist.javax.sdp.SessionDescriptionImpl",
"gov.nist.javax.sdp.TimeDescriptionImpl",
"gov.nist.javax.sdp.fields.OriginField",
"gov.nist.javax.sdp.fields.ProtoVersionField",
"gov.nist.javax.sdp.fields.SessionNameField",
"gov.nist.javax.sdp.fields.TimeField",
"java.net.InetAddress",
"java.net.UnknownH... | import gov.nist.javax.sdp.SessionDescriptionImpl; import gov.nist.javax.sdp.TimeDescriptionImpl; import gov.nist.javax.sdp.fields.OriginField; import gov.nist.javax.sdp.fields.ProtoVersionField; import gov.nist.javax.sdp.fields.SessionNameField; import gov.nist.javax.sdp.fields.TimeField; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.Vector; | import gov.nist.javax.sdp.*; import gov.nist.javax.sdp.fields.*; import java.net.*; import java.util.*; | [
"gov.nist.javax",
"java.net",
"java.util"
] | gov.nist.javax; java.net; java.util; | 821,835 |
EList<AssemblyComponent> getAssemblyComponents(); | EList<AssemblyComponent> getAssemblyComponents(); | /**
* Returns the value of the '<em><b>Assembly Components</b></em>' containment reference list.
* The list contents are of type {@link kieker.tools.slastic.metamodel.componentAssembly.AssemblyComponent}.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Assembly Components</em>' containment reference list isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Assembly Components</em>' containment reference list.
* @see kieker.tools.slastic.metamodel.componentAssembly.ComponentAssemblyPackage#getComponentAssemblyModel_AssemblyComponents()
* @model containment="true" ordered="false"
* @generated
*/ | Returns the value of the 'Assembly Components' containment reference list. The list contents are of type <code>kieker.tools.slastic.metamodel.componentAssembly.AssemblyComponent</code>. If the meaning of the 'Assembly Components' containment reference list isn't clear, there really should be more of a description here... | getAssemblyComponents | {
"repo_name": "SLAsticSPE/slastic",
"path": "src-gen/kieker/tools/slastic/metamodel/componentAssembly/ComponentAssemblyModel.java",
"license": "apache-2.0",
"size": 7471
} | [
"org.eclipse.emf.common.util.EList"
] | import org.eclipse.emf.common.util.EList; | import org.eclipse.emf.common.util.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,564,118 |
public static AccountData deserialize(ProtoAccountData data) {
switch (data.getAccountType()) {
case HUMAN_ACCOUNT:
Preconditions.checkArgument(data.hasHumanAccountData(),
"ProtoAccountData is missing the human_account_data field");
return deserialize(data.getAccountId(), data.getHumanAccountData());
case ROBOT_ACCOUNT:
Preconditions.checkArgument(data.hasRobotAccountData(),
"ProtoAccountData is missing the robot_account_data field");
return deserialize(data.getAccountId(), data.getRobotAccountData());
default:
throw new IllegalArgumentException(
"ProtoAccountData contains neither HumanAccountData nor RobotAccountData.");
}
}
| static AccountData function(ProtoAccountData data) { switch (data.getAccountType()) { case HUMAN_ACCOUNT: Preconditions.checkArgument(data.hasHumanAccountData(), STR); return deserialize(data.getAccountId(), data.getHumanAccountData()); case ROBOT_ACCOUNT: Preconditions.checkArgument(data.hasRobotAccountData(), STR); return deserialize(data.getAccountId(), data.getRobotAccountData()); default: throw new IllegalArgumentException( STR); } } | /**
* Deserialize {@link ProtoAccountData} into {@link AccountData}.
*/ | Deserialize <code>ProtoAccountData</code> into <code>AccountData</code> | deserialize | {
"repo_name": "nelsonsilva/wave-protocol",
"path": "src/org/waveprotocol/box/server/persistence/protos/ProtoAccountDataSerializer.java",
"license": "apache-2.0",
"size": 8171
} | [
"com.google.common.base.Preconditions",
"org.waveprotocol.box.server.account.AccountData",
"org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData"
] | import com.google.common.base.Preconditions; import org.waveprotocol.box.server.account.AccountData; import org.waveprotocol.box.server.persistence.protos.ProtoAccountStoreData; | import com.google.common.base.*; import org.waveprotocol.box.server.account.*; import org.waveprotocol.box.server.persistence.protos.*; | [
"com.google.common",
"org.waveprotocol.box"
] | com.google.common; org.waveprotocol.box; | 182,961 |
static void setEnv(Map<String, String> newenv) {
try {
Class<?> processEnvironmentClass = Class.forName("java.lang.ProcessEnvironment");
Field theEnvironmentField = processEnvironmentClass.getDeclaredField("theEnvironment");
theEnvironmentField.setAccessible(true);
Map<String, String> env = (Map<String, String>) theEnvironmentField.get(null);
env.putAll(newenv);
Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField("theCaseInsensitiveEnvironment");
theCaseInsensitiveEnvironmentField.setAccessible(true);
Map<String, String> cienv = (Map<String, String>) theCaseInsensitiveEnvironmentField.get(null);
cienv.putAll(newenv);
}
catch (NoSuchFieldException e) {
try {
Class[] classes = Collections.class.getDeclaredClasses();
Map<String, String> env = System.getenv();
for(Class cl : classes) {
if("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
Field field = cl.getDeclaredField("m");
field.setAccessible(true);
Object obj = field.get(env);
Map<String, String> map = (Map<String, String>) obj;
map.clear();
map.putAll(newenv);
}
}
} catch (Exception e2) {
throw new RuntimeException(e2);
}
} catch (Exception e1) {
throw new RuntimeException(e1);
}
} | static void setEnv(Map<String, String> newenv) { try { Class<?> processEnvironmentClass = Class.forName(STR); Field theEnvironmentField = processEnvironmentClass.getDeclaredField(STR); theEnvironmentField.setAccessible(true); Map<String, String> env = (Map<String, String>) theEnvironmentField.get(null); env.putAll(newenv); Field theCaseInsensitiveEnvironmentField = processEnvironmentClass.getDeclaredField(STR); theCaseInsensitiveEnvironmentField.setAccessible(true); Map<String, String> cienv = (Map<String, String>) theCaseInsensitiveEnvironmentField.get(null); cienv.putAll(newenv); } catch (NoSuchFieldException e) { try { Class[] classes = Collections.class.getDeclaredClasses(); Map<String, String> env = System.getenv(); for(Class cl : classes) { if(STR.equals(cl.getName())) { Field field = cl.getDeclaredField("m"); field.setAccessible(true); Object obj = field.get(env); Map<String, String> map = (Map<String, String>) obj; map.clear(); map.putAll(newenv); } } } catch (Exception e2) { throw new RuntimeException(e2); } } catch (Exception e1) { throw new RuntimeException(e1); } } | /**
* Credits: http://stackoverflow.com/questions/318239/how-do-i-set-environment-variables-from-java
* Set the environment variables map.
* @param newenv
*/ | Credits: HREF Set the environment variables map | setEnv | {
"repo_name": "mosampaio/javadotenv",
"path": "src/main/java/com/mosampaio/javadotenv/EnvironmentVariablesUtil.java",
"license": "mit",
"size": 2065
} | [
"java.lang.reflect.Field",
"java.util.Collections",
"java.util.Map"
] | import java.lang.reflect.Field; import java.util.Collections; import java.util.Map; | import java.lang.reflect.*; import java.util.*; | [
"java.lang",
"java.util"
] | java.lang; java.util; | 2,593,494 |
public List<RegionForwardingRuleId> getForwardingRules() {
return forwardingRules;
} | List<RegionForwardingRuleId> function() { return forwardingRules; } | /**
* Returns a list of identities of region forwarding rules that are currently using the address.
*/ | Returns a list of identities of region forwarding rules that are currently using the address | getForwardingRules | {
"repo_name": "shinfan/gcloud-java",
"path": "google-cloud-compute/src/main/java/com/google/cloud/compute/AddressInfo.java",
"license": "apache-2.0",
"size": 17244
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,465,310 |
public Collection<String> getAllCoreNames() {
Set<String> set = new TreeSet<>();
synchronized (modifyLock) {
set.addAll(cores.keySet());
set.addAll(transientCores.keySet());
set.addAll(dynamicDescriptors.keySet());
set.addAll(createdCores.keySet());
}
return set;
} | Collection<String> function() { Set<String> set = new TreeSet<>(); synchronized (modifyLock) { set.addAll(cores.keySet()); set.addAll(transientCores.keySet()); set.addAll(dynamicDescriptors.keySet()); set.addAll(createdCores.keySet()); } return set; } | /**
* Gets a list of all cores, loaded and unloaded (dynamic)
*
* @return all cores names, whether loaded or unloaded.
*/ | Gets a list of all cores, loaded and unloaded (dynamic) | getAllCoreNames | {
"repo_name": "visouza/solr-5.0.0",
"path": "solr/core/src/java/org/apache/solr/core/SolrCores.java",
"license": "apache-2.0",
"size": 14031
} | [
"java.util.Collection",
"java.util.Set",
"java.util.TreeSet"
] | import java.util.Collection; import java.util.Set; import java.util.TreeSet; | import java.util.*; | [
"java.util"
] | java.util; | 125,209 |
public List<DiscoveryNode> listedNodes() {
return nodesService.listedNodes();
} | List<DiscoveryNode> function() { return nodesService.listedNodes(); } | /**
* Returns the listed nodes in the transport client (ones added to it).
*/ | Returns the listed nodes in the transport client (ones added to it) | listedNodes | {
"repo_name": "ricardocerq/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/client/transport/TransportClient.java",
"license": "apache-2.0",
"size": 16355
} | [
"java.util.List",
"org.elasticsearch.cluster.node.DiscoveryNode"
] | import java.util.List; import org.elasticsearch.cluster.node.DiscoveryNode; | import java.util.*; import org.elasticsearch.cluster.node.*; | [
"java.util",
"org.elasticsearch.cluster"
] | java.util; org.elasticsearch.cluster; | 1,180,024 |
public static short getRandomShort(Random random) {
return (short) random.nextInt(Short.MAX_VALUE + 1);
} | static short function(Random random) { return (short) random.nextInt(Short.MAX_VALUE + 1); } | /**
* Returns a random short using the {@code Random} passed as arg
* @param random the {@link Random} object that needs to be used to generate the random short
* @return a random short
*/ | Returns a random short using the Random passed as arg | getRandomShort | {
"repo_name": "nsivabalan/ambry",
"path": "ambry-utils/src/main/java/com.github.ambry.utils/Utils.java",
"license": "apache-2.0",
"size": 26612
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 931,271 |
public static int getPrecision(LogicalType logicalType) {
return logicalType.accept(PRECISION_EXTRACTOR);
} | static int function(LogicalType logicalType) { return logicalType.accept(PRECISION_EXTRACTOR); } | /**
* Returns the precision of all types that define a precision implicitly or explicitly.
*/ | Returns the precision of all types that define a precision implicitly or explicitly | getPrecision | {
"repo_name": "tzulitai/flink",
"path": "flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/logical/utils/LogicalTypeChecks.java",
"license": "apache-2.0",
"size": 15784
} | [
"org.apache.flink.table.types.logical.LogicalType"
] | import org.apache.flink.table.types.logical.LogicalType; | import org.apache.flink.table.types.logical.*; | [
"org.apache.flink"
] | org.apache.flink; | 2,044,392 |
private static void addPropertyToEvidence(InternetHeaders headers,
EvidenceCollection evidence, String property, Confidence confidence) {
final String value = headers.getHeader(property, null);
LOGGER.debug("Property: {}, Value: {}", property, value);
if (StringUtils.isNotBlank(value)) {
evidence.addEvidence(METADATA, property, value, confidence);
}
} | static void function(InternetHeaders headers, EvidenceCollection evidence, String property, Confidence confidence) { final String value = headers.getHeader(property, null); LOGGER.debug(STR, property, value); if (StringUtils.isNotBlank(value)) { evidence.addEvidence(METADATA, property, value, confidence); } } | /**
* Adds a value to the evidence collection.
*
* @param headers the properties collection
* @param evidence the evidence collection to add the value
* @param property the property name
* @param confidence the confidence of the evidence
*/ | Adds a value to the evidence collection | addPropertyToEvidence | {
"repo_name": "sirkkalap/DependencyCheck",
"path": "dependency-check-core/src/main/java/org/owasp/dependencycheck/analyzer/PythonDistributionAnalyzer.java",
"license": "apache-2.0",
"size": 13387
} | [
"javax.mail.internet.InternetHeaders",
"org.apache.commons.lang.StringUtils",
"org.owasp.dependencycheck.dependency.Confidence",
"org.owasp.dependencycheck.dependency.EvidenceCollection"
] | import javax.mail.internet.InternetHeaders; import org.apache.commons.lang.StringUtils; import org.owasp.dependencycheck.dependency.Confidence; import org.owasp.dependencycheck.dependency.EvidenceCollection; | import javax.mail.internet.*; import org.apache.commons.lang.*; import org.owasp.dependencycheck.dependency.*; | [
"javax.mail",
"org.apache.commons",
"org.owasp.dependencycheck"
] | javax.mail; org.apache.commons; org.owasp.dependencycheck; | 576,651 |
InsertException getException(ObjectContainer container) {
synchronized (this) {
if(persistent) container.activate(toThrow, 5);
return toThrow;
}
} | InsertException getException(ObjectContainer container) { synchronized (this) { if(persistent) container.activate(toThrow, 5); return toThrow; } } | /** Get the InsertException for this segment.
* NOTE: This will be deleted when the segment is deleted! Do not store it or pass
* it on!
*/ | Get the InsertException for this segment. it on | getException | {
"repo_name": "vwoodzell/fred-staging",
"path": "src/freenet/client/async/SplitFileInserterSegment.java",
"license": "gpl-2.0",
"size": 54218
} | [
"com.db4o.ObjectContainer"
] | import com.db4o.ObjectContainer; | import com.db4o.*; | [
"com.db4o"
] | com.db4o; | 2,700,259 |
public Map<IndexId, Collection<String>> indexMetaDataToRemoveAfterRemovingSnapshots(Collection<SnapshotId> snapshotIds) {
Collection<IndexId> indicesForSnapshot = indicesToUpdateAfterRemovingSnapshot(snapshotIds);
final Set<String> allRemainingIdentifiers = indexMetaDataGenerations.lookup.entrySet().stream()
.filter(e -> snapshotIds.contains(e.getKey()) == false).flatMap(e -> e.getValue().values().stream())
.map(indexMetaDataGenerations::getIndexMetaBlobId).collect(Collectors.toSet());
final Map<IndexId, Collection<String>> toRemove = new HashMap<>();
for (IndexId indexId : indicesForSnapshot) {
for (SnapshotId snapshotId : snapshotIds) {
final String identifier = indexMetaDataGenerations.indexMetaBlobId(snapshotId, indexId);
if (allRemainingIdentifiers.contains(identifier) == false) {
toRemove.computeIfAbsent(indexId, k -> new HashSet<>()).add(identifier);
}
}
}
return toRemove;
} | Map<IndexId, Collection<String>> function(Collection<SnapshotId> snapshotIds) { Collection<IndexId> indicesForSnapshot = indicesToUpdateAfterRemovingSnapshot(snapshotIds); final Set<String> allRemainingIdentifiers = indexMetaDataGenerations.lookup.entrySet().stream() .filter(e -> snapshotIds.contains(e.getKey()) == false).flatMap(e -> e.getValue().values().stream()) .map(indexMetaDataGenerations::getIndexMetaBlobId).collect(Collectors.toSet()); final Map<IndexId, Collection<String>> toRemove = new HashMap<>(); for (IndexId indexId : indicesForSnapshot) { for (SnapshotId snapshotId : snapshotIds) { final String identifier = indexMetaDataGenerations.indexMetaBlobId(snapshotId, indexId); if (allRemainingIdentifiers.contains(identifier) == false) { toRemove.computeIfAbsent(indexId, k -> new HashSet<>()).add(identifier); } } } return toRemove; } | /**
* Returns a map of {@link IndexId} to a collection of {@link String} containing all the {@link IndexId} and the
* {@link org.elasticsearch.cluster.metadata.IndexMetadata} blob name in it that can be removed after removing the given snapshot from
* the repository.
* NOTE: Does not return a mapping for {@link IndexId} values that will be removed completely from the repository.
*
* @param snapshotIds SnapshotIds to remove
* @return map of index to index metadata blob id to delete
*/ | Returns a map of <code>IndexId</code> to a collection of <code>String</code> containing all the <code>IndexId</code> and the <code>org.elasticsearch.cluster.metadata.IndexMetadata</code> blob name in it that can be removed after removing the given snapshot from the repository | indexMetaDataToRemoveAfterRemovingSnapshots | {
"repo_name": "gingerwizard/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/repositories/RepositoryData.java",
"license": "apache-2.0",
"size": 34217
} | [
"java.util.Collection",
"java.util.HashMap",
"java.util.HashSet",
"java.util.Map",
"java.util.Set",
"java.util.stream.Collectors",
"org.elasticsearch.snapshots.SnapshotId"
] | import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import org.elasticsearch.snapshots.SnapshotId; | import java.util.*; import java.util.stream.*; import org.elasticsearch.snapshots.*; | [
"java.util",
"org.elasticsearch.snapshots"
] | java.util; org.elasticsearch.snapshots; | 424,502 |
public void setCssText(String cssText) throws DOMException {
if (handler == null) {
throw new DOMException
(DOMException.NO_MODIFICATION_ALLOWED_ERR, "");
} else {
getValue();
handler.bottomTextChanged(cssText);
}
} | void function(String cssText) throws DOMException { if (handler == null) { throw new DOMException (DOMException.NO_MODIFICATION_ALLOWED_ERR, ""); } else { getValue(); handler.bottomTextChanged(cssText); } } | /**
* <b>DOM</b>: Implements {@link
* org.w3c.dom.css.CSSValue#setCssText(String)}.
*/ | DOM: Implements <code>org.w3c.dom.css.CSSValue#setCssText(String)</code> | setCssText | {
"repo_name": "Squeegee/batik",
"path": "sources/org/apache/batik/css/dom/CSSOMValue.java",
"license": "apache-2.0",
"size": 46308
} | [
"org.w3c.dom.DOMException"
] | import org.w3c.dom.DOMException; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 271,690 |
public void setClusterCache(Ehcache value) {
this.clusterCache = value;
if (value != null) {
// default local member state is "master" (if master/auxiliary
// aware) - but now we are in a cluster
// so set default local state to "auxiliary" to begin
this.localMember.setMaster(false);
}
updateLocalMemberStatus();
}
| void function(Ehcache value) { this.clusterCache = value; if (value != null) { this.localMember.setMaster(false); } updateLocalMemberStatus(); } | /**
* Sets the replicated Ehcache containing a real-time up-to-date view of every application instance (each
* represented by a {@link ClusterMember} object) currently participating in the cluster. This is only expected to
* be called / used if the current member configured to run in a clustered environment.
*/ | Sets the replicated Ehcache containing a real-time up-to-date view of every application instance (each represented by a <code>ClusterMember</code> object) currently participating in the cluster. This is only expected to be called / used if the current member configured to run in a clustered environment | setClusterCache | {
"repo_name": "javapathshala/JP.Cody",
"path": "Cody/jp-apps-parent/jp-cluster/src/main/java/com/jp/app/cluster/ClusterManager.java",
"license": "gpl-2.0",
"size": 36208
} | [
"net.sf.ehcache.Ehcache"
] | import net.sf.ehcache.Ehcache; | import net.sf.ehcache.*; | [
"net.sf.ehcache"
] | net.sf.ehcache; | 1,297,178 |
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, String fileSuffix) {
return getAvailableLocaleSuffixesForBundle(messageBundlePath, fileSuffix, null);
} | static List<String> function(String messageBundlePath, String fileSuffix) { return getAvailableLocaleSuffixesForBundle(messageBundlePath, fileSuffix, null); } | /**
* Returns the list of available locale suffixes for a message resource
* bundle
*
* @param messageBundlePath
* the resource bundle path
* @param fileSuffix
* the file suffix
* @return the list of available locale suffixes for a message resource
* bundle
*/ | Returns the list of available locale suffixes for a message resource bundle | getAvailableLocaleSuffixesForBundle | {
"repo_name": "maximmold/jawr-main-repo",
"path": "jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java",
"license": "apache-2.0",
"size": 12095
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 283,044 |
protected static ResultSet getMCHMothers(Date beginDate, Date endDate, int siteID, Connection conn) throws ServletException {
//Connection conn = null;
ResultSet rs = null;
try {
// conn = getZEPRSConnection();
// Retrieve all Encounter records for this form for mothers
// No longer checking if mother is in flow_id = 7 - Labour - because problem/laobur visit is in that flow
if (siteID == 0) {
String sql = "SELECT DISTINCT patient_id FROM encounter, patient " +
"WHERE encounter.patient_id = patient.id " +
"AND patient_id NOT IN (SELECT patient_id from encounter where (flow_id = 3) OR (flow_id =4))\n" +
"AND patient_id IN (SELECT patient_id from encounter where flow_id = 1)\n" +
"AND date_visit >= ? " +
"AND date_visit <= ? AND parent_id is null " +
"ORDER BY date_visit DESC";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setDate(1, beginDate);
ps.setDate(2, endDate);
rs = ps.executeQuery();
} else {
String sql = "SELECT DISTINCT patient_id FROM encounter, patient " +
"WHERE encounter.patient_id = patient.id " +
"AND patient_id NOT IN (SELECT patient_id from encounter where (flow_id = 3) OR (flow_id =4))\n" +
"AND patient_id IN (SELECT patient_id from encounter where flow_id = 1)\n" +
"AND date_visit >= ? " +
"AND date_visit <= ? AND parent_id is null AND encounter.site_id = ? " +
"ORDER BY date_visit DESC";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setDate(1, beginDate);
ps.setDate(2, endDate);
ps.setInt(3, siteID);
rs = ps.executeQuery();
}
} catch (Exception ex) {
log.error(ex);
}
return rs;
} | static ResultSet function(Date beginDate, Date endDate, int siteID, Connection conn) throws ServletException { ResultSet rs = null; try { if (siteID == 0) { String sql = STR + STR + STR + STR + STR + STR + STR; PreparedStatement ps = conn.prepareStatement(sql); ps.setDate(1, beginDate); ps.setDate(2, endDate); rs = ps.executeQuery(); } else { String sql = STR + STR + STR + STR + STR + STR + STR; PreparedStatement ps = conn.prepareStatement(sql); ps.setDate(1, beginDate); ps.setDate(2, endDate); ps.setInt(3, siteID); rs = ps.executeQuery(); } } catch (Exception ex) { log.error(ex); } return rs; } | /**
* Get MCH mothers - not in labour, having submitted a routine ante visit
* @param beginDate
* @param endDate
* @param siteID
* @param conn
* @return
* @throws ServletException
*/ | Get MCH mothers - not in labour, having submitted a routine ante visit | getMCHMothers | {
"repo_name": "chrisekelley/zeprs",
"path": "src/zeprs/org/cidrz/project/zeprs/report/ZEPRSUtils.java",
"license": "apache-2.0",
"size": 79024
} | [
"java.sql.Connection",
"java.sql.Date",
"java.sql.PreparedStatement",
"java.sql.ResultSet",
"javax.servlet.ServletException"
] | import java.sql.Connection; import java.sql.Date; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.servlet.ServletException; | import java.sql.*; import javax.servlet.*; | [
"java.sql",
"javax.servlet"
] | java.sql; javax.servlet; | 2,582,699 |
EReference getTPresentationElements_Subject(); | EReference getTPresentationElements_Subject(); | /**
* Returns the meta object for the containment reference list '{@link org.wso2.developerstudio.eclipse.humantask.model.ht.TPresentationElements#getSubject <em>Subject</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the containment reference list '<em>Subject</em>'.
* @see org.wso2.developerstudio.eclipse.humantask.model.ht.TPresentationElements#getSubject()
* @see #getTPresentationElements()
* @generated
*/ | Returns the meta object for the containment reference list '<code>org.wso2.developerstudio.eclipse.humantask.model.ht.TPresentationElements#getSubject Subject</code>'. | getTPresentationElements_Subject | {
"repo_name": "chanakaudaya/developer-studio",
"path": "humantask/org.wso2.tools.humantask.model/src/org/wso2/carbonstudio/eclipse/humantask/model/ht/HTPackage.java",
"license": "apache-2.0",
"size": 247810
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,563,480 |
BeanMetadataElement createBeanMetadataElementByIntrospection(Object object);
| BeanMetadataElement createBeanMetadataElementByIntrospection(Object object); | /**
* Creates a bean metadata by introspecting a Java beans object.
*
* @param object the object to introspect
* @return the bean definition
*/ | Creates a bean metadata by introspecting a Java beans object | createBeanMetadataElementByIntrospection | {
"repo_name": "lat-lon/geomajas",
"path": "plugin/geomajas-plugin-runtimeconfig/runtimeconfig/src/main/java/org/geomajas/plugin/runtimeconfig/service/BeanDefinitionDtoConverterService.java",
"license": "agpl-3.0",
"size": 5180
} | [
"org.springframework.beans.BeanMetadataElement"
] | import org.springframework.beans.BeanMetadataElement; | import org.springframework.beans.*; | [
"org.springframework.beans"
] | org.springframework.beans; | 321,190 |
public Job reload(JobOption... options) {
return bigquery.getJob(jobId(), options);
} | Job function(JobOption... options) { return bigquery.getJob(jobId(), options); } | /**
* Fetches current job's latest information. Returns {@code null} if the job does not exist.
*
* @param options job options
* @return a {@code Job} object with latest information or {@code null} if not found
* @throws BigQueryException upon failure
*/ | Fetches current job's latest information. Returns null if the job does not exist | reload | {
"repo_name": "tangiel/google-cloud-java",
"path": "google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Job.java",
"license": "apache-2.0",
"size": 8171
} | [
"com.google.cloud.bigquery.BigQuery"
] | import com.google.cloud.bigquery.BigQuery; | import com.google.cloud.bigquery.*; | [
"com.google.cloud"
] | com.google.cloud; | 327,870 |
@Override
public void onCreate(SQLiteDatabase sqLiteDatabase) {
StringBuilder SQL = new StringBuilder();
SQL.append("CREATE TABLE IF NOT EXISTS Settings (");
SQL.append(" name TEXT PRIMARY KEY,");
SQL.append(" value TEXT DEFAULT '',");
SQL.append(" hint TEXT DEFAULT 'hint'");
SQL.append(")");
sqLiteDatabase.execSQL(SQL.toString());
// This is simply a list of applications that we know about. Display the description.
SQL = new StringBuilder();
SQL.append("CREATE TABLE IF NOT EXISTS RobotApplications (");
SQL.append(" appName TEXT PRIMARY KEY,");
SQL.append(" description TEXT NOT NULL");
SQL.append(")");
sqLiteDatabase.execSQL(SQL.toString());
// Add initial rows - fail silently if they exist. Use default for value.
String statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_GATEWAY+"','"+SBConstants.ROS_GATEWAY_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_MASTER_URI+"','"+SBConstants.ROS_MASTER_URI_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_HOST+"','"+SBConstants.ROS_HOST_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_PAIRED_DEVICE+"','"+SBConstants.ROS_PAIRED_DEVICE_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_SSID+"','"+SBConstants.ROS_SSID_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_WIFIPWD+"','"+SBConstants.ROS_WIFIPWD_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_USER+"','"+SBConstants.ROS_USER_HINT+"')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO Settings(Name,Hint) VALUES('"+SBConstants.ROS_USER_PASSWORD+"','"+SBConstants.ROS_USER_PASSWORD_HINT+"')";
execLenient(sqLiteDatabase,statement);
Log.i(CLSS,String.format("onCreate: Created %s at %s",SBConstants.DB_NAME,context.getDatabasePath(SBConstants.DB_NAME)));
// Define the various applications. This is a fixed list and must correspondd to robot contents.
// NOTE: The former applications FOLLOW, PARK and COME are now sub-applications of Teleop_Services.
statement = "DELETE FROM RobotApplications";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO RobotApplications(AppName,Description) VALUES('"+SBConstants.APPLICATION_HEADLAMP+"','Turn robot headlamp on/off')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO RobotApplications(AppName,Description) VALUES('"+SBConstants.APPLICATION_SYSTEM+"','Monitor robot system status')";
execLenient(sqLiteDatabase,statement);
statement = "INSERT INTO RobotApplications(AppName,Description) VALUES('"+SBConstants.APPLICATION_TELEOP+"','Control robot from the tablet')";
execLenient(sqLiteDatabase,statement);
} | void function(SQLiteDatabase sqLiteDatabase) { StringBuilder SQL = new StringBuilder(); SQL.append(STR); SQL.append(STR); SQL.append(STR); SQL.append(STR); SQL.append(")"); sqLiteDatabase.execSQL(SQL.toString()); SQL = new StringBuilder(); SQL.append(STR); SQL.append(STR); SQL.append(STR); SQL.append(")"); sqLiteDatabase.execSQL(SQL.toString()); String statement = STR+SBConstants.ROS_GATEWAY+"','"+SBConstants.ROS_GATEWAY_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_MASTER_URI+"','"+SBConstants.ROS_MASTER_URI_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_HOST+"','"+SBConstants.ROS_HOST_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_PAIRED_DEVICE+"','"+SBConstants.ROS_PAIRED_DEVICE_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_SSID+"','"+SBConstants.ROS_SSID_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_WIFIPWD+"','"+SBConstants.ROS_WIFIPWD_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_USER+"','"+SBConstants.ROS_USER_HINT+"')"; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.ROS_USER_PASSWORD+"','"+SBConstants.ROS_USER_PASSWORD_HINT+"')"; execLenient(sqLiteDatabase,statement); Log.i(CLSS,String.format(STR,SBConstants.DB_NAME,context.getDatabasePath(SBConstants.DB_NAME))); statement = STR; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.APPLICATION_HEADLAMP+STR; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.APPLICATION_SYSTEM+STR; execLenient(sqLiteDatabase,statement); statement = STR+SBConstants.APPLICATION_TELEOP+STR; execLenient(sqLiteDatabase,statement); } | /**
* Called when the database is created for the FIRST time.
* If a database already exists on disk with the same DATABASE_NAME, this method will NOT be called.
* @param sqLiteDatabase
*/ | Called when the database is created for the FIRST time. If a database already exists on disk with the same DATABASE_NAME, this method will NOT be called | onCreate | {
"repo_name": "chuckcoughlin/sarah-bella",
"path": "android/SBAssistant/app/src/main/java/chuckcoughlin/sb/assistant/db/SBDbManager.java",
"license": "mit",
"size": 10959
} | [
"android.database.sqlite.SQLiteDatabase",
"android.util.Log"
] | import android.database.sqlite.SQLiteDatabase; import android.util.Log; | import android.database.sqlite.*; import android.util.*; | [
"android.database",
"android.util"
] | android.database; android.util; | 551,277 |
@Nullable
@ObjectiveCName("getOwnAvatarVM")
public OwnAvatarVM getOwnAvatarVM() {
return modules.getProfileModule().getOwnAvatarVM();
} | @ObjectiveCName(STR) OwnAvatarVM function() { return modules.getProfileModule().getOwnAvatarVM(); } | /**
* Get Own avatar ViewModel
* Used for displaying avatar change progress
*
* @return the OwnAvatarVM
*/ | Get Own avatar ViewModel Used for displaying avatar change progress | getOwnAvatarVM | {
"repo_name": "luoxiaoshenghustedu/actor-platform",
"path": "actor-apps/core/src/main/java/im/actor/core/Messenger.java",
"license": "mit",
"size": 52564
} | [
"com.google.j2objc.annotations.ObjectiveCName",
"im.actor.core.viewmodel.OwnAvatarVM"
] | import com.google.j2objc.annotations.ObjectiveCName; import im.actor.core.viewmodel.OwnAvatarVM; | import com.google.j2objc.annotations.*; import im.actor.core.viewmodel.*; | [
"com.google.j2objc",
"im.actor.core"
] | com.google.j2objc; im.actor.core; | 48,076 |
private Symbol findSymbolForScope(SymbolScope scope) {
Node rootNode = scope.getRootNode();
if (rootNode.getParent() == null) {
return globalScope.getSlot(GLOBAL_THIS);
}
if (!rootNode.isFunction()) {
return null;
}
String name = NodeUtil.getBestLValueName(NodeUtil.getBestLValue(rootNode));
return name == null ? null : scope.getParentScope().getQualifiedSlot(name);
} | Symbol function(SymbolScope scope) { Node rootNode = scope.getRootNode(); if (rootNode.getParent() == null) { return globalScope.getSlot(GLOBAL_THIS); } if (!rootNode.isFunction()) { return null; } String name = NodeUtil.getBestLValueName(NodeUtil.getBestLValue(rootNode)); return name == null ? null : scope.getParentScope().getQualifiedSlot(name); } | /**
* Find the symbol associated with the given scope. Notice that we won't always be able to figure
* out this association dynamically, so sometimes we'll just create the association when we create
* the scope.
*/ | Find the symbol associated with the given scope. Notice that we won't always be able to figure out this association dynamically, so sometimes we'll just create the association when we create the scope | findSymbolForScope | {
"repo_name": "GoogleChromeLabs/chromeos_smart_card_connector",
"path": "third_party/closure-compiler/src/src/com/google/javascript/jscomp/SymbolTable.java",
"license": "apache-2.0",
"size": 87331
} | [
"com.google.javascript.rhino.Node"
] | import com.google.javascript.rhino.Node; | import com.google.javascript.rhino.*; | [
"com.google.javascript"
] | com.google.javascript; | 2,551,394 |
public YangUInt16 getMaxSduSizeValue() throws JNCException {
YangUInt16 maxSduSize = (YangUInt16)getValue("max-sdu-size");
if (maxSduSize == null) {
maxSduSize = new YangUInt16("1500"); // default
}
return maxSduSize;
} | YangUInt16 function() throws JNCException { YangUInt16 maxSduSize = (YangUInt16)getValue(STR); if (maxSduSize == null) { maxSduSize = new YangUInt16("1500"); } return maxSduSize; } | /**
* Gets the value for child leaf "max-sdu-size".
* @return The value of the leaf.
*/ | Gets the value for child leaf "max-sdu-size" | getMaxSduSizeValue | {
"repo_name": "jnpr-shinma/yangfile",
"path": "hitel/src/hctaEpc/mmeSgsn/subscriber/MmeQosConversion.java",
"license": "apache-2.0",
"size": 19183
} | [
"com.tailf.jnc.YangUInt16"
] | import com.tailf.jnc.YangUInt16; | import com.tailf.jnc.*; | [
"com.tailf.jnc"
] | com.tailf.jnc; | 72,474 |
public String getPrevDate()
{
m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() -1);
return getTodayDate();
} // getPrevDate
| String function() { m_calendar.set (Calendar.DAY_OF_MONTH, getDayOfMonth() -1); return getTodayDate(); } | /**
* Set the calendar to the prev day, and return this.
* @return the prev day.
*/ | Set the calendar to the prev day, and return this | getPrevDate | {
"repo_name": "OpenCollabZA/sakai",
"path": "calendar/calendar-util/util/src/java/org/sakaiproject/util/CalendarUtil.java",
"license": "apache-2.0",
"size": 17701
} | [
"java.util.Calendar"
] | import java.util.Calendar; | import java.util.*; | [
"java.util"
] | java.util; | 2,312,829 |
private MappedByteBuffer getMappedBuffer(int len) throws IOException {
// If request is outside mapped region, map a new region.
if(streamPos < mappedPos || streamPos + len >= mappedUpperBound) {
// Set the map position.
mappedPos = streamPos;
// Determine the map size.
long mappedSize = Math.min(channel.size() - mappedPos,
Integer.MAX_VALUE);
// Set the mapped upper bound.
mappedUpperBound = mappedPos + mappedSize;
// Map the file.
mappedBuffer = channel.map(FileChannel.MapMode.READ_ONLY,
mappedPos,
mappedSize);
mappedBuffer.order(super.getByteOrder());
}
return mappedBuffer;
}
// --- Implementation of superclass abstract methods. --- | MappedByteBuffer function(int len) throws IOException { if(streamPos < mappedPos streamPos + len >= mappedUpperBound) { mappedPos = streamPos; long mappedSize = Math.min(channel.size() - mappedPos, Integer.MAX_VALUE); mappedUpperBound = mappedPos + mappedSize; mappedBuffer = channel.map(FileChannel.MapMode.READ_ONLY, mappedPos, mappedSize); mappedBuffer.order(super.getByteOrder()); } return mappedBuffer; } | /**
* Returns a <code>MappedByteBuffer</code> which memory maps
* at least from the channel position corresponding to the
* current stream position to <code>len</code> bytes beyond.
* A new buffer is created only if necessary.
*
* @param len The number of bytes required beyond the current stream
* position.
*/ | Returns a <code>MappedByteBuffer</code> which memory maps at least from the channel position corresponding to the current stream position to <code>len</code> bytes beyond. A new buffer is created only if necessary | getMappedBuffer | {
"repo_name": "Windowsfreak/NIStreamer",
"path": "Windows/testjni32/src/com/sun/media/imageio/stream/FileChannelImageInputStream.java",
"license": "mit",
"size": 16019
} | [
"java.io.IOException",
"java.nio.MappedByteBuffer",
"java.nio.channels.FileChannel"
] | import java.io.IOException; import java.nio.MappedByteBuffer; import java.nio.channels.FileChannel; | import java.io.*; import java.nio.*; import java.nio.channels.*; | [
"java.io",
"java.nio"
] | java.io; java.nio; | 466,596 |
@Test
@ExpectedFFDC("com.ibm.ejs.container.BeanNotReentrantException")
public void testSFLocalInterfaceMethod_NonReentrantRecursive() throws Exception {
SFLTestReentrance ejb1 = null;
try {
ejb1 = rhome1.create();
ejb1.callNonRecursiveSelf(5, ejb1);
fail("Unexpected return from callNonRecursiveSelf().");
} catch (SFLApplException bae) {
String className = bae.getClass().getName();
assertTrue("Did not Catch expected exception for " + className + ": " + bae, bae.passed);
} finally {
if (ejb1 != null) {
ejb1.remove();
}
}
} | @ExpectedFFDC(STR) void function() throws Exception { SFLTestReentrance ejb1 = null; try { ejb1 = rhome1.create(); ejb1.callNonRecursiveSelf(5, ejb1); fail(STR); } catch (SFLApplException bae) { String className = bae.getClass().getName(); assertTrue(STR + className + STR + bae, bae.passed); } finally { if (ejb1 != null) { ejb1.remove(); } } } | /**
* (bmc06) Test Stateful local non-reentrant recursive method call. <p>
*
* See EJB 2.0 Spec section 12.1.11.
*/ | (bmc06) Test Stateful local non-reentrant recursive method call. See EJB 2.0 Spec section 12.1.11 | testSFLocalInterfaceMethod_NonReentrantRecursive | {
"repo_name": "OpenLiberty/open-liberty",
"path": "dev/com.ibm.ws.ejbcontainer.legacy_fat/test-applications/EJB2XLocalSpecWeb.war/src/com/ibm/ejb2x/base/spec/sfl/web/SFLocalInterfaceMethodServlet.java",
"license": "epl-1.0",
"size": 14054
} | [
"com.ibm.ejb2x.base.spec.sfl.ejb.SFLApplException",
"com.ibm.ejb2x.base.spec.sfl.ejb.SFLTestReentrance",
"org.junit.Assert"
] | import com.ibm.ejb2x.base.spec.sfl.ejb.SFLApplException; import com.ibm.ejb2x.base.spec.sfl.ejb.SFLTestReentrance; import org.junit.Assert; | import com.ibm.ejb2x.base.spec.sfl.ejb.*; import org.junit.*; | [
"com.ibm.ejb2x",
"org.junit"
] | com.ibm.ejb2x; org.junit; | 251,220 |
protected List<WordResult> regexSearch(Pattern p, String text)
{
Matcher m = p.matcher(text);
ArrayList<WordResult> results = new ArrayList<WordResult>();
while (m.find())
{
results.add(new WordResult(m.start(), m.end(), m.group()));
Thread.yield();
}
return results;
} | List<WordResult> function(Pattern p, String text) { Matcher m = p.matcher(text); ArrayList<WordResult> results = new ArrayList<WordResult>(); while (m.find()) { results.add(new WordResult(m.start(), m.end(), m.group())); Thread.yield(); } return results; } | /**
* Searches <code>text</code> using the provided <code>Pattern</code><br>
* <br>
* Thanks to prec in #regex for correcting the use of Matcher.
*
* @author Carl Hall (carl.hall@gmail.com)
* @param p
* @param text
* @return
*/ | Searches <code>text</code> using the provided <code>Pattern</code> Thanks to prec in #regex for correcting the use of Matcher | regexSearch | {
"repo_name": "bwollman/41_follow",
"path": "src/main/java/ghm/follow/search/SearchEngine.java",
"license": "gpl-2.0",
"size": 2979
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 963,591 |
public static boolean authenticateImap(String username,
String password,
Properties props)
{
String url="imap://mailtest:"+username+"@"+props.getProperty(LoginServiceImpl.LOGIN_HOST);
// configure the jvm to use the jsse security.
java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
try {
// create the Session
javax.mail.Session session = javax.mail.Session.getInstance(props);
// and create the store..
javax.mail.Store store = session.getStore(new
javax.mail.URLName(url));
//javax.mail.URLName("imap://mailtest:mailtest@localhost/"));
// and connect.
store.connect(username, password);
return true;
} catch (Exception e) {
logger.error(username+ " unable to connect to "+url, e);
return false;
}
} | static boolean function(String username, String password, Properties props) { String url=STR unable to connect to "+url, e); return false; } } | /**
* Attempt to authenticate a user via IMAP.
*
* @param username the username
* @param password the plaintext password
* @param props login properties from the servlet context init parameters
* @return true if the user has been authenticated successfully, false if not
*/ | Attempt to authenticate a user via IMAP | authenticateImap | {
"repo_name": "ndrppnc/CloudCoder",
"path": "CloudCoder/src/org/cloudcoder/app/server/rpc/ServletUtil.java",
"license": "agpl-3.0",
"size": 2298
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,067,945 |
@SuppressWarnings("unused")
protected void createEnclosingTypeControls(Composite composite, int nColumns) {
// #6891
Composite tabGroup = new Composite(composite, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
tabGroup.setLayout(layout);
fEnclosingTypeSelection.doFillIntoGrid(tabGroup, 1);
Text text = fEnclosingTypeDialogField.getTextControl(composite);
SWTUtil.setAccessibilityText(text, NewWizardMessages.NewTypeWizardPage_enclosing_field_description);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.widthHint = getMaxFieldWidth();
gd.horizontalSpan = 2;
text.setLayoutData(gd);
Button button = fEnclosingTypeDialogField.getChangeControl(composite);
gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.widthHint = SWTUtil.getButtonWidthHint(button);
button.setLayoutData(gd);
ControlContentAssistHelper.createTextContentAssistant(text, fEnclosingTypeCompletionProcessor);
TextFieldNavigationHandler.install(text);
} | @SuppressWarnings(STR) void function(Composite composite, int nColumns) { Composite tabGroup = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(); layout.marginWidth = 0; layout.marginHeight = 0; tabGroup.setLayout(layout); fEnclosingTypeSelection.doFillIntoGrid(tabGroup, 1); Text text = fEnclosingTypeDialogField.getTextControl(composite); SWTUtil.setAccessibilityText(text, NewWizardMessages.NewTypeWizardPage_enclosing_field_description); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.widthHint = getMaxFieldWidth(); gd.horizontalSpan = 2; text.setLayoutData(gd); Button button = fEnclosingTypeDialogField.getChangeControl(composite); gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); gd.widthHint = SWTUtil.getButtonWidthHint(button); button.setLayoutData(gd); ControlContentAssistHelper.createTextContentAssistant(text, fEnclosingTypeCompletionProcessor); TextFieldNavigationHandler.install(text); } | /**
* Creates the controls for the enclosing type name field. Expects a
* <code>GridLayout</code> with at least 4 columns.
*
* @param composite the parent composite
* @param nColumns number of columns to span
*/ | Creates the controls for the enclosing type name field. Expects a <code>GridLayout</code> with at least 4 columns | createEnclosingTypeControls | {
"repo_name": "psoreide/bnd",
"path": "bndtools.core/src/org/bndtools/core/ui/wizards/ds/NewTypeWizardPage.java",
"license": "apache-2.0",
"size": 94393
} | [
"org.eclipse.jdt.internal.ui.dialogs.TextFieldNavigationHandler",
"org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper",
"org.eclipse.jdt.internal.ui.util.SWTUtil",
"org.eclipse.jdt.internal.ui.wizards.NewWizardMessages",
"org.eclipse.swt.layout.GridData",
"org.eclipse.swt.lay... | import org.eclipse.jdt.internal.ui.dialogs.TextFieldNavigationHandler; import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper; import org.eclipse.jdt.internal.ui.util.SWTUtil; import org.eclipse.jdt.internal.ui.wizards.NewWizardMessages; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Text; | import org.eclipse.jdt.internal.ui.dialogs.*; import org.eclipse.jdt.internal.ui.refactoring.contentassist.*; import org.eclipse.jdt.internal.ui.util.*; import org.eclipse.jdt.internal.ui.wizards.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; | [
"org.eclipse.jdt",
"org.eclipse.swt"
] | org.eclipse.jdt; org.eclipse.swt; | 2,512,794 |
public Rectangle2D fill(PDFRenderer state, Graphics2D g,
GeneralPath s) {
g.setPaint(this.mainPaint);
g.fill(s);
return s.createTransformedShape(g.getTransform()).getBounds2D();
} | Rectangle2D function(PDFRenderer state, Graphics2D g, GeneralPath s) { g.setPaint(this.mainPaint); g.fill(s); return s.createTransformedShape(g.getTransform()).getBounds2D(); } | /**
* fill a path with the paint, and record the dirty area.
*
* @param state the current graphics state
* @param g the graphics into which to draw
* @param s the path to fill
* @return a {@link java.awt.geom.Rectangle2D} object.
*/ | fill a path with the paint, and record the dirty area | fill | {
"repo_name": "oswetto/LoboEvolution",
"path": "LoboPDF/src/main/java/org/loboevolution/pdfview/PDFPaint.java",
"license": "gpl-3.0",
"size": 2774
} | [
"java.awt.Graphics2D",
"java.awt.geom.GeneralPath",
"java.awt.geom.Rectangle2D"
] | import java.awt.Graphics2D; import java.awt.geom.GeneralPath; import java.awt.geom.Rectangle2D; | import java.awt.*; import java.awt.geom.*; | [
"java.awt"
] | java.awt; | 2,366,512 |
public void testUnusualArgs() {
// text (first) arg type is number, other args are strings with fractional digits
confirmLen(new NumberEval(123456), 6);
confirmLen(BoolEval.FALSE, 5);
confirmLen(BoolEval.TRUE, 4);
confirmLen(BlankEval.instance, 0);
} | void function() { confirmLen(new NumberEval(123456), 6); confirmLen(BoolEval.FALSE, 5); confirmLen(BoolEval.TRUE, 4); confirmLen(BlankEval.instance, 0); } | /**
* Valid cases where text arg is not exactly a string
*/ | Valid cases where text arg is not exactly a string | testUnusualArgs | {
"repo_name": "tobyclemson/msci-project",
"path": "vendor/poi-3.6/src/testcases/org/apache/poi/hssf/record/formula/functions/TestLen.java",
"license": "mit",
"size": 2618
} | [
"org.apache.poi.hssf.record.formula.eval.BlankEval",
"org.apache.poi.hssf.record.formula.eval.BoolEval",
"org.apache.poi.hssf.record.formula.eval.NumberEval"
] | import org.apache.poi.hssf.record.formula.eval.BlankEval; import org.apache.poi.hssf.record.formula.eval.BoolEval; import org.apache.poi.hssf.record.formula.eval.NumberEval; | import org.apache.poi.hssf.record.formula.eval.*; | [
"org.apache.poi"
] | org.apache.poi; | 2,420,769 |
private Single<JsonObject> rxAnalyseSentiment(JsonObject crawlResult) {
return rxGetService(NewsAnalyserService.name(), NewsAnalyserService.class)
// We wrap the call inside a CircuitBreaker so that we can continually retry certain errors, knowing
// that the underlying service won't actual get called until the circuit breaker closes again. This is
// handy for 429 responses (API rate limits). We simply keep retrying knowing that the circuit breaker
// is preventing unnecessary network calls
.flatMap(service -> this.<JsonObject>rxExecuteCommand(newsAnalyserBreaker, command ->
service.rxAnalyseSentiment(crawlResult)
.doOnError(error -> handlerError(error, service::setTimeout))
.subscribe(RxHelper.toSubscriber(command.completer())))
.retryWhen(errors -> errors.flatMap(error -> {
// TODO: implement a more robust retry method
if (error.getMessage().contains("429") || error.getMessage().contains("open circuit")) {
return Observable.just(null).delay(200, TimeUnit.MILLISECONDS);
}
release(service);
return Observable.error(error);
})));
} | Single<JsonObject> function(JsonObject crawlResult) { return rxGetService(NewsAnalyserService.name(), NewsAnalyserService.class) .flatMap(service -> this.<JsonObject>rxExecuteCommand(newsAnalyserBreaker, command -> service.rxAnalyseSentiment(crawlResult) .doOnError(error -> handlerError(error, service::setTimeout)) .subscribe(RxHelper.toSubscriber(command.completer()))) .retryWhen(errors -> errors.flatMap(error -> { if (error.getMessage().contains("429") error.getMessage().contains(STR)) { return Observable.just(null).delay(200, TimeUnit.MILLISECONDS); } release(service); return Observable.error(error); }))); } | /**
* Performs sentiment analysis on each of the articles contained within the crawlResult.
* @param crawlResult JsonObject which contains the articles to perform analysis on
* @return Single which emits the results of the sentiment analyisis
*/ | Performs sentiment analysis on each of the articles contained within the crawlResult | rxAnalyseSentiment | {
"repo_name": "lukeherron/Sentiment",
"path": "sentiment-service/src/main/java/com/gofish/sentiment/sentimentservice/SentimentServiceImpl.java",
"license": "mit",
"size": 16611
} | [
"com.gofish.sentiment.newsanalyser.rxjava.NewsAnalyserService",
"io.vertx.core.json.JsonObject",
"io.vertx.rx.java.RxHelper",
"java.util.concurrent.TimeUnit"
] | import com.gofish.sentiment.newsanalyser.rxjava.NewsAnalyserService; import io.vertx.core.json.JsonObject; import io.vertx.rx.java.RxHelper; import java.util.concurrent.TimeUnit; | import com.gofish.sentiment.newsanalyser.rxjava.*; import io.vertx.core.json.*; import io.vertx.rx.java.*; import java.util.concurrent.*; | [
"com.gofish.sentiment",
"io.vertx.core",
"io.vertx.rx",
"java.util"
] | com.gofish.sentiment; io.vertx.core; io.vertx.rx; java.util; | 1,361,777 |
public String buildText(boolean frontend) {
StringBuffer result = new StringBuffer();
List<String> rows = frontend ? m_rows : m_dbrows;
List<String> cols = frontend ? m_cols : m_dbcols;
for (int i = 0; i < rows.size(); i++) {
String row = rows.get(i);
for (int j = 0; j < cols.size(); j++) {
String col = cols.get(j);
String key = getKey(m_dbcols.get(j), m_dbrows.get(i), false);
if (m_tableItems.containsKey(key)) {
CmsFieldItem item = m_tableItems.get(key);
result.append(getKey(col, row, frontend)).append(":\t");
result.append(item.getValue()).append("\n");
}
}
}
return result.toString();
}
| String function(boolean frontend) { StringBuffer result = new StringBuffer(); List<String> rows = frontend ? m_rows : m_dbrows; List<String> cols = frontend ? m_cols : m_dbcols; for (int i = 0; i < rows.size(); i++) { String row = rows.get(i); for (int j = 0; j < cols.size(); j++) { String col = cols.get(j); String key = getKey(m_dbcols.get(j), m_dbrows.get(i), false); if (m_tableItems.containsKey(key)) { CmsFieldItem item = m_tableItems.get(key); result.append(getKey(col, row, frontend)).append(":\t"); result.append(item.getValue()).append("\n"); } } } return result.toString(); } | /**
* Returns a table without HTML like "col_row:value".<p>
*
* @param frontend if frontend or backend labels should be used
*
* @return the table without using HTML needed for email
*/ | Returns a table without HTML like "col_row:value" | buildText | {
"repo_name": "gallardo/alkacon-oamp",
"path": "com.alkacon.opencms.v8.formgenerator/src/com/alkacon/opencms/v8/formgenerator/CmsTableField.java",
"license": "gpl-3.0",
"size": 15855
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,584,156 |
public void setResources(List<Resource> resources) {
this.resources = resources;
}
| void function(List<Resource> resources) { this.resources = resources; } | /**
* Sets the value of resources
* @param resources
*/ | Sets the value of resources | setResources | {
"repo_name": "BeliliFahem/om2m-java-client-api",
"path": "src/main/java/org/eclipse/om2m/commons/resource/Resources.java",
"license": "epl-1.0",
"size": 1910
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 249,813 |
private ProjCoordinate translate(ProjCoordinate v) {
ProjCoordinate vector = new ProjCoordinate(v);
vector.x /= cellHeight;
vector.y /= cellWidth;
ProjCoordinate val = new ProjCoordinate(Double.MAX_VALUE, Double.MAX_VALUE);
ProjCoordinate fract = new ProjCoordinate();
int indexX = (int) Math.floor(vector.x);
int indexY = (int) Math.floor(vector.y);
fract.x = vector.x - indexX;
fract.y = vector.y - indexY;
if (indexX < 0) {
// TODO: Why > 0.99+ instead of >= 1
if (indexX == -1 && fract.x > 0.99999999999) {
indexX++;
fract.x = 0;
} else {
return val;
}
} else {
double in = indexX + 1;
if (in >= cvMatrix.length) {
if (in == cvMatrix.length && fract.x < 1e-11) {
indexX--;
fract.x = 1;
} else {
return val;
}
}
}
if (indexY < 0) {
// TODO: Why > 0.99+ instead of >= 1
if (indexY == -1 && fract.y > 0.99999999999) {
indexY++;
fract.y = 0;
} else {
return val;
}
} else {
double in = indexY + 1;
if (in >= cvMatrix[0].length) {
if (in == cvMatrix[0].length && fract.y < 1e-11) {
indexY--;
fract.y = 1;
} else {
return val;
}
}
}
float[] f00 = cvMatrix[indexX][indexY];
float[] f10 = cvMatrix[indexX + 1][indexY];
float[] f11 = cvMatrix[indexX + 1][indexY + 1];
float[] f01 = cvMatrix[indexX][indexY + 1];
double m11 = fract.x * fract.y;
double m10 = fract.x * (1d - fract.y);
double m00 = (1d - fract.x) * (1d - fract.y);
double m01 = (1d - fract.x) * fract.y;
val.x = m00 * f00[0] + m10 * f10[0] + m01 * f01[0] + m11 * f11[0];
val.y = m00 * f00[1] + m10 * f10[1] + m01 * f01[1] + m11 * f11[1];
return val;
} | ProjCoordinate function(ProjCoordinate v) { ProjCoordinate vector = new ProjCoordinate(v); vector.x /= cellHeight; vector.y /= cellWidth; ProjCoordinate val = new ProjCoordinate(Double.MAX_VALUE, Double.MAX_VALUE); ProjCoordinate fract = new ProjCoordinate(); int indexX = (int) Math.floor(vector.x); int indexY = (int) Math.floor(vector.y); fract.x = vector.x - indexX; fract.y = vector.y - indexY; if (indexX < 0) { if (indexX == -1 && fract.x > 0.99999999999) { indexX++; fract.x = 0; } else { return val; } } else { double in = indexX + 1; if (in >= cvMatrix.length) { if (in == cvMatrix.length && fract.x < 1e-11) { indexX--; fract.x = 1; } else { return val; } } } if (indexY < 0) { if (indexY == -1 && fract.y > 0.99999999999) { indexY++; fract.y = 0; } else { return val; } } else { double in = indexY + 1; if (in >= cvMatrix[0].length) { if (in == cvMatrix[0].length && fract.y < 1e-11) { indexY--; fract.y = 1; } else { return val; } } } float[] f00 = cvMatrix[indexX][indexY]; float[] f10 = cvMatrix[indexX + 1][indexY]; float[] f11 = cvMatrix[indexX + 1][indexY + 1]; float[] f01 = cvMatrix[indexX][indexY + 1]; double m11 = fract.x * fract.y; double m10 = fract.x * (1d - fract.y); double m00 = (1d - fract.x) * (1d - fract.y); double m01 = (1d - fract.x) * fract.y; val.x = m00 * f00[0] + m10 * f10[0] + m01 * f01[0] + m11 * f11[0]; val.y = m00 * f00[1] + m10 * f10[1] + m01 * f01[1] + m11 * f11[1]; return val; } | /**
* Gets the translation (in radians) to apply to get to the given cell position
* @param vector a position related to the beginning of the grid, in radians
* @return a translation vector in radians
*/ | Gets the translation (in radians) to apply to get to the given cell position | translate | {
"repo_name": "ebocher/jproj",
"path": "src/main/java/org/jproj/grids/LeafNadgrid.java",
"license": "apache-2.0",
"size": 7961
} | [
"org.jproj.ProjCoordinate"
] | import org.jproj.ProjCoordinate; | import org.jproj.*; | [
"org.jproj"
] | org.jproj; | 1,591,207 |
public void sendMail(UserRequest ureq) {
String recipient = WebappHelper.getMailConfig("mailDeleteUser");
if (recipient.equals("disabled")) {
return;
}
StringBuffer loginsFound = new StringBuffer();
for(String login : lstLoginsFound) loginsFound.append(login + "\n");
StringBuffer loginsNotfound = new StringBuffer();
for(String login : lstLoginsNotfound) loginsNotfound.append(login + "\n");
DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, ureq.getLocale());
String[] bodyArgs = new String[] {
ureq.getIdentity().getName(),
loginsFound.toString(),
loginsNotfound.toString(),
reason,
df.format(new Date())
};
ContactList cl = new ContactList(recipient);
cl.add(recipient);
cl.add(ureq.getIdentity());
try {
MailBundle bundle = new MailBundle();
bundle.setFrom(WebappHelper.getMailConfig("mailReplyTo"));
bundle.setContent(translate("mail.subject"), translate("mail.body", bodyArgs));
bundle.setContactList(cl);
mailService.sendMessage(bundle);
} catch (Exception e) {
logError("Notificatoin mail for bulk deletion could not be sent", null);
}
}
| void function(UserRequest ureq) { String recipient = WebappHelper.getMailConfig(STR); if (recipient.equals(STR)) { return; } StringBuffer loginsFound = new StringBuffer(); for(String login : lstLoginsFound) loginsFound.append(login + "\n"); StringBuffer loginsNotfound = new StringBuffer(); for(String login : lstLoginsNotfound) loginsNotfound.append(login + "\n"); DateFormat df = DateFormat.getDateInstance(DateFormat.FULL, ureq.getLocale()); String[] bodyArgs = new String[] { ureq.getIdentity().getName(), loginsFound.toString(), loginsNotfound.toString(), reason, df.format(new Date()) }; ContactList cl = new ContactList(recipient); cl.add(recipient); cl.add(ureq.getIdentity()); try { MailBundle bundle = new MailBundle(); bundle.setFrom(WebappHelper.getMailConfig(STR)); bundle.setContent(translate(STR), translate(STR, bodyArgs)); bundle.setContactList(cl); mailService.sendMessage(bundle); } catch (Exception e) { logError(STR, null); } } | /**
* Send the mail with informations: who deletes, when, list of deleted users
* list of not deleted users, reason for deletion
*/ | Send the mail with informations: who deletes, when, list of deleted users list of not deleted users, reason for deletion | sendMail | {
"repo_name": "stevenhva/InfoLearn_OpenOLAT",
"path": "src/main/java/org/olat/admin/user/delete/BulkDeleteController.java",
"license": "apache-2.0",
"size": 6485
} | [
"java.text.DateFormat",
"java.util.Date",
"org.olat.core.gui.UserRequest",
"org.olat.core.util.WebappHelper",
"org.olat.core.util.mail.ContactList",
"org.olat.core.util.mail.MailBundle"
] | import java.text.DateFormat; import java.util.Date; import org.olat.core.gui.UserRequest; import org.olat.core.util.WebappHelper; import org.olat.core.util.mail.ContactList; import org.olat.core.util.mail.MailBundle; | import java.text.*; import java.util.*; import org.olat.core.gui.*; import org.olat.core.util.*; import org.olat.core.util.mail.*; | [
"java.text",
"java.util",
"org.olat.core"
] | java.text; java.util; org.olat.core; | 1,027,605 |
public void zoomToFitMarkers(Marker... markers) {
LatLngBounds.Builder b = new LatLngBounds.Builder();
for (Marker m : markers) {
b.include(m.getPosition());
}
LatLngBounds bounds = b.build();
CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 25, 25, 5);
googleMap.animateCamera(cu);
} | void function(Marker... markers) { LatLngBounds.Builder b = new LatLngBounds.Builder(); for (Marker m : markers) { b.include(m.getPosition()); } LatLngBounds bounds = b.build(); CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, 25, 25, 5); googleMap.animateCamera(cu); } | /**
* To zoom the camera to the best possible position so the camera can view
* all the markers
*
* @param markers : The array of markers to zoom to
*/ | To zoom the camera to the best possible position so the camera can view all the markers | zoomToFitMarkers | {
"repo_name": "gfirem/ElRosaCruz",
"path": "branches/development/android/sources/ElRosaCruz/app/src/main/java/com/gfirem/elrosacruz/utils/MapHelper.java",
"license": "apache-2.0",
"size": 23598
} | [
"com.google.android.gms.maps.CameraUpdate",
"com.google.android.gms.maps.CameraUpdateFactory",
"com.google.android.gms.maps.model.LatLngBounds",
"com.google.android.gms.maps.model.Marker"
] | import com.google.android.gms.maps.CameraUpdate; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.model.LatLngBounds; import com.google.android.gms.maps.model.Marker; | import com.google.android.gms.maps.*; import com.google.android.gms.maps.model.*; | [
"com.google.android"
] | com.google.android; | 1,631,923 |
public boolean isHandled(final HttpServletRequest request) {
if ( handled ) return true; // ... once handled always handled !
// setting a header should consider the response to be handled
if ( ! isStatusSet() ) {
if ( ! isHeaderSet() ) {
// true by default seems very weird but this is best to cover
// "more" containers right out of the box ...
// e.g. Jetty https://github.com/jruby/jruby-rack/issues/175
return handled = isHandledByDefault();
}
// consider HTTP OPTIONS with "Allow" header unhandled :
if ( request != null && "OPTIONS".equals( request.getMethod() ) ) {
final Collection<String> headerNames = getHeaderNamesOrNull();
if ( headerNames == null || headerNames.isEmpty() ) {
// not to happen but there's all kind of beasts out there
return false;
}
for ( final String headerName : headerNames ) {
if ( ! "Allow".equals( headerName ) ) {
return handled = true; // not just Allow header - consider handled
}
}
return false; // OPTIONS with only Allow header set - unhandled
}
return handled = true;
}
if ( notHandledStatuses.contains( getStatus() ) ) return false;
return handled = true;
} | boolean function(final HttpServletRequest request) { if ( handled ) return true; if ( ! isStatusSet() ) { if ( ! isHeaderSet() ) { return handled = isHandledByDefault(); } if ( request != null && STR.equals( request.getMethod() ) ) { final Collection<String> headerNames = getHeaderNamesOrNull(); if ( headerNames == null headerNames.isEmpty() ) { return false; } for ( final String headerName : headerNames ) { if ( ! "Allow".equals( headerName ) ) { return handled = true; } } return false; } return handled = true; } if ( notHandledStatuses.contains( getStatus() ) ) return false; return handled = true; } | /**
* Response is considered to be handled if a status has been set
* and it is (by default) not a HTTP NOT FOUND (404) status.
*
* @return true if this response should be considered as handled
* @see #handleStatus(int, boolean)
*/ | Response is considered to be handled if a status has been set and it is (by default) not a HTTP NOT FOUND (404) status | isHandled | {
"repo_name": "jhstatewide/jruby-rack",
"path": "src/main/java/org/jruby/rack/servlet/ResponseCapture.java",
"license": "mit",
"size": 8926
} | [
"java.util.Collection",
"javax.servlet.http.HttpServletRequest"
] | import java.util.Collection; import javax.servlet.http.HttpServletRequest; | import java.util.*; import javax.servlet.http.*; | [
"java.util",
"javax.servlet"
] | java.util; javax.servlet; | 1,653,013 |
public void setExtends(String superType) {
if (!Strings.isEmpty(superType)) {
JvmParameterizedTypeReference superTypeRef = newTypeRef(this.container, superType);
this.sarlClass.setExtends(superTypeRef);
return;
}
this.sarlClass.setExtends(null);
} | void function(String superType) { if (!Strings.isEmpty(superType)) { JvmParameterizedTypeReference superTypeRef = newTypeRef(this.container, superType); this.sarlClass.setExtends(superTypeRef); return; } this.sarlClass.setExtends(null); } | /** Change the super type.
* @param superType the qualified name of the super type,
* or {@code null} if the default type.
*/ | Change the super type | setExtends | {
"repo_name": "sarl/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlClassBuilderImpl.java",
"license": "apache-2.0",
"size": 9330
} | [
"org.eclipse.xtext.common.types.JvmParameterizedTypeReference",
"org.eclipse.xtext.util.Strings"
] | import org.eclipse.xtext.common.types.JvmParameterizedTypeReference; import org.eclipse.xtext.util.Strings; | import org.eclipse.xtext.common.types.*; import org.eclipse.xtext.util.*; | [
"org.eclipse.xtext"
] | org.eclipse.xtext; | 1,128,818 |
private void applyPropertyPattern(RuleCharacterIterator chars,
Appendable rebuiltPat, SymbolTable symbols) {
String patStr = chars.lookahead();
ParsePosition pos = new ParsePosition(0);
applyPropertyPattern(patStr, pos, symbols);
if (pos.getIndex() == 0) {
syntaxError(chars, "Invalid property pattern");
}
chars.jumpahead(pos.getIndex());
append(rebuiltPat, patStr.substring(0, pos.getIndex()));
}
//----------------------------------------------------------------
// Case folding API
//----------------------------------------------------------------
public static final int IGNORE_SPACE = 1;
public static final int CASE = 2;
public static final int CASE_INSENSITIVE = 2;
public static final int ADD_CASE_MAPPINGS = 4; | void function(RuleCharacterIterator chars, Appendable rebuiltPat, SymbolTable symbols) { String patStr = chars.lookahead(); ParsePosition pos = new ParsePosition(0); applyPropertyPattern(patStr, pos, symbols); if (pos.getIndex() == 0) { syntaxError(chars, STR); } chars.jumpahead(pos.getIndex()); append(rebuiltPat, patStr.substring(0, pos.getIndex())); } public static final int IGNORE_SPACE = 1; public static final int CASE = 2; public static final int CASE_INSENSITIVE = 2; public static final int ADD_CASE_MAPPINGS = 4; | /**
* Parse a property pattern.
* @param chars iterator over the pattern characters. Upon return
* it will be advanced to the first character after the parsed
* pattern, or the end of the iteration if all characters are
* parsed.
* @param rebuiltPat the pattern that was parsed, rebuilt or
* copied from the input pattern, as appropriate.
* @param symbols TODO
*/ | Parse a property pattern | applyPropertyPattern | {
"repo_name": "andreynovikov/maptrek",
"path": "app/src/main/java/com/ibm/icu/text/UnicodeSet.java",
"license": "gpl-3.0",
"size": 189524
} | [
"com.ibm.icu.impl.RuleCharacterIterator",
"java.text.ParsePosition"
] | import com.ibm.icu.impl.RuleCharacterIterator; import java.text.ParsePosition; | import com.ibm.icu.impl.*; import java.text.*; | [
"com.ibm.icu",
"java.text"
] | com.ibm.icu; java.text; | 1,670,612 |
public Node clonePropsFrom(Node other) {
Preconditions.checkState(this.propListHead == null,
"Node has existing properties.");
this.propListHead = other.propListHead;
return this;
} | Node function(Node other) { Preconditions.checkState(this.propListHead == null, STR); this.propListHead = other.propListHead; return this; } | /**
* Clone the properties from the provided node without copying
* the property object. The recieving node may not have any
* existing properties.
* @param other The node to clone properties from.
* @return this node.
*/ | Clone the properties from the provided node without copying the property object. The recieving node may not have any existing properties | clonePropsFrom | {
"repo_name": "antz29/closure-compiler",
"path": "src/com/google/javascript/rhino/Node.java",
"license": "apache-2.0",
"size": 64255
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 190,817 |
JobClient getJobClient(final JobID jobId, final ClassLoader userCodeClassloader); | JobClient getJobClient(final JobID jobId, final ClassLoader userCodeClassloader); | /**
* Creates a {@link JobClient} that is adequate for the context in which the job is executed.
* @param jobId the job id of the job associated with the returned client.
* @param userCodeClassloader the class loader to deserialize user code.
* @return the job client.
*/ | Creates a <code>JobClient</code> that is adequate for the context in which the job is executed | getJobClient | {
"repo_name": "greghogan/flink",
"path": "flink-clients/src/main/java/org/apache/flink/client/deployment/application/executors/EmbeddedJobClientCreator.java",
"license": "apache-2.0",
"size": 1509
} | [
"org.apache.flink.api.common.JobID",
"org.apache.flink.core.execution.JobClient"
] | import org.apache.flink.api.common.JobID; import org.apache.flink.core.execution.JobClient; | import org.apache.flink.api.common.*; import org.apache.flink.core.execution.*; | [
"org.apache.flink"
] | org.apache.flink; | 1,788,085 |
public DefaultModelBuilder newInstance()
{
DefaultModelBuilder modelBuilder = new DefaultModelBuilder();
modelBuilder.setModelProcessor( newModelProcessor() );
modelBuilder.setModelValidator( newModelValidator() );
modelBuilder.setModelNormalizer( newModelNormalizer() );
modelBuilder.setModelPathTranslator( newModelPathTranslator() );
modelBuilder.setModelUrlNormalizer( newModelUrlNormalizer() );
modelBuilder.setModelInterpolator( newModelInterpolator() );
modelBuilder.setInheritanceAssembler( newInheritanceAssembler() );
modelBuilder.setProfileInjector( newProfileInjector() );
modelBuilder.setProfileSelector( newProfileSelector() );
modelBuilder.setSuperPomProvider( newSuperPomProvider() );
modelBuilder.setDependencyManagementImporter( newDependencyManagementImporter() );
modelBuilder.setDependencyManagementInjector( newDependencyManagementInjector() );
modelBuilder.setLifecycleBindingsInjector( newLifecycleBindingsInjector() );
modelBuilder.setPluginManagementInjector( newPluginManagementInjector() );
modelBuilder.setPluginConfigurationExpander( newPluginConfigurationExpander() );
modelBuilder.setReportConfigurationExpander( newReportConfigurationExpander() );
modelBuilder.setReportingConverter( newReportingConverter() );
modelBuilder.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() );
return modelBuilder;
}
private static class StubLifecycleBindingsInjector
implements LifecycleBindingsInjector
{ | DefaultModelBuilder function() { DefaultModelBuilder modelBuilder = new DefaultModelBuilder(); modelBuilder.setModelProcessor( newModelProcessor() ); modelBuilder.setModelValidator( newModelValidator() ); modelBuilder.setModelNormalizer( newModelNormalizer() ); modelBuilder.setModelPathTranslator( newModelPathTranslator() ); modelBuilder.setModelUrlNormalizer( newModelUrlNormalizer() ); modelBuilder.setModelInterpolator( newModelInterpolator() ); modelBuilder.setInheritanceAssembler( newInheritanceAssembler() ); modelBuilder.setProfileInjector( newProfileInjector() ); modelBuilder.setProfileSelector( newProfileSelector() ); modelBuilder.setSuperPomProvider( newSuperPomProvider() ); modelBuilder.setDependencyManagementImporter( newDependencyManagementImporter() ); modelBuilder.setDependencyManagementInjector( newDependencyManagementInjector() ); modelBuilder.setLifecycleBindingsInjector( newLifecycleBindingsInjector() ); modelBuilder.setPluginManagementInjector( newPluginManagementInjector() ); modelBuilder.setPluginConfigurationExpander( newPluginConfigurationExpander() ); modelBuilder.setReportConfigurationExpander( newReportConfigurationExpander() ); modelBuilder.setReportingConverter( newReportingConverter() ); modelBuilder.setProfileActivationFilePathInterpolator( newProfileActivationFilePathInterpolator() ); return modelBuilder; } private static class StubLifecycleBindingsInjector implements LifecycleBindingsInjector { | /**
* Creates a new model builder instance.
*
* @return The new model builder instance, never {@code null}.
*/ | Creates a new model builder instance | newInstance | {
"repo_name": "cstamas/maven",
"path": "maven-model-builder/src/main/java/org/apache/maven/model/building/DefaultModelBuilderFactory.java",
"license": "apache-2.0",
"size": 10291
} | [
"org.apache.maven.model.plugin.LifecycleBindingsInjector"
] | import org.apache.maven.model.plugin.LifecycleBindingsInjector; | import org.apache.maven.model.plugin.*; | [
"org.apache.maven"
] | org.apache.maven; | 6,462 |
private String validateImport(String importEntry) {
// This should either be a fully-qualified class name or a package
// name with a wildcard
if (importEntry.indexOf(';') > -1) {
throw new IllegalArgumentException(
Localizer.getMessage("jsp.error.page.invalid.import"));
}
return importEntry.trim();
}
}
public static class IncludeDirective extends Node {
public IncludeDirective(Attributes attrs, Mark start, Node parent) {
this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, null, start, parent);
}
public IncludeDirective(String qName, Attributes attrs,
Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs,
Mark start, Node parent) {
super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs,
taglibAttrs, start, parent);
} | String function(String importEntry) { if (importEntry.indexOf(';') > -1) { throw new IllegalArgumentException( Localizer.getMessage(STR)); } return importEntry.trim(); } } public static class IncludeDirective extends Node { public IncludeDirective(Attributes attrs, Mark start, Node parent) { this(JSP_INCLUDE_DIRECTIVE_ACTION, attrs, null, null, start, parent); } public IncludeDirective(String qName, Attributes attrs, Attributes nonTaglibXmlnsAttrs, Attributes taglibAttrs, Mark start, Node parent) { super(qName, INCLUDE_DIRECTIVE_ACTION, attrs, nonTaglibXmlnsAttrs, taglibAttrs, start, parent); } | /**
* Just need enough validation to make sure nothing strange is going on.
* The compiler will validate this thoroughly when it tries to compile
* the resulting .java file.
*/ | Just need enough validation to make sure nothing strange is going on. The compiler will validate this thoroughly when it tries to compile the resulting .java file | validateImport | {
"repo_name": "plumer/codana",
"path": "tomcat_files/8.0.22/Node.java",
"license": "mit",
"size": 76395
} | [
"org.xml.sax.Attributes"
] | import org.xml.sax.Attributes; | import org.xml.sax.*; | [
"org.xml.sax"
] | org.xml.sax; | 1,993,758 |
public boolean mkdirs(String src, PermissionStatus permissions
) throws IOException {
boolean status = mkdirsInternal(src, permissions);
getEditLog().logSync();
if (status && auditLog.isInfoEnabled() && isExternalInvocation()) {
final HdfsFileStatus stat = dir.getFileInfo(src);
logAuditEvent(UserGroupInformation.getCurrentUser(),
Server.getRemoteIp(),
"mkdirs", src, null, stat);
}
return status;
} | boolean function(String src, PermissionStatus permissions ) throws IOException { boolean status = mkdirsInternal(src, permissions); getEditLog().logSync(); if (status && auditLog.isInfoEnabled() && isExternalInvocation()) { final HdfsFileStatus stat = dir.getFileInfo(src); logAuditEvent(UserGroupInformation.getCurrentUser(), Server.getRemoteIp(), STR, src, null, stat); } return status; } | /**
* Create all the necessary directories
*/ | Create all the necessary directories | mkdirs | {
"repo_name": "wzhuo918/release-1.1.2-MDP",
"path": "src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java",
"license": "apache-2.0",
"size": 226670
} | [
"java.io.IOException",
"org.apache.hadoop.fs.permission.PermissionStatus",
"org.apache.hadoop.hdfs.protocol.HdfsFileStatus",
"org.apache.hadoop.ipc.Server",
"org.apache.hadoop.security.UserGroupInformation"
] | import java.io.IOException; import org.apache.hadoop.fs.permission.PermissionStatus; import org.apache.hadoop.hdfs.protocol.HdfsFileStatus; import org.apache.hadoop.ipc.Server; import org.apache.hadoop.security.UserGroupInformation; | import java.io.*; import org.apache.hadoop.fs.permission.*; import org.apache.hadoop.hdfs.protocol.*; import org.apache.hadoop.ipc.*; import org.apache.hadoop.security.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 1,605,734 |
public void testRemotes() {
GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME);
GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1");
UUID node1 = UUID.randomUUID();
UUID node2 = UUID.randomUUID();
GridCacheVersion ver1 = version(1);
GridCacheVersion ver2 = version(2);
GridCacheVersion ver3 = version(3);
GridCacheVersion ver4 = version(4);
GridCacheVersion ver5 = version(5);
entry.addRemote(node1, 1, ver1, true);
Collection<GridCacheMvccCandidate> cands = entry.remoteMvccSnapshot();
assert cands.size() == 1;
assert cands.iterator().next().version().equals(ver1);
entry.addRemote(node2, 5, ver5, true);
cands = entry.remoteMvccSnapshot();
assert cands.size() == 2;
info(cands);
// Check order.
checkOrder(cands, ver1, ver5);
entry.addRemote(node1, 3, ver3, true);
cands = entry.remoteMvccSnapshot();
info(cands);
assert cands.size() == 3;
// No reordering happens.
checkOrder(cands, ver1, ver5, ver3);
entry.doneRemote(ver3);
checkDone(entry.candidate(ver3));
entry.addRemote(node1, 2, ver2, true);
cands = entry.remoteMvccSnapshot();
info(cands);
assert cands.size() == 4;
// Check order.
checkOrder(cands, ver1, ver5, ver3, ver2);
entry.orderCompleted(
new GridCacheVersion(1, 2, 0, 0),
Arrays.asList(new GridCacheVersion(1, 3, 4, 0), ver2, new GridCacheVersion(1, 5, 6, 0)),
Collections.<GridCacheVersion>emptyList()
);
cands = entry.remoteMvccSnapshot();
info(cands);
assert cands.size() == 4;
// Done ver 2.
checkOrder(cands, ver1, ver2, ver5, ver3);
checkRemote(entry.candidate(ver1), ver1, false, false);
checkRemote(entry.candidate(ver2), ver2, true, false);
checkRemote(entry.candidate(ver3), ver3, true, true);
checkRemote(entry.candidate(ver5), ver5, false, false);
entry.doneRemote(ver5);
checkDone(entry.candidate(ver5));
entry.addRemote(node1, 4, ver4, true);
cands = entry.remoteMvccSnapshot();
info(cands);
assert cands.size() == 5;
// Check order.
checkOrder(cands, ver1, ver2, ver5, ver3, ver4);
entry.orderCompleted(ver3, Arrays.asList(ver2, ver5), Collections.<GridCacheVersion>emptyList());
cands = entry.remoteMvccSnapshot();
info(cands);
assert cands.size() == 5;
checkOrder(cands, ver1, ver2, ver5, ver3, ver4);
assert entry.anyOwner() == null;
entry.doneRemote(ver1);
checkRemoteOwner(entry.anyOwner(), ver1);
entry.removeLock(ver1);
assert entry.remoteMvccSnapshot().size() == 4;
assert entry.anyOwner() == null;
entry.doneRemote(ver2);
checkRemoteOwner(entry.anyOwner(), ver2);
entry.removeLock(ver2);
assert entry.remoteMvccSnapshot().size() == 3;
checkRemoteOwner(entry.anyOwner(), ver5);
entry.removeLock(ver3);
assert entry.remoteMvccSnapshot().size() == 2;
checkRemoteOwner(entry.anyOwner(), ver5);
entry.removeLock(ver5);
assert entry.remoteMvccSnapshot().size() == 1;
assert entry.anyOwner() == null;
entry.doneRemote(ver4);
checkRemoteOwner(entry.anyOwner(), ver4);
entry.removeLock(ver4);
assert entry.remoteMvccSnapshot().isEmpty();
assert entry.anyOwner() == null;
} | void function() { GridCacheAdapter<String, String> cache = grid.internalCache(DEFAULT_CACHE_NAME); GridCacheTestEntryEx entry = new GridCacheTestEntryEx(cache.context(), "1"); UUID node1 = UUID.randomUUID(); UUID node2 = UUID.randomUUID(); GridCacheVersion ver1 = version(1); GridCacheVersion ver2 = version(2); GridCacheVersion ver3 = version(3); GridCacheVersion ver4 = version(4); GridCacheVersion ver5 = version(5); entry.addRemote(node1, 1, ver1, true); Collection<GridCacheMvccCandidate> cands = entry.remoteMvccSnapshot(); assert cands.size() == 1; assert cands.iterator().next().version().equals(ver1); entry.addRemote(node2, 5, ver5, true); cands = entry.remoteMvccSnapshot(); assert cands.size() == 2; info(cands); checkOrder(cands, ver1, ver5); entry.addRemote(node1, 3, ver3, true); cands = entry.remoteMvccSnapshot(); info(cands); assert cands.size() == 3; checkOrder(cands, ver1, ver5, ver3); entry.doneRemote(ver3); checkDone(entry.candidate(ver3)); entry.addRemote(node1, 2, ver2, true); cands = entry.remoteMvccSnapshot(); info(cands); assert cands.size() == 4; checkOrder(cands, ver1, ver5, ver3, ver2); entry.orderCompleted( new GridCacheVersion(1, 2, 0, 0), Arrays.asList(new GridCacheVersion(1, 3, 4, 0), ver2, new GridCacheVersion(1, 5, 6, 0)), Collections.<GridCacheVersion>emptyList() ); cands = entry.remoteMvccSnapshot(); info(cands); assert cands.size() == 4; checkOrder(cands, ver1, ver2, ver5, ver3); checkRemote(entry.candidate(ver1), ver1, false, false); checkRemote(entry.candidate(ver2), ver2, true, false); checkRemote(entry.candidate(ver3), ver3, true, true); checkRemote(entry.candidate(ver5), ver5, false, false); entry.doneRemote(ver5); checkDone(entry.candidate(ver5)); entry.addRemote(node1, 4, ver4, true); cands = entry.remoteMvccSnapshot(); info(cands); assert cands.size() == 5; checkOrder(cands, ver1, ver2, ver5, ver3, ver4); entry.orderCompleted(ver3, Arrays.asList(ver2, ver5), Collections.<GridCacheVersion>emptyList()); cands = entry.remoteMvccSnapshot(); info(cands); assert cands.size() == 5; checkOrder(cands, ver1, ver2, ver5, ver3, ver4); assert entry.anyOwner() == null; entry.doneRemote(ver1); checkRemoteOwner(entry.anyOwner(), ver1); entry.removeLock(ver1); assert entry.remoteMvccSnapshot().size() == 4; assert entry.anyOwner() == null; entry.doneRemote(ver2); checkRemoteOwner(entry.anyOwner(), ver2); entry.removeLock(ver2); assert entry.remoteMvccSnapshot().size() == 3; checkRemoteOwner(entry.anyOwner(), ver5); entry.removeLock(ver3); assert entry.remoteMvccSnapshot().size() == 2; checkRemoteOwner(entry.anyOwner(), ver5); entry.removeLock(ver5); assert entry.remoteMvccSnapshot().size() == 1; assert entry.anyOwner() == null; entry.doneRemote(ver4); checkRemoteOwner(entry.anyOwner(), ver4); entry.removeLock(ver4); assert entry.remoteMvccSnapshot().isEmpty(); assert entry.anyOwner() == null; } | /**
* Tests remote candidates.
*/ | Tests remote candidates | testRemotes | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMvccSelfTest.java",
"license": "apache-2.0",
"size": 60729
} | [
"java.util.Arrays",
"java.util.Collection",
"java.util.Collections",
"java.util.UUID",
"org.apache.ignite.internal.processors.cache.version.GridCacheVersion"
] | import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.UUID; import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; | import java.util.*; import org.apache.ignite.internal.processors.cache.version.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 1,816,941 |
void addNewConnection(GeoServerConnection newConnectionDetails); | void addNewConnection(GeoServerConnection newConnectionDetails); | /**
* Adds the new connection.
*
* @param newConnectionDetails the new connection details
*/ | Adds the new connection | addNewConnection | {
"repo_name": "robward-scisys/sldeditor",
"path": "modules/application/src/main/java/com/sldeditor/datasource/extension/filesystem/GeoServerConnectUpdateInterface.java",
"license": "gpl-3.0",
"size": 1946
} | [
"com.sldeditor.common.data.GeoServerConnection"
] | import com.sldeditor.common.data.GeoServerConnection; | import com.sldeditor.common.data.*; | [
"com.sldeditor.common"
] | com.sldeditor.common; | 1,275,728 |
Token<AMRMTokenIdentifier> getAMRMToken(); | Token<AMRMTokenIdentifier> getAMRMToken(); | /**
* The AMRMToken belonging to this app attempt
* @return The AMRMToken belonging to this app attempt
*/ | The AMRMToken belonging to this app attempt | getAMRMToken | {
"repo_name": "songweijia/fffs",
"path": "sources/hadoop-2.4.1-src/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java",
"license": "apache-2.0",
"size": 7275
} | [
"org.apache.hadoop.security.token.Token",
"org.apache.hadoop.yarn.security.AMRMTokenIdentifier"
] | import org.apache.hadoop.security.token.Token; import org.apache.hadoop.yarn.security.AMRMTokenIdentifier; | import org.apache.hadoop.security.token.*; import org.apache.hadoop.yarn.security.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 2,413,209 |
public final void uninstall(final JTextComponent textComponent) {
uiChangeHandler.uninstall(textComponent);
textComponent.updateUI();
}
private final TextUIChangeHandler uiChangeHandler = new TextUIChangeHandler(); | final void function(final JTextComponent textComponent) { uiChangeHandler.uninstall(textComponent); textComponent.updateUI(); } private final TextUIChangeHandler uiChangeHandler = new TextUIChangeHandler(); | /**
* <p>
* Removes the {@link PropertyChangeListener}, which listens for "UI" property changes (if
* installed) and then calls {@link JComponent#updateUI()} on the <code>textComponent</code> to
* set the UI object provided by the current {@link UIDefaults}.
* </p>
*
* @param textComponent
*/ | Removes the <code>PropertyChangeListener</code>, which listens for "UI" property changes (if installed) and then calls <code>JComponent#updateUI()</code> on the <code>textComponent</code> to set the UI object provided by the current <code>UIDefaults</code>. | uninstall | {
"repo_name": "syncer/swingx",
"path": "swingx-core/src/main/java/org/jdesktop/swingx/plaf/TextUIWrapper.java",
"license": "lgpl-2.1",
"size": 5816
} | [
"javax.swing.text.JTextComponent"
] | import javax.swing.text.JTextComponent; | import javax.swing.text.*; | [
"javax.swing"
] | javax.swing; | 959,510 |
public String invoke(JspFragment fragment)
throws JspException, IOException
{
if (fragment == null)
return "";
BodyContentImpl body = (BodyContentImpl) pushBody();
try {
fragment.invoke(body);
return body.getString();
} finally {
popBody();
body.release();
}
} | String function(JspFragment fragment) throws JspException, IOException { if (fragment == null) return ""; BodyContentImpl body = (BodyContentImpl) pushBody(); try { fragment.invoke(body); return body.getString(); } finally { popBody(); body.release(); } } | /**
* Evaluates the fragment, returing the string value.
*/ | Evaluates the fragment, returing the string value | invoke | {
"repo_name": "mdaniel/svn-caucho-com-resin",
"path": "modules/resin/src/com/caucho/jsp/PageContextImpl.java",
"license": "gpl-2.0",
"size": 53772
} | [
"java.io.IOException",
"javax.servlet.jsp.JspException",
"javax.servlet.jsp.tagext.JspFragment"
] | import java.io.IOException; import javax.servlet.jsp.JspException; import javax.servlet.jsp.tagext.JspFragment; | import java.io.*; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 2,164,264 |
private static void writeWordList(final WordList wl, final PrintWriter writer) {
writer.println();
wl.printWordType(writer, ExpressionType.VERB);
writer.println();
wl.printWordType(writer, ExpressionType.OBJECT);
writer.println();
wl.printWordType(writer, ExpressionType.SUBJECT);
writer.println();
wl.printWordType(writer, ExpressionType.ADJECTIVE);
writer.println();
wl.printWordType(writer, ExpressionType.NUMERAL);
writer.println();
wl.printWordType(writer, ExpressionType.PREPOSITION);
writer.println();
wl.printWordType(writer, ExpressionType.QUESTION);
writer.println();
wl.printWordType(writer, ExpressionType.IGNORE);
writer.println();
wl.printWordType(writer, null);
} | static void function(final WordList wl, final PrintWriter writer) { writer.println(); wl.printWordType(writer, ExpressionType.VERB); writer.println(); wl.printWordType(writer, ExpressionType.OBJECT); writer.println(); wl.printWordType(writer, ExpressionType.SUBJECT); writer.println(); wl.printWordType(writer, ExpressionType.ADJECTIVE); writer.println(); wl.printWordType(writer, ExpressionType.NUMERAL); writer.println(); wl.printWordType(writer, ExpressionType.PREPOSITION); writer.println(); wl.printWordType(writer, ExpressionType.QUESTION); writer.println(); wl.printWordType(writer, ExpressionType.IGNORE); writer.println(); wl.printWordType(writer, null); } | /**
* Print all words sorted by known types.
*
* @param wl
* word list
* @param writer
*/ | Print all words sorted by known types | writeWordList | {
"repo_name": "AntumDeluge/arianne-stendhal",
"path": "src/games/stendhal/tools/npcparser/WordListUpdate.java",
"license": "gpl-2.0",
"size": 4601
} | [
"games.stendhal.common.parser.ExpressionType",
"games.stendhal.common.parser.WordList",
"java.io.PrintWriter"
] | import games.stendhal.common.parser.ExpressionType; import games.stendhal.common.parser.WordList; import java.io.PrintWriter; | import games.stendhal.common.parser.*; import java.io.*; | [
"games.stendhal.common",
"java.io"
] | games.stendhal.common; java.io; | 1,393,963 |
@SuppressWarnings("checkstyle:magicnumber")
static void findsFarthestPointSegmentPoint(int ax, int ay, int bx, int by, int px, int py, Point2D<?, ?> result) {
assert result != null : AssertMessages.notNullParameter(6);
final int v1x = px - ax;
final int v1y = py - ay;
final int v2x = px - bx;
final int v2y = py - by;
if ((v1x * v1x + v1y * v1y) >= (v2x * v2x + v2y * v2y)) {
result.set(ax, ay);
} else {
result.set(bx, by);
}
}
/**
* Replies on which side of a line the given point is located.
*
* <p>A return value of 1 indicates that the line segment must turn in the direction
* that takes the positive X axis towards the negative Y axis. In the default
* coordinate system used by Java 2D, this direction is counterclockwise.
*
* <p>A return value of -1 indicates that the line segment must turn in the direction that takes the
* positive X axis towards the positive Y axis. In the default coordinate system by Java 2D, this direction is clockwise.
*
* <p>A return value of 0 indicates that the point lies exactly on the line segment.
*
* @param x1
* the X coordinate of the start point of the specified line segment
* @param y1
* the Y coordinate of the start point of the specified line segment
* @param x2
* the X coordinate of the end point of the specified line segment
* @param y2
* the Y coordinate of the end point of the specified line segment
* @param px
* the X coordinate of the specified point to be compared with the specified line segment
* @param py
* the Y coordinate of the specified point to be compared with the specified line segment
* @return an integer that indicates the position of the third specified coordinates with respect to
* the line segment formed by the first two specified coordinates.
* @see MathUtil#isEpsilonZero(double)
* @deprecated since 13.0, see {@link #findsSideLinePoint(int, int, int, int, int, int)} | @SuppressWarnings(STR) static void findsFarthestPointSegmentPoint(int ax, int ay, int bx, int by, int px, int py, Point2D<?, ?> result) { assert result != null : AssertMessages.notNullParameter(6); final int v1x = px - ax; final int v1y = py - ay; final int v2x = px - bx; final int v2y = py - by; if ((v1x * v1x + v1y * v1y) >= (v2x * v2x + v2y * v2y)) { result.set(ax, ay); } else { result.set(bx, by); } } /** * Replies on which side of a line the given point is located. * * <p>A return value of 1 indicates that the line segment must turn in the direction * that takes the positive X axis towards the negative Y axis. In the default * coordinate system used by Java 2D, this direction is counterclockwise. * * <p>A return value of -1 indicates that the line segment must turn in the direction that takes the * positive X axis towards the positive Y axis. In the default coordinate system by Java 2D, this direction is clockwise. * * <p>A return value of 0 indicates that the point lies exactly on the line segment. * * @param x1 * the X coordinate of the start point of the specified line segment * @param y1 * the Y coordinate of the start point of the specified line segment * @param x2 * the X coordinate of the end point of the specified line segment * @param y2 * the Y coordinate of the end point of the specified line segment * @param px * the X coordinate of the specified point to be compared with the specified line segment * @param py * the Y coordinate of the specified point to be compared with the specified line segment * @return an integer that indicates the position of the third specified coordinates with respect to * the line segment formed by the first two specified coordinates. * @see MathUtil#isEpsilonZero(double) * @deprecated since 13.0, see {@link #findsSideLinePoint(int, int, int, int, int, int)} | /** Replies the farthest point on a segment to a point.
*
* @param ax is the x-coordinate of the first point of the segment
* @param ay is the y-coordinate of the first point of the segment
* @param bx is the x-coordinate of the second point of the segment
* @param by is the y-coordinate of the second point of the segment
* @param px is the x-coordinate of the point
* @param py is the x-coordinate of the point
* @param result the farthest point in the segment to the point.
*/ | Replies the farthest point on a segment to a point | findsFarthestPointSegmentPoint | {
"repo_name": "tpiotrow/afc",
"path": "core/math/src/main/java/org/arakhne/afc/math/geometry/d2/ai/Segment2ai.java",
"license": "apache-2.0",
"size": 94668
} | [
"org.arakhne.afc.math.MathUtil",
"org.arakhne.afc.math.geometry.d2.Point2D",
"org.arakhne.afc.vmutil.asserts.AssertMessages"
] | import org.arakhne.afc.math.MathUtil; import org.arakhne.afc.math.geometry.d2.Point2D; import org.arakhne.afc.vmutil.asserts.AssertMessages; | import org.arakhne.afc.math.*; import org.arakhne.afc.math.geometry.d2.*; import org.arakhne.afc.vmutil.asserts.*; | [
"org.arakhne.afc"
] | org.arakhne.afc; | 810,896 |
public void checkLockFile() throws Exception
{
Info installationInfo = installdata.getInfo();
if (installationInfo.isSingleInstance() && !Boolean.getBoolean("MULTIINSTANCE"))
{
String appName = installdata.getInfo().getAppName();
File file = FileUtil.getLockFile(appName);
if (file.exists())
{
// Ask user if they want to proceed.
logger.fine("Lock File Exists, asking user for permission to proceed.");
StringBuilder msg = new StringBuilder();
msg.append("<html>");
msg.append("The ").append(appName).append(
" installer you are attempting to run seems to have a copy already running.<br><br>");
msg.append(
"This could be from a previous failed installation attempt or you may have accidentally launched <br>");
msg.append(
"the installer twice. <b>The recommended action is to select 'Exit'</b> and wait for the other copy of <br>");
msg.append(
"the installer to start. If you are sure there is no other copy of the installer running, click <br>");
msg.append("the 'Continue' button to allow this installer to run. <br><br>");
msg.append("Are you sure you want to continue with this installation?");
msg.append("</html>");
JLabel label = new JLabel(msg.toString());
label.setFont(new Font("Sans Serif", Font.PLAIN, 12));
Object[] optionValues = {"Continue", "Exit"};
int selectedOption = JOptionPane.showOptionDialog(null, label, "Warning",
JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE,
null, optionValues,
optionValues[1]);
logger.fine("Selected option: " + selectedOption);
if (selectedOption == 0)
{
// Take control of the file so it gets deleted after this installer instance exits.
logger.fine("Setting temporary file to delete on exit");
file.deleteOnExit();
}
else
{
// Leave the file as it is.
logger.fine("Leaving temporary file alone and exiting");
System.exit(1);
}
}
else
{
try
{
// Create the new lock file
if (file.createNewFile())
{
logger.fine("Temporary file created");
file.deleteOnExit();
}
else
{
logger.warning("Temporary file could not be created");
logger.warning("*** Multiple instances of installer will be allowed ***");
}
}
catch (Exception e)
{
logger.log(Level.WARNING, "Temporary file could not be created: " + e.getMessage(), e);
logger.warning("*** Multiple instances of installer will be allowed ***");
}
}
}
} | void function() throws Exception { Info installationInfo = installdata.getInfo(); if (installationInfo.isSingleInstance() && !Boolean.getBoolean(STR)) { String appName = installdata.getInfo().getAppName(); File file = FileUtil.getLockFile(appName); if (file.exists()) { logger.fine(STR); StringBuilder msg = new StringBuilder(); msg.append(STR); msg.append(STR).append(appName).append( STR); msg.append( STR); msg.append( STR); msg.append( STR); msg.append(STR); msg.append(STR); msg.append(STR); JLabel label = new JLabel(msg.toString()); label.setFont(new Font(STR, Font.PLAIN, 12)); Object[] optionValues = {STR, "Exit"}; int selectedOption = JOptionPane.showOptionDialog(null, label, STR, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, optionValues, optionValues[1]); logger.fine(STR + selectedOption); if (selectedOption == 0) { logger.fine(STR); file.deleteOnExit(); } else { logger.fine(STR); System.exit(1); } } else { try { if (file.createNewFile()) { logger.fine(STR); file.deleteOnExit(); } else { logger.warning(STR); logger.warning(STR); } } catch (Exception e) { logger.log(Level.WARNING, STR + e.getMessage(), e); logger.warning(STR); } } } } | /**
* Sets a lock file. Not using java.nio.channels.FileLock to prevent
* the installer from accidentally keeping a lock on a file if the install
* fails or is killed.
*
* @throws Exception Description of the Exception
*/ | Sets a lock file. Not using java.nio.channels.FileLock to prevent the installer from accidentally keeping a lock on a file if the install fails or is killed | checkLockFile | {
"repo_name": "mtjandra/izpack",
"path": "izpack-installer/src/main/java/com/izforge/izpack/installer/language/ConditionCheck.java",
"license": "apache-2.0",
"size": 9155
} | [
"com.izforge.izpack.api.data.Info",
"com.izforge.izpack.util.FileUtil",
"java.awt.Font",
"java.io.File",
"java.util.logging.Level",
"javax.swing.JLabel",
"javax.swing.JOptionPane"
] | import com.izforge.izpack.api.data.Info; import com.izforge.izpack.util.FileUtil; import java.awt.Font; import java.io.File; import java.util.logging.Level; import javax.swing.JLabel; import javax.swing.JOptionPane; | import com.izforge.izpack.api.data.*; import com.izforge.izpack.util.*; import java.awt.*; import java.io.*; import java.util.logging.*; import javax.swing.*; | [
"com.izforge.izpack",
"java.awt",
"java.io",
"java.util",
"javax.swing"
] | com.izforge.izpack; java.awt; java.io; java.util; javax.swing; | 1,789,259 |
public static Test suite() {
return new TestSuite(StringSplitTest.class);
} | static Test function() { return new TestSuite(StringSplitTest.class); } | /**
* Returns a test suite.
*
* @return the test suite
*/ | Returns a test suite | suite | {
"repo_name": "waikato-datamining/adams-base",
"path": "adams-core/src/test/java/adams/flow/transformer/StringSplitTest.java",
"license": "gpl-3.0",
"size": 3184
} | [
"junit.framework.Test",
"junit.framework.TestSuite"
] | import junit.framework.Test; import junit.framework.TestSuite; | import junit.framework.*; | [
"junit.framework"
] | junit.framework; | 423,553 |
public static List<RelCollation> mergeJoin(RelMetadataQuery mq,
RelNode left, RelNode right,
ImmutableIntList leftKeys, ImmutableIntList rightKeys) {
final ImmutableList.Builder<RelCollation> builder = ImmutableList.builder();
final ImmutableList<RelCollation> leftCollations = mq.collations(left);
assert RelCollations.contains(leftCollations, leftKeys)
: "cannot merge join: left input is not sorted on left keys";
builder.addAll(leftCollations);
final ImmutableList<RelCollation> rightCollations = mq.collations(right);
assert RelCollations.contains(rightCollations, rightKeys)
: "cannot merge join: right input is not sorted on right keys";
final int leftFieldCount = left.getRowType().getFieldCount();
for (RelCollation collation : rightCollations) {
builder.add(RelCollations.shift(collation, leftFieldCount));
}
return builder.build();
} | static List<RelCollation> function(RelMetadataQuery mq, RelNode left, RelNode right, ImmutableIntList leftKeys, ImmutableIntList rightKeys) { final ImmutableList.Builder<RelCollation> builder = ImmutableList.builder(); final ImmutableList<RelCollation> leftCollations = mq.collations(left); assert RelCollations.contains(leftCollations, leftKeys) : STR; builder.addAll(leftCollations); final ImmutableList<RelCollation> rightCollations = mq.collations(right); assert RelCollations.contains(rightCollations, rightKeys) : STR; final int leftFieldCount = left.getRowType().getFieldCount(); for (RelCollation collation : rightCollations) { builder.add(RelCollations.shift(collation, leftFieldCount)); } return builder.build(); } | /** Helper method to determine a {@link Join}'s collation assuming that it
* uses a merge-join algorithm.
*
* <p>If the inputs are sorted on other keys <em>in addition to</em> the join
* key, the result preserves those collations too. */ | Helper method to determine a <code>Join</code>'s collation assuming that it uses a merge-join algorithm. If the inputs are sorted on other keys in addition to the join | mergeJoin | {
"repo_name": "xhoong/incubator-calcite",
"path": "core/src/main/java/org/apache/calcite/rel/metadata/RelMdCollation.java",
"license": "apache-2.0",
"size": 19651
} | [
"com.google.common.collect.ImmutableList",
"java.util.List",
"org.apache.calcite.rel.RelCollation",
"org.apache.calcite.rel.RelCollations",
"org.apache.calcite.rel.RelNode",
"org.apache.calcite.util.ImmutableIntList"
] | import com.google.common.collect.ImmutableList; import java.util.List; import org.apache.calcite.rel.RelCollation; import org.apache.calcite.rel.RelCollations; import org.apache.calcite.rel.RelNode; import org.apache.calcite.util.ImmutableIntList; | import com.google.common.collect.*; import java.util.*; import org.apache.calcite.rel.*; import org.apache.calcite.util.*; | [
"com.google.common",
"java.util",
"org.apache.calcite"
] | com.google.common; java.util; org.apache.calcite; | 986,199 |
private void loadUserFilter(IMemento child) {
MarkerFieldFilterGroup newGroup = new MarkerFieldFilterGroup(null, this);
newGroup.loadSettings(child);
getAllFilters().add(newGroup);
} | void function(IMemento child) { MarkerFieldFilterGroup newGroup = new MarkerFieldFilterGroup(null, this); newGroup.loadSettings(child); getAllFilters().add(newGroup); } | /**
* Load the user supplied filter
*
* @param child
*/ | Load the user supplied filter | loadUserFilter | {
"repo_name": "elucash/eclipse-oxygen",
"path": "org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/MarkerContentGenerator.java",
"license": "epl-1.0",
"size": 32099
} | [
"org.eclipse.ui.IMemento"
] | import org.eclipse.ui.IMemento; | import org.eclipse.ui.*; | [
"org.eclipse.ui"
] | org.eclipse.ui; | 357,429 |
@VisibleForTesting
static Level getLogLevel(Throwable t) {
if (t.getClass().equals(IOException.class)) {
return Level.FINE;
}
return Level.INFO;
} | static Level getLogLevel(Throwable t) { if (t.getClass().equals(IOException.class)) { return Level.FINE; } return Level.INFO; } | /**
* Accepts a throwable and returns the appropriate logging level. Uninteresting exceptions
* should not clutter the log.
*/ | Accepts a throwable and returns the appropriate logging level. Uninteresting exceptions should not clutter the log | getLogLevel | {
"repo_name": "dapengzhang0/grpc-java",
"path": "okhttp/src/main/java/io/grpc/okhttp/ExceptionHandlingFrameWriter.java",
"license": "apache-2.0",
"size": 7250
} | [
"java.io.IOException",
"java.util.logging.Level"
] | import java.io.IOException; import java.util.logging.Level; | import java.io.*; import java.util.logging.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,982,266 |
@Test
public void testConventionFromUnderlyingSecurityForOisLeg() {
final InMemoryConventionSource conventionSource = new InMemoryConventionSource();
// note that the convention refers to the security
final OISLegConvention oisLegConvention = new OISLegConvention("USD OIS Leg", OIS_LEG_CONVENTION_ID.toBundle(),
OVERNIGHT_SECURITY_ID, Tenor.ONE_YEAR, BusinessDayConventions.MODIFIED_FOLLOWING, 2, false, StubType.NONE, false, 0);
conventionSource.addConvention(FIXED_LEG_CONVENTION.clone());
conventionSource.addConvention(oisLegConvention);
conventionSource.addConvention(OVERNIGHT_CONVENTION.clone());
final InMemorySecuritySource securitySource = new InMemorySecuritySource();
securitySource.addSecurity(OVERNIGHT_SECURITY.clone());
final SwapNode node = new SwapNode(Tenor.ONE_YEAR, Tenor.TEN_YEARS, FIXED_LEG_CONVENTION_ID, OIS_LEG_CONVENTION_ID, CNIM_NAME);
assertEquals(node.accept(new CurveNodeCurrencyVisitor(conventionSource, securitySource)), Sets.newHashSet(Currency.USD, Currency.EUR));
} | void function() { final InMemoryConventionSource conventionSource = new InMemoryConventionSource(); final OISLegConvention oisLegConvention = new OISLegConvention(STR, OIS_LEG_CONVENTION_ID.toBundle(), OVERNIGHT_SECURITY_ID, Tenor.ONE_YEAR, BusinessDayConventions.MODIFIED_FOLLOWING, 2, false, StubType.NONE, false, 0); conventionSource.addConvention(FIXED_LEG_CONVENTION.clone()); conventionSource.addConvention(oisLegConvention); conventionSource.addConvention(OVERNIGHT_CONVENTION.clone()); final InMemorySecuritySource securitySource = new InMemorySecuritySource(); securitySource.addSecurity(OVERNIGHT_SECURITY.clone()); final SwapNode node = new SwapNode(Tenor.ONE_YEAR, Tenor.TEN_YEARS, FIXED_LEG_CONVENTION_ID, OIS_LEG_CONVENTION_ID, CNIM_NAME); assertEquals(node.accept(new CurveNodeCurrencyVisitor(conventionSource, securitySource)), Sets.newHashSet(Currency.USD, Currency.EUR)); } | /**
* Tests that all currencies are returned if the convention from the underlying security is available.
*/ | Tests that all currencies are returned if the convention from the underlying security is available | testConventionFromUnderlyingSecurityForOisLeg | {
"repo_name": "McLeodMoores/starling",
"path": "projects/financial/src/test/java/com/opengamma/financial/analytics/curve/SwapNodeCurrencyVisitorTest.java",
"license": "apache-2.0",
"size": 27347
} | [
"com.google.common.collect.Sets",
"com.opengamma.engine.InMemoryConventionSource",
"com.opengamma.engine.InMemorySecuritySource",
"com.opengamma.financial.analytics.ircurve.strips.SwapNode",
"com.opengamma.financial.convention.OISLegConvention",
"com.opengamma.financial.convention.StubType",
"com.openga... | import com.google.common.collect.Sets; import com.opengamma.engine.InMemoryConventionSource; import com.opengamma.engine.InMemorySecuritySource; import com.opengamma.financial.analytics.ircurve.strips.SwapNode; import com.opengamma.financial.convention.OISLegConvention; import com.opengamma.financial.convention.StubType; import com.opengamma.financial.convention.businessday.BusinessDayConventions; import com.opengamma.util.money.Currency; import com.opengamma.util.time.Tenor; import org.testng.Assert; | import com.google.common.collect.*; import com.opengamma.engine.*; import com.opengamma.financial.analytics.ircurve.strips.*; import com.opengamma.financial.convention.*; import com.opengamma.financial.convention.businessday.*; import com.opengamma.util.money.*; import com.opengamma.util.time.*; import org.testng.*; | [
"com.google.common",
"com.opengamma.engine",
"com.opengamma.financial",
"com.opengamma.util",
"org.testng"
] | com.google.common; com.opengamma.engine; com.opengamma.financial; com.opengamma.util; org.testng; | 1,724,909 |
public long queryBookmark(Channel channel, Date recStartTs) throws IOException; | long function(Channel channel, Date recStartTs) throws IOException; | /**
* Retrieve the bookmark set on a recording.
*
* @param channel
* the channel on which the program was recorded
* @param recStartTs
* the actual (not scheduled) start time of the recording
* @return the bookmark location in number of frames or <code>0</code if
* there is no bookmark
* @throws IOException
* if there is a communication or protocol error
*
* @since 63
*/ | Retrieve the bookmark set on a recording | queryBookmark | {
"repo_name": "syphr42/libmythtv-java",
"path": "protocol/src/main/java/org/syphr/mythtv/protocol/Protocol.java",
"license": "apache-2.0",
"size": 50355
} | [
"java.io.IOException",
"java.util.Date",
"org.syphr.mythtv.data.Channel"
] | import java.io.IOException; import java.util.Date; import org.syphr.mythtv.data.Channel; | import java.io.*; import java.util.*; import org.syphr.mythtv.data.*; | [
"java.io",
"java.util",
"org.syphr.mythtv"
] | java.io; java.util; org.syphr.mythtv; | 112,680 |
private TransMemoryResultItem createOrGetResultItem(
Map<TMKey, TransMemoryResultItem> matchesMap, Object[] match,
TransMemoryResultItem.MatchType matchType,
ArrayList<String> sourceContents, ArrayList<String> targetContents,
double percent) {
TMKey key = new TMKey(sourceContents, targetContents);
TransMemoryResultItem item = matchesMap.get(key);
if (item == null) {
float score = (Float) match[0];
item =
new TransMemoryResultItem(sourceContents, targetContents,
matchType, score, percent);
matchesMap.put(key, item);
}
return item;
} | TransMemoryResultItem function( Map<TMKey, TransMemoryResultItem> matchesMap, Object[] match, TransMemoryResultItem.MatchType matchType, ArrayList<String> sourceContents, ArrayList<String> targetContents, double percent) { TMKey key = new TMKey(sourceContents, targetContents); TransMemoryResultItem item = matchesMap.get(key); if (item == null) { float score = (Float) match[0]; item = new TransMemoryResultItem(sourceContents, targetContents, matchType, score, percent); matchesMap.put(key, item); } return item; } | /**
* Look up the result item for the given source and target contents.
*
* If no item is found, a new one is added to the map and returned.
*
* @return the item for the given source and target contents, which may be newly created.
*/ | Look up the result item for the given source and target contents. If no item is found, a new one is added to the map and returned | createOrGetResultItem | {
"repo_name": "mvehar/zanata-server",
"path": "zanata-war/src/main/java/org/zanata/service/impl/TranslationMemoryServiceImpl.java",
"license": "gpl-2.0",
"size": 47817
} | [
"java.util.ArrayList",
"java.util.Map",
"org.zanata.webtrans.shared.model.TransMemoryResultItem"
] | import java.util.ArrayList; import java.util.Map; import org.zanata.webtrans.shared.model.TransMemoryResultItem; | import java.util.*; import org.zanata.webtrans.shared.model.*; | [
"java.util",
"org.zanata.webtrans"
] | java.util; org.zanata.webtrans; | 1,435,160 |
public final int setSocketTimeout(int tmo)
throws InvalidConfigurationException {
// Inform listeners, validate the configuration change
int sts = fireConfigurationChange(ConfigId.SMBSocketTimeout, new Integer(tmo));
m_clientSocketTimeout = tmo;
// Return the change status
return sts;
} | final int function(int tmo) throws InvalidConfigurationException { int sts = fireConfigurationChange(ConfigId.SMBSocketTimeout, new Integer(tmo)); m_clientSocketTimeout = tmo; return sts; } | /**
* et the client socket timeout, in milliseconds
*
* @param tmo int
* @return int
* @exception InvalidConfigurationException
*/ | et the client socket timeout, in milliseconds | setSocketTimeout | {
"repo_name": "arcusys/Liferay-CIFS",
"path": "source/java/org/alfresco/jlan/smb/server/CIFSConfigSection.java",
"license": "gpl-3.0",
"size": 34821
} | [
"org.alfresco.jlan.server.config.ConfigId",
"org.alfresco.jlan.server.config.InvalidConfigurationException"
] | import org.alfresco.jlan.server.config.ConfigId; import org.alfresco.jlan.server.config.InvalidConfigurationException; | import org.alfresco.jlan.server.config.*; | [
"org.alfresco.jlan"
] | org.alfresco.jlan; | 1,365,388 |
public static InputStream newBZFileInputStream(String file, boolean useGzip, boolean useIBuffers, int buffersize)
throws IOException
{
if (useGzip)
{
return new GZIPInputStream(new FileInputStream(file), buffersize);
} else if (useIBuffers)
{
return new BufferedInputStream(new FileInputStream(file), buffersize);
} else
{
return new FileInputStream(file);
}
} | static InputStream function(String file, boolean useGzip, boolean useIBuffers, int buffersize) throws IOException { if (useGzip) { return new GZIPInputStream(new FileInputStream(file), buffersize); } else if (useIBuffers) { return new BufferedInputStream(new FileInputStream(file), buffersize); } else { return new FileInputStream(file); } } | /**
* Constructs a input stream from the file
* @param file
* @param useGzip
* @param useIBuffers
* @param buffersize
* @return
* @throws IOException
* SZ Feb 20, 2009: FileNotFoundException removed
*/ | Constructs a input stream from the file | newBZFileInputStream | {
"repo_name": "lemmy/tlaplus",
"path": "tlatools/org.lamport.tlatools/src/util/FileUtil.java",
"license": "mit",
"size": 17256
} | [
"java.io.BufferedInputStream",
"java.io.FileInputStream",
"java.io.IOException",
"java.io.InputStream",
"java.util.zip.GZIPInputStream"
] | import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.zip.GZIPInputStream; | import java.io.*; import java.util.zip.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 803,528 |
public ArrayList<ReleaseDefinitionRevision> getReleaseDefinitionHistory(
final UUID project,
final int definitionId) {
final UUID locationId = UUID.fromString("258b82e0-9d41-43f3-86d6-fef14ddd44bc"); //$NON-NLS-1$
final ApiResourceVersion apiVersion = new ApiResourceVersion("3.1-preview.1"); //$NON-NLS-1$
final Map<String, Object> routeValues = new HashMap<String, Object>();
routeValues.put("project", project); //$NON-NLS-1$
routeValues.put("definitionId", definitionId); //$NON-NLS-1$
final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET,
locationId,
routeValues,
apiVersion,
VssMediaTypes.APPLICATION_JSON_TYPE);
return super.sendRequest(httpRequest, new TypeReference<ArrayList<ReleaseDefinitionRevision>>() {});
} | ArrayList<ReleaseDefinitionRevision> function( final UUID project, final int definitionId) { final UUID locationId = UUID.fromString(STR); final ApiResourceVersion apiVersion = new ApiResourceVersion(STR); final Map<String, Object> routeValues = new HashMap<String, Object>(); routeValues.put(STR, project); routeValues.put(STR, definitionId); final VssRestRequest httpRequest = super.createRequest(HttpMethod.GET, locationId, routeValues, apiVersion, VssMediaTypes.APPLICATION_JSON_TYPE); return super.sendRequest(httpRequest, new TypeReference<ArrayList<ReleaseDefinitionRevision>>() {}); } | /**
* [Preview API 3.1-preview.1]
*
* @param project
* Project ID
* @param definitionId
*
* @return ArrayList<ReleaseDefinitionRevision>
*/ | [Preview API 3.1-preview.1] | getReleaseDefinitionHistory | {
"repo_name": "Microsoft/vso-httpclient-java",
"path": "Rest/alm-releasemanagement-client/src/main/generated/com/microsoft/alm/visualstudio/services/releasemanagement/webapi/ReleaseHttpClientBase.java",
"license": "mit",
"size": 186198
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"com.microsoft.alm.client.HttpMethod",
"com.microsoft.alm.client.VssMediaTypes",
"com.microsoft.alm.client.VssRestRequest",
"com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.ReleaseDefinitionRevision",
"com.microsoft.alm.visualstud... | import com.fasterxml.jackson.core.type.TypeReference; import com.microsoft.alm.client.HttpMethod; import com.microsoft.alm.client.VssMediaTypes; import com.microsoft.alm.client.VssRestRequest; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.ReleaseDefinitionRevision; import com.microsoft.alm.visualstudio.services.webapi.ApiResourceVersion; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import java.util.UUID; | import com.fasterxml.jackson.core.type.*; import com.microsoft.alm.client.*; import com.microsoft.alm.visualstudio.services.releasemanagement.webapi.contracts.*; import com.microsoft.alm.visualstudio.services.webapi.*; import java.util.*; | [
"com.fasterxml.jackson",
"com.microsoft.alm",
"java.util"
] | com.fasterxml.jackson; com.microsoft.alm; java.util; | 321,890 |
public void setDebugDraw(DebugDraw debugDraw) {
m_debugDraw = debugDraw;
} | void function(DebugDraw debugDraw) { m_debugDraw = debugDraw; } | /**
* Register a routine for debug drawing. The debug draw functions are called inside with
* World.DrawDebugData method. The debug draw object is owned by you and must remain in scope.
*
* @param debugDraw
*/ | Register a routine for debug drawing. The debug draw functions are called inside with World.DrawDebugData method. The debug draw object is owned by you and must remain in scope | setDebugDraw | {
"repo_name": "RedTriplane/RedTriplane",
"path": "r3-box2d-jf/src/org/jbox2d/f/dynamics/World.java",
"license": "unlicense",
"size": 61246
} | [
"org.jbox2d.f.callbacks.DebugDraw"
] | import org.jbox2d.f.callbacks.DebugDraw; | import org.jbox2d.f.callbacks.*; | [
"org.jbox2d.f"
] | org.jbox2d.f; | 1,754,980 |
public void mouseReleased(MouseEvent e) {} | public void mouseReleased(MouseEvent e) {} | /**
* Required by {@link MouseMotionListener} I/F but not actually needed in
* our case, no op implementation.
* @see MouseMotionListener#mouseMoved(MouseEvent)
*/ | Required by <code>MouseMotionListener</code> I/F but not actually needed in our case, no op implementation | mouseMoved | {
"repo_name": "simleo/openmicroscopy",
"path": "components/insight/SRC/org/openmicroscopy/shoola/util/ui/tdialog/BorderListener.java",
"license": "gpl-2.0",
"size": 5885
} | [
"java.awt.event.MouseEvent"
] | import java.awt.event.MouseEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 2,663,596 |
@Override
public String getFlushPolicyClassName() {
return getOrDefault(FLUSH_POLICY_KEY, Function.identity(), null);
} | String function() { return getOrDefault(FLUSH_POLICY_KEY, Function.identity(), null); } | /**
* This gets the class associated with the flush policy which determines the
* stores need to be flushed when flushing a region. The class used by
* default is defined in org.apache.hadoop.hbase.regionserver.FlushPolicy.
*
* @return the class name of the flush policy for this table. If this
* returns null, the default flush policy is used.
*/ | This gets the class associated with the flush policy which determines the stores need to be flushed when flushing a region. The class used by default is defined in org.apache.hadoop.hbase.regionserver.FlushPolicy | getFlushPolicyClassName | {
"repo_name": "ChinmaySKulkarni/hbase",
"path": "hbase-client/src/main/java/org/apache/hadoop/hbase/client/TableDescriptorBuilder.java",
"license": "apache-2.0",
"size": 56865
} | [
"java.util.function.Function"
] | import java.util.function.Function; | import java.util.function.*; | [
"java.util"
] | java.util; | 142,226 |
public int getStatementType() throws SQLException; | int function() throws SQLException; | /**
* Get the type of statement, one of the
* {@link com.pivotal.gemfirexd.internal.iapi.sql.StatementType}s
*/ | Get the type of statement, one of the <code>com.pivotal.gemfirexd.internal.iapi.sql.StatementType</code>s | getStatementType | {
"repo_name": "SnappyDataInc/snappy-store",
"path": "gemfirexd/core/src/main/java/com/pivotal/gemfirexd/internal/iapi/jdbc/EnginePreparedStatement.java",
"license": "apache-2.0",
"size": 2080
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,061,910 |
public int getTargetActions() {
return targetActions;
}
private static final int JDK_1_3_MODIFIERS = InputEvent.SHIFT_DOWN_MASK - 1;
private static final int JDK_1_4_MODIFIERS =
((InputEvent.ALT_GRAPH_DOWN_MASK << 1) - 1) & ~JDK_1_3_MODIFIERS; | int function() { return targetActions; } private static final int JDK_1_3_MODIFIERS = InputEvent.SHIFT_DOWN_MASK - 1; private static final int JDK_1_4_MODIFIERS = ((InputEvent.ALT_GRAPH_DOWN_MASK << 1) - 1) & ~JDK_1_3_MODIFIERS; | /**
* This method returns the target drop action.
*
* @return the target drop action.
*/ | This method returns the target drop action | getTargetActions | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/java/awt/dnd/DragSourceDragEvent.java",
"license": "apache-2.0",
"size": 11626
} | [
"java.awt.event.InputEvent"
] | import java.awt.event.InputEvent; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,478,343 |
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
String listenerMessage=(String) request.getServletContext().getAttribute("listenerMessage");
try {
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet WebFragmentMessageRecord</title>");
out.println("</head>");
out.println("<body>");
out.println("<h2>The absolute-ordering of fragments in web.xml is: fragment3,fragment2,fragment1,filter chain responses in this order.</h2>");
out.println("<h3><font color=red>FilterMessage is: </font><br> " + request.getAttribute("filterMessage") + "<BR/><font color=red>The Listener Message is:</font> "+listenerMessage+"</h3>");
out.println("</body>");
out.println("</html>");
} finally {
out.close();
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(STR); PrintWriter out = response.getWriter(); String listenerMessage=(String) request.getServletContext().getAttribute(STR); try { out.println(STR); out.println(STR); out.println(STR); out.println(STR); out.println(STR); out.println(STR); out.println(STR + request.getAttribute(STR) + STR+listenerMessage+"</h3>"); out.println(STR); out.println(STR); } finally { out.close(); } } | /**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods | processRequest | {
"repo_name": "apache/geronimo",
"path": "testsuite/javaee6-testsuite/servlet3.0-test/servlet3.0-test-war/src/main/java/org/apache/geronimo/testsuite/servlet3/app/WebFragmentMessageRecord.java",
"license": "apache-2.0",
"size": 3903
} | [
"java.io.IOException",
"java.io.PrintWriter",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; | import java.io.*; import javax.servlet.*; import javax.servlet.http.*; | [
"java.io",
"javax.servlet"
] | java.io; javax.servlet; | 2,022,758 |
public void start()
{
try {
while(true){
sock = getServSock().accept();
new Thread(new ServerExecutor(this,sock,getOb())).run();
}
} catch (IOException e) {
e.printStackTrace();
}
} | void function() { try { while(true){ sock = getServSock().accept(); new Thread(new ServerExecutor(this,sock,getOb())).run(); } } catch (IOException e) { e.printStackTrace(); } } | /**
* Starts the TCP Server
* @throws JsonRpcException: in case of abnormal execution
*/ | Starts the TCP Server | start | {
"repo_name": "asvishen/jsonrpc-java-lite",
"path": "src/edu/asu/ser/jsonrpc/lite/server/TCPServer.java",
"license": "apache-2.0",
"size": 2186
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 99,599 |
protected void setTestInfo(Description description) {
JUnitTestData testMethod = new JUnitTestData(false, false);
testMethod.setDescription(description);
if (!testMethodsList.contains(description))
testMethodsList.add(testMethod);
}
| void function(Description description) { JUnitTestData testMethod = new JUnitTestData(false, false); testMethod.setDescription(description); if (!testMethodsList.contains(description)) testMethodsList.add(testMethod); } | /**
* Set test info
*
* @param description
*/ | Set test info | setTestInfo | {
"repo_name": "s2oBCN/tap4j",
"path": "tap4j-ext/src/main/java/org/tap4j/ext/junit/listener/TapListener.java",
"license": "mit",
"size": 10318
} | [
"org.junit.runner.Description",
"org.tap4j.ext.junit.model.JUnitTestData"
] | import org.junit.runner.Description; import org.tap4j.ext.junit.model.JUnitTestData; | import org.junit.runner.*; import org.tap4j.ext.junit.model.*; | [
"org.junit.runner",
"org.tap4j.ext"
] | org.junit.runner; org.tap4j.ext; | 443,408 |
public void readPacketData(PacketBuffer buf) throws IOException
{
this.pos = buf.readBlockPos();
this.lines = new IChatComponent[4];
for (int i = 0; i < 4; ++i)
{
String s = buf.readStringFromBuffer(384);
IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s);
this.lines[i] = ichatcomponent;
}
} | void function(PacketBuffer buf) throws IOException { this.pos = buf.readBlockPos(); this.lines = new IChatComponent[4]; for (int i = 0; i < 4; ++i) { String s = buf.readStringFromBuffer(384); IChatComponent ichatcomponent = IChatComponent.Serializer.jsonToComponent(s); this.lines[i] = ichatcomponent; } } | /**
* Reads the raw packet data from the data stream.
*/ | Reads the raw packet data from the data stream | readPacketData | {
"repo_name": "SkidJava/BaseClient",
"path": "new_1.8.8/net/minecraft/network/play/client/C12PacketUpdateSign.java",
"license": "gpl-2.0",
"size": 1908
} | [
"java.io.IOException",
"net.minecraft.network.PacketBuffer",
"net.minecraft.util.IChatComponent"
] | import java.io.IOException; import net.minecraft.network.PacketBuffer; import net.minecraft.util.IChatComponent; | import java.io.*; import net.minecraft.network.*; import net.minecraft.util.*; | [
"java.io",
"net.minecraft.network",
"net.minecraft.util"
] | java.io; net.minecraft.network; net.minecraft.util; | 792,586 |
public synchronized void removeConsumer(ImageConsumer ic) {
ics.removeElement(ic);
} | synchronized void function(ImageConsumer ic) { ics.removeElement(ic); } | /**
* Remove an ImageConsumer from the list of consumers interested in
* data for this image.
*
* @param ic the ImageConsumer to be removed.
*/ | Remove an ImageConsumer from the list of consumers interested in data for this image | removeConsumer | {
"repo_name": "TheTypoMaster/Scaper",
"path": "openjdk/jdk/src/share/classes/java/awt/image/renderable/RenderableImageProducer.java",
"license": "gpl-2.0",
"size": 8315
} | [
"java.awt.image.ImageConsumer"
] | import java.awt.image.ImageConsumer; | import java.awt.image.*; | [
"java.awt"
] | java.awt; | 524,817 |
public static URL extractJarFileURL(URL jarUrl) throws MalformedURLException {
String urlFile = jarUrl.getFile();
int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR);
if (separatorIndex != -1) {
String jarFile = urlFile.substring(0, separatorIndex);
try {
return new URL(jarFile);
} catch (MalformedURLException ex) {
// Probably no protocol in original jar URL, like "jar:C:/mypath/myjar.jar".
// This usually indicates that the jar file resides in the file system.
if (!jarFile.startsWith("/")) {
jarFile = "/" + jarFile;
}
return new URL(FILE_URL_PREFIX + jarFile);
}
} else {
return jarUrl;
}
} | static URL function(URL jarUrl) throws MalformedURLException { String urlFile = jarUrl.getFile(); int separatorIndex = urlFile.indexOf(JAR_URL_SEPARATOR); if (separatorIndex != -1) { String jarFile = urlFile.substring(0, separatorIndex); try { return new URL(jarFile); } catch (MalformedURLException ex) { if (!jarFile.startsWith("/")) { jarFile = "/" + jarFile; } return new URL(FILE_URL_PREFIX + jarFile); } } else { return jarUrl; } } | /**
* Extract the URL for the actual jar file from the given URL
* (which may point to a resource in a jar file or to a jar file itself).
*
* @param jarUrl the original URL
* @return the URL for the actual jar file
* @throws MalformedURLException if no valid jar file URL could be extracted
*/ | Extract the URL for the actual jar file from the given URL (which may point to a resource in a jar file or to a jar file itself) | extractJarFileURL | {
"repo_name": "weisong44/weisong-soa",
"path": "weisong-soa-service-spark/src/main/java/spark/utils/ResourceUtils.java",
"license": "apache-2.0",
"size": 14088
} | [
"java.net.MalformedURLException"
] | import java.net.MalformedURLException; | import java.net.*; | [
"java.net"
] | java.net; | 1,279,708 |
public E argMax() {
double maxCount = Double.NEGATIVE_INFINITY;
E maxKey = null;
for (Map.Entry<E, Double> entry : entries.entrySet()) {
if (entry.getValue() > maxCount || maxKey == null) {
maxKey = entry.getKey();
maxCount = entry.getValue();
}
}
return maxKey;
} | E function() { double maxCount = Double.NEGATIVE_INFINITY; E maxKey = null; for (Map.Entry<E, Double> entry : entries.entrySet()) { if (entry.getValue() > maxCount maxKey == null) { maxKey = entry.getKey(); maxCount = entry.getValue(); } } return maxKey; } | /**
* Finds the key with maximum count. This is a linear operation, and ties are
* broken arbitrarily.
*
* @return a key with minumum count
*/ | Finds the key with maximum count. This is a linear operation, and ties are broken arbitrarily | argMax | {
"repo_name": "jogonzal-msft/UWNLPAssignment2",
"path": "HelloWorld/src/edu/berkeley/nlp/util/Counter.java",
"license": "mit",
"size": 6719
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 312,642 |
public boolean writeToNBTOptional(NBTTagCompound p_70039_1_)
{
return false;
}
public void writeEntityToNBT(NBTTagCompound p_70014_1_) {} | boolean function(NBTTagCompound p_70039_1_) { return false; } public void writeEntityToNBT(NBTTagCompound p_70014_1_) {} | /**
* Either write this entity to the NBT tag given and return true, or return false without doing anything. If this
* returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their
* rider.
*/ | Either write this entity to the NBT tag given and return true, or return false without doing anything. If this returns false the entity is not saved on disk. Ridden entities return false here as they are saved with their rider | writeToNBTOptional | {
"repo_name": "CheeseL0ver/Ore-TTM",
"path": "build/tmp/recompSrc/net/minecraft/entity/EntityLeashKnot.java",
"license": "lgpl-2.1",
"size": 5916
} | [
"net.minecraft.nbt.NBTTagCompound"
] | import net.minecraft.nbt.NBTTagCompound; | import net.minecraft.nbt.*; | [
"net.minecraft.nbt"
] | net.minecraft.nbt; | 2,325,361 |
@Test
public void testToStringASTSum() {
String in = " x + 1";
Expression out = Expression.parse(in);
Expression desired = new Add(new Variable("x"), new Number(1));
assertTrue(out.toStringAST().equals(desired.toStringAST()));
} | void function() { String in = STR; Expression out = Expression.parse(in); Expression desired = new Add(new Variable("x"), new Number(1)); assertTrue(out.toStringAST().equals(desired.toStringAST())); } | /**
* Tests toStringAST of a sum.
*/ | Tests toStringAST of a sum | testToStringASTSum | {
"repo_name": "hcgatewood/main",
"path": "6.005 Expression Final Project/src/test/ExpressionTest.java",
"license": "mit",
"size": 26294
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 2,683,576 |
public synchronized ArrayList getFriendsList() {
ArrayList ris = new ArrayList();
ArrayList friends = new ArrayList();
ris.add("FRIENDS-LIST-REQ");
String userName = datiPersonali.getUserName();
try {
String SQL = "SELECT * FROM `friends` WHERE user1 = '" + userName + "' OR user2 = '" + userName + "';";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(SQL);
while (rs.next()) {
if (rs.getString("user1").equals(userName) && rs.getString("stato").equals("1")) {
friends.add(rs.getString("user2"));
}
if (rs.getString("user2").equals(userName) && rs.getString("stato").equals("1")) {
friends.add(rs.getString("user1"));
}
}
ris.add(friends);
stmt.close();
System.out.println("Ho generato l'array di amici");
} catch (SQLException ex) {
System.out.println("Errore query getFriendsList --> " + ex);
}
return ris;
} | synchronized ArrayList function() { ArrayList ris = new ArrayList(); ArrayList friends = new ArrayList(); ris.add(STR); String userName = datiPersonali.getUserName(); try { String SQL = STR + userName + STR + userName + "';"; Statement stmt = connection.createStatement(); ResultSet rs = stmt.executeQuery(SQL); while (rs.next()) { if (rs.getString("user1").equals(userName) && rs.getString("stato").equals("1")) { friends.add(rs.getString("user2")); } if (rs.getString("user2").equals(userName) && rs.getString("stato").equals("1")) { friends.add(rs.getString("user1")); } } ris.add(friends); stmt.close(); System.out.println(STR); } catch (SQLException ex) { System.out.println(STR + ex); } return ris; } | /**
* Metodo che genera la lista degli amici di un utente
* @return ArrayList amici
*/ | Metodo che genera la lista degli amici di un utente | getFriendsList | {
"repo_name": "mattia98tr/indixis",
"path": "server_0108/src/server/UserHandler.java",
"license": "gpl-3.0",
"size": 27498
} | [
"java.sql.ResultSet",
"java.sql.SQLException",
"java.sql.Statement",
"java.util.ArrayList"
] | import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 1,820,061 |
@Name("nlopt_set_local_search_algorithm")
public static void nloptSetLocalSearchAlgorithm(IntValuedEnum<NloptLibrary.NloptAlgorithm> deriv,
IntValuedEnum<NloptLibrary.NloptAlgorithm> nonderiv, int maxeval) {
nloptSetLocalSearchAlgorithm((int) deriv.value(), (int) nonderiv.value(), maxeval);
} | @Name(STR) static void function(IntValuedEnum<NloptLibrary.NloptAlgorithm> deriv, IntValuedEnum<NloptLibrary.NloptAlgorithm> nonderiv, int maxeval) { nloptSetLocalSearchAlgorithm((int) deriv.value(), (int) nonderiv.value(), maxeval); } | /**
* Original signature :
* <code>void nlopt_set_local_search_algorithm(nlopt_algorithm, nlopt_algorithm, int)</code>
* <br>
* <i>native declaration : line 362</i>
*/ | Original signature : <code>void nlopt_set_local_search_algorithm(nlopt_algorithm, nlopt_algorithm, int)</code> native declaration : line 362 | nloptSetLocalSearchAlgorithm | {
"repo_name": "epsilony/tb",
"path": "src/main/java/net/epsilony/tb/nlopt/NloptLibrary.java",
"license": "gpl-3.0",
"size": 47964
} | [
"org.bridj.IntValuedEnum",
"org.bridj.ann.Name"
] | import org.bridj.IntValuedEnum; import org.bridj.ann.Name; | import org.bridj.*; import org.bridj.ann.*; | [
"org.bridj",
"org.bridj.ann"
] | org.bridj; org.bridj.ann; | 1,717,589 |
@VisibleForTesting
DatanodeInfo[] getPipeLine() {
if (this.getPipeLine != null && this.hdfs_out != null) {
Object repl;
try {
repl = this.getPipeLine.invoke(getOutputStream(), NO_ARGS);
if (repl instanceof DatanodeInfo[]) {
return ((DatanodeInfo[]) repl);
}
} catch (Exception e) {
LOG.info("Get pipeline failed", e);
}
}
return new DatanodeInfo[0];
} | DatanodeInfo[] getPipeLine() { if (this.getPipeLine != null && this.hdfs_out != null) { Object repl; try { repl = this.getPipeLine.invoke(getOutputStream(), NO_ARGS); if (repl instanceof DatanodeInfo[]) { return ((DatanodeInfo[]) repl); } } catch (Exception e) { LOG.info(STR, e); } } return new DatanodeInfo[0]; } | /**
* This method gets the pipeline for the current WAL.
*/ | This method gets the pipeline for the current WAL | getPipeLine | {
"repo_name": "andrewmains12/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/FSHLog.java",
"license": "apache-2.0",
"size": 93797
} | [
"org.apache.hadoop.hdfs.protocol.DatanodeInfo"
] | import org.apache.hadoop.hdfs.protocol.DatanodeInfo; | import org.apache.hadoop.hdfs.protocol.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 910,664 |
@Test
public void testConvertedBool() {
final Object obj = new AutoKeyAndVal<Boolean>() {
@DynamoDBConvertedBool(DynamoDBConvertedBool.Format.Y_N)
public Boolean getVal() { return super.getVal(); } | void function() { final Object obj = new AutoKeyAndVal<Boolean>() { @DynamoDBConvertedBool(DynamoDBConvertedBool.Format.Y_N) public Boolean getVal() { return super.getVal(); } | /**
* Test mappings.
*/ | Test mappings | testConvertedBool | {
"repo_name": "jentfoo/aws-sdk-java",
"path": "aws-java-sdk-dynamodb/src/test/java/com/amazonaws/services/dynamodbv2/datamodeling/StandardModelFactoriesTest.java",
"license": "apache-2.0",
"size": 62787
} | [
"com.amazonaws.services.dynamodbv2.pojos.AutoKeyAndVal"
] | import com.amazonaws.services.dynamodbv2.pojos.AutoKeyAndVal; | import com.amazonaws.services.dynamodbv2.pojos.*; | [
"com.amazonaws.services"
] | com.amazonaws.services; | 2,708,632 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.