Package edu.brown.designer

Examples of edu.brown.designer.DesignerVertex


            if (zero_list.isEmpty())
            {
                throw new CycleInDagException();
            }

            DesignerVertex cur = zero_list.remove(0);
            ret[cnt++] = (Table) (cur.getCatalogItem());

            // System.out.println("Next ver: " + cur);

            Collection<DesignerVertex> successors = dgraph.getSuccessors(cur);
            dgraph.removeVertex(cur);
View Full Code Here


     * @param edge_type
     * @param clone
     */
    private void checkGraph(EdgeType edge_type, IGraph<DesignerVertex, DesignerEdge> clone) {
        for (DesignerVertex v : graph.getVertices()) {
            DesignerVertex clone_v = graph.getVertex(v.getCatalogItem());
            assertNotNull(clone_v);
        } // FOR
        for (DesignerEdge e : graph.getEdges()) {
            Collection<DesignerVertex> vertices = graph.getIncidentVertices(e);
            DesignerVertex v0 = CollectionUtil.get(vertices, 0);
            assertNotNull(v0);
            DesignerVertex v1 = CollectionUtil.get(vertices, 1);
            assertNotNull(v1);
           
            DesignerVertex clone_v0 = clone.getVertex(v0.getCatalogKey());
            assertNotNull(clone_v0);
            DesignerVertex clone_v1 = clone.getVertex(v1.getCatalogKey());
            assertNotNull(clone_v1);
            Collection<DesignerEdge> clone_e = clone.findEdgeSet(clone_v0, clone_v1);
            assertFalse(clone_e.isEmpty());
            assertEquals(1, clone_e.size());
            assertEquals(edge_type, clone.getEdgeType(CollectionUtil.first(clone_e)));
View Full Code Here

     * testRemoveDuplicateEdges
     */
    public void testRemoveDuplicateEdges() throws Exception {
        final int num_edges = 5;
        DependencyGraph dgraph = new DependencyGraph(catalogContext.database);
        DesignerVertex vertices[] = new DesignerVertex[TABLE_NAMES.length];
        for (int i = 0; i < vertices.length; i++) {
            Table catalog_tbl = this.getTable(TABLE_NAMES[i]);
            vertices[i] = new DesignerVertex(catalog_tbl);
            dgraph.addVertex(vertices[i]);
           
            if (i > 0) {
                for (int j = 0; j < num_edges; j++) {
                    dgraph.addEdge(new DesignerEdge(dgraph), vertices[i-1], vertices[i]);
View Full Code Here

            this.getTable(TM1Constants.TABLENAME_SUBSCRIBER),
            this.getTable(TM1Constants.TABLENAME_ACCESS_INFO),
            this.getTable(TM1Constants.TABLENAME_SPECIAL_FACILITY),
            this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING),
        };
        DesignerVertex v0 = agraph.getVertex(expected[0]);
        assertNotNull("Missing vertex: " + expected[0], v0);
        DesignerVertex v1 = agraph.getVertex(expected[1]);
        assertNotNull("Missing vertex: " + expected[1], v1);
        assert (agraph.addEdge(new DesignerEdge(agraph), v0, v1));
        for (DesignerEdge e : agraph.findEdgeSet(v0, v1)) {
            e.addToWeight(0, 10000000);
        } // FOR
View Full Code Here

     */
    public void testGenerateTableOrderMissingVertex() throws Exception {
        // Remove one of the vertices from the graph and make sure that it's not included
        // in our search table order
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SPECIAL_FACILITY);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        boolean ret = agraph.removeVertex(v);
        assert(ret);
        int expected = catalog_db.getTables().size()-catalogContext.getSysTables().size()-1;
        assertEquals(expected, agraph.getVertexCount());
View Full Code Here

        hints.enable_vertical_partitioning = true;
        cp = new ConstraintPropagator(info, hints, agraph);
       
        // Check that a vertical partition candidate column for SUBSCRIBER
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        Collection<VerticalPartitionColumn> vp_columns = new HashSet<VerticalPartitionColumn>();
        for (Collection<Column> catalog_cols : cp.getEdgeColumns(v).values()) {
            for (Column catalog_col : catalog_cols) {
                if (catalog_col instanceof VerticalPartitionColumn) {
View Full Code Here

        hints.enable_multi_partitioning = true;
        cp = new ConstraintPropagator(info, hints, agraph);
       
        // Check that we have multi-attribute candidates for ACCESS_INFO
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_ACCESS_INFO);
        DesignerVertex v = agraph.getVertex(catalog_tbl);
        assertNotNull(v);
        Collection<MultiColumn> multi_columns = new HashSet<MultiColumn>();
        for (Collection<Column> catalog_cols : cp.getEdgeColumns(v).values()) {
            for (Column catalog_col : catalog_cols) {
                if (catalog_col instanceof MultiColumn) {
View Full Code Here

        // Make sure that the columns that remain for the edges to our target tables
        // are only connected through the column that the target tables were partitioned on
        Collection<Column> columns;
        for (Table catalog_tbl : catalog_db.getTables()) {
            if (targets.contains(catalog_tbl) || catalog_tbl.getSystable()) continue;
            DesignerVertex v0 = agraph.getVertex(catalog_tbl);
           
            try {
                columns = cp.getCandidateValues(catalog_tbl, Column.class);
            } catch (IllegalArgumentException ex) {
                continue;
            }
            assertNotNull(columns);
            assertFalse(columns.isEmpty());
           
            System.err.println(String.format("Examining %d columns for %s", columns.size(), catalog_tbl));
           
            // For each column that is still available for this table, check to make sure that:
            //  (1) It does not have an unmarked edge to one of our target tables
            //  (2) If it is does have an edge to one of target tables then that edge uses the column that the table is partitioned on
            for (Column catalog_col : columns) {
                if (catalog_col instanceof ReplicatedColumn) continue;
                Collection<DesignerEdge> edges = agraph.findEdgeSet(v0, catalog_col);
                assertNotNull(catalog_col.fullName(), edges);
                assertFalse(catalog_col.fullName(), edges.isEmpty());
               
                for (DesignerEdge e : edges) {
                    if (cp.isMarked(e)) continue;
                   
                    DesignerVertex v1 = agraph.getOpposite(v0, e);
                    assertNotNull(e.toString(), v1);
                    Table other_tbl = v1.getCatalogItem();
                    assertNotNull(other_tbl);

                    // Skip if not one of our target tables
                    if (targets.contains(other_tbl) == false || other_tbl.getPartitioncolumn() == null) continue;
                   
View Full Code Here

     * testGenerateAccessGraph
     */
    public void testGenerateAccessGraph() throws Exception {
        // Make sure all of our tables are there
        for (Table catalog_tbl : catalog_db.getTables()) {
            DesignerVertex v = agraph.getVertex(catalog_tbl);
            assertNotNull("Missing " + catalog_tbl, v);
        } // FOR
       
        // Make sure our edges have weights
        // Only the self-referencing edges for CALL_FORWARDING and SUBSCRIBER will be zero
        HashSet<Table> skip = new HashSet<Table>();
        skip.add(this.getTable(TM1Constants.TABLENAME_SUBSCRIBER));
        skip.add(this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING));
        for (DesignerEdge e : agraph.getEdges()) {
            DesignerVertex v0 = CollectionUtil.get(agraph.getIncidentVertices(e), 0);
            DesignerVertex v1 = CollectionUtil.get(agraph.getIncidentVertices(e), 1);
            if (!(v0.getCatalogItem().equals(v1.getCatalogItem()) && skip.contains(v0.getCatalogItem()))) {
                assert(e.getTotalWeight() > 0) : "No edge weight for " + e;
            }
        } // FOR
    }
View Full Code Here

        super.setUp(ProjectType.TM1);
       
        this.graph = new AbstractDirectedGraph<DesignerVertex, DesignerEdge>(catalogContext.database) {
            private static final long serialVersionUID = 1L;
        };
        this.root = new DesignerVertex(this.getTable(TM1Constants.TABLENAME_SUBSCRIBER));
        this.graph.addVertex(this.root);
       
        for (int i = 1; i < TABLE_NAMES.length; i++) {
            String table_name = TABLE_NAMES[i];
            DesignerVertex child = new DesignerVertex(this.getTable(table_name));
            this.graph.addEdge(new DesignerEdge(this.graph), this.root, child);
        } // FOR
    }
View Full Code Here

TOP

Related Classes of edu.brown.designer.DesignerVertex

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.