Search in sources :

Example 6 with DataItem

use of cl.utfsm.samplingSystemUI.core.DataItem in project ACS by ACS-Community.

the class Display2 method run.

public void run() {
    //FileWriter fileW = new FileWriter(AcsInformation.getInstance(), SamplingManager.getInstance());	
    LinkedBlockingQueue<DataItem> cChannel;
    Collection<DataItem> c = new LinkedList<DataItem>();
    while (true) {
        try {
            if (stop == true)
                return;
            Thread.sleep(5000);
            cChannel = ThreadCommunicator.getInstance().getChannel("NC_LAMP1_brightness_10000000_1");
            if (cChannel == null)
                continue;
            cChannel.drainTo(c);
            if (c.isEmpty())
                continue;
            for (DataItem item : c) {
                //DataItem i = (DataItem)item;
                System.out.println(item.getTime() + " " + item.getValue());
            //fileW.initializeComponents();
            //fileW.showData();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
Also used : DataItem(cl.utfsm.samplingSystemUI.core.DataItem) LinkedList(java.util.LinkedList)

Aggregations

DataItem (cl.utfsm.samplingSystemUI.core.DataItem)6 IOException (java.io.IOException)4 BufferedReader (java.io.BufferedReader)2 Date (java.util.Date)2 StringTokenizer (java.util.StringTokenizer)2 IsoDateFormat (alma.acs.util.IsoDateFormat)1 ParseException (java.text.ParseException)1 LinkedList (java.util.LinkedList)1