mjc

org.multijava.mjc
Interface CMethodSet.Strategy

All Known Implementing Classes:
CClass.NoDupStrategy
Enclosing interface:
CMethodSet

public static interface CMethodSet.Strategy

Represents the interface for strategies used in accumulating method sets. Typically a client of CMethodSet will create an anonymous class of type Strategy that is passed to accumMethodSet for adding some subset of the methods of the CMethodSet to an accumulator.

See Also:
CMethodSet#accumMethodSet(CMethodSet.Strategy,String,CMethodSet)

Field Summary
static byte DONE_WITH_ACCUM
          The bit mask representing that no more checks of the candidate method need to be made against the accumulator by calls to resultFor().
static byte IGNORE_CURRENT
          The bit mask representing that the candidate method passed to resultFor() should be ignored.
static byte REMOVE_ACCUM
          The bit mask representing that the accumMethod method passed to resultFor() should be removed from the accumulator.
 
Method Summary
 boolean maybeInclude(CMethod candidate, CClassType[] args)
          Indicates whether the given candidate method should be checked against the methods already in the accumulator for possible inclusion in the accumulator.
 byte resultFor(CMethod candidate, CMethod accumMethod)
          Checks the given candidate method against a single method in the accumulator and decides whether the candidate should be added to the accumulator, whether the method from the accumulator should be removed, and whether additional checks against the remaining methods in the accumulator are necessary.
 

Field Detail

IGNORE_CURRENT

public static final byte IGNORE_CURRENT
The bit mask representing that the candidate method passed to resultFor() should be ignored.

See Also:
resultFor(CMethod,CMethod)

REMOVE_ACCUM

public static final byte REMOVE_ACCUM
The bit mask representing that the accumMethod method passed to resultFor() should be removed from the accumulator.

See Also:
resultFor(CMethod,CMethod)

DONE_WITH_ACCUM

public static final byte DONE_WITH_ACCUM
The bit mask representing that no more checks of the candidate method need to be made against the accumulator by calls to resultFor().

See Also:
resultFor(CMethod,CMethod)
Method Detail

maybeInclude

public boolean maybeInclude(CMethod candidate,
                            CClassType[] args)
                              throws UnpositionedError
Indicates whether the given candidate method should be checked against the methods already in the accumulator for possible inclusion in the accumulator.

Parameters:
candidate - the candidate method for inclusion in the accumulator
Returns:
true if the method should be considered
Throws:
UnpositionedError - usually the implementer will want to use CContextType.reportTrouble() for error reporting to avoid throwing an exception, the exception is allowed here for flexibility

resultFor

public byte resultFor(CMethod candidate,
                      CMethod accumMethod)
                        throws UnpositionedError
Checks the given candidate method against a single method in the accumulator and decides whether the candidate should be added to the accumulator, whether the method from the accumulator should be removed, and whether additional checks against the remaining methods in the accumulator are necessary.

Parameters:
candidate - the candidate method for inclusion in the accumulator
accumMethod - a single method from the accumulator
Returns:
a bit mask indicating the actions to be taken
Throws:
UnpositionedError - if a problem is detected in the source code.

mjc

mjc is Copyright (C) 2000-2004 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.