Files
VisualSapfor/src/_VisualDVM/GlobalData/Machine/Machine.java
2024-10-09 22:21:57 +03:00

66 lines
2.2 KiB
Java

package _VisualDVM.GlobalData.Machine;
import Common.Database.Objects.iDBObject;
import Common.Utils.CommonUtils;
import _VisualDVM.GlobalData.Compiler.Compiler;
import _VisualDVM.GlobalData.User.User;
import java.util.LinkedHashMap;
public class Machine extends iDBObject {
public MachineType type = MachineType.Server;
public String name = "";
public String address = "";
public int port = 22;
public Machine(String name_in, String address_in, int port_in, MachineType type_in) {
name = name_in;
address = address_in;
port = port_in;
type = type_in;
}
public Machine() {
}
public String getURL() {
return type.equals(MachineType.Local) ? name : (address + ":" + port);
}
public String getFullDescription() {
return //this.equals(Constants.repository_machine) ? "Репозиторий визуализатора" :
"Машина по адресу " + CommonUtils.Brackets(getURL());
}
public LinkedHashMap<Integer, Compiler> getCompilers() {
return CommonUtils.db.getMapByFKi(this, Compiler.class);
}
public LinkedHashMap<Integer, User> getUsers() {
return CommonUtils.db.getMapByFKi(this, User.class);
}
@Override
public String getDialogName() {
return super.getDialogName() + ":" + getURL();
}
/* инициализация компиляторов по умолчанию. добавить в отдельный проход.
//todo если машина локальная и винда, их не добавлять.
Visualiser.db.Insert(new Compiler(
(Machine)Target,
"gfortran",
CompilerType.gnu,
"gfortran",
"--version",
"--help"
));
Visualiser.db.Insert(new Compiler(
(Machine)Target,
"gcc",
CompilerType.gnu,
"gcc",
"--version",
"--help"
));
Visualiser.db.Insert(new Compiler(
(Machine)Target,
"g++",
CompilerType.gnu,
"g++",
"--version",
"--help"
));
*/
}