001/**002 * NumericProperties.java003 *004 * Copyright (c) 2004-2012, Nicole C. Tedesco. All rights reserved.005 *006 * Licensed under the Apache License, Version 2.0 (the "License");007 * you may not use this file except in compliance with the License.008 * You may obtain a copy of the License at:009 *010 * http://www.apache.org/licenses/LICENSE-2.0011 *012 * Unless required by applicable law or agreed to in writing, software013 * distributed under the License is distributed on an "AS IS" BASIS,014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.015 * See the License for the specific language governing permissions and016 * limitations under the License.017 */018019package net.sf.jaccumulator.scalars;020021import net.sf.jaccumulator.Domain;022023/**024 * Algebraic predicates indicating properties of a specific number025 *026 * @since JAccumulator 4.0027 * @author Nicole Tedesco (<a028 * href="mailto:Nicole@NicoleTedesco.com">Nicole@NicoleTedesco.com</a>)029 */030public interface NumericProperties031{032 /**033 * @return {@code true} if this value represents a valid and finite value034 */035 public boolean isFinite();036037 /**038 * Answer {@code true} if this value represents the magnitude of a vector039 * into the set of imaginary numbers. This is not the same as testing040 * whether this object's implementation resembles the specification for the041 * {@link Domain#IMAGINARY IMAGINARY} domain, since that is too specific to042 * implementation machinery. This more general test also includes imaginary043 * {@link Domain#MODULO modulo} values in its specification.044 *045 * @return {@code true} if this value represents the magnitude of a vector046 * into the set of imaginary numbers047 */048 public boolean isImaginary();049050 /**051 * @return {@code true} if this number represents either052 * {@link #isPositiveInfinity() positive} or053 * {@link #isNegativeInfinity() negative} infinity054 */055 public boolean isInfinity();056057 /**058 * @return {@code true} if this value does not represent a valid number,059 * such as 0/0 ({@link Double#NaN INVALID})060 * @see <a href="http://en.wikipedia.org/wiki/INVALID">INVALID</a> at061 * Wikipedia062 */063 public boolean isInvalid();064065 /**066 * @return {@code true} if this value represents the maximum rational value067 * in the totally ordered set it represents068 */069 public boolean isMaximum();070071 /**072 * @return {@code true} if this value represents the minimum rational value073 * in the totally ordered set it represents074 */075 public boolean isMinimum();076077 /**078 * Answer {@code true} if this value represents the magnitude of a vector079 * into a modulo set, or finite ring. This is not the same as testing080 * whether this object's implementation resembles the specification for the081 * {@link Domain#MODULO MODULO} domain, since that is too specific to082 * implementation machinery. Modulo values, for instance can either be083 * {@link #isReal() real} or {@link #isImaginary() imaginary}.084 *085 * @return {@code true} if this value represents the magnitude of a vector086 * into a modulo set, or finite ring087 */088 public boolean isModulo();089090 /**091 * @return {@code true} if this value represents a negative value092 */093 public boolean isNegative();094095 /**096 * @return {@code true} if this value represents a valid, finite and097 * negative value098 */099 public boolean isNegativeFinite();100101 /**102 * @return {@code true} if this value represents {@link #isNegative()103 * negative} infinity104 */105 public boolean isNegativeInfinity();106107 /**108 * @return {@code true} if this value represents a positive value109 */110 public boolean isPositive();111112 /**113 * @return {@code true} if this value represents a valid, finite and114 * negative value115 */116 public boolean isPositiveFinite();117118 /**119 * @return {@code true} if this value represents {@link #isPositive()120 * positive} infinity121 */122 public boolean isPositiveInfinity();123124 /**125 * Answer {@code true} if this value represents the magnitude of a vector126 * into the set of real numbers. This is not the same as testing whether127 * this object's implementation resembles the specification for the128 * {@link Domain#REAL REAL} domain, since that is too specific to129 * implementation machinery. This more general test also includes real130 * {@link Domain#MODULO modulo} values in its specification.131 *132 * @return {@code true} if this value represents the magnitude of a vector133 * into the set of real numbers134 */135 public boolean isReal();136137 /**138 * Answer {@code true} if this value represents the <b>multiplicative139 * identity</b> in its arithmetic domain. For real numbers this is 1, for140 * matrices it would be the <i>identity matrix</i> and for functions this141 * would be a <i>pass-through</i>.142 *143 * @return {@code true} if this value represents the <i>multiplicative144 * identity</i> in its domain145 */146 public boolean isUnity();147148 /**149 * @return {@code true} if this value represents a valid number (not150 * {@link Double#NaN INVALID})151 * @see <a href="http://en.wikipedia.org/wiki/INVALID">INVALID</a> at152 * Wikipedia153 */154 public boolean isValid();155156 /**157 * Answer {@code true} if this value represents the <b>additive identity</b>158 * in its algebraic group. For real numbers this is 0, for matrices this159 * would be the <i>zero matrix</i> and for functions this would map every160 * parameter to zero.161 *162 * @return {@code true} if this value represents the <i>additive163 * identity</i> in its algebraic group164 */165 public boolean isZero();166167 /**168 * @return zero if this number is {@link #isZero() zero}, -1 if this number169 * is {@link #isNegative() negative} or +1 if it is170 * {@link #isPositive() positive}171 */172 public int signum();173}