Here you can find the source of splitScopes(String aActivityPath)
Parameter | Description |
---|---|
aActivityPath | a parameter |
protected static List<String> splitScopes(String aActivityPath)
//package com.java2s; import java.util.*; public class Main { /**/*w ww .j a v a 2s.c o m*/ * Splits the activity path into a series of paths to each of its scopes - starting * with the first parallel forEach scope. * <p/> * The following path: * <p/> * <code>/process/sequence/scope/flow/forEach/scope[@name='s1'][instance()=1]/sequence/scope[@name='s2']/sequence/assign</code> * <p/> * would be split into a list like this: * <p/> * <code>/process/sequence/scope/flow/forEach/scope[@name='s1'][instance()=1]/sequence/scope[@name='s2']</code> * <code>/process/sequence/scope/flow/forEach/scope[@name='s1'][instance()=1]</code> * * @param aActivityPath */ protected static List<String> splitScopes(String aActivityPath) { LinkedList<String> list = new LinkedList<>(); int offset = -1; // We only care about variables declarations nested within parallel forEach's // Therefore, start our search from the first occurrence of a parallel forEach scope int startFrom = aActivityPath.lastIndexOf('/', aActivityPath.indexOf("[instance()=")); //$NON-NLS-1$ while ((offset = aActivityPath.indexOf("/scope", startFrom)) != -1) //$NON-NLS-1$ { int endOfScopePath = aActivityPath.indexOf('/', offset + 1); if (endOfScopePath == -1) { // must be the end of the string endOfScopePath = aActivityPath.length(); } String path = aActivityPath.substring(0, endOfScopePath); list.addFirst(path); startFrom = endOfScopePath; } return list; } }