All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.objectweb.fractal.julia.control.content.BasicSuperControllerMixin Maven / Gradle / Ivy

The newest version!
/***
 * Julia: France Telecom's implementation of the Fractal API
 * Copyright (C) 2001-2011 France Telecom R&D
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Contact: [email protected]
 *
 * Author: Eric Bruneton
 */

package org.objectweb.fractal.julia.control.content;

import org.objectweb.fractal.api.Component;

/**
 * Provides a basic implementation of the {@link SuperControllerNotifier}
 * interface.
 * 
*
* Requirements *
    *
  • none.
  • *
*/ public abstract class BasicSuperControllerMixin implements SuperControllerNotifier { // ------------------------------------------------------------------------- // Private constructor // ------------------------------------------------------------------------- private BasicSuperControllerMixin () { } // ------------------------------------------------------------------------- // Fields and methods added and overriden by the mixin class // ------------------------------------------------------------------------- /** * The parents of the component to which this controller object belongs. */ public Component[] fcParents; public Component[] getFcSuperComponents () { if (fcParents == null) { return new Component[0]; } else { return fcParents; } } public void addedToFc (final Component parent) { int length = fcParents == null ? 1 : fcParents.length + 1; Component[] parents = new Component[length]; if (fcParents != null) { System.arraycopy(fcParents, 0, parents, 1, fcParents.length); } parents[0] = parent; fcParents = parents; } public void removedFromFc (final Component parent) { int length = fcParents.length - 1; if (length == 0) { fcParents = null; } else { Component[] parents = new Component[length]; int i = 0; for (int j = 0; j < fcParents.length; ++j) { if (!fcParents[j].equals(parent)) { parents[i++] = fcParents[j]; } } fcParents = parents; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy