1
2
3
4
5
6
7
8
9
10 package ch.panter.li.bi.asn.value;
11
12 import ch.panter.li.bi.asn.model.AsnType;
13 import ch.panter.li.bi.util.HashCodeTool;
14
15 import java.util.Arrays;
16
17
18 public abstract class AsnByteArrayValueBase extends AsnSimpleValueBase
19 {
20
21
22 {
23 super( type );
24 }
25
26
27 {
28 super( copy );
29 this.data = copy.data != null ? copy.data.clone() : null;
30 }
31
32 protected final byte[] getData()
33 {
34 return data;
35 }
36
37 protected final void setData( final byte[] data )
38 {
39 this.data = data;
40 }
41
42 protected boolean isEqualTo( final Object compare )
43 {
44 final AsnByteArrayValueBase comp = (AsnByteArrayValueBase)compare;
45 return super.isEqualTo( compare ) &&
46 Arrays.equals( this.data, comp.data );
47 }
48
49 protected int computeHashCode( final int baseHash )
50 {
51 int hash = super.computeHashCode( baseHash );
52 hash = HashCodeTool.addHashCode( hash, data );
53 return hash;
54 }
55
56 public String toString()
57 {
58
59 return "[" + ( data == null ? "" : data ) + "]";
60 }
61
62
63 private byte[] data;
64
65 }
66
67