tame/core/states.xml

195 lines
12 KiB
XML

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (C) 2017, 2018 R-T Specialty, LLC.
This file is part of tame-core.
tame-core is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<package xmlns="http://www.lovullo.com/rater"
xmlns:c="http://www.lovullo.com/calc"
xmlns:t="http://www.lovullo.com/rater/apply-template"
core="true"
desc="United States">
<import package="base" />
<import package="vector/stub" />
<section title="States">
The type \ref{State} contains each of the States in the United~States,
with the addition of Washington~DC.
The States are 1-indexed and sorted by \emph{abbreviation}\footnote{
States are sorted by abbreviation rather than the State name beacuse
they are most frequently referenced as such.}.
<typedef name="State" desc="States">
<enum type="integer">
<item name="STATE_NONE" value="0" desc="No State" />
<item name="STATE_AK" value="1" desc="Alaska" />
<item name="STATE_AL" value="2" desc="Alabama" />
<item name="STATE_AR" value="3" desc="Arkansas" />
<item name="STATE_AZ" value="4" desc="Arizona" />
<item name="STATE_CA" value="5" desc="California" />
<item name="STATE_CO" value="6" desc="Colorado" />
<item name="STATE_CT" value="7" desc="Connecticut" />
<item name="STATE_DC" value="8" desc="Washington DC" />
<item name="STATE_DE" value="9" desc="Delaware" />
<item name="STATE_FL" value="10" desc="Florida" />
<item name="STATE_GA" value="11" desc="Georgia" />
<item name="STATE_HI" value="12" desc="Hawaii" />
<item name="STATE_IA" value="13" desc="Iowa" />
<item name="STATE_ID" value="14" desc="Idaho" />
<item name="STATE_IL" value="15" desc="Illinois" />
<item name="STATE_IN" value="16" desc="Indiana" />
<item name="STATE_KS" value="17" desc="Kansas" />
<item name="STATE_KY" value="18" desc="Kentucky" />
<item name="STATE_LA" value="19" desc="Louisiana" />
<item name="STATE_MA" value="20" desc="Massachusetts" />
<item name="STATE_MD" value="21" desc="Maryland" />
<item name="STATE_ME" value="22" desc="Maine" />
<item name="STATE_MI" value="23" desc="Michigan" />
<item name="STATE_MN" value="24" desc="Minnesota" />
<item name="STATE_MO" value="25" desc="Missouri" />
<item name="STATE_MS" value="26" desc="Mississippi" />
<item name="STATE_MT" value="27" desc="Montana" />
<item name="STATE_NC" value="28" desc="North Carolina" />
<item name="STATE_ND" value="29" desc="North Dakota" />
<item name="STATE_NE" value="30" desc="Nebraska" />
<item name="STATE_NH" value="31" desc="New Hampshire" />
<item name="STATE_NJ" value="32" desc="New Jersey" />
<item name="STATE_NM" value="33" desc="New Mexico" />
<item name="STATE_NV" value="34" desc="Nevada" />
<item name="STATE_NY" value="35" desc="New York" />
<item name="STATE_OH" value="36" desc="Ohio" />
<item name="STATE_OK" value="37" desc="Oklahoma" />
<item name="STATE_OR" value="38" desc="Oregon" />
<item name="STATE_PA" value="39" desc="Pennsylvania" />
<item name="STATE_RI" value="40" desc="Rhode Island" />
<item name="STATE_SC" value="41" desc="South Carolina" />
<item name="STATE_SD" value="42" desc="South Dakota" />
<item name="STATE_TN" value="43" desc="Tennessee" />
<item name="STATE_TX" value="44" desc="Texas" />
<item name="STATE_UT" value="45" desc="Utah" />
<item name="STATE_VA" value="46" desc="Virginia" />
<item name="STATE_VT" value="47" desc="Vermont" />
<item name="STATE_WA" value="48" desc="Washington" />
<item name="STATE_WI" value="49" desc="Wisconsin" />
<item name="STATE_WV" value="50" desc="West Virginia" />
<item name="STATE_WY" value="51" desc="Wyoming" />
</enum>
</typedef>
</section>
<section title="State Operations">
For operations that involve taking values of all states where order
matters (e.g. for index alignment),
querying the symbol table isn't appropriate,
as it does not guarantee order.
\ref{_for-each-state_} can be used for that purpose;
it exposes the following template values to its body:
\begin{enumerate}
\item \tt{@state_const@} contains the State constant;
\item \tt{@state_upper@} contains the uppercase two-letter State
abbreviation;
\item \tt{@state_lower@} contains the lowercase two-letter State
abbreviation; and
\item \tt{@state_name@} contains the full state name.
\end{enumerate}
This can be used to generate a ^[State vector] by mapping an iteration
index to the State constant~\tt{@state_const@}.
Note that \ref{STATE_NONE} is not in the list.
<template name="_for-each-state_"
desc="Apply body for each State">
<param name="@values@" desc="Body to apply per State" />
<inline-template>
<for-each>
<set state_const="STATE_AK" state_upper="AK" state_lower="ak" state_name="Alaska" />
<set state_const="STATE_AL" state_upper="AL" state_lower="al" state_name="Alabama" />
<set state_const="STATE_AR" state_upper="AR" state_lower="ar" state_name="Arkansas" />
<set state_const="STATE_AZ" state_upper="AZ" state_lower="az" state_name="Arizona" />
<set state_const="STATE_CA" state_upper="CA" state_lower="ca" state_name="California" />
<set state_const="STATE_CO" state_upper="CO" state_lower="co" state_name="Colorado" />
<set state_const="STATE_CT" state_upper="CT" state_lower="ct" state_name="Connecticut" />
<set state_const="STATE_DC" state_upper="DC" state_lower="dc" state_name="Washington DC" />
<set state_const="STATE_DE" state_upper="DE" state_lower="de" state_name="Delaware" />
<set state_const="STATE_FL" state_upper="FL" state_lower="fl" state_name="Florida" />
<set state_const="STATE_GA" state_upper="GA" state_lower="ga" state_name="Georgia" />
<set state_const="STATE_HI" state_upper="HI" state_lower="hi" state_name="Hawaii" />
<set state_const="STATE_IA" state_upper="IA" state_lower="ia" state_name="Iowa" />
<set state_const="STATE_ID" state_upper="ID" state_lower="id" state_name="Idaho" />
<set state_const="STATE_IL" state_upper="IL" state_lower="il" state_name="Illinois" />
<set state_const="STATE_IN" state_upper="IN" state_lower="in" state_name="Indiana" />
<set state_const="STATE_KS" state_upper="KS" state_lower="ks" state_name="Kansas" />
<set state_const="STATE_KY" state_upper="KY" state_lower="ky" state_name="Kentucky" />
<set state_const="STATE_LA" state_upper="LA" state_lower="la" state_name="Louisiana" />
<set state_const="STATE_MA" state_upper="MA" state_lower="ma" state_name="Massachusetts" />
<set state_const="STATE_MD" state_upper="MD" state_lower="md" state_name="Maryland" />
<set state_const="STATE_ME" state_upper="ME" state_lower="me" state_name="Maine" />
<set state_const="STATE_MI" state_upper="MI" state_lower="mi" state_name="Michigan" />
<set state_const="STATE_MN" state_upper="MN" state_lower="mn" state_name="Minnesota" />
<set state_const="STATE_MO" state_upper="MO" state_lower="mo" state_name="Missouri" />
<set state_const="STATE_MS" state_upper="MS" state_lower="ms" state_name="Mississippi" />
<set state_const="STATE_MT" state_upper="MT" state_lower="mt" state_name="Montana" />
<set state_const="STATE_NC" state_upper="NC" state_lower="nc" state_name="North Carolina" />
<set state_const="STATE_ND" state_upper="ND" state_lower="nd" state_name="North Dakota" />
<set state_const="STATE_NE" state_upper="NE" state_lower="ne" state_name="Nebraska" />
<set state_const="STATE_NH" state_upper="NH" state_lower="nh" state_name="New Hampshire" />
<set state_const="STATE_NJ" state_upper="NJ" state_lower="nj" state_name="New Jersey" />
<set state_const="STATE_NM" state_upper="NM" state_lower="nm" state_name="New Mexico" />
<set state_const="STATE_NV" state_upper="NV" state_lower="nv" state_name="Nevada" />
<set state_const="STATE_NY" state_upper="NY" state_lower="ny" state_name="New York" />
<set state_const="STATE_OH" state_upper="OH" state_lower="oh" state_name="Ohio" />
<set state_const="STATE_OK" state_upper="OK" state_lower="ok" state_name="Oklahoma" />
<set state_const="STATE_OR" state_upper="OR" state_lower="or" state_name="Oregon" />
<set state_const="STATE_PA" state_upper="PA" state_lower="pa" state_name="Pennsylvania" />
<set state_const="STATE_RI" state_upper="RI" state_lower="ri" state_name="Rhode Island" />
<set state_const="STATE_SC" state_upper="SC" state_lower="sc" state_name="South Carolina" />
<set state_const="STATE_SD" state_upper="SD" state_lower="sd" state_name="South Dakota" />
<set state_const="STATE_TN" state_upper="TN" state_lower="tn" state_name="Tennessee" />
<set state_const="STATE_TX" state_upper="TX" state_lower="tx" state_name="Texas" />
<set state_const="STATE_UT" state_upper="UT" state_lower="ut" state_name="Utah" />
<set state_const="STATE_VA" state_upper="VA" state_lower="va" state_name="Virginia" />
<set state_const="STATE_VT" state_upper="VT" state_lower="vt" state_name="Vermont" />
<set state_const="STATE_WA" state_upper="WA" state_lower="wa" state_name="Washington" />
<set state_const="STATE_WI" state_upper="WI" state_lower="wi" state_name="Wisconsin" />
<set state_const="STATE_WV" state_upper="WV" state_lower="wv" state_name="West Virginia" />
<set state_const="STATE_WY" state_upper="WY" state_lower="wy" state_name="Wyoming" />
</for-each>
<param-copy name="@values@" />
</inline-template>
</template>
To ease iteration though ^[State vector]s generated with
\ref{_for-each-state_},
a 52~vector \ref{NVEC_STATE_ALL} and classification \ref{state-all}
are provided.
<t:n-vector n="52" name="NVEC_STATE_ALL" value="1" />
<classify as="state-all" desc="Every State in a State vector">
<match on="NVEC_STATE_ALL" />
</classify>
</section>
</package>