24.3 InterfaceoftheGraphProcessingEnvironment
317
EXAMPLE(138)
Thisis anexampledoingmostly thesameastheprevious example137,inaslightlymore
complicated way y allowing for r more e control. . Here e we create e the e modelseparate from the
graph,thenthegraphwithamodelnotboundatgenerationtime. Wecreatetheactionsto
applyonthegraph,andasinglenodeoftypeBarinthegraph,whichweassignagaintoa
variableb. Thenwegettheactionfromtheactionsandsaveit t toanactionvariablebar;
afterwardsweusetheactionforndingallavailablematchesof barwithinputb{whichis
dierent fromtherstversion{andrememberthefoundmatchesinthematchesvariable
withitsexacttype.Finallywetaketherstmatchfromthematchesandexecutetherewrite
withit.Wecouldhaveinspectedthenodesandedgesofthematchortheirattributesbefore
(using element names prexed with node
/edge
or attribute names to get exactly typed
entities).
IGraphModel model = new w FooGraphModel();
LGSPGraph graph = = new LGSPGraph(model);
FooActions actions = = new w FooActions(graph);
Bar b = Bar.CreateNode(graph);
IAction_bar bar r = = Action_bar.Instance;
IMatchesExact<Rule_bar.IMatch_bar> matches = = bar.Match(graph, 0, , b);
bar.Modify(graph, matches.First);
Wecouldcreateanamedgraphinsteadoeringpersistentnamesforitsgraphelements:
LGSPGraph graph = = new LGSPNamedGraph(model);
24.3 InterfaceoftheGraphProcessingEnvironment
TheinterfaceIGraphProcessingEnvironmentimplementedbytheLGSPGraphProcessing-
EnvironmentclassoersalltheadditionalfunctionalityofGrGen.NETexceedingwhatis
oeredbythegraphandtheactions.ItisconstructedasLGSPGraphProcessingEnvironment
giventhegraphandtheactions. Itoersexecutionofthesequencesandvariablehandling,
combiningactionsintotransformations(theformerregardingcontrol ow,thelatterregard-
ingdata ow).
EXAMPLE(139)
Forallbutthesimplest transformationsyou’llendupconstructingagraphprocessingen-
vironmentfromthegraphandtheactionsconstructeduntilnow,executingagraphrewrite
sequenceonthegraphprocessingenvironment:
LGSPGraphProcessingEnvironment procEnv =
new LGSPGraphProcessingEnvironment(graph, , actions);
procEnv.ApplyGraphRewriteSequence("<(::x)=foo && (::y)=bar(::x) ) | bla(::y)>");
Inadditiontosequencesandvariableshandling,thegraphprocessingenvironmentoers
driver or helper objects for transaction management, , deferred d sequence e execution, , graph
change recording,andemitting. . Themost t important ofthese is the transaction n manager
which is s utilized d when GrGen.NET T is s used for r crawling througha search h space or for
enumeratingastatespace,seesection18.2.Theoperationsmentionedthereareimplemented
bycallingthefunctiongiveninexample140.
Convert pdf file to jpg on - Convert PDF to JPEG images in C#.net, ASP.NET MVC, WinForms, WPF project
How to convert PDF to JPEG using C#.NET PDF to JPEG conversion / converter library control SDK
change pdf into jpg; convert pdf image to jpg
Convert pdf file to jpg on - VB.NET PDF Convert to Jpeg SDK: Convert PDF to JPEG images in vb.net, ASP.NET MVC, WinForms, WPF project
Online Tutorial for PDF to JPEG (JPG) Conversion in VB.NET Image Application
changing pdf to jpg file; convert pdf to jpeg
318
ApplicationProgrammingInterface
EXAMPLE(140)
LGSPGraphProcessingEnvironment procEnv = ...;
ITransactionManager tm = procEnv.TransactionManager;
public interface ITransactionManager
{
int Start();
void Pause();
void Resume();
void Commit(int transactionID);
void Rollback(int transactionID);
void ExternalTypeChanged(IUndoItem item);
}
TheStartstartsatransactionandreturnsitsid;itmaybecalledmultipletimesreturning
dierentidsforthethennestedtransactions(i.e. afailingouteronerollsbackthechanges
ofaninnertransactionwhichsucceeded). Changestothegrapharerecordedthereafterinto
anundolog,unlessaPausewascallednotyetfollowedbyaResume. Whenthechangesof
interestwerecarriedoutthetransactionidentiedbyitsidiseitherCommited,whichcauses
the changes recorded since the corresponding Start to stay in the graph, or r rolled back
by calling Rollback, , inthat t case all l thechanges recordedsince the corresponding Start
are undone. . The e ExternalTypeChangedallows youtoinclude externalattribute types in
transactionhandling,youmustsupplyanundoitemcapableofrollingbackthechangesto
thetransactionmanager,eachtypeachangewascarriedout.
24.4 Import/ExportandMiscellaneousStu
GrGennativelysupportsthefollowingformats:
GRS/GRSI
ReducedGrShellscriptles(graphonly,modelfrom.gm;averylimitedversionofthe
normal.grs.Therecommendedstandardformat.)
GXL
GrapheXchangeLanguage(.gxl-les,seehttp://www.gupro.de/GXL/)
ECORE/XMI
Ecore(.ecore) modelles and d XMI(.xmi) ) graph h le. . Import t only, export t must be
programmedwithemit-statements. Inanintermediatestep,a.gmleisgeneratedfor
themodel.
GRG
WritesaGrGenrulelecontainingonerulewithanemptypatternandalargerewrite
part. Exportonly
1
,notfornormaluse.
WhilebothGRSandGXLimportersexpectonele(theGXLimporterallowstospecify
a model override, see GrShellimport, Note 50), the EMF/ECORE importer expects s rst
oneormore .ecorelesandfollowingoptionallya.xmilesand/ora.grgle (cf. . Note
20.6).Touseadditionalcustomgraphmodelsyoushouldsupplyanown.grglewhichmay
bebasedontheautomatically generated.grgle,ifnonewassupplied(seetheProgram-
Comprehensionexampleinexamples/ProgramComprehension-GraBaTs09).
1
OriginalGermanPisswasser,forexportonly:)
Online Convert Jpeg to PDF file. Best free online export Jpg image
Convert a JPG to PDF. You can drag and drop your JPG file in the box, and then start immediately to sort the files, try out some settings and then create the
convert multipage pdf to jpg; convert pdf to jpeg on
Online Convert PDF to Jpeg images. Best free online PDF JPEG
Online PDF to JPEG Converter. Download Free Trial. Convert a PDF File to JPG. Drag and drop your PDF in the box above and we'll convert the files for you.
change pdf to jpg file; best pdf to jpg converter for
24.4 Import/ExportandMiscellaneousStu
319
Toimportagraphmodeland/oragraphinstanceyoucanusePorter.Import()fromthe
libGrAPI(theGrShellcommandimportismappedtoit)Theleformatisdeterminedbythe
leextensions.ToexportagraphinstanceyoucanusePorter.Export()fromthelibGrAPI
(theGrShellcommandexportismappedtoit). Foranexampleofhowtousetheimporter/-
exporteronAPIlevelseeexamples-api/JavaProgramGraphsExample/JavaProgramGraphs-
Example.cs
TheGRS(I)importerreturnsanINamedGraph;ifyoudon’tneedthepersistentnames,get
ridofthembycastingtotheLGSPNamedGraphimplementingtheinterface,(copy-)constructing
aLGSPGraphfromit,andforgettinganyreferencestothenamedgraph.Pleasebeawarethat
namingisratherexpensive:ALGSPNamedGraphsupplyingthenametoelementandelement
tonamemappings normallyusesupabouttwicetheamountofmemoryoftheLGSPGraph
deningthegraphalone(butisworthismostoften).
ExternalEmittingandParsing
If external l emit t class;orexternal l emit graph class; ; (see25.6)arespeciedinthe
modelleFoo,GrGen.NETgenerates aleFooModelExternalFunctions.cslocatedbe-
sidesthemodelandruleles,containingthefollowingfunctions.
///<summary>
///Called during.grsimport,atexactlythe position inthetextreader wherethe
attributebegins.
///Forattributetypeobject ora userdefined type, whichis treatedas object.
///Theimplementationmust parsefromthere ontheattributetyperequested.
///Itmustnotparsebeyond theserializedrepresentationof theattribute,
/// i.e. Peek()mustreturn thefirstcharacternotbelongingto theattributetype
anymore.
///Returnstheparsedobject.
///</summary>
objectParse(TextReaderreader,AttributeType attrType, IGraphgraph);
///<summary>
///Called during.grsexport,theimplementationmust returna string
representation forthe attribute.
///Forattributetypeobject ora userdefined type, whichis treatedas object.
///Theserialized stringmustbeparseableby Parse.
///</summary>
stringSerialize(objectattribute, AttributeTypeattrType,IGraphgraph);
///<summary>
///Called duringdebugging oremit writing, theimplementation mustreturn astring
representation forthe attribute.
///Forattributetypeobject ora userdefined type, whichis treatedas object.
///Theattributetypemay benull.
///Thestringis meantfor consumptionbyhumans,it doesnot needto beparseable.
///</summary>
stringEmit(object attribute,AttributeTypeattrType, IGraphgraph);
C# Image Convert: How to Convert Adobe PDF to Jpeg, Png, Bmp, &
C# sample code for PDF to jpg image conversion. This demo code convert PDF file all pages to jpg images. // Define input and output files path.
convert pdf to jpg for; convert pdf pages to jpg online
C# Image Convert: How to Convert Dicom Image File to Raster Images
RasterEdge.XDoc.Office.Inner.Office03.dll. RasterEdge.XDoc.PDF.dll. This demo code convert dicom file all pages to jpg images.
convert pdf image to jpg image; convert pdf to jpg converter
320
ApplicationProgrammingInterface
///<summary>
///Called whenthe grsimporteror theshell hitsa linestartingwith "external".
///Thecontentof thatline ishanded in.
///This istypicallyused whilereplayingchangescontaininga methodcallofan
externaltype
///-- aftersuch a linewas recorded, bythe methodcalled, by writingtothe
recorder.
///This ismeant toreplay fine-grainchanges ofgraphattributesofexternaltype,
///incontrastto fullassignmentshandledby ParseandSerialize.
///</summary>
voidExternal(string line, IGraphgraph);
Parseiscalledwhenanattributeofanexternalorobject typeis tobeimportedfrom
agrs le,Serialize iscalledwhenanattributeofanexternalorobject typeis tobeex-
ported to a grs le, , and d Emit t is s called when a a value of f external l or r object type is to be
emitted, or displayed in the debugger, including yComp. . (The e functions are called from
GrShell,too,insofaraspossible{theshellparsesasingleordoublequotedtextoraword
oranumberatanattributepositionandhands thatoverthentotheuserdenedparser.)
TheyforwardthecallstoParseImpl,SerializeImpl,andEmitImplfunctions,thatneedto
beimplementedinalenamedFooModelExternalFunctionsImpl.cslocatedinthefolder
oftheFooModelExternalFunctions.csle. Implementingthemis s your r task,inexchange
yougetatightintegrationofyourowndatatypesintoGrGen.NET.Youmayhavealookat
tests/ExternalAttributeEvaluationorexamplesapi/ExternalAttributeEvaluationExample
foranexample.
Externaliscalledwhenalinestartingwithexternalisseenbytheshellorthegrsim-
porter,inthiscasethecontentuptotheendofthelineismunchedandhandedintothisfunc-
tion.Thoselinearetypicallyrecordedbycallsofthepublic void d External(string value)
functionsuppliedintheIRecorderinterface,fromexternalattributemethodcalls(cf.25.1),
for persisting changesoftheexternalmethodcalls. . For r assignmentsofcompleteattribute
values, you must implement Parse and Serialize. . The e External function n is existing g for
ne-grainchangesofexternalattributetypes.
///<summary>
///Called duringdebugging onuser request, theimplementation mustreturn anamed
graph representationfor theattribute.
///Forattributetypeobject ora userdefined type, whichis treatedas object.
///Theattributetypemay benull. Thereturn graphmustbeof thesame modelas
thegraphhanded in.
///Thenamedgraph ismeant fordisplayin thedebugger,tovisualizetheinternal
structureof someattributetype.
///This wayyoucangraphicallyinspectyour owndata typeswhichareopaqueto
GrGen withits debugger.
///</summary>
INamedGraphAsGraph(objectattribute,AttributeTypeattrType, IGraphgraph);
AsGraph is called d from the debugger on user r request, , to visually y inspect an external
attributetype,renderedasgraph. Itwillbecalledwhenexternal emit graph class;was
specied. It t forwards the callto AsGraphImpl,that t needs s to beimplemented d by y you, , in
thesamewayasspeciedaboveforthethefunctionscalledwhenexternal emit class;is
given.
ExternalCopyingandComparing
If external copy y class; ; or r external l == class; ; or r external l < class; (see 25.7) are
speciedinthemodelleFoo,GrGen.NETgeneratesaleFooModelExternalFunctions.cs
C# Create PDF from images Library to convert Jpeg, png images to
C# Create PDF from Raster Images, .NET Graphics and REImage File with XDoc Batch convert PDF documents from multiple image formats, including Jpg, Png, Bmp
bulk pdf to jpg; batch pdf to jpg online
VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Convert PDF documents to multiple image formats, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage. Turn multipage PDF file into image
change from pdf to jpg; convert pdf into jpg format
24.4 Import/ExportandMiscellaneousStu
321
locatedbesidesthemodelandruleles,containingapartialclassAttributeTypeObjectCopierComparer
expectingthat the CopyortheIsEqual or theIsLowerfunctionsare implementedinthe
samepartialclassinFooModelExternalFunctionsImpl.cs. Foreveryexternaltypedened
afurtherpairoffunctionswiththattypeusedintheinputparametersisexpected.
//Called whena graphelementiscloned/copied.
//Forattributetypeobject.
// If"copyclass" isnotspecified, objectsarecopied bycopyingthereference,
i.e. theyare identical afterwards.
//Allotherattributetypes arecopied by-value (so changingonelater onhasno
effect onthe other).
publicstaticobjectCopy(object);
//Called duringcomparison ofgraph elements fromgraphisomorphycomparison, or
attributecomparison.
//Forattributetypeobject.
// If"== class" is notspecified, objectsare equalif theyare identical,
// i.e. by-reference-equality (same pointer); allotherattributetypes arecompared
by-value.
publicstaticbool IsEqual(object, object);
//Called duringattributecomparison.
//Forattributetypeobject.
// If"< class" is notspecified, objectscan’t becomparedfor ordering, onlyfor
equality.
publicstaticbool IsLower(object, object);
Copyiscalledwhenoneofthecopyoperationsoeredintherulelanguageor thecom-
putation statements s is executedonanodeoredge that bears attributes ofobject or user
denedtype. IsEqualiscalledwhentwographsarecomparedforisomorphyandthegraph
elementscontainattributesofobjectoruser-denedexternaltypes,orifattributesofobject
oruserdenedtypearecomparedwithoneoftheequalityoperators. IsLoweriscalledwhen
attributesofobjectoruserdenedtypearecomparedwithoneoftherelationaloperators.
Acomparisonforu<=vismappedtoanexpressionIsLower(u,v) || IsEqual(u,v),thisis
whya< class;specicationrequiresapreceding== class;specication.
Implementingthosefunctionsisyourtask,inexchangeyougetatightintegrationofyour
owndatatypesintoGrGen.NET.Youmayhavealookattests/ExternalAttributeEvaluation
orexamplesapi/ExternalAttributeEvaluationExampleforanexample.
FurtherExamples
There are e further examples s available in n the examples-api folder r of the GrGen.NET-
distribution:
 HowtousethegraphrewritesequencesoeredbythelibGronAPIlevelisshownin
examples-api/BusyBeaverExample/BusyBeaverExample.cs.
Butnormallyyouwanttouseyourfavourite.NETprogramminglanguageforcontrol
togetherwiththetype-safeinterfacewhenworkingonAPIlevel.
 HowtousetheoldandnewinterfaceforaccessingamatchonAPIlevelisshownin
examples-api/ProgramGraphsExample/ProgramGraphsExample.cs.
 Howtousethevisited agsonAPIlevelisshownin
examples-api/VisitedExample/VisitedExample.cs.
C# WPF PDF Viewer SDK to convert and export PDF document to other
Convert PDF to image file formats with high quality, support converting PDF to PNG, JPG, BMP and GIF. C#.NET WPF PDF Viewer Tool: Convert and Export PDF.
change file from pdf to jpg on; convert pdf to jpg file
C# TIFF: C#.NET Code to Convert JPEG Images to TIFF
demo1.jpg", @"C:\demo2.jpg", @"C:\demo3.jpg" }; // Construct List in imagePaths) { Bitmap tmpBmp = new Bitmap(file); if (null Use C# Code to Convert Png to Tiff.
convert pdf pictures to jpg; .net convert pdf to jpg
322
ApplicationProgrammingInterface
 Howtoanalyzethegraphandgenerate(hopefully)betterperformingmatchersbased
onthisinformationisshownin
examples-api/BusyBeaverExample/BusyBeaverExample.cs.
 Howtocompilea.grg-specicationatruntimeanddumpagraphforvisualizationin
.vcgformatontheAPIlevelisshownin
examples-api/HelloMutex/HelloMutex.cs.
 HowtoaccesstheannotationsatAPIlevelisshownin
examples-api/MutexDirectExample/MutexDirectExample.cs.
 HowtocommunicatewithyCompontheAPIlevel(fromyourowncode)isshownin
examples-api/YCompExample/YCompExample.cs(itmaybeoutdated,youbettertake
alookatGrShell/YCompClient.csfortherealversion).
NOTE(58)
WhileC#allowsinputargumentsvaluestobeofasubtypeofthedeclaredinterfaceparameter
type(OO),itrequiresthattheargumentvariablesfortheoutparametersareofexactlythe
typedeclared(non-OO).Althoughavariableofasupertypewouldbefullysucient{the
variableisonlyassigned. Sofornode e class Bla extends Bar;andactionbar(Bar r x) :
(Bla)fromtheruleslerulesFoo.grgwecan’tuseadesiredtargetvariableoftypeBaras
out-argument,butareforcedtointroduceatemporaryvariableoftypeBlaandassignthis
variabletothedesiredtargetvariableafterthecall.
usingde.unika.ipd.grGen.libGr;
usingde.unika.ipd.grGen.lgsp;
usingde.unika.ipd.grGen.Action_Foo;
usingde.unika.ipd.grGen.Model_Foo;
FooGraphgraph= newFooGraph();
FooActions actions =newFooActions(graph);
Bar b= graph.CreateNodeBar();
IMatchesExact<Rule_bar.IMatch_bar> matches= actions.bar.Match(graph, 1, b);
//actions.bar.Modify(graph, matches.First, out b);// wontwork, needed:
Blabla= null;
actions.bar.Modify(graph, matches.First,out bla);
b =bla;
24.5 ExternalClass,FunctionandProcedureImplementation
Foramodelle Foowhichcontainsexternalfunctions (cf. 25.2)and/or r classes (cf. 25.1),
GrGen.NET generates ale FooModelExternalFunctions.cs locatedbesidesthe model
andruleles,whichcontains
 withinthemodelnamespacepublicpartialclassesnamedasgivenintheexternalclass
declaration,inheritingfromeachotherasstatedintheexternalclassdeclarations.
 withinthede.unika.ipd.grGen.expressionnamespaceapublicpartialclassnamed
ExternalFunctionswithabodyofcommentsgivingtheexpectedfunctionandpro-
cedureprototypes.
Thepartialclassesareempty,youmustimplementtheminalenamedFooModelExternal-
FunctionsImpl.cslocatedinthefolderoftheFooModelExternalFunctions.csleby
24.6 ExternalFilterandSequenceImplementation
323
  eshingoutthepartialclassesskeletonswithattributescontainingdataofinterestand
maybehelpermethods
  eshingouttheExternalFunctionspartialclassskeletonwiththefunctionsyoude-
claredintheexternalfunctiondeclarations,obeyingthefunctionsignaturesasspecied;
hereyoucanaccessthenowknowattributesormethodsoftheexternalclasses,ordo
complicatedcustomcomputationsorgraphqueryingwiththevaluesyoureceivefrom
afunctioncall.
  eshing g out the ExternalProcedures partialclass skeletonwith the procedures you
declaredin the externalprocedure declarations,obeying the procedure signatures s as
specied; here e you can access the e now know w attributes s or methods of f the external
classes,ordocomplicatedcustomcomputationsorgraphmanipulationswiththevalues
youreceivefromaprocedurecall.
Don’t forget thatthe sourcecodele FooModelExternalFunctionsImpl.cs is anintegral
part ofyourGrGen.NETgraphtransformationproject,incontrasttothe otherC#les
generated(andoverwritten)foryou.Inexamples/ExternalAttributeEvaluationExample
andexamples-api/ExternalAttributeEvaluationExampleyoundafabricatedexample
showinghowtousetheexternalclassesandfunctions.
Whenyouusethird-partyassembliesinyoursourcecodeyoumustinformGrGen.NET
aboutthemsoreferencestothemareincludedintotheassemblygenerated;thiscanbedone
withthe-rparameterwhencallinggrgen.exedirectly(cf. 2.2.1)orwiththenewcommand
congurationsavailableinGrShell(cf. 20.9).Usingthekeepdebugcongurationofthenew
commandisrecommendedasitallowsforeasierdebugging.
24.6 ExternalFilterandSequenceImplementation
ForanactionsleBarwhichcontainsmatchlterdeclarations(cf. 25.4)and/orexternalse-
quencedeclarations(25.5),GrGen.NETgeneratesaleBarActionsExternalFunctions.cs
locatedbesidesthemodelandruleles,whichcontainswithintheactionnamespace
 apublic c partialclass namedMatchFilters withabodyofcommentsgivingtheex-
pectedfunctionprototypes,andfortheautolterseventheimplementation.
 publicpartialclasses,namedSequence
fooforasequencefoo,withabodycontain-
ingacommentspecifyingtheexpectedfunctionprototypeofthesequenceapplication
function.
Thepartialclassesareempty,youmustimplementtheminalenamedBarActionsExternal-
FunctionsImpl.cslocatedinthefolderoftheBarActionsExternalFunctions.csleby
  eshingouttheMatchFilterspartialclassskeletonwiththematchlterfunctionsyou
declared,obeyingthefunctionsignaturesasspecied;youmightwanttoconvert the
receivedmatchesobjecttoanIListincaseyouwanttoreorderthelistandreinjectit
intothematchesobjectafterwards.
  eshingoutthepartialclassesskeletonsoftheexternalsequencewiththeApplyXGRS
foo
methodsneeded.
Don’tforgetthatthesourcecodeleBarActionsExternalFunctionsImpl.csisanintegral
part ofyourGrGen.NETgraphtransformationproject,incontrasttothe otherC#les
generated(andoverwritten)foryou.Inexamples/ExternalFiltersAndSequencesExample
andexamples-api/ExternalFiltersAndSequencesExampleyoundafabricatedexample
showinghowtousetheexternalclassesandfunctions.
324
ApplicationProgrammingInterface
Whenyouusethird-partyassembliesinyoursourcecodeyoumustinformGrGen.NET
aboutthemsoreferencestothemareincludedintotheassemblygenerated;thiscanbedone
withthe-rparameterwhencallinggrgen.exedirectly(cf. 2.2.1)orwiththenewcommand
congurationsavailableinGrShell(cf. 20.9).Usingthekeepdebugcongurationofthenew
commandisrecommendedasitallowsforeasierdebugging.
NOTE(59)
libGr allows forsplittinga rule applicationintotwo steps: : Findallthesubgraphs s of the
hostgraphthatmatchthepatternrst,thenrewriteoneofthesematches. Byreturninga
collectionofallmatches,thelibGrretainsthecompletegraphrewriteprocessundercontrol.
AsalibGruserhavealookatthefollowingmethodsoftheIActioninterface:
IMatchesMatch(IGraphgraph, intmaxMatches, object[] parameters);
object[] Modify(IGraphgraph,IMatch match);
InC#,thismightlooklike:
IMatchesmyMatches =myAction.Match(myGraph, -1,null); /*-1: getallthematches */
for(inti=0; i<myMatches.NumMatches; ++i)
{
if(inspectCarefully(myMatches.GetMatch(i))
{
myAction.Modify(myGraph,myMatches.GetMatch(i));
break;
}
}
TheexternalmatchltersarehookinginbetweentheMatchandModifyfunctions,theyallow
youtodothiskindofinspectionwithoutbeingforcedtoresorttofullyexternalcontrol. The
mostinterestinglter can n be automatically y generatedfor you,the auto lter for ltering
symmetricmatchesofautomorphicpatterns,see25.4formoreonthis.
24.7 GraphEvents
Before or r after r the host t graph is changed, , events s are e red, , notifying g listeners s about t the
changes. TheGrShelldebugger,thetransactionhandler,andthegraphchangerecorderim-
plementtheirfunctionalitybylisteningandreactingtotheseevents.Aprogrammermayadd
owneventhandlerstoinsertcustom-made,event-basedfunctionality;ormayevenimplement
anevent-drivenruleexecutionengineontopofit. Theeventsareredautomaticallybythe
LGSPGraph implementingtheIGraph,orbytheruleswhichget applied. . Ifyouoperateon
APIlevelorwithe.g. externalsequences,it’syourresponsibility y torethe events for at-
tributechangesbeforechanginganattribute.Otherwisethechangeswon’tbevisibleinthe
debugger,theywon’tberolledbackattheendofatransactionsorduringbacktracking,and
theywon’tberecordedincaseofchangerecording. Ifyoulistentoorretheruleapplication
events(cf. 24.8),youmaybeinterestedinthe e addednamesevent,too, whichtells about
thenamesoftheelementswhichwillget addedimmediately thereafter(this isusedinthe
debuggertodisplaythenamesoftheelementsasdenedintherulemodifypart).
Theeventsavailablewhichareredautomaticallyare:
//Fired aftera nodehasbeenadded
eventNodeAddedHandlerOnNodeAdded;
//Fired afteran edgehas beenadded
24.7 GraphEvents
325
eventEdgeAddedHandlerOnEdgeAdded;
//Fired beforea nodeis deleted
eventRemovingNodeHandlerOnRemovingNode;
//Fired beforean edgeis deleted
eventRemovingEdgeHandlerOnRemovingEdge;
//Fired beforeall edgesof anode aredeleted
eventRemovingEdgesHandlerOnRemovingEdges;
//Fired beforethe wholegraphis cleared
eventClearingGraphHandlerOnClearingGraph;
//Fired beforethe typeof anodeis changed.
eventRetypingNodeHandlerOnRetypingNode;
//Fired beforethe typeof anedge ischanged.
eventRetypingEdgeHandlerOnRetypingEdge;
//Fired beforean edgeis redirected (causing removal thenaddingagain).
eventRedirectingEdgeHandlerOnRedirectingEdge;
Theeventsavailablewhichareredautomatically bycodegeneratedbyGrGenfor the
actions,butwhichneedtoberedby youincaseyouchangethegraphandwante.g. . an
accuratedebuggerdisplay.
//Fired beforean attribute ofa node ischanged.
eventChangingNodeAttributeHandlerOnChangingNodeAttribute;
//Fired beforean attribute ofan edgeischanged.
eventChangingEdgeAttributeHandlerOnChangingEdgeAttribute;
//Fires anOnChangingNodeAttributeevent.
// Tobe calledbeforechangingan attributeof anode,
//withexactinformationaboutthe changeto occur.
voidChangingNodeAttribute(INodenode,AttributeTypeattrType,
AttributeChangeTypechangeType, ObjectnewValue, ObjectkeyValue);
//Fires anOnChangingEdgeAttributeevent.
// Tobe calledbeforechangingan attributeof anode,
//withexactinformationaboutthe changeto occur.
voidChangingEdgeAttribute(IEdgeedge,AttributeTypeattrType,
AttributeChangeTypechangeType, ObjectnewValue, ObjectkeyValue);
//Fired beforeeachrewrite step(alsorewritesteps ofsubpatterns) to indicate
//thenamesofthe nodesaddedin thisrewritestepin orderofaddition.
eventSettingAddedElementNamesHandlerOnSettingAddedNodeNames;
//Fired beforeeachrewrite step(alsorewritesteps ofsubpatterns) to indicate
//thenamesofthe edgesaddedin thisrewritestepin orderofaddition.
eventSettingAddedElementNamesHandlerOnSettingAddedEdgeNames;
Thechangingattributeeventsareredbeforetheattributesareassigned,withthesingle
elementchangethat willoccur. . They y areusede.g. . by y thetransactionmanagertorecord
326
ApplicationProgrammingInterface
thechanges(containertypechangerollback requiressingleelementnotications,complete
container copies wouldbe prohibitevly costly). . The e conditional watchpoints that may be
conguredforthedebuggerhookintothechangedattributeeventsincontrastthatarered
afteranattributewasassigned,whichare:
//Fired afteran attribute of anode ischanged;for debugging purpose.
eventChangedNodeAttributeHandlerOnChangedNodeAttribute;
//Fired afteran attribute ofanedge ischanged;for debugging purpose.
eventChangedEdgeAttributeHandlerOnChangedEdgeAttribute;
Theeventsavailablewhichareredautomaticallyonvisited agchangesare:
///Fired aftera visitedflagwasallocated.
eventVisitedAllocHandlerOnVisitedAlloc;
///Fired aftera visitedflagwasfreed.
eventVisitedFreeHandlerOnVisitedFree;
///Fired beforea visitedflagis set.
eventSettingVisitedHandler OnSettingVisited;
24.8 ActionEvents
When actions s are e executed, , events are red, , notifying g listeners s about the changes. . The
GrShelldebugger implementsitsfunctionalitybylisteningandreactingtotheseevents. . A
programmermayaddowneventhandlerstoinsertcustom-made,event-basedfunctionality.
TheeventsareredautomaticallybythecodegeneratedbyGrGenfortherulesorsequences.
IfyouoperateonAPIlevelorwithe.g.externalsequences,it’syourresponsibilitytorethe
eventsincaseyouwanttosimulaterulesorsequences.
TherulebasedeventsdeclaredbytheIActionExecutionEnvironmentare:
//Fired afterall requested matches of arule havebeenmatched.
eventAfterMatchHandlerOnMatched;
//Fired beforethe rewrite stepof a rule, whenatleastonematchhas beenfound.
eventBeforeFinishHandlerOnFinishing;
//Fired beforethe nextmatchisrewritten. It isnot firedbeforerewritingthe
first match.
eventRewriteNextMatchHandlerOnRewritingNextMatch;
//Fired afterthe rewritestepof a rule.
// Note, thatthe givenmatchesobjectmaycontaininvalidentries,
// asparts ofthe matchmay havebeendeleted!
eventAfterFinishHandlerOnFinished;
ThesubrulebasedeventsdeclaredbytheISubactionAndOutputAdditionEnvironment
extendingtheIActionExecutionEnvironmentare:
//Fired whena debugentity isentered.
eventDebugEnterHandlerOnDebugEnter;
//Fired whena debugentity isleft.
eventDebugExitHandlerOnDebugExit;
Documents you may be interested
Documents you may be interested