hudson.matrix
Class Combination

java.lang.Object
  extended by java.util.AbstractMap<K,V>
      extended by java.util.TreeMap<String,String>
          extended by hudson.matrix.Combination
All Implemented Interfaces:
Serializable, Cloneable, Comparable<Combination>, Map<String,String>, NavigableMap<String,String>, SortedMap<String,String>

public final class Combination
extends TreeMap<String,String>
implements Comparable<Combination>

A particular combination of Axis values. For example, when axes are "x={1,2},y={3,4}", then [x=1,y=3] is a combination (out of 4 possible combinations)

Author:
Kohsuke Kawaguchi
See Also:
Serialized Form

Nested Class Summary
static class Combination.BooleanCategory
          Duck-typing for boolean expressions.
 
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
Constructor Summary
Combination(AxisList axisList, List<String> values)
           
Combination(AxisList axisList, String... values)
           
Combination(Map<String,String> keyValuePairs)
           
 
Method Summary
 void clear()
           
 int compareTo(Combination that)
           
 String digest()
          Gets the 8 character-wide hash code for this combination
 boolean evalGroovyExpression(AxisList axes, String expression)
          Evaluates the given Groovy expression with values bound from this combination.
static Combination fromString(String id)
          Reverse operation of toString().
 String get(Axis a)
           
 String put(String key, String value)
           
 void putAll(Map<? extends String,? extends String> map)
           
 String remove(Object key)
           
 String toCompactString(AxisList axes)
          Creates compact string representation suitable for display purpose.
 int toIndex(AxisList axis)
          Obtains the continuous unique index number of this Combination in the given AxisList.
 String toString()
           
 String toString(char sep1, char sep2)
          Converts to the ID string representation: axisName=value,axisName=value,...
 String toString(Collection<Axis> subset)
          Works like toString() but only include the given axes.
 List<String> values(Collection<? extends Axis> axes)
          Gets the values that correspond to the specified axes, in their order.
 
Methods inherited from class java.util.TreeMap
ceilingEntry, ceilingKey, clone, comparator, containsKey, containsValue, descendingKeySet, descendingMap, entrySet, firstEntry, firstKey, floorEntry, floorKey, get, headMap, headMap, higherEntry, higherKey, keySet, lastEntry, lastKey, lowerEntry, lowerKey, navigableKeySet, pollFirstEntry, pollLastEntry, size, subMap, subMap, tailMap, tailMap, values
 
Methods inherited from class java.util.AbstractMap
equals, hashCode, isEmpty
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
equals, hashCode, isEmpty
 

Constructor Detail

Combination

public Combination(AxisList axisList,
                   List<String> values)

Combination

public Combination(AxisList axisList,
                   String... values)

Combination

public Combination(Map<String,String> keyValuePairs)
Method Detail

get

public String get(Axis a)

toIndex

public int toIndex(AxisList axis)
Obtains the continuous unique index number of this Combination in the given AxisList.


evalGroovyExpression

public boolean evalGroovyExpression(AxisList axes,
                                    String expression)
Evaluates the given Groovy expression with values bound from this combination.

For example, if this combination is a=X,b=Y, then expressions like a=="X" would evaluate to true.


compareTo

public int compareTo(Combination that)
Specified by:
compareTo in interface Comparable<Combination>

toString

public String toString(Collection<Axis> subset)
Works like toString() but only include the given axes.


values

public List<String> values(Collection<? extends Axis> axes)
Gets the values that correspond to the specified axes, in their order.


toString

public String toString(char sep1,
                       char sep2)
Converts to the ID string representation: axisName=value,axisName=value,...

Parameters:
sep1 - The separator between multiple axes.
sep2 - The separator between axis name and value.

toString

public String toString()
Overrides:
toString in class AbstractMap<String,String>

digest

public String digest()
Gets the 8 character-wide hash code for this combination


fromString

public static Combination fromString(String id)
Reverse operation of toString().


toCompactString

public String toCompactString(AxisList axes)
Creates compact string representation suitable for display purpose.

The string is made compact by looking for Axis whose values are unique, and omit the axis name.


clear

public void clear()
Specified by:
clear in interface Map<String,String>
Overrides:
clear in class TreeMap<String,String>

putAll

public void putAll(Map<? extends String,? extends String> map)
Specified by:
putAll in interface Map<String,String>
Overrides:
putAll in class TreeMap<String,String>

put

public String put(String key,
                  String value)
Specified by:
put in interface Map<String,String>
Overrides:
put in class TreeMap<String,String>

remove

public String remove(Object key)
Specified by:
remove in interface Map<String,String>
Overrides:
remove in class TreeMap<String,String>


Copyright © 2004-2013. All Rights Reserved.