Package cgl.imr.base

Examples of cgl.imr.base.TwisterException


    try {
      int ID = 0;

      if (values.size() <= 0) {
        System.err.println("Reduce Input Error!");
        throw new TwisterException("Reduce input error no values.");
      }

      for (Value value : values) {
        BytesValue val = (BytesValue) value;
        Node node = new Node(val.getBytes());
       
        ID = node.getID();

        // save only the minimum distance for each edge
        for (int v : node.getEdges().keySet()) {
          if (node.getEdgeWeight(v) < edgeWeights.get(v))
            edgeWeights.put(v, node.getEdgeWeight(v));
        }
      }

      // create the new node with non-redundant edges and edge with minimum
      // distance and emit it
      Node n = new Node(ID);
      for (int i = 1; i <= 1000; i++) {
        if (edgeWeights.get(i) != Integer.MAX_VALUE)
          n.setEdgeWeight(i, edgeWeights.get(i));
      }

      collector.collect(new StringKey("" + n.getID()), new BytesValue(n
          .getBytes()));
    } catch (SerializationException e) {
      e.printStackTrace();
      throw new TwisterException(e);
    }
  }
View Full Code Here


        }
        collector.collect(new StringKey("" + thisNode.getID()),
            new BytesValue(thisNode.getBytes()));
      }
    } catch (SerializationException e) {
      throw new TwisterException(e);
    }
  }
View Full Code Here

      try {
        Node node = new Node(val.getBytes());
        node.printNode("Nodes combined!");
        results.put(node.getID(), node);
      } catch (SerializationException e) {
        throw new TwisterException(e);
      }
     
    }   
  }
View Full Code Here

TOP

Related Classes of cgl.imr.base.TwisterException

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.