next up previous
Next: Required Part 3 Commands Up: Part 3: B+ tree Previous: Friend and Enemy Data

Tentative Partial BNF

The BNF for Part makes use of the properties of dynamic dispatch. That is, your dictionary, spatial data structure, and adjacency list will be storing Site and Locus objects. Generically all Site objects are considered to be Loci. Thus, all of the "Site" related BNF commands have been renamed to "Locus." However, it is important to note that an actual Site object and the generic Locus object have different output types. That is, if you get a <LocusAlreadyExists> error message and the object that already exists is actually of type Site, the use the <Site> format for printing the error message. If the actual type of the object is a generic Locus (not a Site), use the <Locus> format.

The same applies to <Track> which may be of type <OneWayTrack> or <TwoWayTrack>.

This should be a fairly easy task in JAVA if you set up your classes properly. (Hint: overload the toString() method).

<Locus>:=<LocusType>: <LocusName> at (<longitude>,<latitude>) <Radius>
<Radius>:=<ZeroRadius>|<NonZeroRadius>
<ZeroRadius>:= with radius 0
<NonZeroRadius>:=with radius <radius>
<LocusType>:=<SiteType>|interesting place|junction|MASH unit|pantry and supplies|
							shelter|weapons|unassigned
<SiteType>:=air unit|military base|civilian territory|ground unit|hospital
<LocusName>:=<name>

<StartName>:=<LocusName>
<DestinationName>:=<LocusName>
<StartLocus>:=<Locus>
<DestinationLocus>:=<Locus>

<LocusList>:=<Locus><nl><LocusList>|<Locus><nl>

<FindInSiteLocusList>:=<Locus> at distance: <double><nl><FindInSiteLocusList>|
                          <Locus> at distance: <double><nl>
<Track>:= (<StartName><Direction> <DestinationName>)
<Direction>:=<OneWay>|<TwoWay>
<OneWay>:= ==>
<TwoWay>:= <=>

<ListTracks>:=Follow <Track><nl><ListTracks>|Follow <Track><nl>
<Route>:=<ListTracks><nl>Total length: <double><nl> 

<LocusDoesNotExist>:=Error: <LocusName>, does not exist<nl>
<UnableToDeleteLocus>:=Error: <Locus> cannot be deleted because it is mapped<nl>                                            
<LocusNotMapped>:=Error: The locus <Locus> has not been mapped<nl>

<LocusInUse>:=Error: The locus <Locus> cannot be unmapped while any tracks use it
                 as a start or destination<nl>
<LocusAlreadyMapped>:=Error: The locus <Locus> has already been mapped 
                         at those coordinates<nl>
<LocusAlreadyExists>:=Error: The specified locus cannot be created because 
                     <Locus> already exists<nl>
<TrackAlreadyExists>:=Error: The specified track cannot be created because 
                     <Track> already exists<nl>
<StartAndDestinationSame>:=Error: Start locus and destination locus 
                           must be different<nl>
<SpatialIntersection>:=Error: Spacial intersection<nl>

<NoRouteExists>:=Error: No route could be found from <StartLocus> to 
                 <DestinationLocus><nl>
<NoLociEntered>:=No loci entered<nl>

<BPTreeOrderAlreadyInitialized>:=Error: B+ tree already initialized<nl>
<InvalidBPTreeOrder>:=Error: B+ tree order must be greater than or equal to three (3)<nl>
<BPTreeOrderNotYetInitialized>:=Error: B+ tree has yet to be initialized<nl>
<InvalidLocusType>:=Error: Invalid locus type<nl>
<SiteWithZeroRadius>:=Error: Sites must have non-zero radii<nl>
<NotSitePosRadius>:=Error: Only Sites may have non-zero radii<nl>
<SiteNameIsLocus>:=Error: Cannot perform operation on a Locus<nl>
<LocusNameIsSite>:=Error: Cannot perform operation on a Site<nl>



MM Hugue 2004-04-19