Java Code Examples for org.hy.common.Help#division()

The following examples show how to use org.hy.common.Help#division() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ImageListener.java    From hy.common.report with Apache License 2.0 6 votes vote down vote up
/**
 * 自动缩放
 * 
 * @author      ZhengWei(HY)
 * @createDate  2019-05-30
 * @version     v1.0
 *
 * @param i_Picture
 * @param i_Image
 */
protected void autoScale(Picture i_Picture ,BufferedImage i_Image)
{
    double v_Scale = 1D;
    
    if ( i_Image.getWidth() > i_Image.getHeight() )
    {
        double v_ScaleY = Help.division(i_Image.getHeight() ,i_Image.getWidth());
        i_Picture.resize(v_Scale ,v_ScaleY);
        // i_Picture.resize(v_Scale ,v_Scale);
    }
    else if ( i_Image.getWidth() < i_Image.getHeight() )
    {
        double v_ScaleX = Help.division(i_Image.getWidth() ,i_Image.getHeight());
        i_Picture.resize(v_ScaleX ,v_Scale);
        // i_Picture.resize(0.5D ,v_Scale);
    }
    else
    {
        i_Picture.resize(v_Scale ,v_Scale);
    }
}
 
Example 2
Source File: PageInfo.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
/**
 * 构造子 因为本类是在内部被创建的,所以在此没有进行数据的有效性检测。
 * 
 * @param i_Datas         分页中当前页中要显示的记录
 * @param i_MaxRowCount   一共有多少条记录
 * @param i_PagePerCount  每页分为多少行
 * @param i_CurrentPage   当前分页的分页号
 */
public PageInfo(O i_Datas ,int i_MaxRowCount ,int i_PagePerCount ,int i_CurrentPage)
{
    this.datas        = i_Datas;
    this.maxRowCount  = i_MaxRowCount;
    this.pagePerCount = i_PagePerCount;
    this.currentPage  = i_CurrentPage;
    this.maxPageCount = (int)Help.division(this.maxRowCount , this.pagePerCount);
    if ( (this.maxRowCount % this.pagePerCount) != 0 )
    {
        this.maxPageCount += 1;
    }
}
 
Example 3
Source File: JU_Help.java    From hy.common.base with Apache License 2.0 5 votes vote down vote up
@Test
public void test_division()
{
    double v_Ret01 = Help.division("1" ,"3");
    double v_Ret02 = Help.division(1   ,3);
    
    System.out.println("除法的差值不等于0.333333333:" + (1.0 / 3.0));
    
    Assert.assertTrue("减法的差值是否相等" ,v_Ret01 == 0.333333333);
    Assert.assertTrue("减法的差值是否相等" ,v_Ret02 == 0.333333333);
}