Package gw.lang.reflect
Class MethodList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- gw.util.DynamicArray<IMethodInfo>
-
- gw.lang.reflect.MethodList
-
- All Implemented Interfaces:
Iterable<IMethodInfo>
,Collection<IMethodInfo>
,List<IMethodInfo>
,RandomAccess
public class MethodList extends DynamicArray<IMethodInfo>
-
-
Field Summary
Fields Modifier and Type Field Description static MethodList
EMPTY
-
Fields inherited from class gw.util.DynamicArray
data, size
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Constructor Summary
Constructors Modifier Constructor Description MethodList()
MethodList(int size)
protected
MethodList(MethodList source)
MethodList(List<IMethodInfo> methods)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, IMethodInfo method)
Inserts the specified element at the specified position in this list.boolean
add(IMethodInfo method)
Appends the specified element to the end of this list.boolean
addAll(int index, Collection<? extends IMethodInfo> c)
Inserts all of the elements in the specified collection into this list, starting at the specified position.boolean
addAll(Collection<? extends IMethodInfo> c)
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator.void
clear()
Removes all of the elements from this list.MethodList
copy()
Returns a shallow copy of this ArrayList instance.MethodList
filterMethods(IRelativeTypeInfo.Accessibility accessibility)
IMethodInfo
findAssignableMethod(IMethodInfo miTo, boolean bStatic, TypeVarToTypeMap inferenceMap)
Collection<DynamicArray<IMethodInfo>>
getMethodBuckets()
DynamicArray<? extends IMethodInfo>
getMethods(String name)
int
indexOf(Object o)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.static IType
maybeInferParamType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromParamType, IType toParamType)
static IType
maybeInferReturnType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromReturnType, IType toReturnType)
IMethodInfo
remove(int index)
Removes the element at the specified position in this list.boolean
remove(Object o)
Removes the first occurrence of the specified element from this list, if it is present.boolean
removeAll(Collection<?> c)
protected void
removeRange(int fromIndex, int toIndex)
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.boolean
retainAll(Collection<?> c)
IMethodInfo
set(int index, IMethodInfo method)
Replaces the element at the specified position in this list with the specified element.static MethodList
singleton(IMethodInfo theOneMethod)
-
Methods inherited from class gw.util.DynamicArray
contains, ensureCapacity, get, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize
-
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
-
Methods inherited from class java.util.AbstractCollection
containsAll, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, replaceAll, sort, spliterator, subList
-
-
-
-
Field Detail
-
EMPTY
public static final MethodList EMPTY
-
-
Constructor Detail
-
MethodList
public MethodList()
-
MethodList
public MethodList(List<IMethodInfo> methods)
-
MethodList
public MethodList(int size)
-
MethodList
protected MethodList(MethodList source)
-
-
Method Detail
-
copy
public MethodList copy()
Description copied from class:DynamicArray
Returns a shallow copy of this ArrayList instance. (The elements themselves are not copied.)- Overrides:
copy
in classDynamicArray<IMethodInfo>
- Returns:
- a copy of this DynamicArray instance
-
filterMethods
public MethodList filterMethods(IRelativeTypeInfo.Accessibility accessibility)
-
add
public boolean add(IMethodInfo method)
Description copied from class:DynamicArray
Appends the specified element to the end of this list.- Specified by:
add
in interfaceCollection<IMethodInfo>
- Specified by:
add
in interfaceList<IMethodInfo>
- Overrides:
add
in classDynamicArray<IMethodInfo>
- Parameters:
method
- element to be appended to this list- Returns:
- true (as specified by
Collection.add(E)
)
-
addAll
public boolean addAll(Collection<? extends IMethodInfo> c)
Description copied from class:DynamicArray
Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's Iterator. The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this list, and this list is nonempty.)- Specified by:
addAll
in interfaceCollection<IMethodInfo>
- Specified by:
addAll
in interfaceList<IMethodInfo>
- Overrides:
addAll
in classDynamicArray<IMethodInfo>
- Parameters:
c
- collection containing elements to be added to this list- Returns:
- true if this list changed as a result of the call
-
remove
public IMethodInfo remove(int index)
Description copied from class:DynamicArray
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).- Specified by:
remove
in interfaceList<IMethodInfo>
- Overrides:
remove
in classDynamicArray<IMethodInfo>
- Parameters:
index
- the index of the element to be removed- Returns:
- the element that was removed from the list
-
set
public IMethodInfo set(int index, IMethodInfo method)
Description copied from class:DynamicArray
Replaces the element at the specified position in this list with the specified element.- Specified by:
set
in interfaceList<IMethodInfo>
- Overrides:
set
in classDynamicArray<IMethodInfo>
- Parameters:
index
- index of the element to replacemethod
- element to be stored at the specified position- Returns:
- the element previously at the specified position
-
indexOf
public int indexOf(Object o)
Description copied from class:DynamicArray
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element. More formally, returns the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))), or -1 if there is no such index.- Specified by:
indexOf
in interfaceList<IMethodInfo>
- Overrides:
indexOf
in classDynamicArray<IMethodInfo>
-
getMethods
public DynamicArray<? extends IMethodInfo> getMethods(String name)
-
singleton
public static MethodList singleton(IMethodInfo theOneMethod)
-
add
public void add(int index, IMethodInfo method)
Description copied from class:DynamicArray
Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).- Specified by:
add
in interfaceList<IMethodInfo>
- Overrides:
add
in classDynamicArray<IMethodInfo>
- Parameters:
index
- index at which the specified element is to be insertedmethod
- element to be inserted
-
addAll
public boolean addAll(int index, Collection<? extends IMethodInfo> c)
Description copied from class:DynamicArray
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified collection's iterator.- Specified by:
addAll
in interfaceList<IMethodInfo>
- Overrides:
addAll
in classDynamicArray<IMethodInfo>
- Parameters:
index
- index at which to insert the first element from the specified collectionc
- collection containing elements to be added to this list- Returns:
- true if this list changed as a result of the call
-
remove
public boolean remove(Object o)
Description copied from class:DynamicArray
Removes the first occurrence of the specified element from this list, if it is present. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index i such that (o==null ? get(i)==null : o.equals(get(i))) (if such an element exists). Returns true if this list contained the specified element (or equivalently, if this list changed as a result of the call).- Specified by:
remove
in interfaceCollection<IMethodInfo>
- Specified by:
remove
in interfaceList<IMethodInfo>
- Overrides:
remove
in classDynamicArray<IMethodInfo>
- Parameters:
o
- element to be removed from this list, if present- Returns:
- true if this list contained the specified element
-
removeRange
protected void removeRange(int fromIndex, int toIndex)
Description copied from class:DynamicArray
Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)- Overrides:
removeRange
in classDynamicArray<IMethodInfo>
- Parameters:
fromIndex
- index of first element to be removedtoIndex
- index after last element to be removed
-
clear
public void clear()
Description copied from class:DynamicArray
Removes all of the elements from this list. The list will be empty after this call returns.- Specified by:
clear
in interfaceCollection<IMethodInfo>
- Specified by:
clear
in interfaceList<IMethodInfo>
- Overrides:
clear
in classDynamicArray<IMethodInfo>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<IMethodInfo>
- Specified by:
removeAll
in interfaceList<IMethodInfo>
- Overrides:
removeAll
in classAbstractCollection<IMethodInfo>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<IMethodInfo>
- Specified by:
retainAll
in interfaceList<IMethodInfo>
- Overrides:
retainAll
in classAbstractCollection<IMethodInfo>
-
findAssignableMethod
public IMethodInfo findAssignableMethod(IMethodInfo miTo, boolean bStatic, TypeVarToTypeMap inferenceMap)
-
getMethodBuckets
public Collection<DynamicArray<IMethodInfo>> getMethodBuckets()
-
maybeInferParamType
public static IType maybeInferParamType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromParamType, IType toParamType)
-
maybeInferReturnType
public static IType maybeInferReturnType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromReturnType, IType toReturnType)
-
-