Coverage Report - org.apache.giraph.conf.PerGraphTypeBooleanConfOption
 
Classes in this File Line Coverage Branch Coverage Complexity
PerGraphTypeBooleanConfOption
0%
0/18
0%
0/5
2.286
PerGraphTypeBooleanConfOption$1
0%
0/1
N/A
2.286
 
 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  
  * Boolean Configuration option per user graph type (IVEMM)
 25  
  */
 26  
 public class PerGraphTypeBooleanConfOption {
 27  
   /** option for vertex id */
 28  
   private final BooleanConfOption vertexId;
 29  
   /** option for vertex value */
 30  
   private final BooleanConfOption vertexValue;
 31  
   /** option for edge value */
 32  
   private final BooleanConfOption edgeValue;
 33  
   /** option for outgoing message */
 34  
   private final BooleanConfOption outgoingMessage;
 35  
 
 36  
   /**
 37  
    * Constructor
 38  
    *
 39  
    * @param keyPrefix Configuration key prefix
 40  
    * @param defaultValue default value
 41  
    * @param description description of the option
 42  
    */
 43  
   public PerGraphTypeBooleanConfOption(String keyPrefix,
 44  0
       boolean defaultValue, String description) {
 45  0
     vertexId = new BooleanConfOption(keyPrefix + ".vertex.id",
 46  
         defaultValue, description);
 47  0
     vertexValue = new BooleanConfOption(keyPrefix + ".vertex.value",
 48  
         defaultValue, description);
 49  0
     edgeValue = new BooleanConfOption(keyPrefix + ".edge.value",
 50  
         defaultValue, description);
 51  0
     outgoingMessage = new BooleanConfOption(keyPrefix + ".outgoing.message",
 52  
         defaultValue, description);
 53  0
   }
 54  
 
 55  
   /**
 56  
    * Get option for given GraphType
 57  
    *
 58  
    * @param graphType GraphType
 59  
    * @return BooleanConfOption for given graph type
 60  
    */
 61  
   public BooleanConfOption get(GraphType graphType) {
 62  0
     switch (graphType) {
 63  
     case VERTEX_ID:
 64  0
       return vertexId;
 65  
     case VERTEX_VALUE:
 66  0
       return vertexValue;
 67  
     case EDGE_VALUE:
 68  0
       return edgeValue;
 69  
     case OUTGOING_MESSAGE_VALUE:
 70  0
       return outgoingMessage;
 71  
     default:
 72  0
       throw new IllegalArgumentException(
 73  
           "Don't know how to handle GraphType " + graphType);
 74  
     }
 75  
   }
 76  
 
 77  
   /**
 78  
    * Set value for given GraphType
 79  
    *
 80  
    * @param conf Configuration
 81  
    * @param graphType GraphType
 82  
    * @param value data
 83  
    */
 84  
   public void set(Configuration conf, GraphType graphType, boolean value) {
 85  0
     get(graphType).set(conf, value);
 86  0
   }
 87  
 
 88  
   public BooleanConfOption getEdgeValue() {
 89  0
     return edgeValue;
 90  
   }
 91  
 
 92  
   public BooleanConfOption getOutgoingMessage() {
 93  0
     return outgoingMessage;
 94  
   }
 95  
 
 96  
   public BooleanConfOption getVertexId() {
 97  0
     return vertexId;
 98  
   }
 99  
 
 100  
   public BooleanConfOption getVertexValue() {
 101  0
     return vertexValue;
 102  
   }
 103  
 }
 104