Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
2152de9a
Commit
2152de9a
authored
Jun 22, 2015
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor: Add support for priority updates on constraints
parent
f6a32362
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
0 deletions
+14
-0
constraint.dart
packages/cassowary/lib/constraint.dart
+2
-0
expression.dart
packages/cassowary/lib/expression.dart
+1
-0
cassowary_test.dart
packages/cassowary/test/cassowary_test.dart
+11
-0
No files found.
packages/cassowary/lib/constraint.dart
View file @
2152de9a
...
...
@@ -12,4 +12,6 @@ class Constraint {
double
priority
=
1000.0
;
Constraint
(
this
.
expression
,
this
.
relation
);
Constraint
operator
|(
double
p
)
=>
this
..
priority
=
p
;
}
packages/cassowary/lib/expression.dart
View file @
2152de9a
...
...
@@ -6,6 +6,7 @@ part of cassowary;
class
Expression
extends
EquationMember
{
final
List
<
Term
>
terms
;
final
double
constant
;
double
get
value
=>
terms
.
fold
(
constant
,
(
value
,
term
)
=>
value
+
term
.
value
);
...
...
packages/cassowary/test/cassowary_test.dart
View file @
2152de9a
...
...
@@ -259,4 +259,15 @@ void main() {
expect
(
c3
.
expression
.
constant
,
-
30.0
);
expect
(
c3
.
relation
,
Relation
.
lessThanOrEqualTo
);
});
test
(
'constraint_strength_update'
,
()
{
var
left
=
new
Variable
(
2.0
);
var
right
=
new
Variable
(
10.0
);
var
c
=
(
right
-
left
>=
200.0
)
|
750.0
;
expect
(
c
is
Constraint
,
true
);
expect
(
c
.
expression
.
terms
.
length
,
2
);
expect
(
c
.
expression
.
constant
,
-
200.0
);
expect
(
c
.
priority
,
750.0
);
});
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment