no message
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -7,10 +7,7 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/MainModule_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/MainModule_.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils_.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/MainModule.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -17,14 +17,59 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
//--
|
||||
D db;
|
||||
Class<D> db_class;
|
||||
//--
|
||||
LinkedHashMap<PassCode_, Pass> passes;
|
||||
LinkedHashMap<Current_, Object> objects; //Current
|
||||
//--
|
||||
LinkedHashMap<PassCode_, Pass> passes;
|
||||
//--
|
||||
public MainModule_(Class<D> db_class_in) {
|
||||
objects = new LinkedHashMap<>();
|
||||
createPasses();
|
||||
try {
|
||||
db_class = db_class_in;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//---
|
||||
object = this;
|
||||
System.out.println("main module created");
|
||||
}
|
||||
//БАЗА ДАННЫХ И ТЕКУЩИЕ ОБЪЕКТЫ
|
||||
public D getDb() {
|
||||
return db;
|
||||
}
|
||||
//---
|
||||
public void ActivateDB() throws Exception {
|
||||
db = db_class.newInstance();
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
}
|
||||
public void DeactivateDB() throws Exception{
|
||||
if (db != null) db.Disconnect();
|
||||
}
|
||||
public Object get(Current_ name) {
|
||||
if (!objects.containsKey(name))
|
||||
objects.put(name,null);
|
||||
return objects.get(name);
|
||||
}
|
||||
public Object set(Current_ name, Object object) {
|
||||
if (objects.containsKey(name))
|
||||
objects.replace(name, object);
|
||||
else objects.put(name, object);
|
||||
return object;
|
||||
}
|
||||
public boolean Check(TextLog Log, Current_... names) {
|
||||
for (Current_ name : names)
|
||||
if (get(name) == null)
|
||||
Log.Writeln_(name.getDescription() + " не выбран(а)");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
public boolean matchCurrentID(Current_ name, int id) {
|
||||
return (get(name) != null) && (((iDBObject) get(name)).id == id);
|
||||
}
|
||||
//ПРОХОДЫ
|
||||
public abstract Class getPassCodesEnum();
|
||||
public abstract String getAllPassesClassPrefix();
|
||||
private void createPasses(){
|
||||
passes= new LinkedHashMap<>();
|
||||
for (Object code: getPassCodesEnum().getEnumConstants()){
|
||||
@@ -53,54 +98,6 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
public String getPassDescription(String passName){
|
||||
return ((PassCode_)Enum.valueOf(MainModule_.object.getPassCodesEnum(), passName)).getDescription();
|
||||
}
|
||||
//---
|
||||
public MainModule_(Class<D> db_class_in) {
|
||||
objects = new LinkedHashMap<>();
|
||||
createPasses();
|
||||
try {
|
||||
db_class = db_class_in;
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
//---
|
||||
object = this;
|
||||
System.out.println("main module created");
|
||||
}
|
||||
public abstract Class getPassCodesEnum();
|
||||
public abstract String getAllPassesClassPrefix();
|
||||
public void ActivateDB() throws Exception {
|
||||
db = db_class.newInstance();
|
||||
db.Connect();
|
||||
db.CreateAllTables();
|
||||
db.prepareTablesStatements();
|
||||
db.Synchronize();
|
||||
}
|
||||
public void DeactivateDB() throws Exception{
|
||||
if (db != null) db.Disconnect();
|
||||
}
|
||||
//--
|
||||
public Object get(Current_ name) {
|
||||
if (!objects.containsKey(name))
|
||||
objects.put(name,null);
|
||||
return objects.get(name);
|
||||
}
|
||||
public Object set(Current_ name, Object object) {
|
||||
if (objects.containsKey(name))
|
||||
objects.replace(name, object);
|
||||
else objects.put(name, object);
|
||||
return object;
|
||||
}
|
||||
public boolean Check(TextLog Log, Current_... names) {
|
||||
for (Current_ name : names)
|
||||
if (get(name) == null)
|
||||
Log.Writeln_(name.getDescription() + " не выбран(а)");
|
||||
return Log.isEmpty();
|
||||
}
|
||||
//применять только для наследников iDBObject
|
||||
public boolean matchCurrentID(Current_ name, int id) {
|
||||
return (get(name) != null) && (((iDBObject) get(name)).id == id);
|
||||
}
|
||||
|
||||
public Vector<Pass> getFirstAccessPasses(){
|
||||
Vector<PassStats> sortedStats = new Vector<>(getDb().passStats.Data.values());
|
||||
sortedStats.sort(new Comparator<PassStats>() {
|
||||
@@ -116,4 +113,5 @@ public abstract class MainModule_<D extends VisualiserDatabase> {
|
||||
}
|
||||
return res;
|
||||
}
|
||||
//---
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user