2 * Copyright (C) 2010 ZXing authors
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 * These authors would like to acknowledge the Spanish Ministry of Industry,
19 * Tourism and Trade, for the support in the project TSI020301-2008-2
20 * "PIRAmIDE: Personalizable Interactions with Resources on AmI-enabled
21 * Mobile Dynamic Environments", led by Treelogic
22 * ( http://www.treelogic.com/ ):
24 * http://www.piramidepse.com/
27 package com.google.zxing.oned.rss.expanded;
29 import java.util.Vector;
31 import com.google.zxing.common.BitArray;
34 * @author Pablo Orduña, University of Deusto (pablo.orduna@deusto.es)
35 * @author Eduardo Castillejo, University of Deusto (eduardo.castillejo@deusto.es)
37 final class BitArrayBuilder {
39 private BitArrayBuilder() {
42 static BitArray buildBitArray(Vector pairs) {
43 int charNumber = (pairs.size() << 1) - 1;
44 if ((((ExpandedPair)pairs.lastElement()).getRightChar()) == null) {
48 int size = 12 * charNumber;
50 BitArray binary = new BitArray(size);
53 ExpandedPair firstPair = (ExpandedPair)pairs.get(0);
54 int firstValue = firstPair.getRightChar().getValue();
55 for(int i = 11; i >= 0; --i){
56 if ((firstValue & (1 << i)) != 0) {
62 for(int i = 1; i < pairs.size(); ++i){
63 ExpandedPair currentPair = (ExpandedPair)pairs.get(i);
65 int leftValue = currentPair.getLeftChar().getValue();
66 for(int j = 11; j >= 0; --j){
67 if ((leftValue & (1 << j)) != 0) {
73 if(currentPair.getRightChar() != null){
74 int rightValue = currentPair.getRightChar().getValue();
75 for(int j = 11; j >= 0; --j){
76 if ((rightValue & (1 << j)) != 0) {