Package sizzle.types

Examples of sizzle.types.SizzleInt


    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    Assert.assertEquals("max_pagerank_url is not table of strings indexed by string weighted by int",
        new SizzleTable(new SizzleString(), Arrays.asList(new SizzleScalar[] { new SizzleString() }), new SizzleFloat()), st.get("max_pagerank_url"));
    final List<SizzleType> members = new ArrayList<SizzleType>(Arrays.asList(new SizzleString(), new SizzleInt()));
    Assert.assertEquals("doc is not a Document", new SizzleTuple(members), st.get("doc"));
  }
View Full Code Here


    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    Assert.assertEquals("queries_per_degree is not an unweighted table of ints indexed by ints",
        new SizzleTable(new SizzleInt(), Arrays.asList(new SizzleScalar[] { new SizzleInt(), new SizzleInt() }), null), st.get("queries_per_degree"));

    final List<SizzleType> lmembers = new ArrayList<SizzleType>(Arrays.asList(new SizzleFloat(), new SizzleFloat()));

    Assert.assertEquals("loc is not a Location", new SizzleTuple(lmembers), st.get("loc"));

    final List<SizzleType> qlpmembers = new ArrayList<SizzleType>(Arrays.asList(new SizzleString(), new SizzleInt()));

    Assert.assertEquals("log_record is not a QueryLogProto", new SizzleTuple(qlpmembers), st.get("log_record"));
  }
View Full Code Here

    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    Assert.assertEquals("queries_per_degree is not an unweighted table of ints indexed by various",
        new SizzleTable(new SizzleInt(), Arrays.asList(new SizzleTime(), new SizzleInt(), new SizzleInt()), null), st.get("queries_per_degree"));

    // assertEquals("t is not an time", new SizzleTime(), st.get("t"));
    // assertEquals("m is not an int", new SizzleInt(), st.get("m"));
    Assert.assertEquals("RESOLUTION is not an int", new SizzleInt(), st.get("RESOLUTION"));

    final List<SizzleType> lmembers = new ArrayList<SizzleType>(Arrays.asList(new SizzleFloat(), new SizzleFloat()));

    Assert.assertEquals("loc is not a Location", new SizzleTuple(lmembers), st.get("loc"));

    final List<SizzleType> qlpmembers = new ArrayList<SizzleType>(Arrays.asList(new SizzleString(), new SizzleInt()));

    Assert.assertEquals("log_record is not a QueryLogProto", new SizzleTuple(qlpmembers), st.get("log_record"));
  }
View Full Code Here

    final String source = "out: table sum[key: string][month: int][day: int] of int;\nstatic keywords: array of string = { \"hitchhiker\", \"benedict\", \"vytorin\", \"itanium\", \"aardvark\" };\nquerywords: array of string = words_from_query();\nmonth: int = month_of_query();\nday: int = day_of_query();\nwhen (i: each int; j: some int; querywords[i] == keywords[j])\n    emit out[keywords[j]][month][day] <- 1;\n";

    final SymbolTable st = new SymbolTable();

    // fake functions for this unit test
    st.setFunction("day_of_query", new SizzleFunction(new SizzleInt(), new SizzleType[] {}, "Nonexistant.day_of_query()"));
    st.setFunction("month_of_query", new SizzleFunction(new SizzleInt(), new SizzleType[] {}, "Nonexistant.month_of_query()"));
    st.setFunction("words_from_query", new SizzleFunction(new SizzleArray(new SizzleString()), new SizzleType[] {}, "Nonexistant.words_from_query()"));

    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    Assert.assertEquals("out is not an unweighted table of ints indexed by various",
        new SizzleTable(new SizzleInt(), Arrays.asList(new SizzleString(), new SizzleInt(), new SizzleInt()), null), st.get("out"));

    Assert.assertEquals("keywords is not an array of strings", new SizzleArray(new SizzleString()), st.get("keywords"));
    Assert.assertEquals("querywords is not an array of strings", new SizzleArray(new SizzleString()), st.get("querywords"));

    Assert.assertEquals("month is not an int", new SizzleInt(), st.get("month"));
    Assert.assertEquals("day is not an int", new SizzleInt(), st.get("day"));
  }
View Full Code Here

    final String source = "out: table sum[key: string][month: int][day: int] of int;\nstatic keywords: array of string = { \"hitchhiker\", \"benedict\", \"vytorin\", \"itanium\", \"aardvark\" };\nquerywords: array of string = words_from_query();\nmonth: int = month_of_query();\nday: int = day_of_query();\nwhen (i: each int; j: some int; querywords[i] == keywords[j])\n    emit out <- 1;\n";

    final SymbolTable st = new SymbolTable();

    // fake functions for this unit test
    st.setFunction("day_of_query", new SizzleFunction(new SizzleInt(), new SizzleType[] {}, "Nonexistant.day_of_query()"));
    st.setFunction("month_of_query", new SizzleFunction(new SizzleInt(), new SizzleType[] {}, "Nonexistant.month_of_query()"));
    st.setFunction("words_from_query", new SizzleFunction(new SizzleArray(new SizzleString()), new SizzleType[] {}, "Nonexistant.words_from_query()"));

    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);
  }
View Full Code Here

    final SymbolTable st = new SymbolTable();

    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    final List<SizzleType> members = new ArrayList<SizzleType>(Arrays.asList(new SizzleInt(), new SizzleFloat()));

    Assert.assertEquals("out is not a unindexed, unweighted table of tuple of int and float", new SizzleTable(new SizzleTuple(members)), st.get("out"));

    Assert.assertEquals("line is not a string", new SizzleString(), st.get("line"));
    Assert.assertEquals("tuple is not an array of strings", new SizzleArray(new SizzleString()), st.get("tuple"));
View Full Code Here

    final SymbolTable st = new SymbolTable();

    SizzleParser.ReInit(new StringReader(source));
    TestTypeCheckingVisitor.typeChecker.visit(SizzleParser.Start(), st);

    final List<SizzleType> members = new ArrayList<SizzleType>(Arrays.asList(new SizzleInt(), new SizzleFloat()));

    Assert.assertEquals("out is not an unindexed, unweighted table of int and float", new SizzleTable(new SizzleTuple(members)), st.get("out"));

    Assert.assertEquals("line is not a string", new SizzleString(), st.get("line"));
    Assert.assertEquals("tuple is not an array of strings", new SizzleArray(new SizzleString()), st.get("tuple"));
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public SizzleType visit(final IntegerLiteral n, final SymbolTable argu) {
    return new SizzleInt();
  }
View Full Code Here

  }

  /** {@inheritDoc} */
  @Override
  public SizzleType visit(final CharLiteral n, final SymbolTable argu) {
    return new SizzleInt();
  }
View Full Code Here

TOP

Related Classes of sizzle.types.SizzleInt

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.