use of nl.uva.cs.lobcder.optimization.Vertex in project lobcder by skoulouzis.
the class RandomPredictor method getNextState.
@Override
public Vertex getNextState(Vertex currentState) {
String resource;
Method method;
try {
switch(type) {
case state:
resource = getRandomResource();
method = getRandomMethod();
break;
case resource:
resource = getRandomResource();
method = null;
break;
case method:
resource = null;
method = getRandomMethod();
break;
default:
resource = getRandomResource();
method = getRandomMethod();
break;
}
return new Vertex(method, resource);
} catch (SQLException ex) {
Logger.getLogger(RandomPredictor.class.getName()).log(Level.SEVERE, null, ex);
}
return null;
}
use of nl.uva.cs.lobcder.optimization.Vertex in project lobcder by skoulouzis.
the class RecentPopularity method getPopularState.
private Vertex getPopularState(List<Vertex> listOfKSuccessors) {
int count = 1, tempCount;
Vertex popular = listOfKSuccessors.get(0);
Vertex temp;
for (int i = 0; i < (listOfKSuccessors.size() - 1); i++) {
temp = listOfKSuccessors.get(i);
tempCount = 0;
for (int j = 1; j < listOfKSuccessors.size(); j++) {
if (temp.getID().equals(listOfKSuccessors.get(j).getID())) {
tempCount++;
}
}
if (tempCount > count) {
popular = temp;
count = tempCount;
}
}
if (count >= j) {
return popular;
} else {
return null;
}
}
Aggregations