1 23 24 package org.objectweb.fractal.julia.control.content; 25 26 import org.objectweb.fractal.api.Component; 27 28 38 39 public abstract class BasicSuperControllerMixin 40 implements SuperControllerNotifier 41 { 42 43 47 private BasicSuperControllerMixin () { 48 } 49 50 54 57 58 public Component[] fcParents; 59 60 public Component[] getFcSuperComponents () { 61 if (fcParents == null) { 62 return new Component[0]; 63 } else { 64 return fcParents; 65 } 66 } 67 68 public void addedToFc (final Component parent) { 69 int length = fcParents == null ? 1 : fcParents.length + 1; 70 Component[] parents = new Component[length]; 71 if (fcParents != null) { 72 System.arraycopy(fcParents, 0, parents, 1, fcParents.length); 73 } 74 parents[0] = parent; 75 fcParents = parents; 76 } 77 78 public void removedFromFc (final Component parent) { 79 int length = fcParents.length - 1; 80 if (length == 0) { 81 fcParents = null; 82 } else { 83 Component[] parents = new Component[length]; 84 int i = 0; 85 for (int j = 0; j < fcParents.length; ++j) { 86 if (!fcParents[j].equals(parent)) { 87 parents[i++] = fcParents[j]; 88 } 89 } 90 fcParents = parents; 91 } 92 } 93 } 94 | Popular Tags |