org.molwind.chemical.model
Class SubstructureResolver

java.lang.Object
  extended by org.molwind.chemical.model.SubstructureResolver
All Implemented Interfaces:
EntityGraphAnalyzer, Identity, RelationshipResolver

public class SubstructureResolver
extends java.lang.Object
implements RelationshipResolver, EntityGraphAnalyzer, Identity

SubstructureResolver resolves substructure relationships.

Version:
1.0
Author:
Oliver Karch

Constructor Summary
SubstructureResolver(java.lang.String newParentName, java.lang.String newIdName)
          Creates a new Substructure resolver which uses the given attributes to decide whether there is a relationship.
 
Method Summary
 boolean analyze(EntityGraph graph, EntityVertex vertex)
          Analyzes an entity graph.
 java.lang.String getParentName()
          Get the ParentName value.
 boolean identical(WorldEntity entity1, WorldEntity entity2)
          Tests whether two entities are identical.
 boolean related(WorldEntity entity1, WorldEntity entity2)
          Augments the relationship between two entities.
 EntityGraph resolve()
          Resolves the relationships by creating a graph of entity vertices and relationship edges.
 void setParentName(java.lang.String newParentName)
          Set the ParentName value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SubstructureResolver

public SubstructureResolver(java.lang.String newParentName,
                            java.lang.String newIdName)
Creates a new Substructure resolver which uses the given attributes to decide whether there is a relationship.

Parameters:
newParentName - the parent attribute's name
newIdName - the id attribute's name
Method Detail

getParentName

public java.lang.String getParentName()
Get the ParentName value.

Specified by:
getParentName in interface RelationshipResolver
Returns:
the ParentName value.

setParentName

public void setParentName(java.lang.String newParentName)
Set the ParentName value.

Parameters:
newParentName - The new ParentName value.

related

public boolean related(WorldEntity entity1,
                       WorldEntity entity2)
Augments the relationship between two entities.

Specified by:
related in interface RelationshipResolver
Parameters:
entity1 - a world entity
entity2 - another world entity
Returns:
true if any relationship could be established, false otherwise

resolve

public EntityGraph resolve()
Resolves the relationships by creating a graph of entity vertices and relationship edges.

Specified by:
resolve in interface RelationshipResolver
Returns:
the resulting entity graph

analyze

public boolean analyze(EntityGraph graph,
                       EntityVertex vertex)
Analyzes an entity graph.

Specified by:
analyze in interface EntityGraphAnalyzer
Parameters:
graph - the graph to be analyzed
vertex - the current vertex
Returns:
returning false stops analysis immediately

identical

public boolean identical(WorldEntity entity1,
                         WorldEntity entity2)
Tests whether two entities are identical.

Specified by:
identical in interface Identity
Parameters:
entity1 - the first entity
entity2 - the second entity
Returns:
true if the two entities are identical


Copyright © 2008-2010. All Rights Reserved.