- Timestamp:
- 08/07/2017 03:10:12 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/structures/MyScriptHandler.java
r41 r45 6 6 package scriptbuilder.structures; 7 7 8 import java.util.ArrayList; 8 9 import java.util.Random; 9 10 import java.util.Stack; … … 63 64 * Map containing all Units. Keys = Unit number. Values = Unit object. 64 65 */ 65 private TreeMap<String, Unit> unitMap;66 private ArrayList<Unit> units; 66 67 67 68 /** … … 246 247 incidentMap = new TreeMap<Integer, ScriptIncident>(); 247 248 eventMap = new TreeMap<ELEMENT, I_ScriptEvent>(); 248 unit Map = new TreeMap<String,Unit>();249 units = new ArrayList<Unit>(); 249 250 pcData = new TreeMap<ELEMENT, String>(); 250 251 docPosition = new Stack<ELEMENT>(); … … 266 267 * @returns Vector of Unit objects. 267 268 */ 268 public Vector<Unit> getUnits()269 { 270 return new Vector<Unit>(unitMap.values());269 public ArrayList<Unit> getUnits() 270 { 271 return units; 271 272 } 272 273 … … 768 769 { 769 770 Location_Info locInfo = new Location_Info(); 770 771 771 772 locInfo.Location_ID = LocationInfoID; 772 773 locInfo.Direction = pcData.remove(ELEMENT.Direction); … … 774 775 locInfo.Route = pcData.remove(ELEMENT.Route); 775 776 locInfo.Postmile = pcData.remove(ELEMENT.Postmile); 776 cad.locInfo.add(locInfo); 777 cad.locInfo.add(locInfo); 777 778 } 778 779 else if (currentElement == ELEMENT.MAINTENANCE_RADIO) … … 785 786 { 786 787 cad.Master_Inc_Num = pcData.remove(currentElement); 788 } 789 else if (currentElement == ELEMENT.P) 790 { 791 cad.P = pcData.remove(currentElement); 787 792 } 788 793 else if (currentElement == ELEMENT.PARAMICS) … … 890 895 else if (currentElement == ELEMENT.NEW_UNIT) 891 896 { 892 if (unitMap.get(NewUnitNum) == null) 893 { 894 Unit unit = new Unit(); 895 unit.UnitNum = NewUnitNum; 896 if (pcData.containsKey(ELEMENT.AGY)) 897 { 898 unit.Agy = pcData.remove(ELEMENT.AGY); 899 } 900 if (pcData.containsKey(ELEMENT.ALIAS)) 901 { 902 unit.Alias = pcData.remove(ELEMENT.ALIAS); 903 } 904 if (pcData.containsKey(ELEMENT.AREA)) 905 { 906 unit.Area = pcData.remove(ELEMENT.AREA); 907 } 908 if (pcData.containsKey(ELEMENT.BADGE_NUM)) 909 { 910 unit.Badge_Num = pcData.remove(ELEMENT.BADGE_NUM); 911 } 912 if (pcData.containsKey(ELEMENT.CURR_LOC)) 913 { 914 unit.Curr_Loc = pcData.remove(ELEMENT.CURR_LOC); 915 } 916 if (pcData.containsKey(ELEMENT.DESTINATION)) 917 { 918 unit.Destination = pcData.remove(ELEMENT.DESTINATION); 919 } 920 if (pcData.containsKey(ELEMENT.ID)) 921 { 922 unit.ID = pcData.remove(ELEMENT.ID); 923 } 924 if (pcData.containsKey(ELEMENT.MASTER_INC_NUM)) 925 { 926 unit.Master_Inc_Num = pcData.remove(ELEMENT.MASTER_INC_NUM); 927 } 928 if (pcData.containsKey(ELEMENT.MISC_INFO)) 929 { 930 unit.Misc_Info = pcData.remove(ELEMENT.MISC_INFO); 931 } 932 if (pcData.containsKey(ELEMENT.OOS)) 933 { 934 unit.OOS = pcData.remove(ELEMENT.OOS); 935 } 936 if (pcData.containsKey(ELEMENT.OFFICE)) 937 { 938 unit.Office = pcData.remove(ELEMENT.OFFICE); 939 } 940 if (pcData.containsKey(ELEMENT.OFFICER)) 941 { 942 unit.Officer = pcData.remove(ELEMENT.OFFICER); 943 } 944 if (pcData.containsKey(ELEMENT.P)) 945 { 946 unit.P = pcData.remove(ELEMENT.P); 947 } 948 if (pcData.containsKey(ELEMENT.PRIMARY)) 949 { 950 unit.Primary = pcData.remove(ELEMENT.PRIMARY); 951 } 952 if (pcData.containsKey(ELEMENT.STACK)) 953 { 954 unit.Stack = pcData.remove(ELEMENT.STACK); 955 } 956 if (pcData.containsKey(ELEMENT.STATUS)) 957 { 958 unit.Status = pcData.remove(ELEMENT.STATUS); 959 } 960 if (pcData.containsKey(ELEMENT.TIMER)) 961 { 962 unit.Timer = pcData.remove(ELEMENT.TIMER); 963 } 964 unitMap.put(NewUnitNum, unit); 965 } 966 } 897 Unit unit = new Unit(); 898 unit.UnitNum = NewUnitNum; 899 if (pcData.containsKey(ELEMENT.AGY)) 900 { 901 unit.Agy = pcData.remove(ELEMENT.AGY); 902 } 903 if (pcData.containsKey(ELEMENT.ALIAS)) 904 { 905 unit.Alias = pcData.remove(ELEMENT.ALIAS); 906 } 907 if (pcData.containsKey(ELEMENT.AREA)) 908 { 909 unit.Area = pcData.remove(ELEMENT.AREA); 910 } 911 if (pcData.containsKey(ELEMENT.BADGE_NUM)) 912 { 913 unit.Badge_Num = pcData.remove(ELEMENT.BADGE_NUM); 914 } 915 if (pcData.containsKey(ELEMENT.CURR_LOC)) 916 { 917 unit.Curr_Loc = pcData.remove(ELEMENT.CURR_LOC); 918 } 919 if (pcData.containsKey(ELEMENT.DESTINATION)) 920 { 921 unit.Destination = pcData.remove(ELEMENT.DESTINATION); 922 } 923 if (pcData.containsKey(ELEMENT.ID)) 924 { 925 unit.ID = pcData.remove(ELEMENT.ID); 926 } 927 if (pcData.containsKey(ELEMENT.MASTER_INC_NUM)) 928 { 929 unit.Master_Inc_Num = pcData.remove(ELEMENT.MASTER_INC_NUM); 930 } 931 if (pcData.containsKey(ELEMENT.MISC_INFO)) 932 { 933 unit.Misc_Info = pcData.remove(ELEMENT.MISC_INFO); 934 } 935 if (pcData.containsKey(ELEMENT.OOS)) 936 { 937 unit.OOS = pcData.remove(ELEMENT.OOS); 938 } 939 if (pcData.containsKey(ELEMENT.OFFICE)) 940 { 941 unit.Office = pcData.remove(ELEMENT.OFFICE); 942 } 943 if (pcData.containsKey(ELEMENT.OFFICER)) 944 { 945 unit.Officer = pcData.remove(ELEMENT.OFFICER); 946 } 947 if (pcData.containsKey(ELEMENT.P)) 948 { 949 unit.P = pcData.remove(ELEMENT.P); 950 } 951 if (pcData.containsKey(ELEMENT.PRIMARY)) 952 { 953 unit.Primary = pcData.remove(ELEMENT.PRIMARY); 954 } 955 if (pcData.containsKey(ELEMENT.STACK)) 956 { 957 unit.Stack = pcData.remove(ELEMENT.STACK); 958 } 959 if (pcData.containsKey(ELEMENT.STATUS)) 960 { 961 unit.Status = pcData.remove(ELEMENT.STATUS); 962 } 963 if (pcData.containsKey(ELEMENT.TIMER)) 964 { 965 unit.Timer = pcData.remove(ELEMENT.TIMER); 966 } 967 units.add(unit); 968 } 969 967 970 else if (qName.equals(ELEMENT.TIME_INDEX.tag)) 968 971 {
Note: See TracChangeset
for help on using the changeset viewer.
