刚刚开始学  还是很不懂请教一个题目  Suppose that an environmental monitoring station contains three sensors, namely a thermometer, a rain gauge and a humidity reader. In addition, there is an output device, known as a printer, on which the readings from these three sensors are shown. Readings are taken and transcribed onto the printer every five minutes. this process is known as 'taking a checkpoint'
a. draw an object diagram shwoing a plausible configuration for these objects, and include on the diagram the messages that might be generated in the system every time a checkpoint is taken. assume that a checkpoint is initiated by a message sent from a timer object to the monitoring station.
b. does your diagram clearly show the order in which messages are sent? if not, how might this be shown?
c. draw a class diagram summarizing the structure of the monitoring station.我知道题目很简单的挖  有谁可以给图啊?  谢谢啊

解决方案 »

  1.   

    假设一个环境监测站包含三个传感器,即一个温度计,雨量计和一个湿度读者。此外,还有一个输出设备,如打印机,上这3个传感器的读数显示已知的。读数采取和转录到打印机每五分钟。这一过程被称为'到一个检查点'
    a 画一个图shwoing对象为这些对象的合理配置,并在图中的可能在系统每次生成的邮件包含一个检查站采取。假定一个检查点开始站的监测由一个消息发送到一个计时器对象。
    b 你的图清楚地显示在哪些邮件发送顺序?如果不是,如何会这样显示?
    c 画一个类图总结了监测车站结构。翻译软件还是很好用的
      

  2.   


    学习了。
    貌似缺少一个message对象,包含3个sensor的读数以及 message_no???不知道怎么叫,它这里貌似要求每次读数的顺序。
    does your diagram clearly show the order in which messages are sent? if not, how might this be shown?不知道说的对不对,不大懂UML。
      

  3.   


    有道理  message也应该是一个对象  我再看看  怪不得我总觉得少了什么
      

  4.   

    这个貌似是观察者模式的应用将观察者添加完成后就可以定时从其pull消息,在getMessage中通过获得注册的各sensor对象获得信息
      

  5.   

    修改:
    a. draw an object diagram shwoing a plausible configuration for these objects, and include on the diagram the messages that might be generated in the system every time a checkpoint is taken. assume that a checkpoint is initiated by a message sent from a timer object to the monitoring station.reply:这里通过控制定时调用measurementsChanged方法(其方法通过getters来获取各气象监控信息,事先由传感器注入),来控制事件通知的频度
    b. does your diagram clearly show the order in which messages are sent? if not, how might this be shown?reply:消息发送的顺序可以人为固定,等三个传感器数据都到了MonitoringStation之后,集中定时通知Observers,通过分别调用各Observer的update方法并连带display,Pinter中一些相应域数据忘写了c. draw a class diagram summarizing the structure of the monitoring station.reply: as upper pic has shown