MCPcopy Create free account
hub / github.com/PCGen/pcgen / unparse

Method unparse

code/src/java/plugin/lsttokens/choose/AbilityToken.java:125–161  ·  view source on GitHub ↗
(LoadContext context, CDOMObject cdo)

Source from the content-addressed store, hash-verified

123 }
124
125 @Override
126 public String[] unparse(LoadContext context, CDOMObject cdo)
127 {
128 ChooseInformation<?> tc = context.getObjectContext().getObject(cdo, ObjectKey.CHOOSE_INFO);
129 if (tc == null)
130 {
131 return null;
132 }
133 if (!tc.getName().equals(getTokenName()))
134 {
135 // Don't unparse anything that isn't owned by this SecondaryToken
136 /*
137 * TODO Either this really needs to be a check against the subtoken
138 * (which thus needs to be stored in the ChooseInfo) or there needs
139 * to be a loadtime check that no more than once CHOOSE subtoken
140 * uses the same AssociationListKey... :P
141 */
142 return null;
143 }
144 if (!tc.getGroupingState().isValid())
145 {
146 context.addWriteMessage("Invalid combination of objects" + " was used in: " + getParentToken()
147 + Constants.COLON + getTokenName());
148 return null;
149 }
150 StringBuilder sb = new StringBuilder();
151 sb.append(((CategorizedChooseInformation<?>) tc).getCategory().getLSTformat(false));
152 sb.append('|');
153 sb.append(tc.getLSTformat());
154 String title = tc.getTitle();
155 if (!title.equals(getDefaultTitle()))
156 {
157 sb.append("|TITLE=");
158 sb.append(title);
159 }
160 return new String[]{sb.toString()};
161 }
162
163 @Override
164 public void applyChoice(ChooseDriver owner, Ability st, PlayerCharacter pc)

Callers

nothing calls this directly

Calls 15

getTokenNameMethod · 0.95
getParentTokenMethod · 0.95
getDefaultTitleMethod · 0.95
getObjectMethod · 0.65
getObjectContextMethod · 0.65
equalsMethod · 0.65
getNameMethod · 0.65
isValidMethod · 0.65
getGroupingStateMethod · 0.65
addWriteMessageMethod · 0.65
getLSTformatMethod · 0.65
getTitleMethod · 0.65

Tested by

no test coverage detected