aboutsummaryrefslogtreecommitdiffstats
path: root/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java
diff options
context:
space:
mode:
Diffstat (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java')
-rw-r--r--lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java174
1 files changed, 87 insertions, 87 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java
index fc104e9564..c8c8d2221a 100644
--- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java
+++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangFun.java
@@ -1,27 +1,27 @@
/*
* %CopyrightBegin%
- *
+ *
* Copyright Ericsson AB 2009. All Rights Reserved.
- *
- * The contents of this file are subject to the Erlang Public License,
- * Version 1.1, (the "License"); you may not use this file except in
- * compliance with the License. You should have received a copy of the
- * Erlang Public License along with this software. If not, it can be
- * retrieved online at http://www.erlang.org/.
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * %CopyrightEnd%
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * %CopyrightEnd%
*/
package com.ericsson.otp.erlang;
-import java.io.Serializable;
import java.util.Arrays;
-public class OtpErlangFun extends OtpErlangObject implements Serializable {
+public class OtpErlangFun extends OtpErlangObject {
// don't change this!
private static final long serialVersionUID = -3423031125356706472L;
@@ -35,97 +35,97 @@ public class OtpErlangFun extends OtpErlangObject implements Serializable {
private final byte[] md5;
public OtpErlangFun(final OtpInputStream buf)
- throws OtpErlangDecodeException {
- final OtpErlangFun f = buf.read_fun();
- pid = f.pid;
- module = f.module;
- arity = f.arity;
- md5 = f.md5;
- index = f.index;
- old_index = f.old_index;
- uniq = f.uniq;
- freeVars = f.freeVars;
+ throws OtpErlangDecodeException {
+ final OtpErlangFun f = buf.read_fun();
+ pid = f.pid;
+ module = f.module;
+ arity = f.arity;
+ md5 = f.md5;
+ index = f.index;
+ old_index = f.old_index;
+ uniq = f.uniq;
+ freeVars = f.freeVars;
}
public OtpErlangFun(final OtpErlangPid pid, final String module,
- final long index, final long uniq, final OtpErlangObject[] freeVars) {
- this.pid = pid;
- this.module = module;
- arity = -1;
- md5 = null;
- this.index = index;
- old_index = 0;
- this.uniq = uniq;
- this.freeVars = freeVars;
+ final long index, final long uniq, final OtpErlangObject[] freeVars) {
+ this.pid = pid;
+ this.module = module;
+ arity = -1;
+ md5 = null;
+ this.index = index;
+ old_index = 0;
+ this.uniq = uniq;
+ this.freeVars = freeVars;
}
public OtpErlangFun(final OtpErlangPid pid, final String module,
- final int arity, final byte[] md5, final int index,
- final long old_index, final long uniq,
- final OtpErlangObject[] freeVars) {
- this.pid = pid;
- this.module = module;
- this.arity = arity;
- this.md5 = md5;
- this.index = index;
- this.old_index = old_index;
- this.uniq = uniq;
- this.freeVars = freeVars;
+ final int arity, final byte[] md5, final int index,
+ final long old_index, final long uniq,
+ final OtpErlangObject[] freeVars) {
+ this.pid = pid;
+ this.module = module;
+ this.arity = arity;
+ this.md5 = md5;
+ this.index = index;
+ this.old_index = old_index;
+ this.uniq = uniq;
+ this.freeVars = freeVars;
}
@Override
public void encode(final OtpOutputStream buf) {
- buf
- .write_fun(pid, module, old_index, arity, md5, index, uniq,
- freeVars);
+ buf.write_fun(pid, module, old_index, arity, md5, index, uniq, freeVars);
}
@Override
public boolean equals(final Object o) {
- if (!(o instanceof OtpErlangFun)) {
- return false;
- }
- final OtpErlangFun f = (OtpErlangFun) o;
- if (!pid.equals(f.pid) || !module.equals(f.module) || arity != f.arity) {
- return false;
- }
- if (md5 == null) {
- if (f.md5 != null) {
- return false;
- }
- } else {
- if (!md5.equals(f.md5)) {
- return false;
- }
- }
- if (index != f.index || uniq != f.uniq) {
- return false;
- }
- if (freeVars == null) {
- return f.freeVars == null;
- }
- return freeVars.equals(f.freeVars);
+ if (!(o instanceof OtpErlangFun)) {
+ return false;
+ }
+ final OtpErlangFun f = (OtpErlangFun) o;
+ if (!pid.equals(f.pid) || !module.equals(f.module) || arity != f.arity) {
+ return false;
+ }
+ if (md5 == null) {
+ if (f.md5 != null) {
+ return false;
+ }
+ } else {
+ if (!Arrays.equals(md5, f.md5)) {
+ return false;
+ }
+ }
+ if (index != f.index || uniq != f.uniq) {
+ return false;
+ }
+ if (freeVars == null) {
+ return f.freeVars == null;
+ }
+ return Arrays.equals(freeVars, f.freeVars);
}
-
+
@Override
protected int doHashCode() {
- OtpErlangObject.Hash hash = new OtpErlangObject.Hash(1);
- hash.combine(pid.hashCode(), module.hashCode());
- hash.combine(arity);
- if (md5 != null) hash.combine(md5);
- hash.combine(index);
- hash.combine(uniq);
- if (freeVars != null) {
- for (OtpErlangObject o: freeVars) {
- hash.combine(o.hashCode(), 1);
- }
- }
- return hash.valueOf();
+ final OtpErlangObject.Hash hash = new OtpErlangObject.Hash(1);
+ hash.combine(pid.hashCode(), module.hashCode());
+ hash.combine(arity);
+ if (md5 != null) {
+ hash.combine(md5);
+ }
+ hash.combine(index);
+ hash.combine(uniq);
+ if (freeVars != null) {
+ for (final OtpErlangObject o : freeVars) {
+ hash.combine(o.hashCode(), 1);
+ }
+ }
+ return hash.valueOf();
}
-
+
@Override
public String toString() {
- return "#Fun<" + module + "." + old_index + "." + uniq + ">";
+ return "#Fun<" + module + "." + old_index + "." + uniq + ">";
}
}