Examples of FloatWritable


Examples of org.apache.hadoop.io.FloatWritable

        key.set(URLUtil.getHost(key.toString()));
      } else {
        key.set(URLUtil.getDomainName(key.toString()));
      }

      output.collect(key, new FloatWritable(number));
    }
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

        }

        numCollected++;
      }

      output.collect(key, new FloatWritable(sumOrMax));
    }
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

    public FloatWritable removeEdge(LongWritable targetVertexId) {
        long target = targetVertexId.get();
        if (verticesWithEdgeValues.containsKey(target)) {
            float value = verticesWithEdgeValues.get(target);
            verticesWithEdgeValues.removeKey(target);
            return new FloatWritable(value);
        } else {
            return null;
        }
    }
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

        };
    }

    @Override
    public FloatWritable getEdgeValue(LongWritable targetVertexId) {
        return new FloatWritable(
            verticesWithEdgeValues.get(targetVertexId.get()));
    }
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

            long destVertexId =
                (vertexId.get() + 1) %
                (inputSplit.getNumSplits() * totalRecords);
            float edgeValue = vertexId.get() * 100f;
            Map<LongWritable, FloatWritable> edges = Maps.newHashMap();
            edges.put(new LongWritable(destVertexId), new FloatWritable(edgeValue));
            vertex.initialize(vertexId, vertexValue, edges, null);
            ++recordsRead;
            if (LOG.isInfoEnabled()) {
          LOG.info("next: Return vertexId=" + vertex.getVertexId().get() +
                   ", vertexValue=" + vertex.getVertexValue() +
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

                    instantiateVertex(vertexIndex, null, null, null);
            addVertexRequest(vertex);
            // Add edges to those remote vertices as well
            addEdgeRequest(vertexIndex,
                           new Edge<LongWritable, FloatWritable>(
                               getVertexId(), new FloatWritable(0.0f)));
        } else if (getSuperstep() == 4) {
        } else if (getSuperstep() == 5) {
          long vertexCount = workerContext.getVertexCount();
            if (vertexCount * 2 != getNumVertices()) {
                throw new IllegalStateException(
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

        }
        List<LongWritable> messageList = Lists.newArrayList();
        messageList.add(new LongWritable(4));
        messageList.add(new LongWritable(5));
        vertex.initialize(
            new IntWritable(2), new FloatWritable(3.0f), edgeMap, messageList);
        byte[] byteArray = WritableUtils.writeToByteArray(vertex);
        IFDLEdgeListVertex readVertex = (IFDLEdgeListVertex)
            BspUtils.<IntWritable, FloatWritable, DoubleWritable, LongWritable>
            createVertex(job.getConfiguration());
        WritableUtils.readFieldsFromByteArray(byteArray, readVertex);
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

     */
    public void testOnShorterPathFound() throws Exception {

        SimpleShortestPathsVertex vertex = new SimpleShortestPathsVertex();
        vertex.initialize(null, null, null, null);
        vertex.addEdge(new LongWritable(10L), new FloatWritable(2.5f));
        vertex.addEdge(new LongWritable(20L), new FloatWritable(0.5f));

        MockUtils.MockedEnvironment<LongWritable, DoubleWritable, FloatWritable,
                DoubleWritable> env = MockUtils.prepareVertex(vertex, 1L,
                new LongWritable(7L), new DoubleWritable(Double.MAX_VALUE),
                false);
View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

     */
    public void testOnNoShorterPathFound() throws Exception {

        SimpleShortestPathsVertex vertex = new SimpleShortestPathsVertex();
        vertex.initialize(null, null, null, null);
        vertex.addEdge(new LongWritable(10L), new FloatWritable(2.5f));
        vertex.addEdge(new LongWritable(20L), new FloatWritable(0.5f));

        MockUtils.MockedEnvironment<LongWritable, DoubleWritable, FloatWritable,
                DoubleWritable> env = MockUtils.prepareVertex(vertex, 1L,
                new LongWritable(7L), new DoubleWritable(0.5), false);

View Full Code Here

Examples of org.apache.hadoop.io.FloatWritable

                     " vertex value = " + getVertexValue());
        }
        if (minDist < getVertexValue().get()) {
            setVertexValue(new DoubleWritable(minDist));
            for (LongWritable targetVertexId : this) {
                FloatWritable edgeValue = getEdgeValue(targetVertexId);
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Vertex " + getVertexId() + " sent to " +
                              targetVertexId + " = " +
                              (minDist + edgeValue.get()));
                }
                sendMsg(targetVertexId,
                        new DoubleWritable(minDist + edgeValue.get()));
            }
        }
        voteToHalt();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.