public VarDefBase getUnDollarUnprefixNamedChild( SharedProgramInstanceData sharedProgramInstanceData, String csName, IntegerRef rnChildIndex) { String csUpperName = csName.toUpperCase(); int nNbChildren = getNbChildren(); for (int nIndex = 0; nIndex < nNbChildren; nIndex++) { VarDefBase varDefChild = getChild(nIndex); String csChildName = varDefChild.getUnprefixedName(sharedProgramInstanceData).toUpperCase(); if (csChildName.equals(csUpperName)) { if (rnChildIndex != null) rnChildIndex.set(nIndex); return varDefChild; } else { int nDollarPos = csChildName.indexOf('$'); if (nDollarPos >= 0) { String csUnDollarChildName = csChildName.substring(0, nDollarPos); if (csUnDollarChildName.equals(csUpperName)) { if (rnChildIndex != null) rnChildIndex.set(nIndex); return varDefChild; } } } varDefChild = varDefChild.getUnprefixNamedChild(sharedProgramInstanceData, csName, rnChildIndex); if (varDefChild != null) return varDefChild; } return null; }
public void calcOccursOwners() { if (m_occursItemSettings != null && m_occursItemSettings.m_arrVarDefOccursOwner != null) { int nNbDimensions = m_occursItemSettings.m_arrVarDefOccursOwner.size(); m_occursItemSettings.m_aOccursOwnerLocation = new OccursOwnerLocation[nNbDimensions]; VarDefBase varDefOccursOwnerCurrent = this; for (int n = 0; n < nNbDimensions; n++) { VarDefBase varDefOccursOwner = m_occursItemSettings.m_arrVarDefOccursOwner.get(n); int nDistanceFromOccursOwner = varDefOccursOwnerCurrent.m_nDefaultAbsolutePosition - varDefOccursOwner.m_nDefaultAbsolutePosition; int nSignleEntrySize = varDefOccursOwner.getOneEntrySize(); m_occursItemSettings.m_aOccursOwnerLocation[n] = new OccursOwnerLocation( nDistanceFromOccursOwner, varDefOccursOwner.m_nDefaultAbsolutePosition, nSignleEntrySize); varDefOccursOwnerCurrent = varDefOccursOwner; } } if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); varDefChild.calcOccursOwners(); } } }
private void calcAbsolutePosition(SharedProgramInstanceData sharedProgramInstanceData) { m_nDefaultAbsolutePosition = 0; if (m_varDefRedefinOrigin != null) // We are a redefine { if (isVarInMapRedefine() && m_varDefRedefinOrigin.isEditInMapRedefine()) { // We are a var that redefines an edit; The var must point to the text part of the edit, not // in the attribute header m_nDefaultAbsolutePosition = m_varDefRedefinOrigin.m_nDefaultAbsolutePosition + m_varDefRedefinOrigin.getHeaderLength(); } else // no header to skip { m_nDefaultAbsolutePosition = m_varDefRedefinOrigin.m_nDefaultAbsolutePosition; // Set at the redefine origin position } } else // We are not a redefine { VarDefBase varDefPreviousSameLevelNonRedefine = getPreviousSameLevelNonRedefine(sharedProgramInstanceData); if (varDefPreviousSameLevelNonRedefine != null) m_nDefaultAbsolutePosition = varDefPreviousSameLevelNonRedefine.m_nDefaultAbsolutePosition + varDefPreviousSameLevelNonRedefine.getTotalSize(); else if (m_varDefParent != null) m_nDefaultAbsolutePosition = m_varDefParent.m_nDefaultAbsolutePosition + m_varDefParent.getHeaderLength(); } calcPositionsIntoBuffer(sharedProgramInstanceData); }
private int getSumChildrenSize() { int nNbOccurs = getNbOccurs(); int nSingleItemSize = getSingleItemRequiredStorageSize(); int nSumChildrenSize = 0; if (isVarDefForm()) nSumChildrenSize = getHeaderLength(); if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); int nSize = varDefChild.calcSize(); if (varDefChild.m_varDefRedefinOrigin == null || varDefChild.isEditInMapRedefine()) nSumChildrenSize += nSize; else if (isVarInMapRedefine() && !m_varDefParent.isEditInMapRedefine()) nSumChildrenSize += nSize; } } if (nSingleItemSize == 0) // We have no size defined for ourself { if (isEditInMapRedefine() && m_OccursDef != null) return nNbOccurs * nSumChildrenSize; if (m_varDefRedefinOrigin != null) // We are a redefine { int n = m_varDefRedefinOrigin.getTotalSize(); return n; // do not count the number of occurances, because } return nNbOccurs * nSumChildrenSize; } return nNbOccurs * nSingleItemSize; }
public VarDefBase getParentAtLevel01() { VarDefBase varDefLevel01 = this; while (varDefLevel01 != null) { int nLevel = varDefLevel01.getLevel(); if (nLevel == 1) return varDefLevel01; varDefLevel01 = varDefLevel01.m_varDefParent; } return null; }
public void calcPositionsIntoBuffer(SharedProgramInstanceData sharedProgramInstanceData) { if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); varDefChild.calcAbsolutePosition(sharedProgramInstanceData); } } }
int getMaxIndexAtDim(int n) { if (m_occursItemSettings != null) { VarDefBase occursOwner = m_occursItemSettings.m_arrVarDefOccursOwner.get(n); if (occursOwner == null) { return 0; } return occursOwner.getNbOccurs(); } return 0; }
public void assignEditInMapRedefine() { if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); varDefChild.mapOnOriginEdit(); varDefChild.assignEditInMapRedefine(); } } }
protected VarDefBase getLastVarDefAtLevel(short sLevel) { if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int n = nNbChildren - 1; n >= 0; n--) { VarDefBase varDefChild = getChild(n); if (varDefChild.getLevel() == sLevel || varDefChild.getLevel() == 77) return varDefChild; if (varDefChild.getLevel() < sLevel) return null; } } return null; }
private int getSumChildrenSizeVarInEdit() { int nSumSize = 0; if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); int nSize = varDefChild.calcSizeVarInEdit(); if (varDefChild.m_varDefRedefinOrigin == null) nSumSize += nSize; } } else nSumSize = getSingleItemRequiredStorageSize(); return nSumSize; }
int getNbItems() { int nNbOccurs = getNbOccurs(); if (m_arrChildren != null) { int n = 0; for (int nChild = 0; nChild < m_arrChildren.size(); nChild++) { VarDefBase varDefChild = getChild(nChild); if (varDefChild != null && varDefChild.isEditInMapRedefine()) n += varDefChild.getNbItems(); } if (n == 0) n = 1; return nNbOccurs * n; } else return nNbOccurs; }
public void getChildrenEncodingConvertiblePosition( VarDefEncodingConvertibleManager varDefEncodingConvertibleManager) { if (m_arrChildren != null) { int nNbChildren = m_arrChildren.size(); for (int nChild = 0; nChild < nNbChildren; nChild++) { VarDefBase varDefChild = getChild(nChild); if (!varDefChild.isARedefine()) varDefChild.getChildrenEncodingConvertiblePosition(varDefEncodingConvertibleManager); } } else // No child: We are a final node { if (!isARedefine() && isEbcdicAsciiConvertible()) { int nNbDim = getNbDim(); if (nNbDim == 0) varDefEncodingConvertibleManager.add(this); else if (nNbDim == 1) { TempCache cache = TempCacheLocator.getTLSTempCache(); int nNbX = getMaxIndexAtDim(0); for (int x = 0; x < nNbX; x++) { VarDefBuffer varDefItem = getCachedGetAt(cache, x + 1); if (varDefItem != null) varDefEncodingConvertibleManager.add(varDefItem); cache.resetTempVarIndex(varDefItem.getTypeId()); } } else if (nNbDim == 2) { TempCache cache = TempCacheLocator.getTLSTempCache(); int nNbY = getMaxIndexAtDim(1); int nNbX = getMaxIndexAtDim(0); for (int y = 0; y < nNbY; y++) { for (int x = 0; x < nNbX; x++) { VarDefBuffer varDefItem = getCachedGetAt(cache, y + 1, x + 1); if (varDefItem != null) varDefEncodingConvertibleManager.add(varDefItem); cache.resetTempVarIndex(varDefItem.getTypeId()); } } } else if (nNbDim == 3) { TempCache cache = TempCacheLocator.getTLSTempCache(); int nNbZ = getMaxIndexAtDim(2); int nNbY = getMaxIndexAtDim(1); int nNbX = getMaxIndexAtDim(0); for (int z = 0; z < nNbZ; z++) { for (int y = 0; y < nNbY; y++) { for (int x = 0; x < nNbX; x++) { VarDefBuffer varDefItem = getCachedGetAt(cache, z + 1, y + 1, x + 1); if (varDefItem != null) varDefEncodingConvertibleManager.add(varDefItem); cache.resetTempVarIndex(varDefItem.getTypeId()); } } } } } } }
public VarDefBase getNamedChild( SharedProgramInstanceData sharedProgramInstanceData, String csName) { int nNbChildren = getNbChildren(); for (int nIndex = 0; nIndex < nNbChildren; nIndex++) { VarDefBase varDefChild = getChild(nIndex); String csChildName = varDefChild.getFullName(sharedProgramInstanceData); if (csChildName.equalsIgnoreCase(csName)) return varDefChild; csChildName = NameManager.getUnprefixedName(csChildName); if (csChildName.equalsIgnoreCase(csName)) return varDefChild; varDefChild = varDefChild.getNamedChild(sharedProgramInstanceData, csName); if (varDefChild != null) return varDefChild; } return null; }
private VarDefBase getPreviousSameLevelNonRedefine( SharedProgramInstanceData sharedProgramInstanceData) { if (getVarDefPreviousSameLevel(sharedProgramInstanceData) != null) { VarDefBase varDefPrevious = getVarDefPreviousSameLevel(sharedProgramInstanceData); if (varDefPrevious.m_varDefRedefinOrigin != null) // The previous is a redefine { if (varDefPrevious .isEditInMapRedefine()) // PJD: previous sibling determination error correction return varDefPrevious; // PJD: previous sibling determination error correction return varDefPrevious.getPreviousSameLevelNonRedefine(sharedProgramInstanceData); } return varDefPrevious; // the previous is not a redefine } return null; // No previous at the same level }
private int getNbEdit() { int nNbEdit = 0; if (isEditInMapRedefine() && m_OccursDef == null) nNbEdit++; int nNbChildren = getNbChildren(); for (int n = 0; n < nNbChildren; n++) { VarDefBase varDefChild = getChild(n); int nNbEditUnderChild = varDefChild.getNbEdit(); nNbEdit += nNbEditUnderChild; } if (isEditInMapRedefine() && m_OccursDef != null) { int nNbOccurs = m_OccursDef.getNbOccurs(); nNbEdit = nNbEdit * nNbOccurs; } return nNbEdit; }
int getNbEditUntil(VarDefBase varChildToFind, FoundFlag foundFlag) { int nNbEdit = 0; if (isEditInMapRedefine() && m_OccursDef == null) nNbEdit++; int nNbChildren = getNbChildren(); for (int n = 0; n < nNbChildren && !foundFlag.isFound(); n++) { VarDefBase varDefChild = getChild(n); if (varChildToFind == varDefChild) { foundFlag.setFound(); return nNbEdit; } if (!foundFlag.isFound()) { int nNbEditUnderChild = varDefChild.getNbEditUntil(varChildToFind, foundFlag); if (varDefChild.isVarInMapRedefine() && varDefChild.m_varDefRedefinOrigin != null) // we are a var redefine, and we know what we redefines { if (foundFlag.isFound()) // We found the edit serched as a child of the var redefine { int nNbEditAlredayCounted = varDefChild.m_varDefRedefinOrigin .getNbEdit(); // Number of items alreday counted in the var redefine origin: it // must not be taken into account nNbEdit = nNbEdit + nNbEditUnderChild - nNbEditAlredayCounted; return nNbEdit; } } else nNbEdit += nNbEditUnderChild; } } if (!foundFlag.isFound()) { if (isEditInMapRedefine() && m_OccursDef != null) { int nNbOccurs = m_OccursDef.getNbOccurs(); nNbEdit = nNbEdit * nNbOccurs; } } return nNbEdit; }
public VarDefBase(VarDefBase varDefParent, VarLevel varLevel) { boolean bWSVar = !varLevel.getProgramManager().isLinkageSectionCurrent(); setWSVar(bWSVar); m_varDefParent = varDefParent; setLevel(varLevel.getLevel()); m_varDefRedefinOrigin = varLevel.getVarDefRedefineOrigin(); m_OccursDef = varLevel.getOccursDef(); if (varDefParent != null) m_varDefFormRedefineOrigin = varDefParent.m_varDefFormRedefineOrigin; if (varDefParent != null) { if (getLevel() != 77) { setVarDefPreviousSameLevel(varDefParent.getLastVarDefAtLevel(getLevel())); varDefParent.addChild(this); } else { setVarDefPreviousSameLevel(varDefParent.getLastVarDefAtAnyLevel()); VarDefBase varDefRoot = getVarDefRoot(); varDefRoot.addChild(this); } getArrVarDefOccursOwner(this); } // JmxGeneralStat.incNbVarDef(); }
VarDefBuffer getCachedGetAt(TempCache cache, int x) { assertIfFalse(x > 0); if (cache != null) { int nTypeId = getTypeId(); CoupleVar coupleVarGetAt = cache.getTempVar(nTypeId); if (coupleVarGetAt != null) { // Adjust varDefGetAt to m_varDef.getAt(x); It is already created in the correct type int nAbsStart = getAbsStart(x - 1); int nDebugIndex = VarDefBase.makeDebugIndex(x); adjustSetting(coupleVarGetAt.m_varDefBuffer, nAbsStart, nDebugIndex, 1, m_varDefParent); return coupleVarGetAt.m_varDefBuffer; } VarDefBuffer varDefGetAt = createVarDefAt(x - 1, m_varDefParent); cache.addTempVar(nTypeId, varDefGetAt, null); return varDefGetAt; } VarDefBuffer varDefItem = createVarDefAt(x - 1, m_varDefParent); return varDefItem; }
private void setVarDefPreviousSameLevel(VarDefBase varDefPreviousSameLevel) { int nVarDefPreviousSameLevelId = NULL_ID; if (varDefPreviousSameLevel != null) nVarDefPreviousSameLevelId = varDefPreviousSameLevel.getId(); m_n_PreviousSameLevel_Id = setHigh(m_n_PreviousSameLevel_Id, nVarDefPreviousSameLevelId); }
void setVarDefMaster(VarDefBase varDefBase) { int nId = varDefBase.getId(); m_n_varDefMaster_Free = setHigh(m_n_varDefMaster_Free, nId); }
private void getArrVarDefOccursOwner(VarDefBase varDefCurrent) { if (m_OccursDef != null) varDefCurrent.addVarDefOccursOwner(this); if (m_varDefParent != null) m_varDefParent.getArrVarDefOccursOwner(varDefCurrent); }