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

Method unparse

code/src/java/plugin/lsttokens/spell/CostToken.java:71–95  ·  view source on GitHub ↗
(LoadContext context, Spell spell)

Source from the content-addressed store, hash-verified

69 }
70
71 @Override
72 public String[] unparse(LoadContext context, Spell spell)
73 {
74 BigDecimal i = context.getObjectContext().getObject(spell, ObjectKey.COST);
75 boolean globalClear = context.getObjectContext().wasRemoved(spell, ObjectKey.COST);
76 List<String> list = new ArrayList<>();
77 if (globalClear)
78 {
79 list.add(Constants.LST_DOT_CLEAR);
80 }
81 if (i != null)
82 {
83 if (i.compareTo(BigDecimal.ZERO) <= 00)
84 {
85 context.addWriteMessage(getTokenName() + " requires a positive Integer");
86 return null;
87 }
88 list.add(i.toString());
89 }
90 if (list.isEmpty())
91 {
92 return null;
93 }
94 return list.toArray(new String[0]);
95 }
96
97 @Override
98 public Class<Spell> getTokenClass()

Callers

nothing calls this directly

Calls 10

getTokenNameMethod · 0.95
getObjectMethod · 0.65
getObjectContextMethod · 0.65
wasRemovedMethod · 0.65
addMethod · 0.65
addWriteMessageMethod · 0.65
toStringMethod · 0.65
isEmptyMethod · 0.65
compareToMethod · 0.45
toArrayMethod · 0.45

Tested by

no test coverage detected