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 spawnVehicles(double timeStep) {
for(SpawnPoint spawnPoint : basicMap.getSpawnPoints()) {
List<SpawnSpec> spawnSpecs = spawnPoint.act(timeStep);
if (!spawnSpecs.isEmpty()) {
if (canSpawnVehicle(spawnPoint)) {
for(SpawnSpec spawnSpec : spawnSpecs) {
VehicleSimView vehicle = makeVehicle(spawnPoint, spawnSpec);
VinRegistry.registerVehicle(vehicle); // Get vehicle a VIN number
vinToVehicles.put(vehicle.getVIN(), vehicle);
break; // only handle the first spawn vehicle
// TODO: need to fix this
}
} // else ignore the spawnSpecs and do nothing
}
}
} | void function(double timeStep) { for(SpawnPoint spawnPoint : basicMap.getSpawnPoints()) { List<SpawnSpec> spawnSpecs = spawnPoint.act(timeStep); if (!spawnSpecs.isEmpty()) { if (canSpawnVehicle(spawnPoint)) { for(SpawnSpec spawnSpec : spawnSpecs) { VehicleSimView vehicle = makeVehicle(spawnPoint, spawnSpec); VinRegistry.registerVehicle(vehicle); vinToVehicles.put(vehicle.getVIN(), vehicle); break; } } } } } | /**
* Spawn vehicles.
*
* @param timeStep the time step
*/ | Spawn vehicles | spawnVehicles | {
"repo_name": "Xanders94/AIM-Simulator",
"path": "src/main/java/aim4/sim/AutoDriverOnlySimulatorOriginal.java",
"license": "gpl-3.0",
"size": 32682
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,819,954 |
@Test
public void testTriggerPartitionStateUpdate() throws Exception {
IntermediateDataSetID resultId = new IntermediateDataSetID();
ResultPartitionID partitionId = new ResultPartitionID();
BlobCache blobCache = mock(BlobCache.class);
LibraryCacheManager libCache = mock(LibraryCacheManager.class);
when(libCache.getClassLoader(any(JobID.class))).thenReturn(getClass().getClassLoader());
PartitionProducerStateChecker partitionChecker = mock(PartitionProducerStateChecker.class);
ResultPartitionConsumableNotifier consumableNotifier = mock(ResultPartitionConsumableNotifier.class);
NetworkEnvironment network = mock(NetworkEnvironment.class);
when(network.getResultPartitionManager()).thenReturn(mock(ResultPartitionManager.class));
when(network.getDefaultIOMode()).thenReturn(IOManager.IOMode.SYNC);
when(network.createKvStateTaskRegistry(any(JobID.class), any(JobVertexID.class)))
.thenReturn(mock(TaskKvStateRegistry.class));
createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor());
// Test all branches of trigger partition state check
{
// Reset latches
createQueuesAndActors();
// PartitionProducerDisposedException
Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor());
CompletableFuture<ExecutionState> promise = new CompletableFuture<>();
when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise);
task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId);
promise.completeExceptionally(new PartitionProducerDisposedException(partitionId));
assertEquals(ExecutionState.CANCELING, task.getExecutionState());
}
{
// Reset latches
createQueuesAndActors();
// Any other exception
Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor());
CompletableFuture<ExecutionState> promise = new CompletableFuture<>();
when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise);
task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId);
promise.completeExceptionally(new RuntimeException("Any other exception"));
assertEquals(ExecutionState.FAILED, task.getExecutionState());
}
{
// Reset latches
createQueuesAndActors();
// TimeoutException handled special => retry
Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor());
SingleInputGate inputGate = mock(SingleInputGate.class);
when(inputGate.getConsumedResultId()).thenReturn(resultId);
try {
task.startTaskThread();
awaitLatch.await();
setInputGate(task, inputGate);
CompletableFuture<ExecutionState> promise = new CompletableFuture<>();
when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise);
task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId);
promise.completeExceptionally(new TimeoutException());
assertEquals(ExecutionState.RUNNING, task.getExecutionState());
verify(inputGate, times(1)).retriggerPartitionRequest(eq(partitionId.getPartitionId()));
} finally {
task.getExecutingThread().interrupt();
task.getExecutingThread().join();
}
}
{
// Reset latches
createQueuesAndActors();
// Success
Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor());
SingleInputGate inputGate = mock(SingleInputGate.class);
when(inputGate.getConsumedResultId()).thenReturn(resultId);
try {
task.startTaskThread();
awaitLatch.await();
setInputGate(task, inputGate);
CompletableFuture<ExecutionState> promise = new CompletableFuture<>();
when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise);
task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId);
promise.complete(ExecutionState.RUNNING);
assertEquals(ExecutionState.RUNNING, task.getExecutionState());
verify(inputGate, times(1)).retriggerPartitionRequest(eq(partitionId.getPartitionId()));
} finally {
task.getExecutingThread().interrupt();
task.getExecutingThread().join();
}
}
} | void function() throws Exception { IntermediateDataSetID resultId = new IntermediateDataSetID(); ResultPartitionID partitionId = new ResultPartitionID(); BlobCache blobCache = mock(BlobCache.class); LibraryCacheManager libCache = mock(LibraryCacheManager.class); when(libCache.getClassLoader(any(JobID.class))).thenReturn(getClass().getClassLoader()); PartitionProducerStateChecker partitionChecker = mock(PartitionProducerStateChecker.class); ResultPartitionConsumableNotifier consumableNotifier = mock(ResultPartitionConsumableNotifier.class); NetworkEnvironment network = mock(NetworkEnvironment.class); when(network.getResultPartitionManager()).thenReturn(mock(ResultPartitionManager.class)); when(network.getDefaultIOMode()).thenReturn(IOManager.IOMode.SYNC); when(network.createKvStateTaskRegistry(any(JobID.class), any(JobVertexID.class))) .thenReturn(mock(TaskKvStateRegistry.class)); createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor()); { createQueuesAndActors(); Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor()); CompletableFuture<ExecutionState> promise = new CompletableFuture<>(); when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise); task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId); promise.completeExceptionally(new PartitionProducerDisposedException(partitionId)); assertEquals(ExecutionState.CANCELING, task.getExecutionState()); } { createQueuesAndActors(); Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor()); CompletableFuture<ExecutionState> promise = new CompletableFuture<>(); when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise); task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId); promise.completeExceptionally(new RuntimeException(STR)); assertEquals(ExecutionState.FAILED, task.getExecutionState()); } { createQueuesAndActors(); Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor()); SingleInputGate inputGate = mock(SingleInputGate.class); when(inputGate.getConsumedResultId()).thenReturn(resultId); try { task.startTaskThread(); awaitLatch.await(); setInputGate(task, inputGate); CompletableFuture<ExecutionState> promise = new CompletableFuture<>(); when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise); task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId); promise.completeExceptionally(new TimeoutException()); assertEquals(ExecutionState.RUNNING, task.getExecutionState()); verify(inputGate, times(1)).retriggerPartitionRequest(eq(partitionId.getPartitionId())); } finally { task.getExecutingThread().interrupt(); task.getExecutingThread().join(); } } { createQueuesAndActors(); Task task = createTask(InvokableBlockingInInvoke.class, blobCache, libCache, network, consumableNotifier, partitionChecker, Executors.directExecutor()); SingleInputGate inputGate = mock(SingleInputGate.class); when(inputGate.getConsumedResultId()).thenReturn(resultId); try { task.startTaskThread(); awaitLatch.await(); setInputGate(task, inputGate); CompletableFuture<ExecutionState> promise = new CompletableFuture<>(); when(partitionChecker.requestPartitionProducerState(eq(task.getJobID()), eq(resultId), eq(partitionId))).thenReturn(promise); task.triggerPartitionProducerStateCheck(task.getJobID(), resultId, partitionId); promise.complete(ExecutionState.RUNNING); assertEquals(ExecutionState.RUNNING, task.getExecutionState()); verify(inputGate, times(1)).retriggerPartitionRequest(eq(partitionId.getPartitionId())); } finally { task.getExecutingThread().interrupt(); task.getExecutingThread().join(); } } } | /**
* Tests the trigger partition state update future completions.
*/ | Tests the trigger partition state update future completions | testTriggerPartitionStateUpdate | {
"repo_name": "zohar-mizrahi/flink",
"path": "flink-runtime/src/test/java/org/apache/flink/runtime/taskmanager/TaskTest.java",
"license": "apache-2.0",
"size": 43225
} | [
"java.util.concurrent.CompletableFuture",
"java.util.concurrent.TimeoutException",
"org.apache.flink.api.common.JobID",
"org.apache.flink.runtime.blob.BlobCache",
"org.apache.flink.runtime.concurrent.Executors",
"org.apache.flink.runtime.execution.ExecutionState",
"org.apache.flink.runtime.execution.lib... | import java.util.concurrent.CompletableFuture; import java.util.concurrent.TimeoutException; import org.apache.flink.api.common.JobID; import org.apache.flink.runtime.blob.BlobCache; import org.apache.flink.runtime.concurrent.Executors; import org.apache.flink.runtime.execution.ExecutionState; import org.apache.flink.runtime.execution.librarycache.LibraryCacheManager; import org.apache.flink.runtime.io.disk.iomanager.IOManager; import org.apache.flink.runtime.io.network.NetworkEnvironment; import org.apache.flink.runtime.io.network.netty.PartitionProducerStateChecker; import org.apache.flink.runtime.io.network.partition.ResultPartitionConsumableNotifier; import org.apache.flink.runtime.io.network.partition.ResultPartitionID; import org.apache.flink.runtime.io.network.partition.ResultPartitionManager; import org.apache.flink.runtime.io.network.partition.consumer.SingleInputGate; import org.apache.flink.runtime.jobgraph.IntermediateDataSetID; import org.apache.flink.runtime.jobgraph.JobVertexID; import org.apache.flink.runtime.jobmanager.PartitionProducerDisposedException; import org.apache.flink.runtime.query.TaskKvStateRegistry; import org.junit.Assert; import org.mockito.Matchers; import org.mockito.Mockito; | import java.util.concurrent.*; import org.apache.flink.api.common.*; import org.apache.flink.runtime.blob.*; import org.apache.flink.runtime.concurrent.*; import org.apache.flink.runtime.execution.*; import org.apache.flink.runtime.execution.librarycache.*; import org.apache.flink.runtime.io.disk.iomanager.*; import org.apache.flink.runtime.io.network.*; import org.apache.flink.runtime.io.network.netty.*; import org.apache.flink.runtime.io.network.partition.*; import org.apache.flink.runtime.io.network.partition.consumer.*; import org.apache.flink.runtime.jobgraph.*; import org.apache.flink.runtime.jobmanager.*; import org.apache.flink.runtime.query.*; import org.junit.*; import org.mockito.*; | [
"java.util",
"org.apache.flink",
"org.junit",
"org.mockito"
] | java.util; org.apache.flink; org.junit; org.mockito; | 711,720 |
public List<String> indices() {
return indices;
} | List<String> function() { return indices; } | /**
* Returns indices that were included in this snapshot.
*
* @return list of indices
*/ | Returns indices that were included in this snapshot | indices | {
"repo_name": "GlenRSmith/elasticsearch",
"path": "server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java",
"license": "apache-2.0",
"size": 42703
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,913,547 |
protected String resolveClassName(SerializedType serializedType) {
return serializedType.getName();
} | String function(SerializedType serializedType) { return serializedType.getName(); } | /**
* Resolve the class name from the given <code>serializedType</code>. This method may be overridden to customize
* the names used to denote certain classes, for example, by leaving out a certain base package for brevity.
*
* @param serializedType The serialized type to resolve the class name for
* @return The fully qualified name of the class to load
*/ | Resolve the class name from the given <code>serializedType</code>. This method may be overridden to customize the names used to denote certain classes, for example, by leaving out a certain base package for brevity | resolveClassName | {
"repo_name": "oiavorskyi/AxonFramework",
"path": "core/src/main/java/org/axonframework/serializer/json/JacksonSerializer.java",
"license": "apache-2.0",
"size": 13181
} | [
"org.axonframework.serializer.SerializedType"
] | import org.axonframework.serializer.SerializedType; | import org.axonframework.serializer.*; | [
"org.axonframework.serializer"
] | org.axonframework.serializer; | 2,283,947 |
protected Table<String, Attribute<String>, List<Attribute<String>>> cloneTable(
@NotNull final Table<String, Attribute<String>, List<Attribute<String>>> table)
{
@NotNull final Table<String, Attribute<String>, List<Attribute<String>>> result;
if (table instanceof TableValueObject)
{
result = table;
}
else
{
Table<String, Attribute<String>, List<Attribute<String>>> t_Table =
table.getParentTable();
if (t_Table != null)
{
t_Table = cloneTable(t_Table);
}
result =
new TableValueObject(
table.getName(),
table.getComment(),
cloneAttributes(table.getPrimaryKey()),
cloneAttributes(table.getAttributes()),
cloneForeignKeys(table.getForeignKeys()),
t_Table,
table.getStaticAttribute(),
table.isVoDecorated(),
table.isRelationship());
}
return result;
} | Table<String, Attribute<String>, List<Attribute<String>>> function( @NotNull final Table<String, Attribute<String>, List<Attribute<String>>> table) { @NotNull final Table<String, Attribute<String>, List<Attribute<String>>> result; if (table instanceof TableValueObject) { result = table; } else { Table<String, Attribute<String>, List<Attribute<String>>> t_Table = table.getParentTable(); if (t_Table != null) { t_Table = cloneTable(t_Table); } result = new TableValueObject( table.getName(), table.getComment(), cloneAttributes(table.getPrimaryKey()), cloneAttributes(table.getAttributes()), cloneForeignKeys(table.getForeignKeys()), t_Table, table.getStaticAttribute(), table.isVoDecorated(), table.isRelationship()); } return result; } | /**
* Clones given incomplete tables.
* @param table the table to clone.
* @return the ultimate table list.
*/ | Clones given incomplete tables | cloneTable | {
"repo_name": "rydnr/queryj-rt",
"path": "queryj-core/src/main/java/org/acmsl/queryj/metadata/engines/AbstractJdbcMetadataManager.java",
"license": "gpl-2.0",
"size": 57292
} | [
"java.util.List",
"org.acmsl.queryj.metadata.vo.Attribute",
"org.acmsl.queryj.metadata.vo.Table",
"org.acmsl.queryj.metadata.vo.TableValueObject",
"org.jetbrains.annotations.NotNull"
] | import java.util.List; import org.acmsl.queryj.metadata.vo.Attribute; import org.acmsl.queryj.metadata.vo.Table; import org.acmsl.queryj.metadata.vo.TableValueObject; import org.jetbrains.annotations.NotNull; | import java.util.*; import org.acmsl.queryj.metadata.vo.*; import org.jetbrains.annotations.*; | [
"java.util",
"org.acmsl.queryj",
"org.jetbrains.annotations"
] | java.util; org.acmsl.queryj; org.jetbrains.annotations; | 2,239,420 |
public void removeField(CtField<?> field) throws Exception {
ElementPanel<?> selectedElement = getSelectedElement();
selectedElement.getCtElement().removeField(field);
File classFile = field.getParent().getPosition().getFile();
classFile.delete();
spoon.run();
notifySelectionChanged(selectedElement);
} | void function(CtField<?> field) throws Exception { ElementPanel<?> selectedElement = getSelectedElement(); selectedElement.getCtElement().removeField(field); File classFile = field.getParent().getPosition().getFile(); classFile.delete(); spoon.run(); notifySelectionChanged(selectedElement); } | /**
* Remove a field from the AST, and notify the view part
*
* @param field
* the field to remove
* @throws Exception
* spoon.run() exceptions
*/ | Remove a field from the AST, and notify the view part | removeField | {
"repo_name": "JonathanGeoffroy/RoundTripModeler",
"path": "src/main/java/opl/modeler/UmlModeler.java",
"license": "gpl-2.0",
"size": 7932
} | [
"java.io.File"
] | import java.io.File; | import java.io.*; | [
"java.io"
] | java.io; | 2,538,655 |
@PUT
@Path("setting/restart/{settingId}")
public Response restartSetting(String message, @PathParam("settingId") String settingId) {
logger.info("Restart interpreterSetting {}, msg={}", settingId, message);
InterpreterSetting setting = interpreterSettingManager.get(settingId);
try {
RestartInterpreterRequest request = RestartInterpreterRequest.fromJson(message);
String noteId = request == null ? null : request.getNoteId();
if (null == noteId) {
interpreterSettingManager.close(setting);
} else {
interpreterSettingManager.restart(settingId, noteId, SecurityUtils.getPrincipal());
}
cleanUserCertificates(project);
zeppelinConf.getNotebookServer().clearParagraphRuntimeInfo(setting);
} catch (InterpreterException e) {
logger.error("Exception in InterpreterRestApi while restartSetting ", e);
return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e)).build();
}
if (setting == null) {
return new JsonResponse<>(Status.NOT_FOUND, "", settingId).build();
}
int timeout = zeppelinConf.getConf().getInt(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETER_CONNECT_TIMEOUT);
long startTime = System.currentTimeMillis();
long endTime;
while (zeppelinResource.isInterpreterRunning(setting, project)) {
endTime = System.currentTimeMillis();
if ((endTime - startTime) > (timeout * 2)) {
break;
}
}
if (zeppelinResource.isInterpreterRunning(setting, project)) {
zeppelinResource.forceKillInterpreter(setting, project);
}
InterpreterDTO interpreter = new InterpreterDTO(setting, !zeppelinResource.isInterpreterRunning(setting, project));
return new JsonResponse(Status.OK, "", interpreter).build();
} | @Path(STR) Response function(String message, @PathParam(STR) String settingId) { logger.info(STR, settingId, message); InterpreterSetting setting = interpreterSettingManager.get(settingId); try { RestartInterpreterRequest request = RestartInterpreterRequest.fromJson(message); String noteId = request == null ? null : request.getNoteId(); if (null == noteId) { interpreterSettingManager.close(setting); } else { interpreterSettingManager.restart(settingId, noteId, SecurityUtils.getPrincipal()); } cleanUserCertificates(project); zeppelinConf.getNotebookServer().clearParagraphRuntimeInfo(setting); } catch (InterpreterException e) { logger.error(STR, e); return new JsonResponse<>(Status.NOT_FOUND, e.getMessage(), ExceptionUtils.getStackTrace(e)).build(); } if (setting == null) { return new JsonResponse<>(Status.NOT_FOUND, STR", interpreter).build(); } | /**
* Restart interpreter setting
*/ | Restart interpreter setting | restartSetting | {
"repo_name": "FilotasSiskos/hopsworks",
"path": "hopsworks-api/src/main/java/io/hops/hopsworks/api/zeppelin/rest/InterpreterRestApi.java",
"license": "agpl-3.0",
"size": 22244
} | [
"io.hops.hopsworks.api.zeppelin.rest.message.RestartInterpreterRequest",
"io.hops.hopsworks.api.zeppelin.server.JsonResponse",
"io.hops.hopsworks.api.zeppelin.util.SecurityUtils",
"javax.ws.rs.Path",
"javax.ws.rs.PathParam",
"javax.ws.rs.core.Response",
"org.apache.commons.lang.exception.ExceptionUtils"... | import io.hops.hopsworks.api.zeppelin.rest.message.RestartInterpreterRequest; import io.hops.hopsworks.api.zeppelin.server.JsonResponse; import io.hops.hopsworks.api.zeppelin.util.SecurityUtils; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.core.Response; import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.zeppelin.interpreter.InterpreterException; import org.apache.zeppelin.interpreter.InterpreterSetting; | import io.hops.hopsworks.api.zeppelin.rest.message.*; import io.hops.hopsworks.api.zeppelin.server.*; import io.hops.hopsworks.api.zeppelin.util.*; import javax.ws.rs.*; import javax.ws.rs.core.*; import org.apache.commons.lang.exception.*; import org.apache.zeppelin.interpreter.*; | [
"io.hops.hopsworks",
"javax.ws",
"org.apache.commons",
"org.apache.zeppelin"
] | io.hops.hopsworks; javax.ws; org.apache.commons; org.apache.zeppelin; | 2,494,077 |
private List doReturn(int minSize, int maxSize) {
acquireReadLock();
try {
int numToReturn = this.idsAvailable.size();
if (numToReturn < minSize) {
return null;
}
if (numToReturn > maxSize) {
numToReturn = maxSize;
}
return getBatchAndUpdateThreadContext(numToReturn);
} finally {
releaseReadLock();
}
} | List function(int minSize, int maxSize) { acquireReadLock(); try { int numToReturn = this.idsAvailable.size(); if (numToReturn < minSize) { return null; } if (numToReturn > maxSize) { numToReturn = maxSize; } return getBatchAndUpdateThreadContext(numToReturn); } finally { releaseReadLock(); } } | /**
* Return a batch of minimum specified size
*
* @param minSize minimum number to return
* @return null if minimum was not present
*/ | Return a batch of minimum specified size | doReturn | {
"repo_name": "smanvi-pivotal/geode",
"path": "geode-core/src/main/java/org/apache/geode/internal/cache/ha/HARegionQueue.java",
"license": "apache-2.0",
"size": 142403
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 12,499 |
public boolean removeAttribute(QName qname); | boolean function(QName qname); | /**
* Removes the attribute with the specified qname.
*
* @param qname the <code>QName</code> object with the qname of the
* attribute to be removed
* @return <code>true</code> if the attribute was
* removed successfully; <code>false</code> if it was not
* @see SOAPElement#removeAttribute(Name)
* @since SAAJ 1.3
*/ | Removes the attribute with the specified qname | removeAttribute | {
"repo_name": "haikuowuya/android_system_code",
"path": "src/javax/xml/soap/SOAPElement.java",
"license": "apache-2.0",
"size": 21983
} | [
"javax.xml.namespace.QName"
] | import javax.xml.namespace.QName; | import javax.xml.namespace.*; | [
"javax.xml"
] | javax.xml; | 1,289,016 |
@Override
public void setGlyphPosition(int glyphIndex, Point2D newPos) {
if ((glyphIndex > vector.length) || (glyphIndex < 0)) {
// awt.43=glyphIndex is out of vector's limits
throw new IndexOutOfBoundsException(Messages.getString("awt.43")); //$NON-NLS-1$
}
float x = (float)newPos.getX();
float y = (float)newPos.getY();
int index = glyphIndex << 1;
if ((x != visualPositions[index]) || (y != visualPositions[index + 1])){
visualPositions[index] = x;
visualPositions[index+1] = y;
layoutFlags = layoutFlags | FLAG_HAS_POSITION_ADJUSTMENTS;
}
}
| void function(int glyphIndex, Point2D newPos) { if ((glyphIndex > vector.length) (glyphIndex < 0)) { throw new IndexOutOfBoundsException(Messages.getString(STR)); } float x = (float)newPos.getX(); float y = (float)newPos.getY(); int index = glyphIndex << 1; if ((x != visualPositions[index]) (y != visualPositions[index + 1])){ visualPositions[index] = x; visualPositions[index+1] = y; layoutFlags = layoutFlags FLAG_HAS_POSITION_ADJUSTMENTS; } } | /**
* Sets new position to the specified glyph.
*/ | Sets new position to the specified glyph | setGlyphPosition | {
"repo_name": "shannah/cn1",
"path": "Ports/iOSPort/xmlvm/apache-harmony-6.0-src-r991881/classlib/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/font/CommonGlyphVector.java",
"license": "gpl-2.0",
"size": 32407
} | [
"java.awt.geom.Point2D",
"org.apache.harmony.awt.internal.nls.Messages"
] | import java.awt.geom.Point2D; import org.apache.harmony.awt.internal.nls.Messages; | import java.awt.geom.*; import org.apache.harmony.awt.internal.nls.*; | [
"java.awt",
"org.apache.harmony"
] | java.awt; org.apache.harmony; | 989,126 |
private static int[] trustedStripLeadingZeroInts(int val[]) {
int vlen = val.length;
int keep;
// Find first nonzero byte
for (keep = 0; keep < vlen && val[keep] == 0; keep++)
;
return keep == 0 ? val : java.util.Arrays.copyOfRange(val, keep, vlen);
} | static int[] function(int val[]) { int vlen = val.length; int keep; for (keep = 0; keep < vlen && val[keep] == 0; keep++) ; return keep == 0 ? val : java.util.Arrays.copyOfRange(val, keep, vlen); } | /**
* Returns the input array stripped of any leading zero bytes.
* Since the source is trusted the copying may be skipped.
*/ | Returns the input array stripped of any leading zero bytes. Since the source is trusted the copying may be skipped | trustedStripLeadingZeroInts | {
"repo_name": "FauxFaux/jdk9-jdk",
"path": "src/java.base/share/classes/java/math/BigInteger.java",
"license": "gpl-2.0",
"size": 176132
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,222,815 |
protected void applyCaptions() {
Util.applyCaptions(getI18nService(), modelAccess.getLabel(),
modelAccess.getLabelI18nKey(), getLocale(), list);
} | void function() { Util.applyCaptions(getI18nService(), modelAccess.getLabel(), modelAccess.getLabelI18nKey(), getLocale(), list); } | /**
* Applies the labels to the widgets.
*/ | Applies the labels to the widgets | applyCaptions | {
"repo_name": "lunifera/lunifera-runtime-web",
"path": "org.lunifera.runtime.web.ecview.presentation.vaadin/src/org/lunifera/runtime/web/ecview/presentation/vaadin/internal/ListPresentation.java",
"license": "epl-1.0",
"size": 12416
} | [
"org.lunifera.runtime.web.ecview.presentation.vaadin.internal.util.Util"
] | import org.lunifera.runtime.web.ecview.presentation.vaadin.internal.util.Util; | import org.lunifera.runtime.web.ecview.presentation.vaadin.internal.util.*; | [
"org.lunifera.runtime"
] | org.lunifera.runtime; | 851,867 |
public void addApplicationEventListener(Object listener) {
int len = applicationEventListenersObjects.length;
Object[] newListeners = Arrays.copyOf(applicationEventListenersObjects,
len + 1);
newListeners[len] = listener;
applicationEventListenersObjects = newListeners;
}
| void function(Object listener) { int len = applicationEventListenersObjects.length; Object[] newListeners = Arrays.copyOf(applicationEventListenersObjects, len + 1); newListeners[len] = listener; applicationEventListenersObjects = newListeners; } | /**
* Add a listener to the end of the list of initialized application event
* listeners.
*/ | Add a listener to the end of the list of initialized application event listeners | addApplicationEventListener | {
"repo_name": "pistolove/sourcecode4junit",
"path": "Source4Tomcat/src/org/apache/catalina/core/StandardContext.java",
"license": "apache-2.0",
"size": 202235
} | [
"java.util.Arrays"
] | import java.util.Arrays; | import java.util.*; | [
"java.util"
] | java.util; | 1,872,320 |
public static String getHardWord() throws IOException {
return getRandomWord( R.raw.hard, R.raw.hardh );
} | static String function() throws IOException { return getRandomWord( R.raw.hard, R.raw.hardh ); } | /**
* Get a random hard word.
*
* @return A random hard word
* @throws IOException if fail to read word files
*/ | Get a random hard word | getHardWord | {
"repo_name": "footballhead/hangman-bbw",
"path": "app/src/main/java/com/michaelhitchens/hackathon/hangman/WordRetriever.java",
"license": "mit",
"size": 3746
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 94,164 |
private void processConcepts(OWLClass changeTypeClass,
Set<? extends OWLObject> set, OWLOntologyManager man,
OWLOntology ont) {
// TODO: Check spec if we want to capture anonymous entities too
OWLDataFactory factory = man.getOWLDataFactory();
String date = getDateTime();
for (OWLObject o : set) {
// only take into account named objects with an IRI
// TODO handle anonymous entities
if (o instanceof OWLNamedObject) {
OWLNamedObject c = (OWLNamedObject)o;
log.debug("adding to changeLog:" + c.getIRI());
OWLIndividual in = factory.getOWLNamedIndividual(IRI
.create(changeLogURI + "change" + chgCounter));
// Create pure Change Class
OWLAxiom axiom = factory.getOWLClassAssertionAxiom(
changeTypeClass, in);
changes.add(new AddAxiom(ont, axiom));
// Create connection to changed Entity ("hasRelatedEntity");
OWLObjectProperty hasRE = OMVChangeFactory
.getOWLObjectProperty(IRI.create(OMVChangesURI
+ "hasRelatedEntity"));
OWLIndividual cIndivid = factory.getOWLNamedIndividual(c
.getIRI());
OWLObjectPropertyAssertionAxiom hasREAssertion = factory
.getOWLObjectPropertyAssertionAxiom(hasRE, in, cIndivid);
changes.add(new AddAxiom(ont, hasREAssertion));
// set timestamp DataProperty ("date")
OWLDataProperty dateDP = OMVChangeFactory
.getOWLDataProperty(IRI.create(OMVChangesURI + "date"));
OWLLiteral dateLiteral = factory.getOWLTypedLiteral(date,
OWL2Datatype.XSD_DATE_TIME);
OWLDataPropertyAssertionAxiom dateAssertion = factory
.getOWLDataPropertyAssertionAxiom(dateDP, in,
dateLiteral);
changes.add(new AddAxiom(ont, dateAssertion));
// create author Property if available
if (ci.getAuthor() != null) {
// not implemented yet
}
chgCounter++;
}
}
} | void function(OWLClass changeTypeClass, Set<? extends OWLObject> set, OWLOntologyManager man, OWLOntology ont) { OWLDataFactory factory = man.getOWLDataFactory(); String date = getDateTime(); for (OWLObject o : set) { if (o instanceof OWLNamedObject) { OWLNamedObject c = (OWLNamedObject)o; log.debug(STR + c.getIRI()); OWLIndividual in = factory.getOWLNamedIndividual(IRI .create(changeLogURI + STR + chgCounter)); OWLAxiom axiom = factory.getOWLClassAssertionAxiom( changeTypeClass, in); changes.add(new AddAxiom(ont, axiom)); OWLObjectProperty hasRE = OMVChangeFactory .getOWLObjectProperty(IRI.create(OMVChangesURI + STR)); OWLIndividual cIndivid = factory.getOWLNamedIndividual(c .getIRI()); OWLObjectPropertyAssertionAxiom hasREAssertion = factory .getOWLObjectPropertyAssertionAxiom(hasRE, in, cIndivid); changes.add(new AddAxiom(ont, hasREAssertion)); OWLDataProperty dateDP = OMVChangeFactory .getOWLDataProperty(IRI.create(OMVChangesURI + "date")); OWLLiteral dateLiteral = factory.getOWLTypedLiteral(date, OWL2Datatype.XSD_DATE_TIME); OWLDataPropertyAssertionAxiom dateAssertion = factory .getOWLDataPropertyAssertionAxiom(dateDP, in, dateLiteral); changes.add(new AddAxiom(ont, dateAssertion)); if (ci.getAuthor() != null) { } chgCounter++; } } } | /**
* Creates OMVChanges Individuals for a specific Change Type Class
*
* @param changeTypeClass The Class the individuals belongs to
* @param set Set of Entities to process
* @param man OWLManager for the ChangeLog
* @param ont OWLOntology for the ChangeLog
*/ | Creates OMVChanges Individuals for a specific Change Type Class | processConcepts | {
"repo_name": "ag-csw/SVoNt",
"path": "SVoNt/src/de/fuberlin/agcsw/svont/changelog/OWLAPIChangeLogWriter.java",
"license": "lgpl-3.0",
"size": 12026
} | [
"java.util.Set",
"org.semanticweb.owlapi.model.AddAxiom",
"org.semanticweb.owlapi.model.IRI",
"org.semanticweb.owlapi.model.OWLAxiom",
"org.semanticweb.owlapi.model.OWLClass",
"org.semanticweb.owlapi.model.OWLDataFactory",
"org.semanticweb.owlapi.model.OWLDataProperty",
"org.semanticweb.owlapi.model.O... | import java.util.Set; import org.semanticweb.owlapi.model.AddAxiom; import org.semanticweb.owlapi.model.IRI; import org.semanticweb.owlapi.model.OWLAxiom; import org.semanticweb.owlapi.model.OWLClass; import org.semanticweb.owlapi.model.OWLDataFactory; import org.semanticweb.owlapi.model.OWLDataProperty; import org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom; import org.semanticweb.owlapi.model.OWLIndividual; import org.semanticweb.owlapi.model.OWLLiteral; import org.semanticweb.owlapi.model.OWLNamedObject; import org.semanticweb.owlapi.model.OWLObject; import org.semanticweb.owlapi.model.OWLObjectProperty; import org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom; import org.semanticweb.owlapi.model.OWLOntology; import org.semanticweb.owlapi.model.OWLOntologyManager; import org.semanticweb.owlapi.vocab.OWL2Datatype; | import java.util.*; import org.semanticweb.owlapi.model.*; import org.semanticweb.owlapi.vocab.*; | [
"java.util",
"org.semanticweb.owlapi"
] | java.util; org.semanticweb.owlapi; | 2,185,062 |
private Object isPooled(Map<QName, Serializable> properties) {
Collection<?> actors = (Collection<?>) properties.get(WorkflowModel.ASSOC_POOLED_ACTORS);
return (actors != null) && !actors.isEmpty();
} | Object function(Map<QName, Serializable> properties) { Collection<?> actors = (Collection<?>) properties.get(WorkflowModel.ASSOC_POOLED_ACTORS); return (actors != null) && !actors.isEmpty(); } | /**
* Checks if is pooled.
*
* @param properties
* the properties
* @return the object
*/ | Checks if is pooled | isPooled | {
"repo_name": "SirmaITT/conservation-space-1.7.0",
"path": "docker/sep-alfresco/alfresco-emf-integration/alfresco-integration-impl/src/main/java/org/alfresco/repo/web/scripts/workflow/WorkflowModelBuilder.java",
"license": "lgpl-3.0",
"size": 35307
} | [
"java.io.Serializable",
"java.util.Collection",
"java.util.Map",
"org.alfresco.repo.workflow.WorkflowModel",
"org.alfresco.service.namespace.QName"
] | import java.io.Serializable; import java.util.Collection; import java.util.Map; import org.alfresco.repo.workflow.WorkflowModel; import org.alfresco.service.namespace.QName; | import java.io.*; import java.util.*; import org.alfresco.repo.workflow.*; import org.alfresco.service.namespace.*; | [
"java.io",
"java.util",
"org.alfresco.repo",
"org.alfresco.service"
] | java.io; java.util; org.alfresco.repo; org.alfresco.service; | 166,225 |
String outputDirectory = Utils.getOutputDirectoryPath("RenderToResponsiveHtml");
String pageFilePathFormat = new File(outputDirectory, "page_{0}.html").getPath();
HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat);
viewOptions.setRenderResponsive(true);
try (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX)) {
viewer.view(viewOptions);
}
System.out.println(
"\nSource document rendered successfully.\nCheck output in " + outputDirectory);
} | String outputDirectory = Utils.getOutputDirectoryPath(STR); String pageFilePathFormat = new File(outputDirectory, STR).getPath(); HtmlViewOptions viewOptions = HtmlViewOptions.forEmbeddedResources(pageFilePathFormat); viewOptions.setRenderResponsive(true); try (Viewer viewer = new Viewer(TestFiles.SAMPLE_DOCX)) { viewer.view(viewOptions); } System.out.println( STR + outputDirectory); } | /**
* This example demonstrates how to render document into responsive HTML.
*/ | This example demonstrates how to render document into responsive HTML | run | {
"repo_name": "groupdocs-viewer/GroupDocs.Viewer-for-Java",
"path": "Examples/src/main/java/com/groupdocs/viewer/examples/basic_usage/render_document_to_html/RenderToResponsiveHtml.java",
"license": "mit",
"size": 1016
} | [
"com.groupdocs.viewer.Viewer",
"com.groupdocs.viewer.examples.TestFiles",
"com.groupdocs.viewer.examples.Utils",
"com.groupdocs.viewer.options.HtmlViewOptions",
"java.io.File"
] | import com.groupdocs.viewer.Viewer; import com.groupdocs.viewer.examples.TestFiles; import com.groupdocs.viewer.examples.Utils; import com.groupdocs.viewer.options.HtmlViewOptions; import java.io.File; | import com.groupdocs.viewer.*; import com.groupdocs.viewer.examples.*; import com.groupdocs.viewer.options.*; import java.io.*; | [
"com.groupdocs.viewer",
"java.io"
] | com.groupdocs.viewer; java.io; | 2,777,885 |
protected void onCrafting(ItemStack par1ItemStack)
{
par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted);
this.amountCrafted = 0;
if (par1ItemStack.itemID == Block.workbench.blockID)
{
this.thePlayer.addStat(AchievementList.buildWorkBench, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildPickaxe, 1);
}
else if (par1ItemStack.itemID == Block.furnaceIdle.blockID)
{
this.thePlayer.addStat(AchievementList.buildFurnace, 1);
}
else if (par1ItemStack.itemID == Item.hoeWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildHoe, 1);
}
else if (par1ItemStack.itemID == Item.bread.itemID)
{
this.thePlayer.addStat(AchievementList.makeBread, 1);
}
else if (par1ItemStack.itemID == Item.cake.itemID)
{
this.thePlayer.addStat(AchievementList.bakeCake, 1);
}
else if (par1ItemStack.itemID == Item.pickaxeStone.itemID)
{
this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1);
}
else if (par1ItemStack.itemID == Item.swordWood.itemID)
{
this.thePlayer.addStat(AchievementList.buildSword, 1);
}
else if (par1ItemStack.itemID == Block.enchantmentTable.blockID)
{
this.thePlayer.addStat(AchievementList.enchantments, 1);
}
else if (par1ItemStack.itemID == Block.bookShelf.blockID)
{
this.thePlayer.addStat(AchievementList.bookcase, 1);
}
} | void function(ItemStack par1ItemStack) { par1ItemStack.onCrafting(this.thePlayer.worldObj, this.thePlayer, this.amountCrafted); this.amountCrafted = 0; if (par1ItemStack.itemID == Block.workbench.blockID) { this.thePlayer.addStat(AchievementList.buildWorkBench, 1); } else if (par1ItemStack.itemID == Item.pickaxeWood.itemID) { this.thePlayer.addStat(AchievementList.buildPickaxe, 1); } else if (par1ItemStack.itemID == Block.furnaceIdle.blockID) { this.thePlayer.addStat(AchievementList.buildFurnace, 1); } else if (par1ItemStack.itemID == Item.hoeWood.itemID) { this.thePlayer.addStat(AchievementList.buildHoe, 1); } else if (par1ItemStack.itemID == Item.bread.itemID) { this.thePlayer.addStat(AchievementList.makeBread, 1); } else if (par1ItemStack.itemID == Item.cake.itemID) { this.thePlayer.addStat(AchievementList.bakeCake, 1); } else if (par1ItemStack.itemID == Item.pickaxeStone.itemID) { this.thePlayer.addStat(AchievementList.buildBetterPickaxe, 1); } else if (par1ItemStack.itemID == Item.swordWood.itemID) { this.thePlayer.addStat(AchievementList.buildSword, 1); } else if (par1ItemStack.itemID == Block.enchantmentTable.blockID) { this.thePlayer.addStat(AchievementList.enchantments, 1); } else if (par1ItemStack.itemID == Block.bookShelf.blockID) { this.thePlayer.addStat(AchievementList.bookcase, 1); } } | /**
* the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood.
*/ | the itemStack passed in is the output - ie, iron ingots, and pickaxes, not ore and wood | onCrafting | {
"repo_name": "HATB0T/RuneCraftery",
"path": "forge/mcp/src/minecraft/net/minecraft/inventory/SlotCrafting.java",
"license": "lgpl-3.0",
"size": 5510
} | [
"net.minecraft.block.Block",
"net.minecraft.item.Item",
"net.minecraft.item.ItemStack",
"net.minecraft.stats.AchievementList"
] | import net.minecraft.block.Block; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.stats.AchievementList; | import net.minecraft.block.*; import net.minecraft.item.*; import net.minecraft.stats.*; | [
"net.minecraft.block",
"net.minecraft.item",
"net.minecraft.stats"
] | net.minecraft.block; net.minecraft.item; net.minecraft.stats; | 1,129,090 |
public static CmdArgs read(String[] args) {
Map<String, String> map = new LinkedHashMap<>();
for (String arg : args) {
int index = arg.indexOf("=");
if (index <= 0) {
continue;
}
String key = arg.substring(0, index);
if (key.startsWith("-")) {
key = key.substring(1);
}
if (key.startsWith("-")) {
key = key.substring(1);
}
String value = arg.substring(index + 1);
String old = map.put(toLowerCase(key), value);
if (old != null)
throw new IllegalArgumentException("Pair '" + toLowerCase(key) + "'='" + value + "' not possible to " +
"add to the CmdArgs-object as the key already exists with '" + old + "'");
}
return new CmdArgs(map);
} | static CmdArgs function(String[] args) { Map<String, String> map = new LinkedHashMap<>(); for (String arg : args) { int index = arg.indexOf("="); if (index <= 0) { continue; } String key = arg.substring(0, index); if (key.startsWith("-")) { key = key.substring(1); } if (key.startsWith("-")) { key = key.substring(1); } String value = arg.substring(index + 1); String old = map.put(toLowerCase(key), value); if (old != null) throw new IllegalArgumentException(STR + toLowerCase(key) + "'='" + value + STR + STR + old + "'"); } return new CmdArgs(map); } | /**
* This method creates a CmdArgs object from the specified string array (a list of key=value pairs).
*/ | This method creates a CmdArgs object from the specified string array (a list of key=value pairs) | read | {
"repo_name": "fbonzon/graphhopper",
"path": "api/src/main/java/com/graphhopper/util/CmdArgs.java",
"license": "apache-2.0",
"size": 2845
} | [
"com.graphhopper.util.Helper",
"java.util.LinkedHashMap",
"java.util.Map"
] | import com.graphhopper.util.Helper; import java.util.LinkedHashMap; import java.util.Map; | import com.graphhopper.util.*; import java.util.*; | [
"com.graphhopper.util",
"java.util"
] | com.graphhopper.util; java.util; | 697,115 |
public void addSarlRequiredCapacity(String... name) {
if (name != null && name.length > 0) {
SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity();
this.sarlSkill.getMembers().add(member);
member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember());
Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities();
for (final String aname : name) {
if (!Strings.isEmpty(aname)) {
thecollection.add(newTypeRef(this.sarlSkill, aname));
}
}
}
} | void function(String... name) { if (name != null && name.length > 0) { SarlRequiredCapacity member = SarlFactory.eINSTANCE.createSarlRequiredCapacity(); this.sarlSkill.getMembers().add(member); member.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendMember()); Collection<JvmParameterizedTypeReference> thecollection = member.getCapacities(); for (final String aname : name) { if (!Strings.isEmpty(aname)) { thecollection.add(newTypeRef(this.sarlSkill, aname)); } } } } | /** Create a SarlRequiredCapacity.
* @param name - the types referenced by the SarlRequiredCapacity.
*/ | Create a SarlRequiredCapacity | addSarlRequiredCapacity | {
"repo_name": "jgfoster/sarl",
"path": "main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlSkillBuilderImpl.java",
"license": "apache-2.0",
"size": 10384
} | [
"io.sarl.lang.sarl.SarlFactory",
"io.sarl.lang.sarl.SarlRequiredCapacity",
"java.util.Collection",
"org.eclipse.xtend.core.xtend.XtendFactory",
"org.eclipse.xtext.common.types.JvmParameterizedTypeReference",
"org.eclipse.xtext.util.Strings"
] | import io.sarl.lang.sarl.SarlFactory; import io.sarl.lang.sarl.SarlRequiredCapacity; import java.util.Collection; import org.eclipse.xtend.core.xtend.XtendFactory; import org.eclipse.xtext.common.types.JvmParameterizedTypeReference; import org.eclipse.xtext.util.Strings; | import io.sarl.lang.sarl.*; import java.util.*; import org.eclipse.xtend.core.xtend.*; import org.eclipse.xtext.common.types.*; import org.eclipse.xtext.util.*; | [
"io.sarl.lang",
"java.util",
"org.eclipse.xtend",
"org.eclipse.xtext"
] | io.sarl.lang; java.util; org.eclipse.xtend; org.eclipse.xtext; | 1,825,545 |
public void setSortedModelAndBind(ObservableList<B> list,
ObservableValue<Comparator<B>> toBindValue) {
Optional.ofNullable(list).map(ObservableList::sorted)
.filter(peek(sortedList -> sortedList.comparatorProperty()
.bind(toBindValue)))
.ifPresent(this::setModel);
} | void function(ObservableList<B> list, ObservableValue<Comparator<B>> toBindValue) { Optional.ofNullable(list).map(ObservableList::sorted) .filter(peek(sortedList -> sortedList.comparatorProperty() .bind(toBindValue))) .ifPresent(this::setModel); } | /**
* Sets the sorted model and bind.
*
* @param list
* the list
* @param toBindValue
* the to bind value
*/ | Sets the sorted model and bind | setSortedModelAndBind | {
"repo_name": "JM-Lab/javafx-component",
"path": "src/main/java/kr/jm/fx/template/AbstractJMFXFilteredAndSortedListModel.java",
"license": "apache-2.0",
"size": 2020
} | [
"java.util.Comparator",
"java.util.Optional"
] | import java.util.Comparator; import java.util.Optional; | import java.util.*; | [
"java.util"
] | java.util; | 1,372,456 |
@SuppressWarnings("unchecked")
public static void iterateOverSpellcheckerSuggestionsForWord(NamedList suggestions, SpellcheckerSuggestionProcessor processor) {
int i = 4;
// double topFreq = 0;
if (suggestions.getVal(4) instanceof List) {
// support for new version of Solr (valid after 2009-09-09 in version 1.4)
List<SimpleOrderedMap> l = (List<SimpleOrderedMap>) suggestions.getVal(4);
i = 0;
while (true) {
if (l.size() <= i) {
break;
}
processor.process(l.get(i), (String) l.get(i).get("word"));
i++;
}
}
else {
// old way, before 2009-09-09
while (true) {
if (suggestions.size() <= i) {
break;
}
processor.process((NamedList) (suggestions).getVal(i), suggestions.getName(i));
i++;
}
}
processor.afterProcessingFinished();
} | @SuppressWarnings(STR) static void function(NamedList suggestions, SpellcheckerSuggestionProcessor processor) { int i = 4; if (suggestions.getVal(4) instanceof List) { List<SimpleOrderedMap> l = (List<SimpleOrderedMap>) suggestions.getVal(4); i = 0; while (true) { if (l.size() <= i) { break; } processor.process(l.get(i), (String) l.get(i).get("word")); i++; } } else { while (true) { if (suggestions.size() <= i) { break; } processor.process((NamedList) (suggestions).getVal(i), suggestions.getName(i)); i++; } } processor.afterProcessingFinished(); } | /**
* Contains logic for iterating over spellchecker's suggestions. If any of input parameters is null, just exits. This method
* iterates over suggestions for one incorrect word (for which parameter <code>suggestions</code> should contain spellchecker's suggestions).
*
*
* @param suggestions list of suggestions for some word, so word parameter isn't needed
* @param processor instance of processor which will handle all suggestions for word
*/ | Contains logic for iterating over spellchecker's suggestions. If any of input parameters is null, just exits. This method iterates over suggestions for one incorrect word (for which parameter <code>suggestions</code> should contain spellchecker's suggestions) | iterateOverSpellcheckerSuggestionsForWord | {
"repo_name": "sematext/solr-researcher",
"path": "core/src/main/java/com/sematext/solr/handler/component/ReSearcherUtils.java",
"license": "apache-2.0",
"size": 10234
} | [
"java.util.List",
"org.apache.solr.common.util.NamedList",
"org.apache.solr.common.util.SimpleOrderedMap"
] | import java.util.List; import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.SimpleOrderedMap; | import java.util.*; import org.apache.solr.common.util.*; | [
"java.util",
"org.apache.solr"
] | java.util; org.apache.solr; | 492,722 |
public Datum putSerializable(DataManager data, Bundle bundle, Serializable value) {
if (mAccessor == null) {
bundle.putSerializable(mKey, value);
} else {
throw new RuntimeException("Accessor not supported for serializable objects");
}
return this;
}
| Datum function(DataManager data, Bundle bundle, Serializable value) { if (mAccessor == null) { bundle.putSerializable(mKey, value); } else { throw new RuntimeException(STR); } return this; } | /**
* Set the serializable object in the collection.
* We currently do not use a Datum for special access.
* TODO: Consider how to use an accessor
*
* @param data Parent DataManager
* @param bundle Raw data Bundle
* @param value The serializable object
*
* @return The data manager for chaining
*/ | Set the serializable object in the collection. We currently do not use a Datum for special access | putSerializable | {
"repo_name": "Grunthos/Book-Catalogue",
"path": "src/com/eleybourn/bookcatalogue/datamanager/Datum.java",
"license": "gpl-3.0",
"size": 10870
} | [
"android.os.Bundle",
"java.io.Serializable"
] | import android.os.Bundle; import java.io.Serializable; | import android.os.*; import java.io.*; | [
"android.os",
"java.io"
] | android.os; java.io; | 2,295,947 |
public void setDataSource(final DataSource<T> dataSource)
throws IllegalArgumentException {
if (dataSource == null) {
throw new IllegalArgumentException("dataSource can't be null.");
}
selectionModel.reset();
if (this.dataSource != null) {
this.dataSource.setDataChangeHandler(null);
} | void function(final DataSource<T> dataSource) throws IllegalArgumentException { if (dataSource == null) { throw new IllegalArgumentException(STR); } selectionModel.reset(); if (this.dataSource != null) { this.dataSource.setDataChangeHandler(null); } | /**
* Sets the data source used by this grid.
*
* @param dataSource
* the data source to use, not null
* @throws IllegalArgumentException
* if <code>dataSource</code> is <code>null</code>
*/ | Sets the data source used by this grid | setDataSource | {
"repo_name": "Peppe/vaadin",
"path": "client/src/com/vaadin/client/widgets/Grid.java",
"license": "apache-2.0",
"size": 306271
} | [
"com.vaadin.client.data.DataSource"
] | import com.vaadin.client.data.DataSource; | import com.vaadin.client.data.*; | [
"com.vaadin.client"
] | com.vaadin.client; | 1,832,298 |
@Override
public PrintWriter getLogWriter() throws SQLException {
return this.targetDataSource.getLogWriter();
} | PrintWriter function() throws SQLException { return this.targetDataSource.getLogWriter(); } | /**
* get log writer.
*
* @return PrintWriter
* @throws SQLException
* sql exception
*/ | get log writer | getLogWriter | {
"repo_name": "jianbingfang/xhf",
"path": "src/main/java/com/xthena/core/jdbc/DataSourceProxy.java",
"license": "apache-2.0",
"size": 2707
} | [
"java.io.PrintWriter",
"java.sql.SQLException"
] | import java.io.PrintWriter; import java.sql.SQLException; | import java.io.*; import java.sql.*; | [
"java.io",
"java.sql"
] | java.io; java.sql; | 84,667 |
public BigDecimal getHoldingsValue() {
return price.multiply( BigDecimal.valueOf( quantity ) ).multiply( security.getQuoteCurrency().getConversionRate() ).multiply( security.getSymbolProperties().getContractMultiplier() );
} | BigDecimal function() { return price.multiply( BigDecimal.valueOf( quantity ) ).multiply( security.getQuoteCurrency().getConversionRate() ).multiply( security.getSymbolProperties().getContractMultiplier() ); } | /**
* Market value of our holdings.
*/ | Market value of our holdings | getHoldingsValue | {
"repo_name": "aricooperman/jLean",
"path": "src/main/java/com/quantconnect/lean/securities/SecurityHolding.java",
"license": "apache-2.0",
"size": 9240
} | [
"java.math.BigDecimal"
] | import java.math.BigDecimal; | import java.math.*; | [
"java.math"
] | java.math; | 1,437,149 |
void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName);
| void assignRoleToAuthority(NodeRef filePlan, String role, String authorityName); | /**
* Assign a role to an authority
*
* @param filePlan file plan
* @param role role
* @param authorityName authority name
*/ | Assign a role to an authority | assignRoleToAuthority | {
"repo_name": "dnacreative/records-management",
"path": "rm-server/source/java/org/alfresco/module/org_alfresco_module_rm/role/FilePlanRoleService.java",
"license": "lgpl-3.0",
"size": 6374
} | [
"org.alfresco.service.cmr.repository.NodeRef"
] | import org.alfresco.service.cmr.repository.NodeRef; | import org.alfresco.service.cmr.repository.*; | [
"org.alfresco.service"
] | org.alfresco.service; | 2,207,897 |
public Iterator<EdgeEndPoint> vertexIterator() {
return new VertexIterator();
}
private class MakeEdgeList {
List<EdgeEndPoint> list = new LinkedList<EdgeEndPoint>();
| Iterator<EdgeEndPoint> function() { return new VertexIterator(); } private class MakeEdgeList { List<EdgeEndPoint> list = new LinkedList<EdgeEndPoint>(); | /**
* Iterates over the elements edge endpoints of the template,
* in the sequence order.
* Only one connected component will be iterated on.
* Note that if there is a cycle, the iterator may return a infinite
* number of elements.
*/ | Iterates over the elements edge endpoints of the template, in the sequence order. Only one connected component will be iterated on. Note that if there is a cycle, the iterator may return a infinite number of elements | vertexIterator | {
"repo_name": "jhuang/RNAHeliCesGUI",
"path": "src/fr/orsay/lri/varna/models/templates/RNATemplate.java",
"license": "gpl-3.0",
"size": 56111
} | [
"fr.orsay.lri.varna.models.templates.RNATemplate",
"java.util.Iterator",
"java.util.LinkedList",
"java.util.List"
] | import fr.orsay.lri.varna.models.templates.RNATemplate; import java.util.Iterator; import java.util.LinkedList; import java.util.List; | import fr.orsay.lri.varna.models.templates.*; import java.util.*; | [
"fr.orsay.lri",
"java.util"
] | fr.orsay.lri; java.util; | 2,565,885 |
public Builder useIncludingRegexPatterns(String regexList) {
Preconditions.checkNotNull(regexList);
this.includingRegexPatterns = DatasetFilterUtils.getPatternsFromStrings(COMMA_SPLITTER.splitToList(regexList));
return this;
} | Builder function(String regexList) { Preconditions.checkNotNull(regexList); this.includingRegexPatterns = DatasetFilterUtils.getPatternsFromStrings(COMMA_SPLITTER.splitToList(regexList)); return this; } | /**
* Set the regex patterns used to filter logs that should be copied.
*
* @param regexList a comma-separated list of regex patterns
* @return this {@link LogCopier.Builder} instance
*/ | Set the regex patterns used to filter logs that should be copied | useIncludingRegexPatterns | {
"repo_name": "zliu41/gobblin",
"path": "gobblin-utility/src/main/java/gobblin/util/logs/LogCopier.java",
"license": "apache-2.0",
"size": 21096
} | [
"com.google.common.base.Preconditions"
] | import com.google.common.base.Preconditions; | import com.google.common.base.*; | [
"com.google.common"
] | com.google.common; | 1,605,421 |
@Test
public void testProjectName() throws Exception
{
Assert.assertEquals( "Unknown Project 0", bundle.getProjectName() );
String pomDir = new File( "./target/test-classes/unit/testpom" ).getCanonicalPath();
ResourceBundle bundlePOM = new ResourceBundle( null, null, null, pomDir, pomDir );
Assert.assertEquals( "Test Sample Project", bundlePOM.getProjectName() );
Assert.assertEquals( "net.sf.yal10n:test-project:1.0.0-SNAPSHOT", bundlePOM.getMavenCoordinates() );
} | void function() throws Exception { Assert.assertEquals( STR, bundle.getProjectName() ); String pomDir = new File( STR ).getCanonicalPath(); ResourceBundle bundlePOM = new ResourceBundle( null, null, null, pomDir, pomDir ); Assert.assertEquals( STR, bundlePOM.getProjectName() ); Assert.assertEquals( STR, bundlePOM.getMavenCoordinates() ); } | /**
* Test the project name generation.
* @throws Exception any error
*/ | Test the project name generation | testProjectName | {
"repo_name": "adangel/yal10n",
"path": "src/test/java/net/sf/yal10n/analyzer/ResourceBundleTest.java",
"license": "apache-2.0",
"size": 6768
} | [
"java.io.File",
"org.junit.Assert"
] | import java.io.File; import org.junit.Assert; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 936,086 |
@Override
public Collection<? extends EStructuralFeature> getChildrenFeatures(
Object object) {
if (childrenFeatures == null) {
super.getChildrenFeatures(object);
childrenFeatures
.add(Bpmn2Package.Literals.GLOBAL_USER_TASK__RENDERINGS);
}
return childrenFeatures;
} | Collection<? extends EStructuralFeature> function( Object object) { if (childrenFeatures == null) { super.getChildrenFeatures(object); childrenFeatures .add(Bpmn2Package.Literals.GLOBAL_USER_TASK__RENDERINGS); } return childrenFeatures; } | /**
* This specifies how to implement {@link #getChildren} and is used to deduce an appropriate feature for an
* {@link org.eclipse.emf.edit.command.AddCommand}, {@link org.eclipse.emf.edit.command.RemoveCommand} or
* {@link org.eclipse.emf.edit.command.MoveCommand} in {@link #createCommand}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This specifies how to implement <code>#getChildren</code> and is used to deduce an appropriate feature for an <code>org.eclipse.emf.edit.command.AddCommand</code>, <code>org.eclipse.emf.edit.command.RemoveCommand</code> or <code>org.eclipse.emf.edit.command.MoveCommand</code> in <code>#createCommand</code>. | getChildrenFeatures | {
"repo_name": "adbrucker/SecureBPMN",
"path": "designer/src/org.activiti.designer.model.edit/src/org/eclipse/bpmn2/provider/GlobalUserTaskItemProvider.java",
"license": "apache-2.0",
"size": 6328
} | [
"java.util.Collection",
"org.eclipse.bpmn2.Bpmn2Package",
"org.eclipse.emf.ecore.EStructuralFeature"
] | import java.util.Collection; import org.eclipse.bpmn2.Bpmn2Package; import org.eclipse.emf.ecore.EStructuralFeature; | import java.util.*; import org.eclipse.bpmn2.*; import org.eclipse.emf.ecore.*; | [
"java.util",
"org.eclipse.bpmn2",
"org.eclipse.emf"
] | java.util; org.eclipse.bpmn2; org.eclipse.emf; | 817,091 |
private static boolean to(SocketAddress socketAddress) {
try {
Socket socket = new Socket();
socket.connect(socketAddress, (int) TimeUnit.SECONDS.toMillis(5));
socket.close();
return true;
} catch (IOException e) {
return false;
}
} | static boolean function(SocketAddress socketAddress) { try { Socket socket = new Socket(); socket.connect(socketAddress, (int) TimeUnit.SECONDS.toMillis(5)); socket.close(); return true; } catch (IOException e) { return false; } } | /**
* Check whether a TCP connection can be established to the given {@link SocketAddress}.
*
* @param socketAddress
* @return
*/ | Check whether a TCP connection can be established to the given <code>SocketAddress</code> | to | {
"repo_name": "lettuce-io/lettuce-core",
"path": "src/test/java/io/lettuce/test/CanConnect.java",
"license": "apache-2.0",
"size": 1718
} | [
"java.io.IOException",
"java.net.Socket",
"java.net.SocketAddress",
"java.util.concurrent.TimeUnit"
] | import java.io.IOException; import java.net.Socket; import java.net.SocketAddress; import java.util.concurrent.TimeUnit; | import java.io.*; import java.net.*; import java.util.concurrent.*; | [
"java.io",
"java.net",
"java.util"
] | java.io; java.net; java.util; | 1,720,373 |
@Test
public void testNestedComplexTemplateWithOuterResolver()
{
System.setProperty("simple", "value");
ExpressionTemplate t = new ExpressionTemplate("${simple:a_${nested:nested}_${expr:expression}_}");
assertEquals(3, t.getEntities().size());
assertEquals("${simple:value}", t.getSubstitution());
assertEquals("value", t.getValue());
} | void function() { System.setProperty(STR, "value"); ExpressionTemplate t = new ExpressionTemplate(STR); assertEquals(3, t.getEntities().size()); assertEquals(STR, t.getSubstitution()); assertEquals("value", t.getValue()); } | /**
* Test a nested complex template the resolved outer part
*/ | Test a nested complex template the resolved outer part | testNestedComplexTemplateWithOuterResolver | {
"repo_name": "jandsu/ironjacamar",
"path": "testsuite/src/test/java/org/ironjacamar/common/metadata/common/ExpressionTemplateTestCase.java",
"license": "epl-1.0",
"size": 33024
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 1,959,580 |
public List<T> traverseInOrder() {
List<T> list = new ArrayList<>();
traverseInOrderRecursive(root, list);
return list;
} | List<T> function() { List<T> list = new ArrayList<>(); traverseInOrderRecursive(root, list); return list; } | /**
* Complexity: O(n)
*
* @return
*/ | Complexity: O(n) | traverseInOrder | {
"repo_name": "larunrahul/JADS",
"path": "src/main/java/com/learning/ads/datastructure/tree/StandardBinarySearchTree.java",
"license": "mit",
"size": 7057
} | [
"java.util.ArrayList",
"java.util.List"
] | import java.util.ArrayList; import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,884,973 |
public List<String> getRequestRecipients() {
return to;
}
}
// The actual value of the string is different since that is what the web dialog is actually
// called on the server.
private static final String GAME_REQUEST_DIALOG = "apprequests";
private static final int DEFAULT_REQUEST_CODE =
CallbackManagerImpl.RequestCodeOffset.GameRequest.toRequestCode(); | List<String> function() { return to; } } private static final String GAME_REQUEST_DIALOG = STR; private static final int DEFAULT_REQUEST_CODE = CallbackManagerImpl.RequestCodeOffset.GameRequest.toRequestCode(); | /**
* Returns request recipients.
* @return request recipients
*/ | Returns request recipients | getRequestRecipients | {
"repo_name": "carlesls2/sitappandroidv1",
"path": "prova/facebook/src/com/facebook/share/widget/GameRequestDialog.java",
"license": "lgpl-3.0",
"size": 7041
} | [
"com.facebook.internal.CallbackManagerImpl",
"java.util.List"
] | import com.facebook.internal.CallbackManagerImpl; import java.util.List; | import com.facebook.internal.*; import java.util.*; | [
"com.facebook.internal",
"java.util"
] | com.facebook.internal; java.util; | 159,083 |
public void setSender(final Address address) throws MessagingException {
setHeader("Sender", address);
} | void function(final Address address) throws MessagingException { setHeader(STR, address); } | /**
* Set the "Sender" header. If the address is null, this
* will remove the current sender header.
*
* @param address the new Sender address
*
* @throws MessagingException
* if there was a problem setting the header
*/ | Set the "Sender" header. If the address is null, this will remove the current sender header | setSender | {
"repo_name": "salyh/javamailspec",
"path": "geronimo-javamail_1.5_spec/src/main/java/javax/mail/internet/MimeMessage.java",
"license": "apache-2.0",
"size": 66023
} | [
"javax.mail.Address",
"javax.mail.MessagingException"
] | import javax.mail.Address; import javax.mail.MessagingException; | import javax.mail.*; | [
"javax.mail"
] | javax.mail; | 592,604 |
private void addIntegerIndices(Collection<? super String> keys) {
for (long i = 0, length = getLength(); i < length; ++i) {
keys.add(Long.toString(i));
}
} | void function(Collection<? super String> keys) { for (long i = 0, length = getLength(); i < length; ++i) { keys.add(Long.toString(i)); } } | /**
* Append integer indices to {@code keys} collection
*/ | Append integer indices to keys collection | addIntegerIndices | {
"repo_name": "rwaldron/es6draft",
"path": "src/main/java/com/github/anba/es6draft/runtime/types/builtins/ExoticIntegerIndexedObject.java",
"license": "mit",
"size": 7678
} | [
"java.util.Collection"
] | import java.util.Collection; | import java.util.*; | [
"java.util"
] | java.util; | 1,081,678 |
private boolean showDescriptionEditNotification(final Context context, final Media media,
final boolean result) {
final String message;
String title = context.getString(R.string.description_edit_helper_show_edit_title);
if (result) {
title += ": " + context
.getString(R.string.coordinates_edit_helper_show_edit_title_success);
message = context.getString(R.string.description_edit_helper_show_edit_message);
} else {
title += ": " + context.getString(R.string.description_edit_helper_show_edit_title);
message = context.getString(R.string.description_edit_helper_edit_message_else) ;
}
final String urlForFile = BuildConfig.COMMONS_URL + "/wiki/" + media.getFilename();
final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForFile));
notificationHelper.showNotification(context, title, message, NOTIFICATION_EDIT_DESCRIPTION,
browserIntent);
return result;
} | boolean function(final Context context, final Media media, final boolean result) { final String message; String title = context.getString(R.string.description_edit_helper_show_edit_title); if (result) { title += STR + context .getString(R.string.coordinates_edit_helper_show_edit_title_success); message = context.getString(R.string.description_edit_helper_show_edit_message); } else { title += STR + context.getString(R.string.description_edit_helper_show_edit_title); message = context.getString(R.string.description_edit_helper_edit_message_else) ; } final String urlForFile = BuildConfig.COMMONS_URL + STR + media.getFilename(); final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(urlForFile)); notificationHelper.showNotification(context, title, message, NOTIFICATION_EDIT_DESCRIPTION, browserIntent); return result; } | /**
* Update descriptions and shows notification about descriptions update
* @param context to be added
* @param media to be added
* @param result to be added
* @return boolean
*/ | Update descriptions and shows notification about descriptions update | showDescriptionEditNotification | {
"repo_name": "commons-app/apps-android-commons",
"path": "app/src/main/java/fr/free/nrw/commons/description/DescriptionEditHelper.java",
"license": "apache-2.0",
"size": 5282
} | [
"android.content.Context",
"android.content.Intent",
"android.net.Uri",
"fr.free.nrw.commons.BuildConfig",
"fr.free.nrw.commons.Media"
] | import android.content.Context; import android.content.Intent; import android.net.Uri; import fr.free.nrw.commons.BuildConfig; import fr.free.nrw.commons.Media; | import android.content.*; import android.net.*; import fr.free.nrw.commons.*; | [
"android.content",
"android.net",
"fr.free.nrw"
] | android.content; android.net; fr.free.nrw; | 1,265,596 |
public AccessType getAccess()
{
return AccessType.getFromStringValue(childNode.getAttribute("access"));
} | AccessType function() { return AccessType.getFromStringValue(childNode.getAttribute(STR)); } | /**
* Returns the <code>access</code> attribute
* @return the value defined for the attribute <code>access</code>
*/ | Returns the <code>access</code> attribute | getAccess | {
"repo_name": "forge/javaee-descriptors",
"path": "impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/orm20/EntityImpl.java",
"license": "epl-1.0",
"size": 48316
} | [
"org.jboss.shrinkwrap.descriptor.api.orm20.AccessType"
] | import org.jboss.shrinkwrap.descriptor.api.orm20.AccessType; | import org.jboss.shrinkwrap.descriptor.api.orm20.*; | [
"org.jboss.shrinkwrap"
] | org.jboss.shrinkwrap; | 2,411,504 |
public static StatementKey newCallable(
String sql, String schema, int holdability) {
return newCallable(sql, schema, ResultSet.TYPE_FORWARD_ONLY,
ResultSet.CONCUR_READ_ONLY, holdability);
} | static StatementKey function( String sql, String schema, int holdability) { return newCallable(sql, schema, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, holdability); } | /**
* Creates a key for a callable statement.
* <p>
* Unspecified settings will be according to the JDBC standard; result set
* type will be <code>ResultSet.TYPE_FORWARD_ONLY</code>, concurrency will
* be <code>ResultSet.CONCUR_READ_ONLY</code>.
*
* @param sql SQL query string
* @param schema current compilation schema
* @param holdability result set holdability
* @return A statement key.
*/ | Creates a key for a callable statement. Unspecified settings will be according to the JDBC standard; result set type will be <code>ResultSet.TYPE_FORWARD_ONLY</code>, concurrency will be <code>ResultSet.CONCUR_READ_ONLY</code> | newCallable | {
"repo_name": "lpxz/grail-derby104",
"path": "java/client/org/apache/derby/client/am/stmtcache/StatementKeyFactory.java",
"license": "apache-2.0",
"size": 5195
} | [
"java.sql.ResultSet"
] | import java.sql.ResultSet; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,613,881 |
public Entry getEntry() {
return getElement(Entry.KEY);
} | Entry function() { return getElement(Entry.KEY); } | /**
* Returns the nested entry.
*
* @return nested entry
*/ | Returns the nested entry | getEntry | {
"repo_name": "simonrrr/gdata-java-client",
"path": "java/src/com/google/gdata/model/gd/EntryLink.java",
"license": "apache-2.0",
"size": 5469
} | [
"com.google.gdata.model.atom.Entry"
] | import com.google.gdata.model.atom.Entry; | import com.google.gdata.model.atom.*; | [
"com.google.gdata"
] | com.google.gdata; | 2,173,085 |
public String[] getClientAliases(String keyType, Principal[] issuers) {
return delegate.getClientAliases(keyType, issuers);
} | String[] function(String keyType, Principal[] issuers) { return delegate.getClientAliases(keyType, issuers); } | /**
* Get the matching aliases for authenticating the client side of a secure
* socket, given the public key type and the list of certificate issuer
* authorities recognized by the peer (if any).
*
* @param keyType
* The key algorithm type name
* @param issuers
* The list of acceptable CA issuer subject names, or null if it
* does not matter which issuers are used
*
* @return Array of the matching alias names, or null if there were no
* matches
*/ | Get the matching aliases for authenticating the client side of a secure socket, given the public key type and the list of certificate issuer authorities recognized by the peer (if any) | getClientAliases | {
"repo_name": "xuse/ef-others",
"path": "common-net/src/main/java/jef/net/ftpserver/ssl/impl/AliasKeyManager.java",
"license": "apache-2.0",
"size": 6418
} | [
"java.security.Principal"
] | import java.security.Principal; | import java.security.*; | [
"java.security"
] | java.security; | 284,251 |
public static void saveUserSettings (Context context, UserSettings userSettings, UserSaveListener listener) {
proxy.saveUserSettings(context, userSettings, listener);
}
| static void function (Context context, UserSettings userSettings, UserSaveListener listener) { proxy.saveUserSettings(context, userSettings, listener); } | /**
* Saves the profile for the given user.
* @param context The current context.
* @param userSettings The user settings to be saved.
* @param listener A listener to handle the save.
*/ | Saves the profile for the given user | saveUserSettings | {
"repo_name": "dylanmaryk/InsanityRadio-Android",
"path": "socialize/src/com/socialize/UserUtils.java",
"license": "mit",
"size": 7160
} | [
"android.content.Context",
"com.socialize.listener.user.UserSaveListener",
"com.socialize.ui.profile.UserSettings"
] | import android.content.Context; import com.socialize.listener.user.UserSaveListener; import com.socialize.ui.profile.UserSettings; | import android.content.*; import com.socialize.listener.user.*; import com.socialize.ui.profile.*; | [
"android.content",
"com.socialize.listener",
"com.socialize.ui"
] | android.content; com.socialize.listener; com.socialize.ui; | 2,841,374 |
public static Hashtable<String, String> getHashtable(final String name) {
final Hashtable<String, String> hash = new Hashtable<String, String>();
try {
final String configStr = UserPreferences.get(fixKey(name), "");
if (!configStr.equals("")) {
final String[] rows = configStr.split(";");
for (final String row : rows) {
final String[] split = row.split(":");
if (split.length == 2) {
final String key = split[0];
final String value = split[1];
hash.put(key, value);
}
}
}
} catch (final Exception e) {
// just eat the exception to avoid any system crash on system issues
}
return hash;
} | static Hashtable<String, String> function(final String name) { final Hashtable<String, String> hash = new Hashtable<String, String>(); try { final String configStr = UserPreferences.get(fixKey(name), STRSTR;STR:"); if (split.length == 2) { final String key = split[0]; final String value = split[1]; hash.put(key, value); } } } } catch (final Exception e) { } return hash; } | /**
* Gets the hashtable.
*
* @param name the name
* @return the hashtable
*/ | Gets the hashtable | getHashtable | {
"repo_name": "kiswanij/jk-util",
"path": "src/main/java/com/jk/util/UserPreferences.java",
"license": "mit",
"size": 7535
} | [
"java.util.Hashtable"
] | import java.util.Hashtable; | import java.util.*; | [
"java.util"
] | java.util; | 815,781 |
public FeedbackConversation addFeedbackConversation(
FeedbackConversation conversation) throws Exception; | FeedbackConversation function( FeedbackConversation conversation) throws Exception; | /**
* Adds the feedback conversation.
*
* @param conversation the conversation
* @return the feedback conversation
* @throws Exception the exception
*/ | Adds the feedback conversation | addFeedbackConversation | {
"repo_name": "IHTSDO/OTF-Mapping-Service",
"path": "services/src/main/java/org/ihtsdo/otf/mapping/services/WorkflowService.java",
"license": "apache-2.0",
"size": 15613
} | [
"org.ihtsdo.otf.mapping.model.FeedbackConversation"
] | import org.ihtsdo.otf.mapping.model.FeedbackConversation; | import org.ihtsdo.otf.mapping.model.*; | [
"org.ihtsdo.otf"
] | org.ihtsdo.otf; | 1,963,938 |
static public CalculationMethod createCopy(
final CalculationMethod originalCalculationMethod) {
if (originalCalculationMethod == null) {
return null;
}
CalculationMethod cloneCalculationMethod = new CalculationMethod();
cloneCalculationMethod.setIdentifier(originalCalculationMethod.getIdentifier());
cloneCalculationMethod.setCodeRoutineName(originalCalculationMethod.getCodeRoutineName());
cloneCalculationMethod.setDescription(originalCalculationMethod.getDescription());
cloneCalculationMethod.setName(originalCalculationMethod.getName());
cloneCalculationMethod.setPrior(originalCalculationMethod.getPrior());
List<Parameter> clonedParameterList =
Parameter.createCopy(originalCalculationMethod.getParameters());
cloneCalculationMethod.setParameters(clonedParameterList);
return cloneCalculationMethod;
} | static CalculationMethod function( final CalculationMethod originalCalculationMethod) { if (originalCalculationMethod == null) { return null; } CalculationMethod cloneCalculationMethod = new CalculationMethod(); cloneCalculationMethod.setIdentifier(originalCalculationMethod.getIdentifier()); cloneCalculationMethod.setCodeRoutineName(originalCalculationMethod.getCodeRoutineName()); cloneCalculationMethod.setDescription(originalCalculationMethod.getDescription()); cloneCalculationMethod.setName(originalCalculationMethod.getName()); cloneCalculationMethod.setPrior(originalCalculationMethod.getPrior()); List<Parameter> clonedParameterList = Parameter.createCopy(originalCalculationMethod.getParameters()); cloneCalculationMethod.setParameters(clonedParameterList); return cloneCalculationMethod; } | /**
* Creates the copy.
*
* @param originalCalculationMethod the original calculation method
* @return the calculation method
*/ | Creates the copy | createCopy | {
"repo_name": "smallAreaHealthStatisticsUnit/rapidInquiryFacility",
"path": "rifServices/src/main/java/org/sahsu/rif/services/concepts/CalculationMethod.java",
"license": "lgpl-3.0",
"size": 14068
} | [
"java.util.List",
"org.sahsu.rif.generic.concepts.Parameter"
] | import java.util.List; import org.sahsu.rif.generic.concepts.Parameter; | import java.util.*; import org.sahsu.rif.generic.concepts.*; | [
"java.util",
"org.sahsu.rif"
] | java.util; org.sahsu.rif; | 218,309 |
@Override
public void notifyChanged(Notification notification) {
updateChildren(notification);
super.notifyChanged(notification);
} | void function(Notification notification) { updateChildren(notification); super.notifyChanged(notification); } | /**
* This handles model notifications by calling {@link #updateChildren} to update any cached
* children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/ | This handles model notifications by calling <code>#updateChildren</code> to update any cached children and by creating a viewer notification, which it passes to <code>#fireNotifyChanged</code>. | notifyChanged | {
"repo_name": "SeelabFhdo/AjiL",
"path": "ajiML.edit/src/ajiMLT/provider/CharTItemProvider.java",
"license": "mit",
"size": 2822
} | [
"org.eclipse.emf.common.notify.Notification"
] | import org.eclipse.emf.common.notify.Notification; | import org.eclipse.emf.common.notify.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 2,246,832 |
public static long copy(InputStream from, OutputStream to)
throws IOException {
byte[] buf = new byte[BUF_SIZE];
long total = 0;
while (true) {
int r = from.read(buf);
if (r == -1) {
break;
}
to.write(buf, 0, r);
total += r;
}
return total;
} | static long function(InputStream from, OutputStream to) throws IOException { byte[] buf = new byte[BUF_SIZE]; long total = 0; while (true) { int r = from.read(buf); if (r == -1) { break; } to.write(buf, 0, r); total += r; } return total; } | /**
* Copies all bytes from the input stream to the output stream.
* Does not close or flush either stream.
*
* @param from the input stream to read from
* @param to the output stream to write to
* @return the number of bytes copied
* @throws IOException if an I/O error occurs
*/ | Copies all bytes from the input stream to the output stream. Does not close or flush either stream | copy | {
"repo_name": "eugeneiiim/AndroidCollections",
"path": "src/com/google/common/io/ByteStreams.java",
"license": "apache-2.0",
"size": 24892
} | [
"java.io.IOException",
"java.io.InputStream",
"java.io.OutputStream"
] | import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; | import java.io.*; | [
"java.io"
] | java.io; | 2,369,675 |
private void fixResourceReferenceClassNames(BaseElement theNext, String thePackageBase) {
for (BaseElement next : theNext.getChildren()) {
fixResourceReferenceClassNames(next, thePackageBase);
}
if (theNext.isResourceRef()) {
for (int i = 0; i < theNext.getType().size(); i++) {
String nextTypeName = theNext.getType().get(i);
if ("Any".equals(nextTypeName)) {
continue;
}
// if ("Location".equals(nextTypeName)) {
// ourLog.info("***** Checking for Location");
// ourLog.info("***** Imports are: {}", new
// TreeSet<String>(myImports));
// }
boolean found = false;
for (String nextImport : myImports) {
if (nextImport.endsWith(".resource." + nextTypeName)) {
// ourLog.info("***** Found match " + nextImport);
theNext.getType().set(i, nextImport);
found = true;
}
}
if (!found) {
theNext.getType().set(i, thePackageBase + ".resource." + nextTypeName);
}
}
}
} | void function(BaseElement theNext, String thePackageBase) { for (BaseElement next : theNext.getChildren()) { fixResourceReferenceClassNames(next, thePackageBase); } if (theNext.isResourceRef()) { for (int i = 0; i < theNext.getType().size(); i++) { String nextTypeName = theNext.getType().get(i); if ("Any".equals(nextTypeName)) { continue; } boolean found = false; for (String nextImport : myImports) { if (nextImport.endsWith(STR + nextTypeName)) { theNext.getType().set(i, nextImport); found = true; } } if (!found) { theNext.getType().set(i, thePackageBase + STR + nextTypeName); } } } } | /**
* Example: Encounter has an internal block class named "Location", but it also has a reference to the Location resource type, so we need to use the fully qualified name for that resource
* reference
*/ | Example: Encounter has an internal block class named "Location", but it also has a reference to the Location resource type, so we need to use the fully qualified name for that resource reference | fixResourceReferenceClassNames | {
"repo_name": "Nodstuff/hapi-fhir",
"path": "hapi-tinder-plugin/src/main/java/ca/uhn/fhir/tinder/parser/BaseStructureParser.java",
"license": "apache-2.0",
"size": 22257
} | [
"ca.uhn.fhir.tinder.model.BaseElement"
] | import ca.uhn.fhir.tinder.model.BaseElement; | import ca.uhn.fhir.tinder.model.*; | [
"ca.uhn.fhir"
] | ca.uhn.fhir; | 716,398 |
public Location add(Vector vec) {
this.x += vec.getX();
this.y += vec.getY();
this.z += vec.getZ();
return this;
} | Location function(Vector vec) { this.x += vec.getX(); this.y += vec.getY(); this.z += vec.getZ(); return this; } | /**
* Adds the location by a vector.
*
* @see Vector
* @param vec Vector to use
* @return the same location
*/ | Adds the location by a vector | add | {
"repo_name": "AlmuraDev/Almura-API",
"path": "src/main/java/org/bukkit/Location.java",
"license": "gpl-3.0",
"size": 13004
} | [
"org.bukkit.util.Vector"
] | import org.bukkit.util.Vector; | import org.bukkit.util.*; | [
"org.bukkit.util"
] | org.bukkit.util; | 2,590,003 |
void send(String name, double value) throws IOException; | void send(String name, double value) throws IOException; | /**
* Send a measurement to Wavefront. The current machine's hostname would be used as the source. The point will be
* timestamped at the agent.
*
* @param name The name of the metric. Spaces are replaced with '-' (dashes) and quotes will be automatically
* escaped.
* @param value The value to be sent.
* @throws IOException Throws if there was an error sending the metric.
* @throws UnknownHostException Throws if there's an error determining the current host.
*/ | Send a measurement to Wavefront. The current machine's hostname would be used as the source. The point will be timestamped at the agent | send | {
"repo_name": "jbau/java",
"path": "java-client/src/main/java/com/wavefront/integrations/WavefrontSender.java",
"license": "apache-2.0",
"size": 3563
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 205,576 |
public void remove(Entity e, String group) {
Bag<Entity> entities = entitiesByGroup.get(group);
if(entities != null) {
entities.remove(e);
}
Bag<String> groups = groupsByEntity.get(e);
if(groups != null) {
groups.remove(group);
}
}
| void function(Entity e, String group) { Bag<Entity> entities = entitiesByGroup.get(group); if(entities != null) { entities.remove(e); } Bag<String> groups = groupsByEntity.get(e); if(groups != null) { groups.remove(group); } } | /**
* Remove the entity from the specified group.
* @param e
* @param group
*/ | Remove the entity from the specified group | remove | {
"repo_name": "pbanwait/Artemis-Framework",
"path": "artemis/src/com/artemis/managers/GroupManager.java",
"license": "bsd-3-clause",
"size": 3374
} | [
"com.artemis.Entity",
"com.artemis.utils.Bag"
] | import com.artemis.Entity; import com.artemis.utils.Bag; | import com.artemis.*; import com.artemis.utils.*; | [
"com.artemis",
"com.artemis.utils"
] | com.artemis; com.artemis.utils; | 2,483,595 |
public DateTime timestamp() {
return this.timestamp;
} | DateTime function() { return this.timestamp; } | /**
* Get timestamp for the policy state record.
*
* @return the timestamp value
*/ | Get timestamp for the policy state record | timestamp | {
"repo_name": "selvasingh/azure-sdk-for-java",
"path": "sdk/policyinsights/mgmt-v2019_10_01/src/main/java/com/microsoft/azure/management/policyinsights/v2019_10_01/implementation/PolicyStateInner.java",
"license": "mit",
"size": 24066
} | [
"org.joda.time.DateTime"
] | import org.joda.time.DateTime; | import org.joda.time.*; | [
"org.joda.time"
] | org.joda.time; | 1,129,868 |
@Override
void printSubNodes(int depth)
{
if (SanityManager.DEBUG)
{
super.printSubNodes(depth);
if (searchPredicateList != null)
{
printLabel(depth, "searchPredicateList: ");
searchPredicateList.treePrint(depth + 1);
}
if (joinPredicateList != null)
{
printLabel(depth, "joinPredicateList: ");
joinPredicateList.treePrint(depth + 1);
}
}
} | void printSubNodes(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (searchPredicateList != null) { printLabel(depth, STR); searchPredicateList.treePrint(depth + 1); } if (joinPredicateList != null) { printLabel(depth, STR); joinPredicateList.treePrint(depth + 1); } } } | /**
* Prints the sub-nodes of this object. See QueryTreeNode.java for
* how tree printing is supposed to work.
*
* @param depth The depth of this node in the tree
*/ | Prints the sub-nodes of this object. See QueryTreeNode.java for how tree printing is supposed to work | printSubNodes | {
"repo_name": "apache/derby",
"path": "java/org.apache.derby.engine/org/apache/derby/impl/sql/compile/HashTableNode.java",
"license": "apache-2.0",
"size": 13525
} | [
"org.apache.derby.shared.common.sanity.SanityManager"
] | import org.apache.derby.shared.common.sanity.SanityManager; | import org.apache.derby.shared.common.sanity.*; | [
"org.apache.derby"
] | org.apache.derby; | 1,082,983 |
@Test
public void testAsBytes() throws Exception {
result = maximumBandwidth.asBytes();
assertThat(result, is(notNullValue()));
} | void function() throws Exception { result = maximumBandwidth.asBytes(); assertThat(result, is(notNullValue())); } | /**
* Tests asBytes() method.
*/ | Tests asBytes() method | testAsBytes | {
"repo_name": "sonu283304/onos",
"path": "protocols/ospf/protocol/src/test/java/org/onosproject/ospf/protocol/lsa/linksubtype/MaximumBandwidthTest.java",
"license": "apache-2.0",
"size": 2691
} | [
"org.hamcrest.MatcherAssert",
"org.hamcrest.Matchers"
] | import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; | import org.hamcrest.*; | [
"org.hamcrest"
] | org.hamcrest; | 79,437 |
private static boolean notSkipTests(String propertyName) {
return !Boolean.getBoolean("hpiTest.skip"+propertyName);
}
public static class OtherTests extends TestCase {
private final Map<String,?> params;
public OtherTests(String name, Map<String,?> params) {
super(name);
this.params = params;
} | static boolean function(String propertyName) { return !Boolean.getBoolean(STR+propertyName); } public static class OtherTests extends TestCase { private final Map<String,?> params; public OtherTests(String name, Map<String,?> params) { super(name); this.params = params; } | /**
* Provides an escape hatch for plugin developers to skip auto-generated tests.
*/ | Provides an escape hatch for plugin developers to skip auto-generated tests | notSkipTests | {
"repo_name": "mattclark/jenkins",
"path": "test/src/main/java/org/jvnet/hudson/test/PluginAutomaticTestBuilder.java",
"license": "mit",
"size": 4088
} | [
"java.util.Map",
"junit.framework.TestCase"
] | import java.util.Map; import junit.framework.TestCase; | import java.util.*; import junit.framework.*; | [
"java.util",
"junit.framework"
] | java.util; junit.framework; | 2,474,947 |
if (transaction == null) {
return KFSConstants.EMPTY_STRING;
}
String docNumber = transaction.getDocumentNumber();
String originationCode = transaction.getFinancialSystemOriginationCode();
return getUrl(originationCode, docNumber);
} | if (transaction == null) { return KFSConstants.EMPTY_STRING; } String docNumber = transaction.getDocumentNumber(); String originationCode = transaction.getFinancialSystemOriginationCode(); return getUrl(originationCode, docNumber); } | /**
* get the url of inquirable financial document for the given transaction
*
* @param transaction the business object that implements Transaction interface
* @return the url of inquirable financial document for the given transaction if the document is inquirable; otherwise, return
* empty string
*/ | get the url of inquirable financial document for the given transaction | getInquirableDocumentUrl | {
"repo_name": "Ariah-Group/Finance",
"path": "af_webapp/src/main/java/org/kuali/kfs/gl/businessobject/inquiry/InquirableFinancialDocument.java",
"license": "apache-2.0",
"size": 3368
} | [
"org.kuali.kfs.sys.KFSConstants"
] | import org.kuali.kfs.sys.KFSConstants; | import org.kuali.kfs.sys.*; | [
"org.kuali.kfs"
] | org.kuali.kfs; | 509,811 |
private static LinkedList<Personaje> copiaListaPersonaje(LinkedList<Personaje> lista) {
LinkedList<Personaje> listaRetorno = new LinkedList<>();
for (int i = 0; i < lista.size(); i++)
listaRetorno.add(lista.get(i));
return listaRetorno;
} | static LinkedList<Personaje> function(LinkedList<Personaje> lista) { LinkedList<Personaje> listaRetorno = new LinkedList<>(); for (int i = 0; i < lista.size(); i++) listaRetorno.add(lista.get(i)); return listaRetorno; } | /**
* Genera una copia de la lista de la alianza de los personajes. <br>
*
* @param lista
* Alianza. <br>
* @return Copia de la lista. <br>
*/ | Genera una copia de la lista de la alianza de los personajes. | copiaListaPersonaje | {
"repo_name": "LaInerteBarraDeCarbon/jrpg-2017a-dominio",
"path": "src/main/java/dominio/Alianza.java",
"license": "mit",
"size": 1919
} | [
"java.util.LinkedList"
] | import java.util.LinkedList; | import java.util.*; | [
"java.util"
] | java.util; | 1,693,428 |
private Element findNext() {
if (next == null) {
while (i < length) {
Node node = elements.item(i++);
if (node.getNodeType() == Node.ELEMENT_NODE) {
next = (Element) node;
break;
}
}
}
return next;
} | Element function() { if (next == null) { while (i < length) { Node node = elements.item(i++); if (node.getNodeType() == Node.ELEMENT_NODE) { next = (Element) node; break; } } } return next; } | /**
* Find next element, skipping all non-element nodes
*/ | Find next element, skipping all non-element nodes | findNext | {
"repo_name": "jOOQ/jOOX",
"path": "jOOX-java-8/src/main/java/org/joox/Elements.java",
"license": "apache-2.0",
"size": 2127
} | [
"org.w3c.dom.Element",
"org.w3c.dom.Node"
] | import org.w3c.dom.Element; import org.w3c.dom.Node; | import org.w3c.dom.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 571,676 |
EClass getLetExp(); | EClass getLetExp(); | /**
* Returns the meta object for class '{@link anatlyzer.atlext.OCL.LetExp <em>Let Exp</em>}'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the meta object for class '<em>Let Exp</em>'.
* @see anatlyzer.atlext.OCL.LetExp
* @generated
*/ | Returns the meta object for class '<code>anatlyzer.atlext.OCL.LetExp Let Exp</code>'. | getLetExp | {
"repo_name": "jesusc/anatlyzer",
"path": "plugins/anatlyzer.atl.typing/src-gen/anatlyzer/atlext/OCL/OCLPackage.java",
"license": "epl-1.0",
"size": 484377
} | [
"org.eclipse.emf.ecore.EClass"
] | import org.eclipse.emf.ecore.EClass; | import org.eclipse.emf.ecore.*; | [
"org.eclipse.emf"
] | org.eclipse.emf; | 1,621,592 |
public static void main(String[] args) {
try {
TreeReader tr = new PennTreeReader(new StringReader("(S (NP (NNP Sam)) (VP (VBD died) (NP (NN today))))"), new LabeledScoredTreeFactory());
Tree t = tr.readTree();
System.out.println(t);
TreeGraphNode tgn = new TreeGraphNode(t, (TreeGraphNode) null);
System.out.println(tgn.toPrettyString(0));
tgn.indexNodes();
System.out.println(tgn.toPrettyString(0));
tgn.percolateHeads(new SemanticHeadFinder());
System.out.println(tgn.toPrettyString(0));
} catch (Exception e) {
System.err.println("Horrible error: " + e);
e.printStackTrace();
}
}
// Automatically generated by Eclipse
private static final long serialVersionUID = 5080098143617475328L; | static void function(String[] args) { try { TreeReader tr = new PennTreeReader(new StringReader(STR), new LabeledScoredTreeFactory()); Tree t = tr.readTree(); System.out.println(t); TreeGraphNode tgn = new TreeGraphNode(t, (TreeGraphNode) null); System.out.println(tgn.toPrettyString(0)); tgn.indexNodes(); System.out.println(tgn.toPrettyString(0)); tgn.percolateHeads(new SemanticHeadFinder()); System.out.println(tgn.toPrettyString(0)); } catch (Exception e) { System.err.println(STR + e); e.printStackTrace(); } } private static final long serialVersionUID = 5080098143617475328L; | /**
* Just for testing.
*/ | Just for testing | main | {
"repo_name": "FabianFriedrich/Text2Process",
"path": "Stanford parser/stanford-parser-2010-08-16/src/edu/stanford/nlp/trees/TreeGraphNode.java",
"license": "gpl-3.0",
"size": 24954
} | [
"java.io.StringReader"
] | import java.io.StringReader; | import java.io.*; | [
"java.io"
] | java.io; | 490,883 |
protected void setUp() throws Exception {
ArchiverImpl.sharedArchiver(key, getInstrumentation().getTargetContext());
// Initialize QueryEncoder
queryEncoder = new QueryEncoder(key, clientType, userAgent);
} | void function() throws Exception { ArchiverImpl.sharedArchiver(key, getInstrumentation().getTargetContext()); queryEncoder = new QueryEncoder(key, clientType, userAgent); } | /**
* *********************************************
* Setup and tear down
* **********************************************
*/ | Setup and tear down | setUp | {
"repo_name": "kissmetrics/KISSmetrics-Android-SDK",
"path": "src/androidTest/java/com/kissmetrics/sdk/ArchiverImplActTest.java",
"license": "apache-2.0",
"size": 42501
} | [
"com.kissmetrics.sdk.ArchiverImpl",
"com.kissmetrics.sdk.QueryEncoder"
] | import com.kissmetrics.sdk.ArchiverImpl; import com.kissmetrics.sdk.QueryEncoder; | import com.kissmetrics.sdk.*; | [
"com.kissmetrics.sdk"
] | com.kissmetrics.sdk; | 636,451 |
@Deprecated
public Query build(String sql, Object... params) throws SQLException {
return new Query(sql, params);
} | Query function(String sql, Object... params) throws SQLException { return new Query(sql, params); } | /**
* Builds a generic SQL query for the record and quotes identifiers from the
* given parameters according to the SQL dialect of the mapped database of
* the record.
*
* @deprecated Use Query constructor directly
* @param sql
* the Jorm SQL statement to represent the query.
* @param params
* the parameters applying to the SQL hash markup.
* @return the built query.
* @throws SQLException
*/ | Builds a generic SQL query for the record and quotes identifiers from the given parameters according to the SQL dialect of the mapped database of the record | build | {
"repo_name": "jajja/jorm",
"path": "src/main/java/com/jajja/jorm/Transaction.java",
"license": "mit",
"size": 84462
} | [
"java.sql.SQLException"
] | import java.sql.SQLException; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,420,964 |
protected int getFirstCompleteLineOfRegion(IRegion region, IDocument document) {
try {
int startLine= document.getLineOfOffset(region.getOffset());
int offset= document.getLineOffset(startLine);
if (offset >= region.getOffset())
return startLine;
offset= document.getLineOffset(startLine + 1);
return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1);
} catch (BadLocationException x) {
// should not happen
log.error(x.getMessage(), x);
}
return -1;
} | int function(IRegion region, IDocument document) { try { int startLine= document.getLineOfOffset(region.getOffset()); int offset= document.getLineOffset(startLine); if (offset >= region.getOffset()) return startLine; offset= document.getLineOffset(startLine + 1); return (offset > region.getOffset() + region.getLength() ? -1 : startLine + 1); } catch (BadLocationException x) { log.error(x.getMessage(), x); } return -1; } | /**
* Returns the index of the first line whose start offset is in the given text range.
*
* @param region the text range in characters where to find the line
* @param document The document
* @return the first line whose start index is in the given range, -1 if there is no such line
* @since 2.1
*/ | Returns the index of the first line whose start offset is in the given text range | getFirstCompleteLineOfRegion | {
"repo_name": "JKatzwinkel/bts",
"path": "org.eclipse.xtext.ui/src/org/eclipse/xtext/ui/editor/toggleComments/ToggleSLCommentAction.java",
"license": "lgpl-3.0",
"size": 10972
} | [
"org.eclipse.jface.text.BadLocationException",
"org.eclipse.jface.text.IDocument",
"org.eclipse.jface.text.IRegion"
] | import org.eclipse.jface.text.BadLocationException; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IRegion; | import org.eclipse.jface.text.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 2,106,888 |
public CreateServiceInstanceRequestBuilder context(Context context) {
this.context = context;
return this;
} | CreateServiceInstanceRequestBuilder function(Context context) { this.context = context; return this; } | /**
* Set the {@link Context} as would be provided in the request from the platform.
*
* @param context the context
* @return the builder
* @see #getContext()
*/ | Set the <code>Context</code> as would be provided in the request from the platform | context | {
"repo_name": "spring-cloud/spring-cloud-cloudfoundry-service-broker",
"path": "spring-cloud-open-service-broker-core/src/main/java/org/springframework/cloud/servicebroker/model/instance/CreateServiceInstanceRequest.java",
"license": "apache-2.0",
"size": 18778
} | [
"org.springframework.cloud.servicebroker.model.Context"
] | import org.springframework.cloud.servicebroker.model.Context; | import org.springframework.cloud.servicebroker.model.*; | [
"org.springframework.cloud"
] | org.springframework.cloud; | 2,708,377 |
public Iterator idMappingsIt() {
return idMappings.iterator();
} | Iterator function() { return idMappings.iterator(); } | /**
* Returns an iterator over the id mappings.
*/ | Returns an iterator over the id mappings | idMappingsIt | {
"repo_name": "unkascrack/compass-fork",
"path": "compass-gps/src/main/java/org/compass/gps/device/jdbc/mapping/ResultSetToResourceMapping.java",
"license": "apache-2.0",
"size": 11306
} | [
"java.util.Iterator"
] | import java.util.Iterator; | import java.util.*; | [
"java.util"
] | java.util; | 1,713,690 |
public static void showNoTokenDialogOrRedirect(final Context context, final String url) {
if (hasAPICredentials()) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(R.string.no_flattr_token_title);
builder.setMessage(R.string.no_flattr_token_msg);
builder.setPositiveButton(R.string.authenticate_now_label,
new OnClickListener() { | static void function(final Context context, final String url) { if (hasAPICredentials()) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.no_flattr_token_title); builder.setMessage(R.string.no_flattr_token_msg); builder.setPositiveButton(R.string.authenticate_now_label, new OnClickListener() { | /**
* Opens a dialog that ask the user to either connect the app with flattr or to be redirected to
* the thing's website.
* If no API credentials are available, the user will immediately be redirected to the thing's website.
*/ | Opens a dialog that ask the user to either connect the app with flattr or to be redirected to the thing's website. If no API credentials are available, the user will immediately be redirected to the thing's website | showNoTokenDialogOrRedirect | {
"repo_name": "the100rabh/AntennaPod",
"path": "core/src/main/java/de/danoeh/antennapod/core/util/flattr/FlattrUtils.java",
"license": "mit",
"size": 9201
} | [
"android.app.AlertDialog",
"android.content.Context",
"android.content.DialogInterface"
] | import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; | import android.app.*; import android.content.*; | [
"android.app",
"android.content"
] | android.app; android.content; | 214,863 |
protected Message handleFlexClientPollCommand(FlexClient flexClient, CommandMessage pollCommand)
{
if (Log.isDebug())
Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug(
"Before handling general client poll request. " + StringUtils.NEWLINE +
" incomingMessage: " + pollCommand + StringUtils.NEWLINE);
FlushResult flushResult = handleFlexClientPoll(flexClient, pollCommand);
Message pollResponse = null;
// Generate a no-op poll response if necessary; prevents a single client from busy polling when the server
// is doing wait()-based long-polls.
if ((flushResult instanceof PollFlushResult) && ((PollFlushResult)flushResult).isClientProcessingSuppressed())
{
pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION);
pollResponse.setHeader(CommandMessage.NO_OP_POLL_HEADER, Boolean.TRUE);
}
if (pollResponse == null)
{
List<Message> messagesToReturn = (flushResult != null) ? flushResult.getMessages() : null;
if (messagesToReturn != null && !messagesToReturn.isEmpty())
{
pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION);
pollResponse.setBody(messagesToReturn.toArray());
}
else
{
pollResponse = new AcknowledgeMessage();
}
}
// Set the adaptive poll wait time if necessary.
if (flushResult != null)
{
int nextFlushWaitTime = flushResult.getNextFlushWaitTimeMillis();
if (nextFlushWaitTime > 0)
pollResponse.setHeader(CommandMessage.POLL_WAIT_HEADER, new Integer(nextFlushWaitTime));
}
if (Log.isDebug())
{
String debugPollResult = Log.getPrettyPrinter().prettify(pollResponse);
Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug(
"After handling general client poll request. " + StringUtils.NEWLINE +
" reply: " + debugPollResult + StringUtils.NEWLINE);
}
return pollResponse;
} | Message function(FlexClient flexClient, CommandMessage pollCommand) { if (Log.isDebug()) Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( STR + StringUtils.NEWLINE + STR + pollCommand + StringUtils.NEWLINE); FlushResult flushResult = handleFlexClientPoll(flexClient, pollCommand); Message pollResponse = null; if ((flushResult instanceof PollFlushResult) && ((PollFlushResult)flushResult).isClientProcessingSuppressed()) { pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION); pollResponse.setHeader(CommandMessage.NO_OP_POLL_HEADER, Boolean.TRUE); } if (pollResponse == null) { List<Message> messagesToReturn = (flushResult != null) ? flushResult.getMessages() : null; if (messagesToReturn != null && !messagesToReturn.isEmpty()) { pollResponse = new CommandMessage(CommandMessage.CLIENT_SYNC_OPERATION); pollResponse.setBody(messagesToReturn.toArray()); } else { pollResponse = new AcknowledgeMessage(); } } if (flushResult != null) { int nextFlushWaitTime = flushResult.getNextFlushWaitTimeMillis(); if (nextFlushWaitTime > 0) pollResponse.setHeader(CommandMessage.POLL_WAIT_HEADER, new Integer(nextFlushWaitTime)); } if (Log.isDebug()) { String debugPollResult = Log.getPrettyPrinter().prettify(pollResponse); Log.getLogger(getMessageBroker().getLogCategory(pollCommand)).debug( STR + StringUtils.NEWLINE + STR + debugPollResult + StringUtils.NEWLINE); } return pollResponse; } | /**
* Handles a general poll request from a FlexClient to this endpoint.
* Subclasses may override to implement different poll handling strategies.
*
* @param flexClient The FlexClient that issued the poll request.
* @param pollCommand The poll command from the client.
* @return The poll response message; either for success or fault.
*/ | Handles a general poll request from a FlexClient to this endpoint. Subclasses may override to implement different poll handling strategies | handleFlexClientPollCommand | {
"repo_name": "apache/flex-blazeds",
"path": "core/src/main/java/flex/messaging/endpoints/AbstractEndpoint.java",
"license": "apache-2.0",
"size": 59433
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 2,755,694 |
@Override
public int getMaxSize() {
return CachedData.MAX_SIZE;
} | int function() { return CachedData.MAX_SIZE; } | /**
* Maximum size of encoded data supported by this transcoder.
*
* @return {@code net.spy.memcached.CachedData#MAX_SIZE}.
*/ | Maximum size of encoded data supported by this transcoder | getMaxSize | {
"repo_name": "mrluo735/cas-5.1.0",
"path": "support/cas-server-support-memcached-ticket-registry/src/main/java/org/apereo/cas/ticket/registry/support/kryo/KryoTranscoder.java",
"license": "apache-2.0",
"size": 8813
} | [
"net.spy.memcached.CachedData"
] | import net.spy.memcached.CachedData; | import net.spy.memcached.*; | [
"net.spy.memcached"
] | net.spy.memcached; | 734,965 |
void setBorderRightColor( String color ) throws SemanticException; | void setBorderRightColor( String color ) throws SemanticException; | /**
* Set the color of the right side of the border.
*
* @param color
* @throws SemanticException
*/ | Set the color of the right side of the border | setBorderRightColor | {
"repo_name": "sguan-actuate/birt",
"path": "model/org.eclipse.birt.report.model/src/org/eclipse/birt/report/model/api/simpleapi/IStyle.java",
"license": "epl-1.0",
"size": 39595
} | [
"org.eclipse.birt.report.model.api.activity.SemanticException"
] | import org.eclipse.birt.report.model.api.activity.SemanticException; | import org.eclipse.birt.report.model.api.activity.*; | [
"org.eclipse.birt"
] | org.eclipse.birt; | 1,948,531 |
LongStream mapToLong(IntToLongFunction mapper); | LongStream mapToLong(IntToLongFunction mapper); | /**
* Returns a {@code LongStream} consisting of the results of applying the
* given function to the elements of this stream.
*
* <p>This is an <a href="package-summary.html#StreamOps">intermediate
* operation</a>.
*
* @param mapper a <a href="package-summary.html#NonInterference">non-interfering</a>,
* <a href="package-summary.html#Statelessness">stateless</a>
* function to apply to each element
* @return the new stream
*/ | Returns a LongStream consisting of the results of applying the given function to the elements of this stream. This is an intermediate operation | mapToLong | {
"repo_name": "universsky/openjdk",
"path": "jdk/src/java.base/share/classes/java/util/stream/IntStream.java",
"license": "gpl-2.0",
"size": 45410
} | [
"java.util.function.IntToLongFunction"
] | import java.util.function.IntToLongFunction; | import java.util.function.*; | [
"java.util"
] | java.util; | 13,868 |
private IgniteEx createCluster(int nodeCnt) throws Exception {
String grpName0 = "grp0";
String grpName1 = "grp1";
cacheCfgs = new CacheConfiguration[] {
cacheConfiguration("ch_0_0", grpName0, 10, 2),
cacheConfiguration("ch_0_1", grpName0, 10, 2),
cacheConfiguration("ch_0_2", grpName0, 10, 2),
cacheConfiguration("ch_1_0", grpName1, 10, 2),
cacheConfiguration("ch_1_1", grpName1, 10, 2),
};
IgniteEx crd = startGrids(nodeCnt);
crd.cluster().active(true);
populateCluster(crd, 10, "");
return crd;
} | IgniteEx function(int nodeCnt) throws Exception { String grpName0 = "grp0"; String grpName1 = "grp1"; cacheCfgs = new CacheConfiguration[] { cacheConfiguration(STR, grpName0, 10, 2), cacheConfiguration(STR, grpName0, 10, 2), cacheConfiguration(STR, grpName0, 10, 2), cacheConfiguration(STR, grpName1, 10, 2), cacheConfiguration(STR, grpName1, 10, 2), }; IgniteEx crd = startGrids(nodeCnt); crd.cluster().active(true); populateCluster(crd, 10, ""); return crd; } | /**
* Create and populate cluster.
*
* @param nodeCnt Node count.
* @return Coordinator.
* @throws Exception if any error occurs.
*/ | Create and populate cluster | createCluster | {
"repo_name": "samaitra/ignite",
"path": "modules/core/src/test/java/org/apache/ignite/internal/processors/cache/distributed/rebalancing/RebalanceStatisticsTest.java",
"license": "apache-2.0",
"size": 11884
} | [
"org.apache.ignite.configuration.CacheConfiguration",
"org.apache.ignite.internal.IgniteEx"
] | import org.apache.ignite.configuration.CacheConfiguration; import org.apache.ignite.internal.IgniteEx; | import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; | [
"org.apache.ignite"
] | org.apache.ignite; | 2,248,797 |
@Test
public void beforeMethod() throws Exception {
scanClasses(TestClass.class);
assertThat(applyConcept("testng:BeforeMethod").getStatus(), equalTo(SUCCESS));
store.beginTransaction();
List<Object> methods = query("match (m:BeforeMethod:TestNG:Method) return m").getColumn("m");
assertThat(methods, hasItem(methodDescriptor(TestClass.class, "before")));
store.commitTransaction();
} | void function() throws Exception { scanClasses(TestClass.class); assertThat(applyConcept(STR).getStatus(), equalTo(SUCCESS)); store.beginTransaction(); List<Object> methods = query(STR).getColumn("m"); assertThat(methods, hasItem(methodDescriptor(TestClass.class, STR))); store.commitTransaction(); } | /**
* Verifies the concept "testng:BeforeMethod".
*
* @throws IOException
* If the test fails.
* @throws AnalysisException
* If the test fails.
* @throws NoSuchMethodException
* If the test fails.
* @throws AnalysisException
* If the test fails.
*/ | Verifies the concept "testng:BeforeMethod" | beforeMethod | {
"repo_name": "khmarbaise/jqassistant",
"path": "plugin/testng/src/test/java/com/buschmais/jqassistant/plugin/testng/test/TestNGIT.java",
"license": "gpl-3.0",
"size": 7112
} | [
"com.buschmais.jqassistant.plugin.testng.test.set.test.TestClass",
"java.util.List",
"org.hamcrest.CoreMatchers",
"org.junit.Assert"
] | import com.buschmais.jqassistant.plugin.testng.test.set.test.TestClass; import java.util.List; import org.hamcrest.CoreMatchers; import org.junit.Assert; | import com.buschmais.jqassistant.plugin.testng.test.set.test.*; import java.util.*; import org.hamcrest.*; import org.junit.*; | [
"com.buschmais.jqassistant",
"java.util",
"org.hamcrest",
"org.junit"
] | com.buschmais.jqassistant; java.util; org.hamcrest; org.junit; | 1,466,903 |
@Override
public void policyServing(ServingPolicy policy) {
policy = this.wrapServingPolicy(policy);
super.policyServing(policy);
} | void function(ServingPolicy policy) { policy = this.wrapServingPolicy(policy); super.policyServing(policy); } | /**
* The specified policy is automatically wrapped by a
* {@link ComponentServingPolicy} to handle non-functional method calls
* properly. This wrapping behavior could be redefined (and thus removed) by
* overriding the method
* {@link ComponentMultiActiveService#wrapServingPolicy(ServingPolicy)}.
*/ | The specified policy is automatically wrapped by a <code>ComponentServingPolicy</code> to handle non-functional method calls properly. This wrapping behavior could be redefined (and thus removed) by overriding the method <code>ComponentMultiActiveService#wrapServingPolicy(ServingPolicy)</code> | policyServing | {
"repo_name": "jrochas/scale-proactive",
"path": "src/Core/org/objectweb/proactive/multiactivity/component/ComponentMultiActiveService.java",
"license": "agpl-3.0",
"size": 7402
} | [
"org.objectweb.proactive.multiactivity.policy.ServingPolicy"
] | import org.objectweb.proactive.multiactivity.policy.ServingPolicy; | import org.objectweb.proactive.multiactivity.policy.*; | [
"org.objectweb.proactive"
] | org.objectweb.proactive; | 45,401 |
public void setStatusBarTintEnabled(boolean enabled) {
mStatusBarTintEnabled = enabled;
if (mStatusBarAvailable) {
mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE);
}
} | void function(boolean enabled) { mStatusBarTintEnabled = enabled; if (mStatusBarAvailable) { mStatusBarTintView.setVisibility(enabled ? View.VISIBLE : View.GONE); } } | /**
* Enable tinting of the system status bar.
*
* If the platform is running Jelly Bean or earlier, or translucent system
* UI modes have not been enabled in either the theme or via window flags,
* then this method does nothing.
*
* @param enabled True to enable tinting, false to disable it (default).
*/ | Enable tinting of the system status bar. If the platform is running Jelly Bean or earlier, or translucent system UI modes have not been enabled in either the theme or via window flags, then this method does nothing | setStatusBarTintEnabled | {
"repo_name": "cowthan/Ayo2022",
"path": "Ayo/app-talker/src/main/java/com/zebdar/tom/SystemBarTintManager.java",
"license": "mit",
"size": 19419
} | [
"android.view.View"
] | import android.view.View; | import android.view.*; | [
"android.view"
] | android.view; | 1,385,509 |
public void setImage(String src, int width, int height) {
if (!TextUtils.equals(mSrc, src) || mWidth != width || mHeight != height) {
mSrc = src;
mWidth = width;
mHeight = height;
onImageChanged(src, width, height);
}
} | void function(String src, int width, int height) { if (!TextUtils.equals(mSrc, src) mWidth != width mHeight != height) { mSrc = src; mWidth = width; mHeight = height; onImageChanged(src, width, height); } } | /**
* Sets a new image to be shown.
*
* @param src A web address or Blockly reference to the image.
* @param width The display width of the image in dips.
* @param height The display height of the image in dips.
*/ | Sets a new image to be shown | setImage | {
"repo_name": "rohlfingt/blockly-android",
"path": "blocklylib-core/src/main/java/com/google/blockly/model/FieldImage.java",
"license": "apache-2.0",
"size": 4007
} | [
"android.text.TextUtils"
] | import android.text.TextUtils; | import android.text.*; | [
"android.text"
] | android.text; | 2,118,863 |
public List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>> getRelationshipIsFormedOf(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException {
List<Object> args = new ArrayList<Object>();
args.add(ids);
args.add(fromFields);
args.add(relFields);
args.add(toFields);
TypeReference<List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>>> retType = new TypeReference<List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>>>() {};
List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>> res = caller.jsonrpcCall("CDMI_EntityAPI.get_relationship_IsFormedOf", args, retType, true, false);
return res.get(0);
} | List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>> function(List<String> ids, List<String> fromFields, List<String> relFields, List<String> toFields) throws IOException, JsonClientException { List<Object> args = new ArrayList<Object>(); args.add(ids); args.add(fromFields); args.add(relFields); args.add(toFields); TypeReference<List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>>> retType = new TypeReference<List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>>>() {}; List<List<Tuple3<FieldsAtomicRegulon, FieldsIsFormedOf, FieldsFeature>>> res = caller.jsonrpcCall(STR, args, retType, true, false); return res.get(0); } | /**
* <p>Original spec-file function name: get_relationship_IsFormedOf</p>
* <pre>
* This relationship connects each feature to the atomic regulon to
* which it belongs.
* It has the following fields:
* =over 4
* =back
* </pre>
* @param ids instance of list of String
* @param fromFields instance of list of String
* @param relFields instance of list of String
* @param toFields instance of list of String
* @return instance of list of tuple of size 3: type {@link us.kbase.cdmientityapi.FieldsAtomicRegulon FieldsAtomicRegulon} (original type "fields_AtomicRegulon"), type {@link us.kbase.cdmientityapi.FieldsIsFormedOf FieldsIsFormedOf} (original type "fields_IsFormedOf"), type {@link us.kbase.cdmientityapi.FieldsFeature FieldsFeature} (original type "fields_Feature")
* @throws IOException if an IO exception occurs
* @throws JsonClientException if a JSON RPC exception occurs
*/ | Original spec-file function name: get_relationship_IsFormedOf <code> This relationship connects each feature to the atomic regulon to which it belongs. It has the following fields: =over 4 =back </code> | getRelationshipIsFormedOf | {
"repo_name": "kbase/trees",
"path": "src/us/kbase/cdmientityapi/CDMIEntityAPIClient.java",
"license": "mit",
"size": 869221
} | [
"com.fasterxml.jackson.core.type.TypeReference",
"java.io.IOException",
"java.util.ArrayList",
"java.util.List",
"us.kbase.common.service.JsonClientException",
"us.kbase.common.service.Tuple3"
] | import com.fasterxml.jackson.core.type.TypeReference; import java.io.IOException; import java.util.ArrayList; import java.util.List; import us.kbase.common.service.JsonClientException; import us.kbase.common.service.Tuple3; | import com.fasterxml.jackson.core.type.*; import java.io.*; import java.util.*; import us.kbase.common.service.*; | [
"com.fasterxml.jackson",
"java.io",
"java.util",
"us.kbase.common"
] | com.fasterxml.jackson; java.io; java.util; us.kbase.common; | 1,967,657 |
private static List<JobInstance> getHostAffinityEnabledJobs(File localStoreDirFile) {
List<JobInstance> jobInstances = new ArrayList<>();
for (File jobStore : localStoreDirFile.listFiles(File::isDirectory)) {
// Name of the jobStore(jobStorePath) is of the form : ${job.name}-${job.id}.
String jobStorePath = jobStore.getName();
int indexSeparator = jobStorePath.lastIndexOf("-");
if (indexSeparator != -1) {
jobInstances.add(new JobInstance(jobStorePath.substring(0, indexSeparator),
jobStorePath.substring(indexSeparator + 1)));
}
}
return jobInstances;
} | static List<JobInstance> function(File localStoreDirFile) { List<JobInstance> jobInstances = new ArrayList<>(); for (File jobStore : localStoreDirFile.listFiles(File::isDirectory)) { String jobStorePath = jobStore.getName(); int indexSeparator = jobStorePath.lastIndexOf("-"); if (indexSeparator != -1) { jobInstances.add(new JobInstance(jobStorePath.substring(0, indexSeparator), jobStorePath.substring(indexSeparator + 1))); } } return jobInstances; } | /**
* Helper method to find and return the list of host affinity enabled jobs on this NM.
* @param localStoreDirFile the location in which all stores of host affinity enabled jobs are persisted.
* @return the list of the host affinity enabled jobs that are installed on this NM.
*/ | Helper method to find and return the list of host affinity enabled jobs on this NM | getHostAffinityEnabledJobs | {
"repo_name": "TiVo/samza",
"path": "samza-rest/src/main/java/org/apache/samza/monitor/LocalStoreMonitor.java",
"license": "apache-2.0",
"size": 8110
} | [
"java.io.File",
"java.util.ArrayList",
"java.util.List",
"org.apache.samza.rest.proxy.job.JobInstance"
] | import java.io.File; import java.util.ArrayList; import java.util.List; import org.apache.samza.rest.proxy.job.JobInstance; | import java.io.*; import java.util.*; import org.apache.samza.rest.proxy.job.*; | [
"java.io",
"java.util",
"org.apache.samza"
] | java.io; java.util; org.apache.samza; | 438,351 |
public static List<File> listFilesInDir(final String dirPath) {
return listFilesInDir(dirPath, false);
} | static List<File> function(final String dirPath) { return listFilesInDir(dirPath, false); } | /**
* Return the files in directory.
* <p>Doesn't traverse subdirectories</p>
*
* @param dirPath The path of directory.
* @return the files in directory
*/ | Return the files in directory. Doesn't traverse subdirectories | listFilesInDir | {
"repo_name": "treason258/TreLibrary",
"path": "LovelyReaderAS/app/src/main/java/com/haoyang/lovelyreader/tre/util/FileUtils.java",
"license": "apache-2.0",
"size": 41121
} | [
"java.io.File",
"java.util.List"
] | import java.io.File; import java.util.List; | import java.io.*; import java.util.*; | [
"java.io",
"java.util"
] | java.io; java.util; | 852,600 |
public void addSwipeListener(SwipeListener listener) {
if (mListeners == null) {
mListeners = new ArrayList<SwipeListener>();
}
mListeners.add(listener);
} | void function(SwipeListener listener) { if (mListeners == null) { mListeners = new ArrayList<SwipeListener>(); } mListeners.add(listener); } | /**
* Add a callback to be invoked when a swipe event is sent to this view.
*
* @param listener the swipe listener to attach to this view
*/ | Add a callback to be invoked when a swipe event is sent to this view | addSwipeListener | {
"repo_name": "RunziiMo/grooo_android_client",
"path": "library/src/main/java/com/runzii/lib/SwipeBackLayout.java",
"license": "mit",
"size": 20670
} | [
"java.util.ArrayList"
] | import java.util.ArrayList; | import java.util.*; | [
"java.util"
] | java.util; | 85,060 |
@Override
public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
List<HtmlData> htmlDataList = super.getCustomActionUrls(businessObject, pkNames);
Map<String, String> documentTypes = getReverseDocumentTypeMap();
for (HtmlData htmlData : htmlDataList) {
if (StringUtils.isNotBlank(((AnchorHtmlData) htmlData).getHref())) {
String docType = StringUtils.substringBetween(((AnchorHtmlData) htmlData).getHref(), "documentTypeName=", "&");
if (StringUtils.isNotBlank(docType) && documentTypes.containsKey(docType)) {
((AnchorHtmlData) htmlData).setHref(((AnchorHtmlData) htmlData).getHref().replace(docType,
documentTypes.get(docType)));
}
}
}
return htmlDataList;
} | List<HtmlData> function(BusinessObject businessObject, List pkNames) { List<HtmlData> htmlDataList = super.getCustomActionUrls(businessObject, pkNames); Map<String, String> documentTypes = getReverseDocumentTypeMap(); for (HtmlData htmlData : htmlDataList) { if (StringUtils.isNotBlank(((AnchorHtmlData) htmlData).getHref())) { String docType = StringUtils.substringBetween(((AnchorHtmlData) htmlData).getHref(), STR, "&"); if (StringUtils.isNotBlank(docType) && documentTypes.containsKey(docType)) { ((AnchorHtmlData) htmlData).setHref(((AnchorHtmlData) htmlData).getHref().replace(docType, documentTypes.get(docType))); } } } return htmlDataList; } | /**
* Because the search results is using descriptive name, we need to reverse to use code in href.
* @see org.kuali.rice.kns.lookup.AbstractLookupableHelperServiceImpl#getCustomActionUrls(org.kuali.rice.krad.bo.BusinessObject, java.util.List)
*/ | Because the search results is using descriptive name, we need to reverse to use code in href | getCustomActionUrls | {
"repo_name": "rashikpolus/MIT_KC",
"path": "coeus-impl/src/main/java/edu/mit/kc/lookup/KcMitCustomAttributeLookupHelperServiceImpl.java",
"license": "agpl-3.0",
"size": 4970
} | [
"java.util.List",
"java.util.Map",
"org.apache.commons.lang.StringUtils",
"org.kuali.rice.kns.lookup.HtmlData",
"org.kuali.rice.krad.bo.BusinessObject"
] | import java.util.List; import java.util.Map; import org.apache.commons.lang.StringUtils; import org.kuali.rice.kns.lookup.HtmlData; import org.kuali.rice.krad.bo.BusinessObject; | import java.util.*; import org.apache.commons.lang.*; import org.kuali.rice.kns.lookup.*; import org.kuali.rice.krad.bo.*; | [
"java.util",
"org.apache.commons",
"org.kuali.rice"
] | java.util; org.apache.commons; org.kuali.rice; | 2,617,192 |
public Object deserialize(IDeserializationContext ctxt, XMLStreamReader xmlStreamReader)
throws BindingSetupException,
DeserializationException,
TypeConversionAdapterCreationException {
// Find the package name of the generated classes from context.
try {
Unmarshaller u = createUnmarshaller(ctxt);
return unmarshal(u, ctxt.getRootClass(), xmlStreamReader);
} catch (JAXBException e) {
throw new DeserializationException(e);
}
}
| Object function(IDeserializationContext ctxt, XMLStreamReader xmlStreamReader) throws BindingSetupException, DeserializationException, TypeConversionAdapterCreationException { try { Unmarshaller u = createUnmarshaller(ctxt); return unmarshal(u, ctxt.getRootClass(), xmlStreamReader); } catch (JAXBException e) { throw new DeserializationException(e); } } | /**
* Initiate deserialization of the specified payload passed in from the XMLStreamReader
* deserializer configuration information is passed in through the IDeserializationContextImpl.
*/ | Initiate deserialization of the specified payload passed in from the XMLStreamReader deserializer configuration information is passed in through the IDeserializationContextImpl | deserialize | {
"repo_name": "vthangathurai/SOA-Runtime",
"path": "binding-framework/src/main/java/org/ebayopensource/turmeric/runtime/binding/impl/jaxb/JAXBDeserializer.java",
"license": "apache-2.0",
"size": 6522
} | [
"javax.xml.bind.JAXBException",
"javax.xml.bind.Unmarshaller",
"javax.xml.stream.XMLStreamReader",
"org.ebayopensource.turmeric.runtime.binding.IDeserializationContext",
"org.ebayopensource.turmeric.runtime.binding.exception.BindingSetupException",
"org.ebayopensource.turmeric.runtime.binding.exception.De... | import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; import javax.xml.stream.XMLStreamReader; import org.ebayopensource.turmeric.runtime.binding.IDeserializationContext; import org.ebayopensource.turmeric.runtime.binding.exception.BindingSetupException; import org.ebayopensource.turmeric.runtime.binding.exception.DeserializationException; import org.ebayopensource.turmeric.runtime.binding.exception.TypeConversionAdapterCreationException; | import javax.xml.bind.*; import javax.xml.stream.*; import org.ebayopensource.turmeric.runtime.binding.*; import org.ebayopensource.turmeric.runtime.binding.exception.*; | [
"javax.xml",
"org.ebayopensource.turmeric"
] | javax.xml; org.ebayopensource.turmeric; | 2,884,308 |
public Class<? extends GraphPartitionerFactory<I, V, E>>
getGraphPartitionerFactoryClass() {
return graphPartitionerFactoryClass;
} | Class<? extends GraphPartitionerFactory<I, V, E>> function() { return graphPartitionerFactoryClass; } | /**
* Get the GraphPartitionerFactory
*
* @return GraphPartitionerFactory
*/ | Get the GraphPartitionerFactory | getGraphPartitionerFactoryClass | {
"repo_name": "basio/graph",
"path": "giraph-core/src/main/java/org/apache/giraph/conf/GiraphClasses.java",
"license": "apache-2.0",
"size": 22271
} | [
"org.apache.giraph.partition.GraphPartitionerFactory"
] | import org.apache.giraph.partition.GraphPartitionerFactory; | import org.apache.giraph.partition.*; | [
"org.apache.giraph"
] | org.apache.giraph; | 211,957 |
@Autowired
public void setConfiguration(SSCTargetConfiguration config) {
super.setGroupTemplateExpression(config.getGroupTemplateExpressionForSubmit());
super.setFields(config.getFieldsForSubmit());
super.setAppendedFields(config.getAppendedFieldsForSubmit());
setSscBugTrackerName(config.getSscBugTrackerName());
}
| void function(SSCTargetConfiguration config) { super.setGroupTemplateExpression(config.getGroupTemplateExpressionForSubmit()); super.setFields(config.getFieldsForSubmit()); super.setAppendedFields(config.getAppendedFieldsForSubmit()); setSscBugTrackerName(config.getSscBugTrackerName()); } | /**
* Autowire the configuration from the Spring configuration file.
* @param config
*/ | Autowire the configuration from the Spring configuration file | setConfiguration | {
"repo_name": "HPFOD/FoDBugTrackerUtility",
"path": "bugtracker-target-ssc/src/main/java/com/fortify/bugtracker/tgt/ssc/processor/SSCTargetProcessorSubmitIssues.java",
"license": "mit",
"size": 7303
} | [
"com.fortify.bugtracker.tgt.ssc.config.SSCTargetConfiguration"
] | import com.fortify.bugtracker.tgt.ssc.config.SSCTargetConfiguration; | import com.fortify.bugtracker.tgt.ssc.config.*; | [
"com.fortify.bugtracker"
] | com.fortify.bugtracker; | 1,431,443 |
public Point<S> getProjected() {
return projected;
} | Point<S> function() { return projected; } | /** Projected point.
* @return projected point, or null if there are no boundary
*/ | Projected point | getProjected | {
"repo_name": "happyjack27/autoredistrict",
"path": "src/org/apache/commons/math3/geometry/partitioning/BoundaryProjection.java",
"license": "gpl-3.0",
"size": 3049
} | [
"org.apache.commons.math3.geometry.Point"
] | import org.apache.commons.math3.geometry.Point; | import org.apache.commons.math3.geometry.*; | [
"org.apache.commons"
] | org.apache.commons; | 871,937 |
void setStatusScheme(List<String> scheme); | void setStatusScheme(List<String> scheme); | /**
* Sets the status scheme of this component
* @param scheme the status scheme
*/ | Sets the status scheme of this component | setStatusScheme | {
"repo_name": "lsmaira/gradle",
"path": "subprojects/core-api/src/main/java/org/gradle/api/artifacts/ComponentMetadataBuilder.java",
"license": "apache-2.0",
"size": 1636
} | [
"java.util.List"
] | import java.util.List; | import java.util.*; | [
"java.util"
] | java.util; | 1,441,174 |
@Test
public void testRegionCreation()
{
try {
createHARegion();
}
catch (Exception e) {
e.printStackTrace();
fail("Test failed due to " + e);
}
} | void function() { try { createHARegion(); } catch (Exception e) { e.printStackTrace(); fail(STR + e); } } | /**
* test no exception being thrown while creating an HARegion
*
*/ | test no exception being thrown while creating an HARegion | testRegionCreation | {
"repo_name": "sshcherbakov/incubator-geode",
"path": "gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/HARegionJUnitTest.java",
"license": "apache-2.0",
"size": 6470
} | [
"org.junit.Assert"
] | import org.junit.Assert; | import org.junit.*; | [
"org.junit"
] | org.junit; | 354,378 |
Set<String> getAllGroups(final HttpServletRequest httpServletRequest); | Set<String> getAllGroups(final HttpServletRequest httpServletRequest); | /**
* Gets all the groups available in the configured authentication type.
*
* <p>
* It also saves the fetched result in the session for further use.
*
* @param httpServletRequest {@link HttpServletRequest} request attribute used to save the fetched result in session.
* @return <code>NULL</code> in case of errors otherwise set of groups.
*/ | Gets all the groups available in the configured authentication type. It also saves the fetched result in the session for further use | getAllGroups | {
"repo_name": "ungerik/ephesoft",
"path": "Ephesoft_Community_Release_4.0.2.0/source/gxt/gxt-core/src/main/java/com/ephesoft/gxt/core/server/security/service/AuthorizationService.java",
"license": "agpl-3.0",
"size": 5722
} | [
"java.util.Set",
"javax.servlet.http.HttpServletRequest"
] | import java.util.Set; import javax.servlet.http.HttpServletRequest; | import java.util.*; import javax.servlet.http.*; | [
"java.util",
"javax.servlet"
] | java.util; javax.servlet; | 2,521,299 |
public void setInetAddress(String hostname) {
this.type = AttributeType.INET_ADDRESS;
try {
this.value = InetAddress.getByName(hostname);
} catch (Throwable exception) {
this.value = null;
}
this.assigned = this.value != null;
} | void function(String hostname) { this.type = AttributeType.INET_ADDRESS; try { this.value = InetAddress.getByName(hostname); } catch (Throwable exception) { this.value = null; } this.assigned = this.value != null; } | /**
* Set the value of this metadata.
*
* @param hostname the hostname
*/ | Set the value of this metadata | setInetAddress | {
"repo_name": "tpiotrow/afc",
"path": "advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java",
"license": "apache-2.0",
"size": 71013
} | [
"java.net.InetAddress"
] | import java.net.InetAddress; | import java.net.*; | [
"java.net"
] | java.net; | 678,866 |
public void setScrollableAreaLimit(BoundingBoxE6 boundingBox) {
mScrollableAreaBoundingBox = boundingBox;
// Clear scrollable area limit if null passed.
if (boundingBox == null) {
mScrollableAreaLimit = null;
return;
}
// Get NW/upper-left
final Point upperLeft = TileSystem.LatLongToPixelXY(boundingBox.getLatNorthE6() / 1E6,
boundingBox.getLonWestE6() / 1E6, MapViewConstants.MAXIMUM_ZOOMLEVEL, null);
// Get SE/lower-right
final Point lowerRight = TileSystem.LatLongToPixelXY(boundingBox.getLatSouthE6() / 1E6,
boundingBox.getLonEastE6() / 1E6, MapViewConstants.MAXIMUM_ZOOMLEVEL, null);
mScrollableAreaLimit = new Rect(upperLeft.x, upperLeft.y, lowerRight.x, lowerRight.y);
} | void function(BoundingBoxE6 boundingBox) { mScrollableAreaBoundingBox = boundingBox; if (boundingBox == null) { mScrollableAreaLimit = null; return; } final Point upperLeft = TileSystem.LatLongToPixelXY(boundingBox.getLatNorthE6() / 1E6, boundingBox.getLonWestE6() / 1E6, MapViewConstants.MAXIMUM_ZOOMLEVEL, null); final Point lowerRight = TileSystem.LatLongToPixelXY(boundingBox.getLatSouthE6() / 1E6, boundingBox.getLonEastE6() / 1E6, MapViewConstants.MAXIMUM_ZOOMLEVEL, null); mScrollableAreaLimit = new Rect(upperLeft.x, upperLeft.y, lowerRight.x, lowerRight.y); } | /**
* Set the map to limit it's scrollable view to the specified BoundingBoxE6. Note this does not
* limit zooming so it will be possible for the user to zoom to an area that is larger than the
* limited area.
*
* @param boundingBox
* A lat/long bounding box to limit scrolling to, or null to remove any scrolling
* limitations
*/ | Set the map to limit it's scrollable view to the specified BoundingBoxE6. Note this does not limit zooming so it will be possible for the user to zoom to an area that is larger than the limited area | setScrollableAreaLimit | {
"repo_name": "mozilla/osmdroid",
"path": "src/main/java/org/osmdroid/views/MapView.java",
"license": "apache-2.0",
"size": 42500
} | [
"android.graphics.Point",
"android.graphics.Rect",
"org.osmdroid.util.BoundingBoxE6",
"org.osmdroid.views.util.constants.MapViewConstants"
] | import android.graphics.Point; import android.graphics.Rect; import org.osmdroid.util.BoundingBoxE6; import org.osmdroid.views.util.constants.MapViewConstants; | import android.graphics.*; import org.osmdroid.util.*; import org.osmdroid.views.util.constants.*; | [
"android.graphics",
"org.osmdroid.util",
"org.osmdroid.views"
] | android.graphics; org.osmdroid.util; org.osmdroid.views; | 1,082,717 |
public static void checkGetInputStreamOK(Resource resource) throws IOException {
if(!resource.exists())
throw new IOException("file ["+resource.getPath()+"] does not exist");
if(resource.isDirectory())
throw new IOException("can't read directory ["+resource.getPath()+"] as a file");
} | static void function(Resource resource) throws IOException { if(!resource.exists()) throw new IOException(STR+resource.getPath()+STR); if(resource.isDirectory()) throw new IOException(STR+resource.getPath()+STR); } | /**
* check if getting a inputstream of the file is ok with the rules for the Resource interface, to not change this rules.
* @param resource
* @throws IOException
*/ | check if getting a inputstream of the file is ok with the rules for the Resource interface, to not change this rules | checkGetInputStreamOK | {
"repo_name": "modius/railo",
"path": "railo-java/railo-core/src/railo/commons/io/res/util/ResourceUtil.java",
"license": "lgpl-2.1",
"size": 46370
} | [
"java.io.IOException"
] | import java.io.IOException; | import java.io.*; | [
"java.io"
] | java.io; | 2,290,932 |
public SVGPathSegArcAbs createSVGPathSegArcAbs
(final float x_value, final float y_value,
final float r1_value, final float r2_value,
final float angle_value,
final boolean largeArcFlag_value,
final boolean sweepFlag_value) {
return new SVGPathSegArcAbs(){
protected float x = x_value;
protected float y = y_value;
protected float r1 = r1_value;
protected float r2 = r2_value;
protected float angle = angle_value;
protected boolean largeArcFlag = largeArcFlag_value;
protected boolean sweepFlag = sweepFlag_value; | SVGPathSegArcAbs function (final float x_value, final float y_value, final float r1_value, final float r2_value, final float angle_value, final boolean largeArcFlag_value, final boolean sweepFlag_value) { return new SVGPathSegArcAbs(){ protected float x = x_value; protected float y = y_value; protected float r1 = r1_value; protected float r2 = r2_value; protected float angle = angle_value; protected boolean largeArcFlag = largeArcFlag_value; protected boolean sweepFlag = sweepFlag_value; | /**
* <b>DOM</b>: Implements {@link
* SVGPathElement#createSVGPathSegArcAbs(float,float,float,float,float,boolean,boolean)}.
*/ | DOM: Implements <code>SVGPathElement#createSVGPathSegArcAbs(float,float,float,float,float,boolean,boolean)</code> | createSVGPathSegArcAbs | {
"repo_name": "Groostav/CMPT880-term-project",
"path": "intruder/benchs/batik/batik-1.7/sources/org/apache/batik/dom/svg/SVGOMPathElement.java",
"license": "apache-2.0",
"size": 31448
} | [
"org.w3c.dom.svg.SVGPathSegArcAbs"
] | import org.w3c.dom.svg.SVGPathSegArcAbs; | import org.w3c.dom.svg.*; | [
"org.w3c.dom"
] | org.w3c.dom; | 351,648 |
public DynamicArray setOrder(ByteOrder order) {
if (order != null)
this.order = order;
return this;
} | DynamicArray function(ByteOrder order) { if (order != null) this.order = order; return this; } | /**
* Modifies the array's byte order.
*
* @param order
* The new byte order
* @return This object
*/ | Modifies the array's byte order | setOrder | {
"repo_name": "arnaudpourbaix/creature-editor",
"path": "infinity-file-reader/src/main/java/com/pourbaix/infinity/util/DynamicArray.java",
"license": "gpl-3.0",
"size": 31630
} | [
"java.nio.ByteOrder"
] | import java.nio.ByteOrder; | import java.nio.*; | [
"java.nio"
] | java.nio; | 125,135 |
public ServiceFuture<CertificateBundle> deleteCertificateAsync(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) {
return ServiceFuture.fromResponse(deleteCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback);
} | ServiceFuture<CertificateBundle> function(String vaultBaseUrl, String certificateName, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName), serviceCallback); } | /**
* Deletes a certificate from a specified key vault.
*
* @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
* @param certificateName The name of the certificate.
* @param serviceCallback the async ServiceCallback to handle successful and failed responses.
* @return the {@link ServiceFuture} object
*/ | Deletes a certificate from a specified key vault | deleteCertificateAsync | {
"repo_name": "anudeepsharma/azure-sdk-for-java",
"path": "azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java",
"license": "mit",
"size": 399443
} | [
"com.microsoft.azure.keyvault.models.CertificateBundle",
"com.microsoft.rest.ServiceCallback",
"com.microsoft.rest.ServiceFuture"
] | import com.microsoft.azure.keyvault.models.CertificateBundle; import com.microsoft.rest.ServiceCallback; import com.microsoft.rest.ServiceFuture; | import com.microsoft.azure.keyvault.models.*; import com.microsoft.rest.*; | [
"com.microsoft.azure",
"com.microsoft.rest"
] | com.microsoft.azure; com.microsoft.rest; | 2,698,810 |
public static void closeStatement(final Statement st) {
if (st == null) {
return;
}
try {
st.close();
} catch (Exception e) {
if (LOG.isWarnEnabled()) LOG.warn("Error closing Statement: " + st, e);
}
} | static void function(final Statement st) { if (st == null) { return; } try { st.close(); } catch (Exception e) { if (LOG.isWarnEnabled()) LOG.warn(STR + st, e); } } | /**
* Close a Statement
*
* @param st a database Statement object
*/ | Close a Statement | closeStatement | {
"repo_name": "jhelmer-unicon/uPortal",
"path": "uPortal-rdbm/src/main/java/org/apereo/portal/jdbc/RDBMServices.java",
"license": "apache-2.0",
"size": 14584
} | [
"java.sql.Statement"
] | import java.sql.Statement; | import java.sql.*; | [
"java.sql"
] | java.sql; | 2,134,243 |
protected String getRwString() {
if (readable) {
if (writable) {
return READ_WRITE;
} else {
return READ_ONLY;
}
} else {
if (!writable) {
throw new RuntimeException("Property " + name +
" is neither readable nor writable");
}
return WRITE_ONLY;
}
}
}
protected final class ComponentInfo extends Feature {
// Inherits name and description
protected final Set<String> permissions;
protected final Set<String> libraries;
protected final Set<String> nativeLibraries;
protected final Set<String> assets;
protected final Set<String> classNameAndActionsBR;
protected final SortedMap<String, DesignerProperty> designerProperties;
protected final SortedMap<String, Property> properties;
protected final SortedMap<String, Method> methods;
protected final SortedMap<String, Event> events;
protected final boolean abstractClass;
protected final String displayName;
protected final String type;
protected boolean external;
private String helpDescription; // Shorter popup description
private String category;
private String categoryString;
private boolean simpleObject;
private boolean designerComponent;
private int version;
private boolean showOnPalette;
private boolean nonVisible;
private String iconName;
protected ComponentInfo(Element element) {
super(element.getSimpleName().toString(), // Short name
elementUtils.getDocComment(element),
"Component");
type = element.asType().toString();
displayName = getDisplayNameForComponentType(name);
permissions = Sets.newHashSet();
libraries = Sets.newHashSet();
nativeLibraries = Sets.newHashSet();
assets = Sets.newHashSet();
classNameAndActionsBR = Sets.newHashSet();
designerProperties = Maps.newTreeMap();
properties = Maps.newTreeMap();
methods = Maps.newTreeMap();
events = Maps.newTreeMap();
abstractClass = element.getModifiers().contains(Modifier.ABSTRACT);
external = false;
for (AnnotationMirror am : element.getAnnotationMirrors()) {
DeclaredType dt = am.getAnnotationType();
String annotationName = am.getAnnotationType().toString();
if (annotationName.equals(SimpleObject.class.getName())) {
simpleObject = true;
SimpleObject simpleObjectAnnotation = element.getAnnotation(SimpleObject.class);
external = simpleObjectAnnotation.external();
}
if (annotationName.equals(DesignerComponent.class.getName())) {
designerComponent = true;
DesignerComponent designerComponentAnnotation =
element.getAnnotation(DesignerComponent.class);
// Override javadoc description with explicit description
// if provided.
String explicitDescription = designerComponentAnnotation.description();
if (!explicitDescription.isEmpty()) {
description = explicitDescription;
}
// Set helpDescription to the designerHelpDescription field if
// provided; otherwise, use description
helpDescription = designerComponentAnnotation.designerHelpDescription();
if (helpDescription.isEmpty()) {
helpDescription = description;
}
category = designerComponentAnnotation.category().getName();
categoryString = designerComponentAnnotation.category().toString();
version = designerComponentAnnotation.version();
showOnPalette = designerComponentAnnotation.showOnPalette();
nonVisible = designerComponentAnnotation.nonVisible();
iconName = designerComponentAnnotation.iconName();
}
}
} | String function() { if (readable) { if (writable) { return READ_WRITE; } else { return READ_ONLY; } } else { if (!writable) { throw new RuntimeException(STR + name + STR); } return WRITE_ONLY; } } } protected final class ComponentInfo extends Feature { protected final Set<String> permissions; protected final Set<String> libraries; protected final Set<String> nativeLibraries; protected final Set<String> assets; protected final Set<String> classNameAndActionsBR; protected final SortedMap<String, DesignerProperty> designerProperties; protected final SortedMap<String, Property> properties; protected final SortedMap<String, Method> methods; protected final SortedMap<String, Event> events; protected final boolean abstractClass; protected final String displayName; protected final String type; protected boolean external; private String helpDescription; private String category; private String categoryString; private boolean simpleObject; private boolean designerComponent; private int version; private boolean showOnPalette; private boolean nonVisible; private String iconName; protected ComponentInfo(Element element) { super(element.getSimpleName().toString(), elementUtils.getDocComment(element), STR); type = element.asType().toString(); displayName = getDisplayNameForComponentType(name); permissions = Sets.newHashSet(); libraries = Sets.newHashSet(); nativeLibraries = Sets.newHashSet(); assets = Sets.newHashSet(); classNameAndActionsBR = Sets.newHashSet(); designerProperties = Maps.newTreeMap(); properties = Maps.newTreeMap(); methods = Maps.newTreeMap(); events = Maps.newTreeMap(); abstractClass = element.getModifiers().contains(Modifier.ABSTRACT); external = false; for (AnnotationMirror am : element.getAnnotationMirrors()) { DeclaredType dt = am.getAnnotationType(); String annotationName = am.getAnnotationType().toString(); if (annotationName.equals(SimpleObject.class.getName())) { simpleObject = true; SimpleObject simpleObjectAnnotation = element.getAnnotation(SimpleObject.class); external = simpleObjectAnnotation.external(); } if (annotationName.equals(DesignerComponent.class.getName())) { designerComponent = true; DesignerComponent designerComponentAnnotation = element.getAnnotation(DesignerComponent.class); String explicitDescription = designerComponentAnnotation.description(); if (!explicitDescription.isEmpty()) { description = explicitDescription; } helpDescription = designerComponentAnnotation.designerHelpDescription(); if (helpDescription.isEmpty()) { helpDescription = description; } category = designerComponentAnnotation.category().getName(); categoryString = designerComponentAnnotation.category().toString(); version = designerComponentAnnotation.version(); showOnPalette = designerComponentAnnotation.showOnPalette(); nonVisible = designerComponentAnnotation.nonVisible(); iconName = designerComponentAnnotation.iconName(); } } } | /**
* Returns a string indicating whether this property is readable and/or
* writable.
*
* @return one of "read-write", "read-only", or "write-only"
* @throws {@link RuntimeException} if the property is neither readable nor
* writable
*/ | Returns a string indicating whether this property is readable and/or writable | getRwString | {
"repo_name": "thilankam/appinventor-sources",
"path": "appinventor/components/src/com/google/appinventor/components/scripts/ComponentProcessor.java",
"license": "apache-2.0",
"size": 45864
} | [
"com.google.appinventor.components.annotations.DesignerComponent",
"com.google.appinventor.components.annotations.DesignerProperty",
"com.google.appinventor.components.annotations.SimpleObject",
"com.google.common.collect.Maps",
"com.google.common.collect.Sets",
"java.util.Set",
"java.util.SortedMap",
... | import com.google.appinventor.components.annotations.DesignerComponent; import com.google.appinventor.components.annotations.DesignerProperty; import com.google.appinventor.components.annotations.SimpleObject; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import java.util.Set; import java.util.SortedMap; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.type.DeclaredType; | import com.google.appinventor.components.annotations.*; import com.google.common.collect.*; import java.util.*; import javax.lang.model.element.*; import javax.lang.model.type.*; | [
"com.google.appinventor",
"com.google.common",
"java.util",
"javax.lang"
] | com.google.appinventor; com.google.common; java.util; javax.lang; | 2,770,350 |
@Test(expected = IOException.class)
public void testPolicyCtorFile() throws IOException {
ChaincodeEndorsementPolicy policy = new ChaincodeEndorsementPolicy();
policy.fromFile(new File("/does/not/exists"));
} | @Test(expected = IOException.class) void function() throws IOException { ChaincodeEndorsementPolicy policy = new ChaincodeEndorsementPolicy(); policy.fromFile(new File(STR)); } | /**
* Test method for {@link org.hyperledger.fabric.sdk.ChaincodeEndorsementPolicy#fromFile(File)} (java.io.File)}.
*
* @throws IOException
*/ | Test method for <code>org.hyperledger.fabric.sdk.ChaincodeEndorsementPolicy#fromFile(File)</code> (java.io.File)} | testPolicyCtorFile | {
"repo_name": "edumodule/backend",
"path": "fabric-sdk-java/src/test/java/org/hyperledger/fabric/sdk/ChaincodeEndorsementPolicyTest.java",
"license": "apache-2.0",
"size": 6469
} | [
"java.io.File",
"java.io.IOException",
"org.junit.Test"
] | import java.io.File; import java.io.IOException; import org.junit.Test; | import java.io.*; import org.junit.*; | [
"java.io",
"org.junit"
] | java.io; org.junit; | 940,907 |
public StorageDomainStaticDao getStorageDomainStaticDao() {
return getDao(StorageDomainStaticDao.class);
} | StorageDomainStaticDao function() { return getDao(StorageDomainStaticDao.class); } | /**
* Returns the singleton instance of {@link StorageDomainDao}.
*
* @return the dao
*/ | Returns the singleton instance of <code>StorageDomainDao</code> | getStorageDomainStaticDao | {
"repo_name": "jtux270/translate",
"path": "ovirt/3.6_source/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dal/dbbroker/DbFacade.java",
"license": "gpl-3.0",
"size": 42484
} | [
"org.ovirt.engine.core.dao.StorageDomainStaticDao"
] | import org.ovirt.engine.core.dao.StorageDomainStaticDao; | import org.ovirt.engine.core.dao.*; | [
"org.ovirt.engine"
] | org.ovirt.engine; | 2,876,174 |
public void addButton(Widget w) {
m_buttonPanel.add(w);
if (CmsCoreProvider.get().isIe7()) {
m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX);
}
} | void function(Widget w) { m_buttonPanel.add(w); if (CmsCoreProvider.get().isIe7()) { m_buttonPanel.getElement().getStyle().setWidth(m_buttonPanel.getWidgetCount() * 22, Unit.PX); } } | /**
* Adds a widget to the button panel.<p>
*
* @param w the widget to add
*/ | Adds a widget to the button panel | addButton | {
"repo_name": "serrapos/opencms-core",
"path": "src-gwt/org/opencms/gwt/client/ui/CmsListItemWidget.java",
"license": "lgpl-2.1",
"size": 34354
} | [
"com.google.gwt.dom.client.Style",
"com.google.gwt.user.client.ui.Widget",
"org.opencms.gwt.client.CmsCoreProvider"
] | import com.google.gwt.dom.client.Style; import com.google.gwt.user.client.ui.Widget; import org.opencms.gwt.client.CmsCoreProvider; | import com.google.gwt.dom.client.*; import com.google.gwt.user.client.ui.*; import org.opencms.gwt.client.*; | [
"com.google.gwt",
"org.opencms.gwt"
] | com.google.gwt; org.opencms.gwt; | 2,090,590 |
public TextViewer getTextViewer() {
return (TextViewer) getSourceViewer();
}
| TextViewer function() { return (TextViewer) getSourceViewer(); } | /**
* only for use by unit test code
*/ | only for use by unit test code | getTextViewer | {
"repo_name": "HebaKhaled/bridgepoint",
"path": "src/org.xtuml.bp.ui.text/src/org/xtuml/bp/ui/text/activity/ActivityEditor.java",
"license": "apache-2.0",
"size": 19230
} | [
"org.eclipse.jface.text.TextViewer"
] | import org.eclipse.jface.text.TextViewer; | import org.eclipse.jface.text.*; | [
"org.eclipse.jface"
] | org.eclipse.jface; | 611,058 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.