Object-Oriented Course Second Summary

---Restore content begins---

  The three assignments in April were all about multi-threading. From the beginning, I didn’t understand anything, and then I slowly understood and mastered it. There were many problems in the process, but I finally gained something.

Fifth assignment:

  1. Job introduction

  The fifth operation is in the same line as the previous operation, adding the requirement for multiple elevators to work together, and assigning tasks to elevator threads according to certain requirements.

  2. Design concept

  The job has clearly required the use of multithreading. After preliminary learning, after constructing the elevator class, construct three elevator objects, corresponding to three threads, to simulate the movement of three elevators. The request class acts as a request to obtain input. In addition, the command class implements the formatting of each request and implements the processing method of the command; the scheduler class is responsible for judging whether it is homogeneous, piggybacking, and assigning to which elevator as required carry.

  However, due to insufficient understanding of multi-threading, inexplicable bugs appeared, and the elevator's loading was disordered, which was ultimately invalid, and will not be analyzed this time.


 

Sixth homework:

  1. Job introduction

  This job is an IFTTT job and requires monitoring of a file or all files in a directory. As long as the monitoring object is renamed, the path is modified, the last modification time is changed, or the file path is modified, etc., the trigger corresponding task must be triggered. ——Accumulate the number of triggers, or record the modification.

  2. Design concept

  In this job, whenever the input generates a monitoring task, a monitoring thread is generated. As long as the corresponding modification of the file is triggered, the monitor will respond. When the file resource is competed, conflicts between threads will occur, so thread-safe file operation classes are used to solve this problem.

  3. Program class diagram

  

 

  4. Metric analysis

 

 

  5. Bug analysis

  The problem with this assignment is that if there is no judgment on the renamed files in the directory, this is a negligence in the design, and the other party can only judge whether the input is correct or not.


 

The seventh homework

  1. Job introduction

  This job is to simulate a taxi-hailing system. Arrange 100 taxis in the given bitmap and respond correctly to incoming taxi requests.

  2. Design concept

  First create the corresponding taxi, passenger request class (the map has been reflected in the given package, simplifying the operation), the taxi class needs to correspond to the location, credit, status, and detailed information of the corresponding status; passenger request The class needs to request the time, place, and destination of the request, and because the request is processed, the taxi will not change, so the process information of each processing request needs to be stored in the request command, such as grabbing Information about a single vehicle and information about a single vehicle dispatched.

  3. Class diagram

  

  

4. Metric analysis

  

  

5. Bug analysis

  The problem with this job is that the time is not exactly 200ms, which needs to be solved, the other party's regular expression is wrong, and the 200ms requirement has not been achieved, and the wait is not every 20s.

---End of recovery content---

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325128147&siteId=291194637