Newer
Older
pushpullRefactoringExperiments / programs / TempPull.html
<!DOCTYPE HTML>
<html lang="ja">
<head>
<title>華氏摂氏変換プログラム(PULL)</title>
    <meta charset="UTF-8">
    <!--    <link rel="stylesheet" href="sample.css">-->
    <!-- XRegExp is bundled with the final shCore.js during build -->
    <script type="text/javascript" src="../syntaxhighlighter-3.0.83/scripts/XRegExp.js"></script>
    <script type="text/javascript" src="../syntaxhighlighter-3.0.83/scripts/shCore.js"></script>
    <script type="text/javascript" src="../syntaxhighlighter-3.0.83/scripts/shBrushJava.js"></script>
    <link rel="stylesheet" href="../syntaxhighlighter-3.0.83/styles/shCoreEclipse.css" type="text/css" />
    <link rel="stylesheet" href="../syntaxhighlighter-3.0.83/styles/shThemeEclipse.css" type="text/css" />
    <script type="text/javascript">
        SyntaxHighlighter.all();
    </script>
</head>

<body>
<h1>華氏摂氏変換プログラム(PULL)</h1>

<div style="padding: 10px; margin-bottom: 10px; border: 1px solid #333333; border-radius: 10px;">
<pre class="brush:java; gutter:false" id="E">
    public class Main {
        public static void main(String[] args) {
            TempF tempF = new TempF();
            TempC tempC = new TempC(tempF);
            tempF.setValue(68);
            System.out.println(tempC.getValue());
        }
    }

    public class TempF {
        double value;

        public TempF() {
        }

        public void setValue(double tempF) {
            this.value = tempF;
        }

        public double getValue() {
            return value;
        }
    }

    public class TempC {
        TempF tempF;

        public TempC(TempF tempF) {
            this.tempF = tempF;
        }

        public double getValue() {
            return (tempF.getValue() - 32) / 1.8;
        }
    }
</pre>
</div>
</body>