public BetweenFilterQuery(string fieldName, object from, object to, Inclusion inclusion) { switch (inclusion) { case Inclusion.Both: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThanEquals); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThanEquals); break; case Inclusion.Lower: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThanEquals); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThan); break; case Inclusion.Upper: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThan); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThanEquals); break; case Inclusion.None: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThan); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThan); break; } }
/** **************************************************************************************** * Does the job for * \ref cs::aworx::lox::Lox::SetSourcePathTrimRule "Lox.SetSourcePathTrimRule" and * \ref cs::aworx::lox::Lox::ClearSourcePathTrimRules "Lox.ClearSourcePathTrimRules". * * @param path The path to search for. If not starting with <c> '*'</c>, a prefix * is searched. * @param includeString Determines if \p path should be included in the trimmed path or not. * @param trimOffset Adjusts the portion of \p path that is trimmed. 999999 to clear! * @param sensitivity Determines if the comparison of \p path with a source files' path * is performed case sensitive or not. * @param global If Inclusion.Exclude, only this instance is affected. Otherwise * the setting applies to all instances of class \b Lox. ******************************************************************************************/ public void SetSourcePathTrimRule(String path, Inclusion includeString, int trimOffset, Case sensitivity, Inclusion global) { // unset current origFile to have lazy variables reset with the next invocation for (int i = 0; i < cacheSize; i++) { cache[i].origFile = null; } // clear command if (trimOffset == 999999) { LocalSPTRs.Clear(); if (global == Inclusion.Include) { GlobalSPTRs.Clear(); } AutoDetectTrimableSourcePath = (includeString == Inclusion.Include); // reset config read flag. This is done for unit testing. Not really // useful/needed in real life. GlobalSPTRsReadFromConfig = false; return; } // choosel local or global list List <SourcePathTrimRule> trimInfoList = global == Inclusion.Include ? GlobalSPTRs : LocalSPTRs; // add new entry SourcePathTrimRule rule = new SourcePathTrimRule(); // if path starts with '*', it is not a prefix. We store without * rule.Path = new AString((rule.IsPrefix = !path.StartsWith("*")) ? path : path.Substring(1)); if (rule.Path.CharAtEnd() == '*') { rule.Path.DeleteEnd(1); } if (rule.Path.IsEmpty()) { return; } if (Path.DirectorySeparatorChar == '/') { rule.Path.SearchAndReplaceAll("\\", "/"); } else { rule.Path.SearchAndReplaceAll("/", "\\"); } rule.IncludeString = includeString; rule.TrimOffset = trimOffset; rule.Sensitivity = sensitivity; trimInfoList.Add(rule); }
static int GetMaskAndStoreOriginalLayerAndReassign(Inclusion layerContext, IList <Component> componentsLayers) { StoreOriginalLayerAndReassign(componentsLayers); int mask = ExtLayerMask.physicsSoloCastMask; if (layerContext == Inclusion.Ignore) { mask = ~mask; } return(mask); }
public override async Task <dynamic> GetDataAsync(HttpContext httpContext, DataSource dataSource) { ParametersParser parametersParser = new ParametersParser(dataSource.DataProviderParameters); Inclusion <Object>[] inclusions = null; if (parametersParser.GetStringParameterValue("RelationType") == "Primary") { inclusions = new Inclusion <Object>[] { new Inclusion <Object>("Properties.Member"), new Inclusion <Object>("Properties.StringValue.Localizations"), new Inclusion <Object>("ForeignRelations.Primary.Properties.Member"), new Inclusion <Object>("ForeignRelations.Primary.Properties.StringValue.Localizations") } } ; else { inclusions = new Inclusion <Object>[] { new Inclusion <Object>("Properties.Member"), new Inclusion <Object>("Properties.StringValue.Localizations"), new Inclusion <Object>("PrimaryRelations.Foreign.Properties.Member"), new Inclusion <Object>("PrimaryRelations.Foreign.Properties.StringValue.Localizations") } }; Object @object = (await httpContext.GetStorage().GetRepository <int, Object, ObjectFilter>().GetAllAsync( new ObjectFilter(stringValue: new LocalizationFilter(value: new StringFilter(equals: httpContext.Request.GetUrl()))), inclusions: inclusions )).FirstOrDefault(); if (@object == null) { return(null); } int relationMemberId = parametersParser.GetIntParameterValue("RelationMemberId"); if (new ParametersParser(dataSource.DataProviderParameters).GetStringParameterValue("RelationType") == "Primary") { return(@object.ForeignRelations.Where(r => r.MemberId == relationMemberId).Select(r => this.CreateViewModel(r.Primary))); } return(@object.PrimaryRelations.Where(r => r.MemberId == relationMemberId).Select(r => this.CreateViewModel(r.Foreign))); } }
static int GetMaskAndStoreOriginalLayerAndReassign(int layerMask, Inclusion layerContext, IList <Component> componentsLayers) { StoreOriginalLayerAndReassign(componentsLayers); if (layerContext == Inclusion.Ignore) { return(~ExtLayerMask.physicsSoloCastMask & layerMask); } else if (layerContext == Inclusion.IncludeOnly) { return(ExtLayerMask.physicsSoloCastMask); } else { return(ExtLayerMask.physicsSoloCastMask | layerMask); } }
static int IndexOfAnyInRegion(char[] haystack, int regionStart, int regionLength, char[] needles, Inclusion inclusion) { int nbLen = needles.Length; int i = regionStart; int e = regionStart + regionLength; if (inclusion == Inclusion.Include) { while (i != e) { char c = haystack[i]; for (int n = 0; n < nbLen; n++) { if (c == needles[n]) { return(i); } } i++; } } else { while (i != e) { char c = haystack[i]; int n = 0; while (n < nbLen && c != needles[n]) { n++; } if (n == nbLen) { return(i); } i++; } } return(-1); }
public virtual List <TEntity> GetPageList(int nowPage, int pageSize, out int rowCount, Expression <Func <TEntity, bool> > where = null, Inclusion <TEntity> inclusion = null, string orderBy = "id asc", Expression <Func <TEntity, TEntity> > select = null, bool IsTrack = false) { nowPage = nowPage <= 0 ? 1 : nowPage; pageSize = pageSize < 0 ? 0 : pageSize; if (where == null) { Expression <Func <TEntity, bool> > expression = e => true; where = expression; } if (select == null) { Expression <Func <TEntity, TEntity> > expression = e => e; select = expression; } IQueryable <TEntity> query = _context.Set <TEntity>().AsQueryable(); if (inclusion != null) { var queryableResultWithIncludes = inclusion.Includes .Aggregate(query, (current, include) => current.Include(include)); var secondaryResult = inclusion.IncludeStrings .Aggregate(queryableResultWithIncludes, (current, include) => current.Include(include)); query = secondaryResult; } var temp = query.Where(where); rowCount = temp.Count(); var tempResult = temp.Select(select) .OrderBy(orderBy) .Skip((nowPage - 1) * pageSize) .Take(pageSize); var result = (IsTrack ? tempResult : tempResult.AsNoTracking()).ToList(); return(result); }
public Tuple <IEnumerable <T>, IEnumerable <T> > Sort() { List <T> sorted = new List <T>(); List <T> cycled = new List <T>(); IEnumerable <T> zeroDep; var map = this.map.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); zeroDep = map.Where(kvp => kvp.Value.ArgCount == 0).Select(kvp => kvp.Key).ToArray(); sorted.AddRange(zeroDep); for (int inx = 0; inx < sorted.Count; inx++) { Inclusion inclusion = map[sorted[inx]]; // get source inclusion zeroDep = inclusion.IncludedInFuncs.Where(incInFunc => (--map[incInFunc].ArgCount) == 0).ToArray(); sorted.AddRange(zeroDep); } cycled.AddRange(map.Where(kvp => kvp.Value.ArgCount != 0).Select(kvp => kvp.Key)); return(new Tuple <IEnumerable <T>, IEnumerable <T> >(sorted, cycled)); }
public virtual TEntity GetById(TPK id, Inclusion <TEntity> inclusion = null, bool isTrack = false) { IQueryable <TEntity> query = _context.Set <TEntity>().AsQueryable(); if (inclusion != null) { var queryableResultWithIncludes = inclusion.Includes .Aggregate(query, (current, include) => current.Include(include)); var secondaryResult = inclusion.IncludeStrings .Aggregate(queryableResultWithIncludes, (current, include) => current.Include(include)); query = secondaryResult; } var temp = query.Where(e => e.Id.Equals(id)); var result = (isTrack ? temp : temp.AsNoTracking()).FirstOrDefault(); return(result); }
public BetweenFilterQuery(string fieldName, object from, object to, Inclusion inclusion) { switch(inclusion) { case Inclusion.Both: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThanEquals); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThanEquals); break; case Inclusion.Lower: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThanEquals); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThan); break; case Inclusion.Upper: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThan); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThanEquals); break; case Inclusion.None: LeftQuery = new FilterQuery(fieldName, from, FilterQuery.FilterQueryTypes.GreaterThan); RightQuery = new FilterQuery(fieldName, to, FilterQuery.FilterQueryTypes.LessThan); break; } }
public static IList <Collider> OverlapCapsule(Vector3 segment0, Vector3 segment1, float radius, IList <Component> componentsLayers, IList <Collider> resultBuffer, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { int mask = GetMaskAndStoreOriginalLayerAndReassign(layerMask, layerContext, componentsLayers); OverlapCapsule(segment0, segment1, radius, resultBuffer, mask, queryTriggerInteraction); RestoreToOriginalLayer(componentsLayers); return(resultBuffer); }
public static RaycastHit SphereCast(Vector3 origin, float radius, Vector3 direction, Component componentLayer, float maxDistance = Mathf.Infinity, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { SetTempComponentLayer(componentLayer); return(SphereCast(origin, radius, direction, tempComponentLayer, maxDistance, layerMask, queryTriggerInteraction, layerContext)); }
public Inclusion IncludeOtherPLs; ///< Flag if other PLs should be included as well /** * Constructor * @param logable The \e Logable * @param includeOtherPLs Flag if other PLs should be included as well */ public PL(Object logable, Inclusion includeOtherPLs) { this.Logable = logable; this.IncludeOtherPLs = includeOtherPLs; }
public static bool CheckCapsule(Vector3 segment0, Vector3 segment1, float radius, IList <Component> componentsLayers, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { int mask = GetMaskAndStoreOriginalLayerAndReassign(layerMask, layerContext, componentsLayers); bool hasHit = CheckCapsule(segment0, segment1, radius, mask, queryTriggerInteraction); RestoreToOriginalLayer(componentsLayers); return(hasHit); }
/** **************************************************************************************** * Does the job for * \ref cs::aworx::lox::Lox::SetSourcePathTrimRule "Lox.SetSourcePathTrimRule" and * \ref cs::aworx::lox::Lox::ClearSourcePathTrimRules "Lox.ClearSourcePathTrimRules". * * @param path The path to search for. If not starting with <c> '*'</c>, * a prefix is searched. * @param includeString Determines if \p path should be included in the trimmed path * or not. * @param trimOffset Adjusts the portion of \p path that is trimmed. 999999 to clear! * @param sensitivity Determines if the comparison of \p path with a source files' path * is performed case sensitive or not. * @param trimReplacement Replacement string for trimmed portion of the path. * @param reach Denotes whether the rule is applied locally (to this \b %Lox only) * or applies to all instances of class \b %Lox. * @param priority The priority of the setting. ******************************************************************************************/ public void SetSourcePathTrimRule( String path, Inclusion includeString, int trimOffset, Case sensitivity, String trimReplacement, Reach reach, int priority ) { // unset current origFile to have lazy variables reset with the next invocation for ( int i= 0; i< cacheSize; i++ ) cache[i].origFile= null; // clear command if ( trimOffset == 999999 ) { LocalSPTRs.Clear(); if ( reach == Reach.Global ) GlobalSPTRs.Clear(); AutoDetectTrimableSourcePath= (includeString == Inclusion.Include); // reset config read flag. This is done for unit testing. Not really // useful/needed in real life. GlobalSPTRsReadFromConfig= false; return; } // choosel local or global list List<SourcePathTrimRule> trimInfoList = reach == Reach.Global ? GlobalSPTRs : LocalSPTRs; // add new entry SourcePathTrimRule rule= new SourcePathTrimRule(); // if path starts with '*', it is not a prefix. We store without * rule.Path= new AString( (rule.IsPrefix= !path.StartsWith("*")) ? path : path.Substring( 1 ) ); if ( rule.Path.CharAtEnd() == '*' ) rule.Path.DeleteEnd( 1 ); if ( rule.Path.IsEmpty() ) return; if( Path.DirectorySeparatorChar == '/' ) rule.Path.SearchAndReplaceAll( "\\", "/" ); else rule.Path.SearchAndReplaceAll( "/" , "\\" ); rule.IncludeString= includeString; rule.TrimOffset= trimOffset; rule.Sensitivity= sensitivity; rule.TrimReplacement= trimReplacement; // add rule ordered by priority rule.Priority= priority; int pos= 0; while( pos < trimInfoList.Count && priority < trimInfoList[pos].Priority ) ++pos; trimInfoList.Insert( pos, rule ); }
public static void SetSourcePathTrimRule( String path, Inclusion includeString = Inclusion.Exclude, int trimOffset = 0, Case sensitivity = Case.Ignore, Reach reach = Reach.Global, String trimReplacement = null , int priority = Configuration.PrioDefault ) { #if ALOX_DBG_LOG LOX.SetSourcePathTrimRule( path, includeString, trimOffset, sensitivity, trimReplacement, reach, priority ); #endif }
public List <TEntity> GetPageList(int nowPage, int pageSize, out int rowCount, Expression <Func <TEntity, bool> > where = null, Inclusion <TEntity> inclusion = null, string orderBy = "id asc", Expression <Func <TEntity, TEntity> > select = null, bool IsTrack = false) { return(GetRepository().GetPageList(nowPage, pageSize, out rowCount, where, inclusion, orderBy, select, IsTrack)); }
public Inclusion IncludeOtherPLs; ///< Flag if other PLs should be included as well /** * Constructor * @param logable The \e Logable * @param includeOtherPLs Flag if other PLs should be included as well */ public PL( Object logable, Inclusion includeOtherPLs ) { this.Logable= logable; this.IncludeOtherPLs= includeOtherPLs; }
public TEntity GetById(TPK id, Inclusion <TEntity> inclusion = null, bool isTrack = false) { return(GetRepository().GetById(id, inclusion, isTrack)); }
public List <TEntity> GetList(Expression <Func <TEntity, bool> > where = null, Inclusion <TEntity> inclusion = null, string orderBy = "id asc", Expression <Func <TEntity, TEntity> > select = null, bool isTrack = false) { return(GetRepository().GetList(where, inclusion, orderBy, select, isTrack)); }
/** **************************************************************************************** * Returns the index of the first character which is included, respectively <em>not</em> * included in a given set of characters. * * This method searches from left to right. For reverse search, see #LastIndexOfAny. * * @param needles AString with characters to be searched for. * @param inclusion Denotes whether the search returns the first index that holds a value * that is included or that is not excluded in the set of needle * characters. * @param startIdx The index to start the search at. If the given value is less than 0, * it is set to 0. If it exceeds the length of the string, the length of * the string is returned. * Defaults to 0. * * @return The index of the first character found which is included, respectively not * included, in the given set of characters. * If nothing is found, -1 is returned. ******************************************************************************************/ public int IndexOfAny( char[] needles, Inclusion inclusion, int startIdx= 0 ) { if ( startIdx < 0 ) startIdx= 0; if ( startIdx >= Length() ) return -1; int idx= CString.IndexOfAnyInRegion( Buf, Start + startIdx, Length() - startIdx, needles, inclusion ); if ( idx < 0) return -1; return idx - Start; }
public void ToBetween_PropertySelectorIsNotNullAndLowerAndUpperValuesAreSet_ReturnsPropertyBetweenLowerAndUpperValuesExpression(string propertyName, object minValue, object maxValue, Inclusion inclusion) { // Arrange var propertySelector = ExpressionUtils.GetPropertySelector <TestIndexableEntity, object>(propertyName); var indexableEntity = new TestIndexableEntity { SomeInteger = 1, SomeFloat = 1f, SomeDouble = 100, CreatedDate = DateTime.Now }; Expression <Func <TestIndexableEntity, object> > expected = x => propertySelector.Between(minValue, maxValue, inclusion); // Act var actual = ExpressionConversionService.ToBetween(propertySelector, minValue, maxValue, inclusion); // Assert Assert.Equal(actual.Compile().Invoke(indexableEntity), expected.Compile().Invoke(indexableEntity)); }
public override double Math(T c) { return(Inclusion.Contains(c) ? Pertinence : 0); }
internal override void WriteValue(int stateSlot, Value value, Inclusion inclusion) { value.WriteTo(this); }
void tIndexOfAny(bool forward, String haystack, String needles, int startPos, Inclusion inclusion, int expectedResult ) { char[] needlesArr= needles.ToCharArray(); haystackAString._()._( haystack ); haystackSubsPlain.Set( haystack ); haystackSubstring.Set( "01" + haystack + haystack + "234" , 2 + haystack.Length, haystack.Length ); if ( startPos == DEF ) { if ( forward ) { UT_EQ( expectedResult, haystackAString .IndexOfAny ( needlesArr, inclusion ) ); UT_EQ( expectedResult, haystackSubsPlain.IndexOfAny ( needlesArr, inclusion ) ); UT_EQ( expectedResult, haystackSubstring.IndexOfAny ( needlesArr, inclusion ) ); } else { UT_EQ( expectedResult, haystackAString .LastIndexOfAny( needlesArr, inclusion ) ); UT_EQ( expectedResult, haystackSubsPlain.LastIndexOfAny( needlesArr, inclusion ) ); UT_EQ( expectedResult, haystackSubstring.LastIndexOfAny( needlesArr, inclusion ) ); } } else { if ( forward ) { UT_EQ( expectedResult, haystackAString .IndexOfAny ( needlesArr, inclusion , startPos ) ); UT_EQ( expectedResult, haystackSubsPlain.IndexOfAny ( needlesArr, inclusion , startPos ) ); UT_EQ( expectedResult, haystackSubstring.IndexOfAny ( needlesArr, inclusion , startPos ) ); } else { UT_EQ( expectedResult, haystackAString .LastIndexOfAny( needlesArr, inclusion , startPos ) ); UT_EQ( expectedResult, haystackSubsPlain.LastIndexOfAny( needlesArr, inclusion , startPos ) ); UT_EQ( expectedResult, haystackSubstring.LastIndexOfAny( needlesArr, inclusion , startPos ) ); } } }
public virtual List <TEntity> GetList(Expression <Func <TEntity, bool> > where = null, Inclusion <TEntity> inclusion = null, string orderBy = "id asc", Expression <Func <TEntity, TEntity> > select = null, bool isTrack = false) { if (where == null) { Expression <Func <TEntity, bool> > expression = e => true; where = expression; } if (select == null) { Expression <Func <TEntity, TEntity> > expression = e => e; select = expression; } IQueryable <TEntity> query = _context.Set <TEntity>().AsQueryable(); if (inclusion != null) { var queryableResultWithIncludes = inclusion.Includes .Aggregate(query, (current, include) => current.Include(include)); var secondaryResult = inclusion.IncludeStrings .Aggregate(queryableResultWithIncludes, (current, include) => current.Include(include)); query = secondaryResult; } var temp = query.Where(where).Select(select).OrderBy(orderBy); var result = (isTrack ? temp : temp.AsNoTracking()).ToList(); return(result); }
private void ParseXML() { if ("" == sFile) // т.е. файл не неправильный, а его просто нет { return; } _aAtoms.Clear(); if (!System.IO.File.Exists(sFile)) { throw new Exception("отсутствует указанный файл шаблона [FL:" + sFile + "]"); //TODO LANG } XmlDocument cXMLTemplate = new XmlDocument(); string sXML = System.IO.File.ReadAllText(sFile); sXML = ProcessMacros(sXML); cXMLTemplate.Load(new System.IO.StringReader(sXML)); XmlNode cXmlNode = cXMLTemplate.GetElementsByTagName("template")[0]; if (0 < cXmlNode.Attributes.Count) { foreach (XmlAttribute cAttr in cXmlNode.Attributes) { switch (cAttr.Name) { case "destroy": try { eDestroyType = (Template.DESTROY_TYPE)Enum.Parse(typeof(Template.DESTROY_TYPE), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true); } catch { throw new Exception("указан некорректный тип удаления [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; } } } XmlNodeList aChildNodes = cXmlNode.ChildNodes; Atom cAtom; this.aInclusions = null; List <Inclusion> aInclusions = new List <Inclusion>(); for (int nIndx = 0; nIndx < aChildNodes.Count; nIndx++) { cAtom = null; switch (aChildNodes[nIndx].Name) { case "show": #region show if (0 < aChildNodes[nIndx].Attributes.Count) { foreach (XmlAttribute cAttr in aChildNodes[nIndx].Attributes) { switch (cAttr.Name) { case "exists": try { eOnExists = (Template.EXISTS_BEHAVIOR)Enum.Parse(typeof(Template.EXISTS_BEHAVIOR), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true); } catch { throw new Exception("указан некорректный тип замещения [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; case "lifetime": try { eLifeTime = (Template.LIFETIME)Enum.Parse(typeof(Template.LIFETIME), cAttr.Value.Trim(), true); } catch { try { nLifeTimeSeconds = cAttr.Value.Trim().ToInt32(); eLifeTime = LIFETIME.Seconds; } catch { nLifeTimeSeconds = -1; } if (0 > nLifeTimeSeconds) { throw new Exception("указана некорректная продолжительность существования [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } } break; case "misprepared": try { bMispreparedShow = cAttr.Value.Trim().ToBool(); } catch { throw new Exception("указано некорректное значение поведения при нецелевой подготовке [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; } } } #endregion break; case "include": case "inclusion": case "template": Inclusion cInclusion = new Inclusion(this); cInclusion.LoadXML(aChildNodes[nIndx]); aInclusions.Add(cInclusion); break; case "effects": ParseEffects(aChildNodes[nIndx]); break; case "plugin": cAtom = new Plugin(); break; case "video": cAtom = new Video(); break; case "audio": cAtom = new Audio(); break; case "animation": cAtom = new Animation(); break; case "clock": cAtom = new Clock(); break; case "text": cAtom = new Text(); break; case "playlist": cAtom = new Playlist(); break; case "roll": cAtom = new Roll(); break; } if (null != cAtom) { cAtom.cTemplate = this; cAtom.LoadXML(aChildNodes[nIndx]); if (!(cAtom is Effect) || ((Effect)cAtom).cShow.bShow) { _aAtoms.Add(cAtom); } } if (0 < aInclusions.Count) { this.aInclusions = aInclusions.ToArray(); } } }
public ActionResult SaveNewInclusion(StudentDetailViewModel model) { Inclusion.AddNew(model.StudentId, model.SelectedSubject, model.SelectedClass, model.SelectedTeacher, model.SessionStart, model.SessionEnd, ApplicationHelper.LoggedUserId); return(RedirectToAction("ManageDetails", new { id = model.StudentId })); }
static int LastIndexOfAny( char[] haystack, int regionStart, int regionLength, char[] needles, Inclusion inclusion ) { int nbLen= needles.Length; int i= regionStart + regionLength - 1; if ( inclusion == Inclusion.Include ) { while( i >= regionStart ) { char c= haystack[i]; for( int n= 0; n < nbLen ; n++ ) if ( c == needles[n] ) return i; i--; } } else { while( i >= regionStart ) { char c= haystack[i]; int n= 0; while ( n < nbLen && c != needles[n] ) n++; if ( n == nbLen ) return i; i--; } } return regionStart - 1; }
/// <summary> /// Converts the specified <paramref name="propertySelector"/> to an 'between' expression using the given /// <paramref name="lowerValue"/> and <paramref name="upperValue"/>. /// </summary> /// <typeparam name="T">The type of <see cref="IndexableEntity"/> implementation to use.</typeparam> /// <param name="propertySelector">The property selector</param> /// <param name="lowerValue">The lower-bound value</param> /// <param name="upperValue">The upper-bound value</param> /// <param name="inclusion">The state of how the bounds are included</param> /// <returns></returns> public static Expression <Func <T, bool> > ToBetween <T>(Expression <Func <T, object> > propertySelector, object lowerValue, object upperValue, Inclusion inclusion = Inclusion.Both) { Assert.ArgumentNotNull(propertySelector, "The specified property selector cannot be null"); Assert.ArgumentNotNull(lowerValue, "The specified lower-value cannot be null"); Assert.ArgumentNotNull(upperValue, "The specified upper-value cannot be null"); var parameterExp = Expression.Parameter(typeof(T), "s"); var propertyExp = Expression.Property(parameterExp, ExpressionUtils.GetPropertyNameFromPropertySelector(propertySelector)); var lowerValueExp = Expression.Constant(lowerValue); var upperValueExp = Expression.Constant(upperValue); var inclusionValueExp = Expression.Constant(inclusion); var betweenMethodExp = Expression.Call( typeof(MethodExtensions), "Between", new[] { propertyExp.Type }, propertyExp, lowerValueExp, upperValueExp, inclusionValueExp); return(Expression.Lambda <Func <T, bool> >(betweenMethodExp, parameterExp)); }
/** **************************************************************************************** * This method is looping over the \e Loggers, checking their verbosity against the given * one, and, if they match, invoke the log method of the \e Logger. * With the first logger identified to be active, the <em>Prefix Objects</em> get * collected from the scope store. * @param dom The domain to log on * @param verbosity The verbosity. * @param logable The object to log. * @param prefixes Denotes if prefixes should be included or not. ******************************************************************************************/ protected void log( Domain dom, Verbosity verbosity, Object logable, Inclusion prefixes ) { // OK, this is a little crude, but the simplest solution: As class ScopeStore sees // null objects as nothing and won't return them in a walk, we replace null by // an object (we choose the store itself) and fix this in the loop back to null if ( logable == null ) logable= scopePrefixes; dom.CntLogCalls++; logObjects.Clear(); for ( int i= 0; i < dom.CountLoggers() ; i++ ) if( dom.IsActive( i, verbosity ) ) { // lazily collect objects once if ( logObjects.Count == 0 ) { scopePrefixes.InitWalk( Scope.ThreadInner, logable ); Object next; while( (next= scopePrefixes.Walk() ) != null ) { if ( prefixes == Inclusion.Include || next == logable) logObjects.Insert( 0, next != scopePrefixes ? next : null ); // was this the actual? then insert domain-associated logables now bool excludeOthers= false; if( next == logable ) { int qtyThreadInner= logObjects.Count -1; Domain pflDom= dom; while ( pflDom != null ) { for( int ii= pflDom.PrefixLogables.Count -1 ; ii >= 0 ; ii-- ) { Domain.PL pl= pflDom.PrefixLogables[ii]; logObjects.Insert( 0, pl.Logable ); if ( pl.IncludeOtherPLs == Inclusion.Exclude ) { excludeOthers= true; break; } } pflDom= excludeOthers ? null : pflDom.Parent; } // found a stoppable one? remove those from thread inner and break if (excludeOthers) { for ( int ii= 0; ii < qtyThreadInner ; ii++ ) logObjects.RemoveAt( logObjects.Count - 1 ); break; } } } } Logger logger= dom.GetLogger(i); logger.Acquire(); logger.CntLogs++; logger.Log( dom, verbosity, logObjects, scopeInfo ); logger.TimeOfLastLog.Set(); logger.Release(); } }
public static void SetPrefix( Object logable, String domain =null, Inclusion otherPLs =Inclusion.Include, [CallerLineNumber] int cln= 0,[CallerFilePath] String csf="",[CallerMemberName] String cmn="" ) { #if ALOX_DBG_LOG LOX.SetPrefix( logable, domain, otherPLs ,cln,csf,cmn); #endif }
internal void InitFromValue(int stateSlot, Value value, Inclusion inclusion) { AssertValidValue(stateSlot, value); WriteValue(stateSlot, value, inclusion); }
public static bool CheckCapsule(Vector3 segment0, Vector3 segment1, float radius, Component componentLayer, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { SetTempComponentLayer(componentLayer); return(CheckCapsule(segment0, segment1, radius, tempComponentLayer, layerMask, queryTriggerInteraction, layerContext)); }
internal abstract void WriteValue(int stateSlot, Value value, Inclusion inclusion);
public static IList <Collider> OverlapCapsule(Vector3 segment0, Vector3 segment1, float radius, Component componentLayer, IList <Collider> resultBuffer, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { SetTempComponentLayer(componentLayer); return(OverlapCapsule(segment0, segment1, radius, tempComponentLayer, resultBuffer, layerMask, queryTriggerInteraction, layerContext)); }
private void ParseXML() { if ("" == sFile) // т.е. файл не неправильный, а его просто нет return; _aAtoms.Clear(); if (!System.IO.File.Exists(sFile)) throw new Exception("отсутствует указанный файл шаблона [FL:" + sFile + "]"); //TODO LANG XmlDocument cXMLTemplate = new XmlDocument(); string sXML = System.IO.File.ReadAllText(sFile); sXML = ProcessMacros(sXML); cXMLTemplate.Load(new System.IO.StringReader(sXML)); XmlNode cXmlNode = cXMLTemplate.GetElementsByTagName("template")[0]; if (0 < cXmlNode.Attributes.Count) { foreach (XmlAttribute cAttr in cXmlNode.Attributes) switch (cAttr.Name) { case "destroy": try { eDestroyType = (Template.DESTROY_TYPE)Enum.Parse(typeof(Template.DESTROY_TYPE), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true); } catch { throw new Exception("указан некорректный тип удаления [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; } } XmlNodeList aChildNodes = cXmlNode.ChildNodes; Atom cAtom; this.aInclusions = null; List<Inclusion> aInclusions = new List<Inclusion>(); for (int nIndx = 0; nIndx < aChildNodes.Count; nIndx++) { cAtom = null; switch (aChildNodes[nIndx].Name) { case "show": #region show if (0 < aChildNodes[nIndx].Attributes.Count) { foreach (XmlAttribute cAttr in aChildNodes[nIndx].Attributes) { switch (cAttr.Name) { case "exists": try { eOnExists = (Template.EXISTS_BEHAVIOR)Enum.Parse(typeof(Template.EXISTS_BEHAVIOR), System.Text.RegularExpressions.Regex.Replace(cAttr.Value.Trim(), "\\W", "_"), true); } catch { throw new Exception("указан некорректный тип замещения [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; case "lifetime": try { eLifeTime = (Template.LIFETIME)Enum.Parse(typeof(Template.LIFETIME), cAttr.Value.Trim(), true); } catch { try { nLifeTimeSeconds = cAttr.Value.Trim().ToInt32(); eLifeTime = LIFETIME.Seconds; } catch { nLifeTimeSeconds = -1; } if (0 > nLifeTimeSeconds) throw new Exception("указана некорректная продолжительность существования [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; case "misprepared": try { bMispreparedShow = cAttr.Value.Trim().ToBool(); } catch { throw new Exception("указано некорректное значение поведения при нецелевой подготовке [" + cAttr.Name + "=" + cAttr.Value + "][TPL:" + cXmlNode.BaseURI + "]"); //TODO LANG } break; } } } #endregion break; case "include": case "inclusion": case "template": Inclusion cInclusion = new Inclusion(this); cInclusion.LoadXML(aChildNodes[nIndx]); aInclusions.Add(cInclusion); break; case "plugin": cAtom = new Plugin(); break; case "video": cAtom = new Video(); break; case "audio": cAtom = new Audio(); break; case "animation": cAtom = new Animation(); break; case "clock": cAtom = new Clock(); break; case "text": cAtom = new Text(); break; case "playlist": cAtom = new Playlist(); break; case "roll": cAtom = new Roll(); break; } if (null != cAtom) { cAtom.cTemplate = this; cAtom.LoadXML(aChildNodes[nIndx]); if (!(cAtom is Effect) || ((Effect)cAtom).cShow.bShow) _aAtoms.Add(cAtom); } if(0 < aInclusions.Count) this.aInclusions = aInclusions.ToArray(); } }
public void SetSourcePathTrimRule( String path, Inclusion includeString = Inclusion.Exclude, int trimOffset = 0, Case sensitivity = Case.Ignore, String trimReplacement = null, Reach reach = Reach.Global, int priority = Configuration.PrioDefault ) { #if ALOX_DBG_LOG || ALOX_REL_LOG try { Acquire(); scopeInfo.SetSourcePathTrimRule( path, includeString, trimOffset, sensitivity, trimReplacement, reach, priority ); } finally { Release(); } #endif }
void tIndexOfAny(bool forward, String haystack, String needles, int startPos, Inclusion inclusion, int expectedResult) { char[] needlesArr = needles.ToCharArray(); haystackAString._()._(haystack); haystackSubsPlain.Set(haystack); haystackSubstring.Set("01" + haystack + haystack + "234", 2 + haystack.Length, haystack.Length); if (startPos == DEF) { if (forward) { UT_EQ(expectedResult, haystackAString.IndexOfAny(needlesArr, inclusion)); UT_EQ(expectedResult, haystackSubsPlain.IndexOfAny(needlesArr, inclusion)); UT_EQ(expectedResult, haystackSubstring.IndexOfAny(needlesArr, inclusion)); } else { UT_EQ(expectedResult, haystackAString.LastIndexOfAny(needlesArr, inclusion)); UT_EQ(expectedResult, haystackSubsPlain.LastIndexOfAny(needlesArr, inclusion)); UT_EQ(expectedResult, haystackSubstring.LastIndexOfAny(needlesArr, inclusion)); } } else { if (forward) { UT_EQ(expectedResult, haystackAString.IndexOfAny(needlesArr, inclusion, startPos)); UT_EQ(expectedResult, haystackSubsPlain.IndexOfAny(needlesArr, inclusion, startPos)); UT_EQ(expectedResult, haystackSubstring.IndexOfAny(needlesArr, inclusion, startPos)); } else { UT_EQ(expectedResult, haystackAString.LastIndexOfAny(needlesArr, inclusion, startPos)); UT_EQ(expectedResult, haystackSubsPlain.LastIndexOfAny(needlesArr, inclusion, startPos)); UT_EQ(expectedResult, haystackSubstring.LastIndexOfAny(needlesArr, inclusion, startPos)); } } }
public static RaycastHit SphereCast(Vector3 origin, float radius, Vector3 direction, IList <Component> componentsLayers, float maxDistance = Mathf.Infinity, int layerMask = Physics.AllLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal, Inclusion layerContext = Inclusion.Ignore) { int mask = GetMaskAndStoreOriginalLayerAndReassign(layerMask, layerContext, componentsLayers); RaycastHit hitInfo = SphereCast(origin, radius, direction, maxDistance, mask, queryTriggerInteraction); RestoreToOriginalLayer(componentsLayers); return(hitInfo); }
/** **************************************************************************************** * Returns the index of the first character which is included, respectively <em>not</em> * included in a given set of characters. * The search starts at the given index and goes backward. * For forward search, see #IndexOfAny. * * @param needles AString with characters to be searched for. * @param inclusion Denotes whether the search returns the first index that holds a value * that is included or that is not excluded in the set of needle * characters. * @param startIdx The index to start the search at. The value is cropped to be in * the bounds of 0 and the length of this %AString minus one. * Defaults to maximum integer value. * * @return The index of the first character found which is included, respectively not * included, in the given set of characters. * If nothing is found, -1 is returned. ******************************************************************************************/ public int LastIndexOfAny( char[] needles, Inclusion inclusion, int startIdx= int.MaxValue ) { if ( startIdx < 0 ) return -1; if ( startIdx >= Length() ) startIdx= Length() - 1; int idx= CString.LastIndexOfAny( Buf, Start, startIdx + 1, needles, inclusion ); if ( idx < 0) return -1; return idx - Start; }
internal override void WriteValue(int stateSlot, Value value, Inclusion inclusion) { WriteValue(value, inclusion); }
public void SetPrefix( Object logable, String domain =null, Inclusion otherPLs =Inclusion.Include, [CallerLineNumber] int cln= 0,[CallerFilePath] String csf="",[CallerMemberName] String cmn="" ) { #if ALOX_DBG_LOG || ALOX_REL_LOG try { Acquire(); // initialize scope information scopeInfo.Set( cln,csf,cmn, owner ); // we consider empty strings as unset command, so we set them to null if( logable != null ) { Type type= logable.GetType(); if ( ( type == typeof( AString ) && ((AString) logable).IsNull() ) || ( type == typeof( String ) && ((String) logable).Length == 0 ) ) logable= null; } Domain dom= evaluateResultDomain( domain ); Verbosity intLogVerbosity= Verbosity.Info; intMsg._(); if ( logable != null ) { dom.PrefixLogables.Add( new Domain.PL( logable, otherPLs ) ); intMsg._("Object \"")._NC(logable)._NC( "\" added as prefix logable for" ); } else { int qtyPLs= dom.PrefixLogables.Count; if ( qtyPLs > 0 ) { Object removedLogable= dom.PrefixLogables[qtyPLs - 1].Logable; dom.PrefixLogables.RemoveAt( qtyPLs - 1 ); intMsg._("Object \"")._NC(removedLogable)._NC( "\" removed from list of prefix logables for"); } else { intMsg._NC( "No prefix logable to remove for" ); intLogVerbosity= Verbosity.Warning; } } intMsg._NC( " domain \'")._NC( dom.FullPath )._NC( "\'." ); logInternal( intLogVerbosity, "PFX", intMsg ); } finally { Release(); } #endif }