id stringlengths 36 36 | text stringlengths 1 1.25M |
|---|---|
6d0f47f0-f45b-4aef-afb5-ac3e979e0ec2 | public void allocateBatch(Batch b, Server s){
//1. get info about every job in a batch
for (Object o : b.getJobs()){
((Job) o).getComplexity();
((Job) o).getPriority();
}
//2. get information about every cpu in the server
for (Object o : s.getCpuList()){
((CPU) o).getTemp();
((CPU) o).getTotalPri... |
3d7cb837-0c20-4657-833f-fe847b5b79c7 | public void generateHeat(){
ts.generateHeat(this.getServer());
} |
5ebdb82e-2362-4706-99fd-52d255c8ba50 | public String toString(){
String tempString="";
tempString +="\n\n***DATA OBJECT***";
tempString +="\nThis data object has a batchsize of : "+batch.getJobs().size();
return tempString;
} |
cff040b9-b291-470c-8261-4bd3f9215807 | Batch(){
this.setId(counter);
this.setTimestamp(new Date().getTime());
double tempDouble = 0;
double tempDoubleTwo = 0;
tempDouble = 0;
tempDoubleTwo = 0;
counter++;
} |
606ac134-62d5-4b6c-b699-4d6b7e9e8475 | public ArrayList<Job> getJobs() {
return jobs;
} |
63bfbe85-c99e-410e-b1c8-0be9d07b3445 | public void setJobs(ArrayList<Job> jobs) {
this.jobs = jobs;
} |
d4aaaea4-6a04-4aeb-b67f-d26e049fd78d | public long getTimestamp() {
return timestamp;
} |
b838e3eb-4767-40a8-8374-d311e3fab31f | public void setTimestamp(long timestamp) {
this.timestamp = timestamp;
} |
26817e87-cf22-444a-86aa-65e3bf86e9c3 | public int getId() {
return id;
} |
8d6d511e-1690-499c-9879-5f599765189e | public void setId(int id) {
this.id = id;
} |
7d9a0cb8-b9e2-4882-959e-7d8bb0c68c7e | public double getTotalPower() {
return totalPower;
} |
ef4d51b0-5445-4e5b-a82b-9feea8ae97a6 | public void setTotalPower(double tempDouble) {
this.totalPower = tempDouble;
} |
49c43702-6ded-45c2-ad69-cbcb460da973 | public double getTotalPriority() {
return totalPriority;
} |
05b65f3a-3d8b-477c-bd6a-19a9f31813e1 | public void setTotalPriority(double totalPriority) {
this.totalPriority = totalPriority;
} |
d2e127bb-c9b8-4843-9231-6564bf4051d2 | public String toString(){
String tempString="";
tempString +="\n\n***BATCH OBJECT***";
tempString +="\nID: "+this.getId();
tempString +="\nCurrent Jobs: ";
for (Object o : this.getJobs()){
tempString +="\n"+o;
}
return tempString;
} |
19c29c08-a332-4da3-9e9f-eb7c773e05bd | protected void setUp() throws Exception {
super.setUp();
thermalControl = new ThermalControl();
thermalMap = thermalControl.newThermalMap();
server = new Server();
} |
56ddd39f-1e68-4e65-a687-89808e52d242 | protected void tearDown() throws Exception {
super.tearDown();
thermalControl = new ThermalControl();
thermalMap = thermalControl.newThermalMap();
server = new Server();
} |
ccdb2e9a-72cb-4e6d-a7da-8a6dc60dfc85 | @Test
public void testRankThermalMap(){
thermalMap = thermalControl.rankThermalMap(thermalMap);
Integer previous =null;
Iterator it = thermalMap.entrySet().iterator();
while (it.hasNext()) {
Map.Entry entry = (Map.Entry)it.next();
Assert.assertNotNull( entry.getV... |
6fd74b31-bf6c-492f-9b15-664b48c9beef | public CPU(int id){
this.setId(id);
} |
a7a8c963-c84d-4b88-be8b-87c5875dffcb | public double getTemp() {
return temp;
} |
742302e4-71a1-4b39-bbb8-eb514ccee452 | public void setTemp(double tempCoefficient) {
this.temp = tempCoefficient;
} |
f9a5579e-5c88-41f5-ba75-f7dbb6526cb5 | public ArrayList<Job> getJobs() {
return jobs;
} |
5022529f-fd47-44f1-8cc7-dbdf4586fca1 | public void setJobs(ArrayList<Job> currentJobs) {
this.jobs = currentJobs;
} |
3c91e666-258f-472c-ab11-a3576f54e735 | public double getPercentageUsed() {
//some relationship between complexity and power in here
return percentageUsed;
} |
4ea3cdaf-a041-4731-976c-0f9c736e1ca4 | public void setPercentageUsed(double tempDouble) {
//some relationship between complexity and power in here
this.percentageUsed = tempDouble;
} |
dd5eb453-5216-4f61-a3f1-9fc3dbc0fbe9 | public double getTotalPriority() {
return totalPriority;
} |
88dea0c0-86bb-4c4c-a568-910cd4e087e3 | public void setTotalPriority(double totalPriority) {
this.totalPriority = totalPriority;
} |
6a617fe6-a6ce-4e39-8ce5-2a399279a85f | public int getId() {
return id;
} |
5a2d5f89-4a9b-4620-8f19-1896f6289354 | public void setId(int id) {
this.id = id;
} |
5928e496-246a-4770-a94f-4c5a8f4647aa | public String toString(){
String tempString="";
tempString +="\n\n***CPU OBJECT***";
tempString +="\nCurrent Jobs: ";
for (Object o : this.getJobs()){
tempString +="\n"+o;
}
return tempString;
} |
3b25b773-426e-42aa-8baf-ca46321959a2 | Server(){
CPU tempCpu;
for (int i=0;i<config.TOTAL_CPUs;i++){
tempCpu = new CPU(i);
cpuList.add(tempCpu);
}
} |
d3424332-7613-4c73-84b0-fd0c7df417bc | public ArrayList<CPU> getCpuList() {
return cpuList;
} |
104cf2f8-e6ad-424d-b393-01046835b9b7 | public CPU getCpuById(int j) {
for (int i=0;i<config.TOTAL_CPUs;i++){
if(this.getCpuList().get(i).getId()==j){
return this.getCpuList().get(i);
}
else{
System.out.println("error getCpuById");
}
}
return null;
} |
2f877c53-52ce-4ddb-8d53-7d501e720116 | public void setCpuList(ArrayList<CPU> cpuList) {
this.cpuList = cpuList;
} |
d2159227-d4fb-4a02-9231-baf570c72027 | public String toString(){
String tempString="";
tempString +="\n\n***SERVER OBJECT***";
tempString +="\nThis Server object contains: "+this.getCpuList().size()+" servers";
return tempString;
} |
5840a58c-36c2-4efa-bae8-3047f5c80d49 | public int[] getCracInfo() {
return cracInfo;
} |
d0a5d71c-0501-447c-bdbd-6b02922b01f9 | public void setCracInfo(int[] cracInfo) {
this.cracInfo = cracInfo;
} |
32806183-d334-4870-a317-d7ec7650f1e1 | public int getCurrentTempSetting() {
return currentTempSetting;
} |
587c5602-cbc5-4aa5-b1ce-70db00c35060 | public void setCurrentTempSetting(int currentTempSetting) {
this.currentTempSetting = currentTempSetting;
} |
b3a7a888-0a60-4a62-8c93-c1202e5abba1 | public int updateRequiredCracTemp(int rct){//basically a setter but left in for completeness
return rct;
} |
46d10ae3-10a6-4a21-b83a-f5fc263fafef | Utils(){} |
6435e49d-1a8f-4ca2-80de-fc385a8b7fd8 | public void createJsonFile(String fileName, int noJobs){
PrintWriter writer;
try {
writer = new PrintWriter("file/"+fileName+".json", "UTF-8");
writer.println("[");
for (int i=0; i<noJobs; i++){
writer.println("{\"priority\":\""+0 + (int)(Math.random() * ((9 - 0) + 1))+"\",\"complexity\":\""+0 + (int)(... |
a68ec8c2-9e2c-4062-8eb5-b259f951f999 | public static void main(String[]args){
/*******************************
CREATE RANDOM JOBS.json file
NB:clean and refresh the project after using
*******************************
Utils u = new Utils(){};
u.createJsonFile("newfile", 20);//select a new Filename, no need for extension...
/*****************... |
c6158ed6-c635-4f99-b580-83b1c5b55e3b | @Override
public void run() {
/********************************
EVERYTHING IN HAPPENS ONCE PER EPOCH BUT ISN'T TIMED...
*********************************/
dc.generateHeat();
/********************************
^^^TIMING ENDS HERE...
*********************************/
final Exe... |
5e238a33-32f7-4e2c-9b0e-abbe710f1151 | @Override
public String call() throws Exception {
/********************************
EVERYTHING IN HERE IS TIMED...
*********************************/
//Thread.sleep(EPOCH+10000); //simulate our program running for too long...
//send some of jobQueue to batch
dc.addToBatch(conf... |
9af9fc40-b8db-472d-a6f6-9f10a5b16469 | public void generateHeat(Server s){
for (int i=0;i<config.TOTAL_CPUs;i++){
double tempCoefficient = 1;
double currentTemp = s.getCpuById(i).getTemp();
if (currentTemp==0){
currentTemp=40;
}
if (i<100){tempCoefficient=0.7;}
else if (i<200){tempCoefficient=0.9;}
else if (i<300){tempCoefficient=... |
772b67d6-c3dc-42d0-b42c-e3434a31bbb4 | public double getRandomNo(){
Random r = new Random();
double rangeMax = 1.2;
double rangeMin = 0.8;
double randomValue = rangeMin + (rangeMax - rangeMin) * r.nextDouble();
return randomValue;
} |
d300f3b3-6a17-461c-b2a4-08fc434865d5 | public double cracInletTemp(){
Double temp=0.0;
for (CPU c : s.getCpuList()){
temp += c.getTemp();
}
return temp/400;
} |
1a5bd542-ec9e-45ce-adf2-b4a4085fd384 | public int[][] getThermalMap() {
return thermalMap;
} |
abef4a68-40b8-4418-93f9-41418e8ac9e0 | public void setThermalMap(int[][] thermalMap) {
this.thermalMap = thermalMap;
} |
b22bdc83-edf1-4a90-b1d2-2d10eb4d4baa | public MySQLCon(Reporter plugin, String username, String password, String url) {
this.reporter = plugin;
this.user = username;
this.pass = password;
this.url = url;
reporter.log(1, "URL: " + url);
} |
f45c7c8e-1aee-4158-acc9-730109182d5b | public Connection getConn() {
if (conn != null) {
reporter.log(1, "Returned conn");
return conn;
}
try {
conn = DriverManager.getConnection(url, user, pass);
reporter.log(1, "Reconnected");
return conn;
} catch (SQLException e) ... |
0c10145f-bd68-46d5-b77a-9134b891eab7 | public void closeConn() {
if (conn != null) {
try {
conn.close();
conn = null;
} catch (SQLException ex) {
reporter.getLogger().log(Level.WARNING, "Couldn't connect to MySQL: " + ex.getMessage());
}
}
} |
15169a66-182b-40c4-8b6e-574ba581a46e | public Report(Reporter plugin, MySQLCon sql, int id) {
this.reporter = plugin;
this.id = id;
this.sql = sql;
getInfoById();
} |
24b90bba-3502-4339-977e-a28baebcc1e6 | public Report(Reporter plugin, MySQLCon sql, String sender, String reported, World w, int x, int y, int z, String reason, boolean status, String result, String resolver) {
this.reporter = plugin;
this.sql = sql;
this.sender = sender;
this.reported = reported;
this.w = w;
... |
4aa24af5-6d50-456f-a3dc-165c7f6aa194 | public Report(Reporter plugin, MySQLCon sql, int id, String sender, String reported, World w, int x, int y, int z, String reason, boolean status, String result, String resolver) {
this.reporter = plugin;
this.sql = sql;
this.id = id;
this.sender = sender;
this.reported = reported... |
70af9298-0428-4dd3-9bc6-15ad5482a999 | public String getResolver() {
return resolver;
} |
3e4a05f7-1158-47fb-9e35-cee45ef11427 | public void setResolver(String resolver) {
this.resolver = resolver;
} |
4950e139-7658-4d4d-aaa7-bbbdeae58294 | public boolean isResolved() {
return resolved;
} |
e1906480-2866-4aa7-9fd7-4c91cc869139 | public void setResolved(boolean resolved) {
this.resolved = resolved;
} |
4b9d1360-10b9-4576-a187-f9953cf9614e | public String getResult() {
return result;
} |
8fc612d2-097e-4adc-ac1d-6d2d56bc0253 | public void setResult(String result) {
this.result = result;
} |
9083a145-1860-40e6-b5f3-d1d7e6c7e2da | public String getSender() {
return sender;
} |
e322ea7a-a4a8-47a0-828e-e73308cfdb78 | public String getReported() {
return reported;
} |
0f7164fa-b744-4566-9446-6b96f45c0e08 | public int getId() {
return id;
} |
91af5a84-3929-46e8-848c-4dfc3fef4b25 | public String getReason() {
return reason;
} |
86086217-0425-421c-82e8-2be0061e4bab | public int getX() {
return x;
} |
3fb55294-e43e-4b63-8c05-76aa1cfdb67c | public int getY() {
return y;
} |
4f2d36ae-b7fc-4be2-81d0-b40cacca09d9 | public int getZ() {
return z;
} |
2625d9e8-7796-4e7d-9911-2100b318d3db | public World getW() {
return w;
} |
1278d370-7cc3-4661-9bc4-1dff890cad99 | public void getInfoById() {
try {
Statement s = sql.getConn().createStatement();
ResultSet rs = s.executeQuery("SELECT `sender`, `reported`, `worldname`, `x`, `y`, `z`, `reason`, `resolved`, `result`, `resolver` FROM `" + reporter.config.getString("MySQL.table") + "` WHERE `id`=" + id + ... |
2173494a-e18e-4ef9-a96c-4ffc6877a4c3 | public void insertReport() {
try {
Statement s = sql.getConn().createStatement();
s.execute("INSERT INTO `reporter`(`sender`, `reported`, `worldname`, `x`, `y`, `z`, `reason`, `resolved`, `result`, `resolver`) VALUES ('" + sender + "','" + reported + "','" + w.getName() + "','" + x + "',... |
60b8f508-6a22-4b6f-ba98-df10110a786a | public void updateStatus() {
try {
Statement s = sql.getConn().createStatement();
s.executeUpdate("UPDATE `" + reporter.config.getString("MySQL.table") + "` SET `resolved`=" + resolved + ",`result`='" + result + "',`resolver`='" + resolver + "' WHERE `id`='" + id + "';");
rep... |
9ad1a5c0-a412-4d07-83e5-918563b2bdc4 | @Override
public void onEnable() {
config = getConfig();
genConfig();
sql = new MySQLCon(this, config.getString("MySQL.username"), config.getString("MySQL.password"), "jdbc:mysql://" + config.getString("MySQL.url.host") + ":" + config.getInt("MySQL.url.port") + "/" + config.getString("MySQL... |
a4c65912-130e-4cd5-bdf1-bc9c1a32708f | @Override
public void onDisable() {
sql.closeConn();
} |
85bc51ce-0c4d-44ab-8b35-47fe0aa08f4d | private void genConfig() {
config.addDefault("MySQL.username", "root");
config.addDefault("MySQL.password", "123");
config.addDefault("MySQL.table", "reporter");
config.addDefault("MySQL.url.host", "localhost");
config.addDefault("MySQL.url.port", 3306);
config.addDefault... |
1b3ed066-4337-4308-86fb-a7f4a2bf2535 | public String getLang(String lang) {
return config.getString(lang).replaceAll("&", "§");
} |
984f6cc7-2fc3-4887-9d45-bf38694a13d3 | public void log(int i, String msg) {
switch (i) {
case 0:
getLogger().log(Level.INFO, msg);
break;
case 1:
if (config.getBoolean("Config.debug")) {
getLogger().log(Level.OFF, "DEBUG: " + msg);
}
... |
63afca14-43e3-4244-a572-41f3d8c676ea | public String combineSplit(int startIndex, String[] args) {
StringBuilder builder = new StringBuilder();
if (args.length >= 1) {
for (int i = startIndex; i < args.length; i++) {
builder.append(args[i]);
builder.append(" ");
}
if (build... |
76febce0-acbc-4453-993f-0679cbac497c | private void createTable() {
try {
log(0, "Creating MySQL Table if not exists...");
Statement s = sql.getConn().createStatement();
s.execute("CREATE TABLE IF NOT EXISTS `" + config.getString("MySQL.table") + "` (`id` int(11) NOT NULL AUTO_INCREMENT, `sender` varchar(32) NOT N... |
bfb39f9b-c0db-4f25-8caf-991315991702 | private void loadReports() {
try {
Statement s = sql.getConn().createStatement();
ResultSet rs = s.executeQuery("SELECT `id`, `sender`, `reported`, `worldname`, `x`, `y`, `z`, `reason` FROM `" + config.getString("MySQL.table") + "` WHERE `resolved`=FALSE LIMIT 30;"); // will only load no... |
c545200e-63c1-44eb-bacb-e8add00c689e | public void reloadReports() {
reports.clear();
loadReports();
} |
3986b200-c213-4f76-abdd-52fd5c18d9a7 | public ReporterExecutor(Reporter plugin, MySQLCon sql) {
this.reporter = plugin;
this.sql = sql;
} |
cd1f1aff-5157-49d8-acfa-c59053d4a4ff | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length < 1) {
return false;
} else {
if (args[0].equalsIgnoreCase("list")) {
if (sender.hasPermission("reporter.list")) {
if (repo... |
42320770-bfe2-44bd-b338-233ec2a1dc47 | public ReportExecutor(Reporter plugin, MySQLCon sql) {
this.reporter = plugin;
this.sql = sql;
} |
cd98cbf4-94d5-44e7-bdde-0ea15268e40c | @Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args.length < 1) { // just /report
return false;
} else {
if (args[0].equalsIgnoreCase("help")) {
sender.sendMessage(ChatColor.YELLOW + "Report'em all Plu... |
7cdd5d90-836e-4a96-aab8-e8fb365cce3f | public RemoveFromListTask(ReportExecutor rex, Player p) {
this.r = rex;
this.p = p;
} |
4b1a53a9-b397-464c-8285-228915d8e2be | @Override
public void run() {
if (r.alreadyReport.contains(p)) {
r.alreadyReport.remove(p);
}
} |
b4f7fb10-08ed-44fc-9baa-c204553dfb67 | @Autowired
public void configureGlobal(AuthenticationManagerBuilder auth)
throws Exception {
auth.inMemoryAuthentication().
withUser("dinger").password("123456").roles("ANONYMOUS").and().
withUser("dingeruser").password("123456").roles("USER").and().
withUser("dingeradmin").password("123456").roles("USER", ... |
a6982ba0-59ea-4160-9d3c-00582d5bc10b | @Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/user/**")
.access("hasRole('ROLE_USER')").and().formLogin();
http.authorizeRequests().antMatchers("/admin/**")
.access("hasRole('ROLE_ADMIN')").and().formLogin();
http.authorizeRequests().an... |
94068b72-8571-43bc-9910-3a2f4d64904c | @Bean
public UrlBasedViewResolver setupViewResolver() {
UrlBasedViewResolver resolver = new UrlBasedViewResolver();
resolver.setPrefix("/WEB-INF/");
resolver.setSuffix(".jsp");
resolver.setViewClass(JstlView.class);
return resolver;
} |
f1aa3bb4-00e1-4951-b19d-ec039f4111c1 | @Override
protected Class<?>[] getRootConfigClasses() {
return new Class[] { WebConfig.class };
} |
a1a89e54-bc7e-4aa2-bbd9-ef0dd84c9678 | @Override
protected Class<?>[] getServletConfigClasses() {
return null;
} |
87bf0f3d-7fb1-48cd-90d7-de3f8fb805f3 | @Override
protected String[] getServletMappings() {
return new String[] { "/" };
} |
51880d2f-a706-48a9-9daf-112de8cb9468 | @RequestMapping(value ={"/"}, method = RequestMethod.GET)
public String showHome(Model m) {
m.addAttribute("name", "Hello Anonymous");
return "welcome";
} |
4071e446-5b40-48fe-b296-45e61d179bf0 | @RequestMapping(value ={"/user**"}, method = RequestMethod.GET)
public String showHomeUser(Model m) {
m.addAttribute("name", "Hello User");
return "user/helloUser";
} |
d67ff0ec-fd65-4320-8398-7883d7f7c3b9 | @RequestMapping(value ={"/admin**"}, method = RequestMethod.GET)
public String showHomeAdmin(Model m) {
m.addAttribute("name", "Hello Admin");
return "/admin/helloAdmin";
} |
73f9f360-f281-45a3-a88c-4fba9a62f0e8 | public SmoothGMM(int numberOfComponents) {
super(numberOfComponents);
prev_w = new double[k];
Arrays.fill(prev_w, 0.0);
prev_m = new double[k];
for (int i = 0; i < k; i ++) {
prev_m[i] = ((double)i) - ((double)k)/2.0;
}
prev_v = new double[k];
Arrays.fill(prev_v, 0.0);
} |
adcbd5ef-1f8c-43ec-bb95-3b3c51ea2429 | @Override
public Map<String,String> parseParameters(String params) {
Map<String,String> p = super.parseParameters(params);
if (p.containsKey("alpha")) {
alpha = Double.parseDouble(p.get("alpha"));
} else {
throw new RuntimeException("Parameter alpha=someDouble is mandatory for mixture mode... |
221e60b5-c26e-4fae-9519-eacd3df58601 | @Override
public void update(double x) {
super.update(x);
// M-step updte occured
if (c == 0) {
for (int i = 0; i < k; i ++) {
// weights
w[i] = (1.0 - alpha) * prev_w[i] + alpha * w[i];
prev_w[i] = w[i];
m[i] = (1.0 - alpha) * prev_m[i] + alpha * m[i];
p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.