~ubuntu-branches/debian/sid/eclipse-cdt/sid

« back to all changes in this revision

Viewing changes to core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ACSettingEntry.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2013-10-03 20:30:16 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20131003203016-d4ug6l0xgosasumq
Tags: 8.2.1-1
* New upstream release.
* Updated autotools documentation sources.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 * http://www.eclipse.org/legal/epl-v10.html
7
7
 *
8
8
 * Contributors:
9
 
 * Intel Corporation - Initial API and implementation
 
9
 *     Intel Corporation - Initial API and implementation
10
10
 *******************************************************************************/
11
11
package org.eclipse.cdt.core.settings.model;
12
12
 
17
17
        private final int fFlags;
18
18
        private final String fName;
19
19
 
20
 
        ACSettingEntry(String name, int flags){
 
20
        ACSettingEntry(String name, int flags) {
21
21
                fName = SafeStringInterner.safeIntern(name);
22
22
                fFlags = flags;
23
23
        }
32
32
                return checkFlags(READONLY);
33
33
        }
34
34
 
35
 
        protected boolean checkFlags(int flags){
 
35
        protected boolean checkFlags(int flags) {
36
36
                return (fFlags & flags) == flags;
37
37
        }
38
38
 
67
67
                if (fName == null) {
68
68
                        if (other.fName != null)
69
69
                                return false;
70
 
                } else if (!fName.equals(other.fName))
 
70
                } else if (!fName.equals(other.fName)) {
71
71
                        return false;
 
72
                }
72
73
                return true;
73
74
        }
74
75
 
77
78
                final int prime = 31;
78
79
                int result = 1;
79
80
                result = prime * result + fFlags;
80
 
                result = prime * result + ((fName == null) ? 0 : fName.hashCode());
 
81
                result = prime * result + (fName == null ? 0 : fName.hashCode());
81
82
                return result;
82
83
        }
83
84
 
91
92
                return equalsByName(entry);
92
93
        }
93
94
 
94
 
        protected int getByNameMatchFlags(){
95
 
                return (fFlags & (~ (BUILTIN | READONLY | RESOLVED)));
 
95
        protected int getByNameMatchFlags() {
 
96
                return fFlags & ~(BUILTIN | READONLY | RESOLVED);
96
97
        }
97
98
 
98
99
        @Override
99
100
        public final boolean equalsByName(ICSettingEntry entry) {
100
 
                if(entry == this)
 
101
                if (entry == this)
101
102
                        return true;
102
103
 
103
 
                if(!(entry instanceof ACSettingEntry))
 
104
                if (!(entry instanceof ACSettingEntry))
104
105
                        return false;
105
106
 
106
107
                ACSettingEntry e = (ACSettingEntry)entry;
107
108
 
108
 
                if(getKind() != e.getKind())
 
109
                if (getKind() != e.getKind())
109
110
                        return false;
110
111
 
111
 
                if(getByNameMatchFlags()
 
112
                if (getByNameMatchFlags()
112
113
                                != e.getByNameMatchFlags())
113
114
                        return false;
114
115
 
115
 
                if(!fName.equals(e.fName))
 
116
                if (!fName.equals(e.fName))
116
117
                        return false;
117
118
 
118
119
                return true;
119
120
        }
120
121
 
121
 
        public final int codeForNameKey(){
 
122
        public final int codeForNameKey() {
122
123
                return getKind() + getByNameMatchFlags() + fName.hashCode();
123
124
        }
124
125
 
125
 
        public int codeForContentsKey(){
 
126
        public int codeForContentsKey() {
126
127
                return codeForNameKey();
127
128
        }
128
129
 
129
130
        @Override
130
 
        public final String toString(){
131
 
                StringBuffer buf = new StringBuffer();
 
131
        public final String toString() {
 
132
                StringBuilder buf = new StringBuilder();
132
133
                buf.append('[').append(LanguageSettingEntriesSerializer.kindToString(getKind())).append(']').append(' ');
133
134
                buf.append(contentsToString());
134
 
                buf.append(" ; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$
 
135
                buf.append("; flags: ").append(LanguageSettingEntriesSerializer.composeFlagsString(getFlags())); //$NON-NLS-1$
135
136
                return buf.toString();
136
137
        }
137
138
 
138
139
        protected abstract String contentsToString();
139
 
 
140
140
}