Ejemplo n.º 1
0
        /// <summary>
        /// Translates a specific ClassObject into Java.
        /// </summary>
        /// <param name="cObject"></param>
        /// <returns></returns>
        public override StringBuilder TranslateClass(ClassObject cObject)
        {
            result.Append(@"\cf9 ----------------------------" + cObject.ClassName + @".java----------------------------\line\line");
            if (cObject.GetType() == typeof(MainClassObject))
            {
                TranslateMainClass(cObject);
            }
            else
            {
                result.Append(@"\cf2\b public class \b0 \cf1" + cObject.ClassName + @" \{\line\line");

                TranslatePrimitiveAttributes(cObject);
                if (cObject.PrimitiveAttributes.Count > 0)
                {
                    result.Append(@"\line");
                }
                TranslateObjectAttributes(cObject);
                if (cObject.Attributes.Count > 0)
                {
                    result.Append(@"\line");
                }
                TranslateGetterAndSettersForPrimitiveAttributes(cObject);
                TranslateGetterAndSettersForObjectAttributes(cObject);
                TranslateMethods(cObject);

                result.Append(@"\}\line\line");
            }
            return(result);
        }
Ejemplo n.º 2
0
        public void Classes_PostDelete()
        {
            var classObject = new ClassObject();

            classObject.ClassName              = _value;
            classObject.DayOfClass             = _value;
            classObject.TimeOfClass            = _value;
            classObject.Location               = _value;
            classObject.InstructorId           = _instructorId;
            classObject.Organization           = _organization;
            _classesController.Request.Content = new StringContent(EnrollMe.Controllers.Helper.SerializeJson(classObject));
            _classesController.Request.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
            var response = _classesController.Post(classObject);

            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            var data = ((APIResponse)(((System.Net.Http.ObjectContent)(response.Content)).Value)).Data;

            Assert.AreEqual((data.ReturnModel as EnrollMeDB.Classes).ClassName, classObject.ClassName);

            _classesController.Request.Content = new StringContent(EnrollMe.Controllers.Helper.SerializeJson(classObject));
            _classesController.Request.Content.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
            response = _classesController.Post(classObject);
            Assert.AreEqual(response.StatusCode, HttpStatusCode.OK);
            Assert.AreEqual((data.ReturnModel as EnrollMeDB.Classes).ClassName, classObject.ClassName);

            response = _classesController.Delete((data.ReturnModel as EnrollMeDB.Classes).ClassId);
            Assert.AreEqual(1, ((APICommon.APIResponse)(((System.Net.Http.ObjectContent)(response.Content)).Value)).Data.ReturnModel);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Translates all the primitive attributes of the cObject in c# code.
        /// </summary>
        /// <param name="cObject"></param>
        private void TranslatePrimitiveAttributes(ClassObject cObject)
        {
            foreach (string attributeName in cObject.PrimitiveAttributes.Keys.ToList <string>())
            {
                string type;
                switch (cObject.PrimitiveAttributes[attributeName])
                {
                case PrimitiveTypes.Boolean:
                    type = "bool";
                    break;

                case PrimitiveTypes.Float:
                    type = "float";
                    break;

                case PrimitiveTypes.Integer:
                    type = "int";
                    break;

                case PrimitiveTypes.String:
                    type = "string";
                    break;

                default:
                    type = @"\cf10Type";
                    break;
                }
                result.Append(@"\tab\tab\cf9public " + type + @" \cf1" + CapitalFirst(attributeName) + @" \{ \cf9get\cf1; \cf9set\cf1; \}\line");
            }
        }
Ejemplo n.º 4
0
    //----------------------------------------------------------------------------------------------------------------------------------------------
    protected void markUsed(ClassObject classObject)
    {
        // 加入使用列表
        Type t = classObject.GetType();

        if (mInusedList.ContainsKey(t))
        {
            if (mInusedList[t].Contains(classObject))
            {
                logError("ClassObject is in Inused list! can not add again!");
                return;
            }
        }
        else
        {
            mInusedList.Add(t, new List <ClassObject>());
        }
        mInusedList[t].Add(classObject);
        // 从未使用列表移除
        if (mUnusedList.ContainsKey(t))
        {
            if (mUnusedList[t].Contains(classObject))
            {
                mUnusedList[t].Remove(classObject);
            }
        }
    }
Ejemplo n.º 5
0
        /// <summary>
        /// Translates primitibe Attributes of cObject into Java.
        /// </summary>
        /// <param name="cObject"></param>
        private void TranslatePrimitiveAttributes(ClassObject cObject)
        {
            foreach (string attributeName in cObject.PrimitiveAttributes.Keys.ToList <string>())
            {
                string type;
                switch (cObject.PrimitiveAttributes[attributeName])
                {
                case PrimitiveTypes.Boolean:
                    type = "boolean";
                    break;

                case PrimitiveTypes.Float:
                    type = "float";
                    break;

                case PrimitiveTypes.Integer:
                    type = "int";
                    break;

                case PrimitiveTypes.String:
                    type = "String";
                    break;

                default:
                    type = "type";
                    break;
                }
                result.Append(@"\tab \cf2 \b private " + type + @"\b0 \cf1  " + attributeName + @";\line");
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// メソッドの取得
        /// </summary>
        /// <param name="item">C#ソースを解析したインスタンス</param>
        /// <param name="isOutputMethod">メソッド出力フラグ</param>
        /// <param name="index">インデックス数(半角スペース数)</param>
        /// <returns>TypeScriptのコンストラクタに変換した文字列</returns>
        public MethodData GetMethodText(BaseMethodDeclarationSyntax item, bool isOutputMethod, int index = 0)
        {
            var classObject = ClassObject.GetInstance();

            // メソッド名と戻り値を設定
            var returnValue = string.Empty;
            var methodName  = "constructor";

            if (item is MethodDeclarationSyntax mi)
            {
                methodName  = mi.Identifier.Text;
                returnValue = ClassObject.GetInstance().GetTypeScriptType(mi.ReturnType);
            }

            // 前処理の場合はメソッドチェックと格納のみ
            if (classObject.IsPreAnalyze)
            {
                if (item.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword))
                {
                    classObject.AddStaticMember(methodName);
                }
                return(null);
            }

            // staticキーワードがあればメソッド名に追加する
            if (item.Modifiers.Any(modifier => modifier.Kind() == SyntaxKind.StaticKeyword))
            {
                methodName = "static " + methodName;
            }


            // メソッド出力しない場合はそのまま終了
            if (!isOutputMethod)
            {
                return(null);
            }

            var parameterDataList = new List <MethodData.ParameterData>();

            foreach (var param in item.ParameterList.Parameters)
            {
                parameterDataList.Add(new MethodData.ParameterData(param.Identifier.ValueText, ClassObject.GetInstance().GetTypeScriptType(param.Type)));
            }

            // スーパークラスのコンストラクタのパラメータ数を取得
            var superMethodArgCount = -1;

            if (item is ConstructorDeclarationSyntax cds && cds.Initializer != null && cds.Initializer.ArgumentList != null)
            {
                superMethodArgCount = cds.Initializer.ArgumentList.Arguments.Count;
            }

            // メソッド情報を作成
            var methodData = new MethodData(index, methodName, GetModifierText(item.Modifiers), parameterDataList,
                                            GetMethodText(item.Body, index + IndentSize, parameterDataList.Select(p => p.Name).ToList()),
                                            returnValue, superMethodArgCount, GetComments(item.GetLeadingTrivia().ToString()));

            // メソッド情報を返す
            return(methodData);
        }
Ejemplo n.º 7
0
        private void TranslateObjectAttributes(ClassObject cObject)
        {
            HashSet <string> includedSet = new HashSet <string>();

            foreach (var attribute in cObject.Attributes)
            {
                // Translate each type only once
                if (includedSet.Contains(attribute.ClassObject.Id))
                {
                    continue;
                }
                includedSet.Add(attribute.ClassObject.Id);

                // Set array
                if (NumberOfInstances[attribute.ClassObject.Id] > 1)
                {
                    string classString = attribute.ClassObject.ClassName;

                    result.Append(@"\tab \cf12 var \cf13" + (attribute.AttributeName ?? classString.ToLowerInvariant()) + @"\cf12  = [" + classString + @"]() \line ");
                }
                // Or single attribute
                else
                {
                    string classString = attribute.ClassObject.ClassName;
                    result.Append(@"\tab \cf12 var \cf13" + (attribute.AttributeName ?? classString.ToLower()) + @"\cf12: \cf13" + classString + @" \line");
                }
            }
        }
Ejemplo n.º 8
0
        private void TranslatePrimitiveAttributes(ClassObject cObject)
        {
            foreach (string attributeName in cObject.PrimitiveAttributes.Keys.ToList <string>())
            {
                string type;
                switch (cObject.PrimitiveAttributes[attributeName])
                {
                case PrimitiveTypes.Boolean:
                    type = "Bool";
                    break;

                case PrimitiveTypes.Float:
                    type = "Float";
                    break;

                case PrimitiveTypes.Integer:
                    type = "Int";
                    break;

                case PrimitiveTypes.String:
                    type = "String";
                    break;

                default:
                    type = @"\cf10Type";
                    break;
                }
                result.Append(@"\tab \cf12" + "var " + @"\cf13" + CapitalFirst(attributeName) + @"\cf12: " + type + @" \line");
            }
        }
Ejemplo n.º 9
0
    protected void markUnused(ClassObject classObject)
    {
        // 加入未使用列表
        Type t = classObject.GetType();

        if (mUnusedList.ContainsKey(t))
        {
            if (mUnusedList[t].Contains(classObject))
            {
                logError("ClassObject is in Unused list! can not add again!");
                return;
            }
        }
        else
        {
            mUnusedList.Add(t, new List <ClassObject>());
        }
        mUnusedList[t].Add(classObject);
        // 从使用列表移除,要确保操作的都是从本类创建的实例
        if (mInusedList.ContainsKey(t))
        {
            if (mInusedList[t].Contains(classObject))
            {
                mInusedList[t].Remove(classObject);
            }
            else
            {
                logError("Inused List not contains class object!");
            }
        }
        else
        {
            logError("can not find class type in Inused List! type : " + t.ToString());
        }
    }
Ejemplo n.º 10
0
        /// <summary>
        /// translates all the classes which are included (directly or indirectly) in the root.
        /// </summary>
        /// <param name="root"></param>
        /// <returns></returns>
        public StringBuilder Translate(ClassObject root)
        {
            result.Clear();
            completedList.Clear();
            todoList.Clear();

            result.Append(@"{\rtf1\ansi\deff0");

            //color definitions
            result.Append(@" {\colortbl;");
            result.Append(@"\red255\green255\blue255;"); //white cf1
            result.Append(@"\red234\green128\blue252;"); //allen purple cf2
            result.Append(@"\red29\green233\blue182;");  //turqouise cf3
            result.Append(@"\red255\green183\blue77;");  //orange cf4
            result.Append(@"\red84\green110\blue122;");  //allen gray cf5
            result.Append(@"\red174\green213\blue129;"); //allen green cf6
            result.Append(@"\red128\green216\blue255;"); //allen blue cf7
            result.Append(@"\red255\green213\blue79;");  //allen orange cf8
            result.Append(@"\red86\green156\blue214;");  //dome blue cf9
            result.Append(@"\red78\green201\blue176;");  //dome green cf10
            result.Append(@"\red33\green150\blue243;");  //allen swift blue cf11
            result.Append(@"\red255\green152\blue0;");   //allen swift orange cf12
            result.Append(@"\red189\green189\blue189;"); //allen swift gray cf13


            result.Append("}");

            todoList.Add(root);
            todoList.AddRange(ModelManager.GetInstance().GetClasses());

            while (todoList.Count > 0)
            {
                NumberOfInstances.Clear();
                ClassObject cObject = todoList.First();
                foreach (var subObject in cObject.Attributes)
                {
                    if (!NumberOfInstances.ContainsKey(subObject.ClassObject.Id))
                    {
                        NumberOfInstances.Add(subObject.ClassObject.Id, 1);
                    }
                    else
                    {
                        NumberOfInstances[subObject.ClassObject.Id]++;
                    }
                }
                todoList.Remove(cObject);
                completedList.Add(cObject);
                TranslateClass(cObject);
                foreach (var attribute in cObject.Attributes)
                {
                    if (!completedList.Contains(attribute.ClassObject) && !(todoList.Contains(attribute.ClassObject)))
                    {
                        todoList.Add(attribute.ClassObject);    // Should never be called (contained for compatibility and safety)
                    }
                }
            }

            result.Append("}");
            return(result);
        }
Ejemplo n.º 11
0
    public override GameObject Build()
    {
        PackageNode node = (PackageNode)Node;

        Vector2           size         = Vector2.zero;
        List <CityLayout> childLayouts = new List <CityLayout>();

        GameObj = MonoBehaviour.Instantiate(prefabs[ObjectType.Package], Vector3.zero, Quaternion.identity);
        GameObj.GetComponent <Details>().Node = Node;

        // Build All Child Packages
        foreach (PackageNode childPkg in node.Packages)
        {
            PackageObject po      = new PackageObject(childPkg, prefabs);
            GameObject    childGo = po.Build();
            childLayouts.Add(po);

            size += new Vector2(po.LayoutSize.x, po.LayoutSize.z);
        }

        // Build All Child Classes
        foreach (ClassNode childCls in node.Classes)
        {
            ClassObject co      = new ClassObject(childCls, prefabs);
            GameObject  childGo = co.Build();
            childLayouts.Add(co);

            size += new Vector2(co.LayoutSize.x, co.LayoutSize.z);
        }

        LayoutChildren(GameObj, childLayouts, size);

        return(GameObj);
    }
Ejemplo n.º 12
0
        public int DeleteClass(ClassObject _class)
        {
            try
            {
                string delQuery = "DELETE FROM [dbo].[class_tbl] WHERE classId = (@ClassId);";

                SqlParameter param1 = new SqlParameter("@ClassId", SqlDbType.Int, int.MaxValue, "classId");
                param1.Value = _class.ClassId;

                sqlParameters = new List <SqlParameter>();
                sqlParameters.Add(param1);

                adminDataAccess = new DataAccess();

                if (param1.Value == null)
                {
                    throw new MyException();
                }
                else
                {
                    Task <int> task = Task.Run(() => adminDataAccess.ExecuteCommandAsync(delQuery, CommandType.Text, sqlParameters));

                    return(task.Result);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Ejemplo n.º 13
0
    // create a new player stats object, populate it, and send it to be saved to player prefs
    private void CreateCharacter(ClassObject chosenClass)
    {
        PlayerStats characterStats = new PlayerStats();

        characterStats.Class                      = chosenClass.className;
        characterStats.SuccessfulRuns             = 0;
        characterStats.FlaggedForDeletion         = false;
        characterStats.MinimumDifficultyModifier  = 1.0f;
        characterStats.MaximumDifficultyModifier  = 3.0f;
        characterStats.CurrentDifficultyModifier  = 1.0f;
        characterStats.TotalScore                 = 0;
        characterStats.TotalHealth                = chosenClass.health;
        characterStats.CurrentHealth              = chosenClass.health;
        characterStats.TotalRunSpeed              = chosenClass.playerSpeed;
        characterStats.TotalRunSpeedIncreases     = 0;
        characterStats.MaxRunSpeedReached         = false;
        characterStats.TotalRateOfFire            = 0.5f;
        characterStats.TotalRateOfFireIncreases   = 0;
        characterStats.MaxRateOfFireReached       = false;
        characterStats.AttackDamageIncreaseAmount = chosenClass.projectileDamage;
        characterStats.ProjectileFlightSpeed      = chosenClass.projectileSpeed;
        characterStats.InventoryOneFilled         = false;
        characterStats.InventoryTwoFilled         = false;
        characterStats.InventoryOneItem           = "none";
        characterStats.InventoryTwoItem           = "none";
        PlayerPrefs.SetInt("CurrentBestStreak", 0);
        characterStats.CurrentLevel        = 1;
        characterStats.RoomsClearedCounter = 0;
        GetComponent <PlayerStatHandler>().SavePlayerStats(characterStats);
    }
Ejemplo n.º 14
0
        public AttributeFlyout(ClassObject instance, Flyout flyout)
        {
            InitializeComponent();
            _instance = instance;
            _flyout   = flyout;

            // set values
            this.AttributeNameField.PlaceholderText = "New attribute name";
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Translates all the defined methods.
 /// </summary>
 /// <param name="cObject"></param>
 private void TranslateMethods(ClassObject cObject)
 {
     foreach (string method in cObject.Methods)
     {
         result.Append(@"\tab\cf2 \b public void \b0 \cf1 " + char.ToLower(method[0]) + method.Substring(1) + @"() \{\line");
         result.Append(@"\tab\}");
         result.Append(@"\line\line");
     }
 }
Ejemplo n.º 16
0
        static public void native_copy(ClassObject builder, ClassString bard_st, char[] array, int to_index)
        {
            String st = bard_st.data;

            for (int i = 0; i < st.Length; ++i)
            {
                array[to_index + i] = st[i];
            }
        }
        static void Main(string[] args)
        {
            LW.InitLog();
            LW.SetLogLevel(LogLevel.Dbg);
            DataBaseOperation.InitialiseClient();

            LW.D(DataBaseOperation.QuerySingleData(new DBQuery().WhereEqualTo("realname", "刘浩宇"), out UserObject me));
            LW.D(me);
            ClassObject co = new ClassObject()
            {
                CDepartment = "学部",
                CGrade      = "1年级",
                CNumber     = "5班",
                TeacherID   = me.ObjectId
            };

            LW.D(DataBaseOperation.CreateData(ref co));
            me.ClassList.Add(co.ObjectId);
            LW.D(co);


            SchoolBusObject bo = new SchoolBusObject()
            {
                BusName   = "校车方向1",
                TeacherID = me.ObjectId
            };

            LW.D(DataBaseOperation.CreateData(ref bo));

            LW.D(bo);

            for (int cn = 1; cn < 40; cn++)
            {
                StudentObject stu = new StudentObject()
                {
                    BusID       = bo.ObjectId,
                    ClassID     = co.ObjectId,
                    Sex         = "M",
                    StudentName = "学生-" + cn.ToString("000"),
                    AHChecked   = false,
                    CSChecked   = false,
                    LSChecked   = false
                };
                LW.D(DataBaseOperation.CreateData(ref stu));

                LW.D(stu);
                if (cn < 21)
                {
                    me.ChildList.Add(stu.ObjectId);
                }
            }

            me.HeadImagePath = "liuhaoyu.gif";
            LW.D(DataBaseOperation.UpdateData(ref me));
            LW.D(me);
        }
Ejemplo n.º 18
0
 private void TranslateMethods(ClassObject cObject)
 {
     foreach (string methodName in cObject.Methods)
     {
         result.Append(@"\tab\cf12 func \cf13" + CapitalFirst(methodName) + @"\cf12() -> void\line");
         result.Append(@"\tab\{\line");
         result.Append(@"\line");
         result.Append(@"\tab\}\line");
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Translates the methods of the cobject into c# code.
 /// </summary>
 /// <param name="cObject"></param>
 private void TranslateMethods(ClassObject cObject)
 {
     foreach (string methodName in cObject.Methods)
     {
         result.Append(@"\tab\tab\cf9public void \cf1" + CapitalFirst(methodName) + @"()\line");
         result.Append(@"\tab\tab\{\line");
         result.Append(@"\line");
         result.Append(@"\tab\tab\}\line");
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        /// オブジェクト生成処理のTypeScript変換
        /// </summary>
        /// <param name="condition">ExpressionSyntaxインスタンス</param>
        /// <param name="localDeclarationStatements">ローカル変数リスト</param>
        /// <returns>TypeScriptに変換した文字列</returns>
        private string ConvertExpression(ObjectCreationExpressionSyntax condition, List <string> localDeclarationStatements)
        {
            var equalsValueClauseSyntax = condition.Parent as EqualsValueClauseSyntax;

            if (equalsValueClauseSyntax == null)
            {
                return(condition.ToString());
            }
            return(ClassObject.GetInstance().GetCreateInitializeValue(condition.Type, equalsValueClauseSyntax));
        }
Ejemplo n.º 21
0
        public void FillWithClass(ClassObject cObject)
        {
            _cObject = cObject;
            //PrimitiveListViewType = new ListView();
            if (cObject == null)
            {
                return;
            }

            this.ClassNameTextInput.Text = _cObject.ClassName;
            ColorTextInput.Text          = ((_cObject as DrawableClassObject).Brush as SolidColorBrush).Color.ToString();
            ColorRepresenter.Background  = (_cObject as DrawableClassObject).Brush;
            PrimitiveListViewType.Items.Clear();
            PrimitiveListViewName.Items.Clear();

            foreach (string identifier in _cObject.PrimitiveAttributes.Keys.ToList())
            {
                TextBlock tIdent = new TextBlock();
                tIdent.Text   = identifier;
                tIdent.Height = 30;

                string type;
                switch (_cObject.PrimitiveAttributes[identifier])
                {
                case PrimitiveTypes.Boolean:
                    type = "boolean";
                    break;

                case PrimitiveTypes.Float:
                    type = "float";
                    break;

                case PrimitiveTypes.Integer:
                    type = "int";
                    break;

                case PrimitiveTypes.String:
                    type = "String";
                    break;

                default:
                    type = "type";
                    break;
                }

                TextBlock tType = new TextBlock();
                tType.IsTextSelectionEnabled  = false;
                tIdent.IsTextSelectionEnabled = false;
                tType.Text   = type;
                tType.Height = 30;

                PrimitiveListViewType.Items.Add(tType);
                PrimitiveListViewName.Items.Add(tIdent);
            }
        }
Ejemplo n.º 22
0
 public void reportUndeclaredVariables()
 {
     ClassObject.withUndeclaredVariablesDo((selector, undeclared) => {
         Console.Write("Undeclared: ");
         Console.WriteLine(undeclared.PrimitiveValue);
     });
     MetaclassObject.withUndeclaredVariablesDo((selector, undeclared) => {
         Console.Write("Undeclared: ");
         Console.WriteLine(undeclared.PrimitiveValue);
     });
 }
Ejemplo n.º 23
0
        /// <summary>
        /// Translates getters and setters for the more complex Object such as creatung arrays.
        /// </summary>
        /// <param name="cObject"></param>
        private void TranslateGetterAndSettersForObjectAttributes(ClassObject cObject)
        {
            HashSet <string> includedSet = new HashSet <string>();

            foreach (var attribute in cObject.Attributes)
            {
                if (includedSet.Contains(attribute.ClassObject.Id))
                {
                    continue;
                }
                includedSet.Add(attribute.ClassObject.Id);

                string type          = "";
                string attributeName = "";
                if (NumberOfInstances[attribute.ClassObject.Id] > 1)
                {
                    type = (@"\cf1" + attribute.ClassObject.ClassName + @"[]");
                    if (attribute.AttributeName == null)
                    {
                        attributeName = attribute.ClassObject.ClassName.ToLowerInvariant() + "s";
                    }
                    else
                    {
                        attributeName = attribute.AttributeName;
                    }
                }
                else
                {
                    type = (attribute.ClassObject.ClassName);
                    if (attribute.AttributeName == null)
                    {
                        attributeName = attribute.ClassObject.ClassName.ToLowerInvariant();
                    }
                    else
                    {
                        attributeName = attribute.AttributeName;
                    }
                }

                //generate getter
                string toUpperCaseAttribute = char.ToUpper(attributeName[0]) + attributeName.Substring(1);
                result.Append(@"\tab\cf2 \b public\b0  " + type + @" \cf1 get" + toUpperCaseAttribute + @"() \{\line");
                result.Append(@"\tab\tab\cf2 \b return this\b0 \cf1." + @"\cf1" + attributeName + @";\line");
                result.Append(@"\tab\}\line");
                result.Append(@"\line");

                //generate setter
                result.Append(@"\tab\cf2 \b public void\b0 \cf1  set" + toUpperCaseAttribute + @"(" + type + " " + attributeName + @") \{\line");
                result.Append(@"\tab\tab\cf2 \b this\b0 \cf1." + @"\cf1" + attributeName + @" = " + attributeName + @";\line");
                result.Append(@"\tab\}");
                result.Append(@"\line\line");
            }
        }
Ejemplo n.º 24
0
            public override void EnterClassDeclaration([NotNull] SomeLanguageParser.ClassDeclarationContext context)
            {
                string         className      = context.className().GetText();
                MethodListener methodListener = new MethodListener();

                foreach (var method in context.method())
                {
                    method.EnterRule(methodListener);
                }
                List <Method> methods = methodListener.getMethods();

                parsedClass = new ClassObject(className, methods);
            }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            var  x = new ClassObject();
            long n = x.myId().Value; // The init value is ZERO

            x.myId().Value = 55;     // Extension property set value

            n = -100;
            n = x.myId().Value;      // Extension property get value, value should be 55 not -100
            n.__DEBUG_ECHO();        // display the value

            Pause();
        }
Ejemplo n.º 26
0
        static public ClassString create_from(ClassObject context, char[] array, int count)
        {
            if (count == -1)
            {
                count = array.Length;
            }
            StringBuilder builder = new StringBuilder(count);

            for (int i = 0; i < count; ++i)
            {
                builder.Append(array[i]);
            }
            return(new ClassString(builder.ToString()));
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Builds a class into a StringBuilder.
        /// </summary>
        /// <param name="cObject">the class to be build</param>
        /// <returns></returns>
        public override StringBuilder TranslateClass(ClassObject cObject)
        {
            //if the class is not MainClass and has a name.
            if (String.IsNullOrEmpty(cObject.ClassName) && !(cObject.GetType() == typeof(MainClassObject)))
            {
                result.Append(@"\cf5---------------------------NewClass.h--------------------------\line\line");
            }
            // if the class is MainClass
            else if (cObject.GetType() == typeof(MainClassObject))
            {
                result.Append(@"\cf5--------------------------MainClass.cpp--------------------------\line\line");
                result.Append(@"\cf8#include <iostream.h>\line\line");
                result.Append(@"\cf6int \cf1 main\cf6() \line\{\line");

                foreach (InstanceObject subObject in cObject.Attributes)
                {
                    //result.Append(@"\tab\cf1" + subObject.ClassObject.ClassName + @" \cf1" + subObject.AttributeName.ToLowerInvariant() + @"  \cf6 = new \cf1" + subObject.ClassObject.ClassName + @"\cf6();\line");
                }
                result.Append(@"\cf6\}\line\line");
                return(result);
            }
            else
            {
                result.Append(@"\cf5--------------------------" + cObject.ClassName + ".h----------------------------");
                result.Append(@"\line");
            }

            result.Append(@"\line");

            //Generates the content of the header file.
            GenerateHeader(cObject);

            //if the class is not MainClass and has a name.
            if (String.IsNullOrEmpty(cObject.ClassName) && !(cObject.GetType() == typeof(MainClassObject)))
            {
                result.Append(@"\cf5---------------------------NewClass.cpp---------------------------\line\line");
            }

            else
            {
                result.Append(@"\cf5--------------------------" + cObject.ClassName + ".cpp----------------------------");
            }

            result.Append(@"\line");

            //Generates the content of the cpp file.
            GenerateCpp(cObject);

            return(result);
        }
Ejemplo n.º 28
0
    public void SelectClass()
    {
        // this is where the player stats object will get created and saved to playerprefs... enabling the player
        // to enter a dungeon

        string classText = GetComponent <ClassSelectionIdentifier>().identifier;

        database    = GetComponent <DBAccess>();
        chosenClass = database.GetClassInfo(classText);

        // take that chosen class from the database and make a player prefs character
        CreateCharacter(chosenClass);

        Invoke("HideMenu", 0.2f);
    }
Ejemplo n.º 29
0
        /// <summary>
        /// Translates a main class from cObject.
        /// </summary>
        /// <param name="cObject"></param>
        private void TranslateMainClass(ClassObject cObject)
        {
            result.Append(@"\cf2\b public class\b0 \cf1  MainClass \{\line\line");
            result.Append(@"\tab\cf2\b public static void \b0 \cf1 main(String[] args) \{\line");
            foreach (InstanceObject subObject in cObject.Attributes)
            {
                string classString = subObject.ClassObject.ClassName;
                string attrString  = subObject.AttributeName ?? classString.ToLowerInvariant();

                result.Append(@"\tab\tab\cf2\b " + classString + @"\b0  \cf1" + attrString +
                              @" = \cf2\b new \b0 \cf1" + classString + @"();\line");
            }
            result.Append(@"\cf1\tab\}\line\line");
            result.Append(@"\cf1\}\line\line");
        }
 public ViewStudentInfo(int parentsCount, bool classFound, bool classTeacherFound, bool busFound, bool busTeacherFound, StudentObject student, ClassObject @class, UserObject CTeacher, UserObject[] Parents, SchoolBusObject schoolbus, UserObject BTeacher, bool StudentFound)
 {
     ParentsCount      = parentsCount;
     ClassFound        = classFound;
     ClassTeacherFound = classTeacherFound;
     BusFound          = busFound;
     BusTeacherFound   = busTeacherFound;
     _student          = student;
     _class            = @class;
     _CTeacher         = CTeacher;
     _Parents          = Parents;
     _schoolbus        = schoolbus;
     _BTeacher         = BTeacher;
     this.StudentFound = StudentFound;
 }
Ejemplo n.º 31
0
 public static ClassString describe( ClassObject stack_trace_obj, long ip )
 {
     return new ClassString("[Compiled Code]");
 }
Ejemplo n.º 32
0
 public static void _object( ClassWeakReference context, ClassObject obj )
 {
     context.weak_reference.Target = obj;
 }
Ejemplo n.º 33
0
 public static ClassWeakReference create_from( Object context, ClassObject obj )
 {
     return new ClassWeakReference( obj );
 }
Ejemplo n.º 34
0
 void LoadClassObject(ClassObject o)
 {
     o.Name = "aaa";
     o.Id = 111;
 }
Ejemplo n.º 35
0
 public static ClassString create_from( ClassObject context, char ch )
 {
     return new ClassString( ""+ch );
 }
Ejemplo n.º 36
0
 public static ClassString create_from( ClassObject context, char[] array, int count )
 {
     if (count == -1) count = array.Length;
       StringBuilder builder = new StringBuilder(count);
       for (int i=0; i<count; ++i) builder.Append( array[i] );
       return new ClassString( builder.ToString() );
 }
Ejemplo n.º 37
0
 public static void close( ClassObject socket )
 {
     Bard.log( "TODO: NativeSocket::close()" );
 }
Ejemplo n.º 38
0
 public static bool native_is_trial( ClassObject obj )
 {
     return (new Microsoft.Phone.Marketplace.LicenseInformation().IsTrial());
 }
Ejemplo n.º 39
0
 public static void write( ClassObject writer, char ch )
 {
     Bard.log( "TODO: NativeSocketWriter::write()" );
 }
Ejemplo n.º 40
0
 public static char read( ClassObject reader )
 {
     Bard.log( "TODO: NativeSocketReader::read()" );
       return (char) 0;
 }
Ejemplo n.º 41
0
 public static bool has_another( ClassObject reader )
 {
     Bard.log( "TODO: NativeSocketReader::has_another()" );
       return false;
 }
Ejemplo n.º 42
0
 public static int available( ClassObject reader )
 {
     Bard.log( "TODO: NativeSocketReader::available()" );
       return 0;
 }
Ejemplo n.º 43
0
 public static bool is_connected( ClassObject socket )
 {
     Bard.log( "TODO: NativeSocket::is_connected()" );
       return false;
 }
Ejemplo n.º 44
0
 public static void init( ClassObject socket, ClassString address, int port )
 {
     Bard.log( "TODO: NativeSocket::init()" );
 }
Ejemplo n.º 45
0
 public static void prompt( ClassObject context, ClassString title, ClassString description,
     ClassString default_value)
 {
     NativeWindowsPhone7.default_value = default_value.data;
       Guide.BeginShowKeyboardInput( PlayerIndex.One, title.data, description.data,
     (default_value.data == null) ? "" : default_value.data, on_keyboard_finished, null );
 }
Ejemplo n.º 46
0
 public static long[] native_history( ClassObject stack_trace_obj )
 {
     return null;
 }
Ejemplo n.º 47
0
 public static void native_copy( ClassObject builder, ClassString bard_st, char[] array, int to_index )
 {
     String st = bard_st.data;
       for (int i=0; i<st.Length; ++i)
       {
     array[to_index+i] = st[i];
       }
 }
Ejemplo n.º 48
0
 public static int hash_code( ClassObject context )
 {
     return context.GetHashCode();
 }