1 /* 2 * JScience - Java(TM) Tools and Libraries for the Advancement of Sciences. 3 * Copyright (C) 2005 - JScience (http://jscience.org/) 4 * All rights reserved. 5 * 6 * Permission to use, copy, modify, and distribute this software is 7 * freely granted, provided that this notice is preserved. 8 */ 9 package org.jscience.mathematics.matrices; 10 11 import javolution.realtime.Realtime; 12 13 /** 14 * <p> This interface abstracts the fundamental arithmetic operations: 15 * plus (+), times (*), opposite (-) and reciprocal (1/).</p> 16 * 17 * <p> If the set of objects implementing this interface is commutative under 18 * addition and associative under multiplication and the two operations are 19 * related by distributive laws, then it forms a mathematical ring (linear 20 * algebra). System of linear equations involving these objects can be 21 * resolved using the {@link Matrix} class.</p> 22 * 23 * @author <a HREF="mailto:jean-marie@dautelle.com">Jean-Marie Dautelle</a> 24 * @version 2.0, June 6, 2004 25 */ 26 public interface Operable<T extends Operable<T>> extends Realtime { 27 28 /** 29 * Returns the sum of this object with the one specified. 30 * 31 * @param that the object to be added. 32 * @return <code>this + that</code>. 33 */ 34 T plus(T that); 35 36 /** 37 * Returns the additive inverse of this object. It is the object such as 38 * <code>this.plus(this.opposite()) == ZERO</code>, 39 * with <code>ZERO</code> being the additive identity. 40 * 41 * @return <code>-this</code>. 42 */ 43 T opposite(); 44 45 /** 46 * Returns the product of this object with the one specified. 47 * 48 * @param that the object multiplier. 49 * @return <code>this * that</code>. 50 */ 51 T times(T that); 52 53 /** 54 * Returns the multiplicative inverse of this object. It it the object 55 * such as <code>this.times(this.reciprocal()) == ONE </code>, 56 * with <code>ONE</code> being the multiplicative identity. 57 * 58 * @return <code>ONE / this</code>. 59 */ 60 T reciprocal(); 61 62 }