Skip to content

Instantly share code, notes, and snippets.

@stoivo
Created February 2, 2017 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stoivo/576176b794b3ac444fab1ff61299bd2c to your computer and use it in GitHub Desktop.
Save stoivo/576176b794b3ac444fab1ff61299bd2c to your computer and use it in GitHub Desktop.
regneklynge.java
public class Regneklynge {
int antNode;
ArrayList<Rack> racks = new ArrayList<Rack>();
public void setInnNode(Node node){
boolean sattInn = false
for (int i = 0; i < racks.length-1; i++) {
if (racks[i].setinNode(node)) {
sattInn = true;
break;
}
}
if (!sattInn) {
Rack newRack = new Rack(this.antNode);
newRack.setInnNode(node);
racks.add(newRack);
}
}
}
public class Rack{
int antNode
Node [] nodes = new Array[antNode];
public Rack (int antNode){
this.antNode = antNode;
Node[] nodes = New Array()
}
public boolean setinNode(Node node){
for (int i = 0; i < this.antNode; i++) {
if (this.nodes[i] == null) {
this.nodes[i] = node;
return true;
}
}
return false;
}
}
public class Node{
private Prosessor pros;
int antMinne;
int antProsesorer;
Node(int antKjerner, float ghz, int antMinne, int antProsesorer){
this.antMinne = antMinne;
this.antProsesorer = antProsesorer;
this.pros = new Prosessor(antKjerner, ghz);
}
public int hentAntMinne(){
return antMinne;
}
public int flops(){
// prosessorer * antall kjerner * ghz
this.antProsesorer * this.pros.hentantKjerner() * this.pros.hentGhz()
}
}
public class Prosessor{
int antKjerner;
float ghz;
public Prosessor(int antKjerner, float ghz){
this.antKjerner = antKjerner;
this.ghz = ghz;
}
public int hentantKjerner() {
return antKjerner;
}
public float hentGhz(){
return ghz;
}
}
// int cores, int ghz, float antMinne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment