com.vaadin.sass.internal.parser
Class StringInterpolationSequence

java.lang.Object
  extended by com.vaadin.sass.internal.parser.StringInterpolationSequence
All Implemented Interfaces:
Serializable

public class StringInterpolationSequence
extends Object
implements Serializable

StringInterpolationSequence is used for representing sequences consisting of strings and interpolation. An unevaluated StringInterpolationSequence consists of StringItem (a wrapper for a String) and Interpolation objects. The result of calling replaceInterpolation is a StringInterpolationSequence where occurrences of interpolation have been replaced with the contents of the interpolation.

Author:
Vaadin
See Also:
Serialized Form

Constructor Summary
StringInterpolationSequence(List<SassListItem> sequence)
          Creates a new StringInterpolationSequence.
StringInterpolationSequence(String value)
          Creates a new StringInterpolationSequence containing only the given item.
 
Method Summary
 StringInterpolationSequence append(StringInterpolationSequence other)
          Creates a new StringInterpolationSequence that contains all items of this and other.
 boolean containsInterpolation()
          Returns true if this sequence contains interpolation, i.e.
 List<SassListItem> getItems()
           
 StringInterpolationSequence replaceVariables(ScssContext context)
          Creates a new sequence that is obtained from this by replacing all variables occurring in expressions.
 String toString()
           
 StringInterpolationSequence updateUrl(String prefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StringInterpolationSequence

public StringInterpolationSequence(String value)
Creates a new StringInterpolationSequence containing only the given item.


StringInterpolationSequence

public StringInterpolationSequence(List<SassListItem> sequence)
Creates a new StringInterpolationSequence. The list sequence should only contain StringItem and Interpolation objects.

Parameters:
sequence - A list of StringItem and Interpolation objects.
Method Detail

replaceVariables

public StringInterpolationSequence replaceVariables(ScssContext context)
Creates a new sequence that is obtained from this by replacing all variables occurring in expressions. Also replaces functions, arithmetic expressions and interpolation if all variables have been set.

Parameters:
context - current compilation context
Returns:
A new StringInterpolationSequence.

append

public StringInterpolationSequence append(StringInterpolationSequence other)
Creates a new StringInterpolationSequence that contains all items of this and other. Does not modify this or other.

Parameters:
other - The StringInterpolationSequence to be appended to the end of this.
Returns:
The appended StringInterpolationSequence.

toString

public String toString()
Overrides:
toString in class Object

containsInterpolation

public boolean containsInterpolation()
Returns true if this sequence contains interpolation, i.e. either an interpolation object or a string containing interpolation. This method is intended to be used as a quick test for avoiding repeated evaluation of interpolation when none appear in the StringInterpolationSequence. As such, the result false is always exact but if this method returns true, it is still possible that there is no interpolation.

Returns:
whether this sequence contains an Interpolation object or a string containing interpolation.

getItems

public List<SassListItem> getItems()

updateUrl

public StringInterpolationSequence updateUrl(String prefix)


Copyright © 2013–2015 Vaadin. All rights reserved.