Ejemplo n.º 1
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            FunctionValues aVals = m_a.GetValues(context, readerContext);
            FunctionValues bVals = m_b.GetValues(context, readerContext);

            return(new SingleDocValuesAnonymousClass(this, this, aVals, bVals));
        }
Ejemplo n.º 2
0
        private void CreateGraphOfCobweb(ZedGraphControl zgc)
        {
            PointPairList list  = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;
            LineItem      myCurve2;
            double        x;

            myPane.XAxis.Color     = OppositeGraphColor;
            myPane.YAxis.Color     = OppositeGraphColor;
            myPane.XAxis.IsVisible = true;
            myPane.YAxis.IsVisible = true;

            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();

            for (x = grSettings.XMin; x <= grSettings.XMax; x = x + grSettings.XIncr)
            {
                list1.Add(x, x);
                FunctionValues.Add(point);
                myCurve = myPane.AddCurve("", list1, Color.Blue, SymbolType.None);

                list2.Add(x, function(x));
                FunctionValues.Add(point);
                myCurve2 = myPane.AddCurve("", list2, OppositeGraphColor, SymbolType.None);
            }
            CobwebPlots();
        }
Ejemplo n.º 3
0
        private void CreateGraphOfSlope(ZedGraphControl zgc)
        {
            // Make up some data arrays based on the Sine function
            double        x, y, y1, y2, y3;
            PointPairList list  = new PointPairList();
            PointPairList list1 = new PointPairList();
            PointPairList list2 = new PointPairList();
            PointPairList list3 = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;

            //  y' = y^2 - x
            for (x = grSettings.XMin; x <= grSettings.XMax; x = x + grSettings.XIncr)
            {
                for (y = grSettings.YMin; y <= grSettings.YMax; y = y + grSettings.YIncr)
                {
                    y1 = slope(x, y);

                    y2 = y1 + 0.1 * y1;
                    y3 = y1 - 0.1 * y1;

                    list    = new PointPairList();
                    point   = new PointPair();
                    point.X = x;
                    point.Y = y;
                    list.Add(point);
                    FunctionValues.Add(point);

                    myCurve             = myPane.AddCurve("", list, SlopeColor(y1), SymbolType.Default);
                    myCurve.Symbol.Size = 1;
                }
            }
        }
Ejemplo n.º 4
0
        private void CreateGraphOfVectorField(ZedGraphControl zgc)
        {
            double        x, y, z;
            PointPairList list  = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;

            for (x = grSettings.XMin; x <= grSettings.XMax; x = x + grSettings.XIncr)
            {
                for (y = grSettings.YMin; y <= grSettings.YMax; y = y + grSettings.YIncr)
                {
                    z = vectorfield(x, y);

                    list    = new PointPairList();
                    point   = new PointPair();
                    point.X = x;
                    point.Y = y;
                    list.Add(point);
                    FunctionValues.Add(point);

                    point.X = x + z * Math.Cos(Math.Atan(z));
                    point.Y = y + z * Math.Sin(Math.Atan(z));
                    list.Add(point);
                    FunctionValues.Add(point);

                    myCurve             = myPane.AddCurve("", list, RedBlueSlopeColor(z), SymbolType.Default);
                    myCurve.Symbol.Size = 1;
                }
            }
        }
Ejemplo n.º 5
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            int            @base = readerContext.DocBase;
            FunctionValues vals  = m_source.GetValues(context, readerContext);

            return(new CachingDoubleFunctionValue(@base, vals, m_cache));
        }
Ejemplo n.º 6
0
            public override DocIdSet GetDocIdSet(AtomicReaderContext context, Bits acceptDocs)
            {
                // TODO: this is just like ValueSourceScorer,
                // ValueSourceFilter (spatial),
                // ValueSourceRangeFilter (solr); also,
                // https://issues.apache.org/jira/browse/LUCENE-4251

                FunctionValues values = valueSource.GetValues(new Dictionary <string, object>(), context);

                int maxDoc = context.Reader.MaxDoc;

                Bits fastMatchBits;

                if (fastMatchFilter != null)
                {
                    DocIdSet dis = fastMatchFilter.GetDocIdSet(context, null);
                    if (dis == null)
                    {
                        // No documents match
                        return(null);
                    }
                    fastMatchBits = dis.GetBits();
                    if (fastMatchBits == null)
                    {
                        throw new System.ArgumentException("fastMatchFilter does not implement DocIdSet.bits");
                    }
                }
                else
                {
                    fastMatchBits = null;
                }

                return(new DocIdSetAnonymousInnerClassHelper(this, acceptDocs, values, maxDoc, fastMatchBits));
            }
Ejemplo n.º 7
0
 public BitsAnonymousHelper(DocIdSetAnonymousHelper outerInstance, FunctionValues predFuncValues, AtomicReaderContext context, IBits acceptDocs)
 {
     this.outerInstance  = outerInstance;
     this.predFuncValues = predFuncValues;
     this.context        = context;
     this.acceptDocs     = acceptDocs;
 }
Ejemplo n.º 8
0
        private void CreateGraphOfFunction(ZedGraphControl zgc)
        {
            PointPairList list  = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;
            double        x, y;

            for (x = grSettings.XMin; x <= grSettings.XMax; x = x + grSettings.XIncr)
            {
                y = function(x);

                if (!grSettings.SmoothGraph)
                {
                    list = new PointPairList();
                }
                point   = new PointPair();
                point.X = x;
                point.Y = y;
                list.Add(point);
                FunctionValues.Add(point);

                if (!grSettings.SmoothGraph)
                {
                    myCurve             = myPane.AddCurve("", list, OppositeGraphColor, SymbolType.Default);
                    myCurve.Symbol.Size = 1;
                }
            }
            if (grSettings.SmoothGraph)
            {
                myCurve             = myPane.AddCurve("", list, OppositeGraphColor, SymbolType.Default);
                myCurve.Symbol.Size = 1;
            }
        }
Ejemplo n.º 9
0
 public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, DualFloatFunction @this, FunctionValues aVals, FunctionValues bVals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.aVals         = aVals;
     this.bVals         = bVals;
 }
Ejemplo n.º 10
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            FunctionValues aVals = a.GetValues(context, readerContext);
            FunctionValues bVals = b.GetValues(context, readerContext);

            return(new FloatDocValuesAnonymousInnerClassHelper(this, this, aVals, bVals));
        }
Ejemplo n.º 11
0
                public override Bits GetBits()
                {
                    //null Map context -- we simply don't have one. That's ok.
                    FunctionValues predFuncValues = outerInstance.predicateValueSource.GetValues(null, context);

                    return(new BitsAnonymousHelper(this, predFuncValues, context, acceptDocs));
                }
Ejemplo n.º 12
0
 public FunctionValuesAnonymousInnerClassHelper(IfFunction outerInstance, FunctionValues ifVals, FunctionValues trueVals, FunctionValues falseVals)
 {
     this.outerInstance = outerInstance;
     this.ifVals        = ifVals;
     this.trueVals      = trueVals;
     this.falseVals     = falseVals;
 }
Ejemplo n.º 13
0
 public ValueSourceFilteredDocIdSet(ValueSourceFilter outerInstance, DocIdSet?innerSet, FunctionValues values)
     : base(innerSet)
 {
     // LUCENENET specific - added guard clauses
     this.outerInstance = outerInstance ?? throw new ArgumentNullException(nameof(outerInstance));
     this.values        = values ?? throw new ArgumentNullException(nameof(values));
 }
Ejemplo n.º 14
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            IDictionary <string, FunctionValues> valuesCache = (IDictionary <string, FunctionValues>)context["valuesCache"];

            if (valuesCache == null)
            {
                valuesCache = new Dictionary <string, FunctionValues>();
                context     = new Hashtable(context)
                {
                    ["valuesCache"] = valuesCache
                };
            }
            FunctionValues[] externalValues = new FunctionValues[expression.Variables.Length];
            for (int i = 0; i < variables.Length; ++i)
            {
                string externalName = expression.Variables[i];
                if (!valuesCache.TryGetValue(externalName, out FunctionValues values))
                {
                    values = variables[i].GetValues(context, readerContext);
                    if (values == null)
                    {
                        // LUCENENET specific: Changed from RuntimeException to InvalidOperationException to match .NET conventions
#pragma warning disable IDE0016 // Use 'throw' expression
                        throw IllegalStateException.Create($"Internal error. External ({externalName}) does not exist.");
#pragma warning restore IDE0016 // Use 'throw' expression
                    }
                    valuesCache[externalName] = values;
                }
                externalValues[i] = values;
            }
            return(new ExpressionFunctionValues(this, expression, externalValues));
        }
Ejemplo n.º 15
0
 public BitsAnonymousClass(FunctionValues predFuncValues, AtomicReaderContext context, IBits?acceptDocs)
 {
     // LUCENENET specific - added guard clauses
     this.predFuncValues = predFuncValues ?? throw new ArgumentNullException(nameof(predFuncValues));
     this.context        = context ?? throw new ArgumentNullException(nameof(context));
     this.acceptDocs     = acceptDocs;
 }
Ejemplo n.º 16
0
        private void CreateGraphOfIteration(ZedGraphControl zgc)
        {
            PointPairList list  = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;
            double        x, y;

            y = grSettings.StartingX;

            for (long n = 1; n <= grSettings.N; n++)
            {
                y = function(y);

                if (!grSettings.SmoothGraph)
                {
                    list = new PointPairList();
                }
                point   = new PointPair();
                point.X = n;
                point.Y = y;
                list.Add(point);
                FunctionValues.Add(point);

                if (!grSettings.SmoothGraph)
                {
                    myCurve             = myPane.AddCurve("", list, OppositeGraphColor, SymbolType.Default);
                    myCurve.Symbol.Size = 1;
                }
            }
            if (grSettings.SmoothGraph)
            {
                myCurve             = myPane.AddCurve("", list, OppositeGraphColor, SymbolType.Default);
                myCurve.Symbol.Size = 1;
            }
        }
Ejemplo n.º 17
0
        private void CreateGraphOfDerivative(ZedGraphControl zgc)
        {
            // Make up some data arrays based on the Sine function
            double        x, y;
            PointPairList list  = new PointPairList();
            PointPair     point = new PointPair();
            LineItem      myCurve;

            for (x = grSettings.XMin; x <= grSettings.XMax; x = x + grSettings.XIncr)
            {
                y = derivative(x);

                if (!grSettings.SmoothGraph)
                {
                    list = new PointPairList();
                }
                point   = new PointPair();
                point.X = x;
                point.Y = y;
                list.Add(point);
                FunctionValues.Add(point);

                if (!grSettings.SmoothGraph)
                {
                    myCurve             = myPane.AddCurve("", list, SlopeColor(y), SymbolType.Default);
                    myCurve.Symbol.Size = 1;
                }
            }
            if (grSettings.SmoothGraph)
            {
                myCurve             = myPane.AddCurve("", list, Color.Yellow, SymbolType.Default);
                myCurve.Symbol.Size = 1;
            }
        }
Ejemplo n.º 18
0
        public override void SetNextReader(AtomicReaderContext context)
        {
            FunctionValues values = groupBy.GetValues(vsContext, context);

            filler = values.GetValueFiller();
            mval   = (TMutableValue)filler.Value;
        }
Ejemplo n.º 19
0
 public SingleDocValuesAnonymousClass(DualSingleFunction outerInstance, DualSingleFunction @this, FunctionValues aVals, FunctionValues bVals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.aVals         = aVals;
     this.bVals         = bVals;
 }
Ejemplo n.º 20
0
        public virtual void TestRangeScorer()
        {
            Expression     expr     = JavascriptCompiler.Compile("2*popularity");
            SimpleBindings bindings = new SimpleBindings();

            bindings.Add(new SortField("popularity", SortFieldType.INT64));
            ValueSource vs = expr.GetValueSource(bindings);

            Assert.AreEqual(1, reader.Leaves.Count);
            AtomicReaderContext leaf   = reader.Leaves[0];
            FunctionValues      values = vs.GetValues(new Dictionary <string, object>(), leaf);
            // everything
            ValueSourceScorer scorer = values.GetRangeScorer(leaf.Reader, "4"
                                                             , "40", true, true);

            Assert.AreEqual(-1, scorer.DocID);
            Assert.AreEqual(0, scorer.NextDoc());
            Assert.AreEqual(1, scorer.NextDoc());
            Assert.AreEqual(2, scorer.NextDoc());
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, scorer.NextDoc());
            // just the first doc
            scorer = values.GetRangeScorer(leaf.Reader, "4", "40", false, false);
            Assert.AreEqual(-1, scorer.DocID);
            Assert.AreEqual(0, scorer.NextDoc());
            Assert.AreEqual(DocIdSetIterator.NO_MORE_DOCS, scorer.NextDoc());
        }
Ejemplo n.º 21
0
        /// <summary>This method is unused, it is just here to make sure that the function signatures don't change.</summary>
        /// <remarks>
        /// This method is unused, it is just here to make sure that the function signatures don't change.
        /// If this method fails to compile, you also have to change the byte code generator to correctly
        /// use the <see cref="FunctionValues"/> class.
        /// </remarks>
#pragma warning disable IDE0051 // Remove unused private members
        private static void UnusedTestCompile()
#pragma warning restore IDE0051 // Remove unused private members
        {
            FunctionValues f = null;

            /*double ret = */ f.DoubleVal(2); // LUCENENET: IDE0059: Remove unnecessary value assignment
        }
Ejemplo n.º 22
0
 public FunctionValuesAnonymousInnerClassHelper(IfFunction outerInstance, FunctionValues ifVals, FunctionValues trueVals, FunctionValues falseVals)
 {
     this.outerInstance = outerInstance;
     this.ifVals = ifVals;
     this.trueVals = trueVals;
     this.falseVals = falseVals;
 }
Ejemplo n.º 23
0
 public BoolDocValuesAnonymousClass(ShapePredicateValueSource outerInstance, FunctionValues shapeValues)
     : base(outerInstance)
 {
     // LUCENENET specific - added guard clauses
     this.outerInstance = outerInstance ?? throw new ArgumentNullException(nameof(outerInstance));
     this.shapeValues   = shapeValues ?? throw new ArgumentNullException(nameof(shapeValues));
 }
Ejemplo n.º 24
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            IDictionary <string, FunctionValues> valuesCache = (IDictionary <string, FunctionValues>)context["valuesCache"];

            if (valuesCache == null)
            {
                valuesCache            = new Dictionary <string, FunctionValues>();
                context                = new Hashtable(context);
                context["valuesCache"] = valuesCache;
            }
            FunctionValues[] externalValues = new FunctionValues[expression.Variables.Length];
            for (int i = 0; i < variables.Length; ++i)
            {
                string         externalName = expression.Variables[i];
                FunctionValues values;
                if (!valuesCache.TryGetValue(externalName, out values))
                {
                    values = variables[i].GetValues(context, readerContext);
                    if (values == null)
                    {
                        throw new InvalidOperationException("Internal error. External (" + externalName + ") does not exist.");
                    }
                    valuesCache[externalName] = values;
                }
                externalValues[i] = values;
            }
            return(new ExpressionFunctionValues(this, expression, externalValues));
        }
Ejemplo n.º 25
0
 public CachingDoubleFunctionValue(int docBase, FunctionValues vals, IDictionary <int, double> cache)
 {
     // LUCENENET specific - added guard clauses
     this.docBase = docBase;
     values       = vals ?? throw new ArgumentNullException(nameof(vals));
     this.cache   = cache ?? throw new ArgumentNullException(nameof(cache));
 }
Ejemplo n.º 26
0
        public override void SetNextReader(AtomicReaderContext context)
        {
            base.SetNextReader(context);
            FunctionValues values = groupByVS.GetValues(vsContext, context);

            filler = values.GetValueFiller();
            mval   = filler.Value;
        }
Ejemplo n.º 27
0
 protected override float Func(int doc, FunctionValues[] valsArr)
 {
     if (valsArr.Length == 0)
     {
         return 0.0f;
     }
     return valsArr.Select(vals => vals.FloatVal(doc)).Concat(new[] {float.PositiveInfinity}).Min();
 }
Ejemplo n.º 28
0
 public FloatDocValuesAnonymousInnerClassHelper(RangeMapFloatFunction outerInstance, RangeMapFloatFunction @this, FunctionValues vals, FunctionValues targets, FunctionValues defaults)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.vals = vals;
     this.targets = targets;
     this.defaults = defaults;
 }
Ejemplo n.º 29
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            FunctionValues ifVals    = ifSource.GetValues(context, readerContext);
            FunctionValues trueVals  = trueSource.GetValues(context, readerContext);
            FunctionValues falseVals = falseSource.GetValues(context, readerContext);

            return(new FunctionValuesAnonymousInnerClassHelper(ifVals, trueVals, falseVals));
        }
Ejemplo n.º 30
0
 public DocIdSetAnonymousInnerClassHelper(FilterAnonymousInnerClassHelper outerInstance, Bits acceptDocs, FunctionValues values, int maxDoc, Bits fastMatchBits)
 {
     this.outerInstance = outerInstance;
     this.acceptDocs    = acceptDocs;
     this.values        = values;
     this.maxDoc        = maxDoc;
     this.fastMatchBits = fastMatchBits;
 }
Ejemplo n.º 31
0
 public SingleDocValuesAnonymousInnerClassHelper(RangeMapSingleFunction outerInstance, RangeMapSingleFunction @this, FunctionValues vals, FunctionValues targets, FunctionValues defaults)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.vals          = vals;
     this.targets       = targets;
     this.defaults      = defaults;
 }
Ejemplo n.º 32
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            FunctionValues vals     = m_source.GetValues(context, readerContext);
            FunctionValues targets  = m_target.GetValues(context, readerContext);
            FunctionValues defaults = (this.m_defaultVal == null) ? null : m_defaultVal.GetValues(context, readerContext);

            return(new SingleDocValuesAnonymousInnerClassHelper(this, this, vals, targets, defaults));
        }
Ejemplo n.º 33
0
 public SingleDocValuesAnonymousInnerClassHelper(ScaleSingleFunction outerInstance, ScaleSingleFunction @this, float scale, float minSource, float maxSource, FunctionValues vals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.scale         = scale;
     this.minSource     = minSource;
     this.maxSource     = maxSource;
     this.vals          = vals;
 }
Ejemplo n.º 34
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            var valsArr = new FunctionValues[sources.Length];
            for (int i = 0; i < sources.Length; i++)
            {
                valsArr[i] = sources[i].GetValues(context, readerContext);
            }

            return new FloatDocValuesAnonymousInnerClassHelper(this, this, valsArr);
        }
Ejemplo n.º 35
0
 protected override float Func(int doc, FunctionValues[] valsArr)
 {
     if (valsArr.Length == 0)
     {
         return 0.0f;
     }
     float val = float.NegativeInfinity;
     foreach (FunctionValues vals in valsArr)
     {
         val = Math.Max(vals.FloatVal(doc), val);
     }
     return val;
 }
Ejemplo n.º 36
0
 public static string ToString(string name, FunctionValues[] valsArr, int doc)
 {
     var sb = new StringBuilder();
     sb.Append(name).Append('(');
     bool firstTime = true;
     foreach (FunctionValues vals in valsArr)
     {
         if (firstTime)
         {
             firstTime = false;
         }
         else
         {
             sb.Append(',');
         }
         sb.Append(vals.ToString(doc));
     }
     sb.Append(')');
     return sb.ToString();
 }
Ejemplo n.º 37
0
 public Values(MultiFunction outerInstance, FunctionValues[] valsArr)
 {
     this.outerInstance = outerInstance;
     this.valsArr = valsArr;
 }
Ejemplo n.º 38
0
 protected override float Func(int doc, FunctionValues aVals, FunctionValues bVals)
 {
     return (float)Math.Pow(aVals.FloatVal(doc), bVals.FloatVal(doc));
 }
Ejemplo n.º 39
0
 public FunctionValuesAnonymousInnerClassHelper(FunctionValues ifVals, FunctionValues trueVals, FunctionValues falseVals)
 {
     this.ifVals = ifVals;
     this.trueVals = trueVals;
     this.falseVals = falseVals;
 }
 /// <summary>
 /// Returns the weight for the current <code>docId</code> as computed 
 /// by the <code>weightsValueSource</code>
 /// 
 /// </summary>
 protected internal override long GetWeight(Document doc, int docId)
 {
     if (currentWeightValues == null)
     {
         return 0;
     }
     int subIndex = ReaderUtil.subIndex(docId, starts);
     if (subIndex != currentLeafIndex)
     {
         currentLeafIndex = subIndex;
         try
         {
             currentWeightValues = outerInstance.weightsValueSource.GetValues(new Dictionary<string, object>(), leaves[currentLeafIndex]);
         }
         catch (IOException)
         {
             throw new Exception();
         }
     }
     return currentWeightValues.LongVal(docId - starts[subIndex]);
 }
Ejemplo n.º 41
0
 protected abstract float Func(int doc, FunctionValues aVals, FunctionValues bVals);
Ejemplo n.º 42
0
 protected override float Func(int doc, FunctionValues[] valsArr)
 {
     return valsArr.Aggregate(1.0f, (current, vals) => current * vals.FloatVal(doc));
 }
 //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
 //ORIGINAL LINE: public DocumentValueSourceInputIterator(boolean hasPayloads, boolean hasContexts) throws java.io.IOException
 public DocumentValueSourceInputIterator(DocumentValueSourceDictionary outerInstance, bool hasPayloads, bool hasContexts)
     : base(outerInstance, hasPayloads, hasContexts)
 {
     this.outerInstance = outerInstance;
     leaves = outerInstance.reader.Leaves();
     starts = new int[leaves.Count + 1];
     for (int i = 0; i < leaves.Count; i++)
     {
         starts[i] = leaves[i].DocBase;
     }
     starts[leaves.Count] = outerInstance.reader.MaxDoc();
     currentWeightValues = (leaves.Count > 0) ? outerInstance.weightsValueSource.GetValues(new Dictionary<string, object>(), leaves[currentLeafIndex]) : null;
 }
Ejemplo n.º 44
0
 public BoolDocValuesAnonymousInnerClassHelper(SimpleBoolFunction outerInstance, SimpleBoolFunction @this, FunctionValues vals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.vals = vals;
 }
Ejemplo n.º 45
0
 public FunctionValuesAnonymousInnerClassHelper2(VectorValueSource outerInstance, FunctionValues[] valsArr)
 {
     this.outerInstance = outerInstance;
     this.valsArr = valsArr;
 }
Ejemplo n.º 46
0
 protected abstract bool Func(int doc, FunctionValues vals);
Ejemplo n.º 47
0
 public DocIdSetAnonymousInnerClassHelper(FilterAnonymousInnerClassHelper outerInstance, Bits acceptDocs, FunctionValues values, int maxDoc, Bits fastMatchBits)
 {
     this.outerInstance = outerInstance;
     this.acceptDocs = acceptDocs;
     this.values = values;
     this.maxDoc = maxDoc;
     this.fastMatchBits = fastMatchBits;
 }
Ejemplo n.º 48
0
 public FloatDocValuesAnonymousInnerClassHelper(DualFloatFunction outerInstance, DualFloatFunction @this, FunctionValues aVals, FunctionValues bVals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.aVals = aVals;
     this.bVals = bVals;
 }
Ejemplo n.º 49
0
 public static FunctionValues[] ValsArr(IList<ValueSource> sources, IDictionary fcontext, AtomicReaderContext readerContext)
 {
     var valsArr = new FunctionValues[sources.Count];
     int i = 0;
     foreach (var source in sources)
     {
         valsArr[i++] = source.GetValues(fcontext, readerContext);
     }
     return valsArr;
 }
Ejemplo n.º 50
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new style on the specified style list.
		/// </summary>
		/// <param name="styleList">The style list to add the style to</param>
		/// <param name="name">style name</param>
		/// <param name="context">style context</param>
		/// <param name="structure">style structure</param>
		/// <param name="function">style function</param>
		/// <param name="isCharStyle">true if character style, otherwise false</param>
		/// <param name="userLevel">User level</param>
		/// <param name="isBuiltin">True for a builtin style, otherwise, false.</param>
		/// <returns>The new created (and properly owned style.</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle Create(IFdoOwningCollection<IStStyle> styleList, string name,
			ContextValues context, StructureValues structure, FunctionValues function,
			bool isCharStyle, int userLevel, bool isBuiltin)
		{
			var retval = new StStyle();
			styleList.Add(retval);
			retval.Name = name;
			retval.Context = context;
			retval.Structure = structure;
			retval.Function = function;
			retval.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph);
			retval.UserLevel = userLevel;
			retval.IsBuiltIn = isBuiltin;

			return retval;
		}
Ejemplo n.º 51
0
 public ValueSourceFilteredDocIdSet(DocIdSet innerSet, FunctionValues values, ValueSourceFilter caller)
     : base(innerSet)
 {
     this.enclosingFilter = caller;
     this.values = values;
 }
Ejemplo n.º 52
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new style and add it to the Language Project stylesheet.
		/// </summary>
		/// <param name="name">style name</param>
		/// <param name="context">style context</param>
		/// <param name="structure">style structure</param>
		/// <param name="function">style function</param>
		/// <param name="isCharStyle">true if character style, otherwise false</param>
		/// <param name="userLevel">The user level.</param>
		/// <param name="styleCollection">The style collection.</param>
		/// <returns>The style</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
			FunctionValues function, bool isCharStyle, int userLevel,
			FdoOwningCollection<IStStyle> styleCollection)
		{
			CheckDisposed();
			ITsPropsBldr bldr = TsPropsBldrClass.Create();
			StStyle style = new StStyle();
			styleCollection.Add(style);
			style.Name = name;
			style.Context = context;
			style.Structure = structure;
			style.Function = function;
			style.Rules = bldr.GetTextProps();
			style.Type = (isCharStyle ? StyleType.kstCharacter : StyleType.kstParagraph);
			style.UserLevel = userLevel;

			return style;
		}
Ejemplo n.º 53
0
		/// -------------------------------------------------------------------------------------
		/// <summary>
		/// Detemine whether the newly proposed function for a style is compatible with its
		/// current function.
		/// </summary>
		/// <param name="currFunction">The existing function of the style</param>
		/// <param name="proposedFunction">The function we want</param>
		/// <returns><c>true </c>if the passed in function can be upgraded as requested;
		/// <c>false</c> otherwise.</returns>
		/// -------------------------------------------------------------------------------------
		public override bool CompatibleFunction(FunctionValues currFunction, FunctionValues proposedFunction)
		{
			return base.CompatibleFunction(currFunction, proposedFunction) ||
				(currFunction == FunctionValues.Line &&
				proposedFunction == FunctionValues.StanzaBreak);
		}
Ejemplo n.º 54
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new style and add it to the Language Project stylesheet.
		/// </summary>
		/// <param name="name">style name</param>
		/// <param name="context">style context</param>
		/// <param name="structure">style structure</param>
		/// <param name="function">style function</param>
		/// <param name="isCharStyle">true if character style, otherwise false</param>
		/// <param name="styleCollection">The style collection.</param>
		/// <returns>The style</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
			FunctionValues function, bool isCharStyle, FdoOwningCollection<IStStyle> styleCollection)
		{
			return AddTestStyle(name, context, structure, function, isCharStyle, 0, styleCollection);
		}
Ejemplo n.º 55
0
 public FunctionValuesAnonymousInnerClassHelper(VectorValueSource outerInstance, FunctionValues x, FunctionValues y)
 {
     this.outerInstance = outerInstance;
     this.x = x;
     this.y = y;
 }
Ejemplo n.º 56
0
 public FloatDocValuesAnonymousInnerClassHelper(ReciprocalFloatFunction outerInstance, ReciprocalFloatFunction @this, FunctionValues vals)
     : base(@this)
 {
     this.outerInstance = outerInstance;
     this.vals = vals;
 }
Ejemplo n.º 57
0
        public override FunctionValues GetValues(IDictionary context, AtomicReaderContext readerContext)
        {
            var size = sources.Count;

            // special-case x,y and lat,lon since it's so common
            if (size == 2)
            {
                var x = sources[0].GetValues(context, readerContext);
                var y = sources[1].GetValues(context, readerContext);
                return new FunctionValuesAnonymousInnerClassHelper(this, x, y);
            }

            var valsArr = new FunctionValues[size];
            for (int i = 0; i < size; i++)
            {
                valsArr[i] = sources[i].GetValues(context, readerContext);
            }

            return new FunctionValuesAnonymousInnerClassHelper2(this, valsArr);
        }
Ejemplo n.º 58
0
 protected override float Func(int doc, FunctionValues aVals, FunctionValues bVals)
 {
     return aVals.FloatVal(doc) / bVals.FloatVal(doc);
 }
Ejemplo n.º 59
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Constructor with ContextValues and MarkerDomain as a parameters.
		/// </summary>
		/// <param name="sStyleName">Name of the style.</param>
		/// <param name="styleType">kstCharacter or kstParagraph</param>
		/// <param name="ws">character or paragraph writing system</param>
		/// <param name="context">Context that will be used if this is a new style (otherwise existing
		/// context in DB will be used), see ContextValues for possible types</param>
		/// <param name="domain">The marker domain to use</param>
		/// <param name="styleSheet">The style sheet</param>
		/// ------------------------------------------------------------------------------------
		public ImportStyleProxy(string sStyleName, StyleType styleType, int ws,
			ContextValues context, MarkerDomain domain, FwStyleSheet styleSheet)
		{
			m_FwStyleSheet = styleSheet;
			m_domain = domain;
			Debug.Assert(m_FwStyleSheet != null);

			m_ttpFormattingProps = null;
			m_fIsScriptureStyle = true; //default
			m_sEndMarker = null; //default

			if (context == ContextValues.EndMarker)
			{	// this proxy represents an end marker - not a style; set bogus info
				sStyleName = "End"; //name does not matter
				styleType = StyleType.kstCharacter;
			}
			else if (sStyleName != null)
			{
				// Determine whether style exists in the StyleSheet
				Debug.Assert(ws != 0);
				m_style = m_FwStyleSheet.FindStyle(sStyleName);
				if (m_style != null)
				{
					// If this is an existing style, the actual type, context, structure, and
					// function always override the requested values.
					styleType = m_style.Type;
					context = (ContextValues)m_style.Context;
					m_structure = (StructureValues)m_style.Structure;
					m_function = (FunctionValues)m_style.Function;
				}
			}

			m_sStyleName = sStyleName;
			m_StyleType = styleType;
			m_ws = ws;
			m_Context = context;

//			//force StartOfFootnote marker to be processed as a para style proxy having para props
//			if (context == StyleRole.StartOfFootnote)
//				m_StyleType = StyleType.kstParagraph;

			//set the text property vars for this proxy
			SetTextProps();
		}
Ejemplo n.º 60
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a new style and add it to the Language Project stylesheet.
		/// </summary>
		/// <param name="name">style name</param>
		/// <param name="context">style context</param>
		/// <param name="structure">style structure</param>
		/// <param name="function">style function</param>
		/// <param name="isCharStyle">true if character style, otherwise false</param>
		/// <returns>The style</returns>
		/// ------------------------------------------------------------------------------------
		public IStStyle AddTestStyle(string name, ContextValues context, StructureValues structure,
			FunctionValues function, bool isCharStyle)
		{
			return AddTestStyle(name, context, structure, function, isCharStyle, Cache.LangProject.StylesOC);
		}