root / mobile / src / main / java / org / wannatrak / mobile / model / Cell.java @ 37

View | Annotate | Download

1
/*
2
 * Copyright 2009 Andrey Khalzov, and individual contributors as indicated by the @author tag.
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,
11
 * software 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 limitations under the License.
14
 */
15
16
package org.wannatrak.mobile.model;
17
18
/**
19
 * Created 16.10.2009 1:07:35
20
 *
21
 * @author Andrey Khalzov
22
 */
23
public class Cell {
24
    public String cellID;
25
    public String mobileCountryCode;
26
    public String mobileNetworkCode;
27
    public String locationAreaCode;
28
29
    public Cell(String cellID, String mobileCountryCode, String mobileNetworkCode, String locationAreaCode) {
30
        this.cellID = cellID;
31
        this.mobileCountryCode = mobileCountryCode;
32
        this.mobileNetworkCode = mobileNetworkCode;
33
        this.locationAreaCode = locationAreaCode;
34
    }
35
36
    public String toString() {
37
        return cellID + " " + mobileCountryCode + " " + mobileNetworkCode + " " + locationAreaCode;
38
    }
39
40
    public boolean equals(Object o) {
41
        if (o instanceof Cell) {
42
            final Cell cell = (Cell) o;
43
44
            //true if one of values is null
45
            return cell.cellID == null
46
                    || cell.mobileCountryCode == null
47
                    || cell.mobileNetworkCode == null
48
                    || cell.locationAreaCode == null
49
                    || 
50
                    cell.cellID.equals(cellID)
51
                    && cell.mobileCountryCode.equals(mobileCountryCode)
52
                    && cell.mobileNetworkCode.equals(mobileNetworkCode)
53
                    && cell.locationAreaCode.equals(locationAreaCode);
54
55
        }
56
57
        return false;
58
    }
59
}