Package edu.brown.mappings

Examples of edu.brown.mappings.ParameterMapping


        double coefficient = 0.0;
        for (Statement catalog_stmt : this.catalog_proc.getStatements()) {
            for (StmtParameter catalog_stmt_param : catalog_stmt.getParameters()) {
                int num_mappings = rand.nextInt(3) + 1;
                for (int i = 0; i < num_mappings; i++) {
                    ParameterMapping c = new ParameterMapping(
                            catalog_stmt,
                            0,
                            catalog_stmt_param,
                            this.catalog_proc_param,
                            0,
View Full Code Here


   
    /**
     * testGetStmtParameter
     */
    public void testGetStmtParameter() throws Exception {
        ParameterMapping c = CollectionUtil.get(this.pc, 2);
        assertNotNull(c);
        ParameterMapping other = CollectionUtil.first(this.pc.get(c.getStatement(), c.getStatementIndex(), c.getStmtParameter()));
        assert(other != null);
        assert(c.equals(other));
    }
View Full Code Here

        this.catalog_other_proc = this.getProcedure("UpdateLocation");
        this.catalog_other_stmt = CollectionUtil.first(catalog_other_proc.getStatements());
        assertNotNull(this.catalog_other_stmt);
       
        for (Statement stmt : this.catalog_proc.getStatements()) {
            this.correlation = new ParameterMapping(
                    stmt,                           // Statement
                    0,                              // Statement Instance Index
                    stmt.getParameters().get(0),    // StmtParameter
                    this.catalog_proc_param,        // ProcParameter
                    0,                              // ProcParameter Array Index
View Full Code Here

   
    /**
     * testCompareTo
     */
    public void testCompareTo() {
        ParameterMapping clone = null;
       
        double coefficients[] = {
                this.correlation.getCoefficient(),
                1.0d,
                0.0d,
        };
        int expected_results[] = { 0, 1, -1 };
       
        for (int i = 0; i < coefficients.length; i++) {
            clone = new ParameterMapping(
                    this.correlation.getStatement(),
                    this.correlation.getStatementIndex(),
                    this.correlation.getStmtParameter(),
                    this.correlation.getProcParameter(),
                    this.correlation.getProcParameterIndex(),
                    coefficients[i]);
            assertEquals("i=" + i, expected_results[i], this.correlation.compareTo(clone));
        } // FOR
       
        clone = new ParameterMapping(
                catalog_other_stmt,
                0,
                catalog_other_stmt.getParameters().get(0),
                catalog_other_proc.getParameters().get(0),
                0,
View Full Code Here

   
    /**
     * testEquals
     */
    public void testEquals() {
        ParameterMapping clone = null;

        clone = new ParameterMapping(
                this.correlation.getStatement(),
                this.correlation.getStatementIndex(),
                this.correlation.getStmtParameter(),
                this.correlation.getProcParameter(),
                this.correlation.getProcParameterIndex(),
                0.99999d);
        assert(this.correlation.equals(clone));
       
        clone = new ParameterMapping(
                catalog_other_stmt,
                0,
                catalog_other_stmt.getParameters().get(0),
                catalog_other_proc.getParameters().get(0),
                0,
View Full Code Here

   
    /**
     * testHashCode
     */
    public void testHashCode() {
        ParameterMapping clone = null;

        clone = new ParameterMapping(
                this.correlation.getStatement(),
                this.correlation.getStatementIndex(),
                this.correlation.getStmtParameter(),
                this.correlation.getProcParameter(),
                this.correlation.getProcParameterIndex(),
                0.99999d);
        assertEquals(this.correlation.hashCode(), clone.hashCode());
       
        clone = new ParameterMapping(
                catalog_other_stmt,
                0,
                catalog_other_stmt.getParameters().get(0),
                catalog_other_proc.getParameters().get(0),
                0,
                0.99999d);
        assertNotSame(this.correlation.hashCode(), clone.hashCode());
    }
View Full Code Here

        JSONObject json_obj = new JSONObject(json);
        assertNotNull(json_obj);
       
        // System.err.println(json_obj.toString(2));
       
        ParameterMapping clone = new ParameterMapping();
        clone.fromJSON(json_obj, catalog_db);
        this.examineCorrelation(clone);

        assertEquals(this.correlation.getStatement(), clone.getStatement());
        assertEquals(this.correlation.getStatementIndex(), clone.getStatementIndex());
        assertEquals(this.correlation.getStmtParameter(), clone.getStmtParameter());
        assertEquals(this.correlation.getProcParameter(), clone.getProcParameter());
        assertEquals(this.correlation.getProcParameterIndex(), clone.getProcParameterIndex());
        assertEquals(this.correlation.getCoefficient(), clone.getCoefficient());
    }
View Full Code Here

        int expected_index[] = { 0, 14 }; // ???
       
        for (int i = 0, cnt = catalog_stmt.getParameters().size(); i < cnt; i++) {
            StmtParameter catalog_param = catalog_stmt.getParameters().get(i);
            assertNotNull(catalog_param);
            ParameterMapping c = CollectionUtil.first(param_correlations.get(catalog_param));
            assertNotNull(c);
           
            assert(c.getCoefficient() >= threshold);
            assertEquals("[" + i + "]", expected_param[i], c.getProcParameter());
            assertEquals("[" + i + "]", expected_index[i], c.getProcParameterIndex());
        } // FOR
    }
View Full Code Here

        ParameterSet params = new ParameterSet(txn_trace.getParams());
        for (ProcParameter catalog_param : catalog_proc.getParameters()) {
            if (catalog_param.getIsarray()) {
                Object inner[] = (Object[])params.toArray()[catalog_param.getIndex()];
                for (int i = 0; i < inner.length; i++) {
                    ParameterMapping pm = new ParameterMapping(catalog_stmt, 0, catalog_stmt_param, catalog_param, i, 1.0d);
                    assertTrue(this.checker.equalParameters(params, pm, params, pm));
                } // FOR
            } else {
                ParameterMapping pm = new ParameterMapping(catalog_stmt, 0, catalog_stmt_param, catalog_param, ParametersUtil.NULL_PROC_PARAMETER_OFFSET, 1.0d);
                assertTrue(this.checker.equalParameters(params, pm, params, pm));
            }
        } // FOR
    }
View Full Code Here

                                                                counted_stmt.counter,
                                                                catalog_param);
                assert(pmSets != null) :
                    String.format("Unexpected null %s %s set for %s",
                                  counted_stmt, ParameterMapping.class.getSimpleName(), catalog_param);
                ParameterMapping pm = CollectionUtil.first(pmSets);
                assert(pm != null) :
                    String.format("Unexpected null %s for %s [%s]",
                                  ParameterMapping.class.getSimpleName(),
                                  catalog_param.fullName(), counted_stmt);
                assert(pm.statement_index == counted_stmt.counter) :
View Full Code Here

TOP

Related Classes of edu.brown.mappings.ParameterMapping

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.