Giter Site home page Giter Site logo

Deep history about squirrel HOT 8 CLOSED

hekailiang avatar hekailiang commented on May 23, 2024
Deep history

from squirrel.

Comments (8)

hekailiang avatar hekailiang commented on May 23, 2024

Hi Voskuijlen, Thanks for reporting this issue. I will look into this problem and come back to you later.

from squirrel.

Voskuijlen avatar Voskuijlen commented on May 23, 2024

Hi Hekailiang, Thank you for looking in to this problem. When do you think this might be solved?

from squirrel.

hekailiang avatar hekailiang commented on May 23, 2024

Hi Voskuijlen, I think your thoughts is reasonable. However, my concern is about memory consumption. By doing that you recommended it will cause all the historical information being stored no matter necessary or not. Since this is not a functional problem I will keep this issue open, and try to provider better solution later when I have time. In the mean time if you have better solution I will be happy to take a look. I am sorry for the late reply.

from squirrel.

Voskuijlen avatar Voskuijlen commented on May 23, 2024

Hi Hekailiang, I don't know how the memory consumption will act further down the road. Perhaps adding this else-statement to the if-statement something like the following will be better then?:

if(getParentState().getHistoryType()!=HistoryType.NONE) {
   stateContext.getStateMachineData().write().lastActiveChildStateFor(getParentState().getStateId(), getStateId());
}
else {
   ImmutableState<T, S, E, C> parent = getParentState();
   while (parent != null) {
      if(parent.getHistoryType()==HistoryType.DEEP) {
         stateContext.getStateMachineData().write().lastActiveChildStateFor(parent.getStateId(), getStateId());
         parent = null;
      }
      else {
         parent = parent.getParentState();
      }
   }
}

This will look for the parent state as long as they exist and if historytype deep is found, the state will saved.

Although I am not sure if this also solves the following problem:
A submachine state should be semantically be the same as a composite state (according to http://www.uml-diagrams.org/state-machine-diagrams.html). This means that deep history should also apply to submachine states (or linked states in Squirrel). I don't know if the getParentState function returns the submachine state if linked?

from squirrel.

hekailiang avatar hekailiang commented on May 23, 2024

Hi Voskuijlen, you changes looks fine for me. Can you submit a pull request and with test case provided for your changes.

The linked state backed by a state machine to process its event. Currently implementation(actually is not good) stores all the state machine instances within linked states, and will terminate backend state machine instance when linked state exit, which cause historical information of backend state machine lost. I guess nobody use this feature right now(otherwise it should be many issues) you can ignore about linked state.

from squirrel.

Voskuijlen avatar Voskuijlen commented on May 23, 2024

Hi Hekailiang, I think I did something wrong. I forked the project, and don't really know how to create a pull request from this.. any advise?

from squirrel.

hekailiang avatar hekailiang commented on May 23, 2024

https://help.github.com/articles/creating-a-pull-request/

from squirrel.

Voskuijlen avatar Voskuijlen commented on May 23, 2024

Ok found it!

from squirrel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.