00001 package edu.ksu.cis.bandera.specification.node;
00002
00003
00004
00005 import java.util.*;
00006 import edu.ksu.cis.bandera.specification.analysis.*;
00007
00008 public final class APredicateImport extends PImport
00009 {
00010 private TImport _import_;
00011 private TPredicate _predicate_;
00012 private PImportNames _importNames_;
00013 private TSemicolon _semicolon_;
00014
00015 public APredicateImport()
00016 {
00017 }
00018 public APredicateImport(
00019 TImport _import_,
00020 TPredicate _predicate_,
00021 PImportNames _importNames_,
00022 TSemicolon _semicolon_)
00023 {
00024 setImport(_import_);
00025
00026 setPredicate(_predicate_);
00027
00028 setImportNames(_importNames_);
00029
00030 setSemicolon(_semicolon_);
00031
00032 }
00033 public void apply(Switch sw)
00034 {
00035 ((Analysis) sw).caseAPredicateImport(this);
00036 }
00037 public Object clone()
00038 {
00039 return new APredicateImport(
00040 (TImport) cloneNode(_import_),
00041 (TPredicate) cloneNode(_predicate_),
00042 (PImportNames) cloneNode(_importNames_),
00043 (TSemicolon) cloneNode(_semicolon_));
00044 }
00045 public TImport getImport()
00046 {
00047 return _import_;
00048 }
00049 public PImportNames getImportNames()
00050 {
00051 return _importNames_;
00052 }
00053 public TPredicate getPredicate()
00054 {
00055 return _predicate_;
00056 }
00057 public TSemicolon getSemicolon()
00058 {
00059 return _semicolon_;
00060 }
00061 void removeChild(Node child)
00062 {
00063 if(_import_ == child)
00064 {
00065 _import_ = null;
00066 return;
00067 }
00068
00069 if(_predicate_ == child)
00070 {
00071 _predicate_ = null;
00072 return;
00073 }
00074
00075 if(_importNames_ == child)
00076 {
00077 _importNames_ = null;
00078 return;
00079 }
00080
00081 if(_semicolon_ == child)
00082 {
00083 _semicolon_ = null;
00084 return;
00085 }
00086
00087 }
00088 void replaceChild(Node oldChild, Node newChild)
00089 {
00090 if(_import_ == oldChild)
00091 {
00092 setImport((TImport) newChild);
00093 return;
00094 }
00095
00096 if(_predicate_ == oldChild)
00097 {
00098 setPredicate((TPredicate) newChild);
00099 return;
00100 }
00101
00102 if(_importNames_ == oldChild)
00103 {
00104 setImportNames((PImportNames) newChild);
00105 return;
00106 }
00107
00108 if(_semicolon_ == oldChild)
00109 {
00110 setSemicolon((TSemicolon) newChild);
00111 return;
00112 }
00113
00114 }
00115 public void setImport(TImport node)
00116 {
00117 if(_import_ != null)
00118 {
00119 _import_.parent(null);
00120 }
00121
00122 if(node != null)
00123 {
00124 if(node.parent() != null)
00125 {
00126 node.parent().removeChild(node);
00127 }
00128
00129 node.parent(this);
00130 }
00131
00132 _import_ = node;
00133 }
00134 public void setImportNames(PImportNames node)
00135 {
00136 if(_importNames_ != null)
00137 {
00138 _importNames_.parent(null);
00139 }
00140
00141 if(node != null)
00142 {
00143 if(node.parent() != null)
00144 {
00145 node.parent().removeChild(node);
00146 }
00147
00148 node.parent(this);
00149 }
00150
00151 _importNames_ = node;
00152 }
00153 public void setPredicate(TPredicate node)
00154 {
00155 if(_predicate_ != null)
00156 {
00157 _predicate_.parent(null);
00158 }
00159
00160 if(node != null)
00161 {
00162 if(node.parent() != null)
00163 {
00164 node.parent().removeChild(node);
00165 }
00166
00167 node.parent(this);
00168 }
00169
00170 _predicate_ = node;
00171 }
00172 public void setSemicolon(TSemicolon node)
00173 {
00174 if(_semicolon_ != null)
00175 {
00176 _semicolon_.parent(null);
00177 }
00178
00179 if(node != null)
00180 {
00181 if(node.parent() != null)
00182 {
00183 node.parent().removeChild(node);
00184 }
00185
00186 node.parent(this);
00187 }
00188
00189 _semicolon_ = node;
00190 }
00191 public String toString()
00192 {
00193 return ""
00194 + toString(_import_)
00195 + toString(_predicate_)
00196 + toString(_importNames_)
00197 + toString(_semicolon_);
00198 }
00199 }