Java Code Examples for java.util.Observable#equals()

The following examples show how to use java.util.Observable#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: FlowVisor.java    From sdn-wise-java with GNU General Public License v3.0 6 votes vote down vote up
@Override
public final void update(final Observable o, final Object arg) {
    if (o.equals(getLower())) {
        // if it is a data packet send to the application, else send it to
        // the controller
        byte[] data = (byte[]) arg;
        NetworkPacket np = new NetworkPacket(data);
        switch (np.getTyp()) {
            case DATA:
                manageData(data);
                break;
            case REPORT:
                manageReports(data);
                break;
            default:
                manageRequests(data);
                break;
        }
    } else if (o.equals(getUpper())) {
        manageResponses((byte[]) arg);
    }
}
 
Example 2
Source File: AbstractApplication.java    From sdn-wise-java with GNU General Public License v3.0 5 votes vote down vote up
@Override
public final void update(final Observable o, final Object arg) {
    if (o.equals(getLower())) {
        try {
            bQ.put(new NetworkPacket((byte[]) arg));
        } catch (InterruptedException ex) {
            log(Level.SEVERE, ex.toString());
        }
    }
}
 
Example 3
Source File: AbstractController.java    From sdn-wise-java with GNU General Public License v3.0 5 votes vote down vote up
/**
 * This methods manages updates coming from the lower adapter or the network
 * representation. When a message is received from the lower adapter it is
 * inserted in a ArrayBlockingQueue and then the method managePacket it is
 * called on it. While for updates coming from the network representation
 * the method graphUpdate is invoked.
 *
 * @param o the source of the event.
 * @param arg Object sent by Observable.
 */
@Override
public final void update(final Observable o, final Object arg) {
    for (AbstractAdapter adapter : getLower()) {
        if (o.equals(adapter)) {
            try {
                bQ.put(new NetworkPacket((byte[]) arg));
            } catch (InterruptedException ex) {
                log(Level.SEVERE, ex.toString());
            }
        } else if (o.equals(networkGraph)) {
            graphUpdate();
        }
    }
}
 
Example 4
Source File: ObserverImpl.java    From Llunatic with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update(Observable o, Object updatedBeanName) {
    if (o.equals(model)) {
        onAppContentUpdate((String) updatedBeanName);
    } else {
        onMoldelContentUpdate((String) updatedBeanName);
    }
}