Java Reference
In-Depth Information
-
Given a signal
s
, we first wish to invert it: that is, to obtain its logical
negation. For example, the invert of
signal1
is:
true
false
t=0
t=1
t=3
t=4
Write a function
static
Signal invert (Signal s)
performing this process.
Your function shall not modify the original signal. That is, you need
to create a
new
Signal
. The time complexity of this function should
not depend on the length of the transition states in
s
.
-
Given a signal
s
and time tick
t
,wewanttocompute
s
(
t
) that
is the value (
true
or
false
) of the signal
s
at time
t
. Write an
it-
erative
function
static boolean
valueAt(Signal s,
int
time)
performing
this task. You shall not modify signal
s
, and the time complexity
should be proportional to the number of transition states in
s
.
-
We would like a function that displays a signal as a sequence of
intervals with respective values. For example,
−
inf
−>
+inf
:
false
means that the signal uniformly takes value
false
.For
signal1
,the
display function shall produce the output:
−
inf
−>
1.0 :
false
1.0
−>
3.0 :
true
3.0
−>
4.0 :
false
4.0
−>
+inf
:
true
Write such an
iterative
function
static void
print(Signal s)
.
-
Given a signal
s
, we would like to produce another signal identical
to
s
but shifted in time by a step
δ>
0. That is, we want a signal
with the same initial value but with transition states (
τ
i
) defined by
τ
i
=
τ
i
+
δ,
∀
i
∈{
1
,...,n
}
.
To illustrate this operation, the shifted signal of
signal1
with
δ
=3
produces the following result:
Search WWH ::
Custom Search