24 package org.lightvoting.simulation.environment;
26 import org.lightjason.agentspeak.language.CLiteral;
27 import org.lightjason.agentspeak.language.CRawTerm;
28 import org.lightjason.agentspeak.language.ILiteral;
32 import java.util.Collections;
33 import java.util.LinkedList;
34 import java.util.List;
61 m_groups = Collections.synchronizedList(
new LinkedList<>() );
73 m_agentList.add( p_votingAgent );
80 l_firstAgent.sleep( 0 );
81 l_firstAgent.getChair().sleep( 0 );
93 return CLiteral.from(
"groups", CRawTerm.from(
m_groups ) );
103 final CGroup l_group =
new CGroup( p_votingAgent,
"RANDOM" );
104 m_groups.add( l_group );
105 System.out.println(
"Created Group " + l_group );
118 final CGroup l_group =
new CGroup( p_votingAgent,
"COORDINATED" );
119 m_groups.add( l_group );
120 System.out.println(
"Created Group " + l_group );
133 p_randomGroup.addRandom( p_votingAgent );
147 p_group.addCoordinated( p_votingAgent );
160 if ( !( ( l_group.literal( p_chairAgent ) ) == null ) )
161 return l_group.literal( p_chairAgent );
183 l_wakingAgent.sleep( 0 );
184 l_wakingAgent.getChair().sleep( 0 );
185 System.out.println(
"Waking up agent " + l_wakingAgent.name() );
CGroup openNewGroupCoordinated(final CVotingAgent p_votingAgent)
open new group (for coordinated grouping)
Created by sophie on 22.02.17.
void addAgentCoordinated(final CGroup p_group, final CVotingAgent p_votingAgent)
add agent to group (for coordinated grouping)
ILiteral detectGroup(final CChairAgent p_chairAgent)
detect group of chair agent
CGroup openNewGroupRandom(final CVotingAgent p_votingAgent)
open new group (for random grouping)
ILiteral literal(final CVotingAgent p_votingAgent)
returns literal representation of existing groups
final List< CVotingAgent > m_agentList
final List< CGroup > m_groups
void addAgentRandom(final CGroup p_randomGroup, final CVotingAgent p_votingAgent)
add agent to group (for random grouping)
Created by sophie on 21.02.17.
final void initialset(final CVotingAgent p_votingAgent)
initialize groups
void reopen(final CGroup p_group)
open group for further elections unless the capacity is reached.
Created by sophie on 24.04.17.
BDI agent with voting capabilities.
CEnvironment(final int p_size, final String p_fileName)
constructor