blob: 415709e5e24222f37223d1c77102f66b659dda19 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/*******************************************************************************
* Copyright (c) 2010, 2012 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Wind River Systems - initial API and implementation
*******************************************************************************/
package org.eclipse.tcf.internal.debug.model;
import java.math.BigInteger;
import java.util.Map;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.services.IMemoryMap;
/**
* A comparable extension of TCFMemoryRegion.
*/
public class TCFMemoryRegion extends org.eclipse.tcf.util.TCFMemoryRegion implements Comparable<TCFMemoryRegion> {
public final BigInteger addr;
public final BigInteger size;
public TCFMemoryRegion(Map<String,Object> props) {
super(props);
this.addr = JSON.toBigInteger((Number)props.get(IMemoryMap.PROP_ADDRESS));
this.size = JSON.toBigInteger((Number)props.get(IMemoryMap.PROP_SIZE));
}
public int compareTo(TCFMemoryRegion r) {
if (addr == null && r.addr == null) return 0;
if (addr == null) return -1;
if (r.addr == null) return +1;
return addr.compareTo(r.addr);
}
@Override
public boolean equals(Object o) {
if (o instanceof TCFMemoryRegion) {
return compareTo((TCFMemoryRegion)o) == 0;
}
return false;
}
@Override
public int hashCode() {
if (addr == null) return 0;
return addr.hashCode();
}
}
|