1 28 29 package com.caucho.web.webmail; 30 31 import java.util.ArrayList ; 32 33 36 public class MboxMessage { 37 private int index; 38 39 private String messageId; 40 41 private String from; 42 private String subject; 43 private String dateString; 44 private long date; 45 46 private MboxMessage parent; 47 private MboxMessage root; 48 49 private ArrayList children; 50 private ArrayList descendants; 51 52 public MboxMessage(int index) 53 { 54 this.index = index; 55 56 this.root = this; 57 } 58 59 public int getIndex() 60 { 61 return index; 62 } 63 64 public void setMessageId(String id) 65 { 66 this.messageId = id; 67 } 68 69 public String getMessageId() 70 { 71 return messageId; 72 } 73 74 public void setFrom(String from) 75 { 76 this.from = from; 77 } 78 79 public String getFrom() 80 { 81 return from; 82 } 83 84 public void setSubject(String subject) 85 { 86 this.subject = subject; 87 } 88 89 public String getSubject() 90 { 91 return subject; 92 } 93 94 public void setDateString(String date) 95 { 96 dateString = date; 97 } 98 99 public String getDateString() 100 { 101 return dateString; 102 } 103 104 public void setDate(long date) 105 { 106 this.date = date; 107 } 108 109 public long getDate() 110 { 111 return date; 112 } 113 114 public void setParent(MboxMessage parent) 115 { 116 this.parent = parent; 117 this.root = parent.root; 118 119 parent.addChild(this); 120 } 121 122 public void addChild(MboxMessage child) 123 { 124 if (children == null) 125 children = new ArrayList (); 126 127 children.add(child); 128 129 if (root.descendants == null) 130 root.descendants = new ArrayList (); 131 132 root.descendants.add(child); 133 } 134 135 public ArrayList getChildren() 136 { 137 return children; 138 } 139 140 public int getChildSize() 141 { 142 if (children == null) 143 return 0; 144 else 145 return children.size(); 146 } 147 148 public MboxMessage getChild(int index) 149 { 150 return (MboxMessage) children.get(index); 151 } 152 153 public ArrayList getDescendants() 154 { 155 return descendants; 156 } 157 } 158 | Popular Tags |