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
sequence | imports_info
stringlengths 19
34.8k
| cluster_imports_info
stringlengths 15
3.66k
| libraries
sequence | libraries_info
stringlengths 6
661
| id
int64 0
2.92M
|
---|---|---|---|---|---|---|---|---|---|---|---|
public UserAuthentication createUserAuthentication(Proxy proxy); | UserAuthentication function(Proxy proxy); | /**
* Creates a new Mojang user authentication instance using the given proxy.
* @param proxy Proxy to use.
* @return User authentication instance.
*/ | Creates a new Mojang user authentication instance using the given proxy | createUserAuthentication | {
"repo_name": "Manevolent/EggCrack",
"path": "MinecraftPlugin/src/main/java/net/teamlixo/eggcrack/minecraft/AuthenticationFactory.java",
"license": "gpl-2.0",
"size": 402
} | [
"com.mojang.authlib.UserAuthentication",
"java.net.Proxy"
] | import com.mojang.authlib.UserAuthentication; import java.net.Proxy; | import com.mojang.authlib.*; import java.net.*; | [
"com.mojang.authlib",
"java.net"
] | com.mojang.authlib; java.net; | 887,869 |
public ConstraintBuilder isGreaterThan( Object literalOrSubquery ) {
return is(Operator.GREATER_THAN, literalOrSubquery);
} | ConstraintBuilder function( Object literalOrSubquery ) { return is(Operator.GREATER_THAN, literalOrSubquery); } | /**
* Define the right-hand-side of the constraint to be greater than the supplied literal value.
*
* @param literalOrSubquery the literal value or a subquery
* @return the builder used to create the constraint clause, ready to be used to create other constraints clauses or
* complete already-started clauses; never null
*/ | Define the right-hand-side of the constraint to be greater than the supplied literal value | isGreaterThan | {
"repo_name": "vhalbert/modeshape",
"path": "modeshape-jcr/src/main/java/org/modeshape/jcr/query/QueryBuilder.java",
"license": "apache-2.0",
"size": 126740
} | [
"org.modeshape.jcr.api.query.qom.Operator"
] | import org.modeshape.jcr.api.query.qom.Operator; | import org.modeshape.jcr.api.query.qom.*; | [
"org.modeshape.jcr"
] | org.modeshape.jcr; | 1,939,265 |
public ServiceResponseWithHeaders<Void, LROSADsPost202RetryInvalidHeaderHeaders> beginPost202RetryInvalidHeader() throws CloudException, IOException {
Product product = null;
Call<ResponseBody> call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage());
return beginPost202RetryInvalidHeaderDelegate(call.execute());
} | ServiceResponseWithHeaders<Void, LROSADsPost202RetryInvalidHeaderHeaders> function() throws CloudException, IOException { Product product = null; Call<ResponseBody> call = service.beginPost202RetryInvalidHeader(product, this.client.getAcceptLanguage()); return beginPost202RetryInvalidHeaderDelegate(call.execute()); } | /**
* Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers.
*
* @throws CloudException exception thrown from REST call
* @throws IOException exception thrown from serialization/deserialization
* @return the {@link ServiceResponseWithHeaders} object if successful.
*/ | Long running post request, service returns a 202 to the initial request, with invalid 'Location' and 'Retry-After' headers | beginPost202RetryInvalidHeader | {
"repo_name": "stankovski/AutoRest",
"path": "AutoRest/Generators/Java/Azure.Java.Tests/src/main/java/fixtures/lro/LROSADsOperationsImpl.java",
"license": "mit",
"size": 226665
} | [
"com.microsoft.azure.CloudException",
"com.microsoft.rest.ServiceResponseWithHeaders",
"java.io.IOException"
] | import com.microsoft.azure.CloudException; import com.microsoft.rest.ServiceResponseWithHeaders; import java.io.IOException; | import com.microsoft.azure.*; import com.microsoft.rest.*; import java.io.*; | [
"com.microsoft.azure",
"com.microsoft.rest",
"java.io"
] | com.microsoft.azure; com.microsoft.rest; java.io; | 2,703,305 |
public void testDescendingContainsAll() {
NavigableSet q = populatedSet(SIZE);
NavigableSet p = dset0();
for (int i = 0; i < SIZE; ++i) {
assertTrue(q.containsAll(p));
assertFalse(p.containsAll(q));
p.add(new Integer(i));
}
assertTrue(p.containsAll(q));
} | void function() { NavigableSet q = populatedSet(SIZE); NavigableSet p = dset0(); for (int i = 0; i < SIZE; ++i) { assertTrue(q.containsAll(p)); assertFalse(p.containsAll(q)); p.add(new Integer(i)); } assertTrue(p.containsAll(q)); } | /**
* containsAll(c) is true when c contains a subset of elements
*/ | containsAll(c) is true when c contains a subset of elements | testDescendingContainsAll | {
"repo_name": "md-5/jdk10",
"path": "test/jdk/java/util/concurrent/tck/ConcurrentSkipListSubSetTest.java",
"license": "gpl-2.0",
"size": 32116
} | [
"java.util.NavigableSet"
] | import java.util.NavigableSet; | import java.util.*; | [
"java.util"
] | java.util; | 2,065,734 |
private AssignmentSubmission getSubmission(String assignmentRef, String group_id, String callingFunctionName, SessionState state)
{
AssignmentSubmission rv = null;
try
{
rv = AssignmentService.getSubmission(assignmentRef, group_id);
}
catch (IdUnusedException e)
{
M_log.warn(this + ":build_student_view_submission " + e.getMessage() + " " + assignmentRef + " " + group_id);
if (state != null)
addAlert(state, rb.getFormattedMessage("cannotfin_submission_1", new Object[]{assignmentRef, group_id}));
}
catch (PermissionException e)
{
M_log.warn(this + ":" + callingFunctionName + " " + e.getMessage() + " " + assignmentRef + " " + group_id);
if (state != null)
addAlert(state, rb.getFormattedMessage("youarenot_viewSubmission_1", new Object[]{assignmentRef, group_id}));
}
return rv;
} | AssignmentSubmission function(String assignmentRef, String group_id, String callingFunctionName, SessionState state) { AssignmentSubmission rv = null; try { rv = AssignmentService.getSubmission(assignmentRef, group_id); } catch (IdUnusedException e) { M_log.warn(this + STR + e.getMessage() + " " + assignmentRef + " " + group_id); if (state != null) addAlert(state, rb.getFormattedMessage(STR, new Object[]{assignmentRef, group_id})); } catch (PermissionException e) { M_log.warn(this + ":" + callingFunctionName + " " + e.getMessage() + " " + assignmentRef + " " + group_id); if (state != null) addAlert(state, rb.getFormattedMessage(STR, new Object[]{assignmentRef, group_id})); } return rv; } | /**
* local function for getting assignment submission object for a group id (or is that submitter id instead of group id)
*/ | local function for getting assignment submission object for a group id (or is that submitter id instead of group id) | getSubmission | {
"repo_name": "udayg/sakai",
"path": "assignment/assignment-tool/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java",
"license": "apache-2.0",
"size": 672322
} | [
"org.sakaiproject.assignment.api.AssignmentSubmission",
"org.sakaiproject.assignment.cover.AssignmentService",
"org.sakaiproject.event.api.SessionState",
"org.sakaiproject.exception.IdUnusedException",
"org.sakaiproject.exception.PermissionException"
] | import org.sakaiproject.assignment.api.AssignmentSubmission; import org.sakaiproject.assignment.cover.AssignmentService; import org.sakaiproject.event.api.SessionState; import org.sakaiproject.exception.IdUnusedException; import org.sakaiproject.exception.PermissionException; | import org.sakaiproject.assignment.api.*; import org.sakaiproject.assignment.cover.*; import org.sakaiproject.event.api.*; import org.sakaiproject.exception.*; | [
"org.sakaiproject.assignment",
"org.sakaiproject.event",
"org.sakaiproject.exception"
] | org.sakaiproject.assignment; org.sakaiproject.event; org.sakaiproject.exception; | 1,838,565 |
public void setDistanceMeasure(@NonNull DistanceMeasure distanceMeasure) {
this.distanceMeasure = distanceMeasure;
} | void function(@NonNull DistanceMeasure distanceMeasure) { this.distanceMeasure = distanceMeasure; } | /**
* Sets the distance measure to use.
*
* @param distanceMeasure the distance measure
*/ | Sets the distance measure to use | setDistanceMeasure | {
"repo_name": "dbracewell/apollo",
"path": "src/main/java/com/davidbracewell/apollo/ml/clustering/hierarchical/AgglomerativeClusterer.java",
"license": "apache-2.0",
"size": 10563
} | [
"com.davidbracewell.apollo.stat.measure.DistanceMeasure"
] | import com.davidbracewell.apollo.stat.measure.DistanceMeasure; | import com.davidbracewell.apollo.stat.measure.*; | [
"com.davidbracewell.apollo"
] | com.davidbracewell.apollo; | 1,983,926 |
public MClass cls() {
return (MClass)getClassifier();
} | MClass function() { return (MClass)getClassifier(); } | /**
* Gets the {@link MClass} represented by this class node.
* @return The represented <code>MClass</code>
*/ | Gets the <code>MClass</code> represented by this class node | cls | {
"repo_name": "anonymous100001/maxuse",
"path": "src/gui/org/tzi/use/gui/views/diagrams/classdiagram/ClassNode.java",
"license": "gpl-2.0",
"size": 9588
} | [
"org.tzi.use.uml.mm.MClass"
] | import org.tzi.use.uml.mm.MClass; | import org.tzi.use.uml.mm.*; | [
"org.tzi.use"
] | org.tzi.use; | 1,067,693 |
public void run(Context context) throws IOException, InterruptedException {
setup(context);
while (context.nextKeyValue()) {
map(context.getCurrentKey(), context.getCurrentValue(), context);
}
cleanup(context);
} | void function(Context context) throws IOException, InterruptedException { setup(context); while (context.nextKeyValue()) { map(context.getCurrentKey(), context.getCurrentValue(), context); } cleanup(context); } | /**
* Expert users can override this method for more complete control over the
* execution of the Mapper.
* @param context
* @throws IOException
*/ | Expert users can override this method for more complete control over the execution of the Mapper | run | {
"repo_name": "daniarherikurniawan/Chameleon512",
"path": "src/mapred/org/apache/hadoop/mapreduce/Mapper.java",
"license": "apache-2.0",
"size": 5619
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,396,561 |
public TimeValue getLatency() {
return latency;
} | TimeValue function() { return latency; } | /**
* The latency interval during which out-of-order records should be handled.
*
* @return The latency interval or <code>null</code> if not set
*/ | The latency interval during which out-of-order records should be handled | getLatency | {
"repo_name": "gingerwizard/elasticsearch",
"path": "client/rest-high-level/src/main/java/org/elasticsearch/client/ml/job/config/AnalysisConfig.java",
"license": "apache-2.0",
"size": 17180
} | [
"org.elasticsearch.common.unit.TimeValue"
] | import org.elasticsearch.common.unit.TimeValue; | import org.elasticsearch.common.unit.*; | [
"org.elasticsearch.common"
] | org.elasticsearch.common; | 1,943,971 |
protected OptionsParser createOptionsParser(BlazeCommand command)
throws OptionsParsingException {
Command annotation = command.getClass().getAnnotation(Command.class);
List<Class<? extends OptionsBase>> allOptions = Lists.newArrayList();
allOptions.addAll(BlazeCommandUtils.getOptions(
command.getClass(), getRuntime().getBlazeModules(), getRuntime().getRuleClassProvider()));
OptionsParser parser = OptionsParser.newOptionsParser(allOptions);
parser.setAllowResidue(annotation.allowResidue());
return parser;
} | OptionsParser function(BlazeCommand command) throws OptionsParsingException { Command annotation = command.getClass().getAnnotation(Command.class); List<Class<? extends OptionsBase>> allOptions = Lists.newArrayList(); allOptions.addAll(BlazeCommandUtils.getOptions( command.getClass(), getRuntime().getBlazeModules(), getRuntime().getRuleClassProvider())); OptionsParser parser = OptionsParser.newOptionsParser(allOptions); parser.setAllowResidue(annotation.allowResidue()); return parser; } | /**
* Creates an option parser using the common options classes and the
* command-specific options classes.
*
* <p>An overriding method should first call this method and can then
* override default values directly or by calling {@link
* #parseOptionsForCommand} for command-specific options.
*
* @throws OptionsParsingException
*/ | Creates an option parser using the common options classes and the command-specific options classes. An overriding method should first call this method and can then override default values directly or by calling <code>#parseOptionsForCommand</code> for command-specific options | createOptionsParser | {
"repo_name": "nkhuyu/bazel",
"path": "src/main/java/com/google/devtools/build/lib/runtime/BlazeCommandDispatcher.java",
"license": "apache-2.0",
"size": 26940
} | [
"com.google.common.collect.Lists",
"com.google.devtools.common.options.OptionsBase",
"com.google.devtools.common.options.OptionsParser",
"com.google.devtools.common.options.OptionsParsingException",
"java.util.List"
] | import com.google.common.collect.Lists; import com.google.devtools.common.options.OptionsBase; import com.google.devtools.common.options.OptionsParser; import com.google.devtools.common.options.OptionsParsingException; import java.util.List; | import com.google.common.collect.*; import com.google.devtools.common.options.*; import java.util.*; | [
"com.google.common",
"com.google.devtools",
"java.util"
] | com.google.common; com.google.devtools; java.util; | 1,388,602 |
public List<PtuPrognosis> findPrognosesWithOrderInPeriod(LocalDate period) {
StringBuilder sql = new StringBuilder();
sql.append("SELECT DISTINCT prognosis ");
sql.append("FROM PtuPrognosis prognosis, PtuFlexRequest frequest, PtuFlexOffer foffer, PtuFlexOrder forder ");
sql.append("WHERE prognosis.ptuContainer.ptuDate = :period ");
sql.append(" AND frequest.ptuContainer.ptuDate = :period ");
sql.append(" AND foffer.ptuContainer.ptuDate = :period ");
sql.append(" AND forder.ptuContainer.ptuDate = :period ");
sql.append(" AND forder.participantDomain = foffer.participantDomain ");
sql.append(" AND foffer.participantDomain = frequest.participantDomain ");
sql.append(" AND frequest.participantDomain = prognosis.participantDomain ");
sql.append(" AND forder.flexOfferSequence = foffer.sequence ");
sql.append(" AND foffer.flexRequestSequence = frequest.sequence ");
sql.append(" AND frequest.prognosisSequence = prognosis.sequence ");
sql.append(" AND forder.ptuContainer.ptuIndex = foffer.ptuContainer.ptuIndex ");
sql.append(" AND foffer.ptuContainer.ptuIndex = frequest.ptuContainer.ptuIndex ");
sql.append(" AND frequest.ptuContainer.ptuIndex = prognosis.ptuContainer.ptuIndex ");
return getEntityManager().createQuery(sql.toString(), PtuPrognosis.class)
.setParameter("period", period.toDateMidnight().toDate(), TemporalType.DATE)
.getResultList();
} | List<PtuPrognosis> function(LocalDate period) { StringBuilder sql = new StringBuilder(); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); sql.append(STR); return getEntityManager().createQuery(sql.toString(), PtuPrognosis.class) .setParameter(STR, period.toDateMidnight().toDate(), TemporalType.DATE) .getResultList(); } | /**
* Finds all the distinct prognoses offers that are linked to a flex order during the given period.
*
* @param period {@link LocalDate} period.
* @return a {@link LocalDate} of all the {@link PtuPrognosis} entities.
*/ | Finds all the distinct prognoses offers that are linked to a flex order during the given period | findPrognosesWithOrderInPeriod | {
"repo_name": "USEF-Foundation/ri.usef.energy",
"path": "usef-build/usef-core/usef-core-planboard/src/main/java/energy/usef/core/repository/PtuPrognosisRepository.java",
"license": "apache-2.0",
"size": 9563
} | [
"energy.usef.core.model.PtuPrognosis",
"java.util.List",
"javax.persistence.TemporalType",
"org.joda.time.LocalDate"
] | import energy.usef.core.model.PtuPrognosis; import java.util.List; import javax.persistence.TemporalType; import org.joda.time.LocalDate; | import energy.usef.core.model.*; import java.util.*; import javax.persistence.*; import org.joda.time.*; | [
"energy.usef.core",
"java.util",
"javax.persistence",
"org.joda.time"
] | energy.usef.core; java.util; javax.persistence; org.joda.time; | 879,942 |
@Test
public void testLongNamespaceAndNames() throws Exception {
String ns = largeString("a", 50);
for (int i = 0; i < 4; i++)
ns = ns.concat(largeString(".b", 60));
String appname = largeString("myApp", 40);
final Topology topo = newTopology(ns, appname);
TStream<String> source = topo.strings("a", "b", "c");
Condition<List<String>> ec = topo.getTester().stringContents(source, "a", "b", "c");
complete(topo.getTester(), ec, 10, TimeUnit.SECONDS);
} | void function() throws Exception { String ns = largeString("a", 50); for (int i = 0; i < 4; i++) ns = ns.concat(largeString(".b", 60)); String appname = largeString("myApp", 40); final Topology topo = newTopology(ns, appname); TStream<String> source = topo.strings("a", "b", "c"); Condition<List<String>> ec = topo.getTester().stringContents(source, "a", "b", "c"); complete(topo.getTester(), ec, 10, TimeUnit.SECONDS); } | /**
* Test a combination of namespace and name being larger than 255.
*/ | Test a combination of namespace and name being larger than 255 | testLongNamespaceAndNames | {
"repo_name": "IBMStreams/streamsx.topology",
"path": "test/java/src/com/ibm/streamsx/topology/test/api/TopologyTest.java",
"license": "apache-2.0",
"size": 6341
} | [
"com.ibm.streamsx.topology.TStream",
"com.ibm.streamsx.topology.Topology",
"com.ibm.streamsx.topology.tester.Condition",
"java.util.List",
"java.util.concurrent.TimeUnit"
] | import com.ibm.streamsx.topology.TStream; import com.ibm.streamsx.topology.Topology; import com.ibm.streamsx.topology.tester.Condition; import java.util.List; import java.util.concurrent.TimeUnit; | import com.ibm.streamsx.topology.*; import com.ibm.streamsx.topology.tester.*; import java.util.*; import java.util.concurrent.*; | [
"com.ibm.streamsx",
"java.util"
] | com.ibm.streamsx; java.util; | 207,746 |
public void deleteShardDirectorySafe(ShardId shardId, IndexSettings indexSettings) throws IOException {
final Path[] paths = availableShardPaths(shardId);
logger.trace("deleting shard {} directory, paths: [{}]", shardId, paths);
try (ShardLock lock = shardLock(shardId)) {
deleteShardDirectoryUnderLock(lock, indexSettings);
}
} | void function(ShardId shardId, IndexSettings indexSettings) throws IOException { final Path[] paths = availableShardPaths(shardId); logger.trace(STR, shardId, paths); try (ShardLock lock = shardLock(shardId)) { deleteShardDirectoryUnderLock(lock, indexSettings); } } | /**
* Deletes a shard data directory iff the shards locks were successfully acquired.
*
* @param shardId the id of the shard to delete to delete
* @throws IOException if an IOException occurs
*/ | Deletes a shard data directory iff the shards locks were successfully acquired | deleteShardDirectorySafe | {
"repo_name": "danielmitterdorfer/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/env/NodeEnvironment.java",
"license": "apache-2.0",
"size": 41432
} | [
"java.io.IOException",
"java.nio.file.Path",
"org.elasticsearch.index.IndexSettings",
"org.elasticsearch.index.shard.ShardId"
] | import java.io.IOException; import java.nio.file.Path; import org.elasticsearch.index.IndexSettings; import org.elasticsearch.index.shard.ShardId; | import java.io.*; import java.nio.file.*; import org.elasticsearch.index.*; import org.elasticsearch.index.shard.*; | [
"java.io",
"java.nio",
"org.elasticsearch.index"
] | java.io; java.nio; org.elasticsearch.index; | 2,532,919 |
public static final void setSendText(Map map, String value) {
map.put(SEND_TEXT, value);
} | static final void function(Map map, String value) { map.put(SEND_TEXT, value); } | /**
* Sets the sendText attribute in the specified map to the specified value.
*/ | Sets the sendText attribute in the specified map to the specified value | setSendText | {
"repo_name": "ProgettoRadis/ArasuiteIta",
"path": "TICO/src/tico/board/TBoardConstants.java",
"license": "apache-2.0",
"size": 24156
} | [
"java.util.Map"
] | import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,184,576 |
public void setLocale (Locale locale) {
fConfiguration.setLocale (locale);
} // setLocale(Locale)
//
// XMLDocumentHandler methods
// | void function (Locale locale) { fConfiguration.setLocale (locale); } // | /**
* Set the locale to use for messages.
*
* @param locale The locale object to use for localization of messages.
*
*/ | Set the locale to use for messages | setLocale | {
"repo_name": "samskivert/ikvm-openjdk",
"path": "build/linux-amd64/impsrc/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java",
"license": "gpl-2.0",
"size": 102095
} | [
"java.util.Locale"
] | import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 125,077 |
private static Context getContext( int conf )
{
synchronized ( lock[conf] )
{
return config[conf].context;
}
} | static Context function( int conf ) { synchronized ( lock[conf] ) { return config[conf].context; } } | /**
* Gets context for toast-log
* @param conf PRIMARY/SECONDARY configuration
* @return context of the activity, null if disabled
*/ | Gets context for toast-log | getContext | {
"repo_name": "Palmodroid/BestBoard",
"path": "app/src/main/java/org/lattilad/bestboard/scribe/Scribe.java",
"license": "mit",
"size": 76120
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 338,121 |
int updateByPrimaryKeySelective(VehicleRecord record); | int updateByPrimaryKeySelective(VehicleRecord record); | /**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table tb_vehicle_record
*
* @mbggenerated
*/ | This method was generated by MyBatis Generator. This method corresponds to the database table tb_vehicle_record | updateByPrimaryKeySelective | {
"repo_name": "jasonZhangCoder/jee-site",
"path": "src/main/java/com/security/baotai/mapper/vehicle/VehicleRecordMapper.java",
"license": "apache-2.0",
"size": 2843
} | [
"com.security.baotai.model.vehicle.VehicleRecord"
] | import com.security.baotai.model.vehicle.VehicleRecord; | import com.security.baotai.model.vehicle.*; | [
"com.security.baotai"
] | com.security.baotai; | 956,259 |
public LocalDate getOperatingUntil() {
return operatingUntil;
} | LocalDate function() { return operatingUntil; } | /**
* Returns the finishing year of operations.
*
* @return the year
*/ | Returns the finishing year of operations | getOperatingUntil | {
"repo_name": "CarloMicieli/trenako-v2",
"path": "src/main/java/com/carlomicieli/jtrains/core/models/Railway.java",
"license": "apache-2.0",
"size": 9792
} | [
"java.time.LocalDate"
] | import java.time.LocalDate; | import java.time.*; | [
"java.time"
] | java.time; | 1,019,247 |
@Override
public Builder user(final User[] user) {
this.map.put(USER, user);
this.previous = USER;
return builder();
}
| Builder function(final User[] user) { this.map.put(USER, user); this.previous = USER; return builder(); } | /**
* Builds the User[] array.
*
* @param User[] user
* @return Builder
*/ | Builds the User[] array | user | {
"repo_name": "dsw9742/ceddl",
"path": "src/main/java/com/douglaswhitehead/model/digitaldata/DigitalDataImpl.java",
"license": "mit",
"size": 8562
} | [
"com.douglaswhitehead.model.digitaldata.user.User"
] | import com.douglaswhitehead.model.digitaldata.user.User; | import com.douglaswhitehead.model.digitaldata.user.*; | [
"com.douglaswhitehead.model"
] | com.douglaswhitehead.model; | 2,073,201 |
final Matcher matcher = INDEX_ARGS_FORMAT.matcher(command.trim());
if (!matcher.matches()) {
return Optional.empty();
}
String index = matcher.group("targetIndex");
if (!StringUtil.isUnsignedInteger(index)) {
return Optional.empty();
}
return Optional.of(Integer.parseInt(index));
} | final Matcher matcher = INDEX_ARGS_FORMAT.matcher(command.trim()); if (!matcher.matches()) { return Optional.empty(); } String index = matcher.group(STR); if (!StringUtil.isUnsignedInteger(index)) { return Optional.empty(); } return Optional.of(Integer.parseInt(index)); } | /**
* Returns the specified index in the {@code command} if it is a positive
* unsigned integer Returns an {@code Optional.empty()} otherwise.
*/ | Returns the specified index in the command if it is a positive unsigned integer Returns an Optional.empty() otherwise | parseIndex | {
"repo_name": "CS2103JAN2017-W13-B1/main",
"path": "src/main/java/utask/logic/parser/ParserUtil.java",
"license": "mit",
"size": 11025
} | [
"java.util.Optional",
"java.util.regex.Matcher"
] | import java.util.Optional; import java.util.regex.Matcher; | import java.util.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 1,374,014 |
public void handleConfiguration(Class<OpsType> opsType)
throws InstantiationException, IllegalAccessException {
// If this method returns true it's the first time the
// Activity has been created.
if (mRetainedFragmentManager.firstTimeIn()) {
Log.d(TAG,
"First time onCreate() call");
// Initialize the GenericActivity fields.
initialize(opsType);
} else {
// The RetainedFragmentManager was previously initialized,
// which means that a runtime configuration change
// occured.
Log.d(TAG,
"Second or subsequent onCreate() call");
// Try to obtain the OpsType instance from the
// RetainedFragmentManager.
mOpsInstance =
mRetainedFragmentManager.get(opsType.getSimpleName());
// This check shouldn't be necessary under normal
// circumstances, but it's better to lose state than to
// crash!
if (mOpsInstance == null)
// Initialize the GenericActivity fields.
initialize(opsType);
else
// Inform it that the runtime configuration change has
// completed.
mOpsInstance.onConfiguration(this,
false);
}
} | void function(Class<OpsType> opsType) throws InstantiationException, IllegalAccessException { if (mRetainedFragmentManager.firstTimeIn()) { Log.d(TAG, STR); initialize(opsType); } else { Log.d(TAG, STR); mOpsInstance = mRetainedFragmentManager.get(opsType.getSimpleName()); if (mOpsInstance == null) initialize(opsType); else mOpsInstance.onConfiguration(this, false); } } | /**
* Handle hardware (re)configurations, such as rotating the
* display.
*
* @throws IllegalAccessException
* @throws InstantiationException
*/ | Handle hardware (re)configurations, such as rotating the display | handleConfiguration | {
"repo_name": "stevechlin/mobilecloud-15",
"path": "ex/HobbitContentProvider/src/vandy/mooc/common/GenericActivity.java",
"license": "apache-2.0",
"size": 4707
} | [
"android.util.Log"
] | import android.util.Log; | import android.util.*; | [
"android.util"
] | android.util; | 2,023,119 |
protected void showTabs() {
if (getPageCount() > 1) {
setPageText(0, getString("_UI_SelectionPage_label"));
if (getContainer() instanceof CTabFolder) {
((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT);
Point point = getContainer().getSize();
getContainer().setSize(point.x, point.y - 6);
}
}
}
| void function() { if (getPageCount() > 1) { setPageText(0, getString(STR)); if (getContainer() instanceof CTabFolder) { ((CTabFolder)getContainer()).setTabHeight(SWT.DEFAULT); Point point = getContainer().getSize(); getContainer().setSize(point.x, point.y - 6); } } } | /**
* If there is more than one page in the multi-page editor part,
* this shows the tabs at the bottom.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | If there is more than one page in the multi-page editor part, this shows the tabs at the bottom. | showTabs | {
"repo_name": "jsanchezp/e-edd",
"path": "es.ucm.fdi.edd.emf.editor/src/es/ucm/fdi/edd/emf/model/edd/presentation/EddEditor.java",
"license": "gpl-3.0",
"size": 55672
} | [
"org.eclipse.swt.custom.CTabFolder",
"org.eclipse.swt.graphics.Point"
] | import org.eclipse.swt.custom.CTabFolder; import org.eclipse.swt.graphics.Point; | import org.eclipse.swt.custom.*; import org.eclipse.swt.graphics.*; | [
"org.eclipse.swt"
] | org.eclipse.swt; | 122,421 |
@Schema(description = "")
public SectionObject getData() {
return data;
} | @Schema(description = "") SectionObject function() { return data; } | /**
* Get data
* @return data
**/ | Get data | getData | {
"repo_name": "bclemenzi/clever-java",
"path": "src/main/java/io/swagger/client/model/SectionsUpdated.java",
"license": "gpl-3.0",
"size": 2785
} | [
"io.swagger.v3.oas.annotations.media.Schema"
] | import io.swagger.v3.oas.annotations.media.Schema; | import io.swagger.v3.oas.annotations.media.*; | [
"io.swagger.v3"
] | io.swagger.v3; | 157,186 |
EReference getHydroPowerPlant_Reservoir(); | EReference getHydroPowerPlant_Reservoir(); | /**
* Returns the meta object for the reference '{@link CIM.IEC61970.Generation.Production.HydroPowerPlant#getReservoir <em>Reservoir</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the reference '<em>Reservoir</em>'.
* @see CIM.IEC61970.Generation.Production.HydroPowerPlant#getReservoir()
* @see #getHydroPowerPlant()
* @generated
*/ | Returns the meta object for the reference '<code>CIM.IEC61970.Generation.Production.HydroPowerPlant#getReservoir Reservoir</code>'. | getHydroPowerPlant_Reservoir | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/Production/ProductionPackage.java",
"license": "mit",
"size": 499866
} | [
"org.eclipse.emf.ecore.EReference"
] | import org.eclipse.emf.ecore.EReference; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 806,733 |
PhysType project(
List<Integer> integers,
JavaRowFormat format); | PhysType project( List<Integer> integers, JavaRowFormat format); | /** Projects a given collection of fields from this input record, into
* a particular preferred output format. The output format is optimized
* if there are 0 or 1 fields. */ | Projects a given collection of fields from this input record, into a particular preferred output format. The output format is optimized | project | {
"repo_name": "minji-kim/calcite",
"path": "core/src/main/java/org/apache/calcite/adapter/enumerable/PhysType.java",
"license": "apache-2.0",
"size": 7448
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,105,235 |
public ValidationResult checkMapRecordAdvices(MapRecord mapRecord,
Map<Integer, List<MapEntry>> entryGroups) {
final ValidationResult validationResult = new ValidationResultJpa();
for (final MapEntry mapEntry : mapRecord.getMapEntries()) {
for (final MapAdvice mapAdvice : mapEntry.getMapAdvices()) {
if (!mapProject.getMapAdvices().contains(mapAdvice)) {
validationResult.addError(
"Invalid advice " + mapAdvice.getName() + "." + " Entry:"
+ (mapProject.isGroupStructure() ? " group "
+ Integer.toString(mapEntry.getMapGroup()) + "," : "")
+ " map priority "
+ Integer.toString(mapEntry.getMapPriority()));
}
}
}
return validationResult;
} | ValidationResult function(MapRecord mapRecord, Map<Integer, List<MapEntry>> entryGroups) { final ValidationResult validationResult = new ValidationResultJpa(); for (final MapEntry mapEntry : mapRecord.getMapEntries()) { for (final MapAdvice mapAdvice : mapEntry.getMapAdvices()) { if (!mapProject.getMapAdvices().contains(mapAdvice)) { validationResult.addError( STR + mapAdvice.getName() + "." + STR + (mapProject.isGroupStructure() ? STR + Integer.toString(mapEntry.getMapGroup()) + "," : STR map priority " + Integer.toString(mapEntry.getMapPriority())); } } } return validationResult; } | /**
* Verify advices are valid for the project
*
* @param mapRecord the map record
* @param entryGroups the binned entry lists by group
* @return a list of errors detected
*/ | Verify advices are valid for the project | checkMapRecordAdvices | {
"repo_name": "WestCoastInformatics/OTF-Mapping-Service",
"path": "jpa-services/src/main/java/org/ihtsdo/otf/mapping/jpa/handlers/DefaultProjectSpecificAlgorithmHandler.java",
"license": "apache-2.0",
"size": 32294
} | [
"java.util.List",
"java.util.Map",
"org.ihtsdo.otf.mapping.helpers.ValidationResult",
"org.ihtsdo.otf.mapping.helpers.ValidationResultJpa",
"org.ihtsdo.otf.mapping.model.MapAdvice",
"org.ihtsdo.otf.mapping.model.MapEntry",
"org.ihtsdo.otf.mapping.model.MapRecord"
] | import java.util.List; import java.util.Map; import org.ihtsdo.otf.mapping.helpers.ValidationResult; import org.ihtsdo.otf.mapping.helpers.ValidationResultJpa; import org.ihtsdo.otf.mapping.model.MapAdvice; import org.ihtsdo.otf.mapping.model.MapEntry; import org.ihtsdo.otf.mapping.model.MapRecord; | import java.util.*; import org.ihtsdo.otf.mapping.helpers.*; import org.ihtsdo.otf.mapping.model.*; | [
"java.util",
"org.ihtsdo.otf"
] | java.util; org.ihtsdo.otf; | 2,478,320 |
private void addSlotAnnotations(Map<AnnotationFS, List<FeatureStructure>> linkFSesPerAnno,
Feature aLinkeF)
{
for (AnnotationFS anno : linkFSesPerAnno.keySet()) {
ArrayFS array = anno.getCAS().createArrayFS(linkFSesPerAnno.get(anno).size());
array.copyFromArray(
linkFSesPerAnno.get(anno)
.toArray(new FeatureStructure[linkFSesPerAnno.get(anno).size()]),
0, 0, linkFSesPerAnno.get(anno).size());
anno.setFeatureValue(aLinkeF, array);
anno.getCAS().addFsToIndexes(anno);
}
} | void function(Map<AnnotationFS, List<FeatureStructure>> linkFSesPerAnno, Feature aLinkeF) { for (AnnotationFS anno : linkFSesPerAnno.keySet()) { ArrayFS array = anno.getCAS().createArrayFS(linkFSesPerAnno.get(anno).size()); array.copyFromArray( linkFSesPerAnno.get(anno) .toArray(new FeatureStructure[linkFSesPerAnno.get(anno).size()]), 0, 0, linkFSesPerAnno.get(anno).size()); anno.setFeatureValue(aLinkeF, array); anno.getCAS().addFsToIndexes(anno); } } | /**
* update a base annotation with slot annotations
*
* @param linkFSesPerAnno
* contains list of slot annotations per a base annotation
* @param aLinkeF
* The link slot annotation feature
*/ | update a base annotation with slot annotations | addSlotAnnotations | {
"repo_name": "webanno/webanno",
"path": "webanno-io-tsv/src/main/java/de/tudarmstadt/ukp/clarin/webanno/tsv/WebannoTsv3Reader.java",
"license": "apache-2.0",
"size": 43042
} | [
"java.util.List",
"java.util.Map",
"org.apache.uima.cas.ArrayFS",
"org.apache.uima.cas.Feature",
"org.apache.uima.cas.FeatureStructure",
"org.apache.uima.cas.text.AnnotationFS"
] | import java.util.List; import java.util.Map; import org.apache.uima.cas.ArrayFS; import org.apache.uima.cas.Feature; import org.apache.uima.cas.FeatureStructure; import org.apache.uima.cas.text.AnnotationFS; | import java.util.*; import org.apache.uima.cas.*; import org.apache.uima.cas.text.*; | [
"java.util",
"org.apache.uima"
] | java.util; org.apache.uima; | 921,997 |
public void removeSysOpenreportByIds(String[] ids) {
SysOpenreport.remove(ids);
}
| void function(String[] ids) { SysOpenreport.remove(ids); } | /**
* <pre>
* remove SysOpenreport.
* </pre>
*
* @param ids. (non-Javadoc)
* @author <a href="mailto:iffiff1@gmail.com">Tyler Chen</a>
* @see com.foreveross.qdp.application.system.common.SysOpenreportApplication#removeSysOpenreportByIds(String[])
* @since 2017-11-09
* auto generate by qdp v3.0.
*/ | <code> remove SysOpenreport. </code> | removeSysOpenreportByIds | {
"repo_name": "tylerchen/foss-qdp-project-v4",
"path": "src/main/java/com/foreveross/qdp/application/system/common/impl/SysOpenreportApplicationImpl.java",
"license": "apache-2.0",
"size": 7826
} | [
"com.foreveross.qdp.domain.system.common.SysOpenreport"
] | import com.foreveross.qdp.domain.system.common.SysOpenreport; | import com.foreveross.qdp.domain.system.common.*; | [
"com.foreveross.qdp"
] | com.foreveross.qdp; | 992,510 |
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
} | void function(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { processRequest(request, response); } | /**
* Handles the HTTP <code>POST</code> method.
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/ | Handles the HTTP <code>POST</code> method | doPost | {
"repo_name": "megallanpp/EcommerceAllanUbiraci",
"path": "EcommerceAllan_Ubiraci/src/java/ServletsDominio/ServletCarrinho.java",
"license": "mit",
"size": 4300
} | [
"java.io.IOException",
"javax.servlet.ServletException",
"javax.servlet.http.HttpServletRequest",
"javax.servlet.http.HttpServletResponse"
] | import java.io.IOException; 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,866,865 |
@VisibleForTesting
void enableTestMode(
Supplier<List<SourceFile>> externsSupplier,
Supplier<List<SourceFile>> inputsSupplier,
Supplier<List<JSModule>> modulesSupplier,
Function<Integer, Void> exitCodeReceiver) {
checkArgument(inputsSupplier == null ^ modulesSupplier == null);
testMode = true;
this.externsSupplierForTesting = externsSupplier;
this.inputsSupplierForTesting = inputsSupplier;
this.modulesSupplierForTesting = modulesSupplier;
this.exitCodeReceiver = exitCodeReceiver;
} | void enableTestMode( Supplier<List<SourceFile>> externsSupplier, Supplier<List<SourceFile>> inputsSupplier, Supplier<List<JSModule>> modulesSupplier, Function<Integer, Void> exitCodeReceiver) { checkArgument(inputsSupplier == null ^ modulesSupplier == null); testMode = true; this.externsSupplierForTesting = externsSupplier; this.inputsSupplierForTesting = inputsSupplier; this.modulesSupplierForTesting = modulesSupplier; this.exitCodeReceiver = exitCodeReceiver; } | /**
* Put the command line runner into test mode. In test mode,
* all outputs will be blackholed.
* @param externsSupplier A provider for externs.
* @param inputsSupplier A provider for source inputs.
* @param modulesSupplier A provider for modules. Only one of inputsSupplier
* and modulesSupplier may be non-null.
* @param exitCodeReceiver A receiver for the status code that would
* have been passed to System.exit in non-test mode.
*/ | Put the command line runner into test mode. In test mode, all outputs will be blackholed | enableTestMode | {
"repo_name": "GerHobbelt/closure-compiler",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 97801
} | [
"com.google.common.base.Function",
"com.google.common.base.Preconditions",
"com.google.common.base.Supplier",
"java.util.List"
] | import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.base.Supplier; import java.util.List; | import com.google.common.base.*; import java.util.*; | [
"com.google.common",
"java.util"
] | com.google.common; java.util; | 166,429 |
public static void readRom( InputStream inputStream )
throws MetaDataParserException
{
InputStream internalStream = inputStream;
MetaDataHandlerImpl handler = new MetaDataHandlerImpl( );
try
{
SAXParser parser = CommonUtil.createSAXParser( );
parser.parse( internalStream, handler );
}
catch ( Exception e )
{
MetaLogManager.log( "Metadata parsing error", e ); //$NON-NLS-1$
throw new MetaDataParserException( e,
MetaDataParserException.DESIGN_EXCEPTION_PARSER_ERROR );
}
} | static void function( InputStream inputStream ) throws MetaDataParserException { InputStream internalStream = inputStream; MetaDataHandlerImpl handler = new MetaDataHandlerImpl( ); try { SAXParser parser = CommonUtil.createSAXParser( ); parser.parse( internalStream, handler ); } catch ( Exception e ) { MetaLogManager.log( STR, e ); throw new MetaDataParserException( e, MetaDataParserException.DESIGN_EXCEPTION_PARSER_ERROR ); } } | /**
* Only reads the given metadata with the specified stream.
*
* @param inputStream
* meta source file stream.
* @throws MetaDataParserException
*/ | Only reads the given metadata with the specified stream | readRom | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model.testhelper/test/org/eclipse/birt/report/model/metadata/MetadataTestUtil.java",
"license": "epl-1.0",
"size": 7634
} | [
"java.io.InputStream",
"javax.xml.parsers.SAXParser",
"org.eclipse.birt.core.util.CommonUtil"
] | import java.io.InputStream; import javax.xml.parsers.SAXParser; import org.eclipse.birt.core.util.CommonUtil; | import java.io.*; import javax.xml.parsers.*; import org.eclipse.birt.core.util.*; | [
"java.io",
"javax.xml",
"org.eclipse.birt"
] | java.io; javax.xml; org.eclipse.birt; | 2,812,058 |
@AfterClass
public static void tearDown() {
File dir = new File(testStagingInfo.getStageInDirectory());
FileIOUtil.deleteFilesRecursive(dir);
//Ensure cleanup succeeded
Assert.assertFalse(dir.exists());
} | static void function() { File dir = new File(testStagingInfo.getStageInDirectory()); FileIOUtil.deleteFilesRecursive(dir); Assert.assertFalse(dir.exists()); } | /**
* This tears down the staging area used by the tests
*/ | This tears down the staging area used by the tests | tearDown | {
"repo_name": "victortey/portal-core",
"path": "src/test/java/org/auscope/portal/core/services/cloud/TestFileStagingService.java",
"license": "lgpl-3.0",
"size": 19978
} | [
"java.io.File",
"org.auscope.portal.core.util.FileIOUtil",
"org.junit.Assert"
] | import java.io.File; import org.auscope.portal.core.util.FileIOUtil; import org.junit.Assert; | import java.io.*; import org.auscope.portal.core.util.*; import org.junit.*; | [
"java.io",
"org.auscope.portal",
"org.junit"
] | java.io; org.auscope.portal; org.junit; | 2,237,368 |
public static String replaceFirst(CharSequence receiver, Pattern pattern, Function<Matcher, String> replacementBuilder) {
Matcher m = pattern.matcher(receiver);
if (false == m.find()) {
// CharSequqence's toString is *supposed* to always return the characters in the sequence as a String
return receiver.toString();
}
StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver));
m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m)));
m.appendTail(result);
return result.toString();
} | static String function(CharSequence receiver, Pattern pattern, Function<Matcher, String> replacementBuilder) { Matcher m = pattern.matcher(receiver); if (false == m.find()) { return receiver.toString(); } StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver)); m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m))); m.appendTail(result); return result.toString(); } | /**
* Replace the first match. Similar to {@link Matcher#replaceFirst(String)} but allows you to customize the replacement based on the
* match.
*/ | Replace the first match. Similar to <code>Matcher#replaceFirst(String)</code> but allows you to customize the replacement based on the match | replaceFirst | {
"repo_name": "nknize/elasticsearch",
"path": "modules/lang-painless/src/main/java/org/elasticsearch/painless/api/Augmentation.java",
"license": "apache-2.0",
"size": 28336
} | [
"java.util.function.Function",
"java.util.regex.Matcher",
"java.util.regex.Pattern"
] | import java.util.function.Function; import java.util.regex.Matcher; import java.util.regex.Pattern; | import java.util.function.*; import java.util.regex.*; | [
"java.util"
] | java.util; | 2,020,108 |
private void fillContextMenu(final IMenuManager manager) {
manager.add(this.openValueView);
manager.add(this.openTextTable);
manager.add(this.openSource);
manager.add(new Separator());
manager.add(this.jumpToPreviousSetverdict);
manager.add(this.jumpToNextSetverdict);
manager.add(new Separator());
manager.add(filterAction);
manager.add(new Separator());
manager.add(this.refresh);
}
| void function(final IMenuManager manager) { manager.add(this.openValueView); manager.add(this.openTextTable); manager.add(this.openSource); manager.add(new Separator()); manager.add(this.jumpToPreviousSetverdict); manager.add(this.jumpToNextSetverdict); manager.add(new Separator()); manager.add(filterAction); manager.add(new Separator()); manager.add(this.refresh); } | /**
* Fills the context menu with actions
* @param manager the menu manager
*/ | Fills the context menu with actions | fillContextMenu | {
"repo_name": "eroslevi/titan.EclipsePlug-ins",
"path": "org.eclipse.titan.log.viewer/src/org/eclipse/titan/log/viewer/views/MSCView.java",
"license": "epl-1.0",
"size": 31813
} | [
"org.eclipse.jface.action.IMenuManager",
"org.eclipse.jface.action.Separator"
] | import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.Separator; | import org.eclipse.jface.action.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 1,383,587 |
public QName getSamlObjectQName(final Class objectType) {
try {
val f = objectType.getField(DEFAULT_ELEMENT_NAME_FIELD);
return (QName) f.get(null);
} catch (final NoSuchFieldException e) {
throw new IllegalStateException("Cannot find field " + objectType.getName() + '.' + DEFAULT_ELEMENT_NAME_FIELD, e);
} catch (final IllegalAccessException e) {
throw new IllegalStateException("Cannot access field " + objectType.getName() + '.' + DEFAULT_ELEMENT_NAME_FIELD, e);
}
} | QName function(final Class objectType) { try { val f = objectType.getField(DEFAULT_ELEMENT_NAME_FIELD); return (QName) f.get(null); } catch (final NoSuchFieldException e) { throw new IllegalStateException(STR + objectType.getName() + '.' + DEFAULT_ELEMENT_NAME_FIELD, e); } catch (final IllegalAccessException e) { throw new IllegalStateException(STR + objectType.getName() + '.' + DEFAULT_ELEMENT_NAME_FIELD, e); } } | /**
* Gets saml object QName.
*
* @param objectType the object type
* @return the saml object QName
*/ | Gets saml object QName | getSamlObjectQName | {
"repo_name": "leleuj/cas",
"path": "support/cas-server-support-saml-core-api/src/main/java/org/apereo/cas/support/saml/util/AbstractSamlObjectBuilder.java",
"license": "apache-2.0",
"size": 18716
} | [
"javax.xml.namespace.QName"
] | import javax.xml.namespace.QName; | import javax.xml.namespace.*; | [
"javax.xml"
] | javax.xml; | 2,497,542 |
private void validateBirthDate(Errors errors, Date birthDate) {
if (birthDate == null) {
return;
}
rejectIfFutureDate(errors, birthDate, "birthdate");
rejectDateIfBefore120YearsAgo(errors, birthDate, "birthdate");
}
| void function(Errors errors, Date birthDate) { if (birthDate == null) { return; } rejectIfFutureDate(errors, birthDate, STR); rejectDateIfBefore120YearsAgo(errors, birthDate, STR); } | /**
* Checks if the birth date specified is in the future or older than 120 years old..
*
* @param birthDate The birthdate to validate.
* @param errors Stores information about errors encountered during validation.
*/ | Checks if the birth date specified is in the future or older than 120 years old. | validateBirthDate | {
"repo_name": "vinayvenu/openmrs-core",
"path": "api/src/main/java/org/openmrs/validator/PersonValidator.java",
"license": "mpl-2.0",
"size": 5157
} | [
"java.util.Date",
"org.springframework.validation.Errors"
] | import java.util.Date; import org.springframework.validation.Errors; | import java.util.*; import org.springframework.validation.*; | [
"java.util",
"org.springframework.validation"
] | java.util; org.springframework.validation; | 1,707,515 |
public static ClusterNode oldest(Collection<ClusterNode> c, @Nullable IgnitePredicate<ClusterNode> p) {
ClusterNode oldest = null;
long minOrder = Long.MAX_VALUE;
for (ClusterNode n : c) {
if ((p == null || p.apply(n)) && n.order() < minOrder) {
oldest = n;
minOrder = n.order();
}
}
return oldest;
} | static ClusterNode function(Collection<ClusterNode> c, @Nullable IgnitePredicate<ClusterNode> p) { ClusterNode oldest = null; long minOrder = Long.MAX_VALUE; for (ClusterNode n : c) { if ((p == null p.apply(n)) && n.order() < minOrder) { oldest = n; minOrder = n.order(); } } return oldest; } | /**
* Gets oldest node out of collection of nodes.
*
* @param c Collection of nodes.
* @return Oldest node.
*/ | Gets oldest node out of collection of nodes | oldest | {
"repo_name": "agoncharuk/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java",
"license": "apache-2.0",
"size": 289549
} | [
"java.util.Collection",
"org.apache.ignite.cluster.ClusterNode",
"org.apache.ignite.lang.IgnitePredicate",
"org.jetbrains.annotations.Nullable"
] | import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; import org.apache.ignite.lang.IgnitePredicate; import org.jetbrains.annotations.Nullable; | import java.util.*; import org.apache.ignite.cluster.*; import org.apache.ignite.lang.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.apache.ignite",
"org.jetbrains.annotations"
] | java.util; org.apache.ignite; org.jetbrains.annotations; | 1,222,381 |
@Test
public void testGetResourceCollection_PropsParent() {
ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy());
// build config resources
context.build()
.resource("/conf/site1/sling:test/feature/c")
.resource("/conf/site2/sling:test/feature/c")
.resource("/conf/site2/sling:test/feature/d")
.resource("/apps/conf/sling:test/feature/a")
.resource("/libs/conf/sling:test/feature", PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("b");
assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths(
"/conf/site1/sling:test/feature/c"));
assertThat(underTest.getResourceCollection(site2Page1, BUCKETS, "feature"), ResourceCollectionMatchers.paths(
"/conf/site2/sling:test/feature/c",
"/conf/site2/sling:test/feature/d"));
} | void function() { ConfigurationResourceResolvingStrategy underTest = context.registerInjectActivateService(new DefaultConfigurationResourceResolvingStrategy()); context.build() .resource(STR) .resource(STR) .resource(STR) .resource(STR) .resource(STR, PROPERTY_CONFIG_COLLECTION_INHERIT, true).resource("b"); assertThat(underTest.getResourceCollection(site1Page1, BUCKETS, STR), ResourceCollectionMatchers.paths( STR)); assertThat(underTest.getResourceCollection(site2Page1, BUCKETS, STR), ResourceCollectionMatchers.paths( STR, STR)); } | /**
* Resource inheritance with enabling list merging on a parent context level.
* => no inheritance takes place
*/ | Resource inheritance with enabling list merging on a parent context level. => no inheritance takes place | testGetResourceCollection_PropsParent | {
"repo_name": "cleliameneghin/sling",
"path": "bundles/extensions/caconfig/impl/src/test/java/org/apache/sling/caconfig/resource/impl/def/DefaultConfigurationResourceResolvingStrategyTest.java",
"license": "apache-2.0",
"size": 12607
} | [
"org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy",
"org.apache.sling.hamcrest.ResourceCollectionMatchers",
"org.junit.Assert"
] | import org.apache.sling.caconfig.resource.spi.ConfigurationResourceResolvingStrategy; import org.apache.sling.hamcrest.ResourceCollectionMatchers; import org.junit.Assert; | import org.apache.sling.caconfig.resource.spi.*; import org.apache.sling.hamcrest.*; import org.junit.*; | [
"org.apache.sling",
"org.junit"
] | org.apache.sling; org.junit; | 344,852 |
public static void main(String[] args) {
System.out.println(APP_NAME + " " + getVersion() + " starting");
try {
new MarkDownPublisherMain().run();
} catch (FeedException | AWTException | IOException | ParseException ex) {
LOG.error("", ex);
}
} | static void function(String[] args) { System.out.println(APP_NAME + " " + getVersion() + STR); try { new MarkDownPublisherMain().run(); } catch (FeedException AWTException IOException ParseException ex) { LOG.error("", ex); } } | /**
* Main entry point.
*
* @param args
* the command line arguments.
*/ | Main entry point | main | {
"repo_name": "jjYBdx4IL/misc",
"path": "markdown-publisher/src/main/java/com/github/jjYBdx4IL/web/markdown/publisher/MarkDownPublisherMain.java",
"license": "apache-2.0",
"size": 13666
} | [
"com.rometools.rome.io.FeedException",
"java.awt.AWTException",
"java.io.IOException",
"java.text.ParseException"
] | import com.rometools.rome.io.FeedException; import java.awt.AWTException; import java.io.IOException; import java.text.ParseException; | import com.rometools.rome.io.*; import java.awt.*; import java.io.*; import java.text.*; | [
"com.rometools.rome",
"java.awt",
"java.io",
"java.text"
] | com.rometools.rome; java.awt; java.io; java.text; | 384,854 |
public void addKeyProperty(float keyTime, SVIVector4 value) {
SVIEngineThreadProtection.validateMainThread();
float[] data = {value.mX, value.mY, value.mZ, value.mW};
nativeAddKeyProperty(mNativeAnimation, mAnimationType, keyTime, data);
} | void function(float keyTime, SVIVector4 value) { SVIEngineThreadProtection.validateMainThread(); float[] data = {value.mX, value.mY, value.mZ, value.mW}; nativeAddKeyProperty(mNativeAnimation, mAnimationType, keyTime, data); } | /**
* add key property use SVIVector4
*
* @param keyTime > 0.0f ~ 1.0f
* @param value > SVIVector4 (etc. rotation ... )
*/ | add key property use SVIVector4 | addKeyProperty | {
"repo_name": "Samsung/SVIEngine",
"path": "SVIEngine/src/com/github/sviengine/animation/SVIKeyFrameAnimation.java",
"license": "apache-2.0",
"size": 6156
} | [
"com.github.sviengine.SVIEngineThreadProtection",
"com.github.sviengine.basetype.SVIVector4"
] | import com.github.sviengine.SVIEngineThreadProtection; import com.github.sviengine.basetype.SVIVector4; | import com.github.sviengine.*; import com.github.sviengine.basetype.*; | [
"com.github.sviengine"
] | com.github.sviengine; | 2,250,007 |
public static void e(Throwable thrown) {
loggerError.log(Level.SEVERE, getStackTrace(thrown));
if (!loggingEnabled) {
return;
}
logger.log(Level.SEVERE, getStackTrace(thrown));
} | static void function(Throwable thrown) { loggerError.log(Level.SEVERE, getStackTrace(thrown)); if (!loggingEnabled) { return; } logger.log(Level.SEVERE, getStackTrace(thrown)); } | /**
* Log exception thrown
*
* @param thrown thrown exception
*/ | Log exception thrown | e | {
"repo_name": "MightyPork/tortuga-spritegen",
"path": "src/net/spritegen/util/Log.java",
"license": "bsd-2-clause",
"size": 6857
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,530,420 |
public final long computeFileSize(int snapshotId) {
FileWithSnapshotFeature sf = this.getFileWithSnapshotFeature();
if (snapshotId != CURRENT_STATE_ID && sf != null) {
final FileDiff d = sf.getDiffs().getDiffById(snapshotId);
if (d != null) {
return d.getFileSize();
}
}
return computeFileSize(true, false);
} | final long function(int snapshotId) { FileWithSnapshotFeature sf = this.getFileWithSnapshotFeature(); if (snapshotId != CURRENT_STATE_ID && sf != null) { final FileDiff d = sf.getDiffs().getDiffById(snapshotId); if (d != null) { return d.getFileSize(); } } return computeFileSize(true, false); } | /**
* Compute file size of the current file if the given snapshot is null;
* otherwise, get the file size from the given snapshot.
*/ | Compute file size of the current file if the given snapshot is null; otherwise, get the file size from the given snapshot | computeFileSize | {
"repo_name": "intel-hadoop/hadoop",
"path": "hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/INodeFile.java",
"license": "apache-2.0",
"size": 30343
} | [
"org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff",
"org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature"
] | import org.apache.hadoop.hdfs.server.namenode.snapshot.FileDiff; import org.apache.hadoop.hdfs.server.namenode.snapshot.FileWithSnapshotFeature; | import org.apache.hadoop.hdfs.server.namenode.snapshot.*; | [
"org.apache.hadoop"
] | org.apache.hadoop; | 1,861,528 |
List<Execution> listExecutions(); | List<Execution> listExecutions(); | /**
* Return the list of {@link Execution} associated with this plugin, if any.
*/ | Return the list of <code>Execution</code> associated with this plugin, if any | listExecutions | {
"repo_name": "forge/core",
"path": "maven/api/src/main/java/org/jboss/forge/addon/maven/plugins/MavenPlugin.java",
"license": "epl-1.0",
"size": 1122
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 875,235 |
public void registerAdRenderer(@NonNull final MoPubAdRenderer adRenderer) {
if (!NoThrow.checkNotNull(adRenderer, "Cannot register a null adRenderer")) {
return;
}
mAdRenderer = adRenderer;
} | void function(@NonNull final MoPubAdRenderer adRenderer) { if (!NoThrow.checkNotNull(adRenderer, STR)) { return; } mAdRenderer = adRenderer; } | /**
* Registers an ad renderer to use when displaying ads in your stream.
*
* This renderer will automatically create and render your view when you call {@link
* #getAdView}. If you register a second renderer, it will replace the first, although this
* behavior is subject to change in a future SDK version.
*
* @param adRenderer The ad renderer.
*/ | Registers an ad renderer to use when displaying ads in your stream. This renderer will automatically create and render your view when you call <code>#getAdView</code>. If you register a second renderer, it will replace the first, although this behavior is subject to change in a future SDK version | registerAdRenderer | {
"repo_name": "appsfire/Appsfire-custom-event-adaptors",
"path": "Android/AppsfireAndroidSDK-mopub/MoPubMediationDemo/src/com/mopub/nativeads/MoPubStreamAdPlacer.java",
"license": "bsd-2-clause",
"size": 27827
} | [
"android.support.annotation.NonNull",
"com.mopub.common.Preconditions"
] | import android.support.annotation.NonNull; import com.mopub.common.Preconditions; | import android.support.annotation.*; import com.mopub.common.*; | [
"android.support",
"com.mopub.common"
] | android.support; com.mopub.common; | 193,904 |
public List<Integer> getComponentTasks(String componentId) {
List<Integer> ret = _componentToTasks.get(componentId);
if(ret==null) return new ArrayList<Integer>();
else return new ArrayList<Integer>(ret);
} | List<Integer> function(String componentId) { List<Integer> ret = _componentToTasks.get(componentId); if(ret==null) return new ArrayList<Integer>(); else return new ArrayList<Integer>(ret); } | /**
* Gets the task ids allocated for the given component id. The task ids are
* always returned in ascending order.
*/ | Gets the task ids allocated for the given component id. The task ids are always returned in ascending order | getComponentTasks | {
"repo_name": "javelinjs/storm",
"path": "src/jvm/backtype/storm/task/TopologyContext.java",
"license": "epl-1.0",
"size": 12797
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 715,360 |
private static void link(final ITreeNode<CTag> parent, final ITreeNode<CTag> child) {
child.setParent(parent);
parent.addChild(child);
} | static void function(final ITreeNode<CTag> parent, final ITreeNode<CTag> child) { child.setParent(parent); parent.addChild(child); } | /**
* Connects a parent node with a child node.
*
* @param parent The parent node.
* @param child The child node.
*/ | Connects a parent node with a child node | link | {
"repo_name": "dgrif/binnavi",
"path": "src/main/java/com/google/security/zynamics/binnavi/Tagging/CTagManager.java",
"license": "apache-2.0",
"size": 9521
} | [
"com.google.security.zynamics.zylib.types.trees.ITreeNode"
] | import com.google.security.zynamics.zylib.types.trees.ITreeNode; | import com.google.security.zynamics.zylib.types.trees.*; | [
"com.google.security"
] | com.google.security; | 2,902,231 |
protected static boolean isConnected(ParsedResponse response) {
return response.getResponseCode() == 204;
} | static boolean function(ParsedResponse response) { return response.getResponseCode() == 204; } | /**
* Checks ParsedResponse to be a valid generate_204 response.
* @return True if generate_204 response is valid; otherwise, false is returned.
*/ | Checks ParsedResponse to be a valid generate_204 response | isConnected | {
"repo_name": "TheDrHax/mosmetro-android",
"path": "app/src/main/java/pw/thedrhax/mosmetro/authenticator/Provider.java",
"license": "gpl-3.0",
"size": 11778
} | [
"pw.thedrhax.mosmetro.httpclient.ParsedResponse"
] | import pw.thedrhax.mosmetro.httpclient.ParsedResponse; | import pw.thedrhax.mosmetro.httpclient.*; | [
"pw.thedrhax.mosmetro"
] | pw.thedrhax.mosmetro; | 1,706,002 |
public static String generatePassword(int length, String combination)
{
char[] charArray = combination.toCharArray();
StringBuilder sb = new StringBuilder(length);
Random random = new Random();
for (int i = 0, n = charArray.length; i < length; i++)
{
sb.append(charArray[random.nextInt(n)]);
}
return sb.toString();
}
| static String function(int length, String combination) { char[] charArray = combination.toCharArray(); StringBuilder sb = new StringBuilder(length); Random random = new Random(); for (int i = 0, n = charArray.length; i < length; i++) { sb.append(charArray[random.nextInt(n)]); } return sb.toString(); } | /**
* Generates a random password of length equal to {@code length},
* consisting only of the characters contained in {@code combination}.
*
* <p> If {@code combination} contains more than one occurrence of a character,
* the overall probability of using it in password generation will be higher.
*
* @param length the desired password length.
* @param combination the letterset used in the generation process.
*
* @return the generated password.
*/ | Generates a random password of length equal to length, consisting only of the characters contained in combination. If combination contains more than one occurrence of a character, the overall probability of using it in password generation will be higher | generatePassword | {
"repo_name": "EastWestFM/logit",
"path": "src/main/java/io/github/lucaseasedup/logit/security/SecurityHelper.java",
"license": "gpl-3.0",
"size": 13520
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 2,198,588 |
Collection<ClusterNode> aliveNodesWithCaches(final long topVer) {
return filter(topVer, aliveNodesWithCaches);
} | Collection<ClusterNode> aliveNodesWithCaches(final long topVer) { return filter(topVer, aliveNodesWithCaches); } | /**
* Gets all alive remote nodes with at least one cache configured.
*
* @param topVer Topology version.
* @return Collection of nodes.
*/ | Gets all alive remote nodes with at least one cache configured | aliveNodesWithCaches | {
"repo_name": "leveyj/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/managers/discovery/GridDiscoveryManager.java",
"license": "apache-2.0",
"size": 112502
} | [
"java.util.Collection",
"org.apache.ignite.cluster.ClusterNode"
] | import java.util.Collection; import org.apache.ignite.cluster.ClusterNode; | import java.util.*; import org.apache.ignite.cluster.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 1,850,166 |
@Override
public boolean isSingular() {
for( int i = 0; i < m; i++ ) {
if( Math.abs(dataLU[i* n +i]) < UtilEjml.EPS )
return true;
}
return false;
} | boolean function() { for( int i = 0; i < m; i++ ) { if( Math.abs(dataLU[i* n +i]) < UtilEjml.EPS ) return true; } return false; } | /**
* Determines if the decomposed matrix is singular. This function can return
* false and the matrix be almost singular, which is still bad.
*
* @return true if singular false otherwise.
*/ | Determines if the decomposed matrix is singular. This function can return false and the matrix be almost singular, which is still bad | isSingular | {
"repo_name": "phuongtg/efficient-java-matrix-library",
"path": "src/org/ejml/alg/dense/decomposition/lu/LUDecompositionBase_D64.java",
"license": "apache-2.0",
"size": 6536
} | [
"org.ejml.UtilEjml"
] | import org.ejml.UtilEjml; | import org.ejml.*; | [
"org.ejml"
] | org.ejml; | 2,391,978 |
public final void randomSeed(final long seed) {
// internal random number object
if (internalRandom == null) {
internalRandom = new Random();
}
internalRandom.setSeed(seed);
}
// ////////////////////////////////////////////////////////////
// PERLIN NOISE
// [toxi 040903]
// octaves and amplitude amount per octave are now user controlled
// via the noiseDetail() function.
// [toxi 030902]
// cleaned up code and now using bagel's cosine table to speed up
// [toxi 030901]
// implementation by the german demo group farbrausch
// as used in their demo "art": http://www.farb-rausch.de/fr010src.zip
static final int PERLIN_YWRAPB = 4;
static final int PERLIN_YWRAP = 1 << PApplet.PERLIN_YWRAPB;
static final int PERLIN_ZWRAPB = 8;
static final int PERLIN_ZWRAP = 1 << PApplet.PERLIN_ZWRAPB;
static final int PERLIN_SIZE = 4095;
int perlin_octaves = 4; // default to medium smooth
double perlin_amp_falloff = 0.5f; // 50% reduction/octave
// [toxi 031112]
// new vars needed due to recent change of cos table in PGraphics
int perlin_TWOPI, perlin_PI;
double[] perlin_cosTable;
double[] perlin;
Random perlinRandom; | final void function(final long seed) { if (internalRandom == null) { internalRandom = new Random(); } internalRandom.setSeed(seed); } static final int PERLIN_YWRAPB = 4; static final int PERLIN_YWRAP = 1 << PApplet.PERLIN_YWRAPB; static final int PERLIN_ZWRAPB = 8; static final int PERLIN_ZWRAP = 1 << PApplet.PERLIN_ZWRAPB; static final int PERLIN_SIZE = 4095; int perlin_octaves = 4; double perlin_amp_falloff = 0.5f; int perlin_TWOPI, perlin_PI; double[] perlin_cosTable; double[] perlin; Random perlinRandom; | /**
* ( begin auto-generated from randomSeed.xml ) Sets the seed value for <b>random()</b>. By
* default, <b>random()</b> produces different results each time the program is run. Set the
* <b>value</b> parameter to a constant to return the same pseudo-random numbers each time the
* software is run. ( end auto-generated )
*
* @webref math:random
* @param seed
* seed value
* @see PApplet#random(double,double)
* @see PApplet#noise(double, double, double)
* @see PApplet#noiseSeed(long)
*/ | ( begin auto-generated from randomSeed.xml ) Sets the seed value for random(). By default, random() produces different results each time the program is run. Set the value parameter to a constant to return the same pseudo-random numbers each time the software is run. ( end auto-generated ) | randomSeed | {
"repo_name": "aarongolliver/FractalFlameV3",
"path": "src/processing/core/PApplet.java",
"license": "lgpl-2.1",
"size": 507010
} | [
"java.util.Random"
] | import java.util.Random; | import java.util.*; | [
"java.util"
] | java.util; | 48,802 |
public List<com.mozu.api.contracts.pricingruntime.TaxableOrder> getTaxableOrders(String orderId) throws Exception
{
MozuClient<List<com.mozu.api.contracts.pricingruntime.TaxableOrder>> client = com.mozu.api.clients.commerce.OrderClient.getTaxableOrdersClient( orderId);
client.setContext(_apiContext);
client.executeRequest();
return client.getResult();
} | List<com.mozu.api.contracts.pricingruntime.TaxableOrder> function(String orderId) throws Exception { MozuClient<List<com.mozu.api.contracts.pricingruntime.TaxableOrder>> client = com.mozu.api.clients.commerce.OrderClient.getTaxableOrdersClient( orderId); client.setContext(_apiContext); client.executeRequest(); return client.getResult(); } | /**
* Retrieves an order for the purpose of splitting it into multiple taxable orders in order to fulfill the order in multiple locations.
* <p><pre><code>
* Order order = new Order();
* TaxableOrder taxableOrder = order.getTaxableOrders( orderId);
* </code></pre></p>
* @param orderId Unique identifier of the order.
* @return List<com.mozu.api.contracts.pricingruntime.TaxableOrder>
* @see com.mozu.api.contracts.pricingruntime.TaxableOrder
*/ | Retrieves an order for the purpose of splitting it into multiple taxable orders in order to fulfill the order in multiple locations. <code><code> Order order = new Order(); TaxableOrder taxableOrder = order.getTaxableOrders( orderId); </code></code> | getTaxableOrders | {
"repo_name": "lakshmi-nair/mozu-java",
"path": "mozu-java-core/src/main/java/com/mozu/api/resources/commerce/OrderResource.java",
"license": "mit",
"size": 25653
} | [
"com.mozu.api.MozuClient",
"java.util.List"
] | import com.mozu.api.MozuClient; import java.util.List; | import com.mozu.api.*; import java.util.*; | [
"com.mozu.api",
"java.util"
] | com.mozu.api; java.util; | 1,710,646 |
@Test
public void liesPointInfunction() {
Point point = new Point(1, 3);
boolean result = point.is(1, 2);
boolean expected = true;
assertThat(result, is(expected));
} | void function() { Point point = new Point(1, 3); boolean result = point.is(1, 2); boolean expected = true; assertThat(result, is(expected)); } | /**
* Test add.
*/ | Test add | liesPointInfunction | {
"repo_name": "Strepped/yvlasov",
"path": "chapter_001/src/test/java/ru/job4j/condition/PointTest.java",
"license": "apache-2.0",
"size": 469
} | [
"org.hamcrest.core.Is",
"org.junit.Assert"
] | import org.hamcrest.core.Is; import org.junit.Assert; | import org.hamcrest.core.*; import org.junit.*; | [
"org.hamcrest.core",
"org.junit"
] | org.hamcrest.core; org.junit; | 657,249 |
@ServiceMethod(returns = ReturnType.SINGLE)
Response<PrivateEndpointConnectionListResultInner> listWithResponse(
String resourceGroupName, String accountName, Context context); | @ServiceMethod(returns = ReturnType.SINGLE) Response<PrivateEndpointConnectionListResultInner> listWithResponse( String resourceGroupName, String accountName, Context context); | /**
* Get all private endpoint connections.
*
* @param resourceGroupName The name of the resource group within the Azure subscription.
* @param accountName The Media Services account name.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return all private endpoint connections.
*/ | Get all private endpoint connections | listWithResponse | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/mediaservices/azure-resourcemanager-mediaservices/src/main/java/com/azure/resourcemanager/mediaservices/fluent/PrivateEndpointConnectionsClient.java",
"license": "mit",
"size": 7300
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.core.http.rest.Response",
"com.azure.core.util.Context",
"com.azure.resourcemanager.mediaservices.fluent.models.PrivateEndpointConnectionListResultInner"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.mediaservices.fluent.models.PrivateEndpointConnectionListResultInner; | import com.azure.core.annotation.*; import com.azure.core.http.rest.*; import com.azure.core.util.*; import com.azure.resourcemanager.mediaservices.fluent.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 605,797 |
public static QueryRescorerBuilder randomRescoreBuilder() {
QueryBuilder queryBuilder = new MatchAllQueryBuilder().boost(randomFloat())
.queryName(randomAsciiOfLength(20));
org.elasticsearch.search.rescore.QueryRescorerBuilder rescorer = new
org.elasticsearch.search.rescore.QueryRescorerBuilder(queryBuilder);
if (randomBoolean()) {
rescorer.setQueryWeight(randomFloat());
}
if (randomBoolean()) {
rescorer.setRescoreQueryWeight(randomFloat());
}
if (randomBoolean()) {
rescorer.setScoreMode(randomFrom(QueryRescoreMode.values()));
}
if (randomBoolean()) {
rescorer.windowSize(randomIntBetween(0, 100));
}
return rescorer;
} | static QueryRescorerBuilder function() { QueryBuilder queryBuilder = new MatchAllQueryBuilder().boost(randomFloat()) .queryName(randomAsciiOfLength(20)); org.elasticsearch.search.rescore.QueryRescorerBuilder rescorer = new org.elasticsearch.search.rescore.QueryRescorerBuilder(queryBuilder); if (randomBoolean()) { rescorer.setQueryWeight(randomFloat()); } if (randomBoolean()) { rescorer.setRescoreQueryWeight(randomFloat()); } if (randomBoolean()) { rescorer.setScoreMode(randomFrom(QueryRescoreMode.values())); } if (randomBoolean()) { rescorer.windowSize(randomIntBetween(0, 100)); } return rescorer; } | /**
* create random shape that is put under test
*/ | create random shape that is put under test | randomRescoreBuilder | {
"repo_name": "cwurm/elasticsearch",
"path": "core/src/test/java/org/elasticsearch/search/rescore/QueryRescoreBuilderTests.java",
"license": "apache-2.0",
"size": 16433
} | [
"org.elasticsearch.index.query.MatchAllQueryBuilder",
"org.elasticsearch.index.query.QueryBuilder"
] | import org.elasticsearch.index.query.MatchAllQueryBuilder; import org.elasticsearch.index.query.QueryBuilder; | import org.elasticsearch.index.query.*; | [
"org.elasticsearch.index"
] | org.elasticsearch.index; | 1,091,561 |
public static synchronized void initialize(final Context context, int id) {
schedulePeriodic(context, id);
syncImmediately(context);
} | static synchronized void function(final Context context, int id) { schedulePeriodic(context, id); syncImmediately(context); } | /**
* Shorthand method to initialize a job schedule
*
* @param context
* @param id univocal integer for the job builder object
*/ | Shorthand method to initialize a job schedule | initialize | {
"repo_name": "gianpierobozza/stockhawk-udacity",
"path": "app/src/main/java/com/gbozza/android/stockhawk/sync/QuoteSyncJob.java",
"license": "apache-2.0",
"size": 6745
} | [
"android.content.Context"
] | import android.content.Context; | import android.content.*; | [
"android.content"
] | android.content; | 820,284 |
private boolean isOnBlockList(WebsitePreference website) {
BrowserContextHandle browserContextHandle =
getSiteSettingsDelegate().getBrowserContextHandle();
for (@SiteSettingsCategory.Type int i = 0; i < SiteSettingsCategory.Type.NUM_ENTRIES; i++) {
if (!mCategory.showSites(i)) continue;
@ContentSettingValues
Integer contentSetting = website.site().getContentSetting(
browserContextHandle, SiteSettingsCategory.contentSettingsType(i));
if (contentSetting != null) {
return ContentSettingValues.BLOCK == contentSetting;
}
}
return false;
} | boolean function(WebsitePreference website) { BrowserContextHandle browserContextHandle = getSiteSettingsDelegate().getBrowserContextHandle(); for (@SiteSettingsCategory.Type int i = 0; i < SiteSettingsCategory.Type.NUM_ENTRIES; i++) { if (!mCategory.showSites(i)) continue; Integer contentSetting = website.site().getContentSetting( browserContextHandle, SiteSettingsCategory.contentSettingsType(i)); if (contentSetting != null) { return ContentSettingValues.BLOCK == contentSetting; } } return false; } | /**
* Returns whether a website is on the Blocked list for the category currently showing.
* @param website The website to check.
*/ | Returns whether a website is on the Blocked list for the category currently showing | isOnBlockList | {
"repo_name": "nwjs/chromium.src",
"path": "components/browser_ui/site_settings/android/java/src/org/chromium/components/browser_ui/site_settings/SingleCategorySettings.java",
"license": "bsd-3-clause",
"size": 55802
} | [
"org.chromium.components.content_settings.ContentSettingValues",
"org.chromium.content_public.browser.BrowserContextHandle"
] | import org.chromium.components.content_settings.ContentSettingValues; import org.chromium.content_public.browser.BrowserContextHandle; | import org.chromium.components.content_settings.*; import org.chromium.content_public.browser.*; | [
"org.chromium.components",
"org.chromium.content_public"
] | org.chromium.components; org.chromium.content_public; | 1,175,245 |
@Override
public boolean isItemValidForSlot(int slot, ItemStack stack){
for(ItemStack blacklistedStack : camouflageBlacklist) {
if(blacklistedStack.isItemEqual(stack)) return false;
}
return stack != null && stack.getItem() instanceof ItemBlock;
} | boolean function(int slot, ItemStack stack){ for(ItemStack blacklistedStack : camouflageBlacklist) { if(blacklistedStack.isItemEqual(stack)) return false; } return stack != null && stack.getItem() instanceof ItemBlock; } | /**
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/ | Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot | isItemValidForSlot | {
"repo_name": "MineMaarten/AdvancedMod",
"path": "src/main/java/com/minemaarten/advancedmod/tileentity/TileEntityCamoMine.java",
"license": "gpl-3.0",
"size": 7986
} | [
"net.minecraft.item.ItemBlock",
"net.minecraft.item.ItemStack"
] | import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; | import net.minecraft.item.*; | [
"net.minecraft.item"
] | net.minecraft.item; | 59,823 |
@Override
public boolean deleteSelectedFields(ArbilTable table) {
final ArbilField[] selectedFields = table.getSelectedFields();
if (selectedFields != null) {
return deleteFields(Arrays.asList(selectedFields));
} else {
return false;
}
} | boolean function(ArbilTable table) { final ArbilField[] selectedFields = table.getSelectedFields(); if (selectedFields != null) { return deleteFields(Arrays.asList(selectedFields)); } else { return false; } } | /**
* Deletes the fields selected in the provided table from their parent nodes
*
* @param table table to get selection from
* @return whether deletion was carried out
*/ | Deletes the fields selected in the provided table from their parent nodes | deleteSelectedFields | {
"repo_name": "TheLanguageArchive/Arbil",
"path": "arbil/src/main/java/nl/mpi/arbil/ui/ArbilTableController.java",
"license": "agpl-3.0",
"size": 28530
} | [
"java.util.Arrays",
"nl.mpi.arbil.data.ArbilField"
] | import java.util.Arrays; import nl.mpi.arbil.data.ArbilField; | import java.util.*; import nl.mpi.arbil.data.*; | [
"java.util",
"nl.mpi.arbil"
] | java.util; nl.mpi.arbil; | 840,898 |
public DistributedLockService getLockService()
{
synchronized (this.dlockMonitor) {
// Assert.assertTrue(this.scope.isGlobal()); since 7.0 this is used for distributing clear() ops
String svcName = getFullPath();
if (this.dlockService == null) {
this.dlockService = DistributedLockService.getServiceNamed(svcName);
if (this.dlockService == null) {
this.dlockService = DLockService.create(
getFullPath(),
getSystem(),
true ,
false , // region destroy will destroy dls
false ); // manual freeResources only
}
// handle is-lock-grantor region attribute...
if (this.isLockGrantor) {
this.dlockService.becomeLockGrantor();
}
if (logger.isDebugEnabled()) {
logger.debug("LockService for {} is using LockLease={}, LockTimeout=", svcName, getCache().getLockLease(), getCache().getLockTimeout());
}
}
return this.dlockService;
}
} | DistributedLockService function() { synchronized (this.dlockMonitor) { String svcName = getFullPath(); if (this.dlockService == null) { this.dlockService = DistributedLockService.getServiceNamed(svcName); if (this.dlockService == null) { this.dlockService = DLockService.create( getFullPath(), getSystem(), true , false , false ); } if (this.isLockGrantor) { this.dlockService.becomeLockGrantor(); } if (logger.isDebugEnabled()) { logger.debug(STR, svcName, getCache().getLockLease(), getCache().getLockTimeout()); } } return this.dlockService; } } | /**
* Return the DistributedLockService associated with this Region. This method
* will lazily create that service the first time it is invoked on this
* region.
*/ | Return the DistributedLockService associated with this Region. This method will lazily create that service the first time it is invoked on this region | getLockService | {
"repo_name": "robertgeiger/incubator-geode",
"path": "gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/DistributedRegion.java",
"license": "apache-2.0",
"size": 162027
} | [
"com.gemstone.gemfire.distributed.DistributedLockService",
"com.gemstone.gemfire.distributed.internal.locks.DLockService"
] | import com.gemstone.gemfire.distributed.DistributedLockService; import com.gemstone.gemfire.distributed.internal.locks.DLockService; | import com.gemstone.gemfire.distributed.*; import com.gemstone.gemfire.distributed.internal.locks.*; | [
"com.gemstone.gemfire"
] | com.gemstone.gemfire; | 1,289,474 |
@NotNull
Set<Class> getToolingExtensionsClasses(); | Set<Class> getToolingExtensionsClasses(); | /**
* add paths containing these classes to classpath of gradle tooling extension
*
* @return classes to be available for gradle
*/ | add paths containing these classes to classpath of gradle tooling extension | getToolingExtensionsClasses | {
"repo_name": "caot/intellij-community",
"path": "plugins/gradle/src/org/jetbrains/plugins/gradle/service/project/GradleProjectResolverExtension.java",
"license": "apache-2.0",
"size": 5203
} | [
"java.util.Set"
] | import java.util.Set; | import java.util.*; | [
"java.util"
] | java.util; | 1,029,345 |
public RowMetaInterface getThisStepFields(StepMeta stepMeta,
StepMeta nextStep, RowMetaInterface row,
ProgressMonitorListener monitor) throws KettleStepException {
// Then this one.
if (log.isDebug())
log
.logDebug(
toString(),
Messages
.getString(
"TransMeta.Log.GettingFieldsFromStep", stepMeta.getName(), stepMeta.getStepID())); //$NON-NLS-1$ //$NON-NLS-2$
String name = stepMeta.getName();
if (monitor != null) {
monitor.subTask(Messages.getString(
"TransMeta.Monitor.GettingFieldsFromStepTask.Title", name)); //$NON-NLS-1$ //$NON-NLS-2$
}
StepMetaInterface stepint = stepMeta.getStepMetaInterface();
RowMetaInterface inform[] = null;
StepMeta[] lu = getInfoStep(stepMeta);
if (Const.isEmpty(lu)) {
inform = new RowMetaInterface[] { stepint.getTableFields(), };
} else {
inform = new RowMetaInterface[lu.length];
for (int i = 0; i < lu.length; i++)
inform[i] = getStepFields(lu[i]);
}
// Set the Repository object on the Mapping step
// That way the mapping step can determine the output fields for
// repository hosted mappings...
// This is the exception to the rule so we don't pass this through the
// getFields() method.
//
for (StepMeta step : steps) {
if (step.getStepMetaInterface() instanceof MappingMeta) {
((MappingMeta) step.getStepMetaInterface())
.setRepository(repository);
}
}
// Go get the fields...
//
stepint.getFields(row, name, inform, nextStep, this);
return row;
} | RowMetaInterface function(StepMeta stepMeta, StepMeta nextStep, RowMetaInterface row, ProgressMonitorListener monitor) throws KettleStepException { if (log.isDebug()) log .logDebug( toString(), Messages .getString( STR, stepMeta.getName(), stepMeta.getStepID())); String name = stepMeta.getName(); if (monitor != null) { monitor.subTask(Messages.getString( STR, name)); } StepMetaInterface stepint = stepMeta.getStepMetaInterface(); RowMetaInterface inform[] = null; StepMeta[] lu = getInfoStep(stepMeta); if (Const.isEmpty(lu)) { inform = new RowMetaInterface[] { stepint.getTableFields(), }; } else { inform = new RowMetaInterface[lu.length]; for (int i = 0; i < lu.length; i++) inform[i] = getStepFields(lu[i]); } if (step.getStepMetaInterface() instanceof MappingMeta) { ((MappingMeta) step.getStepMetaInterface()) .setRepository(repository); } } return row; } | /**
* Returns the fields that are emitted by a step
*
* @param stepMeta :
* The StepMeta object that's being queried
* @param nextStep :
* if non-null this is the next step that's call back to ask
* what's being sent
* @param row :
* A row containing the input fields or an empty row if no input
* is required.
*
* @return A Row containing the output fields.
*/ | Returns the fields that are emitted by a step | getThisStepFields | {
"repo_name": "panbasten/imeta",
"path": "imeta2.x/imeta-src/imeta/src/main/java/com/panet/imeta/trans/TransMeta.java",
"license": "gpl-2.0",
"size": 209743
} | [
"com.panet.imeta.core.Const",
"com.panet.imeta.core.ProgressMonitorListener",
"com.panet.imeta.core.exception.KettleStepException",
"com.panet.imeta.core.row.RowMetaInterface",
"com.panet.imeta.trans.step.StepMeta",
"com.panet.imeta.trans.step.StepMetaInterface",
"com.panet.imeta.trans.steps.mapping.MappingMeta"
] | import com.panet.imeta.core.Const; import com.panet.imeta.core.ProgressMonitorListener; import com.panet.imeta.core.exception.KettleStepException; import com.panet.imeta.core.row.RowMetaInterface; import com.panet.imeta.trans.step.StepMeta; import com.panet.imeta.trans.step.StepMetaInterface; import com.panet.imeta.trans.steps.mapping.MappingMeta; | import com.panet.imeta.core.*; import com.panet.imeta.core.exception.*; import com.panet.imeta.core.row.*; import com.panet.imeta.trans.step.*; import com.panet.imeta.trans.steps.mapping.*; | [
"com.panet.imeta"
] | com.panet.imeta; | 2,303,837 |
public Integer existOption(int idVariable, String option) {
try {
StringBuffer sql = new StringBuffer();
sql.append("SELECT " + TablasBD.TABLE_OPTIONS_ID + " ");
sql.append("FROM " + TablasBD.TABLE_OPTIONS + " ");
sql.append("WHERE " + TablasBD.TABLE_OPTIONS_VARIABLE_ID + " = ? and " + TablasBD.TABLE_OPTIONS_OPTION + " =?");
Object[] parametros;
parametros = new Object[] { idVariable, option };
Integer id = jdbcTemplate.queryForObject(sql.toString(), parametros, Integer.class);
System.out.println("exist option: " + sql.toString());
System.out.println("exist option id: " + id);
return id;
} catch (EmptyResultDataAccessException e) {
System.out.println(e);
return -1;
}
} | Integer function(int idVariable, String option) { try { StringBuffer sql = new StringBuffer(); sql.append(STR + TablasBD.TABLE_OPTIONS_ID + " "); sql.append(STR + TablasBD.TABLE_OPTIONS + " "); sql.append(STR + TablasBD.TABLE_OPTIONS_VARIABLE_ID + STR + TablasBD.TABLE_OPTIONS_OPTION + STR); Object[] parametros; parametros = new Object[] { idVariable, option }; Integer id = jdbcTemplate.queryForObject(sql.toString(), parametros, Integer.class); System.out.println(STR + sql.toString()); System.out.println(STR + id); return id; } catch (EmptyResultDataAccessException e) { System.out.println(e); return -1; } } | /**
* Metodo que consulta si una variable tiene la opcion option
*
* @param idvariable Identificador de la variable a consultar
* @param option Cadena de caracteres a consultar si existe como opcion de la variable
* @return Identificador de la opcion. Si no existe la opcion -1
*/ | Metodo que consulta si una variable tiene la opcion option | existOption | {
"repo_name": "cictourgune/EmocionometroWeb",
"path": "src/org/tourgune/apptrack/dao/SDKDao.java",
"license": "apache-2.0",
"size": 19124
} | [
"org.springframework.dao.EmptyResultDataAccessException",
"org.tourgune.apptrack.utils.TablasBD"
] | import org.springframework.dao.EmptyResultDataAccessException; import org.tourgune.apptrack.utils.TablasBD; | import org.springframework.dao.*; import org.tourgune.apptrack.utils.*; | [
"org.springframework.dao",
"org.tourgune.apptrack"
] | org.springframework.dao; org.tourgune.apptrack; | 55,933 |
public java.util.List<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI> getSubterm_cyclicEnumerations_PredecessorHLAPI(){
java.util.List<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI>();
for (Term elemnt : getSubterm()) {
if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.cyclicEnumerations.impl.PredecessorImpl.class)){
retour.add(new fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI(
(fr.lip6.move.pnml.hlpn.cyclicEnumerations.Predecessor)elemnt
));
}
}
return retour;
}
| java.util.List<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI> function(){ java.util.List<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI> retour = new ArrayList<fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI>(); for (Term elemnt : getSubterm()) { if(elemnt.getClass().equals(fr.lip6.move.pnml.hlpn.cyclicEnumerations.impl.PredecessorImpl.class)){ retour.add(new fr.lip6.move.pnml.hlpn.cyclicEnumerations.hlapi.PredecessorHLAPI( (fr.lip6.move.pnml.hlpn.cyclicEnumerations.Predecessor)elemnt )); } } return retour; } | /**
* This accessor return a list of encapsulated subelement, only of PredecessorHLAPI kind.
* WARNING : this method can creates a lot of new object in memory.
*/ | This accessor return a list of encapsulated subelement, only of PredecessorHLAPI kind. WARNING : this method can creates a lot of new object in memory | getSubterm_cyclicEnumerations_PredecessorHLAPI | {
"repo_name": "lhillah/pnmlframework",
"path": "pnmlFw-HLPN/src/fr/lip6/move/pnml/hlpn/booleans/hlapi/InequalityHLAPI.java",
"license": "epl-1.0",
"size": 108490
} | [
"fr.lip6.move.pnml.hlpn.terms.Term",
"java.util.ArrayList",
"java.util.List"
] | import fr.lip6.move.pnml.hlpn.terms.Term; import java.util.ArrayList; import java.util.List; | import fr.lip6.move.pnml.hlpn.terms.*; import java.util.*; | [
"fr.lip6.move",
"java.util"
] | fr.lip6.move; java.util; | 1,910,146 |
public static String get(Type type, Annotation[] annotations, Object subject) {
return get(type, extractQualifier(annotations, subject));
}
/**
* Validates that among {@code annotations} there exists only one annotation which is, itself
* qualified by {@code \@Qualifier} | static String function(Type type, Annotation[] annotations, Object subject) { return get(type, extractQualifier(annotations, subject)); } /** * Validates that among {@code annotations} there exists only one annotation which is, itself * qualified by {@code \@Qualifier} | /**
* Returns a key for {@code type} annotated with {@code annotations},
* reporting failures against {@code subject}.
*
* @param annotations the annotations on a single method, field or parameter.
* This array may contain at most one qualifier annotation.
*/ | Returns a key for type annotated with annotations, reporting failures against subject | get | {
"repo_name": "vamsirajendra/dagger",
"path": "core/src/main/java/dagger/internal/Keys.java",
"license": "apache-2.0",
"size": 10204
} | [
"java.lang.annotation.Annotation",
"java.lang.reflect.Type",
"javax.inject.Qualifier"
] | import java.lang.annotation.Annotation; import java.lang.reflect.Type; import javax.inject.Qualifier; | import java.lang.annotation.*; import java.lang.reflect.*; import javax.inject.*; | [
"java.lang",
"javax.inject"
] | java.lang; javax.inject; | 1,057,932 |
public void setResource(Resource resource) {
this.resource = resource;
} | void function(Resource resource) { this.resource = resource; } | /**
* Sets the resource
*
* @param resource
*/ | Sets the resource | setResource | {
"repo_name": "tamerman/mobile-starting-framework",
"path": "maps/impl/src/test/java/org/kuali/mobility/maps/service/helper/URLHelper.java",
"license": "mit",
"size": 1910
} | [
"org.springframework.core.io.Resource"
] | import org.springframework.core.io.Resource; | import org.springframework.core.io.*; | [
"org.springframework.core"
] | org.springframework.core; | 1,195,416 |
private static <T, I> void takeLoop(
IChannel<T, I> channel,
AsyncCompletionHandler<T> asyncCompletionHandler,
Completion completion
) {
if (!channel.isClosed()) {
channel.take().whenComplete((res, err) -> {
if (res == null && err == null) {
completion.exceptionally(
new AsyncException("No response, no error in result of completable future.")
);
}
try {
final ITryM<T> result = res != null ? TryMOps.success(res) : TryMOps.fail(err);
asyncCompletionHandler.handle(result, completion);
} catch (Throwable t) {
completion.exceptionally(t);
return;
}
if (!completion.isDone()) {
takeLoop(channel, asyncCompletionHandler, completion);
} else {
completion.complete();
}
});
} else {
completion.complete();
}
} | static <T, I> void function( IChannel<T, I> channel, AsyncCompletionHandler<T> asyncCompletionHandler, Completion completion ) { if (!channel.isClosed()) { channel.take().whenComplete((res, err) -> { if (res == null && err == null) { completion.exceptionally( new AsyncException(STR) ); } try { final ITryM<T> result = res != null ? TryMOps.success(res) : TryMOps.fail(err); asyncCompletionHandler.handle(result, completion); } catch (Throwable t) { completion.exceptionally(t); return; } if (!completion.isDone()) { takeLoop(channel, asyncCompletionHandler, completion); } else { completion.complete(); } }); } else { completion.complete(); } } | /**
* Take loop.
*/ | Take loop | takeLoop | {
"repo_name": "xdcrafts/swarm",
"path": "src/main/java/com/github/xdcrafts/swarm/async/Async.java",
"license": "apache-2.0",
"size": 10652
} | [
"com.github.xdcrafts.swarm.javaz.trym.ITryM",
"com.github.xdcrafts.swarm.javaz.trym.TryMOps"
] | import com.github.xdcrafts.swarm.javaz.trym.ITryM; import com.github.xdcrafts.swarm.javaz.trym.TryMOps; | import com.github.xdcrafts.swarm.javaz.trym.*; | [
"com.github.xdcrafts"
] | com.github.xdcrafts; | 143,640 |
public CompletableFuture<Void> closePoolLedger(
) throws IndyException {
return closePoolLedger(this);
} | CompletableFuture<Void> function( ) throws IndyException { return closePoolLedger(this); } | /**
* Closes opened pool ledger, opened nodes connections and frees allocated resources.
*
* @return A future that does not resolve a value.
* @throws IndyException Thrown if an error occurs when calling the underlying SDK.
*/ | Closes opened pool ledger, opened nodes connections and frees allocated resources | closePoolLedger | {
"repo_name": "srottem/indy-sdk",
"path": "wrappers/java/src/main/java/org/hyperledger/indy/sdk/pool/Pool.java",
"license": "apache-2.0",
"size": 7788
} | [
"java.util.concurrent.CompletableFuture",
"org.hyperledger.indy.sdk.IndyException"
] | import java.util.concurrent.CompletableFuture; import org.hyperledger.indy.sdk.IndyException; | import java.util.concurrent.*; import org.hyperledger.indy.sdk.*; | [
"java.util",
"org.hyperledger.indy"
] | java.util; org.hyperledger.indy; | 2,447,321 |
public NumberDataValue divide(NumberDataValue dividend,
NumberDataValue divisor,
NumberDataValue result)
throws StandardException
{
if (result == null)
{
result = new SQLDouble();
}
if (dividend.isNull() || divisor.isNull())
{
result.setToNull();
return result;
}
double divisorValue = divisor.getDouble();
if (divisorValue == 0.0e0D)
{
throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO);
}
double dividendValue = dividend.getDouble();
double divideResult = dividendValue / divisorValue;
if (Double.isNaN(divideResult))
{
throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO);
}
// check underflow (result rounded to 0.0d)
if ((divideResult == 0.0d) && (dividendValue != 0.0d)) {
throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.DOUBLE_NAME);
}
result.setValue(divideResult);
return result;
} | NumberDataValue function(NumberDataValue dividend, NumberDataValue divisor, NumberDataValue result) throws StandardException { if (result == null) { result = new SQLDouble(); } if (dividend.isNull() divisor.isNull()) { result.setToNull(); return result; } double divisorValue = divisor.getDouble(); if (divisorValue == 0.0e0D) { throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO); } double dividendValue = dividend.getDouble(); double divideResult = dividendValue / divisorValue; if (Double.isNaN(divideResult)) { throw StandardException.newException(SQLState.LANG_DIVIDE_BY_ZERO); } if ((divideResult == 0.0d) && (dividendValue != 0.0d)) { throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, TypeId.DOUBLE_NAME); } result.setValue(divideResult); return result; } | /**
* This method implements the / operator for "double / double".
*
* @param dividend The numerator
* @param divisor The denominator
* @param result The result of a previous call to this method, null
* if not called yet
*
* @return A SQLDouble containing the result of the division
*
* @exception StandardException Thrown on error
*/ | This method implements the / operator for "double / double" | divide | {
"repo_name": "viaper/DBPlus",
"path": "DerbyHodgepodge/java/engine/org/apache/derby/iapi/types/SQLDouble.java",
"license": "apache-2.0",
"size": 22814
} | [
"org.apache.derby.iapi.error.StandardException",
"org.apache.derby.iapi.reference.SQLState"
] | import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.SQLState; | import org.apache.derby.iapi.error.*; import org.apache.derby.iapi.reference.*; | [
"org.apache.derby"
] | org.apache.derby; | 2,231,101 |
myView.getChildren().clear();
List<String[]> instructions = commandsList.generate();
for (String s : instructions.get(0)) {
addTextBox(s);
}
} | myView.getChildren().clear(); List<String[]> instructions = commandsList.generate(); for (String s : instructions.get(0)) { addTextBox(s); } } | /**
* Updates the view based on the command list from the model.
* @param commandsList Data from the model that stores the commands
*/ | Updates the view based on the command list from the model | update | {
"repo_name": "kevinli194/slogo",
"path": "src/view/BasicCommandsView.java",
"license": "mit",
"size": 902
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 637,345 |
public void removePhysicalPosition(final long iPosition) throws IOException {
final long position = iPosition * RECORD_SIZE;
acquireExclusiveLock();
try {
final long[] pos = fileSegment.getRelativePosition(position);
final OFile file = fileSegment.files[(int) pos[0]];
final long p = pos[1] + OBinaryProtocol.SIZE_SHORT + OBinaryProtocol.SIZE_LONG + OBinaryProtocol.SIZE_BYTE;
holeSegment.pushPosition(position);
// MARK DELETED SETTING VERSION TO NEGATIVE NUMBER
final int version = file.readInt(p);
file.writeInt(p, (version + 1) * -1);
updateBoundsAfterDeletion(iPosition);
} finally {
releaseExclusiveLock();
}
}
| void function(final long iPosition) throws IOException { final long position = iPosition * RECORD_SIZE; acquireExclusiveLock(); try { final long[] pos = fileSegment.getRelativePosition(position); final OFile file = fileSegment.files[(int) pos[0]]; final long p = pos[1] + OBinaryProtocol.SIZE_SHORT + OBinaryProtocol.SIZE_LONG + OBinaryProtocol.SIZE_BYTE; holeSegment.pushPosition(position); final int version = file.readInt(p); file.writeInt(p, (version + 1) * -1); updateBoundsAfterDeletion(iPosition); } finally { releaseExclusiveLock(); } } | /**
* Removes the Logical position entry. Add to the hole segment and add the minus to the version.
*
* @throws IOException
*/ | Removes the Logical position entry. Add to the hole segment and add the minus to the version | removePhysicalPosition | {
"repo_name": "redox/OrientDB",
"path": "core/src/main/java/com/orientechnologies/orient/core/storage/impl/local/OClusterLocal.java",
"license": "apache-2.0",
"size": 20920
} | [
"com.orientechnologies.orient.core.serialization.OBinaryProtocol",
"com.orientechnologies.orient.core.storage.fs.OFile",
"java.io.IOException"
] | import com.orientechnologies.orient.core.serialization.OBinaryProtocol; import com.orientechnologies.orient.core.storage.fs.OFile; import java.io.IOException; | import com.orientechnologies.orient.core.serialization.*; import com.orientechnologies.orient.core.storage.fs.*; import java.io.*; | [
"com.orientechnologies.orient",
"java.io"
] | com.orientechnologies.orient; java.io; | 2,783,839 |
public static HttpResponse executePost(String targetURL, POLICY authPolicy) throws SocialHttpClientException {
return executePost(targetURL, authPolicy, null, null);
}
| static HttpResponse function(String targetURL, POLICY authPolicy) throws SocialHttpClientException { return executePost(targetURL, authPolicy, null, null); } | /**
* Invokes the social rest service via Post but both <code>Model</code> and HttpParams are null.
*
* @param targetURL
* @param authPolicy POLICY.NO_AUTH/POLICY.BASIC_AUTH
* @return
* @throws SocialHttpClientException
*/ | Invokes the social rest service via Post but both <code>Model</code> and HttpParams are null | executePost | {
"repo_name": "hoatle/exo.social.client",
"path": "src/main/java/org/exoplatform/social/client/core/util/SocialHttpClientSupport.java",
"license": "agpl-3.0",
"size": 14341
} | [
"org.apache.http.HttpResponse",
"org.exoplatform.social.client.api.net.SocialHttpClientException"
] | import org.apache.http.HttpResponse; import org.exoplatform.social.client.api.net.SocialHttpClientException; | import org.apache.http.*; import org.exoplatform.social.client.api.net.*; | [
"org.apache.http",
"org.exoplatform.social"
] | org.apache.http; org.exoplatform.social; | 1,513,995 |
public Builder sheet(int id, @NonNull Drawable icon, @NonNull CharSequence text) {
ActionMenuItem item = new ActionMenuItem(context, 0, id, 0, 0, text);
item.setIcon(icon);
menu.add(item);
return this;
} | Builder function(int id, @NonNull Drawable icon, @NonNull CharSequence text) { ActionMenuItem item = new ActionMenuItem(context, 0, id, 0, 0, text); item.setIcon(icon); menu.add(item); return this; } | /**
* Add one item into BottomSheet
*
* @param id ID of item
* @param icon icon
* @param text text
* @return This Builder object to allow for chaining of calls to set methods
*/ | Add one item into BottomSheet | sheet | {
"repo_name": "dkorolev/omim",
"path": "android/3rd_party/BottomSheet/src/main/java/com/cocosw/bottomsheet/BottomSheet.java",
"license": "apache-2.0",
"size": 30552
} | [
"android.graphics.drawable.Drawable",
"android.support.annotation.NonNull"
] | import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; | import android.graphics.drawable.*; import android.support.annotation.*; | [
"android.graphics",
"android.support"
] | android.graphics; android.support; | 321,583 |
public static List<ConfigDescriptionParameterGroupDTO> mapParameterGroups(
List<ConfigDescriptionParameterGroup> parameterGroups) {
List<ConfigDescriptionParameterGroupDTO> parameterGroupBeans = new ArrayList<>(parameterGroups.size());
for (ConfigDescriptionParameterGroup parameterGroup : parameterGroups) {
parameterGroupBeans
.add(new ConfigDescriptionParameterGroupDTO(parameterGroup.getName(), parameterGroup.getContext(),
parameterGroup.isAdvanced(), parameterGroup.getLabel(), parameterGroup.getDescription()));
}
return parameterGroupBeans;
} | static List<ConfigDescriptionParameterGroupDTO> function( List<ConfigDescriptionParameterGroup> parameterGroups) { List<ConfigDescriptionParameterGroupDTO> parameterGroupBeans = new ArrayList<>(parameterGroups.size()); for (ConfigDescriptionParameterGroup parameterGroup : parameterGroups) { parameterGroupBeans .add(new ConfigDescriptionParameterGroupDTO(parameterGroup.getName(), parameterGroup.getContext(), parameterGroup.isAdvanced(), parameterGroup.getLabel(), parameterGroup.getDescription())); } return parameterGroupBeans; } | /**
* Maps config description parameter groups into DTO objects.
*
* @param parameterGroups the config description parameter groups (not null)
*
* @return the parameter group DTO objects (not null)
*/ | Maps config description parameter groups into DTO objects | mapParameterGroups | {
"repo_name": "kdavis-mozilla/smarthome",
"path": "bundles/config/org.eclipse.smarthome.config.core/src/main/java/org/eclipse/smarthome/config/core/dto/ConfigDescriptionDTOMapper.java",
"license": "epl-1.0",
"size": 5325
} | [
"java.util.ArrayList",
"java.util.List",
"org.eclipse.smarthome.config.core.ConfigDescriptionParameterGroup"
] | import java.util.ArrayList; import java.util.List; import org.eclipse.smarthome.config.core.ConfigDescriptionParameterGroup; | import java.util.*; import org.eclipse.smarthome.config.core.*; | [
"java.util",
"org.eclipse.smarthome"
] | java.util; org.eclipse.smarthome; | 2,175,077 |
@Override
default void setPadding(PaddingCallback<AnnotationContext> paddingCallback) {
// checks if handler is consistent
if (getLabelHandler() != null) {
// stores value
getLabelHandler().setPadding(paddingCallback);
}
} | default void setPadding(PaddingCallback<AnnotationContext> paddingCallback) { if (getLabelHandler() != null) { getLabelHandler().setPadding(paddingCallback); } } | /**
* Sets the callback to set the padding of label.
*
* @param paddingCallback to set the padding of label
*/ | Sets the callback to set the padding of label | setPadding | {
"repo_name": "pepstock-org/Charba",
"path": "src/org/pepstock/charba/client/annotation/HasLabel.java",
"license": "apache-2.0",
"size": 20905
} | [
"org.pepstock.charba.client.callbacks.PaddingCallback"
] | import org.pepstock.charba.client.callbacks.PaddingCallback; | import org.pepstock.charba.client.callbacks.*; | [
"org.pepstock.charba"
] | org.pepstock.charba; | 1,406,664 |
public void ignoreUnknownElements(final String pattern) {
ignoreUnknownElements(Pattern.compile(pattern));
} | void function(final String pattern) { ignoreUnknownElements(Pattern.compile(pattern)); } | /**
* Add pattern for unknown element names to ignore.
*
* @param pattern the name pattern as regular expression
* @since 1.4.5
*/ | Add pattern for unknown element names to ignore | ignoreUnknownElements | {
"repo_name": "codehaus/xstream",
"path": "xstream/src/java/com/thoughtworks/xstream/XStream.java",
"license": "bsd-3-clause",
"size": 89379
} | [
"java.util.regex.Pattern"
] | import java.util.regex.Pattern; | import java.util.regex.*; | [
"java.util"
] | java.util; | 2,623,900 |
public float xDistanceToPlayer(Body otherBody){
ArrayList<Collideable> group = groups.get(Type.PLAYER);
for (Collideable collideable : group) {
Player player = (Player)collideable;
return player.body.getCenterX() - otherBody.getCenterX();
}
return 0.0f;
} | float function(Body otherBody){ ArrayList<Collideable> group = groups.get(Type.PLAYER); for (Collideable collideable : group) { Player player = (Player)collideable; return player.body.getCenterX() - otherBody.getCenterX(); } return 0.0f; } | /**
* Checks for collisions against the group of the specified type.
* @param otherBody The {@link Body} the body you want to get the distance to the player.
* @return <tt>true</tt> if a collision happened, <tt>false</tt> if no.
*/ | Checks for collisions against the group of the specified type | xDistanceToPlayer | {
"repo_name": "cs428-dungeon/DungeonRPG",
"path": "core/src/edu/byu/rpg/physics/World.java",
"license": "gpl-3.0",
"size": 5041
} | [
"edu.byu.rpg.entities.player.Player",
"java.util.ArrayList"
] | import edu.byu.rpg.entities.player.Player; import java.util.ArrayList; | import edu.byu.rpg.entities.player.*; import java.util.*; | [
"edu.byu.rpg",
"java.util"
] | edu.byu.rpg; java.util; | 1,086,797 |
public static String readAttribute(OMElement element, String attName) {
if (element == null) {
return null;
}
OMAttribute temp = element.getAttribute(new QName(attName));
if (temp != null) {
return temp.getAttributeValue();
}
return null;
} | static String function(OMElement element, String attName) { if (element == null) { return null; } OMAttribute temp = element.getAttribute(new QName(attName)); if (temp != null) { return temp.getAttributeValue(); } return null; } | /**
* Reads an attribute in the given element and returns the value of that attribute
*
* @param element - Element to search
* @param attName - attribute name
* @return if the attribute found, return value. else null.
*/ | Reads an attribute in the given element and returns the value of that attribute | readAttribute | {
"repo_name": "madhawa-gunasekara/product-ei",
"path": "components/org.wso2.carbon.micro.integrator.core/src/main/java/org/wso2/carbon/application/deployer/AppDeployerUtils.java",
"license": "apache-2.0",
"size": 31181
} | [
"javax.xml.namespace.QName",
"org.apache.axiom.om.OMAttribute",
"org.apache.axiom.om.OMElement"
] | import javax.xml.namespace.QName; import org.apache.axiom.om.OMAttribute; import org.apache.axiom.om.OMElement; | import javax.xml.namespace.*; import org.apache.axiom.om.*; | [
"javax.xml",
"org.apache.axiom"
] | javax.xml; org.apache.axiom; | 1,641,004 |
@Override
public void onClick(String weatherForDay) {
Context context = this;
Class destinationClass = DetailActivity.class;
Intent intentToStartDetailActivity = new Intent(context, destinationClass);
intentToStartDetailActivity.putExtra(Intent.EXTRA_TEXT, weatherForDay);
startActivity(intentToStartDetailActivity);
} | void function(String weatherForDay) { Context context = this; Class destinationClass = DetailActivity.class; Intent intentToStartDetailActivity = new Intent(context, destinationClass); intentToStartDetailActivity.putExtra(Intent.EXTRA_TEXT, weatherForDay); startActivity(intentToStartDetailActivity); } | /**
* This method is for responding to clicks from our list.
*
* @param weatherForDay String describing weather details for a particular day
*/ | This method is for responding to clicks from our list | onClick | {
"repo_name": "leonnnwu/ud851-Sunshine",
"path": "S06.01-Exercise-LaunchSettingsActivity/app/src/main/java/com/example/android/sunshine/MainActivity.java",
"license": "apache-2.0",
"size": 14067
} | [
"android.content.Context",
"android.content.Intent"
] | import android.content.Context; import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 1,365,845 |
private List<SourceFile> createSourceInputs(List<String> files)
throws FlagUsageException, IOException {
if (isInTestMode()) {
return inputsSupplierForTesting.get();
}
if (files.isEmpty()) {
files = Collections.singletonList("-");
}
try {
return createInputs(files, true);
} catch (FlagUsageException e) {
throw new FlagUsageException("Bad --js flag. " + e.getMessage());
}
} | List<SourceFile> function(List<String> files) throws FlagUsageException, IOException { if (isInTestMode()) { return inputsSupplierForTesting.get(); } if (files.isEmpty()) { files = Collections.singletonList("-"); } try { return createInputs(files, true); } catch (FlagUsageException e) { throw new FlagUsageException(STR + e.getMessage()); } } | /**
* Creates JS source code inputs from a list of files.
*/ | Creates JS source code inputs from a list of files | createSourceInputs | {
"repo_name": "wenzowski/closure-compiler",
"path": "src/com/google/javascript/jscomp/AbstractCommandLineRunner.java",
"license": "apache-2.0",
"size": 65519
} | [
"java.io.IOException",
"java.util.Collections",
"java.util.List"
] | import java.io.IOException; import java.util.Collections; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 2,026,273 |
public SynchronizedCollection<ADDRESST> getAddresses(UUID participant) {
final Object mutex = mutex();
synchronized (mutex) {
return Collections3.synchronizedCollection(this.participants.get(participant), mutex);
}
} | SynchronizedCollection<ADDRESST> function(UUID participant) { final Object mutex = mutex(); synchronized (mutex) { return Collections3.synchronizedCollection(this.participants.get(participant), mutex); } } | /**
* Replies all the addresses of the participant with the given identifier.
*
* @param participant - the identifier of the participant.
* @return the collection of addresses. It may be <code>null</code> if the participant is unknown.
*/ | Replies all the addresses of the participant with the given identifier | getAddresses | {
"repo_name": "jgfoster/sarl",
"path": "sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/MultipleAddressParticipantRepository.java",
"license": "apache-2.0",
"size": 4870
} | [
"io.sarl.lang.util.SynchronizedCollection",
"io.sarl.util.Collections3"
] | import io.sarl.lang.util.SynchronizedCollection; import io.sarl.util.Collections3; | import io.sarl.lang.util.*; import io.sarl.util.*; | [
"io.sarl.lang",
"io.sarl.util"
] | io.sarl.lang; io.sarl.util; | 1,806,614 |
@Override
public void connectionRemoved(Server server, HostedConnection hc) {
} | void function(Server server, HostedConnection hc) { } | /**
* Default implementation does nothing. Implementations can
* override this to peform custom leaving connection behavior.
*/ | Default implementation does nothing. Implementations can override this to peform custom leaving connection behavior | connectionRemoved | {
"repo_name": "PlanetWaves/clockworkengine",
"path": "trunk/jme3-networking/src/main/java/com/jme3/network/service/AbstractHostedService.java",
"license": "apache-2.0",
"size": 3007
} | [
"com.jme3.network.HostedConnection",
"com.jme3.network.Server"
] | import com.jme3.network.HostedConnection; import com.jme3.network.Server; | import com.jme3.network.*; | [
"com.jme3.network"
] | com.jme3.network; | 1,430,174 |
@Test
public void testPortConflictHandling() throws Exception {
ReporterSetup reporterSetup1 = ReporterSetup.forReporter("test1", new JMXReporter("9020-9035"));
ReporterSetup reporterSetup2 = ReporterSetup.forReporter("test2", new JMXReporter("9020-9035"));
MetricRegistryImpl reg = new MetricRegistryImpl(
MetricRegistryConfiguration.defaultMetricRegistryConfiguration(),
Arrays.asList(reporterSetup1, reporterSetup2));
TaskManagerMetricGroup mg = new TaskManagerMetricGroup(reg, "host", "tm");
List<MetricReporter> reporters = reg.getReporters();
assertTrue(reporters.size() == 2);
MetricReporter rep1 = reporters.get(0);
MetricReporter rep2 = reporters.get(1); | void function() throws Exception { ReporterSetup reporterSetup1 = ReporterSetup.forReporter("test1", new JMXReporter(STR)); ReporterSetup reporterSetup2 = ReporterSetup.forReporter("test2", new JMXReporter(STR)); MetricRegistryImpl reg = new MetricRegistryImpl( MetricRegistryConfiguration.defaultMetricRegistryConfiguration(), Arrays.asList(reporterSetup1, reporterSetup2)); TaskManagerMetricGroup mg = new TaskManagerMetricGroup(reg, "host", "tm"); List<MetricReporter> reporters = reg.getReporters(); assertTrue(reporters.size() == 2); MetricReporter rep1 = reporters.get(0); MetricReporter rep2 = reporters.get(1); | /**
* Verifies that multiple JMXReporters can be started on the same machine and register metrics at the MBeanServer.
*
* @throws Exception if the attribute/mbean could not be found or the test is broken
*/ | Verifies that multiple JMXReporters can be started on the same machine and register metrics at the MBeanServer | testPortConflictHandling | {
"repo_name": "fhueske/flink",
"path": "flink-metrics/flink-metrics-jmx/src/test/java/org/apache/flink/metrics/jmx/JMXReporterTest.java",
"license": "apache-2.0",
"size": 11809
} | [
"java.util.Arrays",
"java.util.List",
"org.apache.flink.metrics.reporter.MetricReporter",
"org.apache.flink.runtime.metrics.MetricRegistryConfiguration",
"org.apache.flink.runtime.metrics.MetricRegistryImpl",
"org.apache.flink.runtime.metrics.ReporterSetup",
"org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup",
"org.junit.Assert"
] | import java.util.Arrays; import java.util.List; import org.apache.flink.metrics.reporter.MetricReporter; import org.apache.flink.runtime.metrics.MetricRegistryConfiguration; import org.apache.flink.runtime.metrics.MetricRegistryImpl; import org.apache.flink.runtime.metrics.ReporterSetup; import org.apache.flink.runtime.metrics.groups.TaskManagerMetricGroup; import org.junit.Assert; | import java.util.*; import org.apache.flink.metrics.reporter.*; import org.apache.flink.runtime.metrics.*; import org.apache.flink.runtime.metrics.groups.*; import org.junit.*; | [
"java.util",
"org.apache.flink",
"org.junit"
] | java.util; org.apache.flink; org.junit; | 171,725 |
private PointF transformCoordBitmapToTouch(float bx, float by) {
matrix.getValues(m);
float origW = getDrawable().getIntrinsicWidth();
float origH = getDrawable().getIntrinsicHeight();
float px = bx / origW;
float py = by / origH;
float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px;
float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py;
return new PointF(finalX , finalY);
}
private class Fling implements Runnable {
CompatScroller scroller;
int currX, currY;
Fling(int velocityX, int velocityY) {
setState(State.FLING);
scroller = new CompatScroller(context);
matrix.getValues(m);
int startX = (int) m[Matrix.MTRANS_X];
int startY = (int) m[Matrix.MTRANS_Y];
int minX, maxX, minY, maxY;
if (getImageWidth() > viewWidth) {
minX = viewWidth - (int) getImageWidth();
maxX = 0;
} else {
minX = maxX = startX;
}
if (getImageHeight() > viewHeight) {
minY = viewHeight - (int) getImageHeight();
maxY = 0;
} else {
minY = maxY = startY;
}
scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX,
maxX, minY, maxY);
currX = startX;
currY = startY;
} | PointF function(float bx, float by) { matrix.getValues(m); float origW = getDrawable().getIntrinsicWidth(); float origH = getDrawable().getIntrinsicHeight(); float px = bx / origW; float py = by / origH; float finalX = m[Matrix.MTRANS_X] + getImageWidth() * px; float finalY = m[Matrix.MTRANS_Y] + getImageHeight() * py; return new PointF(finalX , finalY); } private class Fling implements Runnable { CompatScroller scroller; int currX, currY; Fling(int velocityX, int velocityY) { setState(State.FLING); scroller = new CompatScroller(context); matrix.getValues(m); int startX = (int) m[Matrix.MTRANS_X]; int startY = (int) m[Matrix.MTRANS_Y]; int minX, maxX, minY, maxY; if (getImageWidth() > viewWidth) { minX = viewWidth - (int) getImageWidth(); maxX = 0; } else { minX = maxX = startX; } if (getImageHeight() > viewHeight) { minY = viewHeight - (int) getImageHeight(); maxY = 0; } else { minY = maxY = startY; } scroller.fling(startX, startY, (int) velocityX, (int) velocityY, minX, maxX, minY, maxY); currX = startX; currY = startY; } | /**
* Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the
* drawable's coordinate system to the view's coordinate system.
* @param bx x-coordinate in original bitmap coordinate system
* @param by y-coordinate in original bitmap coordinate system
* @return Coordinates of the point in the view's coordinate system.
*/ | Inverse of transformCoordTouchToBitmap. This function will transform the coordinates in the drawable's coordinate system to the view's coordinate system | transformCoordBitmapToTouch | {
"repo_name": "gianei/SmartCatalogSPL",
"path": "core/src/main/java/com/glsebastiany/smartcatalogspl/core/presentation/widget/TouchImageView.java",
"license": "gpl-3.0",
"size": 43480
} | [
"android.graphics.Matrix",
"android.graphics.PointF"
] | import android.graphics.Matrix; import android.graphics.PointF; | import android.graphics.*; | [
"android.graphics"
] | android.graphics; | 1,871,228 |
void populateBrowser(DataSourceSummaryDialog dsSummaryDialog, Long selectedDataSourceId) {
dsSummaryDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
if (rootNodeWorker != null && !rootNodeWorker.isDone()) {
rootNodeWorker.cancel(true);
} | void populateBrowser(DataSourceSummaryDialog dsSummaryDialog, Long selectedDataSourceId) { dsSummaryDialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); if (rootNodeWorker != null && !rootNodeWorker.isDone()) { rootNodeWorker.cancel(true); } | /**
* Populate the data source browser with an updated list of the data sources
* and information about them.
*
* @param dsSummaryDialog The dialog which contains this data source
* browser panel.
* @param selectedDataSourceId The object id for the data source which
* should be selected.
*/ | Populate the data source browser with an updated list of the data sources and information about them | populateBrowser | {
"repo_name": "rcordovano/autopsy",
"path": "Core/src/org/sleuthkit/autopsy/datasourcesummary/ui/DataSourceBrowser.java",
"license": "apache-2.0",
"size": 13788
} | [
"java.awt.Cursor"
] | import java.awt.Cursor; | import java.awt.*; | [
"java.awt"
] | java.awt; | 1,936,394 |
private void processREDCapXml(String fromserver) throws ParserConfigurationException, SAXException, IOException, SQLException {
//build the XML parsers
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document document = builder.parse(new ByteArrayInputStream( fromserver.getBytes() ));
//the data is received from the server in this format:
//<hash><error>There were data validation errors</error>
//<field>
// <record>1481 (event_43_arm_2)</record>
// <field_name>diast_bp</field_name>
// <value>76;72;77;68;</value>
// <message>
// The value you provided could not be validated because it does not
// follow the expected format. Please try again.
// </message>
//</field>
//...more field (s)...
//or
//<ids><id>1509</id><id>1343</id><id>1517</id></ids>
//serialize everything from the <hash> or <ids> onwards, since they are the root nodes.
NodeList nodeList = document.getDocumentElement().getChildNodes();
for (int i = 0; i < nodeList.getLength(); i++) {
Node node = nodeList.item(i);
if (node instanceof Element) {
if( "field".equals(node.getNodeName()) ){
//serialize all of the descendents into one hashset since it's just one item.
NodeList attrList = node.getChildNodes();
HashMap<String,String> line = new HashMap<String,String>();
for (int j = 0; j < attrList.getLength(); j++) {
Node attr = attrList.item(j);
line.put(attr.getNodeName(), attr.getTextContent().trim());
}
//now extract the settings.
String record = line.get("record").replaceAll("'","''");
String field_name = line.get("field_name").replaceAll("'","''");
String message = line.get("message") == null ? "" : ( line.get("message").replaceAll("'","''") );
String value = line.get("value") == null ? "" : ( line.get("value").replaceAll("'","''") );
String event = "$";
//break out the event, which is in parentheses. <record>1481 (event_43_arm_2)</record>
if( record != null && record.indexOf('(') > 0 && record.indexOf(')') > 0){
line.put( "event", event = record.substring(record.indexOf('(')+1,record.indexOf(')')).trim() );
line.put( "record", record = record.substring(0, record.indexOf('(')).trim() );
}
SQLUtilities.execSQL(datadb ,
"UPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>"+message+"</error>' "
+ "WHERE PROJECTID='"+project_id+"' AND "
+ "SENDLOG='"+project_id+"' AND "
+ "STUDYID='"+record+"' AND "
+ "VAR='"+field_name+"' AND "
+ "EVENT_NAME='"+event+"'"
);
} else if( "fields".equals(node.getNodeName()) ){
log("Unknown fields error " + node.getNodeName());
} else if( "id".equals(node.getNodeName())){
//all is well! the data is in the format of <ids><id>1509</id><id>1343</id><id>1517</id></ids>
SQLUtilities.execSQL(datadb ,
"UPDATE PROJECTS_REDCAP_OUTPUT_EAV "
+ "SET SENDLOG='SUCCESS' "
+ "WHERE PROJECTID='"+project_id+"' AND "
+ "SENDLOG='"+project_id+"' AND "
+ "STUDYID='"+node.getTextContent().trim()+"'"
);
} else if( "error".equals(node.getNodeName())){
//saving the error message so we all don't sit here wondering WTF happened.
String truncated = node.getTextContent().trim();
//see if you're a 6.11 REDCap error string. Good job for moving the goalposts again Vanderbuilt.
boolean isV6_11_error = true;
for( String line : truncated.split("\n") ){
String[] cols = line.split("\",\"");
isV6_11_error &= cols.length == 4;
}
if( isV6_11_error ){
for( String line : truncated.split("\n") ){
System.err.println("Logging:" + line );
String[] cols = line.split("\",\"");
String record = cols[0].replaceAll("\"", "");
String field_name = cols[1].replaceAll("'","''");
String value = cols[2]== null ? "" : ( cols[2].replaceAll("'","''") );
String message = cols[3] == null ? "" : ( cols[3].replaceAll("'","''").replaceAll("\"", "") );
String event = "$";
//break out the event, which is in parentheses. <record>1481 (event_43_arm_2)</record>
if( record != null && record.indexOf('(') > 0 && record.indexOf(')') > 0){
event = record.substring(record.indexOf('(')+1,record.indexOf(')')).trim();
record = record.substring(0, record.indexOf('(')).trim();
}
System.err.println( "UPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>"+message+"</error>' "
+ "WHERE PROJECTID='"+project_id+"' AND "
+ "SENDLOG='"+project_id+"' AND "
+ "STUDYID='"+record+"' AND "
+ "VAR='"+field_name+"' AND "
+ "EVENT_NAME='"+event+"'" );
SQLUtilities.execSQL(datadb ,
"UPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>"+message+"</error>' "
+ "WHERE PROJECTID='"+project_id+"' AND "
+ "SENDLOG='"+project_id+"' AND "
+ "STUDYID='"+record+"' AND "
+ "VAR='"+field_name+"' AND "
+ "EVENT_NAME='"+event+"'"
);
}
} else {
if( truncated.length() > 2000 ) {
truncated = truncated.substring(0,1950) + "... ";
}
SQLUtilities.execSQL(datadb ,
"UPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>"+truncated+"</error>' "
+ "WHERE PROJECTID='"+project_id+"' AND "
+ "SENDLOG='"+project_id+"'"
);
}
} else {
log("Unknown node name " + node.getNodeName());
}
} else if( !"#text".equals( node.getNodeName() ) ){
//all of the items have line breaks and other text items in between. if it's not that then log it.
log("not an Element? " + node.getClass().getName() + ": " + node.getNodeName() + " " + node.getTextContent() );
}
} //all the node parseing
} | void function(String fromserver) throws ParserConfigurationException, SAXException, IOException, SQLException { DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); Document document = builder.parse(new ByteArrayInputStream( fromserver.getBytes() )); NodeList nodeList = document.getDocumentElement().getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element) { if( "field".equals(node.getNodeName()) ){ NodeList attrList = node.getChildNodes(); HashMap<String,String> line = new HashMap<String,String>(); for (int j = 0; j < attrList.getLength(); j++) { Node attr = attrList.item(j); line.put(attr.getNodeName(), attr.getTextContent().trim()); } String record = line.get(STR).replaceAll("'","''"); String field_name = line.get(STR).replaceAll("'","''"); String message = line.get(STR) == null ? "" : ( line.get(STR).replaceAll("'","''STRvalue") == null ? STRvalueSTR'","''STR$STRevent", event = record.substring(record.indexOf('(')+1,record.indexOf(')')).trim() ); line.put( STR, record = record.substring(0, record.indexOf('(')).trim() ); } SQLUtilities.execSQL(datadb , "UPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>STR</error>' STRWHERE PROJECTID='STR' AND STRSENDLOG='STR' AND STRSTUDYID='STR' AND STRVAR='STR' AND STREVENT_NAME='STR'STRfieldsSTRUnknown fields error STRidSTRUPDATE PROJECTS_REDCAP_OUTPUT_EAV STRSET SENDLOG='SUCCESS' STRWHERE PROJECTID='STR' AND STRSENDLOG='STR' AND STRSTUDYID='STR'STRerrorSTR\nSTR\",\"STR\nSTRLogging:STR\",\"STR\STRSTR'","''STRSTR'","''STRSTR'","''STR\STRSTR$STRUPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>STR</error>' STRWHERE PROJECTID='STR' AND STRSENDLOG='STR' AND STRSTUDYID='STR' AND STRVAR='STR' AND STREVENT_NAME='STR'STRUPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>STR</error>' STRWHERE PROJECTID='STR' AND STRSENDLOG='STR' AND STRSTUDYID='STR' AND STRVAR='STR' AND STREVENT_NAME='STR'STR... STRUPDATE PROJECTS_REDCAP_OUTPUT_EAV SET SENDLOG='<error>STR</error>' STRWHERE PROJECTID='STR' AND STRSENDLOG='STR'STRUnknown node name STR#textSTRnot an Element? STR: STR " + node.getTextContent() ); } } } | /**
* This function processes the string data returned from the redcap API and determines what errors there was.
* It logs each issue to the EAV file generated on the server.
* @param fromserver - the XML string from the server
* @throws ParserConfigurationException - in case it can't create a SAX Parser
* @throws SAXException - if the XML is incorrect
* @throws IOException - If the string can't be read from memory (really?)
* @throws SQLException - If there's an issue logging the errors to database.
*/ | This function processes the string data returned from the redcap API and determines what errors there was. It logs each issue to the EAV file generated on the server | processREDCapXml | {
"repo_name": "URMC/i2b2_redi",
"path": "java/src/main/java/edu/rochester/urmc/i2b2/redcap/Sender.java",
"license": "mit",
"size": 26395
} | [
"edu.rochester.urmc.util.SQLUtilities",
"java.io.ByteArrayInputStream",
"java.io.IOException",
"java.sql.SQLException",
"java.util.HashMap",
"javax.xml.parsers.DocumentBuilder",
"javax.xml.parsers.DocumentBuilderFactory",
"javax.xml.parsers.ParserConfigurationException",
"org.w3c.dom.Document",
"org.w3c.dom.Element",
"org.w3c.dom.Node",
"org.w3c.dom.NodeList",
"org.xml.sax.SAXException"
] | import edu.rochester.urmc.util.SQLUtilities; import java.io.ByteArrayInputStream; import java.io.IOException; import java.sql.SQLException; import java.util.HashMap; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; | import edu.rochester.urmc.util.*; import java.io.*; import java.sql.*; import java.util.*; import javax.xml.parsers.*; import org.w3c.dom.*; import org.xml.sax.*; | [
"edu.rochester.urmc",
"java.io",
"java.sql",
"java.util",
"javax.xml",
"org.w3c.dom",
"org.xml.sax"
] | edu.rochester.urmc; java.io; java.sql; java.util; javax.xml; org.w3c.dom; org.xml.sax; | 1,546,629 |
public static void testCursorContainsRange(Cursor cursor, int columnIndex, int start, int end) {
HashMap<Integer, Boolean> idsFound = new HashMap<>();
for(int i = start; i <= end; i++) {
idsFound.put(i, false);
}
assertTrue(cursor.moveToFirst());
do {
idsFound.put(cursor.getInt(columnIndex), true);
} while(cursor.moveToNext());
for(Map.Entry<Integer, Boolean> entry : idsFound.entrySet() ) {
int key = entry.getKey();
assertTrue("Id " + key + " not found", entry.getValue());
}
} | static void function(Cursor cursor, int columnIndex, int start, int end) { HashMap<Integer, Boolean> idsFound = new HashMap<>(); for(int i = start; i <= end; i++) { idsFound.put(i, false); } assertTrue(cursor.moveToFirst()); do { idsFound.put(cursor.getInt(columnIndex), true); } while(cursor.moveToNext()); for(Map.Entry<Integer, Boolean> entry : idsFound.entrySet() ) { int key = entry.getKey(); assertTrue(STR + key + STR, entry.getValue()); } } | /**
* Tests if cursor contains all numbers from start until end for given column index.
* Including the start and end integers.
* @param columnIndex
* @param cursor
* @param start
* @param end
*/ | Tests if cursor contains all numbers from start until end for given column index. Including the start and end integers | testCursorContainsRange | {
"repo_name": "RaafatAkkad/Kore",
"path": "app/src/testUtils/java/org/xbmc/kore/testutils/TestUtils.java",
"license": "apache-2.0",
"size": 2409
} | [
"android.database.Cursor",
"java.util.HashMap",
"java.util.Map",
"org.junit.Assert"
] | import android.database.Cursor; import java.util.HashMap; import java.util.Map; import org.junit.Assert; | import android.database.*; import java.util.*; import org.junit.*; | [
"android.database",
"java.util",
"org.junit"
] | android.database; java.util; org.junit; | 528,932 |
public Shape getThumbShape(int thumbIndex) {
return getThumbShape(thumbIndex, null);
} | Shape function(int thumbIndex) { return getThumbShape(thumbIndex, null); } | /**
* Create the shape used to render a specific thumb.
*
* @param thumbIndex
* the index of the thumb to render.
* @return the shape used to render a specific thumb.
*
* @see #getThumbCenter(int)
* @see #getThumb(int)
*/ | Create the shape used to render a specific thumb | getThumbShape | {
"repo_name": "mickleness/pumpernickel",
"path": "src/main/java/com/pump/plaf/MultiThumbSliderUI.java",
"license": "mit",
"size": 46196
} | [
"java.awt.Shape"
] | import java.awt.Shape; | import java.awt.*; | [
"java.awt"
] | java.awt; | 2,346,954 |
public static ChangeMessage createValidChange() {
ChangeMessage change = new ChangeMessage();
change.setChangeNumber(1L);
change.setObjectId("syn123");
change.setObjectVersion(null);
change.setObjectType(ObjectType.ENTITY);
change.setChangeType(ChangeType.CREATE);
return change;
}
| static ChangeMessage function() { ChangeMessage change = new ChangeMessage(); change.setChangeNumber(1L); change.setObjectId(STR); change.setObjectVersion(null); change.setObjectType(ObjectType.ENTITY); change.setChangeType(ChangeType.CREATE); return change; } | /**
* Helper to create a valid ChangeMessage
* @return
*/ | Helper to create a valid ChangeMessage | createValidChange | {
"repo_name": "xschildw/Synapse-Repository-Services",
"path": "lib/jdomodels/src/test/java/org/sagebionetworks/repo/model/message/ChangeMessageUtilsTest.java",
"license": "apache-2.0",
"size": 6835
} | [
"org.sagebionetworks.repo.model.ObjectType"
] | import org.sagebionetworks.repo.model.ObjectType; | import org.sagebionetworks.repo.model.*; | [
"org.sagebionetworks.repo"
] | org.sagebionetworks.repo; | 495,166 |
public static Map<String, Object> flowModToStorageEntry(OFFlowMod fm, String sw, String name) throws Exception {
Map<String, Object> entry = new HashMap<String, Object>();
entry.put(StaticFlowEntryPusher.COLUMN_NAME, name);
entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, sw);
entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, Boolean.toString(true));
entry.put(StaticFlowEntryPusher.COLUMN_PRIORITY, Integer.toString(fm.getPriority()));
entry.put(StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT, Integer.toString(fm.getIdleTimeout()));
entry.put(StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT, Integer.toString(fm.getHardTimeout()));
switch (fm.getVersion()) {
case OF_10:
if (fm.getActions() != null) {
entry.put(StaticFlowEntryPusher.COLUMN_ACTIONS, ActionUtils.actionsToString(fm.getActions(), log));
}
break;
case OF_11:
case OF_12:
case OF_13:
case OF_14:
default:
// should have a table ID present
if (fm.getTableId() != null) { // if not set, then don't worry about it. Default will be set when built and sent to switch
entry.put(StaticFlowEntryPusher.COLUMN_TABLE_ID, Short.toString(fm.getTableId().getValue()));
}
// should have a list of instructions, of which apply and write actions could have sublists of actions
if (fm.getInstructions() != null) {
List<OFInstruction> instructions = fm.getInstructions();
for (OFInstruction inst : instructions) {
switch (inst.getType()) {
case GOTO_TABLE:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_GOTO_TABLE, InstructionUtils.gotoTableToString(((OFInstructionGotoTable) inst), log));
break;
case WRITE_METADATA:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_METADATA, InstructionUtils.writeMetadataToString(((OFInstructionWriteMetadata) inst), log));
break;
case WRITE_ACTIONS:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS, InstructionUtils.writeActionsToString(((OFInstructionWriteActions) inst), log));
break;
case APPLY_ACTIONS:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS, InstructionUtils.applyActionsToString(((OFInstructionApplyActions) inst), log));
break;
case CLEAR_ACTIONS:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_CLEAR_ACTIONS, InstructionUtils.clearActionsToString(((OFInstructionClearActions) inst), log));
break;
case METER:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_GOTO_METER, InstructionUtils.meterToString(((OFInstructionMeter) inst), log));
break;
case EXPERIMENTER:
entry.put(StaticFlowEntryPusher.COLUMN_INSTR_EXPERIMENTER, InstructionUtils.experimenterToString(((OFInstructionExperimenter) inst), log));
break;
default:
log.error("Could not decode OF1.1+ instruction type {}", inst);
}
}
}
}
Match match = fm.getMatch();
// it's a shame we can't use the MatchUtils for this. It's kind of the same thing but storing in a different place.
Iterator<MatchField<?>> itr = match.getMatchFields().iterator(); // only get exact or masked fields (not fully wildcarded)
while(itr.hasNext()) {
@SuppressWarnings("rawtypes") // this is okay here
MatchField mf = itr.next();
switch (mf.id) {
case IN_PORT: // iterates over only exact/masked fields. No need to check for null entries.
if (match.supports(MatchField.IN_PORT) && match.isExact(MatchField.IN_PORT)) {
entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, match.get(MatchField.IN_PORT).toString());
} else if (match.supportsMasked(MatchField.IN_PORT) && match.isPartiallyMasked(MatchField.IN_PORT)) {
entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, match.getMasked(MatchField.IN_PORT).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_IN_PORT, match.getVersion().toString());
}
break;
case ETH_SRC:
if (match.supports(MatchField.ETH_SRC) && match.isExact(MatchField.ETH_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, match.get(MatchField.ETH_SRC).toString());
} else if (match.supportsMasked(MatchField.ETH_SRC) && match.isPartiallyMasked(MatchField.ETH_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, match.getMasked(MatchField.ETH_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_DL_SRC, match.getVersion().toString());
}
break;
case ETH_DST:
if (match.supports(MatchField.ETH_DST) && match.isExact(MatchField.ETH_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, match.get(MatchField.ETH_DST).toString());
} else if (match.supportsMasked(MatchField.ETH_DST) && match.isPartiallyMasked(MatchField.ETH_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, match.getMasked(MatchField.ETH_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_DL_DST, match.getVersion().toString());
}
break;
case VLAN_VID:
if (match.supports(MatchField.VLAN_VID) && match.isExact(MatchField.VLAN_VID)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, match.get(MatchField.VLAN_VID).toString());
} else if (match.supportsMasked(MatchField.VLAN_VID) && match.isPartiallyMasked(MatchField.VLAN_VID)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, match.getMasked(MatchField.VLAN_VID).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_DL_VLAN, match.getVersion().toString());
}
break;
case VLAN_PCP:
if (match.supports(MatchField.VLAN_PCP) && match.isExact(MatchField.VLAN_PCP)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.get(MatchField.VLAN_PCP).toString());
} else if (match.supportsMasked(MatchField.VLAN_PCP) && match.isPartiallyMasked(MatchField.VLAN_PCP)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.getMasked(MatchField.VLAN_PCP).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.getVersion().toString());
}
break;
case ETH_TYPE:
if (match.supports(MatchField.ETH_TYPE) && match.isExact(MatchField.ETH_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, match.get(MatchField.ETH_TYPE).toString());
} else if (match.supportsMasked(MatchField.ETH_TYPE) && match.isPartiallyMasked(MatchField.ETH_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, match.getMasked(MatchField.ETH_TYPE).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_DL_TYPE, match.getVersion().toString());
}
break;
case IP_ECN: // TOS = [DSCP bits 0-5] + [ECN bits 6-7] --> bitwise OR to get TOS byte (have separate columns now though)
if (match.supports(MatchField.IP_ECN) && match.isExact(MatchField.IP_ECN)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_ECN, match.get(MatchField.IP_ECN).toString());
} else if (match.supportsMasked(MatchField.IP_ECN) && match.isPartiallyMasked(MatchField.IP_ECN)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_ECN, match.getMasked(MatchField.IP_ECN).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW_ECN, match.getVersion().toString());
}
break;
case IP_DSCP: // Even for OF1.0, loxi will break ECN and DSCP up from the API's POV. This method is only invoked by a SFP service push from another module
if (match.supports(MatchField.IP_DSCP) && match.isExact(MatchField.IP_DSCP)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_DSCP, match.get(MatchField.IP_DSCP).toString());
} else if (match.supportsMasked(MatchField.IP_DSCP) && match.isPartiallyMasked(MatchField.IP_DSCP)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_DSCP, match.getMasked(MatchField.IP_DSCP).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW_DSCP, match.getVersion().toString());
}
break;
case IP_PROTO:
if (match.supports(MatchField.IP_PROTO) && match.isExact(MatchField.IP_PROTO)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, match.get(MatchField.IP_PROTO).toString());
} else if (match.supportsMasked(MatchField.IP_PROTO) && match.isPartiallyMasked(MatchField.IP_PROTO)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, match.getMasked(MatchField.IP_PROTO).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW_PROTO, match.getVersion().toString());
}
break;
case IPV4_SRC:
if (match.supports(MatchField.IPV4_SRC) && match.isExact(MatchField.IPV4_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, match.get(MatchField.IPV4_SRC).toString());
} else if (match.supportsMasked(MatchField.IPV4_SRC) && match.isPartiallyMasked(MatchField.IPV4_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, match.getMasked(MatchField.IPV4_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW_SRC, match.getVersion().toString());
}
break;
case IPV4_DST:
if (match.supports(MatchField.IPV4_DST) && match.isExact(MatchField.IPV4_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, match.get(MatchField.IPV4_DST).toString());
} else if (match.supportsMasked(MatchField.IPV4_DST) && match.isPartiallyMasked(MatchField.IPV4_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, match.getMasked(MatchField.IPV4_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW_DST, match.getVersion().toString());
}
break;
case TCP_SRC:
if (match.supports(MatchField.TCP_SRC) && match.isExact(MatchField.TCP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_TCP_SRC, match.get(MatchField.TCP_SRC).toString());
} else if (match.supportsMasked(MatchField.TCP_SRC) && match.isPartiallyMasked(MatchField.TCP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_TCP_SRC, match.getMasked(MatchField.TCP_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_TCP_SRC, match.getVersion().toString());
}
break;
case UDP_SRC:
if (match.supports(MatchField.UDP_SRC) && match.isExact(MatchField.UDP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_UDP_SRC, match.get(MatchField.UDP_SRC).toString());
} else if (match.supportsMasked(MatchField.UDP_SRC) && match.isPartiallyMasked(MatchField.UDP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_UDP_SRC, match.getMasked(MatchField.UDP_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_UDP_SRC, match.getVersion().toString());
}
break;
case SCTP_SRC:
if (match.supports(MatchField.SCTP_SRC) && match.isExact(MatchField.SCTP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.get(MatchField.SCTP_SRC).toString());
} else if (match.supportsMasked(MatchField.SCTP_SRC) && match.isPartiallyMasked(MatchField.SCTP_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.getMasked(MatchField.SCTP_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.getVersion().toString());
}
break;
case TCP_DST:
if (match.supports(MatchField.TCP_DST) && match.isExact(MatchField.TCP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_TCP_DST, match.get(MatchField.TCP_DST).toString());
} else if (match.supportsMasked(MatchField.TCP_DST) && match.isPartiallyMasked(MatchField.TCP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_TCP_DST, match.getMasked(MatchField.TCP_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_TCP_DST, match.getVersion().toString());
}
break;
case UDP_DST:
if (match.supports(MatchField.UDP_DST) && match.isExact(MatchField.UDP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_UDP_DST, match.get(MatchField.UDP_DST).toString());
} else if (match.supportsMasked(MatchField.UDP_DST) && match.isPartiallyMasked(MatchField.UDP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_UDP_DST, match.getMasked(MatchField.UDP_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_UDP_DST, match.getVersion().toString());
}
break;
case SCTP_DST:
if (match.supports(MatchField.SCTP_DST) && match.isExact(MatchField.SCTP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_SCTP_DST, match.get(MatchField.SCTP_DST).toString());
} else if (match.supportsMasked(MatchField.SCTP_DST) && match.isPartiallyMasked(MatchField.SCTP_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_SCTP_DST, match.getMasked(MatchField.SCTP_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_SCTP_DST, match.getVersion().toString());
}
break;
case ICMPV4_TYPE:
if (match.supports(MatchField.ICMPV4_TYPE) && match.isExact(MatchField.ICMPV4_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.get(MatchField.ICMPV4_TYPE).toString());
} else if (match.supportsMasked(MatchField.ICMPV4_TYPE) && match.isPartiallyMasked(MatchField.ICMPV4_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.getMasked(MatchField.ICMPV4_TYPE).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.getVersion().toString());
}
break;
case ICMPV4_CODE:
if (match.supports(MatchField.ICMPV4_CODE) && match.isExact(MatchField.ICMPV4_CODE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.get(MatchField.ICMPV4_CODE).toString());
} else if (match.supportsMasked(MatchField.ICMPV4_CODE) && match.isPartiallyMasked(MatchField.ICMPV4_CODE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.getMasked(MatchField.ICMPV4_CODE).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.getVersion().toString());
}
break;
case ARP_OP:
if (match.supports(MatchField.ARP_OP) && match.isExact(MatchField.ARP_OP)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.get(MatchField.ARP_OP).toString());
} else if (match.supportsMasked(MatchField.ARP_OP) && match.isPartiallyMasked(MatchField.ARP_OP)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.getMasked(MatchField.ARP_OP).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.getVersion().toString());
}
break;
case ARP_SHA:
if (match.supports(MatchField.ARP_SHA) && match.isExact(MatchField.ARP_SHA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_SHA, match.get(MatchField.ARP_SHA).toString());
} else if (match.supportsMasked(MatchField.ARP_SHA) && match.isPartiallyMasked(MatchField.ARP_SHA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_SHA, match.getMasked(MatchField.ARP_SHA).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ARP_SHA, match.getVersion().toString());
}
break;
case ARP_THA:
if (match.supports(MatchField.ARP_THA) && match.isExact(MatchField.ARP_THA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_DHA, match.get(MatchField.ARP_THA).toString());
} else if (match.supportsMasked(MatchField.ARP_THA) && match.isPartiallyMasked(MatchField.ARP_THA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_DHA, match.getMasked(MatchField.ARP_THA).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ARP_DHA, match.getVersion().toString());
}
break;
case ARP_SPA:
if (match.supports(MatchField.ARP_SPA) && match.isExact(MatchField.ARP_SPA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_SPA, match.get(MatchField.ARP_SPA).toString());
} else if (match.supportsMasked(MatchField.ARP_SPA) && match.isPartiallyMasked(MatchField.ARP_SPA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_SPA, match.getMasked(MatchField.ARP_SPA).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ARP_SPA, match.getVersion().toString());
}
break;
case ARP_TPA:
if (match.supports(MatchField.ARP_TPA) && match.isExact(MatchField.ARP_TPA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_DPA, match.get(MatchField.ARP_TPA).toString());
} else if (match.supportsMasked(MatchField.ARP_TPA) && match.isPartiallyMasked(MatchField.ARP_TPA)) {
entry.put(StaticFlowEntryPusher.COLUMN_ARP_DPA, match.getMasked(MatchField.ARP_TPA).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ARP_DPA, match.getVersion().toString());
}
break;
case IPV6_SRC:
if (match.supports(MatchField.IPV6_SRC) && match.isExact(MatchField.IPV6_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW6_SRC, match.get(MatchField.IPV6_SRC).toString());
} else if (match.supportsMasked(MatchField.IPV6_SRC) && match.isPartiallyMasked(MatchField.IPV6_SRC)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW6_SRC, match.getMasked(MatchField.IPV6_SRC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW6_SRC, match.getVersion().toString());
}
break;
case IPV6_DST:
if (match.supports(MatchField.IPV6_DST) && match.isExact(MatchField.IPV6_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW6_DST, match.get(MatchField.IPV6_DST).toString());
} else if (match.supportsMasked(MatchField.IPV6_DST) && match.isPartiallyMasked(MatchField.IPV6_DST)) {
entry.put(StaticFlowEntryPusher.COLUMN_NW6_DST, match.getMasked(MatchField.IPV6_DST).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_NW6_DST, match.getVersion().toString());
}
break;
case IPV6_FLABEL:
if (match.supports(MatchField.IPV6_FLABEL) && match.isExact(MatchField.IPV6_FLABEL)) {
entry.put(StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.get(MatchField.IPV6_FLABEL).toString());
} else if (match.supportsMasked(MatchField.IPV6_FLABEL) && match.isPartiallyMasked(MatchField.IPV6_FLABEL)) {
entry.put(StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.getMasked(MatchField.IPV6_FLABEL).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.getVersion().toString());
}
break;
case ICMPV6_TYPE:
if (match.supports(MatchField.ICMPV6_TYPE) && match.isExact(MatchField.ICMPV6_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.get(MatchField.ICMPV6_TYPE).toString());
} else if (match.supportsMasked(MatchField.ICMPV6_TYPE) && match.isPartiallyMasked(MatchField.ICMPV6_TYPE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.getMasked(MatchField.ICMPV6_TYPE).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.getVersion().toString());
}
break;
case ICMPV6_CODE:
if (match.supports(MatchField.ICMPV6_CODE) && match.isExact(MatchField.ICMPV6_CODE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.get(MatchField.ICMPV6_CODE).toString());
} else if (match.supportsMasked(MatchField.ICMPV6_CODE) && match.isPartiallyMasked(MatchField.ICMPV6_CODE)) {
entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.getMasked(MatchField.ICMPV6_CODE).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.getVersion().toString());
}
break;
case IPV6_ND_SLL:
if (match.supports(MatchField.IPV6_ND_SLL) && match.isExact(MatchField.IPV6_ND_SLL)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_SLL, match.get(MatchField.IPV6_ND_SLL).toString());
} else if (match.supportsMasked(MatchField.IPV6_ND_SLL) && match.isPartiallyMasked(MatchField.IPV6_ND_SLL)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_SLL, match.getMasked(MatchField.IPV6_ND_SLL).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ND_SLL, match.getVersion().toString());
}
break;
case IPV6_ND_TLL:
if (match.supports(MatchField.IPV6_ND_TLL) && match.isExact(MatchField.IPV6_ND_TLL)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_TLL, match.get(MatchField.IPV6_ND_TLL).toString());
} else if (match.supportsMasked(MatchField.IPV6_ND_TLL) && match.isPartiallyMasked(MatchField.IPV6_ND_TLL)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_TLL, match.getMasked(MatchField.IPV6_ND_TLL).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ND_TLL, match.getVersion().toString());
}
break;
case IPV6_ND_TARGET:
if (match.supports(MatchField.IPV6_ND_TARGET) && match.isExact(MatchField.IPV6_ND_TARGET)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_TARGET, match.get(MatchField.IPV6_ND_TARGET).toString());
} else if (match.supportsMasked(MatchField.IPV6_ND_TARGET) && match.isPartiallyMasked(MatchField.IPV6_ND_TARGET)) {
entry.put(StaticFlowEntryPusher.COLUMN_ND_TARGET, match.getMasked(MatchField.IPV6_ND_TARGET).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_ND_TARGET, match.getVersion().toString());
}
break;
case MPLS_LABEL:
if (match.supports(MatchField.MPLS_LABEL) && match.isExact(MatchField.MPLS_LABEL)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.get(MatchField.MPLS_LABEL).toString());
} else if (match.supportsMasked(MatchField.MPLS_LABEL) && match.isPartiallyMasked(MatchField.MPLS_LABEL)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.getMasked(MatchField.MPLS_LABEL).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.getVersion().toString());
}
break;
case MPLS_TC:
if (match.supports(MatchField.MPLS_TC) && match.isExact(MatchField.MPLS_TC)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_TC, match.get(MatchField.MPLS_TC).toString());
} else if (match.supportsMasked(MatchField.MPLS_TC) && match.isPartiallyMasked(MatchField.MPLS_TC)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_TC, match.getMasked(MatchField.MPLS_TC).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_MPLS_TC, match.getVersion().toString());
}
break;
case MPLS_BOS:
if (match.supports(MatchField.MPLS_BOS) && match.isExact(MatchField.MPLS_BOS)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.get(MatchField.MPLS_BOS).toString());
} else if (match.supportsMasked(MatchField.MPLS_BOS) && match.isPartiallyMasked(MatchField.MPLS_BOS)) {
entry.put(StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.getMasked(MatchField.MPLS_BOS).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.getVersion().toString());
}
break;
case METADATA:
if (match.supports(MatchField.METADATA) && match.isExact(MatchField.METADATA)) {
entry.put(StaticFlowEntryPusher.COLUMN_METADATA, match.get(MatchField.METADATA).toString());
} else if (match.supportsMasked(MatchField.METADATA) && match.isPartiallyMasked(MatchField.METADATA)) {
entry.put(StaticFlowEntryPusher.COLUMN_METADATA, match.getMasked(MatchField.METADATA).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_METADATA, match.getVersion().toString());
}
break;
case TUNNEL_ID:
if (match.supports(MatchField.TUNNEL_ID) && match.isExact(MatchField.TUNNEL_ID)) {
entry.put(StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.get(MatchField.TUNNEL_ID).toString());
} else if (match.supportsMasked(MatchField.TUNNEL_ID) && match.isPartiallyMasked(MatchField.TUNNEL_ID)) {
entry.put(StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.getMasked(MatchField.TUNNEL_ID).toString());
} else {
log.error("Got match for {} but protocol {} does not support said match. Ignoring match.",
StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.getVersion().toString());
}
break;
// case PBB_ISID not implemented in loxi
default:
log.error("Unhandled Match when parsing OFFlowMod: {}, {}", mf, mf.id);
break;
} // end switch-case
} // end while
int result = StaticFlowEntryPusherResource.checkActions(entry);
if (result == -1)
throw new Exception("Invalid action/instructions");
return entry;
}
/**
* Turns a JSON formatted Static Flow Pusher string into a storage entry
* Expects a string in JSON along the lines of:
* {
* "switch": "AA:BB:CC:DD:EE:FF:00:11",
* "name": "flow-mod-1",
* "cookie": "0",
* "priority": "32768",
* "ingress-port": "1",
* "actions": "output=2",
* } | static Map<String, Object> function(OFFlowMod fm, String sw, String name) throws Exception { Map<String, Object> entry = new HashMap<String, Object>(); entry.put(StaticFlowEntryPusher.COLUMN_NAME, name); entry.put(StaticFlowEntryPusher.COLUMN_SWITCH, sw); entry.put(StaticFlowEntryPusher.COLUMN_ACTIVE, Boolean.toString(true)); entry.put(StaticFlowEntryPusher.COLUMN_PRIORITY, Integer.toString(fm.getPriority())); entry.put(StaticFlowEntryPusher.COLUMN_IDLE_TIMEOUT, Integer.toString(fm.getIdleTimeout())); entry.put(StaticFlowEntryPusher.COLUMN_HARD_TIMEOUT, Integer.toString(fm.getHardTimeout())); switch (fm.getVersion()) { case OF_10: if (fm.getActions() != null) { entry.put(StaticFlowEntryPusher.COLUMN_ACTIONS, ActionUtils.actionsToString(fm.getActions(), log)); } break; case OF_11: case OF_12: case OF_13: case OF_14: default: if (fm.getTableId() != null) { entry.put(StaticFlowEntryPusher.COLUMN_TABLE_ID, Short.toString(fm.getTableId().getValue())); } if (fm.getInstructions() != null) { List<OFInstruction> instructions = fm.getInstructions(); for (OFInstruction inst : instructions) { switch (inst.getType()) { case GOTO_TABLE: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_GOTO_TABLE, InstructionUtils.gotoTableToString(((OFInstructionGotoTable) inst), log)); break; case WRITE_METADATA: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_METADATA, InstructionUtils.writeMetadataToString(((OFInstructionWriteMetadata) inst), log)); break; case WRITE_ACTIONS: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_WRITE_ACTIONS, InstructionUtils.writeActionsToString(((OFInstructionWriteActions) inst), log)); break; case APPLY_ACTIONS: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_APPLY_ACTIONS, InstructionUtils.applyActionsToString(((OFInstructionApplyActions) inst), log)); break; case CLEAR_ACTIONS: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_CLEAR_ACTIONS, InstructionUtils.clearActionsToString(((OFInstructionClearActions) inst), log)); break; case METER: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_GOTO_METER, InstructionUtils.meterToString(((OFInstructionMeter) inst), log)); break; case EXPERIMENTER: entry.put(StaticFlowEntryPusher.COLUMN_INSTR_EXPERIMENTER, InstructionUtils.experimenterToString(((OFInstructionExperimenter) inst), log)); break; default: log.error(STR, inst); } } } } Match match = fm.getMatch(); Iterator<MatchField<?>> itr = match.getMatchFields().iterator(); while(itr.hasNext()) { @SuppressWarnings(STR) MatchField mf = itr.next(); switch (mf.id) { case IN_PORT: if (match.supports(MatchField.IN_PORT) && match.isExact(MatchField.IN_PORT)) { entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, match.get(MatchField.IN_PORT).toString()); } else if (match.supportsMasked(MatchField.IN_PORT) && match.isPartiallyMasked(MatchField.IN_PORT)) { entry.put(StaticFlowEntryPusher.COLUMN_IN_PORT, match.getMasked(MatchField.IN_PORT).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_IN_PORT, match.getVersion().toString()); } break; case ETH_SRC: if (match.supports(MatchField.ETH_SRC) && match.isExact(MatchField.ETH_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, match.get(MatchField.ETH_SRC).toString()); } else if (match.supportsMasked(MatchField.ETH_SRC) && match.isPartiallyMasked(MatchField.ETH_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_SRC, match.getMasked(MatchField.ETH_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_DL_SRC, match.getVersion().toString()); } break; case ETH_DST: if (match.supports(MatchField.ETH_DST) && match.isExact(MatchField.ETH_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, match.get(MatchField.ETH_DST).toString()); } else if (match.supportsMasked(MatchField.ETH_DST) && match.isPartiallyMasked(MatchField.ETH_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_DST, match.getMasked(MatchField.ETH_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_DL_DST, match.getVersion().toString()); } break; case VLAN_VID: if (match.supports(MatchField.VLAN_VID) && match.isExact(MatchField.VLAN_VID)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, match.get(MatchField.VLAN_VID).toString()); } else if (match.supportsMasked(MatchField.VLAN_VID) && match.isPartiallyMasked(MatchField.VLAN_VID)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN, match.getMasked(MatchField.VLAN_VID).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_DL_VLAN, match.getVersion().toString()); } break; case VLAN_PCP: if (match.supports(MatchField.VLAN_PCP) && match.isExact(MatchField.VLAN_PCP)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.get(MatchField.VLAN_PCP).toString()); } else if (match.supportsMasked(MatchField.VLAN_PCP) && match.isPartiallyMasked(MatchField.VLAN_PCP)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.getMasked(MatchField.VLAN_PCP).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_DL_VLAN_PCP, match.getVersion().toString()); } break; case ETH_TYPE: if (match.supports(MatchField.ETH_TYPE) && match.isExact(MatchField.ETH_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, match.get(MatchField.ETH_TYPE).toString()); } else if (match.supportsMasked(MatchField.ETH_TYPE) && match.isPartiallyMasked(MatchField.ETH_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_DL_TYPE, match.getMasked(MatchField.ETH_TYPE).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_DL_TYPE, match.getVersion().toString()); } break; case IP_ECN: if (match.supports(MatchField.IP_ECN) && match.isExact(MatchField.IP_ECN)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_ECN, match.get(MatchField.IP_ECN).toString()); } else if (match.supportsMasked(MatchField.IP_ECN) && match.isPartiallyMasked(MatchField.IP_ECN)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_ECN, match.getMasked(MatchField.IP_ECN).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW_ECN, match.getVersion().toString()); } break; case IP_DSCP: if (match.supports(MatchField.IP_DSCP) && match.isExact(MatchField.IP_DSCP)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_DSCP, match.get(MatchField.IP_DSCP).toString()); } else if (match.supportsMasked(MatchField.IP_DSCP) && match.isPartiallyMasked(MatchField.IP_DSCP)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_DSCP, match.getMasked(MatchField.IP_DSCP).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW_DSCP, match.getVersion().toString()); } break; case IP_PROTO: if (match.supports(MatchField.IP_PROTO) && match.isExact(MatchField.IP_PROTO)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, match.get(MatchField.IP_PROTO).toString()); } else if (match.supportsMasked(MatchField.IP_PROTO) && match.isPartiallyMasked(MatchField.IP_PROTO)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_PROTO, match.getMasked(MatchField.IP_PROTO).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW_PROTO, match.getVersion().toString()); } break; case IPV4_SRC: if (match.supports(MatchField.IPV4_SRC) && match.isExact(MatchField.IPV4_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, match.get(MatchField.IPV4_SRC).toString()); } else if (match.supportsMasked(MatchField.IPV4_SRC) && match.isPartiallyMasked(MatchField.IPV4_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_SRC, match.getMasked(MatchField.IPV4_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW_SRC, match.getVersion().toString()); } break; case IPV4_DST: if (match.supports(MatchField.IPV4_DST) && match.isExact(MatchField.IPV4_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, match.get(MatchField.IPV4_DST).toString()); } else if (match.supportsMasked(MatchField.IPV4_DST) && match.isPartiallyMasked(MatchField.IPV4_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_NW_DST, match.getMasked(MatchField.IPV4_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW_DST, match.getVersion().toString()); } break; case TCP_SRC: if (match.supports(MatchField.TCP_SRC) && match.isExact(MatchField.TCP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_TCP_SRC, match.get(MatchField.TCP_SRC).toString()); } else if (match.supportsMasked(MatchField.TCP_SRC) && match.isPartiallyMasked(MatchField.TCP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_TCP_SRC, match.getMasked(MatchField.TCP_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_TCP_SRC, match.getVersion().toString()); } break; case UDP_SRC: if (match.supports(MatchField.UDP_SRC) && match.isExact(MatchField.UDP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_UDP_SRC, match.get(MatchField.UDP_SRC).toString()); } else if (match.supportsMasked(MatchField.UDP_SRC) && match.isPartiallyMasked(MatchField.UDP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_UDP_SRC, match.getMasked(MatchField.UDP_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_UDP_SRC, match.getVersion().toString()); } break; case SCTP_SRC: if (match.supports(MatchField.SCTP_SRC) && match.isExact(MatchField.SCTP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.get(MatchField.SCTP_SRC).toString()); } else if (match.supportsMasked(MatchField.SCTP_SRC) && match.isPartiallyMasked(MatchField.SCTP_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.getMasked(MatchField.SCTP_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_SCTP_SRC, match.getVersion().toString()); } break; case TCP_DST: if (match.supports(MatchField.TCP_DST) && match.isExact(MatchField.TCP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_TCP_DST, match.get(MatchField.TCP_DST).toString()); } else if (match.supportsMasked(MatchField.TCP_DST) && match.isPartiallyMasked(MatchField.TCP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_TCP_DST, match.getMasked(MatchField.TCP_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_TCP_DST, match.getVersion().toString()); } break; case UDP_DST: if (match.supports(MatchField.UDP_DST) && match.isExact(MatchField.UDP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_UDP_DST, match.get(MatchField.UDP_DST).toString()); } else if (match.supportsMasked(MatchField.UDP_DST) && match.isPartiallyMasked(MatchField.UDP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_UDP_DST, match.getMasked(MatchField.UDP_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_UDP_DST, match.getVersion().toString()); } break; case SCTP_DST: if (match.supports(MatchField.SCTP_DST) && match.isExact(MatchField.SCTP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_SCTP_DST, match.get(MatchField.SCTP_DST).toString()); } else if (match.supportsMasked(MatchField.SCTP_DST) && match.isPartiallyMasked(MatchField.SCTP_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_SCTP_DST, match.getMasked(MatchField.SCTP_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_SCTP_DST, match.getVersion().toString()); } break; case ICMPV4_TYPE: if (match.supports(MatchField.ICMPV4_TYPE) && match.isExact(MatchField.ICMPV4_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.get(MatchField.ICMPV4_TYPE).toString()); } else if (match.supportsMasked(MatchField.ICMPV4_TYPE) && match.isPartiallyMasked(MatchField.ICMPV4_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.getMasked(MatchField.ICMPV4_TYPE).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ICMP_TYPE, match.getVersion().toString()); } break; case ICMPV4_CODE: if (match.supports(MatchField.ICMPV4_CODE) && match.isExact(MatchField.ICMPV4_CODE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.get(MatchField.ICMPV4_CODE).toString()); } else if (match.supportsMasked(MatchField.ICMPV4_CODE) && match.isPartiallyMasked(MatchField.ICMPV4_CODE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.getMasked(MatchField.ICMPV4_CODE).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ICMP_CODE, match.getVersion().toString()); } break; case ARP_OP: if (match.supports(MatchField.ARP_OP) && match.isExact(MatchField.ARP_OP)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.get(MatchField.ARP_OP).toString()); } else if (match.supportsMasked(MatchField.ARP_OP) && match.isPartiallyMasked(MatchField.ARP_OP)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.getMasked(MatchField.ARP_OP).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ARP_OPCODE, match.getVersion().toString()); } break; case ARP_SHA: if (match.supports(MatchField.ARP_SHA) && match.isExact(MatchField.ARP_SHA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_SHA, match.get(MatchField.ARP_SHA).toString()); } else if (match.supportsMasked(MatchField.ARP_SHA) && match.isPartiallyMasked(MatchField.ARP_SHA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_SHA, match.getMasked(MatchField.ARP_SHA).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ARP_SHA, match.getVersion().toString()); } break; case ARP_THA: if (match.supports(MatchField.ARP_THA) && match.isExact(MatchField.ARP_THA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_DHA, match.get(MatchField.ARP_THA).toString()); } else if (match.supportsMasked(MatchField.ARP_THA) && match.isPartiallyMasked(MatchField.ARP_THA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_DHA, match.getMasked(MatchField.ARP_THA).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ARP_DHA, match.getVersion().toString()); } break; case ARP_SPA: if (match.supports(MatchField.ARP_SPA) && match.isExact(MatchField.ARP_SPA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_SPA, match.get(MatchField.ARP_SPA).toString()); } else if (match.supportsMasked(MatchField.ARP_SPA) && match.isPartiallyMasked(MatchField.ARP_SPA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_SPA, match.getMasked(MatchField.ARP_SPA).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ARP_SPA, match.getVersion().toString()); } break; case ARP_TPA: if (match.supports(MatchField.ARP_TPA) && match.isExact(MatchField.ARP_TPA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_DPA, match.get(MatchField.ARP_TPA).toString()); } else if (match.supportsMasked(MatchField.ARP_TPA) && match.isPartiallyMasked(MatchField.ARP_TPA)) { entry.put(StaticFlowEntryPusher.COLUMN_ARP_DPA, match.getMasked(MatchField.ARP_TPA).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ARP_DPA, match.getVersion().toString()); } break; case IPV6_SRC: if (match.supports(MatchField.IPV6_SRC) && match.isExact(MatchField.IPV6_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_NW6_SRC, match.get(MatchField.IPV6_SRC).toString()); } else if (match.supportsMasked(MatchField.IPV6_SRC) && match.isPartiallyMasked(MatchField.IPV6_SRC)) { entry.put(StaticFlowEntryPusher.COLUMN_NW6_SRC, match.getMasked(MatchField.IPV6_SRC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW6_SRC, match.getVersion().toString()); } break; case IPV6_DST: if (match.supports(MatchField.IPV6_DST) && match.isExact(MatchField.IPV6_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_NW6_DST, match.get(MatchField.IPV6_DST).toString()); } else if (match.supportsMasked(MatchField.IPV6_DST) && match.isPartiallyMasked(MatchField.IPV6_DST)) { entry.put(StaticFlowEntryPusher.COLUMN_NW6_DST, match.getMasked(MatchField.IPV6_DST).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_NW6_DST, match.getVersion().toString()); } break; case IPV6_FLABEL: if (match.supports(MatchField.IPV6_FLABEL) && match.isExact(MatchField.IPV6_FLABEL)) { entry.put(StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.get(MatchField.IPV6_FLABEL).toString()); } else if (match.supportsMasked(MatchField.IPV6_FLABEL) && match.isPartiallyMasked(MatchField.IPV6_FLABEL)) { entry.put(StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.getMasked(MatchField.IPV6_FLABEL).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_IPV6_FLOW_LABEL, match.getVersion().toString()); } break; case ICMPV6_TYPE: if (match.supports(MatchField.ICMPV6_TYPE) && match.isExact(MatchField.ICMPV6_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.get(MatchField.ICMPV6_TYPE).toString()); } else if (match.supportsMasked(MatchField.ICMPV6_TYPE) && match.isPartiallyMasked(MatchField.ICMPV6_TYPE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.getMasked(MatchField.ICMPV6_TYPE).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ICMP6_TYPE, match.getVersion().toString()); } break; case ICMPV6_CODE: if (match.supports(MatchField.ICMPV6_CODE) && match.isExact(MatchField.ICMPV6_CODE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.get(MatchField.ICMPV6_CODE).toString()); } else if (match.supportsMasked(MatchField.ICMPV6_CODE) && match.isPartiallyMasked(MatchField.ICMPV6_CODE)) { entry.put(StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.getMasked(MatchField.ICMPV6_CODE).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ICMP6_CODE, match.getVersion().toString()); } break; case IPV6_ND_SLL: if (match.supports(MatchField.IPV6_ND_SLL) && match.isExact(MatchField.IPV6_ND_SLL)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_SLL, match.get(MatchField.IPV6_ND_SLL).toString()); } else if (match.supportsMasked(MatchField.IPV6_ND_SLL) && match.isPartiallyMasked(MatchField.IPV6_ND_SLL)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_SLL, match.getMasked(MatchField.IPV6_ND_SLL).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ND_SLL, match.getVersion().toString()); } break; case IPV6_ND_TLL: if (match.supports(MatchField.IPV6_ND_TLL) && match.isExact(MatchField.IPV6_ND_TLL)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_TLL, match.get(MatchField.IPV6_ND_TLL).toString()); } else if (match.supportsMasked(MatchField.IPV6_ND_TLL) && match.isPartiallyMasked(MatchField.IPV6_ND_TLL)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_TLL, match.getMasked(MatchField.IPV6_ND_TLL).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ND_TLL, match.getVersion().toString()); } break; case IPV6_ND_TARGET: if (match.supports(MatchField.IPV6_ND_TARGET) && match.isExact(MatchField.IPV6_ND_TARGET)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_TARGET, match.get(MatchField.IPV6_ND_TARGET).toString()); } else if (match.supportsMasked(MatchField.IPV6_ND_TARGET) && match.isPartiallyMasked(MatchField.IPV6_ND_TARGET)) { entry.put(StaticFlowEntryPusher.COLUMN_ND_TARGET, match.getMasked(MatchField.IPV6_ND_TARGET).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_ND_TARGET, match.getVersion().toString()); } break; case MPLS_LABEL: if (match.supports(MatchField.MPLS_LABEL) && match.isExact(MatchField.MPLS_LABEL)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.get(MatchField.MPLS_LABEL).toString()); } else if (match.supportsMasked(MatchField.MPLS_LABEL) && match.isPartiallyMasked(MatchField.MPLS_LABEL)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.getMasked(MatchField.MPLS_LABEL).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_MPLS_LABEL, match.getVersion().toString()); } break; case MPLS_TC: if (match.supports(MatchField.MPLS_TC) && match.isExact(MatchField.MPLS_TC)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_TC, match.get(MatchField.MPLS_TC).toString()); } else if (match.supportsMasked(MatchField.MPLS_TC) && match.isPartiallyMasked(MatchField.MPLS_TC)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_TC, match.getMasked(MatchField.MPLS_TC).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_MPLS_TC, match.getVersion().toString()); } break; case MPLS_BOS: if (match.supports(MatchField.MPLS_BOS) && match.isExact(MatchField.MPLS_BOS)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.get(MatchField.MPLS_BOS).toString()); } else if (match.supportsMasked(MatchField.MPLS_BOS) && match.isPartiallyMasked(MatchField.MPLS_BOS)) { entry.put(StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.getMasked(MatchField.MPLS_BOS).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_MPLS_BOS, match.getVersion().toString()); } break; case METADATA: if (match.supports(MatchField.METADATA) && match.isExact(MatchField.METADATA)) { entry.put(StaticFlowEntryPusher.COLUMN_METADATA, match.get(MatchField.METADATA).toString()); } else if (match.supportsMasked(MatchField.METADATA) && match.isPartiallyMasked(MatchField.METADATA)) { entry.put(StaticFlowEntryPusher.COLUMN_METADATA, match.getMasked(MatchField.METADATA).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_METADATA, match.getVersion().toString()); } break; case TUNNEL_ID: if (match.supports(MatchField.TUNNEL_ID) && match.isExact(MatchField.TUNNEL_ID)) { entry.put(StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.get(MatchField.TUNNEL_ID).toString()); } else if (match.supportsMasked(MatchField.TUNNEL_ID) && match.isPartiallyMasked(MatchField.TUNNEL_ID)) { entry.put(StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.getMasked(MatchField.TUNNEL_ID).toString()); } else { log.error(STR, StaticFlowEntryPusher.COLUMN_TUNNEL_ID, match.getVersion().toString()); } break; default: log.error(STR, mf, mf.id); break; } } int result = StaticFlowEntryPusherResource.checkActions(entry); if (result == -1) throw new Exception(STR); return entry; } /** * Turns a JSON formatted Static Flow Pusher string into a storage entry * Expects a string in JSON along the lines of: * { * STR: STR, * "name": STR, * STR: "0", * STR: "32768", * STR: "1", * STR: STR, * } | /**
* Parses an OFFlowMod (and it's inner Match) to the storage entry format.
* @param fm The FlowMod to parse
* @param sw The switch the FlowMod is going to be installed on
* @param name The name of this static flow entry
* @return A Map representation of the storage entry
*/ | Parses an OFFlowMod (and it's inner Match) to the storage entry format | flowModToStorageEntry | {
"repo_name": "netgroup/floodlight",
"path": "src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntries.java",
"license": "apache-2.0",
"size": 43375
} | [
"java.util.HashMap",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"net.floodlightcontroller.staticflowentry.web.StaticFlowEntryPusherResource",
"net.floodlightcontroller.util.ActionUtils",
"net.floodlightcontroller.util.InstructionUtils",
"org.projectfloodlight.openflow.protocol.OFFlowMod",
"org.projectfloodlight.openflow.protocol.instruction.OFInstruction",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionClearActions",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionExperimenter",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteActions",
"org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata",
"org.projectfloodlight.openflow.protocol.match.Match",
"org.projectfloodlight.openflow.protocol.match.MatchField"
] | import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; import net.floodlightcontroller.staticflowentry.web.StaticFlowEntryPusherResource; import net.floodlightcontroller.util.ActionUtils; import net.floodlightcontroller.util.InstructionUtils; import org.projectfloodlight.openflow.protocol.OFFlowMod; import org.projectfloodlight.openflow.protocol.instruction.OFInstruction; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionApplyActions; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionClearActions; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionExperimenter; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionGotoTable; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionMeter; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteActions; import org.projectfloodlight.openflow.protocol.instruction.OFInstructionWriteMetadata; import org.projectfloodlight.openflow.protocol.match.Match; import org.projectfloodlight.openflow.protocol.match.MatchField; | import java.util.*; import net.floodlightcontroller.staticflowentry.web.*; import net.floodlightcontroller.util.*; import org.projectfloodlight.openflow.protocol.*; import org.projectfloodlight.openflow.protocol.instruction.*; import org.projectfloodlight.openflow.protocol.match.*; | [
"java.util",
"net.floodlightcontroller.staticflowentry",
"net.floodlightcontroller.util",
"org.projectfloodlight.openflow"
] | java.util; net.floodlightcontroller.staticflowentry; net.floodlightcontroller.util; org.projectfloodlight.openflow; | 670,156 |
protected void checkTomcatResponse( TomcatManagerResponse tomcatResponse )
throws MojoExecutionException
{
int statusCode = tomcatResponse.getStatusCode();
if ( statusCode >= 400 )
{
getLog().error( messagesProvider.getMessage( "tomcatHttpStatusError", statusCode,
tomcatResponse.getReasonPhrase() ) );
throw new MojoExecutionException(
messagesProvider.getMessage( "tomcatHttpStatusError", statusCode,
tomcatResponse.getReasonPhrase() ) + ": "
+ tomcatResponse.getHttpResponseBody() );
}
} | void function( TomcatManagerResponse tomcatResponse ) throws MojoExecutionException { int statusCode = tomcatResponse.getStatusCode(); if ( statusCode >= 400 ) { getLog().error( messagesProvider.getMessage( STR, statusCode, tomcatResponse.getReasonPhrase() ) ); throw new MojoExecutionException( messagesProvider.getMessage( STR, statusCode, tomcatResponse.getReasonPhrase() ) + STR + tomcatResponse.getHttpResponseBody() ); } } | /**
* Check response of Tomcat to know if ok or not.
*
* @param tomcatResponse response of tomcat return by TomcatManager class
* @throws org.apache.maven.plugin.MojoExecutionException
* if HTTP status code greater than 400 (included)
*/ | Check response of Tomcat to know if ok or not | checkTomcatResponse | {
"repo_name": "karthikjaps/Tomcat",
"path": "tomcat8-maven-plugin/src/main/java/org/apache/tomcat/maven/plugin/tomcat8/AbstractTomcat8Mojo.java",
"license": "apache-2.0",
"size": 2991
} | [
"org.apache.maven.plugin.MojoExecutionException",
"org.apache.tomcat.maven.common.deployer.TomcatManagerResponse"
] | import org.apache.maven.plugin.MojoExecutionException; import org.apache.tomcat.maven.common.deployer.TomcatManagerResponse; | import org.apache.maven.plugin.*; import org.apache.tomcat.maven.common.deployer.*; | [
"org.apache.maven",
"org.apache.tomcat"
] | org.apache.maven; org.apache.tomcat; | 2,556,310 |
@Test
public void getUsedBytesOnTiers() {
long usedBytes = TEST_BLOCK_SIZE * COMMITTED_BLOCKS_NUM;
Map<String, Long> usedBytesOnTiers =
ImmutableMap.of(Constants.MEDIUM_MEM, usedBytes, Constants.MEDIUM_SSD, 0L);
Assert.assertEquals(usedBytesOnTiers, mBlockStoreMeta.getUsedBytesOnTiers());
} | void function() { long usedBytes = TEST_BLOCK_SIZE * COMMITTED_BLOCKS_NUM; Map<String, Long> usedBytesOnTiers = ImmutableMap.of(Constants.MEDIUM_MEM, usedBytes, Constants.MEDIUM_SSD, 0L); Assert.assertEquals(usedBytesOnTiers, mBlockStoreMeta.getUsedBytesOnTiers()); } | /**
* Tests the {@link BlockStoreMeta#getUsedBytesOnTiers()} method.
*/ | Tests the <code>BlockStoreMeta#getUsedBytesOnTiers()</code> method | getUsedBytesOnTiers | {
"repo_name": "wwjiang007/alluxio",
"path": "core/server/worker/src/test/java/alluxio/worker/block/BlockStoreMetaTest.java",
"license": "apache-2.0",
"size": 6020
} | [
"com.google.common.collect.ImmutableMap",
"java.util.Map",
"org.junit.Assert"
] | import com.google.common.collect.ImmutableMap; import java.util.Map; import org.junit.Assert; | import com.google.common.collect.*; import java.util.*; import org.junit.*; | [
"com.google.common",
"java.util",
"org.junit"
] | com.google.common; java.util; org.junit; | 1,190,246 |
@Override
public String getFilename() {
return new File(this.url.getFile()).getName();
} | String function() { return new File(this.url.getFile()).getName(); } | /**
* This implementation returns the name of the file that this URL refers to.
* @see java.net.URL#getFile()
* @see java.io.File#getName()
*/ | This implementation returns the name of the file that this URL refers to | getFilename | {
"repo_name": "boggad/jdk9-sample",
"path": "sample-catalog/spring-jdk9/src/spring.core/org/springframework/core/io/UrlResource.java",
"license": "mit",
"size": 7936
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 946,445 |
long getId(int position) {
Cursor c = (Cursor) getItem(position);
return getId(c);
} | long getId(int position) { Cursor c = (Cursor) getItem(position); return getId(c); } | /**
* Returns the ID of the given row. It may be a mailbox or account ID depending upon the
* result of {@link #isAccountRow}.
*/ | Returns the ID of the given row. It may be a mailbox or account ID depending upon the result of <code>#isAccountRow</code> | getId | {
"repo_name": "rex-xxx/mt6572_x201",
"path": "packages/apps/Email/src/com/android/email/activity/MailboxFragmentAdapter.java",
"license": "gpl-2.0",
"size": 32513
} | [
"android.database.Cursor"
] | import android.database.Cursor; | import android.database.*; | [
"android.database"
] | android.database; | 1,186,589 |
private void runCopyJob(final Path inputRoot, final Path outputRoot,
final String snapshotName, final Path snapshotDir, final boolean verifyChecksum,
final String filesUser, final String filesGroup, final int filesMode,
final int mappers, final int bandwidthMB)
throws IOException, InterruptedException, ClassNotFoundException {
Configuration conf = getConf();
if (filesGroup != null) conf.set(CONF_FILES_GROUP, filesGroup);
if (filesUser != null) conf.set(CONF_FILES_USER, filesUser);
if (mappers > 0) {
conf.setInt(CONF_NUM_SPLITS, mappers);
conf.setInt(MR_NUM_MAPS, mappers);
}
conf.setInt(CONF_FILES_MODE, filesMode);
conf.setBoolean(CONF_CHECKSUM_VERIFY, verifyChecksum);
conf.set(CONF_OUTPUT_ROOT, outputRoot.toString());
conf.set(CONF_INPUT_ROOT, inputRoot.toString());
conf.setInt(CONF_BANDWIDTH_MB, bandwidthMB);
conf.set(CONF_SNAPSHOT_NAME, snapshotName);
conf.set(CONF_SNAPSHOT_DIR, snapshotDir.toString());
Job job = new Job(conf);
job.setJobName("TrafExportSnapshot-" + snapshotName);
job.setJarByClass(TrafExportSnapshot.class);
TableMapReduceUtil.addDependencyJars(job);
job.setMapperClass(ExportMapper.class);
job.setInputFormatClass(ExportSnapshotInputFormat.class);
job.setOutputFormatClass(NullOutputFormat.class);
job.setMapSpeculativeExecution(false);
job.setNumReduceTasks(0);
// Acquire the delegation Tokens
TokenCache.obtainTokensForNamenodes(job.getCredentials(),
new Path[] { inputRoot, outputRoot }, conf);
// Run the MR Job
if (!job.waitForCompletion(true)) {
// TODO: Replace the fixed string with job.getStatus().getFailureInfo()
// when it will be available on all the supported versions.
throw new ExportSnapshotException("Copy Files Map-Reduce Job failed");
}
} | void function(final Path inputRoot, final Path outputRoot, final String snapshotName, final Path snapshotDir, final boolean verifyChecksum, final String filesUser, final String filesGroup, final int filesMode, final int mappers, final int bandwidthMB) throws IOException, InterruptedException, ClassNotFoundException { Configuration conf = getConf(); if (filesGroup != null) conf.set(CONF_FILES_GROUP, filesGroup); if (filesUser != null) conf.set(CONF_FILES_USER, filesUser); if (mappers > 0) { conf.setInt(CONF_NUM_SPLITS, mappers); conf.setInt(MR_NUM_MAPS, mappers); } conf.setInt(CONF_FILES_MODE, filesMode); conf.setBoolean(CONF_CHECKSUM_VERIFY, verifyChecksum); conf.set(CONF_OUTPUT_ROOT, outputRoot.toString()); conf.set(CONF_INPUT_ROOT, inputRoot.toString()); conf.setInt(CONF_BANDWIDTH_MB, bandwidthMB); conf.set(CONF_SNAPSHOT_NAME, snapshotName); conf.set(CONF_SNAPSHOT_DIR, snapshotDir.toString()); Job job = new Job(conf); job.setJobName(STR + snapshotName); job.setJarByClass(TrafExportSnapshot.class); TableMapReduceUtil.addDependencyJars(job); job.setMapperClass(ExportMapper.class); job.setInputFormatClass(ExportSnapshotInputFormat.class); job.setOutputFormatClass(NullOutputFormat.class); job.setMapSpeculativeExecution(false); job.setNumReduceTasks(0); TokenCache.obtainTokensForNamenodes(job.getCredentials(), new Path[] { inputRoot, outputRoot }, conf); if (!job.waitForCompletion(true)) { throw new ExportSnapshotException(STR); } } | /**
* Run Map-Reduce Job to perform the files copy.
*/ | Run Map-Reduce Job to perform the files copy | runCopyJob | {
"repo_name": "apache/incubator-trafodion",
"path": "core/sqf/hbase_utilities/src/main/java/org/trafodion/utility/backuprestore/TrafExportSnapshot.java",
"license": "apache-2.0",
"size": 45743
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.fs.Path",
"org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil",
"org.apache.hadoop.mapreduce.Job",
"org.apache.hadoop.mapreduce.lib.output.NullOutputFormat",
"org.apache.hadoop.mapreduce.security.TokenCache"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat; import org.apache.hadoop.mapreduce.security.TokenCache; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.mapreduce.*; import org.apache.hadoop.mapreduce.*; import org.apache.hadoop.mapreduce.lib.output.*; import org.apache.hadoop.mapreduce.security.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 959,192 |
protected void child(Production node, Node child)
throws ParseException {
switch (node.getId()) {
case GrammarConstants.GRAMMAR:
childGrammar(node, child);
break;
case GrammarConstants.HEADER_PART:
childHeaderPart(node, child);
break;
case GrammarConstants.HEADER_DECLARATION:
childHeaderDeclaration(node, child);
break;
case GrammarConstants.TOKEN_PART:
childTokenPart(node, child);
break;
case GrammarConstants.TOKEN_DECLARATION:
childTokenDeclaration(node, child);
break;
case GrammarConstants.TOKEN_VALUE:
childTokenValue(node, child);
break;
case GrammarConstants.TOKEN_HANDLING:
childTokenHandling(node, child);
break;
case GrammarConstants.PRODUCTION_PART:
childProductionPart(node, child);
break;
case GrammarConstants.PRODUCTION_DECLARATION:
childProductionDeclaration(node, child);
break;
case GrammarConstants.PRODUCTION:
childProduction(node, child);
break;
case GrammarConstants.PRODUCTION_ATOM:
childProductionAtom(node, child);
break;
}
} | void function(Production node, Node child) throws ParseException { switch (node.getId()) { case GrammarConstants.GRAMMAR: childGrammar(node, child); break; case GrammarConstants.HEADER_PART: childHeaderPart(node, child); break; case GrammarConstants.HEADER_DECLARATION: childHeaderDeclaration(node, child); break; case GrammarConstants.TOKEN_PART: childTokenPart(node, child); break; case GrammarConstants.TOKEN_DECLARATION: childTokenDeclaration(node, child); break; case GrammarConstants.TOKEN_VALUE: childTokenValue(node, child); break; case GrammarConstants.TOKEN_HANDLING: childTokenHandling(node, child); break; case GrammarConstants.PRODUCTION_PART: childProductionPart(node, child); break; case GrammarConstants.PRODUCTION_DECLARATION: childProductionDeclaration(node, child); break; case GrammarConstants.PRODUCTION: childProduction(node, child); break; case GrammarConstants.PRODUCTION_ATOM: childProductionAtom(node, child); break; } } | /**
* Called when adding a child to a parse tree node.
*
* @param node the parent node
* @param child the child node, or null
*
* @throws ParseException if the node analysis discovered errors
*/ | Called when adding a child to a parse tree node | child | {
"repo_name": "runner-mei/mibble",
"path": "src/main/java/net/percederberg/grammatica/GrammarAnalyzer.java",
"license": "gpl-2.0",
"size": 36326
} | [
"net.percederberg.grammatica.parser.Node",
"net.percederberg.grammatica.parser.ParseException",
"net.percederberg.grammatica.parser.Production"
] | import net.percederberg.grammatica.parser.Node; import net.percederberg.grammatica.parser.ParseException; import net.percederberg.grammatica.parser.Production; | import net.percederberg.grammatica.parser.*; | [
"net.percederberg.grammatica"
] | net.percederberg.grammatica; | 2,618,251 |
public RuleConfiguredTargetBuilder addFilesToRun(NestedSet<Artifact> files) {
filesToRunBuilder.addTransitive(files);
return this;
} | RuleConfiguredTargetBuilder function(NestedSet<Artifact> files) { filesToRunBuilder.addTransitive(files); return this; } | /**
* Add files required to run the target. Artifacts from {@link #setFilesToBuild} and the runfiles
* middleman, if any, are added automatically.
*/ | Add files required to run the target. Artifacts from <code>#setFilesToBuild</code> and the runfiles middleman, if any, are added automatically | addFilesToRun | {
"repo_name": "meteorcloudy/bazel",
"path": "src/main/java/com/google/devtools/build/lib/analysis/RuleConfiguredTargetBuilder.java",
"license": "apache-2.0",
"size": 29384
} | [
"com.google.devtools.build.lib.actions.Artifact",
"com.google.devtools.build.lib.collect.nestedset.NestedSet"
] | import com.google.devtools.build.lib.actions.Artifact; import com.google.devtools.build.lib.collect.nestedset.NestedSet; | import com.google.devtools.build.lib.actions.*; import com.google.devtools.build.lib.collect.nestedset.*; | [
"com.google.devtools"
] | com.google.devtools; | 569,366 |
private void writeInputFile (File inputFile) {
ArrayList<BinLevel> bins = binning.getBins ();
BufferedWriter writer = null;
try {
writer = new BufferedWriter (new FileWriter (inputFile));
writer.write (String.format ("%-20d numcrit\n", bins.size ()));
// Output the crit levels and the number of bins.
for (int j = 0; j < bins.size (); j ++) {
writer.write (String.format (
"%-20.6f %-20d\n",
bins.get (j).getCrit (),
bins.get (j).getLevel ()
));
}
// Write the omega value.
writer.write (
String.format ("%-20.5f omega\n", parameterSet.getOmega ())
);
// Write the sigma value.
writer.write (
String.format ("%-20.5f sigma\n", parameterSet.getSigma ())
);
// Write the npop value.
writer.write (
String.format ("%-20d npop\n", parameterSet.getNpop ())
);
// Write the nu value.
writer.write (String.format ("%-20d nu\n", nu));
// Write the nrep value.
writer.write (String.format ("%-20d nrep\n", nrep));
// Create the random number seed; an odd integer less than nine
// digits long.
long iii = (long)(100000000 * Math.random ());
if (iii % 2 == 0) {
iii ++;
}
// Write the random number seed.
writer.write (
String.format ("%-20d iii (random number seed)\n", iii)
);
// Write the length of the sequences.
writer.write (
String.format (
"%-20d lengthseq (after deleting gaps, etc.)\n",
length
)
);
// Write the whichavg value.
int whichavg = masterVariables.getCriterion ();
writer.write (String.format ("%-20d whichavg\n", whichavg));
}
catch (IOException e) {
System.out.println ("Error writing the input file.");
}
finally {
if (writer != null) {
try {
writer.close ();
}
catch (IOException e) {
System.out.println ("Error closing the input file.");
}
}
}
} | void function (File inputFile) { ArrayList<BinLevel> bins = binning.getBins (); BufferedWriter writer = null; try { writer = new BufferedWriter (new FileWriter (inputFile)); writer.write (String.format (STR, bins.size ())); for (int j = 0; j < bins.size (); j ++) { writer.write (String.format ( STR, bins.get (j).getCrit (), bins.get (j).getLevel () )); } writer.write ( String.format (STR, parameterSet.getOmega ()) ); writer.write ( String.format (STR, parameterSet.getSigma ()) ); writer.write ( String.format (STR, parameterSet.getNpop ()) ); writer.write (String.format (STR, nu)); writer.write (String.format (STR, nrep)); long iii = (long)(100000000 * Math.random ()); if (iii % 2 == 0) { iii ++; } writer.write ( String.format (STR, iii) ); writer.write ( String.format ( STR, length ) ); int whichavg = masterVariables.getCriterion (); writer.write (String.format (STR, whichavg)); } catch (IOException e) { System.out.println (STR); } finally { if (writer != null) { try { writer.close (); } catch (IOException e) { System.out.println (STR); } } } } | /**
* Private method to write the input file for the hillclimb program.
*
* @param inputFile The file to write to.
*/ | Private method to write the input file for the hillclimb program | writeInputFile | {
"repo_name": "sandain/es1",
"path": "src/java/Hillclimb.java",
"license": "gpl-3.0",
"size": 8513
} | [
"java.io.BufferedWriter",
"java.io.File",
"java.io.FileWriter",
"java.io.IOException",
"java.util.ArrayList"
] | import java.io.BufferedWriter; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,032,700 |
void write(LogEntry logEntry) throws Exception;
| void write(LogEntry logEntry) throws Exception; | /**
* Write a log entry.
*
* @param logEntry
* Log entry to output
*
* @throws Exception
* Failed to write the log entry
*/ | Write a log entry | write | {
"repo_name": "yarish/tinylog",
"path": "tinylog/src/main/java/org/pmw/tinylog/writers/Writer.java",
"license": "apache-2.0",
"size": 2870
} | [
"org.pmw.tinylog.LogEntry"
] | import org.pmw.tinylog.LogEntry; | import org.pmw.tinylog.*; | [
"org.pmw.tinylog"
] | org.pmw.tinylog; | 356,622 |
@Column(name = "epic", precision = 32)
public Integer getEpic() {
return (Integer) get(6);
} | @Column(name = "epic", precision = 32) Integer function() { return (Integer) get(6); } | /**
* Getter for <code>public.story.epic</code>.
*/ | Getter for <code>public.story.epic</code> | getEpic | {
"repo_name": "bisaga/Planitia",
"path": "src/main/java/com/bisaga/planitia/generated/tables/records/StoryRecord.java",
"license": "gpl-3.0",
"size": 11683
} | [
"javax.persistence.Column"
] | import javax.persistence.Column; | import javax.persistence.*; | [
"javax.persistence"
] | javax.persistence; | 2,050,178 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.