private synchronized void ensureRecentLocations() { if (recentLocations == null) { recentLocations = new RecentQueue<String>(MAX_RECENT); } }
public void append(final ScriptCallData data) { recentQueue.append(data); }
@Override protected List<String> getRecentUserInputs() { return getRecentCustomers().getRecents(); }
public void appendRecentTask(Integer taskId) { if (taskId == null) { return; } ensureRecentTasks(); recentTasks.setMaxSize(MAX_RECENT); // Needed, because max size will be set via xstream deserialization. recentTasks.append(taskId); }
@Test public void test() { RecentQueue<Integer> queue = new RecentQueue<Integer>(4); assertEquals("Length of queue", 0, queue.size()); assertNull(queue.get(null)); assertNull(queue.get(5)); assertNull(queue.get(-1)); checkQueue(queue); queue.append(4); checkQueue(queue, 4); queue.append(4); checkQueue(queue, 4); queue.append(3).append(2); checkQueue(queue, 2, 3, 4); queue.append(4); checkQueue(queue, 4, 2, 3); queue.append(3).append(2); checkQueue(queue, 2, 3, 4); queue.append(1); checkQueue(queue, 1, 2, 3, 4); queue.append(0); checkQueue(queue, 0, 1, 2, 3); queue.append(3); checkQueue(queue, 3, 0, 1, 2); assertEquals(new Integer(3), queue.get(null)); assertNull(queue.get(5)); assertNull(queue.get(-1)); }
public TimesheetPrefEntry getRecentEntry(Integer pos) { ensureRecents(); return recents.get(pos); }
public void setRecents(List<TimesheetPrefEntry> recents) { this.recents.setRecents(recents); }
public void initLocations(Collection<String> locations) { if (CollectionUtils.isNotEmpty(locations) == true) { ensureRecentLocations(); for (String location : locations) { if (StringUtils.isBlank(location) == true) { return; } recentLocations.addOnly(location); } } } }
public void appendRecentEntry(TimesheetPrefEntry entry) { ensureRecents(); recents.setMaxSize(MAX_RECENT); // Needed, because size will be set via xstream deserialization. recents.append(entry); }
public Integer getRecentTask(Integer pos) { ensureRecentTasks(); return recentTasks.get(pos); }
public void setRecentTasks(List<Integer> recentTasks) { this.recentTasks.setRecents(recentTasks); }
public void init(List<TimesheetDO> list) { if (CollectionUtils.isNotEmpty(list) == true) { ensureRecents(); ensureRecentTasks(); for (TimesheetDO timesheet : list) { TimesheetPrefEntry prefEntry = new TimesheetPrefEntry(timesheet); recents.addOnly(prefEntry); if (timesheet.getId() == null) { return; } recentTasks.addOnly(timesheet.getTaskId()); } } }
private synchronized void ensureRecentTasks() { if (recentTasks == null) { recentTasks = new RecentQueue<Integer>(MAX_RECENT); } }
/** * Adds the search string to the recent list, if filter is from type BaseSearchFilter and the search string is not * blank and not from type id:4711. * * @param Filter The search filter. */ protected void addRecentSearchTerm() { if (StringUtils.isNotBlank(form.searchFilter.getSearchString()) == true) { final String s = form.searchFilter.getSearchString(); if (s.startsWith("id:") == false || StringUtils.isNumeric(s.substring(3)) == false) { // OK, search string is not from type id:4711 getRecentSearchTermsQueue().append(s); } } }
@Override protected List<String> getRecentUserInputs() { return getRecentSkills().getRecents(); }
public void appendRecentLocation(String location) { if (StringUtils.isBlank(location) == true) { return; } ensureRecentLocations(); recentLocations.setMaxSize(MAX_RECENT); // Needed, because max size will be set via xstream deserialization. recentLocations.append(location); }
final String recentNumber = getRecentSearchTermsQueue().get(0); if (StringUtils.isNotBlank(recentNumber) == true) { phoneNumber = recentNumber;
private synchronized void ensureRecents() { if (recents == null) { recents = new RecentQueue<TimesheetPrefEntry>(MAX_RECENT); } }
public void markTextFieldModelAsChanged() { userTextField.modelChanged(); final PFUserDO user = getModelObject(); if (user != null) { getRecentUsers().append(formatUser(user, true)); } }