From: <th...@us...> - 2008-07-19 22:07:15
|
Revision: 7199 http://pcgen.svn.sourceforge.net/pcgen/?rev=7199&view=rev Author: thpr Date: 2008-07-19 22:03:21 +0000 (Sat, 19 Jul 2008) Log Message: ----------- fix error reporting Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AddLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/AutoLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/RemoveLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/AddLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AddLoader.java 2008-07-19 21:59:46 UTC (rev 7198) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/AddLoader.java 2008-07-19 22:03:21 UTC (rev 7199) @@ -52,7 +52,7 @@ LstUtils.deprecationCheck(token, target, value); if (!token.parse(target, value, level)) { - Logging.errorPrint("Error parsing ADD: " + key + ":" + value); + Logging.errorPrint("Error parsing ADD: " + key + "|" + value); return false; } return true; Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/AutoLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AutoLoader.java 2008-07-19 21:59:46 UTC (rev 7198) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/AutoLoader.java 2008-07-19 22:03:21 UTC (rev 7199) @@ -52,7 +52,7 @@ LstUtils.deprecationCheck(token, target, value); if (!token.parse(target, value, level)) { - Logging.errorPrint("Error parsing AUTO: " + key + ":" + value); + Logging.errorPrint("Error parsing AUTO: " + key + "|" + value); return false; } return true; Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/RemoveLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/RemoveLoader.java 2008-07-19 21:59:46 UTC (rev 7198) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/RemoveLoader.java 2008-07-19 22:03:21 UTC (rev 7199) @@ -53,7 +53,7 @@ if (!token.parse(target, value, level)) { Logging - .errorPrint("Error parsing REMOVE: " + key + ":" + value); + .errorPrint("Error parsing REMOVE: " + key + "|" + value); return false; } return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-12-04 02:42:24
|
Revision: 8530 http://pcgen.svn.sourceforge.net/pcgen/?rev=8530&view=rev Author: thpr Date: 2008-12-04 02:42:14 +0000 (Thu, 04 Dec 2008) Log Message: ----------- [ 2385081 ] SEVERE Reference to Constructed <Entity> is ambiguous Issue#: 2385081 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2008-12-04 02:32:10 UTC (rev 8529) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2008-12-04 02:42:14 UTC (rev 8530) @@ -122,7 +122,7 @@ } @Override - protected void storeObject(PObject pObj) + protected void storeObject(LoadContext context, PObject pObj) { final Language matching = getMatchingObject(pObj); @@ -149,6 +149,7 @@ .compareTo(currentObjDate) > 0)))) { performForget(matching); + context.ref.forget(matching); addGlobalObject(pObj); } } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2008-12-04 02:32:10 UTC (rev 8529) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2008-12-04 02:42:14 UTC (rev 8530) @@ -204,7 +204,7 @@ if (includeObject(source, pObj)) { finishObject(pObj); - storeObject(pObj); + storeObject(context, pObj); } else { @@ -213,7 +213,7 @@ } } - protected void storeObject(final PObject pObj) + protected void storeObject(LoadContext context, PObject pObj) { final T currentObj = getMatchingObject(pObj); @@ -240,6 +240,7 @@ .compareTo(currentObjDate) > 0)))) { performForget(currentObj); + context.ref.forget(currentObj); addGlobalObject(pObj); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-12-06 00:18:08
|
Revision: 8574 http://pcgen.svn.sourceforge.net/pcgen/?rev=8574&view=rev Author: thpr Date: 2008-12-06 00:17:58 +0000 (Sat, 06 Dec 2008) Log Message: ----------- cleanup Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/TokenStore.java Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLstToken.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLoader.java 2008-12-06 00:11:40 UTC (rev 8573) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLoader.java 2008-12-06 00:17:58 UTC (rev 8574) @@ -27,7 +27,6 @@ */ package pcgen.persistence.lst; -import java.util.Map; import java.util.StringTokenizer; import pcgen.core.Globals; @@ -79,8 +78,6 @@ cmpMod.setSourceCampaign(source.getCampaign()); cmpMod.setSourceURI(source.getURI()); - Map<String, LstToken> tokenMap = TokenStore.inst().getTokenMap( - CompanionModLstToken.class); while (colToken.hasMoreTokens()) { final String token = colToken.nextToken().trim(); @@ -111,17 +108,6 @@ { context.commit(); } - else if (tokenMap.containsKey(key)) - { - CompanionModLstToken tok = (CompanionModLstToken) tokenMap.get(key); - LstUtils.deprecationCheck(tok, cmpMod, value); - if (!tok.parse(cmpMod, value)) - { - Logging.errorPrint("Error parsing CompanionMod " - + cmpMod.getDisplayName() + ':' - + source.toString() + ':' + token + "\""); - } - } else if (!PObjectLoader.parseTag(cmpMod, token)) { Logging.replayParsedMessages(); Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLstToken.java 2008-12-06 00:11:40 UTC (rev 8573) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/CompanionModLstToken.java 2008-12-06 00:17:58 UTC (rev 8574) @@ -1,44 +0,0 @@ -/* - * AbilityLstToken - * Copyright 2005 (C) Devon Jones <sou...@ev...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on September 2, 2002, 8:16 AM - * - * Current Ver: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * - */ -package pcgen.persistence.lst; - -import pcgen.core.character.CompanionMod; - -/** - * <code>CompanionModLstToken</code> - * - * @author Devon Jones <sou...@ev...> - */ -public interface CompanionModLstToken extends LstToken -{ - /** - * Parses an CompanionMod object - * @param companionMod - * @param value - * @return true if parse OK - */ - public abstract boolean parse(CompanionMod companionMod, String value); -} Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/TokenStore.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/TokenStore.java 2008-12-06 00:11:40 UTC (rev 8573) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/TokenStore.java 2008-12-06 00:17:58 UTC (rev 8574) @@ -42,7 +42,6 @@ //Campaign data tokenTypeList.add(GlobalLstToken.class); tokenTypeList.add(CampaignLstToken.class); - tokenTypeList.add(CompanionModLstToken.class); tokenTypeList.add(EquipmentLstToken.class); tokenTypeList.add(SourceLstToken.class); //Kits This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2009-10-31 07:17:29
|
Revision: 10869 http://pcgen.svn.sourceforge.net/pcgen/?rev=10869&view=rev Author: jdempsey Date: 2009-10-31 07:17:21 +0000 (Sat, 31 Oct 2009) Log Message: ----------- Fix bug: Tab on blank line in class file reports an error Issue#: 2826872 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2009-10-31 07:14:24 UTC (rev 10868) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2009-10-31 07:17:21 UTC (rev 10869) @@ -419,6 +419,10 @@ { SourceLoader.parseLine(context, line, uri); } + else if (line.trim().length()==0) + { + // Ignore the line + } else if (firstToken.indexOf(COPY_SUFFIX) > 0) { copyLineList.add(new ModEntry(sourceEntry, line, Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-10-31 07:14:24 UTC (rev 10868) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-10-31 07:17:21 UTC (rev 10869) @@ -31,11 +31,9 @@ import pcgen.cdom.enumeration.ObjectKey; import pcgen.cdom.inst.PCClassLevel; import pcgen.core.PCClass; -import pcgen.core.PObject; import pcgen.core.SubClass; import pcgen.core.SubstitutionClass; import pcgen.core.analysis.PCClassKeyChange; -import pcgen.core.prereq.Prerequisite; import pcgen.persistence.PersistenceLayerException; import pcgen.persistence.SystemLoader; import pcgen.persistence.lst.utils.DeferredLine; @@ -268,7 +266,7 @@ Logging.errorPrint("Expected a level value, but got '" + lineIdentifier + "' instead (as a level line in " + pcClass.getKeyName() + ") in source " + source.getURI()); - Logging.errorPrint(" Rest of line was: + " + restOfLine); + Logging.errorPrint(" Rest of line was: " + restOfLine); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2010-12-01 02:59:05
|
Revision: 14017 http://pcgen.svn.sourceforge.net/pcgen/?rev=14017&view=rev Author: thpr Date: 2010-12-01 02:58:58 +0000 (Wed, 01 Dec 2010) Log Message: ----------- Eliminate LanguageLoader (use GenericLoader) Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2010-12-01 02:54:03 UTC (rev 14016) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2010-12-01 02:58:58 UTC (rev 14017) @@ -1,127 +0,0 @@ -/* - * LanguageLoader.java - * Copyright 2001 (C) Bryan McRoberts <mer...@ya...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on February 22, 2002, 10:29 PM - * - * $Id$ - */ -package pcgen.persistence.lst; - -import java.util.StringTokenizer; - -import pcgen.cdom.enumeration.ObjectKey; -import pcgen.core.Language; -import pcgen.persistence.PersistenceLayerException; -import pcgen.persistence.SystemLoader; -import pcgen.rules.context.LoadContext; -import pcgen.util.Logging; - -/** - * - * @author David Rice <dav...@jc...> - * @version $Revision$ - */ -final class LanguageLoader extends LstObjectFileLoader<Language> -{ - /** Creates a new instance of LanguageLoader */ - public LanguageLoader() - { - super(); - } - - /** - * @see pcgen.persistence.lst.LstObjectFileLoader#parseLine(LoadContext, pcgen.core.PObject, java.lang.String, pcgen.persistence.lst.CampaignSourceEntry) - */ - @Override - public Language parseLine(LoadContext context, Language aLang, - String lstLine, SourceEntry source) throws PersistenceLayerException - { - Language lang = aLang; - - boolean isnew = false; - if (lang == null) - { - lang = new Language(); - isnew = true; - } - - final StringTokenizer colToken = - new StringTokenizer(lstLine, SystemLoader.TAB_DELIM); - - if (colToken.hasMoreTokens()) - { - lang.setName(colToken.nextToken()); - lang.put(ObjectKey.SOURCE_CAMPAIGN, source.getCampaign()); - lang.setSourceURI(source.getURI()); - if (isnew) - { - context.addStatefulInformation(lang); - context.ref.importObject(lang); - } - } - - while (colToken.hasMoreTokens()) - { - final String token = colToken.nextToken().trim(); - final int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging - .errorPrint("Invalid Token - does not contain a colon: '" - + token - + "' in Language " - + lang.getDisplayName() + " of " + source); - continue; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: '" - + token + "' in Language " + lang.getDisplayName() - + " of " + source); - continue; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(lang, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); - } - - completeObject(context, source, lang); - return null; - } - - /** - * @see pcgen.persistence.lst.LstObjectFileLoader#getObjectKeyed(LoadContext, java.lang.String) - */ - @Override - protected Language getObjectKeyed(LoadContext context, String aKey) - { - return context.ref.silentlyGetConstructedCDOMObject(Language.class, aKey); - } - -} Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2010-12-01 02:54:03 UTC (rev 14016) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2010-12-01 02:58:58 UTC (rev 14017) @@ -69,6 +69,7 @@ import pcgen.core.EquipmentModifier; import pcgen.core.GameMode; import pcgen.core.Globals; +import pcgen.core.Language; import pcgen.core.PCTemplate; import pcgen.core.PlayerCharacter; import pcgen.core.Race; @@ -186,7 +187,7 @@ } }; - private LanguageLoader languageLoader = new LanguageLoader(); + private GenericLoader<Language> languageLoader = new GenericLoader<Language>(Language.class); private LoadInfoLoader loadInfoLoader = new LoadInfoLoader(); private UnitSetLoader unitSetLoader = new UnitSetLoader(); private EquipSlotLoader eqSlotLoader = new EquipSlotLoader(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-12-06 00:22:06
|
Revision: 8575 http://pcgen.svn.sourceforge.net/pcgen/?rev=8575&view=rev Author: thpr Date: 2008-12-06 00:22:02 +0000 (Sat, 06 Dec 2008) Log Message: ----------- cleanup Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLstToken.java Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLoader.java 2008-12-06 00:17:58 UTC (rev 8574) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLoader.java 2008-12-06 00:22:02 UTC (rev 8575) @@ -1,150 +0,0 @@ -/* - * EquipmentModifierLoader.java - * Copyright 2001 (C) Bryan McRoberts <mer...@ya...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on February 22, 2002, 10:29 PM - * - * $Id$ - */ -package pcgen.persistence.lst; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.StringTokenizer; - -import pcgen.base.lang.UnreachableError; -import pcgen.cdom.base.Constants; -import pcgen.core.Campaign; -import pcgen.core.EquipmentModifier; -import pcgen.core.Globals; -import pcgen.persistence.PersistenceLayerException; -import pcgen.persistence.SystemLoader; -import pcgen.rules.context.LoadContext; -import pcgen.util.Logging; - -/** - * - * @author David Rice <dav...@jc...> - * @version $Revision$ - */ -public final class EquipmentModifierLoader extends - LstObjectFileLoader<EquipmentModifier> { - @Override - protected EquipmentModifier getObjectKeyed(String aKey) - { - return Globals.getContext().ref.silentlyGetConstructedCDOMObject( - EquipmentModifier.class, aKey); - } - - @Override - public EquipmentModifier parseLine(LoadContext context, - EquipmentModifier eqMod, String inputLine, CampaignSourceEntry source) - throws PersistenceLayerException { - boolean isnew = false; - if (eqMod == null) { - eqMod = new EquipmentModifier(); - isnew = true; - } - - final StringTokenizer colToken = new StringTokenizer(inputLine, - SystemLoader.TAB_DELIM); - - if (colToken.hasMoreTokens()) - { - eqMod.setName(colToken.nextToken().replace('|', ' ')); - eqMod.setSourceCampaign(source.getCampaign()); - eqMod.setSourceURI(source.getURI()); - if (isnew) - { - context.ref.importObject(eqMod); - } - } - - while (colToken.hasMoreTokens()) { - final String token = colToken.nextToken().trim(); - final int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); - continue; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); - continue; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(eqMod, key, value)) - { - context.commit(); - } - else if (!PObjectLoader.parseTag(eqMod, token)) - { - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); - } - - completeObject(context, source, eqMod); - return null; - } - - @Override - protected void performForget(EquipmentModifier objToForget) { - throw new java.lang.UnsupportedOperationException( - "Cannot FORGET an EquipmentModifier"); - } - - /** - * This method adds the default available equipment modifiers to the - * Globals. - * @throws PersistenceLayerException - * - * @throws PersistenceLayerException - * if some bizarre error occurs, likely due to a change in - * EquipmentModifierLoader - */ - public void addDefaultEquipmentMods(LoadContext context) throws PersistenceLayerException { - CampaignSourceEntry source; - try { - source = new CampaignSourceEntry(new Campaign(), - new URI("file:/" + getClass().getName() + ".java")); - } catch (URISyntaxException e) { - throw new UnreachableError(e); - } - String aLine; - aLine = "Add Type\tKEY:ADDTYPE\tTYPE:ALL\tCOST:0\tNAMEOPT:NONAME\tSOURCELONG:PCGen Internal\tCHOOSE:EQBUILDER.EQTYPE|COUNT=ALL|TITLE=desired TYPE(s)"; - parseLine(context, null, aLine, source); - - // - // Add internal equipment modifier for adding weapon/armor types to - // equipment - // - aLine = Constants.s_INTERNAL_EQMOD_WEAPON - + "\tTYPE:Weapon\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME"; - parseLine(context, null, aLine, source); - - aLine = Constants.s_INTERNAL_EQMOD_ARMOR - + "\tTYPE:Armor\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME"; - parseLine(context, null, aLine, source); - } -} Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLstToken.java 2008-12-06 00:17:58 UTC (rev 8574) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/EquipmentModifierLstToken.java 2008-12-06 00:22:02 UTC (rev 8575) @@ -1,44 +0,0 @@ -/* - * EquipmentModifierLstToken - * Copyright 2005 (C) Devon Jones <sou...@ev...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on September 2, 2002, 8:16 AM - * - * Current Ver: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * - */ -package pcgen.persistence.lst; - -import pcgen.core.EquipmentModifier; - -/** - * <code>EquipmentModifierLstToken</code> - * - * @author Devon Jones <sou...@ev...> - */ -public interface EquipmentModifierLstToken extends LstToken -{ - /** - * Parses an Equipment object - * @param mod - * @param value - * @return true if parse OK - */ - public abstract boolean parse(EquipmentModifier mod, String value); -} Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2008-12-06 00:17:58 UTC (rev 8574) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2008-12-06 00:22:02 UTC (rev 8575) @@ -61,6 +61,7 @@ import pcgen.core.Domain; import pcgen.core.Equipment; import pcgen.core.EquipmentList; +import pcgen.core.EquipmentModifier; import pcgen.core.GameMode; import pcgen.core.Globals; import pcgen.core.PCAlignment; @@ -233,7 +234,7 @@ private PCClassLoader classLoader = new PCClassLoader(); private GenericLoader<PCTemplate> templateLoader = new GenericLoader<PCTemplate>(PCTemplate.class); private EquipmentLoader equipmentLoader = new EquipmentLoader(); - private EquipmentModifierLoader eqModLoader = new EquipmentModifierLoader(); + private GenericLoader<EquipmentModifier> eqModLoader = new GenericLoader<EquipmentModifier>(EquipmentModifier.class); private CompanionModLoader companionModLoader = new CompanionModLoader(); private KitLoader kitLoader = new KitLoader(); private PaperInfoLoader paperLoader = new PaperInfoLoader(); @@ -533,7 +534,7 @@ checkRequiredDeities(context); // Add default EQ mods - eqModLoader.addDefaultEquipmentMods(context); + addDefaultEquipmentMods(context); classLoader.loadSubLines(context); @@ -582,6 +583,33 @@ } } + private void addDefaultEquipmentMods(LoadContext context) + throws PersistenceLayerException + { + CampaignSourceEntry source; + try { + source = new CampaignSourceEntry(new Campaign(), + new URI("file:/" + eqModLoader.getClass().getName() + ".java")); + } catch (URISyntaxException e) { + throw new UnreachableError(e); + } + String aLine; + aLine = "Add Type\tKEY:ADDTYPE\tTYPE:ALL\tCOST:0\tNAMEOPT:NONAME\tSOURCELONG:PCGen Internal\tCHOOSE:EQBUILDER.EQTYPE|COUNT=ALL|TITLE=desired TYPE(s)"; + eqModLoader.parseLine(context, null, aLine, source); + + // + // Add internal equipment modifier for adding weapon/armor types to + // equipment + // + aLine = Constants.s_INTERNAL_EQMOD_WEAPON + + "\tTYPE:Weapon\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME"; + eqModLoader.parseLine(context, null, aLine, source); + + aLine = Constants.s_INTERNAL_EQMOD_ARMOR + + "\tTYPE:Armor\tVISIBLE:NO\tCHOOSE:NOCHOICE\tNAMEOPT:NONAME"; + eqModLoader.parseLine(context, null, aLine, source); + } + private void validateAbilityCategories(GameMode gamemode) { for (AbilityCategory ac : gamemode.getAllAbilityCategories()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2008-12-07 17:03:44
|
Revision: 8596 http://pcgen.svn.sourceforge.net/pcgen/?rev=8596&view=rev Author: thpr Date: 2008-12-07 17:03:39 +0000 (Sun, 07 Dec 2008) Log Message: ----------- dead code removal Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/EqModChooseLstToken.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/KitLstToken.java Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/EqModChooseLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/EqModChooseLstToken.java 2008-12-07 16:55:40 UTC (rev 8595) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/EqModChooseLstToken.java 2008-12-07 17:03:39 UTC (rev 8596) @@ -1,38 +0,0 @@ -/* - * ChooseLstToken - * Copyright 2007 (C) Thomas Parker <th...@us...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on February 23, 2007 - * - * Current Ver: $Revision: 197 $ - * Last Editor: $Author: nuance $ - * Last Edited: $Date: 2006-03-14 17:59:43 -0500 (Tue, 14 Mar 2006) $ - * - */ -package pcgen.persistence.lst; - -import pcgen.core.EquipmentModifier; - -/** - * <code>ChooseLstToken</code> - * - * @author Thomas Parker <th...@us...> - */ -public interface EqModChooseLstToken extends LstToken -{ - public abstract boolean parse(EquipmentModifier mod, String prefix, String value); -} Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/KitLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/KitLstToken.java 2008-12-07 16:55:40 UTC (rev 8595) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/KitLstToken.java 2008-12-07 17:03:39 UTC (rev 8596) @@ -1,51 +0,0 @@ -/* - * KitLstToken - * Copyright 2006 (C) Aaron Divinsky <boo...@ya...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on March 3, 2006 - * - * Current Ver: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * - */ -package pcgen.persistence.lst; - -import java.net.URI; - -import pcgen.core.Kit; -import pcgen.persistence.PersistenceLayerException; -import pcgen.rules.persistence.token.AbstractToken; - -/** - * <code>KitLstToken</code> - * - * @author Aaron Divinsky <boo...@ya...> - */ -public abstract class KitLstToken extends AbstractToken implements LstToken -{ - /** - * Parses a Kit object - * @param aKit the Kit object to add this information to - * @param value the token string - * @return true if parse OK - * @throws PersistenceLayerException - */ - public abstract boolean parse(Kit aKit, String value, URI source) - throws PersistenceLayerException; - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2009-01-07 02:13:51
|
Revision: 8913 http://pcgen.svn.sourceforge.net/pcgen/?rev=8913&view=rev Author: thpr Date: 2009-01-07 02:13:46 +0000 (Wed, 07 Jan 2009) Log Message: ----------- [ 2385081 ] SEVERE Reference to Constructed <Entity> is ambiguous Issue#: 2385081 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2009-01-07 01:23:32 UTC (rev 8912) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2009-01-07 02:13:46 UTC (rev 8913) @@ -26,9 +26,7 @@ import java.util.StringTokenizer; import pcgen.cdom.enumeration.ObjectKey; -import pcgen.core.Globals; import pcgen.core.Language; -import pcgen.core.PObject; import pcgen.core.SettingsHandler; import pcgen.persistence.PersistenceLayerException; import pcgen.persistence.SystemLoader; @@ -124,7 +122,7 @@ } @Override - protected void storeObject(LoadContext context, PObject pObj) + protected void storeObject(LoadContext context, Language pObj) { final Language matching = getMatchingObject(context, pObj); Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2009-01-07 01:23:32 UTC (rev 8912) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstObjectFileLoader.java 2009-01-07 02:13:46 UTC (rev 8913) @@ -182,7 +182,7 @@ * @since 5.11 */ public void completeObject(LoadContext context, CampaignSourceEntry source, - final PObject pObj) throws PersistenceLayerException + final T pObj) throws PersistenceLayerException { if (!processComplete || pObj == null) { @@ -201,7 +201,7 @@ } } - protected void storeObject(LoadContext context, PObject pObj) + protected void storeObject(LoadContext context, T pObj) { final T currentObj = getMatchingObject(context, pObj); @@ -229,6 +229,10 @@ performForget(context, currentObj); addGlobalObject(pObj); } + else + { + performForget(context, pObj); + } } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2009-01-16 22:47:14
|
Revision: 9023 http://pcgen.svn.sourceforge.net/pcgen/?rev=9023&view=rev Author: thpr Date: 2009-01-16 21:39:52 +0000 (Fri, 16 Jan 2009) Log Message: ----------- [ 2513829 ] SEVERE Error: No Domain objects (false positive) Issue#: 2513829 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2009-01-16 18:15:41 UTC (rev 9022) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstSystemLoader.java 2009-01-16 21:39:52 UTC (rev 9023) @@ -585,7 +585,7 @@ bioLoader.loadLstFiles(context, bioSetFileList); // Check for the default deities - checkRequiredDeities(context); + checkRequiredDeities(specificGameModeDir, context); // Add default EQ mods addDefaultEquipmentMods(context); @@ -616,13 +616,18 @@ private void addDefaultEquipmentMods(LoadContext context) throws PersistenceLayerException { - CampaignSourceEntry source; - try { - source = new CampaignSourceEntry(new Campaign(), - new URI("file:/" + eqModLoader.getClass().getName() + ".java")); - } catch (URISyntaxException e) { + URI uri; + try + { + uri = new URI("file:/" + eqModLoader.getClass().getName() + ".java"); + } + catch (URISyntaxException e) + { throw new UnreachableError(e); } + context.setSourceURI(uri); + CampaignSourceEntry source = new CampaignSourceEntry(new Campaign(), + uri); String aLine; aLine = "Add Type\tKEY:ADDTYPE\tTYPE:ALL\tCOST:0\tNAMEOPT:NONAME\tSOURCELONG:PCGen Internal\tCHOOSE:EQBUILDER.EQTYPE|COUNT=ALL|TITLE=desired TYPE(s)"; eqModLoader.parseLine(context, null, aLine, source); @@ -905,8 +910,9 @@ * method being invoked more than once, a change to DeityLoader, or * an invalid LST file containing the default deities. */ - private void checkRequiredDeities(LoadContext context) throws PersistenceLayerException + private void checkRequiredDeities(File dir, LoadContext context) throws PersistenceLayerException { + context.setSourceURI(new File(dir, "miscinfo.lst").toURI()); // // Add in the default deities (unless they're already there) // Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-01-16 18:15:41 UTC (rev 9022) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-01-16 21:39:52 UTC (rev 9023) @@ -540,6 +540,7 @@ { for (DeferredLine dl : sc.getSafeListFor(ListKey.SUB_CLASS_LEVEL)) { + context.setSourceURI(dl.source.getURI()); String lstLine = dl.lstLine; try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2009-02-06 22:29:30
|
Revision: 9294 http://pcgen.svn.sourceforge.net/pcgen/?rev=9294&view=rev Author: thpr Date: 2009-02-06 22:29:28 +0000 (Fri, 06 Feb 2009) Log Message: ----------- propagate SVN 9292 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCAlignmentLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCCheckLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -87,16 +87,20 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in Ability " + + anAbility.getDisplayName() + " of " + source); continue; } else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + { + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in Ability " + anAbility.getDisplayName() + + " of " + source); continue; - } + } String key = token.substring(0, colonLoc); String value = (colonLoc == token.length() - 1) ? null : token Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -96,14 +96,14 @@ final int colonLoc = inputLine.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid line - does not contain a colon: " - + inputLine); + Logging.errorPrint("Invalid Line - does not contain a colon: '" + + inputLine + "' in Campaign " + sourceURI); return; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid line - starts with a colon: " - + inputLine); + Logging.errorPrint("Invalid Line - starts with a colon: '" + + inputLine + "' in Campaign " + sourceURI); return; } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -127,14 +127,20 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in " + + po.getClass().getSimpleName() + + " " + + po.getDisplayName() + " of " + source); continue; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in " + po.getClass().getSimpleName() + " " + + po.getDisplayName() + " of " + source); continue; } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LanguageLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -83,16 +83,20 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in Language " + + lang.getDisplayName() + " of " + source); continue; } else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + { + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in Language " + lang.getDisplayName() + + " of " + source); continue; - } + } String key = token.substring(0, colonLoc); String value = (colonLoc == token.length() - 1) ? null : token Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCAlignmentLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCAlignmentLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCAlignmentLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -66,14 +66,20 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in Alignment " + + alignment.getDisplayName() + + " of " + + sourceURI); continue; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in alignment " + + alignment.getDisplayName() + " of " + sourceURI); continue; } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCCheckLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCCheckLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCCheckLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -64,14 +64,19 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in check " + + obj.getDisplayName() + + " of " + sourceURI); continue; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in check " + obj.getDisplayName() + + " of " + sourceURI); continue; } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCClassLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -287,14 +287,18 @@ int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in Class " + + pcClass.getDisplayName() + " of " + source); continue; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in Class " + pcClass.getDisplayName() + + " of " + source); continue; } @@ -337,16 +341,20 @@ int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in Class " + + pcClass.getDisplayName() + " of " + source); continue; } else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + { + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in Class " + pcClass.getDisplayName() + + " of " + source); continue; - } + } String key = token.substring(0, colonLoc); String value = (colonLoc == token.length() - 1) ? null : token Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLoader.java 2009-02-06 19:02:55 UTC (rev 9293) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLoader.java 2009-02-06 22:29:28 UTC (rev 9294) @@ -66,14 +66,18 @@ final int colonLoc = token.indexOf(':'); if (colonLoc == -1) { - Logging.errorPrint("Invalid Token - does not contain a colon: " - + token); + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in PCStat " + + stat.getDisplayName() + " of " + sourceURI); continue; } else if (colonLoc == 0) { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in PCStat " + stat.getDisplayName() + + " of " + sourceURI); continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2009-03-28 20:34:07
|
Revision: 9788 http://pcgen.svn.sourceforge.net/pcgen/?rev=9788&view=rev Author: thpr Date: 2009-03-28 20:34:05 +0000 (Sat, 28 Mar 2009) Log Message: ----------- cleanup Removed Paths: ------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLstToken.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/SizeAdjustmentLstToken.java Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLstToken.java 2009-03-28 20:05:12 UTC (rev 9787) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/PCStatLstToken.java 2009-03-28 20:34:05 UTC (rev 9788) @@ -1,44 +0,0 @@ -/* - * PCStatLstToken.java - * Copyright 2006 (C) Devon Jones <sou...@ev...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on September 2, 2002, 8:16 AM - * - * Current Ver: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * - */ -package pcgen.persistence.lst; - -import pcgen.core.PCStat; - -/** - * <code>PCStatLstToken</code> - * - * @author Devon Jones <sou...@ev...> - */ -public interface PCStatLstToken extends LstToken -{ - /** - * Parse the token - * @param stat - * @param value - * @return true if successful - */ - public abstract boolean parse(PCStat stat, String value); -} Deleted: Trunk/pcgen/code/src/java/pcgen/persistence/lst/SizeAdjustmentLstToken.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/SizeAdjustmentLstToken.java 2009-03-28 20:05:12 UTC (rev 9787) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/SizeAdjustmentLstToken.java 2009-03-28 20:34:05 UTC (rev 9788) @@ -1,43 +0,0 @@ -/* - * SizeAdjustmentLstToken.java - * Copyright 2005 (C) Devon Jones <sou...@ev...> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * Created on September 2, 2002, 8:16 AM - * - * Current Ver: $Revision$ - * Last Editor: $Author$ - * Last Edited: $Date$ - * - */ -package pcgen.persistence.lst; - -import pcgen.core.SizeAdjustment; - -/** - * <code>SizeAdjustmentLstToken</code> - * - * @author Devon Jones <sou...@ev...> - */ -public interface SizeAdjustmentLstToken extends LstToken -{ - /** - * @param sa - * @param value - * @return true if parse OK - */ - public abstract boolean parse(SizeAdjustment sa, String value); -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <th...@us...> - 2012-12-08 22:47:46
|
Revision: 18566 http://sourceforge.net/p/pcgen/code/18566 Author: thpr Date: 2012-12-08 22:47:42 +0000 (Sat, 08 Dec 2012) Log Message: ----------- Extract out common token processing code to LstUtils Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/LoadInfoLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstUtils.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/SimpleLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/SpellLoader.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/AbilityLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -84,38 +84,7 @@ } while (colToken.hasMoreTokens()) { - final String token = colToken.nextToken().trim(); - final int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging - .errorPrint("Invalid Token - does not contain a colon: '" - + token - + "' in Ability " - + anAbility.getDisplayName() + " of " + source); - continue; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: '" - + token + "' in Ability " + anAbility.getDisplayName() - + " of " + source); - continue; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(anAbility, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); + LstUtils.processToken(context, anAbility, source, colToken.nextToken().trim()); } completeObject(context, source, anAbility); Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -94,33 +94,7 @@ public void parseLine(LoadContext context, String inputLine, URI sourceURI) throws PersistenceLayerException { - final int colonLoc = inputLine.indexOf(':'); - if (colonLoc == -1) - { - Logging.errorPrint("Invalid Line - does not contain a colon: '" - + inputLine + "' in Campaign " + sourceURI); - return; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Line - starts with a colon: '" - + inputLine + "' in Campaign " + sourceURI); - return; - } - - String key = inputLine.substring(0, colonLoc); - String value = (colonLoc == inputLine.length() - 1) ? null : inputLine - .substring(colonLoc + 1); - if (context.processToken(campaign, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); + LstUtils.processToken(context, campaign, sourceURI, inputLine); } /** Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/GenericLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -27,7 +27,6 @@ import pcgen.persistence.PersistenceLayerException; import pcgen.persistence.SystemLoader; import pcgen.rules.context.LoadContext; -import pcgen.util.Logging; /** * @@ -38,7 +37,7 @@ LstObjectFileLoader<T> { private final Class<T> baseClass; - + public GenericLoader(Class<T> cl) { if (cl == null) @@ -76,12 +75,12 @@ * @see pcgen.persistence.lst.LstObjectFileLoader#parseLine(LoadContext, CDOMObject, String, SourceEntry) */ @Override - public T parseLine(LoadContext context, T aWP, String lstLine, + public T parseLine(LoadContext context, T object, String lstLine, SourceEntry source) throws PersistenceLayerException { T po; boolean isnew = false; - if (aWP == null) + if (object == null) { try { @@ -99,7 +98,7 @@ } else { - po = aWP; + po = object; } final StringTokenizer colToken = new StringTokenizer(lstLine, @@ -118,40 +117,7 @@ while (colToken.hasMoreTokens()) { - final String token = colToken.nextToken().trim(); - final int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging - .errorPrint("Invalid Token - does not contain a colon: '" - + token - + "' in " - + po.getClass().getSimpleName() - + " " - + po.getDisplayName() + " of " + source); - continue; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: '" - + token + "' in " + po.getClass().getSimpleName() + " " - + po.getDisplayName() + " of " + source); - continue; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(po, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); + LstUtils.processToken(context, po, source, colToken.nextToken()); } // One line each; finish the object and return null Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LoadInfoLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LoadInfoLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LoadInfoLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -51,7 +51,7 @@ { LoadInfo loadable = context.ref.constructNowIfNecessary(LoadInfo.class, getGameMode()); - processToken(context, loadable, firstToken, sourceURI); + LstUtils.processToken(context, loadable, sourceURI, firstToken); return loadable; } } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstUtils.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstUtils.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/LstUtils.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -25,9 +25,12 @@ import java.net.URI; import pcgen.cdom.base.CDOMObject; +import pcgen.cdom.base.Loadable; import pcgen.core.bonus.BonusObj; +import pcgen.persistence.PersistenceLayerException; +import pcgen.rules.context.LoadContext; +import pcgen.system.LanguageBundle; import pcgen.util.Logging; -import pcgen.system.LanguageBundle; /** * Utility class to assist with LST files @@ -124,4 +127,46 @@ { Logging.deprecationPrint(warning); } + + /* + * Probably useful elsewhere... + */ + static void processToken(LoadContext context, Loadable po, + Object source, String tok) throws PersistenceLayerException + { + final String token = tok.trim(); + final int colonLoc = token.indexOf(':'); + if (colonLoc == -1) + { + Logging + .errorPrint("Invalid Token - does not contain a colon: '" + + token + + "' in " + + po.getClass().getSimpleName() + + " " + + po.getDisplayName() + " of " + source); + return; + } + else if (colonLoc == 0) + { + Logging.errorPrint("Invalid Token - starts with a colon: '" + + token + "' in " + po.getClass().getSimpleName() + " " + + po.getDisplayName() + " of " + source); + return; + } + + String key = token.substring(0, colonLoc); + String value = (colonLoc == token.length() - 1) ? null : token + .substring(colonLoc + 1); + if (context.processToken(po, key, value)) + { + context.commit(); + } + else + { + context.rollback(); + Logging.replayParsedMessages(); + } + Logging.clearParseMessages(); + } } Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/SimpleLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/SimpleLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/SimpleLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -24,7 +24,6 @@ import pcgen.persistence.PersistenceLayerException; import pcgen.persistence.SystemLoader; import pcgen.rules.context.LoadContext; -import pcgen.util.Logging; public class SimpleLoader<T extends Loadable> extends LstLineFileLoader { @@ -54,48 +53,10 @@ while (colToken.hasMoreTokens()) { - String token = colToken.nextToken().trim(); - processToken(context, loadable, token, sourceURI); + LstUtils.processToken(context, loadable, sourceURI, colToken.nextToken().trim()); } } - protected void processToken(LoadContext context, Loadable loadable, - String token, URI sourceURI) throws PersistenceLayerException - { - int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging.errorPrint("Invalid Token - does not contain a colon: '" - + token + "' in " + loadable.getClass().getSimpleName() - + " " + loadable.getDisplayName() + " of " + sourceURI); - return; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: '" + token - + "' in " + loadable.getClass().getSimpleName() + " " - + loadable.getDisplayName() + " of " + sourceURI); - return; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(loadable, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.errorPrint("Error found loading " + loadable.getClass() - + " " + loadable.getDisplayName() + " from " - + loadable.getSourceURI()); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); - } - protected Loadable getLoadable(LoadContext context, String firstToken, URI sourceURI) throws PersistenceLayerException { Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/SpellLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/SpellLoader.java 2012-12-08 19:31:25 UTC (rev 18565) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/SpellLoader.java 2012-12-08 22:47:42 UTC (rev 18566) @@ -36,7 +36,6 @@ import pcgen.persistence.PersistenceLayerException; import pcgen.persistence.SystemLoader; import pcgen.rules.context.LoadContext; -import pcgen.util.Logging; /** * @@ -84,34 +83,7 @@ while (colToken.hasMoreElements()) { - final String token = colToken.nextToken().trim(); - final int colonLoc = token.indexOf(':'); - if (colonLoc == -1) - { - Logging.errorPrint("Invalid Token - does not contain a colon: '" - + token + "' in spell " + spell.getDisplayName() + " of " + source); - continue; - } - else if (colonLoc == 0) - { - Logging.errorPrint("Invalid Token - starts with a colon: " - + token); - continue; - } - - String key = token.substring(0, colonLoc); - String value = (colonLoc == token.length() - 1) ? null : token - .substring(colonLoc + 1); - if (context.processToken(spell, key, value)) - { - context.commit(); - } - else - { - context.rollback(); - Logging.replayParsedMessages(); - } - Logging.clearParseMessages(); + LstUtils.processToken(context, spell, source, colToken.nextToken().trim()); } completeObject(context, source, spell); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jde...@us...> - 2012-12-30 02:27:43
|
Revision: 18886 http://sourceforge.net/p/pcgen/code/18886 Author: jdempsey Date: 2012-12-30 02:27:39 +0000 (Sun, 30 Dec 2012) Log Message: ----------- Add support for PREMULT in PCC file Issue#: CODE-1938 Modified Paths: -------------- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java Trunk/pcgen/code/src/java/pcgen/persistence/lst/prereq/PreMultParser.java Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2012-12-30 00:33:40 UTC (rev 18885) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/CampaignLoader.java 2012-12-30 02:27:39 UTC (rev 18886) @@ -29,12 +29,15 @@ import java.util.ArrayList; import java.util.List; +import pcgen.cdom.base.Constants; import pcgen.cdom.enumeration.ListKey; import pcgen.cdom.enumeration.SourceFormat; import pcgen.core.Campaign; import pcgen.core.Globals; +import pcgen.core.prereq.Prerequisite; import pcgen.io.PCGFile; import pcgen.persistence.PersistenceLayerException; +import pcgen.persistence.lst.output.prereq.PrerequisiteWriter; import pcgen.rules.context.LoadContext; import pcgen.util.Logging; @@ -106,6 +109,7 @@ { if (Globals.getCampaignByURI(campaign.getSourceURI(), false) == null) { + validatePrereqs(campaign.getPrerequisiteList()); List<String> copyright = campaign.getListFor(ListKey.SECTION_15); if (copyright != null) { @@ -126,6 +130,43 @@ } /** + * Check that all prerequisites specified in the PCC file are + * supported. Any unsupported prereqs will be reported as LST + * errors. This is a recursive function allowing it to + * check nested prereqs. + * + * @param prereqList The prerequisites to be checked. + */ + private void validatePrereqs(List<Prerequisite> prereqList) + { + if (prereqList == null || prereqList.isEmpty()) + { + return; + } + + for (Prerequisite prereq : prereqList) + { + if (prereq.isCharacterRequired()) + { + final PrerequisiteWriter prereqWriter = + new PrerequisiteWriter(); + ArrayList<Prerequisite> displayList = new ArrayList<Prerequisite>(); + displayList.add(prereq); + String lstString = + prereqWriter.getPrerequisiteString(displayList, + Constants.TAB); + Logging.log(Logging.LST_ERROR, "Prereq " + prereq.getKind() + + " is not supported in PCC files. Prereq was " + lstString + + " in " + campaign.getSourceURI() + ". Prereq will be ignored."); + } + else + { + validatePrereqs(prereq.getPrerequisites()); + } + } + } + + /** * This method adds all files from the included campaigns to this one. * It then strips out the excluded files via a call to stripLstExcludes. * Modified: Trunk/pcgen/code/src/java/pcgen/persistence/lst/prereq/PreMultParser.java =================================================================== --- Trunk/pcgen/code/src/java/pcgen/persistence/lst/prereq/PreMultParser.java 2012-12-30 00:33:40 UTC (rev 18885) +++ Trunk/pcgen/code/src/java/pcgen/persistence/lst/prereq/PreMultParser.java 2012-12-30 02:27:39 UTC (rev 18886) @@ -56,6 +56,7 @@ Prerequisite prereq = super.parse(kind, formula, invertResult, overrideQualify); prereq.setKind(null); + prereq.setCharacterRequired(false); int commaIndex = formula.indexOf(","); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |