org.eclipse.xtend.backend.functions
Class DuplicateAwareNamedFunctionCollection

java.lang.Object
  extended by org.eclipse.xtend.backend.functions.DuplicateAwareNamedFunctionCollection

public final class DuplicateAwareNamedFunctionCollection
extends java.lang.Object

This class collects functions. It removes an old one if a new one with identical signature is added, allowing overwriting. The check for "identical signature" is performed only if both functions have no guard. Functions with guards are never treated as having the same signature because an equality check would then require comparison of guards, a tricky undertaking which is left for a future version.

Author:
Arno Haase (http://www.haase-consulting.com), André Arnold

Constructor Summary
DuplicateAwareNamedFunctionCollection()
           
 
Method Summary
 boolean contains(NamedFunction f)
          checks if this collection already contains a function with identical signature.
 java.util.Collection<NamedFunction> getFunctions()
           
static boolean haveSameSignature(NamedFunction f1, NamedFunction f2)
          helper operation to compare two functions.
 NamedFunction register(NamedFunction f)
          registers a function and returns the old function of the same signature if one was replaced, and null otherwise
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DuplicateAwareNamedFunctionCollection

public DuplicateAwareNamedFunctionCollection()
Method Detail

register

public NamedFunction register(NamedFunction f)
registers a function and returns the old function of the same signature if one was replaced, and null otherwise


contains

public boolean contains(NamedFunction f)
checks if this collection already contains a function with identical signature.


getFunctions

public java.util.Collection<NamedFunction> getFunctions()

haveSameSignature

public static boolean haveSameSignature(NamedFunction f1,
                                        NamedFunction f2)
helper operation to compare two functions.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object