Package java.util.regex

Examples of java.util.regex.Pattern$Bound


  /**
   * {@inheritDoc}
   */
  @Override
  public void process(BoundContainer boundContainer) {
    Bound newBound = null;

    // Configure the area if it hasn't been created yet. (Should this be in an "initialize" method?)
    if (area == null) {
      area = new PolygonFileReader(polygonFile).loadPolygon();
    }
   
    for (Bound b : boundContainer.getEntity().toSimpleBound()) {
      if (newBound == null) {
        newBound = simpleBoundIntersect(b);
      } else {
        newBound = newBound.union(simpleBoundIntersect(b));
      }
    }

    if (newBound != null) {
      super.process(new BoundContainer(newBound));
View Full Code Here


   */
  private Bound simpleBoundIntersect(Bound bound) {
    Rectangle2D r;
    double width, height;

    Bound newBound = null;
    Area a2 = (Area) area.clone(); // make a copy so we don't disturb the original

    /*
     * Note that AWT uses the computer graphics convention with the origin at the top left, so
     * top and bottom are reversed for a Rectangle2D vs. a Bound.
     */

    if (bound.getLeft() > bound.getRight()) {
      return null;
    }
    width = bound.getRight() - bound.getLeft();
    height = bound.getTop() - bound.getBottom();
    /*
     * Perform the intersect against the Area itself instead of its bounding box for maximum
     * precision.
     */
    a2.intersect(new Area(new Rectangle2D.Double(
            bound.getLeft(),
            bound.getBottom(),
            width,
            height)));
    if (!a2.isEmpty()) {
      r = a2.getBounds2D();
      newBound = new Bound(
              r.getMaxX(),
              r.getMinX(),
              r.getMaxY(),
              r.getMinY(),
              bound.getOrigin());
View Full Code Here

    double left;
    double right;
    double top;
    double bottom;
    int zoom;
    Bound newBound = null;
    String origin = null;
    boolean remove;

    remove = getBooleanArgument(taskConfig, ARG_REMOVE, DEFAULT_REMOVE);

    if (!remove) {
      origin = getStringArgument(taskConfig, ARG_ORIGIN, DEFAULT_ORIGIN);
      left = getDoubleArgument(taskConfig, ARG_LEFT, DEFAULT_LEFT);
      right = getDoubleArgument(taskConfig, ARG_RIGHT, DEFAULT_RIGHT);
      top = getDoubleArgument(taskConfig, ARG_TOP, DEFAULT_TOP);
      bottom = getDoubleArgument(taskConfig, ARG_BOTTOM, DEFAULT_BOTTOM);

      zoom = getIntegerArgument(taskConfig, ARG_ZOOM, DEFAULT_ZOOM);
      if (doesArgumentExist(taskConfig, ARG_X1)) {
        int x1 = getIntegerArgument(taskConfig, ARG_X1);
        left = xToLon(zoom, x1);
        right = xToLon(zoom, getIntegerArgument(taskConfig, ARG_X2, x1) + 1);
      }
      if (doesArgumentExist(taskConfig, ARG_Y1)) {
        int y1 = getIntegerArgument(taskConfig, ARG_Y1);
        top = yToLat(zoom, y1);
        bottom = yToLat(zoom, getIntegerArgument(taskConfig, ARG_Y2, y1) + 1);
      }

      newBound = new Bound(right, left, top, bottom, origin);
    }

    return new SinkSourceManager(taskConfig.getId(),
        new BoundSetter(newBound), taskConfig.getPipeArgs());
  }
View Full Code Here

  @Override
  public void complete() {
    objects.complete();

    if (nodesSeen) {
      sink.process(new BoundContainer(new Bound(right, left, top, bottom, this.origin)));
    }

    ReleasableIterator<EntityContainer> iter = null;

    try {
View Full Code Here

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testNeitherHasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), false);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), false);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testSource0HasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), true);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), false);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testSource1HasBound() throws Exception {
    RunnableSource source0 = new BoundSource(new Bound(1, 2, 4, 3, "source0"), false);
    RunnableSource source1 = new BoundSource(new Bound(5, 6, 8, 7, "source1"), true);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
View Full Code Here

   *
   * @throws Exception if something goes wrong
   */
  @Test
  public void testBothHaveBounds() throws Exception {
    Bound bound0 = new Bound(1, 2, 4, 3, "source1");
    RunnableSource source0 = new BoundSource(bound0, true);

    Bound bound1 = new Bound(5, 6, 8, 7, "source2");
    RunnableSource source1 = new BoundSource(bound1, true);

    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
    SinkEntityInspector merged = RunTaskUtilities.run(merger, source0, source1);
    List<EntityContainer> mergedList = createList(merged.getProcessedEntities());
    Assert.assertEquals(3, mergedList.size());
    Assert.assertEquals(EntityType.Bound, mergedList.get(0).getEntity().getType());
   
    // Check the bound
    Bound bound01 = (Bound) mergedList.get(0).getEntity();
    Assert.assertEquals(bound0.union(bound1), bound01);

    for (int i = 1; i < mergedList.size(); i++) {
      Assert.assertEquals(EntityType.Node, mergedList.get(i).getEntity().getType());
    }
View Full Code Here

   */
  @Test
  public void testOneSourceEmpty() throws Exception {
    RunnableSource source0 = new EmptyReader();

    Bound bound1 = new Bound(5, 6, 8, 7, "source2");
    RunnableSource source1 = new BoundSource(bound1, true);
   
    EntityMerger merger = new EntityMerger(ConflictResolutionMethod.LatestSource, 1,
        BoundRemovedAction.Ignore);
   
View Full Code Here

          new SchemaVersionValidator(loginCredentials, preferences)
                  .validateVersion(ApidbVersionConstants.SCHEMA_MIGRATIONS);
         
          entityDao = new AllEntityDao(dbCtx.getJdbcTemplate());
         
          sink.process(new BoundContainer(new Bound("Osmosis " + OsmosisConstants.VERSION)));
          reader = entityDao.getCurrent();
          try {
            while (reader.hasNext()) {
              sink.process(reader.next());
            }
View Full Code Here

TOP

Related Classes of java.util.regex.Pattern$Bound

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.