![JAR search and dependency download from the Maven repository](/logo.png)
de.tsl2.nano.vnet.Connection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.vnet Show documentation
Show all versions of tsl2.nano.vnet Show documentation
TSL2 Framework VirtualNetwork (Generic parallelized Network-Mechanism providing implementations for: NeuronalNetwork, Routing, Workflow)
The newest version!
/*
* File: $HeadURL$
* Id : $Id$
*
* created by: ts
* created on: 09.11.2012
*
* Copyright: (c) Thomas Schneider 2012, all rights reserved
*/
package de.tsl2.nano.vnet;
import java.io.Serializable;
import de.tsl2.nano.core.messaging.EventController;
import de.tsl2.nano.core.messaging.IListener;
import de.tsl2.nano.structure.IConnection;
/**
* a connection is used as a one-direction link from a source-node to a destination-node. the source-node may have a set
* of connections, knowing each destination and the connection-properties (e.g. the weight).
*
* to create a bidirectional link, you additionally need to create a connection from destination-node to source-node. if
* you need complex connection properties (=descriptor), you may use {@link FullConnector} as descriptor.
*
* @param type of {@link Node} content (=core)
* @param connection descriptor (on simple weighted connections, it would be Float)
* @author Thomas Schneider, Thomas Schneider
* @version $Revision$
*/
public class Connection & ILocatable & Serializable & Comparable super T>, D extends Comparable super D>> extends
Link, D> implements IListener, ILocatable, IConnection {
/** serialVersionUID */
private static final long serialVersionUID = 1981668952548892244L;
EventController eventController;
/**
* constructor
*
* @param destination
* @param descriptor
*/
public Connection(Node destination, D descriptor) {
super(destination, descriptor);
eventController = Net.createEventController();
}
/**
* @param destination The destination to set.
*/
@Override
public void setDestination(Node destination) {
super.setDestination(destination);
//TODO: fire change event
}
@Override
public void handleEvent(Notification event) {
getDestination().handleEvent(new Notification(null, descriptor, event));
}
/**
* numeric representation of current connection. please check your {@link #descriptor}s hashCode() method to
* evaluate a length as int.
*
* @return
*/
public float length() {
return descriptor != null ? Float.intBitsToFloat(descriptor.hashCode()) : 0f;
}
@Override
public String getPath() {
return getDestination().getPath();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy