Logo
Distributed Genetic Programming Framework
print print

File org.sfc.meta.PropertySet.java

Here you can find all the information about the file org.sfc.meta.PropertySet.java. You may explore it here or download it onto your local disk.
/*
 * Copyright (c) 2006 Thomas Weise
 * 
 * E-Mail           : tweise@gmx.de
 * Creation Date    : 2006-05-22 11:51:39
 * Original Filename: org.sfc.meta.PropertySet.java
 * Version          : 1.0.1
 * Last modification: 2006-05-28
 *                by: Thomas Weise
 * 
 * License          : GNU LESSER GENERAL PUBLIC LICENSE
 *                    Version 2.1, February 1999
 *                    You should have received a copy of this license along
 *                    with this library; if not, write to the Free Software
 *                    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *                    MA 02111-1307, USA or download the license under
 *                    http://www.gnu.org/copyleft/lesser.html.
 *                    
 * Warranty         : This software is provided "as is" 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.
 */

 
package org.sfc.meta;

import java.util.List;

import org.sfc.collections.Collections;
import org.sfc.collections.IVisitor;
import org.sfc.collections.ProtectedCollection;
import org.sfc.utils.Typesafe;

/**
 * The property set contains all the properties of a class.
 *
 * @author Thomas Weise
 */

public final  class    PropertySet
              extends  ProtectedCollection<PropertySubSet>
  {
/**
 * The serial version uid.
 */

  private static final long serialVersionUID = 1;
  
/**
 * The internal ps builder.
 */

  private static final PSBuilder  BUILDER = new PSBuilder();
  
/**
 * The target class.
 */

  final Class<?>  m_target  ;
  
/**
 * Create a new property set for the specified class.
 * @param p_target The target class.
 */

  PropertySet (final Class<?> p_target)
    {
    super(PropertySubSet.class, 8);
    this.m_target = p_target;
    BUILDER.do_it(this);
    }
  
/**
 * Obtain the target class for the property set.
 * @return The target class for the property set.
 */

  public  final Class<?>  get_target()
    {
    return this.m_target;
    }
  
/**
 * Internally add a property subset.
 * @param p_s   The property subset to be added.
 */

  final void  add_ps  (final PropertySubSet p_s)
    {
    do_add(p_s);
    }
  
/**
 * The internal ps builder class.
 *
 * @author Thomas Weise
 */

  private static  final class PSBuilder implements  IVisitor<PropertyGroup>
    {    
/**
 * The property set to work on.
 */

          PropertySet                     m_ps;
/**
 * The property visitor.
 */

    final PV                              m_pv;
/**
 * The property visitor.
 */

    final IVisitor<Property<?>>           m_pvv;
/**
 * The internal property list.
 */

    final List<PropertyPort<?>>           m_pl;
/**
 * Create a ps builder.
 */

    PSBuilder()
      {
      super();
      this.m_pv  = new PV();
      this.m_pl  = Collections.create_list(-1);
      this.m_pvv = Typesafe.cast(this.m_pv);
      }
    
/**
 * Fill the property set.
 * @param p_ps  The property set to fill.
 */

    synchronized  void  do_it (final PropertySet p_ps)
      {
      this.m_ps           = p_ps;
      this.m_pv.m_target2 = p_ps.m_target;      
      PropertyGroup.MANAGER.visit(this);      
      }
    

/**
 * This method is the visit method called when the visitor is carried
 * around.
 * @param p_item    The next item to be visited.
 * @return  <code>true</code> as long as the visiting should continue,
 *          <code>false</code> if the visit should be aborted.
 */
    
    public  final boolean   visit (final PropertyGroup p_item)
      {
      List<PropertyPort<?>> l_l;
      
      l_l = this.m_pl;
      p_item.visit(this.m_pvv);
      if(l_l.size() > 0)
        {
        this.m_ps.add_ps(new PropertySubSet(p_item, this.m_ps, l_l));
        }      
      l_l.clear();
      
      return true;
      }
    
/**
 * The property visitor.
 *
 * @author Thomas Weise
 */

    private final class PV implements  IVisitor<Property<Object>>
      {
/**
 * The target class.
 */

          Class<?>                        m_target2  ;
/**
 * This method is the visit method called when the visitor is carried
 * around.
 * @param p_item    The next item to be visited.
 * @return  <code>true</code> as long as the visiting should continue,
 *          <code>false</code> if the visit should be aborted.
 */

      public  final boolean   visit (final Property<Object> p_item)
        {
        PropertyPort<Object> l_p;
        
        l_p = p_item.get_port(this.m_target2);
        if(l_p != null) PSBuilder.this.m_pl.add(l_p);
        return true;
        }
      }
    }
  }

File Information:

file name:PropertySet.java
package:org.sfc.meta
qualified name:org.sfc.meta.PropertySet.java
file type:Java Source File
download location:download http://dgpf.sourceforge.net/source/org/sfc/meta/PropertySet.java
size:4.770 KB (4885 B)
uploaded: 2018-01-07 12:03:36 GMT+0000
last update: 2006-05-28 13:56:06 GMT+0000
last access: 2018-04-23 23:00:31 GMT+0000

statistics online since 2006-01-02.   RSS Feed
Contact us by sending an email to tweise@gmx.de to receive further information, to report errors, or to join our project.
All content on this site (http://dgpf.sourceforge.net/) is LGPL-licensed.
http://dgpf.sourceforge.net/scripts/source/source.php last modified at 2018-01-07 12:03:34 GMT+0000 served at 2018-04-23 23:00:31 GMT+0000.
Valid CSS Valid XHTML 1.1
Valid RSS SourceForge.net Logo