KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > databinding > provisional > observable > list > ListDiffEntry


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 package org.eclipse.jface.internal.databinding.provisional.observable.list;
13
14 /**
15  * A single addition of an element to a list or removal of an element from a list.
16  *
17  * @since 1.0
18  */

19 public abstract class ListDiffEntry {
20     
21     /**
22      * @return the 0-based position of the addition or removal
23      */

24     public abstract int getPosition();
25     
26     /**
27      * @return true if this represents an addition, false if this represents a removal
28      */

29     public abstract boolean isAddition();
30     
31     /**
32      * @return the element that was added or removed
33      */

34     public abstract Object JavaDoc getElement();
35     
36     /**
37      * @see java.lang.Object#toString()
38      */

39     public String JavaDoc toString() {
40         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc();
41         buffer
42             .append(this.getClass().getName())
43             .append("{position [") //$NON-NLS-1$
44
.append(getPosition())
45             .append("], isAddition [") //$NON-NLS-1$
46
.append(isAddition())
47             .append("], element [") //$NON-NLS-1$
48
.append(getElement() != null ? getElement().toString() : "null") //$NON-NLS-1$
49
.append("]}"); //$NON-NLS-1$
50

51         return buffer.toString();
52     }
53 }
54
Popular Tags