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
306c795c
Commit
306c795c
authored
Jun 23, 2015
by
Chinmay Garde
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor: Add stubs for the symbol and solver
parent
e788fe53
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
2 deletions
+51
-2
cassowary.dart
packages/cassowary/lib/cassowary.dart
+1
-0
constant_member.dart
packages/cassowary/lib/constant_member.dart
+1
-0
constraint.dart
packages/cassowary/lib/constraint.dart
+12
-2
solver.dart
packages/cassowary/lib/solver.dart
+22
-0
symbol.dart
packages/cassowary/lib/symbol.dart
+13
-0
cassowary_test.dart
packages/cassowary/test/cassowary_test.dart
+2
-0
No files found.
packages/cassowary/lib/cassowary.dart
View file @
306c795c
...
...
@@ -11,3 +11,4 @@ part 'variable.dart';
part
'equation_member.dart'
;
part
'constant_member.dart'
;
part
'solver.dart'
;
part
'symbol.dart'
;
packages/cassowary/lib/constant_member.dart
View file @
306c795c
...
...
@@ -6,6 +6,7 @@ part of cassowary;
class
ConstantMember
extends
EquationMember
{
double
value
=
0.0
;
ConstantMember
(
this
.
value
);
Expression
asExpression
()
=>
new
Expression
([],
this
.
value
);
...
...
packages/cassowary/lib/constraint.dart
View file @
306c795c
...
...
@@ -9,9 +9,19 @@ enum Relation { equalTo, lessThanOrEqualTo, greaterThanOrEqualTo, }
class
Constraint
{
final
Relation
relation
;
final
Expression
expression
;
double
priority
=
1000.0
;
final
bool
required
;
Constraint
(
this
.
expression
,
this
.
relation
);
static
const
double
requiredPriority
=
1000.0
;
double
_priority
=
requiredPriority
-
1.0
;
Constraint
(
this
.
expression
,
this
.
relation
)
:
this
.
required
=
false
;
Constraint
.
Required
(
this
.
expression
,
this
.
relation
)
:
this
.
required
=
true
{
this
.
priority
=
requiredPriority
;
}
double
get
priority
=>
required
?
requiredPriority
:
_priority
;
set
priority
(
double
p
)
=>
_priority
=
required
?
requiredPriority
:
p
.
clamp
(
0.0
,
requiredPriority
-
1.0
);
Constraint
operator
|(
double
p
)
=>
this
..
priority
=
p
;
}
packages/cassowary/lib/solver.dart
View file @
306c795c
...
...
@@ -13,5 +13,27 @@ class Solver {
return
false
;
}
bool
hasConstraint
(
Constraint
c
)
{
return
false
;
}
bool
addEditVariable
(
Variable
v
,
double
priority
)
{
return
false
;
}
bool
removeEditVariable
(
Variable
v
)
{
return
false
;
}
bool
hasEditVariable
(
Variable
v
)
{
return
false
;
}
bool
suggestVariable
(
Variable
v
,
double
value
)
{
return
false
;
}
void
updateVariable
()
{}
Solver
operator
<<(
Constraint
c
)
=>
this
..
addConstraint
(
c
);
}
packages/cassowary/lib/symbol.dart
0 → 100644
View file @
306c795c
// Copyright (c) 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
part of
cassowary
;
enum
SymbolType
{
invalid
,
external
,
slack
,
error
,
dummy
,
}
class
Symbol
{
SymbolType
type
;
Symbol
(
this
.
type
);
}
packages/cassowary/test/cassowary_test.dart
View file @
306c795c
...
...
@@ -280,6 +280,8 @@ void main() {
var
c1
=
right
-
left
>=
CM
(
200.0
);
var
c2
=
right
+
left
>=
CM
(
0.0
);
expect
((
right
>=
left
)
is
Constraint
,
true
);
// TODO: Add assertions for this
s
<<
c1
<<
c2
;
});
...
...
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