COMP 310/510
Fall 2013

Lec40: Mixed Data  Dictionareis, WWJ Mapping Library and the map package

Home  Info  Owlspace (310)   Owlspace (510)   Java Resources  Eclipse Resources  Piazza

Mixed Data Dictionaries

The problem with dictionaries is that they are typed to fixed <key, value> types.   One can only put one type of object into a dictionary.    If one wants to put a variety of types of data into the same dictionary, e.g. for configuration information or other common data stores, the superclass of all possible held data types must be used to define the dictionary.    This causes two main problems with type-safety in the application:

  1. The retrieved data must be downcast to be used because it comes out with a type that is too abstract to be useful.
  2. The application must keep track of which keys are related to which types of data.    Nothing prevents incorrect casting at run-time.

What we'd really like a dictionary that enables us to store mixed types of data safely together.   The problem is that Java's type erasure causes the type information to be lost at runtime.   

The soluton is thus to encode the key with the type information of the data to which it refers.   Then, the dictionary can a) restrict any data being stored to only the type or subtype of that the key specifies and b) because of a), can unequivocally retrieve the data with the specific type as defined by the key being used.   

See the documentation for the mixedData package.


WWJ Mapping Library

Please use a message-passing architecture for game server to game client communications -- one of the main points of the final project is to practice thinking in these terms.

Today we will discuss the new World Wind Java mapping library as well as any design issues that have come up over the break.   Here are some links to WWJ references and demos:

A WWJ demo app is available: simply check out the following project:   (Be sure to reconfigure the libraries in the demo to match your system -- it comes configured only for Windows x64)

Word of advice:   Those who accomplish more, earlier, will have first dibs at suggesting and effecting common API changes that would naturally benefit their game the most!   Stragglers will be forced to modify their code to accomodate other people's desires.


map Package

The supplied map package provides some basic WWJ map capabilities such as

See the documentation for the map package.


© 2013 by Stephen Wong