Search in sources :

Example 11 with Unit

use of catdata.Unit in project fql by CategoricalData.

the class FqlOptions method display.

@Override
public Pair<JComponent, Function<Unit, Unit>> display() {
    JPanel general1 = new JPanel(new GridLayout(22, 1));
    JPanel general2 = new JPanel(new GridLayout(22, 1));
    JSplitPane generalsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    generalsplit.add(general1);
    generalsplit.add(general2);
    JCheckBox surjB = new JCheckBox("", allow_surjective);
    JLabel surjL = new JLabel("Allow surjective pi (dangerous):");
    general1.add(surjL);
    general2.add(surjB);
    surjL.setToolTipText("Allows the attribute mapping of pi migrations to be surjections.");
    JCheckBox coeB = new JCheckBox("", continue_on_error);
    JLabel coeL = new JLabel("Continue on errors (dangerous):");
    general1.add(coeL);
    general2.add(coeB);
    coeL.setToolTipText("FQL will attempt to continue on errors, and report these after opening the viewer.");
    JCheckBox ed = new JCheckBox("", VALIDATE_WITH_EDS);
    ed.setToolTipText("Validates Sigma/Delta migrations (on objects) using embedded dependencies");
    JLabel edL = new JLabel("Validate sigmas and deltas using EDs:");
    general1.add(edL);
    general2.add(ed);
    JCheckBox nullbox = new JCheckBox("", ALLOW_NULLS);
    nullbox.setToolTipText("Allow full sigma to create null attribute values");
    JLabel nullL = new JLabel("Allow SIGMA to create nulls (dangerous):");
    general1.add(nullL);
    general2.add(nullbox);
    JCheckBox gr = new JCheckBox("", ALL_GR_PATHS);
    gr.setToolTipText("Show all paths in category of elements");
    JLabel grL = new JLabel("Show all paths in elements view:");
    general1.add(grL);
    general2.add(gr);
    JCheckBox jcb0 = new JCheckBox("", ALLOW_INFINITES);
    JLabel label4 = new JLabel("Allow some infinite schemas (dangerous):");
    label4.setToolTipText(label4text);
    general1.add(label4);
    general2.add(jcb0);
    JCheckBox jcb = new JCheckBox("", VALIDATE);
    JLabel label5 = new JLabel("Validate all categories:");
    label5.setToolTipText(label5text);
    general1.add(label5);
    general2.add(jcb);
    ButtonGroup group = new ButtonGroup();
    JRadioButton nativeButton = new JRadioButton("Naive");
    JRadioButton h2Button = new JRadioButton("H2");
    JRadioButton jdbcButton = new JRadioButton("JDBC");
    group.add(nativeButton);
    group.add(h2Button);
    group.add(jdbcButton);
    JPanel jdbcBox = new JPanel(new FlowLayout(FlowLayout.LEFT));
    jdbcBox.add(nativeButton);
    jdbcBox.add(h2Button);
    jdbcBox.add(jdbcButton);
    switch(sqlKind) {
        case H2:
            group.setSelected(h2Button.getModel(), true);
            break;
        case JDBC:
            group.setSelected(jdbcButton.getModel(), true);
            break;
        case NATIVE:
            group.setSelected(nativeButton.getModel(), true);
            break;
        default:
            throw new RuntimeException();
    }
    JLabel jdbcLabel = new JLabel("SQL Engine:");
    jdbcLabel.setToolTipText("Choose between a naive SQL engine, the H2 engine, or an external JDBC engine.");
    general1.add(jdbcLabel);
    general2.add(jdbcBox);
    JTextField jdbcField = new JTextField(jdbcUrl);
    JLabel jdbcLabel2 = new JLabel("JDBC URL:");
    jdbcLabel2.setToolTipText("The JDBC connection to use.");
    general1.add(jdbcLabel2);
    general2.add(Options.wrap(jdbcField));
    JTextField jdbcField2 = new JTextField(jdbcClass);
    JLabel jdbcLabel22 = new JLabel("JDBC Driver Class:");
    jdbcLabel22.setToolTipText("The JDBC class to use.");
    general1.add(jdbcLabel22);
    general2.add(Options.wrap(jdbcField2));
    JTextField plen = new JTextField(Integer.toString(MAX_PATH_LENGTH));
    JLabel label6 = new JLabel("Maximum path length:");
    label6.setToolTipText(label6text);
    general1.add(label6);
    general2.add(Options.wrap(plen));
    JTextField iter = new JTextField(Integer.toString(MAX_DENOTE_ITERATIONS));
    JLabel label7 = new JLabel("Maximum iterations for left-kan:");
    label7.setToolTipText(label7text);
    general1.add(label7);
    general2.add(Options.wrap(iter));
    JTextField vlen = new JTextField(Integer.toString(varlen));
    JLabel label8 = new JLabel("VARCHAR size:");
    label8.setToolTipText(label8text);
    general1.add(label8);
    general2.add(Options.wrap(vlen));
    JTextField area = new JTextField(12);
    area.setText(prelude);
    JLabel areaLabel = new JLabel("Generated SQL prelude:");
    areaLabel.setToolTipText("Set the prelude for the generated SQL.");
    general1.add(areaLabel);
    general2.add(Options.wrap(area));
    // area.setMaximumSize(new Dimension(200, 300));
    JTextField area2 = new JTextField(12);
    area2.setText(afterlude);
    JLabel areaLabel2 = new JLabel("Generated SQL postlude:");
    areaLabel2.setToolTipText("Set the postlude for the generated SQL.");
    general1.add(areaLabel2);
    general2.add(Options.wrap(area2));
    // area2.setMaximumSize(new Dimension(200, 300));
    JPanel schemaArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox schema_graphical_box = new JCheckBox("Graph", schema_graphical);
    JCheckBox schema_textual_box = new JCheckBox("Text", schema_textual);
    JCheckBox schema_tabular_box = new JCheckBox("Table", schema_tabular);
    JCheckBox schema_ed_box = new JCheckBox("ED", schema_ed);
    JCheckBox schema_denotation_box = new JCheckBox("Denotation", schema_denotation);
    JCheckBox schema_rdf_box = new JCheckBox("OWL", schema_rdf);
    JCheckBox schema_dot_box = new JCheckBox("Dot", schema_dot);
    JCheckBox schema_chk_box = new JCheckBox("Check", schema_check);
    // JPanel schemaTemp = new JPanel();
    // schemaTemp.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JComboBox<String> schemaBox = new JComboBox<>(layouts);
    schemaBox.setSelectedItem(schema_graph);
    schemaBox.setToolTipText(layout_string);
    schemaArea.add(schemaBox);
    schemaArea.add(schema_graphical_box);
    // schemaArea.add(schemaTemp);
    schemaArea.add(schema_textual_box);
    schemaArea.add(schema_tabular_box);
    schemaArea.add(schema_ed_box);
    schemaArea.add(schema_denotation_box);
    schemaArea.add(schema_rdf_box);
    schemaArea.add(schema_chk_box);
    // schemaArea.add(schemaBox);
    JLabel schema_label = new JLabel("Schema viewer panels:");
    schema_label.setToolTipText("Sets which viewers to use for schemas.");
    general1.add(schema_label);
    general2.add(schemaArea);
    JPanel mappingArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox mapping_graphical_box = new JCheckBox("Graph", mapping_graphical);
    JCheckBox mapping_textual_box = new JCheckBox("Text", mapping_textual);
    JCheckBox mapping_tabular_box = new JCheckBox("Table", mapping_tabular);
    JCheckBox mapping_ed_box = new JCheckBox("ED", mapping_ed);
    // JPanel mappingTemp = new JPanel();
    // schemaTemp.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    JComboBox<String> mappingBox = new JComboBox<>(layouts);
    mappingBox.setToolTipText(layout_string);
    mappingBox.setSelectedItem(mapping_graph);
    mappingArea.add(mappingBox);
    mappingArea.add(mapping_graphical_box);
    // mappingArea.add(mappingTemp);
    mappingArea.add(mapping_textual_box);
    mappingArea.add(mapping_tabular_box);
    mappingArea.add(mapping_ed_box);
    JLabel mapping_label = new JLabel("Mapping viewer panels:");
    mapping_label.setToolTipText("Sets which viewers to use for mappings.");
    general1.add(mapping_label);
    general2.add(mappingArea);
    JPanel instArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox inst_graphical_box = new JCheckBox("Graph", inst_graphical);
    JCheckBox inst_textual_box = new JCheckBox("Text", inst_textual);
    JCheckBox inst_tabular_box = new JCheckBox("Table", inst_tabular);
    JCheckBox inst_joined_box = new JCheckBox("Join", inst_joined);
    JCheckBox inst_gr_box = new JCheckBox("Elems", inst_gr);
    JCheckBox inst_obs_box = new JCheckBox("Obs", inst_obs);
    JCheckBox inst_rdf_box = new JCheckBox("RDF", inst_rdf);
    JCheckBox inst_adom_box = new JCheckBox("Adom", inst_adom);
    JCheckBox inst_dot_box = new JCheckBox("Dot", inst_dot);
    JComboBox<String> instBox = new JComboBox<>(layouts);
    instBox.setToolTipText(layout_string);
    instBox.setSelectedItem(inst_graph);
    instArea.add(instBox);
    instArea.add(inst_graphical_box);
    instArea.add(inst_textual_box);
    instArea.add(inst_tabular_box);
    instArea.add(inst_joined_box);
    instArea.add(inst_gr_box);
    instArea.add(inst_obs_box);
    instArea.add(inst_rdf_box);
    instArea.add(inst_adom_box);
    instArea.add(inst_dot_box);
    JLabel inst_label = new JLabel("Instance viewer panels:");
    inst_label.setToolTipText("Sets which viewers to use for instances.");
    general1.add(inst_label);
    general2.add(instArea);
    instBox.setToolTipText(layout_string);
    JPanel transformArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox transform_graphical_box = new JCheckBox("Graph", transform_graphical);
    JCheckBox transform_textual_box = new JCheckBox("Text", transform_textual);
    JCheckBox transform_tabular_box = new JCheckBox("Table", transform_tabular);
    JComboBox<String> transBox = new JComboBox<>(layouts);
    transBox.setToolTipText(layout_string);
    transBox.setSelectedItem(trans_graph);
    transformArea.add(transBox);
    transformArea.add(transform_graphical_box);
    transformArea.add(transform_textual_box);
    transformArea.add(transform_tabular_box);
    JLabel transform_label = new JLabel("Transform viewer panels:");
    mapping_label.setToolTipText("Sets which viewers to use for transforms.");
    general1.add(transform_label);
    general2.add(transformArea);
    JPanel fullQueryArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox query_graphical_box = new JCheckBox("Graph", query_graphical);
    JCheckBox query_textual_box = new JCheckBox("Text", query_textual);
    JComboBox<String> queryBox = new JComboBox<>(layouts);
    queryBox.setToolTipText(layout_string);
    queryBox.setSelectedItem(query_graph);
    fullQueryArea.add(queryBox);
    fullQueryArea.add(query_graphical_box);
    fullQueryArea.add(query_textual_box);
    JLabel query_label = new JLabel("Full Query viewer panels:");
    query_label.setToolTipText("Sets which viewers to use for full queries.");
    general1.add(query_label);
    general2.add(fullQueryArea);
    JComboBox<String> instFlowBox = new JComboBox<>(layouts);
    instFlowBox.setToolTipText(layout_string);
    instFlowBox.setSelectedItem(instFlow_graph);
    JPanel instFlowArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    instFlowArea.add(instFlowBox);
    JLabel instFlow_label = new JLabel("Instance Flow graph layouts:");
    instFlow_label.setToolTipText("Sets which graph layout to use for instance flow.");
    general1.add(instFlow_label);
    general2.add(instFlowArea);
    JComboBox<String> schFlowBox = new JComboBox<>(layouts);
    schFlowBox.setToolTipText(layout_string);
    schFlowBox.setSelectedItem(schFlow_graph);
    JPanel schFlowArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    schFlowArea.add(schFlowBox);
    JLabel schFlow_label = new JLabel("Schema Flow graph layouts:");
    schFlow_label.setToolTipText("Sets which graph layout to use for schema flow.");
    general1.add(schFlow_label);
    general2.add(schFlowArea);
    // for (int i = 0; i < Options.biggestSize - size(); i++) {
    // general1.add(new JLabel());
    // general2.add(new JLabel());
    // }
    Function<Unit, Unit> fn = (Unit t) -> {
        int a = MAX_PATH_LENGTH;
        int b = MAX_DENOTE_ITERATIONS;
        int d = varlen;
        try {
            a = Integer.parseInt(plen.getText());
            b = Integer.parseInt(iter.getText());
            d = Integer.parseInt(vlen.getText());
        } catch (NumberFormatException nfe) {
        }
        continue_on_error = coeB.isSelected();
        VALIDATE_WITH_EDS = ed.isSelected();
        ALLOW_NULLS = nullbox.isSelected();
        ALL_GR_PATHS = gr.isSelected();
        ALLOW_INFINITES = jcb0.isSelected();
        VALIDATE = jcb.isSelected();
        MAX_PATH_LENGTH = a;
        MAX_DENOTE_ITERATIONS = b;
        varlen = d;
        prelude = area.getText();
        afterlude = area2.getText();
        schema_denotation = schema_denotation_box.isSelected();
        schema_ed = schema_ed_box.isSelected();
        schema_graphical = schema_graphical_box.isSelected();
        schema_tabular = schema_tabular_box.isSelected();
        schema_textual = schema_textual_box.isSelected();
        schema_rdf = schema_rdf_box.isSelected();
        schema_dot = schema_dot_box.isSelected();
        schema_check = schema_chk_box.isSelected();
        mapping_ed = mapping_ed_box.isSelected();
        mapping_graphical = mapping_graphical_box.isSelected();
        mapping_tabular = mapping_tabular_box.isSelected();
        mapping_textual = mapping_textual_box.isSelected();
        query_graphical = query_graphical_box.isSelected();
        query_textual = query_textual_box.isSelected();
        inst_graphical = inst_graphical_box.isSelected();
        inst_tabular = inst_tabular_box.isSelected();
        inst_textual = inst_textual_box.isSelected();
        inst_joined = inst_joined_box.isSelected();
        inst_gr = inst_gr_box.isSelected();
        inst_obs = inst_obs_box.isSelected();
        inst_rdf = inst_rdf_box.isSelected();
        inst_adom = inst_adom_box.isSelected();
        inst_dot = inst_dot_box.isSelected();
        schema_graph = (String) schemaBox.getSelectedItem();
        mapping_graph = (String) mappingBox.getSelectedItem();
        inst_graph = (String) instBox.getSelectedItem();
        trans_graph = (String) transBox.getSelectedItem();
        query_graph = (String) queryBox.getSelectedItem();
        instFlow_graph = (String) instFlowBox.getSelectedItem();
        schFlow_graph = (String) schFlowBox.getSelectedItem();
        allow_surjective = surjB.isSelected();
        transform_graphical = transform_graphical_box.isSelected();
        transform_tabular = transform_tabular_box.isSelected();
        transform_textual = transform_textual_box.isSelected();
        if (h2Button.isSelected()) {
            sqlKind = SQLKIND.H2;
        } else if (jdbcButton.isSelected()) {
            sqlKind = SQLKIND.JDBC;
        } else if (nativeButton.isSelected()) {
            sqlKind = SQLKIND.NATIVE;
        }
        jdbcUrl = jdbcField.getText();
        jdbcClass = jdbcField2.getText();
        return new Unit();
    };
    JPanel pan = new JPanel(new GridLayout(1, 1));
    pan.setPreferredSize(new Dimension(300, 20 * Options.biggestSize));
    pan.add(new JScrollPane(generalsplit));
    return new Pair<>(pan, fn);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JTextField(javax.swing.JTextField) Unit(catdata.Unit) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) ButtonGroup(javax.swing.ButtonGroup) JSplitPane(javax.swing.JSplitPane) Pair(catdata.Pair)

Example 12 with Unit

use of catdata.Unit in project fql by CategoricalData.

the class FqlDisplay method handleInstanceFlowEdge.

private void handleInstanceFlowEdge(Object o) {
    InstExp i = (InstExp) o;
    Object f = i.accept(new Unit(), new InstExpVisitor<Object, Unit>() {

        @Override
        public MapExp visit(Unit env, Zero e) {
            return null;
        }

        @Override
        public MapExp visit(Unit env, One e) {
            return null;
        }

        @Override
        public MapExp visit(Unit env, Two e) {
            throw new RuntimeException();
        }

        @Override
        public MapExp visit(Unit env, Plus e) {
            return null;
        }

        @Override
        public MapExp visit(Unit env, Times e) {
            return null;
        }

        @Override
        public MapExp visit(Unit env, Exp e) {
            throw new RuntimeException();
        }

        @Override
        public MapExp visit(Unit env, Const e) {
            return null;
        }

        @Override
        public MapExp visit(Unit env, Delta e) {
            return e.F;
        }

        @Override
        public MapExp visit(Unit env, Sigma e) {
            return e.F;
        }

        @Override
        public MapExp visit(Unit env, Pi e) {
            return e.F;
        }

        @Override
        public MapExp visit(Unit env, FullSigma e) {
            return e.F;
        }

        @Override
        public Unit visit(Unit env, Relationalize e) {
            return null;
        }

        @Override
        public Unit visit(Unit env, External e) {
            return null;
        }

        @Override
        public Object visit(Unit env, Eval e) {
            return e.q;
        }

        @Override
        public Object visit(Unit env, FullEval e) {
            return e.q;
        }

        @Override
        public Object visit(Unit env, Kernel e) {
            return null;
        }

        @Override
        public Object visit(Unit env, Step e) {
            // (Step) this should return a pair
            return null;
        }
    });
    if (f == null) {
        return;
    }
    if (f instanceof QueryExp) {
        QueryExp q = (QueryExp) f;
        if (q instanceof QueryExp.Var) {
            QueryExp.Var qq = (QueryExp.Var) q;
            yyy.setSelectedValue(indices.get(qq.v), true);
            return;
        }
        String k = FQLProgram.revLookup(prog.queries, q);
        if (k != null) {
            yyy.setSelectedValue(indices.get(k), true);
            return;
        }
        String str = q.toString();
        if (!extraInsts.contains(str)) {
            Query view = q.toQuery(prog);
            JPanel p = showQuery(prog, env, view);
            x.add(p, str);
            extraInsts.add(str);
        }
        yyy.clearSelection();
        cl.show(x, str);
    } else if (f instanceof FullQueryExp) {
        FullQueryExp q = (FullQueryExp) f;
        if (q instanceof FullQueryExp.Var) {
            FullQueryExp.Var qq = (FullQueryExp.Var) q;
            yyy.setSelectedValue(indices.get(qq.v), true);
            return;
        }
        String k = FQLProgram.revLookup(prog.full_queries, q);
        if (k != null) {
            yyy.setSelectedValue(indices.get(k), true);
            return;
        }
        String str = q.toString();
        if (!extraInsts.contains(str)) {
            FullQuery view = q.toFullQuery(prog);
            JPanel p = showFullQuery(prog, env, view, q);
            x.add(p, str);
            extraInsts.add(str);
        }
        yyy.clearSelection();
        cl.show(x, str);
    } else if (f instanceof MapExp) {
        MapExp q = (MapExp) f;
        if (q instanceof MapExp.Var) {
            MapExp.Var qq = (MapExp.Var) q;
            yyy.setSelectedValue(indices.get(qq.v), true);
            return;
        }
        String k = FQLProgram.revLookup(prog.maps, q);
        if (k != null) {
            yyy.setSelectedValue(indices.get(k), true);
            return;
        }
        String str = q.toString();
        if (!extraInsts.contains(str)) {
            Mapping view = q.toMap(prog);
            JPanel p = showMapping(env, prog.smap(view.source.toConst()), prog.smap(view.target.toConst()), view);
            x.add(p, str);
            extraInsts.add(str);
        }
        yyy.clearSelection();
        cl.show(x, str);
    } else {
        throw new RuntimeException();
    }
}
Also used : JPanel(javax.swing.JPanel) FullEval(catdata.fql.decl.InstExp.FullEval) FullQuery(catdata.fql.decl.FullQuery) Query(catdata.fql.decl.Query) FullQueryExp(catdata.fql.decl.FullQueryExp) QueryExp(catdata.fql.decl.QueryExp) Var(catdata.fql.decl.SigExp.Var) One(catdata.fql.decl.InstExp.One) FullSigma(catdata.fql.decl.InstExp.FullSigma) Sigma(catdata.fql.decl.InstExp.Sigma) FullQueryExp(catdata.fql.decl.FullQueryExp) Mapping(catdata.fql.decl.Mapping) Step(catdata.fql.decl.InstExp.Step) Unit(catdata.Unit) Pi(catdata.fql.decl.InstExp.Pi) Plus(catdata.fql.decl.InstExp.Plus) FullEval(catdata.fql.decl.InstExp.FullEval) Eval(catdata.fql.decl.InstExp.Eval) Kernel(catdata.fql.decl.InstExp.Kernel) Relationalize(catdata.fql.decl.InstExp.Relationalize) FullQuery(catdata.fql.decl.FullQuery) Zero(catdata.fql.decl.InstExp.Zero) Const(catdata.fql.decl.InstExp.Const) Two(catdata.fql.decl.InstExp.Two) InstExp(catdata.fql.decl.InstExp) MapExp(catdata.fql.decl.MapExp) Delta(catdata.fql.decl.InstExp.Delta) Times(catdata.fql.decl.InstExp.Times) External(catdata.fql.decl.InstExp.External) FullSigma(catdata.fql.decl.InstExp.FullSigma) FullQueryExp(catdata.fql.decl.FullQueryExp) Exp(catdata.fql.decl.InstExp.Exp) MapExp(catdata.fql.decl.MapExp) QueryExp(catdata.fql.decl.QueryExp) SigExp(catdata.fql.decl.SigExp) InstExp(catdata.fql.decl.InstExp)

Example 13 with Unit

use of catdata.Unit in project fql by CategoricalData.

the class FqlppOptions method display.

@Override
public Pair<JComponent, Function<Unit, Unit>> display() {
    JPanel viewer1 = new JPanel(new GridLayout(Options.biggestSize, 1));
    JPanel viewer2 = new JPanel(new GridLayout(Options.biggestSize, 1));
    JSplitPane generalsplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    generalsplit.add(viewer1);
    generalsplit.add(viewer2);
    JComboBox<String> lineageBox = new JComboBox<>(new String[] { "Fresh IDs", "Lineage as ID", "Summary as ID" });
    lineageBox.setSelectedItem(useLineage);
    JLabel lineageLabel = new JLabel("Sigma ID creation strategy:");
    viewer1.add(lineageLabel);
    viewer2.add(lineageBox);
    JComboBox<String> pilineageBox = new JComboBox<>(new String[] { "Fresh IDs", "Lineage as ID", "Summary as ID" });
    pilineageBox.setSelectedItem(piLineage);
    JLabel pilineageLabel = new JLabel("Pi ID creation strategy:");
    viewer1.add(pilineageLabel);
    viewer2.add(pilineageBox);
    JCheckBox jcb = new JCheckBox("", VALIDATE);
    JLabel label5 = new JLabel("Validate categories/functors/etc:");
    viewer1.add(label5);
    viewer2.add(jcb);
    JTextField plen = new JTextField(Integer.toString(MAX_PATH_LENGTH));
    JLabel label6 = new JLabel("Max path length:");
    viewer1.add(label6);
    viewer2.add(wrap(plen));
    JTextField iter = new JTextField(Integer.toString(MAX_DENOTE_ITERATIONS));
    JLabel label7 = new JLabel("Max iterations for left-kan:");
    viewer1.add(label7);
    viewer2.add(wrap(iter));
    JPanel setArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox set_textual_box = new JCheckBox("Text", set_textual);
    setArea.add(set_textual_box);
    JCheckBox set_tabular_box = new JCheckBox("Table", set_tabular);
    setArea.add(set_tabular_box);
    JCheckBox set_graph_box = new JCheckBox("Graph", set_graph);
    setArea.add(set_graph_box);
    JLabel set_label = new JLabel("Set viewer panels:");
    viewer1.add(set_label);
    viewer2.add(setArea);
    JPanel fnArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox fn_textual_box = new JCheckBox("Text", fn_textual);
    fnArea.add(fn_textual_box);
    JCheckBox fn_tabular_box = new JCheckBox("Table", fn_tabular);
    fnArea.add(fn_tabular_box);
    JCheckBox fn_graph_box = new JCheckBox("Graph", fn_graph);
    fnArea.add(fn_graph_box);
    JLabel fn_label = new JLabel("Function viewer panels:");
    viewer1.add(fn_label);
    viewer2.add(fnArea);
    JPanel catArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox cat_textual_box = new JCheckBox("Text", cat_textual);
    catArea.add(cat_textual_box);
    JCheckBox cat_tabular_box = new JCheckBox("Table", cat_tabular);
    catArea.add(cat_tabular_box);
    JCheckBox cat_graph_box = new JCheckBox("Graph", cat_graph);
    catArea.add(cat_graph_box);
    JCheckBox cat_schema_box = new JCheckBox("Schema", cat_schema);
    catArea.add(cat_schema_box);
    JLabel cat_label = new JLabel("Category viewer panels:");
    viewer1.add(cat_label);
    viewer2.add(catArea);
    JPanel ftrArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox ftr_textual_box = new JCheckBox("Text", ftr_textual);
    ftrArea.add(ftr_textual_box);
    JCheckBox ftr_tabular_box = new JCheckBox("Table", ftr_tabular);
    ftrArea.add(ftr_tabular_box);
    JCheckBox ftr_graph_box = new JCheckBox("Graph", ftr_graph);
    ftrArea.add(ftr_graph_box);
    JCheckBox ftr_elements_box = new JCheckBox("Elements", ftr_elements);
    ftrArea.add(ftr_elements_box);
    JCheckBox ftr_instance_box = new JCheckBox("Instance", ftr_instance);
    ftrArea.add(ftr_instance_box);
    JCheckBox ftr_joined_box = new JCheckBox("Joined", ftr_joined);
    ftrArea.add(ftr_joined_box);
    JCheckBox ftr_mapping_box = new JCheckBox("Mapping", ftr_mapping);
    ftrArea.add(ftr_mapping_box);
    JLabel ftr_label = new JLabel("Functor viewer panels:");
    viewer1.add(ftr_label);
    viewer2.add(ftrArea);
    JPanel tArea = new JPanel(new FlowLayout(FlowLayout.LEFT));
    JCheckBox t_textual_box = new JCheckBox("Text", trans_textual);
    tArea.add(t_textual_box);
    JCheckBox t_tabular_box = new JCheckBox("Table", trans_tabular);
    tArea.add(t_tabular_box);
    JCheckBox t_graph_box = new JCheckBox("Graph", trans_graph);
    tArea.add(t_graph_box);
    JCheckBox t_elements_box = new JCheckBox("Elements", trans_elements);
    tArea.add(t_elements_box);
    JLabel t_label = new JLabel("Function viewer panels:");
    t_label.setToolTipText("Sets which viewers to use for transforms.");
    viewer1.add(t_label);
    viewer2.add(tArea);
    for (int i = 0; i < Options.biggestSize - size(); i++) {
        viewer1.add(new JLabel());
        viewer2.add(new JLabel());
    }
    Function<Unit, Unit> fn = (Unit t) -> new Unit();
    return new Pair<>(generalsplit, fn);
}
Also used : JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) Unit(catdata.Unit) JCheckBox(javax.swing.JCheckBox) GridLayout(java.awt.GridLayout) JSplitPane(javax.swing.JSplitPane) Pair(catdata.Pair)

Example 14 with Unit

use of catdata.Unit in project fql by CategoricalData.

the class Inst method fals.

public Transform<O, A, Set, Fn> fals() {
    Set e = new HashSet<>();
    e.add(new Unit());
    Functor<O, A, Set, Fn> prp = (Functor<O, A, Set, Fn>) ((Object) prop());
    return new Transform<>(terminal(), prp, x -> new Fn<>(e, prp.applyO(x), z -> initial()));
}
Also used : Fn(catdata.fqlpp.cat.FinSet.Fn) FUNCTION(catdata.fqlpp.FUNCTION) Chc(catdata.Chc) Util(catdata.Util) Set(java.util.Set) HashMap(java.util.HashMap) Unit(catdata.Unit) Collectors(java.util.stream.Collectors) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) LinkedList(java.util.LinkedList) Pair(catdata.Pair) Set(java.util.Set) HashSet(java.util.HashSet) Fn(catdata.fqlpp.cat.FinSet.Fn) Unit(catdata.Unit) HashSet(java.util.HashSet)

Example 15 with Unit

use of catdata.Unit in project fql by CategoricalData.

the class Inst method tru.

public Transform<O, A, Set, Fn> tru() {
    Set e = new HashSet<>();
    e.add(new Unit());
    Functor<O, A, Set, Fn> prp = (Functor<O, A, Set, Fn>) ((Object) prop());
    Pair<Map<O, Functor<O, A, Set<A>, Fn<A, A>>>, Map<A, Transform<O, A, Set<A>, Fn<A, A>>>> k = cat.repX();
    return new Transform<>(terminal(), prp, x -> new Fn<>(e, prp.applyO(x), z -> k.first.get(x)));
}
Also used : Fn(catdata.fqlpp.cat.FinSet.Fn) FUNCTION(catdata.fqlpp.FUNCTION) Chc(catdata.Chc) Util(catdata.Util) Set(java.util.Set) HashMap(java.util.HashMap) Unit(catdata.Unit) Collectors(java.util.stream.Collectors) HashSet(java.util.HashSet) LinkedHashMap(java.util.LinkedHashMap) List(java.util.List) Map(java.util.Map) Entry(java.util.Map.Entry) Optional(java.util.Optional) LinkedList(java.util.LinkedList) Pair(catdata.Pair) Set(java.util.Set) HashSet(java.util.HashSet) Fn(catdata.fqlpp.cat.FinSet.Fn) Unit(catdata.Unit) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet)

Aggregations

Unit (catdata.Unit)29 Pair (catdata.Pair)16 LinkedList (java.util.LinkedList)11 HashMap (java.util.HashMap)10 HashSet (java.util.HashSet)10 List (java.util.List)9 Map (java.util.Map)8 Set (java.util.Set)8 Chc (catdata.Chc)6 Util (catdata.Util)6 Fn (catdata.fqlpp.cat.FinSet.Fn)6 JPanel (javax.swing.JPanel)6 GridLayout (java.awt.GridLayout)5 LinkedHashMap (java.util.LinkedHashMap)5 Collectors (java.util.stream.Collectors)5 FUNCTION (catdata.fqlpp.FUNCTION)4 CodeTextPanel (catdata.ide.CodeTextPanel)4 Entry (java.util.Map.Entry)4 Triple (catdata.Triple)3 Optional (java.util.Optional)3