MCPcopy Create free account
hub / github.com/EdwardRaff/JSAT / toParameterMap

Method toParameterMap

JSAT/src/jsat/parameters/Parameter.java:172–184  ·  view source on GitHub ↗

Creates a map of all possible parameter names to their corresponding object. No two parameters may have the same name. @param params the list of parameters to create a map for @return a map of string names to their parameters @throws RuntimeException if two parameters have the same name

(List<Parameter> params)

Source from the content-addressed store, hash-verified

170 * @throws RuntimeException if two parameters have the same name
171 */
172 public static Map<String, Parameter> toParameterMap(List<Parameter> params)
173 {
174 Map<String, Parameter> map = new HashMap<String, Parameter>(params.size());
175 for(Parameter param : params)
176 {
177 if(map.put(param.getASCIIName(), param) != null)
178 throw new RuntimeException("Name collision, two parameters use the name '" + param.getASCIIName() + "'");
179 if(!param.getName().equals(param.getASCIIName()))//Dont put it in again
180 if(map.put(param.getName(), param) != null)
181 throw new RuntimeException("Name collision, two parameters use the name '" + param.getName() + "'");
182 }
183 return map;
184 }
185
186 /**
187 * Given an object, this method will use reflection to automatically find

Callers 15

getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95
getParameterMethod · 0.95

Calls 5

sizeMethod · 0.65
equalsMethod · 0.65
getNameMethod · 0.65
putMethod · 0.45
getASCIINameMethod · 0.45

Tested by 1

getParameterMethod · 0.76