How to simulate a "target day" in UML Classdiagrams

I want to describe the following situation in a UML Classdiagram:

The day the newspaper is sent to the client. This day could be. for example, "every Friday" or "every first day of the month."

My idea is to introduce this in a UML Classdiagram:

-targetDay:Integer
-targetDayGrid:Enumeration

targetDay will be sth. for example, “1” (Monday) or “5” (Friday), or it can be “1” on the first day of the month or “10” on the 10th of the month.

targetDayGrid is an enumeration: weekly, monthly.

Thus, the enumeration sets the semantic value of the number in targetDay. I am not happy with this, do you know any other solution to represent my problem? Or do you think my decision is ok?

+3
source share
3 answers

, , . , , . ( , ...). , . , , , , ( , , Date , ). , , - ( , ...).

+1

-, ,

public enum Day_Of_Week{ SUN, MON, TUE, WED, THU, FRI, SAT }

public enum Day_Of_Month{ 1, 2, .. , 31 }

- > 7 targetDay " "

+1

This may seem a little redundant, but I think you need three more classes: TargetDay, which will be an abstract class (or interface), WeeklyTargetDay, and MonthlyTargetDate, which will provide different implementations of TargetDay alt text http://www.freeimagehosting.net/uploads /a5c029bedd.png

+1
source

Source: https://habr.com/ru/post/1738011/


All Articles