Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api)!: add capabilities to nodes #1073

Merged
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
219 commits
Select commit Hold shift + click to select a range
b7932c1
docs: add clone and import howto on website
kelvin-olaiya Feb 2, 2022
be49a83
docs: move clone and import howto under development chapter
kelvin-olaiya Feb 2, 2022
535b8cb
docs: add gradle and maven import instructions
kelvin-olaiya Feb 2, 2022
ad3d32c
docs: add status page
kelvin-olaiya Feb 2, 2022
2b6ea7d
docs(website): fix typo
kelvin-olaiya Feb 3, 2022
669573a
docs(website): rephrase
kelvin-olaiya Feb 3, 2022
de23098
docs(website): rename
kelvin-olaiya Feb 3, 2022
2c9acf5
docs(website): sort development doc pages
kelvin-olaiya Feb 4, 2022
17c7507
docs(website): reorder development content pages
kelvin-olaiya Feb 4, 2022
33f0d41
docs: add contributions rules
kelvin-olaiya Feb 2, 2022
2bea336
docs(website): sort development doc pages
kelvin-olaiya Feb 4, 2022
572fe76
docs(website): improve the build instructions page
DanySK Feb 4, 2022
1e56a58
docs(website): improve the contributions page
DanySK Feb 4, 2022
b938855
docs(website): reorder development content pages
kelvin-olaiya Feb 4, 2022
df2ebe2
docs(website): allow click-ability of the explanatory link to the hug…
DanySK Feb 5, 2022
ad96d60
refactor(gradle): move plugin block on top
kelvin-olaiya Feb 8, 2022
3de320c
refactor(gradle): move extension method for gettin plugin id in Util …
kelvin-olaiya Feb 8, 2022
a2de979
refactor: add capabilities to nodes
kelvin-olaiya Feb 8, 2022
1b2dedc
refactor: follow QA guidelines
kelvin-olaiya Feb 8, 2022
f76d947
refactor: return the exact requested capability type
kelvin-olaiya Feb 8, 2022
c173f8a
refactor: improve capability retrieving, add method to check if node …
kelvin-olaiya Feb 9, 2022
ffa35f8
refactor: make node override equals
kelvin-olaiya Feb 9, 2022
0a5f6f2
refactor: change method name
kelvin-olaiya Feb 9, 2022
7ebcb56
refactor: change method name
kelvin-olaiya Feb 9, 2022
a61e2ff
refactor: add cast safety check
kelvin-olaiya Feb 9, 2022
89ebcc5
feat: add capabilities to AbstractHomogeneousPedestrian
kelvin-olaiya Feb 9, 2022
cae3be1
docs: add documentations to Capabilities
kelvin-olaiya Feb 10, 2022
7a41a4b
refactor: add constructor properties with defaults
kelvin-olaiya Feb 10, 2022
58dd83f
refactor: add capabilities to AbstractHeterogeneousPedestrian
kelvin-olaiya Feb 10, 2022
7556bde
refactor: rename interface
kelvin-olaiya Feb 10, 2022
033cc35
refactor: rename interface/class name
kelvin-olaiya Feb 10, 2022
2d5d96c
refactor: re-write function in kotlin style
kelvin-olaiya Feb 10, 2022
437ab6a
refactor: substitute exception with TODO
kelvin-olaiya Feb 10, 2022
be00ec2
docs: correct documentation grammar
kelvin-olaiya Feb 10, 2022
d734dc2
refactor: rename capabilities
kelvin-olaiya Feb 10, 2022
9e426c3
refactor: rename capabilities
kelvin-olaiya Feb 10, 2022
aa39409
refactor: add delegation
kelvin-olaiya Feb 10, 2022
76367a8
refactor: add constructor overloads
kelvin-olaiya Feb 10, 2022
00fec6e
refactor: change property name
kelvin-olaiya Feb 10, 2022
39cfb52
refactor: change property name
kelvin-olaiya Feb 10, 2022
2c44b3f
refactor: re-write in kotlin style
kelvin-olaiya Feb 10, 2022
bc5f54b
refactor: add capabilities files
kelvin-olaiya Feb 10, 2022
c02a875
build: add dependency to euclidean-geometry
kelvin-olaiya Feb 10, 2022
c57c562
feat: add capabilities interfaces
kelvin-olaiya Feb 10, 2022
27340ce
feat: create a spacial capability
kelvin-olaiya Feb 10, 2022
5e86e9a
refactor: fix typo
kelvin-olaiya Feb 10, 2022
207c6b8
feat: create a IndividualCapability
kelvin-olaiya Feb 10, 2022
5d2c761
refactor: remove circular dependency
kelvin-olaiya Feb 10, 2022
1a57f98
fix: make test pass again
kelvin-olaiya Feb 11, 2022
846cd71
chore: pull from master
kelvin-olaiya Feb 14, 2022
e86aadb
refactor: pass constructor parameters to delegated objects
kelvin-olaiya Feb 14, 2022
c7cf4fd
feat: create pedestrian physical capability
kelvin-olaiya Feb 14, 2022
9b81d84
feat: add pedestrian physical capability interface
kelvin-olaiya Feb 14, 2022
ca80c34
fix: a node shall contain only 1 instance of a type of capability
kelvin-olaiya Feb 14, 2022
6ce56fb
refactor: make homogeneous and heterogenous abstract class use capabi…
kelvin-olaiya Feb 14, 2022
6dce395
feat: implement PedestrainIndividualityCapability
kelvin-olaiya Feb 14, 2022
fff6a7b
refactor: map pedestrianModel to a capability
kelvin-olaiya Feb 14, 2022
ade5810
feat: implement PedestrianCognitiveCapability
kelvin-olaiya Feb 14, 2022
ea5337a
refactor: make use of cognitive capability
kelvin-olaiya Feb 15, 2022
35e589e
refactor: make capabilities know to the node they're attatched to
kelvin-olaiya Feb 15, 2022
c905627
feat: implement PedestrianPhysicalCapability
kelvin-olaiya Feb 15, 2022
0c641fe
refactor: implement Use spatial and physical capabilities
kelvin-olaiya Feb 15, 2022
35abce9
feat: implement Orienting capability
kelvin-olaiya Feb 15, 2022
ffade4a
docs: add documentation comments
kelvin-olaiya Feb 15, 2022
c298fc3
refactor: add delegate orienting feature to capability
kelvin-olaiya Feb 16, 2022
b304e40
refactor: remove unused import
kelvin-olaiya Feb 16, 2022
c75b617
refactor: resolve todo
kelvin-olaiya Feb 16, 2022
c8bd406
feat: implement and use InfluenceCapability
kelvin-olaiya Feb 16, 2022
991669f
feat: implement and use social capability
kelvin-olaiya Feb 16, 2022
59d2a95
fix: resolve TODO
kelvin-olaiya Feb 16, 2022
d30293a
refactor: use data class when possible
kelvin-olaiya Feb 16, 2022
58c194e
refactor: resolve detekt warnings
kelvin-olaiya Feb 16, 2022
f534776
refactor: change name of capabilities
kelvin-olaiya Feb 16, 2022
e7ae8f6
refactor: resolve detekt warnings
kelvin-olaiya Feb 16, 2022
3a34e34
refactor: rethrow instead of stacktrace printing
kelvin-olaiya Feb 16, 2022
7ab554a
refactor: split 2D version of orienting capability in its own file
kelvin-olaiya Feb 16, 2022
944ccee
docs: remove unsupported inheritDoc
kelvin-olaiya Feb 16, 2022
c3d6a4b
docs: resolve detekt warnings
kelvin-olaiya Feb 16, 2022
ee53be2
refactor: remove unused imports
kelvin-olaiya Feb 16, 2022
51ab5ba
refactor: default model in congnitive capability, refactor group
kelvin-olaiya Feb 18, 2022
5f149be
feat: allow adding capabilities to nodes
kelvin-olaiya Feb 18, 2022
fc61a9d
refactor: remove PedestrianGroup interface
kelvin-olaiya Feb 18, 2022
b9f94ed
refactor: avoid passing cognitive model in costructor
kelvin-olaiya Feb 21, 2022
a6ca29c
fix: correct the overriding of cognitiveModel, test are now passing
kelvin-olaiya Feb 21, 2022
32ddb30
fix: Replace missing PedestrianGroup2D
kelvin-olaiya Feb 22, 2022
40d87d2
feat: add loading support for capabilities whit shape filtering, also…
kelvin-olaiya Feb 22, 2022
d7ad801
refactor(api): Add CellularBehaviour capability
kelvin-olaiya Feb 22, 2022
8ab20e3
refactor(api): add Base implementation of various cellular behaviour
kelvin-olaiya Feb 22, 2022
b308a2c
refactor: createMolecule is not a capability
kelvin-olaiya Feb 23, 2022
0eb84e3
refactor(api): create protelis capability
kelvin-olaiya Feb 23, 2022
fc2c5ed
feat(api): create LSACapability
kelvin-olaiya Feb 23, 2022
b41f4f6
refactor: remove unused variable
kelvin-olaiya Feb 23, 2022
6417c47
refactor: rename Shape to ShapeFilter
kelvin-olaiya Feb 23, 2022
a1ee4f8
refactor: add Compound filters interfaces
kelvin-olaiya Feb 23, 2022
b30d674
refactor: remove unused property
kelvin-olaiya Feb 23, 2022
b8644e0
fix: RectangleFilter in yaml
kelvin-olaiya Feb 23, 2022
cfd2d80
refactor(incarnation-protelis): simplify the capability structure
DanySK Feb 23, 2022
2150d95
docs(alchemist-loading): add documentation
kelvin-olaiya Feb 23, 2022
11515bf
docs(incarnation-protelis): add documentation
kelvin-olaiya Feb 23, 2022
d338fe6
refactor: make capability serializable
kelvin-olaiya Feb 23, 2022
7a4f548
refactor(incarnation-protelis): delegate to capabily
kelvin-olaiya Feb 23, 2022
b6125f1
refactor(incarnation-protelis): use protelis capability
kelvin-olaiya Feb 28, 2022
71eacdb
refactor(incarnation-biochemistry): substitute nodes with capabilities
kelvin-olaiya Feb 28, 2022
5323c8d
refactor(api): add GenericNode implementation
kelvin-olaiya Feb 28, 2022
4da36a1
fix(incarnation-biochemistry): fix wrong capability retrieval
kelvin-olaiya Feb 28, 2022
c627eab
fix(incarnation-biochemistry): correctly update junction count
kelvin-olaiya Feb 28, 2022
847d086
fix(incarnation-biochemistry): fix addPolarizationVersor method
kelvin-olaiya Feb 28, 2022
a6ddc9f
refactor(api): manage generic variance
kelvin-olaiya Feb 28, 2022
88d6d1b
refactor(euclidean-goemetry): move capability to euclidean-geometry
kelvin-olaiya Feb 28, 2022
2ad3a3b
refactor(euclidean-goemetry): use spatial capability
kelvin-olaiya Feb 28, 2022
a9ad353
refactor(cognitive-agents): drop nodes and use capabilities
kelvin-olaiya Mar 1, 2022
b32da79
refactor(cognitive-agents): style refactor
kelvin-olaiya Mar 1, 2022
aed84d8
refactor(cognitive-agents): use capabilities in tests
kelvin-olaiya Mar 1, 2022
84bee41
refactor: use capabilities
kelvin-olaiya Mar 1, 2022
10dfbef
refactor: use default properties in capabilities
kelvin-olaiya Mar 1, 2022
6068a82
refactor: add a movement capability for heterogeneous pedestrians
kelvin-olaiya Mar 1, 2022
c80230e
refactor: use default confortArea
kelvin-olaiya Mar 1, 2022
0187a37
refactor: separate capabilities in different files
kelvin-olaiya Mar 1, 2022
67703a3
refactor: use default Speed
kelvin-olaiya Mar 1, 2022
217e8d0
refactor: add documentation
kelvin-olaiya Mar 1, 2022
bfdf0c3
refactor: add cognitive movement capabilty
kelvin-olaiya Mar 1, 2022
7a52267
fix: fix for non cognitive nodes
kelvin-olaiya Mar 2, 2022
00216eb
refactor(api): rename Capability to NodeProperty
kelvin-olaiya Mar 2, 2022
e938426
refactor(api): rename Capability to NodeProperty
kelvin-olaiya Mar 2, 2022
6552787
refactor(api): rename capabilities
kelvin-olaiya Mar 2, 2022
34ab593
refactor(api): rename properties
kelvin-olaiya Mar 2, 2022
e51d731
refactor(api): rename spatial capability
kelvin-olaiya Mar 2, 2022
4bbe355
refactor(api): rename properties
kelvin-olaiya Mar 2, 2022
f07be66
refactor(loading): capabilities are now called properties
kelvin-olaiya Mar 2, 2022
17b5a98
refactor(loading): capabilities are now called properties
kelvin-olaiya Mar 2, 2022
0bfe23c
refactor(loading): rename property
kelvin-olaiya Mar 2, 2022
a0fb541
refactor(loading): start rewriting yaml configuration
kelvin-olaiya Mar 2, 2022
3d87594
fix(test): rewrite yml configurations
kelvin-olaiya Mar 2, 2022
292ee57
fix(test): rewrite yaml for TestPedestrianLoading
kelvin-olaiya Mar 2, 2022
ffc68e0
fix(test): rewriting yaml configuration for TestOrientingBehavior
kelvin-olaiya Mar 3, 2022
0fa4485
fix(test): rewriting yaml configuration for TestFeelsTransmission
kelvin-olaiya Mar 3, 2022
1b3d3b9
fix(test): rewriting yaml configuration for WebSnippets
kelvin-olaiya Mar 3, 2022
87ced23
fix(test): rewrite yaml files
kelvin-olaiya Mar 3, 2022
0090fd3
refactor(test): remove reduntant boolean
kelvin-olaiya Mar 3, 2022
5701c35
refactor(incarnation-biochemistry): remove TODO
kelvin-olaiya Mar 3, 2022
cf27df5
refactor(incarnation-biochemistry): remove TODOs
kelvin-olaiya Mar 3, 2022
8c5f209
refactor: exception messages
kelvin-olaiya Mar 3, 2022
99afb2c
refactor(website): explain capabilities in cognitive simulation
kelvin-olaiya Mar 4, 2022
39ba4df
refactor(website): loading system
kelvin-olaiya Mar 4, 2022
e551a05
fix: conflicts
kelvin-olaiya Mar 4, 2022
9cc638e
fix: check errors
kelvin-olaiya Mar 4, 2022
cebbb64
fix: check task errors
kelvin-olaiya Mar 5, 2022
c10ae41
docs(website): fix classes references
kelvin-olaiya Mar 5, 2022
d4363cc
fix: yml filter specification
kelvin-olaiya Mar 5, 2022
1dd9584
fix: yml filter specification
kelvin-olaiya Mar 5, 2022
89c0843
docs(website): fix classes references
kelvin-olaiya Mar 5, 2022
70d5078
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 5, 2022
5188eb3
refactor: better namings
kelvin-olaiya Mar 5, 2022
2b03b7e
refactor: better naming
kelvin-olaiya Mar 5, 2022
f98288a
refactor: docs
kelvin-olaiya Mar 5, 2022
c98d4a5
refactor: docs
kelvin-olaiya Mar 5, 2022
e43e6a6
refactor(docs): comments
kelvin-olaiya Mar 5, 2022
5f8485d
fix: detekt issues
kelvin-olaiya Mar 5, 2022
625f37c
fix: javadoc
kelvin-olaiya Mar 5, 2022
b0258b9
fix: javadoc
kelvin-olaiya Mar 5, 2022
5d7704d
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 6, 2022
23edbd2
refactor: replace pedestrian occurences with node
kelvin-olaiya Mar 7, 2022
661bd27
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 7, 2022
ef0b028
refactor: trailing commas
kelvin-olaiya Mar 7, 2022
84bbd8f
Update AbstractGroupSteeringAction.kt
kelvin-olaiya Mar 7, 2022
80149b2
Update AbstractGroupSteeringAction.kt
kelvin-olaiya Mar 7, 2022
5863c88
Update AbstractLayerAction.kt
kelvin-olaiya Mar 7, 2022
8b2dedd
refactor: style
kelvin-olaiya Mar 7, 2022
98d9b07
refactor: fix style issues
kelvin-olaiya Mar 7, 2022
2ec43e6
refactor: add another construct for compatibility with previuos imple…
kelvin-olaiya Mar 8, 2022
fdd452a
refactor: rewrite method in a idiomati way
kelvin-olaiya Mar 8, 2022
502ac80
refactor: fix style issues
kelvin-olaiya Mar 8, 2022
39224b0
refactor: add trailing comma
kelvin-olaiya Mar 8, 2022
f6d119d
refactor: add trailing comma
kelvin-olaiya Mar 8, 2022
74c85a4
refactor: fix check issues
kelvin-olaiya Mar 8, 2022
74b0b58
refactor: use typealias instead of class
kelvin-olaiya Mar 8, 2022
d466cf6
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 8, 2022
0bfb2df
refactor: fix style and namings, clone properties on nodeCloning
kelvin-olaiya Mar 8, 2022
4217c40
docs(website): refactor
kelvin-olaiya Mar 8, 2022
61d8e6a
docs(website): refactor
kelvin-olaiya Mar 8, 2022
a2cec67
docs(website): refactor
kelvin-olaiya Mar 8, 2022
bc73218
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
aed4c6f
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
100de15
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
e75db99
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
1220ce5
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
e502ae6
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
0134de2
docs(website): fix documentation
kelvin-olaiya Mar 8, 2022
4e5c430
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 8, 2022
bd5ea12
chore: merge truth branch
kelvin-olaiya Mar 8, 2022
7e4440c
refactor: rename loader.shapes to loader.filters
kelvin-olaiya Mar 9, 2022
d0fa007
refactor: remove unused imports
kelvin-olaiya Mar 9, 2022
a0448c4
refactor: namings
kelvin-olaiya Mar 9, 2022
8414e07
refactor: styling, namings and docs
kelvin-olaiya Mar 9, 2022
8db4e5c
refactor: fix complex method, rewrite yml
kelvin-olaiya Mar 9, 2022
4c9e991
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 9, 2022
ceb74a6
refactor: remove double brace initialization
kelvin-olaiya Mar 9, 2022
9f3a14b
fix(website): correct shortcode
kelvin-olaiya Mar 9, 2022
02c1ce8
refactor: rename property
kelvin-olaiya Mar 9, 2022
8679907
refactor: trailing comma, style
kelvin-olaiya Mar 9, 2022
ef37cd4
refactor(biochemistry-incarnation): remove unnecessary parentheses
kelvin-olaiya Mar 9, 2022
77b91fa
fix: avoid NullPointerException
kelvin-olaiya Mar 9, 2022
9034a3f
Update alchemist-incarnation-biochemistry/src/test/java/it/unibo/alch…
DanySK Mar 10, 2022
3f9929a
refactor(loading-filters): remove useless parentheses
kelvin-olaiya Mar 10, 2022
d2480d0
chore: merge remote branch
kelvin-olaiya Mar 10, 2022
4f7553a
Merge branch 'master' into feature-addCapabilitiesToNodes
kelvin-olaiya Mar 10, 2022
6f999e7
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
4a82f05
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
600791b
refactor(loading-filters): make invoke an operator
kelvin-olaiya Mar 10, 2022
35ec8c6
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
1d3614f
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
04a733e
chore: merge origin branch
kelvin-olaiya Mar 10, 2022
1dc2b0f
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
e2dde49
Update src/main/hugo/content/howtos/simulation/cognitive/_index.md
DanySK Mar 10, 2022
ef52f6e
Update src/main/hugo/content/howtos/simulation/program/content/_index.md
DanySK Mar 10, 2022
f86b1e8
Update src/main/hugo/content/reference/biochemistry/_index.md
DanySK Mar 10, 2022
c6ff278
Update src/main/hugo/content/reference/biochemistry/_index.md
DanySK Mar 10, 2022
56242ef
Update src/main/hugo/content/howtos/simulation/program/content/_index.md
DanySK Mar 10, 2022
e242b05
Update src/main/hugo/content/howtos/simulation/program/content/_index.md
DanySK Mar 10, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions alchemist-full/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import Libs.alchemist
* GNU General Public License, with a linking exception,
* as described in the file LICENSE in the Alchemist distribution"s top directory.
*/
plugins {
application
}

dependencies {
runtimeOnly(rootProject)
Expand All @@ -17,10 +20,6 @@ dependencies {
testImplementation(alchemist("euclidean-geometry"))
}

plugins {
application
}

application {
mainClass.set("it.unibo.alchemist.Alchemist")
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
package it.unibo.alchemist.model.implementations.nodes;

import com.google.common.collect.MapMaker;
import it.unibo.alchemist.model.interfaces.Capability;
import it.unibo.alchemist.model.interfaces.Environment;
import it.unibo.alchemist.model.interfaces.Molecule;
import it.unibo.alchemist.model.interfaces.Node;
Expand All @@ -18,17 +19,21 @@

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.Spliterator;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.stream.Collectors;


/**
Expand All @@ -46,6 +51,7 @@ public abstract class AbstractNode<T> implements Node<T> {
private final int id;
private final List<Reaction<T>> reactions = new ArrayList<>();
private final Map<Molecule, T> molecules = new LinkedHashMap<>();
private final Map<Class<? extends Capability>, Capability> capabilities = new HashMap<>();

private static int idFromEnv(final Environment<?, ?> env) {
MUTEX.acquireUninterruptibly();
Expand Down Expand Up @@ -190,6 +196,22 @@ public void setConcentration(final Molecule molecule, final T concentration) {
molecules.put(molecule, concentration);
}

@Override
public void addCapability(final Capability capability) {
this.capabilities.put(capability.getClass(), capability);
}

@Override
public Optional<Capability> asCapability(final Class<? extends Capability> type) {
return Optional.ofNullable(this.capabilities.get(type));
}

@Override
public Set<Capability> getCapabilities() {
return this.capabilities.entrySet().stream()
.map(Map.Entry::getValue).collect(Collectors.toSet());
}

@Override
public final Spliterator<Reaction<T>> spliterator() {
return reactions.spliterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
* @param <T>
Expand Down Expand Up @@ -116,4 +118,21 @@ public interface Node<T> extends Serializable, Iterable<Reaction<T>>, Comparable
*/
void setConcentration(Molecule mol, T c);

/**
* Adds a capability to the node.
* @param capability the capability you want to add to the node
*/
void addCapability(Capability capability);

/**
* @param type the type of capability to retrieve
* @return an optional with a capability of the requested type
*/
Optional<Capability> asCapability(Class<? extends Capability> type);
kelvin-olaiya marked this conversation as resolved.
Show resolved Hide resolved

/**
* @return a set of the capabilities added to the node
*/
Set<Capability> getCapabilities();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (C) 2010-2022, Danilo Pianini and contributors
* listed, for each module, in the respective subproject's build.gradle.kts 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

/**
* Represents a node capability.
kelvin-olaiya marked this conversation as resolved.
Show resolved Hide resolved
*/
interface Capability
git
3 changes: 1 addition & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import Libs.alchemist
import Libs.incarnation
import Util.fetchJavadocIOForDependency
import Util.id
import Util.testShadowJar
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
Expand All @@ -28,8 +29,6 @@ plugins {
alias(libs.plugins.hugo)
}

val Provider<PluginDependency>.id get() = get().pluginId

allprojects {

with(rootProject.libs.plugins) {
Expand Down
6 changes: 6 additions & 0 deletions buildSrc/src/main/kotlin/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.Exec
import org.gradle.kotlin.dsl.register
import org.gradle.plugin.use.PluginDependency
import java.io.ByteArrayOutputStream
import java.io.File
import java.net.URL
Expand Down Expand Up @@ -113,4 +114,9 @@ object Util {
}
}
}

/**
* Directly accesses the plugin id.
*/
val Provider<PluginDependency>.id get() = get().pluginId
}