View Javadoc
1   /*
2    * Copyright 2010 Daniel Kurka
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5    * use this file except in compliance with the License. You may obtain a copy of
6    * the License at
7    * 
8    * http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations under
14   * the License.
15   */
16  package com.googlecode.mgwt.collection.shared.java;
17  
18  import com.googlecode.mgwt.collection.shared.LightArrayBoolean;
19  
20  /**
21   * 
22   * Implementation of {@link LightArrayBoolean} for java environments
23   * 
24   * @author Daniel Kurka
25   * 
26   */
27  public class JavaLightArrayBoolean implements LightArrayBoolean {
28  
29  	private JavaLightArray<Boolean> array;
30  
31    /**
32     * Construct a {@link JavaLightArrayBoolean}
33     */
34  	public JavaLightArrayBoolean() {
35  		array = new JavaLightArray<Boolean>();
36  	}
37  
38  	@Override
39  	public boolean get(int index) {
40  		Boolean boolean1 = array.get(index);
41  		if (boolean1 != null)
42  			return boolean1;
43  		return false;
44  	}
45  
46  	@Override
47  	public int length() {
48  		return array.length();
49  	}
50  
51  	@Override
52  	public void push(boolean value) {
53  		array.push(value);
54  
55  	}
56  
57  	@Override
58  	public void set(int index, boolean value) {
59  		array.set(index, value);
60  
61  	}
62  
63  	@Override
64  	public boolean shift() {
65  		Boolean shift = array.shift();
66  		if (shift != null)
67  			return shift;
68  		return false;
69  	}
70  
71  	@Override
72  	public void unshift(boolean value) {
73  		array.unshift(value);
74  
75  	}
76  
77  }