Class MyContexts
- java.lang.Object
-
- eu.h2020.helios_social.core.info_control.MyContexts
-
public class MyContexts extends java.lang.Object
This class is a container of user contexts (MyContexts). It provides methods to get, add and remove contexts from the container. It also binds contexts to Contextual Ego Network.
-
-
Constructor Summary
Constructors Constructor Description MyContexts(eu.h2020.helios_social.core.contextualegonetwork.ContextualEgoNetwork cen, MyContextsDatabase myContextsDb)
Creates a MyContexts instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Context context)
Adds a context into MyContexts and associates it with contextual ego networkjava.util.List<Context>
getActiveContexts()
Returns currently active contextseu.h2020.helios_social.core.contextualegonetwork.ContextualEgoNetwork
getCen()
Returns the associated contextual ego networkContext
getContextById(java.lang.String id)
Returns context by given idjava.util.List<Context>
getContexts()
Returns all the contexts in MyContextsvoid
remove(Context context)
Removes a context from MyContexts and from contextual ego networkvoid
removeAll()
void
setActive(Context context, boolean active)
int
size()
Returns the number of contexts in MyContextsvoid
update(Context context)
Updates MyContextsDatabase with updates in given context
-
-
-
Constructor Detail
-
MyContexts
public MyContexts(eu.h2020.helios_social.core.contextualegonetwork.ContextualEgoNetwork cen, MyContextsDatabase myContextsDb)
Creates a MyContexts instance- Parameters:
cen
- the contextual ego network (or null)myContextsDb
- MyContextsDatabase (or null)
-
-
Method Detail
-
add
public void add(@NonNull Context context)
Adds a context into MyContexts and associates it with contextual ego network- Parameters:
context
- the context
-
update
public void update(@NonNull Context context)
Updates MyContextsDatabase with updates in given context- Parameters:
context
- the context
-
remove
public void remove(@NonNull Context context)
Removes a context from MyContexts and from contextual ego network- Parameters:
context
- the context
-
removeAll
public void removeAll()
-
setActive
public void setActive(@NonNull Context context, boolean active)
-
getContextById
public Context getContextById(@NonNull java.lang.String id)
Returns context by given id- Parameters:
id
- the context ids- Returns:
- the context
-
getActiveContexts
public java.util.List<Context> getActiveContexts()
Returns currently active contexts- Returns:
- the Iterator to active contexts list
-
getContexts
public java.util.List<Context> getContexts()
Returns all the contexts in MyContexts- Returns:
- the list of contexts
-
size
public int size()
Returns the number of contexts in MyContexts- Returns:
- the number of contexts
-
getCen
public eu.h2020.helios_social.core.contextualegonetwork.ContextualEgoNetwork getCen()
Returns the associated contextual ego network- Returns:
- the ContextualEgoNetwork
-
-