Java Code Examples for java.nio.channels.DatagramChannel#equals()

The following examples show how to use java.nio.channels.DatagramChannel#equals() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 6 votes vote down vote up
public ArrayList<Channel> getAll(String itemName, Direction direction, DatagramChannel theDatagramChannel) {
    synchronized (this) {

        ArrayList<Channel> selectedChannels = new ArrayList<Channel>();

        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
                    && direction.equals(aChannel.direction)) {
                selectedChannels.add(aChannel);
            }
        }

        return selectedChannels;
    }
}
 
Example 2
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 6 votes vote down vote up
public ArrayList<Channel> getAll(Direction direction, DatagramChannel theDatagramChannel,
        InetSocketAddress clientAddress) {
    synchronized (this) {

        ArrayList<Channel> selectedChannels = new ArrayList<Channel>();

        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (clientAddress.equals(aChannel.remote) && theDatagramChannel.equals(aChannel.channel)
                    && direction.equals(aChannel.direction)) {
                selectedChannels.add(aChannel);
            }
        }

        return selectedChannels;
    }
}
 
Example 3
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public Channel get(DatagramChannel theDatagramChannel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel)) {
                return aChannel;
            }
        }
        return null;
    }
}
 
Example 4
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void replace(String itemName, Direction direction, DatagramChannel theDatagramChannel,
        DatagramChannel channel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
                    && direction.equals(aChannel.direction)) {
                aChannel.channel = channel;
            }
        }

    }
}
 
Example 5
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void replace(String itemName, Direction direction, InetSocketAddress remoteAddress,
        DatagramChannel channel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (itemName.equals(aChannel.item) && remoteAddress.equals(aChannel.remote)
                    && direction.equals(aChannel.direction) && !channel.equals(aChannel.channel)) {
                aChannel.channel = channel;
            }
        }
    }

}
 
Example 6
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void setAll(String itemName, Direction direction, DatagramChannel theDatagramChannel, boolean b) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (itemName.equals(aChannel.item) && theDatagramChannel.equals(aChannel.channel)
                    && direction.equals(aChannel.direction)) {
                aChannel.isBlocking = b;
            }
        }
    }
}
 
Example 7
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void replace(Direction direction, InetSocketAddress remoteAddress, DatagramChannel channel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (remoteAddress.equals(aChannel.remote) && direction.equals(aChannel.direction)
                    && !channel.equals(aChannel.channel)) {
                aChannel.channel = channel;
            }
        }
    }
}
 
Example 8
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public ArrayList<Channel> getAll(Direction direction, DatagramChannel theDatagramChannel) {
    synchronized (this) {
        ArrayList<Channel> selectedChannels = new ArrayList<Channel>();

        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel) && direction.equals(aChannel.direction)) {
                selectedChannels.add(aChannel);
            }
        }

        return selectedChannels;
    }
}
 
Example 9
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void setAllBlocking(Direction direction, DatagramChannel theDatagramChannel, boolean b) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel) && direction.equals(aChannel.direction)) {
                aChannel.isBlocking = true;
            }
        }
    }
}
 
Example 10
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void replace(DatagramChannel oldDatagramChannel, DatagramChannel channel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (oldDatagramChannel.equals(aChannel.channel)) {
                aChannel.channel = channel;
            }
        }

    }
}
 
Example 11
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void replace(InetSocketAddress remoteAddress, DatagramChannel channel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (remoteAddress.equals(aChannel.remote) && !channel.equals(aChannel.channel)) {
                aChannel.channel = channel;
            }
        }
    }

}
 
Example 12
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public ArrayList<Channel> getAll(DatagramChannel theDatagramChannel) {
    synchronized (this) {
        ArrayList<Channel> selectedChannels = new ArrayList<Channel>();

        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel)) {
                selectedChannels.add(aChannel);
            }
        }

        return selectedChannels;
    }
}
 
Example 13
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void setAllBlocking(DatagramChannel theDatagramChannel, boolean b) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel)) {
                aChannel.isBlocking = b;
            }
        }
    }
}
 
Example 14
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public void setAllReconnecting(DatagramChannel theDatagramChannel, boolean b) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel)) {
                aChannel.isReconnecting = b;
            }
        }
    }
}
 
Example 15
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public boolean isBlocking(DatagramChannel theDatagramChannel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel) && aChannel.isBlocking) {
                return true;
            }
        }
        return false;
    }
}
 
Example 16
Source File: AbstractDatagramChannelBinding.java    From openhab1-addons with Eclipse Public License 2.0 5 votes vote down vote up
public Channel getBlocking(DatagramChannel theDatagramChannel) {
    synchronized (this) {
        Iterator<C> it = iterator();
        while (it.hasNext()) {
            C aChannel = it.next();
            if (theDatagramChannel.equals(aChannel.channel) && aChannel.isBlocking) {
                return aChannel;
            }
        }
        return null;
    }
}