Skip to content

Commit ba9ecd8

Browse files
committed
Resolve deprecation: abstract type ... end
1 parent 2936429 commit ba9ecd8

4 files changed

Lines changed: 27 additions & 8 deletions

File tree

REQUIRE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
julia 0.5
22
DataStructures
3+
Compat

src/base.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
abstract Environment
1+
using Compat
2+
3+
@compat abstract type Environment end
24

35
"""
46
The parent type for all events.
@@ -15,7 +17,7 @@ Once the events is scheduled, it has a value.
1517
1618
An event has also a list of callbacks. A callback can be any function as long as it accepts an instance of a subtype of `AbstractEvent` as its first argument. Once an event gets triggered, all callbacks will be invoked. Callbacks can do further processing with the value it has produced.
1719
"""
18-
abstract AbstractEvent{E<:Environment}
20+
@compat abstract type AbstractEvent{E<:Environment} end
1921

2022
@enum EVENT_STATE idle=0 scheduled=1 triggered=2
2123

@@ -43,6 +45,18 @@ function BaseEvent{E<:Environment}(env::E) :: BaseEvent
4345
BaseEvent{E}(env)
4446
end
4547

48+
# type BaseEvent{E<:Environment}
49+
# env :: E
50+
# id :: UInt
51+
# cid :: UInt
52+
# callbacks :: DataStructures.PriorityQueue{Function, UInt}
53+
# state :: EVENT_STATE
54+
# value :: Any
55+
# function BaseEvent{E}(env::E) where E<:Environment
56+
# new(env, env.eid+=one(UInt), zero(UInt), DataStructures.PriorityQueue(Function, UInt), idle, nothing)
57+
# end
58+
# end
59+
4660
function show(io::IO, ev::AbstractEvent)
4761
print(io, "$(typeof(ev)) $(ev.bev.id)")
4862
end

src/resources/base.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
abstract ResourceKey
1+
using Compat
22

3-
abstract AbstractResource{E<:Environment}
3+
@compat abstract type ResourceKey end
44

5-
abstract ResourceEvent{E<:Environment} <: AbstractEvent{E}
5+
@compat abstract type AbstractResource{E<:Environment} end
6+
7+
@compat abstract type ResourceEvent{E<:Environment} <: AbstractEvent{E} end
68

79
type Put{E<:Environment} <: ResourceEvent{E}
810
bev :: BaseEvent{E}

src/resources/containers.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
using Compat
2+
13
type ContainerKey{N<:Number} <: ResourceKey
24
priority :: Int
35
id :: UInt
@@ -20,7 +22,7 @@ function Container{N<:Number, E<:Environment}(env::E, capacity::N; level::N=zero
2022
Container{N, E}(env, capacity, level)
2123
end
2224

23-
typealias Resource{E<:Environment} Container{Int, E}
25+
@compat const Resource{E<:Environment} = Container{Int, E}
2426

2527
function Resource{E<:Environment}(env::E, capacity::Int=1; level::Int=0) :: Resource{E}
2628
Resource{E}(env, capacity, level)
@@ -34,7 +36,7 @@ function Put{N<:Number, E<:Environment}(con::Container{N, E}, amount::N; priorit
3436
return put_ev
3537
end
3638

37-
typealias Request Put
39+
const Request = Put
3840

3941
Request{E<:Environment}(res::Resource{E}; priority::Int=0) = Put(res, 1, priority=priority)
4042

@@ -59,7 +61,7 @@ function Get{N<:Number, E<:Environment}(con::Container{N, E}, amount::N; priorit
5961
return get_ev
6062
end
6163

62-
typealias Release Get
64+
const Release = Get
6365

6466
Release{E<:Environment}(res::Resource{E}; priority::Int=0) = Get(res, 1, priority=priority)
6567

0 commit comments

Comments
 (0)