public Method(string name, string returnType, IEnumerable <MethodParameter> parameters, VisibilityModifier visibility)
 {
     Name       = name;
     ReturnType = returnType;
     Parameters = parameters;
     Visibility = visibility;
 }
 private void AssertMethod(IMethod m, VisibilityModifier expectedVisibility, string expectedName, string expectedReturnType = "void")
 {
     Assert.IsNotNull(m, "unexpected null");
     Assert.AreEqual(expectedVisibility, m.Visibility, "unexpected method visiblity");
     Assert.AreEqual(expectedName, m.Name, "unexpected method name");
     Assert.AreEqual(expectedReturnType, m.ReturnType, "unexpected return type");
 }
        public void t14_Parse_Method_VisibilityModifier(string modifier, VisibilityModifier expectedVisibility)
        {
            var tokens       = TokenStreamBuilder.FromStrings("[", "a", "|", "|", modifier, "methodName", "(", ")", "]");
            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var m            = classDiagram.Classes.ToList()[0].Methods.ToList()[0];

            Assert.AreEqual(expectedVisibility, m.Visibility, "unexpected visibility");
        }
Beispiel #4
0
        public void CastingShouldVisibilityModifier(string value, VisibilityModifier expected)
        {
            // Act
            ClassMember member = value;

            // Assert
            member.Visibility.Should().Be(expected);
        }
Beispiel #5
0
    public void RegisterPersistentVisibility(VisibilityModifier modifier)
    {
        m_PersistentModifierList.Add(modifier);

        if (m_PersistentModifierList.Count >= 4)
        {
            Debug.LogWarning("[Aether Visibility] More persistent visibility modifiers are present than expected!");
        }
    }
        public void t13_Parse_Field_With_AccessModifier(String modifier, VisibilityModifier expectedVm)
        {
            var tokens = TokenStreamBuilder.FromStrings("[", "a", "|", modifier, "fieldName", ":", "fieldType", "]");

            var classDiagram = new ClassDiagramParser(tokens).ParseClassDiagram();
            var f            = classDiagram.Classes.ToList()[0].Fields.ToList()[0];

            Assert.IsNotNull(classDiagram, "field parsing failed");
            Assert.AreEqual("fieldName", f.Name);
            Assert.AreEqual("fieldType", f.Type);
            Assert.AreEqual(expectedVm, f.Visibility, "wrong visibility modifier");
        }
Beispiel #7
0
    private void DispatchModifier(VisibilityModifier mod, bool isInstant)
    {
        // Let the center of the texture be world origin (0,0), so every position should be
        // offset by adding half of texture width and height
        Vector2 modPosTangentSpace = new Vector2(mod.m_Position.x, mod.m_Position.z) +
                                     new Vector2(m_TextureSizeX / 2, m_TextureSizeY / 2);

        int numThreadGroupX = Mathf.Max(1, (int)Mathf.Ceil((mod.m_Radius * 2) / THREADGROUP_SIZE_X));
        int numThreadGroupY = Mathf.Max(1, (int)Mathf.Ceil((mod.m_Radius * 2) / THREADGROUP_SIZE_Y));

        m_VisibilityCS.SetVector("ModifierPosition", modPosTangentSpace);
        m_VisibilityCS.SetFloat("ModifierRadius", mod.m_Radius);
        m_VisibilityCS.SetFloat("UpdateSpeed", isInstant ? 1 : Time.deltaTime * 6);
        m_VisibilityCS.SetBool("IsUnreveal", mod.m_IsUnreveal);
        m_VisibilityCS.SetTexture(COMPUTE_KERNEL, "WorldVisibilityResult", m_WorldVisibilityTexture);

        m_VisibilityCS.Dispatch(COMPUTE_KERNEL, numThreadGroupX, numThreadGroupY, 1);
    }
        public static string GetDisplayText(this VisibilityModifier modifier)
        {
            switch (modifier)
            {
            case VisibilityModifier.Public:
                return("+");

            case VisibilityModifier.Protected:
                return("#");

            case VisibilityModifier.Private:
                return("~");

            case VisibilityModifier.Internal:
                return("-");
            }

            throw new ArgumentException("unexpected visibility modifier: " + modifier.ToString());
        }
 private void TryConsumeVisibilityModifier(out VisibilityModifier mod)
 {
     mod = VisibilityModifier.Public;
     if (_genericTokens.TryConsume(TokenType.Plus))
     {
         mod = VisibilityModifier.Public;
     }
     else if (_genericTokens.TryConsume(TokenType.Dash))
     {
         mod = VisibilityModifier.Private;
     }
     else if (_genericTokens.TryConsume(TokenType.Hash))
     {
         mod = VisibilityModifier.Protected;
     }
     else if (_genericTokens.TryConsume(TokenType.Tilde))
     {
         mod = VisibilityModifier.Internal;
     }
 }
Beispiel #10
0
        internal static void VisibilityChar(this StringBuilder stringBuilder, VisibilityModifier visibility)
        {
            switch (visibility)
            {
            case VisibilityModifier.Private:
                stringBuilder.Append(Constant.Private);
                break;

            case VisibilityModifier.Protected:
                stringBuilder.Append(Constant.Protected);
                break;

            case VisibilityModifier.PackagePrivate:
                stringBuilder.Append(Constant.PackagePrivate);
                break;

            case VisibilityModifier.Public:
                stringBuilder.Append(Constant.Public);
                break;
            }
        }
Beispiel #11
0
    private void Update()
    {
        for (int i = 0; i < m_NumDispatchPerFrame; ++i)
        {
            if (m_OneShotModifierQueue.Count <= 0)
            {
                break;
            }

            VisibilityModifier mod = m_OneShotModifierQueue.Dequeue();
            DispatchModifier(mod, true);
        }

        foreach (VisibilityModifier mod in m_PersistentModifierList)
        {
            DispatchModifier(mod, false);
        }

        VisibilityUpdate();

        VisibilityDebugger();
    }
Beispiel #12
0
        private static IEnumerable <SyntaxToken> GetModifiersFor(VisibilityModifier modifier)
        {
            switch (modifier)
            {
            case VisibilityModifier.Public:
                return(new[] { SyntaxFactory.Token(SyntaxKind.PublicKeyword) });

            case VisibilityModifier.Internal:
                return(new[] { SyntaxFactory.Token(SyntaxKind.InternalKeyword) });

            case VisibilityModifier.Protected:
                return(new[] { SyntaxFactory.Token(SyntaxKind.ProtectedKeyword) });

            case VisibilityModifier.ProtectedInternal:
                return(new[] { SyntaxFactory.Token(SyntaxKind.ProtectedKeyword), SyntaxFactory.Token(SyntaxKind.InternalKeyword) });

            case VisibilityModifier.Private:
                return(new[] { SyntaxFactory.Token(SyntaxKind.PrivateKeyword) });

            default:
                throw new ArgumentOutOfRangeException(nameof(modifier), modifier, $"Unknown modifier '{modifier}'.");
            }
        }
Beispiel #13
0
        /// <summary>
        /// Renders the beginning of a class.
        /// </summary>
        /// <param name="name">The name of the class. The name can't contain spaces.</param>
        /// <param name="displayName">Optional display name. The display name can contain spaces.</param>
        /// <param name="visibility">Optional visibility.</param>
        /// <param name="isAbstract">Indicates wheter the class is abstract. Default <c>false</c>.</param>
        /// <param name="generics">Optional class extension.</param>
        /// <param name="stereotype">Optional stereo type.</param>
        /// <param name="customSpot">Optional custom spot.</param>
        /// <param name="tag">Optional tag.</param>
        /// <param name="url">Optional URL.</param>
        /// <param name="backgroundColor">Optional background color.</param>
        /// <param name="lineColor">Optional line color.</param>
        /// <param name="lineStyle">Optional line style.</param>
        /// <param name="extends">Optional extends.</param>
        /// <param name="implements">Optional implements.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <c>null</c>.</exception>
        /// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <c>null</c>, empty of only white space.</exception>
        public static void ClassStart(this StringBuilder stringBuilder, string name, string displayName = default, VisibilityModifier visibility = VisibilityModifier.None, bool isAbstract = false, string generics = default, string stereotype = default, CustomSpot customSpot = default, string tag = default, Uri url = default, Color backgroundColor = default, Color lineColor = default, LineStyle lineStyle = LineStyle.None, string[] extends = default, string[] implements = default)
        {
            if (stringBuilder is null)
            {
                throw new ArgumentNullException(nameof(stringBuilder));
            }

            stringBuilder.VisibilityChar(visibility);
            stringBuilder.Class(name, displayName, isAbstract, generics, stereotype, customSpot, tag, url, backgroundColor, lineColor, lineStyle, extends, implements);
            stringBuilder.TrimEnd();
            stringBuilder.ClassBaseStart();
        }
Beispiel #14
0
 public AstVisibilityModifier(VisibilityModifier value)
 {
     Value = value;
 }
Beispiel #15
0
        public static ConstructorDeclarationSyntax WithVisibilityModifier(this ConstructorDeclarationSyntax constructorDeclaration, VisibilityModifier modifier)
        {
            Contract.Requires(constructorDeclaration != null);
            Contract.Ensures(Contract.Result <ConstructorDeclarationSyntax>() != null);

            var oldModifiers = constructorDeclaration.Modifiers.Where(m => !m_visibilityModifierKinds.Contains(m.Kind()));
            var modifiers    =
                new SyntaxTokenList()
                .AddRange(GetModifiersFor(modifier))
                .AddRange(oldModifiers);

            return(constructorDeclaration.WithModifiers(modifiers));
        }
 public Field(string name, string type, VisibilityModifier visibilityModifier = VisibilityModifier.Public)
 {
     Name       = name;
     Type       = type;
     Visibility = visibilityModifier;
 }
Beispiel #17
0
 public void RegisterVisibilityOneShot(VisibilityModifier modifier)
 {
     m_OneShotModifierQueue.Enqueue(modifier);
 }