Coverage Report - org.apache.giraph.bsp.BspInputSplit
 
Classes in this File Line Coverage Branch Coverage Complexity
BspInputSplit
0%
0/19
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  
 
 19  
 package org.apache.giraph.bsp;
 20  
 
 21  
 import java.io.DataInput;
 22  
 import java.io.DataOutput;
 23  
 import java.io.IOException;
 24  
 
 25  
 import org.apache.hadoop.io.Writable;
 26  
 import org.apache.hadoop.mapreduce.InputSplit;
 27  
 
 28  
 /**
 29  
  * This InputSplit will not give any ordering or location data.
 30  
  * It is used internally by BspInputFormat (which determines
 31  
  * how many tasks to run the application on).  Users should not use this
 32  
  * directly.
 33  
  */
 34  
 public class BspInputSplit extends InputSplit implements Writable {
 35  
   /** Number of splits */
 36  0
   private int numSplits = -1;
 37  
   /** Split index */
 38  0
   private int splitIndex = -1;
 39  
 
 40  
   /**
 41  
    * Reflection constructor.
 42  
    */
 43  0
   public BspInputSplit() { }
 44  
 
 45  
   /**
 46  
    * Constructor used by {@link BspInputFormat}.
 47  
    *
 48  
    * @param splitIndex Index of this split.
 49  
    * @param numSplits Total number of splits.
 50  
    */
 51  0
   public BspInputSplit(int splitIndex, int numSplits) {
 52  0
     this.splitIndex = splitIndex;
 53  0
     this.numSplits = numSplits;
 54  0
   }
 55  
 
 56  
   @Override
 57  
   public long getLength() throws IOException, InterruptedException {
 58  0
     return 0;
 59  
   }
 60  
 
 61  
   @Override
 62  
   public String[] getLocations() throws IOException, InterruptedException {
 63  0
     return new String[]{};
 64  
   }
 65  
 
 66  
   @Override
 67  
   public void readFields(DataInput in) throws IOException {
 68  0
     splitIndex = in.readInt();
 69  0
     numSplits = in.readInt();
 70  0
   }
 71  
 
 72  
   @Override
 73  
   public void write(DataOutput out) throws IOException {
 74  0
     out.writeInt(splitIndex);
 75  0
     out.writeInt(numSplits);
 76  0
   }
 77  
 
 78  
   /**
 79  
    * Get the index of this split.
 80  
    *
 81  
    * @return Index of this split.
 82  
    */
 83  
   public int getSplitIndex() {
 84  0
     return splitIndex;
 85  
   }
 86  
 
 87  
   /**
 88  
    * Get the number of splits for this application.
 89  
    *
 90  
    * @return Total number of splits.
 91  
    */
 92  
   public int getNumSplits() {
 93  0
     return numSplits;
 94  
   }
 95  
 
 96  
   @Override
 97  
   public String toString() {
 98  0
     return "'" + getClass().getCanonicalName() +
 99  0
       ", index=" + getSplitIndex() + ", num=" + getNumSplits();
 100  
   }
 101  
 }