org.mmbase.util.functions
Class IndexFunction

java.lang.Object
  extended byorg.mmbase.util.functions.FunctionProvider
      extended byorg.mmbase.util.functions.IndexFunction

public class IndexFunction
extends FunctionProvider

The index node functions can be assigned to nodes which are connected by an 'index' relation. An index relation is an extension of 'posrel', but also has an 'index' and a 'root' field. These are used to calcaluate the 'number' of the connected nodes. The 'pos' field only serves to fix the order. The index field can be empty in which case the node with the lowest pos gets number 1, the following number 2 and so on. But on any one of the index relations the index can be stated explicitely. If e.g. the index is specified 'a' then the following node will be 'b'. You can also arrange for 'i', 'ii', 'iii', 'iv' and so on. The root field (a node-type field) specifies to which tree the relations belong. So principaly the same 'chapter' can exists with several different chapter numbers. Also, it is used to define where counting must starts, because the complete number of a chapter consists of a chain of numbers (like 2.3.4.iii).

Since:
MMBase-1.8
Version:
$Id: IndexFunction.java,v 1.8 2005/10/01 20:17:36 michiel Exp $
Author:
Michiel Meeuwissen

Nested Class Summary
protected static class IndexFunction.Stack
           
 
Field Summary
protected static NodeFunction index
           
protected static Cache indexCache
           
 
Fields inherited from class org.mmbase.util.functions.FunctionProvider
functions, getFunctions
 
Constructor Summary
IndexFunction()
           
 
Method Summary
static void main(String[] argv)
           
protected static String romanSuccessor(String index)
          Calculates the 'successor' of a roman number, preserving uppercase/lowercase.
static String successor(String index)
          Returns the 'successor' or a string.
protected static String successor(String index, String separator, String joiner, boolean roman)
          Calculates the 'successor' of an index String.
 
Methods inherited from class org.mmbase.util.functions.FunctionProvider
addFunction, createParameters, getFunction, getFunctions, getFunctionValue, newFunctionInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexCache

protected static Cache indexCache

index

protected static NodeFunction index
Constructor Detail

IndexFunction

public IndexFunction()
Method Detail

successor

public static String successor(String index)
Returns the 'successor' or a string. Which means that e.g. after 'zzz' follows 'aaaa'.


romanSuccessor

protected static String romanSuccessor(String index)
Calculates the 'successor' of a roman number, preserving uppercase/lowercase.


successor

protected static String successor(String index,
                                  String separator,
                                  String joiner,
                                  boolean roman)
Calculates the 'successor' of an index String. Like '7.4.iii' of which the successor is '7.4.iv'.

Parameters:
index - The string to succeed
separator - Regular expression to split up the string first (e.g. "\\.")
joiner - String to rejoin it again (e.g. ".")
roman - Whether to consider roman numbers

main

public static void main(String[] argv)


MMBase build 1.8.1.20060716