/NuSCRtoFBD/src/main/MainWindow.java
Java | 1782 lines | 1447 code | 266 blank | 69 comment | 219 complexity | 9712fad02432506f1c82e27fb706c3b3 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- package main;
-
- import fsm.TransitionForFSM;
- import gui.CombinedDialog;
- import gui.VerilogShow;
- import gui.TwoCTable;
-
- import java.awt.BorderLayout;
- import java.awt.Component;
- import java.awt.Dimension;
- import java.awt.Font;
- import java.awt.Label;
- import java.awt.Point;
- import java.awt.event.ActionEvent;
- import java.awt.event.ActionListener;
- import java.awt.event.MouseListener;
- import java.awt.event.WindowAdapter;
- import java.awt.event.WindowEvent;
- import java.io.BufferedReader;
- import java.io.File;
- import java.io.FileOutputStream;
- import java.io.FileReader;
- import java.io.FileWriter;
- import java.io.IOException;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Calendar;
- import java.util.LinkedList;
- import java.util.Queue;
- import java.util.Stack;
-
- import javax.swing.BorderFactory;
- import javax.swing.BoxLayout;
- import javax.swing.Icon;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFileChooser;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JMenuItem;
- import javax.swing.JOptionPane;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.JTable;
- import javax.swing.JTextArea;
- import javax.swing.JTextField;
- import javax.swing.JTextPane;
- import javax.swing.JToolBar;
- import javax.swing.JTree;
- import javax.swing.SwingUtilities;
- import javax.swing.border.EtchedBorder;
- import javax.swing.event.TreeSelectionEvent;
- import javax.swing.event.TreeSelectionListener;
- import javax.swing.table.DefaultTableCellRenderer;
- import javax.swing.table.TableColumn;
- import javax.swing.tree.DefaultMutableTreeNode;
- import javax.swing.tree.DefaultTreeCellRenderer;
- import javax.swing.tree.DefaultTreeModel;
- import javax.swing.tree.TreePath;
- import javax.xml.parsers.ParserConfigurationException;
-
- import net.infonode.docking.DockingWindow;
- import net.infonode.docking.DockingWindowAdapter;
- import net.infonode.docking.DockingWindowListener;
- import net.infonode.docking.RootWindow;
- import net.infonode.docking.SplitWindow;
- import net.infonode.docking.TabWindow;
- import net.infonode.docking.View;
- import net.infonode.docking.properties.RootWindowProperties;
- import net.infonode.docking.theme.DockingWindowsTheme;
- import net.infonode.docking.theme.ShapedGradientDockingTheme;
- import net.infonode.docking.util.DockingUtil;
- import net.infonode.docking.util.ViewMap;
- import net.infonode.docking.action.*;
-
- import org.w3c.dom.Document;
- import org.w3c.dom.Element;
- // org.w3c.dom : xml data ??? api? DOM? interface ??
- // .Document : XML ?? ??
- // .Element : XML ???? ??
-
- import parselink.VariableLinking;
- import parselink.XmlParsing;
- import sdt.ActionInformation;
- import tts.TransitionForTTS;
- import twoctable.ConditionInformationForTwoC;
- import twoctable.TwoCInformationAutomata;
- import twoctable.TwoCInformationSDT;
- import twoctable.TwoCTableData;
- import variableinformation.FODInformation;
- import variableinformation.FSMInformation;
- import variableinformation.GenericInformation;
- import variableinformation.GenericLinkableInformation;
- import variableinformation.InputInformation;
- import variableinformation.OutputInformation;
- import variableinformation.SDTInformation;
- import variableinformation.TTSInformation;
-
- import y.base.Edge;
- import y.base.Node;
- import y.view.EdgeRealizer;
- import y.view.Graph2D;
- import y.view.Graph2DView;
- import y.view.NodeRealizer;
- import y.view.Port;
- // yWorks company
- // y.jar graphic editor
-
- import basefbd.CombineEngine;
- import basefbd.CondInformation;
- import basefbd.DrawBlocks;
- import basefbd.SequenceEngine;
- import blockInformation.CombinedSelBlock;
- import blockInformation.MoveBlock;
- import blockInformation.MuxBlock;
- import blockInformation.TwoInputBlock;
- import candc.CandC;
-
- import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
- import com.sun.org.apache.xml.internal.serialize.OutputFormat;
- import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
-
-
- @SuppressWarnings("serial")
- public class MainWindow extends JFrame {
-
- protected JTree m_tree = null;
- protected DefaultTreeModel m_model = null;
-
- protected JTree m_tree2 = null;
- protected DefaultTreeModel m_model2 = null;
-
- protected JTable m_twoCtable;
- protected JTable m_combinedTwoCtable;
- protected TwoCTableData m_tableData1;
- protected TwoCTableData m_tableData2;
-
- public final static String appTitle = "NuSCRtoFBD";
- public final static String appVer = "..";
-
- FODInformation root;
-
- XmlParsing xmlParsing;
- VariableLinking variableLinking;
- CandC candc;
- GenericInformation currentVariable;
- CombineEngine combineEngine;
- //Queue<CondInformation> mcondsQue = new Queue<CondInformation>();
- Queue<CondInformation> condsQueueLast= new LinkedList<CondInformation>(); //??? name? contents
- ArrayList<CombinedSelBlock> combinedSelBlocks = new ArrayList<CombinedSelBlock>(); //?? ???? ?? ??.
- String[] combinedStringForFBD;
- SequenceEngine sequenceEngine;
-
- public Stack<Object> operatorStackPre = new Stack<Object>(); //?????
- public Stack<Object> operatorStackOutput = new Stack<Object>();
- public Stack<Object> operatorStackState = new Stack<Object>();
- public Queue<Object> totalStackQueue = new LinkedList<Object>();
- //Queue<Stack<Object>> totalStackQueue = new LinkedList<Stack<object>>();
-
- Object[] levelHash; //fod total? ?? level? collection? hashtable
-
- public Queue<Label> labelColletionPre = new LinkedList<Label>(); //??, ???? ?? label collection
- public Queue<Label> labelColletionOutput = new LinkedList<Label>();
- public Queue<Label> labelColletionState = new LinkedList<Label>();
- public Queue<Queue<Label>> labelColletionTotal = new LinkedList<Queue<Label>>();
-
- Queue<String> outputsForSelBlock; //selblock? output
- Queue<String> statesForSelBlock;
-
- public Graph2DView pre_view = new Graph2DView();
- public Graph2DView output_view = new Graph2DView();
- public Graph2DView state_view = new Graph2DView();
- public Graph2DView total_view = new Graph2DView();
-
- boolean isSaving = false;
- String savePath = "a.xml";
- int totalLocalIdNumber=1;
-
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- try {
- JFrame.setDefaultLookAndFeelDecorated(true);
- } catch (Exception exception) {
- exception.printStackTrace();
- }
- new MainWindow();
- }
- });
- }
-
- public MainWindow() {
- super(appTitle);
-
- setLayout(new BorderLayout());
- setJMenuBar(createMenuBar());
- initDockingWindows();
- initContentsPanel();
- clearContents();
-
- add(mainWindow, BorderLayout.CENTER);
-
- statusLabel.setMinimumSize(new Dimension(400, 25));
- statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.LINE_AXIS));
- statusPanel.add(statusLabel);
- add(statusPanel, BorderLayout.PAGE_END);
-
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setPreferredSize(new Dimension(1500, 1000));
- setLocation(200, 100);
- pack();
- setVisible(true);
- this.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- //actionExit();
- }
- });
- }
-
- // settings
- public static String[] V_KEYWORDS = {"module", "endmodule", "assign", "input", "output", "reg", "wire", "initial", "always", "begin", "end", "posedge", "negedge", "if", "endif"};
- public static String[] V_KEYWORDS2 = {"assert"};
-
- // icons
- final static ImageIcon iconOpen = new ImageIcon("icons/open.png");
- final static ImageIcon iconSave = new ImageIcon("icons/save.png");
- final static ImageIcon iconZoomIn = new ImageIcon("icons/zoomin.png");
- final static ImageIcon iconZoomOut = new ImageIcon("icons/zoomout.png");
- final static ImageIcon iconFitToSize = new ImageIcon("icons/fittosize.png");
- final static ImageIcon iconChecking = new ImageIcon("icons/checking.png");
- final static ImageIcon iconCombined = new ImageIcon("icons/combined.png");
- final static ImageIcon iconSequence = new ImageIcon("icons/sequence.png");
- final static ImageIcon iconAbout = new ImageIcon("icons/about.png");
- final static ImageIcon iconFBDtoVerilog = new ImageIcon("icons/fbdtoverilog.png");
-
- // contents
- ActionListener actionListener = new MenuEventHandler();
- JToolBar toolbar = new JToolBar();
- JPanel topPanel = new JPanel(new BorderLayout());
- JPanel treePanel = new JPanel(new BorderLayout());
- JPanel viewPanel = new JPanel(new BorderLayout());
- JTextField stPathField = new JTextField();
- JTextField verilogPathField = new JTextField();
- JTextArea stTextArea = new JTextArea();
- JTextPane verilogTextArea = new JTextPane();
- JButton buttonOpen = createButton(iconOpen, "Open Data", OPEN);
- JButton buttonSave = createButton(iconSave, "Save Data", SAVE);
- JButton buttonZoomIn = createButton(iconZoomIn, "Zoom In", ZOOMIN);
- JButton buttonZoomOut = createButton(iconZoomOut, "Zoom Out", ZOOMOUT);
- JButton buttonFitToSize = createButton(iconFitToSize, "Fit to Size", FITTOSIZE);
- JButton buttonCheck = createButton(iconChecking, "Checking Completeness & Consistancy", CHECKING);
- JButton buttonCombinedText = createButton(iconCombined, "Combined Text", COMBINED);
- JButton buttonTotalSequence = createButton(iconSequence, "Total Sequence", SEQUENCE);
- JButton buttonAbout = createButton(iconAbout, "About", ABOUT);
- JButton buttonFBDtoVerilog = createButton(iconFBDtoVerilog,"FBD to Verilog", FBDTOVERILOG);
- JPanel statusPanel = new JPanel();
- JLabel statusLabel = new JLabel();
-
- void initContentsPanel() {
- int y = 38;
- buttonOpen.setPreferredSize(new Dimension(y, y));
- buttonSave.setPreferredSize(new Dimension(y, y));
- buttonZoomIn.setPreferredSize(new Dimension(y, y));
- buttonZoomOut.setPreferredSize(new Dimension(y, y));
- buttonFitToSize.setPreferredSize(new Dimension(y, y));
- buttonCheck.setPreferredSize(new Dimension(y, y));
- buttonCombinedText.setPreferredSize(new Dimension(y, y));
- buttonTotalSequence.setPreferredSize(new Dimension(y, y));
- buttonAbout.setPreferredSize(new Dimension(y, y));
- buttonFBDtoVerilog.setPreferredSize(new Dimension(y, y));
-
- stPathField.setEditable(false);
- verilogPathField.setEditable(false);
- stTextArea.setFont(new Font("Courier New", Font.PLAIN, 15));
- verilogTextArea.setFont(new Font("Courier New", Font.PLAIN, 15));
- stTextArea.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
- verilogTextArea.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED));
-
-
- JToolBar toolBar = new JToolBar();
- toolBar.add(buttonOpen);
- toolBar.add(buttonSave);
- toolBar.addSeparator();
- toolBar.add(buttonZoomIn);
- toolBar.add(buttonZoomOut);
- toolBar.add(buttonFitToSize);
- toolBar.addSeparator();
- toolBar.add(buttonCheck);
- toolBar.add(buttonCombinedText);
- toolBar.addSeparator();
- toolBar.add(buttonAbout);
- toolBar.setSize(38, 38);
- toolBar.add(buttonFBDtoVerilog);
- add(toolBar, "North");
-
- treePanel.add(new JScrollPane(stTextArea), BorderLayout.CENTER);
- viewPanel.add(new JScrollPane(verilogTextArea), BorderLayout.CENTER);
- }
-
- void clearContents() {
- msgStatus("Ready");
- stPathField.setText("");
- verilogPathField.setText("");
- stTextArea.setText("");
- verilogTextArea.setText("");
- closeCE();
- }
-
- JButton createButton(Icon icon, String toolTipText, int actionCommand) {
- JButton button = new JButton();
- button.setToolTipText(toolTipText);
- button.setActionCommand(new Integer(actionCommand).toString());
- button.addActionListener(actionListener);
- button.setIcon(icon);
- return button;
- }
-
-
- // docking window items
- RootWindowProperties properties = new RootWindowProperties();
- DockingWindowsTheme currentTheme = new ShapedGradientDockingTheme();
- View[] views = new View[12];
- ViewMap viewMap = new ViewMap();
- RootWindow mainWindow;
-
-
- RootWindow leftWindow;
- TabWindow windowTab;
- TabWindow description;
- TabWindow mainTab;
-
- void initDockingWindows() {
- views[0] = createView("Hierachy Window", new ImageIcon(""), treePanel);
- views[1] = createView("2CTable", new ImageIcon(""), viewPanel);
- views[4] = createView("Combined 2CTable", new ImageIcon(""), viewPanel);
-
- views[5] = createView("Preprocessing part FBD", new ImageIcon(""), viewPanel);
- views[6] = createView("Output part FBD", new ImageIcon(""), viewPanel);
- views[7] = createView("State variable part FBD", new ImageIcon(""), viewPanel);
- views[8] = createView("Total FBD", new ImageIcon(""), viewPanel);
-
- views[9] = createView("Description Window", new ImageIcon(""), viewPanel);
-
- viewMap.addView(0, views[0]);
- viewMap.addView(1, views[1]);
-
-
- mainWindow = DockingUtil.createRootWindow(viewMap, false);
- properties.addSuperObject(currentTheme.getRootWindowProperties());
- mainWindow.getRootWindowProperties().addSuperObject(properties);
-
- leftWindow = DockingUtil.createRootWindow(viewMap, false);
- properties.addSuperObject(currentTheme.getRootWindowProperties());
- leftWindow.getRootWindowProperties().addSuperObject(properties);
-
- windowTab = createTabWindow();
- mainTab = createTabWindow();
- description = createTabWindow();
-
- windowTab.addTab(views[0]);
-
- mainTab.addTab(views[1]);
- mainTab.addTab(views[4]);
-
- mainTab.addTab(views[5]);
- mainTab.addTab(views[6]);
- mainTab.addTab(views[7]);
- mainTab.addTab(views[8]);
-
- description.addTab(views[9]);
- //////
-
-
- //////
- mainWindow.setWindow(new SplitWindow(true, 0.2f, leftWindow, mainTab)); //??
- leftWindow.setWindow(new SplitWindow(false, 0.7f, windowTab, description)); //? ??
- setVisible(true);
-
-
- }
-
-
- View createView(String viewTitle ,Icon icon, Component component) {
- View view = new View( viewTitle, icon, component);
- view.getWindowProperties().setDragEnabled(false);
- view.getWindowProperties().setCloseEnabled(false);
- return view;
- }
-
- TabWindow createTabWindow() {
- TabWindow tab = new TabWindow();
- tab.getTabWindowProperties().getCloseButtonProperties().setVisible(false);
- tab.getWindowProperties().setDragEnabled(false);
- return tab;
- }
-
- // menu
- JMenuItem menuOpen,menuSave,menuZoomIn,menuZoomOut, menuCheck,menuCombinedText,menuSequence,menuAbout;
-
- JMenuBar createMenuBar() {
- JMenuBar menu = new JMenuBar();
- JMenu fileMenu = new JMenu("File");
- JMenu viewMenu = new JMenu("View");
- JMenu informationMenu = new JMenu("Information");
- JMenu helpMenu = new JMenu("Help");
-
- fileMenu.add(menuOpen=createMenuItem(new ImageIcon(), "Open Data", OPEN));
- fileMenu.add(menuSave=createMenuItem(new ImageIcon(),"Save Data",SAVE));
-
- viewMenu.add(menuZoomIn=createMenuItem(new ImageIcon(),"Zoom In",ZOOMIN));
- viewMenu.add(menuZoomOut=createMenuItem(new ImageIcon(),"Zoom Out",ZOOMOUT));
- viewMenu.add(menuZoomOut=createMenuItem(new ImageIcon(),"Fit to Size",FITTOSIZE));
-
- informationMenu.add(menuCheck=createMenuItem(new ImageIcon(),"Check C&C",OPEN));
- informationMenu.add(menuCombinedText=createMenuItem(new ImageIcon(),"Combined Text",OPEN));
- informationMenu.add(menuSequence=createMenuItem(new ImageIcon(),"Total Sequence",OPEN));
-
- helpMenu.add(menuAbout=createMenuItem(new ImageIcon(), "About", ABOUT));
-
- menu.add(fileMenu);
- menu.add(viewMenu);
- menu.add(informationMenu);
- menu.add(helpMenu);
- return menu;
- }
-
- JMenuItem createMenuItem(String itemText, int actionCommand) {
- JMenuItem menu = new JMenuItem(itemText);
- menu.setActionCommand(new Integer(actionCommand).toString());
- menu.addActionListener(actionListener);
- return menu;
- }
-
- JMenuItem createMenuItem(Icon icon, String itemText, int actionCommand) {
- JMenuItem menu = createMenuItem(itemText, actionCommand);
- menu.setIcon(icon);
- return menu;
- }
-
-
- public static final int OPEN = 10;
- public static final int SAVE = 11;
- public static final int ZOOMIN = 20;
- public static final int ZOOMOUT = 21;
- public static final int FITTOSIZE = 22;
- public static final int CHECKING = 30;
- public static final int COMBINED = 40;
- public static final int SEQUENCE = 50;
- public static final int ABOUT = 1;
- public static final int FBDTOVERILOG = 2;
-
- class MenuEventHandler implements ActionListener {
- public void actionPerformed(ActionEvent event) {
- int cmd = Integer.parseInt(event.getActionCommand());
- switch(cmd) {
- case OPEN:
- actionOpen();
- break;
- case SAVE:
- try {
- actionSave();
- } catch (ParserConfigurationException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- break;
- case ZOOMIN:
- actionZoomIn();
- break;
- case ZOOMOUT:
- actionZoomOut();
- break;
- case FITTOSIZE:
- actionFitToSize();
- break;
- case CHECKING:
- actionChecking();
- break;
- case COMBINED:
- actionCombined();
- break;
- case ABOUT:
- actionAbout();
- break;
- case FBDTOVERILOG:
- actionFBDtoVerilog();
- break;
-
- default:
- System.err.println("No such actinon: " + cmd);
- }
- }
- }
-
- // actions
- void actionOpen() {
- String[] exts = {".xml"};
- String filePath = getFileNameFromFileChooser(this, "Load XML", false, exts);
- if(filePath == null)
- return;
- xmlParsing = new XmlParsing(this);
- root = xmlParsing.LoadNuSCRXml(filePath);
- root = root.fods.get(0);
-
- variableLinking = new VariableLinking(root); //linking
- variableLinking.LinkVariables(root);
-
- candc = new CandC();
- candc.CheckCandC(root);
-
- InitTreeView();
- // Hierarchy Window
-
- for(int i=0;i<((FODInformation)root.fods.get(0)).fods.size();i++)
- {
- if(i==6)
- continue;
-
- FODInformation currentFOD = ((FODInformation)root.fods.get(0)).fods.get(i);
-
- //for(SDTInformation sdtInformation : currentFOD.sdts)
- //{
- // currentVariable = sdtInformation;
- // ViewTwoCTableForSDT(sdtInformation.twoCInformation);
- //}
-
- for(FSMInformation fsmInformation : currentFOD.fsms)
- {
- currentVariable = fsmInformation;
- ViewTwoCTableForAutomataForSave(fsmInformation.twoCInformationAutomata);
- }
- for(TTSInformation ttsInformation : currentFOD.ttss)
- {
- currentVariable = ttsInformation;
- ViewTwoCTableForAutomataForSave(ttsInformation.twoCInformationAutomata);
- }
- }
- }
-
- void actionSave() throws ParserConfigurationException, IOException{
- Document xmldoc= new DocumentImpl();
- Element rootElement = xmldoc.createElement("project");
- rootElement.setAttribute("xmlns", "http://www.plcopen.org/xml/tc6.xsd");
- rootElement.setAttribute("xmlns:xhtml","http://www.w3.org/1999/xhtml");
- rootElement.setAttribute("xmlns:xsi","http://www.w3.org/2001/XMLSchema-instance");
- rootElement.setAttribute("xsi:schemaLocation","c://tc6.xsd");
- // project attribute ? ??? ?????
-
- Element fileHeader = xmldoc.createElement("fileHeader");
- fileHeader.setAttribute("companyName", "KONKUKUNIV_DSLAB");
- fileHeader.setAttribute("productName", "nonamenow");
- fileHeader.setAttribute("productVersion", "1");
-
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
-
- fileHeader.setAttribute("creationDateTime", dateFormat.format(calendar.getTime()));
-
- Element contentHeader = xmldoc.createElement("contentHeader");
- contentHeader.setAttribute("name", "bhb");
- contentHeader.setAttribute("author", "bhback");
- contentHeader.setAttribute("modificationDateTime", dateFormat.format(calendar.getTime()));
-
- Element coordinateInfo = xmldoc.createElement("coordinateInfo");
- Element fbd = xmldoc.createElement("fbd");
- Element scaling_fbd = xmldoc.createElement("scaling");
- scaling_fbd.setAttribute("x", "16");
- scaling_fbd.setAttribute("y", "16");
- Element ld = xmldoc.createElement("ld");
- Element scaling_ld = xmldoc.createElement("scaling");
- scaling_ld.setAttribute("x", "16");
- scaling_ld.setAttribute("y", "16");
- Element sfc = xmldoc.createElement("sfc");
- Element scaling_sfc = xmldoc.createElement("scaling");
- scaling_sfc.setAttribute("x", "16");
- scaling_sfc.setAttribute("y", "16");
-
- Element types = xmldoc.createElement("types");
- Element dataTypes = xmldoc.createElement("dataTypes");
- Element pous = xmldoc.createElement("pous");
- Element pou = xmldoc.createElement("pou");
- pou.setAttribute("name", "BP_for_Test"); // BP_for_Test? ??? ??? ???
- pou.setAttribute("pouType", "functionBlock");
-
- Element _interface = xmldoc.createElement("interface"); // Interface ?? ?? ??. localVars, inputVars, outputVars definition
- Element localVars = xmldoc.createElement("localVars");
- localVars.setAttribute("name", "constant"); // localVars "constant" 'k_'? ???? ??? ??? constant
- localVars.setAttribute("constant", "true");
- Element inputVars = xmldoc.createElement("inputVars");
- Element outputVars = xmldoc.createElement("outputVars"); // How can I getting information of variables???
-
- Element body = xmldoc.createElement("body");
- Element FBD = xmldoc.createElement("FBD");
-
- Element instances = xmldoc.createElement("instances");
- Element configurations = xmldoc.createElement("configurations");
-
- for(int i=0;i<((FODInformation)root.fods.get(0)).fods.size();i++) // tctable ??
- {
- if(i==6)
- continue;
-
- FODInformation currentFOD = ((FODInformation)root.fods.get(0)).fods.get(i);
-
- //for(SDTInformation sdtInformation : currentFOD.sdts)
- //{
- // currentVariable = sdtInformation;
- // ViewTwoCTableForSDT(sdtInformation.twoCInformation);
- //}
-
- for(FSMInformation fsmInformation : currentFOD.fsms)
- {
- currentVariable = fsmInformation;
- ViewTwoCTableForAutomataForSave(fsmInformation.twoCInformationAutomata);
- }
- for(TTSInformation ttsInformation : currentFOD.ttss)
- {
- currentVariable = ttsInformation;
- ViewTwoCTableForAutomataForSave(ttsInformation.twoCInformationAutomata);
- }
- }
-
- this.isSaving = true;
- String[] exts = {".xml"};
- this.savePath = getFileNameFromFileChooser(this, "Save XML", false, exts);
-
- this.totalLocalIdNumber=1;
-
- for(int i=0;i<((FODInformation)root.fods.get(0)).fods.size();i++)
- {
- if(i==6)
- continue;
- currentVariable = ((FODInformation)root.fods.get(0)).fods.get(i);
- InitGraphicViews();
- DrawFunctionBlockDiagram(xmldoc, FBD);
- }
-
-
- this.totalLocalIdNumber = 1;
-
- body.appendChild(FBD);
- pou.appendChild(_interface);
- pou.appendChild(body);
- pous.appendChild(pou);
-
- // <interface>\
- _interface.appendChild(localVars);
- _interface.appendChild(inputVars);
- _interface.appendChild(outputVars);
-
- types.appendChild(dataTypes);
- types.appendChild(pous);
- fbd.appendChild(scaling_fbd);
- ld.appendChild(scaling_ld);
- sfc.appendChild(scaling_sfc);
- coordinateInfo.appendChild(fbd);
- coordinateInfo.appendChild(ld);
- coordinateInfo.appendChild(sfc);
- contentHeader.appendChild(coordinateInfo);
- instances.appendChild(configurations);
- rootElement.appendChild(fileHeader);
- rootElement.appendChild(contentHeader);
- rootElement.appendChild(types);
- rootElement.appendChild(instances);
- xmldoc.appendChild(rootElement);
- // Element ? child? (node)? ???? ??
-
- if(savePath.length()<4)
- savePath+=".xml";
-
- //String test = savePath.substring(savePath.length()-5, savePath.length()-1);
-
- if(savePath.substring(savePath.length()-4, savePath.length()).equals(".xml") == false)
- savePath+=".xml";
-
- FileOutputStream fos = new FileOutputStream(savePath);
- OutputFormat of = new OutputFormat("XML","UTF-8",true);
- of.setIndent(5);
- of.setIndenting(true);
- XMLSerializer serializer = new XMLSerializer(fos, of);
- serializer.asDOMSerializer();
- serializer.serialize( xmldoc.getDocumentElement());
- fos.close();
-
- this.isSaving = false;
- mainTab.setSelectedTab(0);
- JOptionPane.showMessageDialog(this, "Save Completed", appTitle, JOptionPane.PLAIN_MESSAGE);
- }
-
- void actionZoomIn()
- {
- View view = (View)mainTab.getSelectedWindow();
- String s = view.getTitle();
- if(s.equals("Preprocessing part FBD"))
- { pre_view.setZoom(pre_view.getZoom() * 1.2D);pre_view.updateView();}
- else if(s.equals("Output part FBD"))
- { output_view.setZoom(output_view.getZoom() * 1.2D);output_view.updateView();}
- else if(s.equals("State variable part FBD"))
- { state_view.setZoom(state_view.getZoom() * 1.2D);state_view.updateView();}
- else if(s.equals("Total FBD"))
- { total_view.setZoom(total_view.getZoom() * 1.2D);total_view.updateView();}
- }
-
- void actionZoomOut()
- {
- View view = (View)mainTab.getSelectedWindow();
- String s = view.getTitle();
- if(s.equals("Preprocessing part FBD"))
- { pre_view.setZoom(pre_view.getZoom() * 0.80000000000000004D);pre_view.updateView();}
- else if(s.equals("Output part FBD"))
- { output_view.setZoom(output_view.getZoom() * 0.80000000000000004D);output_view.updateView();}
- else if(s.equals("State variable part FBD"))
- { state_view.setZoom(state_view.getZoom() * 0.80000000000000004D);state_view.updateView();}
- else if(s.equals("Total FBD"))
- { total_view.setZoom(total_view.getZoom() * 0.80000000000000004D);total_view.updateView();}
- }
-
- void actionFitToSize()
- {
- View view = (View)mainTab.getSelectedWindow();
- String s = view.getTitle();
- if(s.equals("Preprocessing part FBD"))
- { pre_view.fitContent();pre_view.updateView();}
- else if(s.equals("Output part FBD"))
- { output_view.fitContent();output_view.updateView();}
- else if(s.equals("State variable part FBD"))
- { state_view.fitContent();state_view.updateView();}
- else if(s.equals("Total FBD"))
- { total_view.fitContent();total_view.updateView();}
- }
-
- void actionChecking() {
- if(currentVariable instanceof SDTInformation)
- {
- SDTInformation sdtInformation = (SDTInformation)currentVariable;
- TwoCTable messageCandC = new TwoCTable();
- if (sdtInformation.twoCInformation.errorMessage.equals(""))
- messageCandC.SetErrorText("No Error");
- else
- messageCandC.SetErrorText(sdtInformation.twoCInformation.errorMessage);
-
- if(sdtInformation.twoCInformation.warningMessage.equals(""))
- messageCandC.SetWarningText("No Warning");
- else
- messageCandC.SetWarningText(sdtInformation.twoCInformation.warningMessage);
- messageCandC.setVisible(true);
- }
- else if(currentVariable instanceof FSMInformation)
- {
- FSMInformation fsmInformation = (FSMInformation)currentVariable;
- TwoCTable messageCandC = new TwoCTable();
- if (fsmInformation.twoCInformationAutomata.errorMessage.equals(""))
- messageCandC.SetErrorText("No Error");
- else
- messageCandC.SetErrorText(fsmInformation.twoCInformationAutomata.errorMessage);
- messageCandC.SetWarningText("No Warning");
- messageCandC.setVisible(true);
- }
- else if (currentVariable instanceof TTSInformation)
- {
- TTSInformation ttsInformation = (TTSInformation)currentVariable;
- TwoCTable messageCandC = new TwoCTable();
- if (ttsInformation.twoCInformationAutomata.errorMessage.equals(""))
- messageCandC.SetErrorText("No Error");
- else
- messageCandC.SetErrorText(ttsInformation.twoCInformationAutomata.errorMessage);
-
- messageCandC.SetWarningText("No Warning");
- messageCandC.setVisible(true);
- }
-
- }
-
- void actionCombined() {
- CombinedDialog com = new CombinedDialog();
- com.setVisible(true);
- com.SetCombinedCondition(condsQueueLast);
- }
-
-
- void actionAbout() {
- JOptionPane.showMessageDialog(this, "Version " + 1.1 + "\n"
- + "qorgudqn@konkuk.ac.kr\n"
- + "Copyleft (c) 2009 konkuk university"
- , appTitle, JOptionPane.PLAIN_MESSAGE);
- }
-
- void actionFBDtoVerilog() {
- VerilogShow com = new VerilogShow();
- //com.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- com.setSize(700, 200);
- com.setVisible(true);
- com.setLocation(500, 200);
- }
-
-
-
- public void closeCE() {
- if(views[2] != null) views[2].close();
- if(views[3] != null) views[3].close();
- }
-
- // public methods for UI control
- public void msgStatus(String msg) {
- statusLabel.setText(msg);
- }
-
- public void setSTText(String str) {
- stTextArea.setText(str);
- }
-
- public void addSTText(String str) {
- stTextArea.append(str + "\n");
- }
-
- public void setVerilogText(String str) {
- verilogTextArea.setText(str);
- }
-
- public String readFile(String filePath) {
- String str = "";
- try {
- BufferedReader reader = new BufferedReader(new FileReader(new File(filePath)));
- String line;
- while((line = reader.readLine()) != null)
- str += line + "\n";
- } catch(IOException e) {
- msgStatus(e.getMessage());
- }
- return str;
- }
-
- public String writeFile(String filePath, String content, String ext) {
- File file = new File(filePath);
- if(file.canRead()) {
- int ok = JOptionPane.showConfirmDialog(this,
- file.getName() + " exists. Overwrite?\nCancel to rename.",
- "Confirm dialog", JOptionPane.OK_CANCEL_OPTION);
- if(ok != JOptionPane.OK_OPTION) {
- filePath = getFileNameFromFileChooser(this, "Load FBD", true, ext);
- if(filePath == null) return null;
- }
- }
- try {
- FileWriter fw = new FileWriter(filePath);
- fw.write(content, 0, content.length());
- fw.flush();
- fw.close();
- } catch (IOException e) {
- msgStatus(e.getMessage());
- }
- return filePath;
- }
-
- public String getFileNameFromFileChooser(Component parent, String title, boolean isSave, String ext) {
- String[] exts = new String[1];
- exts[0] = ext;
- return getFileNameFromFileChooser(parent, title, isSave, exts);
- }
-
- public String getFileNameFromFileChooser(Component parent, String title, boolean isSave, String[] exts) {
- JFileChooser fileChooser = new JFileChooser(".");
- fileChooser.setDialogTitle(title);
- ExtFilter defaultFilter = new ExtFilter(exts[0]);
- for(int i=1; i<exts.length; i++)
- fileChooser.addChoosableFileFilter(new ExtFilter(exts[i]));
- fileChooser.setFileFilter(defaultFilter);
- int userCommand;
- if(isSaving) {
- fileChooser.setDialogType( JFileChooser.SAVE_DIALOG);
- userCommand = fileChooser.showSaveDialog(parent);
- } else {
- fileChooser.setDialogType( JFileChooser.OPEN_DIALOG);
- userCommand = fileChooser.showOpenDialog(parent);
- }
- if(userCommand == JFileChooser.CANCEL_OPTION)
- return null;
- else {
- String filename = fileChooser.getSelectedFile().getAbsolutePath();
- return filename;
- }
- }
-
- public void InitTreeView()
- {
- DefaultMutableTreeNode top = new DefaultMutableTreeNode(root.name);
- DefaultMutableTreeNode parent = top;
- Object[] nodes = new Object[xmlParsing.nodeCount+1];
- int count=0;
- nodes[0] = root;
- for(FODInformation fodInformation : root.fods) //????? ?? variable?? tree? ???.
- ShowNextNode(fodInformation,parent,nodes,count);
- for(SDTInformation sdtInformation : root.sdts)
- ShowNextNode(sdtInformation, parent,nodes,count);
- for(FSMInformation fsmInformation : root.fsms)
- ShowNextNode(fsmInformation, parent,nodes,count);
- for (TTSInformation ttsInformation : root.ttss)
- ShowNextNode(ttsInformation, parent,nodes,count);
-
- m_model = new DefaultTreeModel(top); //? ?? ?? ???? ??? ??.
- m_tree = new JTree(m_model);
- DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
- m_tree.setCellRenderer(renderer);
- m_tree.setShowsRootHandles(true);
- m_tree.setEditable(false);
- m_tree.setVisible(true);
- m_tree.addTreeSelectionListener(new NodeSelectionListener());
- m_tree.validate();
-
- JScrollPane s = new JScrollPane();
- s.getViewport().add(m_tree);
-
- views[0] = createView("Hierachy Window", new ImageIcon(""), s);
- windowTab = createTabWindow();
- windowTab.addTab(views[0]);
-
-
- mainWindow.setWindow(new SplitWindow(true, 0.2f, leftWindow, mainTab));
- leftWindow.setWindow(new SplitWindow(false, 0.7f, windowTab, description));
-
- }
-
- public void SetDescriptionNodes()
- {
- DefaultMutableTreeNode top = new DefaultMutableTreeNode(currentVariable.name);
- DefaultMutableTreeNode parent = top;
- DefaultMutableTreeNode childDescription = new DefaultMutableTreeNode("Description");
- for(String s : currentVariable.description)
- {
- if(s.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(s);
- childDescription.add(c);
- }
- }
-
- DefaultMutableTreeNode childTemplateNumber = new DefaultMutableTreeNode("Template Number");
- for(String s : currentVariable.templeteNumber)
- {
- if(s.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(s);
- childTemplateNumber.add(c);
- }
- }
-
- DefaultMutableTreeNode childInput = new DefaultMutableTreeNode("Input");
- if(currentVariable instanceof FODInformation)
- {
- for(InputInformation i : currentVariable.inputs)
- {
- if(i.name.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(i.name);
- childInput.add(c);
- }
- }
- }
- else if(currentVariable instanceof SDTInformation)
- {
- for(GenericLinkableInformation g : ((SDTInformation)currentVariable).inputsForSDT)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(g.name);
- childInput.add(c);
- }
- }
- else if(currentVariable instanceof FSMInformation)
- {
- for(GenericLinkableInformation g : ((FSMInformation)currentVariable).inputsForFSM)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(g.name);
- childInput.add(c);
- }
- }
- else if(currentVariable instanceof TTSInformation)
- {
- for(GenericLinkableInformation g : ((TTSInformation)currentVariable).inputsForTTS)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(g.name);
- childInput.add(c);
- }
- }
-
-
-
- DefaultMutableTreeNode childOutput = new DefaultMutableTreeNode("Output");
- if(currentVariable instanceof FODInformation)
- {
- for(OutputInformation o : currentVariable.outputs)
- {
- if(o.name.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(o.name);
- childOutput.add(c);
- }
- }
- }
- else if(currentVariable instanceof SDTInformation)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(((SDTInformation)currentVariable).name);
- childOutput.add(c);
- }
- else if(currentVariable instanceof FSMInformation)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(((FSMInformation)currentVariable).name);
- childOutput.add(c);
- }
- else if(currentVariable instanceof TTSInformation)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(((TTSInformation)currentVariable).name);
- childOutput.add(c);
- }
-
-
- DefaultMutableTreeNode childConstant = new DefaultMutableTreeNode("Constant");
- for(String s : currentVariable.constants)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(s);
- childConstant.add(c);
- }
-
- DefaultMutableTreeNode childLocalClockVariable = new DefaultMutableTreeNode("Local Clock Variable");
- for(String s : currentVariable.localClockVarialbles)
- {
- if(s.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(s);
- childLocalClockVariable.add(c);
- }
- }
-
- DefaultMutableTreeNode childPreviousStateVariable = new DefaultMutableTreeNode("Previous State Variable");
- if(currentVariable.previousStateVariable.equals("")==false)
- {
- DefaultMutableTreeNode c = new DefaultMutableTreeNode(currentVariable.previousStateVariable);
- childPreviousStateVariable.add(c);
- }
-
- DefaultMutableTreeNode childMemoriazableVariable = new DefaultMutableTreeNode("Memoriazable Variable Of External Input");
- for(String s : currentVariable.momoriazbleVariableofExternalinputs)
- {
- if(s.equals("")==false)
- {
- DefaultMutableTreeNode cc = new DefaultMutableTreeNode(s);
- childMemoriazableVariable.add(cc);
- }
- }
-
- parent.add(childDescription);
- parent.add(childTemplateNumber);
- parent.add(childInput);
- parent.add(childOutput);
- parent.add(childConstant);
- parent.add(childLocalClockVariable);
- parent.add(childPreviousStateVariable);
- parent.add(childMemoriazableVariable);
-
- m_model2 = new DefaultTreeModel(top); //? ?? ?? ???? ??? ??.
- m_tree2 = new JTree(m_model2);
- DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
- m_tree2.setCellRenderer(renderer);
- m_tree2.setShowsRootHandles(true);
- m_tree2.setEditable(false);
- m_tree2.setVisible(true);
- m_tree2.addTreeSelectionListener(new NodeSelectionListener());
- m_tree2.validate();
-
- JScrollPane s = new JScrollPane();
- s.getViewport().add(m_tree2);
-
- views[9] = createView("Description Window", new ImageIcon(""), s);
- description = createTabWindow();
- description.addTab(views[9]);
-
-
- mainWindow.setWindow(new SplitWindow(true, 0.2f, leftWindow, mainTab));
- leftWindow.setWindow(new SplitWindow(false, 0.7f, windowTab, description));
-
- }
-
- public void ShowNextNode(GenericInformation genericInformation,DefaultMutableTreeNode parentTreeNode,Object[] nodes,int count)
- {
- DefaultMutableTreeNode child = new DefaultMutableTreeNode(genericInformation.name);
- parentTreeNode.add(child);
- count++;
-
- if (genericInformation instanceof FODInformation)
- {
- FODInformation fodInformation= (FODInformation)genericInformation;
- for (FODInformation fod : fodInformation.fods)
- {
- nodes[count] = fod;
- ShowNextNode(fod, child,nodes,count);
- }
- for (SDTInformation sdt : fodInformation.sdts)
- {
- nodes[count] = sdt;
- ShowNextNode(sdt, child,nodes,count);
- }
- for (FSMInformation fsm : fodInformation.fsms)
- {
- nodes[count] = fsm;
- ShowNextNode(fsm, child,nodes,count);
- }
- for (TTSInformation tts : fodInformation.ttss)
- {
- nodes[count] = tts;
- ShowNextNode(tts, child,nodes,count);
- }
-
- }
- }
-
- public void InitTwoCViewForSDT(int contentCount,TwoCInformationSDT twoCInformation) //colum??
- {
- int count = 0;
- DefaultTableCellRenderer r = new DefaultTableCellRenderer();
- r.setHorizontalAlignment(JLabel.LEFT);
-
- m_tableData1 = new TwoCTableData();
- m_tableData2 = new TwoCTableData();
-
- m_twoCtable = new JTable();
- m_twoCtable.setAutoCreateColumnsFromModel(false);
- m_twoCtable.setModel(m_tableData1);
- TableColumn column1 = new TableColumn(count, 500, r, null);
- m_twoCtable.addColumn(column1);
-
- m_combinedTwoCtable = new JTable();
- m_combinedTwoCtable.setAutoCreateColumnsFromModel(false);
- m_combinedTwoCtable.setModel(m_tableData2);
- TableColumn column2 = new TableColumn(count, 500, r, null);
- m_combinedTwoCtable.addColumn(column2);
-
- count++;
- int colcount=0;
- for(int i=0;i<contentCount;i++)
- {
- if(twoCInformation.conditionContents[0][i]==null)
- break;
- if(twoCInformation.conditionContents[0][i].equals("T"))
- colcount++;
- else if(twoCInformation.conditionContents[0][i].equals("F"))
- colcount++;
- else if(twoCInformation.conditionContents[0][i].equals("-"))
- colcount+=2;
- }
- for (; colcount > 0; colcount--)
-
- {
- DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
- renderer.setHorizontalAlignment(JLabel.CENTER);
-
- TableColumn column11 = new TableColumn(count, 60, renderer, null);
- m_twoCtable.addColumn(column11);
-
- TableColumn column22= new TableColumn(count, 60, renderer, null);
- m_combinedTwoCtable.addColumn(column22);
-
- count++;
- }
-
- JScrollPane s = new JScrollPane();
- s.getViewport().add(m_twoCtable);
-
- JScrollPane ss = new JScrollPane();
- ss.getViewport().add(m_combinedTwoCtable);
-
- views[1] = createView("2CTable", new ImageIcon(""), s);
- views[4] = createView("Combined 2CTable",new ImageIcon(""),ss);
-
- mainTab = createTabWindow();
- mainTab.addTab(views[1]);
- mainTab.addTab(views[4]);
- mainTab.addTab(views[5]);
- mainTab.addTab(views[6]);
- mainTab.addTab(views[7]);
- mainTab.addTab(views[8]);
- mainTab.setSelectedTab(0);
-
- mainWindow.setWindow(new SplitWindow(true, 0.2f, leftWindow, mainTab));
- leftWindow.setWindow(new SplitWindow(false, 0.7f, windowTab, description));
- }
-
- public void InitTwoCViewForAutomata(int contentCount) //colum??
- {
- int count = 0;
- DefaultTableCellRenderer r = new DefaultTableCellRenderer();
- r.setHorizontalAlignment(JLabel.LEFT);
-
- m_tableData1 = new TwoCTableData();
- m_tableData2 = new TwoCTableData();
-
- m_twoCtable = new JTable();
- m_twoCtable.setAutoCreateColumnsFromModel(false);
- m_twoCtable.setModel(m_tableData1);
- TableColumn column1 = new TableColumn(count, 500, r, null);
- m_twoCtable.addColumn(column1);
-
- m_combinedTwoCtable = new JTable();
- m_combinedTwoCtable.setAutoCreateColumnsFromModel(false);
- m_combinedTwoCtable.setModel(m_tableData2);
- TableColumn column2 = new TableColumn(count, 500, r, null);
- m_combinedTwoCtable.addColumn(column2);
-
- count++;
- for (; contentCount > 0; contentCount--)
- {
- DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
- renderer.setHorizontalAlignment(JLabel.CENTER);
-
- TableColumn column11 = new TableColumn(count, 50, renderer, null);
- m_twoCtable.addColumn(column11);
-
- TableColumn column22= new TableColumn(count, 50, renderer, null);
- m_combinedTwoCtable.addColumn(column22);
-
- count++;
- }
- JScrollPane s = new JScrollPane();
- s.getViewport().add(m_twoCtable);
-
- JScrollPane ss = new JScrollPane();
- ss.getViewport().add(m_combinedTwoCtable);
-
- views[1] = createView("2CTable", new ImageIcon(""), s);
- views[4] = createView("Combined 2CTable",new ImageIcon(""),ss);
- mainTab = createTabWindow();
- mainTab.addTab(views[1]);
- mainTab.addTab(views[4]);
- mainTab.addTab(views[5]);
- mainTab.addTab(views[6]);
- mainTab.addTab(views[7]);
- mainTab.addTab(views[8]);
- mainTab.setSelectedTab(0);
-
- MouseListener l = null;
- views[8].addMouseListener(l);
-
- mainWindow.setWindow(new SplitWindow(true, 0.2f, leftWindow, mainTab));
- leftWindow.setWindow(new SplitWindow(false, 0.7f, windowTab, description));
- }
-
- public void actionPerformed(ActionEvent e){
-
- }
-
- public void ViewTwoCTableForSDT(TwoCInformationSDT twoCInformation) //list view? ??
- {
- InitTwoCViewForSDT(twoCInformation.conditionContents[0].length-1,twoCInformation);
- for (int i=0;i<twoCInformation.conditionContents.length ;i++ )
- {
- ArrayList<String> array = new ArrayList<String>();
- int x=0;
-
- array.add(twoCInformation.conditionContents[i][0]);
- for (int j=1;j<twoCInformation.conditionContents[i].length ;j++ )
- array.add(twoCInformation.conditionContents[i][j]);
-
- String[] ss = new String[array.size()];
- for(String s : array)
- { ss[x++] = s; }
- m_tableData1.m_vector.addElement(ss);
- }
-
- m_tableData1.m_vector.addElement(new String[]{"Action","Action"});
-
- for (int i=0;i<twoCInformation.actionContents.length ;i++ )
- {
- ArrayList<String> array = new ArrayList<String>();
- int x=0;
-
- array.add(twoCInformation.actionContents[i][0]);
- for (int j=1;j<twoCInformation.actionContents[i].length ;j++ )
- array.add(twoCInformation.actionContents[i][j]);
-
- String[] ss = new String[array.size()];
- for(String s : array)
- { ss[x++] = s; }
- m_tableData1.m_vector.addElement(ss);
- }
-
-
- //****************************************************************************************
- //combined ? ??.
- String[] conditions = new String[twoCInformation.conditionContents.length]; //?? ?? ??
- for (int i=0;i<twoCInformation.conditionContents.length ;i++ )
- conditions[i] = twoCInformation.conditionContents[i][0];
-
- combineEngine = new CombineEngine();
- condsQueueLast = new LinkedList<CondInformation>();
- combineEngine.MakeCond(conditions,condsQueueLast); //combine
-
-
- for (int i=0;i<twoCInformation.conditionContents.length ;i++ )
- {
- ArrayList<String> array = new ArrayList<String>();
- int x=0;
-
- array.add(conditions[i]);
- for (int j=1;j<twoCInformation.conditionContents[i].length ;j++ )
- array.add(twoCInformation.conditionContents[i][j]);
-
- String[] ss = new String[array.size()];
- for(String s : array)
- { ss[x++] = s; }
- m_tableData2.m_vector.addElement(ss);
- }
-
- m_tableData2.m_vector.addElement(new String[]{"Action","Action"});
-
- for (int i=0;i<twoCInformation.actionContents.length ;i++ )
- {
- ArrayList<String> array = new ArrayList<String>();
- int x=0;
- array.add(twoCInformation.actionContents[i][0]);
- for (int j=1;j<twoCInformation.actionContents[i].length ;j++ )
- array.add(twoCInformation.actionContents[i][j]);
-
- String[] ss = new String[array.size()];
- for(String s : array)
- { ss[x++] = s; }
- m_tableData2.m_vector.addElement(ss);
- }
- //output????.
- twoCInformation.outputString = twoCInformation.actionContents[0][0].substring(0, twoCInformation.actionContents[0][0].indexOf(':'));
- twoCInformation.outputString =twoCInformation.outputString.replace("\n", "");
- //*******************************************************************************************
- //???? ?? action?? condition ??.
- //*******************************************************************************************
- String selBlockString = "(";
- combinedSelBlocks.clear();
- for (int i=1;i<twoCInformation.conditionContents[0].length ;i++ )
- {
-
- for (int j=0;j<twoCInformation.conditionContents.length ;j++ )
- {
- if(j==0)
- {
- if(twoCInformation.conditionContents[j].length<=i)
- continue;
- if ( twoCInformation.conditionContents[j][i] == null||twoCInformation.conditionContents[j][i].equals("")||twoCInformation.conditionContents[j][i].equals(" "))
- break;
- if(twoCInformation.conditionContents[j][i].equals("T"))
- selBlockString +="("+conditions[j]+")";
- else
- selBlockString += "!" + "(" + conditions[j] + ")";
-
- }
- else
- {
- if (twoCInformation.conditionContents[j][i] == null||twoCInformation.conditionContents[j][i].equals(""))
- break;
- if(twoCInformation.conditionContents[j][i].equals("T"))
- selBlockString += "&" + "(" + conditions[j] + ")";
- else
- selBlockString += "&!" + "(" + conditions[j] + ")";
- }
- if (twoCInformation.conditionContents[j][i] == null||twoCInformation.conditionContents[j][i].equals(""))
- {
- selBlockString = "(";
- break;
- }
- }
-
- if(selBlockString.equals("("))
- continue;
-
- selBlockString += ")";
- String output = "";
- boolean startFlag = false;
- for(int j=0;j<twoCInformation.actionContents.length;j++)
- {
- if(twoCInformation.actionContents[j].length<=i)
- continue;
- if(twoCInformation.actionContents[j][i]==null)
- continue;
- if(twoCInformation.actionContents[j][i].equals("O")||twoCInformation.act…
Large files files are truncated, but you can click here to view the full file