Skip to content

Commit

Permalink
Union() -> Union{}
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyichao committed Sep 18, 2015
1 parent 3ef0658 commit ca47672
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 27 deletions.
40 changes: 20 additions & 20 deletions src/containerloops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import Base.values
## These are the containers that can be looped over
## The prefix SDM is for SortedDict and SortedMultiDict
## The prefix SS is for SortedSet. The prefix SA
## is for all sorted containers.
## is for all sorted containers.
## The following two definitions now appear in tokens2.jl

#typealias SDMContainer Union(SortedDict, SortedMultiDict)
#typealias SAContainer Union(SDMContainer, SortedSet)
#typealias SDMContainer Union{SortedDict, SortedMultiDict}
#typealias SAContainer Union{SDMContainer, SortedSet}

@inline extractcontainer(s::SAContainer) = s

Expand All @@ -17,7 +17,7 @@ import Base.values

abstract AbstractExcludeLast{ContainerType <: SAContainer}

immutable SDMExcludeLast{ContainerType <: SDMContainer} <:
immutable SDMExcludeLast{ContainerType <: SDMContainer} <:
AbstractExcludeLast{ContainerType}
m::ContainerType
first::Int
Expand All @@ -26,7 +26,7 @@ end



immutable SSExcludeLast{ContainerType <: SortedSet} <:
immutable SSExcludeLast{ContainerType <: SortedSet} <:
AbstractExcludeLast{ContainerType}
m::ContainerType
first::Int
Expand Down Expand Up @@ -65,18 +65,18 @@ eltype(s::AbstractIncludeLast) = eltype(s.m)
## The basic iterations are either over the whole sorted container, an
## exclude-last object or include-last object.

typealias SDMIterableTypesBase Union(SDMContainer,
@compat typealias SDMIterableTypesBase Union{SDMContainer,
SDMExcludeLast,
SDMIncludeLast)
SDMIncludeLast}

typealias SSIterableTypesBase Union(SortedSet,
@compat typealias SSIterableTypesBase Union{SortedSet,
SSExcludeLast,
SSIncludeLast)
SSIncludeLast}


typealias SAIterableTypesBase Union(SAContainer,
@compat typealias SAIterableTypesBase Union{SAContainer,
AbstractExcludeLast,
AbstractIncludeLast)
AbstractIncludeLast}


## The compound iterations are obtained by applying keys(..) or values(..)
Expand Down Expand Up @@ -111,15 +111,15 @@ immutable SSSemiTokenIteration{T <: SSIterableTypesBase}
base::T
end

eltype(s::SSSemiTokenIteration) = @compat Tuple{IntSemiToken,
eltype(s::SSSemiTokenIteration) = @compat Tuple{IntSemiToken,
eltype(extractcontainer(s.base))}


immutable SDMSemiTokenKeyIteration{T <: SDMIterableTypesBase}
base::T
end

eltype(s::SDMSemiTokenKeyIteration) = @compat Tuple{IntSemiToken,
eltype(s::SDMSemiTokenKeyIteration) = @compat Tuple{IntSemiToken,
keytype(extractcontainer(s.base))}


Expand All @@ -128,20 +128,20 @@ immutable SDMSemiTokenValIteration{T <: SDMIterableTypesBase}
base::T
end

eltype(s::SDMSemiTokenValIteration) = @compat Tuple{IntSemiToken,
eltype(s::SDMSemiTokenValIteration) = @compat Tuple{IntSemiToken,
datatype(extractcontainer(s.base))}

typealias SACompoundIterable Union(SDMKeyIteration,
SDMValIteration,
@compat typealias SACompoundIterable Union{SDMKeyIteration,
SDMValIteration,
SDMSemiTokenIteration,
SSSemiTokenIteration,
SDMSemiTokenKeyIteration,
SDMSemiTokenValIteration)
SDMSemiTokenKeyIteration,
SDMSemiTokenValIteration}

@inline extractcontainer(s::SACompoundIterable) = extractcontainer(s.base)

typealias SAIterable Union(SAIterableTypesBase, SACompoundIterable)

@compat typealias SAIterable Union{SAIterableTypesBase, SACompoundIterable}


## All the loops maintain a state which is an object of the
Expand Down
2 changes: 1 addition & 1 deletion src/hashdict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end
@compat typealias Unordered Void
typealias Ordered Int

type HashDict{K,V,O<:Union(Ordered,Unordered)} <: Associative{K,V}
@compat type HashDict{K,V,O<:Union{Ordered,Unordered}} <: Associative{K,V}
slots::Array{UInt8,1}
keys::Array{K,1}
vals::Array{V,1}
Expand Down
6 changes: 3 additions & 3 deletions src/sortedMultiDict.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ typealias SMDToken @compat Tuple{SortedMultiDict, IntSemiToken}
## to Forward

function SortedMultiDict{K,D, Ord <: Ordering}(kk::AbstractArray{K,1},
dd::AbstractArray{D,1},
dd::AbstractArray{D,1},
o::Ord=Forward)
if length(kk) != length(dd)
throw(ArgumentError("SortedMultiDict K and D constructor array arguments must be the same length"))
Expand Down Expand Up @@ -194,9 +194,9 @@ function isequal(m1::SortedMultiDict, m2::SortedMultiDict)
end
end

typealias SDorAssociative Union(Associative, SortedMultiDict)
@compat typealias SDorAssociative Union{Associative,SortedMultiDict}

function mergetwo!{K,D,Ord <: Ordering}(m::SortedMultiDict{K,D,Ord},
function mergetwo!{K,D,Ord <: Ordering}(m::SortedMultiDict{K,D,Ord},
m2::SDorAssociative)
for (k,v) in m2
insert!(m.bt, convert(K,k), convert(D,v), true)
Expand Down
6 changes: 3 additions & 3 deletions src/tokens2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Base.isequal
import Base.colon
import Base.endof

typealias SDMContainer Union(SortedDict, SortedMultiDict)
typealias SAContainer Union(SDMContainer, SortedSet)
@compat typealias SDMContainer Union{SortedDict, SortedMultiDict}
@compat typealias SAContainer Union{SDMContainer, SortedSet}

typealias Token @compat Tuple{SAContainer, IntSemiToken}
typealias SDMToken @compat Tuple{SDMContainer, IntSemiToken}
Expand Down Expand Up @@ -38,7 +38,7 @@ typealias SetToken @compat Tuple{SortedSet, IntSemiToken}
end

## Function advances takes a token and returns the
## next token in the sorted order.
## next token in the sorted order.

@inline function advance(ii::Token)
not_pastend(ii)
Expand Down

0 comments on commit ca47672

Please sign in to comment.