auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Baked(ResourceLocation location, boolean perspective, @Nullable IBakedModel base, ImmutableMap<String, IBakedModel> parts) { this.location = location; this.base = base; this.parts = parts; if (base != null) internalBase = base; else { Iterator<IBakedModel> iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); } if(base != null && perspective) { EnumMap<TransformType, Pair<Baked, TRSRTransformation>> map = new EnumMap<>(TransformType.class); for(TransformType type : TransformType.values()) { Pair<? extends IBakedModel, Matrix4f> p = base.handlePerspective(type); IBakedModel newBase = p.getLeft(); map.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(p.getRight()))); } <START> transforms = ImmutableMap.copyOf(map); <END> } else { transforms = ImmutableMap.of(); } }</code><technical_language>is advantage changes in this file. ImmutableMap.Builder fine</technical_language>

Target:
public Baked(ResourceLocation location, boolean perspective, @Nullable IBakedModel base, ImmutableMap<String, IBakedModel> parts) { this.location = location; this.base = base; this.parts = parts; if (base != null) internalBase = base; else { Iterator<IBakedModel> iter = parts.values().iterator(); if (iter.hasNext()) internalBase = iter.next(); else throw new IllegalArgumentException("No base model or submodel provided for MultiModel.Baked " + location + "."); } if(base != null && perspective) { EnumMap<TransformType, Pair<Baked, TRSRTransformation>> map = new EnumMap<>(TransformType.class); for(TransformType type : TransformType.values()) { Pair<? extends IBakedModel, Matrix4f> p = base.handlePerspective(type); IBakedModel newBase = p.getLeft(); Matrix4f matrix = p.getRight(); if (newBase != base || matrix != null) { map.put(type, Pair.of(new Baked(location, false, newBase, parts), new TRSRTransformation(matrix))); } } transforms = ImmutableMap.copyOf(map); } else { transforms = ImmutableMap.of(); } }
Source:
<code>protected ScriptTemplate asScriptFrom(ScriptTemplate sourceScript, ScriptTemplate patternScript) { ParamsBuilder params = paramsBuilder(); <START> String template = formatTemplate("{eql}.endsWith(" + sourceScript.template() + "," + patternScript.template() + ",{})"); <END> params.script(sourceScript.params()) .script(patternScript.params()) .variable(isCaseSensitive()); return new ScriptTemplate(template, params.build(), dataType()); }</code><technical_language>totally consistent in these. I for stringContains <LINK_0></technical_language>

Target:
protected ScriptTemplate asScriptFrom(ScriptTemplate sourceScript, ScriptTemplate patternScript) { return new ScriptTemplate(format(Locale.ROOT, formatTemplate("{eql}.%s(%s,%s,%s)"), "endsWith", sourceScript.template(), patternScript.template(), "{}"), paramsBuilder() .script(sourceScript.params()) .script(patternScript.params()) .variable(isCaseSensitive()) .build(), dataType()); }
Source:
<code>public Mono<U> getFinalResult() { return Mono.defer(() -> { if (!this.pollResponse.getStatus().isComplete()) { return Mono.empty(); } else { try { return this.fetchResultOperation .apply(this.pollingContext); } catch (Throwable throwable) { <START> return Mono.error(throwable); <END> } } }); }</code><technical_language>Log exception here. Also, FluxUtil a method called monoError logs returns Mono.error()</technical_language>

Target:
public Mono<U> getFinalResult() { return Mono.defer(() -> { if (!this.pollResponse.getStatus().isComplete()) { return Mono.empty(); } else { try { return this.fetchResultOperation .apply(this.pollingContext); } catch (RuntimeException re) { return FluxUtil.monoError(logger, re); } } }); }
Source:
<code>public void processElement(RowData input, Context ctx, Collector<RowData> out) throws Exception { RowData currentKey = ctx.getCurrentKey(); boolean firstRow; RowData accumulators = accState.value(); if (null == accumulators) { if (isRetractMsg(input)) { return; } firstRow = true; accumulators = function.createAccumulators(); } else { firstRow = false; } function.setAccumulators(accumulators); RowData prevAggValue = function.getValue(); if (isAccumulateMsg(input)) { function.accumulate(input); } else { function.retract(input); } RowData newAggValue = function.getValue(); accumulators = function.getAccumulators(); if (!recordCounter.recordCountIsZero(accumulators)) { accState.update(accumulators); if (!firstRow) { <START> if (stateRetentionTime > 0 && equaliser.equals(prevAggValue, newAggValue)) { <END> return; } else { if (generateUpdateBefore) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.UPDATE_BEFORE); out.collect(resultRow); } resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.UPDATE_AFTER); } } else { resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.INSERT); } out.collect(resultRow); } else { if (!firstRow) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.DELETE); out.collect(resultRow); } accState.clear(); function.cleanup(); } }</code><technical_language>I this is RetractionITCase#testUniqueProcess failed. stateRetentionTime <= 0 state cleaning is enabled</technical_language>

Target:
public void processElement(RowData input, Context ctx, Collector<RowData> out) throws Exception { RowData currentKey = ctx.getCurrentKey(); boolean firstRow; RowData accumulators = accState.value(); if (null == accumulators) { if (isRetractMsg(input)) { return; } firstRow = true; accumulators = function.createAccumulators(); } else { firstRow = false; } function.setAccumulators(accumulators); RowData prevAggValue = function.getValue(); if (isAccumulateMsg(input)) { function.accumulate(input); } else { function.retract(input); } RowData newAggValue = function.getValue(); accumulators = function.getAccumulators(); if (!recordCounter.recordCountIsZero(accumulators)) { accState.update(accumulators); if (!firstRow) { if (stateRetentionTime <= 0 && equaliser.equals(prevAggValue, newAggValue)) { return; } else { if (generateUpdateBefore) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.UPDATE_BEFORE); out.collect(resultRow); } resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.UPDATE_AFTER); } } else { resultRow.replace(currentKey, newAggValue).setRowKind(RowKind.INSERT); } out.collect(resultRow); } else { if (!firstRow) { resultRow.replace(currentKey, prevAggValue).setRowKind(RowKind.DELETE); out.collect(resultRow); } accState.clear(); function.cleanup(); } }
Source:
<code>public CollectProducer(final Operator child, final ExchangePairID operatorID, final int collectConsumerWorkerID) { <START> super(child, new ExchangePairID[] { operatorID }, new int[][] { { MyriaConstants.MASTER_ID } }, <END> new int[] { collectConsumerWorkerID }, new FixValuePartitionFunction(0), true); }</code><technical_language>Actually, wait, confused. I 0 MASTER_ID. CollectProducers master</technical_language>

Target:
public CollectProducer(final Operator child, final ExchangePairID operatorID, final int collectConsumerWorkerID) { super(child, new ExchangePairID[] { operatorID }, COLLECTOR_PARTITION_TO_CHANNEL, new int[] { collectConsumerWorkerID }, new FixValuePartitionFunction(0), true); }
Source:
<code>public InputStream openNext() throws IOException { if (!iterator.hasNext()) { return null; } final String key = iterator.next(); final GetObjectRequest request = new GetObjectRequest(bucket, key); return new DefaultRetryable<ResumableInputStream>("Opening the file") { @Override public ResumableInputStream call() throws Exception { S3Object obj = client.getObject(request); long objectSize = obj.getObjectMetadata().getContentLength(); LOGGER.info("Open S3Object with bucket [{}], key [{}], with size [{}]", bucket, key, objectSize); <START> return new ResumableInputStream(obj.getObjectContent(), new S3InputStreamReopener(client, request, objectSize, retryExec)); <END> } }.executeWithCheckedException(retryExec, IOException.class); }</code><technical_language>return new ResumableInputStream(obj.getObjectContent()... is wrapped another retry logic. Is ok</technical_language>

Target:
public InputStream openNext() throws IOException { if (!iterator.hasNext()) { return null; } final String key = iterator.next(); final GetObjectRequest request = new GetObjectRequest(bucket, key); S3Object object = new DefaultRetryable<S3Object>(format("Getting object '%s'", request.getKey())) { @Override public S3Object call() { return client.getObject(request); } }.executeWithCheckedException(retryExec, IOException.class); long objectSize = object.getObjectMetadata().getContentLength(); LOGGER.info("Open S3Object with bucket [{}], key [{}], with size [{}]", bucket, key, objectSize); return new ResumableInputStream(object.getObjectContent(), new S3InputStreamReopener(client, request, objectSize, retryExec)); }
Source:
<code>public RelSubset getSubset(RelNode rel) { assert rel != null : "pre: rel != null"; if (rel instanceof RelSubset) { return canonize((RelSubset) rel); } else { RelSubset s = mapRel2Subset.get(rel); <START> return s == null ? null : canonize(s); <END> } }</code><technical_language>IMO, canonize in this method is needed. canonized subset is created. do think</technical_language>

Target:
public RelSubset getSubset(RelNode rel) { assert rel != null : "pre: rel != null"; if (rel instanceof RelSubset) { return (RelSubset) rel; } else { return mapRel2Subset.get(rel); } }
Source:
<code>public File createSegmentDescriptorFile(final ObjectMapper jsonMapper, final DataSegment segment) throws IOException { <START> File descriptorFile = File.createTempFile(TEMP_DIR, AzureStorageDruidModule.DESCRIPTOR_FILE_NAME); <END> try (FileOutputStream stream = new FileOutputStream(descriptorFile)) { stream.write(jsonMapper.writeValueAsBytes(segment)); } return descriptorFile; }</code><technical_language>here, I Files.createTempFile</technical_language>

Target:
public File createSegmentDescriptorFile(final ObjectMapper jsonMapper, final DataSegment segment) throws IOException { File descriptorFile = File.createTempFile("descriptor", ".json"); try (FileOutputStream stream = new FileOutputStream(descriptorFile)) { stream.write(jsonMapper.writeValueAsBytes(segment)); } return descriptorFile; }
Source:
<code>void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info) { this.changeType = info.change_type(); patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a()); patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b()); JsArrayString hdr = info.diff_header(); if (hdr != null) { StringBuilder b = new StringBuilder(); for (int i = 1; i < hdr.length(); i++) { String s = hdr.get(i); if (s.startsWith("diff --git ") || s.startsWith("index ") || s.startsWith("+++ ") || s.startsWith("--- ")) { continue; } b.append(s).append('\n'); } String hdrTxt = b.toString().trim(); header = !hdrTxt.isEmpty(); diffHeaderText.setInnerText(hdrTxt); UIObject.setVisible(diffHeaderRow, header); } else { header = false; UIObject.setVisible(diffHeaderRow, false); } <START> if (prefs.hideEmptyPane()) { if (changeType == ChangeType.ADDED) { setVisibleA(false); } else if (changeType == ChangeType.DELETED) { setVisibleB(false); } } <END> }</code><technical_language>This is duplicated below. say: setHideEmptyPane(prefs.hideEmptyPane()) time set() is called prefs honored user temporary changes, view is visible. if hideEmptyPane() is true pass true setHideEmptyPane() false for proper setVisibleA/B call</technical_language>

Target:
void set(DiffPreferences prefs, JsArray<RevisionInfo> list, DiffInfo info) { this.changeType = info.change_type(); patchSetSelectBoxA.setUpPatchSetNav(list, info.meta_a()); patchSetSelectBoxB.setUpPatchSetNav(list, info.meta_b()); JsArrayString hdr = info.diff_header(); if (hdr != null) { StringBuilder b = new StringBuilder(); for (int i = 1; i < hdr.length(); i++) { String s = hdr.get(i); if (s.startsWith("diff --git ") || s.startsWith("index ") || s.startsWith("+++ ") || s.startsWith("--- ")) { continue; } b.append(s).append('\n'); } String hdrTxt = b.toString().trim(); header = !hdrTxt.isEmpty(); diffHeaderText.setInnerText(hdrTxt); UIObject.setVisible(diffHeaderRow, header); } else { header = false; UIObject.setVisible(diffHeaderRow, false); } setHideEmptyPane(prefs.hideEmptyPane()); }
Source:
<code>public void open(FileInputSplit split) throws IOException { super.open(split); @SuppressWarnings("unchecked") FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers(); if(fieldParsers.length == 0) { throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input"); } this.parsedValues = new Object[fieldParsers.length]; for (int i = 0; i < fieldParsers.length; i++) { this.parsedValues[i] = fieldParsers[i].createValue(); } <START> if(this.getDelimiter().length == 1 && this.getDelimiter()[0] == "\n".getBytes(Charsets.UTF_8)[0] ) { <END> this.lineDelimiterIsLinebreak = true; } }</code><technical_language>I simplify this getDelimiter()[0] == '\n' I line feed is in charsets matter. do exclude mainframe C64 charsets way, I ;-)</technical_language>

Target:
public void open(FileInputSplit split) throws IOException { super.open(split); @SuppressWarnings("unchecked") FieldParser<Object>[] fieldParsers = (FieldParser<Object>[]) getFieldParsers(); if(fieldParsers.length == 0) { throw new IOException("CsvInputFormat.open(FileInputSplit split) - no field parsers to parse input"); } this.parsedValues = new Object[fieldParsers.length]; for (int i = 0; i < fieldParsers.length; i++) { this.parsedValues[i] = fieldParsers[i].createValue(); } if(this.getDelimiter().length == 1 && this.getDelimiter()[0] == '\n' ) { this.lineDelimiterIsLinebreak = true; } }
Source:
<code>private List<Job> getJobs(long limit, int dayInterval, String whereClause) { try (Handle handle = dbi.open()) { Query<Map<String, Object>> query = handle.createQuery( <START> "SELECT j.*, t.connector_id AS connectorId, t.schema_ AS \"schema\", t.table_ AS \"table\", t.columns, jo.type, jo.description, jo.location FROM " + <END> "(SELECT * FROM jobs " + "WHERE query_finished > DATE_SUB(NOW(), INTERVAL :day_interval day) " + "ORDER BY query_finished DESC LIMIT :limit) j " + "LEFT OUTER JOIN job_tables jt ON j.id = jt.job_id " + "LEFT OUTER JOIN tables t ON jt.table_id = t.id " + "LEFT OUTER JOIN job_outputs jo ON j.id = jo.job_id " + whereClause + " " + "ORDER BY query_finished DESC") .bind("limit", limit) .bind("day_interval", dayInterval); Map<Long, Job> idToJobMap = query. map(RosettaResultSetMapperFactory.mapperFor(JobTableOutputJoinRow.class)). fold(new HashMap<Long, Job>(), new JobTableOutputJoinRow.JobFolder()); return new ArrayList<>(idToJobMap.values()); } }</code><technical_language>please this 80 characters wide</technical_language>

Target:
private List<Job> getJobs(long limit, int dayInterval, String whereClause) { try (Handle handle = dbi.open()) { Query<Map<String, Object>> query = handle.createQuery( "SELECT " + "j.id AS id, " + "j.query AS query, " + "j.user AS user, " + "j.uuid AS uuid, " + "j.queryStats as queryStats, " + "j.state AS state, " + "j.columns AS columns, " + "j.query_finished AS queryFinished, " + "j.query_started AS queryStarted, " + "j.error AS error, " + "t.connector_id AS connectorId, " + "t.schema_ AS \"schema\", " + "t.table_ AS \"table\", " + "t.columns, " + "jo.type, " + "jo.description, " + "jo.location " + "FROM (SELECT * FROM jobs " + "WHERE query_finished > DATE_SUB(NOW(), INTERVAL :day_interval day) " + "ORDER BY query_finished DESC LIMIT :limit) j " + "LEFT OUTER JOIN job_tables jt ON j.id = jt.job_id " + "LEFT OUTER JOIN tables t ON jt.table_id = t.id " + "LEFT OUTER JOIN job_outputs jo ON j.id = jo.job_id " + whereClause + " " + "ORDER BY query_finished DESC") .bind("limit", limit) .bind("day_interval", dayInterval); Map<Long, Job> idToJobMap = query. map(RosettaResultSetMapperFactory.mapperFor(JobTableOutputJoinRow.class)). fold(new HashMap<Long, Job>(), new JobTableOutputJoinRow.JobFolder()); return new ArrayList<>(idToJobMap.values()); } }
Source:
<code>public Matrix hadamardProduct(Matrix matrix, Factory factory) { ensureFactoryIsNotNull(factory); if (matrix == null) { throw new IllegalArgumentException("Matrix can not be null."); } if (columns != matrix.rows()) { throw new IllegalArgumentException("Wrong matrix dimensions: " + matrix.rows() + "x" + matrix.columns()); } <START> Matrix result = factory.createMatrix(rows, matrix.columns()); <END> for (int i = 0; i < matrix.columns(); i++) { for (int j = 0; j < this.columns(); j++) { result.set(i, j, matrix.get(i, j) * this.get(i, j)); } } return result; }</code><technical_language>colums instead of matrix.colums() equal</technical_language>

Target:
public Matrix hadamardProduct(Matrix matrix, Factory factory) { ensureFactoryIsNotNull(factory); if (matrix == null) { throw new IllegalArgumentException("Matrix can not be null."); } if ((columns != matrix.columns()) || (rows != matrix.rows())) { throw new IllegalArgumentException( "Matrices dimensions are not equal: " + matrix.rows() + "x" + matrix.columns() + " not equal to " + rows + "x" + columns); } Matrix result = factory.createMatrix(rows, columns); for (int i = 0; i < rows; i++) { for (int j = 0; j < columns; j++) { result.set(i, j, matrix.get(i, j) * get(i, j)); } } return result; }
Source:
<code>protected LayoutEditPolicy getLayoutPolicy() { return new DataInterfaceLayoutEditPolicy() { @Override protected Command getCreateCommand(CreateRequest request) { if (((getHost() instanceof InterfaceEditPart) && (request.getNewObjectType() instanceof ResourceTypeEntry))){ ResourceTypeEntry type = (ResourceTypeEntry) request.getNewObjectType(); Device dev = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceCreateCommand(type, dev, false); } return super.getCreateCommand(request); } @Override @SuppressWarnings("unchecked") protected Command getAddCommand(Request generic) { ChangeBoundsRequest request = (ChangeBoundsRequest) generic; List<Object> editParts = request.getEditParts(); CompoundCommand command = new CompoundCommand(); for <START> (Object child <END> : editParts) { if (child instanceof ResourceEditPart) { Device targetDevice = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceMoveCommand(((ResourceEditPart)child).getModel(), targetDevice, targetDevice.getResource().size()); } } return command.unwrap(); } }; }</code><technical_language>this EditPart</technical_language>

Target:
protected LayoutEditPolicy getLayoutPolicy() { return new DataInterfaceLayoutEditPolicy() { @Override protected Command getCreateCommand(CreateRequest request) { if (((getHost() instanceof InterfaceEditPart) && (request.getNewObjectType() instanceof ResourceTypeEntry))){ ResourceTypeEntry type = (ResourceTypeEntry) request.getNewObjectType(); Device dev = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceCreateCommand(type, dev, false); } return super.getCreateCommand(request); } @Override protected Command getAddCommand(Request generic) { ChangeBoundsRequest request = (ChangeBoundsRequest) generic; @SuppressWarnings("unchecked") List<EditPart> editParts = request.getEditParts(); CompoundCommand command = new CompoundCommand(); for (EditPart child : editParts) { if (child instanceof ResourceEditPart) { Device targetDevice = (Device)((InterfaceEditPart)getHost()).getModel().eContainer(); return new ResourceMoveCommand(((ResourceEditPart)child).getModel(), targetDevice, targetDevice.getResource().size()); } } return command.unwrap(); } }; }
Source:
<code>private DynamoDBQueryExpression<DynamoExternalIdentifier> createGetQuery(StudyIdentifier studyId, String offsetKey, int pageSize, String idFilter, Boolean assignmentFilter) { Set<String> callerSubstudyIds = BridgeUtils.getRequestContext().getCallerSubstudies(); DynamoDBQueryExpression<DynamoExternalIdentifier> query = new DynamoDBQueryExpression<DynamoExternalIdentifier>(); if (idFilter != null) { query.withRangeKeyCondition(IDENTIFIER, new Condition() .withAttributeValueList(new AttributeValue().withS(idFilter)) .withComparisonOperator(BEGINS_WITH)); } if (assignmentFilter != null) { query.withQueryFilterEntry(HEALTH_CODE, new Condition() .withComparisonOperator(assignmentFilter.booleanValue() ? NOT_NULL : NULL)); } if (callerSubstudyIds != null && !callerSubstudyIds.isEmpty()) { query.withQueryFilterEntry(SUBSTUDY_ID, new Condition() .withAttributeValueList(callerSubstudyIds.stream() .map(id -> new AttributeValue(id)).collect(Collectors.toList())) <START> .withComparisonOperator(ComparisonOperator.IN)); <END> } query.withHashKeyValues(new DynamoExternalIdentifier(studyId.getIdentifier(), null)); if (offsetKey != null) { Map<String, AttributeValue> map = new HashMap<>(); map.put(STUDY_ID, new AttributeValue().withS(studyId.getIdentifier())); map.put(IDENTIFIER, new AttributeValue().withS(offsetKey)); query.withExclusiveStartKey(map); } query.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); query.withConsistentRead(true); query.withLimit(pageSize); return query; }</code><technical_language>If substudy is sparsely populated (or unpopulated), this table scan large sections of ExternalId table (or possibly external IDs for a study). create a secondary index</technical_language>

Target:
private DynamoDBQueryExpression<DynamoExternalIdentifier> createGetQuery(StudyIdentifier studyId, String offsetKey, int pageSize, String idFilter, Boolean assignmentFilter) { DynamoDBQueryExpression<DynamoExternalIdentifier> query = new DynamoDBQueryExpression<DynamoExternalIdentifier>(); if (idFilter != null) { query.withRangeKeyCondition(IDENTIFIER, new Condition() .withAttributeValueList(new AttributeValue().withS(idFilter)) .withComparisonOperator(BEGINS_WITH)); } if (assignmentFilter != null) { query.withQueryFilterEntry(HEALTH_CODE, new Condition() .withComparisonOperator(assignmentFilter.booleanValue() ? NOT_NULL : NULL)); } query.withHashKeyValues(new DynamoExternalIdentifier(studyId.getIdentifier(), null)); if (offsetKey != null) { Map<String, AttributeValue> map = new HashMap<>(); map.put(STUDY_ID, new AttributeValue().withS(studyId.getIdentifier())); map.put(IDENTIFIER, new AttributeValue().withS(offsetKey)); query.withExclusiveStartKey(map); } query.withReturnConsumedCapacity(ReturnConsumedCapacity.TOTAL); query.withConsistentRead(true); query.withLimit(pageSize); return query; }
Source:
<code>protected void builUI(Group root) { EditorGameAssets gameAssets = controller.getEditorGameAssets(); <START> gameAssets.setLoadingPath("src/test/resources/framesTest", true); <END> controller.getCommands().pushContext(); Frames frames = new Frames(); for (int i = 0; i < 20; ++i) { Frame frame = new Frame(); Image image = new Image(); image.setUri(gameAssets .resolve("externalResources/ic_" + (i % 10) + ".png") .file().getAbsolutePath()); frame.setRenderer(image); frame.setTime(MathUtils.random(.1f, .5f)); frames.getFrames().add(frame); } FramesTimeline widget = new FramesTimeline(controller); widget.setFrames(frames.getFrames()); Container container = new Container(widget); container.setFillParent(true); root.addActor(container); }</code><technical_language>This creates problems. "framesTest". I guessed tested work. problem ApplicationAssets load images, ApplicationAssets completely ignores this path</technical_language>

Target:
protected void builUI(Group root) { EditorGameAssets gameAssets = controller.getEditorGameAssets(); gameAssets.setLoadingPath("framesTest", true); controller.getCommands().pushContext(); Frames frames = new Frames(); for (int i = 0; i < 20; ++i) { Frame frame = new Frame(); Image image = new Image(); image.setUri("externalResources/ic_" + (i % 10) + ".png"); frame.setRenderer(image); frame.setTime(MathUtils.random(.1f, .5f)); frames.getFrames().add(frame); } FramesTimeline widget = new FramesTimeline(controller); widget.setFrames(frames.getFrames()); Container container = new Container(widget); container.setFillParent(true); root.addActor(container); }
Source:
<code>public void deleteVertex(Vertex vertex, Authorizations authorizations) { checkNotNull(vertex, "vertex cannot be null"); Span trace = Trace.start("deleteVertex"); trace.data("vertexId", vertex.getId()); try { <START> FetchHints edgeFetchHints = new FetchHintsBuilder() <END> .setIncludeExtendedDataTableNames(true) .build(); for (Edge edge : vertex.getEdges(Direction.BOTH, edgeFetchHints, authorizations)) { deleteEdge(edge, authorizations); } deleteAllExtendedDataForElement(vertex, authorizations); getSearchIndex().deleteElement(this, vertex, authorizations); addMutations(VertexiumObjectType.VERTEX, elementMutationBuilder.getDeleteRowMutation(vertex.getId())); if (hasEventListeners()) { queueEvent(new DeleteVertexEvent(this, vertex)); } } finally { trace.stop(); } }</code><technical_language>this method gutted call new deleteElements method</technical_language>

Target:
public void deleteVertex(Vertex vertex, Authorizations authorizations) { deleteElements(Stream.of(vertex), authorizations); }
Source:
<code>public static Map<Integer, SubQueryPlan> instantiate(final List<PlanFragmentEncoding> fragments, final ConstructArgs args) throws CatalogException { int idx = 0; for (PlanFragmentEncoding fragment : fragments) { fragment.setFragmentIndex(idx++); } sanityCheckEdges(fragments); assignWorkersToFragments(fragments, args); Map<Integer, PlanFragmentEncoding> op2OwnerFragmentMapping = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { for (OperatorEncoding<?> op : fragment.operators) { op2OwnerFragmentMapping.put(op.opId, fragment); } } Map<Integer, Operator> allOperators = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { instantiateOperators(fragment, args, allOperators); } <START> while (!setConsumerSchema(fragments, allOperators)) { <END> } Map<Integer, SubQueryPlan> plan = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { RootOperator op = instantiateFragment(fragment, args, allOperators); for (Integer worker : fragment.workers) { if (!plan.containsKey(worker)) { plan.put(worker, new SubQueryPlan()); } SubQueryPlan workerPlan = plan.get(worker); workerPlan.addRootOp(op); } } return plan; }</code><technical_language>hard trigger infinite loop here</technical_language>

Target:
public static Map<Integer, SubQueryPlan> instantiate(final List<PlanFragmentEncoding> fragments, final ConstructArgs args) throws CatalogException { int idx = 0; for (PlanFragmentEncoding fragment : fragments) { fragment.setFragmentIndex(idx++); } sanityCheckEdges(fragments); assignWorkersToFragments(fragments, args); Map<Integer, PlanFragmentEncoding> op2OwnerFragmentMapping = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { for (OperatorEncoding<?> op : fragment.operators) { op2OwnerFragmentMapping.put(op.opId, fragment); } } Map<Integer, Operator> allOperators = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { instantiateFragmentOperators(fragment, args, allOperators); } int loopCount = 0; while (setConsumerSchema(fragments, allOperators) && loopCount++ < allOperators.size()) { } Map<Integer, SubQueryPlan> plan = Maps.newHashMap(); for (PlanFragmentEncoding fragment : fragments) { RootOperator op = instantiateFragment(fragment, args, allOperators); for (Integer worker : fragment.workers) { if (!plan.containsKey(worker)) { plan.put(worker, new SubQueryPlan()); } SubQueryPlan workerPlan = plan.get(worker); workerPlan.addRootOp(op); } } return plan; }
Source:
<code>public ListenableFuture<?> startMemoryRevoke() { <START> return null; <END> }</code><technical_language>throw? If means wants some memory giving none. error</technical_language>

Target:
public ListenableFuture<?> startMemoryRevoke() { throw new UnsupportedOperationException("startMemoryRevoke not supported for InMemoryHashAggregationBuilder"); }
Source:
<code>public void addBccAddresses(Address... bccRecipients) { if (bccRecipients.length > 0) { addRecipientsFromAddresses(RecipientType.BCC, bccRecipients); String bccAddress = account.getAlwaysBcc(); boolean alreadyVisible = recipientMvpView.isBccVisible(); boolean singleBccRecipientFromAccount = bccRecipients.length == 1 && bccRecipients[0].toString().equals(bccAddress); <START> recipientMvpView.setBccVisibility(alreadyVisible || !singleBccRecipientFromAccount); <END> updateRecipientExpanderVisibility(); } }</code><technical_language>Flipped logic here, this wrong before</technical_language>

Target:
public void addBccAddresses(Address... bccRecipients) { if (bccRecipients.length > 0) { String bccAddress = account.getAlwaysBcc(); boolean alreadyVisible = recipientMvpView.isBccVisible(); boolean singleBccRecipientFromAccount = bccRecipients.length == 1 && bccRecipients[0].toString().equals(bccAddress); boolean showBcc = alreadyVisible || !singleBccRecipientFromAccount; if ( showBcc ) { addRecipientsFromAddresses(RecipientType.BCC, bccRecipients); } else { defaultBccAddress = bccRecipients[0]; } recipientMvpView.setBccVisibility(showBcc); updateRecipientExpanderVisibility(); } }
Source:
<code>public GoogleComputeEngineServiceAdapter(GoogleComputeEngineApi api, @UserProject Supplier<String> userProject, Function<TemplateOptions, ImmutableMap.Builder<String, String>> metatadaFromTemplateOptions, @Named("zone") Predicate<AtomicReference<Operation>> operationDonePredicate, @Named(OPERATION_COMPLETE_INTERVAL) Long operationCompleteCheckInterval, @Named(OPERATION_COMPLETE_TIMEOUT) Long operationCompleteCheckTimeout, @Memoized Supplier<Map<URI, ? extends Location>> zones, @Memoized Supplier<Map<URI, ? extends Hardware>> hardwareMap, FirewallTagNamingConvention.Factory firewallTagNamingConvention) { this.api = checkNotNull(api, "google compute api"); this.userProject = checkNotNull(userProject, "user project name"); this.metatadaFromTemplateOptions = checkNotNull(metatadaFromTemplateOptions, "metadata from template options function"); this.operationCompleteCheckInterval = checkNotNull(operationCompleteCheckInterval, "operation completed check interval"); this.operationCompleteCheckTimeout = checkNotNull(operationCompleteCheckTimeout, "operation completed check timeout"); this.retryOperationDonePredicate = retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, TimeUnit.MILLISECONDS); this.zones = checkNotNull(zones, "zones"); this.hardwareMap = checkNotNull(hardwareMap, "hardwareMap"); <START> this.firewallTagNamingConvention = firewallTagNamingConvention; <END> }</code><technical_language>Add null check</technical_language>

Target:
public GoogleComputeEngineServiceAdapter(GoogleComputeEngineApi api, @UserProject Supplier<String> userProject, Function<TemplateOptions, ImmutableMap.Builder<String, String>> metatadaFromTemplateOptions, @Named("zone") Predicate<AtomicReference<Operation>> operationDonePredicate, @Named(OPERATION_COMPLETE_INTERVAL) Long operationCompleteCheckInterval, @Named(OPERATION_COMPLETE_TIMEOUT) Long operationCompleteCheckTimeout, @Memoized Supplier<Map<URI, ? extends Location>> zones, @Memoized Supplier<Map<URI, ? extends Hardware>> hardwareMap, FirewallTagNamingConvention.Factory firewallTagNamingConvention) { this.api = checkNotNull(api, "google compute api"); this.userProject = checkNotNull(userProject, "user project name"); this.metatadaFromTemplateOptions = checkNotNull(metatadaFromTemplateOptions, "metadata from template options function"); this.operationCompleteCheckInterval = checkNotNull(operationCompleteCheckInterval, "operation completed check interval"); this.operationCompleteCheckTimeout = checkNotNull(operationCompleteCheckTimeout, "operation completed check timeout"); this.retryOperationDonePredicate = retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, TimeUnit.MILLISECONDS); this.zones = checkNotNull(zones, "zones"); this.hardwareMap = checkNotNull(hardwareMap, "hardwareMap"); this.firewallTagNamingConvention = checkNotNull(firewallTagNamingConvention, "firewallTagNamingConvention"); }
Source:
<code><START> public AnnotationCommandTargetResolver() { <END> super(); }</code><technical_language>mind making constructor protected? Additionally, I Builder sole parameter, pull identifierAnnotation versionAnnotation set fields. I fair introduce this a breaking change gonna part of 4.1. @abuijze / @m1l4n54v1c please call out if disagree here</technical_language>

Target:
public AnnotationCommandTargetResolver() { this.identifierAnnotation = TargetAggregateIdentifier.class; this.versionAnnotation = TargetAggregateVersion.class; }
Source:
<code>public void testCreate() throws StripeException { Map<String, Object> owner = new HashMap<String, Object>(); owner.put("email", "jenny.rosen@example.com"); Map<String, Object> params = new HashMap<String, Object>(); params.put("type", "ach_credit_transfer"); params.put("currency", "usd"); params.put("owner", owner); <START> Source source = Source.create(params); <END> assertNotNull(source); verifyRequest( APIResource.RequestMethod.POST, "/v1/sources", params ); }</code><technical_language>called resource</technical_language>

Target:
public void testCreate() throws StripeException { final Map<String, Object> owner = new HashMap<String, Object>(); owner.put("email", "jenny.rosen@example.com"); final Map<String, Object> params = new HashMap<String, Object>(); params.put("type", "ach_credit_transfer"); params.put("currency", "usd"); params.put("owner", owner); final Source source = Source.create(params); assertNotNull(source); verifyRequest( APIResource.RequestMethod.POST, "/v1/sources", params ); }
Source:
<code>public Adapter getContentAdapter() { if <START> (adapter == null) { <END> adapter = new AdapterImpl() { @Override public void notifyChanged(final Notification notification) { switch (notification.getEventType()) { case Notification.ADD: case Notification.ADD_MANY: refreshChildren(); break; case Notification.MOVE: if (notification.getNewValue() instanceof IInterfaceElement) { refreshChildren(); } break; case Notification.REMOVE: case Notification.REMOVE_MANY: refreshChildren(); break; default: break; } } }; } return adapter; }</code><technical_language>null == adapter</technical_language>

Target:
public Adapter getContentAdapter() { if (null == adapter) { adapter = new EContentAdapter() { @Override public void notifyChanged(final Notification notification) { switch (notification.getEventType()) { case Notification.ADD: case Notification.ADD_MANY: refreshChildren(); break; case Notification.MOVE: if (notification.getNewValue() instanceof IInterfaceElement) { refreshChildren(); } break; case Notification.REMOVE: case Notification.REMOVE_MANY: refreshChildren(); break; default: break; } } }; } return adapter; }
Source:
<code>protected void firstListenerAdded() { if (!isDisposed()) { if <START> (listener == <END> null) { listener = property .adaptListener(new ISimplePropertyListener<ListDiff<E>>() { @Override public void handleEvent( final SimplePropertyEvent<ListDiff<E>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedList = new ArrayList<E>(getList()); stale = false; if (listener != null) listener.addTo(source); } }); } }</code><technical_language>combine conditions of 'if' statements</technical_language>

Target:
protected void firstListenerAdded() { if (!isDisposed() && listener == null) { listener = property.adaptListener(new ISimplePropertyListener<ListDiff<E>>() { @Override public void handleEvent(final SimplePropertyEvent<ListDiff<E>> event) { if (!isDisposed() && !updating) { getRealm().exec(new Runnable() { @Override public void run() { if (event.type == SimplePropertyEvent.CHANGE) { modCount++; notifyIfChanged(event.diff); } else if (event.type == SimplePropertyEvent.STALE && !stale) { stale = true; fireStale(); } } }); } } }); } getRealm().exec(new Runnable() { @Override public void run() { cachedList = new ArrayList<E>(getList()); stale = false; if (listener != null) listener.addTo(source); } }); }
Source:
<code>public V put(V value) { <START> if (value != null) { <END> if (matchingMode == MATCHING_MODE.KEEP_ALL) { allList.add(value); return value; } else { if (matchingMode == MATCHING_MODE.KEEP_LAST || !firstOrLastHash.containsKey(value)) { firstOrLastHash.put(value, value); return value; } } } return null; }</code><technical_language>I suggest refactoring <LINK_0> distinguish exceptional normal branches here. Exceptional branch is == null is recommended put exceptional branches beginning of method (guard clause, guard method exceptional argument/condition): if (value == null) { return null; } Normal branches are: 1. matching mode is keep_all 2. matching mode is keep_last keep_first Normal branches guard clauses. if-else for normal branches, if 2 choices normal conditions. For 3 more options switch-case if statements. I suggest change this method in way. Note, method clarity place: if (matchingMode == MATCHING_MODE.KEEP_ALL) { allList.add(value); return value; } if (matchingMode == MATCHING_MODE.KEEP_LAST) { firstOrLastHash.put(value, value); return value; } if (matchingMode == MATCHING_MODE.KEEP_FIRST && !firstOrLastHash.containsKey(value) ) { firstOrLastHash.put(value, value); return value; } // wan't stored in cache return null; "Guard clauses" remove nested conditions (nested conditions complicates code clarity). I suggest break keep_last keep_first options 2 branches code is same. is highlight options</technical_language>

Target:
public V put(V value) { if (value == null) { return null; } if (matchingMode == MATCHING_MODE.KEEP_ALL) { allList.add(value); return value; } if (matchingMode == MATCHING_MODE.KEEP_LAST) { firstOrLastHash.put(value, value); return value; } if (!firstOrLastHash.containsKey(value)) { firstOrLastHash.put(value, value); return value; } return null; }
Source:
<code>private void shutdownCompleted(String cause) { if (!this.executor.isShutdown()) { this.executor.execute(() -> generateNacksForPendingAcks(cause)); if (!this.executorExplicitlySet) { <START> this.executor.shutdown(); <END> } } }</code><technical_language>style: indentation wrong here</technical_language>

Target:
private void shutdownCompleted(String cause) { this.executor.execute(() -> generateNacksForPendingAcks(cause)); }
Source:
<code>private int getOffset(IDocument document, StyledText textWidget, Point point) throws BadLocationException { int widgetCaret= fViewer.getTextWidget().getCaretOffset(); if (fViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 ext= (ITextViewerExtension5) fViewer; int offset = <START> ext.widgetOffset2ModelOffset(textWidget.getOffsetAtPoint(point)); <END> if (offset == -1) { int docLineIndex= ext.widgetLine2ModelLine(textWidget.getLineIndex(point.y)); String lineDelimiter= document.getLineDelimiter(docLineIndex); int delimLength= lineDelimiter == null ? 0 : lineDelimiter.length(); return document.getLineOffset(docLineIndex) + document.getLineLength(docLineIndex) - delimLength; } return offset; } IRegion visible= fViewer.getVisibleRegion(); return widgetCaret + visible.getOffset(); }</code><technical_language>this throw internally BadLocationException -1</technical_language>

Target:
private int getOffset(IDocument document, StyledText textWidget, Point point) throws BadLocationException { int widgetCaret= fViewer.getTextWidget().getCaretOffset(); if (fViewer instanceof ITextViewerExtension5) { ITextViewerExtension5 ext= (ITextViewerExtension5) fViewer; int widgetOffset = textWidget.getOffsetAtPoint(point); int offset = widgetOffset != -1 ? ext.widgetOffset2ModelOffset(textWidget.getOffsetAtPoint(point)) : -1; if (offset == -1) { int docLineIndex= ext.widgetLine2ModelLine(textWidget.getLineIndex(point.y)); String lineDelimiter= document.getLineDelimiter(docLineIndex); int delimLength= lineDelimiter == null ? 0 : lineDelimiter.length(); return document.getLineOffset(docLineIndex) + document.getLineLength(docLineIndex) - delimLength; } return offset; } IRegion visible= fViewer.getVisibleRegion(); return widgetCaret + visible.getOffset(); }
Source:
<code>private static String getExpectedErrorMessageForInsertExistingBucketedTable(InsertExistingPartitionsBehavior behavior, String partitionName) { if (behavior == InsertExistingPartitionsBehavior.APPEND) { return "Cannot insert into existing partition of bucketed Hive table: " + partitionName; } <START> else if (behavior == InsertExistingPartitionsBehavior.ERROR) { <END> return "Cannot insert into an existing partition of Hive table: " + partitionName; } throw new IllegalArgumentException("Unexpected insertExistingPartitionsBehavior: " + behavior.name()); }</code><technical_language>else is redundant</technical_language>

Target:
private static String getExpectedErrorMessageForInsertExistingBucketedTable(InsertExistingPartitionsBehavior behavior, String partitionName) { if (behavior == InsertExistingPartitionsBehavior.APPEND) { return "Cannot insert into existing partition of bucketed Hive table: " + partitionName; } if (behavior == InsertExistingPartitionsBehavior.ERROR) { return "Cannot insert into an existing partition of Hive table: " + partitionName; } throw new IllegalArgumentException("Unexpected insertExistingPartitionsBehavior: " + behavior); }
Source:
<code>private void waitUntilReady() { busySem.acquireUninterruptibly(); <START> busySem.release(); <END> }</code><technical_language>else is lock? a "queueLock" object lock for this purpose</technical_language>

Target:
private void waitUntilReady() { synchronized(busyLock) { while (busy) { try { busyLock.wait(); } catch (InterruptedException e) { e.printStackTrace(); } } } }
Source:
<code>public void forAllUsers(UserIterator iterator) { <START> Set<String> userAndRoles; <END> for (String user : userSocketMap.keySet()) { userAndRoles = authorizationService.getRoles(user); userAndRoles.add(user); iterator.handleUser(user, userAndRoles); } }</code><technical_language>moved for loop</technical_language>

Target:
public void forAllUsers(UserIterator iterator) { for (String user : userSocketMap.keySet()) { Set<String> userAndRoles = authorizationService.getRoles(user); userAndRoles.add(user); iterator.handleUser(user, userAndRoles); } }
Source:
<code>private State getStateFromConfig(Config pilightConfig, PilightBindingConfig bindingConfig) { Location loc = pilightConfig.getConfig().get(bindingConfig.getLocation()); if (loc != null) { Device dev = loc.getDevices().get(bindingConfig.getDevice()); if (dev != null) { String devType = dev.getType().toString(); if (devType.equals(DeviceType.SWITCH) || devType.equals(DeviceType.DIMMER)) { OnOffType state = OnOffType.valueOf(dev.getState().toUpperCase()); if (dev.getDimlevel() != null && dev.getDimlevel() > 0) { if (state.equals(OnOffType.ON)) return new PercentType(getPercentageFromDimLevel(dev.getDimlevel().toString())); else <START> return new PercentType(0); <END> } return state; } else if (devType.equals(DeviceType.VALUE)) { bindingConfig.setDecimals(dev.getDeviceDecimals()); String property = bindingConfig.getProperty(); if (dev.getProperties().containsKey(property)) { String value = dev.getProperties().get(property); return getStateFromProperty(value, bindingConfig); } } } } return null; }</code><technical_language>please PercentType.ZERO constant instead</technical_language>

Target:
private State getStateFromConfig(Config pilightConfig, PilightBindingConfig bindingConfig) { Location loc = pilightConfig.getConfig().get(bindingConfig.getLocation()); if (loc != null) { Device dev = loc.getDevices().get(bindingConfig.getDevice()); if (dev != null) { String devType = dev.getType().toString(); if (devType.equals(DeviceType.SWITCH) || devType.equals(DeviceType.DIMMER)) { OnOffType state = OnOffType.valueOf(dev.getState().toUpperCase()); if (dev.getDimlevel() != null && dev.getDimlevel() > 0) { if (state.equals(OnOffType.ON)) return new PercentType(getPercentageFromDimLevel(dev.getDimlevel().toString())); else return PercentType.ZERO; } return state; } else if (devType.equals(DeviceType.VALUE)) { bindingConfig.setScale(dev.getScale()); String property = bindingConfig.getProperty(); if (dev.getProperties().containsKey(property)) { String value = dev.getProperties().get(property); return getStateFromProperty(value, bindingConfig); } } } } return null; }
Source:
<code>private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean kaslrEnabled = vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); <START> boolean ovmfEnabled = vm.getBiosType() == BiosType.Q35_SECURE_BOOT; <END> if (!acpiEnabled && !hypervEnabled && !kaslrEnabled && !ovmfEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); writer.writeEndElement(); } if (kaslrEnabled) { writer.writeElement("vmcoreinfo"); } if (ovmfEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }</code><technical_language>a name for variable confusing name line 621</technical_language>

Target:
private void writeFeatures() { if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { return; } boolean acpiEnabled = vm.getAcpiEnable(); boolean kaslrEnabled = vmInfoBuildUtils.isKASLRDumpEnabled(vm.getVmOsId()); boolean secureBootEnabled = vm.getBiosType() == BiosType.Q35_SECURE_BOOT; if (!acpiEnabled && !hypervEnabled && !kaslrEnabled && !secureBootEnabled) { return; } writer.writeStartElement("features"); if (acpiEnabled) { writer.writeElement("acpi"); } if (hypervEnabled) { writer.writeStartElement("hyperv"); writer.writeStartElement("relaxed"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("vapic"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); writer.writeStartElement("spinlocks"); writer.writeAttributeString("state", "on"); writer.writeAttributeString("retries", "8191"); writer.writeEndElement(); writer.writeEndElement(); } if (kaslrEnabled) { writer.writeElement("vmcoreinfo"); } if (secureBootEnabled) { writer.writeStartElement("smm"); writer.writeAttributeString("state", "on"); writer.writeEndElement(); } writer.writeEndElement(); }