本文整理汇总了Java中com.google.gwt.sample.dynatablerf.domain.Person类的典型用法代码示例。如果您正苦于以下问题:Java Person类的具体用法?Java Person怎么用?Java Person使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Person类属于com.google.gwt.sample.dynatablerf.domain包,在下文中一共展示了Person类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: persist
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
@Override
public void persist(Person person) {
if (person.getId() == null) {
person.setId(Long.toString(++serial));
}
person.setVersion(person.getVersion() + 1);
if (person.getClassSchedule() != null) {
scheduleStore.persist(person.getClassSchedule());
}
Person existing = people.get(person.getId());
if (existing != null) {
existing.copyFrom(person);
} else {
people.put(person.getId(), person);
}
}
示例2: findPerson
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
@Override
public Person findPerson(String id) {
Person toReturn = people.get(id);
if (toReturn == null) {
toReturn = backingStore.findPerson(id);
if (toReturn != null) {
toReturn = toReturn.makeCopy();
Integer scheduleKey = toReturn.getClassSchedule().getKey();
Schedule scheduleCopy = scheduleStore.find(scheduleKey);
toReturn.setClassSchedule(scheduleCopy);
}
people.put(id, toReturn);
}
return toReturn;
}
示例3: collectSchedules
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static List<Schedule> collectSchedules(List<Person> randomPeople) {
List<Schedule> toReturn = new ArrayList<Schedule>();
for (Person person : randomPeople) {
toReturn.add(person.getClassSchedule());
}
return toReturn;
}
示例4: generateRandomPeople
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static List<Person> generateRandomPeople() {
List<Person> toReturn = new ArrayList<Person>(MAX_PEOPLE);
Random rnd = new Random(3);
for (long i = 0; i < MAX_PEOPLE; i++) {
Person person = generateRandomPerson(rnd);
AddressFuzzer.fuzz(rnd, person.getAddress());
toReturn.add(person);
}
return toReturn;
}
示例5: generateRandomPerson
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
private static Person generateRandomPerson(Random rnd) {
if (isChosenAsProfessor(rnd)) {
return generateRandomProfessor(rnd);
} else {
return generateRandomStudent(rnd);
}
}
示例6: generateRandomProfessor
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
private static Person generateRandomProfessor(Random rnd) {
Person prof = new Person();
String firstName = pickRandomString(rnd, FIRST_NAMES);
String lastName = pickRandomString(rnd, LAST_NAMES);
prof.setName("Dr. " + firstName + " " + lastName);
String subject = pickRandomString(rnd, SUBJECTS);
prof.setDescription("Professor of " + subject);
prof.setClassSchedule(ScheduleFuzzer.generateRandomSchedule(rnd));
return prof;
}
示例7: generateRandomStudent
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
private static Person generateRandomStudent(Random rnd) {
Person student = new Person();
String firstName = pickRandomString(rnd, FIRST_NAMES);
String lastName = pickRandomString(rnd, LAST_NAMES);
student.setName(firstName + " " + lastName);
String subject = pickRandomString(rnd, SUBJECTS);
student.setDescription("Majoring in " + subject);
student.setClassSchedule(ScheduleFuzzer.generateRandomSchedule(rnd));
return student;
}
示例8: init
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public void init(FilterConfig config) {
backingStore = (PersonSource) config.getServletContext().getAttribute(
SchoolCalendarService.class.getName());
if (backingStore == null) {
List<Person> randomPeople = PersonFuzzer.generateRandomPeople();
scheduleStore = ScheduleSource.of(PersonFuzzer.collectSchedules(randomPeople));
backingStore = PersonSource.of(randomPeople, scheduleStore);
config.getServletContext().setAttribute(
SchoolCalendarService.class.getName(), backingStore);
}
}
示例9: getPeople
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
@Override
public List<Person> getPeople(int startIndex, int maxCount,
List<Boolean> daysFilter) {
int peopleCount = countPeople();
int start = startIndex;
if (start >= peopleCount) {
return Collections.emptyList();
}
int end = Math.min(startIndex + maxCount, peopleCount);
if (start == end) {
return Collections.emptyList();
}
// If there's a simple filter, use a fast path
if (ALL_DAYS.equals(daysFilter)) {
return new ArrayList<Person>(people.values()).subList(start, end);
} else if (NO_DAYS.equals(daysFilter)) {
return new ArrayList<Person>();
}
/*
* Otherwise, iterate from the start position until we collect enough
* People or hit the end of the list.
*/
Iterator<Person> it = people.values().iterator();
int skipped = 0;
List<Person> toReturn = new ArrayList<Person>(maxCount);
while (toReturn.size() < maxCount && it.hasNext()) {
Person person = it.next();
if (person.getScheduleWithFilter(daysFilter).length() > 0) {
if (skipped++ < startIndex) {
continue;
}
toReturn.add(person);
}
}
return toReturn;
}
示例10: of
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
/**
* Create a PersonSource that will act directly on the given list.
*/
public static PersonSource of(List<Person> people, ScheduleSource schedules) {
PersonSource backing = new Backing(schedules);
for (Person person : people) {
backing.persist(person);
}
return backing;
}
示例11: init
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
@Override
public void init(FilterConfig config) {
backingStore = (PersonSource) config.getServletContext().getAttribute(
SchoolCalendarService.class.getName());
if (backingStore == null) {
List<Person> randomPeople = PersonFuzzer.generateRandomPeople();
scheduleStore = ScheduleSource.of(PersonFuzzer.collectSchedules(randomPeople));
backingStore = PersonSource.of(randomPeople, scheduleStore);
config.getServletContext().setAttribute(
SchoolCalendarService.class.getName(), backingStore);
}
}
示例12: generatePerson
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static Person generatePerson() {
Random rnd = new Random();
Person toReturn = generateRandomPerson(rnd);
AddressFuzzer.fuzz(rnd, toReturn.getAddress());
return toReturn;
}
示例13: createPerson
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static Person createPerson() {
checkPersonSource();
Person person = PersonFuzzer.generatePerson();
PERSON_SOURCE.get().persist(person);
return person;
}
示例14: findPerson
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static Person findPerson(String id) {
checkPersonSource();
return PERSON_SOURCE.get().findPerson(id);
}
示例15: getPeople
import com.google.gwt.sample.dynatablerf.domain.Person; //导入依赖的package包/类
public static List<Person> getPeople(int startIndex, int maxCount,
List<Boolean> filter) {
checkPersonSource();
return PERSON_SOURCE.get().getPeople(startIndex, maxCount, filter);
}