/** * @param source the List whose element at position <code>index</code> is returned * @param index the position of the element in <code>source</code> to be returned * @param defaultValue the value of the calculation if the list does not contain <code>index+1</code> entries */ public ElementAt(EventList<E> source, int index, E defaultValue) { super(source.size() > index ? source.get(index) : defaultValue); this.source = source; this.index = index; this.defaultValue = defaultValue; this.source.addListEventListener(this); }
/** {@inheritDoc} */ public Object replaceElements(Object original, Object target, CollectionPersister persister, Object owner, Map copyCache, SessionImplementor session) throws HibernateException { final EventList result = (EventList) target; final EventList source = (EventList) original; result.clear(); result.addAll(source); return result; }
/** {@inheritDoc} */ @Override public boolean contains(Object object) { return source.contains(object); }
public AveragePriceReportList(FIXMessageFactory messageFactory, EventList<ReportHolder> source) { super(source.getPublisher()); this.mMessageFactory = messageFactory; source.addListEventListener(this); readWriteLock = source.getReadWriteLock(); } public void listChanged(ListEvent<ReportHolder> listChanges) {
@Override public void run() { try { contractItemEventList.getReadWriteLock().writeLock().lock(); contractItemEventList.clear(); contractItemEventList.addAll(contractItems); } finally { contractItemEventList.getReadWriteLock().writeLock().unlock(); } } });
/** {@inheritDoc} */ @Override public void add(int index, E value) { if(!isWritable()) throw new IllegalStateException("Non-writable List cannot be modified"); if(index < 0 || index > size()) throw new IndexOutOfBoundsException("Cannot add at " + index + " on list of size " + size()); final int sourceIndex = index < size() ? getSourceIndex(index) : source.size(); source.add(sourceIndex, (S) value); }
/** {@inheritDoc} */ @Override public void add(int index, E value) { source.add(index, reverse(value)); }
/** * @param source the List whose size is reported as the value of this * Calculation */ public Count(EventList source) { super(new Integer(source.size())); this.source = source; this.source.addListEventListener(this); }
/** * {@inheritDoc} */ @Override public void clear() { source.getReadWriteLock().writeLock().lock(); try { source.clear(); } finally { source.getReadWriteLock().writeLock().unlock(); } }
/** * Returns the column key for a given index. * * @param column the column index (zero-based) * @return the column key * * @throws IndexOutOfBoundsException if <code>column</code> is out of bounds */ public Comparable getColumnKey(int column) { return columnKeys.get(column); }
public static <E> boolean contains(EventList<E> eventList, E e) { try { eventList.getReadWriteLock().readLock().lock(); return eventList.contains(e); } finally { eventList.getReadWriteLock().readLock().unlock(); } } public static <E> int size(EventList<E> eventList) {
protected void updateStat() { BusMonitoringStat stat = new BusMonitoringStat(new DateTime(), this.count, this.maximum); Lock lock = this.statList.getReadWriteLock().writeLock(); lock.lock(); try { this.statList.add(stat); } finally { lock.unlock(); } }
/** * Creates a {@link ReadOnlyList} to provide a view of an {@link EventList} * that does not allow write operations. */ public ReadOnlyList(EventList<E> source) { super(source); source.addListEventListener(this); }
/** * {@inheritDoc} */ @Override public E remove(int index) { source.getReadWriteLock().writeLock().lock(); try { return source.remove(index); } finally { source.getReadWriteLock().writeLock().unlock(); } }
public static <E> int indexOf(EventList<E> eventList, Object object) { try { eventList.getReadWriteLock().readLock().lock(); return eventList.indexOf(object); } finally { eventList.getReadWriteLock().readLock().unlock(); } } }
/** * Returns the column index for the column of the data value to retrieve. */ public int getColumnIndex() { if (columnIndex == -1) columnIndex = columnKeys.indexOf(columnKey); return columnIndex; }
@Override public void actionPerformed(ActionEvent actionEvent) { sillyObjects.remove(sillyObject); } }
/** * Returns the number of rows in the table. */ public int getRowCount() { return rowKeys.size(); }
/** {@inheritDoc} */ @Override public ReadWriteLock getReadWriteLock() { return delegate.getReadWriteLock(); }
/** * Rebuild the CompositeMatcher modelled by this editor. */ private Matcher<E> rebuildMatcher() { final Matcher[] matchers = new Matcher[matcherEditors.size()]; for (int i = 0, n = matcherEditors.size(); i < n; i++) { matchers[i] = matcherEditors.get(i).getMatcher(); } if(mode == AND) return Matchers.and(matchers); else if(mode == OR) return Matchers.or(matchers); else throw new IllegalStateException(); }