Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.