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

org.snapscript.tree.math.NumericChecker Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.tree.math;

import org.snapscript.core.type.Type;

public class NumericChecker {

   public static boolean isNumeric(Type type){
      Class real = type.getType();
      return Number.class.isAssignableFrom(real);
   }
   
   public static boolean isNumeric(Class type){
      return Number.class.isAssignableFrom(type);
   }
   
   public static boolean isNumeric(Object value){
      return Number.class.isInstance(value);
   }
   
   public static boolean isBothNumeric(Type left, Type right){
      return isNumeric(left) && isNumeric(right);
   }

   public static boolean isBothNumeric(Class left, Class right){
      return isNumeric(left) && isNumeric(right);
   }
   
   public static boolean isBothNumeric(Object left, Object right){
      return isNumeric(left) && isNumeric(right);
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy