public ZipCode ZipRowToZipCode(ZipRow row) { ZipCode zip = new ZipCode(row.ZipCode); return zip; }
private static ZipRow CompressRowPattern(List <Dot> rowPattern1, List <Dot> rowPattern2, int scaler1, int scaler2) { ZipRow zRowPattern = new ZipRow(); for (int i = 0; i < rowPattern1.Count; i++) { ZipDot zDot = new ZipDot(); zDot.simbol = rowPattern1[i].simbol; // if pattern is static number if (rowPattern1[i].count == rowPattern2[i].count) { zDot.count = rowPattern1[i].count; zDot.patternType = "static"; } // if scaller is smaller than pattern else if (rowPattern1[i].count >= scaler1) { zDot.ScalerIsBigger = false; // if pattern is scaler + or - number if (rowPattern1[i].count - scaler1 == rowPattern2[i].count - scaler2) { zDot.count = rowPattern1[i].count - scaler1; zDot.patternType = "numberMinusScaler"; } // if pattern is scaler * or / by number else if (rowPattern1[i].count / scaler1 == rowPattern2[i].count / scaler2) { zDot.count = rowPattern1[i].count / scaler1; zDot.patternType = "numberDividedByScaler"; if (rowPattern1[i].count % scaler1 == rowPattern2[i].count % scaler2) { zDot.reminder = rowPattern1[i].count % scaler1; } else { throw new Exception("not implemented 1"); } } else { throw new Exception("not implemented 2"); } } // if scaller is bigger than pattern else if (rowPattern1[i].count < scaler1) { zDot.ScalerIsBigger = true; // if pattern is scaler + or - number if (scaler1 - rowPattern1[i].count == scaler2 - rowPattern2[i].count) { zDot.count = scaler1 - rowPattern1[i].count; zDot.patternType = "scalerMinusNumber"; } // if pattern is scaler * or / by number if (scaler1 / rowPattern1[i].count == scaler2 / rowPattern2[i].count) { zDot.count = scaler1 / rowPattern1[i].count; zDot.patternType = "scalerDividedByNumber"; if (scaler1 % rowPattern1[i].count == scaler2 % rowPattern2[i].count) { zDot.reminder = scaler1 % rowPattern1[i].count; } else { throw new Exception("not implemented x"); } } } zRowPattern.pattern.Add(zDot); } return(zRowPattern); }
public ZipCode ZipRowToZipCode(ZipRow row) { ZipCode zip = new ZipCode(row.ZipCode); return(zip); }