API Reference 0.7.1rikulo_view_selectSimpleSelectorSequence

SimpleSelectorSequence class

class SimpleSelectorSequence {
 
 String type;
 String id;
 final Set<String> classes;
 final List<Attribute> attributes;
 final List<PseudoClass> pseudoClasses;
 int combinator = COMB_DESCENDANT;
 
 SimpleSelectorSequence() : 
   classes = new Set<String>(),
   attributes = new List<Attribute>(),
   pseudoClasses = new List<PseudoClass>();
 
 // setters: only once
 
 void setCombinatorByToken(Token token) {
   //if (combinator != COMB_DESCENDANT) // TODO: parse exception
   switch (token.type) {
     case Token.TYPE_CBN_CHILD:
       this.combinator = COMB_CHILD;
       break;
     case Token.TYPE_CBN_ADJACENT_SIBLING:
       this.combinator = COMB_ADJACENT_SIBLING;
       break;
     case Token.TYPE_CBN_GENERAL_SIBLING:
       this.combinator = COMB_GENERAL_SIBLING;
       break;
     default:
       // TODO: parse exception
   }
 }
 
 //Attribute _currAttr;
 //PseudoClass _currPseudoCls;
 
 static const int COMB_DESCENDANT = 0; //
 static const int COMB_CHILD = 1; // >
 static const int COMB_ADJACENT_SIBLING = 2; // +
 static const int COMB_GENERAL_SIBLING = 3; // ~
 
 String printCombinator() {
   switch (this.combinator) {
     case COMB_CHILD:
       return " >";
     case COMB_ADJACENT_SIBLING:
       return " +";
     case COMB_GENERAL_SIBLING:
       return " ~";
     default:
       return "";
   }
 }
 
 String toString() {
   StringBuffer sb = new StringBuffer();
   if (type != null)
     sb.write(type);
   if (id != null)
     sb.write("#${id}");
   for (String c in classes)
     sb.write(".${c}");
   for (PseudoClass p in pseudoClasses)
     sb.write("${p}");
   return sb.isEmpty ? "*" : sb.toString();
 }
 
}

Static Properties

const int COMB_ADJACENT_SIBLING #

static const int COMB_ADJACENT_SIBLING = 2

const int COMB_CHILD #

static const int COMB_CHILD = 1

const int COMB_DESCENDANT #

static const int COMB_DESCENDANT = 0

const int COMB_GENERAL_SIBLING #

static const int COMB_GENERAL_SIBLING = 3

Constructors

new SimpleSelectorSequence() #

Creates a new Object instance.

Object instances have no meaningful state, and are only useful through their identity. An Object instance is equal to itself only.

docs inherited from Object
SimpleSelectorSequence() : 
 classes = new Set<String>(),
 attributes = new List<Attribute>(),
 pseudoClasses = new List<PseudoClass>();

Properties

final List<Attribute> attributes #

final List<Attribute> attributes

final Set<String> classes #

final Set<String> classes

int combinator #

int combinator = COMB_DESCENDANT

String id #

String id

final List<PseudoClass> pseudoClasses #

final List<PseudoClass> pseudoClasses

String type #

String type

Methods

String printCombinator() #

String printCombinator() {
 switch (this.combinator) {
   case COMB_CHILD:
     return " >";
   case COMB_ADJACENT_SIBLING:
     return " +";
   case COMB_GENERAL_SIBLING:
     return " ~";
   default:
     return "";
 }
}

void setCombinatorByToken(Token token) #

void setCombinatorByToken(Token token) {
 //if (combinator != COMB_DESCENDANT) // TODO: parse exception
 switch (token.type) {
   case Token.TYPE_CBN_CHILD:
     this.combinator = COMB_CHILD;
     break;
   case Token.TYPE_CBN_ADJACENT_SIBLING:
     this.combinator = COMB_ADJACENT_SIBLING;
     break;
   case Token.TYPE_CBN_GENERAL_SIBLING:
     this.combinator = COMB_GENERAL_SIBLING;
     break;
   default:
     // TODO: parse exception
 }
}

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString() {
 StringBuffer sb = new StringBuffer();
 if (type != null)
   sb.write(type);
 if (id != null)
   sb.write("#${id}");
 for (String c in classes)
   sb.write(".${c}");
 for (PseudoClass p in pseudoClasses)
   sb.write("${p}");
 return sb.isEmpty ? "*" : sb.toString();
}