Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Rewrite of the fat trees implementation
[simgrid.git] / src / bindings / java / org / simgrid / surf / Action.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   * An action created by a Resource (e.g., a communication, an execution)
13   * @see Model
14   * @see Resource
15   */
16 public class Action {
17   private long swigCPtr;
18   protected boolean swigCMemOwn;
19
20   protected Action(long cPtr, boolean cMemoryOwn) {
21     swigCMemOwn = cMemoryOwn;
22     swigCPtr = cPtr;
23   }
24
25   protected static long getCPtr(Action obj) {
26     return (obj == null) ? 0 : obj.swigCPtr;
27   }
28
29   protected void finalize() {
30     delete();
31   }
32
33   public synchronized void delete() {
34     if (swigCPtr != 0) {
35       if (swigCMemOwn) {
36         swigCMemOwn = false;
37         SurfJNI.delete_Action(swigCPtr);
38       }
39       swigCPtr = 0;
40     }
41   }
42
43   protected static long[] cArrayUnwrap(Action[] arrayWrapper) {
44       long[] cArray = new long[arrayWrapper.length];
45       for (int i=0; i<arrayWrapper.length; i++)
46         cArray[i] = Action.getCPtr(arrayWrapper[i]);
47       return cArray;
48   }
49
50   protected static Action[] cArrayWrap(long[] cArray, boolean cMemoryOwn) {
51     Action[] arrayWrapper = new Action[cArray.length];
52     for (int i=0; i<cArray.length; i++)
53       arrayWrapper[i] = new Action(cArray[i], cMemoryOwn);
54     return arrayWrapper;
55   }
56
57   
58   /**
59     * Action constructor
60     * @param model The model associated
61     * @param cost The cost of the action (e.g., flops, bytes)
62     * @param failed If the action has failed
63     */
64   public Action(Model model, double cost, boolean failed) {
65     this(SurfJNI.new_Action(Model.getCPtr(model), model, cost, failed), true);
66   }
67
68   
69   /**
70     * @return The model associated
71     */
72   public Model getModel() {
73     long cPtr = SurfJNI.Action_getModel(swigCPtr, this);
74     return (cPtr == 0) ? null : new Model(cPtr, false);
75   }
76
77   
78   /**
79     * @return The variable associatied (if using LMM)
80     */
81   public LmmVariable getVariable() {
82     long cPtr = SurfJNI.Action_getVariable(swigCPtr, this);
83     return (cPtr == 0) ? null : new LmmVariable(cPtr, false);
84   }
85
86   
87   /**
88     * @return The state of the action
89     */
90   public ActionState getState() {
91     return ActionState.swigToEnum(SurfJNI.Action_getState(swigCPtr, this));
92   }
93
94   
95   /**
96     * @return True if suspended
97     */
98   public boolean isSuspended() {
99     return SurfJNI.Action_isSuspended(swigCPtr, this);
100   }
101
102   
103   /**
104     * @return TODO
105     */
106   public double getBound() {
107     return SurfJNI.Action_getBound(swigCPtr, this);
108   }
109
110   
111   /**
112     * @param TODO
113     */
114   public void setBound(double bound) {
115     SurfJNI.Action_setBound(swigCPtr, this, bound);
116   }
117
118   
119   /**
120     * Update remaining amount of cost to do
121     * @param delta Difference of time since last call to this function
122     */
123   public void updateRemains(double delta) {
124     SurfJNI.Action_updateRemains(swigCPtr, this, delta);
125   }
126
127   
128   /**
129     * @return The remaining amount of cost to do
130     */
131   public double getRemains() {
132     return SurfJNI.Action_getRemains(swigCPtr, this);
133   }
134
135   
136   /**
137     * @param The new priority of the action
138     */
139   public void setPriority(double priority) {
140     SurfJNI.Action_setPriority(swigCPtr, this, priority);
141   }
142
143   
144   /**
145     * @param The new state
146     */
147   public void setState(ActionState state) {
148     SurfJNI.Action_setState(swigCPtr, this, state.swigValue());
149   }
150
151 }