示例#1
0
 public static readonly ResultDataContent public static ResultDataContent[] fromNames(java.util.List <JavaToDotNetGenericWildcard> names)
 {
     if (names == null || names.isEmpty())
     {
         return(null);
     }
     ResultDataContent[] result = new ResultDataContent[names.size()]; java.util.Iterator <JavaToDotNetGenericWildcard> name = names.iterator(); for (int i = 0; i < result.length; i++)
     {
         Object contentName = name.next(); if (contentName instanceof String)
         {
             try { result[i] = valueOf((( String )contentName).toLowerCase()); } catch (IllegalArgumentException e) { throw new IllegalArgumentException("Invalid result data content specifier: " + contentName); }
         }
示例#2
0
 /**
  * Factory method to create a SetList using the supplied list to retain order.
  * <p>
  * If the list contains duplicates, these are removed (first indexed one kept).
  * A <code>HashSet</code> is used for the set behaviour.
  *
  * @param list  the list to decorate, must not be null
  * @throws IllegalArgumentException if list is null
  */
 public static SetUniqueList decorate(java.util.List <Object> list)
 {
     if (list == null)
     {
         throw new java.lang.IllegalArgumentException("List must not be null");
     }
     if (list.isEmpty())
     {
         return(new SetUniqueList(list, new java.util.HashSet <Object>()));
     }
     else
     {
         java.util.List <Object> temp = new java.util.ArrayList <Object>(list);
         list.clear();
         SetUniqueList sl = new SetUniqueList(list, new java.util.HashSet <Object>());
         sl.addAll(temp);
         return(sl);
     }
 }
示例#3
0
        /// <summary>
        /// Internal utility to dump relationship lists in a structured format that can
        /// easily be compared with the tabular data in MS Project.
        /// </summary>
        /// <param name="relations">project file</param>
        public static void dumpRelationList(java.util.List relations)
        {
            if (relations != null && relations.isEmpty() == false)
            {
                if (relations.size() > 1)
                {
                    System.Console.Write('"');
                }
                bool first = true;
                foreach (Relation relation in relations.ToIEnumerable())
                {
                    if (!first)
                    {
                        System.Console.Write(',');
                    }
                    first = false;
                    System.Console.Write(relation.TargetTask.ID);
                    Duration lag = relation.Lag;
                    if (relation.Type != RelationType.FINISH_START || lag.Duration != 0)
                    {
                        System.Console.Write(relation.Type);
                    }

                    if (lag.Duration != 0)
                    {
                        if (lag.Duration > 0)
                        {
                            System.Console.Write("+");
                        }
                        System.Console.Write(lag);
                    }
                }
                if (relations.size() > 1)
                {
                    System.Console.Write('"');
                }
            }
        }
示例#4
0
        /**
         * Updates the current iterator field to ensure that the current Iterator
         * is not exhausted
         */
        protected void updateCurrentIterator()
        {
            if (currentIterator == null)
            {
                if (iteratorChain.isEmpty())
                {
                    currentIterator = EmptyIterator.INSTANCE;
                }
                else
                {
                    currentIterator = (java.util.Iterator <Object>)iteratorChain.get(0);
                }
                // set last used iterator here, in case the user calls remove
                // before calling hasNext() or next() (although they shouldn't)
                lastUsedIterator = currentIterator;
            }

            while (currentIterator.hasNext() == false && currentIteratorIndex < iteratorChain.size() - 1)
            {
                currentIteratorIndex++;
                currentIterator = (java.util.Iterator <Object>)iteratorChain.get(currentIteratorIndex);
            }
        }
示例#5
0
        /**
         * Starts a new process based on the current state of this process builder.
         *
         * @return the new {@code Process} instance.
         * @throws NullPointerException
         *             if any of the elements of {@link #command()} is {@code null}.
         * @throws IndexOutOfBoundsException
         *             if {@link #command()} is empty.
         * @throws SecurityException
         *             if {@link SecurityManager#checkExec(String)} doesn't allow
         *             process creation.
         * @throws IOException
         *             if an I/O error happens.
         */
        public Process start()//throws IOException {
        {
            if (commandJ.isEmpty())
            {
                throw new IndexOutOfBoundsException();
            }
            String[] cmdArray = new String[commandJ.size()];
            for (int i = 0; i < cmdArray.Length; i++)
            {
                if ((cmdArray[i] = commandJ.get(i)) == null)
                {
                    throw new NullPointerException();
                }
            }
            String[] envArray = new String[environmentJ.size()];
            int      i2       = 0;

            /*
             * foreach (Map.Entry<String, String> entry in environmentJ.entrySet()) {
             * envArray[i2++] = entry.getKey() + "=" + entry.getValue(); //$NON-NLS-1$
             * }
             */
            java.util.Iterator <String> it = environmentJ.keySet().iterator();
            while (it.hasNext())
            {
                String key   = it.next();
                String value = environmentJ.get(key);
                envArray[i2++] = key + "=" + value;
            }

            java.lang.Process process = Runtime.getRuntime().exec(cmdArray, envArray,
                                                                  directoryJ);

            // TODO implement support for redirectErrorStream
            return(process);
        }
示例#6
0
 /**
  * Returns whether this iterator has any more elements.
  * <p>
  * Returns false only if the list originally had zero elements, or
  * all elements have been {@link #remove removed}.
  *
  * @return <code>true</code> if there are more elements
  */
 public bool hasNext()
 {
     return(!list.isEmpty());
 }