[ja] apply patch]

This commit is contained in:
Shin Kojima
2014-09-21 21:31:26 +09:00
parent 1a33aa5c35
commit dace4fa9c5

View File

@@ -156,7 +156,7 @@ methodはstructの上でしか使用されないのでしょうか当然違
b.color = c
}
func (bl BoxList) BiggestsColor() Color {
func (bl BoxList) BiggestColor() Color {
v := 0.00
k := Color(WHITE)
for _, b := range bl {
@@ -192,13 +192,13 @@ methodはstructの上でしか使用されないのでしょうか当然違
fmt.Printf("We have %d boxes in our set\n", len(boxes))
fmt.Println("The volume of the first one is", boxes[0].Volume(), "cm³")
fmt.Println("The color of the last one is",boxes[len(boxes)-1].color.String())
fmt.Println("The biggest one is", boxes.BiggestsColor().String())
fmt.Println("The biggest one is", boxes.BiggestColor().String())
fmt.Println("Let's paint them all black")
boxes.PaintItBlack()
fmt.Println("The color of the second one is", boxes[1].color.String())
fmt.Println("Obviously, now, the biggest one is", boxes.BiggestsColor().String())
fmt.Println("Obviously, now, the biggest one is", boxes.BiggestColor().String())
}
上のコードはconstでいくつかの定数を定義しています。その後カスタム定義型を定義しています。
@@ -211,8 +211,8 @@ methodはstructの上でしか使用されないのでしょうか当然違
- Volume()はレシーバをBoxとして定義します。Boxの堆積を返します。
- SetColor(c Color)はBoxの色をcに変更します。
- BiggestsColor()はBoxListに定義されており、listの中の体積が最大の色を返します。
- PointItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。
- BiggestColor()はBoxListに定義されており、listの中の体積が最大の色を返します。
- PaintItBlack()はBoxListのすべてのBoxの色を全部黒に変更します。
- String()はColorに定義されており、Colorno具体的な色を返します文字列形式
上のコードは文字で書くと非常に簡単に思えませんか?私達は問題を解決する場合問題の描写を通して、対応するコードを書くことで実現します。