продолжение рефакторинга. создал предка для класса current
This commit is contained in:
30
src/Common/CurrentAnchestor.java
Normal file
30
src/Common/CurrentAnchestor.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package Common;
|
||||
import Common.Utils.TextLog;
|
||||
import Common_old.Current;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public interface CurrentAnchestor {
|
||||
//-
|
||||
LinkedHashMap<CurrentAnchestor, Object> objects = new LinkedHashMap<>();
|
||||
static Object get(CurrentAnchestor name) {
|
||||
if (!objects.containsKey(name))
|
||||
objects.put(name,null);
|
||||
return objects.get(name);
|
||||
}
|
||||
static Object set(CurrentAnchestor name, Object object) {
|
||||
if (objects.containsKey(name))
|
||||
objects.replace(name, object);
|
||||
else objects.put(name, object);
|
||||
return object;
|
||||
}
|
||||
default String getDescription(){
|
||||
return "?";
|
||||
}
|
||||
static boolean Check(TextLog Log, CurrentAnchestor... names) {
|
||||
for (CurrentAnchestor name : names)
|
||||
if (CurrentAnchestor.get(name) == null)
|
||||
Log.Writeln_(name.getDescription() + " не выбран(а)");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user