From fae217d744730f7563a642260cf865b5fe6e6d4c Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Mon, 8 Jul 2013 14:21:54 -0700 Subject: [PATCH] Cosmetics. --- .../cdt/core/settings/model/ACPathEntry.java | 16 ++++----- .../core/settings/model/ACSettingEntry.java | 36 +++++++++---------- .../cdt/core/settings/model/CMacroEntry.java | 10 +++--- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java index 0fde81780b2..fdee6dd9b43 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACPathEntry.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Intel Corporation - Initial API and implementation + * Intel Corporation - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.settings.model; @@ -62,7 +62,7 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry ACPathEntry(IPath path, int flags) { super(path.toString(), flags /*| RESOLVED*/); // fPath = path; -// if(isValueWorkspacePath()) +// if (isValueWorkspacePath()) // fFullPath = path; // else // fLocation = path; @@ -70,9 +70,9 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry @Override public IPath getFullPath() { - if(isValueWorkspacePath()) + if (isValueWorkspacePath()) return new Path(getValue()); - if(isResolved()) { + if (isResolved()) { IPath path = new Path(getValue()); return fullPathForLocation(path); } @@ -84,7 +84,7 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry (IResource[])ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(location) : (IResource[])ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location); - if(rcs.length > 0) + if (rcs.length > 0) return rcs[0].getFullPath(); return null; } @@ -96,12 +96,12 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry @Override public IPath getLocation() { - if(!isValueWorkspacePath()) + if (!isValueWorkspacePath()) return new Path(getValue()); - if(isResolved()){ + if (isResolved()){ IPath path = new Path(getValue()); IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - if(rc != null) + if (rc != null) return rc.getLocation(); } return null; diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java index fd79a81211d..c3f5b2c820b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Intel Corporation - Initial API and implementation + * Intel Corporation - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.settings.model; @@ -17,7 +17,7 @@ public abstract class ACSettingEntry implements ICSettingEntry { private final int fFlags; private final String fName; - ACSettingEntry(String name, int flags){ + ACSettingEntry(String name, int flags) { fName = SafeStringInterner.safeIntern(name); fFlags = flags; } @@ -32,7 +32,7 @@ public abstract class ACSettingEntry implements ICSettingEntry { return checkFlags(READONLY); } - protected boolean checkFlags(int flags){ + protected boolean checkFlags(int flags) { return (fFlags & flags) == flags; } @@ -67,8 +67,9 @@ public abstract class ACSettingEntry implements ICSettingEntry { if (fName == null) { if (other.fName != null) return false; - } else if (!fName.equals(other.fName)) + } else if (!fName.equals(other.fName)) { return false; + } return true; } @@ -77,7 +78,7 @@ public abstract class ACSettingEntry implements ICSettingEntry { final int prime = 31; int result = 1; result = prime * result + fFlags; - result = prime * result + ((fName == null) ? 0 : fName.hashCode()); + result = prime * result + (fName == null ? 0 : fName.hashCode()); return result; } @@ -91,50 +92,49 @@ public abstract class ACSettingEntry implements ICSettingEntry { return equalsByName(entry); } - protected int getByNameMatchFlags(){ - return (fFlags & (~ (BUILTIN | READONLY | RESOLVED))); + protected int getByNameMatchFlags() { + return fFlags & ~(BUILTIN | READONLY | RESOLVED); } @Override public final boolean equalsByName(ICSettingEntry entry) { - if(entry == this) + if (entry == this) return true; - if(!(entry instanceof ACSettingEntry)) + if (!(entry instanceof ACSettingEntry)) return false; ACSettingEntry e = (ACSettingEntry)entry; - if(getKind() != e.getKind()) + if (getKind() != e.getKind()) return false; - if(getByNameMatchFlags() + if (getByNameMatchFlags() != e.getByNameMatchFlags()) return false; - if(!fName.equals(e.fName)) + if (!fName.equals(e.fName)) return false; return true; } - public final int codeForNameKey(){ + public final int codeForNameKey() { return getKind() + getByNameMatchFlags() + fName.hashCode(); } - public int codeForContentsKey(){ + public int codeForContentsKey() { return codeForNameKey(); } @Override - public final String toString(){ - StringBuffer buf = new StringBuffer(); + public final String toString() { + StringBuilder buf = new StringBuilder(); buf.append('[').append(LanguageSettingEntriesSerializer.kindToString(getKind())).append(']').append(' '); buf.append(contentsToString()); - buf.append(" ; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$ + buf.append("; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$ return buf.toString(); } protected abstract String contentsToString(); - } diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java index b17469edda3..9e89b971cf5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/CMacroEntry.java @@ -6,7 +6,7 @@ * http://www.eclipse.org/legal/epl-v10.html * * Contributors: - * Intel Corporation - Initial API and implementation + * Intel Corporation - Initial API and implementation *******************************************************************************/ package org.eclipse.cdt.core.settings.model; @@ -56,8 +56,9 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry { if (fValue == null) { if (other.fValue != null) return false; - } else if (!fValue.equals(other.fValue)) + } else if (!fValue.equals(other.fValue)) { return false; + } return true; } @@ -65,13 +66,13 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); + result = prime * result + (fValue == null ? 0 : fValue.hashCode()); return result; } @Override public boolean equalsByContents(ICSettingEntry entry) { - if(!super.equalsByContents(entry)) + if (!super.equalsByContents(entry)) return false; return fValue.equals(((CMacroEntry)entry).fValue); @@ -81,5 +82,4 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry { protected String contentsToString() { return new StringBuffer().append(getName()).append('=').append(fValue).toString(); } - }