Example usage for java.util List hashCode

List of usage examples for java.util List hashCode

Introduction

In this page you can find the example usage for java.util List hashCode.

Prototype

int hashCode();

Source Link

Document

Returns the hash code value for this list.

Usage

From source file:net.pterodactylus.sone.web.ajax.GetNotificationsAjaxPage.java

/**
 * {@inheritDoc}/*from   w w  w. j  a  va  2 s .  c om*/
 */
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
    Sone currentSone = getCurrentSone(request.getToadletContext(), false);
    Collection<Notification> notifications = webInterface.getNotifications().getNotifications();
    List<Notification> filteredNotifications = ListNotificationFilters.filterNotifications(notifications,
            currentSone);
    Collections.sort(filteredNotifications, Notification.CREATED_TIME_SORTER);
    ArrayNode jsonNotifications = new ArrayNode(instance);
    for (Notification notification : filteredNotifications) {
        jsonNotifications.add(createJsonNotification(request, notification));
    }
    return createSuccessJsonObject().put("notificationHash", filteredNotifications.hashCode())
            .put("notifications", jsonNotifications).put("options", createJsonOptions(currentSone));
}

From source file:net.sf.jasperreports.engine.export.JsonExporter.java

protected void exportBookmarks() throws IOException {
    List<PrintBookmark> bookmarks = jasperPrint.getBookmarks();
    if (bookmarks != null && bookmarks.size() > 0) {
        if (gotFirstJsonFragment) {
            writer.write(",\n");
        } else {/*from w  w w . j ava 2 s . c  o m*/
            gotFirstJsonFragment = true;
        }

        writer.write("\"bkmrk_" + (bookmarks.hashCode() & 0x7FFFFFFF) + "\": ");
        writeBookmarks(bookmarks, writer, jacksonUtil);
    }
}

From source file:org.opendaylight.controller.topology.web.Topology.java

/**
 * Calculate the total host hashcode//w  w w.j a v a 2s  . c  o m
 *
 * This is to handle cases where there are multiple hosts per NodeConnector
 *
 * @param hostEdges
 *            - hostEdges data structure
 * @param topology
 *            - topology bundle
 * @return this topology's host hashcode
 */
private int getHostHashCode(Map<Node, Set<NodeConnector>> hostEdges, ITopologyManager topology) {
    List<Host> hosts = new ArrayList<Host>();
    for (Set<NodeConnector> nodeConnectors : hostEdges.values()) {
        for (NodeConnector nodeConnector : nodeConnectors) {
            List<Host> theseHosts = topology.getHostsAttachedToNodeConnector(nodeConnector);
            hosts.addAll(theseHosts);
        }
    }

    return hosts.hashCode();
}

From source file:org.opendaylight.controller.topology.web.Topology.java

/**
 * Topology of nodes and hosts in the network in JSON format.
 *
 * Mainly intended for consumption by the visual topology.
 *
 * @return - JSON output for visual topology
 *///  w  w  w .j  ava  2 s  . co  m
@RequestMapping(value = "/visual.json", method = RequestMethod.GET)
@ResponseBody
public Collection<Map<String, Object>> getLinkData(@RequestParam(required = false) String container,
        HttpServletRequest request) {
    String containerName = (container == null) ? GlobalConstants.DEFAULT.toString() : container;

    // Derive the privilege this user has on the current container
    String userName = request.getUserPrincipal().getName();
    Privilege privilege = DaylightWebUtil.getContainerPrivilege(userName, containerName, this);

    if (privilege == Privilege.NONE) {
        return null;
    }

    ITopologyManager topologyManager = (ITopologyManager) ServiceHelper.getInstance(ITopologyManager.class,
            containerName, this);
    if (topologyManager == null) {
        return null;
    }
    ISwitchManager switchManager = (ISwitchManager) ServiceHelper.getInstance(ISwitchManager.class,
            containerName, this);
    if (switchManager == null) {
        return null;
    }

    Map<Node, Set<Edge>> nodeEdges = topologyManager.getNodeEdges();
    Map<Node, Set<NodeConnector>> hostEdges = topologyManager.getNodesWithNodeConnectorHost();
    int hostEdgesHashCode = getHostHashCode(hostEdges, topologyManager);
    List<Switch> nodes = switchManager.getNetworkDevices();

    List<SwitchConfig> switchConfigurations = new ArrayList<SwitchConfig>();
    for (Switch sw : nodes) {
        Node n = sw.getNode();
        SwitchConfig config = switchManager.getSwitchConfig(n.toString());
        switchConfigurations.add(config);
    }

    // initialize cache if needed
    if (!metaCache.containsKey(containerName)) {
        metaCache.put(containerName, new HashMap<String, Map<String, Object>>());
        // initialize hashes
        metaNodeHash.put(containerName, null);
        metaHostHash.put(containerName, null);
        metaNodeSingleHash.put(containerName, null);
        metaNodeConfigurationHash.put(containerName, null);
    }

    // return cache if topology hasn't changed
    if ((metaNodeHash.get(containerName) != null && metaHostHash.get(containerName) != null
            && metaNodeSingleHash.get(containerName) != null
            && metaNodeConfigurationHash.get(containerName) != null)
            && metaNodeHash.get(containerName).equals(nodeEdges.hashCode())
            && metaHostHash.get(containerName).equals(hostEdgesHashCode)
            && metaNodeSingleHash.get(containerName).equals(nodes.hashCode())
            && metaNodeConfigurationHash.get(containerName).equals(switchConfigurations.hashCode())) {
        return metaCache.get(containerName).values();
    }

    // cache has changed, we must assign the new values
    metaNodeHash.put(containerName, nodeEdges.hashCode());
    metaHostHash.put(containerName, hostEdgesHashCode);
    metaNodeSingleHash.put(containerName, nodes.hashCode());
    metaNodeConfigurationHash.put(containerName, switchConfigurations.hashCode());

    stagedNodes = new HashMap<String, Map<String, Object>>();
    newNodes = new HashMap<String, Map<String, Object>>();

    // nodeEdges addition
    addNodes(nodeEdges, topologyManager, switchManager, containerName);

    // single nodes addition
    addSingleNodes(nodes, switchManager, containerName);

    // hostNodes addition
    addHostNodes(hostEdges, topologyManager, containerName);

    repositionTopology(containerName);

    return metaCache.get(containerName).values();
}

From source file:com.gh.bmd.jrt.android.v4.core.LoaderInvocation.java

@Override
@SuppressWarnings("unchecked")
@SuppressFBWarnings(value = "BC_UNCONFIRMED_CAST_OF_RETURN_VALUE", justification = "class comparison with == is done")
public void onCall(@Nonnull final List<? extends INPUT> inputs, @Nonnull final ResultChannel<OUTPUT> result) {

    final Logger logger = mLogger;
    final Object context = mContext.get();

    if (context == null) {

        logger.dbg("avoiding running invocation since context is null");
        return;/* www.j  a  va2 s  . c  om*/
    }

    final Context loaderContext;
    final LoaderManager loaderManager;

    if (context instanceof FragmentActivity) {

        final FragmentActivity activity = (FragmentActivity) context;
        loaderContext = activity.getApplicationContext();
        loaderManager = activity.getSupportLoaderManager();
        logger.dbg("running invocation bound to activity: %s", activity);

    } else if (context instanceof Fragment) {

        final Fragment fragment = (Fragment) context;
        loaderContext = fragment.getActivity().getApplicationContext();
        loaderManager = fragment.getLoaderManager();
        logger.dbg("running invocation bound to fragment: %s", fragment);

    } else {

        throw new IllegalArgumentException("invalid context type: " + context.getClass().getCanonicalName());
    }

    int loaderId = mLoaderId;

    if (loaderId == ContextRoutineBuilder.AUTO) {

        loaderId = mConstructor.getDeclaringClass().hashCode();

        for (final Object arg : mArgs) {

            loaderId = 31 * loaderId + recursiveHashCode(arg);
        }

        loaderId = 31 * loaderId + inputs.hashCode();
        logger.dbg("generating invocation ID: %d", loaderId);
    }

    final Loader<InvocationResult<OUTPUT>> loader = loaderManager.getLoader(loaderId);
    final boolean isClash = isClash(loader, loaderId, inputs);
    final WeakIdentityHashMap<Object, SparseArray<WeakReference<RoutineLoaderCallbacks<?>>>> callbackMap = sCallbackMap;
    SparseArray<WeakReference<RoutineLoaderCallbacks<?>>> callbackArray = callbackMap.get(context);

    if (callbackArray == null) {

        callbackArray = new SparseArray<WeakReference<RoutineLoaderCallbacks<?>>>();
        callbackMap.put(context, callbackArray);
    }

    final WeakReference<RoutineLoaderCallbacks<?>> callbackReference = callbackArray.get(loaderId);
    RoutineLoaderCallbacks<OUTPUT> callbacks = (callbackReference != null)
            ? (RoutineLoaderCallbacks<OUTPUT>) callbackReference.get()
            : null;

    if ((callbacks == null) || (loader == null) || isClash) {

        final RoutineLoader<INPUT, OUTPUT> routineLoader;

        if (!isClash && (loader != null) && (loader.getClass() == RoutineLoader.class)) {

            routineLoader = (RoutineLoader<INPUT, OUTPUT>) loader;

        } else {

            routineLoader = null;
        }

        final RoutineLoaderCallbacks<OUTPUT> newCallbacks = createCallbacks(loaderContext, loaderManager,
                routineLoader, inputs, loaderId);

        if (callbacks != null) {

            logger.dbg("resetting existing callbacks [%d]", loaderId);
            callbacks.reset();
        }

        callbackArray.put(loaderId, new WeakReference<RoutineLoaderCallbacks<?>>(newCallbacks));
        callbacks = newCallbacks;
    }

    logger.dbg("setting result cache type [%d]: %s", loaderId, mCacheStrategyType);
    callbacks.setCacheStrategy(mCacheStrategyType);

    final OutputChannel<OUTPUT> outputChannel = callbacks.newChannel();

    if (isClash) {

        logger.dbg("restarting loader [%d]", loaderId);
        loaderManager.restartLoader(loaderId, Bundle.EMPTY, callbacks);

    } else {

        logger.dbg("initializing loader [%d]", loaderId);
        loaderManager.initLoader(loaderId, Bundle.EMPTY, callbacks);
    }

    result.pass(outputChannel);
}

From source file:net.pterodactylus.sone.web.ajax.GetStatusAjaxPage.java

/**
 * {@inheritDoc}//  w  ww.  java 2s  .  co m
 */
@Override
protected JsonReturnObject createJsonObject(FreenetRequest request) {
    final Sone currentSone = getCurrentSone(request.getToadletContext(), false);
    /* load Sones. always return the status of the current Sone. */
    Set<Sone> sones = new HashSet<Sone>(
            Collections.singleton(getCurrentSone(request.getToadletContext(), false)));
    String loadSoneIds = request.getHttpRequest().getParam("soneIds");
    if (loadSoneIds.length() > 0) {
        String[] soneIds = loadSoneIds.split(",");
        for (String soneId : soneIds) {
            /* just add it, we skip null further down. */
            sones.add(webInterface.getCore().getSone(soneId).orNull());
        }
    }
    ArrayNode jsonSones = new ArrayNode(instance);
    for (Sone sone : sones) {
        if (sone == null) {
            continue;
        }
        jsonSones.add(createJsonSone(sone));
    }
    /* load notifications. */
    List<Notification> notifications = ListNotificationFilters
            .filterNotifications(webInterface.getNotifications().getNotifications(), currentSone);
    Collections.sort(notifications, Notification.CREATED_TIME_SORTER);
    /* load new posts. */
    Collection<Post> newPosts = webInterface.getNewPosts();
    if (currentSone != null) {
        newPosts = Collections2.filter(newPosts, new Predicate<Post>() {

            @Override
            public boolean apply(Post post) {
                return ListNotificationFilters.isPostVisible(currentSone, post);
            }

        });
    }
    ArrayNode jsonPosts = new ArrayNode(instance);
    for (Post post : newPosts) {
        ObjectNode jsonPost = new ObjectNode(instance);
        jsonPost.put("id", post.getId());
        jsonPost.put("sone", post.getSone().getId());
        jsonPost.put("recipient", post.getRecipientId().orNull());
        jsonPost.put("time", post.getTime());
        jsonPosts.add(jsonPost);
    }
    /* load new replies. */
    Collection<PostReply> newReplies = webInterface.getNewReplies();
    if (currentSone != null) {
        newReplies = Collections2.filter(newReplies, new Predicate<PostReply>() {

            @Override
            public boolean apply(PostReply reply) {
                return ListNotificationFilters.isReplyVisible(currentSone, reply);
            }

        });
    }
    /* remove replies to unknown posts. */
    newReplies = Collections2.filter(newReplies, PostReply.HAS_POST_FILTER);
    ArrayNode jsonReplies = new ArrayNode(instance);
    for (PostReply reply : newReplies) {
        ObjectNode jsonReply = new ObjectNode(instance);
        jsonReply.put("id", reply.getId());
        jsonReply.put("sone", reply.getSone().getId());
        jsonReply.put("post", reply.getPostId());
        jsonReply.put("postSone", reply.getPost().get().getSone().getId());
        jsonReplies.add(jsonReply);
    }
    return createSuccessJsonObject().put("loggedIn", currentSone != null)
            .put("options", createJsonOptions(currentSone)).put("sones", jsonSones)
            .put("notificationHash", notifications.hashCode()).put("newPosts", jsonPosts)
            .put("newReplies", jsonReplies);
}

From source file:org.mindswap.swoop.renderer.entity.ConciseFormatEntityRenderer.java

protected void renderIndividual(OWLIndividual ind) throws OWLException {

    // check if individual is in current ontology or imported
    String importedLbl = "";
    imported = false;/*from   w  w  w .j a v  a  2  s  . c o  m*/
    List unprinted = new ArrayList();

    if (!ind.getOntologies().contains(swoopModel.getSelectedOntology())) {
        importedLbl = "Imported ";
        imported = true;
    }

    OWLClass owlThing = reasoner.getOntology().getOWLDataFactory().getOWLThing();

    print("<b>" + importedLbl + "OWL-Individual:</b>&nbsp;");
    if (ind.isAnonymous())
        println("Anonymous ");
    else
        println(shortForm(ind.getURI()) + "  ");

    if (importedLbl.length() > 0) {
        println();
        // print("<b>Imported from Ontology(s):</b>&nbsp;");
        // also print where the class is imported from
        Iterator ontIter = ind.getOntologies().iterator();
        while (ontIter.hasNext()) {
            OWLOntology ont = (OWLOntology) ontIter.next();
            String ontURI = ont.getURI().toString();
            String ontName = ontURI.substring(ontURI.lastIndexOf("/") + 1, ontURI.length());
            String indXPtrURI = ind.getURI() + XPointers.asDefinedIn + "(" + ontURI + ")";
            print("See its definition in Imported Ontology: <a href=\"" + indXPtrURI + "\">" + ontName
                    + "</a>");
            // print("<a href=\""+ontURI+"asDefinedIn("+ontURI+")\">"+className+"</a>&nbsp;&nbsp;");
            println();
        }
        println();
    }
    println();

    if (showDivisions) {
        print("<table cellpadding=\"5\"><tr bgcolor=\"#FFF68F\"><FONT FACE=\"" + swoopModel.getFontFace()
                + "\" SIZE=" + fontSize + ">");
    }

    boolean printedAnn = renderAnnotations(ind);
    if (!printedAnn)
        unprinted.add("A-ANN");
    else // print the first division here (after annotations) 
    if (showDivisions)
        print(HR + "<FONT FACE=\"" + swoopModel.getFontFace() + "\" SIZE=" + fontSize + ">");

    boolean div2 = false;
    // get defined types
    Set types = OWLDescriptionFinder.getTypes(ind, reasoner.getOntologies());
    if (reasoner.isConsistent()) {
        // remove all the named classes because reasoner will eventually add them
        Iterator i = types.iterator();
        while (i.hasNext())
            if (i.next() instanceof OWLClass)
                i.remove();
        //         types.clear(); // *** turns out reasoner returns asserted types as well
        // add all the named superclasses
        types.addAll(reasoner.typesOf(ind));
    }
    // remove owl:Thing from the superclass set
    Iterator i = types.iterator();
    while (i.hasNext()) {
        Object o = i.next();
        if (o instanceof Set && ((Set) o).contains(owlThing))
            i.remove();
    }

    boolean printedType = false;
    String title = "<b>Instance of:</b>";
    if (types.size() == 0) {
        printedType = insertAddedChanges(new HashSet(), ind, "C-TYP", "<b>Instance of:</b>");
    } else {
        if (editorEnabled)
            title += addTitle("C-TYP");
        printCollection(types, title);
        printedType = true;
    }
    if (!printedType)
        unprinted.add("C-TYP");
    else
        div2 = true;

    // print sameAs individuals
    title = "<b>Same As:</b>";
    boolean printedSame = false;
    if (reasoner.isConsistent() && reasoner.getSameAsIndividuals(ind) != null
            && reasoner.getSameAsIndividuals(ind).size() > 0) {
        Set sameAs = reasoner.getSameAsIndividuals(ind);
        if (editorEnabled)
            title += addTitle("I-SAM");
        printCollection(sameAs, title);
        printedSame = true;
    } else {
        printedSame = insertAddedChanges(new HashSet(), ind, "I-SAM", "<b>Same As:</b>");
    }
    if (!printedSame)
        unprinted.add("I-SAM");
    else
        div2 = true;

    // print diffFrom individuals
    boolean printedDiff = false;
    title = "<b>Different From:</b>";
    if (reasoner.isConsistent() && reasoner.getDifferentFromIndividuals(ind) != null
            && reasoner.getDifferentFromIndividuals(ind).size() > 0) {
        Set diffFrom = reasoner.getDifferentFromIndividuals(ind);
        if (editorEnabled)
            title += addTitle("I-DIF");
        printCollection(diffFrom, title);
        printedDiff = true;
    } else {
        printedDiff = insertAddedChanges(new HashSet(), ind, "I-DIF", "<b>Different From:</b>");
    }
    if (!printedDiff)
        unprinted.add("I-DIF");
    else
        div2 = true;

    // print second division here (after types, sameAs, diffFrom)
    if (div2)
        print(HR + "<FONT FACE=\"" + swoopModel.getFontFace() + "\" SIZE=" + fontSize + ">");

    // get properties whose domain is the type of the individual
    HashMap propMap = new HashMap();
    for (Iterator typeIter = types.iterator(); typeIter.hasNext();) {
        Object typ = typeIter.next();
        if (typ instanceof Set) {
            Set equClas = (HashSet) typ; // set of equivalent class types
            for (Iterator ite = equClas.iterator(); ite.hasNext();) {
                OWLDescription type = (OWLDescription) ite.next();
                if (!(type instanceof OWLClass))
                    continue;
                propMap.put(type, getPropertiesWithDomain((OWLClass) type, false));
                if (showInherited) {
                    Set ancSet = reasoner.ancestorClassesOf(type);
                    for (Iterator supCIter = ancSet.iterator(); supCIter.hasNext();) {
                        Set supCSet = (HashSet) supCIter.next();
                        OWLDescription supC = (OWLDescription) supCSet.iterator().next();
                        if (supC instanceof OWLClass) {
                            propMap.put(supC, getPropertiesWithDomain((OWLClass) supC, false));
                        }
                    }
                }
            }
        }
    }

    boolean div3 = false;
    // print all datatype properties and value pairs of instance
    Set instanceProps = new HashSet();
    Map dataValues = new HashMap();
    if (reasoner.isConsistent())
        dataValues = reasoner.getDataPropertyValues(ind);
    boolean printedDataAssTitle = false;
    if (dataValues.size() > 0) {

        for (Iterator it = dataValues.keySet().iterator(); it.hasNext();) {
            OWLDataProperty prop = (OWLDataProperty) it.next();

            boolean valLinkPrinted = false;
            Set vals = (Set) dataValues.get(prop);

            if (vals.size() > 0) {
                if (!printedDataAssTitle) {
                    // just print title once
                    println();
                    print("<b>Datatype Assertions:</b>");
                    if (editorEnabled)
                        print(addTitle("P-INSD"));
                    println();
                    printedDataAssTitle = true;
                }
                instanceProps.add(prop);
            }

            for (Iterator valIt = vals.iterator(); valIt.hasNext();) {
                OWLDataValue dtv = (OWLDataValue) valIt.next();

                // check if DataPropertyInstance is deleted
                OntologyChange oc = editorEnabled ? isDeleted(prop, dtv) : null;
                boolean deleted = (oc != null);
                if (deleted)
                    print("<font color=\"red\"><strike>");

                visitor.reset();
                dtv.accept(visitor);
                if (!isExplicit(ind, "P-INSD", prop, dtv))
                    print("<i>");
                printConciseObject(prop);
                print(" : " + visitor.result());
                if (!isExplicit(ind, "P-INSD", prop, dtv))
                    print("</i>");

                if (deleted) {
                    print("</strike></font>");
                    addUndo(oc, "Delete", "P-VAL");
                } else if (editorEnabled && isExplicit(ind, "P-INSD", prop, dtv))
                    deleteValueLink(prop, dtv);

                if ((!valLinkPrinted) && (editorEnabled)) {
                    addValueLink(prop);
                    valLinkPrinted = true; // only display 'Add Value' link once for each property
                }
                if (valIt.hasNext()) {
                    println();
                }
            }
            if (printedDataAssTitle)
                println();
        }
    }

    // print all AddDataPropertyInstance changes associated with this instance in green
    Iterator citer = changes.iterator();
    while (citer.hasNext()) {
        OntologyChange oc = (OntologyChange) citer.next();
        if (oc instanceof AddDataPropertyInstance) {
            AddDataPropertyInstance change = (AddDataPropertyInstance) oc;
            if (change.getSubject().equals(ind)) {

                if (!printedDataAssTitle) {
                    println();
                    print("<b>Datatype Assertions:</b>");
                    if (editorEnabled)
                        print(addTitle("P-INSD"));
                    println();
                    printedDataAssTitle = true;
                }

                OWLDataProperty prop = change.getProperty();
                instanceProps.add(prop);
                OWLDataValue dtv = change.getObject();
                visitor.reset();
                dtv.accept(visitor);
                print("<font color=\"green\">");
                printConciseObject(prop);
                print(" : " + visitor.result());
                addUndo(change, "Add", "V");
                print("</font>");
                println();
            }
        }
    }
    if (!printedDataAssTitle)
        unprinted.add("P-INSD");
    else
        div3 = true;

    // print all object properties and value pairs of instance
    Map propertyValues = new HashMap();
    if (reasoner.isConsistent())
        propertyValues = reasoner.getObjectPropertyValues(ind);
    boolean printedObjAssTitle = false;
    if (propertyValues.size() > 0) {

        for (Iterator it = propertyValues.keySet().iterator(); it.hasNext();) {
            OWLObjectProperty prop = (OWLObjectProperty) it.next();

            boolean valLinkPrinted = false;
            Set vals = (Set) propertyValues.get(prop);

            if (vals.size() > 0) {
                if (!printedObjAssTitle) {
                    // only print title once
                    println();
                    print("<b>Object Assertions:</b>");
                    if (editorEnabled)
                        print(addTitle("P-INSO"));
                    println();
                    printedObjAssTitle = true;
                }
                instanceProps.add(prop);
            }

            for (Iterator valIt = vals.iterator(); valIt.hasNext();) {
                OWLIndividual oi = (OWLIndividual) valIt.next();

                // check if ObjectPropertyInstance is deleted
                OntologyChange oc = editorEnabled ? isDeleted(prop, oi) : null;
                boolean deleted = (oc != null);
                if (deleted)
                    print("<font color=\"red\"><strike>");

                if (!isExplicit(ind, "P-INSO", prop, oi))
                    print("<i>");
                printConciseObject(prop);

                visitor.reset();
                boolean turnOnIcons = false;
                // turn off icons while rendering individuals 
                // since we are rendering image values inline
                if (swoopModel.getShowIcons()) {
                    turnOnIcons = true;
                    swoopModel.setShowIcons(false, false);
                }
                oi.accept(visitor);
                String objValue = visitor.result();

                if (isImage(objValue).equals(""))
                    print(" : " + visitor.result());
                else {
                    // render image inline
                    print(" : ");
                    println("<P align=\"left\"><b><img border=\"3\" src=\"" + isImage(objValue)
                            + "\" width=\"100\" height=\"100\"></b></P>");
                }
                // check for turnOnIcons
                if (turnOnIcons)
                    swoopModel.setShowIcons(true, false);

                if (!isExplicit(ind, "P-INSO", prop, oi)) {
                    print("</i>");
                    if (reasoner.supportsExplanation()) {
                        // add why link manually
                        List propVal = new ArrayList();
                        propVal.add(prop);
                        propVal.add(oi);
                        String hash = String.valueOf(propVal.hashCode());
                        OWLDescHash.put(hash, propVal);
                        if (!imported) {
                            print("&nbsp;&nbsp;(<font color=\"red\"><a href=\"<Why:" + hash + ":" + "P-INSO"
                                    + "\">Why?</a></font>)");
                        }
                    }
                }

                if (deleted) {
                    print("</strike></font>");
                    addUndo(oc, "Delete", "P-VAL");
                } else if (editorEnabled && isExplicit(ind, "P-INSO", prop, oi))
                    deleteValueLink(prop, oi);

                if ((!valLinkPrinted) && (editorEnabled)) {
                    addValueLink(prop);
                    valLinkPrinted = true; // only display 'Add Value' link once for each property
                }
                if (valIt.hasNext()) {
                    println();
                }
            }
            if (printedObjAssTitle)
                println();
        }
    }

    // print all AddObjectPropertyInstance changes associated with this instance in green
    citer = changes.iterator();
    while (citer.hasNext()) {
        OntologyChange oc = (OntologyChange) citer.next();
        if (oc instanceof AddObjectPropertyInstance) {
            AddObjectPropertyInstance change = (AddObjectPropertyInstance) oc;
            if (change.getSubject().equals(ind)) {

                if (!printedObjAssTitle) {
                    println();
                    print("<b>Object Assertions:</b>");
                    if (editorEnabled)
                        print(addTitle("P-INSO"));
                    println();
                    printedObjAssTitle = true;
                }

                OWLObjectProperty prop = change.getProperty();
                instanceProps.add(prop);
                OWLIndividual objInst = change.getObject();
                print("<font color=\"green\">");
                printConciseObject(prop);
                print(" : ");
                printConciseObject(objInst);
                addUndo(change, "Add", "V");
                print("</font>");
                println();
            }
        }
    }
    if (!printedObjAssTitle)
        unprinted.add("P-INSO");
    else
        div3 = true;

    if (div3) {
        if (showDivisions)
            print(HR + "<FONT FACE=\"" + swoopModel.getFontFace() + "\" SIZE=" + swoopModel.getFontSize()
                    + ">");
    }

    this.addUnprinted(unprinted);

    if (editorEnabled) {
        if (propMap.size() > 0) {
            if (showDivisions)
                print(HR + "<FONT FACE=\"" + swoopModel.getFontFace() + "\" SIZE=" + fontSize + ">");
            println();
            println("<b>Likely Properties to Use:</b>");
            for (Iterator iter = propMap.keySet().iterator(); iter.hasNext();) {
                OWLClass cla = (OWLClass) iter.next();
                Set props = (HashSet) propMap.get(cla);
                for (Iterator pit = props.iterator(); pit.hasNext();) {
                    OWLProperty prop = (OWLProperty) pit.next();
                    if (!instanceProps.contains(prop)) {
                        print("(of ");
                        printConciseObject(cla);
                        print(") ");

                        printConciseObject(prop);
                        print(" : ");
                        addValueLink(prop);
                        println();
                    }
                }
            }
        }
    }
}

From source file:de.innovationgate.webgate.api.WGDatabase.java

/**
 * Tests, if the current user can be associated with any entry in the list.
 * This is up to the database implementation to decide since name/group/role
 * mechanims may vary widely in different databases.
 * //www  .  j  av  a2  s.c o m
 * @param list
 * @throws WGAPIException
 */
public boolean isMemberOfUserList(List list) throws WGAPIException {

    if (!isSessionOpen()) {
        throw new WGClosedSessionException();
    }

    // Lookup the member decisions cache
    Boolean decision;
    Map<Integer, Boolean> memberDecisions = null;
    int listHash = 0;
    if (this.userCachesEnabled) {
        memberDecisions = (Map<Integer, Boolean>) getUserCache().get(USERCACHE_MEMBERDECISIONS);
        if (memberDecisions == null) {
            memberDecisions = new ConcurrentHashMap<Integer, Boolean>();
            getUserCache().put(USERCACHE_MEMBERDECISIONS, memberDecisions);
        }
        listHash = list.hashCode();
        decision = memberDecisions.get(listHash);
        if (decision != null) {
            return decision;
        }
    }

    // Determine membership 
    decision = this.getCore().isMemberOfUserList(list);

    // Write to cache
    if (this.userCachesEnabled) {
        memberDecisions.put(listHash, decision);
    }
    return decision;
}