// Avoids reallocation of returned children ArrayList private void GetChildren( object oObj, ChildrenListFilter pfChildrenListFilter, object oChildrenListFilterCriteria, ObjectFilter pfObjectFilter, object oObjectFilterCriteria, EntityRelation enRelation, bool bRecursive, ICollection <object> oOutChildren) { // Get TypeInfo of specified object EntityTypeInfo oEntityTypeInfo = GetEntityTypeInfo(oObj); // Get the ChildrenLists according to EntityRelation filter EntityChildrenListInfo[] ChildrenLists = GetChildrenListsInfo( oEntityTypeInfo, enRelation); // Iterate ChildrenLists foreach (EntityChildrenListInfo oChildrenList in ChildrenLists) { // Obtain list object INamedObjectList oContainer = oChildrenList.GetValue(oObj) as INamedObjectList; if (oContainer != null) { // Check if container passes filter bool bContainerPassedFilter = (pfChildrenListFilter == null) || pfChildrenListFilter(oChildrenList, oChildrenListFilterCriteria); object oEl; for (int i = 0; i < oContainer.Count; i++) { oEl = oContainer[oContainer.NameByIndex(i)]; if (bContainerPassedFilter && (pfObjectFilter == null || pfObjectFilter(oEl, oObjectFilterCriteria))) { // If elements filter passed oOutChildren.Add(oEl); } if (bRecursive) { // Recursive call for each children GetChildren( oEl, pfChildrenListFilter, oChildrenListFilterCriteria, pfObjectFilter, oObjectFilterCriteria, enRelation, bRecursive, oOutChildren); } } } } }
private ICollection <object> GetChildren( object oObj, ChildrenListFilter pfChildrenListFilter, object oChildrenListFilterCriteria, ObjectFilter pfObjectFilter, object oObjectFilterCriteria, EntityRelation enRelation, bool bRecursive) { const int INITIAL_CHILDREN_ARRAY = 100; ICollection <object> oChildren = new List <object>(INITIAL_CHILDREN_ARRAY); GetChildren( oObj, pfChildrenListFilter, oChildrenListFilterCriteria, pfObjectFilter, oObjectFilterCriteria, enRelation, bRecursive, oChildren // "Out", will be filled ); return(oChildren); }
protected int CountFromDatabase(ObjectFilter objectFilter) { SqlParameter[] procParams = new SqlParameter[2]; procParams[0] = DataAccess.CreateParameter("@View", SqlDbType.NVarChar, GetViewName()); procParams[1] = DataAccess.CreateParameter("@Where", SqlDbType.NVarChar, objectFilter.Where); return(ConvertHelper.Convert <int>(DataAccess.ExecuteScalar(GetProcName(EnumProcType.Count), procParams), 0)); }
public FilterRule(DataTableColumn <TModel> column, Type propertyType, string propertyName, ObjectFilter objectFilter) { Guid = Guid.NewGuid(); Column = column; FilterType = objectFilter; PropertyName = propertyName; UpdatePropertyType(propertyType); }
public Object Map(ObjectFilter filter, Object @object, CreateOrEditViewModel createOrEdit) { if (@object.Id == 0) { @object.ClassId = (int)filter.Class.Id; } return(@object); }
protected int IndexFromDatabase(ObjectFilter objectFilter, int objectID) { SqlParameter[] procParams = new SqlParameter[4]; procParams[0] = DataAccess.CreateParameter("@View", SqlDbType.NVarChar, GetViewName()); procParams[1] = DataAccess.CreateParameter("@ID", SqlDbType.Int, objectID); procParams[2] = DataAccess.CreateParameter("@Where", SqlDbType.NVarChar, objectFilter.Where); procParams[3] = DataAccess.CreateParameter("@OrderBy", SqlDbType.NVarChar, objectFilter.OrderBy); return(ConvertHelper.Convert <int>(DataAccess.ExecuteScalar(GetProcName(EnumProcType.Index), procParams), -1)); }
protected DataTable GetDataTable(ObjectFilter objectFilter) { SqlParameter[] procParams = new SqlParameter[5]; procParams[0] = DataAccess.CreateParameter("@View", SqlDbType.NVarChar, GetViewName()); procParams[1] = DataAccess.CreateParameter("@HitFrom", SqlDbType.Int, (null != objectFilter.HitFrom) ? objectFilter.HitFrom : NullHelper.Integer); procParams[2] = DataAccess.CreateParameter("@HitTo", SqlDbType.Int, (null != objectFilter.HitTo) ? objectFilter.HitTo : NullHelper.Integer); procParams[3] = DataAccess.CreateParameter("@Where", SqlDbType.NVarChar, objectFilter.Where); procParams[4] = DataAccess.CreateParameter("@OrderBy", SqlDbType.NVarChar, objectFilter.OrderBy); return(DataAccess.ExecuteDataTable(GetProcName(EnumProcType.Select), procParams)); }
protected DataRow GetDataRow(ObjectFilter objectFilter) { DataRow Ret = null; DataTable dt = GetDataTable(objectFilter); if (null != dt && dt.Rows.Count > 0) { Ret = dt.Rows[0]; } return(Ret); }
protected override bool Test() { ObjectFilter filter = new ObjectFilter(); filter.gameObject = GetVariable(m_Target); List <Collider> include = Senses.GetObjectsWithinSphere(transform.position, maxDistance, filter); List <Collider> exclude = Senses.GetObjectsWithinSphere(transform.position, minDistance, filter); IEnumerable <Collider> result = exclude.Intersect(include); return(result.Count <Collider>() > 0); }
private void Initialize() { HaloSize = 3; NearThreshold = 1589; FarThreshold = 1903; objectFilter = ObjectFilter.CreateObjectFilterWithGPUSupport(); // -- Initialize Relay commands -- InitializeRelayCommands(); // -- // -- Create observables to activate / deactivate recording and to start and stop processing -- var observableIsRecording = ObservableEx.ObservableProperty(() => IsRecording); observableIsRecording .Throttle(TimeSpan.FromMilliseconds(150)) .Subscribe(e => { if (e) { ActivateRecording(); } else { DeactivateRecording(); } }); var observableIsAvailable = Observable.FromEventPattern <bool>(KinectManager.Instance, "KinectAvailabilityChanged") .Select(e => e.EventArgs); StartProcessingSubscription = observableIsAvailable .CombineLatest(observableIsRunning, (available, running) => Tuple.Create(available, running)) .Where(tuple => tuple.Item1 && tuple.Item2) .Subscribe(_ => StartProcessing()); StopProcessingSubscription = observableIsAvailable .CombineLatest(observableIsRunning, (available, running) => Tuple.Create(available, running)) .Where(tuple => !tuple.Item1 || !tuple.Item2) .Subscribe(_ => StopProcessing()); InitializeReactiveCommands(); InitializeReactiveProperties(); // -- fpsTimer = Stopwatch.StartNew(); colorAndDepthFPSTimer = Stopwatch.StartNew(); }
protected override bool Test() { sensedTargets.Clear(); GameObject target = GetVariable(m_VariableName); ObjectFilter filter = new ObjectFilter(); filter.gameObject = target; List <Transform> result = Senses.FindVisibleTargets(m_Behaviour.m_Owner.transform, m_Behaviour.m_Owner.transform.position, m_ViewRadius, m_ViewAngle, m_LineOfSightObstacleMask, filter); return(result.Count > 0); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Create UserRemoteService instance. UserRemoteService service = (UserRemoteService)user.GetService( DfaService.v1_20.UserRemoteService); long userId = long.Parse(_T("INSERT_USER_ID_HERE")); long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE")); // Create and configure a user filter. UserFilter filterToAdd = new UserFilter(); // The following field has been filled in to make a filter that allows a // user to access only the assigned objects. This value was determined // using GetUserFilterTypes.cs. filterToAdd.userFilterCriteriaId = 2; // Because this filter used the criteria type "Assigned" it is necessary // to specify what advertisers this user has access to. This next step // would be skipped for the criteria types "All" and "None". // Create an object filter to represent each object the user has access // to. Since this is an advertiser filter, an object filter represents an // advertiser. The total of object filter objects will need to match the // total of advertisers the user is assigned. ObjectFilter allowedObject = new ObjectFilter(); // Insert the advertiser id of an advertiser assigned to this user. allowedObject.id = advertiserId; // Create any additional object filters that are needed, then add these // settings to the user filter filterToAdd.objectFilters = new ObjectFilter[] { allowedObject }; try { // Retrieve the user who is to be modified. User userToModify = service.getUser(userId); // Add the filter to the user. The following method is specific to // advertiser filters. See the User class documentation for the names of // methods for other filters. userToModify.advertiserUserFilter = filterToAdd; // Save the changes made and display a success message. UserSaveResult userSaveResult = service.saveUser(userToModify); Console.WriteLine("User with id \"{0}\" was modified.", userSaveResult.id); } catch (Exception ex) { Console.WriteLine("Failed to add advertiser user filter. Exception says \"{0}\"", ex.Message); } }
private ObservableCollection <FilterTypeConfig> makeFilter(ObjectFilter ifcProductFilter) { var ret = new ObservableCollection <FilterTypeConfig>(); foreach (var item in ifcProductFilter.Items) { ret.Add(new FilterTypeConfig() { TypeName = item.Key, Export = item.Value }); } return(ret); }
public async Task <IActionResult> ObjectSelectorFormAsync([FromQuery] ObjectFilter filter, string objectIds) { return(this.PartialView("_ObjectSelectorForm", await new ObjectSelectorFormViewModelFactory().CreateAsync( this.HttpContext, filter, await this.Storage.GetRepository <int, Object, ObjectFilter>().GetAllAsync( filter, inclusions: new Inclusion <Object>[] { new Inclusion <Object>("Properties.Member"), new Inclusion <Object>("Properties.StringValue.Localizations") } ), objectIds ))); }
/// <summary> init is responsible for checking the class to make sure /// it implements addPropertyChangeListener(java.beans.PropertyChangeListener) /// and removePropertyChangeListener(java.beans.PropertyChangeListener). /// We don't require the classes extend PropertyChangeSupport. /// </summary> public void init() { try { INFO = Introspector.getBeanInfo(OBJECT_CLASS); // we have to filter out the class PropertyDescriptor PropertyInfo[] pd = INFO.getPropertyDescriptors(); List <Object> list = new List <Object>(); for (int idx = 0; idx < pd.Length; idx++) { if (pd[idx].Name.Equals("class")) { // don't Add } else { // we map the methods using the PropertyDescriptor.getName for // the key and the PropertyDescriptor as the value methods.Put(pd[idx].Name, pd[idx]); list.Add(pd[idx]); } } PropertyInfo[] newpd = new PropertyInfo[list.Count]; list.CopyTo(newpd, 0); PROPS = (PropertyInfo[])newpd; // logic for filtering the PropertyDescriptors if (ObjectFilter.lookupFilter(OBJECT_CLASS) != null) { // Remove the props that should be invisible BeanFilter bf = ObjectFilter.lookupFilter(OBJECT_CLASS); PROPS = bf.filter(PROPS); } if (checkBean()) { ISBEAN = true; } // we clean up the array and List<Object> list.Clear(); pd = null; } catch (System.Exception e) { // we should log this and throw an exception } }
private void SetEffectType(ObjectFilter objectFilter, string options) { EffectType effectType = sourceBeatmap.ParseEffectType(options); if ((objectFilter & ObjectFilter.LaserMask) != 0) { // Only use events for laser effect type LaserEffectTypeEvent evt = new LaserEffectTypeEvent { EffectType = effectType, Position = currentPosition }; currentMeasure.Objects.Add(evt); } else { // Store the current effect being used for this type so it can be embeded into the hold object int button = objectFilter == ObjectFilter.Fx0 ? 0 : 1; currentButtonEffectTypes[button] = effectType; } }
private void SetEffectTypeAndParameters(ObjectFilter objectFilter, string options) { string[] values = options.Split(';'); if (values.Length == 1) { SetEffectType(objectFilter, options); } else { // Filter out parameters SetEffectType(objectFilter, values[0]); short parameter = short.Parse(values[1]); if (objectFilter == ObjectFilter.Fx0) { currentButtonEffectParameters[0][0] = parameter; } else { currentButtonEffectParameters[1][0] = parameter; } } }
//Pickup collectable, add value and destroy when done void OnTriggerEnter(Collider col) { if (ObjectFilter.EntityHasTags(col.gameObject, ObjectFilter.Tag.Collectable)) { string nameOfCollectables = col.gameObject.name; GameObject pckup = col.gameObject; if (nameOfCollectables == "Coinx5(Clone)" || nameOfCollectables == "Coinx2(Clone)") { FindObjectOfType <AudioManager> ().play("Coin"); } else { FindObjectOfType <AudioManager> ().play("FoodSound"); } score += pckup.GetComponent <Collectables>().value; _multis.Add(_multis.Count, new MulStruct(pckup.GetComponent <Collectables>()._time, pckup.GetComponent <Collectables>()._mult, Time.frameCount)); _foodFactor += pckup.GetComponent <Collectables>()._sizeMultiplier; _totalFoodForRun += pckup.GetComponent <Collectables>()._sizeMultiplier; _mv.removeFromList(pckup); Destroy(pckup); } }
public async Task <IndexViewModel> CreateAsync(HttpContext httpContext, ObjectFilter filter, IEnumerable <Object> objects, string orderBy, int skip, int take, int total) { Class @class = filter?.Class?.Id == null ? null : await httpContext.GetStorage().GetRepository <int, Class, ClassFilter>().GetByIdAsync( (int)filter.Class.Id, new Inclusion <Class>("Members.PropertyDataType"), new Inclusion <Class>("Members.RelationClass"), new Inclusion <Class>("Parent.Members.PropertyDataType"), new Inclusion <Class>("Parent.Members.RelationClass") ); return(new IndexViewModel() { Class = @class == null ? null : new ClassViewModelFactory().Create(@class), ClassesByAbstractClasses = await this.GetClassesByAbstractClassesAsync(httpContext), Grid = @class == null ? null : new GridViewModelFactory().Create( httpContext, orderBy, skip, take, total, this.GetGridColumns(@class), objects.Select(o => new ObjectViewModelFactory().Create(o, @class.GetVisibleInListMembers())), "_Object" ) }); }
private void Initialize() { HaloSize = 3; NearThreshold = 1589; FarThreshold = 1903; objectFilter = ObjectFilter.CreateObjectFilterWithGPUSupport(); // -- Initialize Relay commands -- InitializeRelayCommands(); // -- // -- Create observables to activate / deactivate recording and to start and stop processing -- var observableIsRecording = ObservableEx.ObservableProperty(() => IsRecording); observableIsRecording .Throttle(TimeSpan.FromMilliseconds(150)) .Subscribe(e => { if (e) ActivateRecording(); else DeactivateRecording(); }); var observableIsAvailable = Observable.FromEventPattern<bool>(KinectManager.Instance, "KinectAvailabilityChanged") .Select(e => e.EventArgs); StartProcessingSubscription = observableIsAvailable .CombineLatest(observableIsRunning, (available, running) => Tuple.Create(available, running)) .Where(tuple => tuple.Item1 && tuple.Item2) .Subscribe(_ => StartProcessing()); StopProcessingSubscription = observableIsAvailable .CombineLatest(observableIsRunning, (available, running) => Tuple.Create(available, running)) .Where(tuple => !tuple.Item1 || !tuple.Item2) .Subscribe(_ => StopProcessing()); InitializeReactiveCommands(); InitializeReactiveProperties(); // -- fpsTimer = Stopwatch.StartNew(); colorAndDepthFPSTimer = Stopwatch.StartNew(); }
public async Task <ObjectSelectorFormViewModel> CreateAsync(HttpContext httpContext, ObjectFilter filter, IEnumerable <Object> objects, string objectIds) { Class @class = filter?.Class?.Id == null ? null : await httpContext.GetStorage().GetRepository <int, Class, ClassFilter>().GetByIdAsync( (int)filter.Class.Id, new Inclusion <Class>("Members.PropertyDataType"), new Inclusion <Class>("Members.RelationClass"), new Inclusion <Class>("Parent.Members.PropertyDataType"), new Inclusion <Class>("Parent.Members.RelationClass") ); return(new ObjectSelectorFormViewModel() { Class = new ClassViewModelFactory().Create(@class), GridColumns = this.GetGridColumns(@class), Objects = objects.Select(o => new ObjectViewModelFactory().Create(o, @class.GetVisibleInListMembers())), ObjectIds = string.IsNullOrEmpty(objectIds) ? new int[] { } : objectIds.Split(',').Select(objectId => int.Parse(objectId)) }); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The Dfa user object running the code example. /// </param> public override void Run(DfaUser user) { // Create UserRemoteService instance. UserRemoteService service = (UserRemoteService) user.GetService( DfaService.v1_19.UserRemoteService); long userId = long.Parse(_T("INSERT_USER_ID_HERE")); long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE")); // Create and configure a user filter. UserFilter filterToAdd = new UserFilter(); // The following field has been filled in to make a filter that allows a // user to access only the assigned objects. This value was determined // using GetUserFilterTypes.cs. filterToAdd.userFilterCriteriaId = 2; // Because this filter used the criteria type "Assigned" it is necessary // to specify what advertisers this user has access to. This next step // would be skipped for the criteria types "All" and "None". // Create an object filter to represent each object the user has access // to. Since this is an advertiser filter, an object filter represents an // advertiser. The total of object filter objects will need to match the // total of advertisers the user is assigned. ObjectFilter allowedObject = new ObjectFilter(); // Insert the advertiser id of an advertiser assigned to this user. allowedObject.id = advertiserId; // Create any additional object filters that are needed, then add these // settings to the user filter filterToAdd.objectFilters = new ObjectFilter[] {allowedObject}; try { // Retrieve the user who is to be modified. User userToModify = service.getUser(userId); // Add the filter to the user. The following method is specific to // advertiser filters. See the User class documentation for the names of // methods for other filters. userToModify.advertiserUserFilter = filterToAdd; // Save the changes made and display a success message. UserSaveResult userSaveResult = service.saveUser(userToModify); Console.WriteLine("User with id \"{0}\" was modified.", userSaveResult.id); } catch (Exception ex) { Console.WriteLine("Failed to add advertiser user filter. Exception says \"{0}\"", ex.Message); } }
public async Task <CreateOrEditViewModel> CreateAsync(HttpContext httpContext, ObjectFilter filter, Object @object) { Class @class = await httpContext.GetStorage().GetRepository <int, Class, ClassFilter>().GetByIdAsync( (int)filter.Class.Id, new Inclusion <Class>(c => c.Tabs), new Inclusion <Class>(c => c.Parent.Tabs), new Inclusion <Class>("Members.Tab"), new Inclusion <Class>("Members.PropertyDataType.DataTypeParameters.DataTypeParameterValues"), new Inclusion <Class>("Members.RelationClass"), new Inclusion <Class>("Parent.Members.Tab"), new Inclusion <Class>("Parent.Members.PropertyDataType.DataTypeParameters.DataTypeParameterValues"), new Inclusion <Class>("Parent.Members.RelationClass") ); if (@object == null) { return new CreateOrEditViewModel() { Class = new ClassViewModelFactory().Create(@class), MembersByTabs = this.GetMembersByTabs(httpContext, @class) } } ; return(new CreateOrEditViewModel() { Id = @object.Id, Class = new ClassViewModelFactory().Create(@class), MembersByTabs = this.GetMembersByTabs(httpContext, @class, @object) }); }