use of javolution.util.FastSet in project org.openntf.domino by OpenNTF.
the class MiscTester method run.
@Override
public void run() {
long testStartTime = System.nanoTime();
marktime = System.nanoTime();
try {
ConferenceGraph graph = new ConferenceGraph();
Attendee paul = graph.getAttendee("paulswithers");
Attendee dv = graph.getAttendee("DanieleVistalli");
System.out.println(paul.getEmail());
Iterable<Event> evts = paul.getAttendingEvents();
FastSet<Presentation> presentations = new FastSet<Presentation>();
for (Event evt : evts) {
if (evt instanceof Presentation) {
presentations.add((Presentation) evt);
}
}
System.out.println("Paul is attending " + presentations.size() + " Sessions");
evts = dv.getAttendingEvents();
presentations = new FastSet<Presentation>();
for (Event evt : evts) {
if (evt instanceof Presentation) {
presentations.add((Presentation) evt);
}
}
System.out.println("Paul is attending " + presentations.size() + " Sessions");
evts = paul.getPresentingEvents();
presentations = new FastSet<Presentation>();
for (Event evt : evts) {
if (evt instanceof Presentation) {
presentations.add((Presentation) evt);
}
}
System.out.println("Paul is presenting " + presentations.size() + " Sessions");
Presentation pres = presentations.iterator().next();
Comment comm = graph.getFramedGraph().addVertex(null, Comment.class);
comm.setBody("This is a test comment");
paul.addComment(comm);
pres.addComment(comm);
paul.addLikeable(comm);
paul.addLikeable(pres);
// Uncomment this and you get a duplicate
// Rates rate1 = paul.addRates(pres);
// rate1.setRating(5);
// This doesn't give a duplicate
Rates rate3 = pres.addRater(paul);
rate3.setRating(5);
Rates rate2 = dv.addRateable(pres);
rate2.setRating(2);
System.out.println("Comments by Paul: " + Lists.newArrayList(paul.getComments()).size());
for (Comment testComm : paul.getComments()) {
System.out.println(testComm.getBody());
}
System.out.println("Likes by Paul: " + Lists.newArrayList(paul.getLikes()).size());
System.out.println("Comments on Pres: " + Lists.newArrayList(pres.getComments()).size());
System.out.println("Likes on Pres: " + Lists.newArrayList(pres.countLikedBys()));
System.out.println("Rates on Pres: " + Lists.newArrayList(pres.getRates()).size());
for (Rates r : Lists.newArrayList(pres.getRates())) {
System.out.println("Rating - " + r.asEdge().getId() + " - " + r.getRating());
}
System.out.println("Rates by Paul: " + Lists.newArrayList(paul.getRates()).size());
System.out.println("Rating by Paul: " + pres.getRaterRating(paul));
System.out.println("Average: " + pres.getAverageRating());
} catch (Exception e) {
e.printStackTrace();
}
long testEndTime = System.nanoTime();
System.out.println("Completed " + getClass().getSimpleName() + " run in " + ((testEndTime - testStartTime) / 1000000) + " ms");
}
use of javolution.util.FastSet in project org.openntf.domino by OpenNTF.
the class DominoGraph method getEdges.
@Override
public Iterable<Edge> getEdges() {
FastSet<Edge> result = new FastSet<Edge>();
ViewEntryCollection vec = getEdgeView().getAllEntries();
for (ViewEntry entry : vec) {
result.add(getEdge(entry.getUniversalID()));
}
return result.unmodifiable();
}
use of javolution.util.FastSet in project org.openntf.domino by OpenNTF.
the class DominoElement method getPropertyKeys.
@Override
public Set<String> getPropertyKeys(final boolean includeEdgeFields) {
if (!checkedDocProps_) {
Set<String> raws = getRawDocument().keySet();
getPropKeysInt().addAll(raws);
checkedDocProps_ = true;
}
if (includeEdgeFields) {
return getPropKeysInt().unmodifiable();
} else {
FastSet<String> result = new FastSet<String>(Equalities.LEXICAL_CASE_INSENSITIVE);
for (String name : getPropKeysInt()) {
if (!(name.startsWith(DominoVertex.IN_PREFIX) || name.startsWith(DominoVertex.OUT_PREFIX))) {
result.add(name);
}
}
return result.unmodifiable();
}
}
use of javolution.util.FastSet in project org.openntf.domino by OpenNTF.
the class DominoGraph method getVertices.
@Override
public Iterable<Vertex> getVertices() {
FastSet<Vertex> result = new FastSet<Vertex>();
ViewEntryCollection vec = getVertexView().getAllEntries();
for (ViewEntry entry : vec) {
result.add(getVertex(entry.getUniversalID()));
}
return result.unmodifiable();
}
Aggregations