Subversion Repository Public Repository

litesoft

Diff Revisions 947 vs 948 for /trunk/Java/GWT/Client/src/com/google/gwt/gen2/table/client/ElementMapper.java

Diff revisions: vs.
  @@ -16,26 +16,23 @@
16 16
17 17 package com.google.gwt.gen2.table.client;
18 18
19 - import java.util.*;
20 -
21 19 import com.google.gwt.user.client.*;
22 20 import com.google.gwt.user.client.ui.*;
23 21
22 + import java.util.*;
23 +
24 24 /**
25 25 * Creates a mapping from elements to their associated ui objects.
26 26 *
27 27 * @param <MappedType> the type that the element is mapped to
28 28 */
29 - public class ElementMapper<MappedType extends UIObject>
30 - {
29 + public class ElementMapper<MappedType extends UIObject> {
31 30
32 - private static class FreeNode
33 - {
31 + private static class FreeNode {
34 32 int index;
35 33 ElementMapper.FreeNode next;
36 34
37 - public FreeNode( int index, ElementMapper.FreeNode next )
38 - {
35 + public FreeNode( int index, ElementMapper.FreeNode next ) {
39 36 this.index = index;
40 37 this.next = next;
41 38 }
  @@ -65,11 +62,9 @@
65 62 *
66 63 * @return the uiObject
67 64 */
68 - public MappedType get( Element elem )
69 - {
65 + public MappedType get( Element elem ) {
70 66 int index = getIndex( elem );
71 - if ( index < 0 )
72 - {
67 + if ( index < 0 ) {
73 68 return null;
74 69 }
75 70 return uiObjectList.get( index );
  @@ -80,16 +75,12 @@
80 75 *
81 76 * @param uiObject uiObject to add
82 77 */
83 - public void put( MappedType uiObject )
84 - {
78 + public void put( MappedType uiObject ) {
85 79 int index;
86 - if ( freeList == null )
87 - {
80 + if ( freeList == null ) {
88 81 index = uiObjectList.size();
89 82 uiObjectList.add( uiObject );
90 - }
91 - else
92 - {
83 + } else {
93 84 index = freeList.index;
94 85 uiObjectList.set( index, uiObject );
95 86 freeList = freeList.next;
  @@ -102,8 +93,7 @@
102 93 *
103 94 * @param elem the uiObject's element
104 95 */
105 - public void removeByElement( Element elem )
106 - {
96 + public void removeByElement( Element elem ) {
107 97 int index = getIndex( elem );
108 98 removeImpl( elem, index );
109 99 }
  @@ -113,11 +103,9 @@
113 103 *
114 104 * @return the iterator
115 105 */
116 - public Iterator<MappedType> iterator()
117 - {
106 + public Iterator<MappedType> iterator() {
118 107
119 - return new Iterator()
120 - {
108 + return new Iterator() {
121 109 int lastIndex = -1;
122 110 int nextIndex = -1;
123 111
  @@ -125,15 +113,12 @@
125 113 findNext();
126 114 }
127 115
128 - public boolean hasNext()
129 - {
116 + public boolean hasNext() {
130 117 return nextIndex < uiObjectList.size();
131 118 }
132 119
133 - public Object next()
134 - {
135 - if ( !hasNext() )
136 - {
120 + public Object next() {
121 + if ( !hasNext() ) {
137 122 throw new NoSuchElementException();
138 123 }
139 124 Object result = uiObjectList.get( nextIndex );
  @@ -142,10 +127,8 @@
142 127 return result;
143 128 }
144 129
145 - public void remove()
146 - {
147 - if ( lastIndex < 0 )
148 - {
130 + public void remove() {
131 + if ( lastIndex < 0 ) {
149 132 throw new IllegalStateException();
150 133 }
151 134 Widget w = (Widget) uiObjectList.get( lastIndex );
  @@ -154,12 +137,9 @@
154 137 lastIndex = -1;
155 138 }
156 139
157 - private void findNext()
158 - {
159 - while ( ++nextIndex < uiObjectList.size() )
160 - {
161 - if ( uiObjectList.get( nextIndex ) != null )
162 - {
140 + private void findNext() {
141 + while ( ++nextIndex < uiObjectList.size() ) {
142 + if ( uiObjectList.get( nextIndex ) != null ) {
163 143 return;
164 144 }
165 145 }
  @@ -167,8 +147,7 @@
167 147 };
168 148 }
169 149
170 - private void removeImpl( Element elem, int index )
171 - {
150 + private void removeImpl( Element elem, int index ) {
172 151 clearIndex( elem );
173 152 uiObjectList.set( index, null );
174 153 freeList = new FreeNode( index, freeList );