1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2013-07-08 14:21:54 -07:00
parent 652d4f7bc0
commit fae217d744
3 changed files with 31 additions and 31 deletions

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.settings.model; package org.eclipse.cdt.core.settings.model;
@ -62,7 +62,7 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
ACPathEntry(IPath path, int flags) { ACPathEntry(IPath path, int flags) {
super(path.toString(), flags /*| RESOLVED*/); super(path.toString(), flags /*| RESOLVED*/);
// fPath = path; // fPath = path;
// if(isValueWorkspacePath()) // if (isValueWorkspacePath())
// fFullPath = path; // fFullPath = path;
// else // else
// fLocation = path; // fLocation = path;
@ -70,9 +70,9 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
@Override @Override
public IPath getFullPath() { public IPath getFullPath() {
if(isValueWorkspacePath()) if (isValueWorkspacePath())
return new Path(getValue()); return new Path(getValue());
if(isResolved()) { if (isResolved()) {
IPath path = new Path(getValue()); IPath path = new Path(getValue());
return fullPathForLocation(path); 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().findFilesForLocation(location)
: (IResource[])ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location); : (IResource[])ResourcesPlugin.getWorkspace().getRoot().findContainersForLocation(location);
if(rcs.length > 0) if (rcs.length > 0)
return rcs[0].getFullPath(); return rcs[0].getFullPath();
return null; return null;
} }
@ -96,12 +96,12 @@ public abstract class ACPathEntry extends ACSettingEntry implements ICPathEntry
@Override @Override
public IPath getLocation() { public IPath getLocation() {
if(!isValueWorkspacePath()) if (!isValueWorkspacePath())
return new Path(getValue()); return new Path(getValue());
if(isResolved()){ if (isResolved()){
IPath path = new Path(getValue()); IPath path = new Path(getValue());
IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path); IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
if(rc != null) if (rc != null)
return rc.getLocation(); return rc.getLocation();
} }
return null; return null;

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.settings.model; package org.eclipse.cdt.core.settings.model;
@ -17,7 +17,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
private final int fFlags; private final int fFlags;
private final String fName; private final String fName;
ACSettingEntry(String name, int flags){ ACSettingEntry(String name, int flags) {
fName = SafeStringInterner.safeIntern(name); fName = SafeStringInterner.safeIntern(name);
fFlags = flags; fFlags = flags;
} }
@ -32,7 +32,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
return checkFlags(READONLY); return checkFlags(READONLY);
} }
protected boolean checkFlags(int flags){ protected boolean checkFlags(int flags) {
return (fFlags & flags) == flags; return (fFlags & flags) == flags;
} }
@ -67,8 +67,9 @@ public abstract class ACSettingEntry implements ICSettingEntry {
if (fName == null) { if (fName == null) {
if (other.fName != null) if (other.fName != null)
return false; return false;
} else if (!fName.equals(other.fName)) } else if (!fName.equals(other.fName)) {
return false; return false;
}
return true; return true;
} }
@ -77,7 +78,7 @@ public abstract class ACSettingEntry implements ICSettingEntry {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + fFlags; result = prime * result + fFlags;
result = prime * result + ((fName == null) ? 0 : fName.hashCode()); result = prime * result + (fName == null ? 0 : fName.hashCode());
return result; return result;
} }
@ -91,50 +92,49 @@ public abstract class ACSettingEntry implements ICSettingEntry {
return equalsByName(entry); return equalsByName(entry);
} }
protected int getByNameMatchFlags(){ protected int getByNameMatchFlags() {
return (fFlags & (~ (BUILTIN | READONLY | RESOLVED))); return fFlags & ~(BUILTIN | READONLY | RESOLVED);
} }
@Override @Override
public final boolean equalsByName(ICSettingEntry entry) { public final boolean equalsByName(ICSettingEntry entry) {
if(entry == this) if (entry == this)
return true; return true;
if(!(entry instanceof ACSettingEntry)) if (!(entry instanceof ACSettingEntry))
return false; return false;
ACSettingEntry e = (ACSettingEntry)entry; ACSettingEntry e = (ACSettingEntry)entry;
if(getKind() != e.getKind()) if (getKind() != e.getKind())
return false; return false;
if(getByNameMatchFlags() if (getByNameMatchFlags()
!= e.getByNameMatchFlags()) != e.getByNameMatchFlags())
return false; return false;
if(!fName.equals(e.fName)) if (!fName.equals(e.fName))
return false; return false;
return true; return true;
} }
public final int codeForNameKey(){ public final int codeForNameKey() {
return getKind() + getByNameMatchFlags() + fName.hashCode(); return getKind() + getByNameMatchFlags() + fName.hashCode();
} }
public int codeForContentsKey(){ public int codeForContentsKey() {
return codeForNameKey(); return codeForNameKey();
} }
@Override @Override
public final String toString(){ public final String toString() {
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append('[').append(LanguageSettingEntriesSerializer.kindToString(getKind())).append(']').append(' '); buf.append('[').append(LanguageSettingEntriesSerializer.kindToString(getKind())).append(']').append(' ');
buf.append(contentsToString()); 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(); return buf.toString();
} }
protected abstract String contentsToString(); protected abstract String contentsToString();
} }

View file

@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/epl-v10.html * http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* Intel Corporation - Initial API and implementation * Intel Corporation - Initial API and implementation
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.core.settings.model; package org.eclipse.cdt.core.settings.model;
@ -56,8 +56,9 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
if (fValue == null) { if (fValue == null) {
if (other.fValue != null) if (other.fValue != null)
return false; return false;
} else if (!fValue.equals(other.fValue)) } else if (!fValue.equals(other.fValue)) {
return false; return false;
}
return true; return true;
} }
@ -65,13 +66,13 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + ((fValue == null) ? 0 : fValue.hashCode()); result = prime * result + (fValue == null ? 0 : fValue.hashCode());
return result; return result;
} }
@Override @Override
public boolean equalsByContents(ICSettingEntry entry) { public boolean equalsByContents(ICSettingEntry entry) {
if(!super.equalsByContents(entry)) if (!super.equalsByContents(entry))
return false; return false;
return fValue.equals(((CMacroEntry)entry).fValue); return fValue.equals(((CMacroEntry)entry).fValue);
@ -81,5 +82,4 @@ public final class CMacroEntry extends ACSettingEntry implements ICMacroEntry {
protected String contentsToString() { protected String contentsToString() {
return new StringBuffer().append(getName()).append('=').append(fValue).toString(); return new StringBuffer().append(getName()).append('=').append(fValue).toString();
} }
} }