Class MotherGraph

java.lang.Object
  |
  +--MusicGraph
        |
        +--MotherGraph

public class MotherGraph
extends MusicGraph

A MotherGraph is a MusicGraph which owns its vertices and edges. Subgraphs only point to vertices and edges owned by their respective mother graphs. All subgraphs must have a mother graph, whereas a mother graph is its own, so to speak. Subgraphs can be changed in any way you like, but changing a mother graph is a serious matter because it affects all subgraphs that may be pointing to its vertices and edges. Proceed with caution. The only such manipulation is the compoundSubsitution() method.


Field Summary
 jm.music.data.Score theScore
          The Score object that this MotherGraph originated from.
 
Fields inherited from class MusicGraph
edges, title, vertices
 
Constructor Summary
MotherGraph(java.lang.String filename, boolean includeInterPartEdges)
          Constructs a MotherGraph from a midifile.
MotherGraph(java.lang.String filename, boolean includeInterPartEdges, boolean combineTies, boolean combineRests)
          Constructs a graph from a Musedata file
MotherGraph(java.util.Vector vert, java.util.Vector edg, java.lang.String t, jm.music.data.Score sc)
          A neutral constructor.
 
Method Summary
 void calculateVertexDistances()
          This method is used to run through the graph and once and for all set the max/minDistanceFromStart/End variables in all vertices.
 java.lang.Object clone()
          Returns a *shallow* clone of this MotherGraph, which is a NonSeqSubgraph -- Call MusicGraph.deepClone() instead if you really really want to do the entire deep cloning.
 CompoundVertex compoundSubstitution(Subgraph sg, Nonterminal nt, SimilarityMeasure measure, SimMeasureResult smresult)
          Substitutes a subgraph of this MotherGraph with a newly created CompoundVertex.
 jm.music.data.Score convertToScore()
          Definition of abstract method from class MusicGraph; simply returns the originating Score just as getScore().
 java.util.Vector getAllProperFollowInEdges(boolean includeWeakEdges)
          Returns a Vector of Vector of MusicEdge.
 java.util.Vector getAllProperFollowOutEdges(boolean includeWeakEdges)
          Returns a Vector of Vector of MusicEdge.
 java.util.Vector getAllProperInEdges(boolean includeWeakEdges)
          Returns a Vector of Vector of MusicEdge.
 java.util.Vector getAllProperOutEdges(boolean includeWeakEdges)
          Returns a Vector of Vector of MusicEdge.
 java.util.Vector getAllSons(java.util.Vector vert)
          Returns a Vector of MusicVertex which follow upon any of the music vertices in the input vector, i.e. there is a FOLLOWS MusicEdge from the vertex in the input vector to the one in the output vector.
 int getMaximalSequentialSubgraphSize()
          Returns the size of the maximal sequential subgraph that could possibly be constructed from this MotherGraph.
static MotherGraph getMomFromFile(java.lang.String filename, boolean interpartEdges, boolean combineTies, boolean combineRests)
          This static method is used to create a MotherGraph from any (supported) file type.
 MotherGraph getMotherGraph()
          Definition of abstract method from class MusicGraph.
 NonSeqSubgraph getRandomNonSeqSubgraph(int size)
          Constructs a random non-sequential subgraph of this MotherGraph.
 SeqSubgraph getRandomSeqSubgraph(int size)
          Constructs a random sequential subgraph of this MotherGraph.
 jm.music.data.Score getScore()
          Returns the originating Score object; if this MotherGraph was created from a midifile, the conversion using the jMusic package created such a Score object; if this MotherGraph was created from a MuseData file, the Score is a dummy object.
 void resetUsageInfo()
          Sets the usage counters of all vertices in this MotherGraph to zero.
 SeqSubgraph sequentialClone()
          Returns a *shallow* clone of this MotherGraph which is a SeqSubgraph, if this MotherGraph is in fact sequential; if not, null is returned.
 java.lang.String toString()
          Returns a string with the toString's of all vertices and edges in this MusicGraph.
 
Methods inherited from class MusicGraph
boolMatrixEqual, boolMatrixMultiply, checkSorting, contains, copyBoolMatrix, deepClone, equals, findVertexAt, getAllPossibleRightExtended, getAllPossibleRightSlides, getAllSequentialSubgraphsOfSize, getAllStrongSequentialSubgraphsOfSize, getBeginningSubgraphSet, getClosure, getMaxEndtime, getMinStarttime, getNestedRestPercentage, getNestedVertexList, getNextGroup, getNSequentialSubgraphsOfSize, getStrongSinks, getStrongSources, getTransitiveClosure, graphicLayoutDone, graphIsConnected, hasInterpartEdges, hasMusedata, initGroupTokenizer, isSimpleGraph, maxUsage, nestedNumberOfRests, nestedNumOfCompoundVertices, nestedSize, nestingDepth, numOfCompoundVertices, overlap, prettyPrintBoolMatrix, printAllDist, size, sortEdges, sortVertexVectorByStarttime, sortVerticesByStarttime, testIntegrity, transitiveClosureOf, vertexAtIndexSplitsSubgraph
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

theScore

public jm.music.data.Score theScore
The Score object that this MotherGraph originated from.

Constructor Detail

MotherGraph

public MotherGraph(java.util.Vector vert,
                   java.util.Vector edg,
                   java.lang.String t,
                   jm.music.data.Score sc)
A neutral constructor.


MotherGraph

public MotherGraph(java.lang.String filename,
                   boolean includeInterPartEdges)
Constructs a MotherGraph from a midifile.


MotherGraph

public MotherGraph(java.lang.String filename,
                   boolean includeInterPartEdges,
                   boolean combineTies,
                   boolean combineRests)
Constructs a graph from a Musedata file

Method Detail

clone

public java.lang.Object clone()
Returns a *shallow* clone of this MotherGraph, which is a NonSeqSubgraph -- Call MusicGraph.deepClone() instead if you really really want to do the entire deep cloning.

Specified by:
clone in class MusicGraph

sequentialClone

public SeqSubgraph sequentialClone()
Returns a *shallow* clone of this MotherGraph which is a SeqSubgraph, if this MotherGraph is in fact sequential; if not, null is returned.


toString

public java.lang.String toString()
Description copied from class: MusicGraph
Returns a string with the toString's of all vertices and edges in this MusicGraph.

Overrides:
toString in class MusicGraph

calculateVertexDistances

public void calculateVertexDistances()
This method is used to run through the graph and once and for all set the max/minDistanceFromStart/End variables in all vertices. These distances are used to get an idea about whether it is possible from a given vertex to construct a random sequential subgraph of a given length. In case it isn't, it would take exponential time in the desired length (or, actually, in the max length possible in the real graph, which is less than the desired length when it isn't possible to construct it) of the sequential subgraph to try all possibilities and realise that it is impossible. NB: this method should be called if the topology of a MotherGraph is changed, e.g. after compound substitution. The compoundSubstitution method does this automatically.


getRandomNonSeqSubgraph

public NonSeqSubgraph getRandomNonSeqSubgraph(int size)
                                       throws java.lang.Exception
Constructs a random non-sequential subgraph of this MotherGraph.

java.lang.Exception

getRandomSeqSubgraph

public SeqSubgraph getRandomSeqSubgraph(int size)
Constructs a random sequential subgraph of this MotherGraph.


getAllProperFollowInEdges

public java.util.Vector getAllProperFollowInEdges(boolean includeWeakEdges)
Returns a Vector of Vector of MusicEdge.

Specified by:
getAllProperFollowInEdges in class MusicGraph

getAllProperFollowOutEdges

public java.util.Vector getAllProperFollowOutEdges(boolean includeWeakEdges)
Returns a Vector of Vector of MusicEdge.

Specified by:
getAllProperFollowOutEdges in class MusicGraph

getAllProperInEdges

public java.util.Vector getAllProperInEdges(boolean includeWeakEdges)
Returns a Vector of Vector of MusicEdge.

Specified by:
getAllProperInEdges in class MusicGraph

getAllProperOutEdges

public java.util.Vector getAllProperOutEdges(boolean includeWeakEdges)
Returns a Vector of Vector of MusicEdge.

Specified by:
getAllProperOutEdges in class MusicGraph

resetUsageInfo

public void resetUsageInfo()
Sets the usage counters of all vertices in this MotherGraph to zero.


getScore

public jm.music.data.Score getScore()
Returns the originating Score object; if this MotherGraph was created from a midifile, the conversion using the jMusic package created such a Score object; if this MotherGraph was created from a MuseData file, the Score is a dummy object.

Specified by:
getScore in class MusicGraph

getMaximalSequentialSubgraphSize

public int getMaximalSequentialSubgraphSize()
Returns the size of the maximal sequential subgraph that could possibly be constructed from this MotherGraph.

Specified by:
getMaximalSequentialSubgraphSize in class MusicGraph

getAllSons

public java.util.Vector getAllSons(java.util.Vector vert)
Returns a Vector of MusicVertex which follow upon any of the music vertices in the input vector, i.e. there is a FOLLOWS MusicEdge from the vertex in the input vector to the one in the output vector.


getMotherGraph

public MotherGraph getMotherGraph()
Definition of abstract method from class MusicGraph.

Specified by:
getMotherGraph in class MusicGraph

convertToScore

public jm.music.data.Score convertToScore()
Definition of abstract method from class MusicGraph; simply returns the originating Score just as getScore().

Specified by:
convertToScore in class MusicGraph

compoundSubstitution

public CompoundVertex compoundSubstitution(Subgraph sg,
                                           Nonterminal nt,
                                           SimilarityMeasure measure,
                                           SimMeasureResult smresult)
Substitutes a subgraph of this MotherGraph with a newly created CompoundVertex.


getMomFromFile

public static MotherGraph getMomFromFile(java.lang.String filename,
                                         boolean interpartEdges,
                                         boolean combineTies,
                                         boolean combineRests)
                                  throws java.lang.Exception
This static method is used to create a MotherGraph from any (supported) file type. It checks if the file is a midi file or a MuseData file and calls the appropriate constructor.

java.lang.Exception