Reputation: 41
I have to convert the following Java code to a UML diagram, however I'm not sure whether I have done the associations between the classes correctly. Please you advise me whether or not the UML diagram is correct.
public class Booking {
private String name;
private Time time;
private Table[] tables;
public Booking ( String n, int st, int en, int num ){
}
public int getStart ( ){
return 1;
}
public int getEnd ( ){
return 1;
}
public Table[] getTables ( ){
return new Table[3];
}
public int getBookingSize ( ){
return 1;
}
}
public class Time {
private int startHour;
private int endHour;
public Time ( int st, int en ){
}
public int getStart ( ){
return 1;
}
public int getEnd ( ){
return 1;
}
}
public class Table {
private int number;
private int seats;
public Table ( int num, int sz ){
}
public int getNumber ( ){
return 1;
}
public int getSeats ( ){
return 1;
}
}
public class Restaurant {
private Booking[] bookings;
public void makeBooking ( String n, int st, int en, int s ){
}
public void cancelBooking ( String n ){
}
public Table[] getTables ( String n ){
return new Table[2];
}
public int getStTime (String n) {
return 1;
}
public int getEndTime (String n) {
return 1;
}
}
Upvotes: 2
Views: 9162
Reputation: 1
+------------------+ +--------------------+
| Input Text | | Pre-processing |
| (Plant Symptoms)| | (Tokenization, |
| | | Embedding, etc.) |
+--------+---------+ +--------+-----------+
| |
+--------v-----------+ +--------------------v-------------+
| Language Model | | Convolutional Neural Network |
| (ULM) | | (CNN) for Image Analysis |
| | | |
| +------------+ | | +-------------+ +--------+ |
| | LSTM Layer | | | | Convolution | | Fully | |
| | 1 | | | | Layers | | Connected| |
| +------------+ | | +-------------+ | Layers | |
| | | | | +----------+ |
| +-----v-----+ | | +--------v-------+ |
| | LSTM Layer | | | | Pooling Layer | |
| | 2 | | | | (e.g. Max) | |
| +------------+ | | +------------------+ |
| | | | | |
| +-----v-----+ | | +--------v-------+ |
| | LSTM Layer | | | | Flatten Layer | |
| | 3 | | | +------------------+ |
| +------------+ | | | |
| | | | +--------v-------+ |
| +-----v-----+ | | | Fully Connected | |
| | Output | | | | Layers for | |
| | Layer | | | | Classification | |
| +------------+ | | +------------------+ |
| | | | | |
+----------v----------+ +------------v-----------------------+
| |
+----------v----------+ |
| Softmax Activation | |
| (Output Probabilities)| |
+----------------------+ |
|
+------------v----------------+
| Disease Prediction |
| (e.g. Healthy, |
| Diseased, etc.) |
+--------------------------+
Upvotes: -1
Reputation: 10197
I will ignore methods and attributes, because they are trivial and not interesting (and getters should ideally be omitted).
There are several differences to your diagram:
Restaurant
may not have any bookings at all, so it should be *
, and not 1..*
Booking
needs only one Time
, because Time
already contains the start and endRestaurant
has start and end time. I will assume it's to show opening hours (which is a single instance of a Time
.Booking
on more than one Table
. In your diagram only one was possible.Table
may have many Booking
s. In your diagram it could have only one. (Of course there is run-time constraint that two Booking
s shouldn't book the same Table
within the same Time
period, but that should be expressed in OCL or as a note)period
,openingHours
,...)More notes:
Time
should either contain a single time, or it should be renamed to Period
or TimeInterval
. The current naming is confusing.Time
can be omitted (since they do not have much meaning here).Upvotes: 1