Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.66 KB | None | 0 0
  1. import java.util.*;
  2. /** lop layer dai dien cho lop ve
  3. * @author Nguyen Ngoc Thanh Tung
  4. * @version 1.0
  5. * @since 2018 10 09
  6. */
  7. public class layer {
  8. // doi tuong layer chua cac doi tuong shape
  9. private ArrayList<shape> shapeList=new ArrayList<>();
  10. private boolean isVisible;
  11.  
  12. // getter,setter
  13. public void setVisible(boolean v) {
  14. this.isVisible = v;
  15. }
  16. public boolean getVisible() {
  17. return this.isVisible;
  18. }
  19.  
  20. /** phuong thuc xoa hinh tam giac
  21. */
  22. public void delelteTriangle() {
  23. for (int i=0;i<shapeList.size();i++) {
  24. if (shapeList.get(i).getType().equals("triangle"))
  25. shapeList.remove(i);
  26. }
  27. }
  28.  
  29. /** phuong thuc xoa hinh tron
  30. */
  31. public void deleteCircle() {
  32. for (int i=0;i<shapeList.size();i++) {
  33. if (shapeList.get(i).getType().equals("circle"))
  34. shapeList.remove(i);
  35. }
  36. }
  37.  
  38. /** phuong thuc xoa hinh chu nhat
  39. */
  40. public void deleteRectangle() {
  41. for (int i=0;i<shapeList.size();i++) {
  42. if (shapeList.get(i).getType().equals("rectangle"))
  43. shapeList.remove(i);
  44. }
  45. }
  46.  
  47. /** phuong thuc them doi tuong vao danh sach cac shape
  48. */
  49. public void addShape(shape s) {
  50. shapeList.add(s);
  51. }
  52.  
  53. // hien thi
  54. public void print() {
  55. for (int i=0;i<shapeList.size();i++)
  56. System.out.println(shapeList.get(i).getType());
  57. }
  58.  
  59. // delete duplicated shape
  60. public void delDuplicated() {
  61. for (int i=0;i<shapeList.size();i++) {
  62. for (int j=0;j<shapeList.size();j++) {
  63. if (shapeList.get(i).getType() == shapeList.get(j).getType() && shapeList.get(i).getType()=="circle") {
  64. if (shapeList.get(i).isDuplicatedCircle(shapeList.get(j))==true) {
  65.  
  66. }
  67. }
  68. }
  69. }
  70. }
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement