method stringlengths 13 441k | clean_method stringlengths 7 313k | doc stringlengths 17 17.3k | comment stringlengths 3 1.42k | method_name stringlengths 1 273 | extra dict | imports list | imports_info stringlengths 19 34.8k | cluster_imports_info stringlengths 15 3.66k | libraries list | libraries_info stringlengths 6 661 | id int64 0 2.92M |
|---|---|---|---|---|---|---|---|---|---|---|---|
private void mockApplications(String appsConfig) {
int id = 1;
HashMap<String, HashSet<String>> userMap = new HashMap<String, HashSet<String>>();
LeafQueue queue = null;
for (String a : appsConfig.split(";")) {
String[] strs = a.split("\t");
String queueName = strs[0];
// get containers
List<RMContainer> liveContainers = new ArrayList<RMContainer>();
List<RMContainer> reservedContainers = new ArrayList<RMContainer>();
ApplicationId appId = ApplicationId.newInstance(0L, id);
ApplicationAttemptId appAttemptId = ApplicationAttemptId
.newInstance(appId, 1);
FiCaSchedulerApp app = mock(FiCaSchedulerApp.class);
when(app.getAMResource(anyString()))
.thenReturn(Resources.createResource(0, 0));
mockContainers(strs[1], app, appAttemptId, queueName, reservedContainers,
liveContainers);
LOG.debug("Application mock: queue: " + queueName + ", appId:" + appId);
when(app.getLiveContainers()).thenReturn(liveContainers);
when(app.getReservedContainers()).thenReturn(reservedContainers);
when(app.getApplicationAttemptId()).thenReturn(appAttemptId);
when(app.getApplicationId()).thenReturn(appId);
// add to LeafQueue
queue = (LeafQueue) nameToCSQueues.get(queueName);
queue.getApplications().add(app);
queue.getAllApplications().add(app);
HashSet<String> users = userMap.get(queueName);
if (null == users) {
users = new HashSet<String>();
userMap.put(queueName, users);
}
users.add(app.getUser());
id++;
}
for (String queueName : userMap.keySet()) {
queue = (LeafQueue) nameToCSQueues.get(queueName);
// Currently we have user-limit test support only for default label.
Resource totResoucePerPartition = partitionToResource.get("");
Resource capacity = Resources.multiply(totResoucePerPartition,
queue.getQueueCapacities().getAbsoluteCapacity());
HashSet<String> users = userMap.get(queue.getQueueName());
Resource userLimit = Resources.divideAndCeil(rc, capacity, users.size());
for (String user : users) {
when(queue.getUserLimitPerUser(eq(user), any(Resource.class),
anyString())).thenReturn(userLimit);
}
}
} | void function(String appsConfig) { int id = 1; HashMap<String, HashSet<String>> userMap = new HashMap<String, HashSet<String>>(); LeafQueue queue = null; for (String a : appsConfig.split(";")) { String[] strs = a.split("\t"); String queueName = strs[0]; List<RMContainer> liveContainers = new ArrayList<RMContainer>(); List<RMContainer> reservedContainers = new ArrayList<RMContainer>(); ApplicationId appId = ApplicationId.newInstance(0L, id); ApplicationAttemptId appAttemptId = ApplicationAttemptId .newInstance(appId, 1); FiCaSchedulerApp app = mock(FiCaSchedulerApp.class); when(app.getAMResource(anyString())) .thenReturn(Resources.createResource(0, 0)); mockContainers(strs[1], app, appAttemptId, queueName, reservedContainers, liveContainers); LOG.debug(STR + queueName + STR + appId); when(app.getLiveContainers()).thenReturn(liveContainers); when(app.getReservedContainers()).thenReturn(reservedContainers); when(app.getApplicationAttemptId()).thenReturn(appAttemptId); when(app.getApplicationId()).thenReturn(appId); queue = (LeafQueue) nameToCSQueues.get(queueName); queue.getApplications().add(app); queue.getAllApplications().add(app); HashSet<String> users = userMap.get(queueName); if (null == users) { users = new HashSet<String>(); userMap.put(queueName, users); } users.add(app.getUser()); id++; } for (String queueName : userMap.keySet()) { queue = (LeafQueue) nameToCSQueues.get(queueName); Resource totResoucePerPartition = partitionToResource.get(""); Resource capacity = Resources.multiply(totResoucePerPartition, queue.getQueueCapacities().getAbsoluteCapacity()); HashSet<String> users = userMap.get(queue.getQueueName()); Resource userLimit = Resources.divideAndCeil(rc, capacity, users.size()); for (String user : users) { when(queue.getUserLimitPerUser(eq(user), any(Resource.class), anyString())).thenReturn(userLimit); } } } | /**
* Format is:
* <pre>
* queueName\t // app1
* (priority,resource,host,expression,#repeat,reserved)
* (priority,resource,host,expression,#repeat,reserved);
* queueName\t // app2
* </pre>
*/ | Format is: <code> queueName\t // app1 (priority,resource,host,expression,#repeat,reserved) (priority,resource,host,expression,#repeat,reserved); queueName\t // app2 </code> | mockApplications | {
"repo_name": "jaypatil/hadoop",
"path": "hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/monitor/capacity/ProportionalCapacityPreemptionPolicyMockFramework.java",
"license": "gpl-3.0",
"size": 29967
} | [
"java.util.ArrayList",
"java.util.HashMap",
"java.util.HashSet",
"java.util.List",
"org.apache.hadoop.yarn.api.records.ApplicationAttemptId",
"org.apache.hadoop.yarn.api.records.ApplicationId",
"org.apache.hadoop.yarn.api.records.Resource",
"org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RM... | import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.List; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerApp; import org.apache.hadoop.yarn.util.resource.Resources; import org.mockito.Matchers; import org.mockito.Mockito; | import java.util.*; import org.apache.hadoop.yarn.api.records.*; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.*; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.*; import org.apache.hadoop.yarn.util.resource.*; import org.mockito.*; | [
"java.util",
"org.apache.hadoop",
"org.mockito"
] | java.util; org.apache.hadoop; org.mockito; | 2,230,755 |
private static Buffer toBuffer(Record record) throws IOException {
int recordSize = record.computeSerializedSize();
int totalSize = 1 + VarInts.computeUnsignedIntSize(recordSize) + recordSize;
Buffer buffer = Buffers.allocate(totalSize);
buffer.writeByte(record.getType());
VarInts.writeUnsignedInt(buffer, recordSize);
record.writeTo(buffer);
return buffer;
}
private Builder(TimeSeriesDefinition definition) {
notNull(definition, "the definition parameter must not be null.");
this.builder = DefaultRecordIterator.newBuilder(definition);
this.definition = definition;
}
} | static Buffer function(Record record) throws IOException { int recordSize = record.computeSerializedSize(); int totalSize = 1 + VarInts.computeUnsignedIntSize(recordSize) + recordSize; Buffer buffer = Buffers.allocate(totalSize); buffer.writeByte(record.getType()); VarInts.writeUnsignedInt(buffer, recordSize); record.writeTo(buffer); return buffer; } private Builder(TimeSeriesDefinition definition) { notNull(definition, STR); this.builder = DefaultRecordIterator.newBuilder(definition); this.definition = definition; } } | /**
* Serializes the specified record.
*
* @param record the record to serialize
* @return the byte representation of specified record.
* @throws IOException if an I/O problem occurs
*/ | Serializes the specified record | toBuffer | {
"repo_name": "blerer/horizondb-model",
"path": "src/main/java/io/horizondb/model/core/iterators/BinaryTimeSeriesRecordIterator.java",
"license": "apache-2.0",
"size": 11360
} | [
"io.horizondb.io.Buffer",
"io.horizondb.io.buffers.Buffers",
"io.horizondb.io.encoding.VarInts",
"io.horizondb.model.core.Record",
"io.horizondb.model.schema.TimeSeriesDefinition",
"java.io.IOException",
"org.apache.commons.lang.Validate"
] | import io.horizondb.io.Buffer; import io.horizondb.io.buffers.Buffers; import io.horizondb.io.encoding.VarInts; import io.horizondb.model.core.Record; import io.horizondb.model.schema.TimeSeriesDefinition; import java.io.IOException; import org.apache.commons.lang.Validate; | import io.horizondb.io.*; import io.horizondb.io.buffers.*; import io.horizondb.io.encoding.*; import io.horizondb.model.core.*; import io.horizondb.model.schema.*; import java.io.*; import org.apache.commons.lang.*; | [
"io.horizondb.io",
"io.horizondb.model",
"java.io",
"org.apache.commons"
] | io.horizondb.io; io.horizondb.model; java.io; org.apache.commons; | 489,894 |
public boolean deleteCategory(final String groupname, final Category cat) {
getWriteLock().lock();
try {
final Enumeration<Categorygroup> enumCG = m_config.enumerateCategorygroup();
while (enumCG.hasMoreElements()) {
final Categorygroup cg = enumCG.nextElement();
if (cg.getName().equals(groupname)) {
// get categories and delete
final Categories cats = cg.getCategories();
cats.removeCategory(cat);
return true;
}
}
} finally {
getWriteLock().unlock();
}
return false;
} | boolean function(final String groupname, final Category cat) { getWriteLock().lock(); try { final Enumeration<Categorygroup> enumCG = m_config.enumerateCategorygroup(); while (enumCG.hasMoreElements()) { final Categorygroup cg = enumCG.nextElement(); if (cg.getName().equals(groupname)) { final Categories cats = cg.getCategories(); cats.removeCategory(cat); return true; } } } finally { getWriteLock().unlock(); } return false; } | /**
* Delete category from a categorygroup.
*
* @param groupname
* category group from which category is to be removed
* @param cat
* category to be deleted
* @return true if category is successfully deleted from the specified
* category group
*/ | Delete category from a categorygroup | deleteCategory | {
"repo_name": "qoswork/opennmszh",
"path": "opennms-config/src/main/java/org/opennms/netmgt/config/CategoryFactory.java",
"license": "gpl-2.0",
"size": 17371
} | [
"java.util.Enumeration",
"org.opennms.netmgt.config.categories.Categories",
"org.opennms.netmgt.config.categories.Category",
"org.opennms.netmgt.config.categories.Categorygroup"
] | import java.util.Enumeration; import org.opennms.netmgt.config.categories.Categories; import org.opennms.netmgt.config.categories.Category; import org.opennms.netmgt.config.categories.Categorygroup; | import java.util.*; import org.opennms.netmgt.config.categories.*; | [
"java.util",
"org.opennms.netmgt"
] | java.util; org.opennms.netmgt; | 700,980 |
RemoteIterator getRemoteVersionIterator(VersionIterator iterator)
throws RemoteException; | RemoteIterator getRemoteVersionIterator(VersionIterator iterator) throws RemoteException; | /**
* Returns a remote adapter for the given local version iterator.
*
* @param iterator local version iterator
* @return remote iterator adapter
* @throws RemoteException on RMI errors
*/ | Returns a remote adapter for the given local version iterator | getRemoteVersionIterator | {
"repo_name": "apache/jackrabbit",
"path": "jackrabbit-jcr-rmi/src/main/java/org/apache/jackrabbit/rmi/server/RemoteAdapterFactory.java",
"license": "apache-2.0",
"size": 17504
} | [
"java.rmi.RemoteException",
"javax.jcr.version.VersionIterator",
"org.apache.jackrabbit.rmi.remote.RemoteIterator"
] | import java.rmi.RemoteException; import javax.jcr.version.VersionIterator; import org.apache.jackrabbit.rmi.remote.RemoteIterator; | import java.rmi.*; import javax.jcr.version.*; import org.apache.jackrabbit.rmi.remote.*; | [
"java.rmi",
"javax.jcr",
"org.apache.jackrabbit"
] | java.rmi; javax.jcr; org.apache.jackrabbit; | 1,491,770 |
private static void createJobParametersMap(String[] args) {
jobParameters = new HashMap<String, String>();
jobParameters.put("hostname", args[0]);
jobParameters.put("port", args[1]);
jobParameters.put("keyspace", args[2]);
jobParameters.put("cf", args[3]);
jobParameters.put("output", args[4]);
if (args.length == 6) {
jobParameters.put("partitioner", args[5]);
} else {
jobParameters.put("partitioner",
"org.apache.cassandra.dht.RandomPartitioner");
}
} | static void function(String[] args) { jobParameters = new HashMap<String, String>(); jobParameters.put(STR, args[0]); jobParameters.put("port", args[1]); jobParameters.put(STR, args[2]); jobParameters.put("cf", args[3]); jobParameters.put(STR, args[4]); if (args.length == 6) { jobParameters.put(STR, args[5]); } else { jobParameters.put(STR, STR); } } | /**
* Sets the configuration parameters.
*
* @param args
* @param configuration
*/ | Sets the configuration parameters | createJobParametersMap | {
"repo_name": "Atindriya-Ghosh/hadoop-lab",
"path": "hadoop-cassandra/src/main/java/hadoop/cassandra/HadoopCassandraDriver.java",
"license": "mit",
"size": 4057
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,647,661 |
@Override public void enterInterfaceMethodDeclaration(@NotNull PJParser.InterfaceMethodDeclarationContext ctx) { } | @Override public void enterInterfaceMethodDeclaration(@NotNull PJParser.InterfaceMethodDeclarationContext ctx) { } | /**
* {@inheritDoc}
*
* <p>The default implementation does nothing.</p>
*/ | The default implementation does nothing | exitElementValuePairs | {
"repo_name": "Diolor/PJ",
"path": "src/main/java/com/lorentzos/pj/PJBaseListener.java",
"license": "mit",
"size": 73292
} | [
"org.antlr.v4.runtime.misc.NotNull"
] | import org.antlr.v4.runtime.misc.NotNull; | import org.antlr.v4.runtime.misc.*; | [
"org.antlr.v4"
] | org.antlr.v4; | 782,386 |
void writeTo(OutputStream out, IO io); | void writeTo(OutputStream out, IO io); | /**
* Write the object to the output stream using the given IO instance
* @param out OutputStream
* @param io IO
*/ | Write the object to the output stream using the given IO instance | writeTo | {
"repo_name": "worldline-messaging/activitystreams",
"path": "core/src/main/java/com/ibm/common/activitystreams/Writable.java",
"license": "apache-2.0",
"size": 2673
} | [
"java.io.OutputStream"
] | import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 1,640,993 |
public TableMap getTableMap() throws TorqueException
{
return TAttributeOptionPeer.getTableMap();
} | TableMap function() throws TorqueException { return TAttributeOptionPeer.getTableMap(); } | /**
* Retrieves the TableMap object related to this Table data without
* compiler warnings of using getPeer().getTableMap().
*
* @return The associated TableMap object.
*/ | Retrieves the TableMap object related to this Table data without compiler warnings of using getPeer().getTableMap() | getTableMap | {
"repo_name": "trackplus/Genji",
"path": "src/main/java/com/aurel/track/persist/BaseTAttributeOption.java",
"license": "gpl-3.0",
"size": 56949
} | [
"org.apache.torque.TorqueException",
"org.apache.torque.map.TableMap"
] | import org.apache.torque.TorqueException; import org.apache.torque.map.TableMap; | import org.apache.torque.*; import org.apache.torque.map.*; | [
"org.apache.torque"
] | org.apache.torque; | 168,330 |
protected static void displayHelp() {
HelpFormatter help = new HelpFormatter();
help.printHelp(cmdName, cmdOptions, true);
} | static void function() { HelpFormatter help = new HelpFormatter(); help.printHelp(cmdName, cmdOptions, true); } | /**
* Display the command line help.
*/ | Display the command line help | displayHelp | {
"repo_name": "ModelN/build-management",
"path": "mn-build-core/src/main/java/com/modeln/build/common/tool/CMnCmdLineTool.java",
"license": "mit",
"size": 8029
} | [
"org.apache.commons.cli.HelpFormatter"
] | import org.apache.commons.cli.HelpFormatter; | import org.apache.commons.cli.*; | [
"org.apache.commons"
] | org.apache.commons; | 1,409,010 |
public static boolean hasHandler(Context context, Intent intent) {
List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0);
return !handlers.isEmpty();
}
private Intents() {
throw new AssertionError("No instances.");
} | static boolean function(Context context, Intent intent) { List<ResolveInfo> handlers = context.getPackageManager().queryIntentActivities(intent, 0); return !handlers.isEmpty(); } private Intents() { throw new AssertionError(STR); } | /**
* Queries on-device packages for a handler for the supplied {@link Intent}.
*/ | Queries on-device packages for a handler for the supplied <code>Intent</code> | hasHandler | {
"repo_name": "mlevytskiy/u2020-mvp",
"path": "app/src/main/java/ru/ltst/u2020mvp/util/Intents.java",
"license": "apache-2.0",
"size": 1213
} | [
"android.content.Context",
"android.content.Intent",
"android.content.pm.ResolveInfo",
"java.util.List"
] | import android.content.Context; import android.content.Intent; import android.content.pm.ResolveInfo; import java.util.List; | import android.content.*; import android.content.pm.*; import java.util.*; | [
"android.content",
"java.util"
] | android.content; java.util; | 1,086,061 |
public synchronized Enumeration enumerateClassNames(CIMObjectPath pClassPath)
throws CIMException {
return enumerateClassNames(pClassPath, false);
}
| synchronized Enumeration function(CIMObjectPath pClassPath) throws CIMException { return enumerateClassNames(pClassPath, false); } | /**
* Enumerates the CIM classes on the target CIM server that are subclasses
* of the specified class, and returns CIM class paths to these classes.
*
* <p>
* This method produces the same results as
* <code>enumerateClassNames(pClassPath, false)</code>
* </p>
*
* @param pClassPath
* CIM class path to the CIM class whose subclasses will be
* enumerated. Must be an intra-server or intra-namespace object
* path within the target CIM server. In the latter case, the
* default namespace name is added to this parameter before being
* used. If the classname attribute is an empty string,
* enumeration starts at the top of the class hierarchy, so that
* the immediate subclasses are the top level classes of the
* hierarchy. If the classname attribute is a valid class name,
* the class must exist in the namespace and enumeration starts
* at that class.
* @return A <code>CIMEnumeration</code> object containing zero or more
* <code>CIMObjectPath</code> objects referencing the enumerated
* classes using intra-namespace CIM class paths (class names).
* @throws CIMException
* with one of these CIM status codes:
* <dl style="margin-left: 80px;">
* <dt>{@link CIMException#CIM_ERR_ACCESS_DENIED CIM_ERR_ACCESS_DENIED}</dt>
* <dt>{@link CIMException#CIM_ERR_NOT_SUPPORTED CIM_ERR_NOT_SUPPORTED}</dt>
* <dt>{@link CIMException#CIM_ERR_INVALID_NAMESPACE CIM_ERR_INVALID_NAMESPACE}</dt>
* <dt>{@link CIMException#CIM_ERR_INVALID_PARAMETER CIM_ERR_INVALID_PARAMETER}</dt>
* <dt>{@link CIMException#CIM_ERR_INVALID_CLASS CIM_ERR_INVALID_CLASS}</dt>
* <dt>{@link CIMException#CIM_ERR_FAILED CIM_ERR_FAILED}</dt>
* </dl>
* @see #enumerateClassNames(CIMObjectPath, boolean)
*/ | Enumerates the CIM classes on the target CIM server that are subclasses of the specified class, and returns CIM class paths to these classes. This method produces the same results as <code>enumerateClassNames(pClassPath, false)</code> | enumerateClassNames | {
"repo_name": "acleasby/sblim-cim-client",
"path": "cim-client-java/src/main/java/org/sblim/wbem/client/CIMClient.java",
"license": "epl-1.0",
"size": 203192
} | [
"java.util.Enumeration",
"org.sblim.wbem.cim.CIMException",
"org.sblim.wbem.cim.CIMObjectPath"
] | import java.util.Enumeration; import org.sblim.wbem.cim.CIMException; import org.sblim.wbem.cim.CIMObjectPath; | import java.util.*; import org.sblim.wbem.cim.*; | [
"java.util",
"org.sblim.wbem"
] | java.util; org.sblim.wbem; | 268,051 |
private static Type mapTypeParameters(Type toMapType, Type typeAndParams) {
if (isMissingTypeParameters(typeAndParams)) {
return erase(toMapType);
} else {
VarMap varMap = new VarMap();
Type handlingTypeAndParams = typeAndParams;
while(handlingTypeAndParams instanceof ParameterizedType) {
ParameterizedType pType = (ParameterizedType)handlingTypeAndParams;
Class<?> clazz = (Class<?>)pType.getRawType(); // getRawType should always be Class
varMap.addAll(clazz.getTypeParameters(), pType.getActualTypeArguments());
handlingTypeAndParams = pType.getOwnerType();
}
return varMap.map(toMapType);
}
}
| static Type function(Type toMapType, Type typeAndParams) { if (isMissingTypeParameters(typeAndParams)) { return erase(toMapType); } else { VarMap varMap = new VarMap(); Type handlingTypeAndParams = typeAndParams; while(handlingTypeAndParams instanceof ParameterizedType) { ParameterizedType pType = (ParameterizedType)handlingTypeAndParams; Class<?> clazz = (Class<?>)pType.getRawType(); varMap.addAll(clazz.getTypeParameters(), pType.getActualTypeArguments()); handlingTypeAndParams = pType.getOwnerType(); } return varMap.map(toMapType); } } | /**
* Maps type parameters in a type to their values.
* @param toMapType Type possibly containing type arguments
* @param typeAndParams must be either ParameterizedType, or (in case there are no type arguments, or it's a raw type) Class
* @return toMapType, but with type parameters from typeAndParams replaced.
*/ | Maps type parameters in a type to their values | mapTypeParameters | {
"repo_name": "objectify/objectify",
"path": "src/main/java/com/googlecode/objectify/repackaged/gentyref/GenericTypeReflector.java",
"license": "mit",
"size": 19318
} | [
"java.lang.reflect.ParameterizedType",
"java.lang.reflect.Type"
] | import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; | import java.lang.reflect.*; | [
"java.lang"
] | java.lang; | 25,539 |
private static Proof trivialProof(TranslationLog log) {
return log==null ? null : new TrivialProof(log);
}
private static final class SolutionIterator implements Iterator<Solution> {
private Translation.Whole translation;
private long translTime;
private int trivial;
SolutionIterator(Formula formula, Bounds bounds, Options options) {
this.translTime = System.currentTimeMillis();
this.translation = Translator.translate(formula, bounds, options);
this.translTime = System.currentTimeMillis() - translTime;
this.trivial = 0;
}
public boolean hasNext() { return translation != null; } | static Proof function(TranslationLog log) { return log==null ? null : new TrivialProof(log); } private static final class SolutionIterator implements Iterator<Solution> { private Translation.Whole translation; private long translTime; private int trivial; SolutionIterator(Formula formula, Bounds bounds, Options options) { this.translTime = System.currentTimeMillis(); this.translation = Translator.translate(formula, bounds, options); this.translTime = System.currentTimeMillis() - translTime; this.trivial = 0; } public boolean hasNext() { return translation != null; } | /**
* Returns a proof for the trivially unsatisfiable log.formula,
* provided that log is non-null. Otherwise returns null.
* @requires log != null => log.formula is trivially unsatisfiable
* @return a proof for the trivially unsatisfiable log.formula,
* provided that log is non-null. Otherwise returns null.
*/ | Returns a proof for the trivially unsatisfiable log.formula, provided that log is non-null. Otherwise returns null | trivialProof | {
"repo_name": "drayside/kodkod",
"path": "src/kodkod/engine/Solver.java",
"license": "mit",
"size": 15967
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,848,572 |
if ((countryCode == null) || (countryCode.length() != 2)) {
return false;
}
final int index = Arrays.binarySearch(Locale.getISOCountries(), countryCode, (String o1, final String o2) -> o1.compareTo(o2));
return index >= 0;
} | if ((countryCode == null) (countryCode.length() != 2)) { return false; } final int index = Arrays.binarySearch(Locale.getISOCountries(), countryCode, (String o1, final String o2) -> o1.compareTo(o2)); return index >= 0; } | /**
* Utility function to check if a country code is a valid ISO-3166 code.
*
* @param countryCode Country code.
* @return True if this is a valid ISO-3166 country code.
*/ | Utility function to check if a country code is a valid ISO-3166 code | isValidCountryISO2 | {
"repo_name": "tomtom-international/speedtools",
"path": "core/src/main/java/com/tomtom/speedtools/utils/AddressUtils.java",
"license": "apache-2.0",
"size": 5078
} | [
"java.util.Arrays",
"java.util.Locale"
] | import java.util.Arrays; import java.util.Locale; | import java.util.*; | [
"java.util"
] | java.util; | 1,142,040 |
public static String getAllTableProperties(String schemaName, String tableName)
throws java.sql.SQLException
{
Properties p = TestPropertyInfo.getConglomerateProperties( schemaName, tableName, false );
if (p == null)
return null;
return org.apache.derbyTesting.functionTests.util.PropertyUtil.sortProperties(p);
} | static String function(String schemaName, String tableName) throws java.sql.SQLException { Properties p = TestPropertyInfo.getConglomerateProperties( schemaName, tableName, false ); if (p == null) return null; return org.apache.derbyTesting.functionTests.util.PropertyUtil.sortProperties(p); } | /**
* Get ALL the Properties associated with a given table, not just the
* customer-visible ones.
*
* @param schemaName The name of the schema that the table is in.
* @param tableName The name of the table.
*
* @return Properties The Properties associated with the specified table.
* (An empty Properties is returned if the table does not exist.)
* @exception java.sql.SQLException thrown on error
*/ | Get ALL the Properties associated with a given table, not just the customer-visible ones | getAllTableProperties | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.tests/org/apache/derbyTesting/functionTests/util/TestPropertyInfo.java",
"license": "apache-2.0",
"size": 6125
} | [
"java.util.Properties"
] | import java.util.Properties; | import java.util.*; | [
"java.util"
] | java.util; | 1,986,658 |
return location;
}
/**
* Description for this location.
* <p>
* It is possible for Facebook to return either this value or {@link #getLocation()}. If {@link #getLocation()} | return location; } /** * Description for this location. * <p> * It is possible for Facebook to return either this value or {@link #getLocation()}. If {@link #getLocation()} | /**
* Location containing geographic information such as latitude, longitude, country, and other fields (fields will vary
* based on geography and availability of information).
* <p>
* It is possible for Facebook to return either this value or {@link #getLocationAsString()}.
*
* @return Location containing geographic information such as latitude, longitude, country, and other fields.
*/ | Location containing geographic information such as latitude, longitude, country, and other fields (fields will vary based on geography and availability of information). It is possible for Facebook to return either this value or <code>#getLocationAsString()</code> | getLocation | {
"repo_name": "AhmedMoataz/facebook-test",
"path": "src/main/java/com/restfb/types/Place.java",
"license": "apache-2.0",
"size": 2564
} | [
"com.restfb.Facebook"
] | import com.restfb.Facebook; | import com.restfb.*; | [
"com.restfb"
] | com.restfb; | 1,262,869 |
private Intent getDefaultIntent() {
Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("image
private class ImageBroadcastReceiver extends BroadcastReceiver{ | Intent function() { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType("image private class ImageBroadcastReceiver extends BroadcastReceiver{ | /** Defines a default (dummy) share intent to initialze the action provider.
* However, as soon as the actual content to be used in the intent
* is known or changes, you must update the share intent by again calling
* mShareActionProvider.setShareIntent()
*/ | Defines a default (dummy) share intent to initialze the action provider. However, as soon as the actual content to be used in the intent is known or changes, you must update the share intent by again calling mShareActionProvider.setShareIntent() | getDefaultIntent | {
"repo_name": "tajchert/CEEHack",
"path": "cardslib/demo/stock/src/main/java/it/gmariotti/cardslib/demo/fragment/BirthDayCardFragment.java",
"license": "apache-2.0",
"size": 6547
} | [
"android.content.BroadcastReceiver",
"android.content.Intent"
] | import android.content.BroadcastReceiver; import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 65,370 |
protected ActionListener createKeyboardUpLeftListener()
{
return new KeyboardUpLeftHandler();
} | ActionListener function() { return new KeyboardUpLeftHandler(); } | /**
* This method creates a new ActionListener for up and left key presses.
*
* @return A new ActionListener for up and left keys.
*
* @deprecated 1.3
*/ | This method creates a new ActionListener for up and left key presses | createKeyboardUpLeftListener | {
"repo_name": "shaotuanchen/sunflower_exp",
"path": "tools/source/gcc-4.2.4/libjava/classpath/javax/swing/plaf/basic/BasicSplitPaneUI.java",
"license": "bsd-3-clause",
"size": 48640
} | [
"java.awt.event.ActionListener"
] | import java.awt.event.ActionListener; | import java.awt.event.*; | [
"java.awt"
] | java.awt; | 1,104,809 |
Future<OperationResponse> updateSlotConfigNamesAsync(String resourceGroupName, String webSiteName, SlotConfigNamesUpdateParameters parameters); | Future<OperationResponse> updateSlotConfigNamesAsync(String resourceGroupName, String webSiteName, SlotConfigNamesUpdateParameters parameters); | /**
* Update list of app settings and connection strings which to be slot
* specific. E.g. settings in staging slots remain in staging after swap
* with production.
*
* @param resourceGroupName Required. The name of the resource group
* @param webSiteName Required. The name of the website
* @param parameters Required. The Update slot configs parameters
* @return A standard service response including an HTTP status code and
* request ID.
*/ | Update list of app settings and connection strings which to be slot specific. E.g. settings in staging slots remain in staging after swap with production | updateSlotConfigNamesAsync | {
"repo_name": "southworkscom/azure-sdk-for-java",
"path": "resource-management/azure-mgmt-websites/src/main/java/com/microsoft/azure/management/websites/WebSiteOperations.java",
"license": "apache-2.0",
"size": 60715
} | [
"com.microsoft.azure.management.websites.models.SlotConfigNamesUpdateParameters",
"com.microsoft.windowsazure.core.OperationResponse",
"java.util.concurrent.Future"
] | import com.microsoft.azure.management.websites.models.SlotConfigNamesUpdateParameters; import com.microsoft.windowsazure.core.OperationResponse; import java.util.concurrent.Future; | import com.microsoft.azure.management.websites.models.*; import com.microsoft.windowsazure.core.*; import java.util.concurrent.*; | [
"com.microsoft.azure",
"com.microsoft.windowsazure",
"java.util"
] | com.microsoft.azure; com.microsoft.windowsazure; java.util; | 1,280,690 |
private void startForegroundCompat(int id, Notification notification) {
// If we have the new startForeground API, then use it.
if( mStartForeground != null ) {
mStartForegroundArgs[0] = Integer.valueOf(id);
mStartForegroundArgs[1] = notification;
try {
mStartForeground.invoke(this, mStartForegroundArgs);
} catch ( InvocationTargetException e ) {
// Should not happen.
} catch ( IllegalAccessException e ) {
// Should not happen.
}
} else {
// Fall back on the old API.
try {
Method setForeground = getClass().getMethod("setForeground", mSetForegroudSignaure);
setForeground.invoke(this, new Object[]{true});
} catch ( NoSuchMethodException exception ) {
// Should not happen
} catch ( InvocationTargetException e ) {
// Should not happen.
} catch ( IllegalAccessException e ) {
// Should not happen.
}
notificationManager.notify(id, notification);
}
} | void function(int id, Notification notification) { if( mStartForeground != null ) { mStartForegroundArgs[0] = Integer.valueOf(id); mStartForegroundArgs[1] = notification; try { mStartForeground.invoke(this, mStartForegroundArgs); } catch ( InvocationTargetException e ) { } catch ( IllegalAccessException e ) { } } else { try { Method setForeground = getClass().getMethod(STR, mSetForegroudSignaure); setForeground.invoke(this, new Object[]{true}); } catch ( NoSuchMethodException exception ) { } catch ( InvocationTargetException e ) { } catch ( IllegalAccessException e ) { } notificationManager.notify(id, notification); } } | /**
* This is a wrapper around the new startForeground method, using the older
* APIs if it is not available.
*/ | This is a wrapper around the new startForeground method, using the older APIs if it is not available | startForegroundCompat | {
"repo_name": "indrora/Atomic",
"path": "application/src/main/java/indrora/atomic/irc/IRCService.java",
"license": "gpl-3.0",
"size": 29162
} | [
"android.app.Notification",
"java.lang.reflect.InvocationTargetException",
"java.lang.reflect.Method"
] | import android.app.Notification; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; | import android.app.*; import java.lang.reflect.*; | [
"android.app",
"java.lang"
] | android.app; java.lang; | 2,434,819 |
void onContextMenu(int mouseX, int mouseY, ProcessTreeNode node); | void onContextMenu(int mouseX, int mouseY, ProcessTreeNode node); | /**
* Is called when user has clicked right mouse button.
*
* @param mouseX mouse x coordinate
* @param mouseY mouse y coordinate
* @param node process tree node
*/ | Is called when user has clicked right mouse button | onContextMenu | {
"repo_name": "TypeFox/che",
"path": "ide/che-core-ide-app/src/main/java/org/eclipse/che/ide/processes/panel/ProcessesPanelView.java",
"license": "epl-1.0",
"size": 4810
} | [
"org.eclipse.che.ide.processes.ProcessTreeNode"
] | import org.eclipse.che.ide.processes.ProcessTreeNode; | import org.eclipse.che.ide.processes.*; | [
"org.eclipse.che"
] | org.eclipse.che; | 1,066,939 |
public java.util.Map<String, Class<?>> getTypeMap() throws SQLException {
checkClosed();
try {
return this.mc.getTypeMap();
} catch (SQLException sqlException) {
checkAndFireConnectionError(sqlException);
}
return null; // we don't reach this code, compiler can't tell
} | java.util.Map<String, Class<?>> function() throws SQLException { checkClosed(); try { return this.mc.getTypeMap(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; } | /**
* Passes call to method on physical connection instance. Notifies listeners
* of any caught exceptions before re-throwing to client.
*
* @see java.sql.Connection#getTypeMap()
*/ | Passes call to method on physical connection instance. Notifies listeners of any caught exceptions before re-throwing to client | getTypeMap | {
"repo_name": "seanbright/mysql-connector-j",
"path": "src/com/mysql/jdbc/jdbc2/optional/ConnectionWrapper.java",
"license": "gpl-2.0",
"size": 87800
} | [
"java.sql.SQLException",
"java.util.Map"
] | import java.sql.SQLException; import java.util.Map; | import java.sql.*; import java.util.*; | [
"java.sql",
"java.util"
] | java.sql; java.util; | 950,535 |
public void addStructuralNodeModifier(StructuralNodeModifier snm) {
this.snms.add(snm);
this.fireTableRowsInserted(this.snms.size() - 1, this.snms.size() - 1);
} | void function(StructuralNodeModifier snm) { this.snms.add(snm); this.fireTableRowsInserted(this.snms.size() - 1, this.snms.size() - 1); } | /**
* Adds a new structural node modifiers to this model
*
* @param snm the structural node modifier
*/ | Adds a new structural node modifiers to this model | addStructuralNodeModifier | {
"repo_name": "psiinon/zaproxy",
"path": "zap/src/main/java/org/zaproxy/zap/view/StructuralNodeModifiersTableModel.java",
"license": "apache-2.0",
"size": 4960
} | [
"org.zaproxy.zap.model.StructuralNodeModifier"
] | import org.zaproxy.zap.model.StructuralNodeModifier; | import org.zaproxy.zap.model.*; | [
"org.zaproxy.zap"
] | org.zaproxy.zap; | 371,522 |
public static void logFinished(JobID jobId, long finishTime,
int finishedMaps, int finishedReduces,
int failedMaps, int failedReduces,
Counters counters){
if (!disableHistory){
// close job file for this job
String logFileKey = JOBTRACKER_UNIQUE_STRING + jobId;
ArrayList<PrintWriter> writer = openJobs.get(logFileKey);
if (null != writer){
JobHistory.log(writer, RecordTypes.Job,
new Keys[] {Keys.JOBID, Keys.FINISH_TIME,
Keys.JOB_STATUS, Keys.FINISHED_MAPS,
Keys.FINISHED_REDUCES,
Keys.FAILED_MAPS, Keys.FAILED_REDUCES,
Keys.COUNTERS},
new String[] {jobId.toString(), Long.toString(finishTime),
Values.SUCCESS.name(),
String.valueOf(finishedMaps),
String.valueOf(finishedReduces),
String.valueOf(failedMaps),
String.valueOf(failedReduces),
counters.makeEscapedCompactString()});
for (PrintWriter out : writer) {
out.close();
}
openJobs.remove(logFileKey);
}
Thread historyCleaner = new Thread(new HistoryCleaner());
historyCleaner.start();
}
} | static void function(JobID jobId, long finishTime, int finishedMaps, int finishedReduces, int failedMaps, int failedReduces, Counters counters){ if (!disableHistory){ String logFileKey = JOBTRACKER_UNIQUE_STRING + jobId; ArrayList<PrintWriter> writer = openJobs.get(logFileKey); if (null != writer){ JobHistory.log(writer, RecordTypes.Job, new Keys[] {Keys.JOBID, Keys.FINISH_TIME, Keys.JOB_STATUS, Keys.FINISHED_MAPS, Keys.FINISHED_REDUCES, Keys.FAILED_MAPS, Keys.FAILED_REDUCES, Keys.COUNTERS}, new String[] {jobId.toString(), Long.toString(finishTime), Values.SUCCESS.name(), String.valueOf(finishedMaps), String.valueOf(finishedReduces), String.valueOf(failedMaps), String.valueOf(failedReduces), counters.makeEscapedCompactString()}); for (PrintWriter out : writer) { out.close(); } openJobs.remove(logFileKey); } Thread historyCleaner = new Thread(new HistoryCleaner()); historyCleaner.start(); } } | /**
* Log job finished. closes the job file in history.
* @param jobId job id, assigned by jobtracker.
* @param finishTime finish time of job in ms.
* @param finishedMaps no of maps successfully finished.
* @param finishedReduces no of reduces finished sucessfully.
* @param failedMaps no of failed map tasks.
* @param failedReduces no of failed reduce tasks.
* @param counters the counters from the job
*/ | Log job finished. closes the job file in history | logFinished | {
"repo_name": "dhootha/hadoop-common",
"path": "src/mapred/org/apache/hadoop/mapred/JobHistory.java",
"license": "apache-2.0",
"size": 66630
} | [
"java.io.PrintWriter",
"java.util.ArrayList"
] | import java.io.PrintWriter; import java.util.ArrayList; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 1,487,097 |
public boolean readLock(TransactionImpl tx, Object obj);
| boolean function(TransactionImpl tx, Object obj); | /**
* acquire a read lock on Object obj for Transaction tx.
* @param tx the transaction requesting the lock
* @param obj the Object to be locked
* @return true if successful, else false
*
*/ | acquire a read lock on Object obj for Transaction tx | readLock | {
"repo_name": "kuali/ojb-1.0.4",
"path": "src/java/org/apache/ojb/odmg/locking/LockStrategy.java",
"license": "apache-2.0",
"size": 2721
} | [
"org.apache.ojb.odmg.TransactionImpl"
] | import org.apache.ojb.odmg.TransactionImpl; | import org.apache.ojb.odmg.*; | [
"org.apache.ojb"
] | org.apache.ojb; | 2,267,556 |
private void addPropertyField(String fieldKey, String[] values, SolrInputDocument solrInputDocument) {
int intValue;
double doubleValue;
// Check whether the value is an Int or decimal or string
String valueType = getType(values[0]);
for (String propValue : values) {
switch (valueType) {
case SolrConstants.TYPE_INT:
intValue = Integer.parseInt(propValue);
solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_INT_FIELD_KEY_SUFFIX,
intValue);
break;
case SolrConstants.TYPE_DOUBLE:
doubleValue = Double.parseDouble(propValue);
solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_DOUBLE_FIELD_KEY_SUFFIX, doubleValue);
break;
case SolrConstants.TYPE_STRING:
solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_STRING_FIELD_KEY_SUFFIX, propValue);
break;
}
}
} | void function(String fieldKey, String[] values, SolrInputDocument solrInputDocument) { int intValue; double doubleValue; String valueType = getType(values[0]); for (String propValue : values) { switch (valueType) { case SolrConstants.TYPE_INT: intValue = Integer.parseInt(propValue); solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_INT_FIELD_KEY_SUFFIX, intValue); break; case SolrConstants.TYPE_DOUBLE: doubleValue = Double.parseDouble(propValue); solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_DOUBLE_FIELD_KEY_SUFFIX, doubleValue); break; case SolrConstants.TYPE_STRING: solrInputDocument.addField(fieldKey + SolrConstants.SOLR_MULTIVALUED_STRING_FIELD_KEY_SUFFIX, propValue); break; } } } | /**
* Method to add property values
* @param fieldKey property field key value
* @param values property field value
* @param solrInputDocument Solr InputDocument
*/ | Method to add property values | addPropertyField | {
"repo_name": "cnapagoda/carbon-registry",
"path": "components/registry/org.wso2.carbon.registry.indexing/src/main/java/org/wso2/carbon/registry/indexing/solr/SolrClient.java",
"license": "apache-2.0",
"size": 68957
} | [
"org.apache.solr.common.SolrInputDocument",
"org.wso2.carbon.registry.indexing.SolrConstants"
] | import org.apache.solr.common.SolrInputDocument; import org.wso2.carbon.registry.indexing.SolrConstants; | import org.apache.solr.common.*; import org.wso2.carbon.registry.indexing.*; | [
"org.apache.solr",
"org.wso2.carbon"
] | org.apache.solr; org.wso2.carbon; | 432,952 |
public boolean queryPath(LoginToken token, DracService aService)
throws Exception {
log.info("Query path called by user {} with service {}", new Object[]{token.getUser(), aService});
checkServiceTna(token, aService);
try {
boolean rc = getNrbInterface().queryPath(token, aService);
return rc;
}
catch (Exception e) {
log.error("queryPath failed", e);
throw e;
}
} | boolean function(LoginToken token, DracService aService) throws Exception { log.info(STR, new Object[]{token.getUser(), aService}); checkServiceTna(token, aService); try { boolean rc = getNrbInterface().queryPath(token, aService); return rc; } catch (Exception e) { log.error(STR, e); throw e; } } | /**
* query NrbInterface to determine if a service is route-able
*/ | query NrbInterface to determine if a service is route-able | queryPath | {
"repo_name": "jmacauley/OpenDRAC",
"path": "Web/RequestHandler/src/main/java/com/nortel/appcore/app/drac/server/requesthandler/RequestHandler.java",
"license": "gpl-3.0",
"size": 65106
} | [
"com.nortel.appcore.app.drac.common.types.DracService",
"com.nortel.appcore.app.drac.security.LoginToken"
] | import com.nortel.appcore.app.drac.common.types.DracService; import com.nortel.appcore.app.drac.security.LoginToken; | import com.nortel.appcore.app.drac.common.types.*; import com.nortel.appcore.app.drac.security.*; | [
"com.nortel.appcore"
] | com.nortel.appcore; | 566,439 |
public ObjectConverter<S,T> unique() {
if (sourceClass != null && targetClass != null) {
final ObjectConverter<S,T> existing = SystemRegistry.INSTANCE.findEquals(this);
if (existing != null) return existing;
}
return this;
} | ObjectConverter<S,T> function() { if (sourceClass != null && targetClass != null) { final ObjectConverter<S,T> existing = SystemRegistry.INSTANCE.findEquals(this); if (existing != null) return existing; } return this; } | /**
* Returns an unique instance of this converter if one exists. If a converter already
* exists for the same source an target classes, then this converter is returned.
* Otherwise this converter is returned <strong>without</strong> being cached.
*
* @return the unique instance, or {@code this} if no unique instance can be found.
*
* @see ObjectToString#unique()
*/ | Returns an unique instance of this converter if one exists. If a converter already exists for the same source an target classes, then this converter is returned. Otherwise this converter is returned without being cached | unique | {
"repo_name": "apache/sis",
"path": "core/sis-utility/src/main/java/org/apache/sis/internal/converter/SystemConverter.java",
"license": "apache-2.0",
"size": 7941
} | [
"org.apache.sis.util.ObjectConverter"
] | import org.apache.sis.util.ObjectConverter; | import org.apache.sis.util.*; | [
"org.apache.sis"
] | org.apache.sis; | 1,979,787 |
RecoveryState recoveryState(); | RecoveryState recoveryState(); | /**
* Returns the recovery state associated with this shard.
*/ | Returns the recovery state associated with this shard | recoveryState | {
"repo_name": "fernandozhu/elasticsearch",
"path": "core/src/main/java/org/elasticsearch/indices/cluster/IndicesClusterStateService.java",
"license": "apache-2.0",
"size": 46029
} | [
"org.elasticsearch.indices.recovery.RecoveryState"
] | import org.elasticsearch.indices.recovery.RecoveryState; | import org.elasticsearch.indices.recovery.*; | [
"org.elasticsearch.indices"
] | org.elasticsearch.indices; | 589,412 |
@Override
public boolean requestAssistScreenshot(final IAssistScreenshotReceiver receiver) {
if (!checkCallingPermission(Manifest.permission.READ_FRAME_BUFFER,
"requestAssistScreenshot()")) {
throw new SecurityException("Requires READ_FRAME_BUFFER permission");
} | boolean function(final IAssistScreenshotReceiver receiver) { if (!checkCallingPermission(Manifest.permission.READ_FRAME_BUFFER, STR)) { throw new SecurityException(STR); } | /**
* Takes a snapshot of the screen. In landscape mode this grabs the whole screen.
* In portrait mode, it grabs the upper region of the screen based on the vertical dimension
* of the target image.
*/ | Takes a snapshot of the screen. In landscape mode this grabs the whole screen. In portrait mode, it grabs the upper region of the screen based on the vertical dimension of the target image | requestAssistScreenshot | {
"repo_name": "OmniEvo/android_frameworks_base",
"path": "services/core/java/com/android/server/wm/WindowManagerService.java",
"license": "gpl-3.0",
"size": 522653
} | [
"com.android.internal.app.IAssistScreenshotReceiver"
] | import com.android.internal.app.IAssistScreenshotReceiver; | import com.android.internal.app.*; | [
"com.android.internal"
] | com.android.internal; | 1,544,895 |
protected Intent getTargetIntent() {
return new Intent();
} | Intent function() { return new Intent(); } | /**
* Get the base intent to use when running
* {@link PackageManager#queryIntentActivities(Intent, int)}.
*/ | Get the base intent to use when running <code>PackageManager#queryIntentActivities(Intent, int)</code> | getTargetIntent | {
"repo_name": "indashnet/InDashNet.Open.UN2000",
"path": "android/frameworks/base/core/java/android/app/LauncherActivity.java",
"license": "apache-2.0",
"size": 17108
} | [
"android.content.Intent"
] | import android.content.Intent; | import android.content.*; | [
"android.content"
] | android.content; | 223,553 |
public static void rotateMatrix(Matrix4f matrix, float x, float y, float z)
{
Matrix4f.mul(matrix, getRotationMatrix(x, y, z), matrix);
}
| static void function(Matrix4f matrix, float x, float y, float z) { Matrix4f.mul(matrix, getRotationMatrix(x, y, z), matrix); } | /**
* Rotates a matrix based on the modelview rotation matrix
* @param matrix the matrix to be rotated
* @param x the x rotation, in degrees
* @param y the y rotation, in degrees
* @param z the z rotation, in degrees
*/ | Rotates a matrix based on the modelview rotation matrix | rotateMatrix | {
"repo_name": "guyfleeman/rayburn",
"path": "src/com/rayburn/engine/util/MathUtil.java",
"license": "gpl-3.0",
"size": 24632
} | [
"org.lwjgl.util.vector.Matrix4f"
] | import org.lwjgl.util.vector.Matrix4f; | import org.lwjgl.util.vector.*; | [
"org.lwjgl.util"
] | org.lwjgl.util; | 927,990 |
public static Add_GPS_ControlHeader fromPerUnaligned(byte[] encodedBytes) {
Add_GPS_ControlHeader result = new Add_GPS_ControlHeader();
result.decodePerUnaligned(new BitStreamReader(encodedBytes));
return result;
} | static Add_GPS_ControlHeader function(byte[] encodedBytes) { Add_GPS_ControlHeader result = new Add_GPS_ControlHeader(); result.decodePerUnaligned(new BitStreamReader(encodedBytes)); return result; } | /**
* Creates a new Add_GPS_ControlHeader from encoded stream.
*/ | Creates a new Add_GPS_ControlHeader from encoded stream | fromPerUnaligned | {
"repo_name": "google/supl-client",
"path": "src/main/java/com/google/location/suplclient/asn1/supl2/rrlp_components/Add_GPS_ControlHeader.java",
"license": "apache-2.0",
"size": 10491
} | [
"com.google.location.suplclient.asn1.base.BitStreamReader"
] | import com.google.location.suplclient.asn1.base.BitStreamReader; | import com.google.location.suplclient.asn1.base.*; | [
"com.google.location"
] | com.google.location; | 1,995,107 |
private static MatrixBlock[] computeLU(MatrixObject in)
throws DMLRuntimeException
{
if ( in.getNumRows() != in.getNumColumns() ) {
throw new DMLRuntimeException("LU Decomposition can only be done on a square matrix. Input matrix is rectangular (rows=" + in.getNumRows() + ", cols="+ in.getNumColumns() +")");
}
Array2DRowRealMatrix matrixInput = DataConverter.convertToArray2DRowRealMatrix(in);
// Perform LUP decomposition
LUDecomposition ludecompose = new LUDecomposition(matrixInput);
RealMatrix P = ludecompose.getP();
RealMatrix L = ludecompose.getL();
RealMatrix U = ludecompose.getU();
// Read the results into native format
MatrixBlock mbP = DataConverter.convertToMatrixBlock(P.getData());
MatrixBlock mbL = DataConverter.convertToMatrixBlock(L.getData());
MatrixBlock mbU = DataConverter.convertToMatrixBlock(U.getData());
return new MatrixBlock[] { mbP, mbL, mbU };
}
| static MatrixBlock[] function(MatrixObject in) throws DMLRuntimeException { if ( in.getNumRows() != in.getNumColumns() ) { throw new DMLRuntimeException(STR + in.getNumRows() + STR+ in.getNumColumns() +")"); } Array2DRowRealMatrix matrixInput = DataConverter.convertToArray2DRowRealMatrix(in); LUDecomposition ludecompose = new LUDecomposition(matrixInput); RealMatrix P = ludecompose.getP(); RealMatrix L = ludecompose.getL(); RealMatrix U = ludecompose.getU(); MatrixBlock mbP = DataConverter.convertToMatrixBlock(P.getData()); MatrixBlock mbL = DataConverter.convertToMatrixBlock(L.getData()); MatrixBlock mbU = DataConverter.convertToMatrixBlock(U.getData()); return new MatrixBlock[] { mbP, mbL, mbU }; } | /**
* Function to perform LU decomposition on a given matrix.
*
* @param in matrix object
* @return array of matrix blocks
* @throws DMLRuntimeException if DMLRuntimeException occurs
*/ | Function to perform LU decomposition on a given matrix | computeLU | {
"repo_name": "asurve/arvind-sysml",
"path": "src/main/java/org/apache/sysml/runtime/matrix/data/LibCommonsMath.java",
"license": "apache-2.0",
"size": 9237
} | [
"org.apache.commons.math3.linear.Array2DRowRealMatrix",
"org.apache.commons.math3.linear.LUDecomposition",
"org.apache.commons.math3.linear.RealMatrix",
"org.apache.sysml.runtime.DMLRuntimeException",
"org.apache.sysml.runtime.controlprogram.caching.MatrixObject",
"org.apache.sysml.runtime.util.DataConver... | import org.apache.commons.math3.linear.Array2DRowRealMatrix; import org.apache.commons.math3.linear.LUDecomposition; import org.apache.commons.math3.linear.RealMatrix; import org.apache.sysml.runtime.DMLRuntimeException; import org.apache.sysml.runtime.controlprogram.caching.MatrixObject; import org.apache.sysml.runtime.util.DataConverter; | import org.apache.commons.math3.linear.*; import org.apache.sysml.runtime.*; import org.apache.sysml.runtime.controlprogram.caching.*; import org.apache.sysml.runtime.util.*; | [
"org.apache.commons",
"org.apache.sysml"
] | org.apache.commons; org.apache.sysml; | 2,058,721 |
private static Map<String, Object> processSection(String section, Collection<Map<String, Object>> hosts,
Map<String, Object> dflts, Map<String, Object> props) throws IgniteCheckedException {
if (section == null || props == null)
return null;
if (DFLT_SECTION.equalsIgnoreCase(section)) {
if (dflts != null)
throw new IgniteCheckedException("Only one '" + DFLT_SECTION + "' section is allowed.");
return props;
}
else {
hosts.add(props);
return null;
}
} | static Map<String, Object> function(String section, Collection<Map<String, Object>> hosts, Map<String, Object> dflts, Map<String, Object> props) throws IgniteCheckedException { if (section == null props == null) return null; if (DFLT_SECTION.equalsIgnoreCase(section)) { if (dflts != null) throw new IgniteCheckedException(STR + DFLT_SECTION + STR); return props; } else { hosts.add(props); return null; } } | /**
* Processes section of parsed INI file.
*
* @param section Name of the section.
* @param hosts Already parsed properties for sections excluding default.
* @param dflts Parsed properties for default section.
* @param props Current properties.
* @return Default properties if specified section is default, {@code null} otherwise.
* @throws IgniteCheckedException If INI file contains several default sections.
*/ | Processes section of parsed INI file | processSection | {
"repo_name": "irudyak/ignite",
"path": "modules/core/src/main/java/org/apache/ignite/internal/util/nodestart/IgniteNodeStartUtils.java",
"license": "apache-2.0",
"size": 14055
} | [
"java.util.Collection",
"java.util.Map",
"org.apache.ignite.IgniteCheckedException"
] | import java.util.Collection; import java.util.Map; import org.apache.ignite.IgniteCheckedException; | import java.util.*; import org.apache.ignite.*; | [
"java.util",
"org.apache.ignite"
] | java.util; org.apache.ignite; | 2,054,006 |
@Override
public boolean updatesAreDetected(int type) throws SQLException {
return false;
} | boolean function(int type) throws SQLException { return false; } | /**
* <p>
* <h1>Implementation Details:</h1><br>
* Returns false
* </p>
*/ | Implementation Details: Returns false | updatesAreDetected | {
"repo_name": "jonathanswenson/starschema-bigquery-jdbc",
"path": "src/main/java/net/starschema/clouddb/jdbc/BQDatabaseMetadata.java",
"license": "bsd-2-clause",
"size": 92438
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 1,012,291 |
Preconditions.checkNotNull(user);
CredentialsStore store = getUserStore(user);
if(store == null){
throw new ServiceException.ForbiddenException(String.format("Logged in user: %s doesn't have writable credentials store", user.getId()));
}
// try to find the right key
for (Credentials cred : store.getCredentials(getDomain(store))) {
if (cred instanceof BasicSSHUserPrivateKey) {
BasicSSHUserPrivateKey sshKey = (BasicSSHUserPrivateKey)cred;
if (BLUEOCEAN_GENERATED_SSH_KEY_ID.equals(sshKey.getId())) {
return sshKey;
}
}
}
// if none found, create one
try {
// create one!
KeyPair keyPair = SSHKeyUtils.generateRSAKey(KEY_SIZE);
RSAPrivateKey privateKey = (RSAPrivateKey)keyPair.getPrivate();
String id_rsa = Base64.encode(privateKey.getEncoded());
BasicSSHUserPrivateKey.DirectEntryPrivateKeySource keySource = new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(id_rsa);
BasicSSHUserPrivateKey key = new BasicSSHUserPrivateKey(CredentialsScope.USER, BLUEOCEAN_GENERATED_SSH_KEY_ID, user.getId(), keySource, null, BLUEOCEAN_GENERATED_SSH_KEY_ID);
store.addCredentials(getDomain(store), key);
store.save();
return key;
} catch (IOException ex) {
throw new ServiceException.UnexpectedErrorException("Failed to create the private key", ex);
}
} | Preconditions.checkNotNull(user); CredentialsStore store = getUserStore(user); if(store == null){ throw new ServiceException.ForbiddenException(String.format(STR, user.getId())); } for (Credentials cred : store.getCredentials(getDomain(store))) { if (cred instanceof BasicSSHUserPrivateKey) { BasicSSHUserPrivateKey sshKey = (BasicSSHUserPrivateKey)cred; if (BLUEOCEAN_GENERATED_SSH_KEY_ID.equals(sshKey.getId())) { return sshKey; } } } try { KeyPair keyPair = SSHKeyUtils.generateRSAKey(KEY_SIZE); RSAPrivateKey privateKey = (RSAPrivateKey)keyPair.getPrivate(); String id_rsa = Base64.encode(privateKey.getEncoded()); BasicSSHUserPrivateKey.DirectEntryPrivateKeySource keySource = new BasicSSHUserPrivateKey.DirectEntryPrivateKeySource(id_rsa); BasicSSHUserPrivateKey key = new BasicSSHUserPrivateKey(CredentialsScope.USER, BLUEOCEAN_GENERATED_SSH_KEY_ID, user.getId(), keySource, null, BLUEOCEAN_GENERATED_SSH_KEY_ID); store.addCredentials(getDomain(store), key); store.save(); return key; } catch (IOException ex) { throw new ServiceException.UnexpectedErrorException(STR, ex); } } | /**
* Gets the existing generated SSH key for the user or creates one and
* returns it in the user's credential store
* @param user owner of the key
* @return the user's personal private key
*/ | Gets the existing generated SSH key for the user or creates one and returns it in the user's credential store | getOrCreate | {
"repo_name": "alvarolobato/blueocean-plugin",
"path": "blueocean-rest-impl/src/main/java/io/jenkins/blueocean/service/embedded/util/UserSSHKeyManager.java",
"license": "mit",
"size": 9518
} | [
"com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey",
"com.cloudbees.plugins.credentials.Credentials",
"com.cloudbees.plugins.credentials.CredentialsScope",
"com.cloudbees.plugins.credentials.CredentialsStore",
"com.google.common.base.Preconditions",
"hudson.remoting.Base64",
"io.j... | import com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey; import com.cloudbees.plugins.credentials.Credentials; import com.cloudbees.plugins.credentials.CredentialsScope; import com.cloudbees.plugins.credentials.CredentialsStore; import com.google.common.base.Preconditions; import hudson.remoting.Base64; import io.jenkins.blueocean.commons.ServiceException; import java.io.IOException; import java.security.KeyPair; import java.security.interfaces.RSAPrivateKey; | import com.cloudbees.jenkins.plugins.sshcredentials.impl.*; import com.cloudbees.plugins.credentials.*; import com.google.common.base.*; import hudson.remoting.*; import io.jenkins.blueocean.commons.*; import java.io.*; import java.security.*; import java.security.interfaces.*; | [
"com.cloudbees.jenkins",
"com.cloudbees.plugins",
"com.google.common",
"hudson.remoting",
"io.jenkins.blueocean",
"java.io",
"java.security"
] | com.cloudbees.jenkins; com.cloudbees.plugins; com.google.common; hudson.remoting; io.jenkins.blueocean; java.io; java.security; | 194,733 |
public void compactRecentForTesting(int N) throws IOException {
List<StoreFile> filesToCompact;
long maxId;
boolean isMajor;
this.lock.readLock().lock();
try {
synchronized (filesCompacting) {
filesToCompact = Lists.newArrayList(storefiles);
if (!filesCompacting.isEmpty()) {
// exclude all files older than the newest file we're currently
// compacting. this allows us to preserve contiguity (HBASE-2856)
StoreFile last = filesCompacting.get(filesCompacting.size() - 1);
int idx = filesToCompact.indexOf(last);
Preconditions.checkArgument(idx != -1);
filesToCompact.subList(0, idx + 1).clear();
}
int count = filesToCompact.size();
if (N > count) {
throw new RuntimeException("Not enough files");
}
filesToCompact = filesToCompact.subList(count - N, count);
maxId = StoreFile.getMaxSequenceIdInList(filesToCompact);
isMajor = (filesToCompact.size() == storefiles.size());
filesCompacting.addAll(filesToCompact);
Collections.sort(filesCompacting, StoreFile.Comparators.FLUSH_TIME);
}
} finally {
this.lock.readLock().unlock();
}
try {
// Ready to go. Have list of files to compact.
StoreFile.Writer writer = this.compactor.compactForTesting(this, conf, filesToCompact,
isMajor, maxId);
// Move the compaction into place.
StoreFile sf = completeCompaction(filesToCompact, writer);
if (region.getCoprocessorHost() != null) {
region.getCoprocessorHost().postCompact(this, sf, null);
}
} finally {
synchronized (filesCompacting) {
filesCompacting.removeAll(filesToCompact);
}
}
} | void function(int N) throws IOException { List<StoreFile> filesToCompact; long maxId; boolean isMajor; this.lock.readLock().lock(); try { synchronized (filesCompacting) { filesToCompact = Lists.newArrayList(storefiles); if (!filesCompacting.isEmpty()) { StoreFile last = filesCompacting.get(filesCompacting.size() - 1); int idx = filesToCompact.indexOf(last); Preconditions.checkArgument(idx != -1); filesToCompact.subList(0, idx + 1).clear(); } int count = filesToCompact.size(); if (N > count) { throw new RuntimeException(STR); } filesToCompact = filesToCompact.subList(count - N, count); maxId = StoreFile.getMaxSequenceIdInList(filesToCompact); isMajor = (filesToCompact.size() == storefiles.size()); filesCompacting.addAll(filesToCompact); Collections.sort(filesCompacting, StoreFile.Comparators.FLUSH_TIME); } } finally { this.lock.readLock().unlock(); } try { StoreFile.Writer writer = this.compactor.compactForTesting(this, conf, filesToCompact, isMajor, maxId); StoreFile sf = completeCompaction(filesToCompact, writer); if (region.getCoprocessorHost() != null) { region.getCoprocessorHost().postCompact(this, sf, null); } } finally { synchronized (filesCompacting) { filesCompacting.removeAll(filesToCompact); } } } | /**
* Compact the most recent N files. Used in testing.
*/ | Compact the most recent N files. Used in testing | compactRecentForTesting | {
"repo_name": "wowoshen/hbase",
"path": "src/main/java/org/apache/hadoop/hbase/regionserver/Store.java",
"license": "apache-2.0",
"size": 88171
} | [
"com.google.common.base.Preconditions",
"com.google.common.collect.Lists",
"java.io.IOException",
"java.util.Collections",
"java.util.List"
] | import com.google.common.base.Preconditions; import com.google.common.collect.Lists; import java.io.IOException; import java.util.Collections; import java.util.List; | import com.google.common.base.*; import com.google.common.collect.*; import java.io.*; import java.util.*; | [
"com.google.common",
"java.io",
"java.util"
] | com.google.common; java.io; java.util; | 97,112 |
public static HashMap<String, String> parseAccountString(final String parseString) {
// 1. split name value pairs by splitting on the ';' character
final String[] valuePairs = parseString.split(";");
final HashMap<String, String> retVals = new HashMap<String, String>();
// 2. for each field value pair parse into appropriate map entries
for (int m = 0; m < valuePairs.length; m++) {
if (valuePairs[m].length() == 0) {
continue;
}
final int equalDex = valuePairs[m].indexOf("=");
if (equalDex < 1) {
throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING);
}
final String key = valuePairs[m].substring(0, equalDex);
final String value = valuePairs[m].substring(equalDex + 1);
// 2.1 add to map
retVals.put(key, value);
}
return retVals;
} | static HashMap<String, String> function(final String parseString) { final String[] valuePairs = parseString.split(";"); final HashMap<String, String> retVals = new HashMap<String, String>(); for (int m = 0; m < valuePairs.length; m++) { if (valuePairs[m].length() == 0) { continue; } final int equalDex = valuePairs[m].indexOf("="); if (equalDex < 1) { throw new IllegalArgumentException(SR.INVALID_CONNECTION_STRING); } final String key = valuePairs[m].substring(0, equalDex); final String value = valuePairs[m].substring(equalDex + 1); retVals.put(key, value); } return retVals; } | /**
* Parses a connection string and returns its values as a hash map of key/value pairs.
*
* @param parseString
* A <code>String</code> that represents the connection string to parse.
*
* @return A <code>java.util.HashMap</code> object that represents the hash map of the key / value pairs parsed from
* the connection string.
*/ | Parses a connection string and returns its values as a hash map of key/value pairs | parseAccountString | {
"repo_name": "Azure/azure-storage-android",
"path": "microsoft-azure-storage/src/com/microsoft/azure/storage/core/Utility.java",
"license": "apache-2.0",
"size": 57440
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 2,004,678 |
protected int _need( final int num )
throws IOException {
//System.out.println( "p: " + _pos + " l: " + _len + " want: " + num );
if ( _len - _pos >= num ){
final int ret = _pos;
_pos += num;
_read += num;
return ret;
}
if ( num >= _inputBuffer.length )
throw new IllegalArgumentException( "you can't need that much" );
final int remaining = _len - _pos;
if ( _pos > 0 ){
System.arraycopy( _inputBuffer , _pos , _inputBuffer , 0 , remaining );
_pos = 0;
_len = remaining;
}
// read as much as possible into buffer
int maxToRead = Math.min( _max - _read - remaining , _inputBuffer.length - _len );
while ( maxToRead > 0 ){
int x = _raw.read( _inputBuffer , _len , maxToRead);
if ( x <= 0 )
throw new IOException( "unexpected EOF" );
maxToRead -= x;
_len += x;
}
int ret = _pos;
_pos += num;
_read += num;
return ret;
} | int function( final int num ) throws IOException { if ( _len - _pos >= num ){ final int ret = _pos; _pos += num; _read += num; return ret; } if ( num >= _inputBuffer.length ) throw new IllegalArgumentException( STR ); final int remaining = _len - _pos; if ( _pos > 0 ){ System.arraycopy( _inputBuffer , _pos , _inputBuffer , 0 , remaining ); _pos = 0; _len = remaining; } int maxToRead = Math.min( _max - _read - remaining , _inputBuffer.length - _len ); while ( maxToRead > 0 ){ int x = _raw.read( _inputBuffer , _len , maxToRead); if ( x <= 0 ) throw new IOException( STR ); maxToRead -= x; _len += x; } int ret = _pos; _pos += num; _read += num; return ret; } | /**
* ensure that there are num bytes to read
* _pos is where to start reading from
* @return where to start reading from
*/ | ensure that there are num bytes to read _pos is where to start reading from | _need | {
"repo_name": "MaOrKsSi/HZS.Durian",
"path": "增强/org.hzs.mongodb/src/org/bson/BasicBSONDecoder.java",
"license": "lgpl-3.0",
"size": 18531
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 961,805 |
public void assertUserCreated(CmsObject cms, String resourceName, CmsUser user) {
try {
// get the actual resource from the vfs
CmsResource res = cms.readResource(resourceName, CmsResourceFilter.ALL);
if (!res.getUserCreated().equals(user.getId())) {
fail(createUserFailMessage(cms, "UserCreated", user.getId(), res.getUserLastModified()));
}
} catch (CmsException e) {
fail("cannot read resource " + resourceName + " " + CmsException.getStackTraceAsString(e));
}
} | void function(CmsObject cms, String resourceName, CmsUser user) { try { CmsResource res = cms.readResource(resourceName, CmsResourceFilter.ALL); if (!res.getUserCreated().equals(user.getId())) { fail(createUserFailMessage(cms, STR, user.getId(), res.getUserLastModified())); } } catch (CmsException e) { fail(STR + resourceName + " " + CmsException.getStackTraceAsString(e)); } } | /**
* Compares the user who created a resource with a given user.<p>
*
* @param cms the CmsObject
* @param resourceName the name of the resource to compare
* @param user the last modification user
*/ | Compares the user who created a resource with a given user | assertUserCreated | {
"repo_name": "serrapos/opencms-core",
"path": "test/org/opencms/test/OpenCmsTestCase.java",
"license": "lgpl-2.1",
"size": 144807
} | [
"org.opencms.file.CmsObject",
"org.opencms.file.CmsResource",
"org.opencms.file.CmsResourceFilter",
"org.opencms.file.CmsUser",
"org.opencms.main.CmsException"
] | import org.opencms.file.CmsObject; import org.opencms.file.CmsResource; import org.opencms.file.CmsResourceFilter; import org.opencms.file.CmsUser; import org.opencms.main.CmsException; | import org.opencms.file.*; import org.opencms.main.*; | [
"org.opencms.file",
"org.opencms.main"
] | org.opencms.file; org.opencms.main; | 1,070,240 |
protected void keyTyped(char typedChar, int keyCode) throws IOException
{
//TODO: STORES NOTE
if (Character.isLetterOrDigit(typedChar))
{
this.shapeinput += typedChar; //Keyboard.getKeyName(keyCode);
}
else
{
// not alphanumerical
if (Keyboard.getKeyName(keyCode).equalsIgnoreCase("SPACE"))
{
this.shapeinput += " ";
}
else if (Keyboard.getKeyName(keyCode).equalsIgnoreCase("BACK"))
{
if (this.shapeinput.length() > 3)
{
this.shapeinput = this.shapeinput.substring(0, this.shapeinput.length()-1);
}
}
else if (Keyboard.getKeyName(keyCode).equalsIgnoreCase("RETURN"))
{
this.shapeinput += "\n";
}
else
{
//this.shapeinput += "?"; //Keyboard.getKeyName(keyCode);
}
}
}
| void function(char typedChar, int keyCode) throws IOException { if (Character.isLetterOrDigit(typedChar)) { this.shapeinput += typedChar; } else { if (Keyboard.getKeyName(keyCode).equalsIgnoreCase("SPACE")) { this.shapeinput += " "; } else if (Keyboard.getKeyName(keyCode).equalsIgnoreCase("BACK")) { if (this.shapeinput.length() > 3) { this.shapeinput = this.shapeinput.substring(0, this.shapeinput.length()-1); } } else if (Keyboard.getKeyName(keyCode).equalsIgnoreCase(STR)) { this.shapeinput += "\n"; } else { } } } | /**
* Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of
* KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
*/ | Fired when a key is typed (except F11 which toggles full screen). This is the equivalent of KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code) | keyTyped | {
"repo_name": "lucemans/ShapeClient-SRC",
"path": "net/minecraft/client/gui/GuiMainMenu.java",
"license": "mpl-2.0",
"size": 38979
} | [
"java.io.IOException",
"org.lwjgl.input.Keyboard"
] | import java.io.IOException; import org.lwjgl.input.Keyboard; | import java.io.*; import org.lwjgl.input.*; | [
"java.io",
"org.lwjgl.input"
] | java.io; org.lwjgl.input; | 1,571,470 |
List<String> getAll(CharSequence name); | List<String> getAll(CharSequence name); | /**
* Returns the values of headers with the specified name
*
* @param name The name of the headers to search
* @return A {@link List} of header values which will be empty if no values are found
*/ | Returns the values of headers with the specified name | getAll | {
"repo_name": "afredlyj/learn-netty",
"path": "codec/src/main/java/io/netty/handler/codec/TextHeaders.java",
"license": "apache-2.0",
"size": 8826
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 105,291 |
public static int getDefaultMapUnits() {
if (defaultMapUnits == -1) {
XMLEntity xml = PluginServices.getPluginServices(
"com.iver.cit.gvsig").getPersistentXML();
if (xml.contains("DefaultMapUnits")) {
defaultMapUnits = xml.getIntProperty("DefaultMapUnits");
} else {
// first app run case
String[] unitNames = MapContext.getDistanceNames();
for (int i = 0; i < unitNames.length; i++) {
// meter is the factory default's map unit
if (unitNames[i].equals("Metros")) {
defaultMapUnits = i;
break;
}
}
}
if (defaultMapUnits == -1 || defaultMapUnits >= MapContext.getDistanceNames().length)
defaultMapUnits = MapContext.getDistancePosition("Metros");
}
return defaultMapUnits;
} | static int function() { if (defaultMapUnits == -1) { XMLEntity xml = PluginServices.getPluginServices( STR).getPersistentXML(); if (xml.contains(STR)) { defaultMapUnits = xml.getIntProperty(STR); } else { String[] unitNames = MapContext.getDistanceNames(); for (int i = 0; i < unitNames.length; i++) { if (unitNames[i].equals(STR)) { defaultMapUnits = i; break; } } } if (defaultMapUnits == -1 defaultMapUnits >= MapContext.getDistanceNames().length) defaultMapUnits = MapContext.getDistancePosition(STR); } return defaultMapUnits; } | /**
* Returns the user's default map units. This is the cartography data
* distance units.
*
* @return int (index of the <b>Attributes.NAMES array</b>)
*/ | Returns the user's default map units. This is the cartography data distance units | getDefaultMapUnits | {
"repo_name": "iCarto/siga",
"path": "appgvSIG/src/com/iver/cit/gvsig/project/Project.java",
"license": "gpl-3.0",
"size": 62151
} | [
"com.iver.andami.PluginServices",
"com.iver.cit.gvsig.fmap.MapContext",
"com.iver.utiles.XMLEntity"
] | import com.iver.andami.PluginServices; import com.iver.cit.gvsig.fmap.MapContext; import com.iver.utiles.XMLEntity; | import com.iver.andami.*; import com.iver.cit.gvsig.fmap.*; import com.iver.utiles.*; | [
"com.iver.andami",
"com.iver.cit",
"com.iver.utiles"
] | com.iver.andami; com.iver.cit; com.iver.utiles; | 2,785,264 |
public void xmlDecl (String version, String encoding, String standalone,
Augmentations augs)
throws XNIException {
if (!fDeferNodeExpansion) {
// REVISIT: when DOM Level 3 is REC rely on Document.support
// instead of specific class
if (fDocumentImpl != null) {
if (version != null)
fDocumentImpl.setXmlVersion (version);
fDocumentImpl.setXmlEncoding (encoding);
fDocumentImpl.setXmlStandalone ("yes".equals (standalone));
}
}
else {
if (version != null)
fDeferredDocumentImpl.setXmlVersion (version);
fDeferredDocumentImpl.setXmlEncoding (encoding);
fDeferredDocumentImpl.setXmlStandalone ("yes".equals (standalone));
}
} // xmlDecl(String,String,String) | void function (String version, String encoding, String standalone, Augmentations augs) throws XNIException { if (!fDeferNodeExpansion) { if (fDocumentImpl != null) { if (version != null) fDocumentImpl.setXmlVersion (version); fDocumentImpl.setXmlEncoding (encoding); fDocumentImpl.setXmlStandalone ("yes".equals (standalone)); } } else { if (version != null) fDeferredDocumentImpl.setXmlVersion (version); fDeferredDocumentImpl.setXmlEncoding (encoding); fDeferredDocumentImpl.setXmlStandalone ("yes".equals (standalone)); } } | /**
* Notifies of the presence of an XMLDecl line in the document. If
* present, this method will be called immediately following the
* startDocument call.
*
* @param version The XML version.
* @param encoding The IANA encoding name of the document, or null if
* not specified.
* @param standalone The standalone value, or null if not specified.
* @param augs Additional information that may include infoset augmentations
*
* @throws XNIException Thrown by handler to signal an error.
*/ | Notifies of the presence of an XMLDecl line in the document. If present, this method will be called immediately following the startDocument call | xmlDecl | {
"repo_name": "shun634501730/java_source_cn",
"path": "src_en/com/sun/org/apache/xerces/internal/parsers/AbstractDOMParser.java",
"license": "apache-2.0",
"size": 106349
} | [
"com.sun.org.apache.xerces.internal.xni.Augmentations",
"com.sun.org.apache.xerces.internal.xni.XNIException"
] | import com.sun.org.apache.xerces.internal.xni.Augmentations; import com.sun.org.apache.xerces.internal.xni.XNIException; | import com.sun.org.apache.xerces.internal.xni.*; | [
"com.sun.org"
] | com.sun.org; | 961,455 |
@Test
public void testUpdate() {
try {
System.out.println("update");
Requirement source = TestHelper.createRequirement("SRS-SW-0001",
"Sample requirement", rsn.getRequirementSpecNodePK(),
"Notes", 1, 1);
RequirementServer instance = new RequirementServer(source);
assertEquals(1, instance.getHistoryList().size());
int count = 1;
for (History h : instance.getHistoryList()) {
assertEquals(0, h.getMajorVersion());
assertEquals(0, h.getMidVersion());
assertEquals(count, h.getMinorVersion());
count++;
}
Requirement target = new Requirement();
instance.update(target, source);
assertEquals(instance.getUniqueId(), target.getUniqueId());
assertEquals(instance.getDescription(), target.getDescription());
assertEquals(instance.getNotes(), target.getNotes());
assertEquals(instance.getRequirementTypeId().getId(),
target.getRequirementTypeId().getId());
assertEquals(instance.getRequirementStatusId().getId(),
target.getRequirementStatusId().getId());
assertEquals(instance.getHistoryList().size(),
target.getHistoryList().size());
}
catch (Exception ex) {
LOG.log(Level.SEVERE, null, ex);
fail();
}
}
| void function() { try { System.out.println(STR); Requirement source = TestHelper.createRequirement(STR, STR, rsn.getRequirementSpecNodePK(), "Notes", 1, 1); RequirementServer instance = new RequirementServer(source); assertEquals(1, instance.getHistoryList().size()); int count = 1; for (History h : instance.getHistoryList()) { assertEquals(0, h.getMajorVersion()); assertEquals(0, h.getMidVersion()); assertEquals(count, h.getMinorVersion()); count++; } Requirement target = new Requirement(); instance.update(target, source); assertEquals(instance.getUniqueId(), target.getUniqueId()); assertEquals(instance.getDescription(), target.getDescription()); assertEquals(instance.getNotes(), target.getNotes()); assertEquals(instance.getRequirementTypeId().getId(), target.getRequirementTypeId().getId()); assertEquals(instance.getRequirementStatusId().getId(), target.getRequirementStatusId().getId()); assertEquals(instance.getHistoryList().size(), target.getHistoryList().size()); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); fail(); } } | /**
* Test of update method, of class RequirementServer.
*/ | Test of update method, of class RequirementServer | testUpdate | {
"repo_name": "javydreamercsw/validation-manager",
"path": "VM-Core/src/test/java/com/validation/manager/core/server/core/RequirementServerTest.java",
"license": "apache-2.0",
"size": 14191
} | [
"com.validation.manager.core.db.History",
"com.validation.manager.core.db.Requirement",
"com.validation.manager.test.TestHelper",
"java.util.logging.Level"
] | import com.validation.manager.core.db.History; import com.validation.manager.core.db.Requirement; import com.validation.manager.test.TestHelper; import java.util.logging.Level; | import com.validation.manager.core.db.*; import com.validation.manager.test.*; import java.util.logging.*; | [
"com.validation.manager",
"java.util"
] | com.validation.manager; java.util; | 1,475,347 |
public static void setImageButtonImage( ImageButton aButton, int aDrawableId )
{
aButton.setImageDrawable( getResources().getDrawable( aDrawableId ));
} | static void function( ImageButton aButton, int aDrawableId ) { aButton.setImageDrawable( getResources().getDrawable( aDrawableId )); } | /**
* change the image source for a ImageButton
*
* @param aButton {ImageButton} the ImageButton
* @param aDrawableId {int} resource ID of the desired drawable resource
*/ | change the image source for a ImageButton | setImageButtonImage | {
"repo_name": "igorski/igorski-android-lib",
"path": "src/main/nl/igorski/lib/utils/ui/ButtonTool.java",
"license": "mit",
"size": 2879
} | [
"android.widget.ImageButton"
] | import android.widget.ImageButton; | import android.widget.*; | [
"android.widget"
] | android.widget; | 1,036,924 |
@Test
public void testDelegate() {
// Visible text
Assert.assertEquals(r.getStartLine(), td.getStartLine());
Assert.assertEquals(r.getEndLine(), td.getEndLine());
Assert.assertEquals(r.getLineCount(), td.getLineCount());
Assert.assertEquals(r.getVisibleText(), td.getVisibleText(), 0.0);
Assert.assertEquals(r.getMaxVisibleText(), td.getMaxVisibleText());
Assert.assertEquals(r.isFinalLineFullyVisible(), td.isFinalLineFullyVisible());
// Size
Assert.assertEquals(r.getMaxWidth(), td.getMaxWidth(), 0.0);
Assert.assertEquals(r.getMaxHeight(), td.getMaxHeight(), 0.0);
Assert.assertEquals(r.getTextWidth(), td.getTextWidth(), 0.0);
Assert.assertEquals(r.getTextHeight(), td.getTextHeight(), 0.0);
Assert.assertEquals(r.getTextHeight(1, 2), td.getTextHeight(1, 2), 0.0);
td.setMaxSize(11, 22);
Assert.assertEquals(11, r.getMaxWidth(), 0.0);
Assert.assertEquals(22, r.getMaxHeight(), 0.0);
td.setUnscaledSize(33, 44);
Assert.assertEquals(33, td.getUnscaledWidth(), 0.0);
Assert.assertEquals(44, td.getUnscaledHeight(), 0.0);
} | void function() { Assert.assertEquals(r.getStartLine(), td.getStartLine()); Assert.assertEquals(r.getEndLine(), td.getEndLine()); Assert.assertEquals(r.getLineCount(), td.getLineCount()); Assert.assertEquals(r.getVisibleText(), td.getVisibleText(), 0.0); Assert.assertEquals(r.getMaxVisibleText(), td.getMaxVisibleText()); Assert.assertEquals(r.isFinalLineFullyVisible(), td.isFinalLineFullyVisible()); Assert.assertEquals(r.getMaxWidth(), td.getMaxWidth(), 0.0); Assert.assertEquals(r.getMaxHeight(), td.getMaxHeight(), 0.0); Assert.assertEquals(r.getTextWidth(), td.getTextWidth(), 0.0); Assert.assertEquals(r.getTextHeight(), td.getTextHeight(), 0.0); Assert.assertEquals(r.getTextHeight(1, 2), td.getTextHeight(1, 2), 0.0); td.setMaxSize(11, 22); Assert.assertEquals(11, r.getMaxWidth(), 0.0); Assert.assertEquals(22, r.getMaxHeight(), 0.0); td.setUnscaledSize(33, 44); Assert.assertEquals(33, td.getUnscaledWidth(), 0.0); Assert.assertEquals(44, td.getUnscaledHeight(), 0.0); } | /**
* Most methods in {@link TextDrawable} delegate to an embedded {@link ITextRenderer}.
*/ | Most methods in <code>TextDrawable</code> delegate to an embedded <code>ITextRenderer</code> | testDelegate | {
"repo_name": "anonl/nvlist",
"path": "core/src/test/java/nl/weeaboo/vn/impl/scene/TextDrawableTest.java",
"license": "apache-2.0",
"size": 3280
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 611,218 |
@Test
public void testRetriableSendOperationIfConnectionErrorOrServiceUnavailable() throws Exception {
final PingRestHandler pingRestHandler = new PingRestHandler(
FutureUtils.completedExceptionally(new RestHandlerException("test exception", HttpResponseStatus.SERVICE_UNAVAILABLE)),
CompletableFuture.completedFuture(EmptyResponseBody.getInstance()));
try (final TestRestServerEndpoint restServerEndpoint = createRestServerEndpoint(pingRestHandler)) {
RestClusterClient<?> restClusterClient = createRestClusterClient(restServerEndpoint.getServerAddress().getPort());
try {
final AtomicBoolean firstPollFailed = new AtomicBoolean();
failHttpRequest = (messageHeaders, messageParameters, requestBody) ->
messageHeaders instanceof PingRestHandlerHeaders && !firstPollFailed.getAndSet(true);
restClusterClient.sendRequest(PingRestHandlerHeaders.INSTANCE).get();
} finally {
restClusterClient.shutdown();
}
}
} | void function() throws Exception { final PingRestHandler pingRestHandler = new PingRestHandler( FutureUtils.completedExceptionally(new RestHandlerException(STR, HttpResponseStatus.SERVICE_UNAVAILABLE)), CompletableFuture.completedFuture(EmptyResponseBody.getInstance())); try (final TestRestServerEndpoint restServerEndpoint = createRestServerEndpoint(pingRestHandler)) { RestClusterClient<?> restClusterClient = createRestClusterClient(restServerEndpoint.getServerAddress().getPort()); try { final AtomicBoolean firstPollFailed = new AtomicBoolean(); failHttpRequest = (messageHeaders, messageParameters, requestBody) -> messageHeaders instanceof PingRestHandlerHeaders && !firstPollFailed.getAndSet(true); restClusterClient.sendRequest(PingRestHandlerHeaders.INSTANCE).get(); } finally { restClusterClient.shutdown(); } } } | /**
* Tests that the send operation is being retried.
*/ | Tests that the send operation is being retried | testRetriableSendOperationIfConnectionErrorOrServiceUnavailable | {
"repo_name": "ueshin/apache-flink",
"path": "flink-clients/src/test/java/org/apache/flink/client/program/rest/RestClusterClientTest.java",
"license": "apache-2.0",
"size": 32550
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.atomic.AtomicBoolean",
"org.apache.flink.runtime.concurrent.FutureUtils",
"org.apache.flink.runtime.rest.handler.RestHandlerException",
"org.apache.flink.runtime.rest.messages.EmptyResponseBody",
"org.apache.flink.shaded.netty4.io.netty.handl... | import java.util.concurrent.CompletableFuture; import java.util.concurrent.atomic.AtomicBoolean; import org.apache.flink.runtime.concurrent.FutureUtils; import org.apache.flink.runtime.rest.handler.RestHandlerException; import org.apache.flink.runtime.rest.messages.EmptyResponseBody; import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.HttpResponseStatus; | import java.util.concurrent.*; import java.util.concurrent.atomic.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.rest.handler.*; import org.apache.flink.runtime.rest.messages.*; import org.apache.flink.shaded.netty4.io.netty.handler.codec.http.*; | [
"java.util",
"org.apache.flink"
] | java.util; org.apache.flink; | 972,554 |
@Override
protected void onResume() {
IntentFilter filter = new IntentFilter();
filter.addAction("blobs.loaded");
filter.addAction("blob.created");
registerReceiver(receiver, filter);
super.onResume();
}
| void function() { IntentFilter filter = new IntentFilter(); filter.addAction(STR); filter.addAction(STR); registerReceiver(receiver, filter); super.onResume(); } | /***
* Register for broadcasts
*/ | Register for broadcasts | onResume | {
"repo_name": "infostatus/Android-MobileServices-Storage",
"path": "source/end/StorageDemo/src/com/msdpe/storagedemo/BlobsActivity.java",
"license": "apache-2.0",
"size": 13105
} | [
"android.content.IntentFilter"
] | import android.content.IntentFilter; | import android.content.*; | [
"android.content"
] | android.content; | 1,579,668 |
public final synchronized L[] getListeners() {
if (this.map == null) {
return newArray(0);
}
List<L> list = new ArrayList<L>();
L[] listeners = this.map.get(null);
if (listeners != null) {
for (L listener : listeners) {
list.add(listener);
}
}
for (Entry<String, L[]> entry : this.map.entrySet()) {
String name = entry.getKey();
if (name != null) {
for (L listener : entry.getValue()) {
list.add(newProxy(name, listener));
}
}
}
return list.toArray(newArray(list.size()));
} | final synchronized L[] function() { if (this.map == null) { return newArray(0); } List<L> list = new ArrayList<L>(); L[] listeners = this.map.get(null); if (listeners != null) { for (L listener : listeners) { list.add(listener); } } for (Entry<String, L[]> entry : this.map.entrySet()) { String name = entry.getKey(); if (name != null) { for (L listener : entry.getValue()) { list.add(newProxy(name, listener)); } } } return list.toArray(newArray(list.size())); } | /**
* Returns all listeners in the map.
*
* @return an array of all listeners
*/ | Returns all listeners in the map | getListeners | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk/jdk/src/share/classes/java/beans/ChangeListenerMap.java",
"license": "mit",
"size": 8282
} | [
"java.util.ArrayList",
"java.util.List",
"java.util.Map"
] | import java.util.ArrayList; import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 2,082,856 |
public static String escape(final String string, boolean brOnly) {
String out = string;
if (!brOnly) {
out = StringEscapeUtils.escapeHtml(out);
}
out = StringUtils.replace(out, "\n", "<br />");
out = StringUtils.replace(out, "\\n", "<br />");
return out;
}
private boolean brOnly = false; | static String function(final String string, boolean brOnly) { String out = string; if (!brOnly) { out = StringEscapeUtils.escapeHtml(out); } out = StringUtils.replace(out, "\n", STR); out = StringUtils.replace(out, "\\n", STR); return out; } private boolean brOnly = false; | /**
* Escapes the string
*/ | Escapes the string | escape | {
"repo_name": "robertoandrade/cyclos",
"path": "src/nl/strohalm/cyclos/taglibs/EscapeHTMLTag.java",
"license": "gpl-2.0",
"size": 2026
} | [
"org.apache.commons.lang.StringEscapeUtils",
"org.apache.commons.lang.StringUtils"
] | import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; | import org.apache.commons.lang.*; | [
"org.apache.commons"
] | org.apache.commons; | 2,229,992 |
public Builder withDisallowedPolicy(final String disallowedPolicy) {
if (disallowedPolicy != null) {
if (this.disallowedPolicies == null) {
this.disallowedPolicies = new ArrayList<>();
}
this.disallowedPolicies.add(disallowedPolicy);
}
return this;
} | Builder function(final String disallowedPolicy) { if (disallowedPolicy != null) { if (this.disallowedPolicies == null) { this.disallowedPolicies = new ArrayList<>(); } this.disallowedPolicies.add(disallowedPolicy); } return this; } | /**
* Add a disallowed policy.
*
* @param disallowedPolicy disallowed policy to add
* @return self
*/ | Add a disallowed policy | withDisallowedPolicy | {
"repo_name": "skalscheuer/jvaultconnector",
"path": "src/main/java/de/stklcode/jvault/connector/model/TokenRole.java",
"license": "apache-2.0",
"size": 13263
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 1,581,375 |
@Test
public void testRunBatchJobThatFails() throws Exception {
Pipeline p = TestPipeline.create(options);
PCollection<Integer> pc = p.apply(Create.of(1, 2, 3));
PAssert.that(pc).containsInAnyOrder(1, 2, 3);
DataflowPipelineJob mockJob = Mockito.mock(DataflowPipelineJob.class);
when(mockJob.getState()).thenReturn(State.FAILED);
when(mockJob.getProjectId()).thenReturn("test-project");
when(mockJob.getJobId()).thenReturn("test-job");
DataflowRunner mockRunner = Mockito.mock(DataflowRunner.class);
when(mockRunner.run(any(Pipeline.class))).thenReturn(mockJob);
TestDataflowRunner runner = TestDataflowRunner.fromOptionsAndClient(options, mockClient);
when(mockClient.getJobMetrics(anyString()))
.thenReturn(generateMockMetricResponse(true , false ));
expectedException.expect(RuntimeException.class);
runner.run(p, mockRunner);
// Note that fail throws an AssertionError which is why it is placed out here
// instead of inside the try-catch block.
fail("AssertionError expected");
} | void function() throws Exception { Pipeline p = TestPipeline.create(options); PCollection<Integer> pc = p.apply(Create.of(1, 2, 3)); PAssert.that(pc).containsInAnyOrder(1, 2, 3); DataflowPipelineJob mockJob = Mockito.mock(DataflowPipelineJob.class); when(mockJob.getState()).thenReturn(State.FAILED); when(mockJob.getProjectId()).thenReturn(STR); when(mockJob.getJobId()).thenReturn(STR); DataflowRunner mockRunner = Mockito.mock(DataflowRunner.class); when(mockRunner.run(any(Pipeline.class))).thenReturn(mockJob); TestDataflowRunner runner = TestDataflowRunner.fromOptionsAndClient(options, mockClient); when(mockClient.getJobMetrics(anyString())) .thenReturn(generateMockMetricResponse(true , false )); expectedException.expect(RuntimeException.class); runner.run(p, mockRunner); fail(STR); } | /**
* Tests that when a batch job terminates in a failure state even if all assertions passed, it
* throws an error to that effect.
*/ | Tests that when a batch job terminates in a failure state even if all assertions passed, it throws an error to that effect | testRunBatchJobThatFails | {
"repo_name": "mxm/incubator-beam",
"path": "runners/google-cloud-dataflow-java/src/test/java/org/apache/beam/runners/dataflow/TestDataflowRunnerTest.java",
"license": "apache-2.0",
"size": 27594
} | [
"org.apache.beam.sdk.Pipeline",
"org.apache.beam.sdk.PipelineResult",
"org.apache.beam.sdk.testing.PAssert",
"org.apache.beam.sdk.testing.TestPipeline",
"org.apache.beam.sdk.transforms.Create",
"org.apache.beam.sdk.values.PCollection",
"org.junit.Assert",
"org.mockito.Mockito"
] | import org.apache.beam.sdk.Pipeline; import org.apache.beam.sdk.PipelineResult; import org.apache.beam.sdk.testing.PAssert; import org.apache.beam.sdk.testing.TestPipeline; import org.apache.beam.sdk.transforms.Create; import org.apache.beam.sdk.values.PCollection; import org.junit.Assert; import org.mockito.Mockito; | import org.apache.beam.sdk.*; import org.apache.beam.sdk.testing.*; import org.apache.beam.sdk.transforms.*; import org.apache.beam.sdk.values.*; import org.junit.*; import org.mockito.*; | [
"org.apache.beam",
"org.junit",
"org.mockito"
] | org.apache.beam; org.junit; org.mockito; | 1,185,818 |
return new String[]{"dtInclusaoFrom", "dtInclusaoTo", "descricao","nome","dummyVO"};
}
private static final long serialVersionUID = 2195241915100521959L;
@Autowired
private ProdutoBusiness produtoBusiness;
private String dsAreaProduto;
private Date dtInclusaoFrom;
private Date dtInclusaoTo;
private String nome;
private String obs;
| return new String[]{STR, STR, STR,"nome",STR}; } private static final long serialVersionUID = 2195241915100521959L; private ProdutoBusiness produtoBusiness; private String dsAreaProduto; private Date dtInclusaoFrom; private Date dtInclusaoTo; private String nome; private String obs; | /**
* Retorna os atributos deste bean utilizados para pesquisa
* @see br.com.dlp.framework.jsf.AbstractJSFBeanImpl#getCamposLimparPesquisa()
*/ | Retorna os atributos deste bean utilizados para pesquisa | getCamposLimparPesquisa | {
"repo_name": "darciopacifico/omr",
"path": "branchs/JazzQA/webportal/src/main/java/br/com/dlp/jazzqa/produto/ProdutoJSFBean.java",
"license": "apache-2.0",
"size": 3005
} | [
"java.util.Date"
] | import java.util.Date; | import java.util.*; | [
"java.util"
] | java.util; | 2,421,933 |
protected File getExecutionRootBuildDirectory()
{
// Find the top level project in the reactor
final MavenProject executionRootProject = getExecutionRootProject( reactorProjects );
// Use the top level project's build directory if there is one, otherwise use this project's build directory
final File buildDirectory;
if ( executionRootProject == null )
{
getLog().debug( "No execution root project found in the reactor, using the current project." );
buildDirectory = new File( project.getBuild().getDirectory() );
}
else
{
getLog().debug( "Using the execution root project found in the reactor: "
+ executionRootProject.getArtifactId() );
buildDirectory = new File( executionRootProject.getBuild().getDirectory() );
}
return buildDirectory;
} | File function() { final MavenProject executionRootProject = getExecutionRootProject( reactorProjects ); final File buildDirectory; if ( executionRootProject == null ) { getLog().debug( STR ); buildDirectory = new File( project.getBuild().getDirectory() ); } else { getLog().debug( STR + executionRootProject.getArtifactId() ); buildDirectory = new File( executionRootProject.getBuild().getDirectory() ); } return buildDirectory; } | /**
* Find the build directory of the execution root project in the reactor.
* If no execution root project is found, the build directory of the current project is returned.
*
* @return the build directory of the execution root project.
*/ | Find the build directory of the execution root project in the reactor. If no execution root project is found, the build directory of the current project is returned | getExecutionRootBuildDirectory | {
"repo_name": "kidaa/maven-plugins",
"path": "maven-site-plugin/src/main/java/org/apache/maven/plugins/site/deploy/SiteStageMojo.java",
"license": "apache-2.0",
"size": 5996
} | [
"java.io.File",
"org.apache.maven.project.MavenProject"
] | import java.io.File; import org.apache.maven.project.MavenProject; | import java.io.*; import org.apache.maven.project.*; | [
"java.io",
"org.apache.maven"
] | java.io; org.apache.maven; | 1,494,732 |
@ServiceMethod(returns = ReturnType.SINGLE)
public ApiManagementServiceResourceInner update(
String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) {
return updateAsync(resourceGroupName, serviceName, parameters).block();
} | @ServiceMethod(returns = ReturnType.SINGLE) ApiManagementServiceResourceInner function( String resourceGroupName, String serviceName, ApiManagementServiceUpdateParameters parameters) { return updateAsync(resourceGroupName, serviceName, parameters).block(); } | /**
* Updates an existing API Management service.
*
* @param resourceGroupName The name of the resource group.
* @param serviceName The name of the API Management service.
* @param parameters Parameters supplied to the CreateOrUpdate API Management service operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return a single API Management service resource in List or Get response.
*/ | Updates an existing API Management service | update | {
"repo_name": "Azure/azure-sdk-for-java",
"path": "sdk/apimanagement/azure-resourcemanager-apimanagement/src/main/java/com/azure/resourcemanager/apimanagement/implementation/ApiManagementServicesClientImpl.java",
"license": "mit",
"size": 156165
} | [
"com.azure.core.annotation.ReturnType",
"com.azure.core.annotation.ServiceMethod",
"com.azure.resourcemanager.apimanagement.fluent.models.ApiManagementServiceResourceInner",
"com.azure.resourcemanager.apimanagement.models.ApiManagementServiceUpdateParameters"
] | import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; import com.azure.resourcemanager.apimanagement.fluent.models.ApiManagementServiceResourceInner; import com.azure.resourcemanager.apimanagement.models.ApiManagementServiceUpdateParameters; | import com.azure.core.annotation.*; import com.azure.resourcemanager.apimanagement.fluent.models.*; import com.azure.resourcemanager.apimanagement.models.*; | [
"com.azure.core",
"com.azure.resourcemanager"
] | com.azure.core; com.azure.resourcemanager; | 89,485 |
protected String getLocalizedGroupName(String group)
{
String gname = null;
String key = "InstallationGroupPanel.group." + group;
String htmlKey = key + ".html";
String html = getString(htmlKey);
// This will equal the key if there is no entry
if (htmlKey.equalsIgnoreCase(html))
{
gname = getString(key);
}
else
{
gname = html;
}
if (gname == null || key.equalsIgnoreCase(gname))
{
gname = this.installData.getVariable(key);
}
if (gname == null)
{
gname = group;
}
try
{
gname = URLDecoder.decode(gname, "UTF-8");
}
catch (UnsupportedEncodingException e)
{
emitWarning("Failed to convert localized group name", e.getMessage());
}
return gname;
} | String function(String group) { String gname = null; String key = STR + group; String htmlKey = key + ".html"; String html = getString(htmlKey); if (htmlKey.equalsIgnoreCase(html)) { gname = getString(key); } else { gname = html; } if (gname == null key.equalsIgnoreCase(gname)) { gname = this.installData.getVariable(key); } if (gname == null) { gname = group; } try { gname = URLDecoder.decode(gname, "UTF-8"); } catch (UnsupportedEncodingException e) { emitWarning(STR, e.getMessage()); } return gname; } | /**
* Look for a key = InstallationGroupPanel.group.[group] entry:
* first using installData.langpackgetString(key+".html")
* next using installData.langpack.getString(key)
* next using installData.getVariable(key)
* lastly, defaulting to group
*
* @param group - the installation group name
* @return the localized group name
*/ | Look for a key = InstallationGroupPanel.group.[group] entry: first using installData.langpackgetString(key+".html") next using installData.langpack.getString(key) next using installData.getVariable(key) lastly, defaulting to group | getLocalizedGroupName | {
"repo_name": "mtjandra/izpack",
"path": "izpack-panel/src/main/java/com/izforge/izpack/panels/installationgroup/InstallationGroupPanel.java",
"license": "apache-2.0",
"size": 24779
} | [
"java.io.UnsupportedEncodingException",
"java.net.URLDecoder"
] | import java.io.UnsupportedEncodingException; import java.net.URLDecoder; | import java.io.*; import java.net.*; | [
"java.io",
"java.net"
] | java.io; java.net; | 1,043,932 |
protected synchronized void createQuery(String queryString) {
if (log.isDebugEnabled())
{
log.debug("EJBQL query: " + queryString);
}
query = em.createQuery(queryString);
// Set parameters.
List parameterNames = getCollectedParameterNames();
if (!parameterNames.isEmpty()) {
// Use set to prevent the parameter to be set multiple times.
Set namesSet = new HashSet();
for (Iterator iter = parameterNames.iterator(); iter.hasNext();) {
String parameterName = (String)iter.next();
if (namesSet.add(parameterName)) {
JRValueParameter parameter = getValueParameter(parameterName);
String ejbParamName = getEjbqlParameterName(parameterName);
Object paramValue = parameter.getValue();
if (log.isDebugEnabled())
{
log.debug("Parameter " + ejbParamName + ": " + paramValue);
}
query.setParameter(ejbParamName, paramValue);
}
}
}
// Set query hints.
// First, set query hints supplied by the JPA_QUERY_HINTS_MAP parameter.
Map queryHintsMap = (Map)getParameterValue(JRJpaQueryExecuterFactory.PARAMETER_JPA_QUERY_HINTS_MAP);
if (queryHintsMap != null) {
for (Iterator i = queryHintsMap.entrySet().iterator(); i.hasNext(); ) {
Map.Entry pairs = (Map.Entry)i.next();
log.debug("EJBQL query hint [" + pairs.getKey() + "] set.");
query.setHint((String)pairs.getKey(), pairs.getValue());
}
}
// Second, set query hints supplied by report properties which start with JREjbPersistenceQueryExecuterFactory.PROPERTY_JPA_PERSISTENCE_QUERY_HINT_PREFIX
// Example: net.sf.jasperreports.ejbql.query.hint.fetchSize
// This property will result in a query hint set with the name: fetchSize
List properties = JRProperties.getProperties(dataset,
JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_HINT_PREFIX);
for (Iterator it = properties.iterator(); it.hasNext();) {
JRProperties.PropertySuffix property = (JRProperties.PropertySuffix) it.next();
String queryHint = property.getSuffix();
if (queryHint.length() > 0) {
String value = property.getValue();
if (log.isDebugEnabled()) {
log.debug("EJBQL query hint [" + queryHint + "] set to: " + value);
}
query.setHint(queryHint, property);
}
}
} | synchronized void function(String queryString) { if (log.isDebugEnabled()) { log.debug(STR + queryString); } query = em.createQuery(queryString); List parameterNames = getCollectedParameterNames(); if (!parameterNames.isEmpty()) { Set namesSet = new HashSet(); for (Iterator iter = parameterNames.iterator(); iter.hasNext();) { String parameterName = (String)iter.next(); if (namesSet.add(parameterName)) { JRValueParameter parameter = getValueParameter(parameterName); String ejbParamName = getEjbqlParameterName(parameterName); Object paramValue = parameter.getValue(); if (log.isDebugEnabled()) { log.debug(STR + ejbParamName + STR + paramValue); } query.setParameter(ejbParamName, paramValue); } } } Map queryHintsMap = (Map)getParameterValue(JRJpaQueryExecuterFactory.PARAMETER_JPA_QUERY_HINTS_MAP); if (queryHintsMap != null) { for (Iterator i = queryHintsMap.entrySet().iterator(); i.hasNext(); ) { Map.Entry pairs = (Map.Entry)i.next(); log.debug(STR + pairs.getKey() + STR); query.setHint((String)pairs.getKey(), pairs.getValue()); } } List properties = JRProperties.getProperties(dataset, JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_HINT_PREFIX); for (Iterator it = properties.iterator(); it.hasNext();) { JRProperties.PropertySuffix property = (JRProperties.PropertySuffix) it.next(); String queryHint = property.getSuffix(); if (queryHint.length() > 0) { String value = property.getValue(); if (log.isDebugEnabled()) { log.debug(STR + queryHint + STR + value); } query.setHint(queryHint, property); } } } | /**
* Creates the EJBQL query object.
*
* @param queryString the query string
*/ | Creates the EJBQL query object | createQuery | {
"repo_name": "delafer/j7project",
"path": "jasper352/csb-jasperreport-dep/src/net/sf/jasperreports/engine/query/JRJpaQueryExecuter.java",
"license": "gpl-2.0",
"size": 9893
} | [
"java.util.HashSet",
"java.util.Iterator",
"java.util.List",
"java.util.Map",
"java.util.Set",
"net.sf.jasperreports.engine.JRValueParameter",
"net.sf.jasperreports.engine.util.JRProperties"
] | import java.util.HashSet; import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; import net.sf.jasperreports.engine.JRValueParameter; import net.sf.jasperreports.engine.util.JRProperties; | import java.util.*; import net.sf.jasperreports.engine.*; import net.sf.jasperreports.engine.util.*; | [
"java.util",
"net.sf.jasperreports"
] | java.util; net.sf.jasperreports; | 1,115,126 |
protected void engineInit(SecureRandom random) {
this.random = random;
} | void function(SecureRandom random) { this.random = random; } | /**
* Initializes this key generator.
*
* @param random the source of randomness for this generator
*/ | Initializes this key generator | engineInit | {
"repo_name": "rokn/Count_Words_2015",
"path": "testing/openjdk2/jdk/src/share/classes/com/sun/crypto/provider/BlowfishKeyGenerator.java",
"license": "mit",
"size": 4032
} | [
"java.security.SecureRandom"
] | import java.security.SecureRandom; | import java.security.*; | [
"java.security"
] | java.security; | 520,048 |
public static ims.core.patient.domain.objects.Patient extractPatient(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.Patient valueObject)
{
return extractPatient(domainFactory, valueObject, new HashMap());
}
| static ims.core.patient.domain.objects.Patient function(ims.domain.ILightweightDomainFactory domainFactory, ims.core.vo.Patient valueObject) { return extractPatient(domainFactory, valueObject, new HashMap()); } | /**
* Create the domain object from the value object.
* @param domainFactory - used to create existing (persistent) domain objects.
* @param valueObject - extract the domain object fields from this.
*/ | Create the domain object from the value object | extractPatient | {
"repo_name": "openhealthcare/openMAXIMS",
"path": "openmaxims_workspace/ValueObjects/src/ims/core/vo/domain/PatientAssembler.java",
"license": "agpl-3.0",
"size": 48315
} | [
"java.util.HashMap"
] | import java.util.HashMap; | import java.util.*; | [
"java.util"
] | java.util; | 209,663 |
public void setOrganization(Organization organization) {
this.organization = organization;
} | void function(Organization organization) { this.organization = organization; } | /**.
* This is the Setter Method for organization
* @param organization The organization to set.
*/ | . This is the Setter Method for organization | setOrganization | {
"repo_name": "blackcathacker/kc.preclean",
"path": "coeus-code/src/main/java/org/kuali/kra/subaward/bo/SubAward.java",
"license": "apache-2.0",
"size": 44135
} | [
"org.kuali.coeus.common.framework.org.Organization"
] | import org.kuali.coeus.common.framework.org.Organization; | import org.kuali.coeus.common.framework.org.*; | [
"org.kuali.coeus"
] | org.kuali.coeus; | 2,781,003 |
public IAdjacencyGraph<Entity> newLayer(String fullUri, IMatrix val) {
IAdjacencyGraph<Entity> g;
if (val==null) {
if (fullUri == null)
g = null;
else
g = newLayer(fullUri);
} else {
g = getLayer(fullUri);
if (g == null){
newLinkType(fullUri); //Creates a new value
PropertyGraph pg = new PropertyGraph(fullUri,this,val);
g= (IAdjacencyGraph<Entity>)pg;
}
}
return g;
} | IAdjacencyGraph<Entity> function(String fullUri, IMatrix val) { IAdjacencyGraph<Entity> g; if (val==null) { if (fullUri == null) g = null; else g = newLayer(fullUri); } else { g = getLayer(fullUri); if (g == null){ newLinkType(fullUri); PropertyGraph pg = new PropertyGraph(fullUri,this,val); g= (IAdjacencyGraph<Entity>)pg; } } return g; } | /**
* Creates a new Layer
* @param fullUri Properties' URI that will be used on the new Layer
* @param val Matrix of previous assertions
* @return b
*/ | Creates a new Layer | newLayer | {
"repo_name": "jackbergus/gSpanExtended",
"path": "src/org/tweetsmining/model/graph/MultiLayerGraph.java",
"license": "gpl-2.0",
"size": 22388
} | [
"org.tweetsmining.model.graph.database.Entity",
"org.tweetsmining.model.matrices.IMatrix"
] | import org.tweetsmining.model.graph.database.Entity; import org.tweetsmining.model.matrices.IMatrix; | import org.tweetsmining.model.graph.database.*; import org.tweetsmining.model.matrices.*; | [
"org.tweetsmining.model"
] | org.tweetsmining.model; | 1,027,268 |
public void createErrorDialog(String message, int code) {
// Status sets exception to <code>null</code> internally.
IStatus status = new Status(IStatus.ERROR, ID, code, message, null);
StatusManager.getManager().handle(status, StatusManager.SHOW | StatusManager.LOG);
} | void function(String message, int code) { IStatus status = new Status(IStatus.ERROR, ID, code, message, null); StatusManager.getManager().handle(status, StatusManager.SHOW StatusManager.LOG); } | /**
* Creates a simple error dialog without exception.
*
* @param message
* The message of the dialog.
* @param code
* The code of the error. <b>-1</b> is a marker that the code has to be added later.
*/ | Creates a simple error dialog without exception | createErrorDialog | {
"repo_name": "inspectIT/inspectIT",
"path": "inspectit.ui.rcp/src/main/java/rocks/inspectit/ui/rcp/InspectIT.java",
"license": "agpl-3.0",
"size": 14903
} | [
"org.eclipse.core.runtime.IStatus",
"org.eclipse.core.runtime.Status",
"org.eclipse.ui.statushandlers.StatusManager"
] | import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; import org.eclipse.ui.statushandlers.StatusManager; | import org.eclipse.core.runtime.*; import org.eclipse.ui.statushandlers.*; | [
"org.eclipse.core",
"org.eclipse.ui"
] | org.eclipse.core; org.eclipse.ui; | 1,530,901 |
void initMapStructure(String key, Map<String, String> keyPropertyMap, Map<String, String> valuePropertyMap, ScenarioSimulationModel.Type type); | void initMapStructure(String key, Map<String, String> keyPropertyMap, Map<String, String> valuePropertyMap, ScenarioSimulationModel.Type type); | /**
* Set the <b>name</b> of the property and the <code>Map</code>s to be used to create the skeleton of the current <code>CollectionViewImpl</code> editor
* showing a <b>Map</b> of elements
* @param key The key representing the property, i.e Classname#propertyname (e.g Author#books)
* @param keyPropertyMap
* @param valuePropertyMap
* @param type
*/ | Set the name of the property and the <code>Map</code>s to be used to create the skeleton of the current <code>CollectionViewImpl</code> editor showing a Map of elements | initMapStructure | {
"repo_name": "mbiarnes/drools-wb",
"path": "drools-wb-screens/drools-wb-scenario-simulation-editor/drools-wb-scenario-simulation-editor-client/src/main/java/org/drools/workbench/screens/scenariosimulation/client/collectioneditor/CollectionView.java",
"license": "apache-2.0",
"size": 7469
} | [
"java.util.Map",
"org.drools.scenariosimulation.api.model.ScenarioSimulationModel"
] | import java.util.Map; import org.drools.scenariosimulation.api.model.ScenarioSimulationModel; | import java.util.*; import org.drools.scenariosimulation.api.model.*; | [
"java.util",
"org.drools.scenariosimulation"
] | java.util; org.drools.scenariosimulation; | 2,745,400 |
public void setTemplateUrl(Url templateUrl) {
this.templateUrl = templateUrl;
} | void function(Url templateUrl) { this.templateUrl = templateUrl; } | /**
* the url where the template is placed
*
* @param templateUrl the Url.
*/ | the url where the template is placed | setTemplateUrl | {
"repo_name": "NABUCCO/org.nabucco.framework.reporting",
"path": "org.nabucco.framework.reporting.facade.datatype/src/main/gen/org/nabucco/framework/reporting/facade/datatype/ReportConfiguration.java",
"license": "epl-1.0",
"size": 26415
} | [
"org.nabucco.framework.base.facade.datatype.net.Url"
] | import org.nabucco.framework.base.facade.datatype.net.Url; | import org.nabucco.framework.base.facade.datatype.net.*; | [
"org.nabucco.framework"
] | org.nabucco.framework; | 2,887,065 |
float[] parseFloatArray(final InfiniumFileTOC toc) throws IOException {
stream.skipBytes(toc.getOffset());
final int arrayLen = Integer.reverseBytes(stream.readInt());
final float[] floatArray = new float[arrayLen];
for (int i = 0; i < arrayLen; i++) {
floatArray[i] = parseFloat();
}
return floatArray;
} | float[] parseFloatArray(final InfiniumFileTOC toc) throws IOException { stream.skipBytes(toc.getOffset()); final int arrayLen = Integer.reverseBytes(stream.readInt()); final float[] floatArray = new float[arrayLen]; for (int i = 0; i < arrayLen; i++) { floatArray[i] = parseFloat(); } return floatArray; } | /**
* Utility method for parsing an array of float values.
*
* @param toc The table of content record for parsing the float values.
* @return An array of float values for the given TOC.
* @throws java.io.IOException is thrown when there is a problem reading the stream.
*/ | Utility method for parsing an array of float values | parseFloatArray | {
"repo_name": "broadinstitute/picard",
"path": "src/main/java/picard/arrays/illumina/InfiniumDataFile.java",
"license": "mit",
"size": 14175
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 1,615,547 |
@Override
protected void performCalculations() {
QL.require(engine != null, SHOULD_DEFINE_PRICING_ENGINE); // QA:[RG]::verified
engine.reset();
setupArguments(engine.getArguments());
engine.getArguments().validate();
engine.calculate();
fetchResults(engine.getResults());
} | void function() { QL.require(engine != null, SHOULD_DEFINE_PRICING_ENGINE); engine.reset(); setupArguments(engine.getArguments()); engine.getArguments().validate(); engine.calculate(); fetchResults(engine.getResults()); } | /**
* This method performs the actual calculations and set any needed results.
*
* @see LazyObject#performCalculations
*/ | This method performs the actual calculations and set any needed results | performCalculations | {
"repo_name": "spolnik/QuantJLib",
"path": "src/main/java/org/quantjlib/instruments/Instrument.java",
"license": "apache-2.0",
"size": 9110
} | [
"org.quantjlib.QL"
] | import org.quantjlib.QL; | import org.quantjlib.*; | [
"org.quantjlib"
] | org.quantjlib; | 2,744,588 |
private void readUniqueColumnElements(XMLStreamReader xmlReader, Index index) throws XMLStreamException, IOException
{
int eventType = XMLStreamReader.START_ELEMENT;
while (eventType != XMLStreamReader.END_ELEMENT)
{
eventType = xmlReader.next();
if (eventType == XMLStreamReader.START_ELEMENT)
{
QName elemQName = xmlReader.getName();
if (isSameAs(elemQName, QNAME_ELEMENT_UNIQUE_COLUMN))
{
index.addColumn(readIndexColumnElement(xmlReader));
}
else {
readOverElement(xmlReader);
}
}
}
}
| void function(XMLStreamReader xmlReader, Index index) throws XMLStreamException, IOException { int eventType = XMLStreamReader.START_ELEMENT; while (eventType != XMLStreamReader.END_ELEMENT) { eventType = xmlReader.next(); if (eventType == XMLStreamReader.START_ELEMENT) { QName elemQName = xmlReader.getName(); if (isSameAs(elemQName, QNAME_ELEMENT_UNIQUE_COLUMN)) { index.addColumn(readIndexColumnElement(xmlReader)); } else { readOverElement(xmlReader); } } } } | /**
* Reads unique index column elements from the XML stream reader and adds them to the given
* index object.
*
* @param xmlReader The reader
* @param index The index object
*/ | Reads unique index column elements from the XML stream reader and adds them to the given index object | readUniqueColumnElements | {
"repo_name": "ramizul/ddlutilsplus",
"path": "src/main/java/org/apache/ddlutils/io/DatabaseIO.java",
"license": "apache-2.0",
"size": 42174
} | [
"java.io.IOException",
"javax.xml.namespace.QName",
"javax.xml.stream.XMLStreamException",
"javax.xml.stream.XMLStreamReader",
"org.apache.ddlutils.model.Index"
] | import java.io.IOException; import javax.xml.namespace.QName; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import org.apache.ddlutils.model.Index; | import java.io.*; import javax.xml.namespace.*; import javax.xml.stream.*; import org.apache.ddlutils.model.*; | [
"java.io",
"javax.xml",
"org.apache.ddlutils"
] | java.io; javax.xml; org.apache.ddlutils; | 789,764 |
URI build(InvocationParameters parameters, UriBuilder uriBuilder); | URI build(InvocationParameters parameters, UriBuilder uriBuilder); | /**
* Build uri.
*
* @param parameters the parameters
* @param uriBuilder the uri builder
* @return the uri
*/ | Build uri | build | {
"repo_name": "bremersee/common",
"path": "common-base-webflux/src/main/java/org/bremersee/web/reactive/function/client/proxy/RequestUriBuilder.java",
"license": "apache-2.0",
"size": 2150
} | [
"org.springframework.web.util.UriBuilder"
] | import org.springframework.web.util.UriBuilder; | import org.springframework.web.util.*; | [
"org.springframework.web"
] | org.springframework.web; | 1,043,085 |
public boolean run(String[] args) throws IOException {
options.addOption(OUTPUT_DIR_OPTION, "output_dir", true,
"Output directory");
options.addOption(NUM_KV_OPTION, "num_kv", true,
"Number of key/value pairs");
options.addOption(KEY_SIZE_OPTION, "key_size", true, "Average key size");
options.addOption(VALUE_SIZE_OPTION, "value_size", true,
"Average value size");
options.addOption(HFILE_VERSION_OPTION, "hfile_version", true,
"HFile version to create");
options.addOption(COMPRESSION_OPTION, "compression", true,
" Compression type, one of "
+ Arrays.toString(Compression.Algorithm.values()));
options.addOption(BLOOM_FILTER_OPTION, "bloom_filter", true,
"Bloom filter type, one of "
+ Arrays.toString(StoreFile.BloomType.values()));
options.addOption(BLOCK_SIZE_OPTION, "block_size", true,
"HFile block size");
options.addOption(BLOOM_BLOCK_SIZE_OPTION, "bloom_block_size", true,
"Compound Bloom filters block size");
options.addOption(INDEX_BLOCK_SIZE_OPTION, "index_block_size", true,
"Index block size");
if (args.length == 0) {
HelpFormatter formatter = new HelpFormatter();
formatter.printHelp(CreateRandomStoreFile.class.getSimpleName(), options,
true);
return false;
}
CommandLineParser parser = new PosixParser();
CommandLine cmdLine;
try {
cmdLine = parser.parse(options, args);
} catch (ParseException ex) {
LOG.error(ex);
return false;
}
if (!cmdLine.hasOption(OUTPUT_DIR_OPTION)) {
LOG.error("Output directory is not specified");
return false;
}
if (!cmdLine.hasOption(NUM_KV_OPTION)) {
LOG.error("The number of keys/values not specified");
return false;
}
if (!cmdLine.hasOption(KEY_SIZE_OPTION)) {
LOG.error("Key size is not specified");
return false;
}
if (!cmdLine.hasOption(VALUE_SIZE_OPTION)) {
LOG.error("Value size not specified");
return false;
}
Configuration conf = HBaseConfiguration.create();
Path outputDir = new Path(cmdLine.getOptionValue(OUTPUT_DIR_OPTION));
long numKV = Long.parseLong(cmdLine.getOptionValue(NUM_KV_OPTION));
configureKeyValue(numKV,
Integer.parseInt(cmdLine.getOptionValue(KEY_SIZE_OPTION)),
Integer.parseInt(cmdLine.getOptionValue(VALUE_SIZE_OPTION)));
FileSystem fs = FileSystem.get(conf);
Compression.Algorithm compr = Compression.Algorithm.NONE;
if (cmdLine.hasOption(COMPRESSION_OPTION)) {
compr = Compression.Algorithm.valueOf(
cmdLine.getOptionValue(COMPRESSION_OPTION));
}
StoreFile.BloomType bloomType = StoreFile.BloomType.NONE;
if (cmdLine.hasOption(BLOOM_FILTER_OPTION)) {
bloomType = StoreFile.BloomType.valueOf(cmdLine.getOptionValue(
BLOOM_FILTER_OPTION));
}
int blockSize = HFile.DEFAULT_BLOCKSIZE;
if (cmdLine.hasOption(BLOCK_SIZE_OPTION))
blockSize = Integer.valueOf(cmdLine.getOptionValue(BLOCK_SIZE_OPTION));
if (cmdLine.hasOption(BLOOM_BLOCK_SIZE_OPTION)) {
conf.setInt(BloomFilterFactory.IO_STOREFILE_BLOOM_BLOCK_SIZE,
Integer.valueOf(cmdLine.getOptionValue(BLOOM_BLOCK_SIZE_OPTION)));
}
if (cmdLine.hasOption(INDEX_BLOCK_SIZE_OPTION)) {
conf.setInt(HFileBlockIndex.MAX_CHUNK_SIZE_KEY,
Integer.valueOf(cmdLine.getOptionValue(INDEX_BLOCK_SIZE_OPTION)));
}
StoreFile.Writer sfw = new StoreFile.WriterBuilder(conf,
new CacheConfig(conf), fs, blockSize)
.withOutputDir(outputDir)
.withCompression(compr)
.withBloomType(bloomType)
.withMaxKeyCount(numKV)
.withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE)
.withBytesPerChecksum(HFile.DEFAULT_BYTES_PER_CHECKSUM)
.build();
rand = new Random();
LOG.info("Writing " + numKV + " key/value pairs");
for (long i = 0; i < numKV; ++i) {
sfw.append(generateKeyValue(i));
}
int numMetaBlocks = rand.nextInt(10) + 1;
LOG.info("Writing " + numMetaBlocks + " meta blocks");
for (int metaI = 0; metaI < numMetaBlocks; ++metaI) {
sfw.getHFileWriter().appendMetaBlock(generateString(),
new BytesWritable(generateValue()));
}
sfw.close();
Path storeFilePath = sfw.getPath();
long fileSize = fs.getFileStatus(storeFilePath).getLen();
LOG.info("Created " + storeFilePath + ", " + fileSize + " bytes");
return true;
} | boolean function(String[] args) throws IOException { options.addOption(OUTPUT_DIR_OPTION, STR, true, STR); options.addOption(NUM_KV_OPTION, STR, true, STR); options.addOption(KEY_SIZE_OPTION, STR, true, STR); options.addOption(VALUE_SIZE_OPTION, STR, true, STR); options.addOption(HFILE_VERSION_OPTION, STR, true, STR); options.addOption(COMPRESSION_OPTION, STR, true, STR + Arrays.toString(Compression.Algorithm.values())); options.addOption(BLOOM_FILTER_OPTION, STR, true, STR + Arrays.toString(StoreFile.BloomType.values())); options.addOption(BLOCK_SIZE_OPTION, STR, true, STR); options.addOption(BLOOM_BLOCK_SIZE_OPTION, STR, true, STR); options.addOption(INDEX_BLOCK_SIZE_OPTION, STR, true, STR); if (args.length == 0) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp(CreateRandomStoreFile.class.getSimpleName(), options, true); return false; } CommandLineParser parser = new PosixParser(); CommandLine cmdLine; try { cmdLine = parser.parse(options, args); } catch (ParseException ex) { LOG.error(ex); return false; } if (!cmdLine.hasOption(OUTPUT_DIR_OPTION)) { LOG.error(STR); return false; } if (!cmdLine.hasOption(NUM_KV_OPTION)) { LOG.error(STR); return false; } if (!cmdLine.hasOption(KEY_SIZE_OPTION)) { LOG.error(STR); return false; } if (!cmdLine.hasOption(VALUE_SIZE_OPTION)) { LOG.error(STR); return false; } Configuration conf = HBaseConfiguration.create(); Path outputDir = new Path(cmdLine.getOptionValue(OUTPUT_DIR_OPTION)); long numKV = Long.parseLong(cmdLine.getOptionValue(NUM_KV_OPTION)); configureKeyValue(numKV, Integer.parseInt(cmdLine.getOptionValue(KEY_SIZE_OPTION)), Integer.parseInt(cmdLine.getOptionValue(VALUE_SIZE_OPTION))); FileSystem fs = FileSystem.get(conf); Compression.Algorithm compr = Compression.Algorithm.NONE; if (cmdLine.hasOption(COMPRESSION_OPTION)) { compr = Compression.Algorithm.valueOf( cmdLine.getOptionValue(COMPRESSION_OPTION)); } StoreFile.BloomType bloomType = StoreFile.BloomType.NONE; if (cmdLine.hasOption(BLOOM_FILTER_OPTION)) { bloomType = StoreFile.BloomType.valueOf(cmdLine.getOptionValue( BLOOM_FILTER_OPTION)); } int blockSize = HFile.DEFAULT_BLOCKSIZE; if (cmdLine.hasOption(BLOCK_SIZE_OPTION)) blockSize = Integer.valueOf(cmdLine.getOptionValue(BLOCK_SIZE_OPTION)); if (cmdLine.hasOption(BLOOM_BLOCK_SIZE_OPTION)) { conf.setInt(BloomFilterFactory.IO_STOREFILE_BLOOM_BLOCK_SIZE, Integer.valueOf(cmdLine.getOptionValue(BLOOM_BLOCK_SIZE_OPTION))); } if (cmdLine.hasOption(INDEX_BLOCK_SIZE_OPTION)) { conf.setInt(HFileBlockIndex.MAX_CHUNK_SIZE_KEY, Integer.valueOf(cmdLine.getOptionValue(INDEX_BLOCK_SIZE_OPTION))); } StoreFile.Writer sfw = new StoreFile.WriterBuilder(conf, new CacheConfig(conf), fs, blockSize) .withOutputDir(outputDir) .withCompression(compr) .withBloomType(bloomType) .withMaxKeyCount(numKV) .withChecksumType(HFile.DEFAULT_CHECKSUM_TYPE) .withBytesPerChecksum(HFile.DEFAULT_BYTES_PER_CHECKSUM) .build(); rand = new Random(); LOG.info(STR + numKV + STR); for (long i = 0; i < numKV; ++i) { sfw.append(generateKeyValue(i)); } int numMetaBlocks = rand.nextInt(10) + 1; LOG.info(STR + numMetaBlocks + STR); for (int metaI = 0; metaI < numMetaBlocks; ++metaI) { sfw.getHFileWriter().appendMetaBlock(generateString(), new BytesWritable(generateValue())); } sfw.close(); Path storeFilePath = sfw.getPath(); long fileSize = fs.getFileStatus(storeFilePath).getLen(); LOG.info(STR + storeFilePath + STR + fileSize + STR); return true; } | /**
* Runs the tools.
*
* @param args command-line arguments
* @return true in case of success
* @throws IOException
*/ | Runs the tools | run | {
"repo_name": "zqxjjj/NobidaBase",
"path": "target/hbase-0.94.9/hbase-0.94.9/src/test/java/org/apache/hadoop/hbase/regionserver/CreateRandomStoreFile.java",
"license": "apache-2.0",
"size": 10399
} | [
"java.io.IOException",
"java.util.Arrays",
"java.util.Random",
"org.apache.commons.cli.CommandLine",
"org.apache.commons.cli.CommandLineParser",
"org.apache.commons.cli.HelpFormatter",
"org.apache.commons.cli.ParseException",
"org.apache.commons.cli.PosixParser",
"org.apache.hadoop.conf.Configuratio... | import java.io.IOException; import java.util.Arrays; import java.util.Random; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.CommandLineParser; import org.apache.commons.cli.HelpFormatter; import org.apache.commons.cli.ParseException; import org.apache.commons.cli.PosixParser; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hbase.HBaseConfiguration; import org.apache.hadoop.hbase.io.hfile.CacheConfig; import org.apache.hadoop.hbase.io.hfile.Compression; import org.apache.hadoop.hbase.io.hfile.HFile; import org.apache.hadoop.hbase.io.hfile.HFileBlockIndex; import org.apache.hadoop.hbase.regionserver.StoreFile; import org.apache.hadoop.hbase.util.BloomFilterFactory; import org.apache.hadoop.io.BytesWritable; | import java.io.*; import java.util.*; import org.apache.commons.cli.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.fs.*; import org.apache.hadoop.hbase.*; import org.apache.hadoop.hbase.io.hfile.*; import org.apache.hadoop.hbase.regionserver.*; import org.apache.hadoop.hbase.util.*; import org.apache.hadoop.io.*; | [
"java.io",
"java.util",
"org.apache.commons",
"org.apache.hadoop"
] | java.io; java.util; org.apache.commons; org.apache.hadoop; | 1,462,291 |
public FormEntity getPersistedInstanceOfForm(FormEntity form) {
String deploymentId = form.getDeploymentId();
if (StringUtils.isEmpty(form.getDeploymentId())) {
throw new ActivitiFormIllegalArgumentException("Provided form must have a deployment id.");
}
FormEntityManager formEntityManager = Context.getCommandContext().getFormEngineConfiguration().getFormEntityManager();
FormEntity persistedForm = null;
if (form.getTenantId() == null || FormEngineConfiguration.NO_TENANT_ID.equals(form.getTenantId())) {
persistedForm = formEntityManager.findFormByDeploymentAndKey(deploymentId, form.getKey());
} else {
persistedForm = formEntityManager.findFormByDeploymentAndKeyAndTenantId(deploymentId, form.getKey(), form.getTenantId());
}
return persistedForm;
} | FormEntity function(FormEntity form) { String deploymentId = form.getDeploymentId(); if (StringUtils.isEmpty(form.getDeploymentId())) { throw new ActivitiFormIllegalArgumentException(STR); } FormEntityManager formEntityManager = Context.getCommandContext().getFormEngineConfiguration().getFormEntityManager(); FormEntity persistedForm = null; if (form.getTenantId() == null FormEngineConfiguration.NO_TENANT_ID.equals(form.getTenantId())) { persistedForm = formEntityManager.findFormByDeploymentAndKey(deploymentId, form.getKey()); } else { persistedForm = formEntityManager.findFormByDeploymentAndKeyAndTenantId(deploymentId, form.getKey(), form.getTenantId()); } return persistedForm; } | /**
* Gets the persisted version of the already-deployed form. Note that this is
* different from {@link #getMostRecentVersionOfForm} as it looks specifically for
* a form that is already persisted and attached to a particular deployment,
* rather than the latest version across all deployments.
*/ | Gets the persisted version of the already-deployed form. Note that this is different from <code>#getMostRecentVersionOfForm</code> as it looks specifically for a form that is already persisted and attached to a particular deployment, rather than the latest version across all deployments | getPersistedInstanceOfForm | {
"repo_name": "stefan-ziel/Activiti",
"path": "modules/activiti-form-engine/src/main/java/org/activiti/form/engine/impl/deployer/FormDeploymentHelper.java",
"license": "apache-2.0",
"size": 4998
} | [
"org.activiti.form.engine.ActivitiFormIllegalArgumentException",
"org.activiti.form.engine.FormEngineConfiguration",
"org.activiti.form.engine.impl.context.Context",
"org.activiti.form.engine.impl.persistence.entity.FormEntity",
"org.activiti.form.engine.impl.persistence.entity.FormEntityManager",
"org.ap... | import org.activiti.form.engine.ActivitiFormIllegalArgumentException; import org.activiti.form.engine.FormEngineConfiguration; import org.activiti.form.engine.impl.context.Context; import org.activiti.form.engine.impl.persistence.entity.FormEntity; import org.activiti.form.engine.impl.persistence.entity.FormEntityManager; import org.apache.commons.lang3.StringUtils; | import org.activiti.form.engine.*; import org.activiti.form.engine.impl.context.*; import org.activiti.form.engine.impl.persistence.entity.*; import org.apache.commons.lang3.*; | [
"org.activiti.form",
"org.apache.commons"
] | org.activiti.form; org.apache.commons; | 1,669,033 |
public void resetResendCount() {
this.resendCount = 0;
if (this.nodeStageAdvancer.isInitializationComplete() && this.isDead() == false) {
nodeStageAdvancer.setCurrentStage(ZWaveNodeInitStage.DONE);
}
} | void function() { this.resendCount = 0; if (this.nodeStageAdvancer.isInitializationComplete() && this.isDead() == false) { nodeStageAdvancer.setCurrentStage(ZWaveNodeInitStage.DONE); } } | /**
* Resets the resend counter and possibly resets the
* node stage to DONE when previous initialization was
* complete.
* Note that if the node is DEAD, then the nodeStage stays DEAD
*/ | Resets the resend counter and possibly resets the node stage to DONE when previous initialization was complete. Note that if the node is DEAD, then the nodeStage stays DEAD | resetResendCount | {
"repo_name": "DigitalBites/openhab2",
"path": "addons/binding/org.openhab.binding.zwave/src/main/java/org/openhab/binding/zwave/internal/protocol/ZWaveNode.java",
"license": "epl-1.0",
"size": 26125
} | [
"org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStage"
] | import org.openhab.binding.zwave.internal.protocol.initialization.ZWaveNodeInitStage; | import org.openhab.binding.zwave.internal.protocol.initialization.*; | [
"org.openhab.binding"
] | org.openhab.binding; | 2,838,193 |
public InjectionTargetType<MessageDestinationRefType<T>> getOrCreateInjectionTarget()
{
List<Node> nodeList = childNode.get("injection-target");
if (nodeList != null && nodeList.size() > 0)
{
return new InjectionTargetTypeImpl<MessageDestinationRefType<T>>(this, "injection-target", childNode, nodeList.get(0));
}
return createInjectionTarget();
} | InjectionTargetType<MessageDestinationRefType<T>> function() { List<Node> nodeList = childNode.get(STR); if (nodeList != null && nodeList.size() > 0) { return new InjectionTargetTypeImpl<MessageDestinationRefType<T>>(this, STR, childNode, nodeList.get(0)); } return createInjectionTarget(); } | /**
* If not already created, a new <code>injection-target</code> element will be created and returned.
* Otherwise, the first existing <code>injection-target</code> element will be returned.
* @return the instance defined for the element <code>injection-target</code>
*/ | If not already created, a new <code>injection-target</code> element will be created and returned. Otherwise, the first existing <code>injection-target</code> element will be returned | getOrCreateInjectionTarget | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/javaee6/MessageDestinationRefTypeImpl.java",
"license": "epl-1.0",
"size": 16577
} | [
"java.util.List",
"org.jboss.shrinkwrap.descriptor.api.javaee6.InjectionTargetType",
"org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationRefType",
"org.jboss.shrinkwrap.descriptor.spi.node.Node"
] | import java.util.List; import org.jboss.shrinkwrap.descriptor.api.javaee6.InjectionTargetType; import org.jboss.shrinkwrap.descriptor.api.javaee6.MessageDestinationRefType; import org.jboss.shrinkwrap.descriptor.spi.node.Node; | import java.util.*; import org.jboss.shrinkwrap.descriptor.api.javaee6.*; import org.jboss.shrinkwrap.descriptor.spi.node.*; | [
"java.util",
"org.jboss.shrinkwrap"
] | java.util; org.jboss.shrinkwrap; | 842,810 |
if (!isSet(EnvironmentVariableKey.NOLOG)) {
log.warning(notice(clazz, method) + message);
}
if (!isSet(EnvironmentVariableKey.NODELAY)) {
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
log.log(Level.WARNING, notice(clazz, method) + message, e);
}
}
} | if (!isSet(EnvironmentVariableKey.NOLOG)) { log.warning(notice(clazz, method) + message); } if (!isSet(EnvironmentVariableKey.NODELAY)) { try { Thread.sleep(4000); } catch (InterruptedException e) { Thread.currentThread().interrupt(); log.log(Level.WARNING, notice(clazz, method) + message, e); } } } | /**
* According to the deprecation policy this method implements the phase 2 which
* involves logging a warning and making a small pause in the execution thread.
*
* @param clazz deprecated class
* @param method name of deprecated method
* @param message the log message
*/ | According to the deprecation policy this method implements the phase 2 which involves logging a warning and making a small pause in the execution thread | phase2 | {
"repo_name": "prowide/prowide-core",
"path": "src/main/java/com/prowidesoftware/deprecation/DeprecationUtils.java",
"license": "apache-2.0",
"size": 6695
} | [
"java.util.logging.Level"
] | import java.util.logging.Level; | import java.util.logging.*; | [
"java.util"
] | java.util; | 1,458,710 |
Optional<Inventory> getDoubleChestInventory(); | Optional<Inventory> getDoubleChestInventory(); | /**
* Returns the inventory representing the combination of this chest and its neighbor
* (which form a double chest), if availab le.
*
* <p>If this chest is not part of a double chest, then this method will return {@link Optional#empty()}.</p>
*
* @return The combined inventory, if available
*/ | Returns the inventory representing the combination of this chest and its neighbor (which form a double chest), if availab le. If this chest is not part of a double chest, then this method will return <code>Optional#empty()</code> | getDoubleChestInventory | {
"repo_name": "AlphaModder/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/block/tileentity/carrier/Chest.java",
"license": "mit",
"size": 1865
} | [
"java.util.Optional",
"org.spongepowered.api.item.inventory.Inventory"
] | import java.util.Optional; import org.spongepowered.api.item.inventory.Inventory; | import java.util.*; import org.spongepowered.api.item.inventory.*; | [
"java.util",
"org.spongepowered.api"
] | java.util; org.spongepowered.api; | 844,365 |
EAttribute getPWRSteamSupply_ThrottlePressureFactor(); | EAttribute getPWRSteamSupply_ThrottlePressureFactor(); | /**
* Returns the meta object for the attribute '{@link CIM.IEC61970.Generation.GenerationDynamics.PWRSteamSupply#getThrottlePressureFactor <em>Throttle Pressure Factor</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for the attribute '<em>Throttle Pressure Factor</em>'.
* @see CIM.IEC61970.Generation.GenerationDynamics.PWRSteamSupply#getThrottlePressureFactor()
* @see #getPWRSteamSupply()
* @generated
*/ | Returns the meta object for the attribute '<code>CIM.IEC61970.Generation.GenerationDynamics.PWRSteamSupply#getThrottlePressureFactor Throttle Pressure Factor</code>'. | getPWRSteamSupply_ThrottlePressureFactor | {
"repo_name": "georghinkel/ttc2017smartGrids",
"path": "solutions/ModelJoin/src/main/java/CIM/IEC61970/Generation/GenerationDynamics/GenerationDynamicsPackage.java",
"license": "mit",
"size": 239957
} | [
"org.eclipse.emf.ecore.EAttribute"
] | import org.eclipse.emf.ecore.EAttribute; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,752,055 |
@SuppressWarnings("InlinedApi")
public AudioCapabilities register() {
Intent stickyIntent = receiver == null ? null
: context.registerReceiver(receiver, new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG));
audioCapabilities = AudioCapabilities.getCapabilities(stickyIntent);
return audioCapabilities;
} | @SuppressWarnings(STR) AudioCapabilities function() { Intent stickyIntent = receiver == null ? null : context.registerReceiver(receiver, new IntentFilter(AudioManager.ACTION_HDMI_AUDIO_PLUG)); audioCapabilities = AudioCapabilities.getCapabilities(stickyIntent); return audioCapabilities; } | /**
* Registers the receiver, meaning it will notify the listener when audio capability changes
* occur. The current audio capabilities will be returned. It is important to call
* {@link #unregister} when the receiver is no longer required.
*
* @return The current audio capabilities for the device.
*/ | Registers the receiver, meaning it will notify the listener when audio capability changes occur. The current audio capabilities will be returned. It is important to call <code>#unregister</code> when the receiver is no longer required | register | {
"repo_name": "WeiChungChang/ExoPlayer",
"path": "library/src/main/java/com/google/android/exoplayer2/audio/AudioCapabilitiesReceiver.java",
"license": "apache-2.0",
"size": 3476
} | [
"android.content.Intent",
"android.content.IntentFilter",
"android.media.AudioManager"
] | import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; | import android.content.*; import android.media.*; | [
"android.content",
"android.media"
] | android.content; android.media; | 2,667,843 |
public interface PackageSelector {
File selectPackageDirectory(String componentId); | interface PackageSelector { File function(String componentId); | /**
* Selects root directory of an installed PEAR package in the local file system. If the given
* component is not installed yet, returns <code>null</code>.
*
* @param componentId
* The ID of the given installed component.
* @return The root directory of the installed PEAR package, or <code>null</code>, if the given
* component is not installed yet.
*/ | Selects root directory of an installed PEAR package in the local file system. If the given component is not installed yet, returns <code>null</code> | selectPackageDirectory | {
"repo_name": "apache/uima-uimaj",
"path": "uimaj-core/src/main/java/org/apache/uima/pear/tools/InstallationController.java",
"license": "apache-2.0",
"size": 85779
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 289,535 |
public List<Provider<?>> getProviders() {
final ArrayList<Provider<?>> providers = new ArrayList<Provider<?>>();
for (final Class<?> type : types) {
if (container.hasProvider(type)) {
providers.add(container.getProvider(type));
}
}
return providers;
} | List<Provider<?>> function() { final ArrayList<Provider<?>> providers = new ArrayList<Provider<?>>(); for (final Class<?> type : types) { if (container.hasProvider(type)) { providers.add(container.getProvider(type)); } } return providers; } | /**
* Return a list of all the providers of this collection. Take note that if
* a provider is removed from the container, is not returned in this group
*
* @return a list of all existent providers
*/ | Return a list of all the providers of this collection. Take note that if a provider is removed from the container, is not returned in this group | getProviders | {
"repo_name": "mohitvargia/smsgateway-android",
"path": "lib/com/calclab/suco/client/ioc/decorator/ProviderCollection.java",
"license": "agpl-3.0",
"size": 2793
} | [
"com.calclab.suco.client.ioc.Provider",
"java.util.ArrayList",
"java.util.List"
] | import com.calclab.suco.client.ioc.Provider; import java.util.ArrayList; import java.util.List; | import com.calclab.suco.client.ioc.*; import java.util.*; | [
"com.calclab.suco",
"java.util"
] | com.calclab.suco; java.util; | 1,299,684 |
@Test(timeout = 300000)
public void testCyclicReplication1() throws Exception {
LOG.info("testSimplePutDelete");
int numClusters = 2;
Table[] htables = null;
try {
startMiniClusters(numClusters);
createTableOnClusters(table);
htables = getHTablesOnClusters(tableName);
// Test the replication scenarios of 0 -> 1 -> 0
addPeer("1", 0, 1);
addPeer("1", 1, 0);
int[] expectedCounts = new int[] { 2, 2 };
// add rows to both clusters,
// make sure they are both replication
putAndWait(row, famName, htables[0], htables[1]);
putAndWait(row1, famName, htables[1], htables[0]);
validateCounts(htables, put, expectedCounts);
deleteAndWait(row, htables[0], htables[1]);
deleteAndWait(row1, htables[1], htables[0]);
validateCounts(htables, delete, expectedCounts);
} finally {
close(htables);
shutDownMiniClusters();
}
} | @Test(timeout = 300000) void function() throws Exception { LOG.info(STR); int numClusters = 2; Table[] htables = null; try { startMiniClusters(numClusters); createTableOnClusters(table); htables = getHTablesOnClusters(tableName); addPeer("1", 0, 1); addPeer("1", 1, 0); int[] expectedCounts = new int[] { 2, 2 }; putAndWait(row, famName, htables[0], htables[1]); putAndWait(row1, famName, htables[1], htables[0]); validateCounts(htables, put, expectedCounts); deleteAndWait(row, htables[0], htables[1]); deleteAndWait(row1, htables[1], htables[0]); validateCounts(htables, delete, expectedCounts); } finally { close(htables); shutDownMiniClusters(); } } | /**
* It tests the replication scenario involving 0 -> 1 -> 0. It does it by
* adding and deleting a row to a table in each cluster, checking if it's
* replicated. It also tests that the puts and deletes are not replicated back
* to the originating cluster.
*/ | It tests the replication scenario involving 0 -> 1 -> 0. It does it by adding and deleting a row to a table in each cluster, checking if it's replicated. It also tests that the puts and deletes are not replicated back to the originating cluster | testCyclicReplication1 | {
"repo_name": "amyvmiwei/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestMasterReplication.java",
"license": "apache-2.0",
"size": 15902
} | [
"org.apache.hadoop.hbase.client.Table",
"org.junit.Test"
] | import org.apache.hadoop.hbase.client.Table; import org.junit.Test; | import org.apache.hadoop.hbase.client.*; import org.junit.*; | [
"org.apache.hadoop",
"org.junit"
] | org.apache.hadoop; org.junit; | 1,156,754 |
public CallFrame getCallFrame() {
return callFrame;
} | CallFrame function() { return callFrame; } | /**
* Function location.
*/ | Function location | getCallFrame | {
"repo_name": "paine1690/cdp4j",
"path": "src/main/java/io/webfolder/cdp/type/profiler/ProfileNode.java",
"license": "mit",
"size": 3429
} | [
"io.webfolder.cdp.type.runtime.CallFrame"
] | import io.webfolder.cdp.type.runtime.CallFrame; | import io.webfolder.cdp.type.runtime.*; | [
"io.webfolder.cdp"
] | io.webfolder.cdp; | 2,554,819 |
private void get_external_sources(HttpServletRequest request, HttpServletResponse response) throws IOException {
ArrayList<JsonObject> response_content = new ArrayList<JsonObject>();
try {
Map<String, Cookie> cookies = this.getCookies(request);
JsonParser parser = new JsonParser();
String loggedUser = cookies.get("loggedUser").getValue();
String sessionToken = cookies.get("sessionToken").getValue();
if (!checkAccessPermissions(loggedUser, sessionToken)) {
throw new AccessControlException("Your session is invalid. Please sign in again.");
}
//For each JSON file in the directory
File folder = new File(DATA_LOCATION + File.separator + "extensions" + File.separator + "external_sources");
//Check if exist, create otherwise
if(!folder.exists()){
String path = Samples_servlets.class.getResource("/sql_scripts/extensions/external_sources/").getPath();
FileUtils.copyDirectory(new File(path), folder);
}
File[] listOfFiles = folder.listFiles();
BufferedReader br;
for (File file : listOfFiles) {
if (file.isFile()) {
//Read the JS0N file
br = new BufferedReader(new FileReader(file));
parser = new JsonParser();
JsonObject data = parser.parse(br).getAsJsonObject();
//Check if type == LIMS
if ("lims".equalsIgnoreCase(data.get("type").getAsString())) {
//If so, add the source to response
data.add("file_name", new JsonPrimitive(file.getName()));
response_content.add(data);
}
}
}
} catch (Exception e) {
ServerErrorManager.handleException(e, Samples_servlets.class.getName(), "get_external_sources", e.getMessage());
} finally {
if (ServerErrorManager.errorStatus()) {
response.setStatus(400);
response.getWriter().print(ServerErrorManager.getErrorResponse());
} else {
JsonObject obj = new JsonObject();
JsonArray _response = new JsonArray();
for (JsonObject element : response_content) {
_response.add(element);
}
obj.add("external_sources", _response);
response.getWriter().print(obj.toString());
}
}
} | void function(HttpServletRequest request, HttpServletResponse response) throws IOException { ArrayList<JsonObject> response_content = new ArrayList<JsonObject>(); try { Map<String, Cookie> cookies = this.getCookies(request); JsonParser parser = new JsonParser(); String loggedUser = cookies.get(STR).getValue(); String sessionToken = cookies.get(STR).getValue(); if (!checkAccessPermissions(loggedUser, sessionToken)) { throw new AccessControlException(STR); } File folder = new File(DATA_LOCATION + File.separator + STR + File.separator + STR); if(!folder.exists()){ String path = Samples_servlets.class.getResource(STR).getPath(); FileUtils.copyDirectory(new File(path), folder); } File[] listOfFiles = folder.listFiles(); BufferedReader br; for (File file : listOfFiles) { if (file.isFile()) { br = new BufferedReader(new FileReader(file)); parser = new JsonParser(); JsonObject data = parser.parse(br).getAsJsonObject(); if ("lims".equalsIgnoreCase(data.get("type").getAsString())) { data.add(STR, new JsonPrimitive(file.getName())); response_content.add(data); } } } } catch (Exception e) { ServerErrorManager.handleException(e, Samples_servlets.class.getName(), STR, e.getMessage()); } finally { if (ServerErrorManager.errorStatus()) { response.setStatus(400); response.getWriter().print(ServerErrorManager.getErrorResponse()); } else { JsonObject obj = new JsonObject(); JsonArray _response = new JsonArray(); for (JsonObject element : response_content) { _response.add(element); } obj.add(STR, _response); response.getWriter().print(obj.toString()); } } } | /**
* *
* This function reads the configuration files that set the supported LIMS
* systems for registering external samples.
*
* @param request
* @param response
* @throws IOException
*/ | This function reads the configuration files that set the supported LIMS systems for registering external samples | get_external_sources | {
"repo_name": "fikipollo/stategraems",
"path": "src/java/servlets/Samples_servlets.java",
"license": "mit",
"size": 98785
} | [
"com.google.gson.JsonArray",
"com.google.gson.JsonObject",
"com.google.gson.JsonParser",
"com.google.gson.JsonPrimitive",
"java.io.BufferedReader",
"java.io.File",
"java.io.FileReader",
"java.io.IOException",
"java.security.AccessControlException",
"java.util.ArrayList",
"java.util.Map",
"java... | import com.google.gson.JsonArray; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.JsonPrimitive; import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; import java.security.AccessControlException; import java.util.ArrayList; import java.util.Map; import javax.servlet.http.Cookie; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.io.FileUtils; | import com.google.gson.*; import java.io.*; import java.security.*; import java.util.*; import javax.servlet.http.*; import org.apache.commons.io.*; | [
"com.google.gson",
"java.io",
"java.security",
"java.util",
"javax.servlet",
"org.apache.commons"
] | com.google.gson; java.io; java.security; java.util; javax.servlet; org.apache.commons; | 1,537,381 |
private void uploadToGoogle(File file, String fileName) throws MalformedURLException, IOException, ServiceException {
String mimeType = DocumentListEntry.MediaType.TXT.getMimeType();
try {
mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType();
}
catch (Exception e) {
//System.out.println(" using mimeType " + mimeType);
}
DocumentEntry doc = new DocumentEntry();
doc.setTitle(new PlainTextConstruct(fileName));
doc.setFile(file, mimeType);
DocsService service = createNewDocsService();
@SuppressWarnings("unused")
DocumentListEntry entry = service.insert(new URL(GoogleDocs.GDOCS_URL), doc);
//System.out.println(" entry=" + entry.toString());
}
| void function(File file, String fileName) throws MalformedURLException, IOException, ServiceException { String mimeType = DocumentListEntry.MediaType.TXT.getMimeType(); try { mimeType = DocumentListEntry.MediaType.fromFileName(file.getName()).getMimeType(); } catch (Exception e) { } DocumentEntry doc = new DocumentEntry(); doc.setTitle(new PlainTextConstruct(fileName)); doc.setFile(file, mimeType); DocsService service = createNewDocsService(); @SuppressWarnings(STR) DocumentListEntry entry = service.insert(new URL(GoogleDocs.GDOCS_URL), doc); } | /**
* Upload a single local file to google documents as the supplied fileName.
* @param file
* @param fileName
* @throws MalformedURLException
* @throws IOException
* @throws ServiceException
*/ | Upload a single local file to google documents as the supplied fileName | uploadToGoogle | {
"repo_name": "theintencity/homefiles",
"path": "src/client/CopyCommand.java",
"license": "gpl-3.0",
"size": 14377
} | [
"com.google.gdata.client.docs.DocsService",
"com.google.gdata.data.PlainTextConstruct",
"com.google.gdata.data.docs.DocumentEntry",
"com.google.gdata.data.docs.DocumentListEntry",
"com.google.gdata.util.ServiceException",
"java.io.File",
"java.io.IOException",
"java.net.MalformedURLException",
"org.... | import com.google.gdata.client.docs.DocsService; import com.google.gdata.data.PlainTextConstruct; import com.google.gdata.data.docs.DocumentEntry; import com.google.gdata.data.docs.DocumentListEntry; import com.google.gdata.util.ServiceException; import java.io.File; import java.io.IOException; import java.net.MalformedURLException; import org.restlet.data.MediaType; | import com.google.gdata.client.docs.*; import com.google.gdata.data.*; import com.google.gdata.data.docs.*; import com.google.gdata.util.*; import java.io.*; import java.net.*; import org.restlet.data.*; | [
"com.google.gdata",
"java.io",
"java.net",
"org.restlet.data"
] | com.google.gdata; java.io; java.net; org.restlet.data; | 297,158 |
public static ChangeLevelEvent createChangeLevelEvent(Cause cause, int originalLevel, int level, Humanoid targetEntity) {
HashMap<String, Object> values = new HashMap<>();
values.put("cause", cause);
values.put("originalLevel", originalLevel);
values.put("level", level);
values.put("targetEntity", targetEntity);
return SpongeEventFactoryUtils.createEventImpl(ChangeLevelEvent.class, values);
} | static ChangeLevelEvent function(Cause cause, int originalLevel, int level, Humanoid targetEntity) { HashMap<String, Object> values = new HashMap<>(); values.put("cause", cause); values.put(STR, originalLevel); values.put("level", level); values.put(STR, targetEntity); return SpongeEventFactoryUtils.createEventImpl(ChangeLevelEvent.class, values); } | /**
* AUTOMATICALLY GENERATED, DO NOT EDIT.
* Creates a new instance of
* {@link org.spongepowered.api.event.entity.living.humanoid.ChangeLevelEvent}.
*
* @param cause The cause
* @param originalLevel The original level
* @param level The level
* @param targetEntity The target entity
* @return A new change level event
*/ | AUTOMATICALLY GENERATED, DO NOT EDIT. Creates a new instance of <code>org.spongepowered.api.event.entity.living.humanoid.ChangeLevelEvent</code> | createChangeLevelEvent | {
"repo_name": "kashike/SpongeAPI",
"path": "src/main/java/org/spongepowered/api/event/SpongeEventFactory.java",
"license": "mit",
"size": 215110
} | [
"java.util.HashMap",
"org.spongepowered.api.entity.living.Humanoid",
"org.spongepowered.api.event.cause.Cause",
"org.spongepowered.api.event.entity.living.humanoid.ChangeLevelEvent"
] | import java.util.HashMap; import org.spongepowered.api.entity.living.Humanoid; import org.spongepowered.api.event.cause.Cause; import org.spongepowered.api.event.entity.living.humanoid.ChangeLevelEvent; | import java.util.*; import org.spongepowered.api.entity.living.*; import org.spongepowered.api.event.cause.*; import org.spongepowered.api.event.entity.living.humanoid.*; | [
"java.util",
"org.spongepowered.api"
] | java.util; org.spongepowered.api; | 1,946,737 |
List<Map<String, Annotation>> currentMetadataList(); | List<Map<String, Annotation>> currentMetadataList(); | /**
* Provides access to the extra query information (for example Lucene score
* and boost values) for a single call to {@link #results()}. This method
* may only be called once for any given call to {@link #results()}.
*/ | Provides access to the extra query information (for example Lucene score and boost values) for a single call to <code>#results()</code>. This method may only be called once for any given call to <code>#results()</code> | currentMetadataList | {
"repo_name": "knabar/openmicroscopy",
"path": "components/common/src/ome/api/Search.java",
"license": "gpl-2.0",
"size": 23018
} | [
"java.util.List",
"java.util.Map"
] | import java.util.List; import java.util.Map; | import java.util.*; | [
"java.util"
] | java.util; | 1,408,645 |
public boolean canStopVirtualCluster(VirtualCluster virtualCluster) {
return entitlementEngine.canDelete("projects/" + virtualCluster.getProjectId() + "/virtual-clusters/" + virtualCluster.getId()
+ "/sessions");
} | boolean function(VirtualCluster virtualCluster) { return entitlementEngine.canDelete(STR + virtualCluster.getProjectId() + STR + virtualCluster.getId() + STR); } | /**
* Indicates if user has appropriate entitlements to stop virtual cluster
*
* @param virtualCluster
* @return
*/ | Indicates if user has appropriate entitlements to stop virtual cluster | canStopVirtualCluster | {
"repo_name": "ow2-xlcloud/vcms",
"path": "vcms-gui/modules/projects/src/main/java/org/xlcloud/console/projects/controllers/entitlements/ProjectVirtualClusterEntitlementsEngineWrapper.java",
"license": "apache-2.0",
"size": 2377
} | [
"org.xlcloud.service.VirtualCluster"
] | import org.xlcloud.service.VirtualCluster; | import org.xlcloud.service.*; | [
"org.xlcloud.service"
] | org.xlcloud.service; | 769,014 |
void delete(String subpath) throws PersistentStorageException; | void delete(String subpath) throws PersistentStorageException; | /**
* Delete a file from this ocfl object.
*
* @param subpath path of the file relative to a version of an ocfl object
* @throws PersistentStorageException if unable to delete file
*/ | Delete a file from this ocfl object | delete | {
"repo_name": "escowles/fcrepo4",
"path": "fcrepo-persistence-ocfl/src/main/java/org/fcrepo/persistence/ocfl/api/OCFLObjectSession.java",
"license": "apache-2.0",
"size": 5920
} | [
"org.fcrepo.persistence.api.exceptions.PersistentStorageException"
] | import org.fcrepo.persistence.api.exceptions.PersistentStorageException; | import org.fcrepo.persistence.api.exceptions.*; | [
"org.fcrepo.persistence"
] | org.fcrepo.persistence; | 584,193 |
@Before
public void setUp()
throws IOException {
this.referenceTable = new Table<>();
this.referenceTable.add(0, 0, "foo");
this.referenceTable.add(0, 1, "bar");
this.referenceTable.add(0, 2, "baz");
this.referenceTable.add(1, 0, "row1-column0");
this.referenceTable.add(1, 1, "row1-column1");
this.referenceTable.add(1, 2, "row1-column2");
this.referenceTable.add(2, 0, "row2-column0");
this.referenceTable.add(2, 1, "row2-column1");
this.referenceTable.add(2, 2, "row2-column2");
ClassLoader classLoader = this.getClass()
.getClassLoader();
String name = classLoader.getResource(this.filename)
.getFile();
this.testFile = new File(name);
this.tempFile = File.createTempFile("test", "csv");
} | void function() throws IOException { this.referenceTable = new Table<>(); this.referenceTable.add(0, 0, "foo"); this.referenceTable.add(0, 1, "bar"); this.referenceTable.add(0, 2, "baz"); this.referenceTable.add(1, 0, STR); this.referenceTable.add(1, 1, STR); this.referenceTable.add(1, 2, STR); this.referenceTable.add(2, 0, STR); this.referenceTable.add(2, 1, STR); this.referenceTable.add(2, 2, STR); ClassLoader classLoader = this.getClass() .getClassLoader(); String name = classLoader.getResource(this.filename) .getFile(); this.testFile = new File(name); this.tempFile = File.createTempFile("test", "csv"); } | /**
* Set up.
*
* @throws IOException
* if a temporary file for serialization could not be created.
*/ | Set up | setUp | {
"repo_name": "aftenkap/jutility",
"path": "jutility-io/src/test/java/org/jutility/io/csv/CsvSerializerTest.java",
"license": "apache-2.0",
"size": 4812
} | [
"java.io.File",
"java.io.IOException",
"org.jutility.common.datatype.table.Table"
] | import java.io.File; import java.io.IOException; import org.jutility.common.datatype.table.Table; | import java.io.*; import org.jutility.common.datatype.table.*; | [
"java.io",
"org.jutility.common"
] | java.io; org.jutility.common; | 1,997,214 |
public Dimension getPreferredSize() {
final Dimension size = super.getPreferredSize();
size.width = 0;
return size;
} | Dimension function() { final Dimension size = super.getPreferredSize(); size.width = 0; return size; } | /**
* Lets make sure that the panel doesn't stretch past the
* scrollpane view pane.
*
* @return the preferred dimension
*/ | Lets make sure that the panel doesn't stretch past the scrollpane view pane | getPreferredSize | {
"repo_name": "vipinraj/Spark",
"path": "plugins/fastpath/src/main/java/org/jivesoftware/fastpath/workspace/panes/AgentConversation.java",
"license": "apache-2.0",
"size": 5530
} | [
"java.awt.Dimension"
] | import java.awt.Dimension; | import java.awt.*; | [
"java.awt"
] | java.awt; | 782,925 |
public List<org.opennms.netmgt.xml.eventconf.Event> getOnmsEvents() {
return container.getOnmsBeans();
} | List<org.opennms.netmgt.xml.eventconf.Event> function() { return container.getOnmsBeans(); } | /**
* Gets the events.
*
* @return the events
*/ | Gets the events | getOnmsEvents | {
"repo_name": "tdefilip/opennms",
"path": "features/vaadin-snmp-events-and-metrics/src/main/java/org/opennms/features/vaadin/events/EventTable.java",
"license": "agpl-3.0",
"size": 3109
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 980,189 |
private static String toHex(byte[] array) {
BigInteger bi = new BigInteger(1, array);
String hex = bi.toString(16);
int paddingLength = (array.length * 2) - hex.length();
if (paddingLength > 0)
return String.format("%0" + paddingLength + "d", 0) + hex;
else
return hex;
} | static String function(byte[] array) { BigInteger bi = new BigInteger(1, array); String hex = bi.toString(16); int paddingLength = (array.length * 2) - hex.length(); if (paddingLength > 0) return String.format("%0" + paddingLength + "d", 0) + hex; else return hex; } | /**
* Converts a byte array into a hexadecimal string.
*
* @param array
* the byte array to convert
* @return a length*2 character string encoding the byte array
*/ | Converts a byte array into a hexadecimal string | toHex | {
"repo_name": "squaregoldfish/QuinCe",
"path": "WebApp/src/uk/ac/exeter/QuinCe/User/PasswordHash.java",
"license": "gpl-3.0",
"size": 12135
} | [
"java.math.BigInteger"
] | import java.math.BigInteger; | import java.math.*; | [
"java.math"
] | java.math; | 889,099 |
public void delete(Long id) {
Recommendation uc = em.find(Recommendation.class, id);
em.remove(uc);
} | void function(Long id) { Recommendation uc = em.find(Recommendation.class, id); em.remove(uc); } | /**
* Removes the Recommendation with the given ID from the database.
*
* @param id The unique ID of the Recommendation to delete. Must not be null.
* @throws IllegalArgumentException if {@code id} is null, or if there is no
* Recommendation with that ID in the database.
*/ | Removes the Recommendation with the given ID from the database | delete | {
"repo_name": "WISDelft/AttendeeEngager",
"path": "src/main/java/nl/wisdelft/cdf/server/RecommendationService.java",
"license": "apache-2.0",
"size": 3713
} | [
"nl.wisdelft.cdf.client.shared.Recommendation"
] | import nl.wisdelft.cdf.client.shared.Recommendation; | import nl.wisdelft.cdf.client.shared.*; | [
"nl.wisdelft.cdf"
] | nl.wisdelft.cdf; | 52,015 |
@Override
public void containerPropertySetChange(
Container.PropertySetChangeEvent event) {
if (isBeingPainted) {
return;
}
disableContentRefreshing();
super.containerPropertySetChange(event);
// sanitize visibleColumns. note that we are not adding previously
// non-existing properties as columns
Collection<?> containerPropertyIds = getContainerDataSource()
.getContainerPropertyIds();
LinkedList<Object> newVisibleColumns = new LinkedList<Object>(
visibleColumns);
for (Iterator<Object> iterator = newVisibleColumns.iterator(); iterator
.hasNext();) {
Object id = iterator.next();
if (!(containerPropertyIds.contains(id) || columnGenerators
.containsKey(id))) {
iterator.remove();
}
}
setVisibleColumns(newVisibleColumns.toArray());
// same for collapsed columns
for (Iterator<Object> iterator = collapsedColumns.iterator(); iterator
.hasNext();) {
Object id = iterator.next();
if (!(containerPropertyIds.contains(id) || columnGenerators
.containsKey(id))) {
iterator.remove();
}
}
resetPageBuffer();
enableContentRefreshing(true);
} | void function( Container.PropertySetChangeEvent event) { if (isBeingPainted) { return; } disableContentRefreshing(); super.containerPropertySetChange(event); Collection<?> containerPropertyIds = getContainerDataSource() .getContainerPropertyIds(); LinkedList<Object> newVisibleColumns = new LinkedList<Object>( visibleColumns); for (Iterator<Object> iterator = newVisibleColumns.iterator(); iterator .hasNext();) { Object id = iterator.next(); if (!(containerPropertyIds.contains(id) columnGenerators .containsKey(id))) { iterator.remove(); } } setVisibleColumns(newVisibleColumns.toArray()); for (Iterator<Object> iterator = collapsedColumns.iterator(); iterator .hasNext();) { Object id = iterator.next(); if (!(containerPropertyIds.contains(id) columnGenerators .containsKey(id))) { iterator.remove(); } } resetPageBuffer(); enableContentRefreshing(true); } | /**
* Container datasource property set change. Table must flush its buffers on
* change.
*
* @see com.vaadin.data.Container.PropertySetChangeListener#containerPropertySetChange(com.vaadin.data.Container.PropertySetChangeEvent)
*/ | Container datasource property set change. Table must flush its buffers on change | containerPropertySetChange | {
"repo_name": "carrchang/vaadin",
"path": "server/src/com/vaadin/ui/Table.java",
"license": "apache-2.0",
"size": 218051
} | [
"com.vaadin.data.Container",
"java.util.Collection",
"java.util.Iterator",
"java.util.LinkedList"
] | import com.vaadin.data.Container; import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; | import com.vaadin.data.*; import java.util.*; | [
"com.vaadin.data",
"java.util"
] | com.vaadin.data; java.util; | 2,416,453 |
public JVMClusterUtil.RegionServerThread startRegionServer() throws IOException {
final Configuration newConf = HBaseConfiguration.create(conf);
return startRegionServer(newConf);
} | JVMClusterUtil.RegionServerThread function() throws IOException { final Configuration newConf = HBaseConfiguration.create(conf); return startRegionServer(newConf); } | /**
* Starts a region server thread running
* @return New RegionServerThread
*/ | Starts a region server thread running | startRegionServer | {
"repo_name": "mahak/hbase",
"path": "hbase-server/src/test/java/org/apache/hadoop/hbase/SingleProcessHBaseCluster.java",
"license": "apache-2.0",
"size": 30762
} | [
"java.io.IOException",
"org.apache.hadoop.conf.Configuration",
"org.apache.hadoop.hbase.util.JVMClusterUtil"
] | import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.util.JVMClusterUtil; | import java.io.*; import org.apache.hadoop.conf.*; import org.apache.hadoop.hbase.util.*; | [
"java.io",
"org.apache.hadoop"
] | java.io; org.apache.hadoop; | 2,277,329 |
protected void finishBlockAndWriteHeaderAndData(DataOutputStream out)
throws IOException {
ensureBlockReady();
out.write(onDiskBytesWithHeader);
out.write(onDiskChecksum);
} | void function(DataOutputStream out) throws IOException { ensureBlockReady(); out.write(onDiskBytesWithHeader); out.write(onDiskChecksum); } | /**
* Writes the header and the compressed data of this block (or uncompressed
* data when not using compression) into the given stream. Can be called in
* the "writing" state or in the "block ready" state. If called in the
* "writing" state, transitions the writer to the "block ready" state.
*
* @param out the output stream to write the
* @throws IOException
*/ | Writes the header and the compressed data of this block (or uncompressed data when not using compression) into the given stream. Can be called in the "writing" state or in the "block ready" state. If called in the "writing" state, transitions the writer to the "block ready" state | finishBlockAndWriteHeaderAndData | {
"repo_name": "lshmouse/hbase",
"path": "hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileBlock.java",
"license": "apache-2.0",
"size": 75316
} | [
"java.io.DataOutputStream",
"java.io.IOException"
] | import java.io.DataOutputStream; import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 796,615 |
@ApiModelProperty(example = "/subscriptions?limit=1&offset=2&apiId=01234567-0123-0123-0123-012345678901&groupId=", value = "Link to the next subset of resources qualified. Empty if no more resources are to be returned. ")
public String getNext() {
return next;
} | @ApiModelProperty(example = STR, value = STR) String function() { return next; } | /**
* Link to the next subset of resources qualified. Empty if no more resources are to be returned.
* @return next
**/ | Link to the next subset of resources qualified. Empty if no more resources are to be returned | getNext | {
"repo_name": "lalaji/carbon-apimgt",
"path": "components/apimgt/org.wso2.carbon.apimgt.rest.api.publisher/src/gen/java/org/wso2/carbon/apimgt/rest/api/publisher/dto/SubscriptionListDTO.java",
"license": "apache-2.0",
"size": 4192
} | [
"io.swagger.annotations.ApiModelProperty"
] | import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.*; | [
"io.swagger.annotations"
] | io.swagger.annotations; | 571,783 |
private void initLabels(boolean schemaEnabled){
//Labels
fileLabel.setText(PluginServices.getText(this, "gpe_select_file") + ":");
formatLabel.setText(PluginServices.getText(this, "gpe_select_format") + ":");
writerLabel.setText(PluginServices.getText(this, "gpe_select_writer") + ":");
schemaLabel.setText(PluginServices.getText(this, "gpe_select_schema") + ":");
schemaCheck.setText(PluginServices.getText(this, "gpe_create_default_schema"));
//Combo colors
formatCombo.setBackground(Color.WHITE);
writerCombo.setBackground(Color.WHITE);
//Buttons
cancelButton.setText(PluginServices.getText(this, "cancel"));
exportButton.setText(PluginServices.getText(this, "export"));
//images
fileButton.setText(null);
schemaButton.setText(null);
try{
fileButton.setIcon(new ImageIcon(View.class.getClassLoader().getResource("images/open.png")));
schemaButton.setIcon(new ImageIcon(View.class.getClassLoader().getResource("images/open.png")));
}catch(NullPointerException exception){
fileButton.setText("...");
schemaButton.setText("...");
}
setSchemaEnabled(schemaEnabled);
} | void function(boolean schemaEnabled){ fileLabel.setText(PluginServices.getText(this, STR) + ":"); formatLabel.setText(PluginServices.getText(this, STR) + ":"); writerLabel.setText(PluginServices.getText(this, STR) + ":"); schemaLabel.setText(PluginServices.getText(this, STR) + ":"); schemaCheck.setText(PluginServices.getText(this, STR)); formatCombo.setBackground(Color.WHITE); writerCombo.setBackground(Color.WHITE); cancelButton.setText(PluginServices.getText(this, STR)); exportButton.setText(PluginServices.getText(this, STR)); fileButton.setText(null); schemaButton.setText(null); try{ fileButton.setIcon(new ImageIcon(View.class.getClassLoader().getResource(STR))); schemaButton.setIcon(new ImageIcon(View.class.getClassLoader().getResource(STR))); }catch(NullPointerException exception){ fileButton.setText("..."); schemaButton.setText("..."); } setSchemaEnabled(schemaEnabled); } | /**
* Initializes all the labels
*/ | Initializes all the labels | initLabels | {
"repo_name": "iCarto/siga",
"path": "extGPE-gvSIG/src/org/gvsig/gpe/gui/dialogs/SelectVersionPanel.java",
"license": "gpl-3.0",
"size": 15113
} | [
"com.iver.andami.PluginServices",
"com.iver.cit.gvsig.project.documents.view.gui.View",
"java.awt.Color",
"javax.swing.ImageIcon"
] | import com.iver.andami.PluginServices; import com.iver.cit.gvsig.project.documents.view.gui.View; import java.awt.Color; import javax.swing.ImageIcon; | import com.iver.andami.*; import com.iver.cit.gvsig.project.documents.view.gui.*; import java.awt.*; import javax.swing.*; | [
"com.iver.andami",
"com.iver.cit",
"java.awt",
"javax.swing"
] | com.iver.andami; com.iver.cit; java.awt; javax.swing; | 2,120,444 |
private boolean isMessageFromMyDevices(byte[] readData) {
int initByte = firstByteOfDeviceId(readData);
if (initByte < 0 || readData.length < initByte){
Log.e(TAG, "Error checking initByte and received length, I can't check If is from 'My devices'");
return false;
}
for (String knownDevice : knownDevices) {
int nBytes = knownDevice.length() / 2;
if (knownDevice.length() % 2 > 0 && knownDevice.length() > 2) {
nBytes++;
}
if (readData.length < (nBytes + initByte)){
Log.e(TAG, "Error checking received length, I can't check If is from 'My devices'");
return false;
}
String deviceCode = HexDump.toHexString(readData, initByte, nBytes);
if (knownDevice.toLowerCase().equals(deviceCode.toLowerCase()))
return true;
else
Log.e(TAG, "Current Known Device "+knownDevice+" Message Received From "+deviceCode);
}
Log.i(TAG, "Message received from unknown device: " + HexDump.dumpHexString(readData) + " I am expecting any of: " + TextUtils.join(", ", knownDevices));
return false;
} | boolean function(byte[] readData) { int initByte = firstByteOfDeviceId(readData); if (initByte < 0 readData.length < initByte){ Log.e(TAG, STR); return false; } for (String knownDevice : knownDevices) { int nBytes = knownDevice.length() / 2; if (knownDevice.length() % 2 > 0 && knownDevice.length() > 2) { nBytes++; } if (readData.length < (nBytes + initByte)){ Log.e(TAG, STR); return false; } String deviceCode = HexDump.toHexString(readData, initByte, nBytes); if (knownDevice.toLowerCase().equals(deviceCode.toLowerCase())) return true; else Log.e(TAG, STR+knownDevice+STR+deviceCode); } Log.i(TAG, STR + HexDump.dumpHexString(readData) + STR + TextUtils.join(STR, knownDevices)); return false; } | /**
* This method checks if the message received has its source in one of the
* devices registered.
*
* @param readData
* @return true, if I "know" the source of this message.
*/ | This method checks if the message received has its source in one of the devices registered | isMessageFromMyDevices | {
"repo_name": "dhermanns/MedtronicUploader",
"path": "app/src/main/java/com/nightscout/android/medtronic/MedtronicReader.java",
"license": "gpl-2.0",
"size": 44007
} | [
"android.text.TextUtils",
"android.util.Log",
"com.nightscout.android.dexcom.USB"
] | import android.text.TextUtils; import android.util.Log; import com.nightscout.android.dexcom.USB; | import android.text.*; import android.util.*; import com.nightscout.android.dexcom.*; | [
"android.text",
"android.util",
"com.nightscout.android"
] | android.text; android.util; com.nightscout.android; | 1,746,304 |
public IFormatContextWrapper createMedia(String url, String outputFormatName) throws LibavException {
switch (formatLib.getMajorVersion()) {
case 53: return FormatContextWrapper53.createMedia(url, outputFormatName);
case 54:
case 55: return FormatContextWrapper54.createMedia(url, outputFormatName);
}
throw new UnsatisfiedLinkError("unsupported version of the libavformat");
} | IFormatContextWrapper function(String url, String outputFormatName) throws LibavException { switch (formatLib.getMajorVersion()) { case 53: return FormatContextWrapper53.createMedia(url, outputFormatName); case 54: case 55: return FormatContextWrapper54.createMedia(url, outputFormatName); } throw new UnsatisfiedLinkError(STR); } | /**
* Create a new media stream.
*
* @param url a media URL
* @param outputFormatName a name of the output format
* @return format context wrapper
* @throws LibavException if an error occurs while creating media
*/ | Create a new media stream | createMedia | {
"repo_name": "operutka/jlibav",
"path": "jlibav/src/main/java/org/libav/avformat/FormatContextWrapperFactory.java",
"license": "lgpl-3.0",
"size": 5430
} | [
"org.libav.LibavException"
] | import org.libav.LibavException; | import org.libav.*; | [
"org.libav"
] | org.libav; | 2,577,613 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.