summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/uic/barcode/ticket/api/utils/NumListWrapper.java
blob: 4d48a818d4446c0c21ac6883debfdd7b74ba2ea9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package org.uic.barcode.ticket.api.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.uic.barcode.asn1.datatypesimpl.SequenceOfStringIA5;
import org.uic.barcode.ticket.EncodingFormatException;

public class NumListWrapper {
	
	private SequenceOfStringIA5 stringList = null;
	private List<Long> numList = null;
	
	public NumListWrapper(Collection<String> list, int min, int max) throws EncodingFormatException {
		
		
		if (list== null || list.isEmpty()) {
			return;
		}
		
		for (String text : list){
			String ia5 = UicEncoderUtils.getIA5RestrictedNonNum (text,min,max);
			if (ia5 != null && ia5.length() > 0) {
				if (stringList == null) {
					stringList = new SequenceOfStringIA5();
				}
				stringList.add(ia5);
			} else {
				Long l =  UicEncoderUtils.getRestrictedNum (text,min,max);
				if (l != null) {
					if (numList == null) {
						numList = new ArrayList<Long>();
					}
					numList.add(l);
				}
			}
			
		}
		return;	
		
	}

	public SequenceOfStringIA5 getStringList() {
		return stringList;
	}

	public List<Long> getNumList() {
		return numList;
	}
	
	
	

}