This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Escreva uma classe, chamada Ponto, que representa um ponto no | |
# plano cartesiano. A figura abaixo mostra quais atributos e métodos | |
# da classe. | |
class Ponto | |
attr_reader :x, :y | |
def initialize(x,y) | |
@x = x | |
@y = y |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File | |
import java.io.FileInputStream | |
case class Chunk(length: Int, bytes: Array[Byte]) | |
def fileContentStream(fileIn: FileInputStream): Stream[Chunk] = { | |
val bytes = Array.fill[Byte](1024)(0) | |
val length = fileIn.read(bytes) | |
Chunk(length, bytes) #:: fileContentStream(fileIn) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.xml.{Node, Elem, Group} | |
/** | |
* A path to a Node in a Node tree. | |
*/ | |
sealed trait NodePath { | |
def depth: Int | |
} | |
object NodePath { |
NewerOlder