EMMA Coverage Report (generated Mon Aug 23 17:21:34 CEST 2010)
[all classes][dmg.cells.nucleus]

COVERAGE SUMMARY FOR SOURCE FILE [CellAddressCore.java]

nameclass, %method, %block, %line, %
CellAddressCore.java100% (1/1)100% (7/7)78%  (105/135)79%  (19/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CellAddressCore100% (1/1)100% (7/7)78%  (105/135)79%  (19/24)
CellAddressCore (String): void 100% (1/1)56%  (29/52)64%  (7/11)
equals (Object): boolean 100% (1/1)83%  (24/29)78%  (3.1/4)
toString (): String 100% (1/1)91%  (21/23)91%  (0.9/1)
CellAddressCore (String, String): void 100% (1/1)100% (22/22)100% (5/5)
getCellDomainName (): String 100% (1/1)100% (3/3)100% (1/1)
getCellName (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (3/3)100% (1/1)

1package dmg.cells.nucleus;
2 
3import java.io.Serializable;
4 
5/**
6 *
7 * Is the core of the CellDomain addressing scheme. The
8 * <code>CellAddressCore</code> specifies the name of the cell and the name of
9 * the domain the cell exists in.<br>
10 * <strong>This Class is designed to be immutable. The whole package relies on
11 * that fact. </strong>
12 *
13 * @author Patrick Fuhrmann
14 * @version 0.1,02/15/1998
15 *
16 *
17 */
18 
19/*
20 * @Immutable
21 */
22public class CellAddressCore implements Cloneable, Serializable {
23 
24    static final long serialVersionUID = 4072907109959708379L;
25 
26    private final String _domain;
27    private final String _cell;
28 
29    /**
30     * while CellAddressCore always used in CellPath, where it stored inside
31     * List, store pre-calculated hashcode;
32     */
33    private final int _hashcode;
34 
35    /**
36     * Creates a CellAddressCore by scanning the argument string. The syntax can
37     * be only one of the following :<br>
38     * <cellName> or <cellName>@<domainName>. If the <domainName> is omitted,
39     * the keyword 'local' is used instead.
40     *
41     * @param addr
42     *            the cell address specification which is interpreted as
43     *            described above. The specified <code>addr</code> is not
44     *            checked for existence.
45     * @return the immutable CellAddressCore.
46     *
47     */
48    public CellAddressCore(String addr) {
49        int ind = addr.indexOf('@');
50        if (ind < 0) {
51            _cell = addr;
52            _domain = "local";
53        } else {
54            _cell = addr.substring(0, ind);
55            if (ind == (addr.length() - 1))
56                _domain = "local";
57            else
58                _domain = addr.substring(ind + 1);
59        }
60 
61        _hashcode = (_domain + _cell).hashCode();
62    }
63 
64    public CellAddressCore(String addr, String domain) {
65        _cell = addr;
66        _domain = domain;
67        _hashcode = (_domain + _cell).hashCode();
68    }
69 
70    /*
71    CellAddressCore getClone(){
72       try {
73          return (CellAddressCore)this.clone() ;
74       }catch( CloneNotSupportedException cnse ){
75          return null ;
76       }
77    }
78    */
79    public String getCellName() {
80        return _cell;
81    }
82 
83    public String getCellDomainName() {
84        return _domain;
85    }
86 
87    @Override
88    public String toString() {
89        return (_cell != null ? _cell : "UnknownCell") + "@"
90                + (_domain != null ? _domain : "UnknownDomain");
91    }
92 
93    @Override
94    public boolean equals(Object obj) {
95 
96        if (obj == this) return true;
97        if (!(obj instanceof CellAddressCore)) return false;
98 
99        CellAddressCore other = (CellAddressCore) obj;
100        return other._domain.equals(_domain) && other._cell.equals(_cell);
101    }
102 
103    @Override
104    public int hashCode() {
105        return _hashcode;
106    }
107 
108}

[all classes][dmg.cells.nucleus]
EMMA 2.0.5312 (C) Vladimir Roubtsov