001    /**
002     * Versor.java
003     *
004     * This file is part of jclifford package and it's distributed under the terms of the MIT license.
005     *
006     * The MIT License :
007     * -----------------
008     * Copyright (c) 2002, 2003, 2004, 2005 Giorgio Vassallo, Pietro Brignola
009     *
010     * Permission is hereby granted, free of charge, to any person obtaining a
011     * copy of this software and associated documentation files (the "Software"),
012     * to deal in the Software without restriction, including without limitation
013     * the rights to use, copy, modify, merge, publish, distribute, sublicense,
014     * and/or sell copies of the Software, and to permit persons to whom the
015     * Software is furnished to do so, subject to the following conditions:
016     * The above copyright notice and this permission notice shall be included in
017     * all copies or substantial portions of the Software.
018     *
019     * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
020     * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
021     * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
022     * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
023     * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
024     * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
025     * DEALINGS IN THE SOFTWARE.
026     */
027    
028    package jclifford;
029    
030    /**
031     * <p>This class represents a basis versor.</p>
032     * <p>It is an utility class for the BladeTreeSet class.</p>
033     * @version <p>0.9</p>
034     * @author <p>Realized by <a href="mailto:vassallo@csai.unipa.it">Giorgio Vassallo</a>, <a href="mailto:pietro.brignola@libero.it">Pietro Brignola</a>, November 2002.</p>
035     * @see Blade Value
036     */
037    class Versor implements Comparable{
038    
039            /**
040             * Basis versor.
041             */
042            public int versor;
043    
044            /**
045             * Creates and returns a Versor object representing a basis versor.
046             * @param versor the int representing the basis versor.
047             */
048            public Versor(int versor)
049            {
050                    this.versor = versor;
051            }
052    
053            /**
054             * Creates and returns an new Object deeply cloning this Object.
055             */
056            public Object clone()
057            {
058                    return new Versor(versor);
059            }
060    
061            /**
062             * Compare this object with another comparing versor field.
063             */
064            public int compareTo(Object object)
065            {
066                    int v = ((Versor) object).versor;
067                    return (versor < v ? -1 : (versor == v ? 0 : 1));
068            }
069    
070            /**
071             * Returns a string representation of the versor.
072             * @return the string representation of the versor.
073             */
074            public String toString()
075            {
076                    return "e" + String.valueOf(versor);
077            }
078    
079    }