Java String Split splitScopes(String aActivityPath)

Here you can find the source of splitScopes(String aActivityPath)

Description

Splits the activity path into a series of paths to each of its scopes - starting with the first parallel forEach scope.

License

Open Source License

Parameter

Parameter Description
aActivityPath a parameter

Declaration

protected static List<String> splitScopes(String aActivityPath) 

Method Source Code

//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;
    }
}

Related

  1. splitParameters(String parameters)
  2. splitParameters(String parameterString)
  3. splitParameterString(String theInput, boolean theUnescapeComponents)
  4. splitPartitionColStats(String key)
  5. splitResponses(String text)
  6. splitScriptToQueries(String script)
  7. SplitSearchTerms(String strSearch)
  8. splitSelection(String selection)
  9. splitSelectionAsInteger(String selection)