auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
START public CtfTmfEvent getCurrentEvent() { END final StreamInputReader top = super.prio.peek(); if (top != null) { return new CtfKernelEvent(top.getCurrentEvent(), top.getFilename(), (CtfKernelTrace) this.getCtfTmfTrace()); } return null; } CtfKernelEvent

Target:
public CtfKernelEvent getCurrentEvent() { final StreamInputReader top = super.prio.peek(); if (top != null) { return new CtfKernelEvent(top.getCurrentEvent(), top.getFilename(), (CtfKernelTrace) this.getCtfTmfTrace()); } return null; }
Source:
private boolean hasExt(PackExt ext) { START return (extensions & ext.getBit()) == ext.getBit(); END } != 0 is also valid if the bit is only ever 1 bit set.

Target:
private boolean hasExt(PackExt ext) { return (extensions & ext.getBit()) != 0; }
Source:
public void setLoadMeterTimerPeriod(int p) { START if (m_loadMeterTimerPeriod == p) return; END m_loadMeterTimerPeriod = p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN; disposeLoadMeterTimer(); initializeLoadMeterTimer(); } You can still put the assert if you want. assert (p > m_LoadMeterTimerPeriodMin); It will warn the designer that something is wrong, but the code below will recover when in production.

Target:
public void setLoadMeterTimerPeriod(int p) { assert (p > LOAD_METER_TIMER_MIN); if (m_loadMeterTimerPeriod == p) return; m_loadMeterTimerPeriod = p > LOAD_METER_TIMER_MIN ? p : LOAD_METER_TIMER_MIN; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }
Source:
public OneCoreTickCounters(Integer[] c) { START assert (c != null && c.length >= 7); END fUser = c[0]; fNice = c[1]; fSystem = c[2]; fIdle = c[3]; fIowait = c[4]; fIrq = c[5]; fSoftirq = c[6]; } I think you should also have if (c == null || c.length < 7) return; or else we'll hav an NPE

Target:
public OneCoreTickCounters(Integer[] c) { // sanity checks assert (c != null && c.length >= 7); if (c == null || c.length < 7) return; fUser = c[0]; fNice = c[1]; fSystem = c[2]; fIdle = c[3]; fIowait = c[4]; fIrq = c[5]; fSoftirq = c[6]; }
Source:
public String toString() { if(m_highLoadWatermark != null) { START return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark.intValue(); //$NON-NLS-1$ //$NON-NLS-2$ END } else { return "Load:" + m_load + ", high water-mark: not defined"; //$NON-NLS-1$ //$NON-NLS-2$ } } Only one uses intValue(). Let's remove it.

Target:
public String toString() { if(m_highLoadWatermark != null) { return "Load:" + m_load + ", high water-mark:" + m_highLoadWatermark; //$NON-NLS-1$ //$NON-NLS-2$ } else { return "Load:" + m_load + ", high water-mark: not defined"; //$NON-NLS-1$ //$NON-NLS-2$ } }
Source:
START public int getLoad() { END return m_load; } Let's have this one return Integer too, to be consistent.

Target:
public Integer getLoad() { return m_load; }
Source:
START public void setLoadMetersEnabled(boolean enabled) { END m_loadMetersEnabled = enabled; disposeLoadMeterTimer(); initializeLoadMeterTimer(); } Maybe if (m_loadMetersEnabled == enabled) return;

Target:
public void setLoadMetersEnabled(boolean enabled) { if (m_loadMetersEnabled == enabled) return; m_loadMetersEnabled = enabled; disposeLoadMeterTimer(); initializeLoadMeterTimer(); }
Source:
protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput) return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); else START return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); END } Braces should be used in the above if-else statement.

Target:
protected String getFilePath() { if (path != null){ return path.toOSString(); } IEditorPart ed = fWindow.getActivePage().getActiveEditor(); if(ed.getEditorInput() instanceof PathEditorInput){ return ((PathEditorInput)ed.getEditorInput()).getPath().toString(); } else { return ResourceUtil.getFile(ed.getEditorInput()).getLocation().toString(); } }
Source:
START public List<CtfTmfEventField> getValue() { END return new ArrayList<CtfTmfEventField>(Arrays.asList((CtfTmfEventField[])super.getValue())); } > The return type must be an Object, the toString() function is called on it so it had to converted to a List or else the string doesn't look good Hmm, good point. But the getValue() should return the same type that is passed to the constructor. And we pass a field[] so we can reuse the sub-fields attribute in the super class... I think the easiest/cleanest way would be to override .toString() in here, and have it use Arrays.toString() to correctly print the array.

Target:
public CtfTmfEventField[] getValue() { return (CtfTmfEventField[])super.getValue(); }
Source:
public TmfLocationArray(ITmfLocation[] locations, long[] ranks) { START assert(locations.length == ranks.length); END fLocations = Arrays.copyOf(locations, locations.length); fRanks = Arrays.copyOf(ranks, ranks.length); } Are you sure you want to leave asserts in the code? Maybe just checking and throwing IllegalArgumentException, or similar, is better?

Target:
public TmfLocationArray(ITmfLocation[] locations, long[] ranks) { fLocations = Arrays.copyOf(locations, locations.length); fRanks = Arrays.copyOf(ranks, ranks.length); }
Source:
private String loadWorkDefinitionFromArtifact(String name) throws OseeCoreException { START Artifact artifact = null; END try { artifact = ArtifactQuery.getArtifactFromTypeAndNameNoException(AtsArtifactTypes.WorkDefinition, name, BranchManager.getCommonBranch()); if (artifact != null) { return loadWorkDefinitionFromArtifact(artifact); } } catch (OseeCoreException ex) { throw ex; } catch (Exception ex) { throw new OseeWrappedException(String.format("Error loading AtsDsl [%s] from Artifact", name), ex); } return null; } Error handling is confusing. Seems like you always want to throw exceptions from ArtifactQuery so that call should be outside the try catch block and the exception you really want to catch are those generated from loadWorkDefinitionFromArtifact.

Target:
private String loadWorkDefinitionFromArtifact(String name) throws OseeCoreException { Artifact artifact = ArtifactQuery.getArtifactFromTypeAndNameNoException(AtsArtifactTypes.WorkDefinition, name, BranchManager.getCommonBranch()); return loadWorkDefinitionFromArtifact(artifact); }
Source:
static void assertDerivedFrom(RevCommit derived, RevCommit original) { assertThat(derived, not(equalTo(original))); START assertEquals(derived.getFullMessage(), original.getFullMessage()); END } Switch arguments, expected comes first for assertEquals.

Target:
static void assertDerivedFrom(RevCommit derived, RevCommit original) { assertThat(derived, not(equalTo(original))); assertEquals(original.getFullMessage(), derived.getFullMessage()); }
Source:
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { includeValue= includeValue && fValue != Value.UNKNOWN; short firstBytes = ITypeMarshalBuffer.EVAL_FIXED; if (includeValue) firstBytes |= ITypeMarshalBuffer.FLAG1; switch (fValueCategory) { case LVALUE: firstBytes |= ITypeMarshalBuffer.FLAG2; break; case PRVALUE: START firstBytes |= ITypeMarshalBuffer.FLAG3; END break; default: break; } buffer.putShort(firstBytes); buffer.marshalType(fType); if (includeValue) { buffer.marshalValue(fValue); } } Makes sense to swap FLAG2 and FLAG3 since LVALUE is less common than PRVALUE.

Target:
public void marshal(ITypeMarshalBuffer buffer, boolean includeValue) throws CoreException { includeValue= includeValue && fValue != Value.UNKNOWN; short firstBytes = ITypeMarshalBuffer.EVAL_FIXED; if (includeValue) firstBytes |= ITypeMarshalBuffer.FLAG1; switch (fValueCategory) { case PRVALUE: firstBytes |= ITypeMarshalBuffer.FLAG2; break; case LVALUE: firstBytes |= ITypeMarshalBuffer.FLAG3; break; default: break; } buffer.putShort(firstBytes); buffer.marshalType(fType); if (includeValue) { buffer.marshalValue(fValue); } }
Source:
public ISerializableEvaluation unmarshalEvaluation() throws CoreException { int oldPos = fPos; short firstBytes = getShort(); START if (firstBytes == NULL_TYPE) { END return null; } fPos = oldPos; // fLinkage.unmarshalEvaluation() will read firstBytes again return fLinkage.unmarshalEvaluation(this); } It's probably makes sense to move this condition to PDOMLinkage.unmarshalEvaluation.

Target:
public ISerializableEvaluation unmarshalEvaluation() throws CoreException { return fLinkage.unmarshalEvaluation(this); }
Source:
public AbstractDifferenceFilter() { super(); START setPredicateWhenSelected(); END setPredicateWhenUnselected(); } should not call the setPredicateWhenSelected in constructor. I would prefer you override getPredicateWhen{Selected/Unselected} in concrete class.

Target:
public AbstractDifferenceFilter() { super(); }
Source:
public String toString() { StringBuilder sb = new StringBuilder(getName()); sb.append('='); START sb.append(formatNumber(getValue(), base)); END return sb.toString(); } Here return getName + '=' + formatNumber(getValue(), base); // trailing space it would be nicer.

Target:
public String toString() { return getName() + '=' + formatNumber(getValue(), base); }
Source:
private StringBuilder format() { START StringBuilder sb = new StringBuilder(String.valueOf(tip)); END if (distance > 0) sb.append('~').append(distance); return sb; } OK so StringBuilder(null) NPEs. Why are we calling format on something with a null tip? Why are we formatting that string as "null~5" when we know its not a valid reference name?

Target:
private StringBuilder format() { StringBuilder sb = new StringBuilder(tip); if (distance > 0) sb.append('~').append(distance); return sb; }
Source:
public IReviewRemoteFactoryProvider createFactoryProvider(TaskRepository repository) { GerritClient client = getClient(repository); START return new GerritRemoteFactoryProvider(client); END } Very minor, but these two lines could be combined together

Target:
public IReviewRemoteFactoryProvider createFactoryProvider(TaskRepository repository) { return new GerritRemoteFactoryProvider(getClient(repository)); }
Source:
public Object execute(ExecutionEvent event) throws ExecutionException { RebaseCurrentRefCommand rebaseCurrent = new RebaseCurrentRefCommand(); rebaseCurrent.setEnabled(event.getApplicationContext()); // Because the enabled state is for both starting a new rebase as well // as working with an existing rebase, it can be that this is executed // even though starting a new rebase is not possible. So check enabled // state again here. See also isEnabled. START if (rebaseCurrent.isEnabled()) { END return rebaseCurrent.execute(event); } else { return null; } } style nit: no braces here

Target:
public Object execute(ExecutionEvent event) throws ExecutionException { RebaseCurrentRefCommand rebaseCurrent = new RebaseCurrentRefCommand(); rebaseCurrent.setEnabled(event.getApplicationContext()); // Because the enabled state is for both starting a new rebase as well // as working with an existing rebase, it can be that this is executed // even though starting a new rebase is not possible. So check enabled // state again here. See also isEnabled. if (rebaseCurrent.isEnabled()) return rebaseCurrent.execute(event); else return null; }
Source:
private void updateActions() { initialize(); IStructuredSelection selection = getStructuredSelection(); copyDetailsAction.selectionChanged(selection); copyCommenterNameAction.selectionChanged(selection); copyCommentDetailsURL.selectionChanged(selection); Object firstElement = selection.getFirstElement(); START if (firstElement != null && firstElement instanceof ITaskComment) { END copyCommentDetailsURL.setEnabled(((ITaskComment) firstElement).getUrl() != null); } } You can just test firstElement instanceof ITaskComment since null is not an instanceof anything.

Target:
private void updateActions() { initialize(); IStructuredSelection selection = getStructuredSelection(); copyDetailsAction.selectionChanged(selection); copyCommenterNameAction.selectionChanged(selection); copyCommentDetailsURL.selectionChanged(selection); Object firstElement = selection.getFirstElement(); if (firstElement instanceof ITaskComment) { copyCommentDetailsURL.setEnabled(((ITaskComment) firstElement).getUrl() != null); } }
Source:
START public void clearCandidates() { END fTraceTypes.clear(); fTraceFiles.clear(); } add missing java-doc

Target:
public synchronized void clearCandidates() { fTraceTypes.clear(); fTraceFiles.clear(); }
Source:
protected void updateButtons() { BatchImportTraceWizard wiz = getBatchWizard(); START ImportUtils.buildFilesToScan(wiz); END updateTable(); wiz.getContainer().updateButtons(); } If selecting a directory with a lot of sub-directories the method buildFilesToScan() takes very long (due to ImportUtil.recurseFiles()) and blocks the GUI. It would be good to run this in a Job and show a progress bar with the possibility to cancel.

Target:
private void updateButtons() { BatchImportTraceWizard wiz = getBatchWizard(); updateTable(); wiz.getContainer().updateButtons(); }
Source:
public void testToString() { assertEquals("toString", "filename1:10 func1()", fCallsite1.toString()); assertEquals("toString", "filename2:25 func2()", fCallsite2.toString()); assertEquals("toString", "filename3:123", fCallsite3.toString()); START ITmfCallsite callsite = new TmfCallsite(null, fFunctionName1, fLine1); END assertEquals("toString", ":10 func1()", callsite.toString()); } filename should not be null according to interface (or do we want to allow it?)

Target:
public void testToString() { assertEquals("toString", "filename1:10 func1()", fCallsite1.toString()); assertEquals("toString", "filename2:25 func2()", fCallsite2.toString()); assertEquals("toString", "filename3:123", fCallsite3.toString()); }
Source:
public Object getPropertyValue(Object id) { START if (id.equals(ID_FILE_NAME) && fSourceLookup.getCallsite().getFileName() != null) { END return fSourceLookup.getCallsite().getFileName(); } else if (id.equals(ID_FUNCTION_NAME)) { return fSourceLookup.getCallsite().getFunctionName(); } else if (id.equals(ID_LINE_NUMBER)) { return Long.valueOf(fSourceLookup.getCallsite().getLineNumber()); } return null; } useless null check (not supposed to be null, and anyways it would be ok to return null)

Target:
public Object getPropertyValue(Object id) { if (id.equals(ID_FILE_NAME)) { return fSourceLookup.getCallsite().getFileName(); } else if (id.equals(ID_FUNCTION_NAME)) { return fSourceLookup.getCallsite().getFunctionName(); } else if (id.equals(ID_LINE_NUMBER)) { return Long.valueOf(fSourceLookup.getCallsite().getLineNumber()); } return null; }
Source:
public void testCallsiteCopy2() { try { new TmfCallsite(null); fail("null copy"); START } catch (final IllegalArgumentException e) { END // Success } } In the wonderful world of JUnit4 ;) you can use @Test(expected=IllegalArgumentException.class) public void testCallsiteCopy2() { new TmfCallsite(null); }

Target:
public void testCallsiteCopy2() { new TmfCallsite(null); }
Source:
private void checkElementAndSubtree(Object element) { START Object e = element; END checkElement(e); for (Object child : fContentProvider.getChildren(e)) { checkElementAndSubtree(child); } } I don't think you have to "cast" the parameter in this case since you do not assign it.

Target:
private void checkElementAndSubtree(Object element) { checkElement(element); for (Object child : fContentProvider.getChildren(element)) { checkElementAndSubtree(child); } }
Source:
private void checkLoadable(DeltaWindowEntry ent, long need) { if (maxMemory == 0) return; DeltaWindowEntry n = res.next; START while (maxMemory < loaded + need) { END clear(n); if (n == ent) throw new LargeObjectException.ExceedsLimit( maxMemory, loaded + need); n = n.next; } } nit: this could be a for loop like you did above (or vice versa)

Target:
private void checkLoadable(DeltaWindowEntry ent, long need) { if (maxMemory == 0) return; DeltaWindowEntry n = res.next; for (; maxMemory < loaded + need; n = n.next) { clear(n); if (n == ent) throw new LargeObjectException.ExceedsLimit( maxMemory, loaded + need); } }
Source:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { // Any delta should be no more than 50% of the original size // (for text files deflate of whole form should shrink 50%). int n = res.size() >>> 1; // Evenly distribute delta size limits over allowed depth. // If src is non-delta (depth = 0), delta <= 50% of original. // If src is almost at limit (9/10), delta <= 10% of original. return n - (n * src.depth() / maxDepth); } // With a delta base chosen any new delta must be "better". // Retain the distribution described above. int d = bestBase.depth(); int n = (int) bestDelta.length(); // If src is whole (depth=0) and base is near limit (depth=9/10) // any delta using src can be 10x larger and still be better. // // If src is near limit (depth=9/10) and base is whole (depth=0) // a new delta dependent on src must be 1/10th the size. START return n * (maxDepth - src.depth()) / (maxDepth - d); END } FYI, i have confirmed this equation is correct.

Target:
private int deltaSizeLimit(DeltaWindowEntry src) { if (bestBase == null) { // Any delta should be no more than 50% of the original size // (for text files deflate of whole form should shrink 50%). int n = res.size() >>> 1; // Evenly distribute delta size limits over allowed depth. // If src is non-delta (depth = 0), delta <= 50% of original. // If src is almost at limit (9/10), delta <= 10% of original. return n * (maxDepth - src.depth()) / maxDepth; } // With a delta base chosen any new delta must be "better". // Retain the distribution described above. int d = bestBase.depth(); int n = (int) bestDelta.length(); // If src is whole (depth=0) and base is near limit (depth=9/10) // any delta using src can be 10x larger and still be better. // // If src is near limit (depth=9/10) and base is whole (depth=0) // a new delta dependent on src must be 1/10th the size. return n * (maxDepth - src.depth()) / (maxDepth - d); }
Source:
private IdJoinQuery populateBranchIdsJoinIdTable() throws OseeDataStoreException, OseeCoreException { IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(); // loop through all non-archieved non-deleted non-purged BranchFilter branchFilter = new BranchFilter(BranchArchivedState.UNARCHIVED); START branchFilter.setNegatedBranchStates(BranchState.PURGED); END branchFilter.setNegatedBranchStates(BranchState.DELETED); for (Branch branch : BranchManager.getBranches(branchFilter)) { branchJoin.add(branch.getId()); } branchJoin.store(); return branchJoin; } Change to a single call with both arguments.

Target:
private IdJoinQuery populateBranchIdsJoinIdTable() throws OseeDataStoreException, OseeCoreException { IdJoinQuery branchJoin = JoinUtility.createIdJoinQuery(); // loop through all non-archieved non-deleted non-purged BranchFilter branchFilter = new BranchFilter(BranchArchivedState.UNARCHIVED); branchFilter.setNegatedBranchStates(BranchState.PURGED, BranchState.DELETED); for (Branch branch : BranchManager.getBranches(branchFilter)) { branchJoin.add(branch.getId()); } branchJoin.store(); return branchJoin; }
Source:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); // Clearing visibility bits of other members START visibility &= VISIBILITY_MASK << visibilityBitOffset * VISIBILITY_BITS; END visibility >>>= visibilityBitOffset * VISIBILITY_BITS; return visibility; } Simpler to apply the mask after the shift.

Target:
private int getVisibility(int memberIndex) throws CoreException { int visibilityBitOffset = memberIndex % VISIBILITY_VALUES_PER_BYTE; long visibilityOffset = record + MEMBER_VISIBILITIES + memberIndex / VISIBILITY_VALUES_PER_BYTE; int visibility = getDB().getByte(visibilityOffset); visibility >>>= visibilityBitOffset * VISIBILITY_BITS; // Filtering the visibility bits of the target member visibility &= VISIBILITY_MASK; return visibility; }
Source:
private long getMemberRecord(int memberIndex) throws CoreException { START if (memberIndex >= MAX_MEMBER_COUNT) { END return 0; } return getDB().getRecPtr(getMemberOffset(memberIndex)); } It's preferable to sacrifice code reuse for readability and always check memberIndex < MAX_MEMBER_COUNT before calling getMemberRecord.

Target:
private long getMemberRecord(int memberIndex) throws CoreException { return getDB().getRecPtr(getMemberOffset(memberIndex)); }
Source:
public PDOMCPPMemberBlock(PDOMLinkage linkage, long record) throws CoreException { this.linkage = linkage; this.record = record; START updateNextPosition(); END } nextMemberPosition is needed only for addMember. Initialize it lazily only when needed.

Target:
public PDOMCPPMemberBlock(PDOMLinkage linkage, long record) throws CoreException { this.linkage = linkage; this.record = record; }
Source:
public PDOMCPPMemberBlock(PDOMLinkage linkage) throws CoreException { Database db = linkage.getDB(); this.linkage = linkage; this.record = db.malloc(RECORD_SIZE); db.clearBytes(record, RECORD_SIZE); START updateNextPosition(); END } Redundant call.

Target:
public PDOMCPPMemberBlock(PDOMLinkage linkage) throws CoreException { Database db = linkage.getDB(); this.linkage = linkage; this.record = db.malloc(RECORD_SIZE); db.clearBytes(record, RECORD_SIZE); }
Source:
START public ITmfTimestamp getCurrentTime() { END return getCurrentTraceContext().getTimestamp(); } Add synchronized to this method

Target:
public synchronized ITmfTimestamp getCurrentTime() { return getCurrentTraceContext().getTimestamp(); }
Source:
START public ITmfTrace getActiveTrace() { END return fCurrentTrace; } Add synchronized to this method

Target:
public synchronized ITmfTrace getActiveTrace() { return fCurrentTrace; }
Source:
START public ITmfTrace[] getActiveTraceSet() { END final ITmfTrace trace = fCurrentTrace; if (trace instanceof TmfExperiment) { final TmfExperiment exp = (TmfExperiment) trace; return exp.getTraces(); } return new ITmfTrace[] { trace }; } Add synchronized to this method

Target:
public synchronized ITmfTrace[] getActiveTraceSet() { final ITmfTrace trace = fCurrentTrace; if (trace instanceof TmfExperiment) { final TmfExperiment exp = (TmfExperiment) trace; return exp.getTraces(); } return new ITmfTrace[] { trace }; }
Source:
protected String[] getExecutionOrder(String group) { if (GROUP_TOP_LEVEL.equals(group)) { return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$ "stepSetEnvironmentVariables", //$NON-NLS-1$ "stepSetExecutable", //$NON-NLS-1$ "stepSetArguments", //$NON-NLS-1$ // For remote non-attach only "stepRemoteConnection", //$NON-NLS-1$ // For post-mortem launch only "stepSpecifyCoreFile", //$NON-NLS-1$ "stepStartTrackingBreakpoints", //$NON-NLS-1$ START "stepInitializeMemory", //$NON-NLS-1$ END "stepStartExecution", //$NON-NLS-1$ "stepCleanupBaseSequence", //$NON-NLS-1$ }; } return null; } For all the attach cases you do the InitializeMemoryFirst and trackBreakpoints after. Here you do the reverse. Not a big deal, but I wondered if there is a reason?

Target:
protected String[] getExecutionOrder(String group) { if (GROUP_TOP_LEVEL.equals(group)) { return new String[] { "stepInitializeBaseSequence", //$NON-NLS-1$ "stepSetEnvironmentVariables", //$NON-NLS-1$ "stepSetExecutable", //$NON-NLS-1$ "stepSetArguments", //$NON-NLS-1$ // For remote non-attach only "stepRemoteConnection", //$NON-NLS-1$ // For post-mortem launch only "stepSpecifyCoreFile", //$NON-NLS-1$ "stepInitializeMemory", //$NON-NLS-1$ "stepStartTrackingBreakpoints", //$NON-NLS-1$ "stepStartExecution", //$NON-NLS-1$ "stepCleanupBaseSequence", //$NON-NLS-1$ }; } return null; }
Source:
public BigInteger getMinValue() { START if (!signed) END return BigInteger.ZERO; BigInteger capacity = BigInteger.ONE.shiftLeft(length); return capacity.divide(BigInteger.valueOf(2)).negate(); } H-How did this happen?? The project setting's Save Actions are supposed to add brackets to all 'if' clauses automatically...

Target:
public BigInteger getMinValue() { if (!signed) { return BigInteger.ZERO; } BigInteger capacity = BigInteger.ONE.shiftLeft(length); return capacity.divide(BigInteger.valueOf(2)).negate(); }
Source:
public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { START toReturn = tempUser; END } } } return toReturn; } break out if you find the user?

Target:
public User getUserByArtId(int userArtifactId) throws OseeCoreException { User toReturn = null; if (userArtifactId <= 0) { toReturn = getUser(SystemUser.OseeSystem); } else { for (User tempUser : getUsersAll()) { if (userArtifactId == tempUser.getArtId()) { toReturn = tempUser; break; } } } return toReturn; }
Source:
public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { if (editor instanceof CEditor) { TextSelection textSelection = selection; try { if (selection != null) { START return SelectionConverter.getElementAtOffset(getInputCElement((CEditor) editor), textSelection); END } else { ICElement element = getInputCElement((CEditor) editor); return element; } } catch (CModelException e) { // ignore } } return null; } we should check if celement is null here

Target:
public Object getObjectForTextSelection(TextSelection selection, IEditorPart editor) { if (editor instanceof CEditor) { TextSelection textSelection = selection; try { ICElement element = getInputCElement((CEditor) editor); if (element != null) { if (selection != null) { return SelectionConverter.getElementAtOffset(element, textSelection); } else { return element; } } } catch (CModelException e) { // ignore } } return null; }
Source:
public ObjectReader newReader() { ObjectReader r = db.newReader(); START r.setAvoidUnreachableObjects(avoidUnreachable); END return r; } IIRC this is not carried into the new clone reader by any other implementation.

Target:
public ObjectReader newReader() { return db.newReader(); }
Source:
private ObjectId endObject(ObjectId id, long offset) throws IOException { PackedObjectInfo obj = new PackedObjectInfo(id); obj.setOffset(offset); obj.setCRC((int) packOut.crc32.getValue()); objectList.add(obj); objectMap.addIfAbsent(obj); START packOut.flushStream(); END return id; } Unlike flushBlock(), this doesn't put the newly written data in the DfsBlockCache. That seems good because otherwise we'd be asking a lot of the block cache by putting partial blocks there. Am I right in assuming that DfsOutputStream#read is meant to be fast already so this shouldn't hurt anything?

Target:
private ObjectId endObject(ObjectId id, long offset) { PackedObjectInfo obj = new PackedObjectInfo(id); obj.setOffset(offset); obj.setCRC((int) packOut.crc32.getValue()); objectList.add(obj); objectMap.addIfAbsent(obj); return id; }
Source:
public RenameDetector(Repository repo) { START objectReader = repo.newObjectReader(); END renameLimit = repo.getConfig().get(DiffConfig.KEY).getRenameLimit(); reset(); } Use this form instead: this(repo.newObjectReader(), repo.getConfig().get(DiffConfig.KEY));

Target:
public RenameDetector(Repository repo) { this(repo.newObjectReader(), repo.getConfig().get(DiffConfig.KEY)); }
Source:
public void partDeactivated(IWorkbenchPart part) { START fTraceSelected = false; END } It should check that the part being deactivated is 'this'.

Target:
public void partDeactivated(IWorkbenchPart part) { }
Source:
public Object getAdapter(Class adapter) { START if (adapter == IResource.class || adapter == IContainer.class) { END return getContainer(); } else if (adapter == IPath.class) { return path; } return null; } style nit: we don't use braces around single line blocks, more of these below

Target:
public Object getAdapter(Class adapter) { if (adapter == IResource.class || adapter == IContainer.class) return getContainer(); else if (adapter == IPath.class) return path; return null; }
Source:
private Object[] getCompressedRoots() { if (compressedRoots == null) { List<Object> compressedRootList = new ArrayList<Object>(); compressedFolders = getCompressedFolders(); START for (StagingFolderEntry compressedFolder : compressedFolders) { END compressedRootList.add(compressedFolder); } for (StagingEntry rootFile : rootFiles) { compressedRootList.add(rootFile); } compressedRoots = new Object[compressedRootList.size()]; compressedRootList.toArray(compressedRoots); } return compressedRoots; } style nit: no braces here

Target:
private Object[] getCompressedRoots() { if (compressedRoots == null) { List<Object> compressedRootList = new ArrayList<Object>(); compressedFolders = getCompressedFolders(); for (StagingFolderEntry compressedFolder : compressedFolders) compressedRootList.add(compressedFolder); for (StagingEntry rootFile : rootFiles) compressedRootList.add(rootFile); compressedRoots = new Object[compressedRootList.size()]; compressedRootList.toArray(compressedRoots); } return compressedRoots; }
Source:
public void TSDLSimpleTest() throws CTFReaderException { createDummyTrace(simpleTSDL); CTFTrace trace = new CTFTrace(tempTraceDir); assertNotNull(trace); START trace.dispose(); END } Good thing to call that. However it should go in a separate @After method

Target:
public void TSDLSimpleTest() throws CTFReaderException { createDummyTrace(simpleTSDL); trace = new CTFTrace(tempTraceDir); assertNotNull(trace); }
Source:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); START TmfSignalManager.dispatchSignal(new TmfTimestampFormatUpdateSignal(null)); END } If this method is executed in non-UI thread the receiving components will have thread access problems. (org.eclipse.swt.SWTException: Invalid thread access). In an internal plug-in we see this problem when getting the timezone during a request handling.

Target:
public static void updateDefaultFormats() { fDefaultTimeFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getTimePattern(), TmfTimePreferences.getInstance().getTimeZone()); fDefaultIntervalFormat = new TmfTimestampFormat(TmfTimePreferences.getInstance().getIntervalPattern()); }
Source:
public static TeamWorkFlowArtifact getCodeTeamWorkflowNamed(String name) throws OseeCoreException { for (Artifact art : ArtifactQuery.getArtifactListFromName(name, AtsUtil.getAtsBranchToken(), DeletionFlag.EXCLUDE_DELETED, QueryOptions.EXACT_MATCH_OPTIONS)) { if (art.isOfType(DemoArtifactTypes.DemoCodeTeamWorkflow)) { return (TeamWorkFlowArtifact) art; } } START return null; END } Prefer one return statement.

Target:
public static TeamWorkFlowArtifact getCodeTeamWorkflowNamed(String name) throws OseeCoreException { TeamWorkFlowArtifact result = null; for (Artifact art : ArtifactQuery.getArtifactListFromName(name, AtsUtil.getAtsBranchToken(), DeletionFlag.EXCLUDE_DELETED, QueryOptions.EXACT_MATCH_OPTIONS)) { if (art.isOfType(DemoArtifactTypes.DemoCodeTeamWorkflow)) { result = (TeamWorkFlowArtifact) art; break; } } return result; }
Source:
private Map<String, String> getTraceProperties() START { END for (ITmfTrace fTrace : TmfTraceManager.getInstance().getOpenedTraces()) { if (fTrace.getResource().equals(this.getResource())) { if (fTrace instanceof ITmfTraceProperties) { ITmfTraceProperties traceProperties = (ITmfTraceProperties) fTrace; return traceProperties.getTraceProperties(); } } } return null; } { on the same line

Target:
private Map<String, String> getTraceProperties() { for (ITmfTrace fTrace : TmfTraceManager.getInstance().getOpenedTraces()) { if (fTrace.getResource().equals(this.getResource())) { if (fTrace instanceof ITmfTraceProperties) { ITmfTraceProperties traceProperties = (ITmfTraceProperties) fTrace; return traceProperties.getTraceProperties(); } } } return new HashMap<String, String>(); }
Source:
START public void setSDWidget(SDWidget sdWidget) { END fSdWidget = sdWidget; } fsdWidget was protected.

Target:
protected void setSDWidget(SDWidget sdWidget) { fSdWidget = sdWidget; }
Source:
START public boolean isNeedInit() { END return fNeedInit; } fNeedInit was protected

Target:
private boolean isNeedInit() { return fNeedInit; }
Source:
START public boolean isComputeMinMax() { END return fComputeMinMax; } Those variables were protected

Target:
protected boolean isComputeMinMax() { return fComputeMinMax; }
Source:
START public void setStartOccurrence(int occurence) { END fStartEventOccurrence = occurence; } Those variables were protected

Target:
protected void setStartOccurrence(int occurence) { fStartEventOccurrence = occurence; }
Source:
public Map<String, IFont> getFontPref() { START return Collections.unmodifiableMap(fFontPref); END } fFontPref was protected

Target:
protected Map<String, IFont> getFontPref() { return Collections.unmodifiableMap(fFontPref); }
Source:
public IUser getAddedBy() { if (addedBy != null && addedBy.eIsProxy()) { InternalEObject oldAddedBy = (InternalEObject) addedBy; addedBy = (IUser) eResolveProxy(oldAddedBy); if (addedBy != oldAddedBy) { START if (eNotificationRequired()) { END eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReviewsPackage.REVIEW_ITEM__ADDED_BY, oldAddedBy, addedBy)); } } } return addedBy; } Same issue here. With auto-generated code, we don't want to change what is already here. I personally hate the lack of braces in this case, but we need to stick with whatever is produced by the combination of a) generating the code, and b) running source format on it.

Target:
public IUser getAddedBy() { if (addedBy != null && addedBy.eIsProxy()) { InternalEObject oldAddedBy = (InternalEObject) addedBy; addedBy = (IUser) eResolveProxy(oldAddedBy); if (addedBy != oldAddedBy) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReviewsPackage.REVIEW_ITEM__ADDED_BY, oldAddedBy, addedBy)); } } return addedBy; }
Source:
public boolean hasAllEvents(String[] names) { START for (int i = 0; i < names.length; i++) { END if (!hasEvent(names[i])) { return false; } } return true; } You can use for-each for arrays too, for (String name : names) { !hasEvent(name)

Target:
public boolean hasAllEvents(String[] names) { for (String name : names) { if (!hasEvent(name)) { return false; } } return true; }
Source:
public void testGetVersion() throws Exception { START assertTrue(atsVersionCache.getVersion(teamWf).getName().equals("Test Version")); END } use assertEquals instead - it gives better output when things don't match. assertEquals("Test Version", atsVersionCache.getVersion(teamWf).getName());

Target:
public void testGetVersion() throws Exception { assertEquals("Test Version", atsVersionCache.getVersion(teamWf).getName()); }
Source:
public Object[] getElements(Object inputElement) { Object[] elements = contentProvider.getElements(inputElement); // add filler elements to ensure alignment with time analysis viewer START Object[] oElements = Arrays.copyOf(elements, elements.length + fNumFillerRows); END for (int i = 0; i < fNumFillerRows; i++) { oElements[elements.length + i] = FILLER; } return oElements; } This change cause a java.lang.ArrayStoreException()

Target:
public Object[] getElements(Object inputElement) { Object[] elements = contentProvider.getElements(inputElement); // add filler elements to ensure alignment with time analysis viewer Object[] oElements = Arrays.copyOf(elements, elements.length + fNumFillerRows, new Object[0].getClass()); for (int i = 0; i < fNumFillerRows; i++) { oElements[elements.length + i] = FILLER; } return oElements; }
Source:
public void start(BundleContext context) throws Exception { START ArchiveCommand.registerFormat("tar", new TarFormat()); END ArchiveCommand.registerFormat("tgz", new TgzFormat()); ArchiveCommand.registerFormat("txz", new TxzFormat()); ArchiveCommand.registerFormat("zip", new ZipFormat()); } Maybe pull this into a static method that pgm.Archive can invoke without having a BundleContext. Then we don't need to maintain this list in two places.

Target:
public void start(BundleContext context) throws Exception { start(); }
Source:
public void stop(BundleContext context) throws Exception { ArchiveCommand.unregisterFormat("zip"); START ArchiveCommand.unregisterFormat("txz"); END ArchiveCommand.unregisterFormat("tgz"); ArchiveCommand.unregisterFormat("tar"); } Maybe use a small helper method to setup the registrations: private static final List<String> myFormats = Collections.synchronizedList(new ArrayList<String>()); private static final void register(String name, Format<?> fmt) { myFormats.add(name); ArchiveCommand.registerFormat(name, fmt); } public void stop(BundleContext context) throws Exception { for (String name : myFormats) { ArchiveCommand.unregisterFormat(name); } myFormats.clear(); }

Target:
public void stop(BundleContext context) throws Exception { stop(); }
Source:
public void hideAll() { Collection<Phantom> phantoms = fPhantomRegistry.values(); Iterable<Phantom> visiblePhantoms = Iterables.filter(phantoms, new Predicate<Phantom>() { public boolean apply(Phantom phantom) { return phantom.getFigure().getParent() != null; } }); START for (Phantom phantom : visiblePhantoms) { END handleDecorator(phantom, false, true); } } this is the typical case where using Predicate is not wise. Your code would be more readable by filtering in the foreach loop: for (Phantom phantom : fPhantomRegistry.values()) { if (phantom.getFigures.getParent() != null) { handleDecorator(phantom, false, true); } }

Target:
public void hideAll() { for (Phantom phantom : fPhantomRegistry.values()) { if (phantom.getFigure().getParent() != null) { handleDecorator(phantom, false, true); } } }
Source:
private void joinAll() throws InterruptedException { START if (!threads.isEmpty()) { END for (Thread thread : threads) { thread.join(); } } } Is threads.isEmpty() necessary ? I think the foreach loop can handle the same case.

Target:
private void joinAll() throws InterruptedException { for (Thread thread : threads) { thread.join(); } }
Source:
public void run() { final Display display = Display.getDefault(); if ((display == null) || display.isDisposed()) { return; } Display.getDefault().asyncExec(new Runnable() { @Override public void run() { START if (!display.isDisposed()) { END scrollView.scrollBy(deltaX, deltaY); } } }); } When you close the view the ScrollView control could be disposed but not the display. Better to check if scrollView.isDisposed.

Target:
public void run() { final Display display = Display.getDefault(); if ((display == null) || display.isDisposed()) { return; } display.asyncExec(new Runnable() { @Override public void run() { if (!scrollView.isDisposed()) { scrollView.scrollBy(deltaX, deltaY); } } }); }
Source:
public SelectGraphWizard(IDataSet data, GraphData gdata) { model = new GraphModel(data); START if (edit = (gdata != null) ) { END model.setGraph(gdata.graphID); model.setKey(gdata.key); model.setTitle(gdata.title); model.setXSeries(gdata.xSeries); model.setYSeries(gdata.ySeries); } } Please write this as two lines edit = (gdata != null); if (edit) It is more readable that way

Target:
public SelectGraphWizard(IDataSet data, GraphData gdata) { model = new GraphModel(data); edit = (gdata != null); if (edit) { model.setGraph(gdata.graphID); model.setKey(gdata.key); model.setTitle(gdata.title); model.setXSeries(gdata.xSeries); model.setYSeries(gdata.ySeries); } }
Source:
private void setControlEnabled(Composite composite, boolean enabled){ composite.setEnabled(enabled); for (Control child : composite.getChildren()) { if (child == removeGraphButton || child == copyGraphButton) { child.setEnabled(false); START } END if(child instanceof Composite){ setControlEnabled((Composite)child, enabled); } } } While this code makes sense. It does not agree with the idea of the function. In addition this gets called once for every child in the tree. Perhaps after setting the enablement for the whole composite you can add a call to removeGraphButton.setEnabled(false); and copyGraphButton.setEnabled(false);

Target:
private void setControlEnabled(Composite composite, boolean enabled){ composite.setEnabled(enabled); for (Control child : composite.getChildren()) { child.setEnabled(enabled); if(child instanceof Composite){ setControlEnabled((Composite)child, enabled); } } }
Source:
START private void saveDataToModelGraph(String selected) { END model.setGraph(selected); setKeyEnablement( GraphFactory.isKeyRequired(model.getGraphID(), model.getDataSet()), GraphFactory.isKeyOptional(model.getGraphID(), model.getDataSet())); } Yeah... The systemtap code is not in great shape but we try to improve the bits we touch little by little.

Target:
private void saveDataToModelGraph(String selected) { model.setGraph(selected); }
Source:
private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); START operationHistory.execute(this, new NullProgressMonitor(), null/*context*/); END } Should the context be passed in?

Target:
private void execute() throws ExecutionException { IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory(); operationHistory.execute(this, new NullProgressMonitor(), info); }
Source:
public static ReviewStatus getReviewStatus(com.google.gerrit.reviewdb.Change.Status gerritStatus) { START switch (gerritStatus) { END case NEW: return ReviewStatus.NEW; case MERGED: return ReviewStatus.MERGED; case SUBMITTED: return ReviewStatus.SUBMITTED; case ABANDONED: return ReviewStatus.ABANDONED; default: if (gerritStatus != null) { GerritCorePlugin.logError("Internal Error: unexpected change status: " + gerritStatus, new Exception()); } // DRAFT is not correctly parsed for ChangeInfo since Change.Status does not define the corresponding enum field return ReviewStatus.DRAFT; } } I get this exception because it's doing a switch on a null: java.lang.NullPointerException at org.eclipse.mylyn.internal.gerrit.core.remote.GerritReviewRemoteFactory.getReviewStatus(GerritReviewRemoteFactory.java:338) at org.eclipse.mylyn.internal.gerrit.core.client.data.GerritQueryResult.<init>(GerritQueryResult.java:51) at org.eclipse.mylyn.internal.gerrit.core.GerritTaskDataHandler.updateTaskData(GerritTaskDataHandler.java:225) at org.eclipse.mylyn.internal.gerrit.core.GerritTaskDataHandler.getTaskData(GerritTaskDataHandler.java:114) at org.eclipse.mylyn.internal.gerrit.core.GerritConnector.getTaskData(GerritConnector.java:160) at org.eclipse.mylyn.internal.tasks.core.sync.SynchronizeTasksJob.synchronizeTask(SynchronizeTasksJob.java:245)

Target:
public static ReviewStatus getReviewStatus(com.google.gerrit.reviewdb.Change.Status gerritStatus) { if (gerritStatus == null) { // DRAFT is not correctly parsed for ChangeInfo since Change.Status does not define the corresponding enum field return ReviewStatus.DRAFT; } switch (gerritStatus) { case NEW: return ReviewStatus.NEW; case MERGED: return ReviewStatus.MERGED; case SUBMITTED: return ReviewStatus.SUBMITTED; case ABANDONED: return ReviewStatus.ABANDONED; default: GerritCorePlugin.logError("Internal Error: unexpected change status: " + gerritStatus, new Exception()); return null; } }
Source:
public Iterable<E> getSubgraphContaining(E element) { START final Node<E> node = nodes.get(element); END if (node != null) { return new SubgraphBuilder<E>(node).build(); } return Collections.emptyList(); } this is not thread safe, nodes can be modified while building the subgraph. I suggest to use Lock for reading and writing accordingly instead of synchronized blocks

Target:
public Iterable<E> getSubgraphContaining(E element) { synchronized(nodes) { final Node<E> node = nodes.get(element); if (node != null) { return new SubgraphBuilder<E>(node).build(); } return Collections.emptyList(); } }
Source:
public void init(final IEditorSite site, final IEditorInput input) { AbstractReviewTaskEditorPage.super.init(site, input); IReviewRemoteFactoryProvider factoryProvider = getFactoryProvider(); START if (factoryProvider != null) { END checkIfModelIsCached(); reviewConsumer = factoryProvider.getReviewFactory().getConsumerForLocalKey(factoryProvider.getRoot(), getTask().getTaskId()); reviewConsumer.addObserver(reviewObserver); reviewConsumer.open(); } } What happens if it's null? Should we log an error or something?

Target:
public void init(final IEditorSite site, final IEditorInput input) { AbstractReviewTaskEditorPage.super.init(site, input); checkIfModelIsCached(); reviewConsumer = getFactoryProvider().getReviewFactory().getConsumerForLocalKey(getFactoryProvider().getRoot(), getTask().getTaskId()); reviewConsumer.addObserver(reviewObserver); reviewConsumer.open(); }
Source:
public void setClosed(boolean closed) { if (closed && !isClosed()) { // end list item builder.endBlock(); START builder.characters("\n"); //$NON-NLS-1$ END // end list block builder.endBlock(); } super.setClosed(closed); } should not add newline here either

Target:
public void setClosed(boolean closed) { if (closed && !isClosed()) { // end list item builder.endBlock(); // end list block builder.endBlock(); } super.setClosed(closed); }
Source:
public String getHostId() { CTFClock clock = getCTFTrace().getClock(); if (clock != null) { return (String) clock.getProperty(CLOCK_HOST_PROPERTY); } START return getName(); END } here it should use super.getHostId(). It's obviously the same thing now, but if we ever change how TmfTrace defines its host ID, then clock-less CTF traces should follow.

Target:
public String getHostId() { CTFClock clock = getCTFTrace().getClock(); if (clock != null) { return (String) clock.getProperty(CLOCK_HOST_PROPERTY); } return super.getHostId(); }
Source:
public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof LttngKernelTrace)) { return false; } LttngKernelTrace ktrace = (LttngKernelTrace) trace; String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT }; START return (ktrace.hasAtLeastOneOfEvents(events)); END } outer parentheses are not needed

Target:
public boolean canMatchTrace(ITmfTrace trace) { if (!(trace instanceof LttngKernelTrace)) { return false; } LttngKernelTrace ktrace = (LttngKernelTrace) trace; String[] events = { TcpEventStrings.INET_SOCK_LOCAL_IN, TcpEventStrings.INET_SOCK_LOCAL_OUT }; return ktrace.hasAtLeastOneOfEvents(events); }
Source:
protected void initMatching() { START if (fMatches != null) { END fMatches.init(fTraces); } List<ITmfMatchEventDefinition> deflist = fMatchDefinitions.get(getMatchingType()); if (deflist == null) { return; } for (ITmfTrace trace : fTraces) { for (ITmfMatchEventDefinition def : deflist) { if (def.canMatchTrace(trace)) { fMatchMap.put(trace, def); break; } } } } Instead of having fMatches be potentially null, couldn't you just check at the constructor to make sure the parameter is not null? (and throw IllegalArgumentException if it is).

Target:
protected void initMatching() { fMatches.init(fTraces); List<ITmfMatchEventDefinition> deflist = fMatchDefinitions.get(getMatchingType()); if (deflist == null) { return; } for (ITmfTrace trace : fTraces) { for (ITmfMatchEventDefinition def : deflist) { if (def.canMatchTrace(trace)) { fMatchMap.put(trace, def); break; } } } }
Source:
START public boolean isSessionAllStop(String sessionId) { END DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), sessionId); IMIRunControl runCtrlService = servicesTracker.getService(IMIRunControl.class); servicesTracker.dispose(); if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP ) { return true; } return false; } It is a good habit to avoid public methods unless you need them to be public. Here, since the class in internal, it does not matter, but normally it would be safer to put as private to avoid being stuck with an new API. Ok to leave it as is in this case though.

Target:
private boolean isSessionAllStop(String sessionId) { DsfServicesTracker servicesTracker = new DsfServicesTracker(MulticoreVisualizerUIPlugin.getBundleContext(), sessionId); IMIRunControl runCtrlService = servicesTracker.getService(IMIRunControl.class); servicesTracker.dispose(); if (runCtrlService != null && runCtrlService.getRunMode() == MIRunMode.ALL_STOP ) { return true; } return false; }