Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / bindings / java / org / simgrid / surf / Model.java
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 2.0.11
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8
9 package org.simgrid.surf;
10
11 /**
12   * A component (e.g., Cpu, Network, Storage, ...) is composed of three classes:
13   * <ul>
14   *  <li> Model: It handle the interactions between resoucses and actions</li>
15   *  <li> Resource: A resource used by the model (e.g., a cpu, a network link)</li>
16   *  <li> Action: An action generated by the resources (e.g., execution, communication)</li>
17   * </ul>
18   * @see Resource
19   * @see Action
20   */
21 public class Model {
22   private long swigCPtr;
23   protected boolean swigCMemOwn;
24
25   protected Model(long cPtr, boolean cMemoryOwn) {
26     swigCMemOwn = cMemoryOwn;
27     swigCPtr = cPtr;
28   }
29
30   protected static long getCPtr(Model obj) {
31     return (obj == null) ? 0 : obj.swigCPtr;
32   }
33
34   protected void finalize() {
35     delete();
36   }
37
38   public synchronized void delete() {
39     if (swigCPtr != 0) {
40       if (swigCMemOwn) {
41         swigCMemOwn = false;
42         SurfJNI.delete_Model(swigCPtr);
43       }
44       swigCPtr = 0;
45     }
46   }
47
48   
49   /**
50     * Model constructor
51     * @param name The name of the model
52     */
53   public Model(String name) {
54     this(SurfJNI.new_Model(name), true);
55   }
56
57   
58   /**
59     * @return The name of the model
60     */
61   public String getName() {
62     return SurfJNI.Model_getName(swigCPtr, this);
63   }
64
65   
66   /**
67     * Share the resources between the actions
68     * @param now the current time
69     * @return the date of the next action of the model will finish
70     */
71   public double shareResources(double now) {
72     return SurfJNI.Model_shareResources(swigCPtr, this, now);
73   }
74
75   public double shareResourcesLazy(double now) {
76     return SurfJNI.Model_shareResourcesLazy(swigCPtr, this, now);
77   }
78
79   public double shareResourcesFull(double now) {
80     return SurfJNI.Model_shareResourcesFull(swigCPtr, this, now);
81   }
82
83   
84   /**
85     * Update time of actions and eventually their states
86     * @param now the new current time
87     * @param delta the delta between previous and new current time
88     */
89   public void updateActionsState(double now, double delta) {
90     SurfJNI.Model_updateActionsState(swigCPtr, this, now, delta);
91   }
92
93   public void updateActionsStateLazy(double now, double delta) {
94     SurfJNI.Model_updateActionsStateLazy(swigCPtr, this, now, delta);
95   }
96
97   public void updateActionsStateFull(double now, double delta) {
98     SurfJNI.Model_updateActionsStateFull(swigCPtr, this, now, delta);
99   }
100
101   
102   /**
103     * Get the List of running Actions
104     */
105   public ActionList getRunningActionSet() {
106     long cPtr = SurfJNI.Model_getRunningActionSet(swigCPtr, this);
107     return (cPtr == 0) ? null : new ActionList(cPtr, false);
108   }
109
110 }