org.irisa.genouest.logol.types
Class ViewVariable

java.lang.Object
  extended by org.irisa.genouest.logol.types.AbstractVariable
      extended by org.irisa.genouest.logol.types.ViewVariable

public class ViewVariable
extends org.irisa.genouest.logol.types.AbstractVariable

Class managing a view type

Author:
osallou History: 02/06/09 Bug 1374 Add spacer as return var 28/07/09 Bug 1397 Add support for negative content constraint

Field Summary
static java.util.Vector<java.lang.String> predicates
           
 
Constructor Summary
ViewVariable(int varID)
           
 
Method Summary
static void addPredicate(java.lang.String pred)
          Adds an internal predicate
 java.lang.String content(org.irisa.genouest.logol.LogolVariable lvar)
          Set the prolog content for the view.
static int getPredCount()
           
static java.lang.String getPredicate(int predId)
          Gets the definition of a prolog internal predicate
static int getPredicateArraySize()
          Gets the number of internal predicates return number of internal predicates
static java.lang.String map2predicate(java.lang.String predicate, int id)
          Same as map2predicate(String predicate,int id, String plist,boolean overlap) with overlap set to false and no postponed list
static java.lang.String map2predicate(java.lang.String predicate, int id, java.lang.String plist)
          Same as map2predicate(String predicate,int id, String plist,boolean overlap) with overlap set to false
static java.lang.String map2predicate(java.lang.String predicate, int id, java.lang.String plist, boolean overlap)
          From a predicate or a list of predicate, create a new predicate and add it to a list of predicates.
static java.lang.String map2predicate(java.lang.String predicate, int id, java.lang.String plist, boolean overlap, java.lang.String min, java.lang.String max, java.lang.String afterpos)
          From a predicate or a list of predicate, create a new predicate and add it to a list of predicates.
static void reset()
          Reset static variables
static void setPredCount(int predCount)
           
 
Methods inherited from class org.irisa.genouest.logol.types.AbstractVariable
externalPredicate, getProlog
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

predicates

public static java.util.Vector<java.lang.String> predicates
Constructor Detail

ViewVariable

public ViewVariable(int varID)
Method Detail

addPredicate

public static void addPredicate(java.lang.String pred)
Adds an internal predicate

Parameters:
pred - String containing the prolog predicate definition

getPredicate

public static java.lang.String getPredicate(int predId)
Gets the definition of a prolog internal predicate

Parameters:
predId -
Returns:
predicate prolog content

getPredicateArraySize

public static int getPredicateArraySize()
Gets the number of internal predicates return number of internal predicates


reset

public static void reset()
Reset static variables


content

public java.lang.String content(org.irisa.genouest.logol.LogolVariable lvar)
                         throws org.irisa.genouest.logol.GrammarException
Set the prolog content for the view. Supports a spacer in front of a view (isAny), though spacer use is not competitive. It force the testing of a complete view with a slicing on the sequence, mainly if no length constraint is set on spacer. For better performance, spacer should be set inside the view.

Parameters:
lvar - variable describing the view
Throws:
org.irisa.genouest.logol.GrammarException

map2predicate

public static java.lang.String map2predicate(java.lang.String predicate,
                                             int id)
Same as map2predicate(String predicate,int id, String plist,boolean overlap) with overlap set to false and no postponed list

Parameters:
predicate - progol sentence to map to an internal predicate
id - identifier of the current variable
Returns:
prolog call to predicate

map2predicate

public static java.lang.String map2predicate(java.lang.String predicate,
                                             int id,
                                             java.lang.String plist)
Same as map2predicate(String predicate,int id, String plist,boolean overlap) with overlap set to false

Parameters:
predicate - progol sentence to map to an internal predicate
id - identifier of the current variable
plist - List of postponed variables
Returns:
prolog call to predicate

map2predicate

public static java.lang.String map2predicate(java.lang.String predicate,
                                             int id,
                                             java.lang.String plist,
                                             boolean overlap)
From a predicate or a list of predicate, create a new predicate and add it to a list of predicates. Returns a call to this newly created predicate.

Parameters:
predicate - progol sentence to map to an internal predicate
id - identifier of the current variable
plist - List of postponed variables
overlap - specific tag for management of overlaps
Returns:
prolog predicate call

map2predicate

public static java.lang.String map2predicate(java.lang.String predicate,
                                             int id,
                                             java.lang.String plist,
                                             boolean overlap,
                                             java.lang.String min,
                                             java.lang.String max,
                                             java.lang.String afterpos)
From a predicate or a list of predicate, create a new predicate and add it to a list of predicates. Returns a call to this newly created predicate.

Parameters:
predicate - progol sentence to map to an internal predicate
id - identifier of the current variable
plist - List of postponed variables
overlap - specific tag for management of overlaps
min - size to use in cas of negative constraint, null if positive constraint
max - size to use in cas of negative constraint, null if positive constraint
afterpos - Variable name to use to store output position. If null, use standard name.
Returns:
prolog predicate call

getPredCount

public static int getPredCount()

setPredCount

public static void setPredCount(int predCount)