mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-10 17:55:39 +02:00
Cosmetics.
This commit is contained in:
parent
221b77a28e
commit
96d87270a5
1 changed files with 24 additions and 23 deletions
|
@ -6,7 +6,7 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
* Andrew Niefer (IBM Corporation) - Initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.core.parser.util;
|
package org.eclipse.cdt.core.parser.util;
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* Represents the empty ObjectSet
|
* Represents the empty ObjectSet
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
public static final ObjectSet EMPTY_SET = new ObjectSet( 0 ){
|
public static final ObjectSet EMPTY_SET = new ObjectSet(0) {
|
||||||
@Override public Object clone() { return this; }
|
@Override public Object clone() { return this; }
|
||||||
@Override public List toList() { return Collections.EMPTY_LIST; }
|
@Override public List toList() { return Collections.EMPTY_LIST; }
|
||||||
@Override public void put( Object key ) { throw new UnsupportedOperationException(); }
|
@Override public void put(Object key) { throw new UnsupportedOperationException(); }
|
||||||
@Override public void addAll( List list ) { throw new UnsupportedOperationException(); }
|
@Override public void addAll(List list) { throw new UnsupportedOperationException(); }
|
||||||
@Override public void addAll( ObjectSet set ) { throw new UnsupportedOperationException(); }
|
@Override public void addAll(ObjectSet set) { throw new UnsupportedOperationException(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,8 +48,8 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* @param items
|
* @param items
|
||||||
*/
|
*/
|
||||||
public ObjectSet(T[] items) {
|
public ObjectSet(T[] items) {
|
||||||
super( items == null ? 2 : items.length );
|
super(items == null ? 2 : items.length);
|
||||||
addAll( items );
|
addAll(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* @param key the item to add (may be null)
|
* @param key the item to add (may be null)
|
||||||
*/
|
*/
|
||||||
public void checkPut(T key) {
|
public void checkPut(T key) {
|
||||||
if(key!=null)
|
if (key!=null)
|
||||||
add(key);
|
add(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* Adds the specified item to the set
|
* Adds the specified item to the set
|
||||||
* @param key the (non-null) object to store
|
* @param key the (non-null) object to store
|
||||||
*/
|
*/
|
||||||
public void put(T key){
|
public void put(T key) {
|
||||||
add(key);
|
add(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* Adds each item in the list to this ObjectSet, or no-ops if list is null
|
* Adds each item in the list to this ObjectSet, or no-ops if list is null
|
||||||
* @param list a list (may be null)
|
* @param list a list (may be null)
|
||||||
*/
|
*/
|
||||||
public void addAll(List<T> list ) {
|
public void addAll(List<T> list) {
|
||||||
if( list == null )
|
if (list == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
for( int i = 0; i < size; i++ ){
|
for (int i = 0; i < size; i++) {
|
||||||
add( list.get( i ) );
|
add(list.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +87,12 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* Adds each item in the specified ObjectSet, or no-ops if the set is null
|
* Adds each item in the specified ObjectSet, or no-ops if the set is null
|
||||||
* @param set a set (may be null)
|
* @param set a set (may be null)
|
||||||
*/
|
*/
|
||||||
public void addAll(ObjectSet<? extends T> set ){
|
public void addAll(ObjectSet<? extends T> set) {
|
||||||
if( set == null )
|
if (set == null)
|
||||||
return;
|
return;
|
||||||
int size = set.size();
|
int size = set.size();
|
||||||
for( int i = 0; i < size; i++ ){
|
for (int i = 0; i < size; i++) {
|
||||||
add( set.keyAt( i ) );
|
add(set.keyAt(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,12 +100,13 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* Adds each of the items in the specified array, or no-ops if the array is null
|
* Adds each of the items in the specified array, or no-ops if the array is null
|
||||||
* @param objs an array (may be null)
|
* @param objs an array (may be null)
|
||||||
*/
|
*/
|
||||||
public void addAll(T[] objs ){
|
public void addAll(T[] objs) {
|
||||||
if( objs == null )
|
if (objs == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (T obj : objs) {
|
for (T obj : objs) {
|
||||||
if( obj != null ) add( obj );
|
if (obj != null)
|
||||||
|
add(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,7 +115,7 @@ public class ObjectSet<T> extends ObjectTable<T> {
|
||||||
* @param key the (non-null) object to remove
|
* @param key the (non-null) object to remove
|
||||||
* @return whether an object was removed
|
* @return whether an object was removed
|
||||||
*/
|
*/
|
||||||
public boolean remove(T key ) {
|
public boolean remove(T key) {
|
||||||
int i = lookup(key);
|
int i = lookup(key);
|
||||||
if (i < 0)
|
if (i < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue