/[ascend]/trunk/pygtk/solver.i
ViewVC logotype

Diff of /trunk/pygtk/solver.i

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 941 by johnpye, Wed Sep 20 13:36:40 2006 UTC revision 942 by johnpye, Sat Nov 25 05:26:47 2006 UTC
# Line 24  Line 24 
24              self.params = params;              self.params = params;
25              self.index = 0;              self.index = 0;
26    
27            def __iter__(self):
28                return self
29    
30          def next(self):          def next(self):
31              self.index = self.index + 1              self.index = self.index + 1
32              if self.index >= self.params.getLength():              if self.index >= self.params.getLength():
33                  raise StopIteration                  raise StopIteration
34                print "INDEX = %d" % self.index
35              return self.params.getParameter(self.index)              return self.params.getParameter(self.index)
36  }  }
37    
# Line 43  public: Line 47  public:
47      %pythoncode{      %pythoncode{
48          def __iter__(self):          def __iter__(self):
49              return SolverParameterIter(self)              return SolverParameterIter(self)
50          def getitem(self,index):          def __getitem__(self,index):
51              return              return self.getParameter(index)
52            def __len__(self):
53                return self.getLength()
54      }      }
55  }  }
56    
# Line 87  public: Line 93  public:
93      const std::string toString() const;      const std::string toString() const;
94  };  };
95    
96    %extend SolverParameter{
97        %pythoncode{
98            def __str__(self):
99                if self.isInt(): return "%s = %d" %(self.getName(),self.getIntValue())
100                if self.isBool(): return "%s = %s" %(self.getName(),self.getBoolValue())
101                if self.isStr(): return "%s = %s" %(self.getName(),self.getStrValue())
102                if self.isReal(): return "%s = %f" %(self.getName(),self.getRealValue())
103        }
104    }
105    
106  /* Incidence matrix stuff */  /* Incidence matrix stuff */
107  typedef enum{  typedef enum{
108      IM_NULL=0, IM_ACTIVE_FIXED, IM_ACTIVE_FREE, IM_DORMANT_FIXED, IM_DORMANT_FREE      IM_NULL=0, IM_ACTIVE_FIXED, IM_ACTIVE_FREE, IM_DORMANT_FIXED, IM_DORMANT_FREE

Legend:
Removed from v.941  
changed lines
  Added in v.942

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22