public IpServiceVertex(GraphVertex graphVertex) { this(graphVertex.getIpService(), graphVertex.getLevel()); }
public BusinessServiceVertex(GraphVertex graphVertex) { this(graphVertex.getBusinessService(), graphVertex.getLevel()); }
public ApplicationVertex(GraphVertex graphVertex) { this(graphVertex.getApplication(), graphVertex.getLevel()); }
public ReductionKeyVertex(GraphVertex graphVertex) { this(graphVertex.getReductionKey(), graphVertex.getLevel()); }
private void calculateAndIndexLevels() { // Start by finding the root vertices // These are the vertices with no incoming edges final Set<GraphVertex> rootVertices = Sets.newHashSet(); for (GraphVertex vertex : getVertices()) { if (getInEdges(vertex).size() == 0) { rootVertices.add(vertex); } } // Now calculate the distance of every node to each of the root nodes final GraphLevelIndexer<GraphVertex, GraphEdge> levelIndexer = new GraphLevelIndexer<>(); levelIndexer.indexLevel(this, rootVertices); for (Entry<GraphVertex, Integer> entry : levelIndexer.getLevelMap().entrySet()) { final int level = entry.getValue().intValue(); final GraphVertexImpl vertex = (GraphVertexImpl)entry.getKey(); // Store the maximum level within the vertex vertex.setLevel(Math.max(level, vertex.getLevel())); } // Index the vertices by level for (GraphVertex vertex : getVertices()) { Set<GraphVertex> verticesAtLevel = m_verticesByLevel.get(vertex.getLevel()); if (verticesAtLevel == null) { verticesAtLevel = Sets.newHashSet(); m_verticesByLevel.put(vertex.getLevel(), verticesAtLevel); } verticesAtLevel.add(vertex); } }
@Override public int compare(BusinessService p1, BusinessService p2) { switch (m_order) { case Name: { return p1.getName().compareTo(p2.getName()); } case Severity: { return businessServiceManager.getOperationalStatus(p1).compareTo(businessServiceManager.getOperationalStatus(p2)); } case Level: { return Integer.compare(graph.getVertexByBusinessServiceId(p1.getId()).getLevel(), graph.getVertexByBusinessServiceId(p2.getId()).getLevel()); } default: throw new IllegalArgumentException("Order not set"); } } };
@Override public int compare(BusinessService p1, BusinessService p2) { switch (m_order) { case Name: { return p1.getName().compareTo(p2.getName()); } case Severity: { return businessServiceManager.getOperationalStatus(p1).compareTo(businessServiceManager.getOperationalStatus(p2)); } case Level: { return Integer.compare(graph.getVertexByBusinessServiceId(p1.getId()).getLevel(), graph.getVertexByBusinessServiceId(p2.getId()).getLevel()); } default: throw new IllegalArgumentException("Order not set"); } } };