MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getModelIndexsForPath

Method getModelIndexsForPath

unused/javax/swing/JTree.java:3198–3215  ·  view source on GitHub ↗

Returns an array of integers specifying the indexs of the components in the path . If path is the root, this will return an empty array. If path is null , null will be returned.

(TreePath path)

Source from the content-addressed store, hash-verified

3196 * is <code>null</code>, <code>null</code> will be returned.
3197 */
3198 private int[] getModelIndexsForPath(TreePath path) {
3199 if(path != null) {
3200 TreeModel model = getModel();
3201 int count = path.getPathCount();
3202 int[] indexs = new int[count - 1];
3203 Object parent = model.getRoot();
3204
3205 for(int counter = 1; counter < count; counter++) {
3206 indexs[counter - 1] = model.getIndexOfChild
3207 (parent, path.getPathComponent(counter));
3208 parent = path.getPathComponent(counter);
3209 if(indexs[counter - 1] < 0)
3210 return null;
3211 }
3212 return indexs;
3213 }
3214 return null;
3215 }
3216
3217 /**
3218 * Returns a <code>TreePath</code> created by obtaining the children

Callers 1

Calls 3

getModelMethod · 0.95
getRootMethod · 0.80
getIndexOfChildMethod · 0.45

Tested by

no test coverage detected