diff --git a/com.ibm.wala.core/src/com/ibm/wala/logic/IntConstant.java b/com.ibm.wala.core/src/com/ibm/wala/logic/IntConstant.java index da3996b7d..db5a30b59 100644 --- a/com.ibm.wala.core/src/com/ibm/wala/logic/IntConstant.java +++ b/com.ibm.wala.core/src/com/ibm/wala/logic/IntConstant.java @@ -10,8 +10,6 @@ *******************************************************************************/ package com.ibm.wala.logic; - - public class IntConstant extends AbstractConstant { private final int val; diff --git a/com.ibm.wala.core/src/com/ibm/wala/logic/LongConstant.java b/com.ibm.wala.core/src/com/ibm/wala/logic/LongConstant.java new file mode 100644 index 000000000..38b2d5c85 --- /dev/null +++ b/com.ibm.wala.core/src/com/ibm/wala/logic/LongConstant.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation. + * 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: + * IBM Corporation - initial API and implementation + *******************************************************************************/ +package com.ibm.wala.logic; + +public class LongConstant extends AbstractConstant { + private final long val; + + protected LongConstant(long val) { + this.val = val; + } + + public static LongConstant make(long val) { + return new LongConstant(val); + } + + public long getVal() { + return val; + } + + @Override + public String toString() { + return String.valueOf(val); + } + + + @Override + public int hashCode() { + final int PRIME = 31; + int result = 1; + result = (int) (PRIME * result + val); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final LongConstant other = (LongConstant) obj; + if (val != other.val) + return false; + return true; + } +}