Package org.glassfish.rmic.tools.java
Class MethodSet
- java.lang.Object
-
- org.glassfish.rmic.tools.java.MethodSet
-
public class MethodSet extends java.lang.Object
The MethodSet structure is used to store methods for a class. It maintains the invariant that it never stores two methods with the same signature. MethodSets are able to lookup all methods with a given name and the unique method with a given signature (name, args). WARNING: The contents of this source file are not part of any supported API. Code that depends on them does so at its own risk: they are subject to change or removal without notice.
-
-
Field Summary
Fields Modifier and Type Field Description private int
count
The number of methods stored in the MethodSet.private boolean
frozen
Is this MethodSet currently frozen? See freeze() for more details.private java.util.Map<Identifier,java.util.List<MemberDefinition>>
lookupMap
A Map containing Lists of MemberDefinitions.
-
Constructor Summary
Constructors Constructor Description MethodSet()
Creates a brand new MethodSet
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(MemberDefinition method)
Adds `method' to the MethodSet.void
freeze()
After freeze() is called, the MethodSet becomes (mostly) immutable.boolean
isFrozen()
Tells whether freeze() has been called on this MethodSet.java.util.Iterator<MemberDefinition>
iterator()
Returns an Iterator of all methods in the MethodSetjava.util.Iterator<MemberDefinition>
lookupName(Identifier name)
Returns an Iterator of all methods contained in the MethodSet which have a given name.MemberDefinition
lookupSig(Identifier name, Type type)
If the MethodSet contains a method with the same signature then lookup() returns it.void
replace(MemberDefinition method)
Adds `method' to the MethodSet, replacing any previous definition with the same signature.int
size()
Returns the number of distinct methods stored in the MethodSet.java.lang.String
toString()
Returns a (big) string representation of this MethodSet
-
-
-
Field Detail
-
lookupMap
private final java.util.Map<Identifier,java.util.List<MemberDefinition>> lookupMap
A Map containing Lists of MemberDefinitions. The Lists contain methods which share the same name.
-
count
private int count
The number of methods stored in the MethodSet.
-
frozen
private boolean frozen
Is this MethodSet currently frozen? See freeze() for more details.
-
-
Method Detail
-
size
public int size()
Returns the number of distinct methods stored in the MethodSet.
-
add
public void add(MemberDefinition method)
Adds `method' to the MethodSet. No method of the same signature should be already defined.
-
replace
public void replace(MemberDefinition method)
Adds `method' to the MethodSet, replacing any previous definition with the same signature.
-
lookupSig
public MemberDefinition lookupSig(Identifier name, Type type)
If the MethodSet contains a method with the same signature then lookup() returns it. Otherwise, this method returns null.
-
lookupName
public java.util.Iterator<MemberDefinition> lookupName(Identifier name)
Returns an Iterator of all methods contained in the MethodSet which have a given name.
-
iterator
public java.util.Iterator<MemberDefinition> iterator()
Returns an Iterator of all methods in the MethodSet
-
freeze
public void freeze()
After freeze() is called, the MethodSet becomes (mostly) immutable. Any calls to add() or addMeet() lead to CompilerErrors. Note that the entries themselves are still (unfortunately) open for mischievous and wanton modification.
-
isFrozen
public boolean isFrozen()
Tells whether freeze() has been called on this MethodSet.
-
toString
public java.lang.String toString()
Returns a (big) string representation of this MethodSet- Overrides:
toString
in classjava.lang.Object
-
-