Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix bug with const in java bindings
[simgrid.git] / src / bindings / java / org / simgrid / surf / Resource.java
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 2.0.12
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 resource used by a model (e.g., a cpu, a network link)
13   * @see Model
14   * @see Action
15   */
16 public class Resource {
17   private long swigCPtr;
18   protected boolean swigCMemOwn;
19
20   protected Resource(long cPtr, boolean cMemoryOwn) {
21     swigCMemOwn = cMemoryOwn;
22     swigCPtr = cPtr;
23   }
24
25   protected static long getCPtr(Resource 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_Resource(swigCPtr);
38       }
39       swigCPtr = 0;
40     }
41   }
42
43   
44   /**
45     * @return The name of the resource
46     */
47   public String getName() {
48     return SurfJNI.Resource_getName(swigCPtr, this);
49   }
50
51   
52   /**
53     * @return True if the Resource is used
54     */
55   public boolean isUsed() {
56     return SurfJNI.Resource_isUsed(swigCPtr, this);
57   }
58
59   
60   /**
61     * @return The model associated to this Resource
62     */
63   public Model getModel() {
64     long cPtr = SurfJNI.Resource_getModel(swigCPtr, this);
65     return (cPtr == 0) ? null : new Model(cPtr, false);
66   }
67
68   
69   /**
70     * @return The state of the resource
71     * @see ResourceState
72     */
73   public ResourceState getState() {
74     return ResourceState.swigToEnum(SurfJNI.Resource_getState(swigCPtr, this));
75   }
76
77   
78   /**
79     * @return The constraint associatied (if using LMM)
80     */
81   public LmmConstraint getConstraint() {
82     long cPtr = SurfJNI.Resource_getConstraint(swigCPtr, this);
83     return (cPtr == 0) ? null : new LmmConstraint(cPtr, false);
84   }
85
86   
87   /**
88     * @return The XbtDict of properties associated to this Resource
89     */
90   public XbtDict getProperties() {
91     long cPtr = SurfJNI.Resource_getProperties(swigCPtr, this);
92     return (cPtr == 0) ? null : new XbtDict(cPtr, false);
93   }
94
95   
96   /**
97     * Update the state of the Resource
98     * @param event_type
99     * @param value
100     * @param date
101     */
102   public void updateState(TmgrTraceEvent event_type, double value, double date) {
103     SurfJNI.Resource_updateState(swigCPtr, this, TmgrTraceEvent.getCPtr(event_type), event_type, value, date);
104   }
105
106 }