Example usage for org.apache.hadoop.io IntWritable set

List of usage examples for org.apache.hadoop.io IntWritable set

Introduction

In this page you can find the example usage for org.apache.hadoop.io IntWritable set.

Prototype

public void set(int value) 

Source Link

Document

Set the value of this IntWritable.

Usage

From source file:org.apache.giraph.combiner.MinimumIntMessageCombiner.java

License:Apache License

@Override
public void combine(WritableComparable vertexIndex, IntWritable originalMessage, IntWritable messageToCombine) {
    if (originalMessage.get() > messageToCombine.get()) {
        originalMessage.set(messageToCombine.get());
    }//from   w w  w  .  j av a  2 s . c om
}

From source file:org.apache.giraph.combiner.SimpleSumCombiner.java

License:Apache License

@Override
public void combine(LongWritable vertexIndex, IntWritable originalMessage, IntWritable messageToCombine) {
    originalMessage.set(originalMessage.get() + messageToCombine.get());
}

From source file:org.apache.giraph.combiner.SimpleSumMessageCombiner.java

License:Apache License

@Override
public void combine(WritableComparable vertexIndex, IntWritable originalMessage, IntWritable messageToCombine) {
    originalMessage.set(originalMessage.get() + messageToCombine.get());
}

From source file:org.apache.giraph.comm.messages.primitives.IntFloatMessageStore.java

License:Apache License

@Override
public void addPartitionMessages(int partitionId, VertexIdMessages<IntWritable, FloatWritable> messages)
        throws IOException {
    IntWritable reusableVertexId = new IntWritable();
    FloatWritable reusableMessage = new FloatWritable();
    FloatWritable reusableCurrentMessage = new FloatWritable();

    Int2FloatOpenHashMap partitionMap = map.get(partitionId);
    synchronized (partitionMap) {
        VertexIdMessageIterator<IntWritable, FloatWritable> iterator = messages.getVertexIdMessageIterator();
        while (iterator.hasNext()) {
            iterator.next();//from  w ww  .j av a  2  s  .  c  o m
            int vertexId = iterator.getCurrentVertexId().get();
            float message = iterator.getCurrentMessage().get();
            if (partitionMap.containsKey(vertexId)) {
                reusableVertexId.set(vertexId);
                reusableMessage.set(message);
                reusableCurrentMessage.set(partitionMap.get(vertexId));
                messageCombiner.combine(reusableVertexId, reusableCurrentMessage, reusableMessage);
                message = reusableCurrentMessage.get();
            }
            partitionMap.put(vertexId, message);
        }
    }
}

From source file:org.apache.giraph.edge.primitives.IntEdgeStore.java

License:Apache License

@Override
protected IntWritable getVertexId(Int2ObjectMap.Entry<OutEdges<IntWritable, E>> entry,
        IntWritable representativeVertexId) {
    representativeVertexId.set(entry.getIntKey());
    return representativeVertexId;
}

From source file:org.apache.giraph.hive.common.HiveParsing.java

License:Apache License

/**
 * Parse a Integer ID from a Hive record
 * @param record Hive record to parse//from w  w w  .j a v  a 2  s.  c om
 * @param columnIndex offset of column in row
 * @param reusableId Reusable vertex id object
 * @return IntWritable ID
 */
public static IntWritable parseIntID(HiveReadableRecord record, int columnIndex, IntWritable reusableId) {
    reusableId.set(parseInt(record, columnIndex));
    return reusableId;
}

From source file:org.apache.giraph.types.ByteToIntWritableWrapper.java

License:Apache License

@Override
public void wrap(Byte javaValue, IntWritable writableValue) {
    writableValue.set(javaValue.intValue());
}

From source file:org.apache.giraph.types.IntToIntWritableWrapper.java

License:Apache License

@Override
public void wrap(Integer javaValue, IntWritable writableValue) {
    writableValue.set(javaValue);
}

From source file:org.apache.giraph.types.ops.collections.array.WIntArrayList.java

License:Apache License

@Override
public void getIntoW(int index, IntWritable to) {
    to.set(getInt(index));
}

From source file:org.apache.giraph.types.ops.collections.array.WIntArrayList.java

License:Apache License

@Override
public void popIntoW(IntWritable to) {
    to.set(popInt());
}