using pdf.js in mvc : Convert online pdf to jpg Library control class asp.net web page azure ajax GrGenNET-Manual14-part1913

CHAPTER 12
COMPUTATIONS (ATTRIBUTE EVALUATION
STATEMENTS)
Inthischapterwe’llhavealookatthestatementsofthecomputations availableintherule
language. The e computations s are e the superordinate concept,they consist ofside-eect free
expressionsalreadyintroducedin6,andside-eectcausingstatements.Theircorresponding
abstractions are the functions s freeofexternally y visible side-eects, , deningan expression
drop-inreplacement,andtheproceduresthatcanonlybeemployedfromstatementcontext,
dening astatement drop-inreplacement; we’ll visit those abstractions at theendof this
chapter.
Themostimportantstatementistheattributeassignment,whichisusedforassigningnew
values computedfromexpressions tographelementattributes. . Besides s this,furthertypes
ofassignmentsareavailable,andseveralcontrol owconstructs asknownfromimperative
programming languages s of f the C-family. . Furthermore, , container r methods s may be e called
(moreonthisinthefollowingchapter13),andglobalgraphfunctionsmaybecalled(more
onthisinthefollowingchapter14).
Anexampleimplementingdepth-rstsearch,breadth-rstsearch,anditerativedeepening
ascomputationsoftherulelanguagecanbefoundintest/should
pass,in/DfsBfsSearch.grg;
youmayhavealookatthe/computations_*.grglesinthatfolderforfurther(butfabri-
cated)examples.
127
Convert online pdf to jpg - 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 to jpg format; convert .pdf to .jpg online
Convert online pdf to jpg - 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
convert pdf to 300 dpi jpg; convert pdf to high quality jpg
128
Computations(AttributeEvaluationStatements)
Statement
-
Assignment
-
CompoundAssignment
-
IndexedAssignment
-
VisitedAssignment
-
LocalVariableDecl
-
MethodCall
-
ProcedureCall
-
EmbeddedExec
-
Decision
-
Repetition
-
ForLoop
-
EarlyExit
-
ReturnStatement
-
12.1 Assignments
Assignment
-
NodeOrEdge
-
.
-
Ident
-
=
-
Expression
-
;
-
::
-
GlobalVarIdent
-
.
-
Ident
-
=
-
Expression
-
;
-
Variable
-
=
-
Expression
-
;
-
::
-
GlobalVarIdent
-
=
-
Expression
-
;
-
Evaluationstatementshaveimperativesemantics. Inparticular,GrGen.NETdoesnot
careaboutdatadependencies(Youmustcareforthem! Theassignmentsarejustexecuted
oneaftertheother.). Assignment t iscarriedout usingvaluesemantics,evenforentities of
containerorstringtype.Theonlyexceptionisthetypeobject,therereferencesemantics
isused. YoucanndoutabouttheavailableExpressionsinchapter6.
Online Convert Jpeg to PDF file. Best free online export Jpg image
Online JPEG to PDF Converter. Download Free Trial. Convert a JPG to PDF. You can drag and drop your JPG file in the box, and then start
convert pdf to jpeg on; change format from pdf to jpg
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 into jpg; change from pdf to jpg
12.2 LocalVariableDeclarations
129
12.2 LocalVariableDeclarations
LocalVariableDecl
-
def
-
Name
-
:
-
Type
-
=
-
Expression
-
;
-
def
-
-
-
Name
-
:
-
Type
-
->
-
=
-
Expression
-
;
-
def
-
var
-
Name
-
:
-
Type
-
=
-
Expression
-
;
-
def
-
ref
-
Name
-
:
-
Type
-
=
-
Expression
-
;
-
Local variables s can n be e denedwiththe e syntax x known for local def f pattern variables,
asalreadyintroducedin8.3,i.e. def f var name:typeforelementaryvariables,or r def f ref
name:type forcontainer variables,ordef f name:typefor r nodes,or def f -name:type-> > for
edges. Attheirdenition,aninitializingexpressionmaybegiven.
EXAMPLE(71)
Thefollowingruleevalpartgivessomeexamplestatementsregardingdata ow.
1
var::v:int;
2
3
ruleexample
4
{
5
n:N;// we assumeattributesa:int,arr:array<int>, narr:array<N>
6
7
modify{
8
eval{
9
def varsum:int= 0; //declaresa localvariableoftypeint and initializesit
10
n.a =42;//assigns 42 totheattribute aofthenode noftype N
11
::v =n.a- 1;// assignstheglobalvariablethevalue41
12
def refarr:array<int>= array<int>[sum,1,2,3];
13
arr[0] =arr[1]+ n.arr[sum];
14
def refnarr:array<N> = array<N>[ n];
15
//narr[0].a= 0xAFFE; -- currentlynotpossible, youmustworkaroundit thisway:
16
def tmp:N =narr[0];
17
tmp.a= 0xAFFE;
18
n.narr[0] =n; // thisispossibleincontrast
19
}
20
}
21
}
12.3 Control ow
Basedonthevalueof abooleanexpressiondierent computationscanbe executedcondi-
tionallywiththeifandelsestatements. Pleasenotthatthebracesaremandatory. . With
theswitchandcasestatements,youcanmatchconstantsagainstthevalueofanexpression
C# Image Convert: How to Convert Adobe PDF to Jpeg, Png, Bmp, &
This demo code just converts first page to jpeg image. String inputFilePath = @"C:\input.pdf"; String outputFilePath = @"C:\output.jpg"; // Convert PDF to jpg.
change file from pdf to jpg; convert .pdf to .jpg
C# Image Convert: How to Convert Tiff Image to Jpeg, Png, Bmp, &
RasterEdge.XDoc.PDF.dll. This demo code will convert first page to jpeg image. C:\input.tif"; String outputFilePath = @"C:\output.jpg"; // Convert tiff to jpg.
batch convert pdf to jpg online; change pdf to jpg file
130
Computations(AttributeEvaluationStatements)
computedonce. Everycase-branchis s enclosedinanblock,atblockendalsotheexecution
of the block ends, there is no implicit fall-through carriedout, a fall-through is not even
available. Only y oneelsebranchis allowed, , itis s hitincasenootherbranchwasexecuted.
Theconstructis onlyavailableforexpressions withvaluesoftypebyte,short,int,long,
string,boolean,andenumtypes.
Decision
-
IfElse
-
SwitchCase
-
IfElse
-
IfPart
-
ElseIfPart
-
ElsePart
-
IfPart
-
if
-
(
-
BoolExpr
-
)
-
f
-
Statement
-
g
-
ElseIfPart
-
else
-
if
-
(
-
BoolExpr
-
)
-
f
-
Statement
-
g
-
ElsePart
-
else
-
f
-
Statement
-
g
-
SwitchCase
-
switch
-
(
-
Expr
-
)
-
f
-
CaseStatement
-
g
-
C# Create PDF from images Library to convert Jpeg, png images to
Batch convert PDF documents from multiple image formats, including Jpg, Png, Bmp, Gif, Tiff, Bitmap, .NET Graphics, and REImage.
.pdf to .jpg online; changing pdf file to jpg
VB.NET PDF Convert to Images SDK: Convert PDF to png, gif images
Resize converted image files in VB.NET. Convert PDF to Jpg, Png, Bmp, Gif, Tiff and Bitmap in ASP.NET. Embed PDF to image converter in viewer.
convert multi page pdf to single jpg; batch convert pdf to jpg
12.3 Control ow
131
CaseStatement
-
case
-
ConstExpr
-
f
-
Statement
-
g
-
else
-
f
-
Statement
-
g
-
Computationsmaybeexecutedrepeatedlybythewhileanddo-whilestatements.Please
notethatthebracesaremandatoryandthatthedo-whileloopcomeswithoutaterminating
semicolon.
Repetition
-
WhileLoop
-
DoWhileLoop
-
WhileLoop
-
while
-
(
-
BoolExpr
-
)
-
f
-
Statement
-
g
-
DoWhileLoop
-
do
-
f
-
Statement
-
g
-
while
-
(
-
BoolExpr
-
)
-
Thecontainersintroducedinchapter13maybeiteratedoverwithaforloop,oneassigning
thecurrentvaluetoavariable,theotherassigningthecurrentindexandthecurrentvalue
toavariable. Furthermore,aforloopisavailableforiteratingarangeofintegers,withthe
lowerandtheupperboundsspecied.Moreover,aforloopisavailableforiteratingthegraph
elementsstoredinanindex,withthelowerandupperboundsspecied,see22.2.6formore
onthisandtheForIndexAccessHeader.
ForLoop
-
ForHeader
-
IndexedForHeader
-
ForRangeHeader
-
ForIndexAccessHeader
-
f
-
Statement
-
g
-
VB.NET PDF - Convert PDF with VB.NET WPF PDF Viewer
VB.NET print PDF, VB.NET merge PDF files, VB.NET view PDF online, VB.NET Convert PDF to image file formats with high quality, support converting PDF to PNG
convert pdf to jpg 300 dpi; bulk pdf to jpg
VB.NET Create PDF from images Library to convert Jpeg, png images
Components to batch convert PDF documents in Visual Basic .NET class. Support create PDF from multiple image formats in VB.NET, including Jpg, Png, Bmp, Gif
convert pdf to gif or jpg; convert pdf page to jpg
132
Computations(AttributeEvaluationStatements)
ForHeader
-
for
-
(
-
Var
-
:
-
Type
-
in
-
ContainerVar
-
)
-
IndexedForHeader
-
for
-
(
-
IndexVar
-
:
-
Type
-
->
-
Var
-
:
-
Type
-
in
-
ContainerVar
-
)
-
ForRangeHeader
-
for
-
(
-
Var
-
:
-
int
-
in
-
[
-
IntExpr
-
:
-
IntExpr
-
]
-
)
-
Loopbodyexecutionmaybeexitedearlyorcontinuedwiththenextiterationwiththe
breakandcontinuestatements. Suchastatementmustnotoccuroutsideofaloop.
EarlyExit
-
break
-
;
-
continue
-
;
-
EXAMPLE(72)
Thefollowingruleevalpartgivessomeexamplestatementsregardingcontrol ow.
1
ruleexample
2
{
3
n:N;// we (again)assumeattributesa:int,arr:array<int>,narr:array<N>
4
5
modify{
6
eval{
7
if(n.a <42){
8
while(true) {
9
n.a =n.a+ 1;
10
if(n.a==42){
11
break;//leavesthewhileloop, n.a==42afterwards
12
}
13
}
14
}else {
15
def ref narr:array<N> = n.narr;
16
def var i:int =0;
17
for(tn:Ninnarr) {
18
i = i+ 1;
19
n.a =n.a+ tn.a+ n.arr[i];
20
}
21
}
22
}
23
}
24
}
12.4 EmbeddedExec
Asintherules(cf.chapter11),execstatementsmaybeembedded.Theyareexecutingthe
graphrewritesequence(seechapter9)contained,withaccesstothevariablesdenedoutside.
Thismeansforonereadingthisvariables,butfortheotherassigningtothatvariableswith
12.5 ComputationDenitionandCall
133
yield. The e embedded d execs s allow to apply rules fromthe computations, , more e exactly:
from the e procedures (embedded d execs s are e not t available in n functions), while the sequence
computations(cf. 17.1)maycalldenedcomputations(functionsinexpressioncontext,and
proceduresinstatementcontext),mixingandmergingdeclarativerule-basedgraphrewriting
(patternmatchinganddependentmodications)withtraditionalgraphprogramming. This
construct achieves s a a further r step in the e direction of f blending rule-based d with traditional
programming;themainstepistheextensionoftheattributeassignments,theonlystatement
availableintheoriginalGrGen,intothefull- edgedcomputationspicturedinthisandthe
followingchapters.
exec(.)
executesthegraphrewritesequencegiven.
12.5 ComputationDenitionandCall
Computations that t are e occurring frequently may be factoredout into a computation def-
inition givenin the header r ofa rule le. . Such h compound computations s can n be built t and
abstractedintoreusableentitiesintwodierentforms,functionsusable(/callable)fromex-
pressioncontext,andproceduresusable(/callable)fromstatementcontext. Besides,several
built-infunctionsandproceduresareavailable,readytobecalledandreusedwiththesame
syntax. (Furthermore,externalfunctionsandproceduresmaybedeclared,callablewiththe
samesyntax,too.)
12.5.1 FunctionDenitionandCall
Functionsreturnexactlyoneoutputvalue,andcanthusbeusedfromtheexpressionswith
their compositionalsemantics. . They y are side-eect free,meaning they arenot allowed d to
change the graphwhile beingexecuted| soyouarenotallowedtocallprocedures (self-
denedaswellasbuilt-in)fromwithafunctiondenition.Ontheotherhanddoweconsider
purefunctionalprogrammingnotahelpbutaburden,soyouarefreetodeclarelocalvariables
andassignthemasyoulikeinsidethefunctiondenitions;theyonlymustbehaveasfunctions
attheoutside.
FunctionDenition
-
function
-
Name
-
(
-
Parameters
-
)
-
:
-
ReturnType
-
f
-
Statement
-
g
-
Parameters
-
Parameter
,
-
134
Computations(AttributeEvaluationStatements)
Parameter
-
IdentDecl
-
:
-
NodeType
-
-
-
IdentDecl
-
:
-
EdgeType
-
->
-
var
-
ref
-
IdentDecl
-
:
-
VarType
-
Thefunctiondenitionmustreturnavalue withareturnstatement(sotheremust be
at least one return n statement). . The e type of the onereturn value must be compatible to
thereturntypespeciedinthecomputationdenition. (Areturnstatementmustnotoccur
outsideofacomputationdenition.)
ReturnStatement
-
return
-
(
-
Expression
-
)
-
;
-
FunctionCall
-
Name
-
(
-
Expression
,
-
)
-
EXAMPLE(73)
Anexampleshowinghowfunctionsaredeclaredandused.
1
functionfac(varx:int) :int
2
{
3
if(x>1){
4
return(x *fac(x-1) );
5
}else{
6
return(1 );
7
}
8
}
9
functionfoo(m:N): boolean
10
{
11
defvartmp:int =fac(m.a);
12
tmp=tmp -1;
13
return(m.a< tmp);
14
}
15
testexample:(int)
16
{
17
n:N;
18
if{foo(n);}
19
return(fac(n.a));
20
}
Asuchdenedfunctionmaythenbecalledasanexpressionatomfromanywhereinthe
rulelanguagelewhereanexpressionis required;orevenfromthesequencecomputations
whereanexpressionisrequired.Besidesthebuilt-infunctionsthatarecalledwiththesame
syntax;table12.1andtable12.2listtheglobalbuilt-infunctionsoftherulelanguageata
glance,table12.3liststhebuilt-infunctionscontainedinbuilt-inpackagesataglance.
12.5 ComputationDenitionandCall
135
nodes([NodeType]):set<Node>
edges([EdgeType]):set<Edge>
source(Edge):Node
target(Edge):Node
opposite(Edge,Node):Node
adjacent(Node[,EdgeType[,NodeType]]):set<Node>
adjacentIncoming(Node[,EdgeType[,NodeType]]):set<Node>
adjacentOutgoing(Node[,EdgeType[,NodeType]]):set<Node>
incident(Node[,EdgeType[,NodeType]]):set<Edge>
incoming(Node[,EdgeType[,NodeType]]):set<Edge>
outgoing(Node[,EdgeType[,NodeType]]):set<Edge>
reachable(Node[,EdgeType[,NodeType]]):set<Node>
reachableIncoming(Node[,EdgeType[,NodeType]]):set<Node>
reachableOutgoing(Node[,EdgeType[,NodeType]]):set<Node>
reachableEdges(Node[,EdgeType[,NodeType]]):set<Edge>
reachableEdgesIncoming(Node[,EdgeType[,NodeType]]):set<Edge>
reachableEdgesOutgoing(Node[,EdgeType[,NodeType]]):set<Edge>
boundedReachable(Node,int[,EdgeType[,NodeType]]):set<Node>
boundedReachableIncoming(Node,int[,EdgeType[,NodeType]]):set<Node>
boundedReachableOutgoing(Node,int[,EdgeType[,NodeType]]):set<Node>
boundedReachableEdges(Node,int[,EdgeType[,NodeType]]):set<Edge>
boundedReachableEdgesIncoming(Node,int[,EdgeType[,NodeType]]):set<Edge>
boundedReachableEdgesOutgoing(Node,int[,EdgeType[,NodeType]]):set<Edge>
boundedReachableWithRemainingDepth(Node,int):map<Node, int>
boundedReachableWithRemainingDepthIncoming(Node,int):map<Node, int>
boundedReachableWithRemainingDepthOutgoing(Node,int):map<Node, int>
Thethreefunctionsaboveallowoptionaledgeandnodetypeconstraints,too.
inducedSubgraph(set<Node>):graph
definedSubgraph(set<Edge>):graph
equalsAny(graph, set<graph>):boolean
equalsAnyStructurally(graph, set<graph>):boolean
copy(graph):graph
copy(container):container
copy(match<r>):match<r>
random():double
random(int):int
nameof(Node/Edge/graph):string
uniqueof(Node/Edge/graph):int
nodeByName(string):Node
edgeByName(string):Edge
nodeByUnique(int):Node
edgeByUnique(int):Edge
Table12.1:Globalfunctionsataglance,partI
136
Computations(AttributeEvaluationStatements)
countNodes([NodeType]):int
countEdges([EdgeType]):int
countAdjacent(Node[,EdgeType[,NodeType]]):int
countAdjacentIncoming(Node[,EdgeType[,NodeType]]):int
countAdjacentOutgoing(Node[,EdgeType[,NodeType]]):int
countIncident(Node[,EdgeType[,NodeType]]):int
countIncoming(Node[,EdgeType[,NodeType]]):int
countOutgoing(Node[,EdgeType[,NodeType]]):int
countReachable(Node[,EdgeType[,NodeType]]):int
countReachableIncoming(Node[,EdgeType[,NodeType]]):int
countReachableOutgoing(Node[,EdgeType[,NodeType]]):int
countReachableEdges(Node[,EdgeType[,NodeType]]):int
countReachableEdgesIncoming(Node[,EdgeType[,NodeType]]):int
countReachableEdgesOutgoing(Node[,EdgeType[,NodeType]]):int
countBoundedReachable(Node,int[,EdgeType[,NodeType]]):int
countBoundedReachableIncoming(Node,int[,EdgeType[,NodeType]]):int
countBoundedReachableOutgoing(Node,int[,EdgeType[,NodeType]]):int
countBoundedReachableEdges(Node,int[,EdgeType[,NodeType]]):int
countBoundedReachableEdgesIncoming(Node,int[,EdgeType[,NodeType]]):int
countBoundedReachableEdgesOutgoing(Node,int[,EdgeType[,NodeType]]):int
isAdjacent(Node,Node[,EdgeType[,NodeType]]):boolean
isAdjacentIncoming(Node,Node[,EdgeType[,NodeType]]):boolean
isAdjacentOutgoing(Node,Node[,EdgeType[,NodeType]]):boolean
isIncident(Node,Edge[,EdgeType[,NodeType]]):boolean
isIncoming(Node,Edge[,EdgeType[,NodeType]]):boolean
isOutgoing(Node,Edge[,EdgeType[,NodeType]]):boolean
isReachable(Node,Node[,EdgeType[,NodeType]]):boolean
isReachableIncoming(Node,Node[,EdgeType[,NodeType]]):boolean
isReachableOutgoing(Node,Node[,EdgeType[,NodeType]]):boolean
isReachableEdges(Node,Edge[,EdgeType[,NodeType]]):boolean
isReachableEdgesIncoming(Node,Edge[,EdgeType[,NodeType]]):boolean
isReachableEdgesOutgoing(Node,Edge[,EdgeType[,NodeType]]):boolean
isBoundedReachable(Node,Node,int[,EdgeType[,NodeType]]):boolean
isBoundedReachableIncoming(Node,Node,int[,EdgeType[,NodeType]]):boolean
isBoundedReachableOutgoing(Node,Node,int[,EdgeType[,NodeType]]):boolean
isBoundedReachableEdges(Node,Edge,int[,EdgeType[,NodeType]]):boolean
isBoundedReachableEdgesIncoming(Node,Edge,int[,EdgeType[,NodeType]]):boolean
isBoundedReachableEdgesOutgoing(Node,Edge,int[,EdgeType[,NodeType]]):boolean
Table12.2:Globalfunctionsataglance,partII
Documents you may be interested
Documents you may be interested