コード例 #1
0
        public virtual void testCreateResponse()
        {
            JDFJMF queries = JDFJMF.createJMF(EnumFamily.Query, EnumType.Status);

            queries.appendCommand(EnumType.Resource);
            queries.appendCommand(EnumType.Resource);
            queries.appendRegistration(EnumType.Resource);

            JDFJMF   responses      = queries.createResponse();
            VElement messageVector  = queries.getMessageVector(null, null);
            VElement responseVector = responses.getMessageVector(null, null);

            Assert.AreEqual(responseVector.Count, 4);
            for (int i = 0; i < responseVector.Count; i++)
            {
                JDFResponse r = (JDFResponse)responseVector[i];
                JDFMessage  m = (JDFMessage)messageVector[i];
                Assert.AreEqual(r.getrefID(), m.getID());
                Assert.AreEqual(r.getType(), m.getType());
            }
        }
コード例 #2
0
        ///
        ///	 * <param name="m_moduleid"> the list of module ids to add, if null: nop </param>
        ///	 * <returns> the list of ModulePhase element </returns>
        ///	 * <exception cref="IllegalArgumentException"> if the vectors have different lengths </exception>
        ///
        public virtual VElement setModules(VString moduleIDs, VString moduleTypes)
        {
            if (moduleIDs == null || moduleIDs.Count == 0)
            {
                return(null);
            }
            if (moduleTypes == null || moduleTypes.Count == 0 || moduleTypes.Count != moduleIDs.Count)
            {
                throw new ArgumentException("Inconsistent vector lengths");
            }
            VElement v = new VElement();

            for (int i = 0; i < moduleIDs.Count; i++)
            {
                JDFModulePhase modulePhase = getCreateModulePhase(i);
                v.Add(modulePhase);
                modulePhase.setModuleID(moduleIDs.stringAt(i));
                modulePhase.setModuleType(moduleTypes.stringAt(i));
            }
            return(v);
        }
コード例 #3
0
ファイル: JDFSourceResource.cs プロジェクト: cip4/JDFLibNet
        public override VString getInvalidElements(EnumValidationLevel level, bool bIgnorePrivate, int nMax)
        {
            bool bIgnorePrivateLocal = bIgnorePrivate;

            if (bIgnorePrivateLocal)
            {
                bIgnorePrivateLocal = false; // dummy to fool compiler
            }
            VString v = base.getInvalidElements(level, bIgnorePrivateLocal, nMax);

            if (v.Count >= nMax)
            {
                return(v);
            }

            VElement v2   = getChildElementVector_KElement(null, null, null, true, 0);
            int      n    = 0;
            int      size = v2.Count;

            for (int i = 0; i < size; i++)
            {
                if (v2[i] is JDFRefElement)
                {
                    n++;
                }
            }

            if (n > 1)
            {
                for (int i = 0; i < size; i++)
                {
                    if (v2[i] is JDFRefElement)
                    {
                        v.appendUnique(v2[i].LocalName);
                    }
                }
            }

            return(v);
        }
コード例 #4
0
ファイル: JDFColor.cs プロジェクト: cip4/JDFLibNet
        public virtual JDFFileSpec getColorProfile()
        {
            VElement v = getChildElementVector(ElementName.FILESPEC, null, null, true, 0, false);

            if (v != null)
            {
                int siz = v.Count;
                for (int i = 0; i < siz; i++)
                {
                    JDFFileSpec res = (JDFFileSpec)v[i];
                    if (res.hasAttribute(AttributeName.RESOURCEUSAGE))
                    {
                        if (res.getResourceUsage().Equals("ColorProfile"))
                        {
                            return(res);
                        }
                    }
                }
            }

            return(null);
        }
コード例 #5
0
ファイル: JDFResourceInfo.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * Method getInvalidElements
        ///	 * <p>
        ///	 * default: GetInvalidElements(level, true, 999999)
        ///	 *  </summary>
        ///	 * <param name="level"> validation level </param>
        ///	 * <param name="bIgnorePrivate"> </param>
        ///	 * <param name="nMax"> maximum number of elements to get
        ///	 *  </param>
        ///	 * <returns> VString - vector of names of invalid elements </returns>
        ///
        public override VString getInvalidElements(EnumValidationLevel level, bool bIgnorePrivate, int nMax)
        {
            VString s = getInvalidElements_JDFElement(level, bIgnorePrivate, nMax);

            if (s.Count > nMax || hasAttribute(AttributeName.RESOURCENAME)) // multiple
            // are
            // allowed
            // with
            // resourcename
            // set
            {
                return(s);
            }

            VElement v    = getChildElementVector(null, null, null, true, 0, false);
            int      size = v.Count;

            if (size > 1)
            {
                // remove anything but resources
                for (int i = size - 1; i >= 0; i--)
                {
                    if (!(v[i] is JDFResource))
                    {
                        v.RemoveAt(i);
                    }
                }
                size = v.Count; // must refresh size due to removes
                // more than one resource --> evil!
                if (size > 1)
                {
                    for (int j = 0; j < size; j++)
                    {
                        s.appendUnique(v.item(j).LocalName);
                    }
                }
            }
            return(s);
        }
コード例 #6
0
ファイル: JDFAmountPool.cs プロジェクト: cip4/JDFLibNet
            ///
            ///		 <summary> * Constructor AmountMap
            ///		 *  </summary>
            ///		 * <param name="vsPartIDKeys"> </param>
            ///
            internal AmountMap(JDFAmountPool enclosingInstance, VString vsPartIDKeys)
            {
                VElement vPartAmount = enclosingInstance.getChildElementVector(ElementName.PARTAMOUNT, null, null, true, 0, false);

                if (vPartAmount != null)
                {
                    int size = vPartAmount.Count;
                    for (int i = 0; i < size; i++)
                    {
                        JDFPartAmount    pa       = (JDFPartAmount)vPartAmount[i];
                        VJDFAttributeMap vamParts = pa.getPartMapVector();

                        int size2 = vamParts.Count;
                        for (int p = 0; p < size2; p++)
                        {
                            JDFAttributeMap amPart = vamParts[p];
                            amPart.reduceMap(vsPartIDKeys);
                            putOne(amPart, pa);
                        }
                    }
                }
            }
コード例 #7
0
ファイル: JDFQueue.cs プロジェクト: cip4/JDFLibNet
        public virtual IDictionary <string, JDFQueueEntry> getQueueEntryIDMap()
        {
            Dictionary <string, JDFQueueEntry> map = null;

            VElement v = getQueueEntryVector();

            if (v != null)
            {
                int siz = v.Count;
                if (siz > 0)
                {
                    map = new Dictionary <string, JDFQueueEntry>(siz);
                    for (int i = 0; i < siz; i++)
                    {
                        JDFQueueEntry qe = (JDFQueueEntry)v[i];
                        map.Add(qe.getQueueEntryID(), qe);
                    }
                }
            }

            return(map);
        }
コード例 #8
0
ファイル: JDFSourceResource.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * get list of missing elements
        ///	 *  </summary>
        ///	 * <param name="nMax">
        ///	 *            maximum size of the returned vector </param>
        ///
        public override VString getMissingElements(int nMax)
        {
            VString vs = getTheElementInfo().requiredElements();

            vs = getMissingElementVector(vs, nMax);
            VElement v2 = getChildElementVector_KElement(null, null, null, true, 0);
            int      n  = 0;

            for (int i = 0; i < v2.Count; i++)
            {
                if (v2[i] is JDFRefElement)
                {
                    n++;
                }
            }
            if (n == 0)
            {
                vs.Add("RefElement");
            }

            return(vs);
        }
コード例 #9
0
ファイル: JDFJMF.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * create a new response for all messages of this if the message is any message except response correctly fills
        ///	 * refId, type etc.
        ///	 *  </summary>
        ///	 * <returns> the newly created JMF with multiple responses </returns>
        ///
        public virtual JDFJMF createResponse()
        {
            VElement v   = getMessageVector(null, null);
            JDFJMF   jmf = new JDFDoc("JMF").getJMFRoot();

            for (int i = 0; i < v.Count; i++)
            {
                JDFMessage m      = (JDFMessage)v[i];
                EnumFamily family = m.getFamily();
                if (family != null && EnumFamily.Response != family && EnumFamily.Acknowledge != family)
                {
                    if (!m.hasAttribute(AttributeName.ID)) // in case someone sends
                    // crappy requests...
                    {
                        m.appendAnchor(null);
                    }
                    JDFResponse r = jmf.appendResponse();
                    r.setQuery(m);
                }
            }
            return(jmf);
        }
コード例 #10
0
        ///
        ///	 <summary> * get the list of QueueEntryDef/@QueueEntryIDs strings as a set
        ///	 *  </summary>
        ///	 * <returns> the set of QueueEntryIDs, null if no QueueEntryDef is specified </returns>
        ///
        public virtual SupportClass.SetSupport <string> getQueueEntryDefSet()
        {
            SupportClass.HashSetSupport <string> @set = null;

            VElement v = getChildElementVector(ElementName.QUEUEENTRYDEF, null);

            if (v != null)
            {
                int siz = v.Count;
                @set = siz == 0 ? null : new SupportClass.HashSetSupport <string>();
                for (int i = 0; i < siz; i++)
                {
                    string qeid = ((JDFQueueEntryDef)v[i]).getQueueEntryID();
                    if (!isWildCard(qeid))
                    {
                        @set.Add(qeid);
                    }
                }
            }

            return(@set != null && @set.Count > 0 ? @set : null);
        }
コード例 #11
0
        public virtual void testSetPhase()
        {
            JDFPhaseTime p1 = myAuditPool.setPhase(EnumNodeStatus.Setup, null, null, null);

            Assert.IsNotNull(p1);
            Assert.AreEqual(1, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            JDFPhaseTime p2 = myAuditPool.setPhase(EnumNodeStatus.Setup, "foobar", null, null);

            Assert.IsNotNull(p2);
            Assert.AreNotEqual(p1, p2);
            Assert.AreEqual(2, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            p2 = myAuditPool.setPhase(EnumNodeStatus.Setup, "foobar", null, null);
            Assert.IsNotNull(p2);
            Assert.AreEqual(2, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            p2 = myAuditPool.setPhase(EnumNodeStatus.Ready, "foobar", null, null);
            Assert.IsNotNull(p2);
            Assert.AreEqual(3, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            p1 = myAuditPool.setPhase(EnumNodeStatus.InProgress, null, null, null);
            Assert.IsNotNull(p1);
            Assert.AreEqual(4, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            p2 = myAuditPool.setPhase(EnumNodeStatus.InProgress, null, null, null);
            Assert.IsNotNull(p2);
            Assert.AreEqual(p1, p2);
            Assert.AreEqual(4, myAuditPool.getChildElementVector(ElementName.PHASETIME, null, null, true, 0, true).Count);
            VElement    vEmpl = new VElement();
            JDFEmployee emp   = (JDFEmployee) new JDFDoc(ElementName.EMPLOYEE).getRoot();

            emp.setPersonalID("p1");
            vEmpl.Add(emp);
            p2 = myAuditPool.setPhase(EnumNodeStatus.InProgress, null, null, vEmpl);
            Assert.IsNotNull(p2);
            Assert.AreNotEqual(p1, p2);
            Assert.IsTrue(p2.getEmployee(0).isEqual(emp));
            emp.setPersonalID("p2");
            p2 = myAuditPool.setPhase(EnumNodeStatus.InProgress, null, null, vEmpl);
            Assert.IsNotNull(p2);
            Assert.AreNotEqual(p1, p2);
            Assert.AreEqual("p2", p2.getEmployee(0).getPersonalID());
        }
コード例 #12
0
ファイル: JDFIntentResource.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * set actual values to the preset defined in preferred
        ///	 *  </summary>
        ///	 * <param name="String">
        ///	 *            key the key of the span resource to modify, if null do all </param>
        ///	 * <returns> number of elements modified </returns>
        ///
        public virtual int preferredToActual(string key)
        {
            int nDone = 0;

            if (!isLeaf())
            {
                VElement leaves = getLeaves(false);
                for (int i = 0; i < leaves.Count; i++)
                {
                    JDFIntentResource ri = (JDFIntentResource)leaves[i];
                    nDone += ri.preferredToActual(key);
                }
                return(nDone);
            }
            VString vKeys = new VString();

            if (KElement.isWildCard(key))
            {
                VElement v = getChildrenByTagName(null, null, new JDFAttributeMap(AttributeName.DATATYPE, (string)null), true, true, 0);
                for (int i = 0; i < v.Count; i++)
                {
                    vKeys.Add(v[i].Name);
                }
            }
            else
            {
                vKeys.Add(key);
            }
            for (int i = 0; i < vKeys.Count; i++)
            {
                JDFSpanBase @base = (JDFSpanBase)getElement(vKeys[i], JDFConstants.EMPTYSTRING, 0);
                if (@base.preferredToActual())
                {
                    nDone++;
                }
            }
            return(nDone);
        }
コード例 #13
0
ファイル: JDFQueue.cs プロジェクト: cip4/JDFLibNet
        public virtual void cleanup()
        {
            VElement v = getQueueEntryVector();

            if (v != null)
            {
                int siz  = v.Count;
                int nBad = 0;
                for (int i = 0; i < siz; i++)
                {
                    JDFQueueEntry        qe     = (JDFQueueEntry)v[i];
                    EnumQueueEntryStatus status = qe.getQueueEntryStatus();
                    if (EnumQueueEntryStatus.Removed.Equals(status))
                    {
                        if (cleanupCallback != null)
                        {
                            cleanupCallback.cleanEntry(qe);
                        }

                        qe.deleteNode();
                    }
                    else if (qe.isCompleted())
                    {
                        if (nBad++ >= maxCompletedEntries)
                        {
                            if (cleanupCallback != null)
                            {
                                cleanupCallback.cleanEntry(qe);
                            }

                            qe.deleteNode();
                        }
                    }
                }
            }

            setStatusFromEntries();
        }
コード例 #14
0
ファイル: JDFxor.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * Evaluates two or more Term elements (and, or, xor, not, Evaluation,
        ///	 * TestRef) to determine if, as a set, they evaluate to “true” when combined
        ///	 * in a boolean “xor” function.
        ///	 *  </summary>
        ///	 * <param name="jdf">
        ///	 *            JDFNode to test to know if the Device can accept it </param>
        ///	 * <param name="reportRoot">
        ///	 *            the report to generate; set to <code>null</code> if no report
        ///	 *            is requested </param>
        ///	 * <returns> boolean - true, if boolean “xor” expression evaluates to “true” </returns>
        ///
        public override bool fitsJDF(KElement jdf, KElement reportRoot)
        {
            KElement reportRootLocal = reportRoot;

            VElement v = getTermVector(null);

            if (reportRootLocal != null)
            {
                reportRootLocal = reportRootLocal.appendElement("xor");
            }

            int siz = v.Count;

            int count = 0;

            for (int i = 0; i < siz; i++)
            {
                JDFTerm t = (JDFTerm)v[i];
                if (t.fitsJDF(jdf, reportRootLocal))
                {
                    count++;
                }

                if (count > 1 && reportRootLocal == null)
                {
                    break;
                }
            }

            bool b = (count == 1);

            if (reportRootLocal != null)
            {
                reportRootLocal.setAttribute("Value", b, null);
            }

            return(b);
        }
コード例 #15
0
        ///
        ///	 <summary> * getPartStatus - get a PartStatus that fits to the filter defined by mPart
        ///	 *  </summary>
        ///	 * <param name="mPart"> the filter for the part to set the status
        ///	 *  </param>
        ///	 * <returns> JDFPartStatus - the PartStatus that fits </returns>
        ///
        public virtual JDFPartStatus getPartStatus(JDFAttributeMap mPart)
        {
            VElement      vPartStatus   = getChildElementVector(ElementName.PARTSTATUS, null, null, true, 0, false);
            int           nSep          = 0;
            JDFPartStatus retPartStatus = null;

            for (int i = vPartStatus.Count - 1; i >= 0; i--)
            {
                JDFPartStatus   ps      = (JDFPartStatus)vPartStatus[i];
                JDFAttributeMap mapPart = ps.getPartMap();

                if (mPart != null && mPart.subMap(mapPart))
                {
                    if (mapPart.Count > nSep)
                    {
                        nSep          = mapPart.Count;
                        retPartStatus = ps; // mPart is a subset of of mapPart
                    }
                }
            }

            return(retPartStatus);
        }
コード例 #16
0
        ///
        ///	 <summary> * add a link to one of the resources
        ///	 *  </summary>
        ///	 * <param name="bNew"> true - new link, false - original link </param>
        ///	 * <param name="r"> the resource that was valid before modification </param>
        ///	 * <param name="usage"> usage of the resource </param>
        ///	 * <returns> the ResourceLink object in the ResourceAudit that points to r </returns>
        ///

        public virtual JDFResourceLink addNewOldLink(bool bNew, JDFResource r, EnumUsage usage)
        {
            VElement v    = getChildElementVector(null, null, null, true, 0, false);
            int      iNew = bNew ? 0 : 1;

            for (int i = v.Count - 1; i >= 0; i--)
            {
                if (!(v[i] is JDFResourceLink))
                {
                    v.RemoveAt(i);
                }
            }

            if (v.Count != iNew)
            {
                throw new JDFException("JDFResourceLink::AddNewOldLink invalid  ResourceAudit");
            }
            JDFResourceLink l = (JDFResourceLink)appendElement(r.getLinkString(), JDFConstants.EMPTYSTRING);

            l.setTarget(r);
            l.setUsage(usage);
            return(l);
        }
コード例 #17
0
        ///
        ///	 <summary> * Gets of jdfRoot a vector of all executable nodes (jdf root or children nodes that this Device may execute)
        ///	 *  </summary>
        ///	 * <param name="jdfRoot"> the node we test </param>
        ///	 * <param name="testlists"> testlists that are specified for the State elements (FitsValue_Allowed or FitsValue_Present)<br>
        ///	 *            Will be used in fitsValue method of the State class. </param>
        ///	 * <param name="level"> validation level </param>
        ///	 * <returns> VElement - vector of executable JDFNodes </returns>
        ///
        public virtual VElement getExecutableJDF(JDFNode docRoot, EnumFitsValue testlists, EnumValidationLevel validationLevel)
        {
            VElement vDC = getChildElementVector(ElementName.DEVICECAP, null, null, true, -1, false);

            if (vDC == null || vDC.IsEmpty())
            {
                return(null);
            }

            VElement vn = new VElement();

            for (int i = 0; i < vDC.Count; i++)
            {
                JDFDeviceCap dc            = (JDFDeviceCap)vDC[i];
                VElement     executableJDF = dc.getExecutableJDF(docRoot, testlists, validationLevel);
                if (executableJDF != null)
                {
                    vn.addAll(executableJDF);
                }
            }
            vn.unify();
            return(vn.IsEmpty() ? null : vn);
        }
コード例 #18
0
        ///
        ///	 <summary> * Method getPoolChild_JDFResourcePool<br>
        ///	 * get a child resource from the pool matching the parameters
        ///	 *  </summary>
        ///	 * <param name="i"> the index of the child or -1 to make a new one. </param>
        ///	 * <param name="name"> the name of the element </param>
        ///	 * <param name="mAttrib"> the attribute of the element </param>
        ///	 * <param name="nameSpaceURI"> the namespace to search in </param>
        ///	 * <returns> JDFResource: the pool child matching the above conditions </returns>
        ///
        private JDFResource getPoolChild_JDFResourcePool(int i, string strName, JDFAttributeMap mAttrib, string nameSpaceURI)
        {
            int iLocal = i;

            VElement v = getPoolChildren(strName, mAttrib, nameSpaceURI);

            if (iLocal < 0)
            {
                iLocal = v.Count + iLocal;
                if (iLocal < 0)
                {
                    return(null);
                }
            }
            if (v.Count <= iLocal)
            {
                return(null);
            }

            JDFResource jdfResource = (JDFResource)v[iLocal];

            return(jdfResource);
        }
コード例 #19
0
            ///
            ///		 * <param name="node"> </param>
            ///		 * <returns> the target resource </returns>
            ///
            private JDFResource getTargetResource(JDFNode node)
            {
                if (node == null)
                {
                    return(null);
                }
                JDFResourceLinkPool rlp = node.getResourceLinkPool();

                if (rlp == null)
                {
                    return(null);
                }
                string resID = enclosingInstance.getResourceID();

                if (resID != null && !resID.Equals(""))
                {
                    VElement vRes = rlp.getLinkedResources(null, null, new JDFAttributeMap(AttributeName.ID, resID), false);
                    if (vRes.Count > 0)
                    {
                        return((JDFResource)vRes[0]);
                    }
                }

                string resName = enclosingInstance.getResourceName();

                if (resName != null && !resName.Equals(""))
                {
                    VElement vRes = rlp.getLinkedResources(resName, null, null, false);
                    if (vRes.Count > 0)
                    {
                        return((JDFResource)vRes[0]);
                    }

                    // TODO link usage, process usage etc.
                }
                return(null);
            }
コード例 #20
0
ファイル: JDFand.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * Evaluates two or more term elements (
        ///	 * <code>and, or, xor, not, Evaluation, TestRef</code>) to determine if, as
        ///	 * a set, they evaluate to “true” when combined in a boolean “and” function.
        ///	 *  </summary>
        ///	 * <param name="jdf">
        ///	 *            the JDFNode to be checked iot find out if the device can
        ///	 *            accept it </param>
        ///	 * <returns> boolean - true, if boolean “and” expression evaluates to “true” </returns>
        ///
        public override bool fitsJDF(KElement jdf, KElement reportRoot) // const JDFNode
        {
            KElement reportRootLocal = reportRoot;

            VElement v = getTermVector(null);

            if (reportRootLocal != null)
            {
                reportRootLocal = reportRootLocal.appendElement("and");
            }

            int  siz = v.Count;
            bool b   = true;

            for (int i = 0; i < siz; i++)
            {
                JDFTerm t  = (JDFTerm)v[i];
                bool    b2 = t.fitsJDF(jdf, reportRootLocal);
                if (!b2)
                {
                    if (reportRootLocal == null)
                    {
                        return(false);
                    }
                }

                b = b && b2;
            }

            if (reportRootLocal != null)
            {
                reportRootLocal.setAttribute("Value", b, null);
            }

            return(b);
        }
コード例 #21
0
        ///
        ///	 <summary> * get the list of Device/@DeviceIDs strings as a set
        ///	 *  </summary>
        ///	 * <returns> the set of DeviceIDs, null if no Device is specified </returns>
        ///
        public virtual SupportClass.SetSupport <string> getDeviceIDSet()
        {
            int size = 0;

            SupportClass.SetSupport <string> @set = null;

            VElement v = getChildElementVector(ElementName.DEVICE, null);

            if (v != null)
            {
                size = v.Count;
                @set = size == 0 ? null : new SupportClass.HashSetSupport <string>();
                for (int i = 0; i < size; i++)
                {
                    string qeid = ((JDFDevice)v[i]).getDeviceID();
                    if (!isWildCard(qeid))
                    {
                        @set.Add(qeid);
                    }
                }
            }

            return(@set != null && @set.Count > 0 ? @set : null);
        }
コード例 #22
0
        ///
        ///	 <summary> * modifies queue to match this filter by removing all non-matching entries
        ///	 *
        ///	 * make sure that this is a copy of any original queue as the incoming queue itself is not cloned
        ///	 *  </summary>
        ///	 * <param name="theQueue"> the queue to modify </param>
        ///
        public virtual void match(JDFQueue theQueue)
        {
            int maxEntries = hasAttribute(AttributeName.MAXENTRIES) ? getMaxEntries() : 999999;

            VElement v = theQueue.getQueueEntryVector();

            if (v != null)
            {
                int size = v.Count;
                theQueue.setQueueSize(size);

                for (int i = 0; i < size; i++)
                {
                    JDFQueueEntry qe = (JDFQueueEntry)v[i];
                    match(qe);
                }
            }

            for (int i = theQueue.numEntries(null) - 1; i >= maxEntries; i--)
            {
                theQueue.removeChild(ElementName.QUEUEENTRY, null, maxEntries);
            }
            // always zapp first - it is faster to find
        }
コード例 #23
0
        ///
        ///	 <summary> * copy a Vector of resourceLinks into this PhaseTime
        ///	 *  </summary>
        ///	 * <param name="vRL"> the Vector of resourceLinks to copy - the order is significant, because the first rl will be used to
        ///	 *            fill the Amount in Signal/DeviceInfo/JobPhase </param>
        ///
        public virtual void setLinks(VElement vRL)
        {
            if (vRL == null)
            {
                return;
            }
            int size = vRL.Count;

            if (size == 0)
            {
                return;
            }

            for (int i = 0; i < size; i++)
            {
                JDFResourceLink rl = (JDFResourceLink)vRL[i];
                removeChildren(rl.LocalName, rl.getNamespaceURI(), null);
            }
            for (int i = 0; i < size; i++)
            {
                JDFResourceLink rl = (JDFResourceLink)vRL[i];
                copyElement(rl, null);
            }
        }
コード例 #24
0
        ///
        ///	 <summary> * Get the Color Element with Name=name
        ///	 *  </summary>
        ///	 * <param name="String">
        ///	 *            name the name of the color
        ///	 *  </param>
        ///	 * <returns> JDFColor the color with the matching name, or null if no matching
        ///	 *         element exists </returns>
        ///
        public virtual JDFColor getColorWithName(string colorName)
        {
            JDFColor color = null;

            if (colorName == null)
            {
                throw new JDFException("Bad colorname:" + colorName);
            }

            VElement v = getChildElementVector(ElementName.COLOR, null, null, true, 0, false);

            if (v != null)
            {
                int pos = -1;
                int siz = v.Count;
                for (int i = 0; i < siz; i++)
                {
                    color = (JDFColor)v[i];
                    if (colorName.Equals(color.getName()) || colorName.Equals(color.getActualColorName()))
                    {
                        if (pos < 0)
                        {
                            pos = i;
                        }
                        else
                        {
                            throw new JDFException("Multiple colors exist for:" + colorName);
                        }
                    }
                }

                color = (JDFColor)(pos == -1 ? null : v[pos]);
            }

            return(color);
        }
コード例 #25
0
        public virtual void testGetSignatureVector_New()
        {
            testBuildNewLayout();
            JDFLayout    lo  = (JDFLayout)n.getMatchingResource(ElementName.LAYOUT, EnumProcessUsage.AnyInput, null, 0);
            VElement     v   = lo.getSignatureVector();
            JDFSignature sig = (JDFSignature)v[0];

            Assert.AreEqual("SignatureName1", sig.getSignatureName());
            JDFSignature sig2 = (JDFSignature)v[1];

            Assert.AreEqual("SignatureName2", sig2.getSignatureName());
            VElement vSheet = sig2.getSheetVector();
            JDFSheet s1     = (JDFSheet)vSheet[1]; // don't try 0 it will

            // fail because it is
            // referenced...
            Assert.AreEqual("SignatureName2", s1.getSignatureName());
            Assert.AreEqual("SheetName2", s1.getSheetName());
            JDFSurface su = s1.getCreateBackSurface();

            Assert.AreEqual("SignatureName2", su.getSignatureName());
            Assert.AreEqual("SheetName2", su.getSheetName());
            Assert.AreEqual(su, s1.getSurfaceVector()[0]);
        }
コード例 #26
0
ファイル: JDFAuditPool.cs プロジェクト: cip4/JDFLibNet
        ///
        ///	 <summary> * getLastPhase - get the most recent PhaseTime audit in this pool
        ///	 *  </summary>
        ///	 * <param name="vPartMap"> the list of matching partMaps </param>
        ///	 * <returns> JDFAudit - the last PhaseTime audit </returns>
        ///
        public virtual JDFPhaseTime getLastPhase(VJDFAttributeMap vPartMap, string moduleID)
        {
            if (KElement.isWildCard(moduleID))
            {
                return((JDFPhaseTime)getAudit(-1, EnumAuditType.PhaseTime, null, vPartMap));
            }

            VElement e = getAudits(EnumAuditType.PhaseTime, null, vPartMap);

            if (e != null)
            {
                int size = e.Count - 1;
                for (int i = size; i >= 0; i--)
                {
                    JDFPhaseTime pt = (JDFPhaseTime)e[i];
                    if (pt.getChildWithAttribute(ElementName.MODULEPHASE, AttributeName.MODULEID, null, moduleID, 0, true) != null)
                    {
                        return(pt);
                    }
                }
            }

            return(null);
        }
コード例 #27
0
ファイル: JDFQueue.cs プロジェクト: cip4/JDFLibNet
        public virtual VElement flushQueue(JDFQueueFilter qf)
        {
            int siz = 0;

            VElement ve = getQueueEntryVector();

            if (ve != null)
            {
                siz = ve.Count;
                for (int i = siz - 1; i >= 0; i--)
                {
                    JDFQueueEntry qe = (JDFQueueEntry)ve[i];
                    if (qe.matchesQueueFilter(qf))
                    {
                        if (cleanupCallback != null)
                        {
                            cleanupCallback.cleanEntry(qe);
                        }

                        qe.deleteNode();
                    }
                    else
                    {
                        ve.RemoveAt(i);
                        siz--;
                    }
                }
            }

            if (automated)
            {
                setStatusFromEntries();
            }

            return(siz == 0 ? null : ve);
        }
コード例 #28
0
ファイル: JDFQueue.cs プロジェクト: cip4/JDFLibNet
        public virtual JDFQueueEntry getNextExecutableQueueEntry()
        {
            JDFQueueEntry theEntry = null;

            if (!canExecute())
            {
                return(theEntry);
            }

            VElement v = getQueueEntryVector(new JDFAttributeMap(AttributeName.STATUS, EnumQueueEntryStatus.Waiting), null);

            if (v != null)
            {
                int siz = v.Count;
                for (int i = 0; i < siz; i++)
                {
                    JDFQueueEntry qe = (JDFQueueEntry)v[i];

                    if (executeCallback != null && !executeCallback.canExecute(qe))
                    {
                        continue;
                    }

                    if (theEntry == null)
                    {
                        theEntry = qe;
                    }
                    else if (qe.CompareTo(theEntry) < 0)
                    {
                        theEntry = qe;
                    }
                }
            }

            return(theEntry);
        }
コード例 #29
0
        ///
        ///	 <summary> * gets the corresponding media with a given mediatype </summary>
        ///	 * <param name="mediaType"> the mediaType - must NOT be null </param>
        ///	 * <returns> the media, null if none is there or mediaType==null; </returns>
        ///
        public virtual JDFMedia getMedia(EnumMediaType mediaType)
        {
            if (mediaType == null)
            {
                return(null);
            }

            VElement v = getChildElementVector(ElementName.MEDIA, null);

            if (v != null)
            {
                int siz = v.Count;
                for (int i = 0; i < siz; i++)
                {
                    JDFMedia m = (JDFMedia)v[i];
                    if (mediaType.Equals(m.getMediaType()))
                    {
                        return(m);
                    }
                }
            }

            return(null);
        }
コード例 #30
0
ファイル: AmountTest.cs プロジェクト: cip4/JDFLibNet
        public virtual void testAudits()
        {
            testPlannedWasteICS();
            VString vs = new VString("Cover Sheet1 Sheet2", " ");

            VElement vRL = new VElement();

            vRL.Add(rlOut);
            vRL.Add(rlMediaIn);

            for (int j = 0; j < 2; j++)
            {
                bool bMinimal = j == 0;

                for (int i = 0; i < vs.Count; i++)
                {
                    string           sheet = vs.stringAt(i);
                    VJDFAttributeMap vmP   = new VJDFAttributeMap();
                    vmP.Add(new JDFAttributeMap(EnumPartIDKey.SheetName, sheet));
                    StatusCounter stUtil = new StatusCounter(n, vmP, vRL);

                    string refComp  = rlOut.getrRef();
                    string refMedia = rlMediaIn.getrRef();

                    stUtil.setTrackWaste(refComp, true);
                    stUtil.setTrackWaste(refMedia, true);

                    if (i == 0)
                    {
                        stUtil.setPhase(EnumNodeStatus.Stopped, "PowerOn", EnumDeviceStatus.Stopped, "PowerOn");
                    }
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");
                    stUtil.addPhase(refMedia, 0, 200, true);
                    stUtil.addPhase(refComp, 0, 200, true);
                    stUtil.setPhase(EnumNodeStatus.Setup, "FormChange", EnumDeviceStatus.Setup, "FormChange");

                    if (i >= 1 && !bMinimal)
                    {
                        JDFResourceAudit ra = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        stUtil.addPhase(refMedia, 50, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra);
                        ra2.setDescriptiveName("manual reset to using only 50 sheets because 100 initially were wastes");
                    }
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, 4000, 0, true);
                    stUtil.addPhase(refComp, 4000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.Cleanup, "Washup during processing", EnumDeviceStatus.Cleanup, "Washup");
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Waste", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 0, i == 0 ? 40 : 30, true);
                    stUtil.addPhase(refComp, 0, i == 0 ? 40 : 30, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    stUtil.addPhase(refMedia, 1000, 0, true);
                    stUtil.addPhase(refComp, 1000, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);
                    stUtil.addPhase(refMedia, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.addPhase(refComp, i == 0 ? 5200 : 5400, 0, true);
                    stUtil.setPhase(EnumNodeStatus.InProgress, "Good", EnumDeviceStatus.Running, null);

                    JDFResourceAudit ra_1 = stUtil.setResourceAudit(refMedia, EnumReason.ProcessResult);

                    if (!bMinimal)
                    {
                        stUtil.setResourceAudit(refComp, EnumReason.ProcessResult);

                        stUtil.clearAmounts(refMedia);
                        // Java to C# Conversion - Don't know the purpose of this unreachable code.  Default to the false value since 1 != 0
                        //stUtil.addPhase(refMedia, 1 == 0 ? 10100 : 10200, 0, true);
                        stUtil.addPhase(refMedia, 10200, 0, true);
                        JDFResourceAudit ra2 = stUtil.setResourceAudit(refMedia, EnumReason.OperatorInput);
                        ra2.setRef(ra_1);
                        ra2.setDescriptiveName("manual reset to using only 10200 sheets because 100 initially were  wates");
                    }
                    JDFProcessRun pr = stUtil.setProcessResult(EnumNodeStatus.Completed);
                    pr.setDescriptiveName("we even have the utterly useless ProcessRun");
                }
                if (bMinimal)
                {
                    JDFAuditPool ap     = n.getAuditPool();
                    VElement     audits = ap.getAudits(EnumAuditType.PhaseTime, null, null);
                    for (int i = 0; i < audits.Count; i++)
                    {
                        audits.item(i).deleteNode();
                    }
                }
                d.write2File(sm_dirTestDataTemp + "ConvPrintAmount_" + (bMinimal ? "min" : "full") + ".jdf", 2, false);
            }
        }