Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java33
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32Factory.java84
-rw-r--r--core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64Factory.java80
3 files changed, 132 insertions, 65 deletions
diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java
index a0e9edeefd3..160e5121ff6 100644
--- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java
+++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/IAddressFactory.java
@@ -10,8 +10,9 @@
*******************************************************************************/
package org.eclipse.cdt.core;
+import java.math.BigInteger;
-/*
+/**
* This inteface serves as an address factory. If you need to
* implement your own addresses, you should extend this.
*
@@ -19,15 +20,19 @@ package org.eclipse.cdt.core;
*/
public interface IAddressFactory
{
- /*
+ /**
* Returns zero address, i.e. minimal possible address
+ * @return
*/
IAddress getZero();
- /*
+
+ /**
* Returns maximal address.
+ * @return
*/
IAddress getMax();
- /*
+
+ /**
* Creates address from string representation.
*
* 1. This method should be able to create address from hex
@@ -37,15 +42,31 @@ public interface IAddressFactory
* 3. Method should be able to create address from decimal address
* representation
*
- * Please see Addr32Factory.createAddress() for reference implementation.
+ * Please see Addr32Factory.createAddress() for reference implementation.
+ *
+ * @param addr
+ * @return
*/
IAddress createAddress(String addr);
- /*
+
+ /**
* Creates address from string with given radix.
*
* Given string should not contain any prefixes or sign numbers.
*
* Method should be case insensetive
+ *
+ * @param addr
+ * @param radix
+ * @return
*/
IAddress createAddress(String addr, int radix);
+
+ /**
+ * Create address from a BigInteger
+ *
+ * @param addr
+ * @return
+ */
+ IAddress createAddress(BigInteger addr);
}
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32Factory.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32Factory.java
index 029be6546df..38685676a6d 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32Factory.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr32Factory.java
@@ -1,44 +1,66 @@
/*******************************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
+ * Copyright (c) 2004 Intel Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Common Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
+ * Contributors: Intel Corporation - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.utils;
+import java.math.BigInteger;
+
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
+public class Addr32Factory implements IAddressFactory {
-/*
- */
-final public class Addr32Factory implements IAddressFactory
-{
-
- final public IAddress getZero()
- {
- return Addr32.ZERO;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#getZero()
+ */
+ public IAddress getZero() {
+ return Addr32.ZERO;
}
- final public IAddress getMax()
- {
- return Addr32.MAX;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#getMax()
+ */
+ public IAddress getMax() {
+ return Addr32.MAX;
}
-
- final public IAddress createAddress(String addr)
- {
- IAddress address=new Addr32(addr);
- return address;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.lang.String)
+ */
+ public IAddress createAddress(String addr) {
+ IAddress address = new Addr32(addr);
+ return address;
}
-
- final public IAddress createAddress(String addr, int radix)
- {
- IAddress address=new Addr32(addr, radix);
- return address;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.lang.String,
+ * int)
+ */
+ public IAddress createAddress(String addr, int radix) {
+ IAddress address = new Addr32(addr, radix);
+ return address;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.math.BigInteger)
+ */
+ public IAddress createAddress(BigInteger addr) {
+ IAddress address = new Addr32(addr.longValue());
+ return address;
}
-
-}
+} \ No newline at end of file
diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64Factory.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64Factory.java
index e22c11e98cd..e3a0506658a 100644
--- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64Factory.java
+++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/Addr64Factory.java
@@ -1,42 +1,66 @@
/*******************************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
+ * Copyright (c) 2004 Intel Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Common Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/cpl-v10.html
*
- * Contributors:
- * Intel Corporation - Initial API and implementation
- *******************************************************************************/
+ * Contributors: Intel Corporation - Initial API and implementation
+ ******************************************************************************/
package org.eclipse.cdt.utils;
+import java.math.BigInteger;
+
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
+public class Addr64Factory implements IAddressFactory {
-/*
- */
-final public class Addr64Factory implements IAddressFactory{
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#getZero()
+ */
+ public IAddress getZero() {
+ return Addr64.ZERO;
+ }
- final public IAddress getZero()
- {
- return Addr64.ZERO;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#getMax()
+ */
+ public IAddress getMax() {
+ return Addr64.MAX;
}
- final public IAddress getMax()
- {
- return Addr64.MAX;
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.lang.String)
+ */
+ public IAddress createAddress(String addr) {
+ IAddress address = new Addr64(addr);
+ return address;
}
-
- final public IAddress createAddress(String addr)
- {
- IAddress address=new Addr64(addr);
- return address;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.lang.String,
+ * int)
+ */
+ public IAddress createAddress(String addr, int radix) {
+ IAddress address = new Addr64(addr, radix);
+ return address;
}
-
- final public IAddress createAddress(String addr, int radix)
- {
- IAddress address=new Addr64(addr, radix);
- return address;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.IAddressFactory#createAddress(java.math.BigInteger)
+ */
+ public IAddress createAddress(BigInteger addr) {
+ IAddress address = new Addr64(addr);
+ return address;
}
-}
+} \ No newline at end of file

Back to the top