ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/selection/SelectionEvaluator.cpp
(Generate patch)

Comparing trunk/OOPSE-2.0/src/selection/SelectionEvaluator.cpp (file contents):
Revision 2204 by gezelter, Fri Apr 15 22:04:00 2005 UTC vs.
Revision 2469 by tim, Fri Dec 2 15:38:03 2005 UTC

# Line 115 | Line 115 | namespace oopse {
115      return loadScript(filename, script);
116    }
117  
118 <  void SelectionEvaluator::instructionDispatchLoop(BitSet& bs){
118 >  void SelectionEvaluator::instructionDispatchLoop(OOPSEBitSet& bs){
119      
120      while ( pc < aatoken.size()) {
121        statement = aatoken[pc++];
# Line 136 | Line 136 | namespace oopse {
136  
137    }
138  
139 <  BitSet SelectionEvaluator::expression(const std::vector<Token>& code, int pcStart) {
140 <    BitSet bs;
141 <    std::stack<BitSet> stack;
139 >  OOPSEBitSet SelectionEvaluator::expression(const std::vector<Token>& code, int pcStart) {
140 >    OOPSEBitSet bs;
141 >    std::stack<OOPSEBitSet> stack;
142      
143      for (int pc = pcStart; pc < code.size(); ++pc) {
144        Token instruction = code[pc];
# Line 149 | Line 149 | namespace oopse {
149        case Token::expressionEnd:
150          break;
151        case Token::all:
152 <        bs = BitSet(nStuntDouble);
152 >        bs = OOPSEBitSet(nStuntDouble);
153          bs.setAll();
154          stack.push(bs);            
155          break;
156        case Token::none:
157 <        bs = BitSet(nStuntDouble);
157 >        bs = OOPSEBitSet(nStuntDouble);
158          stack.push(bs);            
159          break;
160        case Token::opOr:
# Line 206 | Line 206 | namespace oopse {
206  
207  
208  
209 <  BitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) {
209 >  OOPSEBitSet SelectionEvaluator::comparatorInstruction(const Token& instruction) {
210      int comparator = instruction.tok;
211      int property = instruction.intValue;
212      float comparisonValue = boost::any_cast<float>(instruction.value);
213      float propertyValue;
214 <    BitSet bs(nStuntDouble);
214 >    OOPSEBitSet bs(nStuntDouble);
215      bs.clearAll();
216      
217      SimInfo::MoleculeIterator mi;
# Line 235 | Line 235 | namespace oopse {
235      return bs;
236    }
237  
238 <  void SelectionEvaluator::compareProperty(StuntDouble* sd, BitSet& bs, int property, int comparator, float comparisonValue) {
238 >  void SelectionEvaluator::compareProperty(StuntDouble* sd, OOPSEBitSet& bs, int property, int comparator, float comparisonValue) {
239      double propertyValue = 0.0;
240      switch (property) {
241      case Token::mass:
# Line 284 | Line 284 | namespace oopse {
284  
285    }
286  
287 <  void SelectionEvaluator::withinInstruction(const Token& instruction, BitSet& bs){
287 >  void SelectionEvaluator::withinInstruction(const Token& instruction, OOPSEBitSet& bs){
288      
289      boost::any withinSpec = instruction.value;
290      float distance;
# Line 341 | Line 341 | namespace oopse {
341  
342    }
343  
344 <  void SelectionEvaluator::select(BitSet& bs){
344 >  void SelectionEvaluator::select(OOPSEBitSet& bs){
345      bs = expression(statement, 1);
346    }
347  
348 <  BitSet SelectionEvaluator::lookupValue(const std::string& variable){
348 >  OOPSEBitSet SelectionEvaluator::lookupValue(const std::string& variable){
349  
350 <    BitSet bs(nStuntDouble);
350 >    OOPSEBitSet bs(nStuntDouble);
351      std::map<std::string, boost::any>::iterator i = variables.find(variable);
352      
353      if (i != variables.end()) {
354 <      if (i->second.type() == typeid(BitSet)) {
355 <        return boost::any_cast<BitSet>(i->second);
354 >      if (i->second.type() == typeid(OOPSEBitSet)) {
355 >        return boost::any_cast<OOPSEBitSet>(i->second);
356        } else if (i->second.type() ==  typeid(std::vector<Token>)){
357          bs = expression(boost::any_cast<std::vector<Token> >(i->second), 2);
358          i->second =  bs; /**@todo fixme */
# Line 365 | Line 365 | namespace oopse {
365      return bs;
366    }
367  
368 <  BitSet SelectionEvaluator::nameInstruction(const std::string& name){
368 >  OOPSEBitSet SelectionEvaluator::nameInstruction(const std::string& name){
369      
370      return nameFinder.match(name);
371  
# Line 388 | Line 388 | namespace oopse {
388      //predefine();
389    }
390  
391 <  BitSet SelectionEvaluator::evaluate() {
392 <    BitSet bs(nStuntDouble);
391 >  OOPSEBitSet SelectionEvaluator::evaluate() {
392 >    OOPSEBitSet bs(nStuntDouble);
393      if (isLoaded_) {
394        pc = 0;
395        instructionDispatchLoop(bs);
# Line 398 | Line 398 | namespace oopse {
398      return bs;
399    }
400  
401 <  BitSet SelectionEvaluator::indexInstruction(const boost::any& value) {
402 <    BitSet bs(nStuntDouble);
401 >  OOPSEBitSet SelectionEvaluator::indexInstruction(const boost::any& value) {
402 >    OOPSEBitSet bs(nStuntDouble);
403  
404      if (value.type() == typeid(int)) {
405        int index = boost::any_cast<int>(value);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines