Coverage Report - org.apache.maven.archiva.dependency.graph.DependencyGraphEdge
 
Classes in this File Line Coverage Branch Coverage Complexity
DependencyGraphEdge
0%
0/60
0%
0/24
1.944
 
 1  
 package org.apache.maven.archiva.dependency.graph;
 2  
 
 3  
 /*
 4  
  * Licensed to the Apache Software Foundation (ASF) under one
 5  
  * or more contributor license agreements.  See the NOTICE file
 6  
  * distributed with this work for additional information
 7  
  * regarding copyright ownership.  The ASF licenses this file
 8  
  * to you under the Apache License, Version 2.0 (the
 9  
  * "License"); you may not use this file except in compliance
 10  
  * with the License.  You may obtain a copy of the License at
 11  
  *
 12  
  *  http://www.apache.org/licenses/LICENSE-2.0
 13  
  *
 14  
  * Unless required by applicable law or agreed to in writing,
 15  
  * software distributed under the License is distributed on an
 16  
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 17  
  * KIND, either express or implied.  See the License for the
 18  
  * specific language governing permissions and limitations
 19  
  * under the License.
 20  
  */
 21  
 
 22  
 import org.apache.maven.archiva.model.ArtifactReference;
 23  
 import org.apache.maven.archiva.model.DependencyScope;
 24  
 
 25  
 /**
 26  
  * DependencyGraphEdge 
 27  
  *
 28  
  * @version $Id: DependencyGraphEdge.java 718864 2008-11-19 06:33:35Z brett $
 29  
  */
 30  
 public class DependencyGraphEdge
 31  
 {
 32  
     private ArtifactReference nodeFrom;
 33  
 
 34  
     private ArtifactReference nodeTo;
 35  
 
 36  
     private String scope;
 37  
     
 38  0
     private boolean disabled = false;
 39  
 
 40  
     private int disabledType;
 41  
 
 42  
     private String disabledReason;
 43  
 
 44  
     public DependencyGraphEdge( ArtifactReference fromNode, ArtifactReference toNode )
 45  
     {
 46  0
         super();
 47  0
         this.nodeFrom = fromNode;
 48  0
         this.nodeTo = toNode;
 49  0
         this.scope = DependencyScope.COMPILE;
 50  0
     }
 51  
 
 52  
     public boolean equals( Object obj )
 53  
     {
 54  0
         if ( this == obj )
 55  
         {
 56  0
             return true;
 57  
         }
 58  0
         if ( obj == null )
 59  
         {
 60  0
             return false;
 61  
         }
 62  0
         if ( getClass() != obj.getClass() )
 63  
         {
 64  0
             return false;
 65  
         }
 66  0
         final DependencyGraphEdge other = (DependencyGraphEdge) obj;
 67  0
         if ( nodeFrom == null )
 68  
         {
 69  0
             if ( other.nodeFrom != null )
 70  
             {
 71  0
                 return false;
 72  
             }
 73  
         }
 74  0
         else if ( !nodeFrom.equals( other.nodeFrom ) )
 75  
         {
 76  0
             return false;
 77  
         }
 78  0
         if ( nodeTo == null )
 79  
         {
 80  0
             if ( other.nodeTo != null )
 81  
             {
 82  0
                 return false;
 83  
             }
 84  
         }
 85  0
         else if ( !nodeTo.equals( other.nodeTo ) )
 86  
         {
 87  0
             return false;
 88  
         }
 89  0
         return true;
 90  
     }
 91  
 
 92  
     public String getDisabledReason()
 93  
     {
 94  0
         return disabledReason;
 95  
     }
 96  
 
 97  
     public int getDisabledType()
 98  
     {
 99  0
         return disabledType;
 100  
     }
 101  
 
 102  
     public ArtifactReference getNodeFrom()
 103  
     {
 104  0
         return nodeFrom;
 105  
     }
 106  
 
 107  
     public ArtifactReference getNodeTo()
 108  
     {
 109  0
         return nodeTo;
 110  
     }
 111  
 
 112  
     public String getScope()
 113  
     {
 114  0
         return scope;
 115  
     }
 116  
 
 117  
     public int hashCode()
 118  
     {
 119  0
         final int PRIME = 31;
 120  0
         int result = 1;
 121  0
         result = PRIME * result + ( ( nodeFrom == null ) ? 0 : nodeFrom.hashCode() );
 122  0
         result = PRIME * result + ( ( nodeTo == null ) ? 0 : nodeTo.hashCode() );
 123  0
         return result;
 124  
     }
 125  
 
 126  
     public boolean isDisabled()
 127  
     {
 128  0
         return disabled;
 129  
     }
 130  
 
 131  
     public void setDisabled( boolean disabled )
 132  
     {
 133  0
         this.disabled = disabled;
 134  0
         if( this.disabled == false )
 135  
         {
 136  0
             this.disabledReason = null;
 137  0
             this.disabledType = -1;
 138  
         }
 139  0
     }
 140  
 
 141  
     public void setDisabledReason( String disabledReason )
 142  
     {
 143  0
         this.disabledReason = disabledReason;
 144  0
     }
 145  
 
 146  
     public void setDisabledType( int disabledType )
 147  
     {
 148  0
         this.disabledType = disabledType;
 149  0
     }
 150  
     
 151  
     public void setNodeFrom( ArtifactReference ref )
 152  
     {
 153  0
         this.nodeFrom = ref;
 154  0
     }
 155  
 
 156  
     public void setNodeFrom( DependencyGraphNode node )
 157  
     {
 158  0
         this.nodeFrom = node.getArtifact();
 159  0
     }
 160  
     
 161  
     public void setNodeTo( ArtifactReference ref )
 162  
     {
 163  0
         this.nodeTo = ref;
 164  0
     }
 165  
 
 166  
     public void setNodeTo( DependencyGraphNode node )
 167  
     {
 168  0
         this.nodeTo = node.getArtifact();
 169  0
     }
 170  
 
 171  
     public void setScope( String scope )
 172  
     {
 173  0
         this.scope = scope;
 174  0
     }
 175  
 
 176  
     public String toString()
 177  
     {
 178  0
         StringBuffer sb = new StringBuffer();
 179  
 
 180  0
         sb.append( "GraphEdge[" );
 181  0
         sb.append( "from=" ).append( DependencyGraphKeys.toKey( nodeFrom ) );
 182  0
         sb.append( ",to=" ).append( DependencyGraphKeys.toKey( nodeTo ) );
 183  0
         sb.append( "]" );
 184  
 
 185  0
         return sb.toString();
 186  
     }
 187  
 }