示例#1
0
  public void SubscriberConstruct() {

    // Construct ServiceLookup information: The list of service to subscribe
    ArrayList<ServiceLookupMessage> lookupList = new ArrayList<ServiceLookupMessage>();
    lookupList.add(new ServiceLookupMessage("USZip", "CityByZip", new Pair("Double", 85281), 1));
    lookupList.add(
        new ServiceLookupMessage("Resort", "ResortByCity", new Pair("String", "tempe"), 1));
    lookupList.add(new ServiceLookupMessage("VoiceComm", "qRate", new Pair("Hz", 220500), 60));
    ServiceClient Subscriber1 = new ServiceClient("Subscriber1", lookupList, 0.1);

    Subscriber1.setBackgroundColor(Color.GREEN);

    // Construct the subscriber list
    SubscriberList.add(Subscriber1);
  }
示例#2
0
  public void PublisherConstruct() {

    ArrayList<Pair> Endpoints = new ArrayList<Pair>();

    Endpoints.add(new Pair("qRate", "Double"));
    VoiceComm Service1 = new VoiceComm("VoiceComm", "Voice Communication", "Atomic", Endpoints, 1);
    Service1.setBackgroundColor(Color.CYAN);
    PublisherList.add(Service1);

    Endpoints = new ArrayList<Pair>();
    Endpoints.add(new Pair("CityByZip", "Double"));
    USZipService Service2 =
        new USZipService("USZip", "City by Zip Service", "Atomic", Endpoints, 1);
    Service2.setBackgroundColor(Color.CYAN);
    PublisherList.add(Service2);

    Endpoints = new ArrayList<Pair>();
    Endpoints.add(new Pair("ResortByCity", "String"));
    ResortService Service3 =
        new ResortService("Resort", "Resort by City Service", "Atomic", Endpoints, 1);
    Service3.setBackgroundColor(Color.CYAN);
    PublisherList.add(Service3);
  }