50 lines
1.2 KiB
Java
50 lines
1.2 KiB
Java
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
public class Plans {
|
|
public HashMap<String[], MyDate> plans;
|
|
|
|
public Plans(){
|
|
plans = new HashMap<>();
|
|
}
|
|
|
|
public Boolean Write(String[] str){
|
|
if (str == null){
|
|
return false;
|
|
}
|
|
MyDate myDate = new MyDate();
|
|
plans.put(str, myDate);
|
|
return true;
|
|
}
|
|
|
|
public void Read(){
|
|
for (Map.Entry<String[], MyDate> entry : plans.entrySet()){
|
|
ReadDate(entry.getValue());
|
|
for (int i = 0; i < entry.getKey().length; i++) {
|
|
if (entry.getKey()[i] != null) {
|
|
System.out.print(entry.getKey()[i] + " ");
|
|
}
|
|
else
|
|
break;
|
|
}
|
|
System.out.println();
|
|
}
|
|
}
|
|
|
|
public void ReadDate(MyDate date){
|
|
System.out.print(date.Year + "-");
|
|
if (date.Month < 10){
|
|
System.out.print("0" + date.Month + "-");
|
|
}
|
|
else {
|
|
System.out.print(date.Month + "-");
|
|
}
|
|
if (date.Day < 10){
|
|
System.out.print("0" + date.Day + " ");
|
|
}
|
|
else {
|
|
System.out.print(date.Day + " ");
|
|
}
|
|
}
|
|
}
|