comparison org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/list/ListDiffEntry.d @ 78:0a55d2d5a946

Added file for databinding
author Frank Benoit <benoit@tionex.de>
date Tue, 14 Apr 2009 11:35:29 +0200
parents
children 6be48cf9f95c
comparison
equal deleted inserted replaced
76:f05e6e8b2f2d 78:0a55d2d5a946
1 /*******************************************************************************
2 * Copyright (c) 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11
12 module org.eclipse.core.databinding.observable.list.ListDiffEntry;
13
14 import java.lang.all;
15
16 /**
17 * A single addition of an element to a list or removal of an element from a list.
18 *
19 * @since 1.0
20 */
21 public abstract class ListDiffEntry {
22
23 /**
24 * @return the 0-based position of the addition or removal
25 */
26 public abstract int getPosition();
27
28 /**
29 * @return true if this represents an addition, false if this represents a removal
30 */
31 public abstract bool isAddition();
32
33 /**
34 * @return the element that was added or removed
35 */
36 public abstract Object getElement();
37
38 /**
39 * @see java.lang.Object#toString()
40 */
41 public String toString() {
42 StringBuffer buffer = new StringBuffer();
43 buffer
44 .append(this.getClass().getName())
45 .append("{position [") //$NON-NLS-1$
46 .append(getPosition())
47 .append("], isAddition [") //$NON-NLS-1$
48 .append(isAddition())
49 .append("], element [") //$NON-NLS-1$
50 .append(getElement() !is null ? getElement().toString() : "null") //$NON-NLS-1$
51 .append("]}"); //$NON-NLS-1$
52
53 return buffer.toString();
54 }
55 }