Esempio n. 1
0
    /// <summary>
    /// Initializes a new instance of the <see cref="FSMView"/> class.
    /// </summary>
    public FSMView()
    {
      this.InitializeComponent();

      this.currentOptionGraph = GraphOptions.Uninitialized;
      this.currentOption = MachineOptions.Uninitialized;
      this.EnableOrDisableMachineOptions();
      this.EnableOrDisableGraphOptions();
    }
 public void BuildPayload_Should_Use_Defaults()
 {
     var options = new GraphOptions();
     var payload1 = options.BuildPayload(new SimpleGraphStatement("g.V()"));
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("gremlin-groovy"), payload1["graph-language"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("g"), payload1["graph-source"]);
     var payload2 = options.BuildPayload(new SimpleGraphStatement("g.V()"));
     Assert.AreSame(payload1, payload2);
 }
 private static DseSession NewInstance(ISession coreSession, GraphOptions graphOptions = null)
 {
     //Cassandra Configuration does not have a public constructor
     //Create a dummy Cluster instance
     using (var cluster = DseCluster.Builder().AddContactPoint("127.0.0.1")
         .WithGraphOptions(graphOptions ?? new GraphOptions()).Build())
     {
         return new DseSession(coreSession, cluster.Configuration);   
     }
 }
 public void Should_Build_A_Cluster_With_Graph_Options()
 {
     var graphOptions = new GraphOptions();
     IDseCluster cluster = DseCluster.Builder()
         .WithGraphOptions(graphOptions)
         .AddContactPoint("192.168.1.159")
         .Build();
     Assert.NotNull(cluster.Configuration);
     Assert.NotNull(cluster.Configuration.CassandraConfiguration);
     Assert.AreSame(graphOptions, cluster.Configuration.GraphOptions);
 }
 /// <summary>
 /// Creates a new instance of <see cref="DseConfiguration"/>.
 /// </summary>
 public DseConfiguration(Configuration cassandraConfiguration, GraphOptions graphOptions)
 {
     if (cassandraConfiguration == null)
     {
         throw new ArgumentNullException("cassandraConfiguration");
     }
     if (graphOptions == null)
     {
         throw new ArgumentNullException("graphOptions");
     }
     CassandraConfiguration = cassandraConfiguration;
     GraphOptions = graphOptions;
 }
 public void BuildPayload_Should_Not_Use_Default_Name_When_IsSystemQuery()
 {
     var options = new GraphOptions()
         .SetName("graph1");
     var payload1 = options.BuildPayload(new SimpleGraphStatement("g.V()").SetSystemQuery());
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("gremlin-groovy"), payload1["graph-language"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("g"), payload1["graph-source"]);
     Assert.False(payload1.ContainsKey("graph-name"));
     var payload2 = options.BuildPayload(new SimpleGraphStatement("g.V()").SetSystemQuery());
     var payload3 = options.BuildPayload(new SimpleGraphStatement("g.V()"));
     Assert.AreNotSame(payload1, payload2);
     Assert.AreNotSame(payload2, payload3);
 }
 public void BuildPayload_Should_Use_Statement_Options_When_Defined()
 {
     var options = new GraphOptions()
         .SetSource("source1");
     var payload1 = options.BuildPayload(new SimpleGraphStatement("g.V()")
         .SetGraphName("graph2"));
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("gremlin-groovy"), payload1["graph-language"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("source1"), payload1["graph-source"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("graph2"), payload1["graph-name"]);
     var payload2 = options.BuildPayload(new SimpleGraphStatement("g.V()")
         .SetGraphName("graph2"));
     Assert.AreNotSame(payload1, payload2);
 }
 public void BuildPayload_Should_Override_Default_When_Defined()
 {
     var options = new GraphOptions()
         .SetLanguage("lang1")
         .SetName("graph1")
         .SetSource("source1");
     var payload1 = options.BuildPayload(new SimpleGraphStatement("g.V()"));
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("lang1"), payload1["graph-language"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("source1"), payload1["graph-source"]);
     CollectionAssert.AreEqual(Encoding.UTF8.GetBytes("graph1"), payload1["graph-name"]);
     var payload2 = options.BuildPayload(new SimpleGraphStatement("g.V()"));
     Assert.AreSame(payload1, payload2);
 }
 internal override IStatement GetIStatement(GraphOptions options)
 {
     string jsonParams = null;
     if (_valuesDictionary != null)
     {
         jsonParams = JsonConvert.SerializeObject(_valuesDictionary);
     }
     else if (_values != null)
     {
         jsonParams = JsonConvert.SerializeObject(_values);
     }
     IStatement stmt;
     if (jsonParams != null)
     {
         stmt = new TargettedSimpleStatement(_query, jsonParams);
     }
     else
     {
         stmt = new TargettedSimpleStatement(_query);
     }
     //Set Cassandra.Statement properties
     if (Timestamp != null)
     {
         stmt.SetTimestamp(Timestamp.Value);
     }
     var readTimeout = ReadTimeoutMillis != 0 ? ReadTimeoutMillis : options.ReadTimeoutMillis;
     if (readTimeout <= 0)
     {
         // Infinite (-1) is not supported in the core driver, set an arbitrarily large int
         readTimeout = int.MaxValue;
     }
     return stmt
         .SetIdempotence(false)
         .SetConsistencyLevel(ConsistencyLevel)
         .SetReadTimeoutMillis(readTimeout)
         .SetOutgoingPayload(options.BuildPayload(this));
 }
 /// <summary>
 /// Sets the DSE Graph options.
 /// </summary>
 /// <returns>this instance</returns>
 public DseClusterBuilder WithGraphOptions(GraphOptions options)
 {
     GraphOptions = options;
     return(this);
 }
Esempio n. 11
0
        public Dictionary <int, Dictionary <double, GameObject> > GenerateMedals(List <GameObject> yParents, List <GameObject> xParents, Transform medalContentHolder, GraphOptions currentGraphOptions /*, MedalFilterManager filters*/)
        {
            var medals = new Dictionary <int, Dictionary <double, GameObject> >();

            //var queryMedals = MedalManager.Medals.Where(x => filters.Tiers.Contains(x.Value.Tier) && x.Value.GuiltMultiplierHigh <= filters.HighRange && x.Value.GuiltMultiplierLow <= filters.HighRange
            //                                                                                      && x.Value.GuiltMultiplierLow >= filters.LowRange && x.Value.GuiltMultiplierHigh >= filters.LowRange);

            foreach (var kv in MedalManager.Medals.OrderBy(x => x.Value.GuiltMultiplierLow))
            {
                var medal = kv.Value;

                var medalGameObject = this.CreateMedal(medal);

                if (!medals.ContainsKey(medal.Tier))
                {
                    medals.Add(medal.Tier, new Dictionary <double, GameObject>());
                }

                var multiplier = this.GetHighestMultiplier(medal);

                if (currentGraphOptions == GraphOptions.CalculatedStrength)
                {
                    multiplier *= medal.MaxAttack > medal.BaseAttack ? medal.MaxAttack : medal.BaseAttack;
                }

                var guiltIndex = (int)multiplier < 0 ? 0 : (int)multiplier;

                if (currentGraphOptions == GraphOptions.CalculatedStrength)
                {
                    guiltIndex = guiltIndex % 100000 >= 50000 ? guiltIndex + 100000 - guiltIndex % 100000 : guiltIndex - guiltIndex % 100000;
                }


                if (!medals[medal.Tier].ContainsKey(multiplier))
                {
                    GameObject tempObject = null;
                    if (cyclesOn)
                    {
                        tempObject = Instantiate(Resources.Load("MedalCycleDisplay") as GameObject);
                    }
                    else
                    {
                        tempObject = Instantiate(Resources.Load("MedalDisplay") as GameObject);
                    }

                    tempObject.name = multiplier.ToString("0.00");

                    try
                    {
                        tempObject.transform.position = new Vector3(xParents.First(x => x.name == medal.Tier.ToString()).transform.position.x,
                                                                    yParents.First(x => x.name == guiltIndex.ToString()).transform.position.y);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine(e);
                        print(medal.Name + " " + medal.Tier + " " + guiltIndex + " " + medal.MaxAttack + " " + medal.BaseAttack);
                    }

                    tempObject.transform.SetParent(medalContentHolder, false);

                    medals[medal.Tier].Add(multiplier, tempObject);
                }

                if (cyclesOn)
                {
                    medalGameObject.transform.SetParent(medals[medal.Tier][multiplier].GetComponentsInChildren <RectTransform>().First(x => x.name == "SubContent"), false);
                }
                else
                {
                    medalGameObject.transform.SetParent(medals[medal.Tier][multiplier].GetComponentsInChildren <RectTransform>().First(x => x.name == "Content"), true);
                }

                medalGameObject.GetComponent <CanvasGroup>().SetCanvasGroupActive();
            }

            #region Sort Base On Name

            List <Transform> children = new List <Transform>();
            for (int i = medalContentHolder.childCount - 1; i >= 0; i--)
            {
                Transform child = medalContentHolder.GetChild(i);
                children.Add(child);
                child.SetParent(null);
            }
            children.Sort((Transform t1, Transform t2) => string.Compare(t1.name, t2.name, StringComparison.Ordinal));
            foreach (Transform child in children)
            {
                child.SetParent(medalContentHolder);
            }

            #endregion

            foreach (var kv in medals)
            {
                foreach (var kv2 in kv.Value)
                {
                    if (cyclesOn)
                    {
                        this.UpdateMedalCycleContent(kv2.Value.GetComponentsInChildren <RectTransform>().First(x => x.name == "SubContent"));
                    }
                    //this.UpdateMedalHolderContent(kv2.Value.GetComponentsInChildren<RectTransform>().First(x => x.name == "Content"));
                    else
                    {
                        this.UpdateMedalHolderContent(kv2.Value.GetComponentsInChildren <RectTransform>().First(x => x.name == "Content"));
                    }
                }
            }

            return(medals);
        }
Esempio n. 12
0
			public DotClient(string script, GraphOptions options) {
				_p = EnvironmentInfo.GetConsoleProcess(options.Algorithm, "-T" + options.Format);
				_p.Start();
				_p.StandardInput.WriteLine(script);
				_options = options;
			}
Esempio n. 13
0
		/// <summary>
		/// Формирует контент графа
		/// </summary>
		/// <param name="script"></param>
		/// <param name="options"></param>
		/// <returns></returns>
		public object Generate(string script, GraphOptions options) {
			using (var dc = new DotClient(script, options)) {
				return dc.Generate();
			}
		}
Esempio n. 14
0
        public List <GameObject> PlaceYRows(int lowRange, int highRange, Transform startPositionY, Transform parentY, float offset, GraphOptions currentGraphOptions)
        {
            var   rowsY       = new List <GameObject>();
            float tempYOffset = 300;
            var   maxY        = 0.0f;

            var incrementalValue = 1;

            if (currentGraphOptions == GraphOptions.CalculatedStrength)
            {
                //incrementalValue = (highRange - lowRange) / 50;
                incrementalValue = 100000; // 100,000
                lowRange         = lowRange % 100000 >= 50000 ? lowRange + 100000 - lowRange % 100000 : lowRange - lowRange % 100000;
                highRange        = highRange % 100000 >= 50000 ? highRange + 100000 - highRange % 100000 : highRange - highRange % 100000;
            }

            for (int i = lowRange; i <= highRange; i += incrementalValue)
            {
                var pos = new Vector2(startPositionY.position.x, startPositionY.position.y + tempYOffset);
                var row = Instantiate(Resources.Load("NumberY") as GameObject, pos, Quaternion.identity, parentY.parent);

                row.name = i.ToString();
                row.GetComponent <Text>().text = i.ToString();

                tempYOffset += offset;
                rowsY.Add(row);

                maxY = row.GetComponent <RectTransform>().offsetMax.y;
            }

            parentY.GetComponent <RectTransform>().offsetMax = new Vector2(parentY.GetComponent <RectTransform>().offsetMax.x, maxY - 500);

            parentY.parent.GetComponentsInChildren <RectTransform>().Where(x => x.name != "Viewport" && x.name != "Content" && x.name != "InitialYPosition").ToList().ForEach(x => {
                x.transform.SetParent(parentY);
            });

            return(rowsY);
        }
Esempio n. 15
0
 /// <inheritdoc />
 internal abstract IStatement GetIStatement(GraphOptions options);
Esempio n. 16
0
    /// <summary>
    /// Opens the new version.
    /// </summary>
    private void OpenNewVersion()
    {
      Version auxVersion = new Version(); ////make a new version
      auxVersion.GetVersion();
      if (auxVersion.ID != 0)
      {
        this.version = auxVersion;
        if (this.version.ID == 1)
        {
          this.machine = new FirstStateMachine(this.version);
          this.machine.GetDates();
          cbSequences.ItemsSource = ((FirstStateMachine)this.machine).Sequences.ArrayOfSequence.ToList();
        }
        else
        {
          if (this.version.ID == 2)
          {
            this.machine = new SecondStateMachine(this.version);
            this.machine.GetDates();
            cbSequences.ItemsSource = ((SecondStateMachine)this.machine).Sequences.ArrayOfSequence.ToList();
          }
        }

        this.DataContext = this.machine.MyGraph;
        console.Text += "A new version opened successfully!\r\n";
        scrConsole.ScrollToEnd();
      }
      else
      {
        console.Text += "There is no version for this type of xml or you didn't select both files!\r\n";
        scrConsole.ScrollToEnd();
        this.currentOption = MachineOptions.Uninitialized;
        this.currentOptionGraph = GraphOptions.Uninitialized;
        this.EnableOrDisableMachineOptions();
        this.EnableOrDisableGraphOptions();
      }
    }
Esempio n. 17
0
        /// <summary>
        /// Creates a new instance. This class is also used to shareable a context across all instance that are created below one Cluster instance.
        /// One configuration instance per Cluster instance.
        /// </summary>
        internal Configuration(Policies policies,
                               ProtocolOptions protocolOptions,
                               PoolingOptions poolingOptions,
                               SocketOptions socketOptions,
                               ClientOptions clientOptions,
                               IAuthProvider authProvider,
                               IAuthInfoProvider authInfoProvider,
                               QueryOptions queryOptions,
                               IAddressTranslator addressTranslator,
                               IReadOnlyDictionary <string, IExecutionProfile> executionProfiles,
                               MetadataSyncOptions metadataSyncOptions,
                               IEndPointResolver endPointResolver,
                               IDriverMetricsProvider driverMetricsProvider,
                               DriverMetricsOptions metricsOptions,
                               string sessionName,
                               GraphOptions graphOptions,
                               Guid?clusterId,
                               string appVersion,
                               string appName,
                               MonitorReportingOptions monitorReportingOptions,
                               TypeSerializerDefinitions typeSerializerDefinitions,
                               bool?keepContactPointsUnresolved,
                               bool?allowBetaProtocolVersions,
                               ISessionFactory sessionFactory                       = null,
                               IRequestOptionsMapper requestOptionsMapper           = null,
                               IStartupOptionsFactory startupOptionsFactory         = null,
                               IInsightsSupportVerifier insightsSupportVerifier     = null,
                               IRequestHandlerFactory requestHandlerFactory         = null,
                               IHostConnectionPoolFactory hostConnectionPoolFactory = null,
                               IRequestExecutionFactory requestExecutionFactory     = null,
                               IConnectionFactory connectionFactory                 = null,
                               IControlConnectionFactory controlConnectionFactory   = null,
                               IPrepareHandlerFactory prepareHandlerFactory         = null,
                               ITimerFactory timerFactory = null,
                               IObserverFactoryBuilder observerFactoryBuilder = null,
                               IInsightsClientFactory insightsClientFactory   = null,
                               IContactPointParser contactPointParser         = null,
                               IServerNameResolver serverNameResolver         = null,
                               IDnsResolver dnsResolver = null,
                               IMetadataRequestHandler metadataRequestHandler     = null,
                               ITopologyRefresherFactory topologyRefresherFactory = null,
                               ISchemaParserFactory schemaParserFactory           = null,
                               ISupportedOptionsInitializerFactory supportedOptionsInitializerFactory = null,
                               IProtocolVersionNegotiator protocolVersionNegotiator = null,
                               IServerEventsSubscriber serverEventsSubscriber       = null)
        {
            AddressTranslator = addressTranslator ?? throw new ArgumentNullException(nameof(addressTranslator));
            QueryOptions      = queryOptions ?? throw new ArgumentNullException(nameof(queryOptions));
            GraphOptions      = graphOptions ?? new GraphOptions();

            ClusterId                   = clusterId ?? Guid.NewGuid();
            ApplicationVersion          = appVersion ?? Configuration.DefaultApplicationVersion;
            ApplicationName             = appName ?? Configuration.FallbackApplicationName;
            ApplicationNameWasGenerated = appName == null;

            Policies                           = policies;
            ProtocolOptions                    = protocolOptions;
            PoolingOptions                     = poolingOptions;
            SocketOptions                      = socketOptions;
            ClientOptions                      = clientOptions;
            AuthProvider                       = authProvider;
            AuthInfoProvider                   = authInfoProvider;
            StartupOptionsFactory              = startupOptionsFactory ?? new StartupOptionsFactory(ClusterId, ApplicationVersion, ApplicationName);
            SessionFactory                     = sessionFactory ?? new SessionFactory();
            RequestOptionsMapper               = requestOptionsMapper ?? new RequestOptionsMapper();
            MetadataSyncOptions                = metadataSyncOptions?.Clone() ?? new MetadataSyncOptions();
            DnsResolver                        = dnsResolver ?? new DnsResolver();
            MetadataRequestHandler             = metadataRequestHandler ?? new MetadataRequestHandler();
            TopologyRefresherFactory           = topologyRefresherFactory ?? new TopologyRefresherFactory();
            SchemaParserFactory                = schemaParserFactory ?? new SchemaParserFactory();
            SupportedOptionsInitializerFactory = supportedOptionsInitializerFactory ?? new SupportedOptionsInitializerFactory();
            ProtocolVersionNegotiator          = protocolVersionNegotiator ?? new ProtocolVersionNegotiator();
            ServerEventsSubscriber             = serverEventsSubscriber ?? new ServerEventsSubscriber();

            MetricsOptions              = metricsOptions ?? new DriverMetricsOptions();
            MetricsProvider             = driverMetricsProvider ?? new NullDriverMetricsProvider();
            SessionName                 = sessionName;
            MetricsEnabled              = driverMetricsProvider != null;
            TypeSerializers             = typeSerializerDefinitions?.Definitions;
            KeepContactPointsUnresolved = keepContactPointsUnresolved ?? false;
            AllowBetaProtocolVersions   = allowBetaProtocolVersions ?? false;

            ObserverFactoryBuilder    = observerFactoryBuilder ?? (MetricsEnabled ? (IObserverFactoryBuilder) new MetricsObserverFactoryBuilder() : new NullObserverFactoryBuilder());
            RequestHandlerFactory     = requestHandlerFactory ?? new RequestHandlerFactory();
            HostConnectionPoolFactory = hostConnectionPoolFactory ?? new HostConnectionPoolFactory();
            RequestExecutionFactory   = requestExecutionFactory ?? new RequestExecutionFactory();
            ConnectionFactory         = connectionFactory ?? new ConnectionFactory();
            ControlConnectionFactory  = controlConnectionFactory ?? new ControlConnectionFactory();
            PrepareHandlerFactory     = prepareHandlerFactory ?? new PrepareHandlerFactory();
            TimerFactory = timerFactory ?? new TaskBasedTimerFactory();

            RequestOptions    = RequestOptionsMapper.BuildRequestOptionsDictionary(executionProfiles, policies, socketOptions, clientOptions, queryOptions, GraphOptions);
            ExecutionProfiles = BuildExecutionProfilesDictionary(executionProfiles, RequestOptions);

            MonitorReportingOptions = monitorReportingOptions ?? new MonitorReportingOptions();
            InsightsSupportVerifier = insightsSupportVerifier ?? Configuration.DefaultInsightsSupportVerifier;
            InsightsClientFactory   = insightsClientFactory ?? Configuration.DefaultInsightsClientFactory;
            ServerNameResolver      = serverNameResolver ?? new ServerNameResolver(ProtocolOptions);
            EndPointResolver        = endPointResolver ?? new EndPointResolver(ServerNameResolver);
            ContactPointParser      = contactPointParser ?? new ContactPointParser(DnsResolver, ProtocolOptions, ServerNameResolver, KeepContactPointsUnresolved);

            // Create the buffer pool with 16KB for small buffers and 256Kb for large buffers.
            // The pool does not eagerly reserve the buffers, so it doesn't take unnecessary memory
            // to create the instance.
            BufferPool = new RecyclableMemoryStreamManager(16 * 1024, 256 * 1024, ProtocolOptions.MaximumFrameLength);
            Timer      = new HashedWheelTimer();
        }
Esempio n. 18
0
 /// <summary>
 /// Loads new configuration
 /// </summary>
 private void LoadConfig_Click(object sender, RoutedEventArgs e)
 {
   this.currentOption = MachineOptions.Initialized;
   this.EnableOrDisableMachineOptions();
   this.currentOptionGraph = GraphOptions.Initialized;
   this.EnableOrDisableGraphOptions();
   this.OpenNewVersion();
 }
Esempio n. 19
0
        public override TableDefinition Content(ReportData reportData, Dictionary <string, string> options)
        {
            double minVVal = short.MaxValue;
            double maxVVal = 0;
            double stepV;
            int    count = 0;

            bool hasVerticalZoom = options.ContainsKey("ZOOM");

            if (!options.ContainsKey("ZOOM") || !double.TryParse(options["ZOOM"], out stepV))
            {
                stepV = 1;
            }

            var rowData = new List <string>();

            rowData.AddRange(new[] {
                " ",
                Labels.Trans,
                Labels.Chang,
                Labels.Robu,
                Labels.Efcy,
                Labels.Secu,
                Labels.LoC
            });


            #region Fetch Snapshots
            int nbSnapshots = reportData?.Application.Snapshots?.Count() ?? 0;
            if (nbSnapshots > 0)
            {
                var _snapshots = reportData?.Application?.Snapshots?.OrderBy(_ => _.Annotation.Date);
                if (_snapshots != null)
                {
                    foreach (Snapshot snapshot in _snapshots)
                    {
                        BusinessCriteriaDTO bcGrade = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(snapshot, true);
                        double?locValue             = MeasureUtility.GetCodeLineNumber(snapshot);
                        string snapshotDate         = snapshot.Annotation.Date.DateSnapShot?.ToOADate().ToString(CultureInfo.CurrentCulture) ?? string.Empty;

                        rowData.Add(snapshotDate);
                        rowData.Add(bcGrade.Transferability.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(bcGrade.Changeability.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(bcGrade.Robustness.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(bcGrade.Performance.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(bcGrade.Security.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));
                        rowData.Add(locValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture));

                        List <double> values = new List <double>
                        {
                            bcGrade.Changeability.GetValueOrDefault(),
                                      bcGrade.Performance.GetValueOrDefault(),
                                      bcGrade.Robustness.GetValueOrDefault(),
                                      bcGrade.Security.GetValueOrDefault(),
                                      bcGrade.TQI.GetValueOrDefault(),
                                      bcGrade.Transferability.GetValueOrDefault()
                        };
                        minVVal = Math.Min(minVVal, values.Min());
                        maxVVal = Math.Max(maxVVal, values.Max());
                    }
                }
                count = nbSnapshots;
            }
            #endregion

            #region just 1 snapshot
            if (nbSnapshots == 1)
            {
                var    bcGrade      = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(reportData?.CurrentSnapshot, true);
                double?locValue     = MeasureUtility.GetCodeLineNumber(reportData?.CurrentSnapshot);
                string snapshotDate = reportData?.CurrentSnapshot.Annotation.Date.DateSnapShot?.ToOADate().ToString(CultureInfo.CurrentCulture) ?? string.Empty;
                rowData.AddRange(new[] {
                    snapshotDate,
                    bcGrade.Transferability.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    bcGrade.Changeability.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    bcGrade.Robustness.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    bcGrade.Performance.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    bcGrade.Security.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                    locValue.GetValueOrDefault().ToString(CultureInfo.CurrentCulture),
                });
                List <double> values = new List <double>
                {
                    bcGrade.Changeability.GetValueOrDefault(),
                              bcGrade.Performance.GetValueOrDefault(),
                              bcGrade.Robustness.GetValueOrDefault(),
                              bcGrade.Security.GetValueOrDefault(),
                              bcGrade.TQI.GetValueOrDefault(),
                              bcGrade.Transferability.GetValueOrDefault()
                };
                minVVal = Math.Min(minVVal, values.Min());
                maxVVal = Math.Max(maxVVal, values.Max());
                count   = count + 1;
            }
            #endregion just 1 snapshot



            #region Graphic Options
            GraphOptions graphOptions = null;
            if (hasVerticalZoom)
            {
                graphOptions = new GraphOptions()
                {
                    AxisConfiguration = new AxisDefinition()
                };
                graphOptions.AxisConfiguration.VerticalAxisMinimal = MathUtility.GetVerticalMinValue(minVVal, stepV);
                graphOptions.AxisConfiguration.VerticalAxisMaximal = MathUtility.GetVerticalMaxValue(maxVVal, stepV);
            }
            #endregion Graphic Options

            TableDefinition resultTable = new TableDefinition {
                HasRowHeaders    = true,
                HasColumnHeaders = false,
                NbRows           = count + 1,
                NbColumns        = 7,
                Data             = rowData,
                GraphOptions     = graphOptions
            };


            return(resultTable);
        }
Esempio n. 20
0
 /// <summary>
 /// Generates new sequence
 /// </summary>
 private void Generate_Sequence_Click(object sender, RoutedEventArgs e)
 {
   this.currentOptionGraph = GraphOptions.Initialized;
   this.EnableOrDisableGraphOptions();
   if (this.version.ID != 0)
   {
     GenerateSequenceWindow window = new GenerateSequenceWindow(this.machine);
     window.ShowDialog();
     if (this.machine is FirstStateMachine)
     {
       cbSequences.ItemsSource = ((FirstStateMachine)this.machine).Sequences.ArrayOfSequence.ToList();
     }
     else
     {
       cbSequences.ItemsSource = ((SecondStateMachine)this.machine).Sequences.ArrayOfSequence.ToList();
     }
   }
 }
Esempio n. 21
0
 /// <summary>
 /// Возвращает скрипт графа на целевом языке
 /// </summary>
 /// <param name="parameters"></param>
 /// <returns></returns>
 public string GenerateGraphScript(GraphOptions parameters) {
     var render = GraphRender.Create(this,parameters);
     return render.GenerateGraphScript(parameters);
 }
Esempio n. 22
0
 /// <summary>
 /// Handles the Click event of the LoadMultiple control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param>
 private void LoadMultiple_Click(object sender, RoutedEventArgs e)
 {
   this.currentOption = MachineOptions.Initialized;
   this.EnableOrDisableMachineOptions();
   this.currentOptionGraph = GraphOptions.Initialized;
   this.EnableOrDisableGraphOptions();
   this.OpenMachine();
 }
Esempio n. 23
0
        public void WriteStartGraph(string name, GraphType graphtype, GraphOptions options)
        {
            if (name == null)
            {
                throw new System.ArgumentNullException(name);
            }
            this.checkstate(WriterState.Begin);

            string gt_str = get_str_from_graph_type(graphtype);
            this.writeline(string.Format("{0} {1}", gt_str, name));
            this.writeline("{{");
            this.writeline("");
            if (options != null)
            {
                if (options.Overlap.HasValue)
                {
                    this.WriteNodeOption("overlap", options.Overlap.Value.ToString().ToLower());
                }


                if (options.FontName != null)
                {
                    this.WriteNodeOption("fontname", options.FontName);
                }

                if (options.FontColor != null)
                {
                    this.WriteNodeOption("fontcolor", options.FontColor.Value.ToWebColorString());
                }

                if (options.FontSize.HasValue)
                {
                    this.WriteNodeOption("fontsize", options.FontSize.Value);
                }


                if (options.LevelsGap.HasValue)
                {
                    this.WriteNodeOption("levelsgap", options.LevelsGap.Value);
                }

                if (options.LayerSep.HasValue)
                {
                    this.WriteNodeOption("layersep", options.LayerSep.Value);
                }


                if (options.NodeSep.HasValue)
                {
                    this.WriteNodeOption("nodesep", options.NodeSep.Value);
                }


                if (options.RankSep.HasValue)
                {
                    this.WriteNodeOption("ranksep", options.RankSep.Value);
                }
            }

            this.writeline("");
            this.state = WriterState.Graph;
        }
Esempio n. 24
0
 IStatement IGraphStatement.ToIStatement(GraphOptions options)
 {
     return GetIStatement(options);
 }
Esempio n. 25
0
        protected override TableDefinition Content(ReportData reportData, Dictionary<string, string> options)
        {
            double minVVal = Int16.MaxValue;
            double maxVVal = 0;
            double stepV = 0;
            int count = 0;

            bool hasVerticalZoom = options.ContainsKey("ZOOM");
            if (!options.ContainsKey("ZOOM") || !Double.TryParse(options["ZOOM"], out stepV)) {
                stepV = 1;
            }

            var rowData = new List<String>();
            rowData.AddRange(new string[] {
                " ",
                Labels.Trans,
                Labels.Chang,
                Labels.Robu,
                Labels.Efcy,
                Labels.Secu,
                Labels.LoC
            });

            #region Fetch Snapshots
            int nbSnapshots = (reportData != null && reportData.Application.Snapshots != null) ? reportData.Application.Snapshots.Count() : 0;
            if (nbSnapshots > 0) {
                foreach (Snapshot snapshot in reportData.Application.Snapshots.OrderBy(_ => _.Annotation.Date)) {
                    BusinessCriteriaDTO bcGrade = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(snapshot, true);
                    double? locValue = MeasureUtility.GetCodeLineNumber(snapshot);
                    string snapshotDate = snapshot.Annotation.Date.DateSnapShot.HasValue ? snapshot.Annotation.Date.DateSnapShot.Value.ToOADate().ToString()
                                                                                                : string.Empty;
                    rowData.AddRange(new string[] {
                                                    snapshotDate,
                                                    bcGrade.Transferability.GetValueOrDefault().ToString(),
                                                    bcGrade.Changeability.GetValueOrDefault().ToString(),
                                                    bcGrade.Robustness.GetValueOrDefault().ToString(),
                                                    bcGrade.Performance.GetValueOrDefault().ToString(),
                                                    bcGrade.Security.GetValueOrDefault().ToString(),
                                                    locValue.GetValueOrDefault().ToString(),
                                                    });
                    List<double> values = new List<double>() { bcGrade.Changeability.GetValueOrDefault(),
                                                               bcGrade.Performance.GetValueOrDefault(),
                                                               bcGrade.Robustness.GetValueOrDefault(),
                                                               bcGrade.Security.GetValueOrDefault(),
                                                               bcGrade.TQI.GetValueOrDefault(),
                                                               bcGrade.Transferability.GetValueOrDefault()
                                                             };
                    minVVal = Math.Min(minVVal, values.Min());
                    maxVVal = Math.Max(maxVVal, values.Max());

                }
                count = nbSnapshots;
            }
            #endregion

            #region just 1 snapshot
            if (nbSnapshots == 1) {
                BusinessCriteriaDTO bcGrade = new BusinessCriteriaDTO();
                bcGrade = BusinessCriteriaUtility.GetBusinessCriteriaGradesSnapshot(reportData.CurrentSnapshot, true);
                double? locValue = MeasureUtility.GetCodeLineNumber(reportData.CurrentSnapshot);
                string snapshotDate = reportData.CurrentSnapshot.Annotation.Date.DateSnapShot.HasValue ? reportData.CurrentSnapshot.Annotation.Date.DateSnapShot.Value.ToOADate().ToString()
                                                                                                   : string.Empty;
                rowData.AddRange(new string[] {
                                                snapshotDate,
                                                bcGrade.Transferability.GetValueOrDefault().ToString(),
                                                bcGrade.Changeability.GetValueOrDefault().ToString(),
                                                bcGrade.Robustness.GetValueOrDefault().ToString(),
                                                bcGrade.Performance.GetValueOrDefault().ToString(),
                                                bcGrade.Security.GetValueOrDefault().ToString(),
                                                locValue.GetValueOrDefault().ToString(),

                                                });
                List<double> values = new List<double>() { bcGrade.Changeability.GetValueOrDefault(),
                                                            bcGrade.Performance.GetValueOrDefault(),
                                                            bcGrade.Robustness.GetValueOrDefault(),
                                                            bcGrade.Security.GetValueOrDefault(),
                                                            bcGrade.TQI.GetValueOrDefault(),
                                                            bcGrade.Transferability.GetValueOrDefault() };
                minVVal = Math.Min(minVVal, values.Min());
                maxVVal = Math.Max(maxVVal, values.Max());
                count = count + 1;
            }
            #endregion just 1 snapshot

            #region Graphic Options
            GraphOptions graphOptions = null;
            if (hasVerticalZoom) {
                graphOptions = new GraphOptions() { AxisConfiguration = new AxisDefinition() };
                graphOptions.AxisConfiguration.VerticalAxisMinimal = MathUtility.GetVerticalMinValue(minVVal, stepV);
                graphOptions.AxisConfiguration.VerticalAxisMaximal = MathUtility.GetVerticalMaxValue(maxVVal, stepV);
            }
            #endregion Graphic Options

            TableDefinition resultTable = new TableDefinition {
                HasRowHeaders = true,
                HasColumnHeaders = false,
                NbRows = count+1,
                NbColumns = 7,
                Data = rowData,
                GraphOptions = graphOptions
            };

            return resultTable;
        }
 /// <summary>
 /// Sets the DSE Graph options.
 /// </summary>
 /// <returns>this instance</returns>
 public DseClusterBuilder WithGraphOptions(GraphOptions options)
 {
     GraphOptions = options;
     return this;
 }
Esempio n. 27
0
        public void PlaceMedals(List <GameObject> rows, List <GameObject> columns, Dictionary <int, Dictionary <double, GameObject> > medals, GraphOptions currentGraphOptions)
        {
            //yOffset = currentGraphOptions == GraphOptions.CalculatedStrength ? 100000 : 250;

            foreach (var tier in medals)
            {
                foreach (var multiplier in tier.Value)
                {
                    // TODO Rework this!!!! It is not working with calculated strength
                    var medal = multiplier.Value;

                    var    yIndex = (int)multiplier.Key;
                    double yAfterDecimal;

                    if (currentGraphOptions == GraphOptions.CalculatedStrength)
                    {
                        var tempValue = yIndex;
                        //if (yIndex % 100000 >= 50000)
                        //    yIndex = yIndex + 100000 - yIndex % 100000;
                        //else
                        yIndex = yIndex - yIndex % 100000;

                        yAfterDecimal = (tempValue - yIndex) / 100000.0;
                    }
                    else
                    {
                        yAfterDecimal = multiplier.Key - yIndex;
                    }

                    var yTransform = rows.FirstOrDefault(x => x.name == yIndex.ToString()).transform.position;
                    var xPosition  = columns.FirstOrDefault(x => x.name == tier.Key.ToString()).transform.position;

                    var nextY = yOffset;

                    // TODO FIX THIS
                    //if (yIndex + 1 < Rows.Count)
                    //{
                    //    nextY = RowsyIndex + 1].position.y - yTransform.y;
                    //}

                    medal.transform.position = new Vector2(xPosition.x, yTransform.y + (nextY * (float)yAfterDecimal));
                }
            }
        }