Package ptolemy.data.ontologies.lattice
Class ProductLatticeCPO
- java.lang.Object
-
- ptolemy.data.ontologies.ConceptGraph
-
- ptolemy.data.ontologies.lattice.ProductLatticeCPO
-
public class ProductLatticeCPO extends ConceptGraph
A complete partial order for product lattice-based ontologies. Given a product lattice defined by a list ofProductLatticeConcept
s, this class provides the implementation for all complete partial order operations on the product lattice. Note that this complete partial order implementation is not derived from a graph of the concepts, but rather by doing comparison operations that depend on the structure of the individual lattices that comprise the product lattice. For example, take a product lattice P that is composed of two lattices L1 and L2. Each lattice element concept in P is a tuple of the form <C(L1), C(L2)>. To decide the relationship between two concepts in p1 and p2 in P, it is determined by the relationships of the individual concepts in their tuples. So: p1 ≥ p2 iff C1(L1) ≥ C2(L1) and C1(L2) ≥ C2(L2)- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Charles Shelton
- Pt.AcceptedRating:
- Red (cshelton)
- Pt.ProposedRating:
- Red (cshelton)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface ptolemy.graph.CPO
CPO.BoundType
-
-
Field Summary
-
Fields inherited from interface ptolemy.graph.CPO
HIGHER, INCOMPARABLE, LOWER, SAME
-
-
Constructor Summary
Constructors Constructor Description ProductLatticeCPO(ProductLatticeOntology productOntology)
Create a new ProductLatticeCPO from the given list of ProductLatticeConcepts.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Concept
bottom()
Return the bottom element of this CPO.int
compare(java.lang.Object e1, java.lang.Object e2)
Compare two concepts in the product lattice ontology.ProductLatticeConcept[]
downSet(java.lang.Object e)
Compute the down-set of an element in this concept graph.Concept
greatestLowerBound(java.lang.Object e1, java.lang.Object e2)
Compute the greatest lower bound (GLB) of two elements.Concept
leastUpperBound(java.lang.Object e1, java.lang.Object e2)
Compute the least upper bound (LUB) of two elements.NonProductLatticeCounterExample
nonLatticeReason()
Return the reason why this CPO is not a lattice, or null if it is.Concept
top()
Return the top element of this CPO.-
Methods inherited from class ptolemy.data.ontologies.ConceptGraph
greatestElement, greatestLowerBound, isLattice, leastElement, leastUpperBound, upSet
-
-
-
-
Constructor Detail
-
ProductLatticeCPO
public ProductLatticeCPO(ProductLatticeOntology productOntology)
Create a new ProductLatticeCPO from the given list of ProductLatticeConcepts.- Parameters:
productOntology
- The product lattice ontology for which this CPO is a complete partial order.
-
-
Method Detail
-
bottom
public Concept bottom()
Return the bottom element of this CPO. The bottom element is the element in the CPO that is lower than all the other elements.- Specified by:
bottom
in interfaceCPO<Concept>
- Specified by:
bottom
in classConceptGraph
- Returns:
- An Object representing the bottom element, or
null
if the bottom does not exist.
-
compare
public int compare(java.lang.Object e1, java.lang.Object e2)
Compare two concepts in the product lattice ontology. The arguments must be instances ofProductLatticeConcept
, otherwise an exception will be thrown. This method returns one of ptolemy.graph.CPO.LOWER, ptolemy.graph.CPO.SAME, ptolemy.graph.CPO.HIGHER, ptolemy.graph.CPO.INCOMPARABLE, indicating the first argument is lower than, equal to, higher than, or incomparable with the second argument in the product lattice hierarchy, respectively.- Specified by:
compare
in interfaceCPO<Concept>
- Specified by:
compare
in classConceptGraph
- Parameters:
e1
- An instance ofProductLatticeConcept
.e2
- An instance ofProductLatticeConcept
.- Returns:
- One of CPO.LOWER, CPO.SAME, CPO.HIGHER, CPO.INCOMPARABLE.
- Throws:
java.lang.IllegalArgumentException
- If one or both arguments are not instances ofProductLatticeConcept
, the arguments are not from the same ontology, or either argument has an empty or null concept tuple list.
-
downSet
public ProductLatticeConcept[] downSet(java.lang.Object e)
Compute the down-set of an element in this concept graph. This is implemented by deferring to the downSet functions of the component graphs and then enumerating all the product results.- Specified by:
downSet
in interfaceCPO<Concept>
- Overrides:
downSet
in classConceptGraph
- Parameters:
e
- An Object representing a ProductLatticeConcept in this concept graph.- Returns:
- An array of ProductLatticeConcepts of the down-set of the given argument concept.
- Throws:
java.lang.IllegalArgumentException
- If the passed object is not a ProductLatticeConcept or does not belong to this CPO.
-
greatestLowerBound
public Concept greatestLowerBound(java.lang.Object e1, java.lang.Object e2)
Compute the greatest lower bound (GLB) of two elements. The GLB of two elements is the greatest element in the CPO that is lower than or the same as both of the two elements.- Specified by:
greatestLowerBound
in interfaceCPO<Concept>
- Overrides:
greatestLowerBound
in classConceptGraph
- Parameters:
e1
- An Object representing an element in this CPO.e2
- An Object representing an element in this CPO.- Returns:
- An Object representing the GLB of the two specified
elements, or
null
if the GLB does not exist. - Throws:
java.lang.IllegalArgumentException
- Thrown if the product lattice concept greatest lower bound cannot be created from the component greatest lower bound concepts.
-
nonLatticeReason
public NonProductLatticeCounterExample nonLatticeReason()
Return the reason why this CPO is not a lattice, or null if it is. A Product Lattice CPO is a lattice if all of its component ontologies are lattices.- Specified by:
nonLatticeReason
in classConceptGraph
- Returns:
- A string representing which subontology is responsible for
this not being a lattice;
null
otherwise.
-
leastUpperBound
public Concept leastUpperBound(java.lang.Object e1, java.lang.Object e2)
Compute the least upper bound (LUB) of two elements. The LUB of two elements is the least element in the CPO that is greater than or the same as both of the two elements.- Specified by:
leastUpperBound
in interfaceCPO<Concept>
- Specified by:
leastUpperBound
in classConceptGraph
- Parameters:
e1
- An Object representing an element in this CPO.e2
- An Object representing an element in this CPO.- Returns:
- Nothing.
- Throws:
java.lang.IllegalArgumentException
- Thrown if the product lattice concept least upper bound cannot be created from the component least upper bound concepts.
-
top
public Concept top()
Return the top element of this CPO. The top element is the element in the CPO that is higher than all the other elements.- Specified by:
top
in interfaceCPO<Concept>
- Specified by:
top
in classConceptGraph
- Returns:
- An Object representing the top element, or
null
if the top does not exist.
-
-