Package sizzle.types

Examples of sizzle.types.SizzleScalar


    // these generic functions require more finagling than can currently be
    // (easily) done with a static method, so they are handled with macros

    this.setFunction("def", new SizzleFunction(new SizzleBool(), new SizzleType[] { new SizzleAny() }, "${0} != null"));
    this.setFunction("len", new SizzleFunction(new SizzleInt(), new SizzleType[] { new SizzleArray(new SizzleScalar()) }, "${0}.length"));
    this.setFunction("len", new SizzleFunction(new SizzleInt(), new SizzleType[] { new SizzleString() }, "${0}.length()"));
    this.setFunction("len", new SizzleFunction(new SizzleInt(), new SizzleType[] { new SizzleBytes() }, "${0}.length"));
    this.setFunction("len", new SizzleFunction(new SizzleInt(), new SizzleType[] { new SizzleMap(new SizzleScalar(), new SizzleScalar()) },
        "${0}.keySet().size()"));
    this.setFunction("haskey", new SizzleFunction(new SizzleBool(), new SizzleType[] { new SizzleMap(new SizzleScalar(), new SizzleScalar()),
        new SizzleScalar() }, "${0}.containsKey(${1})"));
    this.setFunction("keys", new SizzleFunction(new SizzleArray(new SizzleScalar()), new SizzleType[] { new SizzleMap(new SizzleScalar(),
        new SizzleScalar()) }, "${0}.keySet().toArray()"));
    this.setFunction("lookup", new SizzleFunction(new SizzleScalar(), new SizzleType[] { new SizzleMap(new SizzleScalar(), new SizzleScalar()),
        new SizzleScalar(), new SizzleScalar() }, "(${0}.containsKey(${1}) ? ${0}.get(${1}) : ${2})"));

    this.setFunction("regex", new SizzleFunction(new SizzleString(), new SizzleType[] { new SizzleName(new SizzleScalar()), new SizzleInt() },
        "sizzle.functions.SizzleSpecialIntrinsics.regex(\"${0}\", ${1})"));
    this.setFunction("regex", new SizzleFunction(new SizzleString(), new SizzleType[] { new SizzleName(new SizzleScalar()) },
        "sizzle.functions.SizzleSpecialIntrinsics.regex(\"${0}\")"));
    // these fingerprints are identity functions
    this.setFunction("fingerprintof", new SizzleFunction(new SizzleFingerprint(), new SizzleScalar[] { new SizzleInt() }));
    this.setFunction("fingerprintof", new SizzleFunction(new SizzleFingerprint(), new SizzleScalar[] { new SizzleTime() }));
View Full Code Here


    final SizzleType type = n.f5.accept(this, argu);

    final AggregatorSpec annotation = argu.getAggregators(n.f1.f0.tokenImage, type).get(0).getAnnotation(AggregatorSpec.class);

    SizzleScalar tweight = null;
    if (n.f6.present()) {
      if (annotation.weightType().equals("none"))
        throw new TypeException("unexpected weight for table declaration");

      final SizzleType aweight = argu.getType(annotation.weightType());
View Full Code Here

  @Override
  public SizzleType visit(final Term n, final SymbolTable argu) {
    final SizzleType accepts = n.f0.accept(this, argu);

    if (n.f1.present()) {
      SizzleScalar type;

      if (accepts instanceof SizzleFunction)
        type = (SizzleScalar) ((SizzleFunction) accepts).getType();
      else
        type = (SizzleScalar) accepts;

      for (final Node node : n.f1.nodes) {
        final SizzleType accept = ((NodeSequence) node).nodes.get(1).accept(this, argu);

        type = type.arithmetics(accept);
      }

      return type;
    }
View Full Code Here

TOP

Related Classes of sizzle.types.SizzleScalar

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.