/** * Gathers all LINKS we can travel through from 'searchNode'. * * @param graph * @param searchNode * @return */ protected Collection<LINK> getLinks(SEARCH_NODE searchNode) { NODE node = (NODE) searchNode.node; Collection<LINK> origLinks = (Collection<LINK>) node.getLinks(); if (view == null) { return origLinks; } NODE from = (NODE) searchNode.node; Collection<LINK> extraLinks = view.getExtraLinks(searchNode, origLinks); List<LINK> result = new ArrayList<LINK>(origLinks.size() + (extraLinks == null ? 0 : extraLinks.size())); if (origLinks != null) { for (LINK link : origLinks) { if (view == null || !view.isLinkOpened(from, link)) continue; // LINK IS OPENED result.add(link); } } if (extraLinks != null) { for (LINK link : extraLinks) { if (view == null || !view.isLinkOpened(from, link)) continue; // LINK IS OPENED result.add(link); } } return result; }
/** * Determines EXTRA COST of the given LINK that leads between 'parent' -> 'node'. * * @param node * @param link * @param parent * @return */ protected int getLinkViewCost(NODE node, LINK link, SEARCH_NODE parent) { return (view == null ? 0 : view.getLinkExtraCost(node, link, getLinkGraphCost(node, link), parent)); }
/** * Determines EXTRA COST of the given node. * * @param node * @param parent * @return */ protected int getNodeViewCost(NODE node, SEARCH_NODE parent) { return (view == null ? 0 : view.getNodeExtraCost(node, 0, parent)); }