public static void TestRef() { UInt16 a = 0x200; InsertElement e = new InsertElement("", LEVEL.Building, InsertMode.AutoLevel | InsertMode.AutoPlace); Console.WriteLine("a is = " + Convert.ToString(a,2)); MatchHelper.Assert(true, "aaaa"); Console.ReadLine(); }
//Preliminary check element is legality or not private State PreliminaryCheck(InsertElement el) { State resultState = _addrset.FindNodeInHashTable(el.Name); if (defualtRule(resultState, el)) { return(resultState); } else { throw new TrainException(el, @"element is not legality"); } }
// TODO uncompleted private bool defualtRule(State state, InsertElement el) { if ((el.Mode & PlaceMask) == (UInt16)InsertMode.OldPlace) { if (state.NodeCount == 0) { //throw new TrainException(el, "Existed Node is not found, rule failed"); return false; } //LEVEL judgement if ((el.Mode & LevelMask) == (UInt16)InsertMode.ExactlyLevel && el.Level != LEVEL.Uncertainty) { if (el.Level < state.MinStateLEVEL || el.Level > state.MaxStateLEVEL) { //throw new TrainException(el, "Existed Node is not found, rule failed"); return false; } } //LEVEL judgement //if ((el.Mode & LevelMask) == (UInt16)InsertMode.DegradeLevel && el.Level != LEVEL.Uncertainty) //{ // if (el.Level < state.MinStateLEVEL) // { // //throw new TrainException(el, "Existed Node is not found, rule failed"); // return false; // } //} ////LEVEL judgement //if ((el.Mode & LevelMask) == (UInt16)InsertMode.UpgradeLevel && el.Level != LEVEL.Uncertainty) //{ // if (el.Level > state.MaxStateLEVEL) // { // //throw new TrainException(el, "Existed Node is not found, rule failed"); // return false; // } //} } else if ((el.Mode & PlaceMask) == (UInt16)InsertMode.NewPlace) { } else if ((el.Mode & PlaceMask) == (UInt16)InsertMode.AutoPlace) { } return true; }
// TODO uncompleted private bool defualtRule(State state, InsertElement el) { if ((el.Mode & PlaceMask) == (UInt16)InsertMode.OldPlace) { if (state.NodeCount == 0) { //throw new TrainException(el, "Existed Node is not found, rule failed"); return(false); } //LEVEL judgement if ((el.Mode & LevelMask) == (UInt16)InsertMode.ExactlyLevel && el.Level != LEVEL.Uncertainty) { if (el.Level < state.MinStateLEVEL || el.Level > state.MaxStateLEVEL) { //throw new TrainException(el, "Existed Node is not found, rule failed"); return(false); } } //LEVEL judgement //if ((el.Mode & LevelMask) == (UInt16)InsertMode.DegradeLevel && el.Level != LEVEL.Uncertainty) //{ // if (el.Level < state.MinStateLEVEL) // { // //throw new TrainException(el, "Existed Node is not found, rule failed"); // return false; // } //} ////LEVEL judgement //if ((el.Mode & LevelMask) == (UInt16)InsertMode.UpgradeLevel && el.Level != LEVEL.Uncertainty) //{ // if (el.Level > state.MaxStateLEVEL) // { // //throw new TrainException(el, "Existed Node is not found, rule failed"); // return false; // } //} } else if ((el.Mode & PlaceMask) == (UInt16)InsertMode.NewPlace) { } else if ((el.Mode & PlaceMask) == (UInt16)InsertMode.AutoPlace) { } return(true); }
public TrainException(InsertElement el, string message) : base(message) { _el = el; }
//Preliminary check element is legality or not private State PreliminaryCheck(InsertElement el) { State resultState = _addrset.FindNodeInHashTable(el.Name); if (defualtRule(resultState, el)) { return resultState; } else { throw new TrainException(el, @"element is not legality"); } }