/*
 * Copyright (c) 2012 Mateusz Parzonka, Eric Bodden
 * 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:
 * Mateusz Parzonka - initial API and implementation
 */
package prm4j.indexing.staticdata;

/**
 * Represents all instances which are compatible with the event instance.
 * <p>
 * Used by {@link EventContext}
 */
public class JoinData {

    // identifies the node, which represents the compatible part of the instance, we want to join with
    private final int[] nodeMask;
    // identifies the monitor set, which contains the monitors carrying the bindings we will join with (they are strictly more
    // informative than the node, selected by the nodeMask)
    private final int monitorSetId;
    // prepares the event bindings for the join
    private final boolean[] extensionPattern;
    // identifies the bindings which will be used for the join, picking out only "new" parameters
    private final int[] copyPattern;

    public JoinData(int[] nodeMask, int monitorSetId, boolean[] extensionPattern, int[] copyPattern) {
	super();
	this.nodeMask = nodeMask;
	this.monitorSetId = monitorSetId;
	this.extensionPattern = extensionPattern;
	this.copyPattern = copyPattern;
    }

    public int[] getNodeMask() {
	return nodeMask;
    }

    public int getMonitorSetId() {
	return monitorSetId;
    }

    public boolean[] getExtensionPattern() {
	return extensionPattern;
    }

    /**
     *
     * { joiningBinding[i1], joinableBinding[j1], joiningBinding[i2], joinableBinding[j2], ... }
     *
     * @return
     */
    public int[] getCopyPattern() {
	return copyPattern;
    }

}

@@ -407,16 +407,42 @@
 cdata;%0A%0A
+import java.util.Arrays;%0A%0A
 /**%0A * R
@@ -1833,10 +1833,1112 @@
 %0A    %7D%0A%0A
+    @Override%0A    public int hashCode() %7B%0A%09final int prime = 31;%0A%09int result = 1;%0A%09result = prime * result + Arrays.hashCode(copyPattern);%0A%09result = prime * result + Arrays.hashCode(extensionPattern);%0A%09result = prime * result + monitorSetId;%0A%09result = prime * result + Arrays.hashCode(nodeMask);%0A%09return result;%0A    %7D%0A%0A    @Override%0A    public boolean equals(Object obj) %7B%0A%09if (this == obj)%0A%09    return true;%0A%09if (obj == null)%0A%09    return false;%0A%09if (getClass() != obj.getClass())%0A%09    return false;%0A%09JoinData other = (JoinData) obj;%0A%09if (!Arrays.equals(copyPattern, other.copyPattern))%0A%09    return false;%0A%09if (!Arrays.equals(extensionPattern, other.extensionPattern))%0A%09    return false;%0A%09if (monitorSetId != other.monitorSetId)%0A%09    return false;%0A%09if (!Arrays.equals(nodeMask, other.nodeMask))%0A%09    return false;%0A%09return true;%0A    %7D%0A%0A    @Override%0A    public String toString() %7B%0A%09return %22JoinData %5BnodeMask=%22 + Arrays.toString(nodeMask) + %22, monitorSetId=%22 + monitorSetId%0A%09%09+ %22, extensionPattern=%22 + Arrays.toString(extensionPattern) + %22, copyPattern=%22%0A%09%09+ Arrays.toString(copyPattern) + %22%5D%22;%0A    %7D%0A%0A%0A
 %7D%0A

Add hashCode, equals and toString to JoinData