All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bidib.wizard.api.model.connection.AbstractMessageEvent Maven / Gradle / Ivy

There is a newer version: 2.0.29
Show newest version
package org.bidib.wizard.api.model.connection;

import java.util.Arrays;

import org.bidib.wizard.api.model.NodeInterface;

public abstract class AbstractMessageEvent extends AbstractQueueEvent {

    private final byte[] address;

    private final int messageNum;

    private final int messageType;

    /**
     * @param connectionId
     * @param address
     */
    public AbstractMessageEvent(String connectionId, byte[] address, int messageNum, int messageType) {
        super(connectionId);
        this.address = address;
        this.messageNum = messageNum;
        this.messageType = messageType;
    }

    /**
     * @return the address
     */
    public byte[] getAddress() {
        return address;
    }

    /**
     * @return the messageNum
     */
    public int getMessageNum() {
        return messageNum;
    }

    /**
     * @return the messageType
     */
    public int getMessageType() {
        return messageType;
    }

    /**
     * Check if the node is matching.
     * 
     * @param node
     *            the node
     * @return {@code true}: the node is matching, {@code false} otherwise
     */
    public boolean isMatchingNode(final NodeInterface node) {

        if (node != null && Arrays.equals(getAddress(), node.getAddr())) {
            return true;
        }
        return false;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy