1 package org.opensync.tools;
2 import java.util.Vector;
3
4 public class Parent extends Object {
5 private String idParentFile,label ;
6 private Child childs[]=null;
7 private int num_of_children = 0;
8
9
10 /***
11 * Constructor
12 */
13 public Parent() {
14
15 }
16
17 public void setIdParentFile(String s) {
18 this.idParentFile = s;
19 }
20 public void setLabel(String s) {
21 this.label = s;
22 }
23 public void setChildren(Vector in) {
24 childs = new Child[in.size()];
25 in.toArray(childs);
26 in.clear();
27 num_of_children = childs.length;
28 }
29
30
31
32 public String getIdParentFile() {
33 return(idParentFile);
34 }
35 public String getLabel() {
36 return(label);
37 }
38
39
40 public void addChild (Child e) {
41 if (childs==null) childs = new Child[20];
42 childs[num_of_children++] = e;
43
44 }
45
46
47
48 public int getChildSize() {
49 return (num_of_children);
50
51 }
52 public Child[] getChilds() {
53 return (this.childs);
54 }
55
56 public String getIdChildFile(int v) {
57 return childs[v].getIdChildFile();
58 }
59 public String getKeyChildFile(int v) {
60 return childs[v].getKeyChildFile();
61 }
62 public String getKeyParentFile(int v) {
63 return childs[v].getKeyParentFile();
64 }
65
66 public boolean equals(String s) {
67 return idParentFile.equals(s);
68 }
69
70 public Child findChild(String idChild, String keyParent) {
71 for (int i=0;i<num_of_children;i++) {
72 if (childs[i].equals(idChild,keyParent)) return childs[i];
73 }
74 return null;
75 }
76 }
77
78
79