2016-11-02 7 views
0

나는 에펠에서 제 A linked_list은 "주름"에 대한 "print_min_fold"를 만들기 위해 노력하고, 에펠에서 :오류 얻기 "VEVI을 : 변수가 제대로 설정되지 않았습니다"너무

------- ----------------- Schnipp :

class PF_HP 


create 
make 

feature --Queries: 
-- n : NONE; 

grid: separate GRID; 

seq: BOOL_STRING; 
strseq: STRING; 
iseq: INTEGER; 

zero, one: BOOLEAN; 

fold: STRING; 

folds: LINKED_LIST[STRING]; 

losses, indices: LINKED_LIST[INTEGER]; 
-- indices: ARRAY[INTEGER]; 

i: INTEGER; 
loss, min: INTEGER 
--Constructor: 

make 
    do 

min:=9999 
loss:=0 

from 
    io.put_string("       123456789%N") 
    io.put_string ("Bitte Bitsequenz eingeben: ") 
    io.read_line 
until 
     (not io.last_string.is_empty) --and then io.last_string.is_bit 
loop 
    io.put_string("%N") 
    io.put_string("Keine Bitsequenz eingegeben. Besteht nur aus 0 und 1 in beliebiger Reihenfolge!%N") 
    io.put_string("       123456789%N") 
    io.put_string ("Bitte Bitsequenz eingeben: ") 
    io.read_line 
    end 
-- iseq:=io.last_integer 
strseq:=io.last_string 
create folds.make 
create losses.make 
create indices.make --from_collection(losses) 
create fold.make(strseq.count-1) 
create seq.make(strseq.count) 
--create zero.make 

zero:=False 
one:=True 

------------------------ --- 등 ...

print_min_fold 
do 
    folds.do_all(agent print_item(?)) 

end 

print_item(item: STRING) 
    do 
    number := number + 1 
    io.put_character('#') 
    io.put_integer(number) 
    io.put_character(' ') 
    io.put_string(item) 
    io.put_character('%N') 
    end -- print_item 

----------------------------------- Schnapp

내가받을 수 있나요 오류 :

Error code: VEVI 

Error: variable is not properly set. 
What to do: ensure the variable is properly set by the corresponding 
setter instruction. 

Class: PF_HP 
Feature: print_min_fold 
Creation procedure: make declared in PF_HP 
Attribute(s): grid 
Line: 400 
do 
-> folds.do_all(agent print_item(?)) 

답변

1

grid이 객체를 부착하기 전에 print_min_fold가 호출 것 같습니다. 호출 할 수 print_min_fold 전에 grid 초기화해야합니다.

griddetachable separate으로 표시 할 수 있지만 개체 테스트를 사용하여 호출하기 전에 무효가 아닌지 확인해야합니다.