The following file causes parsing to freeze at 93% of the buffer
in JDE2.2.6 using eieio-0.15, elib-1.0, semantic-1.3.2, and speedbar-0.13a
(as required) in FSF Emacs 20.6.1.

(Btw, it compiles fine.)

Thanks, -CR

__________CUT HERE______________________________________________________

package examples.rea;

import java.util.*;
import collagen.*;
import collagen.plan.*;
import collagen.beans.*;
import collagen.util.*;
import collagen.infer.equal.*;
import collagen.discourse.*;
import collagen.discourse.lang.*;

import examples.rea.lib.*;
import examples.rea.app.*;

// This class is abstract because not hooked up to listings database (see
// getListings below) See implementation in examples.rea.test.TestRea

public abstract class AbstractRea extends NewAgent {

   public String getName () { return "Rea"; }

   List /* of Listing */ shown = new ArrayList();  // listings that have been shown
   Iterator /* of Feature */ features;  // features of current place yet to be 
discussed

   public Iterator getFeatures () { return features; } // see DiscussFeature in 
Recipes.coll

   protected Object respondDuringTurn (Plan.Occurrence occurrence) {
      Act purpose = Discourse.THIS.getLivePurpose();

      // sequence of if-then rules, each exiting when matched

      if ( purpose != null && purpose.isType(FindPlace.class)
           // might allow some parameters to be unbound
           && purpose.hasAllParameterValues() ) { 
         FindPlace find = (FindPlace) purpose;
         // parameters might have changed since last call
         List listings = getListings(
            ((City.Literal) find.getCity().getValue()).unwrap(),
            ((Transport.Literal) find.getTransport().getValue()).unwrap(),
            ((NumberTerm.Literal) find.getBedrooms().getValue()).toInt(),
            ((NumberTerm.Literal) find.getBathrooms().getValue()).toInt(),
            ((NumberTerm.Literal) find.getPrice().getValue()).toInt(),
            ((NumberTerm.Literal) find.getPayment().getValue()).toInt(),
            ((DwellingType.Literal) find.getDwelling().getValue()).unwrap(),
            ((Flooring.Literal) find.getFlooring().getValue()).unwrap(),
            ((Outdoor.Literal) find.getOutdoor().getValue()).unwrap(),
            ((Storage.Literal) find.getStorage().getValue()).unwrap());
         // show next listing (if any) that has not already been shown
         Listing show = null;
         if ( listings != null )
            for (int i = 0; i < listings.size(); i++) {
               Listing listing = (Listing) listings.get(i);
               if ( !shown.contains(listing) ) {
                  show = listing;
                  shown.add(show);
                  break;
               }
            }
         if ( show == null ) {
            features = null;
            return new NoPlaces(SELF);
         }
         // assuming always at least one feature
         features = Arrays.asList(show.getFeatures()).iterator();
         return new Propose.Should(SELF, new ShowPlace(null, Place.make(show)));
      }

      if ( purpose != null && purpose.isType(DiscussFeature.class) && 
features.hasNext() ) {
         Feature feature = (Feature) features.next();
         NoticeFeature notice = new NoticeFeature(SELF, 
StringTerm.make(feature.getText()));
         Object object = feature.getObject();
         return object == null ? (Object) notice :
            (Object) Utils.newList(new ViewFeature(SELF, ObjectTerm.make(object)), 
notice);
      }

      // fall through to default behavior
      return super.respondDuringTurn(occurrence);
   }

   // this is the method that queries the real estate data base
   // (note that arguments are unwrapped objects)
   abstract protected List /* of Listing */ getListings (
      String city, String transport, int bedrooms, int bathrooms,
      int price, int payment, String dwellingType, String flooring,
      String outdoor, String storage);
}

Reply via email to