Coverage Report - org.apache.giraph.io.formats.IntNullNullTextInputFormat
 
Classes in this File Line Coverage Branch Coverage Complexity
IntNullNullTextInputFormat
0%
0/2
N/A
1
IntNullNullTextInputFormat$IntNullNullNullVertexReader
0%
0/6
N/A
1
 
 1  
 /*
 2  
  * Licensed to the Apache Software Foundation (ASF) under one
 3  
  * or more contributor license agreements.  See the NOTICE file
 4  
  * distributed with this work for additional information
 5  
  * regarding copyright ownership.  The ASF licenses this file
 6  
  * to you under the Apache License, Version 2.0 (the
 7  
  * "License"); you may not use this file except in compliance
 8  
  * with the License.  You may obtain a copy of the License at
 9  
  *
 10  
  *     http://www.apache.org/licenses/LICENSE-2.0
 11  
  *
 12  
  * Unless required by applicable law or agreed to in writing, software
 13  
  * distributed under the License is distributed on an "AS IS" BASIS,
 14  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 15  
  * See the License for the specific language governing permissions and
 16  
  * limitations under the License.
 17  
  */
 18  
 package org.apache.giraph.io.formats;
 19  
 
 20  
 import com.google.common.collect.ImmutableList;
 21  
 import org.apache.giraph.edge.Edge;
 22  
 import org.apache.hadoop.io.IntWritable;
 23  
 import org.apache.hadoop.io.NullWritable;
 24  
 import org.apache.hadoop.io.Text;
 25  
 import org.apache.hadoop.mapreduce.InputSplit;
 26  
 import org.apache.hadoop.mapreduce.TaskAttemptContext;
 27  
 
 28  
 import java.io.IOException;
 29  
 
 30  
 /**
 31  
  * Simple text-based {@link org.apache.giraph.io.VertexInputFormat} for
 32  
  * unweighted graphs without edges or values, just vertices with ids.
 33  
  *
 34  
  * Each line is just simply the vertex id.
 35  
  */
 36  0
 public class IntNullNullTextInputFormat extends TextVertexInputFormat<
 37  
     IntWritable, NullWritable, NullWritable> {
 38  
   @Override
 39  
   public TextVertexReader createVertexReader(
 40  
       InputSplit split, TaskAttemptContext context) throws IOException {
 41  0
     return new IntNullNullNullVertexReader();
 42  
   }
 43  
 
 44  
   /**
 45  
    * Reader for this InputFormat.
 46  
    */
 47  0
   public class IntNullNullNullVertexReader extends
 48  
       TextVertexReaderFromEachLineProcessed<String> {
 49  
     /** Cached vertex id */
 50  
     private IntWritable id;
 51  
 
 52  
     @Override
 53  
     protected String preprocessLine(Text line) throws IOException {
 54  0
       id = new IntWritable(Integer.parseInt(line.toString()));
 55  0
       return line.toString();
 56  
     }
 57  
 
 58  
     @Override
 59  
     protected IntWritable getId(String line) throws IOException {
 60  0
       return id;
 61  
     }
 62  
 
 63  
     @Override
 64  
     protected NullWritable getValue(String line) throws IOException {
 65  0
       return NullWritable.get();
 66  
     }
 67  
 
 68  
     @Override
 69  
     protected Iterable<Edge<IntWritable, NullWritable>> getEdges(String line)
 70  
       throws IOException {
 71  0
       return ImmutableList.of();
 72  
     }
 73  
   }
 74  
 }