It provides an actor system.
The project frtex uses this actor system for reading a LaTeX file and return a new LaTeX file in which the "\input" are (recursively) replaced by the content.
- download the actor system from github
- Use it by example performing the tests :
mvn test
Message
Mail
MailBox
The types are
-
DecentActorSystem
its special features are :void setUpActor(DecentActorRef,DecentActor)
. Give to the two references the attribute they need and associate them in the actor map.DecentActorRef createPair()
(abstract). This function has to be overridden in the extensions. The override has to create a pair actor/actor reference and callsetUpActror
with these two as arguments.
-
DecentActorRef
-
DecentAbsActor
its special features are :- reference to the actor system you get the actor system with
public DecentActorSystem getActorSystem()
. - accepted type Each actor has its own accepted type of message. By default it is the one of the system, but is can be set to any other class. No check is done, but the accepted message type of one actor is supposed to be a subclass of the accepted message type of the system.
We have the following two methods : *
void setAcceptedType()
that should be used only one. During the creation process of the actor. See the methodsetUpActor
. *Class getAcceptedType()
.- name/serie number Each actor has a name with the usual method
String getName()
. The default name is based on the creation ordering (zero for the first, and so on). The serie number is private.
- reference to the actor system you get the actor system with
ActorSystem getActorSystem()
returns the actor system which created him.
In order to make the things clearly you should create your own actor system by derivation from the "decent" actor system. You should create the following classes
yourActor
yourActorRef
yourActorSystem
- In the class
yourActorSystem
public void setUpActor(yourActorRef ref,yourActor act)
{
super.setUpActor(ref,act);
// give here to ref and act the properties they need
}
- In the class
yourActorSystem
public yourActorRef createPair()
{
yourActorRef reference = new yourActorRef();
yourActor actor = new yourActor();
setUpActor(reference,actor);
return reference;
}
- In the class
yourActorSystem
@Override
public yourActor getActor(DecentActorRef reference) { return (yourActor) super.getActor(reference); }
The cast should work because the actor has a reference to its actor system. Thus only actors build from your actor system should get into that method.
- In the class
yourActor
@Override
public YourActorRef getSelfReference() { return (YourActorRef) super.getSelfReference() ; }
- In the class
yourActor
@Override
public LatexActorSystem getActorSystem() { return (LatexActorSystem) super.getActorSystem(); }
- In the class
yourActorRef
@Override
public LatexActor getActor() { return (LatexActor) super.getActor(); }
- In the class
yourActor
@Override
public void receive(Message m)
{
super.receive(m);
// do whatever your actor should do.
}
It is only for testing purpose. The system manage the message type "EchoText".
The EchoText
type has two subtypes EchoTextOne
and EchoTextTwo
that only exist for testing purpose of the accepted_type
system.
EchoActor
has a reference to the last message
- The actor reference often calls its actor in order to answer questions like the accepted type or the actor system. One should memoize them.
The skeleton is from rcardin, but I got quite far away from his architecture. For example
- I removed the use of generics and add a class variable
accepted_type
- I removed the base 'abstract' first implementation.
- I removed the interfaces