当前位置: 首页>>代码示例>>Java>>正文


Java CloseableIterator.hasNext方法代码示例

本文整理汇总了Java中mil.nga.giat.geowave.core.store.CloseableIterator.hasNext方法的典型用法代码示例。如果您正苦于以下问题:Java CloseableIterator.hasNext方法的具体用法?Java CloseableIterator.hasNext怎么用?Java CloseableIterator.hasNext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mil.nga.giat.geowave.core.store.CloseableIterator的用法示例。


在下文中一共展示了CloseableIterator.hasNext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testQuery

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private int testQuery(
		final DataAdapter<?> adapter,
		final Query query )
		throws Exception {
	final mil.nga.giat.geowave.core.store.DataStore geowaveStore = dataStore.createDataStore();

	final CloseableIterator<?> accumuloResults = geowaveStore.query(
			new QueryOptions(
					adapter,
					TestUtils.DEFAULT_SPATIAL_INDEX),
			query);

	int resultCount = 0;
	while (accumuloResults.hasNext()) {
		accumuloResults.next();

		resultCount++;
	}
	accumuloResults.close();

	return resultCount;

}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:GeowaveSparkIngestIT.java

示例2: getStoredPointSet

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
protected static Set<Point> getStoredPointSet(
		final DataStore ds ) {
	final CloseableIterator itr = ds.query(
			new QueryOptions(),
			new BasicQuery(
					new BasicQuery.Constraints()));
	final Set<Point> readPoints = new TreeSet<Point>();
	while (itr.hasNext()) {
		final Object n = itr.next();
		if (n instanceof SimpleFeature) {
			final SimpleFeature gridCell = (SimpleFeature) n;
			final Point p = (Point) gridCell.getDefaultGeometry();
			readPoints.add(p);
		}
	}
	return readPoints;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:SimpleHBaseIngestTest.java

示例3: getStoredPointSet

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
protected static Set<Point> getStoredPointSet(
		DataStore ds ) {
	CloseableIterator itr = ds.query(
			new QueryOptions(),
			new BasicQuery(
					new BasicQuery.Constraints()));
	Set<Point> readPoints = new TreeSet<Point>();
	while (itr.hasNext()) {
		Object n = itr.next();
		if (n instanceof SimpleFeature) {
			SimpleFeature gridCell = (SimpleFeature) n;
			Point p = (Point) gridCell.getDefaultGeometry();
			readPoints.add(p);
		}
	}
	return readPoints;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:SimpleIngestTest.java

示例4: testPolygonDataIdQueryResults

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testPolygonDataIdQueryResults() {
	final CloseableIterator<SimpleFeature> matches = dataStore.createDataStore().query(
			new QueryOptions(
					dataAdapter,
					TestUtils.DEFAULT_SPATIAL_INDEX),
			new DataIdQuery(
					dataAdapter.getAdapterId(),
					new ByteArrayId(
							StringUtils.stringToBinary(DATA_ID))));
	int numResults = 0;
	while (matches.hasNext()) {
		matches.next();
		numResults++;
	}
	Assert.assertTrue(
			"Expected 1 result, but returned " + numResults,
			numResults == 1);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:20,代码来源:PolygonDataIdQueryIT.java

示例5: getAllCentroidGroups

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Override
public List<String> getAllCentroidGroups()
		throws IOException {
	final List<String> groups = new ArrayList<String>();
	final CloseableIterator<T> it = getRawCentroids(
			this.batchId,
			null);
	while (it.hasNext()) {
		final AnalyticItemWrapper<T> item = centroidFactory.create(it.next());
		final String groupID = item.getGroupID();
		int pos = groups.indexOf(groupID);
		if (pos < 0) {
			pos = groups.size();
			groups.add(groupID);
		}
		// cache the first set
		if (pos < capacity) {
			getCentroidsForGroup(groupID);
		}
	}
	it.close();
	return groups;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:CentroidManagerGeoWave.java

示例6: transferBatch

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void transferBatch(
		final String fromBatchId,
		final String groupID )
		throws IOException {
	final CloseableIterator<T> it = getRawCentroids(
			fromBatchId,
			groupID);
	int count = 0;
	try (final IndexWriter indexWriter = dataStore.createWriter(
			adapter,
			index)) {
		while (it.hasNext()) {
			final AnalyticItemWrapper<T> item = centroidFactory.create(it.next());
			item.setBatchID(this.batchId);
			count++;

			indexWriter.write(item.getWrappedItem());
		}
		it.close();
		// indexWriter.close();
	}
	LOGGER.info("Transfer " + count + " centroids");
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:CentroidManagerGeoWave.java

示例7: canOpen

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@SuppressWarnings("squid:S1166") // Exception caught and handled
public static boolean canOpen(String input,
    ProviderProperties providerProperties) throws IOException
{
  log.debug("Inside canOpen with " + input);
  initConnectionInfo();
  ParseResults results = parseResourceName(input);
  try
  {
    initDataSource(null, results.storeName);
    DataSourceEntry entry = getDataSourceEntry(results.storeName);
    CloseableIterator<DataAdapter<?>> iter = entry.adapterStore.getAdapters();
    while (iter.hasNext())
    {
      DataAdapter<?> da = iter.next();
      log.debug("GeoWave adapter: " + da.getAdapterId().toString());
    }
    ByteArrayId adapterId = new ByteArrayId(results.name);
    DataAdapter<?> adapter = entry.adapterStore.getAdapter(adapterId);
    if (adapter == null)
    {
      return false;
    }
    return checkAuthorizations(adapterId, results.storeName, providerProperties);
  }
  catch (IOException ignored)
  {
  }
  catch (IllegalArgumentException e)
  {
    log.info("Unable to open " + input + " with the GeoWave data provider", e);
  }
  return false;
}
 
开发者ID:ngageoint,项目名称:mrgeo,代码行数:35,代码来源:GeoWaveVectorDataProvider.java

示例8: testIngest

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
		throws IOException {

	final URL toIngest = this.getClass().getClassLoader().getResource(
			filePath);

	assertTrue(GeoLifeUtils.validate(toIngest));
	final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
	indexIds.add(new ByteArrayId(
			"123".getBytes(StringUtils.UTF8_CHAR_SET)));
	final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
			toIngest,
			indexIds,
			"");

	assertTrue((features != null) && features.hasNext());

	int featureCount = 0;
	while (features.hasNext()) {
		final GeoWaveData<SimpleFeature> feature = features.next();

		if (isValidGeoLifeFeature(feature)) {
			featureCount++;
		}
	}
	features.close();

	final boolean readExpectedCount = (featureCount == expectedCount);
	if (!readExpectedCount) {
		System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
	}

	assertTrue(readExpectedCount);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:36,代码来源:GEOLIFEIngestTest.java

示例9: testIngest

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
		throws IOException {

	final URL toIngest = this.getClass().getClassLoader().getResource(
			filePath);

	assertTrue(TwitterUtils.validate(toIngest));
	final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
	indexIds.add(new ByteArrayId(
			"123".getBytes(StringUtils.UTF8_CHAR_SET)));
	final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
			toIngest,
			indexIds,
			"");

	assertTrue((features != null) && features.hasNext());

	int featureCount = 0;
	while (features.hasNext()) {
		final GeoWaveData<SimpleFeature> feature = features.next();

		if (isValidTwitterFeature(feature)) {
			featureCount++;
		}
	}
	features.close();

	final boolean readExpectedCount = (featureCount == expectedCount);
	if (!readExpectedCount) {
		System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
	}
	assertTrue(readExpectedCount);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:35,代码来源:TwitterIngestTest.java

示例10: hasAtLeastOne

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private static boolean hasAtLeastOne(
		final CloseableIterator<?> it ) {
	try {
		return it.hasNext();
	}
	finally {
		try {
			it.close();
		}
		catch (final IOException e) {
			e.printStackTrace();
		}
	}
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:15,代码来源:AbstractGeoWaveBasicVectorIT.java

示例11: createTypeNames

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Override
protected List<Name> createTypeNames()
		throws IOException {
	final List<Name> names = new ArrayList<>();
	final CloseableIterator<DataAdapter<?>> adapters = adapterStore.getAdapters();
	while (adapters.hasNext()) {
		final DataAdapter<?> adapter = adapters.next();
		if (adapter instanceof GeotoolsFeatureDataAdapter) {
			names.add(((GeotoolsFeatureDataAdapter) adapter).getFeatureType().getName());
		}
	}
	adapters.close();
	return names;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:15,代码来源:GeoWaveGTDataStore.java

示例12: getFeatureAdapterCount

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
public static int getFeatureAdapterCount(
		final DataStorePluginOptions dataStore ) {
	final CloseableIterator<DataAdapter<?>> adapterIt = dataStore.createAdapterStore().getAdapters();
	int featureAdapters = 0;

	while (adapterIt.hasNext()) {
		final DataAdapter adapter = adapterIt.next();
		if (adapter instanceof GeotoolsFeatureDataAdapter) {
			featureAdapters++;
		}
	}

	return featureAdapters;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:15,代码来源:FeatureDataUtils.java

示例13: getFeatureAdapterIds

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
public static List<ByteArrayId> getFeatureAdapterIds(
		final DataStorePluginOptions dataStore ) {
	final ArrayList<ByteArrayId> featureAdapterIds = new ArrayList<>();

	final CloseableIterator<DataAdapter<?>> adapterIt = dataStore.createAdapterStore().getAdapters();

	while (adapterIt.hasNext()) {
		final DataAdapter adapter = adapterIt.next();
		if (adapter instanceof GeotoolsFeatureDataAdapter) {
			featureAdapterIds.add(adapter.getAdapterId());
		}
	}

	return featureAdapterIds;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:16,代码来源:FeatureDataUtils.java

示例14: verifyResults

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
private void verifyResults(
		final CloseableIterator<SimpleFeature> results,
		final int numExpectedResults,
		final Collection<String> attributesExpected )
		throws IOException {

	int numResults = 0;
	SimpleFeature currentFeature;
	Object currentAttributeValue;

	while (results.hasNext()) {

		currentFeature = results.next();
		numResults++;

		for (final String currentAttribute : ALL_ATTRIBUTES) {

			currentAttributeValue = currentFeature.getAttribute(currentAttribute);

			if (attributesExpected.contains(currentAttribute)) {
				Assert.assertNotNull(
						"Expected non-null " + currentAttribute + " value!",
						currentAttributeValue);
			}
			else {
				Assert.assertNull(
						"Expected null " + currentAttribute + " value!",
						currentAttributeValue);
			}
		}
	}

	results.close();

	Assert.assertEquals(
			"Unexpected number of query results",
			numExpectedResults,
			numResults);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:40,代码来源:AttributesSubsetQueryIT.java

示例15: testIngest

import mil.nga.giat.geowave.core.store.CloseableIterator; //导入方法依赖的package包/类
@Test
public void testIngest()
		throws IOException {

	final URL toIngest = this.getClass().getClassLoader().getResource(
			filePath);

	assertTrue(GDELTUtils.validate(toIngest));
	final Collection<ByteArrayId> indexIds = new ArrayList<ByteArrayId>();
	indexIds.add(new ByteArrayId(
			"123".getBytes(StringUtils.UTF8_CHAR_SET)));
	final CloseableIterator<GeoWaveData<SimpleFeature>> features = ingester.toGeoWaveData(
			toIngest,
			indexIds,
			"");

	assertTrue((features != null) && features.hasNext());

	int featureCount = 0;
	while (features.hasNext()) {
		final GeoWaveData<SimpleFeature> feature = features.next();

		if (isValidGDELTFeature(feature)) {
			featureCount++;
		}
	}
	features.close();

	final CloseableIterator<GeoWaveData<SimpleFeature>> featuresExt = ingesterExt.toGeoWaveData(
			toIngest,
			indexIds,
			"");

	assertTrue((featuresExt != null) && featuresExt.hasNext());

	int featureCountExt = 0;
	while (featuresExt.hasNext()) {
		final GeoWaveData<SimpleFeature> featureExt = featuresExt.next();

		if (isValidGDELTFeatureExt(featureExt)) {
			featureCountExt++;
		}
	}
	featuresExt.close();

	final boolean readExpectedCount = (featureCount == expectedCount);
	if (!readExpectedCount) {
		System.out.println("Expected " + expectedCount + " features, ingested " + featureCount);
	}

	final boolean readExpectedCountExt = (featureCountExt == expectedCount);
	if (!readExpectedCount) {
		System.out.println("Expected " + expectedCount + " features, ingested " + featureCountExt);
	}

	assertTrue(readExpectedCount);
	assertTrue(readExpectedCountExt);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:59,代码来源:GDELTIngestTest.java


注:本文中的mil.nga.giat.geowave.core.store.CloseableIterator.hasNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。