org.eclipse.xtend.backend.functions
Class DuplicateAwareFunctionCollection

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

public final class DuplicateAwareFunctionCollection
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)

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

Constructor Detail

DuplicateAwareFunctionCollection

public DuplicateAwareFunctionCollection()
Method Detail

register

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


contains

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


getFunctions

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

haveSameSignature

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