argutia.logic
Class PropositionalVariable

java.lang.Object
  extended by argutia.logic.syntax.SyntacticUnit
      extended by argutia.logic.PropositionalVariable
All Implemented Interfaces:
AffichableAvecStyle, Atom, Literal
@Immutable
public class PropositionalVariable
extends SyntacticUnit
implements Atom

En logique propositionnelle, une variable propositionnelle représente une proposition, c'est-à-dire une entité ayant pour valeurs possibles vrai ou faux. Une variable propositionnelle possède une orthographe constituée d'un ou plusieurs caractères choisis par l'utilisateur.

Author:
Geoffroy AUBRY
Implementation Notes:
La création de chaque variable propositionnelle entraîne automatiquement la construction de sa négation, à savoir un littéral négatif.
Test Case:
PropositionalVariableTest
Field Summary
static String CARACTERE
          Définit ce qu'est un caractère au sein d'une variable propositionnelle via une expression régulière.
private NegativeLiteral oppose
          Littéral opposé, c'est-à-dire la négation de la variable propositionnelle.
private String orthographe
          Orthographe de la variable propositionnelle.
static String RB_ILLEGAL_ARGUMENT_EXCEPTION
           
static String RB_KEY_ALREADY_EXISTS_EXCEPTION
           
private static Map<String,PropositionalVariable> VALUES
          Map répertoriant les différentes instances de PropositionalVariable.
 
Constructor Summary
private PropositionalVariable(String orthographe)
          Crée une variable propositionnelle avec pour orthographe celle spécifiée.
 
Method Summary
 NegativeLiteral getOppose()
          Retourne le littéral opposé, c'est-à-dire la négation de cette variable propositionnelle.
static PropositionalVariable getOrNew(String orthographe)
          Retourne la variable propositionnelle dont l'orthographe correspond à celle fourni en paramètre.
static boolean isSyntaxValid(String s)
          Retourne true si la chaîne s est constituée d'un ou plusieurs caractères.
 String toString()
          Retourne l'orthographe de la variable propositionnelle.
 void toStyledString(BatchStyledDocument doc)
          Ajoute du style au résultat d'un appel à toString() et l'ajoute en attente d'insertion dans le document spécifié.
 
Methods inherited from class argutia.logic.syntax.SyntacticUnit
equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Field Detail

CARACTERE

public static final String CARACTERE
Définit ce qu'est un caractère au sein d'une variable propositionnelle via une expression régulière.

See Also:
Pattern, Constant Field Values
Constant Field Value:
"(?:\\p{L}|\\d|_)"

RB_ILLEGAL_ARGUMENT_EXCEPTION

@ResourceBundle(value="argutia.argutia")
public static final String RB_ILLEGAL_ARGUMENT_EXCEPTION
See Also:
PropositionalVariable(String), Constant Field Values
Constant Field Value:
"propositional_variable.illegal_argument_exception"

RB_KEY_ALREADY_EXISTS_EXCEPTION

@ResourceBundle(value="argutia.argutia")
public static final String RB_KEY_ALREADY_EXISTS_EXCEPTION
See Also:
PropositionalVariable(String), Constant Field Values
Constant Field Value:
"propositional_variable.key_already_exists_exception"

VALUES

private static final Map<String,PropositionalVariable> VALUES
Map répertoriant les différentes instances de PropositionalVariable.

Implementation Notes:
La clef est l'orthographe de la variable propositionnelle.

oppose

private final NegativeLiteral oppose
Littéral opposé, c'est-à-dire la négation de la variable propositionnelle. C'est donc un littéral négatif.

Implementation Notes:
Un littéral négatif est construit pour chaque variable propositionnelle, lors de l'appel à l'unique constructeur : PropositionalVariable(String).

orthographe

private final String orthographe
Orthographe de la variable propositionnelle.

Constructor Detail

PropositionalVariable

private PropositionalVariable(String orthographe)
                       throws KeyAlreadyExistsException,
                              IllegalArgumentException
Crée une variable propositionnelle avec pour orthographe celle spécifiée. Construit également sa négation.

Parameters:
orthographe - orthographe de la nouvelle variable propositionnelle.
Throws:
KeyAlreadyExistsException - si une variable propositionnelle avec la même orthographe a déjà été créée.
IllegalArgumentException - si la syntaxe de la variable propositionnelle n'est pas conforme selon isSyntaxValid(String).
Method Detail

getOrNew

public static PropositionalVariable getOrNew(String orthographe)
                                      throws IllegalArgumentException
Retourne la variable propositionnelle dont l'orthographe correspond à celle fourni en paramètre. Si aucune ne correspond, alors une nouvelle variable propositionnelle est créée, puis retournée.

See Also:
PropositionalVariable(String)
Test Case:
PropositionalVariableTest.testGetOrNew()
Parameters:
orthographe - orthographe pour laquelle on recherche ou crée une variable propositionnelle.
Returns:
la variable propositionnelle dont l'orthographe correspond à celle fourni en paramètre, ou une nouvelle sinon.
Throws:
IllegalArgumentException - si la syntaxe de la variable propositionnelle n'est pas conforme selon isSyntaxValid(String).

isSyntaxValid

public static boolean isSyntaxValid(String s)
Retourne true si la chaîne s est constituée d'un ou plusieurs caractères.

Test Case:
PropositionalVariableTest.testIsSyntaxValid()
Parameters:
s - chaîne que l'on examine.
Returns:
true si la chaîne s est constituée d'un ou plusieurs caractères.

getOppose

public NegativeLiteral getOppose()
Retourne le littéral opposé, c'est-à-dire la négation de cette variable propositionnelle.

Specified by:
getOppose in interface Literal
Test Case:
PropositionalVariableTest.testGetOppose()
Returns:
le littéral opposé.

toString

public String toString()
Retourne l'orthographe de la variable propositionnelle.

Overrides:
toString in class Object
Returns:
l'orthographe de la variable propositionnelle.

toStyledString

public void toStyledString(BatchStyledDocument doc)
Ajoute du style au résultat d'un appel à toString() et l'ajoute en attente d'insertion dans le document spécifié.

Specified by:
toStyledString in interface AffichableAvecStyle
See Also:
MyStyles
Parameters:
doc - BatchStyledDocument auquel on veut ajouter du texte mis en forme.
Argutia JavaDoc
23 décembre 2007