From: Erik V. <eri...@xs...> - 2011-08-15 19:28:18
|
> -----Original Message----- > From: Stefan Frey [mailto:ste...@we...] > Sent: Monday, August 15, 2011 6:25 PM > To: Development list for Rails: an 18xx game > Subject: Re: [Rails-devel] Stop properties > > Erik: > I tried to change my coding in NetworkVertex accordingly. > Thanks a lot this will simplify the previous code needed to adapt the revenue > code to the algorithm code substantially. > > However as usual with coding one realizes some more thing. > > I think having those attributes are one thing, checking if runThrough or runTo > is possible still requires more than that. > > The best solution would be adding additional methods for if a runThrough > and a runTo is possible for a specific company. Thus it also checks the current > token situation. > > Thus something like > > public boolean runThroughAllowedFor(PublicCompanyI company) public > boolean runToAllowedFor(PublicCompanyI company) Hmm, that does make sense. > >From my perspective you could then define the > isRunToAllowed/isRunThroughAllowed for as private or even remove it, as > this is only required internally. Similar for the according methods in MapHex > or Tile, they only need to be package private and not public. On the supposition that we will never subclass MapHex, Stop and Tile. But that's indeed unlikely. > Even better would be if you could add similar methods. Then all values are > retrieved from the stop object, instead of sometimes querying hex or station > instead. > > * public int getValueAt(PhaseI phase) > Retrieves the current value (either from the related station for cities/towns > or via the MapHex for offboard defined values) > > * public String getName() > Retrieves the name: Either from the hex or if undefined there from the > related station. > > Again this would allow to restrict access/visibility of a lot of related methods > in Stop / Station / MapHex. I think getName() must be public everywhere - it's used in many ways. Ok, this all should be doable, hopefully before I'm going on vacation next week Wednesday for almost three weeks. During my vacation you probably won't hear from me. Erik. |