All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.snapscript.core.function.index.CachePointer Maven / Gradle / Ivy

package org.snapscript.core.function.index;

import static org.snapscript.core.function.index.Retention.ALWAYS;
import static org.snapscript.core.function.index.Retention.NEVER;

import java.util.Set;

import org.snapscript.core.function.Function;
import org.snapscript.core.function.Invocation;
import org.snapscript.core.scope.Scope;

public class CachePointer implements FunctionPointer {

   private final FunctionPointer pointer;
   private final Set keys;

   public CachePointer(FunctionPointer pointer, Set keys) {
      this.pointer = pointer;
      this.keys = keys;
   }

   @Override
   public ReturnType getType(Scope scope) {
      return pointer.getType(scope);
   }

   @Override
   public Function getFunction() {
      return pointer.getFunction();
   }

   @Override
   public Invocation getInvocation() {
      return pointer.getInvocation();
   }

   @Override
   public Retention getRetention() {
      return 1 == keys.size() ? ALWAYS : NEVER;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy