Package lt.refactory.primsAlgo.service.algorithm.exceptions

Examples of lt.refactory.primsAlgo.service.algorithm.exceptions.AlgorithmException


        return BigDecimal.valueOf(180);
      }
     
      return BigDecimal.valueOf(Math.toDegrees(result)).round(new MathContext(ROUNDING_PRECISION, ROUNDING_MODE));
    }
    throw new AlgorithmException("Cannot compute angle of edges which doesn't have a common point");
  }
View Full Code Here


      triangle.addEdgeWithNodes(new WeightedEdge(secondEdge, SteinersAlgorithm.getEdgeLength(secondEdge)));
      triangle.addEdgeWithNodes(new WeightedEdge(thirdEdge, SteinersAlgorithm.getEdgeLength(thirdEdge)));
     
      return triangle;
    }
    throw new AlgorithmException("Edges must have a common point to form a triangle");
  }
View Full Code Here

          combinedGraph.addEdgeWithNodes(edge);
        }
      }
     
    } catch (AddEdgeException e) {
      throw new AlgorithmException("Failed to make combined graph");
    }
   
    List<Node> resultNodes = new ArrayList<Node>();
    List<Node> nearNodes;
   
    for (Node node : combinedGraph.getNodeList()) {
      nearNodes = combinedGraph.getNearNodes(node);
      if (nearNodes.size() == 2) {
        resultNodes.add(node);
      }
    }
   
    if (resultNodes.size() != 2) {
      throw new AlgorithmException("Found more or less edges than needed");
    }
   
    Edge resultEdge = new Edge(resultNodes.get(0), resultNodes.get(1));
    BigDecimal weight = getEdgeLength(resultEdge);
   
View Full Code Here

TOP

Related Classes of lt.refactory.primsAlgo.service.algorithm.exceptions.AlgorithmException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.