public virtual void testValidCombinedProcessIndex() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType(EnumType.Strapping); JDFResource rBar = n.addResource("Bar", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null); JDFResourceLink rl = n.getLink(rBar, null); Assert.IsTrue(rl.validCombinedProcessIndex()); rl.setCombinedProcessIndex(null); Assert.IsTrue(rl.validCombinedProcessIndex()); JDFIntegerList il = new JDFIntegerList(); rl.setCombinedProcessIndex(il); Assert.IsTrue(rl.validCombinedProcessIndex()); il.Add(0); rl.setCombinedProcessIndex(il); Assert.IsFalse(rl.validCombinedProcessIndex()); n.setCombined(new VString("Approval ImageSetting", " ")); Assert.IsTrue(rl.validCombinedProcessIndex()); il.Add(1); rl.setCombinedProcessIndex(il); Assert.IsTrue(rl.validCombinedProcessIndex()); il.Add(1); rl.setCombinedProcessIndex(il); Assert.IsTrue(rl.validCombinedProcessIndex()); Assert.IsTrue(n.isValid(EnumValidationLevel.Incomplete)); il.Add(2); rl.setCombinedProcessIndex(il); Assert.IsFalse(rl.validCombinedProcessIndex()); Assert.IsFalse(n.isValid(EnumValidationLevel.Incomplete)); Assert.IsTrue(rl.getInvalidAttributes(EnumValidationLevel.Incomplete, true, -1).Contains(AttributeName.COMBINEDPROCESSINDEX)); }
public void testSetDefaultValue() { JDFIntegerList integerList = new JDFIntegerList("1 2 3"); iState.setDefaultValue(integerList); Assert.AreEqual(integerList, iState.getDefaultValue()); iState.setDefaultValue(1); Assert.AreEqual(new JDFIntegerList("1"), iState.getDefaultValue()); }
/// /// <summary> * fitsValueMod - checks whether <code>rangelist</code> matches /// * AllowedValueMod/PresentValueMod, specified for this State /// * </summary> /// * <param name="rangelist"> /// * range list to test </param> /// * <param name="valuemod"> /// * switches between AllowedValueMod and PresentValueMod. /// * </param> /// * <returns> boolean - true, if <code>rangelist</code> matches the /// * <code>valuemod</code> or if AllowedValueMod is not specified </returns> /// private bool fitsValueMod(JDFIntegerRangeList rangelist, EnumFitsValue valuemod) { if (valuemod.Equals(EnumFitsValue.Allowed)) { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD)) { return(true); } } else { if (!hasAttribute(AttributeName.ALLOWEDVALUEMOD) && !hasAttribute(AttributeName.PRESENTVALUEMOD)) { return(true); } } JDFXYPair mod; if (valuemod.Equals(EnumFitsValue.Allowed)) { mod = getAllowedValueMod(); } else { mod = getPresentValueMod(); } int divi = (int)(mod.X + 0.5); // X - the Modulo int shift = (int)(mod.Y + 0.5); // Y - offset of the // allowed/present value if (divi == 0) // ValueMod can't be "0 x" { return(false); } JDFIntegerList v = rangelist.getIntegerList(); int[] vi = v.getIntArray(); int siz = vi.Length; for (int i = 0; i < siz; i++) { if ((((vi[i] % divi) - shift) % divi) != 0) { return(false); } } return(true); }
/// /// <summary> * (20) get JDFIntegerList attribute AlternatePositions </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getAlternatePositions() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.ALTERNATEPOSITIONS, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute CombinedProcessIndex </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getCombinedProcessIndex() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.COMBINEDPROCESSINDEX, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute FoldOutPages </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getFoldOutPages() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.FOLDOUTPAGES, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute UnderLays </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getUnderLays() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.UNDERLAYS, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute GlueLineRefSheets </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getGlueLineRefSheets() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.GLUELINEREFSHEETS, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute PhysicalSection </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getPhysicalSection() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.PHYSICALSECTION, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
/// /// <summary> * (20) get JDFIntegerList attribute IntegerValue </summary> /// * <returns> JDFIntegerList the value of the attribute, null if a the /// * attribute value is not a valid to create a JDFIntegerList </returns> /// public virtual JDFIntegerList getIntegerValue() { string strAttrName = ""; JDFIntegerList nPlaceHolder = null; strAttrName = getAttribute(AttributeName.INTEGERVALUE, null, JDFConstants.EMPTYSTRING); try { nPlaceHolder = new JDFIntegerList(strAttrName); } catch (FormatException) { return(null); } return(nPlaceHolder); }
public void testIsValid() { JDFIntegerList integerList = new JDFIntegerList("1 2 3"); iState.setDefaultValue(integerList); iState.setCurrentValue(integerList); Assert.IsFalse(iState.isValid(EnumValidationLevel.Complete)); iState.setListType(EnumListType.List); Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete)); JDFIntegerRangeList integerRList = new JDFIntegerRangeList("1 2 3 4 ~ 44"); iState.setAllowedValueList(integerRList); Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete)); JDFIntegerRangeList integerList2 = new JDFIntegerRangeList("1 2 3 7~77"); iState.setPresentValueList(integerList2); Assert.IsTrue(iState.isValid(EnumValidationLevel.Complete)); }
public virtual void testSetCombinedProcessIndex() { JDFDoc d = new JDFDoc(ElementName.JDF); JDFNode n = d.getJDFRoot(); n.setType(EnumType.Strapping); JDFResource rBar = n.addResource("Bar", EnumResourceClass.Parameter, EnumUsage.Input, null, null, null, null); JDFResourceLink rl = n.getLink(rBar, null); rl.setCombinedProcessIndex(null); Assert.IsFalse(rl.hasAttribute(AttributeName.COMBINEDPROCESSINDEX)); JDFIntegerList il = new JDFIntegerList(); rl.setCombinedProcessIndex(il); Assert.IsFalse(rl.hasAttribute(AttributeName.COMBINEDPROCESSINDEX)); il.Add(0); rl.setCombinedProcessIndex(il); Assert.AreEqual(il, rl.getCombinedProcessIndex()); }
// --------------------------------------------------------------------- // Methods for Attribute IntegerValue // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute IntegerValue </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setIntegerValue(JDFIntegerList @value) { setAttribute(AttributeName.INTEGERVALUE, @value, null); }
// ************************************************************************ // * Attribute getter / setter // * ************************************************************************ // // --------------------------------------------------------------------- // Methods for Attribute AlternatePositions // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute AlternatePositions </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setAlternatePositions(JDFIntegerList @value) { setAttribute(AttributeName.ALTERNATEPOSITIONS, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute GlueLineRefSheets // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute GlueLineRefSheets </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setGlueLineRefSheets(JDFIntegerList @value) { setAttribute(AttributeName.GLUELINEREFSHEETS, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute FoldOutPages // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute FoldOutPages </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setFoldOutPages(JDFIntegerList @value) { setAttribute(AttributeName.FOLDOUTPAGES, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute UnderLays // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute UnderLays </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setUnderLays(JDFIntegerList @value) { setAttribute(AttributeName.UNDERLAYS, @value, null); }
// ************************************************************************ // * Attribute getter / setter // * ************************************************************************ // // --------------------------------------------------------------------- // Methods for Attribute Finishings // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute Finishings </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setFinishings(JDFIntegerList @value) { setAttribute(AttributeName.FINISHINGS, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute BackPages // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute BackPages </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setBackPages(JDFIntegerList @value) { setAttribute(AttributeName.BACKPAGES, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute PhysicalSection // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute PhysicalSection </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setPhysicalSection(JDFIntegerList @value) { setAttribute(AttributeName.PHYSICALSECTION, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute HoleCount // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute HoleCount </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setHoleCount(JDFIntegerList @value) { setAttribute(AttributeName.HOLECOUNT, @value, null); }
public virtual void setCurrentValue(JDFIntegerList @value) { setAttribute(AttributeName.CURRENTVALUE, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute SectionList // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute SectionList </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setSectionList(JDFIntegerList @value) { setAttribute(AttributeName.SECTIONLIST, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute VSamples // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute VSamples </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setVSamples(JDFIntegerList @value) { setAttribute(AttributeName.VSAMPLES, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute FrontPages // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute FrontPages </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setFrontPages(JDFIntegerList @value) { setAttribute(AttributeName.FRONTPAGES, @value, null); }
// ************************************************************************ // * Attribute getter / setter // * ************************************************************************ // // --------------------------------------------------------------------- // Methods for Attribute CombinedProcessIndex // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute CombinedProcessIndex </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setCombinedProcessIndex(JDFIntegerList @value) { setAttribute(AttributeName.COMBINEDPROCESSINDEX, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute Ties // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute Ties </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setTies(JDFIntegerList @value) { setAttribute(AttributeName.TIES, @value, null); }
// --------------------------------------------------------------------- // Methods for Attribute LayerAmount // --------------------------------------------------------------------- /// /// <summary> * (36) set attribute LayerAmount </summary> /// * <param name="value">: the value to set the attribute to </param> /// public virtual void setLayerAmount(JDFIntegerList @value) { setAttribute(AttributeName.LAYERAMOUNT, @value, null); }
/// /// <summary> * append elements to the node that match this DevCap, if they do not exist /// * yet /// * </summary> /// * <param name="node"> /// * the node to append the elements to </param> /// * <param name="bAll"> /// * if false, only add if minOccurs>=1 and required=true or a /// * default exists /// * </param> /// * <returns> KElement - the last element that was appended </returns> /// public virtual KElement appendMatchingElementsToNode(JDFNode node, bool bAll, org.cip4.jdflib.util.VectorMap <int, JDFResource> indexResMap, bool bLink) { KElement e = null; EnumContext context = getContext(); if (!bLink && EnumContext.Link.Equals(context)) { return(null); } if (bLink && !EnumContext.Link.Equals(context)) { return(null); } JDFDevCap devCap = getDevCap(); if (devCap == null) { return(null); } int minOcc = devCap.getMinOccurs(); if (minOcc == 0 && bAll) { minOcc = 1; } string nam = getName(); for (int i = 0; i < minOcc; i++) { if (context.Equals(EnumContext.Element)) { // vElem - for a common return type in all cases if (nam.Equals(ElementName.JDF)) { // nop - should actually never get here } else { e = node.getCreateElement(nam, getDevNS(), i); } } else if (context.Equals(EnumContext.Resource) || context.Equals(EnumContext.Link)) { EnumUsage linkUsage = getLinkUsage(); string procUsage = getProcessUsage(); JDFAttributeMap map = new JDFAttributeMap(); EnumProcessUsage pu = null; if (procUsage != null && procUsage.Length > 0) { map.put(AttributeName.PROCESSUSAGE, procUsage); pu = EnumProcessUsage.getEnum(procUsage); } if (linkUsage != null) { map.put(AttributeName.USAGE, linkUsage.getName()); } VElement links = node.getResourceLinks(nam, map, null); // now look for the correct combinedprocessindex - remove all // non-matching JDFIntegerRangeList tocNum = getTypeOccurrenceNum(); JDFIntegerList tocNum2 = tocNum == null ? null : tocNum.getIntegerList(); if (links != null && tocNum != null) { for (int ll = links.Count - 1; ll >= 0; ll--) { JDFResourceLink rl = (JDFResourceLink)links[ll]; JDFIntegerList il = rl.getCombinedProcessIndex(); if (il == null || !il.Contains(tocNum2)) { links.RemoveAt(ll); } } } if (links == null || links.Count <= i) { JDFResource r = null; // get a link hook for the matching combinedprocessindex if (bLink) { int kk = (tocNum2 == null || tocNum2.Count == 0) ? -1 : tocNum2.getInt(0); if (EnumUsage.Input.Equals(linkUsage)) { kk--; } List <JDFResource> v = null; indexResMap.TryGetValue(kk, out v); if (v != null) { int sv = v.Count; for (int kkk = 0; kkk < sv; kkk++) { JDFResource rr = v[kkk]; if (rr.LocalName.Equals(nam)) { r = rr; break; } } } } // we found no matching existing res - make a new one if (r == null) { r = node.addResource(nam, null, linkUsage, pu, null, getDevNS(), null); string id = devCap.getAttribute(AttributeName.ID, null, null); if (id != null) { JDFResourceLink rl = node.getLink(r, linkUsage); r.setID(id); if (rl != null) { rl.setrRef(id); } } if (tocNum2 == null || tocNum2.Count == 0) { indexResMap.putOne(-1, r); //(new int(-1), r); } else { indexResMap.putOne((int)tocNum2.elementAt(0), r); // only } // support // 1 // now } else // preexisting resource - just link it { e = node.linkResource(r, linkUsage, pu); } e = node.getLink(r, linkUsage); if (e != null) { JDFResourceLink rl = (JDFResourceLink)e; rl.setCombinedProcessIndex(tocNum2); } // update partititons JDFEnumerationState pidKeys = devCap.getEnumerationState(AttributeName.PARTIDKEYS); if (pidKeys != null) { VString keys = pidKeys.getAllowedValueList(); if (keys != null && keys.Count > 0) { JDFAttributeMap keyMap = new JDFAttributeMap(); for (int k = 0; k < keys.Count; k++) { string sk = "PartKey" + k; string key = keys.stringAt(k); if (key.Equals("RunIndex")) { sk = "0~-1"; } keyMap.put(key, sk); } r.getCreatePartition(keyMap, keys); } } } } else if (context.Equals(EnumContext.JMF)) { // TODO __Lena__ ... } } return(e); }
public virtual void setDefaultValue(JDFIntegerList @value) { setAttribute(AttributeName.DEFAULTVALUE, @value, null); }