All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.formkiq.vision.crafter.DocumentWall Maven / Gradle / Ivy

/*
 * Copyright (C) 2018 FormKiQ Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.formkiq.vision.crafter;

import java.io.Serializable;
import java.util.List;

import org.apache.commons.lang3.Range;

import com.formkiq.vision.document.DocumentBlock;
import com.formkiq.vision.document.DocumentBlockRectangle;

/**
 * Document Wall Holder.
 *
 */
public class DocumentWall implements DocumentBlockRectangle, Serializable {

    /** serialVersionUID. */
    private static final long serialVersionUID = -7128878631931290957L;

    /** {@link DocumentBlock}. */
	private DocumentBlock block;
	/** {@link List} {@link DocumentRowLayout}. */
	private List rowlayouts;

	/**
	 * constructor.
	 */
	public DocumentWall() {
	}

	/**
	 * @return {@link DocumentBlock}
	 */
	public DocumentBlock getBlock() {
		return this.block;
	}

	/**
	 * @param docblock {@link DocumentBlock}
	 */
	public void setBlock(final DocumentBlock docblock) {
		this.block = docblock;
	}

    @Override
    public String toString() {
        return this.block.toString() + ",rowlayouts=" + this.rowlayouts.size();
    }

	@Override
	public float getLowerLeftX() {
		return this.block.getLowerLeftX();
	}

	@Override
	public float getLowerLeftY() {
		return this.block.getLowerLeftY();
	}

	@Override
	public float getUpperRightX() {
		return this.block.getUpperRightX();
	}

	@Override
	public float getUpperRightY() {
		return this.block.getUpperRightY();
	}

    /**
     * @return {@link List} {@link DocumentRowLayout}
     */
    public List getRowlayouts() {
        return this.rowlayouts;
    }

    /**
     * @param layouts {@link List} {@link DocumentRowLayout}
     */
    public void setRowlayouts(final List layouts) {
        this.rowlayouts = layouts;
    }

    /**
     * @return {@link Range}
     */
    public Range getX() {
        return Range.between(Float.valueOf(this.block.getLowerLeftX()),
                Float.valueOf(this.block.getUpperRightX()));
    }

    /**
     * @return {@link Range}
     */
    public Range getY() {
        return Range.between(Float.valueOf(this.block.getLowerLeftY()),
                Float.valueOf(this.block.getUpperRightY()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy