before
stringlengths
33
3.21M
after
stringlengths
63
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
@Override public synchronized CacheSpan startReadWrite(String key, long position) throws InterruptedException { CacheSpan lookupSpan = CacheSpan.createLookup(key, position); while (lockedSpans.containsKey(key)) { wait(); } CacheSpan spanningRegion = getSpan(lookupSpan); if (spanningRegion.isCached) { CacheSpan oldCacheSpan = spanningRegion; TreeSet<CacheSpan> spansForKey = cachedSpans.get(oldCacheSpan.key); Assertions.checkState(spansForKey.remove(oldCacheSpan)); spanningRegion = oldCacheSpan.touch(); spansForKey.add(spanningRegion); notifySpanTouched(oldCacheSpan, spanningRegion); } else { lockedSpans.put(key, spanningRegion); } return spanningRegion; }
@Override public synchronized CacheSpan startReadWrite(String key, long position) throws InterruptedException { CacheSpan lookupSpan = CacheSpan.createLookup(key, position); while (lockedSpans.containsKey(key)) { wait(); } <DeepExtract> CacheSpan spanningRegion = getSpan(lookupSpan); if (spanningRegion.isCached) { CacheSpan oldCacheSpan = spanningRegion; TreeSet<CacheSpan> spansForKey = cachedSpans.get(oldCacheSpan.key); Assertions.checkState(spansForKey.remove(oldCacheSpan)); spanningRegion = oldCacheSpan.touch(); spansForKey.add(spanningRegion); notifySpanTouched(oldCacheSpan, spanningRegion); } else { lockedSpans.put(key, spanningRegion); } return spanningRegion; </DeepExtract> }
ExoPlayerLeanback
positive
1,264
public BaggageWriter exit() { currentLevel--; backing.finish(); if (isHeader(atoms.get(atoms.size() - 1))) { atoms.remove(atoms.size() - 1); } currentBagBeginIndex = atoms.size(); return this; }
public BaggageWriter exit() { currentLevel--; <DeepExtract> backing.finish(); </DeepExtract> if (isHeader(atoms.get(atoms.size() - 1))) { atoms.remove(atoms.size() - 1); } currentBagBeginIndex = atoms.size(); return this; }
tracingplane-java
positive
1,265
@Override public void render() { assert !server; if (modelBatch == null) { modelBatch = new ModelBatch(Gdx.files.internal("shaders/gdx/world.vert.glsl"), Gdx.files.internal("shaders/gdx/world.frag.glsl")); wiremeshBatch = new ModelBatch(Gdx.files.internal("shaders/gdx/world.vert.glsl"), Gdx.files.internal("shaders/gdx/wiremesh.frag.glsl")); } if (skybox == null) { skybox = createSkybox(); } while (!chunkUploadQueue.isEmpty()) { chunkUploadQueue.poll().run(); if (RadixClient.getInstance().getSettingsManager().getVisualSettings().getSmoothChunkLoad().getValue()) break; } boolean noLightUpdatesQueued = sunlightQueue.isEmpty() && sunlightRemovalQueue.isEmpty(); for (IChunk c : chunkMap.values()) { if (c == null) continue; if (!c.hasInitialSun() && RadixClient.getInstance().getPlayer().getPosition().planeDistance(c.getStartPosition().x, c.getStartPosition().z) <= RadixClient.getInstance().getSettingsManager().getVisualSettings().getViewDistance() * CHUNK_SIZE) { setupLighting(c); c.finishAddingSun(); } if (noLightUpdatesQueued && c.waitingOnLightFinish()) { c.finishChangingSunlight(); } } processLightRemovalQueue(); { Queue<IChunk> skippedChunks = new LinkedList<>(); IChunk c; while ((c = chunksToRerender.poll()) != null) { if (RadixClient.getInstance().getPlayer().getPosition().planeDistance(c.getStartPosition().x, c.getStartPosition().z) <= RadixClient.getInstance().getSettingsManager().getVisualSettings().getViewDistance() * CHUNK_SIZE) { c.rerender(); } else { skippedChunks.add(c); } } while ((c = skippedChunks.poll()) != null) { chunksToRerender.add(c); } } float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); boolean wireframe = RadixClient.getInstance().isWireframe(); if (wireframe) { RadixClient.getInstance().setWireframe(false); } modelBatch.begin(RadixClient.getInstance().getCamera()); skybox.transform.translate(playerX, playerY, playerZ); modelBatch.render(skybox); skybox.transform.translate(-playerX, -playerY, -playerZ); if (chunkMap != null) { List<IChunk> visibleChunks = new LinkedList<>(); for (IChunk c : chunkMap.values()) { if (c == null) continue; int x = c.getStartPosition().x; int z = c.getStartPosition().z; int halfWidth = getChunkSize() / 2; int midX = x + halfWidth; int midZ = z + halfWidth; int midY = c.getHighestPoint() / 2; boolean visible = RadixClient.getInstance().getGameRenderer().getFrustum().boundsInFrustum(midX, midY, midZ, halfWidth, midY, halfWidth); if (visible) { visibleChunks.add(c); c.render(modelBatch); } } for (IChunk c : visibleChunks) { c.renderTranslucent(modelBatch); } modelBatch.end(); if (wireframe) { RadixClient.getInstance().setWireframe(true); Gdx.gl.glLineWidth(2); wiremeshBatch.begin(RadixClient.getInstance().getCamera()); for (IChunk c : visibleChunks) { c.render(wiremeshBatch); } wiremeshBatch.end(); } } else { modelBatch.end(); } }
@Override public void render() { assert !server; if (modelBatch == null) { modelBatch = new ModelBatch(Gdx.files.internal("shaders/gdx/world.vert.glsl"), Gdx.files.internal("shaders/gdx/world.frag.glsl")); wiremeshBatch = new ModelBatch(Gdx.files.internal("shaders/gdx/world.vert.glsl"), Gdx.files.internal("shaders/gdx/wiremesh.frag.glsl")); } if (skybox == null) { skybox = createSkybox(); } while (!chunkUploadQueue.isEmpty()) { chunkUploadQueue.poll().run(); if (RadixClient.getInstance().getSettingsManager().getVisualSettings().getSmoothChunkLoad().getValue()) break; } <DeepExtract> boolean noLightUpdatesQueued = sunlightQueue.isEmpty() && sunlightRemovalQueue.isEmpty(); for (IChunk c : chunkMap.values()) { if (c == null) continue; if (!c.hasInitialSun() && RadixClient.getInstance().getPlayer().getPosition().planeDistance(c.getStartPosition().x, c.getStartPosition().z) <= RadixClient.getInstance().getSettingsManager().getVisualSettings().getViewDistance() * CHUNK_SIZE) { setupLighting(c); c.finishAddingSun(); } if (noLightUpdatesQueued && c.waitingOnLightFinish()) { c.finishChangingSunlight(); } } processLightRemovalQueue(); </DeepExtract> { Queue<IChunk> skippedChunks = new LinkedList<>(); IChunk c; while ((c = chunksToRerender.poll()) != null) { if (RadixClient.getInstance().getPlayer().getPosition().planeDistance(c.getStartPosition().x, c.getStartPosition().z) <= RadixClient.getInstance().getSettingsManager().getVisualSettings().getViewDistance() * CHUNK_SIZE) { c.rerender(); } else { skippedChunks.add(c); } } while ((c = skippedChunks.poll()) != null) { chunksToRerender.add(c); } } float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); float playerX = RadixClient.getInstance().getPlayer().getPosition().getX(), playerY = RadixClient.getInstance().getPlayer().getPosition().getY(), playerZ = RadixClient.getInstance().getPlayer().getPosition().getZ(); boolean wireframe = RadixClient.getInstance().isWireframe(); if (wireframe) { RadixClient.getInstance().setWireframe(false); } modelBatch.begin(RadixClient.getInstance().getCamera()); skybox.transform.translate(playerX, playerY, playerZ); modelBatch.render(skybox); skybox.transform.translate(-playerX, -playerY, -playerZ); if (chunkMap != null) { List<IChunk> visibleChunks = new LinkedList<>(); for (IChunk c : chunkMap.values()) { if (c == null) continue; int x = c.getStartPosition().x; int z = c.getStartPosition().z; int halfWidth = getChunkSize() / 2; int midX = x + halfWidth; int midZ = z + halfWidth; int midY = c.getHighestPoint() / 2; boolean visible = RadixClient.getInstance().getGameRenderer().getFrustum().boundsInFrustum(midX, midY, midZ, halfWidth, midY, halfWidth); if (visible) { visibleChunks.add(c); c.render(modelBatch); } } for (IChunk c : visibleChunks) { c.renderTranslucent(modelBatch); } modelBatch.end(); if (wireframe) { RadixClient.getInstance().setWireframe(true); Gdx.gl.glLineWidth(2); wiremeshBatch.begin(RadixClient.getInstance().getCamera()); for (IChunk c : visibleChunks) { c.render(wiremeshBatch); } wiremeshBatch.end(); } } else { modelBatch.end(); } }
Radix
positive
1,266
public void gen_eval_body(Map<String, Object> context, QLSelect select, PrintWriter out) { Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } String className = clazz.getName(); className = className.replaceAll("\\$", "."); String entryVarName = "item"; out.println(" List<" + className + "> " + srcCollectionName + " = (List<" + className + ">) ctx.get(\"_src_\");"); out.println(" List<" + className + "> " + destCollectionName + " = (List<" + className + ">) ctx.get(\"_dest_\");"); final QLLimit limit = select.getLimit(); if (limit != null) { if (limit.getOffset() != null) { out.println(" final int offset = " + limit.getOffset() + ";"); } out.println(" final int rowCount = " + limit.getRowCount() + ";"); out.println(); if (limit.getOffset() != null) { out.println(" int rowIndex = 0;"); } } out.println(" for (" + className + " " + entryVarName + " : " + srcCollectionName + ") {"); out.println(); final Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } final QLExpr where = select.getWhere(); if (where == null) { return; } final QLLimit limit = select.getLimit(); QLAstVisitorAdapter setTypeVisitor = new SetTypeVisitor(clazz); where.accept(setTypeVisitor); out.print(" if("); QLAstVisitor visitor = new WhereGenOutputVisitor(out, clazz); where.accept(visitor); out.println(") {"); if (limit != null && select.getOrderBy() == null) { out.println(" if (_dest_.size() >= rowCount) {"); out.println(" break;"); out.println(" }"); } out.println(" " + destCollectionName + ".add(item);"); out.println(" }"); out.println(); out.println(); out.println(" }"); final Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } final QLOrderBy orderBy = select.getOrderBy(); if (orderBy == null || orderBy.getItems().size() == 0) { return; } String className = clazz.getName(); className = className.replaceAll("\\$", "."); for (QLOrderByItem item : orderBy.getItems()) { out.println(" {"); out.println(" Comparator<" + className + "> comparator = new Comparator<" + className + ">() {"); out.println(" public int compare(" + className + " a, " + className + " b) {"); if (item.getMode() == QLOrderByMode.DESC) { out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " > " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return -1;"); out.println(" }"); out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " < " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return 1;"); out.println(" }"); } else { out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " > " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return 1;"); out.println(" }"); out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " < " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return -1;"); out.println(" }"); } out.println(" return 0;"); out.println(" }"); out.println(" };"); out.println(" Collections.sort(" + destCollectionName + ", comparator);"); out.println(" }"); } QLLimit limit = select.getLimit(); if (limit == null) { return; } out.println(); if (limit.getOffset() != null) { out.println(" for (int i = 0; i < offset && i < _dest_.size(); ++i) {"); out.println(" _dest_.remove(0);"); out.println(" }"); } out.println(" while(_dest_.size() > rowCount) {"); out.println(" _dest_.remove(_dest_.size() - 1);"); out.println(" }"); }
public void gen_eval_body(Map<String, Object> context, QLSelect select, PrintWriter out) { Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } String className = clazz.getName(); className = className.replaceAll("\\$", "."); String entryVarName = "item"; out.println(" List<" + className + "> " + srcCollectionName + " = (List<" + className + ">) ctx.get(\"_src_\");"); out.println(" List<" + className + "> " + destCollectionName + " = (List<" + className + ">) ctx.get(\"_dest_\");"); final QLLimit limit = select.getLimit(); if (limit != null) { if (limit.getOffset() != null) { out.println(" final int offset = " + limit.getOffset() + ";"); } out.println(" final int rowCount = " + limit.getRowCount() + ";"); out.println(); if (limit.getOffset() != null) { out.println(" int rowIndex = 0;"); } } out.println(" for (" + className + " " + entryVarName + " : " + srcCollectionName + ") {"); out.println(); final Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } final QLExpr where = select.getWhere(); if (where == null) { return; } final QLLimit limit = select.getLimit(); QLAstVisitorAdapter setTypeVisitor = new SetTypeVisitor(clazz); where.accept(setTypeVisitor); out.print(" if("); QLAstVisitor visitor = new WhereGenOutputVisitor(out, clazz); where.accept(visitor); out.println(") {"); if (limit != null && select.getOrderBy() == null) { out.println(" if (_dest_.size() >= rowCount) {"); out.println(" break;"); out.println(" }"); } out.println(" " + destCollectionName + ".add(item);"); out.println(" }"); out.println(); out.println(); out.println(" }"); final Class<?> clazz = (Class<?>) context.get("class"); if (clazz == null) { throw new IllegalArgumentException("context not contains 'class'"); } final QLOrderBy orderBy = select.getOrderBy(); if (orderBy == null || orderBy.getItems().size() == 0) { return; } String className = clazz.getName(); className = className.replaceAll("\\$", "."); for (QLOrderByItem item : orderBy.getItems()) { out.println(" {"); out.println(" Comparator<" + className + "> comparator = new Comparator<" + className + ">() {"); out.println(" public int compare(" + className + " a, " + className + " b) {"); if (item.getMode() == QLOrderByMode.DESC) { out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " > " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return -1;"); out.println(" }"); out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " < " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return 1;"); out.println(" }"); } else { out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " > " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return 1;"); out.println(" }"); out.println(" if (" + gen_orderByItem(context, "a", item.getExpr()) + " < " + gen_orderByItem(context, "b", item.getExpr()) + ") {"); out.println(" return -1;"); out.println(" }"); } out.println(" return 0;"); out.println(" }"); out.println(" };"); out.println(" Collections.sort(" + destCollectionName + ", comparator);"); out.println(" }"); } <DeepExtract> QLLimit limit = select.getLimit(); if (limit == null) { return; } out.println(); if (limit.getOffset() != null) { out.println(" for (int i = 0; i < offset && i < _dest_.size(); ++i) {"); out.println(" _dest_.remove(0);"); out.println(" }"); } out.println(" while(_dest_.size() > rowCount) {"); out.println(" _dest_.remove(_dest_.size() - 1);"); out.println(" }"); </DeepExtract> }
simpleel
positive
1,267
public static Operation createCreateCollectionOperation(TypeReference tref) { Operation op = TransformationHelpers.createOperationWithAtomicParameters("createCollection", DATA_ROLE, VOID_TYPE, true, ID_ROLE, INT_TYPE); OperationResponsibility ov = MAPDecoratorHelpers.setPrimaryResponsibility(MAPDecoratorHelpers.STATE_CREATION_OPERATION); op.setResponsibility(ov); TransformationHelpers.setAtomicParameterNames(op, EMPTY_PAYLOAD, COLLECTION_ID); return op; }
public static Operation createCreateCollectionOperation(TypeReference tref) { Operation op = TransformationHelpers.createOperationWithAtomicParameters("createCollection", DATA_ROLE, VOID_TYPE, true, ID_ROLE, INT_TYPE); <DeepExtract> OperationResponsibility ov = MAPDecoratorHelpers.setPrimaryResponsibility(MAPDecoratorHelpers.STATE_CREATION_OPERATION); op.setResponsibility(ov); </DeepExtract> TransformationHelpers.setAtomicParameterNames(op, EMPTY_PAYLOAD, COLLECTION_ID); return op; }
MDSL-Specification
positive
1,268
@Override public List<Resources> listUrlAndPermission() { List<SysResources> sysResources = resourceMapper.listUrlAndPermission(); if (CollectionUtils.isEmpty(sysResources)) { return null; } List<Resources> resources = new ArrayList<>(); for (SysResources r : sysResources) { resources.add(new Resources(r)); } return resources; }
@Override public List<Resources> listUrlAndPermission() { List<SysResources> sysResources = resourceMapper.listUrlAndPermission(); <DeepExtract> if (CollectionUtils.isEmpty(sysResources)) { return null; } List<Resources> resources = new ArrayList<>(); for (SysResources r : sysResources) { resources.add(new Resources(r)); } return resources; </DeepExtract> }
springboot-learn
positive
1,269
public int returnTypeIndexFromMethodIndex(int methodIndex) { if (methodIndex < 0 || methodIndex >= tableOfContents.methodIds.size) { throw new IndexOutOfBoundsException("index:" + methodIndex + ", length=" + tableOfContents.methodIds.size); } int position = tableOfContents.methodIds.off + (SizeOf.MEMBER_ID_ITEM * methodIndex); position += SizeOf.USHORT; int protoIndex = data.getShort(position) & 0xFFFF; if (protoIndex < 0 || protoIndex >= tableOfContents.protoIds.size) { throw new IndexOutOfBoundsException("index:" + protoIndex + ", length=" + tableOfContents.protoIds.size); } position = tableOfContents.protoIds.off + (SizeOf.PROTO_ID_ITEM * protoIndex); position += SizeOf.UINT; return data.getInt(position); }
public int returnTypeIndexFromMethodIndex(int methodIndex) { if (methodIndex < 0 || methodIndex >= tableOfContents.methodIds.size) { throw new IndexOutOfBoundsException("index:" + methodIndex + ", length=" + tableOfContents.methodIds.size); } int position = tableOfContents.methodIds.off + (SizeOf.MEMBER_ID_ITEM * methodIndex); position += SizeOf.USHORT; int protoIndex = data.getShort(position) & 0xFFFF; <DeepExtract> if (protoIndex < 0 || protoIndex >= tableOfContents.protoIds.size) { throw new IndexOutOfBoundsException("index:" + protoIndex + ", length=" + tableOfContents.protoIds.size); } </DeepExtract> position = tableOfContents.protoIds.off + (SizeOf.PROTO_ID_ITEM * protoIndex); position += SizeOf.UINT; return data.getInt(position); }
tinker-dex-dump
positive
1,270
@Test public void testKeyOpenRangeDesc() { List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "key", SecQueries.<Integer, Integer>builder().ltKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("cfehmil", result); List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "weight", SecQueries.<Integer, Long>builder().geKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("dfk", result); List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "str", SecQueries.<Integer, String>builder().leKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("kjihgfedcba", result); }
@Test public void testKeyOpenRangeDesc() { List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "key", SecQueries.<Integer, Integer>builder().ltKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("cfehmil", result); List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "weight", SecQueries.<Integer, Long>builder().geKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("dfk", result); <DeepExtract> List<Integer> keys = ENTITY3.<M>queryKeys(velvet, "str", SecQueries.<Integer, String>builder().leKey(8).descending().build()); List<TestEnt3> values = ENTITY3.batchGetList(velvet, keys); String result = values.stream().map(TestEnt3::getStr).collect(Collectors.joining("")); Assert.assertEquals("kjihgfedcba", result); </DeepExtract> }
velvetdb
positive
1,271
public void setCurrentItem(int item) { mPopulatePending = false; setCurrentItemInternal(item, !mFirstLayout, false, 0); }
public void setCurrentItem(int item) { mPopulatePending = false; <DeepExtract> setCurrentItemInternal(item, !mFirstLayout, false, 0); </DeepExtract> }
OkCalendar
positive
1,272
private Map<String, Long> getStats(String trough_name) { Map<String, Long> map = new TreeMap<String, Long>(); map.put("tables", 0L); map.put("items", 0L); map.put("key_size", 0L); map.put("data_size", 0L); long pos; Map<String, Integer> troughs = getTroughMap(); if (!troughs.containsKey(trough_name)) { throw new RuntimeException("Unable to find trough: " + trough_name); } int idx = troughs.get(trough_name); MappedByteBuffer mbb = getBufferMap(0); synchronized (mbb) { mbb.position((int) (LOCATION_TROUGH_TABLE_START + (8 + MAX_TROUGH_NAME_LEN) * idx)); pos = mbb.getLong(); } map.put("tables", map.get("tables") + 1); int hash_file = (int) (pos / SEGMENT_FILE_SIZE); MappedByteBuffer hash_mbb = getBufferMap(hash_file); int file_offset = (int) (pos % SEGMENT_FILE_SIZE); int max; int items; long next_ptr; synchronized (hash_mbb) { hash_mbb.position(file_offset + (int) LOCATION_HASH_MAX); max = hash_mbb.getInt(); items = hash_mbb.getInt(); next_ptr = hash_mbb.getLong(); hash_mbb.position(file_offset + (int) LOCATION_HASH_START); for (int i = 0; i < max; i++) { long ptr = hash_mbb.getLong(file_offset + LOCATION_HASH_START + i * 8); if (ptr != 0) { RecordEntry re = new RecordEntry(ptr); ByteString key = re.getKey(); ByteString value = re.getValue(); map.put("key_size", map.get("key_size") + key.size()); map.put("data_size", map.get("data_size") + value.size()); } } } map.put("items", map.get("items") + items); if (next_ptr != 0) { getTableStats(next_ptr, map); } return map; }
private Map<String, Long> getStats(String trough_name) { Map<String, Long> map = new TreeMap<String, Long>(); map.put("tables", 0L); map.put("items", 0L); map.put("key_size", 0L); map.put("data_size", 0L); long pos; Map<String, Integer> troughs = getTroughMap(); if (!troughs.containsKey(trough_name)) { throw new RuntimeException("Unable to find trough: " + trough_name); } int idx = troughs.get(trough_name); MappedByteBuffer mbb = getBufferMap(0); synchronized (mbb) { mbb.position((int) (LOCATION_TROUGH_TABLE_START + (8 + MAX_TROUGH_NAME_LEN) * idx)); pos = mbb.getLong(); } <DeepExtract> map.put("tables", map.get("tables") + 1); int hash_file = (int) (pos / SEGMENT_FILE_SIZE); MappedByteBuffer hash_mbb = getBufferMap(hash_file); int file_offset = (int) (pos % SEGMENT_FILE_SIZE); int max; int items; long next_ptr; synchronized (hash_mbb) { hash_mbb.position(file_offset + (int) LOCATION_HASH_MAX); max = hash_mbb.getInt(); items = hash_mbb.getInt(); next_ptr = hash_mbb.getLong(); hash_mbb.position(file_offset + (int) LOCATION_HASH_START); for (int i = 0; i < max; i++) { long ptr = hash_mbb.getLong(file_offset + LOCATION_HASH_START + i * 8); if (ptr != 0) { RecordEntry re = new RecordEntry(ptr); ByteString key = re.getKey(); ByteString value = re.getValue(); map.put("key_size", map.get("key_size") + key.size()); map.put("data_size", map.get("data_size") + value.size()); } } } map.put("items", map.get("items") + items); if (next_ptr != 0) { getTableStats(next_ptr, map); } </DeepExtract> return map; }
jelectrum
positive
1,273
@Override public synchronized void stopCapture() { if (isDisposed) { throw new RuntimeException("capturer is disposed."); } ThreadUtils.invokeAtFrontUninterruptibly(surfaceTextureHelper.getHandler(), new Runnable() { @Override public void run() { surfaceTextureHelper.stopListening(); capturerObserver.onCapturerStopped(); if (virtualDisplay != null) { virtualDisplay.release(); virtualDisplay = null; } if (mediaProjection != null) { mediaProjection.unregisterCallback(mediaProjectionCallback); mediaProjection.stop(); mediaProjection = null; } } }); }
@Override public synchronized void stopCapture() { <DeepExtract> if (isDisposed) { throw new RuntimeException("capturer is disposed."); } </DeepExtract> ThreadUtils.invokeAtFrontUninterruptibly(surfaceTextureHelper.getHandler(), new Runnable() { @Override public void run() { surfaceTextureHelper.stopListening(); capturerObserver.onCapturerStopped(); if (virtualDisplay != null) { virtualDisplay.release(); virtualDisplay = null; } if (mediaProjection != null) { mediaProjection.unregisterCallback(mediaProjectionCallback); mediaProjection.stop(); mediaProjection = null; } } }); }
VideoCRE
positive
1,274
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { SharedPreferences prefs = getPreferences(MODE_PRIVATE); if (!prefs.getBoolean("dbInitialized", false)) { prefs.edit().putBoolean("dbInitialized", true).commit(); rebuildList(); } if (adapter == null) { adapter = new MySimpleCursorAdapter(savedInstanceState, this, cursor); adapter.setOnItemClickListener(this); adapter.setAdapterView(getListView()); } else { adapter.changeCursor(cursor); } }
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { <DeepExtract> SharedPreferences prefs = getPreferences(MODE_PRIVATE); if (!prefs.getBoolean("dbInitialized", false)) { prefs.edit().putBoolean("dbInitialized", true).commit(); rebuildList(); } if (adapter == null) { adapter = new MySimpleCursorAdapter(savedInstanceState, this, cursor); adapter.setOnItemClickListener(this); adapter.setAdapterView(getListView()); } else { adapter.changeCursor(cursor); } </DeepExtract> }
MultiChoiceAdapter
positive
1,275
public Criteria andRoleNotLike(String value) { if (value == null) { throw new RuntimeException("Value for " + "role" + " cannot be null"); } criteria.add(new Criterion("role not like", value)); return (Criteria) this; }
public Criteria andRoleNotLike(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "role" + " cannot be null"); } criteria.add(new Criterion("role not like", value)); </DeepExtract> return (Criteria) this; }
CuitJavaEEPractice
positive
1,277
public static void d(Object msg) { if (!IS_SHOW_ChuMuKLog) { return; } String[] contents = wrapperContent(STACK_TRACE_INDEX_5, null, msg); String tag = contents[0]; String msg = contents[1]; String headString = contents[2]; switch(D) { case V: case D: case I: case W: case E: case A: ChuMuBaseLog.printDefault(D, tag, headString + msg); break; case JSON: JsonLog.printJson(tag, msg, headString); break; case XML: XmlLog.printXml(tag, msg, headString); break; } }
public static void d(Object msg) { <DeepExtract> if (!IS_SHOW_ChuMuKLog) { return; } String[] contents = wrapperContent(STACK_TRACE_INDEX_5, null, msg); String tag = contents[0]; String msg = contents[1]; String headString = contents[2]; switch(D) { case V: case D: case I: case W: case E: case A: ChuMuBaseLog.printDefault(D, tag, headString + msg); break; case JSON: JsonLog.printJson(tag, msg, headString); break; case XML: XmlLog.printXml(tag, msg, headString); break; } </DeepExtract> }
ChuMuYa
positive
1,278
public static Spannable getColorizedSpannableBrightWhite(String s, Context context) { Spannable sp = new SpannableString(s); if (context == null) { return; } if (sp.length() > 0) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.yellow)), 0, sp.length() > 10 ? 11 : sp.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); if (sp.length() > 58) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.yellow)), 58, sp.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } if (context == null) { return; } if (sp.length() > 58) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.white_90)), 11, 58, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } return sp; }
public static Spannable getColorizedSpannableBrightWhite(String s, Context context) { Spannable sp = new SpannableString(s); if (context == null) { return; } if (sp.length() > 0) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.yellow)), 0, sp.length() > 10 ? 11 : sp.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); if (sp.length() > 58) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.yellow)), 58, sp.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } } <DeepExtract> if (context == null) { return; } if (sp.length() > 58) { sp.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.white_90)), 11, 58, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } </DeepExtract> return sp; }
kalium-android-wallet
positive
1,281
@Override protected void onDraw(Canvas canvas) { mFloorPaint.setColor(mFloorColor); int radius = mCenterPoint.x; canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, radius * mFloorScale, mFloorPaint); mPaint.setColor(mUnCheckedColor); float radius = (mCenterPoint.x - mStrokeWidth) * mScaleVal; canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, radius, mPaint); if (mTickDrawing && isChecked()) { drawTickPath(canvas); } }
@Override protected void onDraw(Canvas canvas) { mFloorPaint.setColor(mFloorColor); int radius = mCenterPoint.x; canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, radius * mFloorScale, mFloorPaint); mPaint.setColor(mUnCheckedColor); float radius = (mCenterPoint.x - mStrokeWidth) * mScaleVal; canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, radius, mPaint); <DeepExtract> if (mTickDrawing && isChecked()) { drawTickPath(canvas); } </DeepExtract> }
FastWaiMai
positive
1,282
@OnClick({ R.id.main_bottom_mainpage_tv, R.id.main_bottom_discover_tv, R.id.main_bottom_post, R.id.main_bottom_group_tv, R.id.main_bottom_mine_tv }) public void onButtomClick(ImageView view) { int type = mainBottomLLY.indexOfChild(view); mainpageIv.setImageResource(R.drawable.main_mainpage_black); discoverIv.setImageResource(R.drawable.main_discover_black); groupIv.setImageResource(R.drawable.main_group_black); postIv.setImageResource(R.drawable.main_post); mineIv.setImageResource(R.drawable.main_mine_black); switch(type) { case MainMvp.MAINPAGE: view.setImageResource(R.drawable.main_mainpage_pink); break; case MainMvp.DISCOVER: view.setImageResource(R.drawable.main_discover_pink); break; case MainMvp.POST: view.setImageResource(R.drawable.main_post); break; case MainMvp.GROUP: view.setImageResource(R.drawable.main_group_pink); break; case MainMvp.MINE: view.setImageResource(R.drawable.main_mine_pink); break; } if (navType == type) { if (currentLoadingFragment != null) currentLoadingFragment.onNavigateClick(); } else { getPresenter().onModuleChanged(getSupportFragmentManager(), type); navType = type; } }
@OnClick({ R.id.main_bottom_mainpage_tv, R.id.main_bottom_discover_tv, R.id.main_bottom_post, R.id.main_bottom_group_tv, R.id.main_bottom_mine_tv }) public void onButtomClick(ImageView view) { int type = mainBottomLLY.indexOfChild(view); mainpageIv.setImageResource(R.drawable.main_mainpage_black); discoverIv.setImageResource(R.drawable.main_discover_black); groupIv.setImageResource(R.drawable.main_group_black); postIv.setImageResource(R.drawable.main_post); mineIv.setImageResource(R.drawable.main_mine_black); switch(type) { case MainMvp.MAINPAGE: view.setImageResource(R.drawable.main_mainpage_pink); break; case MainMvp.DISCOVER: view.setImageResource(R.drawable.main_discover_pink); break; case MainMvp.POST: view.setImageResource(R.drawable.main_post); break; case MainMvp.GROUP: view.setImageResource(R.drawable.main_group_pink); break; case MainMvp.MINE: view.setImageResource(R.drawable.main_mine_pink); break; } <DeepExtract> if (navType == type) { if (currentLoadingFragment != null) currentLoadingFragment.onNavigateClick(); } else { getPresenter().onModuleChanged(getSupportFragmentManager(), type); navType = type; } </DeepExtract> }
banciyuan-unofficial
positive
1,285
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wechat_fragment_tab_first_msg, container, false); mToolbar = (Toolbar) view.findViewById(R.id.toolbar); mBtnSend = (Button) view.findViewById(R.id.btn_send); mEtSend = (EditText) view.findViewById(R.id.et_send); mRecy = (RecyclerView) view.findViewById(R.id.recy); mToolbar.setTitle(mChat.name); initToolbarNav(mToolbar); return attachToSwipeBack(view); }
@Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wechat_fragment_tab_first_msg, container, false); <DeepExtract> mToolbar = (Toolbar) view.findViewById(R.id.toolbar); mBtnSend = (Button) view.findViewById(R.id.btn_send); mEtSend = (EditText) view.findViewById(R.id.et_send); mRecy = (RecyclerView) view.findViewById(R.id.recy); mToolbar.setTitle(mChat.name); initToolbarNav(mToolbar); </DeepExtract> return attachToSwipeBack(view); }
Fragmentation
positive
1,286
@Override public void onStart() { super.onStart(); Window window = getWindow(); if (window != null) { PromptEntity promptEntity = getPromptEntity(); window.setGravity(Gravity.CENTER); WindowManager.LayoutParams lp = window.getAttributes(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); if (promptEntity.getWidthRatio() > 0 && promptEntity.getWidthRatio() < 1) { lp.width = (int) (displayMetrics.widthPixels * promptEntity.getWidthRatio()); } if (promptEntity.getHeightRatio() > 0 && promptEntity.getHeightRatio() < 1) { lp.height = (int) (displayMetrics.heightPixels * promptEntity.getHeightRatio()); } window.setAttributes(lp); } }
@Override public void onStart() { super.onStart(); <DeepExtract> Window window = getWindow(); if (window != null) { PromptEntity promptEntity = getPromptEntity(); window.setGravity(Gravity.CENTER); WindowManager.LayoutParams lp = window.getAttributes(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); if (promptEntity.getWidthRatio() > 0 && promptEntity.getWidthRatio() < 1) { lp.width = (int) (displayMetrics.widthPixels * promptEntity.getWidthRatio()); } if (promptEntity.getHeightRatio() > 0 && promptEntity.getHeightRatio() < 1) { lp.height = (int) (displayMetrics.heightPixels * promptEntity.getHeightRatio()); } window.setAttributes(lp); } </DeepExtract> }
XUpdate
positive
1,287
@Implementation public static Message obtain(Message msg) { Message m = new Message(); message.arg1 = msg.arg1; message.arg2 = msg.arg2; message.obj = msg.obj; message.what = msg.what; message.setData(msg.getData()); this.target = msg.getTarget(); return m; }
@Implementation public static Message obtain(Message msg) { Message m = new Message(); message.arg1 = msg.arg1; message.arg2 = msg.arg2; message.obj = msg.obj; message.what = msg.what; message.setData(msg.getData()); <DeepExtract> this.target = msg.getTarget(); </DeepExtract> return m; }
scdl
positive
1,289
public static String encodeBytes(byte[] source, int off, int len) { byte[] encoded; if (source == null) throw new NullPointerException("Cannot serialize a null array."); if (off < 0) throw new IllegalArgumentException("Cannot have negative offset: " + off); if (len < 0) throw new IllegalArgumentException("Cannot have length offset: " + len); if (off + len > source.length) throw new IllegalArgumentException(String.format("Cannot have offset of %d and length of %d with array of length %d", off, len, source.length)); int encLen = (len / 3) * 4 + (len % 3 > 0 ? 4 : 0); byte[] outBuff = new byte[encLen]; int d = 0; int e = 0; int len2 = len - 2; for (; d < len2; d += 3, e += 4) encode3to4(source, d + off, 3, outBuff, e); if (d < len) { encode3to4(source, d + off, len - d, outBuff, e); e += 4; } if (e <= outBuff.length - 1) { byte[] finalOut = new byte[e]; System.arraycopy(outBuff, 0, finalOut, 0, e); encoded = finalOut; } else encoded = outBuff; try { return new String(encoded, PREFERRED_ENCODING); } catch (UnsupportedEncodingException uue) { return new String(encoded); } }
public static String encodeBytes(byte[] source, int off, int len) { <DeepExtract> byte[] encoded; if (source == null) throw new NullPointerException("Cannot serialize a null array."); if (off < 0) throw new IllegalArgumentException("Cannot have negative offset: " + off); if (len < 0) throw new IllegalArgumentException("Cannot have length offset: " + len); if (off + len > source.length) throw new IllegalArgumentException(String.format("Cannot have offset of %d and length of %d with array of length %d", off, len, source.length)); int encLen = (len / 3) * 4 + (len % 3 > 0 ? 4 : 0); byte[] outBuff = new byte[encLen]; int d = 0; int e = 0; int len2 = len - 2; for (; d < len2; d += 3, e += 4) encode3to4(source, d + off, 3, outBuff, e); if (d < len) { encode3to4(source, d + off, len - d, outBuff, e); e += 4; } if (e <= outBuff.length - 1) { byte[] finalOut = new byte[e]; System.arraycopy(outBuff, 0, finalOut, 0, e); encoded = finalOut; } else encoded = outBuff; </DeepExtract> try { return new String(encoded, PREFERRED_ENCODING); } catch (UnsupportedEncodingException uue) { return new String(encoded); } }
nanoleaf-aurora
positive
1,290
protected void sendTextMessage(String thisMessage) { player.sendText(TrekAnsi.locate(22, 1, player)); player.sendText(TrekAnsi.deleteLines(1, player)); player.sendText(TrekAnsi.locate(24, 1, player)); player.sendText(thisMessage + TrekAnsi.eraseToEndOfLine(player)); hudobjects.put("MyHudLine22", getHudValueString("MyHudLine23")); hudobjects.put("MyHudLine23", getHudValueString("MyHudLine24")); hudobjects.put("MyHudLine24", thisMessage); talkMessageWaiting = true; talkMessagesTimeout = 180; }
protected void sendTextMessage(String thisMessage) { player.sendText(TrekAnsi.locate(22, 1, player)); player.sendText(TrekAnsi.deleteLines(1, player)); player.sendText(TrekAnsi.locate(24, 1, player)); player.sendText(thisMessage + TrekAnsi.eraseToEndOfLine(player)); hudobjects.put("MyHudLine22", getHudValueString("MyHudLine23")); hudobjects.put("MyHudLine23", getHudValueString("MyHudLine24")); <DeepExtract> hudobjects.put("MyHudLine24", thisMessage); </DeepExtract> talkMessageWaiting = true; talkMessagesTimeout = 180; }
jtrek
positive
1,293
@Override public void run() { Throwable cause = null; try { onComplete.beforeWrite(msg, args, null); out.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid)); x.write(out); out.writeMessageEnd(); out.getTransport().flush(); } catch (Throwable e) { cause = e; } onComplete.afterWrite(msg, cause, TMessageType.EXCEPTION, args, null); }
@Override public void run() { <DeepExtract> Throwable cause = null; try { onComplete.beforeWrite(msg, args, null); out.writeMessageBegin(new TMessage(msg.name, TMessageType.EXCEPTION, msg.seqid)); x.write(out); out.writeMessageEnd(); out.getTransport().flush(); } catch (Throwable e) { cause = e; } onComplete.afterWrite(msg, cause, TMessageType.EXCEPTION, args, null); </DeepExtract> }
netty-thrift
positive
1,294
@Override public void onInit() { super.onInit(); mSharpnessLocation = GLES20.glGetUniformLocation(getProgram(), "sharpness"); mImageWidthFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageWidthFactor"); mImageHeightFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageHeightFactor"); mSharpness = mSharpness; setFloat(mSharpnessLocation, mSharpness); }
@Override public void onInit() { super.onInit(); mSharpnessLocation = GLES20.glGetUniformLocation(getProgram(), "sharpness"); mImageWidthFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageWidthFactor"); mImageHeightFactorLocation = GLES20.glGetUniformLocation(getProgram(), "imageHeightFactor"); <DeepExtract> mSharpness = mSharpness; setFloat(mSharpnessLocation, mSharpness); </DeepExtract> }
MagicShow
positive
1,295
public static void main(String[] args) { byte[] ab = new byte[581969]; BitCoderContext ctx = new BitCoderContext(ab); for (int i = 0; i < 31; i++) { ctx.encodeVarBits((1 << i) + 3); } for (int i = 0; i < 100000; i += 13) { ctx.encodeVarBits(i); } flushBuffer(); if (bits > 0) { ab[++idx] = (byte) (b & 0xff); } return idx + 1; ctx = new BitCoderContext(ab); for (int i = 0; i < 31; i++) { int value = ctx.decodeVarBits(); int v0 = (1 << i) + 3; if (v0 != value) throw new RuntimeException("value mismatch value=" + value + "v0=" + v0); } for (int i = 0; i < 100000; i += 13) { int value = ctx.decodeVarBits(); if (value != i) throw new RuntimeException("value mismatch i=" + i + "v=" + value); } }
public static void main(String[] args) { byte[] ab = new byte[581969]; BitCoderContext ctx = new BitCoderContext(ab); for (int i = 0; i < 31; i++) { ctx.encodeVarBits((1 << i) + 3); } for (int i = 0; i < 100000; i += 13) { ctx.encodeVarBits(i); } <DeepExtract> flushBuffer(); if (bits > 0) { ab[++idx] = (byte) (b & 0xff); } return idx + 1; </DeepExtract> ctx = new BitCoderContext(ab); for (int i = 0; i < 31; i++) { int value = ctx.decodeVarBits(); int v0 = (1 << i) + 3; if (v0 != value) throw new RuntimeException("value mismatch value=" + value + "v0=" + v0); } for (int i = 0; i < 100000; i += 13) { int value = ctx.decodeVarBits(); if (value != i) throw new RuntimeException("value mismatch i=" + i + "v=" + value); } }
brouter
positive
1,296
public Criteria andPhoneNotEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <>", value)); return (Criteria) this; }
public Criteria andPhoneNotEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "phone" + " cannot be null"); } criteria.add(new Criterion("phone <>", value)); </DeepExtract> return (Criteria) this; }
garbage-collection
positive
1,298
public boolean updateRelationshipProperty(String type, String label1, String from, String label2, String to, int number, String property, Object value) { if (property.startsWith("~")) return false; int node1; if (!nodeKeys.containsKey(label1)) { node1 = -1; } else { node1 = nodeKeys.get(label1).getInt(from); } int node2; if (!nodeKeys.containsKey(label2)) { node2 = -1; } else { node2 = nodeKeys.get(label2).getInt(to); } if (node1 == -1 || node2 == -1) { return false; } long countId = ((long) node1 << 32) + node2; int count = relatedCounts.get(type).get(countId); if (count == 0 || count < number) { return false; } int relId; if (!relationshipKeys.containsKey(type + number)) { relId = -1; } else { relId = relationshipKeys.get(type + number).get(((long) node1 << 32) + node2); } relationships.get(relId).put(property, value); return true; }
public boolean updateRelationshipProperty(String type, String label1, String from, String label2, String to, int number, String property, Object value) { if (property.startsWith("~")) return false; int node1; if (!nodeKeys.containsKey(label1)) { node1 = -1; } else { node1 = nodeKeys.get(label1).getInt(from); } int node2; if (!nodeKeys.containsKey(label2)) { node2 = -1; } else { node2 = nodeKeys.get(label2).getInt(to); } if (node1 == -1 || node2 == -1) { return false; } long countId = ((long) node1 << 32) + node2; int count = relatedCounts.get(type).get(countId); if (count == 0 || count < number) { return false; } <DeepExtract> int relId; if (!relationshipKeys.containsKey(type + number)) { relId = -1; } else { relId = relationshipKeys.get(type + number).get(((long) node1 << 32) + node2); } </DeepExtract> relationships.get(relId).put(property, value); return true; }
uranusdb
positive
1,299
public void setZ(double z) { Point3D coords = new Point3D(0, 0, z); if (coordinates != null) { coords = new Point3D(this.coordinates.getX(), this.coordinates.getY(), z); } if (this.coordinates != null) { this.coordinates = coords; setChanged(); notifyObservers(ModelBoxChange.COORDINATES); } }
public void setZ(double z) { Point3D coords = new Point3D(0, 0, z); if (coordinates != null) { coords = new Point3D(this.coordinates.getX(), this.coordinates.getY(), z); } <DeepExtract> if (this.coordinates != null) { this.coordinates = coords; setChanged(); notifyObservers(ModelBoxChange.COORDINATES); } </DeepExtract> }
ObjectGraphVisualization
positive
1,300
@Nonnull public ItemFilter notIn(ItemSet set) { return new Simple(mode, amount, s -> !set.contains(s)); }
@Nonnull public ItemFilter notIn(ItemSet set) { <DeepExtract> return new Simple(mode, amount, s -> !set.contains(s)); </DeepExtract> }
Technicalities
positive
1,302
public static void enter(Object obj) { System.out.println("Step 1"); System.out.println("Step 2"); synchronized (obj) { System.out.println("Step 3 (never reached here)"); } }
public static void enter(Object obj) { <DeepExtract> </DeepExtract> System.out.println("Step 1"); <DeepExtract> </DeepExtract> System.out.println("Step 2"); <DeepExtract> </DeepExtract> synchronized (obj) { <DeepExtract> </DeepExtract> System.out.println("Step 3 (never reached here)"); <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> }
ijmtdp
positive
1,303
private void initUI(Bundle savedInstanceState) { res = getResources(); initiateActionBar(); try { stock = Inventory.getInstance().getStock(); productCatalog = Inventory.getInstance().getProductCatalog(); } catch (NoDaoSetException e) { e.printStackTrace(); } id = getIntent().getStringExtra("id"); product = productCatalog.getProductById(Integer.parseInt(id)); initUI(savedInstanceState); remember = new String[3]; nameBox.setText(product.getName()); priceBox.setText(product.getUnitPrice() + ""); barcodeBox.setText(product.getBarcode()); setContentView(R.layout.layout_productdetail_main); stockListView = (ListView) findViewById(R.id.stockListView); nameBox = (EditText) findViewById(R.id.nameBox); priceBox = (EditText) findViewById(R.id.priceBox); barcodeBox = (EditText) findViewById(R.id.barcodeBox); stockSumBox = (TextView) findViewById(R.id.stockSumBox); submitEditButton = (Button) findViewById(R.id.submitEditButton); submitEditButton.setVisibility(View.INVISIBLE); cancelEditButton = (Button) findViewById(R.id.cancelEditButton); cancelEditButton.setVisibility(View.INVISIBLE); openEditButton = (Button) findViewById(R.id.openEditButton); openEditButton.setVisibility(View.VISIBLE); addProductLotButton = (Button) findViewById(R.id.addProductLotButton); mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator(res.getString(R.string.product_detail)).setContent(R.id.tab1)); mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator(res.getString(R.string.stock)).setContent(R.id.tab2)); mTabHost.setCurrentTab(0); popDialog = new AlertDialog.Builder(this); inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); addProductLotButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showAddProductLot(); } }); openEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { edit(); } }); submitEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { submitEdit(); } }); cancelEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { cancelEdit(); } }); }
private void initUI(Bundle savedInstanceState) { <DeepExtract> res = getResources(); initiateActionBar(); try { stock = Inventory.getInstance().getStock(); productCatalog = Inventory.getInstance().getProductCatalog(); } catch (NoDaoSetException e) { e.printStackTrace(); } id = getIntent().getStringExtra("id"); product = productCatalog.getProductById(Integer.parseInt(id)); initUI(savedInstanceState); remember = new String[3]; nameBox.setText(product.getName()); priceBox.setText(product.getUnitPrice() + ""); barcodeBox.setText(product.getBarcode()); </DeepExtract> setContentView(R.layout.layout_productdetail_main); stockListView = (ListView) findViewById(R.id.stockListView); nameBox = (EditText) findViewById(R.id.nameBox); priceBox = (EditText) findViewById(R.id.priceBox); barcodeBox = (EditText) findViewById(R.id.barcodeBox); stockSumBox = (TextView) findViewById(R.id.stockSumBox); submitEditButton = (Button) findViewById(R.id.submitEditButton); submitEditButton.setVisibility(View.INVISIBLE); cancelEditButton = (Button) findViewById(R.id.cancelEditButton); cancelEditButton.setVisibility(View.INVISIBLE); openEditButton = (Button) findViewById(R.id.openEditButton); openEditButton.setVisibility(View.VISIBLE); addProductLotButton = (Button) findViewById(R.id.addProductLotButton); mTabHost = (TabHost) findViewById(android.R.id.tabhost); mTabHost.setup(); mTabHost.addTab(mTabHost.newTabSpec("tab_test1").setIndicator(res.getString(R.string.product_detail)).setContent(R.id.tab1)); mTabHost.addTab(mTabHost.newTabSpec("tab_test2").setIndicator(res.getString(R.string.stock)).setContent(R.id.tab2)); mTabHost.setCurrentTab(0); popDialog = new AlertDialog.Builder(this); inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE); addProductLotButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { showAddProductLot(); } }); openEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { edit(); } }); submitEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { submitEdit(); } }); cancelEditButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { cancelEdit(); } }); }
pos
positive
1,304
public void setRenderer(GLSurfaceView.Renderer renderer) { if (mGLThread != null) { throw new IllegalStateException("setRenderer has already been called for this instance."); } if (mEGLConfigChooser == null) { mEGLConfigChooser = new SimpleEGLConfigChooser(true); } if (mEGLContextFactory == null) { mEGLContextFactory = new DefaultContextFactory(); } if (mEGLWindowSurfaceFactory == null) { mEGLWindowSurfaceFactory = new DefaultWindowSurfaceFactory(); } mRenderer = renderer; mGLThread = new GLThread(mThisWeakRef); if (LOG_EGL) { Log.w("EglHelper", "startRecord() tid=" + Thread.currentThread().getId()); } mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); if (mEglDisplay == EGL10.EGL_NO_DISPLAY) { throw new RuntimeException("eglGetDisplay failed"); } int[] version = new int[2]; if (!mEgl.eglInitialize(mEglDisplay, version)) { throw new RuntimeException("eglInitialize failed"); } GLTextureView view = mGLTextureViewWeakRef.get(); if (view == null) { mEglConfig = null; mEglContext = null; } else { mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); } if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) { mEglContext = null; throwEglException("createContext"); } if (LOG_EGL) { Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId()); } mEglSurface = null; }
public void setRenderer(GLSurfaceView.Renderer renderer) { if (mGLThread != null) { throw new IllegalStateException("setRenderer has already been called for this instance."); } if (mEGLConfigChooser == null) { mEGLConfigChooser = new SimpleEGLConfigChooser(true); } if (mEGLContextFactory == null) { mEGLContextFactory = new DefaultContextFactory(); } if (mEGLWindowSurfaceFactory == null) { mEGLWindowSurfaceFactory = new DefaultWindowSurfaceFactory(); } mRenderer = renderer; mGLThread = new GLThread(mThisWeakRef); <DeepExtract> if (LOG_EGL) { Log.w("EglHelper", "startRecord() tid=" + Thread.currentThread().getId()); } mEgl = (EGL10) EGLContext.getEGL(); mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); if (mEglDisplay == EGL10.EGL_NO_DISPLAY) { throw new RuntimeException("eglGetDisplay failed"); } int[] version = new int[2]; if (!mEgl.eglInitialize(mEglDisplay, version)) { throw new RuntimeException("eglInitialize failed"); } GLTextureView view = mGLTextureViewWeakRef.get(); if (view == null) { mEglConfig = null; mEglContext = null; } else { mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay); mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig); } if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) { mEglContext = null; throwEglException("createContext"); } if (LOG_EGL) { Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId()); } mEglSurface = null; </DeepExtract> }
VideoRecorder
positive
1,305
public Parcelable onSaveInstanceState() { SavedState savedState = new SavedState(super.onSaveInstanceState()); return this.mChecked; return savedState; }
public Parcelable onSaveInstanceState() { SavedState savedState = new SavedState(super.onSaveInstanceState()); <DeepExtract> return this.mChecked; </DeepExtract> return savedState; }
SamsungOneUi
positive
1,306
public int run(String[] args) throws IOException, ParseException { JobConf conf = new JobConf(getConf(), PersistLogBuilder.class); String line = null; Options options = new Options(); options.addOption("i", true, "input file list"); options.addOption("o", true, "output directory"); options.addOption("r", true, "number of reducers"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (!cmd.hasOption("i") || !cmd.hasOption("o")) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setWidth(80); helpFormatter.printHelp(CLI_USAGE, CLI_HEADER, options, ""); System.exit(1); } this.input = cmd.getOptionValue("i"); this.output = cmd.getOptionValue("o"); if (cmd.hasOption("r")) { reducers = Integer.parseInt(cmd.getOptionValue("r")); } BufferedReader br = new BufferedReader(new FileReader(this.input)); int lineCount = 0; while ((line = br.readLine()) != null) { FileInputFormat.addInputPath(conf, new Path(line)); System.out.print("Added " + ++lineCount + " input paths.\r"); } System.out.println(); FileOutputFormat.setOutputPath(conf, new Path(this.output)); conf.setJobName(this.input + "_" + System.currentTimeMillis()); conf.setInputFormat(ArchiveFileInputFormat.class); conf.setMapperClass(PersistLogMapper.class); conf.setMapOutputValueClass(Text.class); conf.setMapOutputValueClass(Text.class); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(Text.class); conf.setOutputFormat(TextOutputFormat.class); conf.setNumReduceTasks(reducers); conf.set("mapred.reduce.tasks.speculative.execution", "false"); conf.set("mapred.output.compress", "true"); conf.set("mapred.compress.map.output", "true"); conf.setClass("mapred.output.compression.codec", GzipCodec.class, CompressionCodec.class); JobClient client = new JobClient(conf); client.submitJob(conf); return 0; }
public int run(String[] args) throws IOException, ParseException { JobConf conf = new JobConf(getConf(), PersistLogBuilder.class); String line = null; Options options = new Options(); options.addOption("i", true, "input file list"); options.addOption("o", true, "output directory"); options.addOption("r", true, "number of reducers"); CommandLineParser parser = new PosixParser(); CommandLine cmd = parser.parse(options, args); if (!cmd.hasOption("i") || !cmd.hasOption("o")) { HelpFormatter helpFormatter = new HelpFormatter(); helpFormatter.setWidth(80); helpFormatter.printHelp(CLI_USAGE, CLI_HEADER, options, ""); System.exit(1); } this.input = cmd.getOptionValue("i"); this.output = cmd.getOptionValue("o"); if (cmd.hasOption("r")) { reducers = Integer.parseInt(cmd.getOptionValue("r")); } BufferedReader br = new BufferedReader(new FileReader(this.input)); int lineCount = 0; while ((line = br.readLine()) != null) { FileInputFormat.addInputPath(conf, new Path(line)); System.out.print("Added " + ++lineCount + " input paths.\r"); } System.out.println(); FileOutputFormat.setOutputPath(conf, new Path(this.output)); conf.setJobName(this.input + "_" + System.currentTimeMillis()); conf.setInputFormat(ArchiveFileInputFormat.class); conf.setMapperClass(PersistLogMapper.class); conf.setMapOutputValueClass(Text.class); conf.setMapOutputValueClass(Text.class); conf.setOutputKeyClass(Text.class); conf.setOutputValueClass(Text.class); conf.setOutputFormat(TextOutputFormat.class); conf.setNumReduceTasks(reducers); <DeepExtract> conf.set("mapred.reduce.tasks.speculative.execution", "false"); conf.set("mapred.output.compress", "true"); conf.set("mapred.compress.map.output", "true"); conf.setClass("mapred.output.compression.codec", GzipCodec.class, CompressionCodec.class); </DeepExtract> JobClient client = new JobClient(conf); client.submitJob(conf); return 0; }
webarchive-discovery
positive
1,307
public void transferOwnership(Address newOwner) { require(Msg.sender().equals(owner), "Only the owner of the contract can execute it."); emit(new OwnershipTransferredEvent(owner, newOwner)); owner = newOwner; }
public void transferOwnership(Address newOwner) { <DeepExtract> require(Msg.sender().equals(owner), "Only the owner of the contract can execute it."); </DeepExtract> emit(new OwnershipTransferredEvent(owner, newOwner)); owner = newOwner; }
nuls-contracts
positive
1,308
public Builder setFp64Contents(int index, double value) { if (!((bitField0_ & 0x00000040) == 0x00000040)) { fp64Contents_ = new java.util.ArrayList<Double>(fp64Contents_); bitField0_ |= 0x00000040; } fp64Contents_.set(index, value); onChanged(); return this; }
public Builder setFp64Contents(int index, double value) { <DeepExtract> if (!((bitField0_ & 0x00000040) == 0x00000040)) { fp64Contents_ = new java.util.ArrayList<Double>(fp64Contents_); bitField0_ |= 0x00000040; } </DeepExtract> fp64Contents_.set(index, value); onChanged(); return this; }
dl_inference
positive
1,309
public static void main(String[] args) { CoinChange clz = new CoinChange(); int[] coins = { 1, 2, 3 }; if (12 <= 1) { return 12; } int[] f = new int[12 + 1]; Arrays.fill(f, Integer.MAX_VALUE); f[0] = 0; for (int i = 1; i * i <= 12; i++) { for (int j = 1; j <= 12; j++) { if (j - i * i < 0) continue; f[j] = Math.min(f[j], f[j - i * i] + 1); } } System.out.println(Arrays.toString(f)); return f[12]; List<String> res = new ArrayList<>(); helper(0, coins, 6, new StringBuilder(), res, 0, 0); System.out.println(Arrays.toString(res.toArray())); }
public static void main(String[] args) { CoinChange clz = new CoinChange(); int[] coins = { 1, 2, 3 }; if (12 <= 1) { return 12; } int[] f = new int[12 + 1]; Arrays.fill(f, Integer.MAX_VALUE); f[0] = 0; for (int i = 1; i * i <= 12; i++) { for (int j = 1; j <= 12; j++) { if (j - i * i < 0) continue; f[j] = Math.min(f[j], f[j - i * i] + 1); } } System.out.println(Arrays.toString(f)); return f[12]; <DeepExtract> List<String> res = new ArrayList<>(); helper(0, coins, 6, new StringBuilder(), res, 0, 0); System.out.println(Arrays.toString(res.toArray())); </DeepExtract> }
interviewprep
positive
1,311
@Test public void testThirdDslContainer() { ClientInterface clientInterface = ElasticSearchHelper.getConfigRestClientUtil(new BaseTemplateContainerImpl("testnamespace7") { @Override protected Map<String, TemplateMeta> loadTemplateMetas(String namespace) { try { List<BaseTemplateMeta> templateMetas = SQLExecutor.queryListWithDBName(BaseTemplateMeta.class, "testdslconfig", "select * from dslconfig where namespace = ?", namespace); if (templateMetas == null) { return null; } else { Map<String, TemplateMeta> templateMetaMap = new HashMap<String, TemplateMeta>(templateMetas.size()); for (BaseTemplateMeta baseTemplateMeta : templateMetas) { templateMetaMap.put(baseTemplateMeta.getName(), baseTemplateMeta); } return templateMetaMap; } } catch (Exception e) { throw new DSLParserException(e); } } @Override protected long getLastModifyTime(String namespace) { return System.currentTimeMillis(); } }); try { testHighlightSearch(clientInterface); } catch (Exception e) { logger.error("", e); } try { testCRUD(clientInterface); } catch (Exception e) { logger.error("", e); } ScriptImpl7 scriptImpl7 = new ScriptImpl7(clientInterface); scriptImpl7.updateDocumentByScriptPath(); scriptImpl7.updateDocumentByScriptQueryPath(); }
@Test public void testThirdDslContainer() { ClientInterface clientInterface = ElasticSearchHelper.getConfigRestClientUtil(new BaseTemplateContainerImpl("testnamespace7") { @Override protected Map<String, TemplateMeta> loadTemplateMetas(String namespace) { try { List<BaseTemplateMeta> templateMetas = SQLExecutor.queryListWithDBName(BaseTemplateMeta.class, "testdslconfig", "select * from dslconfig where namespace = ?", namespace); if (templateMetas == null) { return null; } else { Map<String, TemplateMeta> templateMetaMap = new HashMap<String, TemplateMeta>(templateMetas.size()); for (BaseTemplateMeta baseTemplateMeta : templateMetas) { templateMetaMap.put(baseTemplateMeta.getName(), baseTemplateMeta); } return templateMetaMap; } } catch (Exception e) { throw new DSLParserException(e); } } @Override protected long getLastModifyTime(String namespace) { return System.currentTimeMillis(); } }); try { testHighlightSearch(clientInterface); } catch (Exception e) { logger.error("", e); } try { testCRUD(clientInterface); } catch (Exception e) { logger.error("", e); } <DeepExtract> ScriptImpl7 scriptImpl7 = new ScriptImpl7(clientInterface); scriptImpl7.updateDocumentByScriptPath(); scriptImpl7.updateDocumentByScriptQueryPath(); </DeepExtract> }
elasticsearch-example
positive
1,312
@Override public void store(Path path, String name, BiConsumer<String, IOException> stored) throws IOException { if (Files.size(path) > MAX_SIZE) throw new IllegalArgumentException(path + " exceeds maximum size " + MAX_SIZE); try { checkAccount(); try { B2FileVersion fileInfo = client.getFileInfoByName(bucketInfo.getBucketName(), name); exists -> { if (exists instanceof B2FileVersion) { stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null); } else { try { final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build()); stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null); } catch (B2Exception e) { stored.accept(null, new IOException("Failed to process Backblaze upload", e)); } } }.accept(fileInfo); return; } catch (B2Exception ex) { if (ex.getStatus() != 404) { throw new IOException("File existence check failed", ex); } } exists -> { if (exists instanceof B2FileVersion) { stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null); } else { try { final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build()); stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null); } catch (B2Exception e) { stored.accept(null, new IOException("Failed to process Backblaze upload", e)); } } }.accept(null); } catch (B2Exception e) { throw new IOException("Failed to check Backblaze file", e); } }
@Override public void store(Path path, String name, BiConsumer<String, IOException> stored) throws IOException { if (Files.size(path) > MAX_SIZE) throw new IllegalArgumentException(path + " exceeds maximum size " + MAX_SIZE); <DeepExtract> try { checkAccount(); try { B2FileVersion fileInfo = client.getFileInfoByName(bucketInfo.getBucketName(), name); exists -> { if (exists instanceof B2FileVersion) { stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null); } else { try { final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build()); stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null); } catch (B2Exception e) { stored.accept(null, new IOException("Failed to process Backblaze upload", e)); } } }.accept(fileInfo); return; } catch (B2Exception ex) { if (ex.getStatus() != 404) { throw new IOException("File existence check failed", ex); } } exists -> { if (exists instanceof B2FileVersion) { stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), ((B2FileVersion) exists).getFileName())), null); } else { try { final B2FileVersion upload = this.client.uploadSmallFile(B2UploadFileRequest.builder(bucket, name, Util.mimeType(Util.extension(path)), B2FileContentSource.build(path.toFile())).build()); stored.accept(Util.toUriString(String.format(DOWNLOAD_URL, account.getDownloadUrl(), bucketInfo.getBucketName(), upload.getFileName())), null); } catch (B2Exception e) { stored.accept(null, new IOException("Failed to process Backblaze upload", e)); } } }.accept(null); } catch (B2Exception e) { throw new IOException("Failed to check Backblaze file", e); } </DeepExtract> }
unreal-archive
positive
1,313
@Override public Node next() { if (skip) { skip = false; return current; } Node nextNode = nextImpl(); return nextNode; return current; }
@Override public Node next() { if (skip) { skip = false; return current; } <DeepExtract> Node nextNode = nextImpl(); return nextNode; </DeepExtract> return current; }
libxml2-java
positive
1,314
@Override protected void onCreate(Bundle savedInstanceState) { Log.d(LOGTAG, "onCreate"); super.onCreate(savedInstanceState); vuforiaAppSession = new SampleApplicationSession(this); LayoutInflater inflater = LayoutInflater.from(this); mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay, null, false); mUILayout.setVisibility(View.VISIBLE); mUILayout.setBackgroundColor(Color.BLACK); loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_indicator); loadingDialogHandler.sendEmptyMessage(LoadingDialogHandler.SHOW_LOADING_DIALOG); addContentView(mUILayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); vuforiaAppSession.initAR(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mGestureDetector = new GestureDetector(this, new GestureListener()); mTextures = new Vector<Texture>(); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_Q.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_C.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_A.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_R.png", getAssets())); mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid"); }
@Override protected void onCreate(Bundle savedInstanceState) { Log.d(LOGTAG, "onCreate"); super.onCreate(savedInstanceState); vuforiaAppSession = new SampleApplicationSession(this); LayoutInflater inflater = LayoutInflater.from(this); mUILayout = (RelativeLayout) inflater.inflate(R.layout.camera_overlay, null, false); mUILayout.setVisibility(View.VISIBLE); mUILayout.setBackgroundColor(Color.BLACK); loadingDialogHandler.mLoadingDialogContainer = mUILayout.findViewById(R.id.loading_indicator); loadingDialogHandler.sendEmptyMessage(LoadingDialogHandler.SHOW_LOADING_DIALOG); addContentView(mUILayout, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); vuforiaAppSession.initAR(this, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); mGestureDetector = new GestureDetector(this, new GestureListener()); mTextures = new Vector<Texture>(); <DeepExtract> mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_Q.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_C.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_A.png", getAssets())); mTextures.add(Texture.loadTextureFromApk("FrameMarkers/letter_R.png", getAssets())); </DeepExtract> mIsDroidDevice = android.os.Build.MODEL.toLowerCase().startsWith("droid"); }
Vuforia-Samples-Android-Studio
positive
1,315
@Test public void resolveViewNameNormalDeviceTabletSitePreferenceTabletPrefix() throws Exception { device.setDeviceType(DeviceType.NORMAL); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET); viewResolver.setTabletPrefix("tablet/"); expect(delegateViewResolver.resolveViewName("tablet/" + viewName, locale)).andReturn(view); replay(delegateViewResolver, view); View result = viewResolver.resolveViewName(viewName, locale); assertSame("Invalid view", view, result); verify(delegateViewResolver, view); }
@Test public void resolveViewNameNormalDeviceTabletSitePreferenceTabletPrefix() throws Exception { device.setDeviceType(DeviceType.NORMAL); request.setAttribute(DeviceUtils.CURRENT_DEVICE_ATTRIBUTE, device); request.setAttribute(SitePreferenceHandler.CURRENT_SITE_PREFERENCE_ATTRIBUTE, SitePreference.TABLET); viewResolver.setTabletPrefix("tablet/"); <DeepExtract> expect(delegateViewResolver.resolveViewName("tablet/" + viewName, locale)).andReturn(view); replay(delegateViewResolver, view); View result = viewResolver.resolveViewName(viewName, locale); assertSame("Invalid view", view, result); verify(delegateViewResolver, view); </DeepExtract> }
spring-mobile
positive
1,316
public String readString(int nbytes) throws IOException { byte[] data = new byte[nbytes]; readFully(data, 0, data.length); return new String(data); }
public String readString(int nbytes) throws IOException { byte[] data = new byte[nbytes]; <DeepExtract> readFully(data, 0, data.length); </DeepExtract> return new String(data); }
NomadReader
positive
1,317
@Subscribe(threadMode = ThreadMode.MAIN) public void getSign(ViewSign sign) { user = uDao.selectOnLine(); list = cDao.selectAll(user.getUsername()); RecyclerView.LayoutManager manager = new LinearLayoutManager(this); recyclerView.setLayoutManager(manager); adapter = new AddBalanceAdapter(list, this); recyclerView.setAdapter(adapter); position = SharePreferencesUtils.getInt(this, "PayCard", 0); position = sign.getPosition(); recyclerView.scrollToPosition(position); }
@Subscribe(threadMode = ThreadMode.MAIN) public void getSign(ViewSign sign) { <DeepExtract> user = uDao.selectOnLine(); list = cDao.selectAll(user.getUsername()); RecyclerView.LayoutManager manager = new LinearLayoutManager(this); recyclerView.setLayoutManager(manager); adapter = new AddBalanceAdapter(list, this); recyclerView.setAdapter(adapter); position = SharePreferencesUtils.getInt(this, "PayCard", 0); </DeepExtract> position = sign.getPosition(); recyclerView.scrollToPosition(position); }
CinemaTicket
positive
1,318
public DockerTest loginAsAlice() { this.commands.add(new DockerCommand(this.deployment, "Failed to login to Artipie", List.of("docker", "login", "--username", "alice", "--password", "123", this.registry), new ContainerResultMatcher())); return this; }
public DockerTest loginAsAlice() { <DeepExtract> this.commands.add(new DockerCommand(this.deployment, "Failed to login to Artipie", List.of("docker", "login", "--username", "alice", "--password", "123", this.registry), new ContainerResultMatcher())); return this; </DeepExtract> }
artipie
positive
1,320
@Override public void run() { mResults.remove(key); }
@Override public void run() { <DeepExtract> mResults.remove(key); </DeepExtract> }
POSA-15
positive
1,321
public RecordedProgram build() { RecordedProgram recordedProgram = new RecordedProgram(); if (this == mRecordedProgram) { return; } mAudioLanguages = mRecordedProgram.mAudioLanguages; mBroadcastGenres = mRecordedProgram.mBroadcastGenres; mCanonicalGenres = mRecordedProgram.mCanonicalGenres; mChannelId = mRecordedProgram.mChannelId; mContentRatings = mRecordedProgram.mContentRatings; mEpisodeDisplayNumber = mRecordedProgram.mEpisodeDisplayNumber; mEpisodeTitle = mRecordedProgram.mEpisodeTitle; mId = mRecordedProgram.mId; mInputId = mRecordedProgram.mInputId; mInternalProviderData = mRecordedProgram.mInternalProviderData; mLongDescription = mRecordedProgram.mLongDescription; mPosterArtUri = mRecordedProgram.mPosterArtUri; mRecordingDataBytes = mRecordedProgram.mRecordingDataBytes; mRecordingDataUri = mRecordedProgram.mRecordingDataUri; mRecordingDurationMillis = mRecordedProgram.mRecordingDurationMillis; mRecordingExpireTimeUtcMillis = mRecordedProgram.mRecordingExpireTimeUtcMillis; mSearchable = mRecordedProgram.mSearchable; mSeasonDisplayNumber = mRecordedProgram.mSeasonDisplayNumber; mSeasonTitle = mRecordedProgram.mSeasonTitle; mShortDescription = mRecordedProgram.mShortDescription; mStartTimeUtcMillis = mRecordedProgram.mStartTimeUtcMillis; mEndTimeUtcMillis = mRecordedProgram.mEndTimeUtcMillis; mThumbnailUri = mRecordedProgram.mThumbnailUri; mTitle = mRecordedProgram.mTitle; mVersionNumber = mRecordedProgram.mVersionNumber; mVideoHeight = mRecordedProgram.mVideoHeight; mVideoWidth = mRecordedProgram.mVideoWidth; if (recordedProgram.getInputId() == null) { throw new IllegalArgumentException("This recorded program does not have an Input Id"); } if (recordedProgram.getRecordingDurationMillis() == INVALID_INT_VALUE && recordedProgram.getEndTimeUtcMillis() > 0) { recordedProgram.mRecordingDurationMillis = recordedProgram.getEndTimeUtcMillis() - recordedProgram.getStartTimeUtcMillis(); } return recordedProgram; }
public RecordedProgram build() { RecordedProgram recordedProgram = new RecordedProgram(); <DeepExtract> if (this == mRecordedProgram) { return; } mAudioLanguages = mRecordedProgram.mAudioLanguages; mBroadcastGenres = mRecordedProgram.mBroadcastGenres; mCanonicalGenres = mRecordedProgram.mCanonicalGenres; mChannelId = mRecordedProgram.mChannelId; mContentRatings = mRecordedProgram.mContentRatings; mEpisodeDisplayNumber = mRecordedProgram.mEpisodeDisplayNumber; mEpisodeTitle = mRecordedProgram.mEpisodeTitle; mId = mRecordedProgram.mId; mInputId = mRecordedProgram.mInputId; mInternalProviderData = mRecordedProgram.mInternalProviderData; mLongDescription = mRecordedProgram.mLongDescription; mPosterArtUri = mRecordedProgram.mPosterArtUri; mRecordingDataBytes = mRecordedProgram.mRecordingDataBytes; mRecordingDataUri = mRecordedProgram.mRecordingDataUri; mRecordingDurationMillis = mRecordedProgram.mRecordingDurationMillis; mRecordingExpireTimeUtcMillis = mRecordedProgram.mRecordingExpireTimeUtcMillis; mSearchable = mRecordedProgram.mSearchable; mSeasonDisplayNumber = mRecordedProgram.mSeasonDisplayNumber; mSeasonTitle = mRecordedProgram.mSeasonTitle; mShortDescription = mRecordedProgram.mShortDescription; mStartTimeUtcMillis = mRecordedProgram.mStartTimeUtcMillis; mEndTimeUtcMillis = mRecordedProgram.mEndTimeUtcMillis; mThumbnailUri = mRecordedProgram.mThumbnailUri; mTitle = mRecordedProgram.mTitle; mVersionNumber = mRecordedProgram.mVersionNumber; mVideoHeight = mRecordedProgram.mVideoHeight; mVideoWidth = mRecordedProgram.mVideoWidth; </DeepExtract> if (recordedProgram.getInputId() == null) { throw new IllegalArgumentException("This recorded program does not have an Input Id"); } if (recordedProgram.getRecordingDurationMillis() == INVALID_INT_VALUE && recordedProgram.getEndTimeUtcMillis() > 0) { recordedProgram.mRecordingDurationMillis = recordedProgram.getEndTimeUtcMillis() - recordedProgram.getStartTimeUtcMillis(); } return recordedProgram; }
androidtv-sample-inputs
positive
1,322
@Override protected void calculateOffsets() { float legendRight = 0f, legendBottom = 0f; float legendRight = 0f, legendBottom = 0f; if (mDrawLegend && mLegend != null && mLegend.getPosition() != LegendPosition.NONE) { if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) { float spacing = Utils.convertDpToPixel(12f); legendRight = mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace() + spacing; mLegendLabelPaint.setTextAlign(Align.LEFT); } else if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) { if (mXLabels.getPosition() == XLabelPosition.TOP) legendBottom = mLegendLabelPaint.getTextSize() * 3.5f; else { legendBottom = mLegendLabelPaint.getTextSize() * 2.5f; } } mLegend.setOffsetBottom(legendBottom); mLegend.setOffsetRight(legendRight); } float yleft = 0f, yright = 0f; float yleft = 0f, yright = 0f; String label = mYLabels.getLongestLabel(); float ylabelwidth = Utils.calcTextWidth(mYLabelPaint, label + mUnit + (mYChartMin < 0 ? "----" : "+++")); if (mDrawYLabels) { if (mYLabels.getPosition() == YLabelPosition.LEFT) { yleft = ylabelwidth; mYLabelPaint.setTextAlign(Align.RIGHT); } else if (mYLabels.getPosition() == YLabelPosition.RIGHT) { yright = ylabelwidth; mYLabelPaint.setTextAlign(Align.LEFT); } else if (mYLabels.getPosition() == YLabelPosition.BOTH_SIDED) { yright = ylabelwidth; yleft = ylabelwidth; } } float xtop = 0f, xbottom = 0f; float xtop = 0f, xbottom = 0f; float xlabelheight = Utils.calcTextHeight(mXLabelPaint, "Q") * 2f; if (mDrawXLabels) { if (mXLabels.getPosition() == XLabelPosition.BOTTOM) { xbottom = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.TOP) { xtop = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.BOTH_SIDED) { xbottom = xlabelheight; xtop = xlabelheight; } } float min = Utils.convertDpToPixel(11f); mOffsetBottom = Math.max(min, xbottom + legendBottom); mOffsetTop = Math.max(min, xtop); mOffsetLeft = Math.max(min, yleft); mOffsetRight = Math.max(min, yright + legendRight); if (mLegend != null) { mLegend.setOffsetTop(mOffsetTop + min / 3f); mLegend.setOffsetLeft(mOffsetLeft); } prepareContentRect(); prepareMatrixValuePx(); prepareMatrixOffset(); if (mLogEnabled) Log.i(LOG_TAG, "Matrices prepared."); }
@Override protected void calculateOffsets() { float legendRight = 0f, legendBottom = 0f; float legendRight = 0f, legendBottom = 0f; if (mDrawLegend && mLegend != null && mLegend.getPosition() != LegendPosition.NONE) { if (mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART || mLegend.getPosition() == LegendPosition.RIGHT_OF_CHART_CENTER) { float spacing = Utils.convertDpToPixel(12f); legendRight = mLegend.getMaximumEntryLength(mLegendLabelPaint) + mLegend.getFormSize() + mLegend.getFormToTextSpace() + spacing; mLegendLabelPaint.setTextAlign(Align.LEFT); } else if (mLegend.getPosition() == LegendPosition.BELOW_CHART_LEFT || mLegend.getPosition() == LegendPosition.BELOW_CHART_RIGHT || mLegend.getPosition() == LegendPosition.BELOW_CHART_CENTER) { if (mXLabels.getPosition() == XLabelPosition.TOP) legendBottom = mLegendLabelPaint.getTextSize() * 3.5f; else { legendBottom = mLegendLabelPaint.getTextSize() * 2.5f; } } mLegend.setOffsetBottom(legendBottom); mLegend.setOffsetRight(legendRight); } float yleft = 0f, yright = 0f; float yleft = 0f, yright = 0f; String label = mYLabels.getLongestLabel(); float ylabelwidth = Utils.calcTextWidth(mYLabelPaint, label + mUnit + (mYChartMin < 0 ? "----" : "+++")); if (mDrawYLabels) { if (mYLabels.getPosition() == YLabelPosition.LEFT) { yleft = ylabelwidth; mYLabelPaint.setTextAlign(Align.RIGHT); } else if (mYLabels.getPosition() == YLabelPosition.RIGHT) { yright = ylabelwidth; mYLabelPaint.setTextAlign(Align.LEFT); } else if (mYLabels.getPosition() == YLabelPosition.BOTH_SIDED) { yright = ylabelwidth; yleft = ylabelwidth; } } float xtop = 0f, xbottom = 0f; float xtop = 0f, xbottom = 0f; float xlabelheight = Utils.calcTextHeight(mXLabelPaint, "Q") * 2f; if (mDrawXLabels) { if (mXLabels.getPosition() == XLabelPosition.BOTTOM) { xbottom = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.TOP) { xtop = xlabelheight; } else if (mXLabels.getPosition() == XLabelPosition.BOTH_SIDED) { xbottom = xlabelheight; xtop = xlabelheight; } } float min = Utils.convertDpToPixel(11f); mOffsetBottom = Math.max(min, xbottom + legendBottom); mOffsetTop = Math.max(min, xtop); mOffsetLeft = Math.max(min, yleft); mOffsetRight = Math.max(min, yright + legendRight); if (mLegend != null) { mLegend.setOffsetTop(mOffsetTop + min / 3f); mLegend.setOffsetLeft(mOffsetLeft); } prepareContentRect(); <DeepExtract> prepareMatrixValuePx(); prepareMatrixOffset(); if (mLogEnabled) Log.i(LOG_TAG, "Matrices prepared."); </DeepExtract> }
MPChartLib
positive
1,323
public void putSafeArray(SafeArray in) { if (m_pVariant != 0) { return getVariantType(); } else { throw new IllegalStateException("uninitialized Variant"); } putVariantSafeArray(in); }
public void putSafeArray(SafeArray in) { <DeepExtract> if (m_pVariant != 0) { return getVariantType(); } else { throw new IllegalStateException("uninitialized Variant"); } </DeepExtract> putVariantSafeArray(in); }
jacob
positive
1,324
@Test public void testReadAsBinary() throws Throwable { this.requestAction = http -> { final ByteArrayOutputStream body = new ByteArrayOutputStream(); http.<ByteBuffer>onchunk(data -> { byte[] bytes = new byte[data.remaining()]; data.get(bytes); body.write(bytes, 0, bytes.length); }).onend($ -> { threadAssertTrue(Arrays.equals(body.toByteArray(), new byte[] { 'h', 'i' })); resume(); }).readAsBinary(); }; client.newRequest(uri()).method(HttpMethod.POST).content(new BytesContentProvider(new byte[] { 'h', 'i' }), "text/plain").send(ASYNC); await(); }
@Test public void testReadAsBinary() throws Throwable { <DeepExtract> this.requestAction = http -> { final ByteArrayOutputStream body = new ByteArrayOutputStream(); http.<ByteBuffer>onchunk(data -> { byte[] bytes = new byte[data.remaining()]; data.get(bytes); body.write(bytes, 0, bytes.length); }).onend($ -> { threadAssertTrue(Arrays.equals(body.toByteArray(), new byte[] { 'h', 'i' })); resume(); }).readAsBinary(); }; </DeepExtract> client.newRequest(uri()).method(HttpMethod.POST).content(new BytesContentProvider(new byte[] { 'h', 'i' }), "text/plain").send(ASYNC); await(); }
asity
positive
1,325
private static void solve(PegStack[] pegs) { int srcPeg = 0; int dstPeg = 2; int numberOfDisks = pegs[0].bottomValue(); if (numberOfDisks == 0) { return; } int tmpPeg = getTemporaryPeg(srcPeg, dstPeg); move(pegs, srcPeg, tmpPeg, numberOfDisks - 1); moveOneDisk(pegs, srcPeg, dstPeg); move(pegs, tmpPeg, dstPeg, numberOfDisks - 1); }
private static void solve(PegStack[] pegs) { int srcPeg = 0; int dstPeg = 2; int numberOfDisks = pegs[0].bottomValue(); <DeepExtract> if (numberOfDisks == 0) { return; } int tmpPeg = getTemporaryPeg(srcPeg, dstPeg); move(pegs, srcPeg, tmpPeg, numberOfDisks - 1); moveOneDisk(pegs, srcPeg, dstPeg); move(pegs, tmpPeg, dstPeg, numberOfDisks - 1); </DeepExtract> }
data-structures-in-java
positive
1,326
public void final_binding(Token finalKeyword) { printRuleHeader(454, "final-binding", ""); System.out.println(); }
public void final_binding(Token finalKeyword) { printRuleHeader(454, "final-binding", ""); <DeepExtract> System.out.println(); </DeepExtract> }
open-fortran-parser
positive
1,327
@Override public void onClick(View v) { if (PViewSizeUtils.onDoubleClick()) { return; } Intent intent = new Intent(); intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, mSelectList); setResult(true ? ImagePicker.REQ_PICKER_RESULT_CODE : RESULT_CANCELED, intent); finish(); }
@Override public void onClick(View v) { if (PViewSizeUtils.onDoubleClick()) { return; } <DeepExtract> Intent intent = new Intent(); intent.putExtra(ImagePicker.INTENT_KEY_PICKER_RESULT, mSelectList); setResult(true ? ImagePicker.REQ_PICKER_RESULT_CODE : RESULT_CANCELED, intent); finish(); </DeepExtract> }
BaseDemo
positive
1,328
public static void dragBy(final Node node, final double offsetX, final double offsetY, final double dx, final double dy) { final double startX = node.getLayoutX() + offsetX; final double startY = node.getLayoutY() + offsetY; final double dragX = startX + (node.getLayoutX() + dx - node.getLayoutX()); final double dragY = startY + (node.getLayoutY() + dy - node.getLayoutY()); final MouseEvent pressed = createMouseEvent(MouseEvent.MOUSE_PRESSED, startX, startY); final MouseEvent dragged = createMouseEvent(MouseEvent.MOUSE_DRAGGED, dragX, dragY); final MouseEvent released = createMouseEvent(MouseEvent.MOUSE_RELEASED, dragX, dragY); Event.fireEvent(node, pressed); Event.fireEvent(node, dragged); Event.fireEvent(node, released); }
public static void dragBy(final Node node, final double offsetX, final double offsetY, final double dx, final double dy) { <DeepExtract> final double startX = node.getLayoutX() + offsetX; final double startY = node.getLayoutY() + offsetY; final double dragX = startX + (node.getLayoutX() + dx - node.getLayoutX()); final double dragY = startY + (node.getLayoutY() + dy - node.getLayoutY()); final MouseEvent pressed = createMouseEvent(MouseEvent.MOUSE_PRESSED, startX, startY); final MouseEvent dragged = createMouseEvent(MouseEvent.MOUSE_DRAGGED, dragX, dragY); final MouseEvent released = createMouseEvent(MouseEvent.MOUSE_RELEASED, dragX, dragY); Event.fireEvent(node, pressed); Event.fireEvent(node, dragged); Event.fireEvent(node, released); </DeepExtract> }
graph-editor
positive
1,329
@Override public void setNString(int arg0, String arg1) throws SQLException { if (arg0 <= 0) throw new SQLException("Invalid position for parameter (" + arg0 + ")"); this.parameters.put(Integer.valueOf(arg0), arg1); }
@Override public void setNString(int arg0, String arg1) throws SQLException { <DeepExtract> if (arg0 <= 0) throw new SQLException("Invalid position for parameter (" + arg0 + ")"); this.parameters.put(Integer.valueOf(arg0), arg1); </DeepExtract> }
jdbc-redis
positive
1,330
@Override public void keyTyped(KeyEvent ev) { if (surface != null && !surface.requestFocusInWindow()) { surface.requestFocus(); } ev.consume(); }
@Override public void keyTyped(KeyEvent ev) { <DeepExtract> if (surface != null && !surface.requestFocusInWindow()) { surface.requestFocus(); } </DeepExtract> ev.consume(); }
tvnjviewer
positive
1,331
static private String formatDouble(double dd, int minPrecision, int maxPrecision) { BigDecimal bd = new BigDecimal(dd, MathContext.DECIMAL128); bd = bd.setScale(maxPrecision, RoundingMode.HALF_UP); return formatBigDecimal(bd, 2, 7); }
static private String formatDouble(double dd, int minPrecision, int maxPrecision) { BigDecimal bd = new BigDecimal(dd, MathContext.DECIMAL128); bd = bd.setScale(maxPrecision, RoundingMode.HALF_UP); <DeepExtract> return formatBigDecimal(bd, 2, 7); </DeepExtract> }
tradelib
positive
1,332
private static void initializePackageLibraryGit(UnityProjectImportContext context, File packageDir, List<Runnable> writeCommits, Map<String, UnityAssemblyContext> asmdefs, LibraryTable.ModifiableModel librariesModModel) { VirtualFile packageVDir = LocalFileSystem.getInstance().findFileByIoFile(packageDir); if (packageVDir == null) { return; } Map<String, UnityAssemblyContext> assemblies = new HashMap<>(); VirtualFileUtil.visitChildrenRecursively(packageVDir, new AsmDefFileVisitor(context.getProject(), UnityAssemblyType.FROM_EXTERNAL_PACKAGE, assemblies)); asmdefs.putAll(assemblies); for (UnityAssemblyContext unityAssemblyContext : assemblies.values()) { String libraryName = "Unity: " + packageDir.getName() + " [" + unityAssemblyContext.getName() + "]"; VirtualFile asmDirectory = unityAssemblyContext.getAsmDirectory(); if (asmDirectory == null) { continue; } Library oldLibrary = librariesModModel.getLibraryByName(libraryName); if (oldLibrary != null) { librariesModModel.removeLibrary(oldLibrary); } Library library = librariesModModel.createLibrary(libraryName, UnityPackageLibraryType.ID); Library.ModifiableModel modifiableModel = library.getModifiableModel(); unityAssemblyContext.setLibrary(library); modifiableModel.addRoot(asmDirectory, BinariesOrderRootType.getInstance()); modifiableModel.addRoot(asmDirectory, SourcesOrderRootType.getInstance()); for (UnityAssemblyContext anotherAssembly : assemblies.values()) { if (unityAssemblyContext == anotherAssembly || anotherAssembly.getAsmDirectory() == null) { continue; } VirtualFile anotherDirectory = anotherAssembly.getAsmDirectory(); if (VirtualFileUtil.isAncestor(asmDirectory, anotherDirectory, false)) { modifiableModel.addExcludedRoot(anotherDirectory.getUrl()); } } writeCommits.add(modifiableModel::commit); } }
private static void initializePackageLibraryGit(UnityProjectImportContext context, File packageDir, List<Runnable> writeCommits, Map<String, UnityAssemblyContext> asmdefs, LibraryTable.ModifiableModel librariesModModel) { <DeepExtract> VirtualFile packageVDir = LocalFileSystem.getInstance().findFileByIoFile(packageDir); if (packageVDir == null) { return; } Map<String, UnityAssemblyContext> assemblies = new HashMap<>(); VirtualFileUtil.visitChildrenRecursively(packageVDir, new AsmDefFileVisitor(context.getProject(), UnityAssemblyType.FROM_EXTERNAL_PACKAGE, assemblies)); asmdefs.putAll(assemblies); for (UnityAssemblyContext unityAssemblyContext : assemblies.values()) { String libraryName = "Unity: " + packageDir.getName() + " [" + unityAssemblyContext.getName() + "]"; VirtualFile asmDirectory = unityAssemblyContext.getAsmDirectory(); if (asmDirectory == null) { continue; } Library oldLibrary = librariesModModel.getLibraryByName(libraryName); if (oldLibrary != null) { librariesModModel.removeLibrary(oldLibrary); } Library library = librariesModModel.createLibrary(libraryName, UnityPackageLibraryType.ID); Library.ModifiableModel modifiableModel = library.getModifiableModel(); unityAssemblyContext.setLibrary(library); modifiableModel.addRoot(asmDirectory, BinariesOrderRootType.getInstance()); modifiableModel.addRoot(asmDirectory, SourcesOrderRootType.getInstance()); for (UnityAssemblyContext anotherAssembly : assemblies.values()) { if (unityAssemblyContext == anotherAssembly || anotherAssembly.getAsmDirectory() == null) { continue; } VirtualFile anotherDirectory = anotherAssembly.getAsmDirectory(); if (VirtualFileUtil.isAncestor(asmDirectory, anotherDirectory, false)) { modifiableModel.addExcludedRoot(anotherDirectory.getUrl()); } } writeCommits.add(modifiableModel::commit); } </DeepExtract> }
consulo-unity3d
positive
1,333
public Criteria andAgeBetween(Integer value1, Integer value2) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "age" + " cannot be null"); } criteria.add(new Criterion("age between", value1, value2)); return (Criteria) this; }
public Criteria andAgeBetween(Integer value1, Integer value2) { <DeepExtract> if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + "age" + " cannot be null"); } criteria.add(new Criterion("age between", value1, value2)); </DeepExtract> return (Criteria) this; }
Whome
positive
1,334
@Override public int findColumn(String columnLabel) throws SQLException { if (isClosed()) { throw new SQLException("ResultSet is closed"); } if (columnLabel == null) { throw new SQLException("Column label is null"); } Integer index = fieldMap.get(columnLabel.toLowerCase(ENGLISH)); if (index == null) { throw new SQLException("Invalid column label: " + columnLabel); } return index; }
@Override public int findColumn(String columnLabel) throws SQLException { if (isClosed()) { throw new SQLException("ResultSet is closed"); } <DeepExtract> if (columnLabel == null) { throw new SQLException("Column label is null"); } Integer index = fieldMap.get(columnLabel.toLowerCase(ENGLISH)); if (index == null) { throw new SQLException("Invalid column label: " + columnLabel); } return index; </DeepExtract> }
presto-jdbc-java6
positive
1,335
public void draw() { if (!visible) return; if (bufferInvalid) { Graphics2D g2d = buffer.g2; bufferInvalid = false; buffer.beginDraw(); buffer.background(buffer.color(255, 0)); buffer.noStroke(); buffer.fill(palette[BACK_COLOR]); buffer.rect(0, 0, width, itemHeight); if (expanded) { buffer.fill(palette[ITEM_BACK_COLOR]); buffer.rect(0, itemHeight, width, itemHeight * dropListActualSize); } float px = TPAD, py; TextLayout line; line = selText.getLines(g2d).getFirst().layout; py = (itemHeight + line.getAscent() - line.getDescent()) / 2; g2d.setColor(jpalette[FORE_COLOR]); line.draw(g2d, px, py); if (expanded) { g2d.setColor(jpalette[ITEM_FORE_COLOR]); for (int i = 0; i < dropListActualSize; i++) { py += itemHeight; if (currOverItem == startItem + i) g2d.setColor(jpalette[OVER_ITEM_FORE_COLOR]); else g2d.setColor(jpalette[ITEM_FORE_COLOR]); line = sitems[startItem + i].getLines(g2d).getFirst().layout; line.draw(g2d, px, py); } } buffer.endDraw(); } winApp.pushStyle(); winApp.pushMatrix(); winApp.translate(cx, cy); winApp.rotate(rotAngle); winApp.pushMatrix(); winApp.translate(-halfWidth, -halfHeight); winApp.imageMode(PApplet.CORNER); if (alphaLevel < 255) winApp.tint(TINT_FOR_ALPHA, alphaLevel); winApp.image(buffer, 0, 0); winApp.popMatrix(); if (children != null) { for (GAbstractControl c : children) c.draw(); } winApp.popMatrix(); winApp.popStyle(); }
public void draw() { if (!visible) return; <DeepExtract> if (bufferInvalid) { Graphics2D g2d = buffer.g2; bufferInvalid = false; buffer.beginDraw(); buffer.background(buffer.color(255, 0)); buffer.noStroke(); buffer.fill(palette[BACK_COLOR]); buffer.rect(0, 0, width, itemHeight); if (expanded) { buffer.fill(palette[ITEM_BACK_COLOR]); buffer.rect(0, itemHeight, width, itemHeight * dropListActualSize); } float px = TPAD, py; TextLayout line; line = selText.getLines(g2d).getFirst().layout; py = (itemHeight + line.getAscent() - line.getDescent()) / 2; g2d.setColor(jpalette[FORE_COLOR]); line.draw(g2d, px, py); if (expanded) { g2d.setColor(jpalette[ITEM_FORE_COLOR]); for (int i = 0; i < dropListActualSize; i++) { py += itemHeight; if (currOverItem == startItem + i) g2d.setColor(jpalette[OVER_ITEM_FORE_COLOR]); else g2d.setColor(jpalette[ITEM_FORE_COLOR]); line = sitems[startItem + i].getLines(g2d).getFirst().layout; line.draw(g2d, px, py); } } buffer.endDraw(); } </DeepExtract> winApp.pushStyle(); winApp.pushMatrix(); winApp.translate(cx, cy); winApp.rotate(rotAngle); winApp.pushMatrix(); winApp.translate(-halfWidth, -halfHeight); winApp.imageMode(PApplet.CORNER); if (alphaLevel < 255) winApp.tint(TINT_FOR_ALPHA, alphaLevel); winApp.image(buffer, 0, 0); winApp.popMatrix(); if (children != null) { for (GAbstractControl c : children) c.draw(); } winApp.popMatrix(); winApp.popStyle(); }
hid-serial
positive
1,336
private void setToolbarTitle(long id) { Cursor cursor = ShaderEditorApp.db.getShader(id); if (Database.closeIfEmpty(cursor)) { return; } setQualitySpinner(Database.getFloat(cursor, Database.SHADERS_QUALITY)); setToolbarTitle(cursor); cursor.close(); }
private void setToolbarTitle(long id) { Cursor cursor = ShaderEditorApp.db.getShader(id); if (Database.closeIfEmpty(cursor)) { return; } <DeepExtract> setQualitySpinner(Database.getFloat(cursor, Database.SHADERS_QUALITY)); </DeepExtract> setToolbarTitle(cursor); cursor.close(); }
ShaderEditor
positive
1,337
public _Fields fieldForId(int fieldId) { switch(fieldId) { case 1: return TRUE_AS_OF_SECS; default: return null; } }
public _Fields fieldForId(int fieldId) { <DeepExtract> switch(fieldId) { case 1: return TRUE_AS_OF_SECS; default: return null; } </DeepExtract> }
big-data-src
positive
1,338
@Override public TypeV remove(Object key) { if (NO_MATCH_OLD == null || TOMBSTONE == null) throw new NullPointerException(); final Object res = putIfMatch(this, _kvs, key, TOMBSTONE, NO_MATCH_OLD); assert !(res instanceof Prime); assert res != null; return res == TOMBSTONE ? null : (TypeV) res; }
@Override public TypeV remove(Object key) { <DeepExtract> if (NO_MATCH_OLD == null || TOMBSTONE == null) throw new NullPointerException(); final Object res = putIfMatch(this, _kvs, key, TOMBSTONE, NO_MATCH_OLD); assert !(res instanceof Prime); assert res != null; return res == TOMBSTONE ? null : (TypeV) res; </DeepExtract> }
high-scale-lib
positive
1,339
@Override public Collection<JarContainer> load() throws DependencyException { final List<JarContainer> result = new ArrayList<JarContainer>(); final Map<String, String> properties = new HashMap<String, String>(); final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(rootFileName)); final Element racine = document.getRootElement(); final Element eltProperties = racine.getChild("properties", racine.getNamespace()); final List<Element> eltProperty = eltProperties.getChildren(); for (final Element element : eltProperty) { properties.put(element.getName(), element.getValue()); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(destFileName)); final Element racine = document.getRootElement(); final Element eltProperties = racine.getChild("properties", racine.getNamespace()); final List<Element> eltProperty = eltProperties.getChildren(); for (final Element element : eltProperty) { properties.put(element.getName(), element.getValue()); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(destFileName)); final Element racine = document.getRootElement(); final Element eltDependencies = racine.getChild("dependencies", racine.getNamespace()); final List<Element> eltDependency = eltDependencies.getChildren("dependency", racine.getNamespace()); for (final Element element : eltDependency) { final JarContainer jar = new JarContainer(AdapterPomXml.class); jar.setGroupId(loadText(element, "groupId", properties)); jar.setArtifactId(loadText(element, "artifactId", properties)); jar.setVersion(loadText(element, "version", properties)); result.add(jar); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } return result; }
@Override public Collection<JarContainer> load() throws DependencyException { final List<JarContainer> result = new ArrayList<JarContainer>(); final Map<String, String> properties = new HashMap<String, String>(); final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(rootFileName)); final Element racine = document.getRootElement(); final Element eltProperties = racine.getChild("properties", racine.getNamespace()); final List<Element> eltProperty = eltProperties.getChildren(); for (final Element element : eltProperty) { properties.put(element.getName(), element.getValue()); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } <DeepExtract> final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(destFileName)); final Element racine = document.getRootElement(); final Element eltProperties = racine.getChild("properties", racine.getNamespace()); final List<Element> eltProperty = eltProperties.getChildren(); for (final Element element : eltProperty) { properties.put(element.getName(), element.getValue()); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } </DeepExtract> final SAXBuilder sxb = new SAXBuilder(); try { final Document document = sxb.build(new File(destFileName)); final Element racine = document.getRootElement(); final Element eltDependencies = racine.getChild("dependencies", racine.getNamespace()); final List<Element> eltDependency = eltDependencies.getChildren("dependency", racine.getNamespace()); for (final Element element : eltDependency) { final JarContainer jar = new JarContainer(AdapterPomXml.class); jar.setGroupId(loadText(element, "groupId", properties)); jar.setArtifactId(loadText(element, "artifactId", properties)); jar.setVersion(loadText(element, "version", properties)); result.add(jar); } } catch (final JDOMException e) { throw new DependencyException(e); } catch (final IOException e) { throw new DependencyException(e); } return result; }
sonos-java
positive
1,340
protected void onVisible() { if (hasLoaded) { return; } hasLoaded = true; }
protected void onVisible() { <DeepExtract> </DeepExtract> if (hasLoaded) { <DeepExtract> </DeepExtract> return; <DeepExtract> </DeepExtract> } <DeepExtract> </DeepExtract> hasLoaded = true; <DeepExtract> </DeepExtract> }
EnjoyLife
positive
1,341
@Override public void onClick(View v) { FileManager manager = new FileManager(getActivity().getApplicationContext()); File file = new File(manager.getMyQRPath()); if (!file.exists()) { manager.saveMyQRCode(QRExchange.makeQRFriendCode(getActivity(), manager)); } Bundle bundle = new Bundle(); bundle.putString("uri", Uri.fromFile(file).toString()); Navigation.findNavController(addFriendView).navigate(R.id.action_addFriendFragment_to_displayQRFragment, bundle); }
@Override public void onClick(View v) { <DeepExtract> FileManager manager = new FileManager(getActivity().getApplicationContext()); File file = new File(manager.getMyQRPath()); if (!file.exists()) { manager.saveMyQRCode(QRExchange.makeQRFriendCode(getActivity(), manager)); } Bundle bundle = new Bundle(); bundle.putString("uri", Uri.fromFile(file).toString()); Navigation.findNavController(addFriendView).navigate(R.id.action_addFriendFragment_to_displayQRFragment, bundle); </DeepExtract> }
ndn-photo-app
positive
1,342
public MethodInfo findSuperclassImplementation(HashSet notStrippable) { if (mReturnType == null) { return null; } if (mOverriddenMethod != null) { if (this.signature().equals(mOverriddenMethod.signature())) { return mOverriddenMethod; } } ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>(); if (containingClass().realSuperclass() != null && containingClass().realSuperclass().isAbstract()) { queue.add(containingClass()); } for (ClassInfo i : containingClass().realInterfaces()) { queue.add(i); } for (ClassInfo i : containingClass().realInterfaces()) { addInterfaces(i.interfaces(), queue); } for (ClassInfo iface : queue) { for (MethodInfo me : iface.methods()) { if (me.name().equals(this.name()) && me.signature().equals(this.signature()) && notStrippable.contains(me.containingClass())) { return me; } } } return null; }
public MethodInfo findSuperclassImplementation(HashSet notStrippable) { if (mReturnType == null) { return null; } if (mOverriddenMethod != null) { if (this.signature().equals(mOverriddenMethod.signature())) { return mOverriddenMethod; } } ArrayList<ClassInfo> queue = new ArrayList<ClassInfo>(); if (containingClass().realSuperclass() != null && containingClass().realSuperclass().isAbstract()) { queue.add(containingClass()); } <DeepExtract> for (ClassInfo i : containingClass().realInterfaces()) { queue.add(i); } for (ClassInfo i : containingClass().realInterfaces()) { addInterfaces(i.interfaces(), queue); } </DeepExtract> for (ClassInfo iface : queue) { for (MethodInfo me : iface.methods()) { if (me.name().equals(this.name()) && me.signature().equals(this.signature()) && notStrippable.contains(me.containingClass())) { return me; } } } return null; }
TWRP2-CM7_build
positive
1,343
public void startForecastDownloader(Context context, Modes downloadMode, boolean forceBroadcast) { UpdatesManager manager = new UpdatesManager(context); List<Uri> uris = manager.getAllUpdateUris(); LocationDatabase locDb = this.getLocationDatabase(context); Log.i("UpdatesReceiver", "ensuring " + uris.size() + " widgets/notifications are up to date"); UnitSet unitset = Units.getUnitSet(WeatherApp.prefs(context).getString(WeatherApp.PREF_KEY_UNITS, Units.UNITS_DEFAULT)); for (Uri uri : uris) { ForecastLocation l = locDb.getLocation(uri); Forecast f = new Forecast(context, l, WeatherApp.getLanguage(context)); f.setUnitSet(unitset); ForecastDownloader d = new ForecastDownloader(f, null, downloadMode, forceBroadcast); d.download(); } }
public void startForecastDownloader(Context context, Modes downloadMode, boolean forceBroadcast) { UpdatesManager manager = new UpdatesManager(context); List<Uri> uris = manager.getAllUpdateUris(); LocationDatabase locDb = this.getLocationDatabase(context); <DeepExtract> Log.i("UpdatesReceiver", "ensuring " + uris.size() + " widgets/notifications are up to date"); </DeepExtract> UnitSet unitset = Units.getUnitSet(WeatherApp.prefs(context).getString(WeatherApp.PREF_KEY_UNITS, Units.UNITS_DEFAULT)); for (Uri uri : uris) { ForecastLocation l = locDb.getLocation(uri); Forecast f = new Forecast(context, l, WeatherApp.getLanguage(context)); f.setUnitSet(unitset); ForecastDownloader d = new ForecastDownloader(f, null, downloadMode, forceBroadcast); d.download(); } }
CanadaWeather
positive
1,345
@Override public void testPeriodic() { subsystems.outputToSmartDashboard(); robotState.outputToSmartDashboard(); enabledLooper.outputToSmartDashboard(); SmartDashboard.putBoolean("Enabled", ds.isEnabled()); SmartDashboard.putNumber("Match time", ds.getMatchTime()); }
@Override public void testPeriodic() { <DeepExtract> subsystems.outputToSmartDashboard(); robotState.outputToSmartDashboard(); enabledLooper.outputToSmartDashboard(); SmartDashboard.putBoolean("Enabled", ds.isEnabled()); SmartDashboard.putNumber("Match time", ds.getMatchTime()); </DeepExtract> }
2019DeepSpace
positive
1,346
public void putOption(final JSONObject option) { cache.put(option.optString(Keys.OBJECT_ID), Solos.clone(option)); final String category = option.optString(Option.OPTION_CATEGORY); categoryCache.remove(category); }
public void putOption(final JSONObject option) { cache.put(option.optString(Keys.OBJECT_ID), Solos.clone(option)); final String category = option.optString(Option.OPTION_CATEGORY); <DeepExtract> categoryCache.remove(category); </DeepExtract> }
solo
positive
1,347
public static int[] crop(int[] argb, int width, Rect rect) { rect.left = Math.max(rect.left, 0); rect.right = Math.min(rect.right, width); int height = argb.length / width; rect.bottom = Math.min(rect.bottom, height); rect.sort(); int[] image = new int[rect.width() * rect.height()]; for (int i = rect.top; i < rect.bottom; i++) { int rowIndex = width * i; try { System.arraycopy(argb, rowIndex + rect.left, image, rect.width() * (i - rect.top), rect.width()); } catch (Exception e) { e.printStackTrace(); return argb; } } return image; }
public static int[] crop(int[] argb, int width, Rect rect) { <DeepExtract> rect.left = Math.max(rect.left, 0); rect.right = Math.min(rect.right, width); int height = argb.length / width; rect.bottom = Math.min(rect.bottom, height); rect.sort(); </DeepExtract> int[] image = new int[rect.width() * rect.height()]; for (int i = rect.top; i < rect.bottom; i++) { int rowIndex = width * i; try { System.arraycopy(argb, rowIndex + rect.left, image, rect.width() * (i - rect.top), rect.width()); } catch (Exception e) { e.printStackTrace(); return argb; } } return image; }
FaceLoginAndroid
positive
1,349
@Override public void changedUpdate(DocumentEvent e) { if (!isChangedNickname) { remoteNameText.setText(remoteHostText.getText() + COLON + remotePortText.getText()); } }
@Override public void changedUpdate(DocumentEvent e) { <DeepExtract> if (!isChangedNickname) { remoteNameText.setText(remoteHostText.getText() + COLON + remotePortText.getText()); } </DeepExtract> }
RemoteResources
positive
1,350
@Override public byte[] signTransaction(byte[] privateKey, byte[] unsignedTransaction) { byte[] signature; byte[] messageSha256 = getSha256().digest(unsignedTransaction); if (nativeEnabled()) { signature = nativeCurve25519.sign(messageSha256, privateKey); } else { signature = curve25519.sign(messageSha256, privateKey); } byte[] signedTransaction = new byte[unsignedTransaction.length]; System.arraycopy(unsignedTransaction, 0, signedTransaction, 0, unsignedTransaction.length); System.arraycopy(signature, 0, signedTransaction, 96, 64); return signedTransaction; }
@Override public byte[] signTransaction(byte[] privateKey, byte[] unsignedTransaction) { <DeepExtract> byte[] signature; byte[] messageSha256 = getSha256().digest(unsignedTransaction); if (nativeEnabled()) { signature = nativeCurve25519.sign(messageSha256, privateKey); } else { signature = curve25519.sign(messageSha256, privateKey); } </DeepExtract> byte[] signedTransaction = new byte[unsignedTransaction.length]; System.arraycopy(unsignedTransaction, 0, signedTransaction, 0, unsignedTransaction.length); System.arraycopy(signature, 0, signedTransaction, 96, 64); return signedTransaction; }
signumj
positive
1,351
@Override public void run() { mLiveBanner.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); mLiveBanner.setBackgroundResource(R.drawable.live_orange_bg); mLiveBanner.setTag(null); mLiveBanner.setText(getString(R.string.buffering)); mLiveBanner.bringToFront(); mLiveBanner.startAnimation(AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_from_left)); mLiveBanner.setVisibility(View.VISIBLE); }
@Override public void run() { mLiveBanner.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null); mLiveBanner.setBackgroundResource(R.drawable.live_orange_bg); mLiveBanner.setTag(null); mLiveBanner.setText(getString(R.string.buffering)); <DeepExtract> mLiveBanner.bringToFront(); mLiveBanner.startAnimation(AnimationUtils.loadAnimation(getActivity().getApplicationContext(), R.anim.slide_from_left)); mLiveBanner.setVisibility(View.VISIBLE); </DeepExtract> }
kickflip-android-sdk
positive
1,353
@Override public String printTree(String indent) { StringBuffer print = new StringBuffer(); print.append("WordElement: base=").append(getBaseForm()).append(", category=").append(getCategory().toString()).append(", ").append(super.toString()).append('\n'); ElementCategory _category = getCategory(); StringBuffer buffer = new StringBuffer("WordElement["); buffer.append(getBaseForm()).append(':'); if (_category != null) { buffer.append(_category.toString()); } else { buffer.append("no category"); } buffer.append(']'); return buffer.toString(); }
@Override public String printTree(String indent) { StringBuffer print = new StringBuffer(); print.append("WordElement: base=").append(getBaseForm()).append(", category=").append(getCategory().toString()).append(", ").append(super.toString()).append('\n'); <DeepExtract> ElementCategory _category = getCategory(); StringBuffer buffer = new StringBuffer("WordElement["); buffer.append(getBaseForm()).append(':'); if (_category != null) { buffer.append(_category.toString()); } else { buffer.append("no category"); } buffer.append(']'); return buffer.toString(); </DeepExtract> }
SimpleNLG-EnFr
positive
1,354
public void newarray_int() { if (this.count >= this.maxLength) { throw new CompileException("Write after end of stream."); } write(Bytecode.NEWARRAY.getBytecode() & 0xff); if (this.count >= this.maxLength) { throw new CompileException("Write after end of stream."); } write(0x0a & 0xff); }
public void newarray_int() { if (this.count >= this.maxLength) { throw new CompileException("Write after end of stream."); } write(Bytecode.NEWARRAY.getBytecode() & 0xff); <DeepExtract> if (this.count >= this.maxLength) { throw new CompileException("Write after end of stream."); } write(0x0a & 0xff); </DeepExtract> }
BASICCompiler
positive
1,355
public SparseDataset fitTransform(List<List<String>> documents) { int nrow = documents.size(); int ncol = tokenToIndex.size(); SparseDataset tfidf = new SparseDataset(ncol); for (int rowNo = 0; rowNo < nrow; rowNo++) { tfidf.set(rowNo, 0, 0.0); Multiset<String> row = HashMultiset.create(documents.get(rowNo)); for (Entry<String> e : row.entrySet()) { String token = e.getElement(); double tf = e.getCount(); if (sublinearTf) { tf = 1 + Math.log(tf); } if (!tokenToIndex.containsKey(token)) { continue; } int colNo = tokenToIndex.get(token); if (applyIdf) { double idf = idfs[colNo]; tfidf.set(rowNo, colNo, tf * idf); } else { tfidf.set(rowNo, colNo, tf); } } } if (normalize) { tfidf.unitize(); } return tfidf; }
public SparseDataset fitTransform(List<List<String>> documents) { <DeepExtract> int nrow = documents.size(); int ncol = tokenToIndex.size(); SparseDataset tfidf = new SparseDataset(ncol); for (int rowNo = 0; rowNo < nrow; rowNo++) { tfidf.set(rowNo, 0, 0.0); Multiset<String> row = HashMultiset.create(documents.get(rowNo)); for (Entry<String> e : row.entrySet()) { String token = e.getElement(); double tf = e.getCount(); if (sublinearTf) { tf = 1 + Math.log(tf); } if (!tokenToIndex.containsKey(token)) { continue; } int colNo = tokenToIndex.get(token); if (applyIdf) { double idf = idfs[colNo]; tfidf.set(rowNo, colNo, tf * idf); } else { tfidf.set(rowNo, colNo, tf); } } } if (normalize) { tfidf.unitize(); } return tfidf; </DeepExtract> }
mastering-java-data-science
positive
1,356
public int delete(Criteria criteria) { String sql = criteria.toSQL(); String table = Mapping.getInstance().getTableName(criteria.getRoot().getClazz()); if (Aorm.isDebug()) { log("delete " + table + " where: " + criteria.getWhere()); } int count = delete(table, criteria.getWhere(), criteria.getStringArgs()); if (listeners != null) { synchronized (listeners) { for (SessionListener l : listeners) { l.onChange(criteria.getRoot().getClass()); } } } return count; }
public int delete(Criteria criteria) { String sql = criteria.toSQL(); String table = Mapping.getInstance().getTableName(criteria.getRoot().getClazz()); if (Aorm.isDebug()) { log("delete " + table + " where: " + criteria.getWhere()); } int count = delete(table, criteria.getWhere(), criteria.getStringArgs()); <DeepExtract> if (listeners != null) { synchronized (listeners) { for (SessionListener l : listeners) { l.onChange(criteria.getRoot().getClass()); } } } </DeepExtract> return count; }
Android-ORM
positive
1,357
final public void SynchronizedStatement() { boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); IElementType actualType = builder.getTokenType(); if (actualType == SYNCHRONIZED) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + SYNCHRONIZED + ", but get: " + text); } } return SYNCHRONIZED; IElementType actualType = builder.getTokenType(); if (actualType == LPAREN) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + LPAREN + ", but get: " + text); } } return LPAREN; boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); ConditionalExpression(); if (jj_2_24(2)) { AssignmentOperator(); Expression(); } else { ; } { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTEXPRESSION); } } } IElementType actualType = builder.getTokenType(); if (actualType == RPAREN) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + RPAREN + ", but get: " + text); } } return RPAREN; boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); jj_consume_token(LBRACE); label_201: while (true) { IElementType type_202 = getType(); if (type_202 == _LOOKAHEAD || type_202 == _IGNORE_CASE || type_202 == _PARSER_BEGIN || type_202 == _PARSER_END || type_202 == _JAVACODE || type_202 == _TOKEN || type_202 == _SPECIAL_TOKEN || type_202 == _MORE || type_202 == _SKIP || type_202 == _TOKEN_MGR_DECLS || type_202 == _EOF || type_202 == ABSTRACT || type_202 == ASSERT || type_202 == BOOLEAN || type_202 == BREAK || type_202 == BYTE || type_202 == CHAR || type_202 == CLASS || type_202 == CONTINUE || type_202 == DO || type_202 == DOUBLE || type_202 == FALSE || type_202 == FINAL || type_202 == FLOAT || type_202 == FOR || type_202 == IF || type_202 == INT || type_202 == INTERFACE || type_202 == LONG || type_202 == NATIVE || type_202 == NEW || type_202 == NULL || type_202 == PRIVATE || type_202 == PROTECTED || type_202 == PUBLIC || type_202 == RETURN || type_202 == SHORT || type_202 == STATIC || type_202 == STRICTFP || type_202 == SUPER || type_202 == SWITCH || type_202 == SYNCHRONIZED || type_202 == THIS || type_202 == THROW || type_202 == TRANSIENT || type_202 == TRUE || type_202 == TRY || type_202 == VOID || type_202 == VOLATILE || type_202 == WHILE || type_202 == INTEGER_LITERAL || type_202 == FLOATING_POINT_LITERAL || type_202 == CHARACTER_LITERAL || type_202 == STRING_LITERAL || type_202 == IDENTIFIER || type_202 == LPAREN || type_202 == LBRACE || type_202 == SEMICOLON || type_202 == INCR || type_202 == DECR || type_202 == AT) { ; } else { break label_201; } BlockStatement(); } jj_consume_token(RBRACE); { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTBLOCK); } } } { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTSYNCHRONIZEDSTATEMENT); } } } }
final public void SynchronizedStatement() { boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); IElementType actualType = builder.getTokenType(); if (actualType == SYNCHRONIZED) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + SYNCHRONIZED + ", but get: " + text); } } return SYNCHRONIZED; IElementType actualType = builder.getTokenType(); if (actualType == LPAREN) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + LPAREN + ", but get: " + text); } } return LPAREN; boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); ConditionalExpression(); if (jj_2_24(2)) { AssignmentOperator(); Expression(); } else { ; } { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTEXPRESSION); } } } IElementType actualType = builder.getTokenType(); if (actualType == RPAREN) { builder.advanceLexer(); } else { if (builder.eof()) { if (!reportEof) { reportEof = true; builder.error("Unexpected end of file"); } } else { PsiBuilder.Marker errorMarker = builder.mark(); String text = builder.getTokenText(); builder.advanceLexer(); errorMarker.error("Expected " + RPAREN + ", but get: " + text); } } return RPAREN; <DeepExtract> boolean jjtc000 = true; PsiBuilder.Marker jjtn000 = builder.mark(); jj_consume_token(LBRACE); label_201: while (true) { IElementType type_202 = getType(); if (type_202 == _LOOKAHEAD || type_202 == _IGNORE_CASE || type_202 == _PARSER_BEGIN || type_202 == _PARSER_END || type_202 == _JAVACODE || type_202 == _TOKEN || type_202 == _SPECIAL_TOKEN || type_202 == _MORE || type_202 == _SKIP || type_202 == _TOKEN_MGR_DECLS || type_202 == _EOF || type_202 == ABSTRACT || type_202 == ASSERT || type_202 == BOOLEAN || type_202 == BREAK || type_202 == BYTE || type_202 == CHAR || type_202 == CLASS || type_202 == CONTINUE || type_202 == DO || type_202 == DOUBLE || type_202 == FALSE || type_202 == FINAL || type_202 == FLOAT || type_202 == FOR || type_202 == IF || type_202 == INT || type_202 == INTERFACE || type_202 == LONG || type_202 == NATIVE || type_202 == NEW || type_202 == NULL || type_202 == PRIVATE || type_202 == PROTECTED || type_202 == PUBLIC || type_202 == RETURN || type_202 == SHORT || type_202 == STATIC || type_202 == STRICTFP || type_202 == SUPER || type_202 == SWITCH || type_202 == SYNCHRONIZED || type_202 == THIS || type_202 == THROW || type_202 == TRANSIENT || type_202 == TRUE || type_202 == TRY || type_202 == VOID || type_202 == VOLATILE || type_202 == WHILE || type_202 == INTEGER_LITERAL || type_202 == FLOATING_POINT_LITERAL || type_202 == CHARACTER_LITERAL || type_202 == STRING_LITERAL || type_202 == IDENTIFIER || type_202 == LPAREN || type_202 == LBRACE || type_202 == SEMICOLON || type_202 == INCR || type_202 == DECR || type_202 == AT) { ; } else { break label_201; } BlockStatement(); } jj_consume_token(RBRACE); { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTBLOCK); } } } </DeepExtract> { if (jjtc000) { jjtc000 = false; { jjtn000.done(JJTSYNCHRONIZEDSTATEMENT); } } } }
ideaCC
positive
1,358
public static int getApptVersion(File aapt) throws BrutException { if (!aapt.isFile()) { throw new BrutException("Could not identify aapt binary as executable."); } aapt.setExecutable(true); List<String> cmd = new ArrayList<>(); cmd.add(aapt.getAbsolutePath()); cmd.add("version"); String version = OS.execAndReturn(cmd.toArray(new String[0])); if (version == null) { throw new BrutException("Could not execute aapt binary at location: " + aapt.getAbsolutePath()); } if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) { return 2; } else if (version.startsWith("Android Asset Packaging Tool (aapt) 2.")) { return 2; } else if (version.startsWith("Android Asset Packaging Tool, v0.")) { return 1; } throw new BrutException("aapt version could not be identified: " + version); }
public static int getApptVersion(File aapt) throws BrutException { if (!aapt.isFile()) { throw new BrutException("Could not identify aapt binary as executable."); } aapt.setExecutable(true); List<String> cmd = new ArrayList<>(); cmd.add(aapt.getAbsolutePath()); cmd.add("version"); String version = OS.execAndReturn(cmd.toArray(new String[0])); if (version == null) { throw new BrutException("Could not execute aapt binary at location: " + aapt.getAbsolutePath()); } <DeepExtract> if (version.startsWith("Android Asset Packaging Tool (aapt) 2:")) { return 2; } else if (version.startsWith("Android Asset Packaging Tool (aapt) 2.")) { return 2; } else if (version.startsWith("Android Asset Packaging Tool, v0.")) { return 1; } throw new BrutException("aapt version could not be identified: " + version); </DeepExtract> }
ratel
positive
1,359
public XmlNode getParentNode() { if (node.getParentNode() == null) return null; if (node.getParentNode() instanceof Element) return new XmlElement((Element) node.getParentNode()); if (node.getParentNode() instanceof Document) return new XmlDocument((Document) node.getParentNode()); if (node.getParentNode() instanceof Attr) return new XmlAttribute((Attr) node.getParentNode()); if (node.getParentNode() instanceof Comment) return new XmlComment((Comment) node.getParentNode()); if (node.getParentNode() instanceof CDATASection) return new XmlCDataSection((CDATASection) node.getParentNode()); if (node.getParentNode() instanceof Text) return new XmlText((Text) node.getParentNode()); return new XmlNode(node.getParentNode()); }
public XmlNode getParentNode() { <DeepExtract> if (node.getParentNode() == null) return null; if (node.getParentNode() instanceof Element) return new XmlElement((Element) node.getParentNode()); if (node.getParentNode() instanceof Document) return new XmlDocument((Document) node.getParentNode()); if (node.getParentNode() instanceof Attr) return new XmlAttribute((Attr) node.getParentNode()); if (node.getParentNode() instanceof Comment) return new XmlComment((Comment) node.getParentNode()); if (node.getParentNode() instanceof CDATASection) return new XmlCDataSection((CDATASection) node.getParentNode()); if (node.getParentNode() instanceof Text) return new XmlText((Text) node.getParentNode()); return new XmlNode(node.getParentNode()); </DeepExtract> }
cs2j
positive
1,360
VL eulerTrail() { _adjq = new EQ[n]; int nOdd = 0, start = 0; int nOdd = 0, start = 0; for (int u = 0; u < n; u++) { _adjq[u] = new EQ(); if (start == 0 && out[u] > 0) start = u; for (int i = 0; i < out[u]; i++) _adjq[u].add(edge(u, i)); } for (int v = 0; v < n; v++) { int diff = Math.abs(in[v] - out[v]); if (diff > 1) return null; if (diff == 1) { if (++nOdd > 2) return null; if (out[v] > in[v]) start = v; } } _trail = new VL(); while (!_adjq[start].isEmpty()) { E e = _adjq[start].remove(); eulerBuildTrail(e.v); } _trail.add(start); Collections.reverse(_trail); return _trail; }
VL eulerTrail() { _adjq = new EQ[n]; int nOdd = 0, start = 0; int nOdd = 0, start = 0; for (int u = 0; u < n; u++) { _adjq[u] = new EQ(); if (start == 0 && out[u] > 0) start = u; for (int i = 0; i < out[u]; i++) _adjq[u].add(edge(u, i)); } for (int v = 0; v < n; v++) { int diff = Math.abs(in[v] - out[v]); if (diff > 1) return null; if (diff == 1) { if (++nOdd > 2) return null; if (out[v] > in[v]) start = v; } } _trail = new VL(); <DeepExtract> while (!_adjq[start].isEmpty()) { E e = _adjq[start].remove(); eulerBuildTrail(e.v); } _trail.add(start); </DeepExtract> Collections.reverse(_trail); return _trail; }
pc-code
positive
1,362
public boolean putLongLite(String key, long value) { if (!valid) { throw new IllegalStateException("this should only be called when LitePrefs didn't initialize once"); } return getLiteInterface().putLongLite(key, value); }
public boolean putLongLite(String key, long value) { if (!valid) { throw new IllegalStateException("this should only be called when LitePrefs didn't initialize once"); } <DeepExtract> return getLiteInterface().putLongLite(key, value); </DeepExtract> }
PureNote
positive
1,363
@Override public void act() { isClimbing = on; swerve.setLowPowerScalar(0.25); }
@Override public void act() { <DeepExtract> isClimbing = on; swerve.setLowPowerScalar(0.25); </DeepExtract> }
2019DeepSpace
positive
1,364
public Integer getMaxIntegerId() { String id; Query query = new Query(); query.with(Sort.by(new Order(Direction.DESC, "id"))); query.limit(1); T data = mongoTemplate.findOne(query, dao().getClassT()); try { id = data == null ? "0" : (String) dao().getClassT().getMethod("getId").invoke(data); } catch (Exception e) { id = null; } try { if (StringUtils.isNoneBlank(id)) { Integer maxId = Integer.parseInt(id); return maxId; } } catch (Exception e) { logger.error("parse num error!", e); } return null; }
public Integer getMaxIntegerId() { <DeepExtract> String id; Query query = new Query(); query.with(Sort.by(new Order(Direction.DESC, "id"))); query.limit(1); T data = mongoTemplate.findOne(query, dao().getClassT()); try { id = data == null ? "0" : (String) dao().getClassT().getMethod("getId").invoke(data); } catch (Exception e) { id = null; } </DeepExtract> try { if (StringUtils.isNoneBlank(id)) { Integer maxId = Integer.parseInt(id); return maxId; } } catch (Exception e) { logger.error("parse num error!", e); } return null; }
resys-one
positive
1,366
@Test public void singleTerminalState_HasNoCycle_IsValid() { validate(StepFunctionBuilder.stateMachine().startAt("Initial").state("Initial", StepFunctionBuilder.succeedState())); }
@Test public void singleTerminalState_HasNoCycle_IsValid() { <DeepExtract> validate(StepFunctionBuilder.stateMachine().startAt("Initial").state("Initial", StepFunctionBuilder.succeedState())); </DeepExtract> }
light-workflow-4j
positive
1,367
private void updateProgressBars() { int currentLength = envelope.getText().length(); int smsLength = envelope.getSMSLength(); int maxTextLength = envelope.getMaxTextLength(); fullProgressBar.setMaximum(maxTextLength); int min = envelope.getPenultimateIndexOfCut(envelope.getText(), smsLength); int max = min + smsLength; max = Math.min(max, maxTextLength); singleProgressBar.setMinimum(min); singleProgressBar.setMaximum(max); fullProgressBar.setValue(currentLength); singleProgressBar.setValue(currentLength); int used = fullProgressBar.getValue() - fullProgressBar.getMinimum(); if (fullProgressBar.getMaximum() == Integer.MAX_VALUE) { fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, "∞", "∞")); } else { int capacity = fullProgressBar.getMaximum() - fullProgressBar.getMinimum(); int remaining = fullProgressBar.getMaximum() - fullProgressBar.getValue(); fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, capacity, remaining)); } int used = singleProgressBar.getValue() - singleProgressBar.getMinimum(); if (singleProgressBar.getMaximum() == Integer.MAX_VALUE) { singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, "∞", "∞")); } else { int capacity = singleProgressBar.getMaximum() - singleProgressBar.getMinimum(); int remaining = singleProgressBar.getMaximum() - singleProgressBar.getValue(); singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, capacity, remaining)); } }
private void updateProgressBars() { int currentLength = envelope.getText().length(); int smsLength = envelope.getSMSLength(); int maxTextLength = envelope.getMaxTextLength(); fullProgressBar.setMaximum(maxTextLength); int min = envelope.getPenultimateIndexOfCut(envelope.getText(), smsLength); int max = min + smsLength; max = Math.min(max, maxTextLength); singleProgressBar.setMinimum(min); singleProgressBar.setMaximum(max); fullProgressBar.setValue(currentLength); singleProgressBar.setValue(currentLength); int used = fullProgressBar.getValue() - fullProgressBar.getMinimum(); if (fullProgressBar.getMaximum() == Integer.MAX_VALUE) { fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, "∞", "∞")); } else { int capacity = fullProgressBar.getMaximum() - fullProgressBar.getMinimum(); int remaining = fullProgressBar.getMaximum() - fullProgressBar.getValue(); fullProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.fullProgressBar"), used, capacity, remaining)); } <DeepExtract> int used = singleProgressBar.getValue() - singleProgressBar.getMinimum(); if (singleProgressBar.getMaximum() == Integer.MAX_VALUE) { singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, "∞", "∞")); } else { int capacity = singleProgressBar.getMaximum() - singleProgressBar.getMinimum(); int remaining = singleProgressBar.getMaximum() - singleProgressBar.getValue(); singleProgressBar.setToolTipText(MessageFormat.format(l10n.getString("SMSPanel.singleProgressBar"), used, capacity, remaining)); } </DeepExtract> }
esmska
positive
1,368
public CellReference composeFirstSimpleTextHeaderCellReference() { if (simpleTextHeaderRowIndex == null || firstDataColumn == null) { return null; } return new CellReference(simpleTextHeaderRowIndex, firstDataColumn); }
public CellReference composeFirstSimpleTextHeaderCellReference() { <DeepExtract> if (simpleTextHeaderRowIndex == null || firstDataColumn == null) { return null; } return new CellReference(simpleTextHeaderRowIndex, firstDataColumn); </DeepExtract> }
MemPOI
positive
1,369
@Override public Cursor cursor() { return new CursorImpl(tagSets, false); }
@Override public Cursor cursor() { <DeepExtract> return new CursorImpl(tagSets, false); </DeepExtract> }
metrics
positive
1,370
public static com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; }
public static com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point parseFrom(byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { <DeepExtract> com.conveyal.transitwand.TransitWandProtos.Upload.Route.Point result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result).asInvalidProtocolBufferException(); } return result; </DeepExtract> }
transit-wand
positive
1,371
@Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { bindEntityTexture((EntityBlunderShot) entity); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); Tessellator tessellator = Tessellator.instance; float f2 = 0.0F; float f3 = 5F / 16F; float f10 = 0.05625F; GL11.glEnable(32826); GL11.glScalef(0.04F, 0.04F, 0.04F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0D, -1D, -1D, f2, f2); tessellator.addVertexWithUV(0D, -1D, 1D, f3, f2); tessellator.addVertexWithUV(0D, 1D, 1D, f3, f3); tessellator.addVertexWithUV(0D, 1D, -1D, f2, f3); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0D, 1D, -1D, f2, f2); tessellator.addVertexWithUV(0D, 1D, 1D, f3, f2); tessellator.addVertexWithUV(0D, -1D, 1D, f3, f3); tessellator.addVertexWithUV(0D, -1D, -1D, f2, f3); tessellator.draw(); for (int j = 0; j < 4; j++) { GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-1D, -1D, 0.0D, f2, f2); tessellator.addVertexWithUV(1D, -1D, 0.0D, f3, f2); tessellator.addVertexWithUV(1D, 1D, 0.0D, f3, f3); tessellator.addVertexWithUV(-1D, 1D, 0.0D, f2, f3); tessellator.draw(); } GL11.glDisable(32826); GL11.glPopMatrix(); GL11.glPushMatrix(); { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1F, 1F, 0.8F, 1F); GL11.glLineWidth(1.0F); tessellator.startDrawing(GL11.GL_LINES); { tessellator.addVertex((EntityBlunderShot) entity.posX, (EntityBlunderShot) entity.posY, (EntityBlunderShot) entity.posZ); tessellator.addVertex((EntityBlunderShot) entity.prevPosX, (EntityBlunderShot) entity.prevPosY, (EntityBlunderShot) entity.prevPosZ); } tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); } GL11.glPopMatrix(); }
@Override public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) { <DeepExtract> bindEntityTexture((EntityBlunderShot) entity); GL11.glPushMatrix(); GL11.glTranslatef((float) d, (float) d1, (float) d2); Tessellator tessellator = Tessellator.instance; float f2 = 0.0F; float f3 = 5F / 16F; float f10 = 0.05625F; GL11.glEnable(32826); GL11.glScalef(0.04F, 0.04F, 0.04F); GL11.glNormal3f(f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0D, -1D, -1D, f2, f2); tessellator.addVertexWithUV(0D, -1D, 1D, f3, f2); tessellator.addVertexWithUV(0D, 1D, 1D, f3, f3); tessellator.addVertexWithUV(0D, 1D, -1D, f2, f3); tessellator.draw(); GL11.glNormal3f(-f10, 0.0F, 0.0F); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(0D, 1D, -1D, f2, f2); tessellator.addVertexWithUV(0D, 1D, 1D, f3, f2); tessellator.addVertexWithUV(0D, -1D, 1D, f3, f3); tessellator.addVertexWithUV(0D, -1D, -1D, f2, f3); tessellator.draw(); for (int j = 0; j < 4; j++) { GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F); GL11.glNormal3f(0.0F, 0.0F, f10); tessellator.startDrawingQuads(); tessellator.addVertexWithUV(-1D, -1D, 0.0D, f2, f2); tessellator.addVertexWithUV(1D, -1D, 0.0D, f3, f2); tessellator.addVertexWithUV(1D, 1D, 0.0D, f3, f3); tessellator.addVertexWithUV(-1D, 1D, 0.0D, f2, f3); tessellator.draw(); } GL11.glDisable(32826); GL11.glPopMatrix(); GL11.glPushMatrix(); { GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1F, 1F, 0.8F, 1F); GL11.glLineWidth(1.0F); tessellator.startDrawing(GL11.GL_LINES); { tessellator.addVertex((EntityBlunderShot) entity.posX, (EntityBlunderShot) entity.posY, (EntityBlunderShot) entity.posZ); tessellator.addVertex((EntityBlunderShot) entity.prevPosX, (EntityBlunderShot) entity.prevPosY, (EntityBlunderShot) entity.prevPosZ); } tessellator.draw(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); } GL11.glPopMatrix(); </DeepExtract> }
balkons-weaponmod
positive
1,373
public static void setLong(long l, byte[] buf, int o) { buf[o] = (byte) ((int) (l & 0xffffffffL) & 255); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff00) >> 8); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff0000) >> 16); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff000000) >> 24); buf[o + 4] = (byte) ((int) (l >> 32) & 255); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff00) >> 8); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff0000) >> 16); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff000000) >> 24); }
public static void setLong(long l, byte[] buf, int o) { buf[o] = (byte) ((int) (l & 0xffffffffL) & 255); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff00) >> 8); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff0000) >> 16); o++; buf[o] = (byte) (((int) (l & 0xffffffffL) & 0xff000000) >> 24); <DeepExtract> buf[o + 4] = (byte) ((int) (l >> 32) & 255); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff00) >> 8); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff0000) >> 16); o + 4++; buf[o + 4] = (byte) (((int) (l >> 32) & 0xff000000) >> 24); </DeepExtract> }
deployr-rserve
positive
1,374
public Call buildCall(Callback callback) { return okHttpRequest.generateRequest(callback); if (readTimeOut > 0 || writeTimeOut > 0 || connTimeOut > 0) { readTimeOut = readTimeOut > 0 ? readTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; writeTimeOut = writeTimeOut > 0 ? writeTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; connTimeOut = connTimeOut > 0 ? connTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; clone = OkHttpUtils.getInstance().getOkHttpClient().newBuilder().readTimeout(readTimeOut, TimeUnit.MILLISECONDS).writeTimeout(writeTimeOut, TimeUnit.MILLISECONDS).connectTimeout(connTimeOut, TimeUnit.MILLISECONDS).build(); call = clone.newCall(request); } else { call = OkHttpUtils.getInstance().getOkHttpClient().newCall(request); } return call; }
public Call buildCall(Callback callback) { <DeepExtract> return okHttpRequest.generateRequest(callback); </DeepExtract> if (readTimeOut > 0 || writeTimeOut > 0 || connTimeOut > 0) { readTimeOut = readTimeOut > 0 ? readTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; writeTimeOut = writeTimeOut > 0 ? writeTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; connTimeOut = connTimeOut > 0 ? connTimeOut : OkHttpUtils.DEFAULT_MILLISECONDS; clone = OkHttpUtils.getInstance().getOkHttpClient().newBuilder().readTimeout(readTimeOut, TimeUnit.MILLISECONDS).writeTimeout(writeTimeOut, TimeUnit.MILLISECONDS).connectTimeout(connTimeOut, TimeUnit.MILLISECONDS).build(); call = clone.newCall(request); } else { call = OkHttpUtils.getInstance().getOkHttpClient().newCall(request); } return call; }
Shopping
positive
1,377
public Criteria andUserPasswordGreaterThanOrEqualTo(String value) { if (value == null) { throw new RuntimeException("Value for " + "userPassword" + " cannot be null"); } criteria.add(new Criterion("user_password >=", value)); return (Criteria) this; }
public Criteria andUserPasswordGreaterThanOrEqualTo(String value) { <DeepExtract> if (value == null) { throw new RuntimeException("Value for " + "userPassword" + " cannot be null"); } criteria.add(new Criterion("user_password >=", value)); </DeepExtract> return (Criteria) this; }
LostAndFound
positive
1,378
@Override public void onClick(View v) { Intent intent = WelcomeActivity.getStartActivityIntent(this); startActivity(intent); finish(); }
@Override public void onClick(View v) { <DeepExtract> Intent intent = WelcomeActivity.getStartActivityIntent(this); startActivity(intent); finish(); </DeepExtract> }
input-samples
positive
1,379
public RetCode natr(int startIdx, int endIdx, float[] inHigh, float[] inLow, float[] inClose, int optInTimePeriod, MInteger outBegIdx, MInteger outNBElement, double[] outReal) { MInteger outBegIdx1 = new MInteger(); MInteger outNbElement1 = new MInteger(); double[] prevATRTemp = new double[1]; if (startIdx < 0) return RetCode.OutOfRangeStartIndex; if ((endIdx < 0) || (endIdx < startIdx)) return RetCode.OutOfRangeEndIndex; if ((int) optInTimePeriod == (Integer.MIN_VALUE)) optInTimePeriod = 14; else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000)) return RetCode.BadParam; outBegIdx.value = 0; outNBElement.value = 0; if ((int) optInTimePeriod == (Integer.MIN_VALUE)) optInTimePeriod = 14; else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000)) lookbackTotal = -1; return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Natr.ordinal()]); if (startIdx < lookbackTotal) startIdx = lookbackTotal; if (startIdx > endIdx) return RetCode.Success; if (optInTimePeriod <= 1) { return trueRange(startIdx, endIdx, inHigh, inLow, inClose, outBegIdx, outNBElement, outReal); } tempBuffer = new double[lookbackTotal + (endIdx - startIdx) + 1]; int today, outIdx; double val2, val3, greatest; double tempCY, tempLT, tempHT; if ((startIdx - lookbackTotal + 1) < 0) retCode = RetCode.OutOfRangeStartIndex; if ((endIdx < 0) || (endIdx < (startIdx - lookbackTotal + 1))) retCode = RetCode.OutOfRangeEndIndex; if ((startIdx - lookbackTotal + 1) < 1) (startIdx - lookbackTotal + 1) = 1; if ((startIdx - lookbackTotal + 1) > endIdx) { outBegIdx1.value = 0; outNbElement1.value = 0; retCode = RetCode.Success; } outIdx = 0; today = (startIdx - lookbackTotal + 1); while (today <= endIdx) { tempLT = inLow[today]; tempHT = inHigh[today]; tempCY = inClose[today - 1]; greatest = tempHT - tempLT; val2 = Math.abs(tempCY - tempHT); if (val2 > greatest) greatest = val2; val3 = Math.abs(tempCY - tempLT); if (val3 > greatest) greatest = val3; tempBuffer[outIdx++] = greatest; today++; } outNbElement1.value = outIdx; outBegIdx1.value = (startIdx - lookbackTotal + 1); return RetCode.Success; if (retCode != RetCode.Success) { return retCode; } double periodTotal, tempReal; int i, outIdx, trailingIdx, lookbackTotal; lookbackTotal = (optInTimePeriod - 1); if (optInTimePeriod - 1 < lookbackTotal) optInTimePeriod - 1 = lookbackTotal; if (optInTimePeriod - 1 > optInTimePeriod - 1) { outBegIdx1.value = 0; outNbElement1.value = 0; retCode = RetCode.Success; } periodTotal = 0; trailingIdx = optInTimePeriod - 1 - lookbackTotal; i = trailingIdx; if (optInTimePeriod > 1) { while (i < optInTimePeriod - 1) periodTotal += tempBuffer[i++]; } outIdx = 0; do { periodTotal += tempBuffer[i++]; tempReal = periodTotal; periodTotal -= tempBuffer[trailingIdx++]; prevATRTemp[outIdx++] = tempReal / optInTimePeriod; } while (i <= optInTimePeriod - 1); outNbElement1.value = outIdx; outBegIdx1.value = optInTimePeriod - 1; return RetCode.Success; if (retCode != RetCode.Success) { return retCode; } prevATR = prevATRTemp[0]; today = optInTimePeriod; outIdx = (this.unstablePeriod[FuncUnstId.Natr.ordinal()]); while (outIdx != 0) { prevATR *= optInTimePeriod - 1; prevATR += tempBuffer[today++]; prevATR /= optInTimePeriod; outIdx--; } outIdx = 1; tempValue = inClose[today]; if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001)))) outReal[0] = (prevATR / tempValue) * 100.0; else outReal[0] = 0.0; nbATR = (endIdx - startIdx) + 1; while (--nbATR != 0) { prevATR *= optInTimePeriod - 1; prevATR += tempBuffer[today++]; prevATR /= optInTimePeriod; tempValue = inClose[today]; if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001)))) outReal[outIdx] = (prevATR / tempValue) * 100.0; else outReal[0] = 0.0; outIdx++; } outBegIdx.value = startIdx; outNBElement.value = outIdx; return retCode; }
public RetCode natr(int startIdx, int endIdx, float[] inHigh, float[] inLow, float[] inClose, int optInTimePeriod, MInteger outBegIdx, MInteger outNBElement, double[] outReal) { MInteger outBegIdx1 = new MInteger(); MInteger outNbElement1 = new MInteger(); double[] prevATRTemp = new double[1]; if (startIdx < 0) return RetCode.OutOfRangeStartIndex; if ((endIdx < 0) || (endIdx < startIdx)) return RetCode.OutOfRangeEndIndex; if ((int) optInTimePeriod == (Integer.MIN_VALUE)) optInTimePeriod = 14; else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000)) return RetCode.BadParam; outBegIdx.value = 0; outNBElement.value = 0; if ((int) optInTimePeriod == (Integer.MIN_VALUE)) optInTimePeriod = 14; else if (((int) optInTimePeriod < 1) || ((int) optInTimePeriod > 100000)) lookbackTotal = -1; return optInTimePeriod + (this.unstablePeriod[FuncUnstId.Natr.ordinal()]); if (startIdx < lookbackTotal) startIdx = lookbackTotal; if (startIdx > endIdx) return RetCode.Success; if (optInTimePeriod <= 1) { return trueRange(startIdx, endIdx, inHigh, inLow, inClose, outBegIdx, outNBElement, outReal); } tempBuffer = new double[lookbackTotal + (endIdx - startIdx) + 1]; int today, outIdx; double val2, val3, greatest; double tempCY, tempLT, tempHT; if ((startIdx - lookbackTotal + 1) < 0) retCode = RetCode.OutOfRangeStartIndex; if ((endIdx < 0) || (endIdx < (startIdx - lookbackTotal + 1))) retCode = RetCode.OutOfRangeEndIndex; if ((startIdx - lookbackTotal + 1) < 1) (startIdx - lookbackTotal + 1) = 1; if ((startIdx - lookbackTotal + 1) > endIdx) { outBegIdx1.value = 0; outNbElement1.value = 0; retCode = RetCode.Success; } outIdx = 0; today = (startIdx - lookbackTotal + 1); while (today <= endIdx) { tempLT = inLow[today]; tempHT = inHigh[today]; tempCY = inClose[today - 1]; greatest = tempHT - tempLT; val2 = Math.abs(tempCY - tempHT); if (val2 > greatest) greatest = val2; val3 = Math.abs(tempCY - tempLT); if (val3 > greatest) greatest = val3; tempBuffer[outIdx++] = greatest; today++; } outNbElement1.value = outIdx; outBegIdx1.value = (startIdx - lookbackTotal + 1); return RetCode.Success; if (retCode != RetCode.Success) { return retCode; } <DeepExtract> double periodTotal, tempReal; int i, outIdx, trailingIdx, lookbackTotal; lookbackTotal = (optInTimePeriod - 1); if (optInTimePeriod - 1 < lookbackTotal) optInTimePeriod - 1 = lookbackTotal; if (optInTimePeriod - 1 > optInTimePeriod - 1) { outBegIdx1.value = 0; outNbElement1.value = 0; retCode = RetCode.Success; } periodTotal = 0; trailingIdx = optInTimePeriod - 1 - lookbackTotal; i = trailingIdx; if (optInTimePeriod > 1) { while (i < optInTimePeriod - 1) periodTotal += tempBuffer[i++]; } outIdx = 0; do { periodTotal += tempBuffer[i++]; tempReal = periodTotal; periodTotal -= tempBuffer[trailingIdx++]; prevATRTemp[outIdx++] = tempReal / optInTimePeriod; } while (i <= optInTimePeriod - 1); outNbElement1.value = outIdx; outBegIdx1.value = optInTimePeriod - 1; return RetCode.Success; </DeepExtract> if (retCode != RetCode.Success) { return retCode; } prevATR = prevATRTemp[0]; today = optInTimePeriod; outIdx = (this.unstablePeriod[FuncUnstId.Natr.ordinal()]); while (outIdx != 0) { prevATR *= optInTimePeriod - 1; prevATR += tempBuffer[today++]; prevATR /= optInTimePeriod; outIdx--; } outIdx = 1; tempValue = inClose[today]; if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001)))) outReal[0] = (prevATR / tempValue) * 100.0; else outReal[0] = 0.0; nbATR = (endIdx - startIdx) + 1; while (--nbATR != 0) { prevATR *= optInTimePeriod - 1; prevATR += tempBuffer[today++]; prevATR /= optInTimePeriod; tempValue = inClose[today]; if (!(((-(0.00000000000001)) < tempValue) && (tempValue < (0.00000000000001)))) outReal[outIdx] = (prevATR / tempValue) * 100.0; else outReal[0] = 0.0; outIdx++; } outBegIdx.value = startIdx; outNBElement.value = outIdx; return retCode; }
clj-ta-lib
positive
1,380
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gallery); ButterKnife.bind(this); context = this; photoSetId = getIntent().getStringExtra(PHOTO_SET); if (TextUtils.isEmpty(photoSetId)) { imgList = getIntent().getStringArrayListExtra(IMG_LIST); index = getIntent().getIntExtra(INDEX, 0); } presenter = new GalleryPresenterImpl(this); if (TextUtils.isEmpty(photoSetId)) { initViewPager(); } else { presenter.getExploreSet(photoSetId); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_gallery); ButterKnife.bind(this); context = this; photoSetId = getIntent().getStringExtra(PHOTO_SET); if (TextUtils.isEmpty(photoSetId)) { imgList = getIntent().getStringArrayListExtra(IMG_LIST); index = getIntent().getIntExtra(INDEX, 0); } <DeepExtract> presenter = new GalleryPresenterImpl(this); </DeepExtract> if (TextUtils.isEmpty(photoSetId)) { initViewPager(); } else { presenter.getExploreSet(photoSetId); } }
C9MJ
positive
1,381
@Override public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { executeMigrations(db, oldVersion, newVersion); }
@Override public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { <DeepExtract> executeMigrations(db, oldVersion, newVersion); </DeepExtract> }
ReActiveAndroid
positive
1,382
public void onPrepared(MediaPlayer mp) { Log.d("onPrepared"); mCurrentState = STATE_PREPARED; if (mOnPreparedListener != null) mOnPreparedListener.onPrepared(mMediaPlayer); if (mMediaController != null) mMediaController.setEnabled(true); return mVideoWidth; return mVideoHeight; return mVideoAspectRatio; long seekToPosition = mSeekWhenPrepared; if (seekToPosition != 0) seekTo(seekToPosition); if (mVideoWidth != 0 && mVideoHeight != 0) { setVideoLayout(mVideoLayout, mAspectRatio); if (mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) { if (mTargetState == STATE_PLAYING) { start(); if (mMediaController != null) mMediaController.show(); } else if (!isPlaying() && (seekToPosition != 0 || getCurrentPosition() > 0)) { if (mMediaController != null) mMediaController.show(0); } } } else if (mTargetState == STATE_PLAYING) { start(); } }
public void onPrepared(MediaPlayer mp) { Log.d("onPrepared"); mCurrentState = STATE_PREPARED; if (mOnPreparedListener != null) mOnPreparedListener.onPrepared(mMediaPlayer); if (mMediaController != null) mMediaController.setEnabled(true); return mVideoWidth; return mVideoHeight; <DeepExtract> return mVideoAspectRatio; </DeepExtract> long seekToPosition = mSeekWhenPrepared; if (seekToPosition != 0) seekTo(seekToPosition); if (mVideoWidth != 0 && mVideoHeight != 0) { setVideoLayout(mVideoLayout, mAspectRatio); if (mSurfaceWidth == mVideoWidth && mSurfaceHeight == mVideoHeight) { if (mTargetState == STATE_PLAYING) { start(); if (mMediaController != null) mMediaController.show(); } else if (!isPlaying() && (seekToPosition != 0 || getCurrentPosition() > 0)) { if (mMediaController != null) mMediaController.show(0); } } } else if (mTargetState == STATE_PLAYING) { start(); } }
FunLive
positive
1,384