use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.
the class EntityReporter method process.
/**
* {@inheritDoc}
*/
public void process(EntityContainer entityContainer) {
String userName;
final UserStatistics user;
// Obtain the user statistics object.
userName = entityContainer.getEntity().getUser().getName();
if (userName != null && userName.length() > 0) {
if (userMap.containsKey(userName)) {
user = userMap.get(userName);
} else {
user = new UserStatistics(userName);
userMap.put(userName, user);
}
} else {
user = anonymousUser;
}
// Increment the relevant user statistic.
entityContainer.process(new EntityProcessor() {
private UserStatistics processorUser = user;
public void process(BoundContainer bound) {
// Do nothing.
}
public void process(NodeContainer node) {
processorUser.incrementNodeCount();
totalUser.incrementNodeCount();
}
public void process(WayContainer way) {
processorUser.incrementWayCount();
totalUser.incrementWayCount();
}
public void process(RelationContainer relation) {
processorUser.incrementRelationCount();
totalUser.incrementRelationCount();
}
});
}
use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.
the class BoundComputerTest method computeBoundNoNodesWithBound.
/**
* Tests the bound computation if no nodes but a bound entity is upstream.
*/
@Test
public void computeBoundNoNodesWithBound() {
SinkEntityInspector inspector = new SinkEntityInspector();
BoundComputer bc = new BoundComputer("NewBound");
bc.setSink(inspector);
bc.process(new BoundContainer(new Bound("Test")));
bc.complete();
bc.close();
Assert.assertNull(inspector.getLastEntityContainer());
}
use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.
the class OsmWriterTest method testProcess4.
/**
* Test processing a Bound after a Node.
*/
@Test(expected = OsmosisRuntimeException.class)
public final void testProcess4() {
testOsmWriter.process(new NodeContainer(new Node(new CommonEntityData(1234, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0, new ArrayList<Tag>()), 20, 20)));
testOsmWriter.process(new BoundContainer(new Bound("source")));
fail("Expected to throw an exception.");
}
use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.
the class OsmWriterTest method testProcess9.
/**
* Test processing a Bound after a Relation.
*/
@Test(expected = OsmosisRuntimeException.class)
public final void testProcess9() {
Relation testRelation;
testRelation = new Relation(new CommonEntityData(3456, 0, new Date(), new OsmUser(12, "OsmosisTest"), 0));
testRelation.getMembers().add(new RelationMember(1234, EntityType.Node, "role1"));
testRelation.getTags().add(new Tag("test_key1", "test_value1"));
testOsmWriter.process(new RelationContainer(testRelation));
testOsmWriter.process(new BoundContainer(new Bound("source")));
}
use of org.openstreetmap.osmosis.core.container.v0_6.BoundContainer in project osmosis by openstreetmap.
the class BoundsElementProcessor method end.
/**
* {@inheritDoc}
*/
@Override
public void end() {
getSink().process(new BoundContainer(bound));
bound = null;
}
Aggregations