Class SymTypeOfFunction


  • public class SymTypeOfFunction
    extends SymTypeExpression
    SymTypeOfFunction stores any kind of Function, such as List<Person>::get, obj::<Integer>getX, i -> i + 2
    • Field Detail

      • TYPESYMBOL_NAME

        @Deprecated
        public static final java.lang.String TYPESYMBOL_NAME
        Deprecated.
        only required for the deprecated type symbol
        See Also:
        Constant Field Values
      • functionSymbol

        protected java.util.Optional<FunctionSymbol> functionSymbol
        Symbol of the function may not be present (e.g., for lambdas)
      • returnType

        protected SymTypeExpression returnType
        Type of return value returned when the function is called
      • argumentTypes

        protected java.util.List<SymTypeExpression> argumentTypes
        List of argument types of the function e.g. "Integer f(Float t)" has "Float" as its argument type a this-pointer is the first argument
      • elliptic

        protected boolean elliptic
        Whether the function supports varargs e.g. Integer f(Float... t)
    • Constructor Detail

      • SymTypeOfFunction

        public SymTypeOfFunction​(FunctionSymbol functionSymbol,
                                 SymTypeExpression returnType,
                                 java.util.List<? extends SymTypeExpression> argumentTypes,
                                 boolean elliptic)
        Constructor with all parameters that are stored: FunctionSymbol can be null
      • SymTypeOfFunction

        @Deprecated
        public SymTypeOfFunction​(SymTypeExpression returnType,
                                 java.util.List<SymTypeExpression> argumentTypes,
                                 boolean elliptic)
        Deprecated.
        the other constructor is to be used
    • Method Detail

      • deepEqualsSignature

        public boolean deepEqualsSignature​(SymTypeExpression other)
        deepEquals, but ignoring the return type s.a. Java Spec 20 8.4.2
      • getType

        public SymTypeExpression getType()
        Returns:
        the return type of the function NOT the actual type of the function itself
      • isElliptic

        public boolean isElliptic()
        iff true, the last argument type is accepted any amount of times
      • setElliptic

        public void setElliptic​(boolean elliptic)
      • hasSymbol

        public boolean hasSymbol()
      • canHaveArity

        public boolean canHaveArity​(int arity)
        returns whether the specified amount of arguments can be accepted E.g., (P, int...) -> int can accept 1,2,3,... arguments, but not 0
      • getWithFixedArity

        public SymTypeOfFunction getWithFixedArity​(int arity)
        returns a clone, with the arity fixed to the specified number E.g., (P, int...) -> int with arity of 3 is (P, int, int) -> int
      • getDeclaredType

        public SymTypeOfFunction getDeclaredType()
        returns the declared type
      • getTypeArguments

        public java.util.List<SymTypeExpression> getTypeArguments()
        returns the type arguments for a generic function. E.g., given asList, which has the declared Type <T> (T...) -> List<T> and this is the instantiation (int, int) -> List<int>, This will return the argument list [int].

        Warning: if the instantiation is, e.g., (Person, Car) -> List<int>, no correct list of arguments can be calculated.

        Not to be confused with getArgumentTypes, which in turn returns the parameter types (a.k.a. the types the arguments need to be compatible to). Naming is confusing due to legacy reasons.

      • containsArgumentType

        public boolean containsArgumentType​(java.lang.Object element)
      • containsAllArgumentTypes

        public boolean containsAllArgumentTypes​(java.util.Collection<?> collection)
      • isEmptyArgumentTypes

        public boolean isEmptyArgumentTypes()
      • iteratorArgumentTypes

        public java.util.Iterator<SymTypeExpression> iteratorArgumentTypes()
      • sizeArgumentTypes

        public int sizeArgumentTypes()
      • toArrayArgumentTypes

        public java.lang.Object[] toArrayArgumentTypes()
      • spliteratorArgumentTypes

        public java.util.Spliterator<SymTypeExpression> spliteratorArgumentTypes()
      • streamArgumentTypes

        public java.util.stream.Stream<SymTypeExpression> streamArgumentTypes()
      • parallelStreamArgumentTypes

        public java.util.stream.Stream<SymTypeExpression> parallelStreamArgumentTypes()
      • indexOfArgumentType

        public int indexOfArgumentType​(java.lang.Object element)
      • lastIndexOfArgumentType

        public int lastIndexOfArgumentType​(java.lang.Object element)
      • equalsArgumentTypeTypes

        public boolean equalsArgumentTypeTypes​(java.lang.Object o)
      • hashCodeArgumentTypes

        public int hashCodeArgumentTypes()
      • listIteratorArgumentTypes

        public java.util.ListIterator<SymTypeExpression> listIteratorArgumentTypes()
      • listIteratorArgumentTypes

        public java.util.ListIterator<SymTypeExpression> listIteratorArgumentTypes​(int index)
      • subListArgumentTypes

        public java.util.List<SymTypeExpression> subListArgumentTypes​(int start,
                                                                      int end)
      • getArgumentTypeList

        public java.util.List<SymTypeExpression> getArgumentTypeList()
      • clearArgumentTypes

        public void clearArgumentTypes()
      • addAllArgumentTypes

        public boolean addAllArgumentTypes​(java.util.Collection<? extends SymTypeExpression> collection)
      • removeArgumentType

        public boolean removeArgumentType​(java.lang.Object element)
      • removeAllArgumentTypes

        public boolean removeAllArgumentTypes​(java.util.Collection<?> collection)
      • retainAllArgumentTypes

        public boolean retainAllArgumentTypes​(java.util.Collection<?> collection)
      • removeIfArgumentType

        public boolean removeIfArgumentType​(java.util.function.Predicate<? super SymTypeExpression> filter)
      • forEachArgumentTypes

        public void forEachArgumentTypes​(java.util.function.Consumer<? super SymTypeExpression> action)
      • addArgumentType

        public void addArgumentType​(int index,
                                    SymTypeExpression element)
      • addAllArgumentTypes

        public boolean addAllArgumentTypes​(int index,
                                           java.util.Collection<? extends SymTypeExpression> collection)
      • replaceAllArgumentTypes

        public void replaceAllArgumentTypes​(java.util.function.UnaryOperator<SymTypeExpression> operator)
      • sortArgumentTypes

        public void sortArgumentTypes​(java.util.Comparator<? super SymTypeExpression> comparator)
      • setArgumentTypeList

        public void setArgumentTypeList​(java.util.List<SymTypeExpression> argumentTypes)