Package org.openbel.framework.common

Examples of org.openbel.framework.common.InvalidArgument


     * @throws InvalidArgument
     */
    public static Kam intersection(Kam kam1, Kam kam2) throws InvalidArgument {

        if (!kam1.getKamInfo().equals(kam2.getKamInfo())) {
            throw new InvalidArgument(
                    "Kam1 and Kam2 must reference the same kam in the KamStore");
        }
        List<KamEdge> kamEdges = new ArrayList<KamEdge>();

        // Check for edges in Kam1 that are also in Kam2
View Full Code Here


            throws InvalidArgument {

        // Make sure that all the edges in the edge list are associated with the Kam
        for (KamEdge kamEdge : kamEdges) {
            if (!kamEdge.getKam().getKamInfo().equals(kam.getKamInfo())) {
                throw new InvalidArgument(
                        "Kamedges do not reference the same Kam.");
            }
        }

        // Check for edges in Kam1 that are also in the list
View Full Code Here

            throws InvalidArgument {

        // Make sure that all the edges in the edge list are associated with the Kam
        for (KamEdge kamEdge : kamEdges) {
            if (!kamEdge.getKam().getKamInfo().equals(kam.getKamInfo())) {
                throw new InvalidArgument(
                        "Kamedges do not reference the same Kam.");
            }
        }

        // Create a new kam instance and add the edges
View Full Code Here

     * @throws InvalidArgument
     */
    public static Kam union(Kam kam1, Kam kam2) throws InvalidArgument {

        if (!kam1.getKamInfo().equals(kam2.getKamInfo())) {
            throw new InvalidArgument(
                    "Kam1 and Kam2 must reference the same kam in the KamStore");
        }
        Kam newKam = newInstance(kam1);
        newKam.union(kam1.getEdges());
        newKam.union(kam2.getEdges());
View Full Code Here

     * @throws InvalidArgument
     */
    public static Kam difference(Kam kam1, Kam kam2) throws InvalidArgument {

        if (!kam1.getKamInfo().equals(kam2.getKamInfo())) {
            throw new InvalidArgument(
                    "Kam1 and Kam2 must reference the same kam in the KamStore");
        }
        List<KamEdge> kamEdges = new ArrayList<KamEdge>();

        // First check for edges in Kam1 that are not in Kam2
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public SimplePath[] findPaths(KamNode source, KamNode target) {
        if (source == null) {
            throw new InvalidArgument("Source kam node cannot be null.");
        }

        if (target == null) {
            throw new InvalidArgument("Target kam node cannot be null.");
        }

        if (!kam.contains(source)) {
            throw new InvalidArgument("Source does not exist in KAM.");
        }

        if (!kam.contains(target)) {
            throw new InvalidArgument("Target does not exist in KAM.");
        }

        final Set<KamNode> targets = sizedHashSet(1);
        targets.add(target);

View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public SimplePath[] findPaths(KamNode[] sources, KamNode[] targets) {
        if (sources == null || sources.length == 0) {
            throw new InvalidArgument(
                    "Source kam nodes cannot be null or empty.");
        }

        if (targets == null || targets.length == 0) {
            throw new InvalidArgument(
                    "Target kam nodes cannot be null or empty.");
        }

        for (final KamNode source : sources) {
            if (!kam.contains(source)) {
                throw new InvalidArgument("Source does not exist in KAM.");
            }
        }

        final Set<KamNode> targetSet = new HashSet<KamNode>(targets.length);
        for (final KamNode target : targets) {
            if (!kam.contains(target)) {
                throw new InvalidArgument("Target does not exist in KAM.");
            }

            targetSet.add(target);
        }

        final List<SimplePath> pathsFound = new ArrayList<SimplePath>();
        for (final KamNode source : sources) {
            if (!kam.contains(source)) {
                throw new InvalidArgument("Source does not exist in KAM.");
            }

            pathsFound.addAll(runDepthFirstSearch(kam, source, targetSet));
        }

View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public SimplePath[] interconnect(KamNode[] sources) {
        if (sources == null || sources.length < 2) {
            throw new InvalidArgument(
                    "Source kam nodes cannot be null and must contain at least two source nodes.");
        }

        // build out target set, check that each node is in the KAM
        final Set<KamNode> targetSet = new HashSet<KamNode>(sources.length);
        for (int i = 0; i < sources.length; i++) {
            final KamNode source = sources[i];

            if (!kam.contains(source)) {
                throw new InvalidArgument("Source does not exist in KAM.");
            }

            targetSet.add(source);
        }

View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public SimplePath[] scan(KamNode source) {
        if (source == null) {
            throw new InvalidArgument("Source kam node cannot be null.");
        }

        if (!kam.contains(source)) {
            throw new InvalidArgument("Source does not exist in KAM.");
        }

        final List<SimplePath> pathsFound = runDepthFirstScan(kam, source);
        return pathsFound.toArray(new SimplePath[pathsFound.size()]);
    }
View Full Code Here

     * {@inheritDoc}
     */
    @Override
    public SimplePath[] scan(KamNode[] sources) {
        if (sources == null || sources.length == 0) {
            throw new InvalidArgument(
                    "Source kam nodes cannot be null or empty.");
        }

        for (final KamNode source : sources) {
            if (!kam.contains(source)) {
                throw new InvalidArgument("Source does not exist in KAM.");
            }
        }

        final List<SimplePath> pathsFound = new ArrayList<SimplePath>();
        for (final KamNode source : sources) {
View Full Code Here

TOP

Related Classes of org.openbel.framework.common.InvalidArgument

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.