public void addUpdateObserverList() { UGUIUpdateManager.addAlwaysObserver(this); }
public void dataUpdate() { // 日付関係はUGUIUpdateManager経由で取得するように変更. int date = UGUIUpdateManager.getDate(); int boardNo = UGUIUpdateManager.getBoard(); int step = UGUIUpdateManager.getStep(); int now = UGUIUpdateManager.getMarketStatus(); if (now != fCurrentStatus) { fIsUpdated = true; } if (step <= fCurrentStep) { // Exchange X-Y がセットされている場合の処理.フラグ処理はあまりきれいではないが // X-Y の入れ換え自体が???なので勘弁してもらおう. if (fIsUpdated == false) { return; } else { fIsUpdated = false; } } if (boardNo == 1) { fDay.setText(String.valueOf(date - 1)); fBoard.setText(String.valueOf(fParam.getBoardPerDay())); } else { fDay.setText(String.valueOf(date)); if (now == fCurrentStatus) { fBoard.setText(String.valueOf(boardNo - 1)); } else { fBoard.setText(String.valueOf(boardNo)); } } fCurrentStep = step; fCurrentStatus = now; UCBoardDataCore cBoardData = (UCBoardDataCore) fCProtocol.getCommand(UCBoardDataCore.CMD_NAME); UCommandStatus status = cBoardData.doIt(); ArrayList array; HashMap boardDataInfo; long maxPrice, minPrice, totalBuyVolume; Vector printData = new Vector(); if (status.getStatus()) { array = cBoardData.getBoardDataArray(); boardDataInfo = cBoardData.getBoardDataInfo(); maxPrice = ((Long) boardDataInfo.get(UCBoardDataCore.LONG_MAX_PRICE)).longValue(); minPrice = ((Long) boardDataInfo.get(UCBoardDataCore.LONG_MIN_PRICE)).longValue(); totalBuyVolume = ((Long) boardDataInfo.get(UCBoardDataCore.LONG_TOTAL_BUY_VOLUME)).longValue(); if (fIsExchangeXY == false) { fBoardGraph.setFixedMaxX(maxPrice); fBoardGraph.setFixedMinX(minPrice); fBoardGraph.setFixedMaxY(totalBuyVolume); fBoardGraph.setFixedMinY(0); } else { fBoardGraph.setFixedMaxX(totalBuyVolume); fBoardGraph.setFixedMinX(0); fBoardGraph.setFixedMaxY(maxPrice); fBoardGraph.setFixedMinY(minPrice); } } else { return; } long contractPrice = ((Long) boardDataInfo.get(UCBoardDataCore.LONG_CONTRACT_PRICE)).longValue(); long contractVolume = ((Long) boardDataInfo.get(UCBoardDataCore.LONG_CONTRACT_VOLUME)).longValue(); fContractPriceTextField.setText(String.valueOf(contractPrice)); fContractVolumeTextField.setText(String.valueOf(contractVolume)); ArrayList tmpSellData = new ArrayList(); ArrayList tmpBuyData = new ArrayList(); ArrayList tmpContractData = new ArrayList(); if (fIsExchangeXY == false) { tmpContractData.add(new Point2D.Double(minPrice, contractVolume)); tmpContractData.add(new Point2D.Double(contractPrice, contractVolume)); tmpContractData.add(new Point2D.Double(contractPrice, 0)); fBoardGraph.setXLableName("price"); fBoardGraph.setYLableName("volume"); } else { tmpContractData.add(new Point2D.Double(contractVolume, minPrice)); tmpContractData.add(new Point2D.Double(contractVolume, contractPrice)); tmpContractData.add(new Point2D.Double(0, contractPrice)); fBoardGraph.setXLableName("volume"); fBoardGraph.setYLableName("price"); } Iterator iter = array.iterator(); double tmpPrice, tmpVolume, currentSellVolume = 0, currentBuyVolume = totalBuyVolume; while (iter.hasNext()) { HashMap os = (HashMap) iter.next(); String s = (String) os.get(UCBoardDataCore.STRING_SELL_BUY); if (s.equals("sell")) { tmpPrice = ((Long) os.get(UCBoardDataCore.LONG_PRICE)).doubleValue(); tmpVolume = ((Long) os.get(UCBoardDataCore.LONG_VOLUME)).doubleValue(); if (fIsExchangeXY == false) { tmpSellData.add(new Point2D.Double(tmpPrice, currentSellVolume)); tmpSellData.add(new Point2D.Double(tmpPrice, currentSellVolume + tmpVolume)); } else { tmpSellData.add(new Point2D.Double(currentSellVolume, tmpPrice)); tmpSellData.add(new Point2D.Double(currentSellVolume + tmpVolume, tmpPrice)); } currentSellVolume += tmpVolume; } else if (s.equals("buy")) { tmpPrice = ((Long) os.get(UCBoardDataCore.LONG_PRICE)).doubleValue(); tmpVolume = ((Long) os.get(UCBoardDataCore.LONG_VOLUME)).doubleValue(); if (fIsExchangeXY == false) { tmpBuyData.add(new Point2D.Double(tmpPrice, currentBuyVolume)); tmpBuyData.add(new Point2D.Double(tmpPrice, currentBuyVolume - tmpVolume)); } else { tmpBuyData.add(new Point2D.Double(currentBuyVolume, tmpPrice)); tmpBuyData.add(new Point2D.Double(currentBuyVolume - tmpVolume, tmpPrice)); } currentBuyVolume -= tmpVolume; } } ((UGraphData) fBoardGraph.getGraph().get(0)).setData(tmpSellData); ((UGraphData) fBoardGraph.getGraph().get(1)).setData(tmpBuyData); }