Difference between revisions of "PCGen Code Exploration Almanac"
(Initial page) |
(No difference)
|
Revision as of 12:17, 18 October 2013
Introduction
This guide is a collection of strategies and ways to tackle tasks in the PCGen code. It doesn’t try to be an architectural guide, for that I would start with Explanation_of_the_Code_Base , which is a good document to be familiar with. There is also some good info at Architecture
Lst Tokens as an Entry Point
Quite often you will know the data that is associated with a problem or request. An important tip to remember is that almost all LST tokens are processed by a class which starts with the same name. e.g. the kit EQUIPBUY token is processed by the class plugin.lsttokens.kit.startpack.EquipBuyToken
All token classes then have a parse and unparsed method (sometimes it is in a parent class). You can look at these to find out how the token is interpreted and where the value is stored. Generally the token value is stored in a map in the rules object with a specific constant as a key (e.g. Objectkey.EQUIP_BUY). You can use this key to trace where the token value is processed, thus quickly getting to the code you want to look at.
So, typically in Eclipse I will
- Search for a class starting with the token name
- Read through the parse method to see the key used to store the value (or relevant part of the value).
- Open the Call hierarchy for the key to identify where the token’s value is processed.