![]() |
ENSDF++ 1.1
An easy, fast and simple way to run querys towards the ENSDF database, written in C++.
|
00001 00008 /* 00009 The isotope class is used to store information about an isotope. 00010 It contains a name (string) as well as number of protons, neutrons and 00011 mass number (ints). It has methods to set number of protons and mass number 00012 and its name. 00013 \author Philippe Klintefelt-Collet, Carl Toft, Rikard Lundmark 00014 */ 00015 import java.util.ArrayList; 00016 00018 public class JIsotope 00019 { 00020 private int A, Z, N; // mass, number of protons, number of neutrons 00021 private String name; 00022 private ArrayList<RGBVector> colorList; 00023 00024 00029 public JIsotope(int Z, int A, String name) 00030 { 00031 colorList = new ArrayList<RGBVector>(); 00032 this.Z = Z; 00033 this.A = A; 00034 N = A-Z; 00035 this.name = name; 00036 } 00037 00038 public JIsotope(int Z, int A, String name, RGBVector rgbVector) 00039 { 00040 this(Z, A, name); 00041 addColor(rgbVector); 00042 } 00043 00044 public void addColor(RGBVector rgbVector) 00045 { 00046 colorList.add(rgbVector); 00047 } 00048 00049 public ArrayList<RGBVector> getColorList() 00050 { 00051 return new ArrayList<RGBVector>(colorList); 00052 } 00053 00055 public int getZ() 00056 { 00057 return Z; 00058 } 00059 00061 public int getA() 00062 { 00063 return A; 00064 } 00065 00067 public int getN() 00068 { 00069 return N; 00070 } 00071 00073 public String getName() 00074 { 00075 return name; 00076 } 00077 00078 //Skulle kunna skrivas som equals(Object o), vilket vore snyggare. 00079 public boolean equals(Object o) 00080 { 00081 if(!(o instanceof JIsotope)) 00082 { 00083 System.out.println("You failed to compare JIsotopes with JIsotope's equals(Object o)-method, and I didn't care to make an exception."); 00084 } 00085 return Z == ((JIsotope)o).getZ() && N == ((JIsotope)o).getN(); 00086 } 00087 }