Jelajahi Sumber

add getter and setter functions for classes in domain package.

171870002 5 tahun lalu
induk
melakukan
a54b713ab0

+ 60 - 0
src/main/java/com/example/data_structure/domain/Graph.java

@@ -76,4 +76,64 @@ public class Graph {
         return null;
     }
 
+
+    /*getter*/
+
+    public boolean isDirected() {
+        return isDirected;
+    }
+
+    public boolean isWeighted() {
+        return isWeighted;
+    }
+
+    public int getNodeNum() {
+        return nodeNum;
+    }
+
+    public int getEdgeNum() {
+        return edgeNum;
+    }
+
+    public ArrayList<String> getNodeList() {
+        return nodeList;
+    }
+
+    public ArrayList<ArrayList<Boolean>> getGraph() {
+        return graph;
+    }
+
+    public ArrayList<ArrayList<Double>> getWeight() {
+        return weight;
+    }
+
+    /*setter*/
+
+    public void setDirected(boolean directed) {
+        isDirected = directed;
+    }
+
+    public void setWeighted(boolean weighted) {
+        isWeighted = weighted;
+    }
+
+    public void setNodeNum(int nodeNum) {
+        this.nodeNum = nodeNum;
+    }
+
+    public void setEdgeNum(int edgeNum) {
+        this.edgeNum = edgeNum;
+    }
+
+    public void setNodeList(ArrayList<String> nodeList) {
+        this.nodeList = nodeList;
+    }
+
+    public void setGraph(ArrayList<ArrayList<Boolean>> graph) {
+        this.graph = graph;
+    }
+
+    public void setWeight(ArrayList<ArrayList<Double>> weight) {
+        this.weight = weight;
+    }
 }

+ 36 - 0
src/main/java/com/example/data_structure/domain/Hanoi.java

@@ -20,4 +20,40 @@ public class Hanoi {
         this.b = b;
         this.c = c;
     }
+
+    /*getter*/
+
+    public int getN() {
+        return n;
+    }
+
+    public String getA() {
+        return a;
+    }
+
+    public String getB() {
+        return b;
+    }
+
+    public String getC() {
+        return c;
+    }
+
+    /*setter*/
+
+    public void setN(int n) {
+        this.n = n;
+    }
+
+    public void setA(String a) {
+        this.a = a;
+    }
+
+    public void setB(String b) {
+        this.b = b;
+    }
+
+    public void setC(String c) {
+        this.c = c;
+    }
 }

+ 36 - 0
src/main/java/com/example/data_structure/domain/Sorting.java

@@ -68,4 +68,40 @@ public class Sorting {
     public ArrayList<ArrayList<Object>> selectionSort(){
         return null;
     }
+
+    /*getter*/
+
+    public int getSize() {
+        return size;
+    }
+
+    public String getElementType() {
+        return elementType;
+    }
+
+    public ArrayList<Object> getContent() {
+        return content;
+    }
+
+    public boolean isDesc() {
+        return isDesc;
+    }
+
+    /*setter*/
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public void setElementType(String elementType) {
+        this.elementType = elementType;
+    }
+
+    public void setContent(ArrayList<Object> content) {
+        this.content = content;
+    }
+
+    public void setDesc(boolean desc) {
+        isDesc = desc;
+    }
 }

+ 40 - 0
src/main/java/com/example/data_structure/domain/Stack.java

@@ -59,4 +59,44 @@ public class Stack {
 
     }
 
+
+    /*getter*/
+
+    public static int getMaxSize() {
+        return MAX_SIZE;
+    }
+
+    public int getCapacity() {
+        return capacity;
+    }
+
+    public int getSize() {
+        return size;
+    }
+
+    public String getElementType() {
+        return elementType;
+    }
+
+    public ArrayList<Object> getContent() {
+        return content;
+    }
+
+    /*setter*/
+
+    public void setCapacity(int capacity) {
+        this.capacity = capacity;
+    }
+
+    public void setSize(int size) {
+        this.size = size;
+    }
+
+    public void setElementType(String elementType) {
+        this.elementType = elementType;
+    }
+
+    public void setContent(ArrayList<Object> content) {
+        this.content = content;
+    }
 }