internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
            {
                throw new ArgumentNullException("nativeSearchCondition");
            }

            NativeSearchCondition = nativeSearchCondition;

            HResult hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded(hr))
            {
                throw new ShellException(hr);
            }

            if (ConditionType == SearchConditionType.Leaf)
            {
                using (PropVariant propVar = new PropVariant())
                {
                    hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, propVar);

                    if (!CoreErrorHelper.Succeeded(hr))
                    {
                        throw new ShellException(hr);
                    }

                    PropertyValue = propVar.Value.ToString();
                }
            }
        }
Beispiel #2
0
 private XmlNode WriteConditionToXmlNode(ICondition condition)
 {
     string conditionName = condition.GetConditionDef().GetConditionName();
     XmlElement conditionElement = m_doc.CreateElement(conditionName);
     if (condition is AbstractCompositeCondition)
     {
         if (condition is AbstractMultipleCondition)
         {
             var multipleCondition = condition as AbstractMultipleCondition;
             foreach (ICondition subCondition in multipleCondition.ConditionList)
             {
                 conditionElement.AppendChild(WriteConditionToXmlNode(subCondition));
             }
         }
         else
         {
             var singleCondition = condition as AbstractSingleCondition;
             conditionElement.AppendChild(
                 WriteConditionToXmlNode(singleCondition.ConditionList[0]));
         }
     }
     else
     {
         var atomicCondition = condition as AbstractAtomicCondition;
         conditionElement.SetAttribute(RuleFileConstants.Operator,
             atomicCondition.Operator.GetOperatorName());
         conditionElement.SetAttribute(RuleFileConstants.Value, atomicCondition.Value);
     }
     return conditionElement;
 }
Beispiel #3
0
        public CrimsonTempest()
            : base(WoWSpell.FromId(SpellBook.CastCrimsonTempest), true, false)
        {
            Category = AbilityCategory.Combat;
            _energy = new EnergyRangeCondition(35);

        }
		/// <summary>
		/// Creates a visual representation of a condition
		/// </summary>
		/// <returns>A ConditionMethodDisplay object</returns>
		public static ConditionDisplayBase CreateConditionDisplay(ICondition condition, Workshare.Policy.PolicyType type)
		{
			ConditionUnitFactory.PreDefinedConditionType conditionType = ConditionUnitFactory.PreDefinedConditionType.Undefined;

			try
			{
				conditionType = CustomAttributes.GetPreDefinedConditionType(condition);
			}
			catch (ArgumentException ex)
			{
				Logger.LogError("Condition is not one of our predefined types.");
				Logger.LogError(ex);
				return null;
			}

			switch (conditionType)
			{
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileContext:
				return new ConditionDisplayContentInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileContext:
				return new ConditionDisplayRegexInFileContext(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.ContentInFileName:
				return new ConditionDisplayContentInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.RegexInFileName:
				return new ConditionDisplayRegexInFileName(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileSize:
				return new ConditionDisplayFileSize(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileType:
				return new ConditionDisplayFileType(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInFile:
				return new ConditionDisplayHiddenDataInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.CustomProperty:
				return new ConditionDisplayCustomProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PasswordProtectedFile:
				return new ConditionDisplayPasswordProtectedFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.DocumentRestrictions:
				return new ConditionDisplayDocumentRestrictions(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.PiiInFile:
				return new ConditionDisplayPiiInFile(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.FileProperty:
				return new ConditionDisplayFileProperty(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmbeddedEmail:
				return new ConditionDisplayEmbeddedEmail(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.EmailAdresses:
				return new ConditionDisplayEmailAddresses(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.HiddenDataInPDF:
				return new ConditionDisplayHiddenDataInPDF(condition, type);
			case ConditionUnitFactory.PreDefinedConditionType.TotalAttachmentSize:
				return new ConditionDisplayTotalAttachmentSize(condition, type);
			default:
				{
					Utilities.ErrorMessage errorMessage = new Utilities.ErrorMessage(
						"CONDITION_INVALID_PREDEFINED",
						"Workshare.PolicyDesigner.Properties.Resources",
						System.Reflection.Assembly.GetExecutingAssembly());
					Logger.LogError(errorMessage.LogString);
					throw new ArgumentException(errorMessage.DisplayString);
				}
			}
		}
Beispiel #5
0
		public Codon(AddIn addIn, string name, Properties properties, ICondition[] conditions)
		{
			this.addIn      = addIn;
			this.name       = name;
			this.properties = properties;
			this.conditions = conditions;
		}
Beispiel #6
0
 public EviscerateAbility() : base(WoWSpell.FromId(SpellBook.CastEviscerate), true, false)
 {
     Category = AbilityCategory.Combat;
     _energy = new EnergyRangeCondition(35);
    
     
 }
Beispiel #7
0
 public Codon(SkyMap.Net.Core.AddIn addIn, string name, SkyMap.Net.Core.Properties properties, ICondition[] conditions)
 {
     this.addIn = addIn;
     this.name = name;
     this.properties = properties;
     this.conditions = conditions;
 }
Beispiel #8
0
        public AoERupture()
            : base(WoWSpell.FromId(SpellBook.CastRupture), true, false)
        {
            Category = AbilityCategory.Combat;
            _energy = new EnergyRangeCondition(25);

        }
 public void SaveSettingsToCondition(ICondition condition)
 {
     var c = (ProductivityCondition)condition;
     c.Enabled = this.settingsPanel.ConditionEnabled;
     c.Pomodoros = this.settingsPanel.Pomodoros;
     c.Duration = this.settingsPanel.Duration;
 }
 public override bool IsTrue(ICondition condition)
 {
     var c = (ProductivityCondition)condition;
     var since = ((DateTime)this.now.Do(null)) - c.Duration;
     var productivity = this.getProductivity.Do(new ProductivityCommandArgs(since)) as PomodorosProductivity;
     return productivity.Pomodoros < c.Pomodoros;
 }
Beispiel #11
0
 /// <summary>
 /// This operation detaches a Condition from the WaitSet. If the Condition was not attached 
 /// to this WaitSet, the operation returns PreconditionNotMet
 /// </summary>
 /// <param name="condition">The attached condition in the WaitSet which is to be detached.</param>
 /// <returns>Possible return codes are: Ok, Error, BadParameter, OutOfResources or PreconditionNotMet.</returns>
 public ReturnCode DetachCondition(ICondition condition)
 {
     Condition conditionObj = (Condition)condition;
     return OpenSplice.Gapi.WaitSet.detach_condition(
             GapiPeer,
             conditionObj.GapiPeer);
 }
Beispiel #12
0
 public Rule(ICategory applyCategory, IAction action, ICondition condition, string name)
 {
     m_condition = condition;
     m_action = action;
     m_applyCategory = applyCategory;
     m_name = name;
 }
 public RevealingStrikeAbility()
     : base(WoWSpell.FromId(SpellBook.CastRevealingStrike), true, false)
 {
     base.Category = AbilityCategory.Combat;
     _energy = new EnergyRangeCondition(25);
     base.Conditions.Add(_energy);
 }
 public ChainCondition(int? transitionTarget, ICondition[] subconditions)
 {
     _currentIndex = 0;
     _subconditions = subconditions;
     _transitionTarget = transitionTarget;
     _hasNotification = false;
 }
Beispiel #15
0
 public LockedDownFileStore(string filePath, ICondition backingCondition = null)
     : base(
     NaturalInMemoryStore.New()
     .DecorateWithBackingLockedFile(filePath, backingCondition)
     )
 {
 }
Beispiel #16
0
 public FileStore(string filePath, ICondition backingCondition = null)
     : base(
     NaturalInMemoryStore.New()
     .DecorateWithBackingFile(filePath)
     )
 {
 }
 public ObservingConditionDecoration(ICondition decorated, LogicOf<ICondition> preObservation,
     LogicOf<ICondition> postObservation)
     : base(decorated)
 {
     this.PostObservation = postObservation;
     this.PreObservation = preObservation;
 }
 public override void LoadConditionFromXml(ICondition condition, XmlElement conditionElement)
 {
     var c = condition as TimeOfDayCondition;
     c.StartTime = TimeSpan.Parse(conditionElement.GetAttribute("start"));
     c.EndTime = TimeSpan.Parse(conditionElement.GetAttribute("end"));
     c.ShouldBeWithin = bool.Parse(conditionElement.GetAttribute("shouldBeWithin"));
 }
 public override void SaveConditionToXml(ICondition condition, XmlElement conditionElement)
 {
     var c = condition as TimeOfDayCondition;
     conditionElement.SetAttribute("start", c.StartTime.ToString());
     conditionElement.SetAttribute("end", c.EndTime.ToString());
     conditionElement.SetAttribute("shouldBeWithin", c.ShouldBeWithin.ToString());
 }
		public DataSelectParameter(string fullName, ICondition condition, string scope, Paging paging, Sorting[] sortings) : base(fullName)
		{
			_condition = condition;
			_scope = scope;
			_paging = paging;
			_sortings = sortings;
		}
Beispiel #21
0
 private static bool IsConditionLoss(ICondition newCondition, ICondition oldCondition)
 {
     if (newCondition is AbstractAtomicCondition)
     {
         if (oldCondition is AbstractCompositeCondition)
         {
             var condition = (AbstractCompositeCondition) oldCondition;
             if (condition.ConditionList.Count > 0)
             {
                 return true;
             }
         }
     }
     else if (newCondition is AbstractSingleCondition)
     {
         if (oldCondition is AbstractMultipleCondition)
         {
             var condition = (AbstractMultipleCondition) oldCondition;
             if (condition.ConditionList.Count > 1)
             {
                 return true;
             }
         }
     }
     return false;
 }
Beispiel #22
0
 public void AddCondition(ICondition c)
 {
     lock (_conditions)
     {
         _conditions.Add(c);
     }
 }
Beispiel #23
0
        internal SearchCondition(ICondition nativeSearchCondition)
        {
            if (nativeSearchCondition == null)
                throw new ArgumentNullException("nativeSearchCondition");

            NativeSearchCondition = nativeSearchCondition;

            HRESULT hr = NativeSearchCondition.GetConditionType(out conditionType);

            if (!CoreErrorHelper.Succeeded((int)hr))
                Marshal.ThrowExceptionForHR((int)hr);

            if (ConditionType == SearchConditionType.Leaf)
            {
                PropVariant propVar;
                hr = NativeSearchCondition.GetComparisonInfo(out canonicalName, out conditionOperation, out propVar);

                if (!CoreErrorHelper.Succeeded((int)hr))
                    Marshal.ThrowExceptionForHR((int)hr);

                try
                {
                    propertyValue = propVar.Value.ToString();
                }
                finally
                {
                    propVar.Clear();
                }

            }
        }
        public static IHasExpirable ExpiresWhen(this IHasExpirable thing, ICondition condition)
        {
            Condition.Requires(thing).IsNotNull();
            thing.Expirable = thing.Expirable.DecorateWithConditionalExpirable(condition);

            return thing;
        }
 public static Polyface IsConditionalExpirable(this Polyface root, ICondition expiry)
 {
     Condition.Requires(root).IsNotNull();
     var composited = new NaturalConditionalExpirable(expiry);
     root.Is(composited);
     return root;
 }
Beispiel #26
0
 /// <summary> TODO - note the logic feels a bit messy. Need to rethink it and make it
 /// simpler. When the first conditional element is Exist, it can only have
 /// literal constraints, so we shouldn't need to check if the last node
 /// is a join. That doesn't make any sense. Need to rethink this and clean
 /// it up. Peter Lin 10/14/2007
 /// </summary>
 public override void compileFirstJoin(ICondition condition, Rule.IRule rule)
 {
     BaseJoin bjoin = new ExistJoinFrst(ruleCompiler.Engine.nextNodeId());
     ExistCondition cond = (ExistCondition) condition;
     BaseNode base_Renamed = cond.LastNode;
     if (base_Renamed != null)
     {
         if (base_Renamed is BaseAlpha)
         {
             ((BaseAlpha) base_Renamed).addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
         }
         else if (base_Renamed is BaseJoin)
         {
             ((BaseJoin) base_Renamed).addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
         }
     }
     else
     {
         // the rule doesn't have a literal constraint so we need to Add
         // ExistJoinFrst as a child
         ObjectTypeNode otn = ruleCompiler.findObjectTypeNode(cond.TemplateName);
         otn.addSuccessorNode(bjoin, ruleCompiler.Engine, ruleCompiler.Memory);
     }
     // important, do not call this before ExistJoinFrst is added
     // if it's called first, the List<Object> will return index
     // out of bound, since there's nothing in the list
     cond.addNode(bjoin);
 }
Beispiel #27
0
		public static List<FileType> GetFileTypes(ICondition condition)
		{
            List<FileType> returnVal = new List<FileType>();
			
			IDataSource dataSource = condition.DataLeft.Data as IDataSource;
			if (null == dataSource)
				return returnVal;

			if (2 > dataSource.Method.Parameters.Count)
                return returnVal;

			IParameter parameter = dataSource.Method.Parameters[1];
			if (0 != string.Compare(parameter.Name.Value, m_FileTypeParameterName, true, CultureInfo.InvariantCulture))
                return returnVal;

			IPolicyObjectCollection<IDataItem> collection = parameter.Value.Data as IPolicyObjectCollection<IDataItem>;
			if (null == collection)
                return returnVal;

			foreach (IDataItem item in collection)
			{
				string fileTypeString = item.Value as string;
				FileType type = (FileType)Enum.Parse(typeof(FileType), fileTypeString);
				returnVal.Add(type);
			}

			return returnVal;
		}
Beispiel #28
0
 /// <summary> the method is responsible for compiling a TestCE pattern to a testjoin node.
 /// It uses the globally declared prevCE and prevJoinNode
 /// </summary>
 public virtual BaseJoin compileJoin(ICondition condition, int position, Rule.IRule rule)
 {
     TestCondition tc = (TestCondition) condition;
     ShellFunction fn = (ShellFunction) tc.Function;
     fn.lookUpFunction(ruleCompiler.Engine);
     IParameter[] oldpm = fn.Parameters;
     IParameter[] pms = new IParameter[oldpm.Length];
     for (int ipm = 0; ipm < pms.Length; ipm++)
     {
         if (oldpm[ipm] is ValueParam)
         {
             pms[ipm] = ((ValueParam) oldpm[ipm]).cloneParameter();
         }
         else if (oldpm[ipm] is BoundParam)
         {
             BoundParam bpm = (BoundParam) oldpm[ipm];
             // now we need to resolve and setup the BoundParam
             Binding b = rule.getBinding(bpm.VariableName);
             BoundParam newpm = new BoundParam(b.LeftRow, b.LeftIndex, 9, bpm.ObjectBinding);
             newpm.VariableName = bpm.VariableName;
             pms[ipm] = newpm;
         }
     }
     BaseJoin joinNode = null;
     if (tc.Negated)
     {
         joinNode = new NTestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     else
     {
         joinNode = new TestNode(ruleCompiler.Engine.nextNodeId(), fn.Function, pms);
     }
     ((TestNode) joinNode).lookUpFunction(ruleCompiler.Engine);
     return joinNode;
 }
 public void LoadSettingsFromCondition(ICondition condition)
 {
     var c = (ProductivityCondition)condition;
     this.settingsPanel.ConditionEnabled = c.Enabled;
     this.settingsPanel.Pomodoros = c.Pomodoros;
     this.settingsPanel.Duration = c.Duration;
 }
Beispiel #30
0
        protected TransitionMonitor(string name, ICondition c)
        {
            Name = name;
            FullCondition = c;

            DeriveTransitions();
            DerivePostCondition();
        }
Beispiel #31
0
 public SelectedConditional(ICondition <TFrom> condition, IConditional <TTo, TOut> source, Func <TFrom, TTo> select)
 {
     Condition = condition;
     _select   = select;
     _source   = source;
 }
Beispiel #32
0
 /// <summary>
 /// Or连接条件
 /// </summary>
 /// <typeparam name="T">源类型</typeparam>
 /// <param name="source">源</param>
 /// <param name="predicate">条件</param>
 /// <param name="condition">该值为true时添加查询条件,否则忽略</param>
 /// <returns></returns>
 public static T OrIf <T>(this T source, ICondition predicate, bool condition) where T : IWhere
 {
     return(condition ? Or(source, predicate) : source);
 }
 /// <summary>
 /// Checks if the condition is applicable for the object.
 /// </summary>
 /// <param name="element">The condition to check.</param>
 /// <param name="obj">The object.</param>
 /// <returns>Returns if the condition is applicable (true) or not (false).</returns>
 public bool IsConditionApplicable <T>(ICondition element, T obj) where T : class
 {
     return((new[] { obj }).AsQueryable().Any(element.Condition, FormatArguments(element.ConditionArguments, obj)));
 }
Beispiel #34
0
 public AssignableFromGuard(ICondition <Type> condition, ISelect <Type, string> message)
     : base(condition, message)
 {
 }
Beispiel #35
0
 /// <summary>
 /// Aggregates this condition's properties with another of the same type.
 /// </summary>
 /// <param name="conditionOfSameType">The condition to aggregate with.</param>
 /// <returns>True if this condition's properties were changed as a result, and false if nothing changed.</returns>
 public abstract bool Aggregate(ICondition conditionOfSameType);
Beispiel #36
0
        ///<inheritdoc/>
        protected override void SetupHandler()
        {
            OptionGroup generalGroup     = Handler.AddGroup(GENERAL);
            OptionGroup interactionGroup = generalGroup.AddGroup(INTERACTION);

            interactionGroup.AddBool(SELECTED_ELEMENTS_INCREMENTALLY, false);
            IOptionItem useDrawingItem = interactionGroup.AddBool(USE_DRAWING_AS_SKETCH, false);

            interactionGroup.Attributes[TableEditorFactory.RenderingHintsAttribute] = TableEditorFactory.RenderingHints.Invisible;

            generalGroup.AddList(ORIENTATION, orientEnum.Keys, TOP_TO_BOTTOM);
            generalGroup.AddBool(LAYOUT_COMPONENTS_SEPARATELY, false);
            IOptionItem symmetricPlacement = generalGroup.AddBool(SYMMETRIC_PLACEMENT, true);

            generalGroup.AddInt(MAXIMUM_DURATION, 5);

            OptionGroup distanceGroup = generalGroup.AddGroup(MINIMUM_DISTANCES);

            distanceGroup.AddDouble(NODE_TO_NODE_DISTANCE, 30.0d);
            distanceGroup.AddDouble(NODE_TO_EDGE_DISTANCE, 15.0d);
            distanceGroup.AddDouble(EDGE_TO_EDGE_DISTANCE, 15.0d);
            distanceGroup.AddDouble(MINIMUM_LAYER_DISTANCE, 10.0d);

            OptionGroup edgeSettingsGroup = Handler.AddGroup(EDGE_SETTINGS);
            OptionItem  eoi = edgeSettingsGroup.AddList(EDGE_ROUTING, edgeRoutingEnum.Keys, EDGE_ROUTING_ORTHOGONAL);

            edgeSettingsGroup.AddBool(BACKLOOP_ROUTING, false);
            edgeSettingsGroup.AddBool(AUTOMATIC_EDGE_GROUPING_ENABLED, false);
            IOptionItem edgeStraightening = edgeSettingsGroup.AddBool(EDGE_STRAIGHTENING_OPTIMIZATION_ENABLED, false);

            edgeSettingsGroup.AddBool(CONSIDER_EDGE_THICKNESS, false);
            edgeSettingsGroup.AddBool(CONSIDER_EDGE_DIRECTION, false);
            edgeSettingsGroup.AddDouble(MINIMUM_FIRST_SEGMENT_LENGTH, 10.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_LAST_SEGMENT_LENGTH, 15.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_EDGE_LENGTH, 20.0d);
            edgeSettingsGroup.AddDouble(MINIMUM_EDGE_DISTANCE, 15.0d);

            ConstraintManager cm = new ConstraintManager(Handler);

            cm.SetEnabledOnValueEquals(eoi, EDGE_ROUTING_POLYLINE,
                                       edgeSettingsGroup.AddDouble(MINIMUM_SLOPE, 0.25d, 0.0d, 5.0d));
            cm.SetEnabledOnValueEquals(symmetricPlacement, false, edgeStraightening);

            edgeSettingsGroup.AddBool(PC_OPTIMIZATION_ENABLED, false);
            edgeSettingsGroup.AddList(RECURSIVE_EDGE_ROUTING, new[] { RECURSIVE_EDGE_ROUTING_OFF, RECURSIVE_EDGE_ROUTING_DIRECTED, RECURSIVE_EDGE_ROUTING_UNDIRECTED }, RECURSIVE_EDGE_ROUTING_OFF);

            OptionGroup rankGroup = Handler.AddGroup(RANKS);

            rankGroup.AddList(RANKING_POLICY, rankingPolicies.Keys, HIERARCHICAL_OPTIMAL);
            rankGroup.AddList(LAYER_ALIGNMENT, alignmentEnum.Keys, BOTTOM);
            rankGroup.AddList(COMPONENT_ARRANGEMENT_POLICY, componentAlignmentEnum.Keys, POLICY_TOPMOST);

            OptionGroup sketchGroup = rankGroup.AddGroup(FROM_SKETCH_PROPERTIES);

            sketchGroup.AddDouble(SCALE, 1.0d, 0.0d, 5.0d);
            sketchGroup.AddDouble(HALO, 0.0d);
            sketchGroup.AddDouble(MINIMUM_SIZE, 0.0d, 0, Double.MaxValue);
            sketchGroup.AddDouble(MAXIMUM_SIZE, 1000.0d, 0, Double.MaxValue);
            cm.SetEnabledOnValueEquals(Handler.GetItemByName(RANKS + "." + RANKING_POLICY), FROM_SKETCH,
                                       Handler.GetItemByName(RANKS + "." + FROM_SKETCH_PROPERTIES));

            OptionGroup labelingGroup = Handler.AddGroup(LABELING);
            OptionGroup npGroup       = labelingGroup.AddGroup(NODE_PROPERTIES);

            npGroup.AddBool(CONSIDER_NODE_LABELS, true);
            npGroup.Attributes[TableEditorFactory.RenderingHintsAttribute] = TableEditorFactory.RenderingHints.Invisible;
            //npGroup.SetAttribute(DefaultEditorFactory.RenderingHintsAttribute,
            //  DefaultEditorFactory.RenderingHints.Invisible);
            OptionGroup epGroup = labelingGroup.AddGroup(LABELING_EDGE_PROPERTIES);
            CollectionOptionItem <string> edgeLabelingEnumItem = epGroup.AddList(EDGE_LABELING, edgeLabeling, EDGE_LABELING_NONE);
            CollectionOptionItem <string> labelModelItem       = epGroup.AddList(EDGE_LABEL_MODEL, edgeLabelModel, EDGE_LABEL_MODEL_BEST);

            epGroup.Attributes[TableEditorFactory.RenderingHintsAttribute] = TableEditorFactory.RenderingHints.Invisible;
            ICondition cond = ConstraintManager.LogicalCondition.Not(cm.CreateValueEqualsCondition(edgeLabelingEnumItem, EDGE_LABELING_NONE));

            cm.SetEnabledOnCondition(cond, labelModelItem);
            IOptionItem compactEdgeLabel = epGroup.AddBool(COMPACT_EDGE_LABEL_PLACEMENT, true);

            cm.SetEnabledOnValueEquals(edgeLabelingEnumItem, EDGE_LABELING_HIERARCHIC, compactEdgeLabel);
            OptionGroup groupingGroup = Handler.AddGroup(GROUPING);
            CollectionOptionItem <string> groupStrategyItem = groupingGroup.AddList(GROUP_LAYERING_STRATEGY, groupStrategyEnum.Keys, RECURSIVE_LAYERING);
            CollectionOptionItem <string> groupAlignItem    = groupingGroup.AddList(GROUP_ALIGNMENT, groupAlignmentEnum.Keys, GROUP_ALIGN_TOP);
            IOptionItem groupCompactionItem = groupingGroup.AddBool(GROUP_ENABLE_COMPACTION, false);

            groupingGroup.AddList(GROUP_HORIZONTAL_COMPACTION, groupHorizCompactionEnum.Keys, GROUP_HORIZONTAL_COMPACTION_NONE);
            cm.SetEnabledOnValueEquals(groupStrategyItem, RECURSIVE_LAYERING, groupCompactionItem);
            cm.SetEnabledOnValueEquals(groupStrategyItem, RECURSIVE_LAYERING, groupAlignItem);

            cm.SetEnabledOnValueEquals(useDrawingItem, false, groupStrategyItem);
            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(groupStrategyItem, RECURSIVE_LAYERING),
                                                                            cm.CreateValueEqualsCondition(groupCompactionItem, false)), groupAlignItem);

            cm.SetEnabledOnCondition(ConstraintManager.LogicalCondition.And(cm.CreateValueEqualsCondition(groupStrategyItem, RECURSIVE_LAYERING),
                                                                            cm.CreateValueEqualsCondition(useDrawingItem, false)), groupCompactionItem);

            OptionGroup swimGroup        = Handler.AddGroup(SWIMLANES);
            IOptionItem swimlaneOption   = swimGroup.AddBool(TREAT_ROOT_GROUPS_AS_SWIMLANES, false);
            IOptionItem fromSketchOption = swimGroup.AddBool(USE_ORDER_FROM_SKETCH, false);
            IOptionItem spacingOption    = swimGroup.AddDouble(SWIMLANE_SPACING, 0.0d, 0, Double.MaxValue);

            cm.SetEnabledOnValueEquals(swimlaneOption, true, fromSketchOption);
            cm.SetEnabledOnValueEquals(swimlaneOption, true, spacingOption);

            OptionGroup gridGroup          = Handler.AddGroup(GRID);
            IOptionItem gridEnabled        = gridGroup.AddBool(GRID_ENABLED, false);
            IOptionItem gridSpacing        = gridGroup.AddDouble(GRID_SPACING, 10);
            IOptionItem gridPortAssignment = gridGroup.AddList(GRID_PORT_ASSIGNMENT, new[] { GRID_PORT_ASSIGNMENT_DEFAULT, GRID_PORT_ASSIGNMENT_ON_GRID, GRID_PORT_ASSIGNMENT_ON_SUBGRID }, GRID_PORT_ASSIGNMENT_DEFAULT);

            cm.SetEnabledOnValueEquals(gridEnabled, true, gridSpacing);
            cm.SetEnabledOnValueEquals(gridEnabled, true, gridPortAssignment);
        }
 public DataExistedEventArgs(string name, ICondition condition, bool result) : base(name)
 {
     _condition = condition;
     _result    = result;
 }
Beispiel #38
0
 public MotionAdjuster(ICondition condition)
 {
     Condition = condition;
 }
Beispiel #39
0
 public InternalTransition(S toState, ICondition <C> condition, List <IAction <S, E, C> > actions)
     : base(toState, condition, actions)
 {
 }
Beispiel #40
0
        /// <summary>
        /// Instantiates a new instance of the OptionSpecSet class.
        /// </summary>
        /// <param name="condition">The condition to consider.</param>
        /// <param name="optionSpecifications">The option specifications to consider.</param>
        public IOptionSpecSet AddSubSet(ICondition condition, params IOptionSpec[] optionSpecifications)
        {
            SubSets?.Add(new OptionSpecSet(condition, optionSpecifications));

            return(this);
        }
Beispiel #41
0
 public void ActivateWhen <T>(T arg, Predicate <T> condition)
 {
     Condition = new LambdaCondition <T>(arg, condition);
 }
Beispiel #42
0
 /// <summary>
 /// Instantiates a new instance of the OptionSpecSet class.
 /// </summary>
 /// <param name="condition">The condition to consider.</param>
 /// <param name="optionSpecifications">The option specifications to consider.</param>
 public OptionSpecSet(ICondition condition, params IOptionSpec[] optionSpecifications) : this(optionSpecifications)
 {
     Condition = condition as Condition;
 }
Beispiel #43
0
 /// <summary>
 /// And连接条件
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns></returns>
 public ISqlQuery And(ICondition condition)
 {
     Builder.And(condition);
     return(this);
 }
Beispiel #44
0
 /// <summary>
 /// Or连接条件
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns></returns>
 public ISqlQuery Or(ICondition condition)
 {
     Builder.Or(condition);
     return(this);
 }
Beispiel #45
0
 /// <summary>
 /// 初始化And连接条件
 /// </summary>
 /// <param name="left">左操作数</param>
 /// <param name="right">右操作数</param>
 public AndCondition(ICondition left, ICondition right)
 {
     _left  = left?.GetCondition();
     _right = right?.GetCondition();
 }
Beispiel #46
0
 public ITask AddExecutingCondition(ICondition condition)
 {
     ExecutingConditions.Add(condition);
     return(this);
 }
Beispiel #47
0
 public NotCondition(ICondition cond) =>
 this.cond = cond;
Beispiel #48
0
        // ========================================================= ADDERS

        public ITask AddCondition(ICondition condition)
        {
            Conditions.Add(condition);
            return(this);
        }
Beispiel #49
0
 public AfterScenarioEverQuery(ICondition pi, ICondition gamma, Scenario scenario)
 {
     this.pi       = pi;
     this.gamma    = gamma;
     this.scenario = scenario;
 }
Beispiel #50
0
 public void AddCondition(ICondition condition)
 {
     Conditions.Add(condition);
 }
 public DataExistedEventArgs(string name, ICondition condition) : base(name)
 {
     _condition = condition;
 }
Beispiel #52
0
        // ========================================================= ADDERS

        public ITask AddCondition(ICondition condition)
        {
            throw new Exception("Pause Plan tasks does not support conditions.");
        }
Beispiel #53
0
        public static ObjectConditional ParseDirect(Mobile from, string[] args, int offset, int size)
        {
            if (args == null || size == 0)
            {
                return(ObjectConditional.Empty);
            }

            int index = 0;

            Type objectType = Assembler.FindTypeByName(args[offset + index], true);

            if (objectType == null)
            {
                throw new Exception(string.Format("No type with that name ({0}) was found.", args[offset + index]));
            }

            ++index;

            List <ICondition[]> conditions = new List <ICondition[]>();
            List <ICondition>   current    = new List <ICondition>
            {
                TypeCondition.Default
            };

            while (index < size)
            {
                string cur = args[offset + index];

                bool inverse = false;

                if (Insensitive.Equals(cur, "not") || cur == "!")
                {
                    inverse = true;
                    ++index;

                    if (index >= size)
                    {
                        throw new Exception("Improperly formatted object conditional.");
                    }
                }
                else if (Insensitive.Equals(cur, "or") || cur == "||")
                {
                    if (current.Count > 1)
                    {
                        conditions.Add(current.ToArray());

                        current.Clear();
                        current.Add(TypeCondition.Default);
                    }

                    ++index;

                    continue;
                }

                string binding = args[offset + index];
                index++;

                if (index >= size)
                {
                    throw new Exception("Improperly formatted object conditional.");
                }

                string oper = args[offset + index];
                index++;

                if (index >= size)
                {
                    throw new Exception("Improperly formatted object conditional.");
                }

                string val = args[offset + index];
                index++;

                Property prop = new Property(binding);

                prop.BindTo(objectType, PropertyAccess.Read);
                prop.CheckAccess(from);

                ICondition condition = null;

                switch (oper)
                {
                    #region Equality
                case "=":
                case "==":
                case "is":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.Equal, val);
                    break;

                case "!=":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.NotEqual, val);
                    break;
                    #endregion

                    #region Relational
                case ">":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.Greater, val);
                    break;

                case "<":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.Lesser, val);
                    break;

                case ">=":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.GreaterEqual, val);
                    break;

                case "<=":
                    condition = new ComparisonCondition(prop, inverse, ComparisonOperator.LesserEqual, val);
                    break;
                    #endregion

                    #region Strings
                case "==~":
                case "~==":
                case "=~":
                case "~=":
                case "is~":
                case "~is":
                    condition = new StringCondition(prop, inverse, StringOperator.Equal, val, true);
                    break;

                case "!=~":
                case "~!=":
                    condition = new StringCondition(prop, inverse, StringOperator.NotEqual, val, true);
                    break;

                case "starts":
                    condition = new StringCondition(prop, inverse, StringOperator.StartsWith, val, false);
                    break;

                case "starts~":
                case "~starts":
                    condition = new StringCondition(prop, inverse, StringOperator.StartsWith, val, true);
                    break;

                case "ends":
                    condition = new StringCondition(prop, inverse, StringOperator.EndsWith, val, false);
                    break;

                case "ends~":
                case "~ends":
                    condition = new StringCondition(prop, inverse, StringOperator.EndsWith, val, true);
                    break;

                case "contains":
                    condition = new StringCondition(prop, inverse, StringOperator.Contains, val, false);
                    break;

                case "contains~":
                case "~contains":
                    condition = new StringCondition(prop, inverse, StringOperator.Contains, val, true);
                    break;
                    #endregion
                }

                if (condition == null)
                {
                    throw new InvalidOperationException(string.Format("Unrecognized operator (\"{0}\").", oper));
                }

                current.Add(condition);
            }

            conditions.Add(current.ToArray());

            return(new ObjectConditional(objectType, conditions.ToArray()));
        }
Beispiel #54
0
 /// <summary>
 /// 设置查询条件
 /// </summary>
 /// <param name="condition">查询条件</param>
 /// <returns></returns>
 public ISqlQuery Where(ICondition condition)
 {
     Builder.Where(condition);
     return(this);
 }
Beispiel #55
0
 /// <summary>
 /// Or连接条件
 /// </summary>
 /// <param name="condition">查询条件</param>
 public ISqlBuilder Or(ICondition condition)
 {
     WhereClause.Or(condition);
     return(this);
 }
Beispiel #56
0
 /// <summary>
 /// 查找
 /// </summary>
 /// <param name="condition">查询条件</param>
 public IQueryable <EntitySample> Find(ICondition <EntitySample> condition)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Create a new instance for this class
 /// </summary>
 /// <param name="condition">The condition to meet</param>
 public SelectFolderCommand(ICondition condition)
 {
     this.condition = condition;
 }
 public void Visit(ICondition condition)
 {
 }
Beispiel #59
0
 public NegatedCondition(ICondition condition)
 {
     Debug.Assert(condition != null);
     this.condition = condition;
 }
Beispiel #60
0
 /// <summary>
 /// And连接条件
 /// </summary>
 /// <param name="condition">查询条件</param>
 public ISqlBuilder And(ICondition condition)
 {
     WhereClause.And(condition);
     return(this);
 }