moise.os.ss
Class Role

Package class diagram package Role
java.lang.Object
  extended by moise.common.MoiseElement
      extended by moise.os.ss.Role
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Identifiable, ToXML

public class Role
extends MoiseElement
implements ToXML

Represents a Role Definition (its name and inheritance).

See Also:
Serialized Form

Field Summary
protected  boolean isAbstract
           
protected  SS ss
           
protected  java.util.Set<Role> superRoles
           
 
Fields inherited from class moise.common.MoiseElement
debug
 
Constructor Summary
Role(java.lang.String id, SS ss)
          Creates a new Role
 
Method Summary
 void addSuperRole(java.lang.String superId)
           
 boolean containsSuperRole(Role r)
          returns true if some of the direct super roles is equal r
 java.util.Map<java.lang.String,Role> getAllSuperRoles()
          gets the super roles of this role (including the super roles of the super roles...., but excluding this role).
 org.w3c.dom.Element getAsDetailedDom(org.w3c.dom.Document document)
           
 org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
           
 java.util.Collection<Compatibility> getCompatibilities(Group gr)
          gets all compatibilities for this role (and its super roles) in the context of the GrSpec
 java.util.Collection<Norm> getDeonticRelations()
          gets all deontic relations (obligations, permissions, ...) for this role (and its super roles)
 java.util.Map<java.lang.String,Role> getEntailedRoles()
          gets the super roles of this role (including this role, the super roles of the super roles....)
 java.util.Collection<Group> getGroups()
          gets a list of groups where this role can be played
 java.util.Collection<Link> getLinks(Group gr)
          gets all links for this role (and its super roles) in the context of the GrSpec
 java.util.Collection<Norm> getNorms(NS.OpTypes type, java.lang.String mission)
          gets norms for this role (and its super roles).
 java.lang.Object getProperty(java.lang.String id)
          gets properties of this role (it also looks at super roles properties not "over written"
 java.util.Collection<Role> getSubRoles()
          gets the direct specialisations (sub-roles) of this role.
 java.util.Collection<Role> getSuperRoles()
          gets the super roles of this role
static java.lang.String getXMLTag()
           
 boolean hasNorm(NS.OpTypes type, java.lang.String mission)
          returns true if this role has a norm towards the mission.
 boolean isAbstract()
           
protected  void setAbstract(boolean a)
           
 void setFromDOM(org.w3c.dom.Element ele)
           
 void setSS(SS ss)
           
 
Methods inherited from class moise.common.MoiseElement
compareTo, equals, getBoolProperty, getBoolProperty, getCreationDate, getFullId, getId, getId, getOwner, getPrefix, getPrefix, getProperties, getPropertiesAsDOM, getPropertiesAsProlog, getStrProperty, hashCode, setId, setOwner, setPrefix, setPropertiesFromDOM, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

superRoles

protected java.util.Set<Role> superRoles

isAbstract

protected boolean isAbstract

ss

protected SS ss
Constructor Detail

Role

public Role(java.lang.String id,
            SS ss)
Creates a new Role

Parameters:
ss - the SS this role will belongs to
id - the identification of the role
Method Detail

setSS

public void setSS(SS ss)

addSuperRole

public void addSuperRole(java.lang.String superId)
                  throws MoiseConsistencyException
Throws:
MoiseConsistencyException

getSuperRoles

public java.util.Collection<Role> getSuperRoles()
gets the super roles of this role


containsSuperRole

public boolean containsSuperRole(Role r)
returns true if some of the direct super roles is equal r


getAllSuperRoles

public java.util.Map<java.lang.String,Role> getAllSuperRoles()
gets the super roles of this role (including the super roles of the super roles...., but excluding this role). The returned map keys are the roles' id (String) and the value is the role (object of the class Role)


getEntailedRoles

public java.util.Map<java.lang.String,Role> getEntailedRoles()
gets the super roles of this role (including this role, the super roles of the super roles....) The returned map keys are the roles' id (String) and the value is the role


getSubRoles

public java.util.Collection<Role> getSubRoles()
gets the direct specialisations (sub-roles) of this role. It does not return the sub-sub-roles.


getGroups

public java.util.Collection<Group> getGroups()
gets a list of groups where this role can be played


getCompatibilities

public java.util.Collection<Compatibility> getCompatibilities(Group gr)
gets all compatibilities for this role (and its super roles) in the context of the GrSpec


getLinks

public java.util.Collection<Link> getLinks(Group gr)
gets all links for this role (and its super roles) in the context of the GrSpec


getDeonticRelations

public java.util.Collection<Norm> getDeonticRelations()
gets all deontic relations (obligations, permissions, ...) for this role (and its super roles)


getNorms

public java.util.Collection<Norm> getNorms(NS.OpTypes type,
                                           java.lang.String mission)
gets norms for this role (and its super roles). if type != null, the norm type must be equals to type (all obligation is a permission). if mission != null, the norm mission must be equals to mission


hasNorm

public boolean hasNorm(NS.OpTypes type,
                       java.lang.String mission)
returns true if this role has a norm towards the mission. if type != null, the norm type must be equals to type (all obligation is a permission). if mission != null, the norm mission must be equals to mission


getProperty

public java.lang.Object getProperty(java.lang.String id)
gets properties of this role (it also looks at super roles properties not "over written"

Overrides:
getProperty in class MoiseElement

setAbstract

protected void setAbstract(boolean a)

isAbstract

public boolean isAbstract()

getXMLTag

public static java.lang.String getXMLTag()

getAsDOM

public org.w3c.dom.Element getAsDOM(org.w3c.dom.Document document)
Specified by:
getAsDOM in interface ToXML

getAsDetailedDom

public org.w3c.dom.Element getAsDetailedDom(org.w3c.dom.Document document)

setFromDOM

public void setFromDOM(org.w3c.dom.Element ele)
                throws MoiseException
Throws:
MoiseException