src/Pure/PIDE/document.scala
changeset 70780 034742453594
parent 70716 a8afe8eb3529
child 70986 d8a7df9fdd03
equal deleted inserted replaced
70779:97b168f0c3a3 70780:034742453594
   895         command <- commands.iterator
   895         command <- commands.iterator
   896         id <- (command.id :: assignment.command_execs.getOrElse(command.id, Nil)).iterator
   896         id <- (command.id :: assignment.command_execs.getOrElse(command.id, Nil)).iterator
   897       } yield (id -> command)).toMap
   897       } yield (id -> command)).toMap
   898     }
   898     }
   899 
   899 
   900     def command_state_eval(version: Version, command: Command): Option[Command.State] =
   900     def command_maybe_consolidated(version: Version, command: Command): Boolean =
   901     {
   901     {
   902       require(is_assigned(version))
   902       require(is_assigned(version))
   903       try {
   903       try {
   904         the_assignment(version).check_finished.command_execs.getOrElse(command.id, Nil) match {
   904         the_assignment(version).check_finished.command_execs.getOrElse(command.id, Nil) match {
   905           case eval_id :: _ => Some(the_dynamic_state(eval_id))
   905           case eval_id :: print_ids =>
   906           case Nil => None
   906             the_dynamic_state(eval_id).maybe_consolidated &&
   907         }
   907             !print_ids.exists(print_id => the_dynamic_state(print_id).consolidating)
   908       }
   908           case Nil => false
   909       catch { case _: State.Fail => None }
   909         }
       
   910       }
       
   911       catch { case _: State.Fail => false }
   910     }
   912     }
   911 
   913 
   912     private def command_states_self(version: Version, command: Command)
   914     private def command_states_self(version: Version, command: Command)
   913       : List[(Document_ID.Generic, Command.State)] =
   915       : List[(Document_ID.Generic, Command.State)] =
   914     {
   916     {
   990         case Some(command) => command_states(version, command).headOption.exists(_.initialized)
   992         case Some(command) => command_states(version, command).headOption.exists(_.initialized)
   991       })
   993       })
   992 
   994 
   993     def node_maybe_consolidated(version: Version, name: Node.Name): Boolean =
   995     def node_maybe_consolidated(version: Version, name: Node.Name): Boolean =
   994       name.is_theory &&
   996       name.is_theory &&
   995       {
   997       version.nodes(name).commands.reverse.iterator.forall(command_maybe_consolidated(version, _))
   996         version.nodes(name).commands.reverse.iterator.forall(command =>
       
   997           command_state_eval(version, command) match {
       
   998             case None => false
       
   999             case Some(st) => st.maybe_consolidated
       
  1000           })
       
  1001       }
       
  1002 
   998 
  1003     def node_consolidated(version: Version, name: Node.Name): Boolean =
   999     def node_consolidated(version: Version, name: Node.Name): Boolean =
  1004       !name.is_theory ||
  1000       !name.is_theory ||
  1005       {
  1001       {
  1006         val it = version.nodes(name).commands.reverse.iterator
  1002         val it = version.nodes(name).commands.reverse.iterator