2

I have a intercity delivery system simulation model. A type of the agent is "Parcel". At the end of each delivery shift I want to generate some new parcels as a different sort of parcels. Therefore, I created a new class called "Dummy_Parcel" which extends from the class "Parcel".

package intraCity_Simulator;

public class DummyParcel extends Parcel {

    public DummyParcel(int id, int arr_tm, String or_hub, String de_hub, String mode, double wgt, double qty) {
        super(id, arr_tm, or_hub, de_hub, mode, wgt, qty);
        // TODO Auto-generated constructor stub
    }
}

The problem is that when I create a new "Dummy_Parcel", this Dummy_Parcel will be recorded in the Dummy_Parcel tab of the "Agent Table". Also this Dummy_Parcel will appear in the Parcel tab. This causes unnecessary duplication. How to configure to prevent Dummy_Parcel displayed in Parcel Tab? This problem also appears in batch run data collection.

enter image description here

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Jack
  • 1,339
  • 1
  • 12
  • 31

1 Answers1

3

The agent table and I believe also the data collection will record all sub-classes of a parent agent class if the parent class is specified as the class on which to collect stats. To better separate implementing sub-classes, I would suggest creating a parent abstract class or interface Parcel, and then create subclasses that extend or implement Parcel, for example RealParcel, DummyParcel, etc. Then only specify the sub-classes in the data collection and the agent table will have separate tabs automatically for each sub-class type.

The sub-classes really don't actually need to have any specific behavior different from Parcel - this architecture can simply be used to help organize data collection.

Eric Tatara
  • 715
  • 3
  • 12
  • Thanks. However, in my situation I need to record both parent parcel class and child parcel class at the same time. If there is no easy separation method I would need to add a field to distinguish between them in the parent parcel data collection. – Jack Dec 10 '19 at 03:47