private object[] compile(string text) { if (text == null) { return(new object[0]); } ArrayList arrayList = new ArrayList(); StringTokenizer stringTokenizer = new StringTokenizer(text, ":."); while (stringTokenizer.hasMoreTokens()) { string text2 = stringTokenizer.nextToken(); OpEnum instance = OpEnum.getInstance(text2); if (instance == null) { string text3 = new StringBuilder().append("Bad path compiled ").append(text).toString(); throw new Error(text3); } arrayList.add(instance); if (instance == OpEnum.RELATION) { arrayList.add(stringTokenizer.nextToken()); } } return(arrayList.toArray()); }
public virtual Item findItem(Item item) { if (PathExtractor.INTERPRET_PATHS) { return(item.findItem(this.path)); } if (this.compiledPath == null) { this.compiledPath = this.compile(this.path); } Item item2 = item; int num = 0; while (item2 != null && num < this.compiledPath.Length) { object[] array = this.compiledPath; int num2 = num; num++; OpEnum opEnum = (OpEnum)array[num2]; if (opEnum == OpEnum.NEXT) { item2 = item2.getNext(); } else if (opEnum == OpEnum.PREV) { item2 = item2.getPrevious(); } else if (opEnum == OpEnum.NEXT_NEXT) { item2 = item2.getNext(); if (item2 != null) { item2 = item2.getNext(); } } else if (opEnum == OpEnum.PREV_PREV) { item2 = item2.getPrevious(); if (item2 != null) { item2 = item2.getPrevious(); } } else if (opEnum == OpEnum.PARENT) { item2 = item2.getParent(); } else if (opEnum == OpEnum.DAUGHTER) { item2 = item2.getDaughter(); } else if (opEnum == OpEnum.LAST_DAUGHTER) { item2 = item2.getLastDaughter(); } else if (opEnum == OpEnum.RELATION) { object[] array2 = this.compiledPath; int num3 = num; num++; string relationName = (string)array2[num3]; item2 = item2.getSharedContents().getItemRelation(relationName); } else { [email protected](new StringBuilder().append("findItem: bad feature ").append(opEnum).append(" in ").append(this.path).toString()); } } return(item2); }