To know the full status of a node

@param bn
@param nodeName
@return hashmap in format [status, hypothesis]
@throws UnknownNodeException
186911
public static HashMap<String, Float> getNodeStatesHypotheses(Network bn,
            String nodeName) throws ShanksException {
        try {
            int node = ShanksAgentBayesianReasoningCapability.getNode(bn,
                    nodeName);
            String[] states = bn.getOutcomeIds(node);
            HashMap<String, Float> result = new HashMap<String, Float>();
            for (int i = 0; i < states.length; i++) {
                String status = states[i];
                Float hypothesis = (float) bn.getNodeValue(node)[i];
                result.put(status, hypothesis);
            }
            return result;
        } catch (Exception e) {
            throw new ShanksException("Problem getting hypotheses from: "
                    + nodeName + " -> Exception message: " + e.getMessage());
        }
    }
1191931
public static Boolean getYesNoAttrVal(final NamedNodeMap nnm, final String name)
      throws SAXException {
    String val = getAttrVal(nnm, name);

    if (val == null) {
      return null;
    }

    if ((!"yes".equals(val)) && (!"no".equals(val))) {
      throw new SAXException("Invalid attribute value: " + val);
    }

    return new Boolean("yes".equals(val));
  }
1071302
public TreeElement findNode(String nodeName)
    {
        TreeElement root = getRoot(this);
        return root.findNodeRecurse(nodeName, nodeName);
    }
1280519
@CheckForNull
    public Node getNode() {
        Jenkins j = Jenkins.getInstanceOrNull(); // TODO confirm safe to assume non-null and use getInstance()
        if (j == null) {
            return null;
        }
        if (nodeName == null) {
            return j;
        }
        return j.getNode(nodeName);
    }
31270
public NodeObject getPeerNodeObject (String nodeName)
    {
        if (Objects.equal(_nodeName, nodeName)) {
            return _nodeobj;
        }
        PeerNode peer = _peers.get(nodeName);
        return (peer == null) ? null : peer.nodeobj;
    }
1290244
protected String getNodeName(Node node) {
        String result = node.getLocalName();
        return result == null ? node.getNodeName() : result;
    }
146206
public JSONObject nodesMapToJSON(StaticRouting.NodesMap nm) {
        JSONObject o = new JSONObject();
        o.put("src", nm.getSrc().id());
        o.put("dst", nm.getDst().id());
        return o;
    }
1206192
function hashBlankNodes(unnamed) {
    var nextUnnamed = [];
    var duplicates = {};
    var unique = {};

    // hash quads for each unnamed bnode
    jsonld.setImmediate(function() {hashUnnamed(0);});
    function hashUnnamed(i) {
      if(i === unnamed.length) {
        // done, name blank nodes
        return nameBlankNodes(unique, duplicates, nextUnnamed);
      }

      // hash unnamed bnode
      var bnode = unnamed[i];
      var hash = _hashQuads(bnode, bnodes, namer);

      // store hash as unique or a duplicate
      if(hash in duplicates) {
        duplicates[hash].push(bnode);
        nextUnnamed.push(bnode);
      }
      else if(hash in unique) {
        duplicates[hash] = [unique[hash], bnode];
        nextUnnamed.push(unique[hash]);
        nextUnnamed.push(bnode);
        delete unique[hash];
      }
      else {
        unique[hash] = bnode;
      }

      // hash next unnamed bnode
      jsonld.setImmediate(function() {hashUnnamed(i + 1);});
    }
  }
1210888
public static <BEAN, KEYTYPE> Set<KEYTYPE> getNoDataKeySet(Map<KEYTYPE, BEAN> map) {
		Set<KEYTYPE> keySet = null;
		Iterator<Entry<KEYTYPE, BEAN>> iterator = map.entrySet().iterator();
		while (iterator.hasNext()) {
			Entry<KEYTYPE, BEAN> entry = iterator.next();
			BEAN bean = entry.getValue();
			if (bean == null) {
				if (keySet == null) {
					keySet = new LinkedHashSet<KEYTYPE>();
				}
				keySet.add(entry.getKey());
			}
		}
		return keySet;
	}
763765
public static Map<String, String> getEvidences(ProbabilisticNetwork bn) {

        HashMap<String, String> evidences = new HashMap<String, String>();
        for (Node n : bn.getNodes()) {
            ProbabilisticNode pn = (ProbabilisticNode) n;
            if (pn.hasEvidence()) {
                evidences.put(pn.getName(), pn.getStateAt(pn.getEvidence()));
            }
        }
        return evidences;
    }
503558
public static HashMap<String, HashMap<String, Float>> getAllHypotheses(
            ProbabilisticNetwork bn) throws ShanksException {
        List<Node> nodes = bn.getNodes();
        HashMap<String, HashMap<String, Float>> result = new HashMap<String, HashMap<String, Float>>();
        for (Node node : nodes) {
            String nodeName = node.getName();
            HashMap<String, Float> hypotheses = ShanksAgentBayesianReasoningCapability
                    .getNodeStatesHypotheses(bn, nodeName);
            result.put(nodeName, hypotheses);
        }
        return result;
    }
720284
public Node getNode(String name) {
    Node n = hostnameToNodeMap.get(name);

    // it's ok if multiple threads try to resolve the same host at the same time
    // the assumption is that resolve() will return a canonical node object and
    // the put operation is therefore idempotent
    if (n == null) {
      n = resolveAndGetNode(name);
      hostnameToNodeMap.put(name, n);
      // Make an entry for the node at the max level in the cache
      nodesAtMaxLevel.add(
        getParentNode(n, NetworkTopology.DEFAULT_HOST_LEVEL - 1));
    }

    return n;
  }
403050
int numNodes(Block b) {
    BlockInfo info = blocks.get(b);
    return info == null ? 0 : info.numNodes();
  }
114669
public static int getNode(Network bn, String nodeName)
            throws ShanksException {
        int node = bn.getNode(nodeName);
        return node;
    }
1111416
@GET
    @Path("localnode/health")
    @Produces(MediaType.TEXT_PLAIN)
    public String getLocalNodeHealth() throws MalformedObjectNameException
    {
        // Local service only - not enabled when running on top of Tomcat & co.
        if (n == null)
        {
            throw new ErrorDto("can only retrieve local node health when the web app runs on top of JQM", "", 7, Status.BAD_REQUEST);
        }
        if (n.getJmxServerPort() == null || n.getJmxServerPort() == 0)
        {
            throw new ErrorDto("JMX is not enabled on this server", "", 8, Status.BAD_REQUEST);
        }

        // Connect to JMX server
        MBeanServer server = ManagementFactory.getPlatformMBeanServer();
        ObjectName nodeBean = new ObjectName("com.enioka.jqm:type=Node,name=" + n.getName());
        Set<ObjectName> names = server.queryNames(nodeBean, null);
        if (names.isEmpty())
        {
            throw new ErrorDto("could not find the JMX Mbean of the local JQM node", "", 8, Status.INTERNAL_SERVER_ERROR);
        }
        ObjectName localNodeBean = names.iterator().next();

        // Query bean
        Object result;
        try
        {
            result = server.getAttribute(localNodeBean, "AllPollersPolling");
        }
        catch (Exception e)
        {
            throw new ErrorDto("Issue when querying JMX server", 12, e, Status.INTERNAL_SERVER_ERROR);
        }
        if (!(result instanceof Boolean))
        {
            throw new ErrorDto("JMX bean answered with wrong datatype - answer was " + result.toString(), "", 9,
                    Status.INTERNAL_SERVER_ERROR);
        }

        // Analyze output
        boolean res = (Boolean) result;
        if (!res)
        {
            throw new ErrorDto("JQM node has is not working as expected", "", 11, Status.SERVICE_UNAVAILABLE);
        }

        return "Pollers are polling";
    }
868698
JcrNodeType getNodeType( Name nodeTypeName ) {
        JcrNodeType nodeType = nodeTypes().getNodeType(nodeTypeName);

        if (nodeType != null) {
            nodeType = nodeType.with(context(), session);
        }

        return nodeType;
    }
307480
public static Map<QName, String> getAttributes(Node n) {
        Map<QName, String> map = new LinkedHashMap<QName, String>();
        NamedNodeMap m = n.getAttributes();
        if (m != null) {
            final int len = m.getLength();
            for (int i = 0; i < len; i++) {
                Attr a = (Attr) m.item(i);
                map.put(getQName(a), a.getValue());
            }
        }
        return map;
    }