Search in sources :

Example 1 with FastSet

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");
}
Also used : Comment(org.openntf.domino.graph2.builtin.social.Comment) FastSet(javolution.util.FastSet) Rates(org.openntf.domino.graph2.builtin.social.Rates) Event(org.openntf.conference.graph.Event) Presentation(org.openntf.conference.graph.Presentation) ConferenceGraph(org.openntf.conference.graph.ConferenceGraph) Attendee(org.openntf.conference.graph.Attendee)

Example 2 with FastSet

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();
}
Also used : FastSet(javolution.util.FastSet) ViewEntry(org.openntf.domino.ViewEntry) ViewEntryCollection(org.openntf.domino.ViewEntryCollection) Edge(com.tinkerpop.blueprints.Edge)

Example 3 with FastSet

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();
    }
}
Also used : FastSet(javolution.util.FastSet) BigString(org.openntf.domino.types.BigString)

Example 4 with FastSet

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();
}
Also used : Vertex(com.tinkerpop.blueprints.Vertex) FastSet(javolution.util.FastSet) ViewEntry(org.openntf.domino.ViewEntry) ViewEntryCollection(org.openntf.domino.ViewEntryCollection)

Aggregations

FastSet (javolution.util.FastSet)4 ViewEntry (org.openntf.domino.ViewEntry)2 ViewEntryCollection (org.openntf.domino.ViewEntryCollection)2 Edge (com.tinkerpop.blueprints.Edge)1 Vertex (com.tinkerpop.blueprints.Vertex)1 Attendee (org.openntf.conference.graph.Attendee)1 ConferenceGraph (org.openntf.conference.graph.ConferenceGraph)1 Event (org.openntf.conference.graph.Event)1 Presentation (org.openntf.conference.graph.Presentation)1 Comment (org.openntf.domino.graph2.builtin.social.Comment)1 Rates (org.openntf.domino.graph2.builtin.social.Rates)1 BigString (org.openntf.domino.types.BigString)1