public ConnectionUnion(string name) { Name = name; Chanels = new List <Chanel>(); _direction = Direction.Na; _initialstate = InitialState.Na; }
public virtual void Start() { RefRigidbody = GetComponent <Rigidbody>(); RefSphere = GetComponent <SphereCollider>(); Neighbors = new List <Agent>(); FSM = new StateMachine.StateMachine(); InitialState initial = new InitialState(this); GroupState group = new GroupState(this); ExitState exit = new ExitState(this); JoinGroupTransition JG = new JoinGroupTransition(); JG.SetTargetState(group); ExitTriggerTransition ET = new ExitTriggerTransition(); ET.SetTargetState(exit); ExitFormationTransition EF = new ExitFormationTransition(); EF.SetTargetState(group); initial.AddTransitions(JG); group.AddTransitions(ET); exit.AddTransitions(EF); FSM.AddState(initial); FSM.AddState(group); FSM.AddState(exit); FSM.Start(initial); }
public static void Initialise(MonoGameRenderer renderer) { //levelCompleteState = new LevelCompleteState(nextLevelState); //nextLevelState = new NextLevelState(levelInProgressState); collusionManager = new CollusionManager(); level = new LevelOne(null, collusionManager); character = new Character(level, collusionManager); gameInProgressState = new GameInProgressState(initialState, level, character); drawCompleteState = new DrawCompleteState(initialState); drawCharacterState = new DrawCharacterState(initialState, character); drawLevelState = new DrawLevelState(initialState, level); drawLevelBuilderState = new DrawLevelBuilderState(initialState); drawMainMenuState = new DrawMainMenuState(initialState); initialState = new InitialState(drawMainMenuState); //displayMainMenuState.NextState = displayLevelBuilderState; //displayLevelBuilderState.NextState = initialState; //displayLevelState.NextState = initialState; //levelInProgressState.NextState = levelCompleteState; //levelCompleteState.NextState = nextLevelState; //nextLevelState.NextState = levelInProgressState; States.Add("InitialState", initialState); States.Add("DrawMainMenuState", drawMainMenuState); States.Add("DrawLevelBuilderState", drawLevelBuilderState); States.Add("DrawLevelState", drawLevelState); States.Add("DrawCharacterState", drawCharacterState); States.Add("DrawCompleteState", drawCompleteState); States.Add("GameInProgressState", gameInProgressState); //States.Add("LevelCompleteState", levelCompleteState); //States.Add("NextLevelState", nextLevelState); }
/// <summary> /// Visits the given input data node. /// </summary> /// <param name="data">Input data node.</param> public override void Visit(InitialState data) { Location = "Initial state"; if (data.Count != ProblemContext.Variables.Count) { throw GetException("The number of initial values does not match the variables count."); } int variableIndex = 0; foreach (var value in data) { CheckValueAssignment(variableIndex++, value); } foreach (var mutexGroup in ProblemContext.MutexGroups) { bool isLocked = false; foreach (var mutexFact in mutexGroup) { if (data[mutexFact.Variable] == mutexFact.Value) { if (isLocked) { throw GetException("Initial values do not comply with defined mutex groups constraints."); } isLocked = true; } } } }
public void StartTracking(object entityObject, InitialState initialState) { Instance instance = new Instance(this, entityObject, initialState); EntityKey entityKey = new EntityKey(this, instance.EntityObject, instance.IsPersisted); this.StartTracking(entityKey, instance); }
public AtmStateMachine(Money cash) { _currentState = Initial = new InitialState(this); CardInserted = new CardInserted(this); PinEntered = new PinEntered(this); CashWithdrawn = new CashWithdrawn(this); CashAmount = cash; }
public override void ProcessFrame(Playable playable, UnityEngine.Playables.FrameData info, object userData) { if (gameObject != null) { gameObject.SetActive(value: true); m_InitialState = InitialState.Active; } }
public override void OnBehaviourPlay(Playable playable, UnityEngine.Playables.FrameData info) { if (!(gameObject == null)) { gameObject.SetActive(value: true); m_InitialState = InitialState.Active; } }
public void Handle_WhenContextIsNull_ExceptionExpected() { var state = new InitialState(); IContext context = null; // ReSharper disable once ExpressionIsAlwaysNull Assert.Catch <ArgumentNullException>(() => state.Go(context)); }
public IEnumerable <Difference> Diff(string flowHandler) { var initial = InitialState.SingleOrDefault(x => x.FlowHandler == flowHandler); var end = EndState.SingleOrDefault(x => x.FlowHandler == flowHandler); var result = _Compare(initial, end); return(result); }
internal Instance(Context context, object entityObject, InitialState initialState) : this(context, entityObject) { for (int index = 0; index < this.entity.RelationCount; index++) { RelationMap relation = this.entity.Relation(index); if (relation.QueryOnly) continue; // Do NOT initialize relations for entities with existing relations if (this.GetField(relation.Member) == null) { string typeName = relation.Type; Type type = EntityMap.GetType(typeName); object relations = null; if (!relation.Lazy && relation.Relationship == Relationship.Parent) { relations = this.context.GetObject(type); } else { #if DOTNETV2 Type genericType = null; object[] args = null; if (relation.Lazy) { if (relation.Relationship == Relationship.Parent) { genericType = typeof(ObjectHolder<>).MakeGenericType(type); args = new object[] { this.context, DBNull.Value }; } else { genericType = typeof(ObjectList<>).MakeGenericType(type); args = new object[] { this.context }; } } else { genericType = typeof(ObjectSet<>).MakeGenericType(type); args = new object[] { 1, 0, 0 }; } relations = Activator.CreateInstance(genericType, internalFlags, null, args, null, null); #else if (relation.Lazy) { if (relation.Relationship == Relationship.Parent) { relations = new ObjectHolder(this.context, type, null); } else { relations = new ObjectList(this.context, type); } } else { relations = new ObjectSet(type, 1, 0, 0); } #endif } this.SetField(relation.Member, relations); } } this.StartTracking(initialState); }
/// <summary> /// Returns true if HistoryItem instances are equal /// </summary> /// <param name="other">Instance of HistoryItem to be compared</param> /// <returns>Boolean</returns> public bool Equals(HistoryItem other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( ProcessId == other.ProcessId || ProcessId != null && ProcessId.Equals(other.ProcessId) ) && ( IdentityId == other.IdentityId || IdentityId != null && IdentityId.Equals(other.IdentityId) ) && ( AllowedToEmployeeNames == other.AllowedToEmployeeNames || AllowedToEmployeeNames != null && AllowedToEmployeeNames.Equals(other.AllowedToEmployeeNames) ) && ( TransitionTime == other.TransitionTime || TransitionTime != null && TransitionTime.Equals(other.TransitionTime) ) && ( Order == other.Order || Order != null && Order.Equals(other.Order) ) && ( InitialState == other.InitialState || InitialState != null && InitialState.Equals(other.InitialState) ) && ( DestinationState == other.DestinationState || DestinationState != null && DestinationState.Equals(other.DestinationState) ) && ( Command == other.Command || Command != null && Command.Equals(other.Command) )); }
public DelimitedFieldEnumerator(StreamReader reader, ParserSettings settings) { _reader = reader; _buffer = new char[1024]; _length = 0; INITIAL_STATE = new InitialState(settings.FieldDelimiter, settings.TextQualifier); _currentState = INITIAL_STATE; }
public void Handle_WhenContextIsCorrect_CreateViewModel() { var state = new InitialState(); var context = TestHelper.CreateTestContext(); state.Go(context); Assert.AreEqual(typeof(WindowOneViewModel), context.WindowManager.GetActiveViewModels().First().GetType()); }
public void Handle_WhenContextIsCorrect_SetExpectedStateToContext() { var state = new InitialState(); var context = TestHelper.CreateTestContext(); state.Go(context); Assert.AreEqual(typeof(WindowOneInitialState), context.State.GetType()); }
protected Game(string configPath) : this() { #if DRAWGRID _gridColor = Config.Instance.Grid; #endif Configuration = new Config(configPath); State = new InitialState(this, Configuration.SplashScreenColor); }
protected void Reset() { Cleanup(); Configuration.ResetMenuColors(); State = new InitialState(this, Configuration.SplashScreenColor); QueueInitialState(); }
public override void OnBehaviourPause(Playable playable, UnityEngine.Playables.FrameData info) { if (!(gameObject == null) && ((info.seekOccurred && info.evaluationType == UnityEngine.Playables.FrameData.EvaluationType.Evaluate) || (info.deltaTime > 0 && playable.GetGraph().IsPlaying()))) { gameObject.SetActive(value: false); m_InitialState = InitialState.Inactive; } }
/// <summary> /// This function is called when the PlayableGraph that owns this PlayableBehaviour starts. /// </summary> /// <param name="playable">The playable this behaviour is attached to.</param> public override void OnGraphStart(Playable playable) { if (gameObject != null) { if (m_InitialState == InitialState.Unset) { m_InitialState = gameObject.activeSelf ? InitialState.Active : InitialState.Inactive; } } }
/// <inheritdoc /> public override int GetHashCode() { unchecked { var hashCode = (States != null ? States.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (InputAlphabet != null ? InputAlphabet.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (InitialState != null ? InitialState.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AcceptStates != null ? AcceptStates.GetHashCode() : 0); return(hashCode); } }
public bool Equals(PDA <A, S> other) { var part1 = AcceptanceCondition.Equals(other.AcceptanceCondition); var part2 = Deterministic == other.Deterministic; var part3 = InitialState.Equals(other.InitialState); var part4 = FirstStackSymbol.Equals(other.FirstStackSymbol); var part5 = AllStackSymbols.OrderBy(s => s.ToString()).SequenceEqual(other.AllStackSymbols.OrderBy(s => s.ToString())); var part6 = States.Values.OrderBy(s => s.Id).SequenceEqual(other.States.Values.OrderBy(s => s.Id)); return(part1 && part2 && part3 && part4 && part5 && part6); }
public void PositiveReadTest() { char[] buffer = new char[1]; int bufferPosition = 0; InitialState returnToState = new InitialState(',', '"'); EndNewLinePatternState target = new EndNewLinePatternState('\n', returnToState); StateReader actualNextState = target.ReadChar((int)'\n', ref buffer, ref bufferPosition); Assert.ReferenceEquals(target, actualNextState); }
public static void Initialize() { endGameState = new EndGameState(initialState); moveSnekState = new MoveSnekState(endGameState); initialState = new InitialState(moveSnekState); States.Add("InitialState", initialState); States.Add("MoveSnekState", moveSnekState); States.Add("EndGameState", endGameState); CurrentState = initialState; }
public File(File parent, string path, string name, bool isMaster, bool isDir, InitialState state, SlaveState slaveState) { this.parent = parent; this.path = path.Replace('\\', '/'); this.name = name; this.isDir = isDir; this.initialState = state; this.slaveState = slaveState; this.isMaster = isMaster; this.initialHash = isDir == false?NGSyncFoldersWindow.TryGetCachedHash(this.path) : string.Empty; }
public File(File parent, string path, string name, bool isMaster, bool isDir, InitialState initialState, MasterState masterState) { this.parent = parent; this.path = path.Replace('\\', '/'); this.name = Path.GetFileName(path); this.isDir = isDir; this.initialState = initialState; this.masterState = masterState; this.isMaster = isMaster; this.initialHash = isDir == false?NGSyncFoldersWindow.TryGetCachedHash(this.path) : string.Empty; }
protected override void Update() { base.Update(); if (!layoutCache.IsValid) { foreach (var state in hitObjectInitialStateCache.Values) { state.Cache.Invalidate(); } combinedObjCache.Invalidate(); scrollingInfo.Algorithm.Reset(); layoutCache.Validate(); } if (!combinedObjCache.IsValid) { switch (direction.Value) { case ScrollingDirection.Up: case ScrollingDirection.Down: scrollLength = DrawSize.Y; break; default: scrollLength = DrawSize.X; break; } foreach (var obj in Objects) { if (!hitObjectInitialStateCache.TryGetValue(obj, out var state)) { state = hitObjectInitialStateCache[obj] = new InitialState(new Cached()); } if (state.Cache.IsValid) { continue; } state.ScheduledComputation?.Cancel(); state.ScheduledComputation = computeInitialStateRecursive(obj); computeLifetimeStartRecursive(obj); state.Cache.Validate(); } combinedObjCache.Validate(); } }
public override string ToString() { string repr = "SST: q0=" + InitialState.ToString() + " F=" + new Set <int>(FinalStates).ToString() + " "; foreach (Move <Label <SYMBOL> > move in Moves) { repr += "; " + move.SourceState + "(" + (move.IsEpsilon ? "" : move.Label.ToString()) + ") -> " + move.TargetState; } return(repr); }
float cameraWidth; //Horizontal size of camera view // Use this for initialization void Start() { pc2d = GetComponent <PlayerController2D>(); pc2d.isBot = true; t = transform; appliedState = initialState; if (Random.Range(-10, 10) > 0) { StartCoroutine(StatePause(CurrentState.Idle, true)); } }
public void SyncAll(File model) { File[] children = this.children.ToArray(); for (int i = 0; i < children.Length; i++) { File match = null; if (model != null) { for (int j = 0; j < model.children.Count; j++) { if (model.children[j].name == children[i].name) { match = model.children[j]; break; } } } if (children[i].isDir == false) { children[i].Sync(match); } else { children[i].SyncAll(match); } } if (this.isHeightInvalidated == true) { int i = 0; for (; i < children.Length; i++) { if (children[i].initialState != InitialState.Origin) { break; } } if (i >= children.Length) { this.canDisplay = false; this.open = false; this.height = 0F; this.isHeightInvalidated = false; } this.initialState = InitialState.Origin; } }
public static void Initialize() { InitialState = new InitialState(MenuState); MenuState = new MenuState(UpdateState); UpdateState = new UpdateState(InitialState); InitialState.NextState = MenuState; CurrentState = InitialState; CurrentLevel = Globals.ListOfLevels[Globals.Rng.Next(0, 3)]; CurrentLevel.Initialize(); }
internal TemplateModel Parse(string template) { var tokenizer = new Tokenizer(template); IEnumerable <Token> tokens = tokenizer.Tokenize(); var builder = new TemplateModelBuilder(); IState state = new InitialState(builder); tokens.Aggregate(state, (current, token) => current.Next(token)); return(builder.GetResult()); }
public IExpression Parse(string text) { IState state = new InitialState(); if (_factory!=null) { state.FunctionFactory = _factory; } foreach (char c in text) { state = state.Process(c); } if (state.IsFinalState) return state.CreateExpression(); return null; }
public override IState Process(char c) { if (_expression == null) { return InvalidState.Instance; } if (c == ',') { if (ContainedState.IsFinalState) { _expression.AddParameter(ContainedState.CreateExpression()); ContainedState = new InitialState(){FunctionFactory = FunctionFactory}; Append(c.ToString()); return this; } } return base.Process(c); }
public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent; while (content.Length > 0) { state = state.ApplyRules(rules, ref content); } return state.Root; }
public static TocViewModel LoadToc(string tocContent, string filePath) { ParseState state = new InitialState(filePath); var rules = new ParseRule[] { new TopicTocParseRule(), new ExternalLinkTocParseRule(), new TopicXrefAutoLinkTocParseRule(), new TopicXrefShortcutTocParseRule(), new ContainerParseRule(), new CommentParseRule(), new WhitespaceParseRule(), }; var content = tocContent.Replace("\r\n", "\n").Replace("\r", "\n"); int lineNumber = 1; while (content.Length > 0) { state = state.ApplyRules(rules, ref content, ref lineNumber); } return state.Root; }
public void CommitChanges(PersistDepth persistDepth) { this.CommitChildren(persistDepth); if (this.State == ObjectState.Deleted) { this.instance = null; } else { if (this.initial == InitialState.Inserted && this.entity.KeyType == KeyType.Auto) { // InitialState Bug-Fix by Gerrod Thomas (http://www.Gerrod.com) this.initial = InitialState.Unchanged; EntityKey entityKey = new EntityKey(this.context, this.EntityObject, this.IsPersisted); this.context.StartTracking(entityKey, this); } this.StartTracking(InitialState.Unchanged); } }
private void StartTracking(InitialState initialState, bool setValues) { this.lastAccess = DateTime.Now; this.initial = initialState; this.isDeleted = false; if (setValues) { for (int index = 0; index < this.entity.FieldCount; index++) { this.values[index] = this.GetField(this.entity[index]); } } }
public void StartTracking(InitialState initialState) { this.StartTracking(initialState, true); }