Hi Steve,
what about the structures below?
My intent is not to save space here, but more
to allow loops to iterate like this:
for (int side = 0; side < 2; side++){
  boolean left = (side==0);
  x = blabla.getxyz(left);
...
  blabla.set(left, 4711)
 }

Gerd

RoadDef:
List<AddrRoadInfo> addrList;

class AddrRoadInfo {
  int nodeNumber; // n-th number node in road
  AddrData left,right;

  getAddrData(boolean left){
    return (left)? left:right;
 }
}

class AddrData{
  String zipCode;
  CityInfo city;
  Numbers numbers;
}

class Numbers {
  int start,end;
  NumberStyle style;
}
 

> Date: Mon, 20 Apr 2015 11:55:25 +0100
> From: steve@parabola.me.uk
> To: mkgmap-dev@lists.mkgmap.org.uk
> Subject: Re: [mkgmap-dev] class Numbers
>
> On 20/04/15 10:31, Gerd Petermann wrote:
> > just noticed that img file starts with optional zip code info, followed
> > by optional city info,
> > followed by numbers.
> > So, maybe it is not a good idea to combine them in one class?
>
> It makes a lot of sense to keep them separate I agree. A road with
> more than one city does not even need any road numbers, or there may
> be no road numbers at the point where the city changes.
>
> > Would that make reading difficult?
> It would make reading a little more difficult since you would have to
> merge the two streams, but we don't need to read it for map making
> purposes, only for display. Writing is already pretty difficult, so
> it wouldn't make much difference there ;)
>
> So if it saved a lot of space it would be possible, but I'm not sure
> that it would. Most roads will have one city, so having the two pointers
> for each segment would be wasted space.
>
> > My current thinking is that we should have the number of RoadNumbers
> > before we start to read them (because we have the number of "Number nodes").
> > So, it should be possible to allocate an array of RoadNumbers instances
> > and fill those whenever we have data for one node.
>
> I do think that is a upper bound to the number you will need.
>
> ..Steve
> _______________________________________________
> mkgmap-dev mailing list
> mkgmap-dev@lists.mkgmap.org.uk
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev