Package org.apache.giraph.comm.messages.primitives

Examples of org.apache.giraph.comm.messages.primitives.IntFloatMessageStore


    messageStore.addPartitionMessages(0, messages);
  }

  @Test
  public void testIntFloatMessageStore() throws IOException {
    IntFloatMessageStore messageStore =
        new IntFloatMessageStore(service, new FloatSumMessageCombiner());
    insertIntFloatMessages(messageStore);

    Iterable<FloatWritable> m0 =
        messageStore.getVertexMessages(new IntWritable(0));
    Assert.assertEquals(1, Iterables.size(m0));
    Assert.assertEquals((float) 10.0, m0.iterator().next().get());
    Iterable<FloatWritable> m1 =
        messageStore.getVertexMessages(new IntWritable(1));
    Assert.assertEquals(1, Iterables.size(m1));
    Assert.assertEquals((float) 8.0, m1.iterator().next().get());
    Iterable<FloatWritable> m2 =
        messageStore.getVertexMessages(new IntWritable(2));
    Assert.assertEquals(1, Iterables.size(m2));
    Assert.assertEquals((float) 3.0, m2.iterator().next().get());
    Assert.assertTrue(
        Iterables.isEmpty(messageStore.getVertexMessages(new IntWritable(3))));
  }
View Full Code Here


    Class<M> messageClass = messageValueFactory.getValueClass();
    MessageStore messageStore;
    Class<I> vertexIdClass = conf.getVertexIdClass();
    if (vertexIdClass.equals(IntWritable.class) &&
        messageClass.equals(FloatWritable.class)) {
      messageStore = new IntFloatMessageStore(
          (CentralizedServiceWorker<IntWritable, Writable, Writable>) service,
          (MessageCombiner<IntWritable, FloatWritable>)
              conf.<FloatWritable>createMessageCombiner());
    } else if (vertexIdClass.equals(LongWritable.class) &&
        messageClass.equals(DoubleWritable.class)) {
View Full Code Here

TOP

Related Classes of org.apache.giraph.comm.messages.primitives.IntFloatMessageStore

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.