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 MethodListEMPTY-
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)protectedMethodList(MethodList source)MethodList(List<IMethodInfo> methods)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, IMethodInfo method)Inserts the specified element at the specified position in this list.booleanadd(IMethodInfo method)Appends the specified element to the end of this list.booleanaddAll(int index, Collection<? extends IMethodInfo> c)Inserts all of the elements in the specified collection into this list, starting at the specified position.booleanaddAll(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.voidclear()Removes all of the elements from this list.MethodListcopy()Returns a shallow copy of this ArrayList instance.MethodListfilterMethods(IRelativeTypeInfo.Accessibility accessibility)IMethodInfofindAssignableMethod(IMethodInfo miTo, boolean bStatic, TypeVarToTypeMap inferenceMap)Collection<DynamicArray<IMethodInfo>>getMethodBuckets()DynamicArray<? extends IMethodInfo>getMethods(String name)intindexOf(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 ITypemaybeInferParamType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromParamType, IType toParamType)static ITypemaybeInferReturnType(TypeVarToTypeMap inferenceMap, IType ownersType, IType fromReturnType, IType toReturnType)IMethodInforemove(int index)Removes the element at the specified position in this list.booleanremove(Object o)Removes the first occurrence of the specified element from this list, if it is present.booleanremoveAll(Collection<?> c)protected voidremoveRange(int fromIndex, int toIndex)Removes from this list all of the elements whose index is between fromIndex, inclusive, and toIndex, exclusive.booleanretainAll(Collection<?> c)IMethodInfoset(int index, IMethodInfo method)Replaces the element at the specified position in this list with the specified element.static MethodListsingleton(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:DynamicArrayReturns a shallow copy of this ArrayList instance. (The elements themselves are not copied.)- Overrides:
copyin 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:DynamicArrayAppends the specified element to the end of this list.- Specified by:
addin interfaceCollection<IMethodInfo>- Specified by:
addin interfaceList<IMethodInfo>- Overrides:
addin 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:DynamicArrayAppends 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:
addAllin interfaceCollection<IMethodInfo>- Specified by:
addAllin interfaceList<IMethodInfo>- Overrides:
addAllin 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:DynamicArrayRemoves the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).- Specified by:
removein interfaceList<IMethodInfo>- Overrides:
removein 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:DynamicArrayReplaces the element at the specified position in this list with the specified element.- Specified by:
setin interfaceList<IMethodInfo>- Overrides:
setin 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:DynamicArrayReturns 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:
indexOfin interfaceList<IMethodInfo>- Overrides:
indexOfin 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:DynamicArrayInserts 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:
addin interfaceList<IMethodInfo>- Overrides:
addin 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:DynamicArrayInserts 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:
addAllin interfaceList<IMethodInfo>- Overrides:
addAllin 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:DynamicArrayRemoves 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:
removein interfaceCollection<IMethodInfo>- Specified by:
removein interfaceList<IMethodInfo>- Overrides:
removein 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:DynamicArrayRemoves 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:
removeRangein 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:DynamicArrayRemoves all of the elements from this list. The list will be empty after this call returns.- Specified by:
clearin interfaceCollection<IMethodInfo>- Specified by:
clearin interfaceList<IMethodInfo>- Overrides:
clearin classDynamicArray<IMethodInfo>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<IMethodInfo>- Specified by:
removeAllin interfaceList<IMethodInfo>- Overrides:
removeAllin classAbstractCollection<IMethodInfo>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<IMethodInfo>- Specified by:
retainAllin interfaceList<IMethodInfo>- Overrides:
retainAllin 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)
-
-