Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tla2bAST
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
tla2bAST
Commits
be2f1e81
Commit
be2f1e81
authored
7 months ago
by
Jan Gruteser
Browse files
Options
Downloads
Patches
Plain Diff
delete unused Indentation class
parent
1c8843a6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/de/tla2b/output/Indentation.java
+0
-140
0 additions, 140 deletions
src/main/java/de/tla2b/output/Indentation.java
with
0 additions
and
140 deletions
src/main/java/de/tla2b/output/Indentation.java
deleted
100644 → 0
+
0
−
140
View file @
1c8843a6
package
de.tla2b.output
;
import
de.be4.classicalb.core.parser.analysis.DepthFirstAdapter
;
import
de.be4.classicalb.core.parser.node.*
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.Hashtable
;
import
java.util.List
;
public
class
Indentation
extends
DepthFirstAdapter
{
private
final
Hashtable
<
Node
,
Integer
>
indentation
=
new
Hashtable
<>();
private
final
HashSet
<
Node
>
newlineMiddle
=
new
HashSet
<>();
private
final
HashSet
<
Node
>
nodesWithNewlineAtTheEnd
=
new
HashSet
<>();
private
final
HashSet
<
Node
>
indentedNodes
=
new
HashSet
<>();
public
final
static
String
INDENT
=
" "
;
public
final
static
String
SPACE
=
" "
;
public
Indentation
(
Start
start
)
{
start
.
apply
(
this
);
}
@Override
public
void
defaultIn
(
final
Node
node
)
{
if
(
node
.
parent
()
!=
null
)
{
if
(!
indentation
.
containsKey
(
node
))
{
setIndentation
(
node
,
getIndentNumber
(
node
.
parent
()));
}
}
}
private
void
addIndentedNode
(
final
Node
node
)
{
indentedNodes
.
add
(
node
);
}
private
void
addNewlineNode
(
final
Node
node
)
{
newlineMiddle
.
add
(
node
);
}
@Override
public
void
caseASetsMachineClause
(
ASetsMachineClause
node
)
{
List
<
PSet
>
copy
=
new
ArrayList
<>(
node
.
getSetDefinitions
());
for
(
PSet
e
:
copy
)
{
setIndentation
(
e
,
getIndentNumber
(
node
)
+
1
);
addIndentedNode
(
e
);
e
.
apply
(
this
);
}
}
@Override
public
void
caseAConstantsMachineClause
(
AConstantsMachineClause
node
)
{
List
<
PExpression
>
copy
=
new
ArrayList
<>(
node
.
getIdentifiers
());
for
(
PExpression
e
:
copy
)
{
setIndentation
(
e
,
getIndentNumber
(
node
)
+
1
);
addIndentedNode
(
e
);
e
.
apply
(
this
);
}
}
public
void
inAPropertiesMachineClause
(
APropertiesMachineClause
node
)
{
setIndentation
(
node
.
getPredicates
(),
getIndentNumber
(
node
)
+
1
);
addIndentedNode
(
node
.
getPredicates
());
}
@Override
public
void
inAConjunctPredicate
(
AConjunctPredicate
node
)
{
defaultIn
(
node
);
addNewlineNode
(
node
);
}
@Override
public
void
inAForallPredicate
(
AForallPredicate
node
)
{
defaultIn
(
node
);
setIndentation
(
node
.
getImplication
(),
getIndentNumber
(
node
)
+
2
);
}
@Override
public
void
inAExistsPredicate
(
AExistsPredicate
node
)
{
defaultIn
(
node
);
setIndentation
(
node
.
getPredicate
(),
getIndentNumber
(
node
)
+
2
);
}
@Override
public
void
inAImplicationPredicate
(
AImplicationPredicate
node
)
{
defaultIn
(
node
);
addNewlineNode
(
node
);
}
public
void
inAPredicateDefinitionDefinition
(
APredicateDefinitionDefinition
node
)
{
indentation
.
put
(
node
.
getRhs
(),
0
);
}
public
boolean
printNewLineInTheMiddle
(
Node
node
)
{
return
newlineMiddle
.
contains
(
node
);
}
public
void
setIndentation
(
Node
node
,
Integer
i
)
{
indentation
.
put
(
node
,
i
);
}
public
void
setNewlineAtTheEnd
(
Node
node
)
{
nodesWithNewlineAtTheEnd
.
add
(
node
);
}
public
Integer
getIndentNumber
(
Node
node
)
{
Integer
res
=
indentation
.
get
(
node
);
if
(
res
==
null
)
{
res
=
0
;
}
return
res
;
}
public
StringBuilder
getIndent
(
Node
node
)
{
StringBuilder
sb
=
new
StringBuilder
();
Integer
i
=
indentation
.
get
(
node
);
if
(
i
==
null
)
{
i
=
0
;
}
for
(
int
j
=
0
;
j
<
i
;
j
++)
{
sb
.
append
(
INDENT
);
}
return
sb
;
}
public
boolean
isNewline
(
Node
node
)
{
return
nodesWithNewlineAtTheEnd
.
contains
(
node
);
}
public
static
String
getIdent
()
{
return
INDENT
;
}
public
boolean
isIndentedNode
(
final
Node
node
)
{
return
indentedNodes
.
contains
(
node
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment