Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * Licensed to the Apache Software Foundation (ASF) under one or more
0003  * contributor license agreements.  See the NOTICE file distributed with
0004  * this work for additional information regarding copyright ownership.
0005  * The ASF licenses this file to You under the Apache License, Version 2.0
0006  * (the "License"); you may not use this file except in compliance with
0007  * the License.  You may obtain a copy of the License at
0008  *
0009  *    http://www.apache.org/licenses/LICENSE-2.0
0010  *
0011  * Unless required by applicable law or agreed to in writing, software
0012  * distributed under the License is distributed on an "AS IS" BASIS,
0013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0014  * See the License for the specific language governing permissions and
0015  * limitations under the License.
0016  */
0017 
0018 package org.apache.spark.graphx;
0019 
0020 import java.io.Serializable;
0021 
0022 /**
0023  * Represents a subset of the fields of an [[EdgeTriplet]] or [[EdgeContext]]. This allows the
0024  * system to populate only those fields for efficiency.
0025  */
0026 public class TripletFields implements Serializable {
0027 
0028   /** Indicates whether the source vertex attribute is included. */
0029   public final boolean useSrc;
0030 
0031   /** Indicates whether the destination vertex attribute is included. */
0032   public final boolean useDst;
0033 
0034   /** Indicates whether the edge attribute is included. */
0035   public final boolean useEdge;
0036 
0037   /** Constructs a default TripletFields in which all fields are included. */
0038   public TripletFields() {
0039     this(true, true, true);
0040   }
0041 
0042   public TripletFields(boolean useSrc, boolean useDst, boolean useEdge) {
0043     this.useSrc = useSrc;
0044     this.useDst = useDst;
0045     this.useEdge = useEdge;
0046   }
0047 
0048   /**
0049    * None of the triplet fields are exposed.
0050    */
0051   public static final TripletFields None = new TripletFields(false, false, false);
0052 
0053   /**
0054    * Expose only the edge field and not the source or destination field.
0055    */
0056   public static final TripletFields EdgeOnly = new TripletFields(false, false, true);
0057 
0058   /**
0059    * Expose the source and edge fields but not the destination field. (Same as Src)
0060    */
0061   public static final TripletFields Src = new TripletFields(true, false, true);
0062 
0063   /**
0064    * Expose the destination and edge fields but not the source field. (Same as Dst)
0065    */
0066   public static final TripletFields Dst = new TripletFields(false, true, true);
0067 
0068   /**
0069    * Expose all the fields (source, edge, and destination).
0070    */
0071   public static final TripletFields All = new TripletFields(true, true, true);
0072 }