private int getParameterIndex(StackComponentWrapper stackElement) {
		int structOffset = stackElement.getOffset();
		StackComponentWrapper[] definedComponents = getDefinedComponents();
		int numComps = definedComponents.length;
		int firstIndex = -1; // first parameter index
		if (growsNegative) {
			for (int i = 0; i < numComps; i++) {
				DataTypeComponent dtc = definedComponents[i];
				int currentOffset = dtc.getOffset();
				if (currentOffset < parameterOffset) {
					continue;
				}
				if (firstIndex < 0) {
					firstIndex = i;
				}
				if (currentOffset == structOffset) {
					return i - firstIndex;
				}
			}
		}
		else {
			for (int i = numComps - 1; i >= 0; i--) {
				DataTypeComponent dtc = definedComponents[i];
				int currentOffset = dtc.getOffset();
				if (currentOffset >= parameterOffset) {
					continue;
				}
				if (firstIndex < 0) {
					firstIndex = i;
				}
				if (currentOffset == structOffset) {
					return firstIndex - i;
				}
			}
		}
		return 0;
	}
@param stackElement stack element
@return the index number for this parameter (starting at 1 for the first parameter.) 0 if the
        element is not a parameter.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/stackeditor/StackFrameDataType.java