Warm tip: This article is reproduced from serverfault.com, please click

How do I debug a type instantiation Error?

发布于 2020-12-12 18:22:25

I have three agents: Buyer, Supplier, and Order. Buyers have a 'supplier' parameter. Order has six parameters of varying types, p1,...,p6. I'm using an Event to govern how often a buyer sends an order to a supplier. My action code in that placesOrder Event is:

Order order = new Order(p1, p2, p3, p4, p5, p6);
send(order,supplier);

I get the following error: "Can't instantiate the type Order" in the placesOrder Event. I've used this technique in other simulations but this is the first time I've gotten this error. The java code is basically the same as in other models (different parameters of course). I'm not sure I understand how to begin debugging this one. Any suggestions on where to go from here? Any more info needed?

Questioner
Vince
Viewed
0
Felipe 2020-12-14 03:06:38

The error is that you have another generic called Order... so order is a bit of a conflicting name that you shouldn't use if avoidable. Also you have the arguments of your class constructor wrong and they should be like this:

class

So if you do this, the problem is solved:

logservqual_satisfaction.Order order = new logservqual_satisfaction.Order( 0, 0.0, 0.0, 0.0, supplier,this);