id stringlengths 7 14 | source stringlengths 135 41.2k | target stringlengths 36 20.4k | context_text stringlengths 183 4k | prompt_context stringlengths 0 1.52k | source_ctx stringlengths 198 41.2k | ctx_included bool 2
classes | static_status stringclasses 2
values | static_context stringlengths 1.96k 252k |
|---|---|---|---|---|---|---|---|---|
251068401_3 | class DateTimeUtils {
public static DateTime withStartOfQuarter(DateTime dateTime) {
int monthOfYear = dateTime.getMonthOfYear();
DateTime firstMonthOfQuarter;
if (monthOfYear >= DateTimeConstants.OCTOBER) {
firstMonthOfQuarter = dateTime.withMonthOfYear(DateTimeConstants.OCTOBE... | DateTime dateTime = DateTime.now();
DateTime startOfQuarter = DateTimeUtils.withStartOfQuarter(dateTime.withMonthOfYear(2));
Assert.assertEquals(1, startOfQuarter.monthOfYear().get());
startOfQuarter = DateTimeUtils.withStartOfQuarter(dateTime.withMonthOfYear(5));
Assert.assertE... | [FOCAL] public static DateTime DateTimeUtils.withStartOfQuarter(DateTime dateTime)
[CLASS] class DateTimeUtils
[METRICS] loc=14 cc=4 branches=3 loops=0 returns=1 throws=0 nesting=3
[CALLS-EXTERNAL] DateTime.getMonthOfYear/0, DateTime.withMonthOfYear/1, DateTime.withDayOfMonth/1
[PATH1] if(monthOfYear >= DateTimeConstan... | /* static context
[FOCAL] public static DateTime DateTimeUtils.withStartOfQuarter(DateTime dateTime)
[PATH1] if(monthOfYear >= DateTimeConstants.OCTOBER)=F -> if(monthOfYear >= DateTimeConstants.JULY)=F -> if(monthOfYear >= DateTimeConstants.APRIL)=T -> return firstMonthOfQuarter.withDayOfMonth(1)
[PATH2] if(monthOfYea... | /* static context
[FOCAL] public static DateTime DateTimeUtils.withStartOfQuarter(DateTime dateTime)
[PATH1] if(monthOfYear >= DateTimeConstants.OCTOBER)=F -> if(monthOfYear >= DateTimeConstants.JULY)=F -> if(monthOfYear >= DateTimeConstants.APRIL)=T -> return firstMonthOfQuarter.withDayOfMonth(1)
[PATH2] if(monthOfYea... | true | ok | {"focal": {"class": "DateTimeUtils", "name": "withStartOfQuarter", "signature": "DateTime withStartOfQuarter(DateTime dateTime)", "start_line": 3, "modifiers": "public static", "params": [{"name": "dateTime", "type": "DateTime"}], "return_type": "DateTime"}, "class_info": {"name": "DateTimeUtils", "kind": "class", "mod... |
252293371_1 | class TCNProtoUtil {
public static void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback) {
int from = readUShort(report, 64);
byte[] bstartTCK = Arrays.copyOfRange(report, 32, 64);
TCNProtoGen ratchet = new TCNProtoGen(report[68], getRvkfromReport(report), bstartTCK, from... | byte[] report = hex2Byte(TCNProtoGenTest.VALIDREPORT);
List<String> tcns = new LinkedList<>();
TCNProtoUtil.generateAllTCNsFromReport(report, x ->
tcns.add(byte2Hex(x))
);
assertArrayEquals(REPORTTCNS, tcns.toArray());
}
} | [FOCAL] public static void TCNProtoUtil.generateAllTCNsFromReport(byte[] report, INextTCNCallback callback)
[CLASS] class TCNProtoUtil
[METRICS] loc=11 cc=2 branches=0 loops=1 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] byte[] getRvkfromReport(byte[] report); int readUShort(byte[] report, int index)
[CALLS-EXTERNAL] ... | /* static context
[FOCAL] public static void TCNProtoUtil.generateAllTCNsFromReport(byte[] report, INextTCNCallback callback)
[PATH1] for(i < to)=T -> exit loop
[PATH2] for(i < to)=F
[INPUTS] branches=report | result=-
[COLLABORATORS] param callback:INextTCNCallback next/1
[CALLS-INTERNAL] byte[] getRvkfromReport(byte[... | /* static context
[FOCAL] public static void TCNProtoUtil.generateAllTCNsFromReport(byte[] report, INextTCNCallback callback)
[PATH1] for(i < to)=T -> exit loop
[PATH2] for(i < to)=F
[INPUTS] branches=report | result=-
[COLLABORATORS] param callback:INextTCNCallback next/1
[CALLS-INTERNAL] byte[] getRvkfromReport(byte[... | true | ok | {"focal": {"class": "TCNProtoUtil", "name": "generateAllTCNsFromReport", "signature": "void generateAllTCNsFromReport(byte[] report, INextTCNCallback callback)", "start_line": 3, "modifiers": "public static", "params": [{"name": "report", "type": "byte[]"}, {"name": "callback", "type": "INextTCNCallback"}], "return_typ... |
252902347_4 | class WebServerPortFileWriter implements ApplicationListener<WebServerInitializedEvent> {
@Override
public void onApplicationEvent(WebServerInitializedEvent event) {
File portFile = getPortFile(event.getApplicationContext());
try {
String port = String.valueOf(event.getWebServer().getPort());
createParentF... | File file = this.temporaryFolder.newFile();
file = new File(file.getParentFile(), file.getName().toUpperCase(Locale.ENGLISH));
WebServerPortFileWriter listener = new WebServerPortFileWriter(file);
listener.onApplicationEvent(mockEvent("management", 9090));
String managementFile = file.getName();
managementF... | [FOCAL] @Override public void WebServerPortFileWriter.onApplicationEvent(WebServerInitializedEvent event)
[CLASS] class WebServerPortFileWriter implements ApplicationListener<WebServerInitializedEvent>
[METRICS] loc=13 cc=2 branches=0 loops=0 returns=0 throws=0 nesting=1
[CALLS-INTERNAL] File getPortFile(ApplicationCon... | /* static context
[FOCAL] @Override public void WebServerPortFileWriter.onApplicationEvent(WebServerInitializedEvent event)
[PATH1] try-body throws
[COLLABORATORS] param event:WebServerInitializedEvent getApplicationContext/0,getWebServer/0
[EXCEPTIONS] catches Exception ex
[CALLS-INTERNAL] File getPortFile(Application... | /* static context
[FOCAL] @Override public void WebServerPortFileWriter.onApplicationEvent(WebServerInitializedEvent event)
[PATH1] try-body throws
[COLLABORATORS] param event:WebServerInitializedEvent getApplicationContext/0,getWebServer/0
[EXCEPTIONS] catches Exception ex
[CALLS-INTERNAL] File getPortFile(Application... | true | ok | {"focal": {"class": "WebServerPortFileWriter", "name": "onApplicationEvent", "signature": "void onApplicationEvent(WebServerInitializedEvent event)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "event", "type": "WebServerInitializedEvent"}], "return_type": "void"}, "class_info": {"name": "WebS... |
253269900_126 | class Fragment implements Iterable<Atom> {
List<Atom> getAtomList() {
return new ArrayList<Atom>(atomCollection);
}
Fragment(Element tokenEl);
Fragment(String type);
void addAtom(Atom atom);
int getAtomCount();
void addBond(Bond bond);
boolean removeBond(Bond bond);
Set<Bond> getBondSet();
int ... | Fragment dhp = fm.buildSMILES("c1cCccC1");
FragmentTools.convertSpareValenciesToDoubleBonds(dhp);
for(Atom a : dhp.getAtomList()) {
assertEquals("All atoms have no sv", false, a.hasSpareValency());
}
Fragment funnydiene = fm.buildSMILES("C(=C)C=C");
FragmentTools.convertSpareValenciesToDoubleBonds(funnyd... | [FOCAL] List<Atom> Fragment.getAtomList()
[CLASS] class Fragment implements Iterable<Atom>
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[NEW] ArrayList<Atom>
[CLASS-MEMBERS] Fragment(Element tokenEl); Fragment(String type); void addAtom(Atom atom); int getAtomCount(); void addBond(Bond bond); bo... | /* static context
[FOCAL] List<Atom> Fragment.getAtomList()
[NEW] ArrayList<Atom>
*/
| /* static context
[FOCAL] List<Atom> Fragment.getAtomList()
[NEW] ArrayList<Atom>
*/
class Fragment implements Iterable<Atom> {
List<Atom> getAtomList() {
return new ArrayList<Atom>(atomCollection);
}
Fragment(Element tokenEl);
Fragment(String type);
void addAtom(Atom atom);
int getAtomCount();
void ... | true | ok | {"focal": {"class": "Fragment", "name": "getAtomList", "signature": "List<Atom> getAtomList()", "start_line": 3, "modifiers": "", "params": [], "return_type": "List<Atom>"}, "class_info": {"name": "Fragment", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "Iterable<Atom>", "fields": [{"name": "frag... |
253595061_79 | class ReclaimerConfig {
public String validate()
{
List<String> validationIssues = new LinkedList<>();
if(maximumExecutionSeconds < 0)
validationIssues.add("maximumExecutionSeconds must be non-negative");
return validationIssues.size() == 0
? null
... | String validationResult = config.validate();
Assert.assertTrue(StringUtils.containsIgnoreCase(validationResult, EXPECTED_FRAGMENT));
}
} | [FOCAL] public String ReclaimerConfig.validate()
[CLASS] class ReclaimerConfig
[METRICS] loc=12 cc=2 branches=1 loops=0 returns=1 throws=0 nesting=1
[CALLS-EXTERNAL] List<String>.add/1, List<String>.size/0, String.join/2
[NEW] LinkedList<>
[PATH1] if(maximumExecutionSeconds < 0)=T -> return validationIssues.size() == 0... | /* static context
[FOCAL] public String ReclaimerConfig.validate()
[PATH1] if(maximumExecutionSeconds < 0)=T -> return validationIssues.size() == 0 ? null : String.join(",", validationIs...
[PATH2] if(maximumExecutionSeconds < 0)=F -> return validationIssues.size() == 0 ? null : String.join(",", validationIs...
[NEW] L... | /* static context
[FOCAL] public String ReclaimerConfig.validate()
[PATH1] if(maximumExecutionSeconds < 0)=T -> return validationIssues.size() == 0 ? null : String.join(",", validationIs...
[PATH2] if(maximumExecutionSeconds < 0)=F -> return validationIssues.size() == 0 ? null : String.join(",", validationIs...
[NEW] L... | true | ok | {"focal": {"class": "ReclaimerConfig", "name": "validate", "signature": "String validate()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "String"}, "class_info": {"name": "ReclaimerConfig", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [], "members": [{"nam... |
254264048_0 | class ParseEngine {
public static ASTNode parse(final String sql) {
ParseTree parseTree = createParseTree(sql);
return new SQLVisitor().visit(parseTree.getChild(0));
}
private static ParseTree createParseTree(final String sql);
}
class ParseEngineTest {
@Test
public void testPar... | String sql = "use sharding_db";
UseStatement useStatement = (UseStatement) ParseEngine.parse(sql);
assertThat(useStatement.getSchemeName().getIdentifier().getValue(), is("sharding_db"));
}
} | [FOCAL] public static ASTNode ParseEngine.parse(String sql)
[CLASS] class ParseEngine
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] ParseTree createParseTree(String sql)
[CALLS-EXTERNAL] new SQLVisitor().visit/1, ParseTree.getChild/1
[NEW] SQLVisitor
[INPUTS] branches=- | result=... | /* static context
[FOCAL] public static ASTNode ParseEngine.parse(String sql)
[INPUTS] branches=- | result=sql
[CALLS-INTERNAL] ParseTree createParseTree(String sql)
[NEW] SQLVisitor
[CALLS-EXTERNAL] new SQLVisitor().visit/1, ParseTree.getChild/1
*/
| /* static context
[FOCAL] public static ASTNode ParseEngine.parse(String sql)
[INPUTS] branches=- | result=sql
[CALLS-INTERNAL] ParseTree createParseTree(String sql)
[NEW] SQLVisitor
[CALLS-EXTERNAL] new SQLVisitor().visit/1, ParseTree.getChild/1
*/
class ParseEngine {
public static ASTNode parse(final String sql)... | true | ok | {"focal": {"class": "ParseEngine", "name": "parse", "signature": "ASTNode parse(String sql)", "start_line": 3, "modifiers": "public static", "params": [{"name": "sql", "type": "String"}], "return_type": "ASTNode"}, "class_info": {"name": "ParseEngine", "kind": "class", "modifiers": "", "superclass": null, "interfaces":... |
255469961_50 | class ExceptionHandlingControllerAdvice extends ResponseEntityExceptionHandler {
@ExceptionHandler(RuntimeException.class)
public ResponseEntity<Object> handleRuntimeException(RuntimeException exception) {
return new ResponseEntity<>(createResponseBody(exception.getMessage(), BAD_REQUEST), new HttpHead... | var exception = new RuntimeException("kaboom");
var expectedResponse = ApiErrorResponse.builder()
.status(BAD_REQUEST)
.message("kaboom")
.timeStamp(Instant.now(clock))
.build();
assertEquals(new ResponseEntity<>(expectedResponse, ... | [FOCAL] @ExceptionHandler(RuntimeException.class) public ResponseEntity<Object> ExceptionHandlingControllerAdvice.handleRuntimeException(RuntimeException exception)
[CLASS] class ExceptionHandlingControllerAdvice extends ResponseEntityExceptionHandler
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0... | /* static context
[FOCAL] @ExceptionHandler(RuntimeException.class) public ResponseEntity<Object> ExceptionHandlingControllerAdvice.handleRuntimeException(RuntimeException exception)
[INPUTS] branches=- | result=exception
[COLLABORATORS] param exception:RuntimeException getMessage/0
[CALLS-INTERNAL] ApiErrorResponse cr... | /* static context
[FOCAL] @ExceptionHandler(RuntimeException.class) public ResponseEntity<Object> ExceptionHandlingControllerAdvice.handleRuntimeException(RuntimeException exception)
[INPUTS] branches=- | result=exception
[COLLABORATORS] param exception:RuntimeException getMessage/0
[CALLS-INTERNAL] ApiErrorResponse cr... | true | ok | {"focal": {"class": "ExceptionHandlingControllerAdvice", "name": "handleRuntimeException", "signature": "ResponseEntity<Object> handleRuntimeException(RuntimeException exception)", "start_line": 3, "modifiers": "@ExceptionHandler(RuntimeException.class) public", "params": [{"name": "exception", "type": "RuntimeExceptio... |
255633533_25 | class ExecutionNodeCompiler {
static List<ExecutionNode> sort(List<ExecutionNode> nodes) {
// priority is initial order in the list, node earlier in the list
// would be always executed earlier if possible
Map<String, Integer> priorityMap = new HashMap<>();
Map<String, Integer> degreeMap = new HashMa... | ExecutionNode node1 = createExecutionNode("node-1", ImmutableList.of("node-2"));
VerifyException e =
assertThrows(
VerifyException.class, () -> ExecutionNodeCompiler.sort(ImmutableList.of(node1)));
Assert.assertEquals("workflow graph isn't connected or has a cycle", e.getMessage());
... | [FOCAL] static List<ExecutionNode> ExecutionNodeCompiler.sort(List<ExecutionNode> nodes)
[CLASS] class ExecutionNodeCompiler
[METRICS] loc=74 cc=9 branches=3 loops=5 returns=1 throws=0 nesting=4
[CALLS-EXTERNAL] ArrayListMultimap.create/0, List<ExecutionNode>.size/0, List<ExecutionNode>.get/1, Map<String, Integer>.put/... | /* static context
[FOCAL] static List<ExecutionNode> ExecutionNodeCompiler.sort(List<ExecutionNode> nodes)
[PATH1] for(i < nodes.size())=T -> foreach(String upstreamNodeId : node.upstreamNodeIds())=F -> exit loop -> while(!deque.isEmpty())=T -> foreach(String nodeId : nodeIds)=T -> if(!nodeId.equals(START_NODE_ID))=T -... | /* static context
[FOCAL] static List<ExecutionNode> ExecutionNodeCompiler.sort(List<ExecutionNode> nodes)
[PATH1] for(i < nodes.size())=T -> foreach(String upstreamNodeId : node.upstreamNodeIds())=F -> exit loop -> while(!deque.isEmpty())=T -> foreach(String nodeId : nodeIds)=T -> if(!nodeId.equals(START_NODE_ID))=T -... | true | ok | {"focal": {"class": "ExecutionNodeCompiler", "name": "sort", "signature": "List<ExecutionNode> sort(List<ExecutionNode> nodes)", "start_line": 3, "modifiers": "static", "params": [{"name": "nodes", "type": "List<ExecutionNode>"}], "return_type": "List<ExecutionNode>"}, "class_info": {"name": "ExecutionNodeCompiler", "k... |
256285632_3 | class SystemBleDevice implements IBleDevice {
@Override
public void stopScans(@NonNull ScanCallback scanCallback) {
try {
if (!bluetoothAdapter.isEnabled()) {
BeaconLogger.e(
"Can't stop the BLE scans since BluetoothAdapter is not enabled, most likely "
... | // given
when(adapter.getBluetoothLeScanner()).thenReturn(null);
when(adapter.isEnabled()).thenReturn(true);
// when
device.stopScans(scanCallback);
// then
verify(adapter).isEnabled();
verify(adapter).getBluetoothLeScanner();
verifyNoMoreInterac... | [FOCAL] @Override public void SystemBleDevice.stopScans(ScanCallback scanCallback)
[CLASS] class SystemBleDevice implements IBleDevice
[METRICS] loc=31 cc=4 branches=2 loops=0 returns=2 throws=0 nesting=2
[CALLS-EXTERNAL] bluetoothAdapter.isEnabled/0, BeaconLogger.e/1, bluetoothAdapter.getBluetoothLeScanner/0, Bluetoot... | /* static context
[FOCAL] @Override public void SystemBleDevice.stopScans(ScanCallback scanCallback)
[PATH1] if(!bluetoothAdapter.isEnabled())=F -> if(bleScanner == null)=T -> return
[PATH2] try-body throws
[PATH3] if(!bluetoothAdapter.isEnabled())=T -> return
[PATH4] if(!bluetoothAdapter.isEnabled())=F -> if(bleScanne... | /* static context
[FOCAL] @Override public void SystemBleDevice.stopScans(ScanCallback scanCallback)
[PATH1] if(!bluetoothAdapter.isEnabled())=F -> if(bleScanner == null)=T -> return
[PATH2] try-body throws
[PATH3] if(!bluetoothAdapter.isEnabled())=T -> return
[PATH4] if(!bluetoothAdapter.isEnabled())=F -> if(bleScanne... | true | ok | {"focal": {"class": "SystemBleDevice", "name": "stopScans", "signature": "void stopScans(ScanCallback scanCallback)", "start_line": 3, "modifiers": "@Override public", "params": [{"name": "scanCallback", "type": "ScanCallback"}], "return_type": "void"}, "class_info": {"name": "SystemBleDevice", "kind": "class", "modifi... |
257682134_30 | class PBKDF2 {
public static String createHash(String password, String salt, int iterations, int dkLen)
throws NoSuchAlgorithmException, InvalidKeySpecException {
byte[] saltBytes = salt.getBytes(StandardCharsets.UTF_8);
byte[] hash = pbkdf2(password.toCharArray(), saltBytes, iterations, dkLen);
return toHex... | try {
assertEquals(
"5a27c13513ac42482cce07a543293c56dbfe06deb56634c1f2c6bd1cdeaab1bd373e22861d1f6c6785a406f0d75a7f247f87666b02d08f142c9097e8d40e6f17",
PBKDF2.createHash("test input", "testsalt", 2, 512));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeySpecException... | [FOCAL] public static String PBKDF2.createHash(String password, String salt, int iterations, int dkLen)
[CLASS] class PBKDF2
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-INTERNAL] String toHex(byte[] array); byte[] pbkdf2(char[] password, byte[] salt, int iterations, int bits)
[CALLS-EXTE... | /* static context
[FOCAL] public static String PBKDF2.createHash(String password, String salt, int iterations, int dkLen)
[INPUTS] branches=- | result=dkLen, iterations, password, salt
[EXCEPTIONS] declares NoSuchAlgorithmException, InvalidKeySpecException
[CALLS-INTERNAL] String toHex(byte[] array); byte[] pbkdf2(char... | /* static context
[FOCAL] public static String PBKDF2.createHash(String password, String salt, int iterations, int dkLen)
[INPUTS] branches=- | result=dkLen, iterations, password, salt
[EXCEPTIONS] declares NoSuchAlgorithmException, InvalidKeySpecException
[CALLS-INTERNAL] String toHex(byte[] array); byte[] pbkdf2(char... | true | ok | {"focal": {"class": "PBKDF2", "name": "createHash", "signature": "String createHash(String password, String salt, int iterations, int dkLen) throws NoSuchAlgorithmException, InvalidKeySpecException", "start_line": 3, "modifiers": "public static", "params": [{"name": "password", "type": "String"}, {"name": "salt", "type... |
259639325_11 | class Tensor {
public void setOnCoord(Object value, int... coords) {
checkCoordsLength(coords);
if (value != null) {
if (this.isScalar()) {
this.data = value;
} else if (value.getClass().isArray()) {
this.setArrayOnCoord(value, coords);
... | Tensor tensor = new Tensor(DataType.INTEGER, new int[] {3, 2, 4});
EvaluationException exception = assertThrows(
EvaluationException.class,
() -> tensor.setOnCoord(4, 0, 0, -1)
);
assertEquals("Coordinates contained at least an undefined value : [0, 0, -1]", excep... | [FOCAL] public void Tensor.setOnCoord(Object value, int... coords)
[CLASS] class Tensor
[METRICS] loc=12 cc=4 branches=3 loops=0 returns=0 throws=0 nesting=3
[CALLS-INTERNAL] boolean isScalar(); void checkCoordsLength(int... coords); void setArrayOnCoord(Object value, int... coords); void setSingleOnCoord(Object value,... | /* static context
[FOCAL] public void Tensor.setOnCoord(Object value, int... coords)
[PATH1] if(value != null)=T -> if(this.isScalar())=F -> if(value.getClass().isArray())=T
[PATH2] if(value != null)=F
[PATH3] if(value != null)=T -> if(this.isScalar())=T
[PATH4] if(value != null)=T -> if(this.isScalar())=F -> if(value.... | /* static context
[FOCAL] public void Tensor.setOnCoord(Object value, int... coords)
[PATH1] if(value != null)=T -> if(this.isScalar())=F -> if(value.getClass().isArray())=T
[PATH2] if(value != null)=F
[PATH3] if(value != null)=T -> if(this.isScalar())=T
[PATH4] if(value != null)=T -> if(this.isScalar())=F -> if(value.... | true | ok | {"focal": {"class": "Tensor", "name": "setOnCoord", "signature": "void setOnCoord(Object value, int... coords)", "start_line": 3, "modifiers": "public", "params": [{"name": "value", "type": "Object"}, {"name": "coords", "type": "int..."}], "return_type": "void"}, "class_info": {"name": "Tensor", "kind": "class", "modif... |
259929534_5 | class BookController {
@DeleteMapping()
public ResponseEntity<Book> deleteAll() {
LOGGER.info("Delete all books");
books.clear();
return ResponseEntity.noContent().build();
}
@PostMapping public ResponseEntity<Book> create(@Valid @RequestBody BookRequest request);
@GetMappi... | MockHttpServletResponse response = deleteAll();
assertThat(response.getStatus(), is(HttpStatus.NO_CONTENT.value()));
}
} | [FOCAL] @DeleteMapping() public ResponseEntity<Book> BookController.deleteAll()
[CLASS] class BookController
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] LOGGER.info/1, books.clear/0, ResponseEntity.noContent().build/0, ResponseEntity.noContent/0
[COLLABORATORS] field books clea... | /* static context
[FOCAL] @DeleteMapping() public ResponseEntity<Book> BookController.deleteAll()
[COLLABORATORS] field books clear/0
[CALLS-EXTERNAL] LOGGER.info/1, books.clear/0, ResponseEntity.noContent().build/0, ResponseEntity.noContent/0
*/
| /* static context
[FOCAL] @DeleteMapping() public ResponseEntity<Book> BookController.deleteAll()
[COLLABORATORS] field books clear/0
[CALLS-EXTERNAL] LOGGER.info/1, books.clear/0, ResponseEntity.noContent().build/0, ResponseEntity.noContent/0
*/
class BookController {
@DeleteMapping()
public ResponseEntity<Bo... | true | ok | {"focal": {"class": "BookController", "name": "deleteAll", "signature": "ResponseEntity<Book> deleteAll()", "start_line": 3, "modifiers": "@DeleteMapping() public", "params": [], "return_type": "ResponseEntity<Book>"}, "class_info": {"name": "BookController", "kind": "class", "modifiers": "", "superclass": null, "inter... |
260172508_9 | class MmapChunkAllocator implements ChunkAllocator {
@Override
public void close() {
if (!isClosed.compareAndSet(false, true)) {
return;
}
// unmap and close file
for (Tuple2<RandomAccessFile, MappedByteBuffer> tuple : memoryMappedFiles) {
PlatformDependent.freeDirectBuffer(tuple.f1);
IOUtils.close... | File[] dirs = new File[3];
for (int i = 0; i < dirs.length; i++) {
dirs[i] = tempFolder.newFolder();
}
MmapChunkAllocator allocator =
new MmapChunkAllocator(10240, dirs, new Configuration());
for (File dir : dirs) {
Assert.assertTrue(new File(dir, MmapChunkAllocator.MMAP_DIR).exists());
}
alloc... | [FOCAL] @Override public void MmapChunkAllocator.close()
[CLASS] class MmapChunkAllocator implements ChunkAllocator
[METRICS] loc=15 cc=3 branches=1 loops=1 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] void removeCandidateDirectory(List<CandidateDirectory> directories)
[CALLS-EXTERNAL] isClosed.compareAndSet/2, Platfo... | /* static context
[FOCAL] @Override public void MmapChunkAllocator.close()
[PATH1] if(!isClosed.compareAndSet(false, true))=F -> foreach(Tuple2<RandomAccessFile, MappedByteBuffer> tuple : memoryMappedFiles)=T -> exit loop
[PATH2] if(!isClosed.compareAndSet(false, true))=T -> return
[PATH3] if(!isClosed.compareAndSet(fa... | /* static context
[FOCAL] @Override public void MmapChunkAllocator.close()
[PATH1] if(!isClosed.compareAndSet(false, true))=F -> foreach(Tuple2<RandomAccessFile, MappedByteBuffer> tuple : memoryMappedFiles)=T -> exit loop
[PATH2] if(!isClosed.compareAndSet(false, true))=T -> return
[PATH3] if(!isClosed.compareAndSet(fa... | true | ok | {"focal": {"class": "MmapChunkAllocator", "name": "close", "signature": "void close()", "start_line": 3, "modifiers": "@Override public", "params": [], "return_type": "void"}, "class_info": {"name": "MmapChunkAllocator", "kind": "class", "modifiers": "", "superclass": null, "interfaces": "ChunkAllocator", "fields": [{"... |
261970003_3 | class DatabaseOperator {
public <T> T query(final String baseQuery, final ResultSetHandler<T> resultHandler,
final Object... params)
throws SQLException {
try {
return this.queryRunner.query(baseQuery, resultHandler, params);
} catch (final SQLException ex) {
// todo kunkun-tang: Retr... | final int res = this.dbOperator.query("select * from blah where ? = ?", this.handler, "id", 3);
Assert.assertEquals(0, res);
}
} | [FOCAL] public T DatabaseOperator.query(String baseQuery, ResultSetHandler<T> resultHandler, Object... params)
[CLASS] class DatabaseOperator
[METRICS] loc=14 cc=3 branches=1 loops=0 returns=1 throws=1 nesting=2
[CALLS-EXTERNAL] QueryRunner.query/3, logger.error/2, this.dbMetrics.markDBFailQuery/0
[FIELDS] read=dbMetri... | /* static context
[FOCAL] public T DatabaseOperator.query(String baseQuery, ResultSetHandler<T> resultHandler, Object... params)
[THROWS-WHEN] ex when try-body throws && this.dbMetrics != null
[THROWS-WHEN] ex when try-body throws && !(this.dbMetrics != null)
[PATH1] try-body throws -> if(this.dbMetrics != null)=T -> t... | /* static context
[FOCAL] public T DatabaseOperator.query(String baseQuery, ResultSetHandler<T> resultHandler, Object... params)
[THROWS-WHEN] ex when try-body throws && this.dbMetrics != null
[THROWS-WHEN] ex when try-body throws && !(this.dbMetrics != null)
[PATH1] try-body throws -> if(this.dbMetrics != null)=T -> t... | true | ok | {"focal": {"class": "DatabaseOperator", "name": "query", "signature": "T query(String baseQuery, ResultSetHandler<T> resultHandler, Object... params) throws SQLException", "start_line": 3, "modifiers": "public", "params": [{"name": "baseQuery", "type": "String"}, {"name": "resultHandler", "type": "ResultSetHandler<T>"}... |
263047969_22 | class ReduxViewModel extends AndroidViewModel implements Store<S, A> {
@MainThread
public void restoreState(@NonNull S state) {
store.restoreState(state);
}
public ReduxViewModel(@NonNull Application applicationContext);
@NonNull protected abstract ReduxStore<S, A> initializeStore();
... | State state = currentState -> {
};
reduxViewModel.restoreState(state);
Mockito.verify(store, Mockito.times(1)).restoreState(state);
}
} | [FOCAL] @MainThread public void ReduxViewModel.restoreState(S state)
[CLASS] class ReduxViewModel extends AndroidViewModel implements Store<S, A>
[METRICS] loc=4 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] ReduxStore<State, Action>.restoreState/1
[FIELDS] read=store:ReduxStore<State, Action>
[... | /* static context
[FOCAL] @MainThread public void ReduxViewModel.restoreState(S state)
[COLLABORATORS] field store:ReduxStore<State, Action> restoreState/1
[FIELDS] read=store:ReduxStore<State, Action>
[CALLS-EXTERNAL] ReduxStore<State, Action>.restoreState/1
*/
| /* static context
[FOCAL] @MainThread public void ReduxViewModel.restoreState(S state)
[COLLABORATORS] field store:ReduxStore<State, Action> restoreState/1
[FIELDS] read=store:ReduxStore<State, Action>
[CALLS-EXTERNAL] ReduxStore<State, Action>.restoreState/1
*/
class ReduxViewModel extends AndroidViewModel implements ... | true | ok | {"focal": {"class": "ReduxViewModel", "name": "restoreState", "signature": "void restoreState(S state)", "start_line": 3, "modifiers": "@MainThread public", "params": [{"name": "state", "type": "S"}], "return_type": "void"}, "class_info": {"name": "ReduxViewModel", "kind": "class", "modifiers": "", "superclass": "Andro... |
263923665_38 | class SourceCodeAnalyzer {
public int calculateNOC(String filepath, String analyzerType) throws IOException {
if(analyzerType.equals("regex")) {
String sourceCode = fileReader.readFileIntoString(filepath);
Pattern pattern = Pattern.compile(".*\\s*class\\s+.*");
Matcher classSignatures = pattern.matc... | assertEquals(3, sca.calculateNOC(TEST_CLASS, TYPE_STRCOMP));
}
} | [FOCAL] public int SourceCodeAnalyzer.calculateNOC(String filepath, String analyzerType)
[CLASS] class SourceCodeAnalyzer
[METRICS] loc=24 cc=6 branches=3 loops=2 returns=3 throws=0 nesting=4
[CALLS-EXTERNAL] String.equals/1, fileReader.readFileIntoString/1, Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, fileRea... | /* static context
[FOCAL] public int SourceCodeAnalyzer.calculateNOC(String filepath, String analyzerType)
[PATH1] if(analyzerType.equals("regex"))=F -> if(analyzerType.equals("strcomp"))=T -> foreach(String line : sourceCodeList)=T -> if((line.startsWith("class ") || line.contains(" class ")) && line.contains("{"))=T ... | /* static context
[FOCAL] public int SourceCodeAnalyzer.calculateNOC(String filepath, String analyzerType)
[PATH1] if(analyzerType.equals("regex"))=F -> if(analyzerType.equals("strcomp"))=T -> foreach(String line : sourceCodeList)=T -> if((line.startsWith("class ") || line.contains(" class ")) && line.contains("{"))=T ... | true | ok | {"focal": {"class": "SourceCodeAnalyzer", "name": "calculateNOC", "signature": "int calculateNOC(String filepath, String analyzerType) throws IOException", "start_line": 3, "modifiers": "public", "params": [{"name": "filepath", "type": "String"}, {"name": "analyzerType", "type": "String"}], "return_type": "int"}, "clas... |
264141019_7 | class ColumnarDataSet extends AbstractDataSet {
@Override
protected Stream<DataPoint> streamDataPoints()
{
return Utils.getStream(nRows)
.mapToObj(this::mapIndexToDataPoint);
}
public ColumnarDataSet(Map<? extends DataStructureComponent<?, ?, ?>, ScalarValue<?, ?, ?>[]> columns);
private DataPoint mapIn... | boolean found[] = new boolean[5];
Iterator<DataPoint> it = INSTANCE.stream().iterator();
while (it.hasNext())
{
DataPoint dp = it.next();
for (int i = 0; i < 5; i++)
if (new StringValue(STR_ID_VAL[i]).equals(dp.get(STR_ID)) && new IntegerValue(INT_ID_VAL[i]).equals(dp.get(INT_ID)))
{
ScalarVa... | [FOCAL] @Override protected Stream<DataPoint> ColumnarDataSet.streamDataPoints()
[CLASS] class ColumnarDataSet extends AbstractDataSet
[METRICS] loc=6 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CALLS-EXTERNAL] Utils.getStream(nRows).mapToObj/1, Utils.getStream/1
[CLASS-MEMBERS] ColumnarDataSet(Map<? extends ... | /* static context
[FOCAL] @Override protected Stream<DataPoint> ColumnarDataSet.streamDataPoints()
[CALLS-EXTERNAL] Utils.getStream(nRows).mapToObj/1, Utils.getStream/1
*/
| /* static context
[FOCAL] @Override protected Stream<DataPoint> ColumnarDataSet.streamDataPoints()
[CALLS-EXTERNAL] Utils.getStream(nRows).mapToObj/1, Utils.getStream/1
*/
class ColumnarDataSet extends AbstractDataSet {
@Override
protected Stream<DataPoint> streamDataPoints()
{
return Utils.getStream(nRows)
.... | true | ok | {"focal": {"class": "ColumnarDataSet", "name": "streamDataPoints", "signature": "Stream<DataPoint> streamDataPoints()", "start_line": 3, "modifiers": "@Override protected", "params": [], "return_type": "Stream<DataPoint>"}, "class_info": {"name": "ColumnarDataSet", "kind": "class", "modifiers": "", "superclass": "Abstr... |
264503046_2 | class ConfigurationLoader {
@Nullable
protected T initClass() {
T instance = null;
try {
final Constructor<T> constructor = getClazz().getDeclaredConstructor();
constructor.setAccessible(true);
instance = constructor.newInstance();
} catch (NoSuchMet... | TestConfig config = configurationLoader.initClass();
assertNotNull(config);
assertNull(config.name);
}
} | [FOCAL] @Nullable protected T ConfigurationLoader.initClass()
[CLASS] class ConfigurationLoader
[METRICS] loc=18 cc=4 branches=0 loops=0 returns=1 throws=0 nesting=1
[CALLS-INTERNAL] Class<T> getClazz(); Logger getLogger()
[CALLS-EXTERNAL] getClazz().getDeclaredConstructor/0, Constructor<T>.setAccessible/1, Constructor... | /* static context
[FOCAL] @Nullable protected T ConfigurationLoader.initClass()
[PATH1] try-body throws -> return instance
[COLLABORATORS] field clazz getSimpleName/0
[EXCEPTIONS] catches NoSuchMethodException e, IllegalAccessException | InstantiationException e, InvocationTargetException e
[CALLS-INTERNAL] Class<T> ge... | /* static context
[FOCAL] @Nullable protected T ConfigurationLoader.initClass()
[PATH1] try-body throws -> return instance
[COLLABORATORS] field clazz getSimpleName/0
[EXCEPTIONS] catches NoSuchMethodException e, IllegalAccessException | InstantiationException e, InvocationTargetException e
[CALLS-INTERNAL] Class<T> ge... | true | ok | {"focal": {"class": "ConfigurationLoader", "name": "initClass", "signature": "T initClass()", "start_line": 3, "modifiers": "@Nullable protected", "params": [], "return_type": "T"}, "class_info": {"name": "ConfigurationLoader", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"name"... |
265243047_3 | class StringUtil {
public static String convertRegularExpr (String str) {
if(str == null){
return "";
}
String pattern = "\\\\(\\d{3})";
Pattern r = Pattern.compile(pattern);
while(true) {
Matcher m = r.matcher(str);
if(!m.find()) {
... | String result = StringUtil.convertRegularExpr("\\t\\r\\n");
Assert.assertEquals(result, "\t\r\n");
result = StringUtil.convertRegularExpr(null);
Assert.assertEquals(result, "");
}
} | [FOCAL] public static String StringUtil.convertRegularExpr(String str)
[CLASS] class StringUtil
[METRICS] loc=23 cc=3 branches=2 loops=1 returns=2 throws=0 nesting=2
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.group/1, Integer.parseInt/2, Matcher.replaceFirst/1, String.valueOf/1, Stri... | /* static context
[FOCAL] public static String StringUtil.convertRegularExpr(String str)
[PATH1] if(str == null)=F -> while(true)=T -> if(!m.find())=T -> return str
[PATH2] if(str == null)=T -> return ""
[INPUTS] branches=str | result=str
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.gr... | /* static context
[FOCAL] public static String StringUtil.convertRegularExpr(String str)
[PATH1] if(str == null)=F -> while(true)=T -> if(!m.find())=T -> return str
[PATH2] if(str == null)=T -> return ""
[INPUTS] branches=str | result=str
[CALLS-EXTERNAL] Pattern.compile/1, Pattern.matcher/1, Matcher.find/0, Matcher.gr... | true | ok | {"focal": {"class": "StringUtil", "name": "convertRegularExpr", "signature": "String convertRegularExpr(String str)", "start_line": 3, "modifiers": "public static", "params": [{"name": "str", "type": "String"}], "return_type": "String"}, "class_info": {"name": "StringUtil", "kind": "class", "modifiers": "", "superclass... |
265564812_1 | class HttpService extends SingletonSerializeAsToken {
@SneakyThrows
public void destroy() {
server.stop();
server.destroy();
}
@SneakyThrows public HttpService(AppServiceHub appServiceHub);
private boolean existsClass(String name);
}
class HttpServiceTest {
@Test
public void verifyHttpServerAvailable... | AppServiceHub serviceHub = Mockito.mock(AppServiceHub.class);
HttpService service = new HttpService(serviceHub);
try {
String url = "http://127.0.0.1:" + service.getPort() + "/hello";
HttpClient client = HttpClientBuilder.create().build();
HttpResponse response = client.execute(new HttpGet(url));
asse... | [FOCAL] @SneakyThrows public void HttpService.destroy()
[CLASS] class HttpService extends SingletonSerializeAsToken
[METRICS] loc=5 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[CALLS-EXTERNAL] server.stop/0, server.destroy/0
[COLLABORATORS] field server stop/0,destroy/0
[CLASS-MEMBERS] HttpService(AppServiceHu... | /* static context
[FOCAL] @SneakyThrows public void HttpService.destroy()
[COLLABORATORS] field server stop/0,destroy/0
[CALLS-EXTERNAL] server.stop/0, server.destroy/0
*/
| /* static context
[FOCAL] @SneakyThrows public void HttpService.destroy()
[COLLABORATORS] field server stop/0,destroy/0
[CALLS-EXTERNAL] server.stop/0, server.destroy/0
*/
class HttpService extends SingletonSerializeAsToken {
@SneakyThrows
public void destroy() {
server.stop();
server.destroy();
}
@SneakyThro... | true | ok | {"focal": {"class": "HttpService", "name": "destroy", "signature": "void destroy()", "start_line": 3, "modifiers": "@SneakyThrows public", "params": [], "return_type": "void"}, "class_info": {"name": "HttpService", "kind": "class", "modifiers": "", "superclass": "SingletonSerializeAsToken", "interfaces": null, "fields"... |
267999301_0 | class XMLUtils {
public Document getXmlDocument() {
return xmlDocument;
}
public XMLUtils(String xmlString);
public List<Double> getDoubleValues(String tagName);
public List<Long> getLongValues(String tagName);
public List<Integer> getIntValues(String tagName);
public List<Boolea... | Document xmlDocument = XMLUtils.getXmlDocument(xmlString); /*w3c document is created with xml string to access the different nodes of xml*/
Check.assertEquals(3, xmlDocument.getElementsByTagName("book").getLength(), "Book count in xml mismatched");
}
} | [FOCAL] public Document XMLUtils.getXmlDocument()
[CLASS] class XMLUtils
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=1 throws=0 nesting=0
[CLASS-MEMBERS] XMLUtils(String xmlString); List<Double> getDoubleValues(String tagName); List<Long> getLongValues(String tagName); List<Integer> getIntValues(String tagName); Li... | /* static context
[FOCAL] public Document XMLUtils.getXmlDocument()
*/
| /* static context
[FOCAL] public Document XMLUtils.getXmlDocument()
*/
class XMLUtils {
public Document getXmlDocument() {
return xmlDocument;
}
public XMLUtils(String xmlString);
public List<Double> getDoubleValues(String tagName);
public List<Long> getLongValues(String tagName);
pu... | true | ok | {"focal": {"class": "XMLUtils", "name": "getXmlDocument", "signature": "Document getXmlDocument()", "start_line": 3, "modifiers": "public", "params": [], "return_type": "Document"}, "class_info": {"name": "XMLUtils", "kind": "class", "modifiers": "", "superclass": null, "interfaces": null, "fields": [{"name": "xmlStrin... |
269759605_7 | class BattlePositionHoldingArea {
public void setColumns(int columns) {
this.columns = columns;
}
public BattlePositionHoldingArea(int rows, int columns);
public int getRows();
public void setRows(int rows);
public int getColumns();
}
class BattlePositionHoldingAreaTest {
@Tes... | BattlePositionHoldingArea bpha = new BattlePositionHoldingArea(2, 4);
bpha.setColumns(2);
Assert.assertEquals("getColumns == 2", bpha.getColumns(), 2);
}
} | [FOCAL] public void BattlePositionHoldingArea.setColumns(int columns)
[CLASS] class BattlePositionHoldingArea
[METRICS] loc=3 cc=1 branches=0 loops=0 returns=0 throws=0 nesting=0
[FIELDS] write=columns
[STATE] columns via getColumns()
[DATAFLOW] columns@param->L2
[CLASS-MEMBERS] BattlePositionHoldingArea(int rows, int ... | /* static context
[FOCAL] public void BattlePositionHoldingArea.setColumns(int columns)
[STATE] columns via getColumns()
[FIELDS] write=columns
*/
| /* static context
[FOCAL] public void BattlePositionHoldingArea.setColumns(int columns)
[STATE] columns via getColumns()
[FIELDS] write=columns
*/
class BattlePositionHoldingArea {
public void setColumns(int columns) {
this.columns = columns;
}
public BattlePositionHoldingArea(int rows, int colum... | true | ok | {"focal": {"class": "BattlePositionHoldingArea", "name": "setColumns", "signature": "void setColumns(int columns)", "start_line": 3, "modifiers": "public", "params": [{"name": "columns", "type": "int"}], "return_type": "void"}, "class_info": {"name": "BattlePositionHoldingArea", "kind": "class", "modifiers": "", "super... |
271229375_1 | class TypeConverter {
public static Time toTime(String s) {
try {
return new Time(StdDateFormat.getTimeInstance().parse(s).getTime());
} catch (ParseException e) {
throw new IllegalArgumentException(s);
}
}
public static int toInt(String s);
public stati... | assertThat(TypeConverter.toTime("10:11:12"))
.hasHourOfDay(10)
.hasMinute(11)
.hasSecond(12);
}
} | [FOCAL] public static Time TypeConverter.toTime(String s)
[CLASS] class TypeConverter
[METRICS] loc=7 cc=2 branches=0 loops=0 returns=1 throws=1 nesting=1
[CALLS-EXTERNAL] StdDateFormat.getTimeInstance().parse(s).getTime/0, StdDateFormat.getTimeInstance().parse/1, StdDateFormat.getTimeInstance/0
[NEW] Time, IllegalArgu... | /* static context
[FOCAL] public static Time TypeConverter.toTime(String s)
[THROWS-WHEN] IllegalArgumentException when try-body throws
[PATH1] try-body throws -> throw new IllegalArgumentException(s)
[PATH2] return new Time(StdDateFormat.getTimeInstance().parse(s).getTime())
[INPUTS] branches=- | result=s
[EXCEPTIONS]... | /* static context
[FOCAL] public static Time TypeConverter.toTime(String s)
[THROWS-WHEN] IllegalArgumentException when try-body throws
[PATH1] try-body throws -> throw new IllegalArgumentException(s)
[PATH2] return new Time(StdDateFormat.getTimeInstance().parse(s).getTime())
[INPUTS] branches=- | result=s
[EXCEPTIONS]... | true | ok | {"focal": {"class": "TypeConverter", "name": "toTime", "signature": "Time toTime(String s)", "start_line": 3, "modifiers": "public static", "params": [{"name": "s", "type": "String"}], "return_type": "Time"}, "class_info": {"name": "TypeConverter", "kind": "class", "modifiers": "", "superclass": null, "interfaces": nul... |
276117258_29 | class Parser {
public static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
boolean withParameters, boolean splitStatements,
boolean isBatchedReWriteConfigured,
String... returningColumnNames) throws SQLException {
int numOfOverSymble = 0;
boolean havePr... | String query =
"insert test(id, name) select 1, 'value' from test2 RETURNING id";
List<NativeQuery> qry =
Parser.parseJdbcSql(
query, true, true, true, true);
boolean returningKeywordPresent = qry.get(0).command.isReturningKeywordPresent();
Assert.assertTrue("Query has a retu... | [FOCAL] public static List<NativeQuery> Parser.parseJdbcSql(String query, boolean standardConformingStrings, boolean withParameters, boolean splitStatements, boolean isBatchedReWriteConfigured, String... returningColumnNames)
[CLASS] class Parser
[METRICS] loc=387 cc=79 branches=65 loops=2 returns=4 throws=0 nesting=10... | class Parser {
public static List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings,
boolean withParameters, boolean splitStatements,
boolean isBatchedReWriteConfigured,
String... returningColumnNames) throws SQLException {
int numOfOverSymble = 0;
boolean havePr... | false | ok | {"focal": {"class": "Parser", "name": "parseJdbcSql", "signature": "List<NativeQuery> parseJdbcSql(String query, boolean standardConformingStrings, boolean withParameters, boolean splitStatements, boolean isBatchedReWriteConfigured, String... returningColumnNames) throws SQLException", "start_line": 3, "modifiers": "pu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.