All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.unlaxer.jaddress.normalizer.Numberd Maven / Gradle / Ivy

The newest version!
package org.unlaxer.jaddress.normalizer;

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

public class Numberd {
	public final int index;

	public Numberd(int index) {
		super();
		this.index = index;
	}

	public int diff = 0;

	StringBuilder source = new StringBuilder();
	private String normalized;

	public void setNormalized(String value) {
		this.normalized = value;
		diff = normalized.length() - source.toString().length();
	}

	public String getNormalized() {
		return this.normalized;
	}

	List numlist = new ArrayList<>();
	Boolean isSum = false;

	@Override
	public String toString() {
		return "Numberd [index=" + index + ", source=" + source.toString() + ", normalized=" + normalized + ", diff=" + diff + "]";
	}

	public boolean hasValue() {
		return numlist.size() > 0;
	}

	public void addValue(int num, char c) {
		if (num >= 10) {
			isSum = true;
			int listSize = numlist.size();
			if (listSize > 0) {
				if (numlist.get(listSize - 1) < 10) {
					num = numlist.get(listSize - 1) * num;
					numlist.remove(listSize - 1);
				}
			}
		}

		source.append(c);
		numlist.add(num);

	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy