Changeset 43 in tmcsimulator-scriptbuilder


Ignore:
Timestamp:
08/07/2017 03:08:44 PM (9 years ago)
Author:
bmcguffin
Message:

Filled out toXML method of CadData? object.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/scriptbuilder/structures/CadData.java

    r39 r43  
    2828    public String Master_Inc_Num = ""; 
    2929 
     30    public String P = ""; 
     31 
    3032    public String Info_Type = ""; 
    3133 
     
    3739 
    3840    public String General_Text = ""; 
    39      
     41 
    4042    public String Location_Beat = ""; 
    41      
     43 
     44    public String Location_Address = ""; 
     45 
    4246    public String Location_Loc = ""; 
    43      
     47 
     48    public String Location_City = ""; 
     49 
     50    public String Location_Area = ""; 
     51 
    4452    public String Location_Fire = ""; 
    45      
     53 
    4654    public String Location_Law = ""; 
    47      
     55 
    4856    public String Location_Ems = ""; 
    49      
    50     public String Location_City = ""; 
    51      
    52     public String Location_Address = ""; 
    53      
    54     public String Location_Area = ""; 
    5557 
    5658    public ArrayList<Location_Info> locInfo; 
     
    5961    public String toXML() 
    6062    { 
    61         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
     63        String output = ""; 
     64 
     65        if (!Master_Inc_Num.equals("")) 
     66        { 
     67            output += openTag(ELEMENT.MASTER_INC_NUM.tag); 
     68            output += Master_Inc_Num; 
     69            output += closeTag(ELEMENT.MASTER_INC_NUM.tag); 
     70        } 
     71 
     72        if (!P.equals("")) 
     73        { 
     74            output += openTag(ELEMENT.P.tag); 
     75            output += P; 
     76            output += closeTag(ELEMENT.P.tag); 
     77        } 
     78 
     79        if (hasAdditionalInfo()) 
     80        { 
     81            output += openTag(ELEMENT.ADDITIONAL_INFO.tag); 
     82            output += openTag(ELEMENT.TYPE_CODE.tag); 
     83            output += Info_Type_Code; 
     84            output += closeTag(ELEMENT.TYPE_CODE.tag); 
     85            output += openTag(ELEMENT.TYPE.tag); 
     86            output += Info_Type; 
     87            output += closeTag(ELEMENT.TYPE.tag); 
     88            output += closeTag(ELEMENT.ADDITIONAL_INFO.tag); 
     89        } 
     90 
     91        if (hasLocation()) 
     92        { 
     93            output += openTag(ELEMENT.LOCATION.tag); 
     94            if (!Location_Beat.equals("")) 
     95            { 
     96                output += openTag(ELEMENT.BEAT.tag); 
     97                output += Location_Beat; 
     98                output += closeTag(ELEMENT.BEAT.tag); 
     99            } 
     100 
     101            if (!Location_Address.equals("")) 
     102            { 
     103                output += openTag(ELEMENT.ADDRESS.tag); 
     104                output += Location_Address; 
     105                output += closeTag(ELEMENT.ADDRESS.tag); 
     106            } 
     107 
     108            if (!Location_Loc.equals("")) 
     109            { 
     110                output += openTag(ELEMENT.LOC.tag); 
     111                output += Location_Loc; 
     112                output += closeTag(ELEMENT.LOC.tag); 
     113            } 
     114 
     115            if (!Location_City.equals("")) 
     116            { 
     117                output += openTag(ELEMENT.CITY.tag); 
     118                output += Location_City; 
     119                output += closeTag(ELEMENT.CITY.tag); 
     120            } 
     121 
     122            if (!Location_Area.equals("")) 
     123            { 
     124                output += openTag(ELEMENT.AREA.tag); 
     125                output += Location_Area; 
     126                output += closeTag(ELEMENT.AREA.tag); 
     127            } 
     128 
     129            if (!Location_Fire.equals("")) 
     130            { 
     131                output += openTag(ELEMENT.FIRE.tag); 
     132                output += Location_Fire; 
     133                output += closeTag(ELEMENT.FIRE.tag); 
     134            } 
     135 
     136            if (!Location_Law.equals("")) 
     137            { 
     138                output += openTag(ELEMENT.LAW.tag); 
     139                output += Location_Law; 
     140                output += closeTag(ELEMENT.LAW.tag); 
     141            } 
     142 
     143            if (!Location_Ems.equals("")) 
     144            { 
     145                output += openTag(ELEMENT.EMS.tag); 
     146                output += Location_Ems; 
     147                output += closeTag(ELEMENT.EMS.tag); 
     148            } 
     149 
     150            output += closeTag(ELEMENT.LOCATION.tag); 
     151        } 
     152 
     153        if (!Agy.equals("")) 
     154        { 
     155            output += openTag(ELEMENT.GENERAL.tag); 
     156            output += openTag(ELEMENT.AGY.tag); 
     157            output += Agy; 
     158            output += closeTag(ELEMENT.AGY.tag); 
     159            output += closeTag(ELEMENT.GENERAL.tag); 
     160        } 
     161 
     162        if (hasHeaderInfo()) 
     163        { 
     164            output += openTag(ELEMENT.HEADER_INFO.tag); 
     165 
     166            output += openTag(ELEMENT.Type.tag); 
     167            output += Header_Type; 
     168            output += closeTag(ELEMENT.Type.tag); 
     169 
     170            output += openTag(ELEMENT.Beat.tag); 
     171            output += Header_Beat; 
     172            output += closeTag(ELEMENT.Beat.tag); 
     173 
     174            output += openTag(ELEMENT.TruncLoc.tag); 
     175            output += Header_TruncLoc; 
     176            output += closeTag(ELEMENT.TruncLoc.tag); 
     177 
     178            output += openTag(ELEMENT.FullLoc.tag); 
     179            output += Header_FullLoc; 
     180            output += closeTag(ELEMENT.FullLoc.tag); 
     181 
     182            output += closeTag(ELEMENT.HEADER_INFO.tag); 
     183        } 
     184 
     185        if (locInfo.size() > 0) 
     186        { 
     187            for (Location_Info li : locInfo) 
     188            { 
     189                output += li.toXML(); 
     190            } 
     191        } 
     192 
     193        return output; 
    62194    } 
    63195 
     
    65197    public String openTag(String s) 
    66198    { 
    67         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
     199        return "<" + s + ">"; 
    68200    } 
    69201 
     
    71203    public String closeTag(String s) 
    72204    { 
    73         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
     205        return "</" + s + ">\n"; 
    74206    } 
    75207 
     
    77209    public String emptyTag(String s) 
    78210    { 
    79         throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. 
     211        return "<" + s + "/>\n"; 
     212    } 
     213 
     214    public boolean hasHeaderInfo() 
     215    { 
     216        return !Header_Type.equals("") || !Header_Beat.equals("") 
     217                || !Header_FullLoc.equals("") || !Header_TruncLoc.equals(""); 
     218    } 
     219 
     220    public boolean hasLocation() 
     221    { 
     222        return !Location_Address.equals("") || !Location_Area.equals("") 
     223                || !Location_Beat.equals("") || !Location_City.equals("") 
     224                || !Location_Ems.equals("") || !Location_Fire.equals("") 
     225                || !Location_Law.equals("") || !Location_Loc.equals(""); 
     226    } 
     227 
     228    public boolean hasGeneralInfo() 
     229    { 
     230        return !General_Text.equals("") || !General_Title.equals(""); 
     231    } 
     232 
     233    public boolean hasAdditionalInfo() 
     234    { 
     235        return !Info_Type.equals("") || !Info_Type_Code.equals(""); 
    80236    } 
    81237 
Note: See TracChangeset for help on using the changeset viewer.