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

it.unibo.alchemist.model.interfaces.LinkingRule Maven / Gradle / Ivy

There is a newer version: 20.0.1
Show newest version
/*
 * Copyright (C) 2010-2014, Danilo Pianini and contributors
 * listed in the project's pom.xml file.
 * 
 * This file is part of Alchemist, and is distributed under the terms of
 * the GNU General Public License, with a linking exception, as described
 * in the file LICENSE in the Alchemist distribution's top directory.
 */
package it.unibo.alchemist.model.interfaces;

import java.io.Serializable;

/**
 * An interface that represent an auto-linking logic for nodes within an
 * environment.
 * 
 * @param 
 *            The type which describes the concentration of a molecule
 */
public interface LinkingRule extends Serializable {

    /**
     * Produces a new neighborhood for specified node considering its position.
     * 
     * @param center
     *            the node to recompute
     * @param env
     *            the node's environment
     * @return a neighborhood
     */
    Neighborhood computeNeighborhood(Node center, Environment env);

    /**
     * Some rules may require to be evaluated against multiple nodes until the
     * situations gets consistent. For instance, a rule that connects the
     * closest 10 nodes must be evaluated multiple times to get to the correct
     * result (this is because a change in one neighbor may require a
     * disconnection from another node to maintain exactly 10 connections).
     * 
     * Most rules do not need such machinery (e.g., connecting to nodes within
     * some statically defined range).
     * 
     * @return true if this rule does not need to be recursively re-applied to
     *         neighbors to ensure global consistency.
     */
    boolean isLocallyConsistent();

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy