Example #1
0
        public Dictionary <string, TbData> RetrieveAdi(ITbBasket target, Dictionary <string, string> Modelinfo)
        {
            Dictionary <string, TbData> Adidictionary = new Dictionary <string, TbData>();
            string tag   = this.Modelinfo["tag"];
            var    setup = new BridgeSetup(false);

            //setup.AddAllJarsClassPath(@"B:\ToolboxAddinExamples\lib");

            setup.AddAllJarsClassPath(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            Bridge.CreateJVM(setup);

            Bridge.RegisterAssembly(typeof(AdiArray).Assembly);
            java.util.List list = AdiArray.getADI(tag, target.Chemical.Smiles);
            if (list.size() == 0)
            {
                return(Adidictionary);
            }

            //create the iterator
            for (int i = 0; i < list.size(); i++)
            {
                AdiArray adicomponent = (AdiArray)list.get(i);
                Adidictionary.Add(adicomponent.AdiName, new TbData(new TbUnit(TbScale.EmptyRatioScale.Name, string.Empty), adicomponent.AdiValue));
            }

            return(Adidictionary);
        }
Example #2
0
        public static IReadOnlyList <ChemicalWithData> GetSet(Dictionary <string, string> Modelinfo, TbScale ScaleDeclaration, String Set)
        {
            List <ChemicalWithData> SetList = new List <ChemicalWithData>();

            var setup = new BridgeSetup(false);

            //setup.AddAllJarsClassPath(@"B:\ToolboxAddinExamples\lib");

            setup.AddAllJarsClassPath(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location));
            Bridge.CreateJVM(setup);
            Bridge.RegisterAssembly(typeof(ChemicalinSet).Assembly);
            java.util.List list = ChemicalinSet.getDataset(Modelinfo["tag"], Set);

            if (list.size() == 0)
            {
                return(SetList);
            }

            for (int i = 0; i < list.size(); i++)
            {
                TbData        Mockdescriptordata = new TbData(new TbUnit(TbScale.EmptyRatioScale.FamilyGroup, TbScale.EmptyRatioScale.BaseUnit), new double?());
                ChemicalinSet cur_Chemical       = (ChemicalinSet)list.get(i);
                TbData        cur_exp            = (TbData)Utilities.ConvertData(cur_Chemical.getExperimental(), ScaleDeclaration, Modelinfo);
                SetList.Add(new ChemicalWithData(cur_Chemical.getCAS(), new[] { "N.A." }, cur_Chemical.getSmiles(),
                                                 new TbDescribedData[] { new TbDescribedData(Mockdescriptordata, null) },
                                                 new TbDescribedData(cur_exp, null)));
            }
            return(SetList);
        }
Example #3
0
 private static string[] finishSplit(java.util.List <string> list, string input, int
                                     begin, int maxSize, int limit)
 {
     // Add trailing text.
     if (begin < input.Length)
     {
         list.add(Sharpen.StringHelper.Substring(input, begin));
     }
     else
     {
         if (limit != 0)
         {
             // No point adding the empty string if limit == 0, just to remove it below.
             list.add(string.Empty);
         }
     }
     // Remove all trailing empty matches in the limit == 0 case.
     if (limit == 0)
     {
         int i = list.size() - 1;
         while (i >= 0 && string.IsNullOrEmpty(list.get(i)))
         {
             list.remove(i);
             i--;
         }
     }
     // Convert to an array.
     return(list.toArray(new string[list.size()]));
 }
Example #4
0
 public static string RemoteCommandResponse(string Command)
 {
     if (ClientDDM != null && !ClientDDM.isClosed())
     {
         java.util.List lstMessages = ClientDDM.executeReturnMessageList(Command);
         if (lstMessages == null || lstMessages.size() == 0)
         {
             return("");
         }
         else
         {
             for (int msgidx = 0; msgidx < lstMessages.size(); msgidx++)
             {
                 com.ibm.jtopenlite.Message msg = (com.ibm.jtopenlite.Message)lstMessages.get(0);
                 if (msg.getSeverity() > 10)
                 {
                     return(msg.getText());
                 }
             }
         }
         // Get here means no messages with Sev > 10, so ok
         return("");
     }
     else
     {
         return("Not connected.");
     }
 }
Example #5
0
        /**
         * Add a Comparator to the end of the chain using the
         * given sort order
         *
         * @param comparator Comparator to add to the end of the chain
         * @param reverse    false = forward sort order; true = reverse sort order
         */
        public void addComparator(java.util.Comparator <Object> comparator, bool reverse)
        {
            checkLocked();

            comparatorChain.add(comparator);
            if (reverse == true)
            {
                orderingBits.set(comparatorChain.size() - 1);
            }
        }
Example #6
0
        /// <summary>
        /// Get a thumbnail of the document, if possible
        /// </summary>
        /// <param name="sizeX">The maximum X size of the thumbnail</param>
        /// <param name="sizeY">The maximum y size of the thumbnail</param>
        /// <param name="forceFullSize">True if the thumbnail should be exatly XxY pixels and False if the thumbnail
        /// should fit inside a XxY box but should maintain its aspect ratio</param>
        /// <returns>A JPEG byte thumbnail or null if the thumbnail canĀ“t be generated</returns>
        public override byte[] GetThumbnail(int sizeX, int sizeY, bool forceFullSize)
        {
            // If we have no bytes then we can't do anything.
            if (Bytes == null || Bytes.Length == 0)
            {
                return(null);
            }

            try
            {
                org.pdfbox.pdfviewer.PageDrawer pagedrawer = new
                                                             org.pdfbox.pdfviewer.PageDrawer();

                java.io.ByteArrayInputStream byteStream = new java.io.ByteArrayInputStream(Bytes);
                PDDocument     doc   = PDDocument.load(byteStream);
                int            count = doc.getNumberOfPages();
                java.util.List pages = doc.getDocumentCatalog().getAllPages();
                if (pages.size() > 0)
                {
                    PDPage page = pagedrawer.getPage();
                    java.awt.image.BufferedImage  image = page.convertToImage();
                    java.io.ByteArrayOutputStream os    = new java.io.ByteArrayOutputStream();
                    ImageIO.write(image, "jpg", os);
                    byte[] data = os.toByteArray();
                    return(data);
                }
            }
            catch (Exception e)
            {
                log.Error("Failed to get the thumbnail from the PDF file " + Name, e);
            }

            return(null);
        }
Example #7
0
        public void testParseAndVerifySimpleValues()
        {
            string        adl     = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\dadl-parser\src\test\resources\simple_values.dadl");
            DADLParser    parser  = new DADLParser(adl);
            ContentObject content = parser.parse();

            Assert.IsNotNull(content);
            Assert.IsNull(content.getComplexObjectBlock());
            Assert.IsNotNull(content.getAttributeValues());
            Assert.AreEqual(1, content.getAttributeValues().size());
            AttributeValue av = (AttributeValue)content.getAttributeValues().get(0);

            Assert.AreEqual("simple_values", av.getId());
            ObjectBlock ob = av.getValue();

            Assert.IsInstanceOfType(ob, typeof(SingleAttributeObjectBlock));
            SingleAttributeObjectBlock single = (SingleAttributeObjectBlock)ob;

            java.util.List values = single.getAttributeValues();
            Assert.AreEqual(10, values.size());
            assertDateTimeValue((AttributeValue)values.get(0), "2007-10-30T09:22:00");
            assertDateValue((AttributeValue)values.get(1), "2008-04-02");
            assertTimeValue((AttributeValue)values.get(2), "11:09:40");
            assertDurationValue((AttributeValue)values.get(3), "PT10M");
            assertStringValue((AttributeValue)values.get(4), "a string value");
            assertCharacterValue((AttributeValue)values.get(5), 'a');
            assertIntegerValue((AttributeValue)values.get(6), 100);
            assertRealValue((AttributeValue)values.get(7), 9.5);
            assertBooleanValue((AttributeValue)values.get(8), true);
        }
        private IEnumerable <FeedQueueItem> GetExistingQueueItems()
        {
            IList <FeedQueueItem> items = new List <FeedQueueItem>();

            java.util.List jobQueueItems = Client.getFeedJobQueueItems(this.jmxConfiguration.AmqJmxUrl, this.jmxConfiguration.BrokerJmxName, "FeedJobQueue");

            for (int i = 0; i < jobQueueItems.size(); i++)
            {
                var queueItem = jobQueueItems.get(i) as string;

                if (queueItem != null)
                {
                    var boxedVkGroupId     = GroupRegex.Match(queueItem).Groups[1].Value;
                    var boxedQueueItemType = QueueItemTypeRegex.Match(queueItem).Groups[1].Value;

                    var item = new FeedQueueItem
                    {
                        VkGroupId     = int.Parse(boxedVkGroupId),
                        QueueItemType = (QueueItemType)Enum.Parse(typeof(QueueItemType), boxedQueueItemType)
                    };
                    items.Add(item);
                }
            }

            return(items);
        }
Example #9
0
        private void verifyCDvQuantityValue(org.openehr.am.archetype.constraintmodel.ArchetypeConstraint node)
        {
            Assert.IsTrue(node is org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity, "CDvQuantity expected");

            org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity cdvquantity = (org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantity)node;

            // verify property
            org.openehr.rm.datatypes.text.CodePhrase property = cdvquantity.getProperty();
            Assert.IsNotNull(property, "property is null");
            Assert.AreEqual("openehr", property.getTerminologyId().name());
            Assert.AreEqual("128", property.getCodeString());

            // verify item list
            java.util.List list = cdvquantity.getList();
            Assert.AreEqual(2, list.size(), "unexpected size of list");
            java.lang.Double  temp1 = new java.lang.Double(0.0);
            java.lang.Double  temp2 = new java.lang.Double(200.0);
            java.lang.Integer temp3 = new java.lang.Integer(2);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(0), "yr", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));
            temp1 = new java.lang.Double(1.0);
            temp2 = new java.lang.Double(36.0);
            assertCDvQuantityItem((org.openehr.am.openehrprofile.datatypes.quantity.CDvQuantityItem)list.get(1), "mth", new org.openehr.rm.support.basic.Interval(temp1, temp2), new org.openehr.rm.support.basic.Interval(temp3, temp3));

            org.openehr.rm.support.measurement.MeasurementService ms       = org.openehr.rm.support.measurement.SimpleMeasurementService.getInstance();
            org.openehr.rm.datatypes.quantity.DvQuantity          expected = new org.openehr.rm.datatypes.quantity.DvQuantity("yr", new java.lang.Double(8.0), new java.lang.Integer(2), ms);
            Assert.AreEqual(expected,
                            cdvquantity.getAssumedValue(), "assumed value wrong");
        }
Example #10
0
        public void testConstraintBindingWithMultiTerminologies()
        {
            string adl = System.IO.File.ReadAllText(@"..\..\..\..\java-libs\adl-parser\src\test\resources\adl-test-entry.constraint_binding.test.adl");

            se.acode.openehr.parser.ADLParser  parser    = new se.acode.openehr.parser.ADLParser(adl);
            org.openehr.am.archetype.Archetype archetype = parser.parse();
            java.util.List list = archetype.getOntology().getConstraintBindingList();

            Assert.AreEqual(2, list.size(), "unexpected number of onotology binding");

            // verify the first constraint binding
            org.openehr.am.archetype.ontology.OntologyBinding binding = (org.openehr.am.archetype.ontology.OntologyBinding)list.get(0);
            Assert.AreEqual("SNOMED_CT", binding.getTerminology(), "unexpected binding terminology");

            org.openehr.am.archetype.ontology.QueryBindingItem item = (org.openehr.am.archetype.ontology.QueryBindingItem)binding.getBindingList().get(0);

            Assert.AreEqual("ac0001", item.getCode(), "unexpected local code");
            Assert.AreEqual("http://terminology.org?terminology_id=snomed_ct&&has_relation=102002;with_target=128004", item.getQuery().getUrl(), "exexpected query");

            // verify the second constraint binding
            binding = (org.openehr.am.archetype.ontology.OntologyBinding)list.get(1);
            Assert.AreEqual("ICD10", binding.getTerminology(), "unexpected binding terminology");

            item = (org.openehr.am.archetype.ontology.QueryBindingItem)binding.getBindingList().get(0);

            Assert.AreEqual("ac0001", item.getCode(), "unexpected local code");
            Assert.AreEqual("http://terminology.org?terminology_id=icd10&&has_relation=a2;with_target=b19",
                            item.getQuery().getUrl(), "exexpected query");
        }
 //-----------------------------------------------------------------------
 public override bool Equals(Object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj is java.util.List <Object> == false)
     {
         return(false);
     }
     java.util.List <Object> other = (java.util.List <Object>)obj;
     if (other.size() != size())
     {
         return(false);
     }
     java.util.ListIterator <Object> it1 = listIterator();
     java.util.ListIterator <Object> it2 = other.listIterator();
     while (it1.hasNext() && it2.hasNext())
     {
         Object o1 = it1.next();
         Object o2 = it2.next();
         if (!(o1 == null ? o2 == null : o1.equals(o2)))
         {
             return(false);
         }
     }
     return(!(it1.hasNext() || it2.hasNext()));
 }
Example #12
0
        private void assertKeyedObject(KeyedObject ko, int key,
                                       String attribute, String value)
        {
            SimpleValue keyValue = ko.getKey();

            Assert.IsInstanceOfType(keyValue, typeof(IntegerValue));
            IntegerValue iv = (IntegerValue)keyValue;
            //Assert.AreEqual(iv.getValue(), key);

            ObjectBlock ob = ko.getObject();

            Assert.IsInstanceOfType(ob, typeof(SingleAttributeObjectBlock));
            SingleAttributeObjectBlock saob = (SingleAttributeObjectBlock)ob;

            java.util.List attributes = saob.getAttributeValues();
            Assert.AreEqual(attributes.size(), 1);
            AttributeValue av = (AttributeValue)attributes.get(0);

            Assert.AreEqual(av.getId(), attribute);

            ob = av.getValue();
            Assert.IsInstanceOfType(ob, typeof(PrimitiveObjectBlock));
            SimpleValue sv = ((PrimitiveObjectBlock)ob).getSimpleValue();

            Assert.IsInstanceOfType(sv, typeof(StringValue));
            StringValue str = (StringValue)sv;

            Assert.AreEqual(str.getValue(), value);
        }
Example #13
0
        /*
         * Compares the specified object to this vector and returns if they are
         * equal. The object must be a List which contains the same objects in the
         * same order.
         *
         * @param object
         *            the object to compare with this object
         * @return {@code true} if the specified object is equal to this vector,
         *         {@code false} otherwise.
         * @see #hashCode
         */

        public override bool Equals(Object obj)
        {
            lock (this) {
                if (this == obj)
                {
                    return(true);
                }
                if (obj is java.util.List <Object> )
                {
                    java.util.List <Object> list = (java.util.List <Object>)obj;
                    if (list.size() != elementCount)
                    {
                        return(false);
                    }

                    int index            = 0;
                    Iterator <Object> it = list.iterator();
                    while (it.hasNext())
                    {
                        Object e1 = elementData[index++], e2 = it.next();
                        if (!(e1 == null ? e2 == null : e1.equals(e2)))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                return(false);
            }
        }
 public IEnumerator <T> GetEnumerator()
 {
     for (var i = 0; i < list.size(); i++)
     {
         yield return((T)list.get(i));
     }
 }
Example #15
0
 public bool removeAll(java.util.Collection <Object> o)
 {
     if (root.fast)
     {
         lock (root)
         {
             java.util.ArrayList <Object> temp = (java.util.ArrayList <Object>)root.list.clone();
             java.util.List <Object>      sub  = get(temp);
             bool r = sub.removeAll(o);
             if (r)
             {
                 last = first + sub.size();
             }
             root.list = temp;
             expected  = temp;
             return(r);
         }
     }
     else
     {
         lock (root.list)
         {
             return(get(expected).removeAll(o));
         }
     }
 }
 public void addAll(java.util.List <T> list)
 {
     for (int i = 0; i < list.size(); i++)
     {
         this.add(list.get(i));
     }
 }
Example #17
0
        /// <summary>
        /// Note that currently there seem to be no way for the "yanqi" implementation to actually specify the number
        /// of shortest paths to return, but it seems to find all paths.
        /// However, the implementation of this method instead takes care of reducing the result.
        /// Otherwise, if the semantic of the method is not respected it can not for example be tested
        /// against results from other implementations since then they would return a different number of paths.
        /// </summary>
        /// <param name="startVertex"></param>
        /// <param name="endVertex"></param>
        /// <param name="maxNumberOfPaths"></param>
        /// <returns></returns>
        protected override IList <P> FindShortestPathHook(
            V startVertex,
            V endVertex,
            int maxNumberOfPaths
            )
        {
            IList <P> paths                = new List <P>();
            int       startVertexId        = idMapper.CreateOrRetrieveIntegerId(startVertex.VertexId);
            int       endVertexId          = idMapper.CreateOrRetrieveIntegerId(endVertex.VertexId);
            YenTopKShortestPathsAlg yenAlg = new YenTopKShortestPathsAlg(graphAdaptee, graphAdaptee.GetVertex(startVertexId), graphAdaptee.GetVertex(endVertexId));

            while (yenAlg.HasNext())
            {
                global::edu.asu.emit.algorithm.graph.Path path = yenAlg.Next();
                IList <E> edges = new List <E>();
                java.util.List <BaseVertex> vertexList = path.GetVertexList();
                for (int i = 1; i < vertexList.size(); i++)
                {
                    BaseVertex startVertexForEdge = vertexList.get(i - 1);
                    BaseVertex endVertexForEdge   = vertexList.get(i);
                    E          edge = GetOriginalEdgeInstance(startVertexForEdge, endVertexForEdge);
                    edges.Add(
                        edge
                        );
                }
                W totalWeight = base.CreateInstanceWithTotalWeight(path.GetWeight(), edges);
                paths.Add(base.CreatePath(totalWeight, edges));
                if (maxNumberOfPaths == paths.Count)
                {
                    break;
                }
            }
            return(new ReadOnlyCollection <P>(paths));
        }
Example #18
0
 /**
  * Returns the index of the element that would be returned by a
  * subsequent call to {@link #previous}.
  * <p>
  * As would be expected, if at the iterator is at the physical
  * beginning of the underlying list, the list's size minus one is
  * returned, signifying the end of the list.
  *
  * @return the index of the element that would be returned if previous() were called
  * @throws NoSuchElementException if there are no elements in the list
  */
 public int previousIndex()
 {
     if (list.isEmpty())
     {
         throw new java.util.NoSuchElementException(
                   "There are no elements for this iterator to loop on");
     }
     if (iterator.hasPrevious() == false)
     {
         return(list.size() - 1);
     }
     else
     {
         return(iterator.previousIndex());
     }
 }
Example #19
0
        public virtual int addIntentOptions(int groupId, int itemId, int order, android.content.ComponentName
                                            caller, android.content.Intent[] specifics, android.content.Intent intent, int
                                            flags, android.view.MenuItem[] outSpecificItems)
        {
            android.content.pm.PackageManager pm = mContext.getPackageManager();
            java.util.List <android.content.pm.ResolveInfo> lri = pm.queryIntentActivityOptions
                                                                      (caller, specifics, intent, 0);
            int N = lri != null?lri.size() : 0;

            if ((flags & android.view.MenuClass.FLAG_APPEND_TO_GROUP) == 0)
            {
                removeGroup(groupId);
            }
            {
                for (int i = 0; i < N; i++)
                {
                    android.content.pm.ResolveInfo ri      = lri.get(i);
                    android.content.Intent         rintent = new android.content.Intent(ri.specificIndex < 0 ?
                                                                                        intent : specifics[ri.specificIndex]);
                    rintent.setComponent(new android.content.ComponentName(ri.activityInfo.applicationInfo
                                                                           .packageName, ri.activityInfo.name));
                    android.view.MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm)).setIcon
                                                     (ri.loadIcon(pm)).setIntent(rintent);
                    if (outSpecificItems != null && ri.specificIndex >= 0)
                    {
                        outSpecificItems[ri.specificIndex] = item;
                    }
                }
            }
            return(N);
        }
Example #20
0
        private List <Token> getTokens(java.util.List tokens)
        {
            var returnValue = new List <Token>();

            if (tokens != null && tokens.size() > 0)
            {
                for (int i = 0; i < tokens.size(); ++i)
                {
                    var token     = (CoreMap)tokens.get(i);
                    var tokenText = (string)token.get(typeof(CoreAnnotations.OriginalTextAnnotation));
                    var pos       = (string)token.get(typeof(CoreAnnotations.PartOfSpeechAnnotation));
                    var ner       = (string)token.get(typeof(CoreAnnotations.NamedEntityTagAnnotation));
                    var lemma     = token.get(typeof(CoreAnnotations.LemmaAnnotation));

                    returnValue.Add(new Token(tokenText, new PartOfSpeechTag(pos, string.Empty), new NamedEntity(ner, string.Empty)));
                }
            }
            return(returnValue);
        }
        private void assertVertexList(IList <int> expectedVertices, java.util.List <BaseVertex> actualVertices)
        {
            Assert.AreEqual(expectedVertices.Count, actualVertices.size());
            int count = expectedVertices.Count;

            for (int i = 0; i < count; i++)
            {
                Assert.AreEqual(expectedVertices[i], actualVertices.get(i).GetId());
            }
        }
Example #22
0
        /// <summary>
        /// Converts a java.util.List of PVectors to a list of Vector3D
        /// </summary>
        /// <param name="arrayList">the java.util.List to convert</param>
        /// <returns>the list of Vectors</returns>
        public static List <Vector3d> ToVec3DList(java.util.List arrayList)
        {
            List <Vector3d> vecList = new List <Vector3d>();

            for (int i = 0; i < arrayList.size(); i++)
            //foreach (PVector p in arrayList)
            {
                vecList.Add(ToVector3d((PVector)arrayList.get(i)));
            }
            return(vecList);
        }
Example #23
0
        public string[] listOpenPrescriptions()
        {
            java.util.List list = module.listOpenPrescription();
            List <string>  l    = new List <string>();

            for (int i = 0; i < list.size(); i++)
            {
                l.Add(list.get(i).ToString());
            }
            return(l.ToArray());
        }
Example #24
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));
            }
        }
 public ConsumeConcurrentlyStatus consumeMessage(java.util.List list, ConsumeConcurrentlyContext ccc)
 {
     for (int i = 0; i < list.size(); i++)
     {
         var                msg  = list.get(i) as Message;
         byte[]             body = msg.getBody();
         var                str  = Encoding.UTF8.GetString(body);
         MongodbQueryEntity mongodbQueryEntity = JsonConvert.DeserializeObject <MongodbQueryEntity>(str);
         mongodbHelper.Add(mongodbQueryEntity.tablename + DateTime.Now.ToString("yyyyMM"), mongodbQueryEntity);;
     }
     return(ConsumeConcurrentlyStatus.CONSUME_SUCCESS);
 }
Example #26
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); }
         }
Example #27
0
 //Returns true if successful
 public static bool RemoteCommand(string Command, bool ShowError = true)
 {
     if (ClientDDM != null && !ClientDDM.isClosed())
     {
         try
         {
             java.util.List lstMessages = ClientDDM.executeReturnMessageList(Command);
             if (lstMessages == null || lstMessages.size() == 0)
             {
                 return(true);
             }
             else
             {
                 for (int msgidx = 0; msgidx < lstMessages.size(); msgidx++)
                 {
                     com.ibm.jtopenlite.Message msg = (com.ibm.jtopenlite.Message)lstMessages.get(msgidx);
                     if (msg.getSeverity() > 1) // DDM returns sev 0-8 range (AS400 severity / 10 if you will )
                     {
                         if (ShowError)
                         {
                             MessageBox.Show(msg.getText(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                         }
                         return(false);
                     }
                 }
             }
             // Get here means no messages with Sev > 10, so ok
             return(true);
         } catch (Exception ex)
         {
             // command failed.
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
Example #28
0
        private void _getMinAndInterval(ucar.nc2.Variable var, string minMaxStr, out double interval, out double minVal, out double count)
        {
            ucar.ma2.Array dataArr    = _util.GetAllVariableData(var);
            bool           stepExists = false;

            interval = 1.0; minVal = double.MaxValue; count = 0;
            java.util.List ncVarAtt = var.getAttributes();
            for (int attCount = 0; attCount < ncVarAtt.size(); attCount++)
            {
                ucar.nc2.Attribute varAtt  = (ucar.nc2.Attribute)ncVarAtt.get(attCount);
                string             attName = varAtt.getName();
                if (attName == "step")
                {
                    java.lang.Number attVal = (java.lang.Number)varAtt.getValue(0);
                    interval   = attVal.doubleValue();
                    stepExists = true;
                }
            }

            double prevVal = 0.0;
            int    minCount = 0, maxCount = (int)dataArr.getSize() - 1; count = 0;

            if (!string.IsNullOrEmpty(minMaxStr))
            {
                minCount = Convert.ToInt32(minMaxStr.Split(':')[0]);
                maxCount = Convert.ToInt32(minMaxStr.Split(':')[1]);
                count    = maxCount - minCount + 1;
            }
            else
            {
                count = maxCount + 1;
            }

            for (int dCount = minCount; dCount <= maxCount; dCount++)
            {
                ucar.ma2.Index dIndex = dataArr.getIndex();
                double         data   = dataArr.getDouble(dIndex.set(dCount));
                if (minVal >= data)
                {
                    minVal = data;
                }
                if (!stepExists)
                {
                    if (dCount > 0)
                    {
                        prevVal  = dataArr.getDouble(dIndex.set(dCount - 1));
                        interval = data - prevVal;
                    }
                }
            }
        }
Example #29
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('"');
                }
            }
        }
        public void inform(ResourceLoader loader)
        {
            string commonWordFiles = (string)args.get("words");

            ignoreCase = getBoolean("ignoreCase", false);

            if (commonWordFiles != null)
            {
                try {
                    List /*<String>*/ files = StrUtils.splitFileNames(commonWordFiles);
                    if (commonWords == null && files.size() > 0)
                    {
                        // default stopwords list has 35 or so words, but maybe don't make it
                        // that big to start
                        commonWords = new CharArraySet(files.size() * 10, ignoreCase);
                    }
                    for (var iter = files.iterator(); iter.hasNext();)
                    {
                        string            file  = (string)iter.next();
                        List /*<String>*/ wlist = loader.getLines(file.Trim());
                        // TODO: once StopFilter.makeStopSet(List) method is available, switch
                        // to using that so we can avoid a toArray() call
                        commonWords.addAll(CommonGramsFilter.makeCommonSet((string[])wlist
                                                                           .toArray(new string[0]), ignoreCase));
                    }
                } catch (IOException e) {
                    throw new System.ApplicationException("Unexpected exception", e);
                }
            }
            else
            {
#pragma warning disable 612
                commonWords = CommonGramsFilter.makeCommonSet(
                    StopAnalyzer.ENGLISH_STOP_WORDS, ignoreCase);
#pragma warning restore 612
            }
        }
 /**
  * Constructor that wraps a list.
  *
  * @param list  the list to create a reversed iterator for
  * @throws NullPointerException if the list is null
  */
 public ReverseListIterator(java.util.List<Object> list)
     : base()
 {
     this.list = list;
     iterator = list.listIterator(list.size());
 }