Initiate the get requests and return the tree map of results.
@return A non-null tree map of results (may be empty)
501538
public Deferred<TreeMap<byte[], Span>> fetch() {
    if(tags.isEmpty()) {
      return Deferred.fromResult(null);
    }
    startFetch();
    return results;
  }
169456
public static Deferred<List<Tree>> fetchAllTrees(final TSDB tsdb) {
    
    final Deferred<List<Tree>> result = new Deferred<List<Tree>>();
    
    /**
     * Scanner callback that recursively calls itself to load the next set of
     * rows from storage. When the scanner returns a null, the callback will
     * return with the list of trees discovered.
     */
    final class AllTreeScanner implements Callback<Object, 
      ArrayList<ArrayList<KeyValue>>> {
  
      private final List<Tree> trees = new ArrayList<Tree>();
      private final Scanner scanner;
      
      public AllTreeScanner() {
        scanner = setupAllTreeScanner(tsdb);
      }
      
      /**
       * Fetches the next set of results from the scanner and adds this class
       * as a callback.
       * @return A list of trees if the scanner has reached the end
       */
      public Object fetchTrees() {
        return scanner.nextRows().addCallback(this);
      }
      
      @Override
      public Object call(ArrayList<ArrayList<KeyValue>> rows)
          throws Exception {
        if (rows == null) {
          result.callback(trees);
          return null;
        }
        
        for (ArrayList<KeyValue> row : rows) {
          final Tree tree = new Tree();
          for (KeyValue column : row) {
            if (column.qualifier().length >= TREE_QUALIFIER.length && 
                Bytes.memcmp(TREE_QUALIFIER, column.qualifier()) == 0) {
              // it's *this* tree. We deserialize to a new object and copy
              // since the columns could be in any order and we may get a rule 
              // before the tree object
              final Tree local_tree = JSON.parseToObject(column.value(), 
                  Tree.class);
              tree.created = local_tree.created;
              tree.description = local_tree.description;
              tree.name = local_tree.name;
              tree.notes = local_tree.notes;
              tree.strict_match = local_tree.strict_match;
              tree.enabled = local_tree.enabled;
              tree.store_failures = local_tree.store_failures;
              
              // WARNING: Since the JSON data in storage doesn't contain the tree
              // ID, we need to parse it from the row key
              tree.setTreeId(bytesToId(row.get(0).key()));
              
            // tree rule
            } else if (column.qualifier().length > TreeRule.RULE_PREFIX().length &&
                Bytes.memcmp(TreeRule.RULE_PREFIX(), column.qualifier(), 
                0, TreeRule.RULE_PREFIX().length) == 0) {
              final TreeRule rule = TreeRule.parseFromStorage(column);
              tree.addRule(rule);
            }
          }
          
          // only add the tree if we parsed a valid ID
          if (tree.tree_id > 0) {
            trees.add(tree);
          }
        }
        
        // recurse to get the next set of rows from the scanner
        return fetchTrees();
      }
      
    }
    
    // start the scanning process
    new AllTreeScanner().fetchTrees();
    return result;
  }
1122512
public Map<Integer, String> getCategories()
    {
        if (categories == null)
        {
            categories = new TreeMap<>();
        }

        Map<String, Object> responseMap = super.getAttributes();
        for (Entry<String, Object> response : responseMap.entrySet())
        {
            String key = response.getKey();
            if (key.toLowerCase(Locale.US).contains("category"))
            {
                String[] keyParts = key.split("-");

                // if it doesn't have at least category-XXXXXX, skip
                if (keyParts.length < 2)
                    continue;

                // try to get the number of this category, skip if we mess up
                Integer categoryNumber;
                try
                {
                    categoryNumber = Integer.parseInt(keyParts[1]);
                }
                catch (Exception exception)
                {
                    continue;
                }

                categories.put(categoryNumber, (String) response.getValue());
            }
        }

        return categories;
    }
1105400
public Map<String, Collection<String>> queries() {
    Map<String, Collection<String>> queryMap = new LinkedHashMap<>();
    this.queries.forEach((key, queryTemplate) -> {
      List<String> values = new ArrayList<>(queryTemplate.getValues());

      /* add the expanded collection, but lock it */
      queryMap.put(key, Collections.unmodifiableList(values));
    });

    return Collections.unmodifiableMap(queryMap);
  }
314870
public TreeMap<Long, Map<String, Object>> getRows() {
        return new TreeMap<Long, Map<String, Object>>(this.rows);
    }
845745
public Map<String, String> getLinks() {
        if (links == null) {
            return ImmutableMap.of();
        }
        return ImmutableMap.copyOf(links);
    }
597662
public Set<String> getNames() {
        if (parent == null) {
            return getLocalNames();
        }
        Set<String> result = new TreeSet<>();
        result.addAll(parent.getNames());
        result.addAll(getLocalNames());
        return result;
    }
131610
final TreeMapEntry<K,V> getFirstEntry() {
        TreeMapEntry<K,V> p = root;
        if (p != null)
            while (p.left != null)
                p = p.left;
        return p;
    }
637051
public java.util.List<Mapping> getMapping() {  
		if (myMapping == null) {
			myMapping = new java.util.ArrayList<Mapping>();
		}
		return myMapping;
	}
1066978
public Map<String, T> getNodes() {
        return Maps.transformValues(Collections.unmodifiableMap(_nodes), input -> (input != null) ? input.orElse(null) : null);
    }
51279
@SuppressWarnings("unchecked")
    public final V get() {
        InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
        Object v = threadLocalMap.indexedVariable(index);
        if (v != InternalThreadLocalMap.UNSET) {
            return (V) v;
        }

        return initialize(threadLocalMap);
    }
357276
public Tree<T> build() {
        Tree<T> result = base;
        if (null == base && treeStack.size() == 1) {
            result = treeStack.get(0);
        } else if (treeStack.size() > 0) {
            result = new TreeStack<T>(treeStack, base);
        }else if(null==base) {
            throw new IllegalArgumentException("base tree was not set");
        }

        return result;
    }
65769
public final LocalCompressedForest fetch() {
    int ntrees = _treeKeys.length;
    CompressedTree[][] trees = new CompressedTree[ntrees][];
    for (int t = 0; t < ntrees; t++) {
      Key[] treek = _treeKeys[t];
      trees[t] = new CompressedTree[treek.length];
      for (int i = 0; i < treek.length; i++)
        if (treek[i] != null)
          trees[t][i] = DKV.get(treek[i]).get();
    }
    return new LocalCompressedForest(trees, _domains);
  }
612932
public @NotNull List<Resource> getResources() {
    return getResources((Predicate<Resource>)null, (Resource)null);
  }
59465
public synchronized Map<T, Resource> get()
    {
        if (!done.get())
        {
            throw new LionEngineException(ERROR_NOT_FINISHED);
        }
        return Collections.unmodifiableMap(resources);
    }
40508
public T get() {
		final SQLiteDatabase db = Sprinkles.getDatabase();
		final Cursor c = db.rawQuery(rawQuery, null);

		T result = null;
		if (c.moveToFirst()) {
			result = Utils.getResultFromCursor(resultClass, c);
		}

		c.close();
		return result;
	}
1313729
@Override
    public Set<String> getKeys() {
        Map<String, String> map = inheritableThreadLocal.get();
        if (map != null) {
            return map.keySet();
        } else {
            return null;
        }
    }