com.metsci.glimpse.context
Class TargetStackUtil

java.lang.Object
  extended by com.metsci.glimpse.context.TargetStackUtil

public class TargetStackUtil
extends java.lang.Object

Utility method for manipulating GlimpseTargetStack instances.

Author:
ulman

Constructor Summary
TargetStackUtil()
           
 
Method Summary
static boolean endsWith(GlimpseTargetStack query, GlimpseTargetStack suffix)
          Returns true if the query stack ends with the sequence of GlimpseTargets defined by the prefix stack.
static GlimpseTargetStack newTargetStack(GlimpseTarget... targets)
          Creates a new target stack which is the concatenation of the provided GlimpseTargets.
static GlimpseTargetStack newTargetStack(GlimpseTargetStack stack)
          Creates a new GlimpseTargetStack which is an exact copy of the given stack.
static boolean startsWith(GlimpseTargetStack query, GlimpseTargetStack prefix)
          Returns true if the query stack starts with the sequence of GlimpseTargets defined by the prefix stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TargetStackUtil

public TargetStackUtil()
Method Detail

newTargetStack

public static GlimpseTargetStack newTargetStack(GlimpseTargetStack stack)
Creates a new GlimpseTargetStack which is an exact copy of the given stack.

Parameters:
stack - the stack to copy
Returns:
a deep copy of the provided stack

newTargetStack

public static GlimpseTargetStack newTargetStack(GlimpseTarget... targets)
Creates a new target stack which is the concatenation of the provided GlimpseTargets. The first provided GlimpseTarget is placed at the bottom of the new GlimpseTargetStack.

Parameters:
targets - the GlimpseTargets to concatenate
Returns:
the newly constructed GlimpseTargetStack

endsWith

public static boolean endsWith(GlimpseTargetStack query,
                               GlimpseTargetStack suffix)
Returns true if the query stack ends with the sequence of GlimpseTargets defined by the prefix stack. Ignores the GlimpseBounds.

Parameters:
query - the GlimpseTargetStack to investigate
suffix - a GlimpseTargetStack to search for at the end of the query stack
Returns:
whether the query stack ends with the GlimpseTargets in the prefix stack

startsWith

public static boolean startsWith(GlimpseTargetStack query,
                                 GlimpseTargetStack prefix)
Returns true if the query stack starts with the sequence of GlimpseTargets defined by the prefix stack. Ignores the GlimpseBounds.

Parameters:
query - the GlimpseTargetStack to investigate
prefix - a GlimpseTargetStack to search for at the start of the query stack
Returns:
whether the query stack starts with the GlimpseTargets in the prefix stack


Copyright © 2012 Metron, Inc.. All Rights Reserved.