本文整理汇总了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));
}
}
示例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;
}