001    /**
002     *  "TRMSim-WSN, Trust and Reputation Models Simulator for Wireless
003     * Sensor Networks" is free software: you can redistribute it and/or
004     * modify it under the terms of the GNU Lesser General Public License
005     * as published by the Free Software Foundation, either version 3 of
006     * the License, or (at your option) any later version always keeping
007     * the additional terms specified in this license.
008     *
009     * This program is distributed in the hope that it will be useful,
010     * but WITHOUT ANY WARRANTY; without even the implied warranty of
011     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012     * GNU Lesser General Public License for more details.
013     *
014     *
015     * Additional Terms of this License
016     * --------------------------------
017     *
018     * 1. It is Required the preservation of specified reasonable legal notices
019     *   and author attributions in that material and in the Appropriate Legal
020     *   Notices displayed by works containing it.
021     *
022     * 2. It is limited the use for publicity purposes of names of licensors or
023     *   authors of the material.
024     *
025     * 3. It is Required indemnification of licensors and authors of that material
026     *   by anyone who conveys the material (or modified versions of it) with
027     *   contractual assumptions of liability to the recipient, for any liability
028     *   that these contractual assumptions directly impose on those licensors
029     *   and authors.
030     *
031     * 4. It is Prohibited misrepresentation of the origin of that material, and it is
032     *   required that modified versions of such material be marked in reasonable
033     *   ways as different from the original version.
034     *
035     * 5. It is Declined to grant rights under trademark law for use of some trade
036     *   names, trademarks, or service marks.
037     *
038     * You should have received a copy of the GNU Lesser General Public License
039     * along with this program (lgpl.txt).  If not, see <http://www.gnu.org/licenses/>
040    */
041    
042    package es.ants.felixgm.trmsim_wsn.trm.templatetrm;
043    
044    import es.ants.felixgm.trmsim_wsn.outcomes.Outcome;
045    import es.ants.felixgm.trmsim_wsn.network.Network;
046    import es.ants.felixgm.trmsim_wsn.network.Sensor;
047    import es.ants.felixgm.trmsim_wsn.network.Service;
048    import es.ants.felixgm.trmsim_wsn.trm.GatheredInformation;
049    import es.ants.felixgm.trmsim_wsn.trm.TRModel_WSN;
050    import java.util.Collection;
051    import java.util.Vector;
052    
053    /**
054     * <p>This class models TemplateTRM
055     * algorithm used by a client in a P2P, Ad-hoc or Wireless Sensor Network,
056     * in order to find the most trustworthy server offering a desired service.</p>
057     * <p><a name="TemplateTRMparameters"></a>It needs some parameters to be passed as a
058     * {@link TemplateTRM_Parameters} object. To do this, a file can be given following the next structure:</p>
059     * <pre>
060     *    ####################################
061     *    # TemplateTRM parameters file
062     *    ####################################
063     *    parameter1Name=parameter1Value
064     *    parameter2Name=parameter2Value
065     * </pre>
066     * This file can be downloaded
067     * <a href="http://ants.dif.um.es/~felixgm/research/trmsim-wsn/resources/TemplateTRMparameters.txt" target=_blank">here</a>.
068     * But if any of the parameters can not be successfully extracted from the file, they are set
069     * to a default value.
070     *
071     * @author <a href="http://ants.dif.um.es/~felixgm/en" target="_blank">F&eacute;lix G&oacute;mez M&aacute;rmol</a>, <a href="http://webs.um.es/gregorio" target="_blank">Gregorio Mart&iacute;nez P&eacute;rez</a>
072     * @version 0.3
073     * @since 0.3
074     */
075    public class TemplateTRM  extends TRModel_WSN {
076    
077        /**
078         * Class TemplateTRM constructor
079         * @param templateTRM_parameters Parameters needed for the algorithm, as described <a href="#TemplateTRMparameters">before</a>
080         */
081        public TemplateTRM(TemplateTRM_Parameters templateTRM_parameters) {
082            super(templateTRM_parameters);
083        }
084    
085        /**
086         * Returns the name of this model, i.e., "TemplateTRM"
087         * @return The name of this model, i.e., "TemplateTRM"
088         */
089        public static String get_name() { return "TemplateTRM"; }
090    
091        @Override
092        public GatheredInformation gatherInformation(Sensor client, Service service) {
093            return null;
094        }
095    
096        @Override
097        public Vector<Sensor> scoreAndRanking(Sensor client, GatheredInformation gi) {
098            return null;
099        }
100    
101        @Override
102        public Outcome performTransaction(Vector<Sensor> path, Service service) {
103            return null;
104        }
105    
106        @Override
107        public Outcome reward(Vector<Sensor> path, Outcome outcome) {
108            return outcome;
109        }
110    
111        @Override
112        public Outcome punish(Vector<Sensor> path, Outcome outcome) {
113            return outcome;
114        }
115    
116        @Override
117        public Network generateRandomNetwork(
118                int numSensors,
119                double probClients,
120                double rangeFactor,
121                Collection<Double> probServices,
122                Collection<Double> probGoodness,
123                Collection<Service> services)  {
124            return new TemplateTRM_Network(numSensors,probClients,rangeFactor,probServices,probGoodness,services);
125        }
126    
127        @Override
128        public Network loadCurrentNetwork(String fileName) throws Exception {
129            return new TemplateTRM_Network(fileName);
130        }
131    }