1 package org.apache.maven.plugin.cxx.utils.svn;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.codehaus.plexus.util.StringUtils;
22
23
24
25
26
27 public class SvnExternalEntry
28 {
29 public String revision = null;
30 public String origin = null;
31 public String targetDir = null;
32 public String comment = null;
33
34 public boolean isValide()
35 {
36 return ! StringUtils.isEmpty( comment )
37 || ( ! StringUtils.isEmpty( origin ) && ! StringUtils.isEmpty( targetDir ) );
38 }
39
40 public String toString()
41 {
42 return "" + ( ( null != comment ) ? comment
43 : ( ( ( null != revision ) ? revision + " " : "" ) + ( ( null != origin ) ? origin : "" )
44 + " " + ( ( null != targetDir ) ? targetDir : "" ) ) );
45 }
46
47 @Override
48 public boolean equals( Object other )
49 {
50 if ( other == null )
51 {
52 return false;
53 }
54 if ( other == this )
55 {
56 return true;
57 }
58 if ( !( other instanceof SvnExternalEntry ) )
59 {
60 return false;
61 }
62 SvnExternalEntry otherExternalEntry = (SvnExternalEntry) other;
63
64 if ( null != comment || null != otherExternalEntry.comment )
65 {
66 return false;
67 }
68
69 return StringUtils.equals( origin, otherExternalEntry.origin )
70 || StringUtils.equals( targetDir, otherExternalEntry.targetDir );
71 }
72
73 @Override
74 public int hashCode()
75 {
76 return null != comment ? super.hashCode()
77 : null != targetDir ? null != origin
78 ? ( origin + targetDir ).hashCode() : targetDir.hashCode()
79 : null != origin ? origin.hashCode() : 0;
80 }
81 }