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

import ceylon.language.Boolean;
import ceylon.language.Callable;
import ceylon.language.Character;
import ceylon.language.Comparison;
import ceylon.language.Entry;
import ceylon.language.Integer;
import ceylon.language.Iterable;
import ceylon.language.Map;
import ceylon.language.Sequence;
import ceylon.language.Sequential;
import ceylon.language.Some;
import ceylon.language.String;
import ceylon.language.string_;

import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.Ignore;

@Ignore
@Ceylon(major = 3)
public class SequenceString extends String implements Some<Character> {

    public SequenceString(java.lang.String s) {
        super(s);
    }

    @Override
    public boolean getEmpty() {
        return false;
    }

    @Override
    public Sequential<? extends Character> getRest() {
        return span(Integer.instance(1), null);
    }

    @Override
    @Ignore
    public Character getFirst() {
        return item(Integer.instance(0));
    }
    @Override @Ignore
    public Character getLast() {
        return item(getLastIndex());
    }

    @Override
    @Ignore
    public Sequential<? extends Character> getSequence() {
        return $ceylon$language$Iterable$this.getSequence();
    }
    @Override @Ignore
    public Character find(Callable<? extends Boolean> f) {
        return $ceylon$language$Iterable$this.find(f);
    }
    @Override @Ignore
    public Character findLast(Callable<? extends Boolean> f) {
        return $ceylon$language$List$this.findLast(f);
    }
    @Override
    @Ignore
    public Sequential<? extends Character> sort(Callable<? extends Comparison> f) {
        return String.instance(string_.string($ceylon$language$Iterable$this.sort(f)));
    }
    @Override
    @Ignore
    public Iterable<? extends Character> filter(Callable<? extends Boolean> f) {
        return String.instance(string_.string((new FilterIterable<Character>(this, f)).getSequence()));
    }
    @Override @Ignore
    public <Result> Sequential<? extends Result> collect(Callable<? extends Result> f) {
        return new MapIterable<Character,Result>(this, f).getSequence();
    }
    @Override @Ignore
    public Sequential<? extends Character> select(Callable<? extends Boolean> f) {
        return String.instance(string_.string((new FilterIterable<Character>(this, f)).getSequence()));
    }
    @Override
    @Ignore
    public <Result> Result fold(Result ini, Callable<? extends Result> f) {
        return $ceylon$language$Iterable$this.fold(ini, f);
    }
    @Override @Ignore
    public boolean any(Callable<? extends Boolean> f) {
        return $ceylon$language$Iterable$this.any(f);
    }
    @Override @Ignore
    public boolean every(Callable<? extends Boolean> f) {
        return $ceylon$language$Iterable$this.every(f);
    }
    @Override @Ignore
    public Iterable<? extends Character> skipping(long skip) {
        return this.segment(Integer.instance(skip), this.getSize());
    }
    @Override @Ignore
    public Iterable<? extends Character> taking(long take) {
        return this.segment(Integer.instance(0), take);
    }
    @Override @Ignore
    public Iterable<? extends Character> by(long step) {
        return String.instance(string_.string($ceylon$language$Iterable$this.by(step).getSequence()));
    }
    @Override @Ignore
    public long count(Callable<? extends Boolean> f) {
        return $ceylon$language$Iterable$this.count(f);
    }
    @Override @Ignore
    public Iterable<? extends Entry<? extends Integer, ? extends Character>> getIndexed() {
        return $ceylon$language$Iterable$this.getIndexed();
    }
    @SuppressWarnings("rawtypes")
    @Override @Ignore public <Other>Iterable chain(Iterable<? extends Other> other) {
        return $ceylon$language$Iterable$this.chain(other);
    }
    @Override @Ignore
    public <Key> Map<? extends Key, ? extends Sequence<? extends Character>> group(Callable<? extends Key> grouping) {
        return $ceylon$language$Iterable$this.group(grouping);
    }

    @Override @Ignore
    @SuppressWarnings("rawtypes")
    public <Other> Sequence withLeading(Other e) {
        return $ceylon$language$List$this.withLeading(e);
    }
    @Override @Ignore
    @SuppressWarnings("rawtypes")
    public <Other> Sequence withTrailing(Other e) {
        return $ceylon$language$List$this.withTrailing(e);
    }
}

@@ -373,37 +373,8 @@
 al;%0A
-import ceylon.language.Some;%0A
 impo
@@ -400,16 +400,16 @@
 String;%0A
+
 import c
@@ -628,18 +628,22 @@
 ements S
-om
+equenc
 e%3CCharac
@@ -1164,36 +1164,34 @@
    public Sequen
-tial
+ce
 %3C? extends Chara
@@ -1219,32 +1219,53 @@
 %0A        return 
+(Sequence%3CCharacter%3E)
 $ceylon$language
@@ -1623,36 +1623,34 @@
    public Sequen
-tial
+ce
 %3C? extends Chara
@@ -1703,32 +1703,53 @@
 %0A        return 
+(Sequence%3CCharacter%3E)
 String.instance(
@@ -2072,28 +2072,26 @@
 sult%3E Sequen
-tial
+ce
 %3C? extends R
@@ -2152,16 +2152,44 @@
  return 
+(Sequence%3C? extends Result%3E)
 new MapI
@@ -4460,10 +4460,132 @@
 ;%0A    %7D%0A
+    @Override @Ignore%0A    public SequenceString getReversed() %7B%0A        return (SequenceString)super.getReversed();%0A    %7D%0A
 %7D%0A

Fix ceylon/ceylon-compiler#887 by making SequenceString actually implement Sequence