Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove PSG from SimGrid git
[simgrid.git] / contrib / psg / src / peersim / cdsim / DaemonProtocol.java
diff --git a/contrib/psg/src/peersim/cdsim/DaemonProtocol.java b/contrib/psg/src/peersim/cdsim/DaemonProtocol.java
deleted file mode 100644 (file)
index 73f9a4e..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2003-2005 The BISON Project
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-package peersim.cdsim;
-
-import java.util.Arrays;
-import peersim.config.Configuration;
-import peersim.core.Node;
-import peersim.core.Control;
-
-/**
-* A protocol that is not really a protocol, but a trick to carry out all
-* kinds of tasks during the simulation. Many users will probably not need it,
-* but it is a nice way to e.g. run controls at any time, not only between cycles.
-*/
-public class DaemonProtocol implements CDProtocol {
-
-
-// ========================= fields =================================
-// ==================================================================
-
-
-/**
-* This is the prefix for network dynamism managers.
-* @config
-*/
-private static final String PAR_CTRL = "control";
-
-/**
-* The controls will be run according to this frequency.
-* It is interpreted within a cycle, in terms of cycle time
-* ({@link CDState#getCycleT}). The first cycletime is 0.
-* Defaults to 1.
-* @config
-*/
-private static final String PAR_STEP = "cstep";
-
-// --------------------------------------------------------------------
-
-private static Control[] controls=null;
-
-private static int step;
-
-// ========================= initialization =========================
-// ==================================================================
-
-
-public DaemonProtocol(String s)
-{  
-       step = Configuration.getInt(s+"."+PAR_STEP,1);
-       
-       String[] names = Configuration.getNames(s+"."+PAR_CTRL);
-       controls = new Control[names.length];
-       for(int i=0; i<names.length; ++i)
-       {
-               controls[i]=(Control)Configuration.getInstance(names[i]);
-       }
-       System.err.println(s+": loaded controls "+Arrays.asList(names));
-}
-
-// ------------------------------------------------------------------
-
-public Object clone() {
-
-       DaemonProtocol ip = null;
-       try { ip=(DaemonProtocol)super.clone(); }
-       catch( CloneNotSupportedException e ) {} // never happens
-       return ip;
-}
-
-
-// ========================= methods =================================
-// ===================================================================
-
-       
-/**
-* Runs the configured controls if {@link CDState#getCycleT} %
-* {@value #PAR_STEP}=0.
-*/
-public void nextCycle( Node node, int protocolID ) {
-
-       if( CDState.getCycleT() % step != 0 ) return;
-       for(int j=0; j<controls.length; ++j) controls[j].execute();
-}
-
-}
-