01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: /**
18: * @author Alexander T. Simbirtsev
19: * @version $Revision$
20: */package javax.swing.tree;
21:
22: import java.util.Vector;
23:
24: class PathPlaceHolder {
25: protected boolean isNew;
26: protected TreePath path;
27:
28: PathPlaceHolder() {
29: }
30:
31: PathPlaceHolder(final TreePath path, final boolean isNew) {
32: this .path = path;
33: this .isNew = isNew;
34: }
35:
36: static TreePath[] getPathsArray(
37: final Vector<PathPlaceHolder> pathPlaceHolders) {
38: if (pathPlaceHolders == null) {
39: return new TreePath[0];
40: }
41:
42: TreePath[] result = new TreePath[pathPlaceHolders.size()];
43: for (int i = 0; i < result.length; i++) {
44: result[i] = pathPlaceHolders.get(i).path;
45: }
46: return result;
47: }
48:
49: static boolean[] getAreNewArray(
50: final Vector<PathPlaceHolder> pathPlaceHolders) {
51: if (pathPlaceHolders == null) {
52: return new boolean[0];
53: }
54:
55: boolean[] result = new boolean[pathPlaceHolders.size()];
56: for (int i = 0; i < result.length; i++) {
57: result[i] = pathPlaceHolders.get(i).isNew;
58: }
59: return result;
60: }
61:
62: static Vector<PathPlaceHolder> createPathsPlaceHolders(
63: final TreePath[] paths, final boolean areNew) {
64: if (paths == null) {
65: return new Vector();
66: }
67: Vector result = new Vector(paths.length);
68: for (int i = 0; i < paths.length; i++) {
69: result.add(new PathPlaceHolder(paths[i], areNew));
70: }
71: return result;
72: }
73: }
|