Examples of TypeExpression


Examples of org.apache.uima.ruta.expression.type.TypeExpression

    RutaVerbalizer v = new RutaVerbalizer();
    List<TypeExpression> typeExprList = new ArrayList<TypeExpression>();
    List<StringExpression> stringExprList = new ArrayList<StringExpression>();
    String var = "anyVar";
    StringExpression varExpr = new ReferenceNumberExpression(var);
    TypeExpression typeExpr1 = new SimpleTypeExpression("Type1");
    TypeExpression typeExpr2 = new ReferenceTypeExpression("typeVar");
    typeExprList.add(typeExpr1);
    typeExprList.add(typeExpr2);
    NumberExpression numExpr1 = new SimpleNumberExpression(4);
    NumberExpression numExpr2 = new ReferenceNumberExpression("numVar");
    BooleanExpression boolExpr1 = new SimpleBooleanExpression(true);
View Full Code Here

Examples of org.apache.uima.ruta.expression.type.TypeExpression

        List<String> l = new ArrayList<String>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          count++;
        }
      } else if (arg instanceof TypeExpression && list instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) list;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          count++;
        }
      }
View Full Code Here

Examples of org.apache.uima.ruta.expression.type.TypeExpression

        List<String> l = new ArrayList<String>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          basicCount++;
        }
      } else if (arg instanceof TypeExpression && argList instanceof TypeListExpression) {
        TypeExpression e = (TypeExpression) arg;
        TypeListExpression le = (TypeListExpression) argList;
        Type v = e.getType(element.getParent());
        List<Type> l = new ArrayList<Type>(le.getList(element.getParent(), stream));
        while (l.remove(v)) {
          basicCount++;
        }
      }
View Full Code Here

Examples of org.apache.uima.ruta.expression.type.TypeExpression

    if (expr instanceof BooleanExpression) {
      BooleanExpression be = (BooleanExpression) expr;
      return new EvaluatedCondition(this, be.getBooleanValue(element.getParent(), null, stream));
    } else if (expr instanceof FeatureMatchExpression) {
      FeatureMatchExpression fme = (FeatureMatchExpression) expr;
      TypeExpression typeExpr = fme.getTypeExpr();
      Type type = typeExpr.getType(element.getParent());
      List<AnnotationFS> annotations = getAnnotationsToCheck(annotation, type, fme, stream);
      Collection<AnnotationFS> featureAnnotations = fme.getFeatureAnnotations(annotations, stream,
              element.getParent(), true);
      return new EvaluatedCondition(this, !featureAnnotations.isEmpty());
    }
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

            for (MethodType type : method.getAnnotations()) {
                List<TypeVariable> types = type.getTypes();
                List<TypeConstraint> constraints = type.getConstraints();
                MethodType.Signature sig = type.getSignature();
                if (sig != null) {
                    TypeExpression argType = sig.getArgType();
                    MethodType.Block block = sig.getBlock();
                    TypeExpression returnType = sig.getReturnType();

                    env.clear();
                    if (types != null) {
                        for (TypeVariable var : types) {
                            env.put(var, graph.createFreeVertex());
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

                    List<TypeVariable> vars = klassType.getTypes();
                    for (int i = 0; i < vars.size(); i++) {
                        TypeVariable var = vars.get(i);
                        Vertex vertex = typeVarMap.get(var);
                        if (i < types.size() && vertex != null) {
                            TypeExpression expr = types.get(i);
                            for (IRubyObject a : vertex.getTypeSet()) {
                                if (!resolveMethodArg(template, klassType, expr, receiver, a)) {
                                    return false;
                                }
                            }
                        }
                    }
                }
            }
            return true;
        }
        case SCOPED_IDENTITY:
        case ABSOLUTE_IDENTITY:
        case RELATIVE_IDENTITY: {
            IRubyObject guard = resolveIdentity(template, (TypeIdentity) argType);
            return (guard instanceof RubyClass) && arg.isKindOf((RubyClass) guard);
        }
        case UNION:
            for (TypeExpression expr : (TypeUnion) argType) {
                if (resolveMethodArg(template, classType, expr, receiver, arg)) {
                    return true;
                }
            }
            return false;
        case TUPLE: {
            TypeTuple tuple = (TypeTuple) argType;
            for (TypeExpression expr : tuple.getList()) {
                if (resolveMethodArg(template, classType, expr, receiver, arg)) {
                    return true;
                }
            }
            return false;
        }
        case SPLAT: {
            TypeSplat splat = (TypeSplat) argType;
            TypeExpression expr = splat.getExpression();
            if (expr == null) {
                return true;
            } else if (expr.getType() == TypeExpression.Type.VARIABLE) {
                return resolveMethodArg(template, classType, expr, receiver, arg);
            } else if (arg instanceof Array) {
                Array array = (Array) arg;
                for (Vertex v : array.getElements()) {
                    for (IRubyObject a : v.getTypeSet()) {
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

    public boolean resolveMethodConstraints(Template template, ClassType classType, List<TypeConstraint> constraints, IRubyObject receiver) {
        if (constraints == null) { return true; }

        for (TypeConstraint cons : constraints) {
            if (cons.getType() == TypeExpression.Type.SUBTYPE_CONS) {
                TypeExpression lhs = cons.lhs();
                TypeExpression rhs = cons.rhs();
                TypeSet ts = processMethodReturn(template, classType, lhs, receiver);
                if (ts == null) {
                    return false;
                } else if (ts.isEmpty() && lhs.getType() == TypeExpression.Type.VARIABLE) {
                    // null can be any type
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

        } else if ((block != null) ^ (blockType != null)) {
            return false;
        }

        MethodType.Signature blockSig = blockType.getSignature();
        TypeExpression blockArgType = blockSig.getArgType();
        TypeExpression returnArgType = blockSig.getReturnType();
        TypeSet[] args = processMethodBlockArg(template, classType, blockArgType, receiver);


        // FIXME checkArity
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

                if (klassType != null && typeVarMap != null) {
                    List<TypeVariable> vars = klassType.getTypes();
                    for (int i = 0; i < vars.size(); i++) {
                        TypeVariable var = vars.get(i);
                        if (i < types.size()) {
                            TypeExpression expr = types.get(i);
                            TypeSet ts = processMethodReturn(template, classType, expr, receiver);
                            Vertex vertex = graph.createFreeVertex();
                            vertex.addTypes(ts);
                            typeVarMap.put(var, vertex);
                        }
View Full Code Here

Examples of org.cx4a.rsense.typing.annotation.TypeExpression

    public boolean checkArity(List<TypeExpression> list, IRubyObject[] args) {
        int preCount = 0;
        int postCount = 0;

        for (int i = 0; i < list.size(); i++) {
            TypeExpression argType = list.get(i);
            switch (argType.getType()) {
            case SPLAT:
                return true;
            case OPTIONAL:
                postCount++;
                break;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.