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


Java DataFactory.getBusinessName方法代码示例

本文整理汇总了Java中org.fluttercode.datafactory.impl.DataFactory.getBusinessName方法的典型用法代码示例。如果您正苦于以下问题:Java DataFactory.getBusinessName方法的具体用法?Java DataFactory.getBusinessName怎么用?Java DataFactory.getBusinessName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fluttercode.datafactory.impl.DataFactory的用法示例。


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

示例1: generateAndStorePlaces

import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
/**
     * This is a development helper function for seeding the db.
     * It generates massive amounts of places with fake data and inserts then to database.
     * The x0 and y0 are longitude and latitude respectively, the new places will be generated
     * in a circle around them.
     * @param places_num The number of placed to generate.
     * @param latitude The latitude at the center of circle
     * @param longitude The longitude at the center of circle
     * @param radius The radious of circle in meters.
     */
    public void generateAndStorePlaces(int places_num, double latitude, double longitude, double radius ){
        DataFactory df              = new DataFactory();
        Random randomGenerator      = new Random();
        List<Category> categories   = getAllCategories();
        double radiusInDegrees      = radius / 111000f; // Convert radius from meters to degrees (near the equator)

        while(--places_num >= 0) {
            Category randomCategory = categories.get(randomGenerator.nextInt(categories.size()));

            /* u and v are random number between 0 and 1 */
            double u = randomGenerator.nextDouble();
            double v = randomGenerator.nextDouble();

            /* Random point inside radious algorithm. Credits here: http://gis.stackexchange.com/questions/25877/ */
            double w = radiusInDegrees * Math.sqrt(u);
            double t = 2 * Math.PI * v;
            double x = w * Math.cos(t);
            double y = w * Math.sin(t);

            // Adjust the x-coordinate for the shrinking of the east-west distances
            double new_x = x / Math.cos(latitude);

            double randomLongitude = new_x + longitude;
            double randomLatitude = y + latitude;

            Place p = new Place(df.getName() + " - " + df.getBusinessName(),
                    df.getRandomWord() + " " + df.getRandomText(35, 55) + " " + df.getRandomWord(),
                    randomLatitude,
                    randomLongitude,
                    randomCategory.getId());

            insertOrReplacePlace(p);
//            Log.d("Generated Place", p.toString());
//            Log.d("Iteration #", Integer.toString(places_num));
        }
    }
 
开发者ID:dklisiaris,项目名称:geopin,代码行数:47,代码来源:DBHandler.java

示例2: Person

import org.fluttercode.datafactory.impl.DataFactory; //导入方法依赖的package包/类
public Person(int id, DataFactory dataFactory, SimpleDateFormat simpleDateFormat) {
    this.id = id;
    this.firstName = dataFactory.getFirstName();
    this.lastName = dataFactory.getLastName();
    this.city = dataFactory.getCity();
    this.company = new CustomCompany(dataFactory.getBusinessName());
    this.birthday = simpleDateFormat.format(dataFactory.getBirthDate());
    this.email = dataFactory.getEmailAddress();
    this.gender = id % 3 == 0;
}
 
开发者ID:lucas34,项目名称:android-spreadsheet-lib,代码行数:11,代码来源:Person.java


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