package com.redhat.ceylon.compiler.java.language;


import ceylon.language.Iterable;
import ceylon.language.finished_;
import ceylon.language.impl.BaseIterable;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Class;
import com.redhat.ceylon.compiler.java.metadata.Ignore;
import com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor;

/** 
 * A non-user-visible class that helps create iterables in 
 * generated bytecode. The {@link #iterator()} method should 
 * return a new instance in every call.
 * 
 * @author Enrique Zamudio
 */
@Ceylon(major = 7)
@Class
public abstract class AbstractIterable<Element,Absent>
extends BaseIterable<Element,Absent>  {
    
    @Ignore
    private TypeDescriptor $reifiedElement;
    @Ignore
    private TypeDescriptor $reifiedAbsent;
    
    @Ignore
    private final Iterable<?,?>[] $iterables;

    public AbstractIterable(@Ignore TypeDescriptor $reifiedElement, 
    		@Ignore TypeDescriptor $reifiedAbsent) {
    	super($reifiedElement, $reifiedAbsent);
        this.$iterables = null;
    }
    
    public AbstractIterable(@Ignore TypeDescriptor $reifiedElement, 
    		@Ignore TypeDescriptor $reifiedAbsent, 
    		Iterable<?,?>... iterables) {
    	super($reifiedElement, $reifiedAbsent);
    	this.$reifiedElement = $reifiedElement;
    	this.$reifiedAbsent = $reifiedAbsent;
        this.$iterables = iterables;
    }
    
    @Ignore
    public Iterable<?,?>[] $getIterables$() {
        return $iterables;
    }
    
    @Override
    public boolean getEmpty() {
        return iterator().next() == finished_.get_();
    }
    
    @Override
    @Ignore
    public final TypeDescriptor $getType$() {
        return TypeDescriptor.klass(AbstractIterable.class, 
        		$reifiedElement, $reifiedAbsent);
    }
}

@@ -49,41 +49,8 @@
 ;%0A%0A%0A
-import ceylon.language.Iterable;%0A
 impo
@@ -683,24 +683,26 @@
 nt%3E  %7B%0A    %0A
+//
     @Ignore%0A
@@ -693,32 +693,34 @@
  %0A//    @Ignore%0A
+//
     private Type
@@ -743,24 +743,26 @@
 iedElement;%0A
+//
     @Ignore%0A
@@ -753,32 +753,34 @@
 ;%0A//    @Ignore%0A
+//
     private Type
@@ -806,21 +806,25 @@
 Absent;%0A
+//
     %0A
+//
     @Ign
@@ -823,24 +823,26 @@
     @Ignore%0A
+//
     private 
@@ -1033,24 +1033,26 @@
 iedAbsent);%0A
+//
         this
@@ -1078,24 +1078,26 @@
 %0A    %7D%0A    %0A
+//
     public A
@@ -1145,32 +1145,34 @@
 eifiedElement, %0A
+//
     %09%09@Ignore Ty
@@ -1197,24 +1197,26 @@
 iedAbsent, %0A
+//
     %09%09Iterab
@@ -1235,24 +1235,26 @@
 terables) %7B%0A
+//
     %09super($
@@ -1282,24 +1282,26 @@
 iedAbsent);%0A
+//
     %09this.$r
@@ -1329,24 +1329,26 @@
 iedElement;%0A
+//
     %09this.$r
@@ -1378,16 +1378,18 @@
 Absent;%0A
+//
         
@@ -1413,35 +1413,41 @@
  iterables;%0A
+//
     %7D%0A
+//
     %0A
+//
     @Ignore%0A
@@ -1438,32 +1438,34 @@
  %0A//    @Ignore%0A
+//
     public Itera
@@ -1490,24 +1490,26 @@
 rables$() %7B%0A
+//
         retu
@@ -1523,16 +1523,18 @@
 rables;%0A
+//
     %7D%0A  
@@ -1639,32 +1639,34 @@
 _();%0A    %7D%0A    %0A
+//
     @Override%0A  
@@ -1659,24 +1659,26 @@
   @Override%0A
+//
     @Ignore%0A
@@ -1677,16 +1677,18 @@
 @Ignore%0A
+//
     publ
@@ -1721,24 +1721,26 @@
 etType$() %7B%0A
+//
         retu
@@ -1788,16 +1788,18 @@
 class, %0A
+//
         
@@ -1834,16 +1834,18 @@
 bsent);%0A
+//
     %7D%0A%7D%0A

comment out seemingly obsolete code