Get the count of values inside the JSON document.

This method is only available with Couchbase Server 5.0 and later.

@param paths the path inside the document where to get the count from.
@return this builder for chaining.
767157
public AsyncLookupInBuilder getCount(String... paths) {
        if (paths == null || paths.length == 0) {
            throw new IllegalArgumentException("Path is mandatory for subdoc get count");
        }
        for (String path : paths) {
            if (StringUtil.isNullOrEmpty(path)) {
                throw new IllegalArgumentException("Path is mandatory for subdoc get count");
            }
            this.specs.add(new LookupSpec(Lookup.GET_COUNT, path));
        }
        return this;
    }
1109346
public static List<File> pathsFiles(final String paths, final Predicate<File> predicate) {
        final List<File> files = new ArrayList<File>();
        for (final String filePathAndName : paths.split(File.pathSeparator)) {
            final File file = new File(filePathAndName);
            if (file.isDirectory()) {
                try (final Stream<Path> stream = Files.walk(file.toPath(), Integer.MAX_VALUE)) {
                    stream.map(f -> f.toFile()).filter(predicate).forEach(files::add);
                } catch (final IOException ex) {
                    throw new RuntimeException("Error walking path: " + file, ex);
                }
            } else {
                if (predicate.test(file)) {
                    files.add(file);
                }
            }
        }
        return files;
    }
674825
@SuppressWarnings("unchecked")
    public Q load(Path<?>... paths) {
        Set<String> fields = new HashSet<String>();
        for (Path<?> path : paths) {
            fields.add(serializer.toField(path));
        }
        this.fieldsToLoad = fields;
        return (Q) this;
    }
132186
public DavChild getProps(final BasicHttpClient cl,
                           final String path,
                           final Collection<QName> props) throws Throwable {
    return makeDavChild(propfind(cl,
                                 normalizePath(path),
                                 props,
                                 depth0));
  }
999017
public static SimpleFeatureCollection readJsonfile( String path ) throws Exception {

        OmsJsonFeatureReader reader = new OmsJsonFeatureReader();
        reader.file = path;
        reader.readFeatureCollection();

        return reader.geodata;
    }
559009
@Override
    public Enumeration<String> getEntryPaths(String path, boolean recurse) {
        path = preSlashify(path);
        Iterator<Entry> entries;
        if (path.equals("/")) {
            // asking for entries of the root container
            entries = container.iterator();
        } else {
            Entry entry = container.getEntry(path);
            Container entryContainer = entry == null ? null : getContainer(entry);
            // Check if the entry is a container; 
            // if so only iterate over its entries if the container is not a root
            entries = entryContainer == null || entryContainer.isRoot() ? null : entryContainer.iterator();
            path = postSlashify(path, null);
        }
        return entries == null ? null : new ContainerEnumeration(path, entries, recurse);
    }
1122542
public Object collectOne(InputStream inputStream, String... paths) {
        return collectOne(inputStream, compile(paths));
    }
467124
public static List<String> getTokens(String path) {
        if (path == null) {
            throw MESSAGES.nullArgument("path");
        }
        List<String> list = new ArrayList<String>();
        getTokens(list, path);
        return list;
    }
1352099
public static String getStringFromJSONPath(JSONObject record, String path) {
        final Object object = getObjectFromJSONPath(record, path);
        return object == null ? null : object.toString();
    }
605663
public List<V> getDescendantValues(List<P> path) {

        CmsPathTree<P, V> node = findNode(path);
        List<V> result = Lists.newArrayList();
        if (node != null) {
            node.collectEntries(result);
        }
        return result;
    }
566983
public JSONResource json(JSONPathQuery path) throws Exception {
		Object jsonValue = path.eval(this);
		return json(jsonValue.toString());
	}
1176702
public void count(String path,boolean b) throws IOException{

		HashMap<String, Integer> wordsFreq = new HashMap<String, Integer>();
		HashMap<Integer, Integer> lensFreq = new HashMap<Integer, Integer>();
		HashMap<String, Integer> posFreq = new HashMap<String, Integer>();
		HashMap<String, Integer> relsFreq = new HashMap<String, Integer>();
		HashMap<String, HashSet<String>> wordsPOS = new HashMap<String, HashSet<String>>();
		
		int total = 0;
		int totalsent = 0;
		Iterator<FNLPDoc> dit = docs.iterator();
		while(dit.hasNext()){
			FNLPDoc doc = dit.next();
			Iterator<FNLPSent> sit = doc.sentences.iterator();
			while(sit.hasNext()){
				FNLPSent sent = sit.next();
				totalsent++;
				for(int i=0;i<sent.words.length;i++){
					total++;
					String w = sent.words[i];
					int len = w.length();
					String pos = sent.tags[i];
					if(!pos.equals("专有名"))
						continue;
					String rels = sent.relations[i];
//					if(len > 20){
//						System.out.println(w);						
//					}
					
					if (posFreq.containsKey(pos)) {
						posFreq.put(pos, posFreq.get(pos) + 1);
					} else {
						posFreq.put(pos, 1);
					}

					if (lensFreq.containsKey(len)) {
						lensFreq.put(len, lensFreq.get(len) + 1);
					} else {
						lensFreq.put(len, 1);
					}

					if (wordsFreq.containsKey(w)) {
						wordsFreq.put(w, wordsFreq.get(w) + 1);
						
					} else {
						wordsFreq.put(w, 1);						
					}
					
					if (wordsPOS.containsKey(w)) {
						wordsPOS.get(w).add(pos);						
					} else {
						HashSet<String> posset = new HashSet<String>();
						posset.add(pos);
						wordsPOS.put(w, posset);			
					}
					
					
					
					if (relsFreq.containsKey(rels)) {
						relsFreq.put(rels, relsFreq.get(rels) + 1);
					} else {
						relsFreq.put(rels, 1);
					}
				}
			}
		}
		System.out.println("总字数："+total);
		System.out.println("总句数："+totalsent);
		List<Entry> sortedwordsFreq = MyCollection.sort(wordsFreq);		
		MyCollection.write(sortedwordsFreq, path+"/wc.txt", b);
		
		List<Entry> sortedposFreq = MyCollection.sort(posFreq);		
		MyCollection.write(sortedposFreq, path+"/pos.txt", b);
		
		List<Entry> sortedlrelsFreq = MyCollection.sort(relsFreq);
		MyCollection.write(sortedlrelsFreq, path+"/relations.txt", b);

		List<Entry> sortedlensFreq = MyCollection.sort(lensFreq);
		MyCollection.write(sortedlensFreq, path+"/lc.txt", b);
		
		MyCollection.write(wordsPOS, path+"/wordpos.txt");
	}
1370182
public AbstractBigDecimalAssert<?> jsonPathAsBigDecimal(String path) {
        return Assertions.assertThat(actual.read(path, BigDecimal.class));
    }
506829
public int getPathCount() {
    int result = 0;
    for(IndexTreePath<E> path = this; path != null; path = path.parentPath) {
      result++;
    }
    return result;
  }
980590
public static Predicate paths(final String... paths) {
        final PathMatchPredicate[] predicates = new PathMatchPredicate[paths.length];
        for (int i = 0; i < paths.length; ++i) {
            predicates[i] = new PathMatchPredicate(paths[i]);
        }
        return or(predicates);
    }
939245
private JSONObject getJSONFromPath(String path) throws LRException
    {
        JSONObject json = null;
        String jsonTxt = null;
        
        try
        {
            jsonTxt = LRClient.executeJsonGet(importProtocol + "://" + nodeHost + path);
        }
        catch(Exception e)
        {
            throw new LRException(LRException.IMPORT_FAILED);
            //e.printStackTrace();
        }
        
        try
        {
            json = new JSONObject(jsonTxt);
        }
        catch(JSONException e)
        {
            throw new LRException(LRException.JSON_IMPORT_FAILED);
            //e.printStackTrace();
        }

        return json;
    }
450980
public Collection<Object> collectAll(InputStream inputStream, JsonPath... paths) {
        return collectAll(inputStream, Object.class, paths);
    }