/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.ArrayList;
/**
*
* @author Paolo
*/
public class Hamming {
this.code=pCode;
}
public boolean isBinaryNum() {
for (int i = 0; i < this.code.length(); i++) {
if (this.code.charAt(i) != '0' && this.code.charAt(i) != '1') {
return false;
}
}
return true;
}
int oldLeng = old.length();
int nuovoLeng = nuovo.length();
if (nuovoLeng < oldLeng) {
for (int i = 0; i < (oldLeng - nuovoLeng); i++) {
nuovo = "0" + nuovo;
}
}
for (int i = 0; i < old.length(); i++) {
if (old.charAt(i) == nuovo.charAt(i)) {
retval = retval + "0";
} else {
retval = retval + "1";
}
}
return retval;
}
ArrayList<Integer> uni = new ArrayList<Integer>();
for (int i = 0; i < this.code.length(); i++) {
if (this.code.charAt(i) == '1') {
uni.add((this.code.length() - i));
}
}
for (int i = 1; i < uni.size(); i++) {
old = confronta(old, nuovo);
}
return old;
}
public void setCode
(String pCode
) {
this.code = pCode;
}
}