Coverage Summary for Class: AbstractGraph (com.google.common.graph)
| Class | Class, % | Method, % | Line, % |
|---|---|---|---|
| AbstractGraph | 0% (0/1) | 0% (0/4) | 0% (0/15) |
1 /* 2 * Copyright (C) 2016 The Guava Authors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.common.graph; 18 19 import com.google.common.annotations.Beta; 20 import javax.annotation.CheckForNull; 21 22 /** 23 * This class provides a skeletal implementation of {@link Graph}. It is recommended to extend this 24 * class rather than implement {@link Graph} directly. 25 * 26 * @author James Sexton 27 * @param <N> Node parameter type 28 * @since 20.0 29 */ 30 @Beta 31 @ElementTypesAreNonnullByDefault 32 public abstract class AbstractGraph<N> extends AbstractBaseGraph<N> implements Graph<N> { 33 34 @Override 35 public final boolean equals(@CheckForNull Object obj) { 36 if (obj == this) { 37 return true; 38 } 39 if (!(obj instanceof Graph)) { 40 return false; 41 } 42 Graph<?> other = (Graph<?>) obj; 43 44 return isDirected() == other.isDirected() 45 && nodes().equals(other.nodes()) 46 && edges().equals(other.edges()); 47 } 48 49 @Override 50 public final int hashCode() { 51 return edges().hashCode(); 52 } 53 54 /** Returns a string representation of this graph. */ 55 @Override 56 public String toString() { 57 return "isDirected: " 58 + isDirected() 59 + ", allowsSelfLoops: " 60 + allowsSelfLoops() 61 + ", nodes: " 62 + nodes() 63 + ", edges: " 64 + edges(); 65 } 66 }