PageRenderTime 69ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 1ms

/bs-cs-ufal-brazil/classes/systems-analysis-design/bibliweb/src/br/ufal/bibliweb/barcode/linear/BarCode.java

http://marcellodesales-cs-research.googlecode.com/
Java | 2100 lines | 1959 code | 141 blank | 0 comment | 638 complexity | 1028ff57535babdc7a822ecb20630fae MD5 | raw file
Possible License(s): LGPL-2.1
  1. package br.ufal.bibliweb.barcode.linear;
  2. import java.awt.*;
  3. import java.awt.image.MemoryImageSource;
  4. import java.awt.image.PixelGrabber;
  5. import java.io.PrintStream;
  6. import java.io.Serializable;
  7. public class BarCode extends Canvas
  8. implements Serializable
  9. {
  10. public BarCode()
  11. {
  12. barType = 13;
  13. code = "";
  14. codeSup = "";
  15. checkCharacter = true;
  16. checkCharacterInText = true;
  17. postnetHeightTallBar = 0.29999999999999999D;
  18. postnetHeightShortBar = 0.125D;
  19. leftMarginCM = 0.20000000000000001D;
  20. topMarginCM = 0.5D;
  21. leftMarginPixels = 0;
  22. topMarginPixels = 0;
  23. leftGuardBar = 0;
  24. centerGuardBarStart = 0;
  25. centerGuardBarEnd = 0;
  26. rightGuardBar = 0;
  27. endOfCode = 0;
  28. supplement = "";
  29. guardBars = true;
  30. backColor = Color.white;
  31. codeText = "";
  32. narrowBarPixels = 0;
  33. widthBarPixels = 0;
  34. narrowBarCM = 0.0D;
  35. widthBarCM = 0.0D;
  36. resolution = (int)((double)getToolkit().getScreenResolution() / 2.54D);
  37. barHeightPixels = 0;
  38. barHeightCM = 0.0D;
  39. width = 170;
  40. height = 70;
  41. pWidth = width;
  42. pHeight = height;
  43. textFont = new Font("Arial", 0, 11);
  44. fontColor = Color.black;
  45. barColor = Color.black;
  46. extraHeight = 0;
  47. UPCESytem = '1';
  48. CODABARStartChar = 'A';
  49. CODABARStopChar = 'B';
  50. UPCEANSupplement2 = false;
  51. UPCEANSupplement5 = false;
  52. Code128Set = '0';
  53. X = 0.029999999999999999D;
  54. N = 2D;
  55. I = 1.0D;
  56. H = 0.45000000000000001D;
  57. L = 0.0D;
  58. rotate = 0;
  59. supSeparationCM = 0.5D;
  60. supHeight = 0.80000000000000004D;
  61. currentX = 0;
  62. currentY = 0;
  63. }
  64. public void setSymbologyID(int i)
  65. {
  66. barType = i;
  67. invalidate();
  68. }
  69. public int getSymbologyID()
  70. {
  71. return barType;
  72. }
  73. public void setDataToEncode(String s)
  74. {
  75. code = s;
  76. invalidate();
  77. }
  78. public String getDataToEncode()
  79. {
  80. return code;
  81. }
  82. public void setCheckCharacter(boolean flag)
  83. {
  84. checkCharacter = flag;
  85. invalidate();
  86. }
  87. public boolean getCheckCharacter()
  88. {
  89. return checkCharacter;
  90. }
  91. public void setCheckCharacterInText(boolean flag)
  92. {
  93. checkCharacterInText = flag;
  94. invalidate();
  95. }
  96. public boolean getCheckCharacterInText()
  97. {
  98. return checkCharacterInText;
  99. }
  100. public void setPostnetHeightTall(double d1)
  101. {
  102. postnetHeightTallBar = d1;
  103. invalidate();
  104. }
  105. public double getPostnetHeightTall()
  106. {
  107. return postnetHeightTallBar;
  108. }
  109. public void setPostnetHeightShort(double d1)
  110. {
  111. postnetHeightShortBar = d1;
  112. invalidate();
  113. }
  114. public double getPostnetHeightShort()
  115. {
  116. return postnetHeightShortBar;
  117. }
  118. public void setLeftMarginCM(double d1)
  119. {
  120. leftMarginCM = d1;
  121. invalidate();
  122. }
  123. public double getLeftMarginCM()
  124. {
  125. return leftMarginCM;
  126. }
  127. public void setTopMarginCM(double d1)
  128. {
  129. topMarginCM = d1;
  130. invalidate();
  131. }
  132. public double getTopMarginCM()
  133. {
  134. return topMarginCM;
  135. }
  136. public void setSupplementToEncode(String s)
  137. {
  138. supplement = s;
  139. invalidate();
  140. }
  141. public String getSupplementToEncode()
  142. {
  143. return supplement;
  144. }
  145. public void setBackground(Color color)
  146. {
  147. backColor = color;
  148. invalidate();
  149. }
  150. public Color getBackground()
  151. {
  152. return backColor;
  153. }
  154. public void setPixelsPerCM(int i)
  155. {
  156. resolution = i;
  157. invalidate();
  158. }
  159. public int getPixelsPerCM()
  160. {
  161. return resolution;
  162. }
  163. public void setBarHeightCM(double d1)
  164. {
  165. barHeightCM = d1;
  166. invalidate();
  167. }
  168. public double getBarHeightCM()
  169. {
  170. return barHeightCM;
  171. }
  172. public Dimension getPreferredSize()
  173. {
  174. return new Dimension(pWidth, pHeight);
  175. }
  176. public Dimension getMinimumSize()
  177. {
  178. Dimension dimension = new Dimension(10, 10);
  179. return dimension;
  180. }
  181. public void setFont(Font font)
  182. {
  183. textFont = font;
  184. invalidate();
  185. }
  186. public Font getFont()
  187. {
  188. return textFont;
  189. }
  190. public void setTextFontColor(Color color)
  191. {
  192. fontColor = color;
  193. invalidate();
  194. }
  195. public Color getTextFontColor()
  196. {
  197. return fontColor;
  198. }
  199. public void setForeground(Color color)
  200. {
  201. barColor = color;
  202. invalidate();
  203. }
  204. public Color getForeground()
  205. {
  206. return barColor;
  207. }
  208. public void setUPCESytem(String s)
  209. {
  210. if(s.equals("0"))
  211. UPCESytem = '0';
  212. if(s.equals("1"))
  213. UPCESytem = '1';
  214. invalidate();
  215. }
  216. public String getUPCESytem()
  217. {
  218. String s = "";
  219. if(UPCESytem == '0')
  220. s = "0";
  221. if(UPCESytem == '1')
  222. s = "1";
  223. return s;
  224. }
  225. public void setCODABARStartChar(String s)
  226. {
  227. if(s.equals("B"))
  228. CODABARStartChar = 'B';
  229. if(s.equals("A"))
  230. CODABARStartChar = 'A';
  231. if(s.equals("C"))
  232. CODABARStartChar = 'C';
  233. if(s.equals("D"))
  234. CODABARStartChar = 'D';
  235. invalidate();
  236. }
  237. public String getCODABARStartChar()
  238. {
  239. String s = "";
  240. if(CODABARStartChar == 'B')
  241. s = "B";
  242. if(CODABARStartChar == 'A')
  243. s = "A";
  244. if(CODABARStartChar == 'C')
  245. s = "C";
  246. if(CODABARStartChar == 'D')
  247. s = "D";
  248. return s;
  249. }
  250. public void setCODABARStopChar(String s)
  251. {
  252. if(s.equals("B"))
  253. CODABARStopChar = 'B';
  254. if(s.equals("A"))
  255. CODABARStopChar = 'A';
  256. if(s.equals("C"))
  257. CODABARStopChar = 'C';
  258. if(s.equals("D"))
  259. CODABARStopChar = 'D';
  260. invalidate();
  261. }
  262. public String getCODABARStopChar()
  263. {
  264. String s = "";
  265. if(CODABARStopChar == 'B')
  266. s = "B";
  267. if(CODABARStopChar == 'A')
  268. s = "A";
  269. if(CODABARStopChar == 'C')
  270. s = "C";
  271. if(CODABARStopChar == 'D')
  272. s = "D";
  273. return s;
  274. }
  275. public void setUPCEANSupplement2(boolean flag)
  276. {
  277. UPCEANSupplement2 = flag;
  278. invalidate();
  279. }
  280. public boolean getUPCEANSupplement2()
  281. {
  282. return UPCEANSupplement2;
  283. }
  284. public void setUPCEANSupplement5(boolean flag)
  285. {
  286. UPCEANSupplement5 = flag;
  287. invalidate();
  288. }
  289. public boolean getUPCEANSupplement5()
  290. {
  291. return UPCEANSupplement5;
  292. }
  293. public void setCode128Set(String s)
  294. {
  295. if(s.toUpperCase().equals("B"))
  296. Code128Set = 'B';
  297. if(s.toUpperCase().equals("A"))
  298. Code128Set = 'A';
  299. if(s.toUpperCase().equals("C"))
  300. Code128Set = 'C';
  301. if(s.toUpperCase().equals("AUTO"))
  302. Code128Set = '0';
  303. if(s.toUpperCase().equals("0"))
  304. Code128Set = '0';
  305. invalidate();
  306. }
  307. public String getCode128Set()
  308. {
  309. String s = "";
  310. if(Code128Set == 'B')
  311. s = "B";
  312. if(Code128Set == 'A')
  313. s = "A";
  314. if(Code128Set == 'C')
  315. s = "C";
  316. if(Code128Set == '0')
  317. s = "0";
  318. return s;
  319. }
  320. public void setXDimensionCM(double d1)
  321. {
  322. X = d1;
  323. invalidate();
  324. }
  325. public double getXDimensionCM()
  326. {
  327. return X;
  328. }
  329. public void setNarrowToWideRatio(double d1)
  330. {
  331. N = d1;
  332. invalidate();
  333. }
  334. public double getNarrowToWideRatio()
  335. {
  336. return N;
  337. }
  338. public void setRotationAngle(int i)
  339. {
  340. rotate = i;
  341. invalidate();
  342. }
  343. public int getRotationAngle()
  344. {
  345. return rotate;
  346. }
  347. protected void addBar(Graphics g, int i, boolean flag, int j)
  348. {
  349. if(flag)
  350. {
  351. g.setColor(barColor);
  352. g.fillRect(currentX, topMarginPixels + j, i, (barHeightPixels + extraHeight) - j);
  353. }
  354. currentX = currentX + i;
  355. }
  356. protected void paintPostNetChar(Graphics g, String s)
  357. {
  358. int i = (int)(postnetHeightTallBar * (double)resolution);
  359. int j = (int)(postnetHeightShortBar * (double)resolution);
  360. g.setColor(barColor);
  361. for(int k = 0; k < s.length(); k++)
  362. {
  363. char c = s.charAt(k);
  364. if(c == '0')
  365. g.fillRect(currentX, topMarginPixels, narrowBarPixels, j + extraHeight);
  366. if(c == '1')
  367. g.fillRect(currentX, topMarginPixels + (j - i), narrowBarPixels, i + extraHeight);
  368. currentX = currentX + narrowBarPixels;
  369. currentX = currentX + widthBarPixels;
  370. }
  371. }
  372. protected void paintPOSTNET(Graphics g)
  373. {
  374. boolean flag = false;
  375. int j = 0;
  376. String s2 = code;
  377. paintPostNetChar(g, "1");
  378. for(int k = code.length() - 1; k >= 0; k--)
  379. {
  380. String s = "" + code.charAt(k);
  381. j += findChar(setPOSTNET, s);
  382. }
  383. int l = (int)mod(j, 10D);
  384. if(l != 0)
  385. l = 10 - l;
  386. if(checkCharacter)
  387. s2 = s2 + (new Integer(l)).toString();
  388. for(int i1 = 0; i1 < s2.length(); i1++)
  389. {
  390. String s1 = "" + s2.charAt(i1);
  391. int i = findChar(setPOSTNET, s1);
  392. paintPostNetChar(g, setPOSTNET[i][1]);
  393. }
  394. paintPostNetChar(g, "1");
  395. }
  396. protected int findChar(String as[][], String s)
  397. {
  398. for(int i = 0; i < as.length; i++)
  399. if(s.compareTo(as[i][0]) == 0)
  400. return i;
  401. return -1;
  402. }
  403. protected void paintPLANET(Graphics g)
  404. {
  405. boolean flag = false;
  406. int j = 0;
  407. String s2 = code;
  408. paintPostNetChar(g, "1");
  409. for(int k = code.length() - 1; k >= 0; k--)
  410. {
  411. String s = "" + code.charAt(k);
  412. j += findChar(setPLANET, s);
  413. }
  414. int l = (int)mod(j, 10D);
  415. if(l != 0)
  416. l = 10 - l;
  417. if(checkCharacter)
  418. s2 = s2 + (new Integer(l)).toString();
  419. for(int i1 = 0; i1 < s2.length(); i1++)
  420. {
  421. String s1 = "" + s2.charAt(i1);
  422. int i = findChar(setPLANET, s1);
  423. paintPostNetChar(g, setPLANET[i][1]);
  424. }
  425. paintPostNetChar(g, "1");
  426. }
  427. protected void paintInterleaved25(Graphics g)
  428. {
  429. boolean flag = false;
  430. boolean flag1 = false;
  431. boolean flag2 = false;
  432. String s3 = code;
  433. paintChar(g, "bwbw", "nnnn");
  434. String s4 = "";
  435. if(mod(code.length(), 2D) == 0.0D && checkCharacter)
  436. s3 = "0" + code;
  437. if(mod(code.length(), 2D) == 1.0D && !checkCharacter)
  438. s3 = "0" + code;
  439. int k = 0;
  440. int l = 0;
  441. boolean flag3 = true;
  442. for(int i1 = s3.length() - 1; i1 >= 0; i1--)
  443. {
  444. String s = "" + s3.charAt(i1);
  445. if(flag3)
  446. k += findChar(set25, s);
  447. else
  448. l += findChar(set25, s);
  449. flag3 = !flag3;
  450. }
  451. int j1 = k * 3 + l;
  452. j1 = (int)mod(j1, 10D);
  453. if(j1 != 0)
  454. j1 = 10 - j1;
  455. if(checkCharacter)
  456. s3 = s3 + (new Integer(j1)).toString();
  457. for(int k1 = 0; k1 < s3.length(); k1 += 2)
  458. {
  459. String s1 = "" + s3.charAt(k1);
  460. String s2 = "" + s3.charAt(k1 + 1);
  461. int i = findChar(set25, s1);
  462. int j = findChar(set25, s2);
  463. for(int l1 = 0; l1 < 5; l1++)
  464. {
  465. paintChar(g, "b", "" + set25[i][1].charAt(l1));
  466. paintChar(g, "w", "" + set25[j][1].charAt(l1));
  467. }
  468. }
  469. paintChar(g, "bwb", "wnn");
  470. if(checkCharacterInText)
  471. codeText = s3;
  472. else
  473. codeText = code;
  474. }
  475. protected void paintIND25(Graphics g)
  476. {
  477. boolean flag = false;
  478. boolean flag1 = false;
  479. String s2 = code;
  480. paintChar(g, "bwbwbw", "wwwwnw");
  481. int j = 0;
  482. int k = 0;
  483. boolean flag2 = true;
  484. for(int l = s2.length() - 1; l >= 0; l--)
  485. {
  486. String s = "" + s2.charAt(l);
  487. if(flag2)
  488. j += findChar(set25, s);
  489. else
  490. k += findChar(set25, s);
  491. flag2 = !flag2;
  492. }
  493. int i1 = j * 3 + k;
  494. i1 = (int)mod(i1, 10D);
  495. if(i1 != 0)
  496. i1 = 10 - i1;
  497. if(checkCharacter)
  498. s2 = s2 + (new Integer(i1)).toString();
  499. for(int j1 = 0; j1 < s2.length(); j1++)
  500. {
  501. String s1 = "" + s2.charAt(j1);
  502. int i = findChar(set25, s1);
  503. if(i >= 0)
  504. {
  505. for(int k1 = 0; k1 < set25[i][1].length(); k1++)
  506. {
  507. paintChar(g, "b", "" + set25[i][1].charAt(k1));
  508. paintChar(g, "w", "w");
  509. }
  510. }
  511. }
  512. paintChar(g, "bwbwb", "wwnww");
  513. }
  514. protected String UPCEANCheck(String s)
  515. {
  516. boolean flag = true;
  517. int i = 0;
  518. int j = 0;
  519. int k = 0;
  520. for(int l = s.length() - 1; l >= 0; l--)
  521. {
  522. if(flag)
  523. i += (new Integer("" + s.charAt(l))).intValue();
  524. else
  525. j += (new Integer("" + s.charAt(l))).intValue();
  526. flag = !flag;
  527. }
  528. j = i * 3 + j;
  529. k = (int)mod(j, 10D);
  530. if(k != 0)
  531. k = 10 - k;
  532. return "" + k;
  533. }
  534. protected void paintUPCA(Graphics g)
  535. {
  536. boolean flag = false;
  537. boolean flag1 = false;
  538. if(code.length() == 13)
  539. {
  540. supplement = code.substring(11, 13);
  541. UPCEANSupplement2 = true;
  542. code = code.substring(0, 11);
  543. }
  544. if(code.length() == 14)
  545. {
  546. supplement = code.substring(12, 14);
  547. UPCEANSupplement2 = true;
  548. code = code.substring(0, 11);
  549. }
  550. if(code.length() == 16)
  551. {
  552. supplement = code.substring(11, 16);
  553. UPCEANSupplement5 = true;
  554. code = code.substring(0, 11);
  555. }
  556. if(code.length() == 17)
  557. {
  558. supplement = code.substring(12, 17);
  559. UPCEANSupplement5 = true;
  560. code = code.substring(0, 11);
  561. }
  562. code = code.substring(0, 11) + UPCEANCheck(code);
  563. paintGuardChar(g, "bwb", "nnn", 0);
  564. leftGuardBar = currentX;
  565. for(int k = 0; k < code.length(); k++)
  566. {
  567. String s = "" + code.charAt(k);
  568. byte byte0 = -1;
  569. if(k <= 5)
  570. {
  571. int i = findChar(setUPCALeft, s);
  572. paintChar(g, "wbwb", setUPCALeft[i][1]);
  573. } else
  574. {
  575. int j = findChar(setUPCARight, s);
  576. paintChar(g, "bwbw", setUPCARight[j][1]);
  577. }
  578. if(k == 5)
  579. {
  580. centerGuardBarStart = currentX;
  581. paintGuardChar(g, "wbwbw", "nnnnn", 0);
  582. centerGuardBarEnd = currentX;
  583. }
  584. }
  585. rightGuardBar = currentX;
  586. paintGuardChar(g, "bwb", "nnn", 0);
  587. endOfCode = currentX;
  588. if(UPCEANSupplement2)
  589. paintSup2(g, code.substring(1, 3));
  590. else
  591. if(UPCEANSupplement5)
  592. paintSup5(g, code.substring(1, 6));
  593. }
  594. protected void paintEAN13(Graphics g)
  595. {
  596. int i = 0;
  597. boolean flag = false;
  598. if(code.length() == 12 && checkCharacter)
  599. code = code + UPCEANCheck(code);
  600. if(code.length() < 13)
  601. return;
  602. paintGuardChar(g, "bwb", "nnn", 0);
  603. leftGuardBar = currentX;
  604. String s1 = setEANCode[(new Integer("" + code.charAt(0))).intValue()];
  605. i = findChar(setEANLeftA, "" + code.charAt(1));
  606. paintChar(g, "wbwb", setEANLeftA[i][1]);
  607. for(int j = 2; j < 12; j++)
  608. {
  609. String s = "" + code.charAt(j);
  610. i = -1;
  611. if(j <= 6)
  612. {
  613. String as[][] = setEANLeftA;
  614. if(s1.charAt(j - 2) == 'B')
  615. as = setEANLeftB;
  616. i = findChar(as, s);
  617. paintChar(g, "wbwb", as[i][1]);
  618. } else
  619. {
  620. i = findChar(setEANRight, s);
  621. paintChar(g, "bwbw", setEANRight[i][1]);
  622. }
  623. if(j == 6)
  624. {
  625. centerGuardBarStart = currentX;
  626. paintGuardChar(g, "wbwbw", "nnnnn", 0);
  627. centerGuardBarEnd = currentX;
  628. }
  629. }
  630. i = findChar(setEANRight, "" + code.charAt(12));
  631. paintChar(g, "bwbw", setEANRight[i][1]);
  632. rightGuardBar = currentX;
  633. paintGuardChar(g, "bwb", "nnn", 0);
  634. endOfCode = currentX;
  635. if(UPCEANSupplement2)
  636. paintSup2(g, code.substring(2, 4));
  637. else
  638. if(UPCEANSupplement5)
  639. paintSup5(g, code.substring(2, 7));
  640. }
  641. private int C0(String as[], String s)
  642. {
  643. for(int i = 0; i < as.length; i++)
  644. if(as[i].compareTo(s) == 0)
  645. return i;
  646. return -1;
  647. }
  648. protected void paintCode128(Graphics g)
  649. {
  650. boolean flag = false;
  651. boolean flag1 = false;
  652. String s2 = code;
  653. codeText = code;
  654. boolean flag2 = false;
  655. boolean flag3 = false;
  656. int k1 = code.length();
  657. String as[] = set128B;
  658. int l1 = 103;
  659. if(Code128Set != '0')
  660. {
  661. s2 = "";
  662. codeText = "";
  663. for(int i2 = 1; i2 <= k1; i2++)
  664. {
  665. int l = code.charAt(i2 - 1);
  666. if(l < 32 && l >= 0)
  667. {
  668. if(Code128Set == 'A')
  669. s2 = s2 + (char)(l + 96);
  670. if(Code128Set == 'B')
  671. if(code.charAt(i2) < ' ')
  672. {
  673. s2 = s2 + '\311' + (char)(l + 96) + (char)(code.charAt(i2) + 96) + '\310';
  674. i2++;
  675. } else
  676. {
  677. s2 = s2 + '\311' + (char)(l + 96) + '\310';
  678. }
  679. if(Code128Set == 'C')
  680. if(code.charAt(i2) < ' ')
  681. {
  682. s2 = s2 + '\311' + '\311' + (l + 64) + (code.charAt(i2) + 64) + "99";
  683. i2++;
  684. } else
  685. {
  686. s2 = s2 + '\311' + '\311' + (l + 64) + "99";
  687. }
  688. if(l == 13 || l == 9)
  689. codeText = codeText + " ";
  690. } else
  691. {
  692. codeText = codeText + (char)l;
  693. s2 = s2 + (char)l;
  694. }
  695. }
  696. }
  697. if(Code128Set == '0')
  698. {
  699. as = set128B;
  700. codeText = "";
  701. s2 = "";
  702. char c2 = '\314';
  703. byte byte0 = 66;
  704. char c = code.charAt(0);
  705. if(c < ' ')
  706. c2 = '\313';
  707. if(c > '\037' && c < '\177')
  708. c2 = '\314';
  709. if(k1 > 3 && c > '/' && c < ':' && code.charAt(1) > '/' && code.charAt(1) < ':' && code.charAt(2) > '/' && code.charAt(2) < ':' && code.charAt(3) > '/' && code.charAt(3) < ':')
  710. c2 = '\315';
  711. if(c == '\312')
  712. c2 = '\315';
  713. if(c2 == '\313')
  714. {
  715. byte0 = 65;
  716. l1 = 103;
  717. paintChar(g, "bwbwbw", "211412");
  718. }
  719. if(c2 == '\314')
  720. {
  721. byte0 = 66;
  722. l1 = 104;
  723. paintChar(g, "bwbwbw", "211214");
  724. }
  725. if(c2 == '\315')
  726. {
  727. byte0 = 67;
  728. l1 = 105;
  729. paintChar(g, "bwbwbw", "211232");
  730. }
  731. for(int l2 = 1; l2 <= k1; l2++)
  732. {
  733. int i1 = code.charAt(l2 - 1);
  734. if(l2 < k1 - 1 && i1 == 202)
  735. s2 = s2 + (char)i1;
  736. else
  737. if(l2 <= k1 - 3 && i1 > 47 && i1 < 58 && code.charAt(l2) > '/' && code.charAt(l2) < ':' && code.charAt(l2 + 1) > '/' && code.charAt(l2 + 1) < ':' && code.charAt(l2 + 2) > '/' && code.charAt(l2 + 2) < ':' || l2 <= k1 - 1 && i1 > 47 && i1 < 58 && code.charAt(l2) > '/' && code.charAt(l2) < ':' && byte0 == 67)
  738. {
  739. if(byte0 != 67)
  740. {
  741. s2 = s2 + '\307';
  742. byte0 = 67;
  743. }
  744. i1 = (code.charAt(l2 - 1) - 48) * 10 + (code.charAt(l2) - 48);
  745. if(i1 < 95 && i1 >= 0)
  746. s2 = s2 + (char)(i1 + 32);
  747. else
  748. if(i1 > 94)
  749. s2 = s2 + (char)(i1 + 100);
  750. l2++;
  751. } else
  752. if(l2 <= k1 && (i1 < 32 || byte0 == 65 && i1 < 96))
  753. {
  754. if(byte0 != 65)
  755. {
  756. s2 = s2 + '\311';
  757. byte0 = 65;
  758. }
  759. if(i1 < 32)
  760. s2 = s2 + (char)(i1 + 96);
  761. else
  762. if(i1 > 31)
  763. s2 = s2 + (char)i1;
  764. } else
  765. if(l2 <= k1 && i1 > 31 && i1 < 127)
  766. {
  767. if(byte0 != 66)
  768. {
  769. s2 = s2 + '\310';
  770. byte0 = 66;
  771. }
  772. s2 = s2 + (char)i1;
  773. }
  774. }
  775. }
  776. for(int j2 = 1; j2 <= k1; j2++)
  777. {
  778. char c1 = code.charAt(j2 - 1);
  779. if(j2 < k1 - 1 && c1 == '\312')
  780. {
  781. int j1 = (code.charAt(j2) - 48) * 10 + (code.charAt(j2 + 1) - 48);
  782. if(j2 < k1 - 3 && (j1 <= 81 && j1 >= 80 || j1 <= 34 && j1 >= 31))
  783. {
  784. codeText = codeText + " (" + code.charAt(j2) + code.charAt(j2 + 1) + code.charAt(j2 + 2) + code.charAt(j2 + 3) + ") ";
  785. j2 += 4;
  786. } else
  787. if(j2 < k1 - 2 && (j1 <= 49 && j1 >= 40 || j1 <= 25 && j1 >= 23))
  788. {
  789. codeText = codeText + " (" + code.charAt(j2) + code.charAt(j2 + 1) + code.charAt(j2 + 2) + ") ";
  790. j2 += 3;
  791. } else
  792. if(j1 <= 30 && j1 >= 0 || j1 <= 99 && j1 >= 90)
  793. {
  794. codeText = codeText + " (" + code.charAt(j2) + code.charAt(j2 + 1) + ") ";
  795. j2 += 2;
  796. }
  797. } else
  798. if(code.charAt(j2 - 1) < ' ')
  799. codeText = codeText + " ";
  800. else
  801. if(code.charAt(j2 - 1) > '\037' && code.charAt(j2 - 1) < '\200')
  802. codeText = codeText + code.charAt(j2 - 1);
  803. }
  804. if(Code128Set == 'B')
  805. {
  806. as = set128B;
  807. l1 = 104;
  808. }
  809. if(Code128Set == 'C')
  810. {
  811. as = set128C;
  812. l1 = 105;
  813. if(s2.length() % 2 == 1)
  814. {
  815. s2 = "0" + s2;
  816. codeText = s2;
  817. }
  818. }
  819. if(Code128Set == 'B')
  820. paintChar(g, "bwbwbw", "211214");
  821. if(Code128Set == 'C')
  822. paintChar(g, "bwbwbw", "211232");
  823. if(Code128Set == 'A')
  824. paintChar(g, "bwbwbw", "211412");
  825. int k2 = 1;
  826. for(int i3 = 0; i3 < s2.length(); i3++)
  827. {
  828. String s = "" + s2.charAt(i3);
  829. if(Code128Set == 'C')
  830. {
  831. String s1 = "" + s;
  832. if(++i3 < s2.length())
  833. s1 = s1 + s2.charAt(i3);
  834. int i = C0(set128C, s1);
  835. if(i >= 0)
  836. {
  837. paintChar(g, "bwbwbw", set128[i]);
  838. l1 += i * k2;
  839. }
  840. } else
  841. {
  842. int j = C0(as, s);
  843. if(j >= 0)
  844. {
  845. paintChar(g, "bwbwbw", set128[j]);
  846. l1 += j * k2;
  847. }
  848. }
  849. k2++;
  850. }
  851. if(checkCharacter)
  852. {
  853. int k = (int)mod(l1, 103D);
  854. paintChar(g, "bwbwbw", set128[k]);
  855. }
  856. paintChar(g, "bwbwbwb", "2331112");
  857. }
  858. protected void paintUCC128(Graphics g)
  859. {
  860. boolean flag = false;
  861. boolean flag1 = false;
  862. String s2 = code;
  863. codeText = code;
  864. boolean flag2 = false;
  865. String as[] = set128C;
  866. Code128Set = 'C';
  867. int l = 105;
  868. if(s2.length() % 2 == 1)
  869. {
  870. s2 = "0" + s2;
  871. codeText = s2;
  872. }
  873. if(s2.charAt(0) != '\312' && s2.charAt(1) != '\312')
  874. s2 = "\312\312" + s2;
  875. boolean flag3 = false;
  876. int j1 = s2.length();
  877. codeText = "";
  878. for(int k1 = 0; k1 < j1; k1++)
  879. {
  880. char c = s2.charAt(k1);
  881. if(k1 < j1 - 3 && s2.charAt(k1) == '\312' && s2.charAt(k1 + 1) == '\312')
  882. {
  883. int i1 = (s2.charAt(k1 + 2) - 48) * 10 + (s2.charAt(k1 + 3) - 48);
  884. if(k1 < j1 - 5 && (i1 <= 81 && i1 >= 80 || i1 <= 34 && i1 >= 31))
  885. {
  886. codeText = codeText + " (" + s2.charAt(k1 + 2) + s2.charAt(k1 + 3) + s2.charAt(k1 + 4) + s2.charAt(k1 + 5) + ") ";
  887. k1 += 5;
  888. } else
  889. if(k1 < j1 - 4 && (i1 <= 49 && i1 >= 40 || i1 <= 25 && i1 >= 23))
  890. {
  891. codeText = codeText + " (" + s2.charAt(k1 + 2) + s2.charAt(k1 + 3) + s2.charAt(k1 + 4) + ") ";
  892. k1 += 4;
  893. } else
  894. if(i1 <= 30 && i1 >= 0 || i1 <= 99 && i1 >= 90)
  895. {
  896. codeText = codeText + " (" + s2.charAt(k1 + 2) + s2.charAt(k1 + 3) + ") ";
  897. k1 += 3;
  898. }
  899. } else
  900. {
  901. codeText = codeText + s2.charAt(k1);
  902. }
  903. }
  904. paintChar(g, "bwbwbw", "211232");
  905. int l1 = 1;
  906. for(int i2 = 0; i2 < s2.length(); i2++)
  907. {
  908. String s = "" + s2.charAt(i2);
  909. if(Code128Set == 'C')
  910. {
  911. String s1 = "" + s;
  912. if(++i2 < s2.length())
  913. s1 = s1 + s2.charAt(i2);
  914. int i = C0(set128C, s1);
  915. if(i >= 0)
  916. {
  917. paintChar(g, "bwbwbw", set128[i]);
  918. l += i * l1;
  919. }
  920. } else
  921. {
  922. int j = C0(as, s);
  923. if(j >= 0)
  924. {
  925. paintChar(g, "bwbwbw", set128[j]);
  926. l += j * l1;
  927. }
  928. }
  929. l1++;
  930. }
  931. if(checkCharacter)
  932. {
  933. int k = (int)mod(l, 103D);
  934. paintChar(g, "bwbwbw", set128[k]);
  935. }
  936. paintChar(g, "bwbwbwb", "2331112");
  937. }
  938. protected void paintEAN8(Graphics g)
  939. {
  940. boolean flag = false;
  941. boolean flag1 = false;
  942. if(code.length() == 7 && checkCharacter)
  943. code = code + UPCEANCheck(code);
  944. if(code.length() < 8)
  945. return;
  946. paintGuardChar(g, "bwb", "nnn", 0);
  947. leftGuardBar = currentX;
  948. for(int k = 0; k < 8; k++)
  949. {
  950. String s = "" + code.charAt(k);
  951. byte byte0 = -1;
  952. if(k <= 3)
  953. {
  954. int i = findChar(setEANLeftA, s);
  955. paintChar(g, "wbwb", setEANLeftA[i][1]);
  956. } else
  957. {
  958. int j = findChar(setEANRight, s);
  959. paintChar(g, "bwbw", setEANRight[j][1]);
  960. }
  961. if(k == 3)
  962. {
  963. centerGuardBarStart = currentX;
  964. paintGuardChar(g, "wbwbw", "nnnnn", 0);
  965. centerGuardBarEnd = currentX;
  966. }
  967. }
  968. rightGuardBar = currentX;
  969. paintGuardChar(g, "bwb", "nnn", 0);
  970. endOfCode = currentX;
  971. if(UPCEANSupplement2)
  972. paintSup2(g, code.substring(2, 4));
  973. else
  974. if(UPCEANSupplement5)
  975. paintSup5(g, code.substring(2, 7));
  976. }
  977. protected void paintUPCE(Graphics g)
  978. {
  979. boolean flag = false;
  980. boolean flag1 = false;
  981. int j = 0;
  982. String s1 = "";
  983. if(code.length() == 11 && checkCharacter)
  984. code = code + UPCEANCheck(code);
  985. if(code.length() < 12)
  986. return;
  987. j = (new Integer("" + code.charAt(11))).intValue();
  988. if(code.substring(3, 6).compareTo("000") == 0 || code.substring(3, 6).compareTo("100") == 0 || code.substring(3, 6).compareTo("200") == 0)
  989. s1 = code.substring(1, 3) + code.substring(8, 11) + code.charAt(3);
  990. if(code.substring(3, 6).compareTo("300") == 0 || code.substring(3, 6).compareTo("400") == 0 || code.substring(3, 6).compareTo("500") == 0 || code.substring(3, 6).compareTo("600") == 0 || code.substring(3, 6).compareTo("700") == 0 || code.substring(3, 6).compareTo("800") == 0 || code.substring(3, 6).compareTo("900") == 0)
  991. s1 = code.substring(1, 4) + code.substring(9, 11) + "3";
  992. if(code.substring(4, 6).compareTo("10") == 0 || code.substring(4, 6).compareTo("20") == 0 || code.substring(4, 6).compareTo("30") == 0 || code.substring(4, 6).compareTo("40") == 0 || code.substring(4, 6).compareTo("50") == 0 || code.substring(4, 6).compareTo("60") == 0 || code.substring(4, 6).compareTo("70") == 0 || code.substring(4, 6).compareTo("80") == 0 || code.substring(4, 6).compareTo("90") == 0)
  993. s1 = code.substring(1, 5) + code.substring(10, 11) + "4";
  994. if(code.substring(5, 6).compareTo("0") != 0)
  995. s1 = code.substring(1, 6) + code.substring(10, 11);
  996. codeText = s1 + j;
  997. paintGuardChar(g, "bwb", "nnn", 0);
  998. leftGuardBar = currentX;
  999. String s2 = UPCESystem0[j];
  1000. if(UPCESytem == '1')
  1001. s2 = UPCESystem1[j];
  1002. for(int k = 0; k < s1.length(); k++)
  1003. {
  1004. String s = "" + s1.charAt(k);
  1005. int i = -1;
  1006. String as[][] = setUPCEOdd;
  1007. if(s2.charAt(k) == 'E')
  1008. as = setUPCEEven;
  1009. i = findChar(as, s);
  1010. paintChar(g, "wbwb", as[i][1]);
  1011. }
  1012. rightGuardBar = currentX;
  1013. paintGuardChar(g, "wbwbwb", "nnnnnn", 0);
  1014. endOfCode = currentX;
  1015. if(UPCEANSupplement2)
  1016. paintSup2(g, s1.substring(0, 2));
  1017. else
  1018. if(UPCEANSupplement5)
  1019. paintSup5(g, s1.substring(0, 5));
  1020. }
  1021. protected void paintSup2(Graphics g, String s)
  1022. {
  1023. if(supplement.length() > 0)
  1024. s = supplement;
  1025. suplementTopMargin = (int)((double)barHeightPixels * (1.0D - supHeight));
  1026. codeSup = s;
  1027. if(s.length() != 2)
  1028. return;
  1029. currentX = (int)((double)currentX + (double)resolution * supSeparationCM);
  1030. startSuplement = currentX;
  1031. int i;
  1032. try
  1033. {
  1034. i = Integer.valueOf(s).intValue();
  1035. }
  1036. catch(Exception exception)
  1037. {
  1038. i = 0;
  1039. }
  1040. String s1 = "OO";
  1041. if(mod(i, 4D) == 1.0D)
  1042. s1 = "OE";
  1043. if(mod(i, 4D) == 2D)
  1044. s1 = "EO";
  1045. if(mod(i, 4D) == 3D)
  1046. s1 = "EE";
  1047. paintGuardChar(g, "bwb", "112", suplementTopMargin);
  1048. String as[][] = setUPCEOdd;
  1049. if(s1.charAt(0) == 'E')
  1050. as = setUPCEEven;
  1051. int j = findChar(as, "" + s.charAt(0));
  1052. paintGuardChar(g, "wbwb", as[j][1], suplementTopMargin);
  1053. paintGuardChar(g, "wb", "11", suplementTopMargin);
  1054. as = setUPCEOdd;
  1055. if(s1.charAt(1) == 'E')
  1056. as = setUPCEEven;
  1057. j = findChar(as, "" + s.charAt(1));
  1058. paintGuardChar(g, "wbwb", as[j][1], suplementTopMargin);
  1059. endSuplement = currentX;
  1060. }
  1061. protected void paintSup5(Graphics g, String s)
  1062. {
  1063. if(supplement.length() > 0)
  1064. s = supplement;
  1065. suplementTopMargin = (int)((double)barHeightPixels * (1.0D - supHeight));
  1066. codeSup = s;
  1067. if(s.length() != 5)
  1068. return;
  1069. boolean flag = true;
  1070. int i = 0;
  1071. int j = 0;
  1072. for(int l = s.length() - 1; l >= 0; l--)
  1073. {
  1074. if(flag)
  1075. i += (new Integer("" + s.charAt(l))).intValue();
  1076. else
  1077. j += (new Integer("" + s.charAt(l))).intValue();
  1078. flag = !flag;
  1079. }
  1080. j = i * 3 + j * 9;
  1081. String s1 = "" + j;
  1082. int k = (new Integer("" + s1.charAt(s1.length() - 1))).intValue();
  1083. String s2 = fiveSuplement[k];
  1084. currentX = (int)((double)currentX + (double)resolution * supSeparationCM);
  1085. startSuplement = currentX;
  1086. paintGuardChar(g, "bwb", "112", suplementTopMargin);
  1087. Object obj = null;
  1088. for(int j1 = 0; j1 < 5; j1++)
  1089. {
  1090. String as[][] = setUPCEOdd;
  1091. if(s2.charAt(j1) == 'E')
  1092. as = setUPCEEven;
  1093. int i1 = findChar(as, "" + s.charAt(j1));
  1094. paintGuardChar(g, "wbwb", as[i1][1], suplementTopMargin);
  1095. if(j1 < 4)
  1096. paintGuardChar(g, "wb", "11", suplementTopMargin);
  1097. }
  1098. endSuplement = currentX;
  1099. }
  1100. protected void paintMAT25(Graphics g)
  1101. {
  1102. boolean flag = false;
  1103. boolean flag1 = false;
  1104. String s1 = code;
  1105. paintChar(g, "bwbwbw", "wnnnnn");
  1106. for(int j = 0; j < s1.length(); j++)
  1107. {
  1108. String s = "" + code.charAt(j);
  1109. int i = findChar(set25, s);
  1110. if(i >= 0)
  1111. paintChar(g, "bwbwbw", set25[i][1] + "n");
  1112. }
  1113. paintChar(g, "bwbwbw", "wnnnnn");
  1114. }
  1115. protected void paintCODE39(Graphics g)
  1116. {
  1117. boolean flag = false;
  1118. int k = 0;
  1119. code = code.toUpperCase();
  1120. paintChar(g, "bwbwbwbwb", set39[findChar(set39, "*")][1]);
  1121. currentX = currentX + narrowBarPixels;
  1122. for(int l = 0; l < code.length(); l++)
  1123. {
  1124. String s = "" + code.charAt(l);
  1125. int i = findChar(set39, s);
  1126. if(i > -1)
  1127. {
  1128. k += i;
  1129. paintChar(g, "bwbwbwbwb", set39[i][1]);
  1130. currentX = currentX + narrowBarPixels;
  1131. }
  1132. }
  1133. if(checkCharacter)
  1134. {
  1135. int j = (int)mod(k, 43D);
  1136. paintChar(g, "bwbwbwbwb", set39[j][1]);
  1137. currentX = currentX + narrowBarPixels;
  1138. if(checkCharacterInText)
  1139. codeText = code + "" + set39[j][0];
  1140. else
  1141. codeText = code;
  1142. }
  1143. paintChar(g, "bwbwbwbwb", set39[findChar(set39, "*")][1]);
  1144. }
  1145. protected void paintCODE11(Graphics g)
  1146. {
  1147. boolean flag = false;
  1148. int l = 0;
  1149. paintChar(g, "bwbwbw", "nnwwnn");
  1150. int i1 = 1;
  1151. l = 0;
  1152. for(int j1 = code.length() - 1; j1 >= 0; j1--)
  1153. {
  1154. l += findChar(set11, "" + code.charAt(j1)) * i1;
  1155. if(++i1 == 11)
  1156. i1 = 1;
  1157. }
  1158. int j = (int)mod(l, 11D);
  1159. i1 = 2;
  1160. l = j;
  1161. for(int k1 = code.length() - 1; k1 >= 0; k1--)
  1162. {
  1163. l += findChar(set11, "" + code.charAt(k1)) * i1;
  1164. if(++i1 == 10)
  1165. i1 = 1;
  1166. }
  1167. int k = (int)mod(l, 11D);
  1168. for(int l1 = 0; l1 < code.length(); l1++)
  1169. {
  1170. String s = "" + code.charAt(l1);
  1171. int i = findChar(set11, s);
  1172. if(i > -1)
  1173. paintChar(g, "bwbwbw", set11[i][1] + "n");
  1174. }
  1175. if(checkCharacter)
  1176. {
  1177. paintChar(g, "bwbwbw", set11[j][1] + "n");
  1178. if(checkCharacterInText)
  1179. codeText = code + set11[j][0];
  1180. else
  1181. codeText = code;
  1182. if(code.length() > 10)
  1183. {
  1184. paintChar(g, "bwbwbw", set11[k][1] + "n");
  1185. if(checkCharacterInText)
  1186. codeText = codeText + set11[k][0];
  1187. else
  1188. codeText = code;
  1189. }
  1190. }
  1191. paintChar(g, "bwbwbw", "nnwwnn");
  1192. }
  1193. protected void paintCODABAR(Graphics g)
  1194. {
  1195. boolean flag = false;
  1196. int k = 0;
  1197. paintChar(g, "bwbwbwbw", setCODABAR[findChar(setCODABAR, "" + CODABARStartChar)][1] + "n");
  1198. k = findChar(setCODABAR, "" + CODABARStartChar) + findChar(setCODABAR, "" + CODABARStopChar);
  1199. for(int l = code.length() - 1; l >= 0; l--)
  1200. k += findChar(setCODABAR, "" + code.charAt(l));
  1201. int j = (int)mod(k, 16D);
  1202. if(j != 0)
  1203. j = 16 - j;
  1204. for(int i1 = 0; i1 < code.length(); i1++)
  1205. {
  1206. String s = "" + code.charAt(i1);
  1207. int i = findChar(setCODABAR, s);
  1208. if(i > -1)
  1209. paintChar(g, "bwbwbwbw", setCODABAR[i][1] + "n");
  1210. }
  1211. if(checkCharacter)
  1212. {
  1213. if(checkCharacterInText)
  1214. codeText = code + setCODABAR[j][0];
  1215. else
  1216. codeText = code;
  1217. paintChar(g, "bwbwbwbw", setCODABAR[j][1] + "n");
  1218. }
  1219. paintChar(g, "bwbwbwb", setCODABAR[findChar(setCODABAR, "" + CODABARStopChar)][1]);
  1220. }
  1221. protected void paintMSI(Graphics g)
  1222. {
  1223. boolean flag = false;
  1224. int k = 0;
  1225. paintChar(g, "bw", "wn");
  1226. k = 0;
  1227. String s1 = "";
  1228. boolean flag1 = true;
  1229. for(int l = code.length() - 1; l >= 0; l--)
  1230. {
  1231. if(!flag1)
  1232. k += findChar(setMSI, "" + code.charAt(l));
  1233. if(flag1)
  1234. s1 = findChar(setMSI, "" + code.charAt(l)) + s1;
  1235. flag1 = !flag1;
  1236. }
  1237. s1 = "" + (new Long(s1)).longValue() * 2L;
  1238. for(int i1 = s1.length() - 1; i1 >= 0; i1--)
  1239. k += findChar(setMSI, "" + s1.charAt(i1));
  1240. int j = (int)mod(k, 10D);
  1241. if(j != 0)
  1242. j = 10 - j;
  1243. for(int j1 = 0; j1 < code.length(); j1++)
  1244. {
  1245. String s = "" + code.charAt(j1);
  1246. int i = findChar(setMSI, s);
  1247. if(i > -1)
  1248. paintChar(g, "bwbwbwbw", setMSI[i][1]);
  1249. }
  1250. if(checkCharacter)
  1251. {
  1252. paintChar(g, "bwbwbwb", setMSI[j][1]);
  1253. if(checkCharacterInText)
  1254. codeText = code + setMSI[j][0];
  1255. else
  1256. codeText = code;
  1257. }
  1258. paintChar(g, "wbwb", "nnwn");
  1259. }
  1260. protected static double mod(double d1, double d2)
  1261. {
  1262. double d3 = d1 / d2;
  1263. double d4 = Math.round(d3);
  1264. if(d4 > d3)
  1265. d4--;
  1266. return d1 - d2 * d4;
  1267. }
  1268. protected void paintCODE39Ext(Graphics g)
  1269. {
  1270. boolean flag = false;
  1271. int k = 0;
  1272. paintChar(g, "bwbwbwbwb", set39[findChar(set39, "*")][1]);
  1273. currentX = currentX + narrowBarPixels;
  1274. for(int l = 0; l < code.length(); l++)
  1275. {
  1276. byte byte0 = (byte)code.charAt(l);
  1277. if(byte0 <= 128)
  1278. {
  1279. String s1 = set39Ext[byte0];
  1280. for(int i1 = 0; i1 < s1.length(); i1++)
  1281. {
  1282. String s = "" + s1.charAt(i1);
  1283. int i = findChar(set39, s);
  1284. if(i > -1)
  1285. {
  1286. k += i;
  1287. paintChar(g, "bwbwbwbwb", set39[i][1]);
  1288. currentX = currentX + narrowBarPixels;
  1289. }
  1290. }
  1291. }
  1292. }
  1293. codeText = "";
  1294. boolean flag1 = false;
  1295. for(int k1 = 1; k1 <= code.length(); k1++)
  1296. {
  1297. int j1 = code.charAt(k1 - 1);
  1298. if(j1 < 32 && j1 >= 0)
  1299. {
  1300. if(j1 == 13 || j1 == 9)
  1301. codeText = codeText + " ";
  1302. } else
  1303. {
  1304. codeText = codeText + (char)j1;
  1305. }
  1306. }
  1307. if(checkCharacter)
  1308. {
  1309. int j = (int)mod(k, 43D);
  1310. paintChar(g, "bwbwbwbwb", set39[j][1]);
  1311. currentX = currentX + narrowBarPixels;
  1312. if(checkCharacterInText)
  1313. codeText = codeText + "" + set39[j][0];
  1314. }
  1315. paintChar(g, "bwbwbwbwb", set39[findChar(set39, "*")][1]);
  1316. }
  1317. protected void paintBAR93(Graphics g)
  1318. {
  1319. boolean flag = false;
  1320. int j = 0;
  1321. int k = 0;
  1322. int l = 0;
  1323. paintChar(g, "bwbwbw", "111141");
  1324. for(int i1 = 0; i1 < code.length(); i1++)
  1325. {
  1326. String s = "" + code.charAt(i1);
  1327. int i = findChar(set93, s);
  1328. if(i > -1)
  1329. {
  1330. j += i;
  1331. paintChar(g, "bwbwbw", set93[i][1]);
  1332. }
  1333. }
  1334. int j1 = 1;
  1335. j = 0;
  1336. for(int k1 = code.length() - 1; k1 >= 0; k1--)
  1337. {
  1338. j += findChar(set93, "" + code.charAt(k1)) * j1;
  1339. if(++j1 == 21)
  1340. j1 = 1;
  1341. }
  1342. l = (int)mod(j, 47D);
  1343. j1 = 2;
  1344. j = l;
  1345. for(int l1 = code.length() - 1; l1 >= 0; l1--)
  1346. {
  1347. j += findChar(set93, "" + code.charAt(l1)) * j1;
  1348. if(++j1 == 16)
  1349. j1 = 1;
  1350. }
  1351. k = (int)mod(j, 47D);
  1352. if(checkCharacter)
  1353. {
  1354. paintChar(g, "bwbwbw", set93[l][1]);
  1355. paintChar(g, "bwbwbw", set93[k][1]);
  1356. if(checkCharacterInText)
  1357. codeText = code + set93[l][0].charAt(0) + set93[k][0].charAt(0);
  1358. else
  1359. codeText = code;
  1360. }
  1361. paintChar(g, "bwbwbwb", "1111411");
  1362. }
  1363. protected void paintBAR93Ext(Graphics g)
  1364. {
  1365. boolean flag = false;
  1366. int k1 = 0;
  1367. int l1 = 0;
  1368. int i2 = 0;
  1369. paintChar(g, "bwbwbw", "111141");
  1370. for(int j2 = 0; j2 < code.length(); j2++)
  1371. {
  1372. byte byte0 = (byte)code.charAt(j2);
  1373. if(byte0 <= 128)
  1374. {
  1375. String s5 = set93Ext[byte0];
  1376. String s;
  1377. if(s5.length() == 3)
  1378. {
  1379. s = "" + s5.charAt(0) + s5.charAt(1);
  1380. int i = findChar(set93, s);
  1381. paintChar(g, "bwbwbw", set93[i][1]);
  1382. s = "" + s5.charAt(2);
  1383. } else
  1384. {
  1385. s = "" + s5.charAt(0);
  1386. }
  1387. int j = findChar(set93, s);
  1388. k1 += j;
  1389. paintChar(g, "bwbwbw", set93[j][1]);
  1390. }
  1391. }
  1392. int k2 = 1;
  1393. k1 = 0;
  1394. for(int l2 = code.length() - 1; l2 >= 0; l2--)
  1395. {
  1396. byte byte1 = (byte)code.charAt(l2);
  1397. if(byte1 <= 128)
  1398. {
  1399. String s6 = set93Ext[byte1];
  1400. if(s6.length() == 3)
  1401. {
  1402. String s1 = "" + s6.charAt(0) + s6.charAt(1);
  1403. int k = findChar(set93, s1);
  1404. k1 += k * (k2 + 1);
  1405. s1 = "" + s6.charAt(2);
  1406. k = findChar(set93, s1);
  1407. k1 += k * k2;
  1408. if(++k2 == 21)
  1409. k2 = 1;
  1410. if(++k2 == 21)
  1411. k2 = 1;
  1412. } else
  1413. {
  1414. String s2 = "" + s6.charAt(0);
  1415. int l = findChar(set93, s2);
  1416. k1 += l * k2;
  1417. if(++k2 == 21)
  1418. k2 = 1;
  1419. }
  1420. }
  1421. }
  1422. i2 = (int)mod(k1, 47D);
  1423. k2 = 2;
  1424. k1 = i2;
  1425. for(int i3 = code.length() - 1; i3 >= 0; i3--)
  1426. {
  1427. byte byte2 = (byte)code.charAt(i3);
  1428. if(byte2 <= 128)
  1429. {
  1430. String s7 = set93Ext[byte2];
  1431. if(s7.length() == 3)
  1432. {
  1433. String s3 = "" + s7.charAt(0) + s7.charAt(1);
  1434. int i1 = findChar(set93, s3);
  1435. k1 += i1 * (k2 + 1);
  1436. s3 = "" + s7.charAt(2);
  1437. i1 = findChar(set93, s3);
  1438. k1 += i1 * k2;
  1439. if(++k2 == 16)
  1440. k2 = 1;
  1441. if(++k2 == 16)
  1442. k2 = 1;
  1443. } else
  1444. {
  1445. String s4 = "" + s7.charAt(0);
  1446. int j1 = findChar(set93, s4);
  1447. k1 += j1 * k2;
  1448. if(++k2 == 16)
  1449. k2 = 1;
  1450. }
  1451. }
  1452. }
  1453. l1 = (int)mod(k1, 47D);
  1454. if(checkCharacter)
  1455. {
  1456. paintChar(g, "bwbwbw", set93[i2][1]);
  1457. paintChar(g, "bwbwbw", set93[l1][1]);
  1458. if(checkCharacterInText)
  1459. codeText = code + set93[i2][0].charAt(0) + set93[l1][0].charAt(0);
  1460. else
  1461. codeText = code;
  1462. }
  1463. paintChar(g, "bwbwbwb", "1111411");
  1464. }
  1465. protected void paintChar(Graphics g, String s, String s1)
  1466. {
  1467. paintChar2(g, s, s1, 0);
  1468. }
  1469. protected void paintChar2(Graphics g, String s, String s1, int i)
  1470. {
  1471. for(int j = 0; j < s.length(); j++)
  1472. {
  1473. char c = s.charAt(j);
  1474. char c1 = s1.charAt(j);
  1475. if(c1 == 'n')
  1476. addBar(g, narrowBarPixels, c == 'b', i);
  1477. if(c1 == 'w')
  1478. addBar(g, widthBarPixels, c == 'b', i);
  1479. if(c1 == '1')
  1480. addBar(g, narrowBarPixels, c == 'b', i);
  1481. if(c1 == '2')
  1482. addBar(g, narrowBarPixels * 2, c == 'b', i);
  1483. if(c1 == '3')
  1484. addBar(g, narrowBarPixels * 3, c == 'b', i);
  1485. if(c1 == '4')
  1486. addBar(g, narrowBarPixels * 4, c == 'b', i);
  1487. }
  1488. }
  1489. protected void paintGuardChar(Graphics g, String s, String s1, int i)
  1490. {
  1491. if(textFont != null && guardBars)
  1492. {
  1493. g.setFont(textFont);
  1494. extraHeight = g.getFontMetrics().getHeight();
  1495. }
  1496. paintChar2(g, s, s1, i);
  1497. extraHeight = 0;
  1498. }
  1499. protected void calculateSizes()
  1500. {
  1501. int i = code.length();
  1502. narrowBarCM = X;
  1503. widthBarCM = X * N;
  1504. if(barType == 2)
  1505. {
  1506. if(mod(i, 2D) == 0.0D && checkCharacter)
  1507. i++;
  1508. if(mod(i, 2D) == 1.0D && !checkCharacter)
  1509. i++;
  1510. if(checkCharacter)
  1511. i++;
  1512. L = (double)(i / 2) * (3D + 2D * N) * X + 7D * X;
  1513. }
  1514. if(barType == 6)
  1515. {
  1516. if(checkCharacter)
  1517. i++;
  1518. L = (double)(i * 7) * X + 11D * X;
  1519. }
  1520. if(barType == 10)
  1521. L = (double)(i * 7) * X + 11D * X;
  1522. if(barType == 11)
  1523. L = (double)(i * 7) * X + 11D * X;
  1524. if(barType == 13)
  1525. {
  1526. if(checkCharacter)
  1527. i++;
  1528. if(Code128Set == 'C')
  1529. L = (double)(11 * i + 35) * X;
  1530. else
  1531. L = (5.5D * (double)i + 35D) * X;
  1532. }
  1533. if(barType == 12)
  1534. L = 56D * X + 11D * X;
  1535. if(barType == 7)
  1536. {
  1537. if(checkCharacter)
  1538. i++;
  1539. L = (double)i * (3D + 2D * N) * X + 7D * X;
  1540. }
  1541. if(barType == 8)
  1542. {
  1543. if(checkCharacter)
  1544. i++;
  1545. L = (double)i * (3D + 2D * N) * X + 7D * X;
  1546. }
  1547. if(barType == 5)
  1548. {
  1549. if(checkCharacter)
  1550. i++;
  1551. L = (double)i * (4D + 4D * N) * X + (1.0D + N) * X + (2D + N) * X;
  1552. }
  1553. if(barType == 4)
  1554. {
  1555. if(checkCharacter)
  1556. i++;
  1557. L = (double)(i + 2) * (4D + 3D * N) * X;
  1558. }
  1559. if(barType == 3)
  1560. {
  1561. if(checkCharacter || code.length() > 10)
  1562. i++;
  1563. L = (double)(i + 2 + 1) * (3D + 2D * N) * X;
  1564. }
  1565. if(barType == 15)
  1566. {
  1567. if(checkCharacter)
  1568. i++;
  1569. L = X * 10D;
  1570. }
  1571. if(barType == 0)
  1572. {
  1573. if(checkCharacter)
  1574. i++;
  1575. L = (double)(i + 2) * (3D * N + 6D) * X + (double)(i + 1) * I * X;
  1576. }
  1577. if(barType == 1)
  1578. {
  1579. int j = 0;
  1580. if(checkCharacter)
  1581. j++;
  1582. for(int l = 0; l < code.length(); l++)
  1583. {
  1584. byte byte0 = (byte)code.charAt(l);
  1585. if(byte0 <= 128)
  1586. {
  1587. String s = set39Ext[byte0];
  1588. j += s.length();
  1589. }
  1590. }
  1591. L = (double)(j + 2) * (3D * N + 6D) * X + (double)(j + 1) * I * X;
  1592. }
  1593. if(barType == 9 || barType == 14)
  1594. {
  1595. int k = 0;
  1596. if(checkCharacter)
  1597. k++;
  1598. for(int i1 = 0; i1 < code.length(); i1++)
  1599. {
  1600. byte byte1 = (byte)code.charAt(i1);
  1601. if(byte1 <= 128)
  1602. {
  1603. String s1 = set39Ext[byte1];
  1604. if(s1.length() == 1)
  1605. k++;
  1606. else
  1607. k += 2;
  1608. }
  1609. }
  1610. L = (double)(k + 2) * (9D * X) + (double)(k + 1) * I * X;
  1611. }
  1612. if(barHeightCM == 0.0D)
  1613. {
  1614. barHeightCM = L * H;
  1615. if(barHeightCM < 0.625D)
  1616. barHeightCM = 0.625D;
  1617. }
  1618. if(barHeightCM != 0.0D)
  1619. barHeightPixels = (int)(barHeightCM * (double)resolution);
  1620. if(narrowBarCM != 0.0D)
  1621. narrowBarPixels = (int)(narrowBarCM * (double)resolution);
  1622. if(widthBarCM != 0.0D)
  1623. widthBarPixels = (int)((double)narrowBarPixels * N);
  1624. if(narrowBarPixels <= 0)
  1625. narrowBarPixels = 1;
  1626. if(widthBarPixels <= 1)
  1627. widthBarPixels = (int)((double)narrowBarPixels * N);
  1628. }
  1629. public void paint(Graphics g)
  1630. {
  1631. Graphics g1 = g;
  1632. Image image = null;
  1633. if(rotate != 0)
  1634. {
  1635. String s = System.getProperty("java.version");
  1636. if(s.indexOf("1.0") == 0 || s.indexOf("1.1") == 0)
  1637. {
  1638. image = createImage(getSize().width, getSize().height);
  1639. g1 = image.getGraphics();
  1640. } else
  1641. {
  1642. IDAImageCreator idaimagecreator = new IDAImageCreator();
  1643. image = idaimagecreator.getImage(getSize().width, getSize().height);
  1644. g1 = idaimagecreator.getGraphics();
  1645. }
  1646. }
  1647. g.setColor(backColor);
  1648. g.fillRect(0, 0, getSize().width, getSize().height);
  1649. paintBasis(g1);
  1650. if(rotate != 0)
  1651. {
  1652. int i = currentX + leftMarginPixels;
  1653. int j = currentY + topMarginPixels;
  1654. Image image1 = rotate(image, rotate, i, j);
  1655. if(image1 == null)
  1656. g.drawImage(image, 0, 0, null);
  1657. else
  1658. g.drawImage(image1, 0, 0, null);
  1659. }
  1660. }
  1661. protected void paintBasis(Graphics g)
  1662. {
  1663. codeText = "";
  1664. calculateSizes();
  1665. topMarginPixels = (int)(topMarginCM * (double)resolution);
  1666. leftMarginPixels = (int)(leftMarginCM * (double)resolution);
  1667. currentX = leftMarginPixels;
  1668. g.setColor(backColor);
  1669. int i = getSize().width;
  1670. int j = getSize().height;
  1671. int k = i;
  1672. if(j > k)
  1673. k = j;
  1674. g.fillRect(0, 0, k, k);
  1675. endOfCode = 0;
  1676. if(barType == 3)
  1677. paintCODE11(g);
  1678. if(barType == 5)
  1679. paintMSI(g);
  1680. if(barType == 4)
  1681. paintCODABAR(g);
  1682. if(barType == 0)
  1683. paintCODE39(g);
  1684. if(barType == 1)
  1685. paintCODE39Ext(g);
  1686. if(barType == 2)
  1687. paintInterleaved25(g);
  1688. if(barType == 9)
  1689. paintBAR93(g);
  1690. if(barType == 11)
  1691. paintEAN8(g);
  1692. if(barType == 10)
  1693. paintEAN13(g);
  1694. if(barType == 6)
  1695. paintUPCA(g);
  1696. if(barType == 12)
  1697. paintUPCE(g);
  1698. if(barType == 13)
  1699. paintCode128(g);
  1700. if(barType == 14)
  1701. paintBAR93Ext(g);
  1702. if(barType == 7)
  1703. paintIND25(g);
  1704. if(barType == 8)
  1705. paintMAT25(g);
  1706. if(barType == 15)
  1707. paintPOSTNET(g);
  1708. if(barType == 16)
  1709. paintPLANET(g);
  1710. if(barType == 17)
  1711. paintUCC128(g);
  1712. if(endOfCode == 0)
  1713. endOfCode = currentX;
  1714. if(codeText.length() == 0)
  1715. codeText = code;
  1716. g.setColor(barColor);
  1717. g.setFont(new Font("Arial", 0, 11));
  1718. int l = g.getFontMetrics().getHeight();
  1719. g.drawString("UFAL - Universidade Federal de Alagoas", leftMarginPixels, l + 1);
  1720. if(rotate == 0 || rotate == 180)
  1721. {
  1722. pHeight = barHeightPixels + topMarginPixels + 20;
  1723. pWidth = widthBarPixels + topMarginPixels + 20;
  1724. } else
  1725. {
  1726. pWidth = barHeightPixels + topMarginPixels + 20;
  1727. pHeight = widthBarPixels + topMarginPixels + 20;
  1728. }
  1729. currentY = barHeightPixels + topMarginPixels;
  1730. if(textFont != null)
  1731. {
  1732. g.setColor(fontColor);
  1733. g.setFont(textFont);
  1734. int i1 = g.getFontMetrics().getHeight();
  1735. int j1 = g.getFontMetrics().stringWidth("X");
  1736. if((UPCEANSupplement2 || UPCEANSupplement5) && (barType == 11 || barType == 6 || barType == 12 || barType == 10))
  1737. {
  1738. int k1 = (endSuplement - startSuplement - g.getFontMetrics().stringWidth(codeSup)) / 2;
  1739. if(k1 < 0)
  1740. k1 = 0;
  1741. g.drawString(codeSup, startSuplement + k1, (topMarginPixels + suplementTopMargin) - 2);
  1742. }
  1743. if(barType == 15)
  1744. {
  1745. int l1 = (endOfCode - leftMarginPixels - g.getFontMetrics().stringWidth(codeText)) / 2;
  1746. if(l1 < 0)
  1747. l1 = 0;
  1748. g.drawString(codeText, leftMarginPixels + l1, (int)(postnetHeightTallBar * (double)resolution + (double)i1 + 1.0D + (double)topMarginPixels));
  1749. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1750. return;
  1751. }
  1752. if(barType == 10 && guardBars && codeText.length() >= 13)
  1753. {
  1754. int i2 = 0;
  1755. g.drawString(codeText.substring(0, 1), leftMarginPixels - j1, barHeightPixels + i1 + 1 + topMarginPixels);
  1756. i2 = (centerGuardBarStart - leftGuardBar - g.getFontMetrics().stringWidth(codeText.substring(1, 7))) / 2;
  1757. if(i2 < 0)
  1758. i2 = 0;
  1759. g.drawString(codeText.substring(1, 7), leftGuardBar + i2, barHeightPixels + i1 + 1 + topMarginPixels);
  1760. i2 = (rightGuardBar - centerGuardBarEnd - g.getFontMetrics().stringWidth(codeText.substring(7, 13))) / 2;
  1761. if(i2 < 0)
  1762. i2 = 0;
  1763. g.drawString(codeText.substring(7, 13), centerGuardBarEnd + i2, barHeightPixels + i1 + 1 + topMarginPixels);
  1764. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1765. return;
  1766. }
  1767. if(barType == 6 && guardBars && codeText.length() >= 12)
  1768. {
  1769. int j2 = 0;
  1770. g.drawString(codeText.substring(0, 1), leftMarginPixels - j1, barHeightPixels + i1 + 1 + topMarginPixels);
  1771. j2 = (centerGuardBarStart - leftGuardBar - g.getFontMetrics().stringWidth(codeText.substring(1, 6))) / 2;
  1772. if(j2 < 0)
  1773. j2 = 0;
  1774. g.drawString(codeText.substring(1, 6), leftGuardBar + j2, barHeightPixels + i1 + 1 + topMarginPixels);
  1775. j2 = (rightGuardBar - centerGuardBarEnd - g.getFontMetrics().stringWidth(codeText.substring(6, 11))) / 2;
  1776. if(j2 < 0)
  1777. j2 = 0;
  1778. g.drawString(codeText.substring(6, 11), centerGuardBarEnd + j2, barHeightPixels + i1 + 1 + topMarginPixels);
  1779. g.drawString(codeText.substring(11, 12), endOfCode + 3, barHeightPixels + i1 + 1 + topMarginPixels);
  1780. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1781. return;
  1782. }
  1783. if(barType == 11 && guardBars && codeText.length() >= 8)
  1784. {
  1785. int k2 = 0;
  1786. k2 = (centerGuardBarStart - leftGuardBar - g.getFontMetrics().stringWidth(codeText.substring(0, 4))) / 2;
  1787. if(k2 < 0)
  1788. k2 = 0;
  1789. g.drawString(codeText.substring(0, 4), leftGuardBar + k2, barHeightPixels + i1 + 1 + topMarginPixels);
  1790. k2 = (rightGuardBar - centerGuardBarEnd - g.getFontMetrics().stringWidth(codeText.substring(4, 8))) / 2;
  1791. if(k2 < 0)
  1792. k2 = 0;
  1793. g.drawString(codeText.substring(4, 8), centerGuardBarEnd + k2, barHeightPixels + i1 + 1 + topMarginPixels);
  1794. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1795. return;
  1796. }
  1797. if(barType == 12 && guardBars)
  1798. {
  1799. int l2 = 0;
  1800. g.drawString(codeText.substring(0, 1), leftMarginPixels - j1, barHeightPixels + i1 + 1 + topMarginPixels);
  1801. l2 = (rightGuardBar - leftGuardBar - g.getFontMetrics().stringWidth(codeText)) / 2;
  1802. if(l2 < 0)
  1803. l2 = 0;
  1804. g.drawString(codeText.substring(1, 6), leftGuardBar + l2, barHeightPixels + i1 + 1 + topMarginPixels);
  1805. g.drawString(codeText.substring(7, 1), rightGuardBar, barHeightPixels + i1 + 1 + topMarginPixels);
  1806. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1807. return;
  1808. }
  1809. int i3 = (endOfCode - leftMarginPixels - g.getFontMetrics().stringWidth(codeText)) / 2;
  1810. if(i3 < 0)
  1811. i3 = 0;
  1812. g.drawString(codeText, leftMarginPixels + i3, barHeightPixels + i1 + 1 + topMarginPixels);
  1813. currentY = barHeightPixels + i1 + 1 + topMarginPixels;
  1814. }
  1815. }
  1816. protected Image rotate(Image image, int i, int j, int k)
  1817. {
  1818. int l = image.getWidth(null);
  1819. int i1 = image.getHeight(null);
  1820. if(j > l)
  1821. j = l;
  1822. if(k > i1)
  1823. k = i1;
  1824. int ai[] = new int[l * i1];
  1825. int ai1[] = new int[j * k];
  1826. PixelGrabber pixelgrabber = new PixelGrabber(image, 0, 0, l, i1, ai, 0, l);
  1827. try
  1828. {
  1829. pixelgrabber.grabPixels();
  1830. }
  1831. catch(InterruptedException interruptedexception)
  1832. {
  1833. System.err.println("interrupted waiting for pixels!");
  1834. return null;
  1835. }
  1836. if((pixelgrabber.getStatus() & 0x80) != 0)
  1837. {
  1838. System.err.println("image fetch aborted or errored");
  1839. return null;
  1840. }
  1841. if(i == 90)
  1842. {
  1843. for(int j1 = 0; j1 < j; j1++)
  1844. {
  1845. for(int i2 = 0; i2 < k; i2++)
  1846. ai1[k * (j - (j1 + 1)) + i2] = ai[i2 * l + j1];
  1847. }
  1848. return Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(k, j, ai1, 0, k));
  1849. }
  1850. if(i == 180)
  1851. {
  1852. for(int k1 = 0; k1 < j; k1++)
  1853. {
  1854. for(int j2 = 0; j2 < k; j2++)
  1855. ai1[(k - (j2 + 1)) * j + (j - (k1 + 1))] = ai[j2 * l + k1];
  1856. }
  1857. return Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(j, k, ai1, 0, j));
  1858. }
  1859. if(i == 270)
  1860. {
  1861. for(int l1 = 0; l1 < j; l1++)
  1862. {
  1863. for(int k2 = 0; k2 < k; k2++)
  1864. ai1[k * l1 + (k - (k2 + 1))] = ai[k2 * l + l1];
  1865. }
  1866. return Toolkit.getDefaultToolkit().createImage(new MemoryImageSource(k, j, ai1, 0, k));
  1867. } else
  1868. {
  1869. return null;
  1870. }
  1871. }
  1872. public static final int CODE39 = 0;
  1873. public static final int CODE39EXT = 1;
  1874. public static final int INTERLEAVED25 = 2;
  1875. public static final int CODE11 = 3;
  1876. public static final int CODABAR = 4;
  1877. public static final int MSI = 5;
  1878. public static final int UPCA = 6;
  1879. public static final int IND25 = 7;
  1880. public static final int MAT25 = 8;
  1881. public static final int CODE93 = 9;
  1882. public static final int EAN13 = 10;
  1883. public static final int EAN8 = 11;
  1884. public static final int UPCE = 12;
  1885. public static final int CODE128 = 13;
  1886. public static final int CODE93EXT = 14;
  1887. public static final int POSTNET = 15;
  1888. public static final int PLANET = 16;
  1889. public static final int UCC128 = 17;
  1890. public int barType;
  1891. public String code;
  1892. private String codeSup;
  1893. public boolean checkCharacter;
  1894. public boolean checkCharacterInText;
  1895. public double postnetHeightTallBar;
  1896. public double postnetHeightShortBar;
  1897. public double leftMarginCM;
  1898. protected static final int d = 3;
  1899. public double topMarginCM;
  1900. protected int leftMarginPixels;
  1901. protected int topMarginPixels;
  1902. private int leftGuardBar;
  1903. private int centerGuardBarStart;
  1904. private int centerGuardBarEnd;
  1905. private int rightGuardBar;
  1906. private int endOfCode;
  1907. private int startSuplement;
  1908. private int endSuplement;
  1909. private int suplementTopMargin;
  1910. public String supplement;
  1911. public boolean guardBars;
  1912. public Color backColor;
  1913. public String codeText;
  1914. protected int narrowBarPixels;
  1915. protected int widthBarPixels;
  1916. protected double narrowBarCM;
  1917. protected double widthBarCM;
  1918. public int resolution;
  1919. protected int barHeightPixels;
  1920. public double barHeightCM;
  1921. public int width;
  1922. public int height;
  1923. private int pWidth;
  1924. private int pHeight;
  1925. public Font textFont;
  1926. public Color fontColor;
  1927. public Color barColor;
  1928. private int extraHeight;
  1929. public char UPCESytem;
  1930. public char CODABARStartChar;
  1931. public char CODABARStopChar;
  1932. public boolean UPCEANSupplement2;
  1933. public boolean UPCEANSupplement5;
  1934. public char Code128Set;
  1935. public double X;
  1936. public double N;
  1937. public double I;
  1938. public double H;
  1939. public double L;
  1940. public int rotate;
  1941. public double supSeparationCM;
  1942. public double supHeight;
  1943. protected int currentX;
  1944. protected int currentY;
  1945. protected String set39[][] = {
  1946. {
  1947. "0", "nnnwwnwnn"
  1948. }, {
  1949. "1", "wnnwnnnnw"
  1950. }, {
  1951. "2", "nnwwnnnnw"
  1952. }, {
  1953. "3", "wnwwnnnnn"
  1954. }, {
  1955. "4", "nnnwwnnnw"
  1956. }, {
  1957. "5", "wnnwwnnnn"
  1958. }, {
  1959. "6", "nnwww