Skip to content
Snippets Groups Projects
Select Git revision
  • 47feb1f419cc39677111a56c65aa9972c7e5f09f
  • master default
  • JS-based-scroll-rendering
  • Paul_Marius_Level
  • Paul_Marius_2
  • Paul_Marius
  • Andi_Mark
  • be-UnityWebView
  • gitignoreFrameitServer
  • ZimmerBSc
  • Bugfix_StageLoading
  • stages
  • MAZIFAU_Experimental
  • tsc/coneworld
  • tsc/fact-interaction
  • marcel
  • MaZiFAU_TopSort
  • mergeHelper
  • zwischenSpeichern
  • tempAndrToMaster
  • SebBranch
  • 3.0
  • v2.1
  • v2.0
  • v1.0
25 results

SOMDocs.cs

Blame
    • MaZiFAU's avatar
      47feb1f4
      Known Bugs; BugFixes; Facts; Misc; · 47feb1f4
      MaZiFAU authored
      Known Bugs;
      + Saving/Loading [Experimental]
      
      BugFixes;
      + Server caching may pose the need for postponed Stage loading
      + Server cheches wrong label -> send fact with new one.
      + New Facts may have Definisions()==null -> null.ToString() for ID
      +-> MMTFact.ToString() as Fallback
      
      Facts;
      + Further decoupled from FactRecorder
      +-> labeling done JIT by FactRecorder
      + Caching: object CompiledValue && Expression CompileBase
      
      Misc;
      + added SOMDoc(from)Object(object)
      + StageStatic.ShallowLoadStages(bool): streamlined loading in case of failure due to unloaded dependecies (e.g.: ContextRecorder)
      47feb1f4
      History
      Known Bugs; BugFixes; Facts; Misc;
      MaZiFAU authored
      Known Bugs;
      + Saving/Loading [Experimental]
      
      BugFixes;
      + Server caching may pose the need for postponed Stage loading
      + Server cheches wrong label -> send fact with new one.
      + New Facts may have Definisions()==null -> null.ToString() for ID
      +-> MMTFact.ToString() as Fallback
      
      Facts;
      + Further decoupled from FactRecorder
      +-> labeling done JIT by FactRecorder
      + Caching: object CompiledValue && Expression CompileBase
      
      Misc;
      + added SOMDoc(from)Object(object)
      + StageStatic.ShallowLoadStages(bool): streamlined loading in case of failure due to unloaded dependecies (e.g.: ContextRecorder)
    SOMDocs.cs 33.36 KiB
    using JsonSubTypes;
    using Newtonsoft.Json;
    using System.Collections.Generic;
    using System.Linq.Expressions;
    using System.Linq;
    using System;
    using UnityEngine;
    using MoreLinq;
    using System.Runtime.CompilerServices;
    using System.Collections;
    
    namespace REST_JSON_API
    {
        public class ApproximationComparer : EqualityComparer<object>
        {
            public static readonly ApproximationComparer Instance = new();
            private double precission;
    
            public ApproximationComparer(double precission = Math3d.vectorPrecission)
            {
                this.precission = precission;
            }
    
            public override bool Equals(object x, object y)
            {
                if (x.Equals(y))
                    return true;
                if (x.GetType() != y.GetType())
                    return false;
    
                if (x is float fx)
                    return Math3d.Approximately(fx, (float)y, (float)precission);
                if (x is Vector3 vx)
                    return Math3d.IsApproximatelyEqual(vx, (Vector3)y, precission);
    
                return false;
            }
    
            public override int GetHashCode(object obj)
            {
                if (obj is float)
                    return typeof(float).GetHashCode();
                if (obj is Vector3)
                    return typeof(Vector3).GetHashCode();
    
                return obj.GetHashCode();
            }
        }
    
        [JsonConverter(typeof(JsonSubtypes), "kind")]
        [JsonSubtypes.KnownSubType(typeof(RAW), "RAW")]
        [JsonSubtypes.KnownSubType(typeof(OMS), "OMS")]
        [JsonSubtypes.KnownSubType(typeof(OMA), "OMA")]
        [JsonSubtypes.KnownSubType(typeof(OMV), "VAR")]
        [JsonSubtypes.KnownSubType(typeof(OML_Member), "OML")]
        [JsonSubtypes.KnownSubType(typeof(FUN), "FUN")]
        [JsonSubtypes.KnownSubType(typeof(FUNTYPE), "FUNTYPE")]
        //[JsonSubtypes.KnownSubType(typeof(OMC<T>), "OMC<" + typeof(T).Name + ">")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<bool>), "OMLIT<Boolean>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<byte>), "OMLIT<Byte>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<short>), "OMLIT<Int16>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<int>), "OMLIT<Int32>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<long>), "OMLIT<Int64>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<float>), "OMLIT<Single>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<float>), "OMLIT<Double>")] // we dont use double
        [JsonSubtypes.KnownSubType(typeof(OMLIT<string>), "OMLIT<String>")]
        [JsonSubtypes.KnownSubType(typeof(OMLIT<Vector3>), "OMLIT<Vector3>")]
        [JsonSubtypes.FallBackSubType(typeof(FallbackWrapper))]
        //[JsonSubtypes.KnownSubType(typeof(FallbackWrapper), "SFunction")]
        //[JsonSubtypes.KnownSubTypeWithProperty(typeof(FallbackWrapper), "SFunction")]