-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReminderVisitor.java
More file actions
39 lines (32 loc) · 999 Bytes
/
ReminderVisitor.java
File metadata and controls
39 lines (32 loc) · 999 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package design_patterns;
import java.util.Date;
public class ReminderVisitor extends NodeVisitor {
@Override
public void visitFacade(PTBSFacade facade) {
ProductIterator prdtr=new ProductIterator(facade.theProductList);
if(facade.theProductList!=null&& (!facade.theProductList.isEmpty())) {
System.out.println("Visting each product in the Product list");
while(prdtr.hasNext())
System.out.print(prdtr.Next() +"is visited ");
}
else {
System.out.print("Product List is empty");
}
}
public void visitTrading(Trading trading) {
Date currentDate=new Date();
if(trading.DueDate.after(currentDate)) {
System.out.print("Trading is due");
}
}
@Override
public void visitProduct(Product product) {
Trading trading=new Trading();
if(trading.tradingList!=null&& (!trading.tradingList.isEmpty())) {
System.out.println("Visting each Trading for the given Product");
}
else {
System.out.print("No Trading for the given Product is empty");
}
}
}