Package clojure.lang

Examples of clojure.lang.PersistentVector$Node


    }
    else if (m instanceof NoitStatus) {
      ns = (NoitStatus)m;
    }
    if(nmn != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                      "reconnoiter",
                      "check:" + nmn.getUuid(),
                      "name:" + nmn.getCheck_name(),
                      "module:" + nmn.getCheck_module(),
                      "noit:" + nmn.getNoit(),
                      "type:numeric" });
      e = new Event(nmn.getCheck_target(), // host
                    nmn.getName(), // service
                    null, // state
                    null, // description
                    nmn.getValue(), // value
                    tags, // tags
                    nmn.getTime()/1000, //time
                    10); //ttl
    }
    else if(nmt != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                      "reconnoiter",
                      "check:" + nmt.getUuid(),
                      "name:" + nmt.getCheck_name(),
                      "module:" + nmt.getCheck_module(),
                      "noit:" + nmt.getNoit(),
                      "type:text" });
      e = new Event(nmt.getCheck_target(), // host
                    nmt.getName(), // service
                    null, // state
                    nmt.getMessage(), // description
                    null, // value
                    tags, // tags
                    nmt.getTime()/1000, //time
                    10); //ttl
    }
    if (ns != null) {
      PersistentVector tags = PersistentVector.create(new java.lang.String[] {
                    "reconnoiter",
                    "check:" + ns.getUuid(),
                    "name:" + ns.getCheck_name(),
                    "module:" + ns.getCheck_module(),
                    "noit:" + ns.getNoit(),
View Full Code Here


        return null;
    }

    static PersistentVector fromRubyArray(ThreadContext context, RubyArray ruby_array) {
        Var var = DiametricService.getFn("clojure.core", "vector");
        PersistentVector clj_tx_data = (PersistentVector)var.invoke();
        Var adder = DiametricService.getFn("clojure.core", "conj");
        for (int i=0; i<ruby_array.getLength(); i++) {
            Object element = ruby_array.get(i);
            if (element instanceof RubyHash) {
                APersistentMap map = fromRubyHash(context, (RubyHash)element);
                clj_tx_data = (PersistentVector)adder.invoke(clj_tx_data, map);
            } else if (element instanceof RubyArray) {
                PersistentVector vector = fromRubyArray(context, (RubyArray)element);
                clj_tx_data = (PersistentVector)adder.invoke(clj_tx_data, vector);
            } else if (element instanceof IRubyObject) {
                clj_tx_data =
                        (PersistentVector)adder.invoke(clj_tx_data, DiametricUtils.convertRubyToJava(context, (IRubyObject)element));
            } else if (element instanceof String) {
View Full Code Here

                break;
            case 3:
                if ((args[2] instanceof RubyArray) && (((RubyArray)args[2]).getLength() == 0)) {
                    results = query_without_arg(query, database);
                } else if (args[2] instanceof RubyArray) {
                    PersistentVector clj_arg = DiametricUtils.fromRubyArray(context, (RubyArray)args[2]);
                    results = query_with_arg(query, database, clj_arg);
                } else {
                    Object arg = DiametricUtils.convertRubyToJava(context, args[2]);
                    results = query_with_arg(query, database, arg);
                }
View Full Code Here

            } else {
                Var var = DiametricService.getFn("clojure.core", "load-string");
                drop_or_take_fn = (Var)var.invoke("(defn drop-or-take [n target] (apply vector (drop n target)))");
                DiametricService.fnMap.put("drop-or-take", drop_or_take_fn);
            }
            PersistentVector value = (PersistentVector)drop_or_take_fn.invoke(n, target);
            RubyClass clazz = (RubyClass) context.getRuntime().getClassFromPath("Diametric::Persistence::Collection");
            DiametricCollection ruby_collection = (DiametricCollection)clazz.allocate();
            ruby_collection.init(value);
            return ruby_collection;
        } catch (Throwable t) {
View Full Code Here

            } else {
                Var var = DiametricService.getFn("clojure.core", "load-string");
                first_n_fn = (Var)var.invoke("(defn first-n [n target] (apply vector (take n target)))");
                DiametricService.fnMap.put("first-n", first_n_fn);
            }
            PersistentVector value = (PersistentVector)first_n_fn.invoke(n, target);
            RubyClass clazz = (RubyClass) context.getRuntime().getClassFromPath("Diametric::Persistence::Collection");
            DiametricCollection ruby_collection = (DiametricCollection)clazz.allocate();
            ruby_collection.init(value);
            return ruby_collection;
        } catch (Throwable t) {
View Full Code Here

    // create list for SortContainers...
    final LinkedList<SortContainer> scl = new LinkedList<SortContainer>();

    // walk through children...
    for (int i = 0; i < node.jjtGetNumChildren(); ++i) {
      Node n = node.jjtGetChild(i); // get current child

      boolean desc = false; // set order ASC as default

      // current node is Order node...
      if (n instanceof ASTAscOrder || n instanceof ASTDescOrder) {
        if (n instanceof ASTDescOrder) // reset order value to DESC...
          desc = true;

        i++; // increase counter to get next child (which is sort
        // condition)
      }

      n = node.jjtGetChild(i); // get next child (which is sort condition)

      // parse node with the filter...
      final SPARQLParserVisitorImplementationDumper filterDumper = new SPARQLParserVisitorImplementationDumper();
      final String sortString = n.accept(filterDumper);

      try {
        final SortContainer sc = new SortContainer(this.prefix, desc,
            sortString); // create SortContainer
View Full Code Here

  @SuppressWarnings("unchecked")
  public Object visit(final ASTTripleSet node, final Object data) {
    final Item[] item = { null, null, null };

    for (int i = 0; i < 3; i++) {
      final Node n = node.jjtGetChild(i);
      item[i] = lupos.sparql1_1.operatorgraph.SPARQLCoreParserVisitorImplementation.getItem(n);
    }

    final HashMap<Item, QueryRDFTerm> rdfHash = (HashMap<Item, QueryRDFTerm>) data;
View Full Code Here

    // if AST exists...
    if (debugViewerCreator!=null && debugViewerCreator instanceof SPARQLDebugViewerCreator
        && ((SPARQLDebugViewerCreator) debugViewerCreator).getAST() != null) {

      final Node ast = ((SPARQLDebugViewerCreator) debugViewerCreator).getAST(); // get AST

      // walk through first level children of AST...
      for (int i = 0; i < ast.jjtGetNumChildren(); ++i) {
        final Node child = ast.jjtGetChild(i); // get current child

        if (child instanceof ASTSelectQuery) {
          final ASTSelectQuery selectChild = (ASTSelectQuery) child;

          // SELECT is not the wildcard *...
          if (!selectChild.isSelectAll()) {
            // walk through select children...
            for (int j = 0; j < selectChild.jjtGetNumChildren(); ++j) {
              final Node selectChildChild = selectChild
              .jjtGetChild(j);

              // child of select is variable...
              if (selectChildChild instanceof ASTVar) {
                final ASTVar var = (ASTVar) selectChildChild;

                // add name of variable to order...
                if (!resultOrder.contains(var.getName())) {
                  resultOrder.add(var.getName());
                }
              } else if (selectChildChild instanceof ASTAs) {
                for (int j1 = 0; j1 < selectChildChild
                .jjtGetNumChildren(); ++j1) {
                  final Node selectChildChildChild = selectChildChild
                  .jjtGetChild(j1);
                  if (selectChildChildChild instanceof ASTVar) {
                    final ASTVar var = (ASTVar) selectChildChildChild;

                    // add name of variable to order...
View Full Code Here

        ret += "\n";
        final String orderByClause = " ORDER BY "
          + toBeSorted.toString() + "\n";
        boolean ORDERBYADDED = false;
        while (i < node.jjtGetNumChildren()) {
          final Node child = node.jjtGetChild(i);
          if (!ORDERBYADDED
              && (child instanceof ASTOrderConditions
                  || child instanceof ASTLimit || child instanceof ASTOffset)) {
            ORDERBYADDED = true;
            ret += orderByClause;
View Full Code Here

  private static void determineVariables(final Node root,
      final Set<String> variables) {
    if (root instanceof ASTSelectQuery) {
      for (int i = 0; i < root.jjtGetNumChildren(); i++) {
        final Node node = root.jjtGetChild(i);
        if (node instanceof ASTGroupConstraint)
          determineVariables(node, variables);
      }
    } else {
      if (root instanceof ASTVar) {
View Full Code Here

TOP

Related Classes of clojure.lang.PersistentVector$Node

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.