Mini-Retreat Two

Logistics

Topics for Discussion

Agenda

Friday

9:15AM - 6:00PM

(Note: ISB group can't stay for Saturday, need view model nailed down and some talk about the web stuff)

Saturday

9:30AM - 3:00PM

Goal

Pre-meeting Comments

Decisions and Results

This is an attempt pull together the major decisions we made and (possibly) the areas where we might need further discussion (perhaps via E-Mail).

Architecture

Model

View Model

Presentation

Events

list of events moved to Cytoscape_3.0/EventHandling/PlannedCoreEventsIn3.0

Meeting Notes

Day 1

Review of architecture: (photo will be attached)

Examples:

Questions:


VizMap:


Web presentation strategy:


Presentation Layer:


Summary:

Tomorrow:


Day 2

While listing events below, we realized that we really need a Presentation and ViewModel for CyDataTable. This will support events in the Table, all the same events needed for Network. With proper View Model support, this doesn't even have to be table! This could be histograms and heatmaps.

List of events: Cytoscape_3.0/EventHandling/PlannedCoreEventsIn3.0

Need for an Action-Event Broker:

Idea for Decorations:


Event-coalescence optimization Daniels Starter Questions

Batchable.java

interface Batchable {
        void batchBegin();
        void batchEnd();
}

NetworkThingy.java

import java.util.ArrayList;
import java.util.List;

class NetworkThingy implements Batchable {
        boolean inBatch = false;
        List<String> addEventList = null;
        List<String> removeEventList = null;

        public NetworkThingy () {}

        public void addNetworkSubThingy (String name) {
                if (!inBatch)
                        System.out.println("Added network sub-thingy "+name);
                else
                        addEvent(name);
        }

        public void deleteNetworkSubThingy (String name) {
                if (!inBatch)
                        System.out.println("Deleted network sub-thingy "+name);
                else
                        removeEvent(name);
        }

        public void batchBegin() {
                inBatch = true;
        }

        public void batchEnd() {
                inBatch = false;
                if (addEventList != null && addEventList.size() > 0) {
                        System.out.print("Added sub-thingy's ");
                        for (String event: addEventList) {
                                System.out.print(event+", ");
                        }
                        System.out.println();
                }

                if (removeEventList != null && removeEventList.size() > 0) {
                        System.out.print("Removed sub-thingy's ");
                        for (String event: removeEventList) {
                                System.out.print(event+", ");
                        }
                        System.out.println();
                }

                addEventList = null;
                removeEventList = null;
        }

        private void addEvent(String name) {
                if (addEventList == null)
                        addEventList = new ArrayList();

                addEventList.add(name);
        }

        private void removeEvent(String name) {
                if (addEventList != null && addEventList.contains(name)) {
                        addEventList.remove(name);
                        return;
                }

                if (removeEventList == null)
                        removeEventList = new ArrayList();

                removeEventList.add(name);
        }
}

TestBatch.java

public class TestBatch {

        public static void main(String[] args) {
                NetworkThingy thingy = new NetworkThingy();

                for (int i = 0; i < 100; i++) {
                        thingy.addNetworkSubThingy("ST "+i);
                }

                thingy.batchBegin();
                for (int i = 0; i < 100; i++) {
                        thingy.addNetworkSubThingy("ST "+(i+100));
                }
                thingy.batchEnd();

                thingy = new NetworkThingy();
                thingy.batchBegin();
                for (int i = 0; i < 100; i++) {
                        thingy.addNetworkSubThingy("ST "+i);
                }

                thingy.deleteNetworkSubThingy("ST 5");
                thingy.deleteNetworkSubThingy("ST 50");
                thingy.batchEnd();

        }
}

Alternative implementation of batchable events that switches responsibility for batching from the firing data structure to an EventHandler that manages everything. The advantages of this approach are:

The disadvantages of this approach are:

NetworkThingy.java

class NetworkThingy {
        EventHandler eh;

        public NetworkThingy (EventHandler eh) { this.eh = eh; }

        public void addNetworkSubThingy (String name) {
                eh.fireEvent("ADD","Added network sub-thingy "+name);
        }

        public void deleteNetworkSubThingy (String name) {
                eh.fireEvent("DELETE","Deleted network sub-thingy "+name);
        }
}

EventHandler.java

import java.util.*;

public class EventHandler {

    Map<String,List<String>> listeners;
    Map<String,List<String>> batches;
    public EventHandler() {
        listeners = new HashMap<String,List<String>>();
        batches = new HashMap<String,List<String>>();
    }

    public void batchBegin(String eventType) {
        batches.put(eventType, new ArrayList<String>());
    }
    public void batchEnd(String eventType) {

        // somehow aggregate events
        String aggregateEvent = "AGGREGATE:";
        for (String e : batches.get(eventType))
            aggregateEvent += " " + e;

        fireInternal(eventType,aggregateEvent);

        batches.remove(eventType);
    }

    public void fireEvent(String eventType, String event) {
        if ( batches.containsKey(eventType) )   // batching == true
            batches.get(eventType).add(event);
        else  // batching == false
            fireInternal(eventType,event);
    }

    private void fireInternal(String eventType, String event) {
        List<String> list = listeners.get(eventType);
        for (String l : list)
            System.out.println("listener: " + l + ": " + eventType + " - " + event);
    }

    public void addListener(String eventType, String listenerName) {
        if ( !listeners.containsKey(eventType) )
            listeners.put( eventType, new ArrayList<String>() );
        listeners.get(eventType).add(listenerName);
    }
}

TestBatch.java

public class TestBatch {

        public static void main(String[] args) {
                EventHandler eh = new EventHandler();
                eh.addListener("ADD", "homer");
                eh.addListener("ADD", "marge");
                eh.addListener("DELETE", "homer");

                int ct = 10;

                NetworkThingy thingy = new NetworkThingy(eh);

                for (int i = 0; i < ct; i++) {
                        thingy.addNetworkSubThingy("ST "+i);
                }

                eh.batchBegin("ADD");
                for (int i = 0; i < ct; i++) {
                        thingy.addNetworkSubThingy("ST "+(i+ct));
                }
                eh.batchEnd("ADD");

                thingy = new NetworkThingy(eh);
                eh.batchBegin("DELETE");
                for (int i = 0; i < ct; i++) {
                        // not being batched since we're only batching DELETE events
                        thingy.addNetworkSubThingy("ST "+i);
                }

                thingy.deleteNetworkSubThingy("ST 5");
                thingy.deleteNetworkSubThingy("ST 50");
                eh.batchEnd("DELETE");

        }
}


Work Layer:


I/O Layer:

CyReaderManager:

CyReader:

When is the ViewModel built?

Summary:

Outdated_Cytoscape_3.0/MiniRetreatTwo (last edited 2011-02-24 15:40:08 by PietMolenaar)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux