Coverage Report - org.apache.giraph.conf.PerGraphTypeBoolean
 
Classes in this File Line Coverage Branch Coverage Complexity
PerGraphTypeBoolean
0%
0/27
0%
0/5
1.818
PerGraphTypeBoolean$1
0%
0/1
N/A
1.818
 
 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.conf;
 19  
 
 20  
 import org.apache.giraph.graph.GraphType;
 21  
 import org.apache.hadoop.conf.Configuration;
 22  
 
 23  
 /**
 24  
  * A boolean stored per user graph type
 25  
  */
 26  0
 public class PerGraphTypeBoolean {
 27  
   /** data for vertex id */
 28  
   private boolean vertexId;
 29  
   /** data for vertex value */
 30  
   private boolean vertexValue;
 31  
   /** data for edge value */
 32  
   private boolean edgeValue;
 33  
   /** data for outgoing message */
 34  
   private boolean outgoingMessage;
 35  
 
 36  
   /**
 37  
    * Create from options and configuration
 38  
    *
 39  
    * @param options pre user graph type options
 40  
    * @param conf configuration
 41  
    * @return new object
 42  
    */
 43  
   public static PerGraphTypeBoolean readFromConf(
 44  
       PerGraphTypeBooleanConfOption options, Configuration conf) {
 45  0
     PerGraphTypeBoolean pgtb = new PerGraphTypeBoolean();
 46  0
     pgtb.setFrom(options, conf);
 47  0
     return pgtb;
 48  
   }
 49  
 
 50  
   /**
 51  
    * Set data from per user graph type set of options
 52  
    *
 53  
    * @param options per user graph type options
 54  
    * @param conf Configuration
 55  
    */
 56  
   public void setFrom(PerGraphTypeBooleanConfOption options,
 57  
       Configuration conf) {
 58  0
     setVertexId(options.getVertexId(), conf);
 59  0
     setVertexValue(options.getVertexValue(), conf);
 60  0
     setEdgeValue(options.getEdgeValue(), conf);
 61  0
     setOutgoingMessage(options.getOutgoingMessage(), conf);
 62  0
   }
 63  
 
 64  
   /**
 65  
    * Set the vertex id data from the option
 66  
    *
 67  
    * @param option EnumConfOption option to use
 68  
    * @param conf Configuration
 69  
    */
 70  
   public void setVertexId(BooleanConfOption option, Configuration conf) {
 71  0
     vertexId = option.get(conf);
 72  0
   }
 73  
 
 74  
   /**
 75  
    * Set the vertex value data from the option
 76  
    *
 77  
    * @param option EnumConfOption option to use
 78  
    * @param conf Configuration
 79  
    */
 80  
   public void setVertexValue(BooleanConfOption option, Configuration conf) {
 81  0
     vertexValue = option.get(conf);
 82  0
   }
 83  
 
 84  
   /**
 85  
    * Set the edge value data from the option
 86  
    *
 87  
    * @param option EnumConfOption option to use
 88  
    * @param conf Configuration
 89  
    */
 90  
   public void setEdgeValue(BooleanConfOption option, Configuration conf) {
 91  0
     edgeValue = option.get(conf);
 92  0
   }
 93  
 
 94  
   /**
 95  
    * Set the outgoing message value data from the option
 96  
    *
 97  
    * @param option EnumConfOption option to use
 98  
    * @param conf Configuration
 99  
    */
 100  
   public void setOutgoingMessage(BooleanConfOption option, Configuration conf) {
 101  0
     outgoingMessage = option.get(conf);
 102  0
   }
 103  
 
 104  
   /**
 105  
    * Get data for given GraphType
 106  
    *
 107  
    * @param graphType GraphType
 108  
    * @return data for given graph type
 109  
    */
 110  
   public boolean get(GraphType graphType) {
 111  0
     switch (graphType) {
 112  
     case VERTEX_ID:
 113  0
       return vertexId;
 114  
     case VERTEX_VALUE:
 115  0
       return vertexValue;
 116  
     case EDGE_VALUE:
 117  0
       return edgeValue;
 118  
     case OUTGOING_MESSAGE_VALUE:
 119  0
       return outgoingMessage;
 120  
     default:
 121  0
       throw new IllegalArgumentException(
 122  
           "Don't know how to handle GraphType " + graphType);
 123  
     }
 124  
   }
 125  
 
 126  
   public boolean getEdgeValue() {
 127  0
     return edgeValue;
 128  
   }
 129  
 
 130  
   public boolean getOutgoingMessage() {
 131  0
     return outgoingMessage;
 132  
   }
 133  
 
 134  
   public boolean getVertexId() {
 135  0
     return vertexId;
 136  
   }
 137  
 
 138  
   public boolean getVertexValue() {
 139  0
     return vertexValue;
 140  
   }
 141  
 }