Example #1
0
 private RandomGenR()
 {
     this.dateModule = new Dates();
     this.numberModule = new Numbers();
     this.collectionsModule = new Collections();
     this.stringsModule = new Strings();
 }
Example #2
0
        public SocketToken(int id,
            Sinan.Collections.BytesSegment receiveBuffer,
            Sinan.Collections.BytesSegment sendBuffer,
            IBufferProcessor processor,
            Collections.CircularQueue<Collections.BytesSegment> sendPool = null)
        {
            m_connectID = id;
            m_sendPool = sendPool ?? new Collections.CircularQueue<Collections.BytesSegment>(64);
            m_processor = processor;
            SocketAsyncEventArgs receiver = new SocketAsyncEventArgs();
            receiver.Completed += new EventHandler<SocketAsyncEventArgs>(ReceiveCompleted);
            receiver.SetBuffer(receiveBuffer.Array, receiveBuffer.Offset, receiveBuffer.Count);

            SocketAsyncEventArgs sender = new SocketAsyncEventArgs();
            sender.Completed += new EventHandler<SocketAsyncEventArgs>(SendCompleted);
            sender.SetBuffer(sendBuffer.Array, sendBuffer.Offset, sendBuffer.Count);

            m_receiver = receiver;
            m_receiveOffset = receiver.Offset;
            m_receiveMax = receiver.Count;

            m_sender = sender;
            m_sendOffset = sender.Offset;
            m_sendMax = sender.Count;
        }
 void Users_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<User>> e) {
   foreach (var u in e.Items) {
     if (u.Value.Id != Guid.Empty) {
       Content.DeleteUserAsync(u.Value, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
     }
   }
 }
 /// <summary>
 /// Loads the object definitions.
 /// </summary>
 /// <param name="configurationModel">The configuration model.</param>
 public void LoadObjectDefinitions(Collections.Generic.ISet<ConfigurationClass> configurationModel)
 {
     foreach (ConfigurationClass configClass in configurationModel)
     {
         LoadObjectDefinitionsForConfigurationClass(configClass);
     }
 }
Example #5
0
 private void Content_CheckedItemsChanged(object sender, Collections.CollectionItemsChangedEventArgs<IFilter> e) {
   if (Content != null) {
     foreach (IFilter filter in e.Items) {
       filter.Active = checkedFilterView.Content.ItemChecked(filter);
     }
     UpdateFilterInfo();
   }
 }
Example #6
0
        public override void Initialise(Collections.INamedDataProvider initialisationData)
        {
            base.Initialise(initialisationData);

            initialisationData.TryCopyValue(this, SkyColourName, _skyColour);
            initialisationData.TryCopyValue(this, GroundColourName, _groundColour);
            initialisationData.TryCopyValue(this, UpName, _up);
        }
Example #7
0
        public override void Initialise(Collections.INamedDataProvider initialisationData)
        {
            base.Initialise(initialisationData);

            initialisationData.TryCopyValue(this, TextureName, _texture);
            initialisationData.TryCopyValue(this, BrightnessName, _brightness);
            initialisationData.TryCopyValue(this, GammaCorrectName, _gammaCorrect);
        }
	    /// <summary>
	    /// Create a new QualifierAnnotationAutowireCandidateResolver
	    /// for the given qualifier attribute types.
	    /// </summary>
	    /// <param name="qualifierTypes">the qualifier annotations to look for</param>
	    public QualifierAnnotationAutowireCandidateResolver(Collections.Generic.ISet<Type> qualifierTypes) {
            AssertUtils.ArgumentNotNull(qualifierTypes, "'qualifierTypes' must not be null");
            foreach(var type in qualifierTypes)
            {
                if (!_qualifierTypes.Contains(type))
                    _qualifierTypes.Add(type);
            }
	    }
Example #9
0
    public Parser(Collections.IList<object> tokens)
    {
        this.tokens = tokens;
        this.index = 0;
        this.result = this.ParseStmt();

        if (this.index != this.tokens.Count)
            throw new System.Exception("expected EOF");
    }
Example #10
0
        public override void Initialise(Collections.INamedDataProvider initialisationData)
        {
            base.Initialise(initialisationData);

            initialisationData.TryCopyValue(this, ColourName, _colour);
            initialisationData.TryCopyValue(this, PositionName, _position);
            initialisationData.TryCopyValue(this, RangeName, _range);
            initialisationData.TryCopyValue(this, ActiveName, _active);
        }
Example #11
0
    public Parser(Collections.IList<object> tokens)
    {
        this.tokens = tokens;
        this.indice = 0;
        this.resultado = this.ParseStmt();

        if (this.indice != this.tokens.Count)
            throw new System.Exception("se esperaba el final del archivo");
    }
Example #12
0
        public override void Initialise(Collections.INamedDataProvider initialisationData)
        {
            base.Initialise(initialisationData);

            initialisationData.TryCopyValue(this, ColourName, _colour);
            initialisationData.TryCopyValue(this, DirectionName, _direction);
            initialisationData.TryCopyValue(this, ShadowResolutionName, _shadowResolution);
            initialisationData.TryCopyValue(this, ActiveName, _active);
        }
     public MethodParamPair(
 MethodParamResult method,
 Interfaces.IEventInput input,
         Collections.ExitPathGroup _paths)
     {
         _result = MethodResult.None;
         _method = method;
         _params = input;
         _exitPaths = _paths;
     }
        protected override void OnItemsChanged(Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            if (e.Action == Collections.Specialized.NotifyCollectionChangedAction.Remove)
            {
                // Don't select itself when its child items got removed. (Default action of base.OnItemsChanged)
                // The selection should be managed by designer surface.
                return;
            }

            base.OnItemsChanged(e);
        }
Example #15
0
        internal static Node<TreeNode> CreateNode(this HierarchyNode<ContentItem> structure, IContentAdapterProvider adapters, Collections.ItemFilter filter)
        {
            var adapter = adapters.ResolveAdapter<NodeAdapter>(structure.Current);

            var children = structure.Children.Select(c => CreateNode(c, adapters, filter)).ToList();
            return new Node<TreeNode>
            {
                Current = adapter.GetTreeNode(structure.Current),
                HasChildren = adapter.HasChildren(structure.Current, filter),
                Expanded = children.Any(),
                Children = children
            };
        }
Example #16
0
        /// <summary>
        /// Checks for emty runner instances.
        /// </summary>
        /// <param name="runners">The runners.</param>
        /// <returns></returns>
        public static Collections.SelectionList CheckForEmtyRunnerInstances(Collections.SelectionList runners)
        {
            if (runners == null) return runners;

            int removeAt = -1;

            for (int x = 0; x < runners.Count; x++)
            {
                if (runners[x].selectionId <= 0) removeAt = x;
            }

            if (removeAt > -1) runners.RemoveAt(removeAt);

            return runners;
        }
Example #17
0
        /// <summary>
        /// Checks for emty runner instances.
        /// </summary>
        /// <param name="market">The market.</param>
        /// <returns></returns>
        public static Collections.Market CheckForEmtyRunnerInstances(Collections.Market market)
        {
            if (market == null || market.runners == null) return market;

            int removeAt = -1;

            for (int x = 0; x < market.runners.Count; x++)
            {
                if (market.runners[x].selectionId <= 0) removeAt = x;
            }

            if (removeAt > -1) market.runners.RemoveAt(removeAt);

            market.numberOfRunners = market.runners.Count;

            return market;
        }
Example #18
0
        static void Main(string[] args)
        {
            IEnumerable<int> list = new List<int>() { 1, 2, 3, 5 };

            foreach (int number in list)
            {
                Console.WriteLine(number);
            }

            // ... e echivalent cu:
            using (var enumerator = list.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    int number = enumerator.Current;
                    Console.WriteLine(number);
                }
            }

            var collections = new Collections();
            foreach (var dwarf in collections.TheSevenDwarves())
            {
                Console.WriteLine("Here comes {0}", dwarf);
            }

            var fibonacci = collections.Fibonacci();
            var firstFibonacci = collections.FirstTwelve(fibonacci);
            foreach (var n in firstFibonacci)
            {
                Console.WriteLine(n);
            }

            Console.WriteLine("------------------------------------------");

            var newFibonacci = collections.Fibonacci();
            var evenFibonacci = collections.OnlyEven(newFibonacci);
            var firstEvenFibonacci = collections.FirstTwelve(evenFibonacci);
            foreach (var n in firstEvenFibonacci)
            {
                Console.WriteLine(n);
            }
        }
		protected override Resource _create( string name, ulong handle, string group, bool isManual, IManualResourceLoader loader, Collections.NameValuePairList createParams )
		{
			string paramSyntax = string.Empty;
			string paramType = string.Empty;

			if ( createParams == null || createParams.ContainsKey( "syntax" ) == false || createParams.ContainsKey( "type" ) == false )
			{
				throw new AxiomException( "You must supply 'syntax' and 'type' parameters" );
			}
			else
			{
				paramSyntax = createParams[ "syntax" ];
				paramType = createParams[ "type" ];
			}
			CreateGpuProgramDelegate iter = null;
			if ( this._programMap.ContainsKey( paramSyntax ) )
			{
				iter = this._programMap[ paramSyntax ];
			}
			else
			{
				// No factory, this is an unsupported syntax code, probably for another rendersystem
				// Create a basic one, it doesn't matter what it is since it won't be used
				return new GLES2GpuProgram( this, name, handle, group, isManual, loader );
			}
			GpuProgramType gpt;
			if ( paramType == "vertex_program" )
			{
				gpt = GpuProgramType.Vertex;
			}
			else
			{
				gpt = GpuProgramType.Fragment;
			}

			return iter( this, name, handle, group, isManual, loader, gpt, paramSyntax );
		}
Example #20
0
 public override IEnumerator <string> GetEnumerator()
 {
     return(Collections.UnmodifiableSet(fields.Keys).GetEnumerator());
 }
        public void GetUpdatedAssignmentGroupResults_NewAssignment_ReturnsAllResultsForNewAssignment()
        {
            var section = new Section()
            {
                DisplayName = SectionName
            };
            var users       = new List <User>();
            var assignments = new List <Assignment>();
            var submissions = new List <UserQuestionSubmission>();

            var oldSnapshot = Collections.CreateList
                              (
                CreateSingleAssignmentResults
                (
                    "Unit1",
                    5.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit1", "Last1", "First1", 5.0),
                        CreateAssignmentGroupResult("Unit1", "Last2", "First2", 4.0)
                    )
                )
                              );

            var newSnapshot = Collections.CreateList
                              (
                CreateSingleAssignmentResults
                (
                    "Unit1",
                    5.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit1", "Last1", "First1", 5.0),
                        CreateAssignmentGroupResult("Unit1", "Last2", "First2", 4.0)
                    )
                ),
                CreateSingleAssignmentResults
                (
                    "Unit2",
                    6.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit2", "Last1", "First1", 6.0),
                        CreateAssignmentGroupResult("Unit2", "Last2", "First2", 2.0)
                    )
                )
                              );

            var updatedAssignmentReportGenerator = CreateUpdatedAssignmentReportGenerator
                                                   (
                section,
                users,
                assignments,
                submissions,
                oldSnapshot,
                newSnapshot
                                                   );

            var results = updatedAssignmentReportGenerator.GetUpdatedAssignmentGroupResults
                          (
                assignments,
                users,
                section,
                GradebookName,
                DateLastTransferred,
                submissions
                          );

            Assert.Equal(1, results.AssignmentResults.Count);

            var sectionAssignmentResults = results.AssignmentResults[0];

            Assert.Equal(SectionName, sectionAssignmentResults.SectionName);
            Assert.Equal("Unit2", sectionAssignmentResults.AssignmentGroupName);
            Assert.Equal(6.0, sectionAssignmentResults.Points);
            Assert.Equal(2, sectionAssignmentResults.AssignmentGroupResults.Count);

            {
                var assignmentGroupResult = sectionAssignmentResults.AssignmentGroupResults[0];

                Assert.Equal("Unit2", assignmentGroupResult.AssignmentGroupName);
                Assert.Equal("Last1", assignmentGroupResult.LastName);
                Assert.Equal("First1", assignmentGroupResult.FirstName);
                Assert.Equal(6.0, assignmentGroupResult.Score);
            }

            {
                var assignmentGroupResult = sectionAssignmentResults.AssignmentGroupResults[1];

                Assert.Equal("Unit2", assignmentGroupResult.AssignmentGroupName);
                Assert.Equal("Last2", assignmentGroupResult.LastName);
                Assert.Equal("First2", assignmentGroupResult.FirstName);
                Assert.Equal(2.0, assignmentGroupResult.Score);
            }
        }
 public IDictionary <string, object> metaData()
 {
     return(Collections.emptyMap());
 }
Example #23
0
 public List <SortPredicate> getSortPredicates()
 {
     return(Collections.unmodifiableList(_sortPredicates));
 }
Example #24
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testUpdateEventTrigger()
        public virtual void testUpdateEventTrigger()
        {
            // given
            string newMessageName = "newMessage";

            ProcessDefinition sourceProcessDefinition = migrationRule.deployAndGetDefinition(ProcessModels.ONE_RECEIVE_TASK_PROCESS);
            ProcessDefinition targetProcessDefinition = migrationRule.deployAndGetDefinition(modify(ProcessModels.ONE_RECEIVE_TASK_PROCESS).renameMessage("Message", newMessageName));

            ProcessInstance processInstance = runtimeService.startProcessInstanceById(sourceProcessDefinition.Id);
            MigrationPlan   migrationPlan   = runtimeService.createMigrationPlan(sourceProcessDefinition.Id, targetProcessDefinition.Id).mapEqualActivities().updateEventTriggers().build();

            Batch batch = runtimeService.newMigration(migrationPlan).processInstanceIds(Collections.singletonList(processInstance.Id)).executeAsync();

            helper.executeSeedJob(batch);

            // when
            helper.executeJobs(batch);

            // then the message event subscription's event name was changed
            EventSubscription eventSubscription = runtimeService.createEventSubscriptionQuery().singleResult();

            assertEquals(newMessageName, eventSubscription.EventName);
        }
Example #25
0
        private void RunAssertionNestedDotMethod(bool grouped, bool soda)
        {
            var eplDeclare = "create table varagg (" +
                             (grouped ? "key string primary key, " : "") +
                             "windowSupportBean window(*) @type('SupportBean'))";

            SupportModelHelper.CreateByCompileOrParse(_epService, soda, eplDeclare);

            var eplInto = "into table varagg " +
                          "select window(*) as windowSupportBean from SupportBean.win:length(2)" +
                          (grouped ? " group by TheString" : "");

            SupportModelHelper.CreateByCompileOrParse(_epService, soda, eplInto);

            var key       = grouped ? "[\"E1\"]" : "";
            var eplSelect = "select " +
                            "varagg" + key + ".windowSupportBean.last(*).IntPrimitive as c0, " +
                            "varagg" + key + ".windowSupportBean.window(*).countOf() as c1, " +
                            "varagg" + key + ".windowSupportBean.window(IntPrimitive).take(1) as c2" +
                            " from SupportBean_S0";
            EPStatement stmtSelect = SupportModelHelper.CreateByCompileOrParse(_epService, soda, eplSelect);

            stmtSelect.AddListener(_listener);
            var expectedAggType = new object[][]
            {
                new object[] { "c0", typeof(int?) },
                new object[] { "c1", typeof(int) },
                new object[] { "c2", typeof(ICollection <object>) }
            };

            EventTypeAssertionUtil.AssertEventTypeProperties(expectedAggType, stmtSelect.EventType, EventTypeAssertionEnum.NAME, EventTypeAssertionEnum.TYPE);

            var fields = "c0,c1,c2".Split(',');

            MakeSendBean("E1", 10, 0);
            _epService.EPRuntime.SendEvent(new SupportBean_S0(0));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new object[] { 10, 1, Collections.SingletonList(10) });

            MakeSendBean("E1", 20, 0);
            _epService.EPRuntime.SendEvent(new SupportBean_S0(0));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new object[] { 20, 2, Collections.SingletonList(10) });

            MakeSendBean("E1", 30, 0);
            _epService.EPRuntime.SendEvent(new SupportBean_S0(0));
            EPAssertionUtil.AssertProps(_listener.AssertOneGetNewAndReset(), fields, new object[] { 30, 2, Collections.SingletonList(20) });

            _epService.EPAdministrator.DestroyAllStatements();
            _epService.EPAdministrator.Configuration.RemoveEventType("table_varagg__internal", false);
            _epService.EPAdministrator.Configuration.RemoveEventType("table_varagg__public", false);
        }
Example #26
0
        // 统计集合
        int Count(List<ListViewItem> items,
            ref Collections cols,
            out string strError)
        {
            strError = "";

            foreach (ListViewItem item in items)
            {
                string strBorrower = ListViewUtil.GetItemText(item, COLUMN_BORROWER);

                int nImageIndex = item.ImageIndex;

                if (nImageIndex == TYPE_ERROR)
                {
                    cols.Error.Add(item);
                    continue;
                }
                else if (nImageIndex == TYPE_VERIFIED)
                {
                    cols.Scaned.Add(item);
                    cols.OnShelf.Add(item);
                }
                else if (nImageIndex == TYPE_NOTRETURN)
                {
                    cols.Scaned.Add(item);
                    cols.OnShelf.Add(item);
                    cols.OnShelfBorrowed.Add(item);
                }
                else if (nImageIndex == TYPE_NORMAL)
                {
                    if (string.IsNullOrEmpty(strBorrower) == false)
                        cols.Borrowed.Add(item);
                    else
                        cols.Lost.Add(item);
                }

                if (string.IsNullOrEmpty(strBorrower) == false)
                    cols.DataBorrowed.Add(item);
                else
                    cols.DataOnShelf.Add(item);
            }

            return 0;
        }
Example #27
0
        public virtual void testProcessVariableValueLessThan()
        {
            runtimeService.startProcessInstanceByKey("oneTaskProcess", Collections.singletonMap <string, object>("requestNumber", 123));

            assertEquals(1, historyService.createHistoricTaskInstanceQuery().processVariableValueLessThan("requestNumber", 124).count());
        }
		public void InitializeSuperfluosLayersQuestion(Collections.SelectableListNodeList list)
		{
			GuiHelper.Initialize(_cbSuperfluousLayersAction, list);
		}
Example #29
0
        //--------------------------------------------------------------
        /// <inheritdoc/>
        internal override void Flatten(Collections.ArrayList<Vector3F> vertices, Collections.ArrayList<int> strokeIndices, Collections.ArrayList<int> fillIndices)
        {
            _arcSegment.IsLargeArc = true;
              _arcSegment.Point1 = new Vector2F(RadiusX, 0);
              _arcSegment.Point2 = _arcSegment.Point1;
              _arcSegment.Radius = new Vector2F(RadiusX, RadiusY);
              _arcSegment.RotationAngle = 0;
              _arcSegment.SweepClockwise = false;

              var tempVertices = ResourcePools<Vector2F>.Lists.Obtain();
              _arcSegment.Flatten(tempVertices, MaxNumberOfIterations, Tolerance);

              int numberOfVertices = tempVertices.Count;
              if (numberOfVertices < 2)
            return;

              int startIndex = vertices.Count;

              // Add 3D vertices. We skip the duplicated vertices.
              for (int i = 0; i < numberOfVertices; i += 2)
            vertices.Add(new Vector3F(tempVertices[i].X, tempVertices[i].Y, 0));

              // Add stroke indices.
              for (int i = 0; i < numberOfVertices - 1; i++)
            strokeIndices.Add(startIndex + (i + 1) / 2);

              // Closing stroke:
              strokeIndices.Add(startIndex);

              if (IsFilled)
              {
            // Add a center vertex.
            var centerIndex = vertices.Count;
            vertices.Add(new Vector3F(0, 0, 0));

            // Add one triangle per circle segment.
            for (int i = 0; i < numberOfVertices / 2 - 1; i++)
            {
              fillIndices.Add(centerIndex);
              fillIndices.Add(startIndex + i + 1);
              fillIndices.Add(startIndex + i);
            }

            // Last triangle:
            fillIndices.Add(centerIndex);
            fillIndices.Add(startIndex);
            fillIndices.Add(centerIndex - 1);
              }

              ResourcePools<Vector2F>.Lists.Recycle(tempVertices);
        }
        public CodegenClass Forge(
            bool includeDebugSymbols,
            bool fireAndForget)
        {
            Supplier<string> debugInformationProvider = () => {
                var writer = new StringWriter();
                _raw.AppendCodeDebugInfo(writer);
                writer.Write(" output-processor ");
                writer.Write(_spec.GetType().FullName);
                return writer.ToString();
            };

            try {
                IList<CodegenInnerClass> innerClasses = new List<CodegenInnerClass>();

                // build ctor
                IList<CodegenTypedParam> ctorParms = new List<CodegenTypedParam>();
                ctorParms.Add(
                    new CodegenTypedParam(
                        typeof(EPStatementInitServices),
                        EPStatementInitServicesConstants.REF.Ref,
                        false));
                ctorParms.Add(
                    new CodegenTypedParam(
                        _namespaceScope.FieldsClassName,
                        null,
                        "statementFields",
                        true,
                        false));

                var providerCtor = new CodegenCtor(
                    typeof(StmtClassForgeableOPVFactoryProvider),
                    ClassName,
                    includeDebugSymbols,
                    ctorParms);
                var classScope = new CodegenClassScope(includeDebugSymbols, _namespaceScope, ClassName);
                var providerExplicitMembers = new List<CodegenTypedParam>();
                providerExplicitMembers.Add(
                    new CodegenTypedParam(typeof(StatementResultService), MEMBERNAME_STATEMENTRESULTSVC));
                providerExplicitMembers.Add(
                    new CodegenTypedParam(typeof(OutputProcessViewFactory), MEMBERNAME_OPVFACTORY));

                if (_spec.IsCodeGenerated) {
                    // make factory and view both, assign to member
                    MakeOPVFactory(classScope, innerClasses, providerExplicitMembers, providerCtor, ClassName);
                    MakeOPV(
                        classScope,
                        innerClasses,
                        Collections.GetEmptyList<CodegenTypedParam>(),
                        providerCtor,
                        ClassName,
                        _spec,
                        _numStreams);
                }
                else {
                    // build factory from existing classes
                    var symbols = new SAIFFInitializeSymbol();
                    var init = providerCtor
                        .MakeChildWithScope(typeof(OutputProcessViewFactory), GetType(), symbols, classScope)
                        .AddParam(
                            typeof(EPStatementInitServices),
                            EPStatementInitServicesConstants.REF.Ref);
                    _spec.ProvideCodegen(init, symbols, classScope);
                    providerCtor.Block.AssignRef(
                        MEMBERNAME_OPVFACTORY,
                        LocalMethod(init, EPStatementInitServicesConstants.REF));
                }

                // make get-factory method
                var factoryMethodGetter = CodegenProperty.MakePropertyNode(
                    typeof(OutputProcessViewFactory),
                    GetType(),
                    CodegenSymbolProviderEmpty.INSTANCE,
                    classScope);
                factoryMethodGetter.GetterBlock.BlockReturn(Ref(MEMBERNAME_OPVFACTORY));

                var properties = new CodegenClassProperties();
                var methods = new CodegenClassMethods();
                CodegenStackGenerator.RecursiveBuildStack(
                    providerCtor,
                    "ctor",
                    methods,
                    properties);
                CodegenStackGenerator.RecursiveBuildStack(
                    factoryMethodGetter,
                    "OutputProcessViewFactory",
                    methods,
                    properties);

                // render and compile
                return new CodegenClass(
                    CodegenClassType.OUTPUTPROCESSVIEWFACTORYPROVIDER,
                    typeof(OutputProcessViewFactoryProvider),
                    ClassName,
                    classScope,
                    providerExplicitMembers,
                    providerCtor,
                    methods,
                    properties,
                    innerClasses);
            }
            catch (Exception t) {
                throw new EPException(
                    "Fatal exception during code-generation for " +
                    debugInformationProvider.Invoke() +
                    " : " +
                    t.Message,
                    t);
            }
        }
        private static void MakeOPV(
            CodegenClassScope classScope,
            IList<CodegenInnerClass> innerClasses,
            IList<CodegenTypedParam> factoryExplicitMembers,
            CodegenCtor factoryCtor,
            string classNameParent,
            OutputProcessViewFactoryForge forge,
            int numStreams)
        {
            IList<CodegenTypedParam> ctorParams = new List<CodegenTypedParam>();
            ctorParams.Add(new CodegenTypedParam(classNameParent, "o"));
            ctorParams.Add(new CodegenTypedParam(typeof(ResultSetProcessor), NAME_RESULTSETPROCESSOR));
            ctorParams.Add(new CodegenTypedParam(typeof(AgentInstanceContext), NAME_AGENTINSTANCECONTEXT));

            // make ctor code
            var serviceCtor = new CodegenCtor(typeof(StmtClassForgeableOPVFactoryProvider), classScope, ctorParams);

            // Get-Result-Type Method
            var eventTypeGetter = CodegenProperty
                .MakePropertyNode(typeof(EventType), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride();
            eventTypeGetter.GetterBlock.BlockReturn(ExprDotName(Ref(NAME_RESULTSETPROCESSOR), "ResultEventType"));

            // Process-View-Result Method
            var updateMethod = CodegenMethod
                .MakeMethod(typeof(void), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride()
                .AddParam(typeof(EventBean[]), NAME_NEWDATA)
                .AddParam(typeof(EventBean[]), NAME_OLDDATA);
            if (numStreams == 1) {
                forge.UpdateCodegen(updateMethod, classScope);
            }
            else {
                updateMethod.Block.MethodThrowUnsupported();
            }

            // Process-Join-Result Method
            var processMethod = CodegenMethod
                .MakeMethod(typeof(void), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride()
                .AddParam(typeof(ISet<MultiKeyArrayOfKeys<EventBean>>), NAME_NEWDATA)
                .AddParam(typeof(ISet<MultiKeyArrayOfKeys<EventBean>>), NAME_OLDDATA)
                .AddParam(
                    typeof(ExprEvaluatorContext),
                    "notApplicable");
            if (numStreams == 1) {
                processMethod.Block.MethodThrowUnsupported();
            }
            else {
                forge.ProcessCodegen(processMethod, classScope);
            }

            // Stop-Method (generates last as other methods may allocate members)
            var enumeratorMethod = CodegenMethod
                .MakeMethod(
                    typeof(IEnumerator<EventBean>),
                    forge.GetType(),
                    CodegenSymbolProviderEmpty.INSTANCE,
                    classScope)
                .WithOverride();
            forge.EnumeratorCodegen(enumeratorMethod, classScope);

            // NumChangesetRows (always zero for generated code)
            var numChangesetRowsProp = CodegenProperty
                .MakePropertyNode(typeof(int), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride();
            numChangesetRowsProp.GetterBlock.BlockReturn(Constant(0));

            // OptionalOutputCondition (always null for generated code)
            var optionalOutputConditionProp = CodegenProperty
                .MakePropertyNode(typeof(OutputCondition), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride();
            optionalOutputConditionProp.GetterBlock.BlockReturn(ConstantNull());

            // Stop-Method (no action for generated code)
            CodegenMethod stopMethod = CodegenMethod
                .MakeMethod(typeof(void), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride()
                .AddParam(typeof(AgentInstanceStopServices), "svc");

            // Terminate-Method (no action for generated code)
            CodegenMethod terminatedMethod = CodegenMethod
                .MakeMethod(typeof(void), forge.GetType(), CodegenSymbolProviderEmpty.INSTANCE, classScope)
                .WithOverride();

            var innerProperties = new CodegenClassProperties();
            var innerMethods = new CodegenClassMethods();
            CodegenStackGenerator.RecursiveBuildStack(
                eventTypeGetter,
                "EventType",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                updateMethod,
                "Update",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                processMethod,
                "Process",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                enumeratorMethod,
                "GetEnumerator",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                numChangesetRowsProp,
                "NumChangesetRows",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                optionalOutputConditionProp,
                "OptionalOutputCondition",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                stopMethod,
                "Stop",
                innerMethods,
                innerProperties);
            CodegenStackGenerator.RecursiveBuildStack(
                terminatedMethod,
                "Terminated",
                innerMethods,
                innerProperties);


            var innerClass = new CodegenInnerClass(
                CLASSNAME_OUTPUTPROCESSVIEW,
                typeof(OutputProcessView),
                serviceCtor,
                Collections.GetEmptyList<CodegenTypedParam>(),
                innerMethods,
                innerProperties);
            innerClasses.Add(innerClass);
        }
Example #32
0
 /// <summary>Configure the generator to compute reverse blame (history of deletes).</summary>
 /// <remarks>
 /// Configure the generator to compute reverse blame (history of deletes).
 /// <p>
 /// This method is expensive as it immediately runs a RevWalk over the
 /// history spanning the expression
 /// <code>start..end</code>
 /// (end being more recent
 /// than start) and then performs the equivalent operation as
 /// <see cref="Push(string, NGit.AnyObjectId)">Push(string, NGit.AnyObjectId)</see>
 /// to begin blame traversal from the
 /// commit named by
 /// <code>start</code>
 /// walking forwards through history until
 /// <code>end</code>
 /// blaming line deletions.
 /// <p>
 /// A reverse blame may produce multiple sources for the same result line,
 /// each of these is a descendant commit that removed the line, typically
 /// this occurs when the same deletion appears in multiple side branches such
 /// as due to a cherry-pick. Applications relying on reverse should use
 /// <see cref="BlameResult">BlameResult</see>
 /// as it filters these duplicate sources and only
 /// remembers the first (oldest) deletion.
 /// </remarks>
 /// <param name="start">
 /// oldest commit to traverse from. The result file will be loaded
 /// from this commit's tree.
 /// </param>
 /// <param name="end">
 /// most recent commit to stop traversal at. Usually an active
 /// branch tip, tag, or HEAD.
 /// </param>
 /// <returns>
 ///
 /// <code>this</code>
 /// </returns>
 /// <exception cref="System.IO.IOException">the repository cannot be read.</exception>
 public virtual NGit.Blame.BlameGenerator Reverse(AnyObjectId start, AnyObjectId end
                                                  )
 {
     return(Reverse(start, Collections.Singleton(end.ToObjectId())));
 }
        public void GetUpdatedAssignmentGroupResults_NoNewSubmissions_ReturnsNoResults()
        {
            var section = new Section()
            {
                DisplayName = SectionName
            };
            var users       = new List <User>();
            var assignments = new List <Assignment>();
            var submissions = new List <UserQuestionSubmission>();

            var oldSnapshot = Collections.CreateList
                              (
                CreateSingleAssignmentResults
                (
                    "Unit1",
                    5.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit1", "Last1", "First1", 5.0)
                    )
                ),
                CreateSingleAssignmentResults
                (
                    "Unit2",
                    6.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit2", "Last1", "First1", 6.0)
                    )
                )
                              );

            var newSnapshot = Collections.CreateList
                              (
                CreateSingleAssignmentResults
                (
                    "Unit1",
                    5.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit1", "Last1", "First1", 5.0)
                    )
                ),
                CreateSingleAssignmentResults
                (
                    "Unit2",
                    6.0,
                    Collections.CreateList
                    (
                        CreateAssignmentGroupResult("Unit2", "Last1", "First1", 6.0)
                    )
                )
                              );

            var updatedAssignmentReportGenerator = CreateUpdatedAssignmentReportGenerator
                                                   (
                section,
                users,
                assignments,
                submissions,
                oldSnapshot,
                newSnapshot
                                                   );

            var results = updatedAssignmentReportGenerator.GetUpdatedAssignmentGroupResults
                          (
                assignments,
                users,
                section,
                GradebookName,
                DateLastTransferred,
                submissions
                          );

            Assert.Equal(0, results.AssignmentResults.Count);
        }
Example #34
0
		public override Graphics.RenderWindow NewWindow( string name, int width, int height, bool fullScreen, Collections.NamedParameterList miscParams = null )
		{
			IPhoneWindow window = new IPhoneWindow();
			window.Create( name, width, height, fullScreen, miscParams );
			return window;
		}
Example #35
0
        public virtual void testSkipTaskListenerInvocation()
        {
            ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("taskListenerProcess", "brum", Collections.singletonMap <string, object> ("listener", new RecorderTaskListener()));

            string processInstanceId = processInstance.Id;

            RecorderTaskListener.clear();

            // when I start an activity with "skip listeners" setting
            Batch modificationBatch = runtimeService.createProcessInstanceModification(processInstanceId).startBeforeActivity("task").executeAsync(true, false);

            assertNotNull(modificationBatch);
            executeSeedAndBatchJobs(modificationBatch);

            // then no listeners are invoked
            assertTrue(RecorderTaskListener.RecordedEvents.Count == 0);

            // when I cancel an activity with "skip listeners" setting
            ActivityInstance activityInstanceTree = runtimeService.getActivityInstance(processInstanceId);

            Batch batch = runtimeService.createProcessInstanceModification(processInstance.Id).cancelActivityInstance(getChildInstanceForActivity(activityInstanceTree, "task").Id).executeAsync(true, false);

            assertNotNull(batch);
            executeSeedAndBatchJobs(batch);

            // then no listeners are invoked
            assertTrue(RecorderTaskListener.RecordedEvents.Count == 0);
        }
Example #36
0
        private static void Postfix(StandardLevelDetailView __instance, ref IDifficultyBeatmap ____selectedDifficultyBeatmap, ref Button ____actionButton, ref Button ____practiceButton,
                                    ref BeatmapDifficultySegmentedControlController ____beatmapDifficultySegmentedControlController,
                                    ref BeatmapCharacteristicSegmentedControlController ____beatmapCharacteristicSegmentedControlController)
        {
            var firstSelection = false;
            var level          = ____selectedDifficultyBeatmap.level is CustomBeatmapLevel ? ____selectedDifficultyBeatmap.level as CustomPreviewBeatmapLevel : null;

            if (level != lastLevel)
            {
                firstSelection = true;
                lastLevel      = level;
            }

            ____actionButton.interactable   = true;
            ____practiceButton.interactable = true;

            RequirementsUI.instance.ButtonGlowColor    = false;
            RequirementsUI.instance.ButtonInteractable = false;
            if (level == null)
            {
                return;
            }

            var songData = Collections.RetrieveExtraSongData(Hashing.GetCustomLevelHash(level), level.customLevelPath);

            if (songData == null)
            {
                RequirementsUI.instance.ButtonGlowColor    = false;
                RequirementsUI.instance.ButtonInteractable = false;
                return;
            }

            var wipFolderSong = false;
            var selectedDiff  = ____selectedDifficultyBeatmap;
            var diffData      = Collections.RetrieveDifficultyData(selectedDiff);

            if (diffData != null)
            {
                //If no additional information is present
                if (!diffData.additionalDifficultyData._requirements.Any() &&
                    !diffData.additionalDifficultyData._suggestions.Any() &&
                    !diffData.additionalDifficultyData._warnings.Any() &&
                    !diffData.additionalDifficultyData._information.Any() &&
                    !songData.contributors.Any())
                {
                    RequirementsUI.instance.ButtonGlowColor    = false;
                    RequirementsUI.instance.ButtonInteractable = false;
                }
                else if (!diffData.additionalDifficultyData._warnings.Any())
                {
                    RequirementsUI.instance.ButtonGlowColor    = true;
                    RequirementsUI.instance.ButtonInteractable = true;
                }
                else if (diffData.additionalDifficultyData._warnings.Any())
                {
                    RequirementsUI.instance.ButtonGlowColor    = true;
                    RequirementsUI.instance.ButtonInteractable = true;
                    if (diffData.additionalDifficultyData._warnings.Contains("WIP"))
                    {
                        ____actionButton.interactable = false;
                    }
                }
            }

            if (level.levelID.EndsWith(" WIP"))
            {
                RequirementsUI.instance.ButtonGlowColor    = true;
                RequirementsUI.instance.ButtonInteractable = true;
                ____actionButton.interactable = false;
                wipFolderSong = true;
            }

            if (diffData != null)
            {
                foreach (var requirement in diffData.additionalDifficultyData._requirements)
                {
                    if (!Collections.capabilities.Contains(requirement))
                    {
                        ____actionButton.interactable              = false;
                        ____practiceButton.interactable            = false;
                        RequirementsUI.instance.ButtonGlowColor    = true;
                        RequirementsUI.instance.ButtonInteractable = true;
                    }
                }
            }

            if (selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName == "MissingCharacteristic")
            {
                ____actionButton.interactable              = false;
                ____practiceButton.interactable            = false;
                RequirementsUI.instance.ButtonGlowColor    = true;
                RequirementsUI.instance.ButtonInteractable = true;
            }

            RequirementsUI.instance.level     = level;
            RequirementsUI.instance.songData  = songData;
            RequirementsUI.instance.diffData  = diffData;
            RequirementsUI.instance.wipFolder = wipFolderSong;


            //Difficulty Label Handling
            LevelLabels.Clear();
            string currentCharacteristic = string.Empty;

            foreach (Data.ExtraSongData.DifficultyData diffLevel in songData._difficulties)
            {
                var    difficulty     = diffLevel._difficulty;
                string characteristic = diffLevel._beatmapCharacteristicName;
                if (characteristic == selectedDiff.parentDifficultyBeatmapSet.beatmapCharacteristic.serializedName)
                {
                    currentCharacteristic = characteristic;
                }

                if (!LevelLabels.ContainsKey(characteristic))
                {
                    LevelLabels.Add(characteristic, new OverrideLabels());
                }

                var charLabels = LevelLabels[characteristic];
                if (!string.IsNullOrWhiteSpace(diffLevel._difficultyLabel))
                {
                    switch (difficulty)
                    {
                    case BeatmapDifficulty.Easy:
                        charLabels.EasyOverride = diffLevel._difficultyLabel;
                        break;

                    case BeatmapDifficulty.Normal:
                        charLabels.NormalOverride = diffLevel._difficultyLabel;
                        break;

                    case BeatmapDifficulty.Hard:
                        charLabels.HardOverride = diffLevel._difficultyLabel;
                        break;

                    case BeatmapDifficulty.Expert:
                        charLabels.ExpertOverride = diffLevel._difficultyLabel;
                        break;

                    case BeatmapDifficulty.ExpertPlus:
                        charLabels.ExpertPlusOverride = diffLevel._difficultyLabel;
                        break;
                    }
                }
            }

            if (!string.IsNullOrWhiteSpace(currentCharacteristic))
            {
                SetCurrentLabels(LevelLabels[currentCharacteristic]);
            }
            else
            {
                ClearOverrideLabels();
            }

            ____beatmapDifficultySegmentedControlController.SetData(____selectedDifficultyBeatmap.parentDifficultyBeatmapSet.difficultyBeatmaps,
                                                                    ____beatmapDifficultySegmentedControlController.selectedDifficulty);
            ClearOverrideLabels();

            // TODO: Check if this whole if block is still needed
            if (songData._defaultCharacteristic != null && firstSelection)
            {
                if (____beatmapCharacteristicSegmentedControlController.selectedBeatmapCharacteristic.serializedName != songData._defaultCharacteristic)
                {
                    var chars =
                        ____beatmapCharacteristicSegmentedControlController.GetField <List <BeatmapCharacteristicSO>, BeatmapCharacteristicSegmentedControlController>("_beatmapCharacteristics");
                    var index = 0;
                    foreach (var characteristic in chars)
                    {
                        if (songData._defaultCharacteristic == characteristic.serializedName)
                        {
                            break;
                        }

                        index++;
                    }

                    if (index != chars.Count)
                    {
                        ____beatmapCharacteristicSegmentedControlController.GetField <HMUI.IconSegmentedControl, BeatmapCharacteristicSegmentedControlController>("_segmentedControl")
                        .SelectCellWithNumber(index);
                        ____beatmapCharacteristicSegmentedControlController.HandleDifficultySegmentedControlDidSelectCell(
                            ____beatmapCharacteristicSegmentedControlController.GetField <HMUI.IconSegmentedControl, BeatmapCharacteristicSegmentedControlController>("_segmentedControl"), index);
                    }
                }
            }
        }
Example #37
0
        public async Task <IActionResult> CreateAndConnect(string tablename, int tableid, int infotype, string currentpath, [Bind("Id,Firstnameauhor1,Lastnameauhor1,Firstnameauhor2,Lastnameauhor2,Firstnameauhor3,Lastnameauhor3,Furtherauthors,Publisher,Title,Location,Edition,Publicationdate,Pages")] Collections collections)
        {
            int id = new int();

            String[] url = new String[4];

            if (ModelState.IsValid)
            {
                _context.Add(collections);

                await _context.SaveChangesAsync();

                List <Collections> allentries = new List <Collections>();
                allentries = await _context.Collections.ToListAsync();

                foreach (Collections item in allentries)
                {
                    if (item == collections)
                    {
                        id = collections.Id;
                    }
                }
                var relation = new InfoSourcesInRelation {
                    Tablename = tablename, Tableid = tableid, Infotype = infotype, Infosourceid = id
                };
                _context.Add(relation);
                await _context.SaveChangesAsync();

                url = currentpath.Split('/');
                return(RedirectToAction(url[3], url[2], new { id = url[4] }));
                // return RedirectToAction("CreateAndConnect", "InfoSourcesInRelations", new { tablename = tablename, tableid = tableid, infotype = infotype, infosourceid = id, currentpath = currentpath });
            }
            return(View(collections));
        }
Example #38
0
        public void TestIt()
        {
            var NOT_EXISTS = ValueWithExistsFlag.MultipleNotExists(6);

            // Bean
            SupportBeanComplexProps beanOne = SupportBeanComplexProps.MakeDefaultBean();
            string n1_v   = beanOne.Nested.NestedValue;
            string n1_n_v = beanOne.Nested.NestedNested.NestedNestedValue;
            SupportBeanComplexProps beanTwo = SupportBeanComplexProps.MakeDefaultBean();

            beanTwo.Nested.NestedValue = "nested1";
            beanTwo.Nested.NestedNested.SetNestedNestedValue("nested2");
            var beanTests = new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>[] {
                new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot(beanOne), ValueWithExistsFlag.AllExist(n1_v, n1_v, n1_n_v, n1_n_v, n1_n_v, n1_n_v)),
                new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot(beanTwo), ValueWithExistsFlag.AllExist("nested1", "nested1", "nested2", "nested2", "nested2", "nested2")),
                new Pair <SupportBeanDynRoot, ValueWithExistsFlag[]>(new SupportBeanDynRoot("abc"), NOT_EXISTS)
            };

            RunAssertion(BEAN_TYPENAME, SupportEventInfra.FBEAN, null, beanTests, typeof(object));

            // Map
            IDictionary <string, object> mapOneL2 = new Dictionary <string, object>();

            mapOneL2.Put("nestedNestedValue", 101);
            IDictionary <string, object> mapOneL1 = new Dictionary <string, object>();

            mapOneL1.Put("nestedNested", mapOneL2);
            mapOneL1.Put("nestedValue", 100);
            IDictionary <string, object> mapOneL0 = new Dictionary <string, object>();

            mapOneL0.Put("nested", mapOneL1);
            var mapOne   = Collections.SingletonDataMap("item", mapOneL0);
            var mapTests = new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>[] {
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(mapOne, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)),
                new Pair <IDictionary <string, object>, ValueWithExistsFlag[]>(Collections.EmptyDataMap, NOT_EXISTS),
            };

            RunAssertion(SupportEventInfra.MAP_TYPENAME, SupportEventInfra.FMAP, null, mapTests, typeof(object));

            // Object-Array
            var oaOneL2 = new object[] { 101 };
            var oaOneL1 = new object[] { oaOneL2, 100 };
            var oaOneL0 = new object[] { oaOneL1 };
            var oaOne   = new object[] { oaOneL0 };
            var oaTests = new Pair <object[], ValueWithExistsFlag[]>[] {
                new Pair <object[], ValueWithExistsFlag[]>(oaOne, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)),
                new Pair <object[], ValueWithExistsFlag[]>(new object[] { null }, NOT_EXISTS),
            };

            RunAssertion(SupportEventInfra.OA_TYPENAME, SupportEventInfra.FOA, null, oaTests, typeof(object));

            // XML
            var xmlTests = new Pair <string, ValueWithExistsFlag[]>[] {
                new Pair <string, ValueWithExistsFlag[]>("<item>\n" +
                                                         "\t<nested nestedValue=\"100\">\n" +
                                                         "\t\t<nestedNested nestedNestedValue=\"101\">\n" +
                                                         "\t\t</nestedNested>\n" +
                                                         "\t</nested>\n" +
                                                         "</item>\n", ValueWithExistsFlag.AllExist("100", "100", "101", "101", "101", "101")),
                new Pair <string, ValueWithExistsFlag[]>("<item/>", NOT_EXISTS),
            };

            RunAssertion(SupportEventInfra.XML_TYPENAME, SupportEventInfra.FXML, SupportEventInfra.XML_TO_VALUE, xmlTests, typeof(XmlNode));

            // Avro
            var schema       = GetAvroSchema();
            var nestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle(
                schema.GetField("item").Schema.GetField("nested").Schema).AsRecordSchema();
            var nestedNestedSchema = AvroSchemaUtil.FindUnionRecordSchemaSingle(
                nestedSchema.GetField("nestedNested").Schema).AsRecordSchema();
            var nestedNestedDatum = new GenericRecord(nestedNestedSchema);

            nestedNestedDatum.Put("nestedNestedValue", 101);
            var nestedDatum = new GenericRecord(nestedSchema);

            nestedDatum.Put("nestedValue", 100);
            nestedDatum.Put("nestedNested", nestedNestedDatum);
            var emptyDatum = new GenericRecord(SchemaBuilder.Record(SupportEventInfra.AVRO_TYPENAME));
            var avroTests  = new Pair <object, ValueWithExistsFlag[]>[] {
                new Pair <object, ValueWithExistsFlag[]>(nestedDatum, ValueWithExistsFlag.AllExist(100, 100, 101, 101, 101, 101)),
                new Pair <object, ValueWithExistsFlag[]>(emptyDatum, NOT_EXISTS),
                new Pair <object, ValueWithExistsFlag[]>(null, NOT_EXISTS)
            };

            RunAssertion(SupportEventInfra.AVRO_TYPENAME, FAVRO, null, avroTests, typeof(object));
        }
Example #39
0
        private FilterSpecCompiled Compile(FilterStreamSpecRaw raw)
        {
            var compiled = (FilterStreamSpecCompiled)raw.Compile(SupportStatementContextFactory.MakeContext(_container), new HashSet <String>(), false, Collections.GetEmptyList <int>(), false, false, false, null);

            return(compiled.FilterSpec);
        }
Example #40
0
        /// <summary>
        /// Seals the <see cref="Index.SegmentInfo"/> for the new flushed segment and persists
        /// the deleted documents <see cref="IMutableBits"/>.
        /// </summary>
        internal virtual void SealFlushedSegment(FlushedSegment flushedSegment)
        {
            Debug.Assert(flushedSegment != null);

            SegmentCommitInfo newSegment = flushedSegment.segmentInfo;

            IndexWriter.SetDiagnostics(newSegment.Info, IndexWriter.SOURCE_FLUSH);

            IOContext context = new IOContext(new FlushInfo(newSegment.Info.DocCount, newSegment.GetSizeInBytes()));

            bool success = false;

            try
            {
                if (indexWriterConfig.UseCompoundFile)
                {
                    Collections.AddAll(filesToDelete, IndexWriter.CreateCompoundFile(infoStream, directory, CheckAbort.NONE, newSegment.Info, context));
                    newSegment.Info.UseCompoundFile = true;
                }

                // Have codec write SegmentInfo.  Must do this after
                // creating CFS so that 1) .si isn't slurped into CFS,
                // and 2) .si reflects useCompoundFile=true change
                // above:
                codec.SegmentInfoFormat.SegmentInfoWriter.Write(directory, newSegment.Info, flushedSegment.fieldInfos, context);

                // TODO: ideally we would freeze newSegment here!!
                // because any changes after writing the .si will be
                // lost...

                // Must write deleted docs after the CFS so we don't
                // slurp the del file into CFS:
                if (flushedSegment.liveDocs != null)
                {
                    int delCount = flushedSegment.delCount;
                    Debug.Assert(delCount > 0);
                    if (infoStream.IsEnabled("DWPT"))
                    {
                        infoStream.Message("DWPT", "flush: write " + delCount + " deletes gen=" + flushedSegment.segmentInfo.DelGen);
                    }

                    // TODO: we should prune the segment if it's 100%
                    // deleted... but merge will also catch it.

                    // TODO: in the NRT case it'd be better to hand
                    // this del vector over to the
                    // shortly-to-be-opened SegmentReader and let it
                    // carry the changes; there's no reason to use
                    // filesystem as intermediary here.

                    SegmentCommitInfo info  = flushedSegment.segmentInfo;
                    Codec             codec = info.Info.Codec;
                    codec.LiveDocsFormat.WriteLiveDocs(flushedSegment.liveDocs, directory, info, delCount, context);
                    newSegment.DelCount = delCount;
                    newSegment.AdvanceDelGen();
                }

                success = true;
            }
            finally
            {
                if (!success)
                {
                    if (infoStream.IsEnabled("DWPT"))
                    {
                        infoStream.Message("DWPT", "hit exception creating compound file for newly flushed segment " + newSegment.Info.Name);
                    }
                }
            }
        }
Example #41
0
 public virtual ISet <object> keySet()
 {
     return(Collections.emptySet());
 }
Example #42
0
        /// <summary>
        /// populate the items in collection.
        /// </summary>
        void PopulateCollections()
        {
            var RootNode1 = new GettingStartedModel {
                Header = "Work Documents"
            };
            var RootNode2 = new GettingStartedModel {
                Header = "Personal Folder"
            };

            var ChildNode1 = new GettingStartedModel {
                Header = "Functional Specifications"
            };
            var ChildNode2 = new GettingStartedModel {
                Header = "TreeView spec"
            };
            var ChildNode3 = new GettingStartedModel {
                Header = "Feature Schedule"
            };
            var ChildNode4 = new GettingStartedModel {
                Header = "Overall Project Plan"
            };
            var ChildNode5 = new GettingStartedModel {
                Header = "Feature Resource Allocation"
            };
            var ChildNode6 = new GettingStartedModel {
                Header = "Home Remodel Folder"
            };
            var ChildNode7 = new GettingStartedModel {
                Header = "Contractor Contact Info"
            };
            var ChildNode8 = new GettingStartedModel {
                Header = "Paint Color Scheme"
            };
            var ChildNode9 = new GettingStartedModel {
                Header = "Flooring Woodgrain type"
            };
            var ChildNode10 = new GettingStartedModel {
                Header = "Kitchen Cabinet Style"
            };

            var ChildNode11 = new GettingStartedModel {
                Header = "My Network Places"
            };
            var ChildNode12 = new GettingStartedModel {
                Header = "Server"
            };
            var ChildNode13 = new GettingStartedModel {
                Header = "My Folders"
            };

            var ChildNode14 = new GettingStartedModel {
                Header = "My Computer"
            };
            var ChildNode15 = new GettingStartedModel {
                Header = "Music"
            };
            var ChildNode16 = new GettingStartedModel {
                Header = "Videos"
            };
            var ChildNode17 = new GettingStartedModel {
                Header = "Wallpaper.png"
            };
            var ChildNode18 = new GettingStartedModel {
                Header = "My Banner.png"
            };



            var ChildNode19 = new GettingStartedModel {
                Header = "Favourites"
            };
            var ChildNode20 = new GettingStartedModel {
                Header = "Image3.png"
            };
            var ChildNode21 = new GettingStartedModel {
                Header = "Image4.png"
            };
            var ChildNode22 = new GettingStartedModel {
                Header = "Image5.png"
            };

            var ChildNode23 = new GettingStartedModel {
                Header = "Image1.png"
            };
            var ChildNode24 = new GettingStartedModel {
                Header = "Image2.png"
            };

            RootNode1.Childs.Add(ChildNode1);
            RootNode1.Childs.Add(ChildNode3);
            RootNode1.Childs.Add(ChildNode4);
            RootNode1.Childs.Add(ChildNode5);
            RootNode2.Childs.Add(ChildNode6);

            RootNode2.Childs.Add(ChildNode11);
            RootNode2.Childs.Add(ChildNode14);
            RootNode2.Childs.Add(ChildNode19);

            ChildNode1.Childs.Add(ChildNode2);
            ChildNode6.Childs.Add(ChildNode7);
            ChildNode6.Childs.Add(ChildNode8);
            ChildNode6.Childs.Add(ChildNode9);
            ChildNode6.Childs.Add(ChildNode10);
            ChildNode11.Childs.Add(ChildNode12);
            ChildNode11.Childs.Add(ChildNode13);

            ChildNode11.Childs.Add(ChildNode23);
            ChildNode11.Childs.Add(ChildNode24);

            ChildNode14.Childs.Add(ChildNode15);
            ChildNode14.Childs.Add(ChildNode16);
            ChildNode14.Childs.Add(ChildNode17);
            ChildNode14.Childs.Add(ChildNode18);

            ChildNode19.Childs.Add(ChildNode20);
            ChildNode19.Childs.Add(ChildNode21);
            ChildNode19.Childs.Add(ChildNode22);

            SelectedNodes = new ObservableCollection <object>();
            SelectedNodes.Add(ChildNode1);
            SelectedNodes.Add(ChildNode4);
            SelectedNodes.Add(ChildNode8);
            Collections.Add(RootNode1);
            Collections.Add(RootNode2);
        }
Example #43
0
        private void dgEvaluaciones_Loaded(List <Area> areaspc)
        {
            Collections col = new Collections();

            List <Area>          areas           = col.ReadAllAreas();
            List <Competencia>   competencias    = col.ReadAllCompetencias();/**//**/
            List <float>         brechas         = new List <float>();
            List <PerfildeCargo> perfilesdecargo = new List <PerfildeCargo>();

            //Calcular cantidad máxima de notas, para definir el ancho de la tabla
            int nbrechas = 0;

            foreach (Area a in areas)
            {
                foreach (Area item in areaspc)
                {
                    if (a.ID_AREA == item.ID_AREA)
                    {
                        foreach (Competencia com in competencias)
                        {
                            brechas = col.ObtenerNotasCompetencia((int)a.ID_AREA, (int)com.ID_COMPETENCIA);/**//**/
                            if (brechas.Count > nbrechas)
                            {
                                nbrechas = brechas.Count;
                            }
                        }
                    }
                }
            }

            //dar formato a la tabla
            DataTable  table = new DataTable();
            DataColumn column;

            column            = table.Columns.Add();
            column.ColumnName = "Cargo";
            column.DataType   = typeof(string);

            column            = table.Columns.Add();
            column.ColumnName = "Competencia";
            column.DataType   = typeof(string);
            if (nbrechas > 0)
            {
                for (int i = 0; i < nbrechas; i++)
                {
                    column            = table.Columns.Add();
                    column.ColumnName = "N" + (i + 1);
                    column.DataType   = typeof(string);
                }
            }
            column            = table.Columns.Add();
            column.ColumnName = "Brecha Promedio";
            column.DataType   = typeof(string);
            //Final formato tabla

            //Listar resultados en la tabla
            DataRow row;
            float   sumabrechas = 0;

            foreach (Area a in areas)
            {
                foreach (Area item in areaspc)
                {
                    if (a.ID_AREA == item.ID_AREA)
                    {
                        foreach (Competencia com in competencias)
                        {
                            sumabrechas = 0;
                            brechas     = col.ObtenerNotasCompetencia((int)a.ID_AREA, (int)com.ID_COMPETENCIA);/**//**/
                            if (brechas.Count > 0)
                            {
                                row                = table.NewRow();
                                row["Cargo"]       = a.NOMBRE;
                                row["Competencia"] = com.NOMBRE;
                                for (int i = 0; i < brechas.Count; i++)
                                {
                                    row["N" + (i + 1)] = brechas[i];
                                    sumabrechas        = brechas[i] + sumabrechas;
                                }
                                float brpromedio = sumabrechas / brechas.Count;
                                row["Brecha Promedio"] = brpromedio.ToString("0.0");
                                if (bajonivelesperado == true && Convert.ToDecimal(brpromedio) < com.NIVEL_OPTIMO_ESPERADO)
                                {
                                    table.Rows.Add(row);
                                }
                                if (bajonivelesperado == false)
                                {
                                    table.Rows.Add(row);
                                }
                            }
                        }
                    }
                }
            }

            dgEvaluaciones.ItemsSource = table.AsDataView();
        }
        public virtual TokenInfoDictionaryWriter BuildDictionary(IList<string> csvFiles)
        {
            TokenInfoDictionaryWriter dictionary = new TokenInfoDictionaryWriter(10 * 1024 * 1024);

            // all lines in the file
            Console.WriteLine("  parse...");
            List<string[]> lines = new List<string[]>(400000);
            foreach (string file in csvFiles)
            {
                using (Stream inputStream = new FileStream(file, FileMode.Open, FileAccess.Read))
                {
                    Encoding decoder = Encoding.GetEncoding(encoding);
                    TextReader reader = new StreamReader(inputStream, decoder);

                    string line = null;
                    while ((line = reader.ReadLine()) != null)
                    {
                        string[] entry = CSVUtil.Parse(line);

                        if (entry.Length < 13)
                        {
                            Console.WriteLine("Entry in CSV is not valid: " + line);
                            continue;
                        }

                        string[] formatted = FormatEntry(entry);
                        lines.Add(formatted);

                        // NFKC normalize dictionary entry
                        if (normalizeEntries)
                        {
                            //if (normalizer.isNormalized(entry[0])){
                            if (entry[0].IsNormalized(NormalizationForm.FormKC))
                            {
                                continue;
                            }
                            string[] normalizedEntry = new string[entry.Length];
                            for (int i = 0; i < entry.Length; i++)
                            {
                                //normalizedEntry[i] = normalizer.normalize(entry[i]);
                                normalizedEntry[i] = entry[i].Normalize(NormalizationForm.FormKC);
                            }

                            formatted = FormatEntry(normalizedEntry);
                            lines.Add(formatted);
                        }
                    }
                }
            }

            Console.WriteLine("  sort...");

            // sort by term: we sorted the files already and use a stable sort.
            lines.Sort(new ComparerAnonymousHelper());

            Console.WriteLine("  encode...");

            PositiveInt32Outputs fstOutput = PositiveInt32Outputs.Singleton;
            Builder<long?> fstBuilder = new Builder<long?>(Lucene.Net.Util.Fst.FST.INPUT_TYPE.BYTE2, 0, 0, true, true, int.MaxValue, fstOutput, null, true, PackedInt32s.DEFAULT, true, 15);
            Int32sRef scratch = new Int32sRef();
            long ord = -1; // first ord will be 0
            string lastValue = null;

            // build tokeninfo dictionary
            foreach (string[] entry in lines)
            {
                int next = dictionary.Put(entry);

                if (next == offset)
                {
                    Console.WriteLine("Failed to process line: " + Collections.ToString(entry));
                    continue;
                }

                string token = entry[0];
                if (!token.Equals(lastValue, StringComparison.Ordinal))
                {
                    // new word to add to fst
                    ord++;
                    lastValue = token;
                    scratch.Grow(token.Length);
                    scratch.Length = token.Length;
                    for (int i = 0; i < token.Length; i++)
                    {
                        scratch.Int32s[i] = (int)token[i];
                    }
                    fstBuilder.Add(scratch, ord);
                }
                dictionary.AddMapping((int)ord, offset);
                offset = next;
            }

            FST<long?> fst = fstBuilder.Finish();

            Console.WriteLine("  " + fst.NodeCount + " nodes, " + fst.ArcCount + " arcs, " + fst.GetSizeInBytes() + " bytes...  ");
            dictionary.SetFST(fst);
            Console.WriteLine(" done");

            return dictionary;
        }
Example #45
0
        public virtual void shouldAuthorizeSetRemovalTimeForHistoricBatchesBatch()
        {
            // given
            string batchId = engineRule.HistoryService.deleteHistoricProcessInstancesAsync(Collections.singletonList(processInstance.Id), "aDeleteReason").Id;

            authRule.init(scenario).withUser("userId").bindResource("batchId", "*").start();

            HistoricBatchQuery query = historyService.createHistoricBatchQuery().batchId(batchId);

            // when
            historyService.setRemovalTimeToHistoricBatches().absoluteRemovalTime(DateTime.Now).byQuery(query).executeAsync();

            // then
            authRule.assertScenario(scenario);

            // clear database
            managementService.deleteBatch(batchId, true);
        }
Example #46
0
 // TODO: add support for WikipediaTokenizer's advanced options.
 public override Tokenizer Create(AttributeSource.AttributeFactory factory, TextReader input)
 {
     return(new WikipediaTokenizer(factory, input, WikipediaTokenizer.TOKENS_ONLY, Collections.EmptyList <string>()));
 }
		public void InitializeCultureFormatList(Collections.SelectableListNodeList list)
		{
			GuiHelper.Initialize(_guiCultures, list);
		}
Example #48
0
        // **** Sets up member variables related to camera ****
        private void SetUpCameraOutputs(int width, int height)
        {
            var activity = Activity;
            var manager  = (CameraManager)activity.GetSystemService(Context.CameraService);

            try
            {
                // Loop through all of the cameras
                for (var i = 0; i < manager.GetCameraIdList().Length; i++)
                {
                    var cameraId = manager.GetCameraIdList()[i];
                    CameraCharacteristics characteristics = manager.GetCameraCharacteristics(cameraId);

                    // We don't want the front facing camera. This is for selfies.
                    var facing = (Integer)characteristics.Get(CameraCharacteristics.LensFacing);
                    if (facing != null && facing == (Integer.ValueOf((int)LensFacing.Front)))
                    {
                        continue;
                    }

                    // This returns the sizes of the previews
                    // We neded to match this with our screen
                    var map = (StreamConfigurationMap)characteristics.Get(CameraCharacteristics.ScalerStreamConfigurationMap);
                    if (map == null)
                    {
                        continue;
                    }

                    // For still image captures, we use the largest available size.
                    Size largest = (Size)Collections.Max(Arrays.AsList(map.GetOutputSizes((int)ImageFormatType.Jpeg)),
                                                         new CompareSizesByArea());

                    mImageReader = ImageReader.NewInstance(largest.Width, largest.Height, ImageFormatType.Jpeg, /*maxImages*/ 2);
                    mImageReader.SetOnImageAvailableListener(mOnImageAvailableListener, mBackgroundHandler);

                    // Find out if we need to swap dimensions to get the preview size relative to the sensor
                    // coordinate.
                    var displayRotation = activity.WindowManager.DefaultDisplay.Rotation;
                    //noinspection ConstantConditions
                    mSensorOrientation = (int)characteristics.Get(CameraCharacteristics.SensorOrientation);
                    bool swappedDimensions = false;
                    switch (displayRotation)
                    {
                    case SurfaceOrientation.Rotation0:
                    case SurfaceOrientation.Rotation180:
                        if (mSensorOrientation == 90 || mSensorOrientation == 270)
                        {
                            swappedDimensions = true;
                        }
                        break;

                    case SurfaceOrientation.Rotation90:
                    case SurfaceOrientation.Rotation270:
                        if (mSensorOrientation == 0 || mSensorOrientation == 180)
                        {
                            swappedDimensions = true;
                        }
                        break;

                    default:
                        Log.Error(TAG, "Display rotation is invalid: " + displayRotation);
                        break;
                    }

                    Point displaySize = new Point();
                    activity.WindowManager.DefaultDisplay.GetSize(displaySize);
                    var rotatedPreviewWidth  = width;
                    var rotatedPreviewHeight = height;
                    var maxPreviewWidth      = displaySize.X;
                    var maxPreviewHeight     = displaySize.Y;

                    if (swappedDimensions)
                    {
                        rotatedPreviewWidth  = height;
                        rotatedPreviewHeight = width;
                        maxPreviewWidth      = displaySize.Y;
                        maxPreviewHeight     = displaySize.X;
                    }

                    if (maxPreviewWidth > MAX_PREVIEW_WIDTH)
                    {
                        maxPreviewWidth = MAX_PREVIEW_WIDTH;
                    }

                    if (maxPreviewHeight > MAX_PREVIEW_HEIGHT)
                    {
                        maxPreviewHeight = MAX_PREVIEW_HEIGHT;
                    }

                    // Danger, W.R.! Attempting to use too large a preview size could exceed the camera
                    // bus's bandwidth limitation, resulting in gorgeous previews but the storage of
                    // garbage capture data.
                    mPreviewSize = ChooseOptimalSize(map.GetOutputSizes(Class.FromType(typeof(SurfaceTexture))),
                                                     rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth,
                                                     maxPreviewHeight, largest);

                    // We fit the aspect ratio of TextureView to the size of the preview we picked.
                    var orientation = Resources.Configuration.Orientation;
                    if (orientation == Orientation.Landscape)
                    {
                        mTextureView.SetAspectRatio(mPreviewSize.Width, mPreviewSize.Height);
                    }
                    else
                    {
                        mTextureView.SetAspectRatio(mPreviewSize.Height, mPreviewSize.Width);
                    }

                    // Check if the flash is supported.
                    var available = (Boolean)characteristics.Get(CameraCharacteristics.FlashInfoAvailable);
                    if (available == null)
                    {
                        mFlashSupported = false;
                    }
                    else
                    {
                        mFlashSupported = (bool)available;
                    }

                    mCameraId = cameraId;
                    return;
                }
            }
            catch (CameraAccessException e)
            {
                e.PrintStackTrace();
            }
            catch (NullPointerException e)
            {
                string exception = e.ToString();
                // Currently an NPE is thrown when the Camera2API is used but not supported on the
                // device this code runs.
                ErrorDialog.NewInstance(GetString(Resource.String.camera_error)).Show(ChildFragmentManager, FRAGMENT_DIALOG);
            }
        }
Example #49
0
        int BuildHtml(
            List<ListViewItem> in_items,
            List<ListViewItem> outof_items,
            out List<string> filenames,
            out string strError)
        {
            strError = "";
            int nRet = 0;

            Hashtable macro_table = new Hashtable();

            string strNamePath = "inventory_printoption";

            // 获得打印参数
            PrintOption option = new ItemHandoverPrintOption(this.MainForm.DataDir,
                this.comboBox_load_type.Text);
            option.LoadData(this.MainForm.AppInfo,
                strNamePath);

            macro_table["%date%"] = DateTime.Now.ToLongDateString();

            macro_table["%barcodefilepath%"] = "";
            macro_table["%barcodefilename%"] = "";
            macro_table["%recpathfilepath%"] = "";
            macro_table["%recpathfilename%"] = "";

            if (this.SourceStyle == "barcodefile")
            {
                macro_table["%barcodefilepath%"] = this.BarcodeFilePath;
                macro_table["%barcodefilename%"] = Path.GetFileName(this.BarcodeFilePath);
            }
            else if (this.SourceStyle == "recpathfile")
            {
                macro_table["%recpathfilepath%"] = this.RecPathFilePath;
                macro_table["%recpathfilename%"] = Path.GetFileName(this.RecPathFilePath);
            }

            filenames = new List<string>();    // 这个数组存放了所有文件名

            string strFileNamePrefix = this.MainForm.DataDir + "\\~inventory";

            string strFileName = "";

            Collections in_cols = new Collections();
            Collections out_cols = new Collections();
            // 统计集合
            nRet = Count(in_items,
                ref in_cols,
                out strError);
            if (nRet == -1)
                return -1;

            // 统计集合
            nRet = Count(outof_items,
                ref out_cols,
                out strError);
            if (nRet == -1)
                return -1;

            // 输出统计信息页
            {
                macro_table["%scancount%"] = (in_cols.Scaned.Count + out_cols.DataBorrowed.Count + out_cols.DataOnShelf.Count).ToString();
                macro_table["%incount%"] = in_items.Count.ToString();

                macro_table["%borrowedcount%"] = in_cols.Borrowed.Count.ToString();
                macro_table["%onshelfcount%"] = in_cols.OnShelf.Count.ToString();
                macro_table["%notreturncount%"] = in_cols.OnShelfBorrowed.Count.ToString();
                macro_table["%lostcount%"] = in_cols.Lost.Count.ToString();
                macro_table["%outcount%"] = outof_items.Count.ToString();

                macro_table["%datadir%"] = this.MainForm.DataDir;   // 便于引用datadir下templates目录内的某些文件
                macro_table["%cssfilepath%"] = this.GetAutoCssUrl(option, "itemhandover.css");  // 便于引用服务器端或“css”模板的CSS文件

                strFileName = strFileNamePrefix + "0" + ".html";

                filenames.Add(strFileName);

                string strTemplateFilePath = option.GetTemplatePageFilePath("统计页");
                    string strContent = "";
                if (String.IsNullOrEmpty(strTemplateFilePath) == true)
                    strContent = @"<html>
<head>
	<LINK href='%cssfilepath%' type='text/css' rel='stylesheet'>
</head>
<body>
	<div class='pageheader'>%date% 盘点概况</div>
	<div class='tabletitle'>%date% 盘点概况 -- %barcodefilepath%</div>
	<div class='scancount'>数据采集册数: %scancount%</div>
	<div class='sepline'><hr/></div>
	<div class='incount'>集合内册数: %incount%</div>
	<div class='borrowedcount'>借出册数: %borrowedcount%</div>
	<div class='onshelfcount'>在架册数: %onshelfcount%</div>
	<div class='notreturncount'>在架错为外借册数: %notreturncount%</div>
	<div class='lostcount'>丢失册数: %lostcount%</div>
	<div class='sepline'><hr/></div>
	<div class='outcount'>集合外册数: %outcount%</div>
	<div class='sepline'><hr/></div>
	<div class='pagefooter'></div>
</body>
</html>";
                else
                {
                    // 根据模板打印
                    // 能自动识别文件内容的编码方式的读入文本文件内容模块
                    // return:
                    //      -1  出错
                    //      0   文件不存在
                    //      1   文件存在
                    nRet = Global.ReadTextFileContent(strTemplateFilePath,
                        out strContent,
                        out strError);
                    if (nRet == -1)
                        return -1;
                }

                string strResult = StringUtil.MacroString(macro_table,
                        strContent);
                    StreamUtil.WriteText(strFileName,
                        strResult);

            }

#if NO
            // 表格页循环
            for (int i = 0; i < nTablePageCount; i++)
            {
                macro_table["%pageno%"] = (i + 1 + 1).ToString();

                strFileName = strFileNamePrefix + (i + 1).ToString() + ".html";

                filenames.Add(strFileName);

                BuildPageTop(option,
                    macro_table,
                    strFileName,
                    true);
                // 行循环
                for (int j = 0; j < option.LinesPerPage; j++)
                {
                    BuildTableLine(option,
                        in_items,
                        strFileName, i, j);
                }

                BuildPageBottom(option,
                    macro_table,
                    strFileName,
                    true);
            }

            /*
            for (int i = 0; i < this.listView_in.Items.Count; i++)
            {

            }
             * */
#endif

            return 0;
        }
Example #50
0
 public UnregisterDeploymentCmd(string deploymentId) : this(Collections.singleton(deploymentId))
 {
 }
 void Roles_ItemsRemoved(object sender, Collections.CollectionItemsChangedEventArgs<Collections.IndexedItem<Role>> e) {
   foreach (var u in e.Items) {
     Content.DeleteRoleAsync(u.Value, PluginInfrastructure.ErrorHandling.ShowErrorDialog);
   }
 }
        public void TestSchemaObjectArray()
        {
            _epService.EPAdministrator.CreateEPL("create objectarray schema MyEvent(p0 string, p1 long)");

            RunAssertionOA(false);
            RunAssertionOA(true);

            // test collector
            _epService.EPAdministrator.CreateEPL("create dataflow MyDataFlowOne " +
                                                 "EventBusSource -> ReceivedStream<MyEvent> {filter: p0 like 'A%'} " +
                                                 "DefaultSupportCaptureOp(ReceivedStream) {}");

            MyCollector                    collector = new MyCollector();
            DefaultSupportCaptureOp        future    = new DefaultSupportCaptureOp();
            EPDataFlowInstantiationOptions options   = new EPDataFlowInstantiationOptions()
                                                       .OperatorProvider(new DefaultSupportGraphOpProvider(future))
                                                       .ParameterProvider(new DefaultSupportGraphParamProvider(Collections.SingletonDataMap("collector", collector)));

            EPDataFlowInstance instance = _epService.EPRuntime.DataFlowRuntime.Instantiate("MyDataFlowOne", options);

            instance.Start();

            _epService.EPRuntime.SendEvent(new Object[] { "B", 100L }, "MyEvent");
            Thread.Sleep(50);
            Assert.IsNull(collector.GetLast());

            _epService.EPRuntime.SendEvent(new Object[] { "A", 101L }, "MyEvent");
            future.WaitForInvocation(100, 1);
            Assert.NotNull(collector.GetLast().Emitter);
            Assert.AreEqual("MyEvent", collector.GetLast().Event.EventType.Name);
            Assert.AreEqual(false, collector.GetLast().IsSubmitEventBean);
        }
Example #53
0
		/// <summary>
		/// Overrides to recover by last sample's index instead.
		/// </summary>
		/// <param name="renderer"></param>
		/// <param name="options"></param>
		protected override void Reconfigure( string renderer, Collections.NameValuePairList options )
		{
			this.LastViewCategory = this.CategoryMenu.SelectionIndex;
			this.LastViewTitle = this.SampleMenu.SelectionIndex;
			this.LastSampleIndex = -1;
			int index = -1;
			foreach ( Sample i in this.LoadedSamples )
			{
				index++;
				if ( i == CurrentSample )
				{
					this.LastSampleIndex = index;
					break;
				}
			}
			base.Reconfigure( renderer, options );
		}
 private void EffectPools_ItemRemoved(object sender, Collections.ObservableCollectionEventArgs<EffectPool> e)
 {
     RemoveEffectPool(e.Item);
 }
Example #55
0
 /// <exception cref="System.IO.IOException"/>
 public override void CacheGroupsAdd(IList <string> groups)
 {
     Log.Info("Adding " + groups + " to groups.");
     Collections.AddAll(allGroups, groups);
 }
Example #56
0
        private void AddMapEventType()
        {
            var top = Collections.SingletonDataMap("item", typeof(IDictionary <string, object>));

            _epService.EPAdministrator.Configuration.AddEventType(SupportEventInfra.MAP_TYPENAME, top);
        }
 private void effectPool_EffectRemoved(object sender, Collections.ObservableCollectionEventArgs<Effect> e)
 {
     RemoveEffect(e.Item);
 }
Example #58
0
        static PortugueseContractionUtility()
        {
            IDictionary <string, string> elems = new Dictionary <string, string>();

            // 103 CONTRACTIONS.
            elems["a+a"]            = "\u00e0";
            elems["a+as"]           = "\u00e0s";
            elems["a+aquele"]       = "\u00e0quele";
            elems["a+aqueles"]      = "\u00e0queles";
            elems["a+aquela"]       = "\u00e0quela";
            elems["a+aquelas"]      = "\u00e0quelas";
            elems["a+aquilo"]       = "\u00e0quilo";
            elems["a+o"]            = "ao";
            elems["a+os"]           = "aos";
            elems["com+mim"]        = "comigo";
            elems["com+n\u00f2s"]   = "conosco";
            elems["com+si"]         = "consigo";
            elems["com+ti"]         = "contigo";
            elems["com+v\u00f2s"]   = "convosco";
            elems["de+a\u00ed"]     = "da\u00ed";
            elems["de+algu\u00e9m"] = "dalgu\u00e9m";
            elems["de+algum"]       = "dalgum";
            elems["de+alguma"]      = "dalguma";
            elems["de+alguns"]      = "dalguns";
            elems["de+algumas"]     = "dalgumas";
            elems["de+ali"]         = "dali";
            elems["de+aqu\u00e9m"]  = "daqu\u00e9m";
            elems["de+aquele"]      = "daquele";
            elems["de+aquela"]      = "daquela";
            elems["de+aqueles"]     = "daqueles";
            elems["de+aquelas"]     = "daquelas";
            elems["de+aqui"]        = "daqui";
            elems["de+aquilo"]      = "daquilo";
            elems["de+ele"]         = "dele";
            elems["de+ela"]         = "dela";
            elems["de+eles"]        = "deles";
            elems["de+elas"]        = "delas";
            elems["de+entre"]       = "dentre";
            elems["de+esse"]        = "desse";
            elems["de+essa"]        = "dessa";
            elems["de+esses"]       = "desses";
            elems["de+essas"]       = "dessas";
            elems["de+este"]        = "deste";
            elems["de+esta"]        = "desta";
            elems["de+estes"]       = "destes";
            elems["de+estas"]       = "destas";
            elems["de+isso"]        = "disso";
            elems["de+isto"]        = "disto";
            elems["de+o"]           = "do";
            elems["de+a"]           = "da";
            elems["de+os"]          = "dos";
            elems["de+as"]          = "das";
            elems["de+outrem"]      = "doutrem";
            elems["de+outro"]       = "doutro";
            elems["de+outra"]       = "doutra";
            elems["de+outros"]      = "doutros";
            elems["de+outras"]      = "doutras";
            elems["de+um"]          = "dum";
            elems["de+uma"]         = "duma";
            elems["de+uns"]         = "duns";
            elems["de+umas"]        = "dumas";
            elems["esse+outro"]     = "essoutro";
            elems["essa+outra"]     = "essoutra";
            elems["este+outro"]     = "estoutro";
            elems["este+outra"]     = "estoutra";
            elems["ele+o"]          = "lho";
            elems["ele+a"]          = "lha";
            elems["ele+os"]         = "lhos";
            elems["ele+as"]         = "lhas";
            elems["em+algum"]       = "nalgum";
            elems["em+alguma"]      = "nalguma";
            elems["em+alguns"]      = "nalguns";
            elems["em+algumas"]     = "nalgumas";
            elems["em+aquele"]      = "naquele";
            elems["em+aquela"]      = "naquela";
            elems["em+aqueles"]     = "naqueles";
            elems["em+aquelas"]     = "naquelas";
            elems["em+aquilo"]      = "naquilo";
            elems["em+ele"]         = "nele";
            elems["em+ela"]         = "nela";
            elems["em+eles"]        = "neles";
            elems["em+elas"]        = "nelas";
            elems["em+esse"]        = "nesse";
            elems["em+essa"]        = "nessa";
            elems["em+esses"]       = "nesses";
            elems["em+essas"]       = "nessas";
            elems["em+este"]        = "neste";
            elems["em+esta"]        = "nesta";
            elems["em+estes"]       = "nestes";
            elems["em+estas"]       = "nestas";
            elems["em+isso"]        = "nisso";
            elems["em+isto"]        = "nisto";
            elems["em+o"]           = "no";
            elems["em+a"]           = "na";
            elems["em+os"]          = "nos";
            elems["em+as"]          = "nas";
            elems["em+outro"]       = "noutro";
            elems["em+outra"]       = "noutra";
            elems["em+outros"]      = "noutros";
            elems["em+outras"]      = "noutras";
            elems["em+um"]          = "num";
            elems["em+uma"]         = "numa";
            elems["em+uns"]         = "nuns";
            elems["em+umas"]        = "numas";
            elems["por+o"]          = "pelo";
            elems["por+a"]          = "pela";
            elems["por+os"]         = "pelos";
            elems["por+as"]         = "pelas";
            elems["para+a"]         = "pra";
            elems["para+o"]         = "pro";
            elems["para+as"]        = "pras";
            elems["para+os"]        = "pros";
            CONTRACTIONS            = Collections.unmodifiableMap(elems);
        }
		public void ComboBox_Initialize(Collections.SelectableListNodeList items, Collections.SelectableListNode defaultItem)
		{
			_cbComboBox.ItemsSource = null;
			_cbComboBox.ItemsSource = items;
			_cbComboBox.SelectedItem = defaultItem;
		}
Example #60
0
 /// <summary>
 /// Creates a new instance of the <see cref="WikipediaTokenizer"/>. Attaches the
 /// <paramref name="input"/> to a newly created JFlex scanner.
 /// </summary>
 /// <param name="input"> The Input <see cref="TextReader"/> </param>
 public WikipediaTokenizer(TextReader input)
     : this(input, TOKENS_ONLY, Collections.EmptySet <string>())
 {
 }