Package eu.simuline.relana.model
Class CClass
- java.lang.Object
-
- eu.simuline.relana.model.CClass
-
- All Implemented Interfaces:
CClassLink
public class CClass extends Object implements CClassLink
Represents a component class. Like a java-class this has a namecName
, a packagepkg
and a superclasssuperClass
which is again aCClass
. As this is a component class, it has named components and the mapping from names to components is given bysubComponents
. Observe that the values are notCClass
es butCClassLink
s as the components may not be resolved if this class is resolved as a component may be again of thisCClass
. **** Maps and effects **** are to be explained later.x
- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CClass.SClassDecl
static class
CClass.SClassModifier
Enumerates the class modifier for anSClass
: input and output.
-
Field Summary
Fields Modifier and Type Field Description private String
cName
The Name of thisCClass
.static CClass
COMPONENT
The root of the subclass hierarchy ofCClass
es: Class namedComponent
without superclass, i.e.private Map<String,CClass.SClassDecl>
effects
Maps the names of the effects to their classes.private Map<String,MapDecl>
maps
The maps declared in this class.private Package
pkg
The package of this class.private Map<String,CClassLink>
subComponents
Maps the names of the subcomponents to their classes.private CClass
superClass
The unique superclass of this class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addOccurrence(CClassLoader.Occurrence occ)
static CClass
getCClass(String cName, Package pkg, CClass superClass, Map<String,MapDecl> maps, Map<String,CClassLink> subComponents, Map<String,CClass.SClassDecl> effects)
The location of the description of this class within the library.CClassLink
getComponentCls(String name)
CClassLink
getComponentCls(List<String> path)
(package private) Set<String>
getComponentNames()
CClass.SClassDecl
getEffectDecl(String name)
CClass.SClassDecl
getEffectDecl(List<String> path)
(package private) Set<String>
getEffectNames()
Set<CClass.SClassDecl>
getEffectsRec()
CInstance
getInstance()
Returns an instance of this class.MapDecl
getMapDecl(String name)
Returns the map declaration with the given name.String
getName()
Returns the short name of this class.private Map<String,CClassLink>
getName2ComponentClss()
Returns the map between names and subcomponent classes.private Map<String,CClass.SClassDecl>
getName2Effects()
Package
getPackage()
Returns the package of this class.CClass
getSuperClass()
Returns the superclass of this class.boolean
isResolved()
CClassLink
setComponent(String name, CClass cClass)
String
toString()
(package private) void
verify()
-
-
-
Field Detail
-
COMPONENT
public static final CClass COMPONENT
The root of the subclass hierarchy ofCClass
es: Class namedComponent
without superclass, i.e.getSuperClass()
returnsnull
This represents an empty component.
-
cName
private final String cName
The Name of thisCClass
.
-
pkg
private final Package pkg
The package of this class.
-
superClass
private final CClass superClass
The unique superclass of this class. There is exactly one class without super class:COMPONENT
and the only one for which this field istnull
.
-
subComponents
private final Map<String,CClassLink> subComponents
Maps the names of the subcomponents to their classes.
-
effects
private final Map<String,CClass.SClassDecl> effects
Maps the names of the effects to their classes.
-
-
Method Detail
-
getCClass
public static CClass getCClass(String cName, Package pkg, CClass superClass, Map<String,MapDecl> maps, Map<String,CClassLink> subComponents, Map<String,CClass.SClassDecl> effects)
The location of the description of this class within the library.
-
getName
public final String getName()
Returns the short name of this class.- Specified by:
getName
in interfaceCClassLink
- Returns:
cName
.
-
getSuperClass
public final CClass getSuperClass()
Returns the superclass of this class. This isnull
if and only if this class is the unique overall base classCOMPONENT
.- Returns:
superClass
.
-
getMapDecl
public MapDecl getMapDecl(String name)
Returns the map declaration with the given name. The lookup is done recursively down the inheritance hierarchy.- Parameters:
name
- the name of a declared map.- Returns:
- the map declaration with the given name
or
null
if no declaration is defined with this name.
-
getName2ComponentClss
private Map<String,CClassLink> getName2ComponentClss()
Returns the map between names and subcomponent classes.- Returns:
subComponents
.
-
getComponentCls
public CClassLink getComponentCls(String name)
-
getComponentCls
public final CClassLink getComponentCls(List<String> path)
-
getEffectDecl
public CClass.SClassDecl getEffectDecl(String name)
-
getEffectDecl
public final CClass.SClassDecl getEffectDecl(List<String> path)
-
getName2Effects
private Map<String,CClass.SClassDecl> getName2Effects()
-
getEffectsRec
public final Set<CClass.SClassDecl> getEffectsRec()
-
setComponent
public final CClassLink setComponent(String name, CClass cClass)
- Specified by:
setComponent
in interfaceCClassLink
-
verify
void verify() throws VerifyException
- Throws:
VerifyException
-
getInstance
public CInstance getInstance()
Returns an instance of this class. Also resolves formulae.- Returns:
- a
CInstance
of this class.
-
addOccurrence
public void addOccurrence(CClassLoader.Occurrence occ)
- Specified by:
addOccurrence
in interfaceCClassLink
-
isResolved
public final boolean isResolved()
- Specified by:
isResolved
in interfaceCClassLink
-
-