private MppTask GetTask(Mpxj.Task task)
            {
                if (task != null)
                {
                    java.util.Date taskStartDate        = task.Start;
                    java.util.Date taskFinishDate       = task.Finish;
                    java.util.Date taskActualStartDate  = task.ActualStart;
                    java.util.Date taskActualFinishDate = task.ActualFinish;
                    java.util.Date taskConstraintDate   = task.ConstraintDate;

                    Mpxj.Task      parentTask   = task.ParentTask;
                    java.util.List predecessors = task.Predecessors;
                    MppTask        returnTask   = new MppTask();

                    returnTask.Id             = task.ID.longValue();
                    returnTask.UniqueId       = task.UniqueID.longValue();
                    returnTask.ParentTaskId   = (parentTask == null) ? -1 : parentTask.UniqueID.longValue();
                    returnTask.ConstraintType = (MppConstraintType)task.ConstraintType.Value;

                    returnTask.Name = task.Name;

                    returnTask.StartDate        = Utility.GetDateTimme(taskStartDate);
                    returnTask.ConstraintDate   = Utility.GetDateTimme(taskConstraintDate);
                    returnTask.FinishDate       = Utility.GetDateTimme(taskFinishDate);
                    returnTask.ActualStartDate  = Utility.GetDateTimme(taskActualStartDate);
                    returnTask.ActualFinishDate = Utility.GetDateTimme(taskActualFinishDate);

                    returnTask.PercentageComplete = task.PercentageComplete.doubleValue();
                    returnTask.Priority           = (MppPriority)task.Priority.Value;
                    returnTask.ResourceNames      = task.ResourceNames;
                    returnTask.Notes = task.Notes;

                    if (predecessors != null)
                    {
                        for (int i = 0; i < predecessors.size(); i++)
                        {
                            Relation relation = predecessors.get(i) as Mpxj.Relation;
                            if (relation != null)
                            {
                                returnTask.PredecessorTaskIds.Add(relation.TargetTask.ID.longValue());
                            }
                        }
                    }

                    java.util.List resourcesList = task.ResourceAssignments;
                    Mpxj.Resource  resource      = null;

                    for (int i = 0; i < resourcesList.size(); i++)
                    {
                        resource = ((Mpxj.ResourceAssignment)resourcesList.get(i)).Resource as Mpxj.Resource;
                        returnTask.Resources.Add(GetResource(resource, false));
                    }


                    return(returnTask);
                }

                return(null);
            }
Esempio n. 2
0
        public static void replaceAll(List @this, java.util.function.UnaryOperator unaryoperator)
        {
            int s = @this.size();

            for (int i = 0; i < s; i++)
            {
                @this.set(i, unaryoperator.apply(@this.get(i)));
            }
        }
Esempio n. 3
0
        public void commandLineParser()
        {
            ServerCommand servercommand;

            for (; commands.size() > 0; commandHandler.handleCommand(servercommand))
            {
                servercommand = (ServerCommand)commands.remove(0);
            }
        }
Esempio n. 4
0
    // Qt's asynchronous DNS resolution mechanism will call this method
    // when the DNS resolution for this peer's hostname is complete.
    // "Completion" might mean either success or failure:
    // on failure, we'll get a QHostInfo object with no IP addresses.
    public void lookupDone(QHostInfo hi)
    {
        hostinfo = hi;
        addrs    = hi.addresses();
        Console.WriteLine("Peer " + name
                          + ": got " + addrs.size() + " addresses");

        //Console.WriteLine(((QHostAddress)addrs.get(0)).ToString());
        IPaddr = ((QHostAddress)addrs.get(0)).ToString();
    }
            private void GetAssignedTasks(Resource resource, MppResource returnResource)
            {
                java.util.List     tasksList = resource.TaskAssignments;
                ResourceAssignment task      = null;

                for (int i = 0; i < tasksList.size(); i++)
                {
                    task = tasksList.get(i) as ResourceAssignment;
                    returnResource.Tasks.Add(GetTask(task.Task));
                }
            }
 private void PopulateTasks(ProjectFile projectFile, MppProject project)
 {
     java.util.List tasksList = projectFile.AllTasks;
     Mpxj.Task      task      = null;
     for (int i = 0; i < tasksList.size(); i++)
     {
         task = tasksList.get(i) as Mpxj.Task;
         project.AllTasks.Add(GetTask(task));
     }
     BuildTaskHiererchy(project);
 }
Esempio n. 7
0
        /// <summary>
        /// 返回bsonDoc对象
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public static List <T> ToList <T>(this java.util.List terms)
        {
            var docList = new List <T>();

            for (int i = terms.size() - 1; i >= 0; i--)
            {
                var wordStr = terms.get(i);
                docList.Add((T)wordStr);
            }
            return(docList);
        }
Esempio n. 8
0
 public static IEnumerable <T> JavaListToCSharpList <T>(this java.util.List list)
 {
     if (list == null)
     {
         throw new ArgumentNullException(nameof(list));
     }
     for (var i = 0; i < list.size(); i++)
     {
         yield return((T)list.get(i));
     }
 }
Esempio n. 9
0
        /// <summary>
        /// javaList To List
        /// </summary>
        /// <param name="terms"></param>
        /// <returns></returns>
        private static List <string> SegmentListToList(java.util.List terms)
        {
            var docList = new List <string>();

            for (int i = terms.size() - 1; i >= 0; i--)
            {
                var wordStr = terms.get(i).ToString();
                docList.Add(wordStr);
            }
            return(docList);
        }
Esempio n. 10
0
        private void doTick()
        {
            var arraylist = new ArrayList();

            for (Iterator iterator = field_6037_b.keySet().iterator(); iterator.hasNext();)
            {
                var s = (string)iterator.next();
                int k = ((Integer)field_6037_b.get(s)).intValue();
                if (k > 0)
                {
                    field_6037_b.put(s, Integer.valueOf(k - 1));
                }
                else
                {
                    arraylist.add(s);
                }
            }

            for (int i = 0; i < arraylist.size(); i++)
            {
                field_6037_b.remove(arraylist.get(i));
            }

            AxisAlignedBB.clearBoundingBoxPool();
            Vec3D.initialize();
            deathTime++;
            if (deathTime % 20 == 0)
            {
                configManager.sendPacketToAllPlayers(new Packet4UpdateTime(worldMngr.getWorldTime()));
            }
            worldMngr.tick();
            while (worldMngr.func_6156_d())
            {
                ;
            }
            worldMngr.updateEntities();
            networkServer.func_715_a();
            configManager.func_637_b();
            entityTracker.updateTrackedEntities();
            for (int j = 0; j < field_9010_p.size(); j++)
            {
                ((IUpdatePlayerListBox)field_9010_p.get(j)).update();
            }

            try
            {
                commandLineParser();
            }
            catch (java.lang.Exception exception)
            {
                logger.log(Level.WARNING, "Unexpected exception while parsing console command", exception);
            }
        }
Esempio n. 11
0
        public static IEnumerable <T> AsEnumerable <T>(this java.util.List list)
        {
            if (list == null)
            {
                yield break;
            }

            for (int i = 0; i < list.size(); i++)
            {
                yield return((T)list.get(i));
            }
        }
            private void PopulateResources(ProjectFile projectFile, MppProject project)
            {
                java.util.List resourcesList = projectFile.Resources;
                Mpxj.Resource  resource      = null;

                for (int i = 0; i < resourcesList.size(); i++)
                {
                    resource = resourcesList.get(i) as Mpxj.Resource;

                    project.Resources.Add(GetResource(resource, true));
                }
            }
Esempio n. 13
0
    public static List <T> ToList <T>(this java.util.List list)
    {
        List <T> newList = new List <T>();

        if (list != null)
        {
            for (int index = 0; index < list.size(); index++)
            {
                newList.Add((T)list.get(index));
            }
        }
        return(newList);
    }
Esempio n. 14
0
 // Send a datagram to this peer,
 // using any and all IP addresses we have for it.
 // This isn't very friendly to hosts with multiple IP addresses:
 // we really should figure out which address works and use that one.
 public void send(byte[] msg)
 {
     // Note that Qt Jambi converts QList into java.util.List,
     // which unfortunately isn't compatible with C#'s foreach,
     // and also isn't a generic that preserves the content type.
     // So we have to iterate manually over the list,
     // and cast each element we get to a QHostAddress explicitly.
     for (int i = 0; i < addrs.size(); i++)
     {
         net.sock.writeDatagram(msg,
                                (QHostAddress)addrs.get(i), port);
     }
 }
Esempio n. 15
0
        public static List <T> ToList <T>(this java.util.List list)
        {
            if (list == null)
            {
                return(null);
            }

            var newList = new List <T>();

            for (int i = 0; i < list.size(); i++)
            {
                newList.Add((T)list.get(i));
            }

            return(newList);
        }
        public override bool Equals(object b)
        {
            if (b == null || !(b is List))
            {
                return(false);
            }
            int  s = this.size();
            List l = (List)b;

            if (s != l.size())
            {
                return(false);
            }
            for (int i = 0; i < s; i++)
            {
                object e1 = this.get(i);
                object e2 = l.get(i);
                if (!(e1 == null ? e2 == null : e1.Equals(e2)))
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 17
0
    // note Awake, Start, Update, etc. made public virtual so can override in extensions

    public virtual void Awake()      // do non-primitive initializations for MonoBehavior's here
    {
        taskHandle    = new EventWaitHandle(false, EventResetMode.ManualReset);
        menuHandle    = new EventWaitHandle(false, EventResetMode.ManualReset);
        sensingHandle = new EventWaitHandle(false, EventResetMode.ManualReset);
        w32Classes    = new W32ClassBatchUnregisterer();
        program       = new Program();
        player        = new Player("Player");
        npc           = new NPC(this, "NPC");
        interaction   = new Interaction(npc, player);
        interaction.setOk(false);          // suppress default Ok's
        // support calling Debug.Log from scripts
        getDisco().eval(
            "Debug = { Log : function (obj) { TextWindow.Program.Log(obj); }}", "DiscoUnity");

        discoThread = new Thread((ThreadStart) delegate {
            try {
                while (discoRunning)
                {
                    // start console if requested
                    if (Console && !formStarted)
                    {
                        formStarted = true;
                        //second parameter is called when the console Form is loaded
                        program.StartWindow(formThread, (sender, evt) => {
                            if (onWindows)
                            {
                                w32Classes.AddWindowClassesRecursively((Control)sender);
                            }
                            formLoaded = true;
                            form.Writer.WriteLine("    DiscoUnity " + VERSION);
                            console = new edu.wpi.disco.Console(null, interaction);
                            interaction.setConsole(console);
                            console.init(getDisco());
                            console.setReader(new Program.ConsoleReader(form));
                            form.shell.shellTextBox.GotFocus += (s, e) => {                             // improve window readability
                                if (!firstPrompt && form.shell.shellTextBox.IsCaretJustBeforePrompt())
                                {
                                    firstPrompt = false;
                                    form.Writer.Write(console.getPrompt());
                                }
                            };
                            interaction.start(true);                             // start console thread
                        });
                    }
                    // do Sensing on Unity thread
                    sensing = true;
                    sensingHandle.WaitOne();
                    sensingHandle.Reset();
                    UpdateDisco(getDisco());               // manage toplevel goals
                    getDisco().tick();                     // update conditions
                    // process player menu choice, if any
                    if (chosen != null)
                    {
                        getDisco().doneUtterance(chosen.task, formatted);
                        done(true, chosen.task, chosen.contributes);
                        chosen    = null;
                        formatted = null;
                    }
                    // process NPC response, if any
                    Agenda.Plugin.Item item = npc.respondIf(interaction, true);
                    if (item != null && !item.task.Equals(npc.getLastUtterance()))
                    {
                        npc.done(interaction, item);
                    }
                    if (Menu)
                    {
                        // update player menu options (including empty)
                        java.util.List newItems = player.generate(interaction);
                        if (!newItems.equals(items))
                        {
                            String [] choices = null;
                            if (!newItems.isEmpty())
                            {
                                choices = new String[newItems.size()];
                                int i   = 0;
                                java.util.Iterator l = newItems.iterator();
                                while (l.hasNext())
                                {
                                    choices[i++] = translate(((Agenda.Plugin.Item)l.next()).task);
                                }
                            }
                            lastMenu = null;                             // block choosing from old menu
                            menu     = choices;
                            items    = newItems;
                            newMenu  = true;
                            menuHandle.WaitOne();                             // execute on Unity thread
                            menuHandle.Reset();
                            lastMenu = choices;
                        }
                    }
                    // sleep for a while
                    Thread.Sleep(Sleep);
                }
            } catch (Exception e) {
                Debug.Log("Disco thread terminating: " + e);
                if (Tracing)
                {
                    Debug.Log(e.ToString());
                }
            }
        });
        discoThread.IsBackground = true;
        discoThread.Priority     = Priority;

        formThread = new Thread((ThreadStart) delegate {
            try {
                /*
                 *      while (true) { // for testing
                 *              program.WriteLine("Echo: " + program.ReadLine());
                 *      }
                 */
                form = program.GetForm();
                java.lang.System.setOut(new java.io.PrintStream(new Program.ConsoleOut(form.Writer), true));
                java.lang.System.setErr(java.lang.System.@out);
            } catch (Exception e) { Debug.Log("Console form thread terminating: " + e); }
        });
        formThread.IsBackground = true;
    }