alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (bug657.scala)

This example Scala source code file (bug657.scala) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

baselist, linkedlist, linkedlist, matchable, matchableimpl, matchableimpl, matcher, node, node, nodeimpl, nodeimpl, offsetlist, precedenceparser, prioritytree

The Scala bug657.scala source code

abstract class BaseList {
  type Node <: NodeImpl;
  implicit def convertNode(ni : NodeImpl) = ni.asInstanceOf[Node];
  abstract class NodeImpl;
}
abstract class LinkedList extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}
trait OffsetList extends LinkedList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;
}

trait PriorityTree extends BaseList {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl {
    def chop : Node = this;
  }
}

trait PrecedenceParser  extends LinkedList with PriorityTree {
  type Node <: NodeImpl;
  trait NodeImpl extends super[LinkedList].NodeImpl with super[PriorityTree].NodeImpl;
}

trait Matcher extends PrecedenceParser {
  type Node <: NodeImpl;
  trait NodeImpl extends super.NodeImpl;

  type Matchable <: Node with MatchableImpl;
  implicit def convertMatchable(m : MatchableImpl) = m.asInstanceOf[Matchable];
  trait MatchableImpl extends NodeImpl {
    override def chop : Node = {
      Console.println("passed"); super.chop;
    }
  }
}

class Test1 extends OffsetList with Matcher {
  type Node = NodeImpl;
  trait NodeImpl extends super[OffsetList].NodeImpl with super[Matcher].NodeImpl;
  class MatchableImpl extends super.MatchableImpl with NodeImpl;
  type Matchable = MatchableImpl;
}

object Test extends App {
  val test = new Test1;
  val m = new test.MatchableImpl;
  m.chop;
}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala bug657.scala source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.