Orbital library

orbital.logic.imp
Class InterpretationBase

java.lang.Object
  extended by orbital.util.DelegateMap
      extended by orbital.logic.imp.InterpretationBase
All Implemented Interfaces:
java.io.Serializable, java.util.Map, Interpretation

public class InterpretationBase
extends DelegateMap
implements Interpretation

A basic interpretation implementation.

Author:
André Platzer
See Also:
Logic.satisfy(orbital.logic.imp.Interpretation, orbital.logic.imp.Formula), Signature, Map, Serialized Form
Invariants:
sub classes support nullary constructor (for virtual new instance).

Nested Class Summary
 
Nested classes/interfaces inherited from interface java.util.Map
java.util.Map.Entry
 
Constructor Summary
protected InterpretationBase(Signature sigma)
          Construct a problem specific interpretation source.
  InterpretationBase(Signature sigma, java.util.Map associations)
          Construct a new Interpretation with the given map of associations.
  InterpretationBase(Signature sigma, java.util.SortedMap associations)
           
 
Method Summary
 boolean contains(java.lang.Object symbol)
           
 boolean containsKey(java.lang.Object symbol)
          Returns whether the specified symbol is contained in this interpretation assocation map.
static Interpretation EMPTY(Signature sigma)
          The empty interpretation ∅ for the given signature.
 boolean equals(java.lang.Object o)
          Checks two interpretations for extensional equality.
 java.lang.Object get(java.lang.Object symbol)
          Get the referent associated with the given symbol in this interpretation.
 Signature getSignature()
          Get the signature interpreted.
 int hashCode()
          Get a hash code fitting extensional equality.
 java.lang.Object put(java.lang.Object symbol, java.lang.Object referent)
          Set the referent associated with the given symbol in this interpretation.
 void putAll(java.util.Map associations)
          Copies all of the associations from the specified map to this interpretation.
 java.lang.Object remove(java.lang.Object symbol)
           
 void setSignature(Signature sigma)
          Set the signature interpreted.
 java.lang.String toString()
           
 Interpretation union(Interpretation i2)
          Returns the union of two interpretations.
static Interpretation unmodifiableInterpretation(Interpretation i)
          Returns an unmodifiable view of the specified interpretation.
 
Methods inherited from class orbital.util.DelegateMap
clear, containsValue, entrySet, getDelegatee, isEmpty, keySet, setDelegatee, size, values
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Map
clear, containsValue, entrySet, isEmpty, keySet, size, values
 

Constructor Detail

InterpretationBase

protected InterpretationBase(Signature sigma)
Construct a problem specific interpretation source.

Overwrite map operations like get(Object), contains(Object) to implement a different source for symbol associations, than the map. This is especially useful if a problem specific source for logical data values already exists.

Parameters:
sigma - the signature Σ whose symbols are interpreted by the custom interpretation source. If sigma is null, then it should be set later with setSignature(Signature).

InterpretationBase

public InterpretationBase(Signature sigma,
                          java.util.Map associations)
Construct a new Interpretation with the given map of associations.

Parameters:
sigma - the signature Σ whose symbols to interpret.
associations - the map that associates each symbol in sigma with a value object.

InterpretationBase

public InterpretationBase(Signature sigma,
                          java.util.SortedMap associations)
Method Detail

EMPTY

public static final Interpretation EMPTY(Signature sigma)
The empty interpretation ∅ for the given signature. Note that it is generally not useful to use empty interpretations, however there are some special applications.


equals

public boolean equals(java.lang.Object o)
Description copied from interface: Interpretation
Checks two interpretations for extensional equality. Two interpretations are equal if both their signatures and interpretation objects are equal.

Specified by:
equals in interface java.util.Map
Specified by:
equals in interface Interpretation
Overrides:
equals in class DelegateMap

hashCode

public int hashCode()
Description copied from interface: Interpretation
Get a hash code fitting extensional equality. .

Specified by:
hashCode in interface java.util.Map
Specified by:
hashCode in interface Interpretation
Overrides:
hashCode in class DelegateMap

getSignature

public Signature getSignature()
Get the signature interpreted.

Specified by:
getSignature in interface Interpretation

setSignature

public void setSignature(Signature sigma)
Set the signature interpreted.

Specified by:
setSignature in interface Interpretation
Throws:
java.lang.IllegalArgumentException - if sigma does not contain a symbol which is interpreted in the current assocation map. This is not checked if sigma is null.
Preconditions:
sigma == null || map == null || map.keySet() ⊆ sigma

get

public java.lang.Object get(java.lang.Object symbol)
Description copied from interface: Interpretation
Get the referent associated with the given symbol in this interpretation.

Overwrite along with other map operations like Set.contains(Object) to implement a different source for symbol associations.

Specified by:
get in interface java.util.Map
Specified by:
get in interface Interpretation
Overrides:
get in class DelegateMap

remove

public java.lang.Object remove(java.lang.Object symbol)
Specified by:
remove in interface java.util.Map
Overrides:
remove in class DelegateMap

put

public java.lang.Object put(java.lang.Object symbol,
                            java.lang.Object referent)
Description copied from interface: Interpretation
Set the referent associated with the given symbol in this interpretation.

Specified by:
put in interface java.util.Map
Specified by:
put in interface Interpretation
Overrides:
put in class DelegateMap

putAll

public void putAll(java.util.Map associations)
Description copied from interface: Interpretation
Copies all of the associations from the specified map to this interpretation.

Specified by:
putAll in interface java.util.Map
Specified by:
putAll in interface Interpretation
Overrides:
putAll in class DelegateMap

containsKey

public boolean containsKey(java.lang.Object symbol)
Description copied from interface: Interpretation
Returns whether the specified symbol is contained in this interpretation assocation map.

Specified by:
containsKey in interface java.util.Map
Specified by:
containsKey in interface Interpretation
Overrides:
containsKey in class DelegateMap

contains

public boolean contains(java.lang.Object symbol)

union

public Interpretation union(Interpretation i2)
Description copied from interface: Interpretation
Returns the union of two interpretations.

Specified by:
union in interface Interpretation
Parameters:
i2 - the interpretation to merge with this one, resulting in a new interpretation. (If a symbol is contained in both interpretations, the value of i2 will precede over the value of this.)
Returns:
i ∪ i2.
See Also:
Setops.union(java.util.Collection,java.util.Collection)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

unmodifiableInterpretation

public static final Interpretation unmodifiableInterpretation(Interpretation i)
Returns an unmodifiable view of the specified interpretation. The result is a read only view.


Orbital library
1.3.0: 11 Apr 2009

Copyright © 1996-2009 André Platzer
All Rights Reserved.