public void Initialize() // overwrites constructor { // protons A = 1.0; Z = 1.0; E = 150.0; // MeV/n p_t = p_type.proton; }
public Particle() { // protons A = 1.0; Z = 1.0; E = 150.0; // MeV/n p_t = p_type.proton; }
public void Initialize(double a, double z, double e) // overwrites constructor { A = a; Z = z; E = e; p_t = GetPtype(a, z, e); }
public Particle(p_type p_t) { switch (p_t) { case p_type.photon: { // photon A = 0.0; Z = 0.0; E = 10.0; } break; case p_type.neutron: { // neutron A = 1.0; Z = 0.0; E = 10.0; } break; case p_type.proton: { // proton A = 1.0; Z = 1.0; E = 150.0; } break; case p_type.Si: { // Si ion A = 16.0; Z = 8.0; E = 55.0; } break; case p_type.Fe: { // Fe ion A = 56.0; Z = 26.0; E = 450.0; } break; default: { // protons A = 1.0; Z = 1.0; E = 150.0; // MeV/n p_t = p_type.proton; } break; } }
public static bool IsValidType(string Type) { try { p_type t = (p_type)Enum.Parse(typeof(p_type), Type, true); } catch (ArgumentException) { return(false); } return(true); }
public void ParticleAZ(p_type p_t) { double m_dMass = 0.0, m_dCharge = 0.0; switch (p_t) { case p_type.C: { m_dMass = 12.0; m_dCharge = 6.0; } break; // C ions case p_type.O: { m_dMass = 16.0; m_dCharge = 8.0; } break; // O ions case p_type.Ne: { m_dMass = 20.0; m_dCharge = 10.0; } break; // Ne ions case p_type.Si: { m_dMass = 28.0; m_dCharge = 14.0; } break; // Si ions case p_type.Ar: { m_dMass = 40.0; m_dCharge = 18.0; } break; // Ar ions case p_type.Ti: { m_dMass = 48.0; m_dCharge = 22.0; } break; // Ti ions case p_type.proton: { m_dMass = 1.00; m_dCharge = 1.00; } break; // protons case p_type.Fe: { m_dMass = 56.0; m_dCharge = 26.0; } break; // Fe ions case p_type.He: { m_dMass = 4.00; m_dCharge = 2.00; } break; // He ions default: break; } A = m_dMass; Z = m_dCharge; }
public void EditPort(bool ValidField, p_type Type, char R_W, int Data_size, char Bank, string Memory_size, int Memory_section, bool Relative_address, int Priority, char Anable_emerge, bool Read_bk_address, string Comment) { this.ValidField = ValidField; this.Type = Type; this.R_W = R_W; this.Data_size = Data_size; this.Type = Type; this.Bank = Bank; this.Memory_size = Memory_size; this.Memory_section = Memory_section; this.Relative_address = Relative_address; this.Priority = Priority; this.Anable_emerge = Anable_emerge; this.Read_bk_address = Read_bk_address; this.Comment = Comment; }
public PortEntry(string Name, bool ValidField, p_type Type, char R_W, int Data_size, char Bank, string Memory_size, int Memory_section, bool Relative_address, int Priority, char Anable_emerge, bool Read_bk_address, string Comment) { this.Name = Name; this.ValidField = ValidField; this.Type = Type; this.R_W = R_W; this.Data_size = Data_size; this.Type = Type; this.Bank = Bank; this.Memory_size = Memory_size; this.Memory_section = Memory_section; this.Relative_address = Relative_address; this.Priority = Priority; this.Anable_emerge = Anable_emerge; this.Read_bk_address = Read_bk_address; this.Comment = Comment; IsValid = true; IsComment = false; Reason = ""; Index = -1; }
public p_type GetPtype(double a, double z, double e) { p_type p_t; switch (z) { case 0: { if (a == 1.0) { p_t = p_type.neutron; } else { if (a == 0.0) { p_t = p_type.photon; } else { p_t = p_type.not_known; } } } break; case 1: p_t = p_type.proton; break; case 2: p_t = p_type.He; break; case 6: p_t = p_type.C; break; case 8: p_t = p_type.O; break; case 10: p_t = p_type.Ne; break; case 14: p_t = p_type.Si; break; case 18: p_t = p_type.Ar; break; case 22: p_t = p_type.Ti; break; case 26: p_t = p_type.Fe; break; default: { p_t = p_type.not_known; A = a; Z = z; E = e; } break; } return(p_t); }
public void Initialize(p_type p_t, double e) // overwrites constructor { E = e; ParticleAZ(p_t); }
public void SetPortType(p_type Type) { this.Type = Type; }
private void Load_Click(object sender, EventArgs e) { PortEntry pe = null; DataGridViewRow item_f = null; int i = -1; foreach (DataGridViewRow item in dataGridView1.SelectedRows) { i = (int)item.Cells["Index"].Value; pe = Ports[i]; item_f = item; break; } if (pe == null) { MessageBox.Show("Please select a port in order to edit"); return; } string name = PortNameText.Text; if (!pe.GetName().Equals(name)) { MessageBox.Show("You can't edit a port's name"); PortNameText.Text = pe.GetName(); return; } string memory_size = MemorySizeText.Text; bool valid = ValidCheckBox.Checked; char r_w = R_WCombo.SelectedItem.ToString()[0]; bool relative_address = RelativeAddressCheckBox.Checked; char emergency_enable = 'N'; if (EmergencyCheckBox.Checked) { emergency_enable = 'Y'; } bool debug_enable = DebugCheckBox.Checked; int priority = (int)numericUpDown1.Value; int memory_section = (int)numericUpDown2.Value; int data_size = int.Parse(DataSizeBox.SelectedItem.ToString()); char bank = BankBox.SelectedItem.ToString()[0]; string comment = CommentText.Text; p_type type = (p_type)Enum.Parse(typeof(p_type), TypeOpts.Text, true); if (i == -1) { MessageBox.Show("No such port " + name); InitFields(); return; } if (pe.GetIsComment()) { MessageBox.Show("This port is a comment and can't be edited"); //InitFields(); return; } pe.EditPort(valid, type, r_w, data_size, bank, memory_size, memory_section, relative_address, priority, emergency_enable, debug_enable, comment); OpenValidation(); UpdateDataBase(); EditCell(item_f, pe.GetTableEntry()); //MessageBox.Show(pe.ToString()); saved = false; }