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

Method getNoteList

code/src/java/plugin/exporttokens/NoteToken.java:133–169  ·  view source on GitHub ↗
(PlayerCharacter pc, String name)

Source from the content-addressed store, hash-verified

131 }
132
133 public static List<NoteItem> getNoteList(PlayerCharacter pc, String name)
134 {
135 List<NoteItem> noteList = new ArrayList<>();
136 List<NoteItem> resultList;
137
138 buildSubTree(noteList, pc.getDisplay().getNotesList(), -1);
139
140 if ("ALL".equals(name))
141 {
142 resultList = noteList;
143 }
144 else
145 {
146 resultList = new ArrayList<>();
147 try
148 {
149 int i = Integer.parseInt(name);
150
151 resultList.add(noteList.get(i));
152 }
153 catch (NumberFormatException e)
154 {
155 resultList = new ArrayList<>(noteList);
156
157 for (int i = resultList.size() - 1; i >= 0; --i)
158 {
159 final NoteItem ni = resultList.get(i);
160
161 if (!ni.getName().equalsIgnoreCase(name))
162 {
163 resultList.remove(i);
164 }
165 }
166 }
167 }
168 return resultList;
169 }
170
171 /**
172 * Populate the target list with the children of the specified node.

Callers 1

getTokenMethod · 0.95

Calls 11

buildSubTreeMethod · 0.95
getNameMethod · 0.95
getNotesListMethod · 0.80
parseIntMethod · 0.80
equalsIgnoreCaseMethod · 0.80
equalsMethod · 0.65
addMethod · 0.65
getMethod · 0.65
sizeMethod · 0.65
removeMethod · 0.65
getDisplayMethod · 0.45

Tested by

no test coverage detected