public void Read (BinaryReader reader) { machine = (MachineId) reader.ReadUInt16 (); sections = reader.ReadInt16 (); tdStampRaw = reader.ReadUInt32 (); symTabPtr = reader.ReadUInt32 (); numSymbols = reader.ReadUInt32 (); optHeaderSize = reader.ReadInt16 (); characteristics = (Characteristics) reader.ReadUInt16 (); }
void EntryInit() { l = new List<int>(); l.Insert(0, 12); l.Insert(0, 23); l.Insert(0, 12); l.Insert(0, 23); l.Insert(0, 12); l.Insert(0, 23); mac = this.CreateMachine(typeof(Tester)); this.Send(mac, new Config(l, 1)); this.Send(mac, new SeqPayload(l)); }
/// <summary> /// Инициализирует новый проект с указанными начальными параметрами. /// </summary> /// <param name="name">Название проекта.</param> /// <param name="machine">Тип абстрактного вычислителя, под который создается проект.</param> /// <param name="directory">Путь к директории проекта.</param> public AbstractProject(string name, MachineId machine, string directory) { if (name == null) throw new ArgumentNullException("Название проекта не может быть неопределенным"); if(!Enum.IsDefined(typeof(MachineId), machine)) throw new ArgumentException("Указанный тип не существует"); if (!CheckName(name)) throw new ArgumentException("Название проекта некорректно. Название может содержать латинские буквы и десятичные цифры"); if (string.IsNullOrEmpty(directory)) throw new ArgumentException("Путь к файлу проекта имеет неверный формат"); _name = name; _machineId = machine; _files = new List<string>(); _directory = directory; }
public E(MachineId id) { this.Id = id; }
/// <summary> /// Constructor. /// </summary> protected BaseMachine() { this.Id = new MachineId(this.GetType()); }
/// <summary> /// Creates a bug trace step. /// </summary> /// <param name="index">Index</param> /// <param name="type">BugTraceStepType</param> /// <param name="machine">Machine</param> /// <param name="machineState">MachineState</param> /// <param name="eventInfo">EventInfo</param> /// <param name="action">MethodInfo</param> /// <param name="targetMachine">Target machine</param> /// <param name="boolChoice">Boolean choice</param> /// <param name="intChoice">Integer choice</param> /// <param name="extraInfo">Extra info</param> /// <returns>BugTraceStep</returns> internal static BugTraceStep Create(int index, BugTraceStepType type, MachineId machine, string machineState, EventInfo eventInfo, MethodInfo action, MachineId targetMachine, bool? boolChoice, int? intChoice, string extraInfo) { var traceStep = new BugTraceStep(); traceStep.Index = index; traceStep.Type = type; traceStep.Machine = machine; traceStep.MachineState = machineState; traceStep.EventInfo = eventInfo; if (action != null) { traceStep.InvokedAction = action.Name; } traceStep.TargetMachine = targetMachine; traceStep.RandomBooleanChoice = boolChoice; traceStep.RandomIntegerChoice = intChoice; traceStep.ExtraInfo = extraInfo; traceStep.Previous = null; traceStep.Next = null; return traceStep; }
void EntryInit() { TravelAgentMachine = this.CreateMachine(typeof(TravelAgent)); this.Send(TravelAgentMachine, new Config(this.Id)); CityCabMachine = this.CreateMachine(typeof(CityCab)); this.Send(CityCabMachine, new Config(this.Id)); RemoteCheckIn = false; this.Raise(new Unit()); }
/// <summary> /// Creates a send action info. /// </summary> /// <param name="index">Index</param> /// <param name="mid">MachineId</param> /// <param name="targetMachineId">Target MachineId</param> /// <param name="e">Event</param> /// <param name="sendId">Send id</param> /// <returns>MachineActionInfo</returns> internal static MachineActionInfo CreateSendActionInfo(int index, MachineId mid, MachineId targetMachineId, Event e, int sendId) { var actionInfo = new MachineActionInfo(); actionInfo.Index = index; actionInfo.Type = MachineActionType.SendAction; actionInfo.MachineId = mid.Value; actionInfo.TargetMachineId = targetMachineId.Value; actionInfo.EventName = e.GetType().FullName; actionInfo.EventId = e.GetHashCode(); actionInfo.SendId = sendId; actionInfo.Previous = null; actionInfo.Next = null; return actionInfo; }
/// <summary> /// Создает новый проект с указанным названием и типом абстрактной машины. /// </summary> /// <param name="name">Название создаваемого проекта.</param> /// <param name="machine">Тип абстрактной машины, под который создается проект.</param> /// <param name="settings">Начальные установки визуализатора.</param> /// <returns>Созданный проект.</returns> private AbstractProject CreateProject(string name, MachineId machine, Dictionary<string, bool> settings = null) { string fileName = nameBox.Text; string folder = newFolderBox.Checked ? Path.Combine(_folderDialog.SelectedPath, fileName) : _folderDialog.SelectedPath; AbstractProject result = new AbstractProject(name, machine, folder); result.VisualizerSettings = settings; return result; }
public E(MachineId a) { this.A = a; }
/// <summary> /// Sets the id of this machine. /// </summary> /// <param name="mid">MachineId</param> internal void SetMachineId(MachineId mid) { this.Id = mid; this.Runtime = mid.Runtime; }
public ConfigureEvent(MachineId id) : base() { this.Target = id; }
void Configure() { this.Target = (this.ReceivedEvent as ConfigureEvent).Target; this.Raise(new StartTimerEvent()); }
void Configure() { this.Server = (this.ReceivedEvent as Config).Id; this.Counter = 0; this.Raise(new Unit()); }
void InitOnEntry() { this.Client = this.CreateMachine(typeof(Client)); this.Send(this.Client, new Config(this.Id)); this.Raise(new Unit()); }
void Configure() { this.Target = (this.ReceivedEvent as Config).Target; this.Raise(new Unit()); }
/// <summary> /// Sends an event to a remote machine. /// </summary> /// <param name="target">Target machine id</param> /// <param name="e">Event</param> void INetworkProvider.RemoteSend(MachineId target, Event e) { this.Channel.SendEvent(target, e); }
void SOnEntry() { this.N = this.CreateMachine(typeof(N)); this.Send(this.N, new E(this.Id)); this.Raise(new Unit()); }
void Configure() { this.Master = (this.ReceivedEvent as Config).Id; this.Raise(new Unit()); }
void Configure() { RealMachine = (this.ReceivedEvent as Config).Id; }
/// <summary> /// Sends an asynchronous event to a machine. /// </summary> /// <param name="target">Target machine id</param> /// <param name="e">Event</param> void IRemoteCommunication.SendEvent(MachineId target, Event e) { Output.Print("Received sent event {0}", e.GetType()); PSharpRuntime.SendEvent(target, e); }
public Config(MachineId id) : base(-1, -1) { this.Id = id; }
void EntryInit() { GhostMachine = this.CreateMachine(typeof(Ghost)); this.Send(GhostMachine, new Config(this.Id)); this.Raise(new Unit()); }
public Config(MachineId id) : base() { this.Target = id; }
public static void Send(PSharpRuntime runtime, MachineId target) { runtime.SendEvent(target, new E(2)); }
void EntryInit() { GhostMachine = this.CreateMachine(typeof(GhostMachine)); this.Send(GhostMachine, new Config(this.Id)); this.Raise(new Unit()); }
public Config(MachineId server) { this.Server = server; }
public Ping(MachineId id) : base(1, -1) { this.Id = id; }
public Ping(MachineId client) { this.Client = client; }
/// <summary> /// Получает краткое название машины по ее идентификатору. /// </summary> /// <param name="id">Идентификатор машины.</param> /// <returns>Название машины.</returns> private string GetMachineShortName(MachineId id) { switch(id) { case MachineId.Post: return "МП"; case MachineId.Turing: return "МТ"; case MachineId.Register: return "МБР"; } return "???"; }
internal virtual void Initialize(MachineId machineId, AppMachineInitializePayload payload) { this.machineId = machineId; peekProxy = payload.peekProxy; annotationProxy = payload.annotationProxy; }
public void Deserialize(Stream stream) { StreamHelper.Read(stream, out Magic); StreamHelper.Read(stream, out MajorVersion); StreamHelper.Read(stream, out MinorVersion); byte mId; StreamHelper.Read(stream, out mId); MachineId = (MachineId)mId; StreamHelper.Read(stream, out Flags); }
internal override void Initialize(MachineId machineId, AppMachineInitializePayload payload) { base.Initialize(machineId, payload); migratingTable = new MasterMigratingTable(payload.configService, payload.oldTable, payload.newTable, new ChainTableMonitor(this), MigrationModel.GetEnabledBug()); }
/// <summary> /// Sends an asynchronous event to a machine. /// </summary> /// <param name="target">Target machine id</param> /// <param name="e">Event</param> void IRemoteCommunication.SendEvent(MachineId target, Event e) { this.Runtime.Log("<RemoteLog> Received remotely sent event {0}", e.GetType()); this.Runtime.SendEvent(target, e); }
public ReplyTarget(object replyId, MachineId machineId) { this.replyId = replyId; this.machineId = machineId; tcs = new TaskCompletionSource <TResult>(TaskCreationOptions.RunContinuationsAsynchronously); }
/// <summary> /// Sends an asynchronous event to a machine. /// </summary> /// <param name="target">Target machine id</param> /// <param name="e">Event</param> void INetworkProvider.RemoteSend(MachineId target, Event e) { this.Runtime.SendEvent(target, e); }
public Config(List <MachineId> servers, MachineId parentServer, int myRank) { this.Servers = servers; this.ParentServer = parentServer; this.MyRank = myRank; }
private void Configure() { this.Master = (this.ReceivedEvent as Config).Id; this.Raise(new Unit()); }
public Ping(MachineId leaderElection, int rank) { this.LeaderElection = leaderElection; this.Rank = rank; }
/// <summary> /// Creates an invocation action info. /// </summary> /// <param name="index">Index</param> /// <param name="mid">MachineId</param> /// <param name="actionName">Action name</param> /// <param name="actionId">Action id</param> /// <returns>MachineActionInfo</returns> internal static MachineActionInfo CreateInvocationActionInfo(int index, MachineId mid, string actionName, int actionId) { var actionInfo = new MachineActionInfo(); actionInfo.Index = index; actionInfo.Type = MachineActionType.InvocationAction; actionInfo.MachineId = mid.Value; actionInfo.ActionName = actionName; actionInfo.ActionId = actionId; actionInfo.Previous = null; actionInfo.Next = null; return actionInfo; }
public NewLeader(MachineId leader, int rank) { this.CurrentLeader = leader; this.Rank = rank; }
void EntryInit() { mac = this.CreateMachine(typeof(Real2)); this.Raise(new E1()); }
void ExitInit() { GhostMachine = this.CreateMachine(typeof(Ghost)); this.Send(GhostMachine, new Config(this.Id)); }
public Ping(MachineId sender) : base() { this.Sender = sender; }
public Config(MachineId id) { this.Id = id; }
public Pong(MachineId node) : base() { this.Node = node; }
public static void Send(PSharpRuntime runtime, MachineId target) { runtime.SendEvent(target, new E1(2)); }
void InitOnEntry() { this.Servers = new List <MachineId>(); this.Clients = new List <MachineId>(); this.NumOfServers = 3; for (int i = 0; i < this.NumOfServers; i++) { MachineId server = null; if (i == 0) { server = this.CreateMachine(typeof(ChainReplicationServer), new ChainReplicationServer.Config(i, true, false)); } else if (i == this.NumOfServers - 1) { server = this.CreateMachine(typeof(ChainReplicationServer), new ChainReplicationServer.Config(i, false, true)); } else { server = this.CreateMachine(typeof(ChainReplicationServer), new ChainReplicationServer.Config(i, false, false)); } this.Servers.Add(server); } this.Monitor <InvariantMonitor>( new InvariantMonitor.Config(this.Servers)); this.Monitor <ServerResponseSeqMonitor>( new ServerResponseSeqMonitor.Config(this.Servers)); for (int i = 0; i < this.NumOfServers; i++) { MachineId pred = null; MachineId succ = null; if (i > 0) { pred = this.Servers[i - 1]; } else { pred = this.Servers[0]; } if (i < this.NumOfServers - 1) { succ = this.Servers[i + 1]; } else { succ = this.Servers[this.NumOfServers - 1]; } this.Send(this.Servers[i], new ChainReplicationServer.PredSucc(pred, succ)); } this.Clients.Add(this.CreateMachine(typeof(Client), new Client.Config(0, this.Servers[0], this.Servers[this.NumOfServers - 1], 1))); this.Clients.Add(this.CreateMachine(typeof(Client), new Client.Config(1, this.Servers[0], this.Servers[this.NumOfServers - 1], 100))); this.ChainReplicationMaster = this.CreateMachine(typeof(ChainReplicationMaster), new ChainReplicationMaster.Config(this.Servers, this.Clients)); this.Raise(new Halt()); }
public ReminderCancellationSource(MachineId actor, MachineId reminder) { this.Actor = actor; this.Reminder = reminder; }
/// <summary> /// Gets result from the given machine. /// </summary> /// <param name="runtime">The P# runtime.</param> /// <param name="mid">Machine to get response from.</param> static async Task GetDataAndPrint(PSharpRuntime runtime, MachineId mid) { var resp = await GetReponseMachine <M1.Response> .GetResponse(runtime, mid, m => new M1.Get(m)); Console.WriteLine("Got response: {0}", resp.v); }
void Configure() { EmployeeMachine = (this.ReceivedEvent as Config).Id; this.Raise(new Unit()); }
public Get(MachineId mid) { this.Mid = mid; }
void EntryInit() { PongId = this.CreateMachine(typeof(PONG)); this.Raise(new Success()); }
public I_ReliableStorageMachine(MachineId machine, List <string> permissions) : base(machine, permissions) { }